aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories/Arith/Lt.v
blob: bfc2b91a9fb85bf2c2c0db567d5d899986e76a57 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, *   INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2016     *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)

(** Strict order on natural numbers.

 This file is mostly OBSOLETE now, see module [PeanoNat.Nat] instead.

 [lt] is defined in library [Init/Peano.v] as:
<<
Definition lt (n m:nat) := S n <= m.
Infix "<" := lt : nat_scope.
>>
*)

Require Import PeanoNat.

Local Open Scope nat_scope.

(** * Irreflexivity *)

Notation lt_irrefl := Nat.lt_irrefl (compat "8.4"). (* ~ x < x *)

Hint Resolve lt_irrefl: arith.

(** * Relationship between [le] and [lt] *)

Theorem lt_le_S n m : n < m -> S n <= m.
Proof.
 apply Nat.le_succ_l.
Qed.

Theorem lt_n_Sm_le n m : n < S m -> n <= m.
Proof.
 apply Nat.lt_succ_r.
Qed.

Theorem le_lt_n_Sm n m : n <= m -> n < S m.
Proof.
 apply Nat.lt_succ_r.
Qed.

Hint Immediate lt_le_S: arith.
Hint Immediate lt_n_Sm_le: arith.
Hint Immediate le_lt_n_Sm: arith.

Theorem le_not_lt n m : n <= m -> ~ m < n.
Proof.
 apply Nat.le_ngt.
Qed.

Theorem lt_not_le n m : n < m -> ~ m <= n.
Proof.
 apply Nat.lt_nge.
Qed.

Hint Immediate le_not_lt lt_not_le: arith.

(** * Asymmetry *)

Notation lt_asym := Nat.lt_asymm (compat "8.4"). (* n<m -> ~m<n *)

(** * Order and 0 *)

Notation lt_0_Sn := Nat.lt_0_succ (compat "8.4"). (* 0 < S n *)
Notation lt_n_0 := Nat.nlt_0_r (compat "8.4"). (* ~ n < 0 *)

Theorem neq_0_lt n : 0 <> n -> 0 < n.
Proof.
 intros. now apply Nat.neq_0_lt_0, Nat.neq_sym.
Qed.

Theorem lt_0_neq n : 0 < n -> 0 <> n.
Proof.
 intros. now apply Nat.neq_sym, Nat.neq_0_lt_0.
Qed.

Hint Resolve lt_0_Sn lt_n_0 : arith.
Hint Immediate neq_0_lt lt_0_neq: arith.

(** * Order and successor *)

Notation lt_n_Sn := Nat.lt_succ_diag_r (compat "8.4"). (* n < S n *)
Notation lt_S := Nat.lt_lt_succ_r (compat "8.4"). (* n < m -> n < S m *)

Theorem lt_n_S n m : n < m -> S n < S m.
Proof.
 apply Nat.succ_lt_mono.
Qed.

Theorem lt_S_n n m : S n < S m -> n < m.
Proof.
 apply Nat.succ_lt_mono.
Qed.

Hint Resolve lt_n_Sn lt_S lt_n_S : arith.
Hint Immediate lt_S_n : arith.

(** * Predecessor *)

Lemma S_pred n m : m < n -> n = S (pred n).
Proof.
 intros. symmetry. now apply Nat.lt_succ_pred with m.
Qed.

Lemma lt_pred n m : S n < m -> n < pred m.
Proof.
 apply Nat.lt_succ_lt_pred.
Qed.

Lemma lt_pred_n_n n : 0 < n -> pred n < n.
Proof.
 intros. now apply Nat.lt_pred_l, Nat.neq_0_lt_0.
Qed.

Hint Immediate lt_pred: arith.
Hint Resolve lt_pred_n_n: arith.

(** * Transitivity properties *)

Notation lt_trans := Nat.lt_trans (compat "8.4").
Notation lt_le_trans := Nat.lt_le_trans (compat "8.4").
Notation le_lt_trans := Nat.le_lt_trans (compat "8.4").

Hint Resolve lt_trans lt_le_trans le_lt_trans: arith.

(** * Large = strict or equal *)

Notation le_lt_or_eq_iff := Nat.lt_eq_cases (compat "8.4").

Theorem le_lt_or_eq n m : n <= m -> n < m \/ n = m.
Proof.
 apply Nat.lt_eq_cases.
Qed.

Notation lt_le_weak := Nat.lt_le_incl (compat "8.4").

Hint Immediate lt_le_weak: arith.

(** * Dichotomy *)

Notation le_or_lt := Nat.le_gt_cases (compat "8.4"). (* n <= m \/ m < n *)

Theorem nat_total_order n m : n <> m -> n < m \/ m < n.
Proof.
 apply Nat.lt_gt_cases.
Qed.

(* begin hide *)
Notation lt_O_Sn := lt_0_Sn (only parsing).
Notation neq_O_lt := neq_0_lt (only parsing).
Notation lt_O_neq := lt_0_neq (only parsing).
Notation lt_n_O := lt_n_0 (only parsing).
(* end hide *)

(** For compatibility, we "Require" the same files as before *)

Require Import Le.