Skip to content

Instantly share code, notes, and snippets.

@MikeMKH
Created April 18, 2017 11:32
Show Gist options
  • Select an option

  • Save MikeMKH/50cf71c91b7843071d1949a56876ff8c to your computer and use it in GitHub Desktop.

Select an option

Save MikeMKH/50cf71c91b7843071d1949a56876ff8c to your computer and use it in GitHub Desktop.
Simple proofs in Coq taken from More Exercises section of https://www.seas.upenn.edu/~cis500/current/sf/Basics.html
(* taken from More Exercises sections in https://www.seas.upenn.edu/~cis500/current/sf/Basics.html *)
Theorem identity_fn_applied_twice :
forall (f : bool -> bool),
(forall (x : bool), f x = x)
-> forall (b : bool), f (f b) = b.
Proof.
intros f H b.
rewrite -> H.
rewrite -> H.
reflexivity.
Qed.
Theorem andb_eq_orb : forall (a b : bool),
(andb a b = orb a b) -> a = b.
Proof.
intros a b H.
destruct a, b.
- (* case true = true *)
reflexivity.
- (* case true = false *)
inversion H.
- (* case false = true *)
inversion H.
- (* case false = false *)
reflexivity.
Qed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment