Skip to content

Commit 7a4cf80

Browse files
committed
Proofs of preserving the last were added for + and *.
1 parent 2b6d2ad commit 7a4cf80

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

libs/contrib/Data/Fin/Extra.idr

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,16 @@ finToNat_mult_linearity (FS x) y {a=S i} = rewrite finToNat_plus_linearity y (x
172172
rewrite finToNat_mult_linearity x y in
173173
Refl
174174

175+
export
176+
plus_preserves_last : (a, b : Nat) -> Fin.last {n=a} + Fin.last {n=b} = Fin.last
177+
plus_preserves_last Z b = rewrite weakenNZero_preserves $ Fin.last {n=b} in Refl
178+
plus_preserves_last (S k) b = rewrite plus_preserves_last k b in Refl
179+
180+
export
181+
mult_preserves_last : (a, b : Nat) -> Fin.last {n=a} * Fin.last {n=b} = Fin.last
182+
mult_preserves_last Z b = Refl
183+
mult_preserves_last (S k) b = rewrite mult_preserves_last k b in plus_preserves_last _ _
184+
175185
export
176186
plusSuccRightSucc : {a, b : Nat} -> (left : Fin $ S a) -> (right : Fin $ S b) -> FS (left + right) = rewrite plusSuccRightSucc a b in left + FS right
177187
plusSuccRightSucc FZ right = rewrite plusCommutative a b in Refl

0 commit comments

Comments
 (0)