Skip to content

Instantly share code, notes, and snippets.

@etosch
Created July 12, 2013 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etosch/5987951 to your computer and use it in GitHub Desktop.
Save etosch/5987951 to your computer and use it in GitHub Desktop.
From the list chapter in the Coq book.
(* There is a short solution to the next exercise.
If you find yourself getting tangled up, step back and try to look for a simpler way. *)
Theorem app_ass4 : forall l1 l2 l3 l4 : natlist,
l1 ++ (l2 ++ (l3 ++ l4)) = ((l1 ++ l2) ++ l3) ++ l4.
Proof.
intros l1 l2 l3 l4.
Theorem app_right : forall l1 l2 l3 : natlist,
l1 ++ (l2 ++ l3) = (l1 ++ l2) ++ l3.
Proof.
intros l1 l2 l3.
induction l1 as [|h1 t1]. reflexivity.
simpl. rewrite -> IHt1. reflexivity.
Qed.
rewrite <- app_right. rewrite app_right. reflexivity.
Qed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment