Add proof that list reverse is involutory.

This commit is contained in:
Mathew Polzin 2020-12-28 17:30:24 -08:00
parent 0eef8e58f9
commit bc76809288

View File

@ -670,6 +670,14 @@ revAppend (v :: vs) ns
rewrite appendAssociative (reverse ns) (reverse vs) [v] in
Refl
||| List reverse applied twice yields the identity function.
export
reverseInvolutory : (xs : List a) -> reverse (reverse xs) = xs
reverseInvolutory [] = Refl
reverseInvolutory (x :: xs) = rewrite revOnto [x] xs in
rewrite sym (revAppend (reverse xs) [x]) in
cong (x ::) $ reverseInvolutory xs
export
dropFusion : (n, m : Nat) -> (l : List t) -> drop n (drop m l) = drop (n+m) l
dropFusion Z m l = Refl