Skip to content

Instantly share code, notes, and snippets.

@palmskog
Created October 9, 2018 21:34
Show Gist options
  • Save palmskog/341da4e54ff7e805077b6e0b3af7d21d to your computer and use it in GitHub Desktop.
Save palmskog/341da4e54ff7e805077b6e0b3af7d21d to your computer and use it in GitHub Desktop.
Proof by reflection in Coq
From mathcomp
Require Import all_ssreflect.
Section Barendregt.
Variable P : Prop.
Fixpoint B (n : nat) := match n with | 1 => P | n'.+1 => P <-> B n' | 0 => False end.
Lemma B2n: forall n, n >= 1 -> B (2 * n).
Proof.
elim => //.
move => n IH Hlt.
rewrite mulnS /=.
case Hn: (2 * n); first by auto.
rewrite -Hn.
have Hlt': 0 < n by case: n IH Hlt Hn.
move/IH: Hlt' => Hlt'.
split => HP; first by split.
by apply HP.
Qed.
End Barendregt.
Lemma iffP : forall P : Prop, P <-> (P <-> (P <-> (P <-> (P <-> (P <-> (P <-> (P <-> (P <-> P)))))))).
Proof.
move => P.
set g := P <-> _.
have ->: g = B P 10 by [].
have ->: 10 = 2 * 5 by [].
exact: B2n.
Qed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment