1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
14
Fixpoint iter (n : nat) : (A -> A) -> A -> A :=
15
fun (fl : A -> A) (def : A) =>
18
| S m => fl (iter m fl def)
22
Theorem SSplus_lt : forall p p' : nat, p < S (S (p + p')).
23
intro p; intro p'; change (S p <= S (S (p + p')));
24
apply le_S; apply Gt.gt_le_S; change (p < S (p + p'));
25
apply Lt.le_lt_n_Sm; apply Plus.le_plus_l.
29
Theorem Splus_lt : forall p p' : nat, p' < S (p + p').
30
intro p; intro p'; change (S p' <= S (p + p'));
31
apply Gt.gt_le_S; change (p' < S (p + p')); apply Lt.le_lt_n_Sm;
35
Theorem le_lt_SS : forall x y, x <= y -> x < S (S y).
36
intro x; intro y; intro H; change (S x <= S (S y));
37
apply le_S; apply Gt.gt_le_S; change (x < S y);
38
apply Lt.le_lt_n_Sm; exact H.
41
Inductive max_type (m n:nat) : Set :=
42
cmt : forall v, m <= v -> n <= v -> max_type m n.
44
Definition max : forall m n:nat, max_type m n.
45
intros m n; case (Compare_dec.le_gt_dec m n).
46
intros h; exists n; [exact h | apply le_n].
47
intros h; exists m; [apply le_n | apply Lt.lt_le_weak; exact h].