Skip to content

Instantly share code, notes, and snippets.

@gallais
Created September 2, 2015 23:42
Show Gist options
  • Save gallais/f05268a5640e66ac712b to your computer and use it in GitHub Desktop.
Save gallais/f05268a5640e66ac712b to your computer and use it in GitHub Desktop.
Require Import Equations.
Require Import List.
Require String. Open Scope string_scope.
Ltac Case str :=
let val := eval compute in (String.append "case " str)
in idtac val.
Equations append {A : Type} (xs ys : list A) : list A
:= append A [] ys := ys
; append A (cons x xs) ys := cons x (append xs ys).
Theorem append_neutral :
forall {A} (xs : list A), append xs nil = xs.
Proof.
induction 0 as [|hd tl].
- Case "[]".
assert (H0 : @append A [] [] = [])
by apply append_equation_1.
exact H0.
- Case "hd :: tl".
assert (H1 : append (hd :: tl) [] = hd :: append tl [])
by apply append_equation_2.
assert (H2 : append (hd :: tl) [] = hd :: tl)
by (rewrite H1, IHtl; trivial).
exact H2.
Qed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment