{-@ set :: forall <p :: Int -> a -> Prop>.
             a:Arr<p> a -> i:Upto (alen a) -> a<p i> -> {v:Arr<p> a | alen v = alen a}
  @-}
set a@(A _ f) i v = a { aval = \j -> if (i == j) then v else f j }
set a@(A _ f) i v = a { aval = \j -> if (i == j) then v else f j }
set a@(A _ f) i v = a { aval = \j -> if (i == j) then v else f j }