Skip to content

Instantly share code, notes, and snippets.

@ramntry
Created October 24, 2014 17:25
Show Gist options
  • Select an option

  • Save ramntry/84a18d21ac5290612157 to your computer and use it in GitHub Desktop.

Select an option

Save ramntry/84a18d21ac5290612157 to your computer and use it in GitHub Desktop.
SF
Require Import Basics.
Require Import Induction.
Require Import Lists.
Definition even (n : nat) : Prop :=
evenb n = true.
Inductive ev : nat -> Prop :=
| ev_0 : ev 0
| ev_SS : forall n : nat, ev n -> ev (S (S n)).
Definition double (n : nat) : nat :=
n + n.
Theorem n_plus_Sm_is_S_n_plus_m : forall n m : nat,
n + S m = S (n + m).
Proof.
intros n m.
generalize dependent m.
induction n as [ | n'].
intros m.
reflexivity.
intros m.
simpl.
rewrite IHn'.
reflexivity.
Qed.
Theorem double_even : forall n,
ev (double n).
Proof.
unfold double.
induction n as [ | n'].
apply ev_0.
rewrite n_plus_Sm_is_S_n_plus_m.
simpl.
apply ev_SS.
apply IHn'.
Qed.
(*
*** Local Variables: ***
*** coq-load-path: ("../book-sources") ***
*** End: ***
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment