mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-09-11 21:37:48 +03:00
[ base ] Properties of indexing after replaceAt
were added for Vect
This commit is contained in:
parent
941e3963fa
commit
0749165245
@ -198,6 +198,20 @@ export
|
||||
merge : Ord elem => Vect n elem -> Vect m elem -> Vect (n + m) elem
|
||||
merge = mergeBy compare
|
||||
|
||||
-- Properties for functions in this section --
|
||||
|
||||
export
|
||||
replaceAtSameIndex : (xs : Vect n a) -> (i : Fin n) -> (0 y : a) -> index i (replaceAt i y xs) = y
|
||||
replaceAtSameIndex (_::_) FZ _ = Refl
|
||||
replaceAtSameIndex (_::_) (FS _) _ = replaceAtSameIndex _ _ _
|
||||
|
||||
export
|
||||
replaceAtDiffIndexPreserves : (xs : Vect n a) -> (i, j : Fin n) -> Not (i = j) -> (0 y : a) -> index i (replaceAt j y xs) = index i xs
|
||||
replaceAtDiffIndexPreserves (_::_) FZ FZ co _ = absurd $ co Refl
|
||||
replaceAtDiffIndexPreserves (_::_) FZ (FS _) _ _ = Refl
|
||||
replaceAtDiffIndexPreserves (_::_) (FS _) FZ _ _ = Refl
|
||||
replaceAtDiffIndexPreserves (_::_) (FS z) (FS w) co y = replaceAtDiffIndexPreserves _ z w (co . cong FS) y
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Transformations
|
||||
--------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user