Created
September 2, 2015 23:42
-
-
Save gallais/f05268a5640e66ac712b to your computer and use it in GitHub Desktop.
Using Sozeau's equations to mimick http://researchblogs.cs.bham.ac.uk/thelablunch/2015/09/a-simple-proof-checker-for-teaching/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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