Skip to content

Instantly share code, notes, and snippets.

@ikedaisuke
Created March 23, 2011 16:28
Show Gist options
  • Save ikedaisuke/883394 to your computer and use it in GitHub Desktop.
Save ikedaisuke/883394 to your computer and use it in GitHub Desktop.
reverse (reverse xs) ≡ xs in Coq
Require Import Coq.Lists.List.
Lemma rev_Unfold : forall {A:Type} (l:list A) (a:A), rev (a::l) = rev l ++ (cons a nil).
Proof.
intros.
simpl.
reflexivity.
Qed.
Theorem rev_Involutive : forall {A:Type} (l:list A), rev (rev l) = l.
Proof.
intros.
induction l.
reflexivity.
rename IHl into InductiveHypothesisOfl.
rewrite rev_Unfold.
rewrite rev_app_distr.
simpl.
rewrite InductiveHypothesisOfl.
reflexivity.
Qed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment