Skip to content

Instantly share code, notes, and snippets.

@nkaretnikov
Created April 25, 2015 22:29
Show Gist options
  • Save nkaretnikov/bf79a4fa8c4af8ed6ff3 to your computer and use it in GitHub Desktop.
Save nkaretnikov/bf79a4fa8c4af8ed6ff3 to your computer and use it in GitHub Desktop.
true_upto_n__true_everywhere
(** One more quick digression, for adventurous souls: if we can define
parameterized propositions using [Definition], then can we also
define them using [Fixpoint]? Of course we can! However, this
kind of "recursive parameterization" doesn't correspond to
anything very familiar from everyday mathematics. The following
exercise gives a slightly contrived example. *)
(** **** Exercise: 4 stars, optional (true_upto_n__true_everywhere) *)
(** Define a recursive function
[true_upto_n__true_everywhere] that makes
[true_upto_n_example] work. *)
Fixpoint true_upto_n__true_everywhere (n:nat) (P : nat -> Prop) : Prop :=
match n with
| 0 => forall m : nat, P m
| S n' => P n -> true_upto_n__true_everywhere n' P
end.
Example true_upto_n_example :
(true_upto_n__true_everywhere 3 (fun n => even n))
= (even 3 -> even 2 -> even 1 -> forall m : nat, even m).
Proof. reflexivity. Qed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment