Module Type LocalNat.
Inductive nat : Set :=
| O : nat
| S : nat->nat.
Check nat.
Check O.
Check S.
End LocalNat.
Print nat.
Print le.
Print zero_leq_three.
repeat constructor.
Qed.
Print list.
Check list.
Check (nil (A:=nat)).
Check (nil (A:= nat -> nat)).
Check (fun A: Set => (cons (A:=A))).
Check (cons 3 (cons 2 nil)).
Print Vector.t.
Check (Vector.nil nat).
Check (fun (A:Set)(a:A)=> Vector.cons _ a _ (Vector.nil _)).
Check (Vector.cons _ 5 _ (Vector.cons _ 3 _ (Vector.nil _))).
Print eq_3_3.
Print eq_proof_proof.
Check (2 + 1 = 3).
Check (Type = Type).
Goal Type = Type.
reflexivity.
Qed.
Print or.
Print and.
Print sumbool.
Print ex.
Check le_lt_dec.
Definition max (n p :nat) := match le_lt_dec n p with
| left _ => p
| right _ => n
end.
Require Coq.extraction.Extraction.
Extraction max.
Inductive tree(A:Set)   : Set :=
node : A -> forest A -> tree A
with
forest (A: Set)    : Set :=
nochild  : forest A |
addchild : tree A -> forest A -> forest A.
Inductive
even    : nat->Prop :=
evenO : even  O |
evenS : forall n, odd n -> even (S n)
with
odd    : nat->Prop :=
oddS : forall n, even n -> odd (S n).
simpl; repeat constructor.
Qed.
Definition nat_case :=
fun (Q : Type)(g0 : Q)(g1 : nat -> Q)(n:nat) =>
match n return Q with
| 0 => g0
| S p => g1 p
end.
Eval simpl in (nat_case nat 0 (fun p => p) 34).
Eval simpl in (fun g0 g1 => nat_case nat g0 g1 34).
Eval simpl in (fun g0 g1 => nat_case nat g0 g1 0).
Definition pred (n:nat) := match n with O => O | S m => m end.
Eval simpl in pred 56.
Eval simpl in pred 0.
Eval simpl in fun p => pred (S p).
Definition xorb (b1 b2:bool) :=
match b1, b2 with
| false, true => true
| true, false => true
| _ , _       => false
end.
Definition pred_spec (n:nat) := {m:nat | n=0 /\ m=0  \/ n = S m}.
Definition predecessor : forall n:nat, pred_spec n.
intro n;case n.
unfold pred_spec;exists 0;auto.
unfold pred_spec; intro n0;exists n0; auto.
Defined.
Print predecessor.
Extraction predecessor.
intro n;case n;simpl;auto.
Qed.
Check (fun p:False => match p return 2=3 with end).

Theorem fromFalse : False -> 0=1.