aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories/Arith/Le.v
blob: e12d2f2ba153ed9d02ea8a6b217897da057e0732 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
(***********************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team    *)
(* <O___,, *        INRIA-Rocquencourt  &  LRI-CNRS-Orsay              *)
(*   \VV/  *************************************************************)
(*    //   *      This file is distributed under the terms of the      *)
(*         *       GNU Lesser General Public License Version 2.1       *)
(***********************************************************************)

(*i $Id$ i*)

(** Order on natural numbers *)
V7only [Import nat_scope.].
Open Local Scope nat_scope.

Implicit Variables Type m,n,p:nat.

Theorem le_n_S : (n,m:nat)(le n m)->(le (S n) (S m)).
Proof.
  NewInduction 1; Auto.
Qed.

Theorem le_trans : (n,m,p:nat)(le n m)->(le m p)->(le n p).
Proof.
  NewInduction 2; Auto.
Qed.

Theorem le_n_Sn : (n:nat)(le n (S n)).
Proof.
  Auto.
Qed.

Theorem le_O_n : (n:nat)(le O n).
Proof.
  NewInduction n ; Auto.
Qed.

Hints Resolve le_n_S le_n_Sn le_O_n le_n_S le_trans : arith v62.

Theorem le_pred_n : (n:nat)(le (pred n) n).
Proof.
NewInduction n ; Auto with arith.
Qed.
Hints Resolve le_pred_n : arith v62.

Theorem le_trans_S : (n,m:nat)(le (S n) m)->(le n m).
Proof.
Intros n m H ; Apply le_trans with (S n) ; Auto with arith.
Qed.
Hints Immediate le_trans_S : arith v62.

Theorem le_S_n : (n,m:nat)(le (S n) (S m))->(le n m).
Proof.
Intros n m H ; Change (le (pred (S n)) (pred (S m))).
(*  (le (pred (S n)) (pred (S m)))
    ============================
      H : (le (S n) (S m))
      m : nat
      n : nat *)
Elim H ; Simpl ; Auto with arith.
Qed.
Hints Immediate le_S_n : arith v62.

Lemma le_pred : (n,m:nat)(le n m)->(le (pred n) (pred m)).
Proof.
Induction n. Simpl. Auto with arith.
Intros n0 Hn0. Induction m. Simpl. Intro H. Inversion H.
Intros n1 H H0. Simpl. Auto with arith.
Qed.

(** Negative properties *)

Theorem le_Sn_O : (n:nat)~(le (S n) O).
Proof.
Red ; Intros n H.
(*  False
    ============================
      H : (lt n O)
      n : nat *)
Change (IsSucc O) ; Elim H ; Simpl ; Auto with arith.
Qed.
Hints Resolve le_Sn_O : arith v62.

Theorem le_Sn_n : (n:nat)~(le (S n) n).
Proof.
NewInduction n; Auto with arith.
Qed.
Hints Resolve le_Sn_n : arith v62.

Theorem le_antisym : (n,m:nat)(le n m)->(le m n)->(n=m).
Proof.
Intros n m h ; Elim h ; Auto with arith.
(*  (m:nat)(le n m)->((le m n)->(n=m))->(le (S m) n)->(n=(S m))
    ============================
      h : (le n m)
      m : nat
      n : nat *)
Intros m0 H H0 H1.
Absurd (le (S m0) m0) ; Auto with arith.
(*  (le (S m0) m0)
    ============================
      H1 : (le (S m0) n)
      H0 : (le m0 n)->(<nat>n=m0)
      H : (le n m0)
      m0 : nat *)
Apply le_trans with n ; Auto with arith.
Qed.
Hints Immediate le_antisym : arith v62.

Theorem le_n_O_eq : (n:nat)(le n O)->(O=n).
Proof.
Auto with arith.
Qed.
Hints Immediate le_n_O_eq : arith v62.

(** A different elimination principle for the order on natural numbers *)

Lemma le_elim_rel : (P:nat->nat->Prop)
     ((p:nat)(P O p))->
     ((p,q:nat)(le p q)->(P p q)->(P (S p) (S q)))->
     (n,m:nat)(le n m)->(P n m).
Proof.
NewInduction n; Auto with arith.
Intros m Le.
Elim Le; Auto with arith.
Qed.