4 ||M|| This file is part of HELM, an Hypertextual, Electronic
5 ||A|| Library of Mathematics, developed at the Computer Science
6 ||T|| Department of the University of Bologna, Italy.
9 ||A|| This file is distributed under the terms of the
10 \ / GNU General Public License Version 2
12 V_______________________________________________________________ *)
14 include "basics/relations.ma".
16 inductive nat : Type[0] ≝
20 interpretation "Natural numbers" 'N = nat.
22 alias num (instance 0) = "natural number".
25 λn. match n with [ O ⇒
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 | S p ⇒ p].
27 theorem pred_Sn : ∀n.n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/pred.def(1)"
\ 6pred
\ 5/a
\ 6 (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n).
30 theorem injective_S :
\ 5a href="cic:/matita/basics/relations/injective.def(1)"
\ 6injective
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6.
34 theorem inj_S : \forall n,m:nat.(S n)=(S m) \to n=m.
37 theorem not_eq_S: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="leibnitz's non-equality" href="cic:/fakeuri.def(1)"
\ 6≠
\ 5/a
\ 6 m →
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="leibnitz's non-equality" href="cic:/fakeuri.def(1)"
\ 6≠
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m.
40 definition not_zero:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 → Prop ≝
41 λn:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. match n with [ O ⇒
\ 5a href="cic:/matita/basics/logic/False.ind(1,0,0)"
\ 6False
\ 5/a
\ 6 | (S p) ⇒
\ 5a href="cic:/matita/basics/logic/True.ind(1,0,0)"
\ 6True
\ 5/a
\ 6 ].
43 theorem not_eq_O_S : ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="leibnitz's non-equality" href="cic:/fakeuri.def(1)"
\ 6≠
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n.
44 #n @
\ 5a href="cic:/matita/basics/logic/Not.con(0,1,1)"
\ 6nmk
\ 5/a
\ 6 #eqOS (change with (
\ 5a href="cic:/matita/arithmetics/nat/not_zero.def(1)"
\ 6not_zero
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6)) >eqOS // qed.
46 theorem not_eq_n_Sn: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="leibnitz's non-equality" href="cic:/fakeuri.def(1)"
\ 6≠
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n.
50 ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.∀P:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 → Prop.
51 (n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 → P
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6) → (∀m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m → P (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m)) → P n.
52 #n #P (elim n) /2/ qed.
55 ∀R:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 → Prop.
56 (∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. R
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 n)
57 → (∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. R (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n)
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6)
58 → (∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. R n m → R (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n) (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m))
59 → ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. R n m.
60 #R #ROn #RSO #RSS #n (elim n) // #n0 #Rn0m #m (cases m) /2/ qed.
62 theorem decidable_eq_nat : ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/basics/logic/decidable.def(1)"
\ 6decidable
\ 5/a
\ 6 (n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6m).
63 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 #n [ (cases n) /2/ | /3/ | #m #Hind (cases Hind) /3/]
66 (*************************** plus ******************************)
69 match n with [ O ⇒ m | S p ⇒
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 (plus p m) ].
71 interpretation "natural plus" 'plus x y = (plus x y).
73 theorem plus_O_n: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6n.
77 theorem plus_Sn_m: ∀n,m:nat. S (n + m) = S n + m.
81 theorem plus_n_O: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6\ 5a title="natural number" href="cic:/fakeuri.def(1)"
\ 60
\ 5/a
\ 6.
82 #n (elim n) normalize // qed.
84 theorem plus_n_Sm : ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 (n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6m)
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m.
85 #n (elim n) normalize // qed.
88 theorem plus_Sn_m1: ∀n,m:nat. S m + n = n + S m.
89 #n (elim n) normalize // qed.
93 theorem plus_n_1 : ∀n:nat. S n = n+1.
97 theorem commutative_plus:
\ 5a href="cic:/matita/basics/relations/commutative.def(1)"
\ 6commutative
\ 5/a
\ 6 ?
\ 5a href="cic:/matita/arithmetics/nat/plus.fix(0,0,1)"
\ 6plus
\ 5/a
\ 6.
98 #n (elim n) normalize // qed.
100 theorem associative_plus :
\ 5a href="cic:/matita/basics/relations/associative.def(1)"
\ 6associative
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/plus.fix(0,0,1)"
\ 6plus
\ 5/a
\ 6.
101 #n (elim n) normalize // qed.
103 theorem assoc_plus1: ∀a,b,c. c
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 (b
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 a)
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 b
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 c
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 a.
106 theorem injective_plus_r: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/basics/relations/injective.def(1)"
\ 6injective
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 (λm.n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6m).
107 #n (elim n) normalize /3/ qed.
109 (* theorem inj_plus_r: \forall p,n,m:nat. p+n = p+m \to n=m
110 \def injective_plus_r.
112 theorem injective_plus_l: ∀m:nat.injective nat nat (λn.n+m).
115 (* theorem inj_plus_l: \forall p,n,m:nat. n+p = m+p \to n=m
116 \def injective_plus_l. *)
118 (*************************** times *****************************)
121 match n with [ O ⇒
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 | S p ⇒ m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6(times p m) ].
123 interpretation "natural times" 'times x y = (times x y).
125 theorem times_Sn_m: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6m.
128 theorem times_O_n: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6n.
131 theorem times_n_O: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6.
134 theorem times_n_Sm : ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6(n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6m)
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6(
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m).
135 #n (elim n) normalize // qed.
137 theorem commutative_times :
\ 5a href="cic:/matita/basics/relations/commutative.def(1)"
\ 6commutative
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/times.fix(0,0,2)"
\ 6times
\ 5/a
\ 6.
138 #n (elim n) normalize // qed.
140 (* variant sym_times : \forall n,m:nat. n*m = m*n \def
143 theorem distributive_times_plus :
\ 5a href="cic:/matita/basics/relations/distributive.def(1)"
\ 6distributive
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/times.fix(0,0,2)"
\ 6times
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/plus.fix(0,0,1)"
\ 6plus
\ 5/a
\ 6.
144 #n (elim n) normalize // qed.
146 theorem distributive_times_plus_r :
147 ∀a,b,c:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. (b
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6c)
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6a
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 b
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6a
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 c
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6a.
150 theorem associative_times:
\ 5a href="cic:/matita/basics/relations/associative.def(1)"
\ 6associative
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/times.fix(0,0,2)"
\ 6times
\ 5/a
\ 6.
151 #n (elim n) normalize // qed.
153 lemma times_times: ∀x,y,z. x
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6(y
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6z)
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 y
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6(x
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6z).
156 theorem times_n_1 : ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6 \ 5a title="natural number" href="cic:/fakeuri.def(1)"
\ 61
\ 5/a
\ 6.
159 (* ci servono questi risultati?
160 theorem times_O_to_O: ∀n,m:nat.n*m=O → n=O ∨ m=O.
162 #n #m #H normalize #H1 napply False_ind napply not_eq_O_S
165 theorem times_n_SO : ∀n:nat. n = n * S O.
168 theorem times_SSO_n : ∀n:nat. n + n = (S(S O)) * n.
171 nlemma times_SSO: \forall n.(S(S O))*(S n) = S(S((S(S O))*n)).
174 theorem or_eq_eq_S: \forall n.\exists m.
175 n = (S(S O))*m \lor n = S ((S(S O))*m).
178 ##|#a #H nelim H #b#ornelim or#aeq
185 (******************** ordering relations ************************)
187 inductive le (n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6) :
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 → Prop ≝
189 | le_S : ∀ m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. le n m → le n (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m).
191 interpretation "natural 'less or equal to'" 'leq x y = (le x y).
193 interpretation "natural 'neither less nor equal to'" 'nleq x y = (Not (le x y)).
195 definition lt:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 → Prop ≝ λn,m.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m.
197 interpretation "natural 'less than'" 'lt x y = (lt x y).
198 interpretation "natural 'not less than'" 'nless x y = (Not (lt x y)).
200 (* lemma eq_lt: ∀n,m. (n < m) = (S n ≤ m).
203 definition ge:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 → Prop ≝ λn,m.m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n.
205 interpretation "natural 'greater or equal to'" 'geq x y = (ge x y).
207 definition gt:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 → Prop ≝ λn,m.m
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6n.
209 interpretation "natural 'greater than'" 'gt x y = (gt x y).
210 interpretation "natural 'not greater than'" 'ngtr x y = (Not (gt x y)).
212 theorem transitive_le :
\ 5a href="cic:/matita/basics/relations/transitive.def(2)"
\ 6transitive
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/le.ind(1,0,1)"
\ 6le
\ 5/a
\ 6.
213 #a #b #c #leab #lebc (elim lebc) /2/
217 theorem trans_le: \forall n,m,p:nat. n \leq m \to m \leq p \to n \leq p
218 \def transitive_le. *)
220 theorem transitive_lt:
\ 5a href="cic:/matita/basics/relations/transitive.def(2)"
\ 6transitive
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/lt.def(1)"
\ 6lt
\ 5/a
\ 6.
221 #a #b #c #ltab #ltbc (elim ltbc) /2/qed.
224 theorem trans_lt: \forall n,m,p:nat. lt n m \to lt m p \to lt n p
225 \def transitive_lt. *)
227 theorem le_S_S: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m →
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m.
228 #n #m #lenm (elim lenm) /2/ qed.
230 theorem le_O_n : ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n.
233 theorem le_n_Sn : ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n.
236 theorem le_pred_n : ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/pred.def(1)"
\ 6pred
\ 5/a
\ 6 n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n.
239 theorem monotonic_pred:
\ 5a href="cic:/matita/basics/relations/monotonic.def(1)"
\ 6monotonic
\ 5/a
\ 6 ?
\ 5a href="cic:/matita/arithmetics/nat/le.ind(1,0,1)"
\ 6le
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/pred.def(1)"
\ 6pred
\ 5/a
\ 6.
240 #n #m #lenm (elim lenm) /2/ qed.
242 theorem le_S_S_to_le: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m → n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m.
246 (* this are instances of the le versions
247 theorem lt_S_S_to_lt: ∀n,m. S n < S m → n < m.
250 theorem lt_to_lt_S_S: ∀n,m. n < m → S n < S m.
253 theorem lt_to_not_zero : ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m →
\ 5a href="cic:/matita/arithmetics/nat/not_zero.def(1)"
\ 6not_zero
\ 5/a
\ 6 m.
254 #n #m #Hlt (elim Hlt) // qed.
257 theorem not_le_Sn_O: ∀ n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural 'neither less nor equal to'" href="cic:/fakeuri.def(1)"
\ 6≰
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6.
258 #n @
\ 5a href="cic:/matita/basics/logic/Not.con(0,1,1)"
\ 6nmk
\ 5/a
\ 6 #Hlen0 @(
\ 5a href="cic:/matita/arithmetics/nat/lt_to_not_zero.def(2)"
\ 6lt_to_not_zero
\ 5/a
\ 6 ?? Hlen0) qed.
260 theorem not_le_to_not_le_S_S: ∀ n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'neither less nor equal to'" href="cic:/fakeuri.def(1)"
\ 6≰
\ 5/a
\ 6 m →
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural 'neither less nor equal to'" href="cic:/fakeuri.def(1)"
\ 6≰
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m.
263 theorem not_le_S_S_to_not_le: ∀ n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural 'neither less nor equal to'" href="cic:/fakeuri.def(1)"
\ 6≰
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m → n
\ 5a title="natural 'neither less nor equal to'" href="cic:/fakeuri.def(1)"
\ 6≰
\ 5/a
\ 6 m.
266 theorem decidable_le: ∀n,m.
\ 5a href="cic:/matita/basics/logic/decidable.def(1)"
\ 6decidable
\ 5/a
\ 6 (n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6m).
267 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 #n /2/ #m * /3/ qed.
269 theorem decidable_lt: ∀n,m.
\ 5a href="cic:/matita/basics/logic/decidable.def(1)"
\ 6decidable
\ 5/a
\ 6 (n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m).
270 #n #m @
\ 5a href="cic:/matita/arithmetics/nat/decidable_le.def(6)"
\ 6decidable_le
\ 5/a
\ 6 qed.
272 theorem not_le_Sn_n: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural 'neither less nor equal to'" href="cic:/fakeuri.def(1)"
\ 6≰
\ 5/a
\ 6 n.
275 (* this is le_S_S_to_le
276 theorem lt_S_to_le: ∀n,m:nat. n < S m → n ≤ m.
280 lemma le_gen: ∀P:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 → Prop.∀n.(∀i. i
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n → P i) → P n.
283 theorem not_le_to_lt: ∀n,m. n
\ 5a title="natural 'neither less nor equal to'" href="cic:/fakeuri.def(1)"
\ 6≰
\ 5/a
\ 6 m → m
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 n.
284 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 #n
285 [#abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/
287 |#m #Hind #HnotleSS @
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6 /3/
291 theorem lt_to_not_le: ∀n,m. n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m → m
\ 5a title="natural 'neither less nor equal to'" href="cic:/fakeuri.def(1)"
\ 6≰
\ 5/a
\ 6 n.
292 #n #m #Hltnm (elim Hltnm) /3/ qed.
294 theorem not_lt_to_le: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'not less than'" href="cic:/fakeuri.def(1)"
\ 6≮
\ 5/a
\ 6 m → m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n.
297 theorem le_to_not_lt: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m → m
\ 5a title="natural 'not less than'" href="cic:/fakeuri.def(1)"
\ 6≮
\ 5/a
\ 6 n.
298 #n #m #H @
\ 5a href="cic:/matita/arithmetics/nat/lt_to_not_le.def(7)"
\ 6lt_to_not_le
\ 5/a
\ 6 /2/ (* /3/ *) qed.
300 (* lt and le trans *)
302 theorem lt_to_le_to_lt: ∀n,m,p:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m → m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 p → n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 p.
303 #n #m #p #H #H1 (elim H1) /2/ qed.
305 theorem le_to_lt_to_lt: ∀n,m,p:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m → m
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 p → n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 p.
306 #n #m #p #H (elim H) /3/ qed.
308 theorem lt_S_to_lt: ∀n,m.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m → n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m.
311 theorem ltn_to_ltO: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m →
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m.
315 theorem lt_SO_n_to_lt_O_pred_n: \forall n:nat.
316 (S O) \lt n \to O \lt (pred n).
318 apply (ltn_to_ltO (pred (S O)) (pred n) ?).
319 apply (lt_pred (S O) n)
325 theorem lt_O_n_elim: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 n →
326 ∀P:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 → Prop.(∀m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.P (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m)) → P n.
327 #n (elim n) // #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/
330 theorem S_pred: ∀n.
\ 5a title="natural number" href="cic:/fakeuri.def(1)"
\ 60
\ 5/a
\ 6 \ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 n →
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6(
\ 5a href="cic:/matita/arithmetics/nat/pred.def(1)"
\ 6pred
\ 5/a
\ 6 n)
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 n.
331 #n #posn (cases posn) //
335 theorem lt_pred: \forall n,m.
336 O < n \to n < m \to pred n < pred m.
338 [intros.apply False_ind.apply (not_le_Sn_O ? H)
339 |intros.apply False_ind.apply (not_le_Sn_O ? H1)
340 |intros.simplify.unfold.apply le_S_S_to_le.assumption
344 theorem le_pred_to_le:
345 ∀n,m. O < m → pred n ≤ pred m → n ≤ m.
361 theorem le_to_or_lt_eq: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m → n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m
\ 5a title="logical or" href="cic:/fakeuri.def(1)"
\ 6∨
\ 5/a
\ 6 n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 m.
362 #n #m #lenm (elim lenm) /3/ qed.
365 theorem lt_to_not_eq : ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m → n
\ 5a title="leibnitz's non-equality" href="cic:/fakeuri.def(1)"
\ 6≠
\ 5/a
\ 6 m.
366 #n #m #H @
\ 5a href="cic:/matita/basics/logic/not_to_not.def(3)"
\ 6not_to_not
\ 5/a
\ 6 /2/ qed.
369 theorem eq_to_not_lt: ∀a,b:nat. a = b → a ≮ b.
374 apply (lt_to_not_eq b b)
380 theorem lt_n_m_to_not_lt_m_Sn: ∀n,m. n < m → m ≮ S n.
386 generalize in match (le_S_S ? ? H)
388 generalize in match (transitive_le ? ? ? H2 H1)
390 apply (not_le_Sn_n ? H3).
393 theorem not_eq_to_le_to_lt: ∀n,m. n
\ 5a title="leibnitz's non-equality" href="cic:/fakeuri.def(1)"
\ 6≠
\ 5/a
\ 6m → n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6m → n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6m.
394 #n #m #Hneq #Hle cases (
\ 5a href="cic:/matita/arithmetics/nat/le_to_or_lt_eq.def(5)"
\ 6le_to_or_lt_eq
\ 5/a
\ 6 ?? Hle) //
397 nelim (Hneq Heq) qed. *)
400 theorem le_n_O_to_eq : ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6n.
401 #n (cases n) // #a #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/ qed.
403 theorem le_n_O_elim: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 → ∀P:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →Prop. P
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 → P n.
404 #n (cases n) // #a #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/ qed.
406 theorem le_n_Sm_elim : ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m →
407 ∀P:Prop. (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m → P) → (n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m → P) → P.
408 #n #m #Hle #P (elim Hle) /3/ qed.
412 theorem le_to_le_to_eq: ∀n,m. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m → m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n → n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 m.
413 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 /4/
416 theorem lt_O_S : ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n.
420 (* other abstract properties *)
421 theorem antisymmetric_le : antisymmetric nat le.
422 unfold antisymmetric.intros 2.
423 apply (nat_elim2 (\lambda n,m.(n \leq m \to m \leq n \to n=m))).
424 intros.apply le_n_O_to_eq.assumption.
425 intros.apply False_ind.apply (not_le_Sn_O ? H).
426 intros.apply eq_f.apply H.
427 apply le_S_S_to_le.assumption.
428 apply le_S_S_to_le.assumption.
431 theorem antisym_le: \forall n,m:nat. n \leq m \to m \leq n \to n=m
432 \def antisymmetric_le.
434 theorem le_n_m_to_lt_m_Sn_to_eq_n_m: ∀n,m. n ≤ m → m < S n → n=m.
437 generalize in match (le_S_S_to_le ? ? H1)
444 (* well founded induction principles *)
446 theorem nat_elim1 : ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.∀P:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 → Prop.
447 (∀m.(∀p. p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m → P p) → P m) → P n.
449 cut (∀q:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. q
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n → P q) /2/
451 [#q #HleO (* applica male *)
452 @(
\ 5a href="cic:/matita/arithmetics/nat/le_n_O_elim.def(4)"
\ 6le_n_O_elim
\ 5/a
\ 6 ? HleO)
453 @H #p #ltpO @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/ (* 3 *)
455 @H #a #lta @Hind @
\ 5a href="cic:/matita/arithmetics/nat/le_S_S_to_le.def(5)"
\ 6le_S_S_to_le
\ 5/a
\ 6 /2/
459 (* some properties of functions *)
461 definition increasing ≝ λf:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. f n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 f (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n).
463 theorem increasing_to_monotonic: ∀f:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
464 \ 5a href="cic:/matita/arithmetics/nat/increasing.def(2)"
\ 6increasing
\ 5/a
\ 6 f →
\ 5a href="cic:/matita/basics/relations/monotonic.def(1)"
\ 6monotonic
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/lt.def(1)"
\ 6lt
\ 5/a
\ 6 f.
465 #f #incr #n #m #ltnm (elim ltnm) /2/
468 theorem le_n_fn: ∀f:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
469 \ 5a href="cic:/matita/arithmetics/nat/increasing.def(2)"
\ 6increasing
\ 5/a
\ 6 f → ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 f n.
470 #f #incr #n (elim n) /2/
473 theorem increasing_to_le: ∀f:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
474 \ 5a href="cic:/matita/arithmetics/nat/increasing.def(2)"
\ 6increasing
\ 5/a
\ 6 f → ∀m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a title="exists" href="cic:/fakeuri.def(1)"
\ 6∃
\ 5/a
\ 6i.m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 f i.
475 #f #incr #m (elim m) /2/#n * #a #lenfa
476 @(
\ 5a href="cic:/matita/basics/logic/ex.con(0,1,2)"
\ 6ex_intro
\ 5/a
\ 6 ?? (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 a)) /2/
479 theorem increasing_to_le2: ∀f:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/increasing.def(2)"
\ 6increasing
\ 5/a
\ 6 f →
480 ∀m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. f
\ 5a title="natural number" href="cic:/fakeuri.def(1)"
\ 60
\ 5/a
\ 6 \ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m →
\ 5a title="exists" href="cic:/fakeuri.def(1)"
\ 6∃
\ 5/a
\ 6i. f i
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m
\ 5a title="logical and" href="cic:/fakeuri.def(1)"
\ 6∧
\ 5/a
\ 6 m
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 f (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 i).
481 #f #incr #m #lem (elim lem)
482 [@(
\ 5a href="cic:/matita/basics/logic/ex.con(0,1,2)"
\ 6ex_intro
\ 5/a
\ 6 ? ?
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6) /2/
483 |#n #len * #a * #len #ltnr (cases(
\ 5a href="cic:/matita/arithmetics/nat/le_to_or_lt_eq.def(5)"
\ 6le_to_or_lt_eq
\ 5/a
\ 6 … ltnr)) #H
484 [@(
\ 5a href="cic:/matita/basics/logic/ex.con(0,1,2)"
\ 6ex_intro
\ 5/a
\ 6 ? ? a) % /2/
485 |@(
\ 5a href="cic:/matita/basics/logic/ex.con(0,1,2)"
\ 6ex_intro
\ 5/a
\ 6 ? ? (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 a)) % //
490 theorem increasing_to_injective: ∀f:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
491 \ 5a href="cic:/matita/arithmetics/nat/increasing.def(2)"
\ 6increasing
\ 5/a
\ 6 f →
\ 5a href="cic:/matita/basics/relations/injective.def(1)"
\ 6injective
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 f.
492 #f #incr #n #m cases(
\ 5a href="cic:/matita/arithmetics/nat/decidable_le.def(6)"
\ 6decidable_le
\ 5/a
\ 6 n m)
493 [#lenm cases(
\ 5a href="cic:/matita/arithmetics/nat/le_to_or_lt_eq.def(5)"
\ 6le_to_or_lt_eq
\ 5/a
\ 6 … lenm) //
494 #lenm #eqf @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 @(
\ 5a href="cic:/matita/basics/logic/absurd.def(2)"
\ 6absurd
\ 5/a
\ 6 … eqf) @
\ 5a href="cic:/matita/arithmetics/nat/lt_to_not_eq.def(7)"
\ 6lt_to_not_eq
\ 5/a
\ 6
495 @
\ 5a href="cic:/matita/arithmetics/nat/increasing_to_monotonic.def(4)"
\ 6increasing_to_monotonic
\ 5/a
\ 6 //
496 |#nlenm #eqf @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 @(
\ 5a href="cic:/matita/basics/logic/absurd.def(2)"
\ 6absurd
\ 5/a
\ 6 … eqf) @
\ 5a href="cic:/matita/basics/logic/sym_not_eq.def(4)"
\ 6sym_not_eq
\ 5/a
\ 6
497 @
\ 5a href="cic:/matita/arithmetics/nat/lt_to_not_eq.def(7)"
\ 6lt_to_not_eq
\ 5/a
\ 6 @
\ 5a href="cic:/matita/arithmetics/nat/increasing_to_monotonic.def(4)"
\ 6increasing_to_monotonic
\ 5/a
\ 6 /2/
501 (*********************** monotonicity ***************************)
502 theorem monotonic_le_plus_r:
503 ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/basics/relations/monotonic.def(1)"
\ 6monotonic
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/le.ind(1,0,1)"
\ 6le
\ 5/a
\ 6 (λm.n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 m).
504 #n #a #b (elim n) normalize //
505 #m #H #leab @
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6 /2/ qed.
508 theorem le_plus_r: ∀p,n,m:nat. n ≤ m → p + n ≤ p + m
509 ≝ monotonic_le_plus_r. *)
511 theorem monotonic_le_plus_l:
512 ∀m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/basics/relations/monotonic.def(1)"
\ 6monotonic
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/le.ind(1,0,1)"
\ 6le
\ 5/a
\ 6 (λn.n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 m).
516 theorem le_plus_l: \forall p,n,m:nat. n \le m \to n + p \le m + p
517 \def monotonic_le_plus_l. *)
519 theorem le_plus: ∀n1,n2,m1,m2:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n1
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n2 → m1
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m2
520 → n1
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 m1
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n2
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 m2.
521 #n1 #n2 #m1 #m2 #len #lem @(
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6 ? (n1
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6m2))
524 theorem le_plus_n :∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 m.
527 lemma le_plus_a: ∀a,n,m. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m → n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 a
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 m.
530 lemma le_plus_b: ∀b,n,m. n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 b
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m → n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m.
533 theorem le_plus_n_r :∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 n.
536 theorem eq_plus_to_le: ∀n,m,p:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6p → m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n.
539 theorem le_plus_to_le: ∀a,n,m. a
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 a
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 m → n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m.
540 #a (elim a) normalize /3/ qed.
542 theorem le_plus_to_le_r: ∀a,n,m. n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 a
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6a → n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m.
547 theorem monotonic_lt_plus_r:
548 ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/basics/relations/monotonic.def(1)"
\ 6monotonic
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/lt.def(1)"
\ 6lt
\ 5/a
\ 6 (λm.n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6m).
552 variant lt_plus_r: \forall n,p,q:nat. p < q \to n + p < n + q \def
553 monotonic_lt_plus_r. *)
555 theorem monotonic_lt_plus_l:
556 ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/basics/relations/monotonic.def(1)"
\ 6monotonic
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/lt.def(1)"
\ 6lt
\ 5/a
\ 6 (λm.m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6n).
560 variant lt_plus_l: \forall n,p,q:nat. p < q \to p + n < q + n \def
561 monotonic_lt_plus_l. *)
563 theorem lt_plus: ∀n,m,p,q:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m → p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 q → n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 q.
564 #n #m #p #q #ltnm #ltpq
565 @(
\ 5a href="cic:/matita/arithmetics/nat/transitive_lt.def(3)"
\ 6transitive_lt
\ 5/a
\ 6 ? (n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6q))/2/ qed.
567 theorem lt_plus_to_lt_l :∀n,p,q:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. p
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 q
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6n → p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6q.
570 theorem lt_plus_to_lt_r :∀n,p,q:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6q → p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6q.
574 theorem le_to_lt_to_lt_plus: ∀a,b,c,d:nat.
575 a ≤ c → b < d → a + b < c+d.
576 (* bello /2/ un po' lento *)
577 #a #b #c #d #leac #lebd
578 normalize napplyS le_plus // qed.
582 theorem monotonic_le_times_r:
583 ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/basics/relations/monotonic.def(1)"
\ 6monotonic
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/le.ind(1,0,1)"
\ 6le
\ 5/a
\ 6 (λm. n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6 m).
584 #n #x #y #lexy (elim n) normalize//(* lento /2/*)
585 #a #lea @
\ 5a href="cic:/matita/arithmetics/nat/le_plus.def(7)"
\ 6le_plus
\ 5/a
\ 6 //
589 theorem le_times_r: \forall p,n,m:nat. n \le m \to p*n \le p*m
590 \def monotonic_le_times_r. *)
593 theorem monotonic_le_times_l:
594 ∀m:nat.monotonic nat le (λn.n*m).
599 theorem le_times_l: \forall p,n,m:nat. n \le m \to n*p \le m*p
600 \def monotonic_le_times_l. *)
602 theorem le_times: ∀n1,n2,m1,m2:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
603 n1
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n2 → m1
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m2 → n1
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6m1
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n2
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6m2.
604 #n1 #n2 #m1 #m2 #len #lem @(
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6 ? (n1
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6m2)) /2/
608 theorem lt_times_n: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 n → m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6m.
611 theorem le_times_to_le:
612 ∀a,n,m.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 a → a
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6 n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 a
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6 m → n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m.
613 #a @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 normalize
616 @(
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6 ? (a
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n)) /2/
618 @
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6 @H /2/
623 theorem le_S_times_2: ∀n,m.O < m → n ≤ m → S n ≤ 2*m.
624 #n #m #posm #lenm (* interessante *)
625 applyS (le_plus n m) // qed. *)
629 theorem lt_O_times_S_S: ∀n,m:nat.O < (S n)*(S m).
630 intros.simplify.unfold lt.apply le_S_S.apply le_O_n.
634 theorem lt_times_eq_O: \forall a,b:nat.
635 O < a → a * b = O → b = O.
642 rewrite > (S_pred a) in H1
644 apply (eq_to_not_lt O ((S (pred a))*(S m)))
647 | apply lt_O_times_S_S
654 theorem O_lt_times_to_O_lt: \forall a,c:nat.
655 O \lt (a * c) \to O \lt a.
667 lemma lt_times_to_lt_O: \forall i,n,m:nat. i < n*m \to O < m.
669 elim (le_to_or_lt_eq O ? (le_O_n m))
673 rewrite < times_n_O in H.
674 apply (not_le_Sn_O ? H)
679 theorem monotonic_lt_times_r:
680 ∀n:nat.monotonic nat lt (λm.(S n)*m).
684 simplify.rewrite < plus_n_O.rewrite < plus_n_O.assumption.
685 apply lt_plus.assumption.assumption.
688 theorem monotonic_lt_times_r:
689 ∀c:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 c →
\ 5a href="cic:/matita/basics/relations/monotonic.def(1)"
\ 6monotonic
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/lt.def(1)"
\ 6lt
\ 5/a
\ 6 (λt.(c
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6t)).
691 (elim ltnm) normalize
693 |#a #_ #lt1 @(
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6 … lt1) //
697 theorem monotonic_lt_times_l:
698 ∀c:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 c →
\ 5a href="cic:/matita/basics/relations/monotonic.def(1)"
\ 6monotonic
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/lt.def(1)"
\ 6lt
\ 5/a
\ 6 (λt.(t
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6c)).
702 theorem lt_to_le_to_lt_times:
703 ∀n,m,p,q:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m → p
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 q →
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 q → n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6q.
704 #n #m #p #q #ltnm #lepq #posq
705 @(
\ 5a href="cic:/matita/arithmetics/nat/le_to_lt_to_lt.def(4)"
\ 6le_to_lt_to_lt
\ 5/a
\ 6 ? (n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6q))
706 [@
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_times_r.def(8)"
\ 6monotonic_le_times_r
\ 5/a
\ 6 //
707 |@
\ 5a href="cic:/matita/arithmetics/nat/monotonic_lt_times_l.def(9)"
\ 6monotonic_lt_times_l
\ 5/a
\ 6 //
711 theorem lt_times:∀n,m,p,q:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6m → p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6q → n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6q.
712 #n #m #p #q #ltnm #ltpq @
\ 5a href="cic:/matita/arithmetics/nat/lt_to_le_to_lt_times.def(10)"
\ 6lt_to_le_to_lt_times
\ 5/a
\ 6/2/
715 theorem lt_times_n_to_lt_l:
716 ∀n,p,q:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. p
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 q
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6n → p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 q.
717 #n #p #q #Hlt (elim (
\ 5a href="cic:/matita/arithmetics/nat/decidable_lt.def(7)"
\ 6decidable_lt
\ 5/a
\ 6 p q)) //
718 #nltpq @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 @(
\ 5a href="cic:/matita/basics/logic/absurd.def(2)"
\ 6absurd
\ 5/a
\ 6 ? ? (
\ 5a href="cic:/matita/arithmetics/nat/lt_to_not_le.def(7)"
\ 6lt_to_not_le
\ 5/a
\ 6 ? ? Hlt))
719 applyS
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_times_r.def(8)"
\ 6monotonic_le_times_r
\ 5/a
\ 6 /2/
722 theorem lt_times_n_to_lt_r:
723 ∀n,p,q:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 n
\ 5a title="natural times" href="cic:/fakeuri.def(1)"
\ 6*
\ 5/a
\ 6q → p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 q.
727 theorem nat_compare_times_l : \forall n,p,q:nat.
728 nat_compare p q = nat_compare ((S n) * p) ((S n) * q).
729 intros.apply nat_compare_elim.intro.
730 apply nat_compare_elim.
733 apply (inj_times_r n).assumption.
734 apply lt_to_not_eq. assumption.
736 apply (lt_times_to_lt_r n).assumption.
737 apply le_to_not_lt.apply lt_to_le.assumption.
738 intro.rewrite < H.rewrite > nat_compare_n_n.reflexivity.
739 intro.apply nat_compare_elim.intro.
741 apply (lt_times_to_lt_r n).assumption.
742 apply le_to_not_lt.apply lt_to_le.assumption.
745 apply (inj_times_r n).assumption.
746 apply lt_to_not_eq.assumption.
751 theorem lt_times_plus_times: \forall a,b,n,m:nat.
752 a < n \to b < m \to a*m + b < n*m.
755 [intros.apply False_ind.apply (not_le_Sn_O ? H)
759 change with (S b+a*m1 \leq m1+m*m1).
763 [apply le_S_S_to_le.assumption
770 (************************** minus ******************************)
774 [ O ⇒
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6
777 [ O ⇒
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 p
778 | S q ⇒ minus p q ]].
780 interpretation "natural minus" 'minus x y = (minus x y).
782 theorem minus_S_S: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m.
785 theorem minus_O_n: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6n.
788 theorem minus_n_O: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6.
791 theorem minus_n_n: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6n.
794 theorem minus_Sn_n: ∀n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n)
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6n.
795 #n (elim n) normalize // qed.
797 theorem minus_Sn_m: ∀m,n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n →
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 (n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m).
798 (* qualcosa da capire qui
799 #n #m #lenm nelim lenm napplyS refl_eq. *)
800 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6
802 |#n #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/
803 |#n #m #Hind #c applyS Hind /2/
808 theorem not_eq_to_le_to_le_minus:
809 ∀n,m.n ≠ m → n ≤ m → n ≤ m - 1.
810 #n * #m (cases m// #m normalize
811 #H #H1 napply le_S_S_to_le
812 napplyS (not_eq_to_le_to_lt n (S m) H H1)
815 theorem eq_minus_S_pred: ∀n,m. n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6 (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m)
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/pred.def(1)"
\ 6pred
\ 5/a
\ 6(n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m).
816 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 normalize // qed.
819 ∀m,n,p:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n → (n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m)
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6p
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 (n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6p)
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m.
820 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6
822 |#n #p #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/
827 theorem minus_plus_m_m: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 (n
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6m)
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m.
830 theorem plus_minus_m_m: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
831 m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n → n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 (n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m)
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6m.
832 #n #m #lemn @
\ 5a href="cic:/matita/basics/logic/sym_eq.def(2)"
\ 6sym_eq
\ 5/a
\ 6 /2/ qed.
834 theorem le_plus_minus_m_m: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 (n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m)
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6m.
835 #n (elim n) // #a #Hind #m (cases m) // normalize #n/2/
838 theorem minus_to_plus :∀n,m,p:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
839 m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n → n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 p → n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6p.
840 #n #m #p #lemn #eqp (applyS
\ 5a href="cic:/matita/arithmetics/nat/plus_minus_m_m.def(7)"
\ 6plus_minus_m_m
\ 5/a
\ 6) //
843 theorem plus_to_minus :∀n,m,p:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6p → n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 p.
844 #n #m #p #eqp @
\ 5a href="cic:/matita/basics/logic/sym_eq.def(2)"
\ 6sym_eq
\ 5/a
\ 6 (applyS (
\ 5a href="cic:/matita/arithmetics/nat/minus_plus_m_m.def(6)"
\ 6minus_plus_m_m
\ 5/a
\ 6 p m))
847 theorem minus_pred_pred : ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 n →
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 \ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m →
848 \ 5a href="cic:/matita/arithmetics/nat/pred.def(1)"
\ 6pred
\ 5/a
\ 6 n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/pred.def(1)"
\ 6pred
\ 5/a
\ 6 m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6 m.
849 #n #m #posn #posm @(
\ 5a href="cic:/matita/arithmetics/nat/lt_O_n_elim.def(4)"
\ 6lt_O_n_elim
\ 5/a
\ 6 n posn) @(
\ 5a href="cic:/matita/arithmetics/nat/lt_O_n_elim.def(4)"
\ 6lt_O_n_elim
\ 5/a
\ 6 m posm) //.
855 theorem le_SO_minus: \forall n,m:nat.S n \leq m \to S O \leq m-n.
856 intros.elim H.elim (minus_Sn_n n).apply le_n.
857 rewrite > minus_Sn_m.
858 apply le_S.assumption.
859 apply lt_to_le.assumption.
862 theorem minus_le_S_minus_S: \forall n,m:nat. m-n \leq S (m-(S n)).
864 apply (nat_elim2 (\lambda n,m.m-n \leq S (m-(S n)))).
865 intro.elim n1.simplify.apply le_n_Sn.
866 simplify.rewrite < minus_n_O.apply le_n.
867 intros.simplify.apply le_n_Sn.
868 intros.simplify.apply H.
871 theorem lt_minus_S_n_to_le_minus_n : \forall n,m,p:nat. m-(S n) < p \to m-n \leq p.
874 (* end auto($Revision: 9739 $) proof: TIME=1.33 SIZE=100 DEPTH=100 *)
875 apply (trans_le (m-n) (S (m-(S n))) p).
876 apply minus_le_S_minus_S.
880 theorem le_minus_m: \forall n,m:nat. n-m \leq n.
881 intros.apply (nat_elim2 (\lambda m,n. n-m \leq n)).
882 intros.rewrite < minus_n_O.apply le_n.
883 intros.simplify.apply le_n.
884 intros.simplify.apply le_S.assumption.
887 theorem lt_minus_m: \forall n,m:nat. O < n \to O < m \to n-m \lt n.
888 intros.apply (lt_O_n_elim n H).intro.
889 apply (lt_O_n_elim m H1).intro.
890 simplify.unfold lt.apply le_S_S.apply le_minus_m.
893 theorem minus_le_O_to_le: \forall n,m:nat. n-m \leq O \to n \leq m.
895 apply (nat_elim2 (\lambda n,m:nat.n-m \leq O \to n \leq m)).
897 simplify.intros. assumption.
898 simplify.intros.apply le_S_S.apply H.assumption.
902 (* monotonicity and galois *)
904 theorem monotonic_le_minus_l:
905 ∀p,q,n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. q
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 p → q
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 p
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6n.
906 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 #p #q
907 [#lePO @(
\ 5a href="cic:/matita/arithmetics/nat/le_n_O_elim.def(4)"
\ 6le_n_O_elim
\ 5/a
\ 6 ? lePO) //
909 |#Hind #n (cases n) // #a #leSS @Hind /2/
913 theorem le_minus_to_plus: ∀n,m,p. n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 p → n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 p
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6m.
914 #n #m #p #lep @
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6
915 [|@
\ 5a href="cic:/matita/arithmetics/nat/le_plus_minus_m_m.def(6)"
\ 6le_plus_minus_m_m
\ 5/a
\ 6 | @
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_plus_l.def(6)"
\ 6monotonic_le_plus_l
\ 5/a
\ 6 // ]
918 theorem le_minus_to_plus_r: ∀a,b,c. c
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 b → a
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 b
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6 c → a
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 c
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 b.
919 #a #b #c #Hlecb #H >(
\ 5a href="cic:/matita/arithmetics/nat/plus_minus_m_m.def(7)"
\ 6plus_minus_m_m
\ 5/a
\ 6 … Hlecb) /2/
922 theorem le_plus_to_minus: ∀n,m,p. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 p
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6m → n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 p.
923 #n #m #p #lep /2/ qed.
925 theorem le_plus_to_minus_r: ∀a,b,c. a
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 b
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 c → a
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 c
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6b.
926 #a #b #c #H @(
\ 5a href="cic:/matita/arithmetics/nat/le_plus_to_le_r.def(6)"
\ 6le_plus_to_le_r
\ 5/a
\ 6 … b) /2/
929 theorem lt_minus_to_plus: ∀a,b,c. a
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6 b
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 c → a
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 c
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 b.
930 #a #b #c #H @
\ 5a href="cic:/matita/arithmetics/nat/not_le_to_lt.def(5)"
\ 6not_le_to_lt
\ 5/a
\ 6
931 @(
\ 5a href="cic:/matita/basics/logic/not_to_not.def(3)"
\ 6not_to_not
\ 5/a
\ 6 … (
\ 5a href="cic:/matita/arithmetics/nat/lt_to_not_le.def(7)"
\ 6lt_to_not_le
\ 5/a
\ 6 …H)) /2/
934 theorem lt_minus_to_plus_r: ∀a,b,c. a
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 b
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6 c → a
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 c
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 b.
935 #a #b #c #H @
\ 5a href="cic:/matita/arithmetics/nat/not_le_to_lt.def(5)"
\ 6not_le_to_lt
\ 5/a
\ 6 @(
\ 5a href="cic:/matita/basics/logic/not_to_not.def(3)"
\ 6not_to_not
\ 5/a
\ 6 … (
\ 5a href="cic:/matita/arithmetics/nat/le_plus_to_minus.def(7)"
\ 6le_plus_to_minus
\ 5/a
\ 6 …))
936 @
\ 5a href="cic:/matita/arithmetics/nat/lt_to_not_le.def(7)"
\ 6lt_to_not_le
\ 5/a
\ 6 //
939 theorem lt_plus_to_minus: ∀n,m,p. m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n → n
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 p
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6m → n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 p.
940 #n #m #p #lenm #H normalize <
\ 5a href="cic:/matita/arithmetics/nat/minus_Sn_m.def(5)"
\ 6minus_Sn_m
\ 5/a
\ 6 // @
\ 5a href="cic:/matita/arithmetics/nat/le_plus_to_minus.def(7)"
\ 6le_plus_to_minus
\ 5/a
\ 6 //
943 theorem lt_plus_to_minus_r: ∀a,b,c. a
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6 b
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 c → a
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 c
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6 b.
944 #a #b #c #H @
\ 5a href="cic:/matita/arithmetics/nat/le_plus_to_minus_r.def(7)"
\ 6le_plus_to_minus_r
\ 5/a
\ 6 //
947 theorem monotonic_le_minus_r:
948 ∀p,q,n:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. q
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 p → n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6p
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6q.
949 #p #q #n #lepq @
\ 5a href="cic:/matita/arithmetics/nat/le_plus_to_minus.def(7)"
\ 6le_plus_to_minus
\ 5/a
\ 6
950 @(
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6 … (
\ 5a href="cic:/matita/arithmetics/nat/le_plus_minus_m_m.def(6)"
\ 6le_plus_minus_m_m
\ 5/a
\ 6 ? q)) /2/
953 theorem eq_minus_O: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
954 n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m → n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6.
955 #n #m #lenm @(
\ 5a href="cic:/matita/arithmetics/nat/le_n_O_elim.def(4)"
\ 6le_n_O_elim
\ 5/a
\ 6 (n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m)) /2/
958 theorem distributive_times_minus:
\ 5a href="cic:/matita/basics/relations/distributive.def(1)"
\ 6distributive
\ 5/a
\ 6 ?
\ 5a href="cic:/matita/arithmetics/nat/times.fix(0,0,2)"
\ 6times
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/minus.fix(0,0,1)"
\ 6minus
\ 5/a
\ 6.
960 (cases (
\ 5a href="cic:/matita/arithmetics/nat/decidable_lt.def(7)"
\ 6decidable_lt
\ 5/a
\ 6 b c)) #Hbc
961 [>
\ 5a href="cic:/matita/arithmetics/nat/eq_minus_O.def(9)"
\ 6eq_minus_O
\ 5/a
\ 6 /2/ >
\ 5a href="cic:/matita/arithmetics/nat/eq_minus_O.def(9)"
\ 6eq_minus_O
\ 5/a
\ 6 //
962 @
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_times_r.def(8)"
\ 6monotonic_le_times_r
\ 5/a
\ 6 /2/
963 |@
\ 5a href="cic:/matita/basics/logic/sym_eq.def(2)"
\ 6sym_eq
\ 5/a
\ 6 (applyS
\ 5a href="cic:/matita/arithmetics/nat/plus_to_minus.def(7)"
\ 6plus_to_minus
\ 5/a
\ 6) <
\ 5a href="cic:/matita/arithmetics/nat/distributive_times_plus.def(7)"
\ 6distributive_times_plus
\ 5/a
\ 6
964 @
\ 5a href="cic:/matita/basics/logic/eq_f.def(3)"
\ 6eq_f
\ 5/a
\ 6 (applyS
\ 5a href="cic:/matita/arithmetics/nat/plus_minus_m_m.def(7)"
\ 6plus_minus_m_m
\ 5/a
\ 6) /2/
967 theorem minus_plus: ∀n,m,p. n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6p
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6(m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6p).
969 cases (
\ 5a href="cic:/matita/arithmetics/nat/decidable_le.def(6)"
\ 6decidable_le
\ 5/a
\ 6 (m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6p) n) #Hlt
970 [@
\ 5a href="cic:/matita/arithmetics/nat/plus_to_minus.def(7)"
\ 6plus_to_minus
\ 5/a
\ 6 @
\ 5a href="cic:/matita/arithmetics/nat/plus_to_minus.def(7)"
\ 6plus_to_minus
\ 5/a
\ 6 <
\ 5a href="cic:/matita/arithmetics/nat/associative_plus.def(4)"
\ 6associative_plus
\ 5/a
\ 6
971 @
\ 5a href="cic:/matita/arithmetics/nat/minus_to_plus.def(8)"
\ 6minus_to_plus
\ 5/a
\ 6 //
972 |cut (n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6p) [@(
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6 … (
\ 5a href="cic:/matita/arithmetics/nat/le_n_Sn.def(1)"
\ 6le_n_Sn
\ 5/a
\ 6 …)) @
\ 5a href="cic:/matita/arithmetics/nat/not_le_to_lt.def(5)"
\ 6not_le_to_lt
\ 5/a
\ 6 //]
973 #H >
\ 5a href="cic:/matita/arithmetics/nat/eq_minus_O.def(9)"
\ 6eq_minus_O
\ 5/a
\ 6 /2/ >
\ 5a href="cic:/matita/arithmetics/nat/eq_minus_O.def(9)"
\ 6eq_minus_O
\ 5/a
\ 6 //
978 theorem plus_minus: ∀n,m,p. p ≤ m → (n+m)-p = n +(m-p).
979 #n #m #p #lepm @plus_to_minus >(commutative_plus p)
980 >associative_plus <plus_minus_m_m //
983 theorem minus_minus: ∀n,m,p:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. p
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m → m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n →
984 p
\ 5a title="natural plus" href="cic:/fakeuri.def(1)"
\ 6+
\ 5/a
\ 6(n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6m)
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 n
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6(m
\ 5a title="natural minus" href="cic:/fakeuri.def(1)"
\ 6-
\ 5/a
\ 6p).
986 @
\ 5a href="cic:/matita/basics/logic/sym_eq.def(2)"
\ 6sym_eq
\ 5/a
\ 6 @
\ 5a href="cic:/matita/arithmetics/nat/plus_to_minus.def(7)"
\ 6plus_to_minus
\ 5/a
\ 6 <
\ 5a href="cic:/matita/arithmetics/nat/associative_plus.def(4)"
\ 6associative_plus
\ 5/a
\ 6 <
\ 5a href="cic:/matita/arithmetics/nat/plus_minus_m_m.def(7)"
\ 6plus_minus_m_m
\ 5/a
\ 6 //
987 <
\ 5a href="cic:/matita/arithmetics/nat/commutative_plus.def(5)"
\ 6commutative_plus
\ 5/a
\ 6 <
\ 5a href="cic:/matita/arithmetics/nat/plus_minus_m_m.def(7)"
\ 6plus_minus_m_m
\ 5/a
\ 6 //
990 (*********************** boolean arithmetics ********************)
991 include "basics/bool.ma".
995 [ O ⇒ match m with [ O ⇒
\ 5a href="cic:/matita/basics/bool/bool.con(0,1,0)"
\ 6true
\ 5/a
\ 6 | S q ⇒
\ 5a href="cic:/matita/basics/bool/bool.con(0,2,0)"
\ 6false
\ 5/a
\ 6]
996 | S p ⇒ match m with [ O ⇒
\ 5a href="cic:/matita/basics/bool/bool.con(0,2,0)"
\ 6false
\ 5/a
\ 6 | S q ⇒ eqb p q]
999 theorem eqb_elim : ∀ n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.∀ P:
\ 5a href="cic:/matita/basics/bool/bool.ind(1,0,0)"
\ 6bool
\ 5/a
\ 6 → Prop.
1000 (n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6m → (P
\ 5a href="cic:/matita/basics/bool/bool.con(0,1,0)"
\ 6true
\ 5/a
\ 6)) → (n
\ 5a title="leibnitz's non-equality" href="cic:/fakeuri.def(1)"
\ 6≠
\ 5/a
\ 6 m → (P
\ 5a href="cic:/matita/basics/bool/bool.con(0,2,0)"
\ 6false
\ 5/a
\ 6)) → (P (
\ 5a href="cic:/matita/arithmetics/nat/eqb.fix(0,0,1)"
\ 6eqb
\ 5/a
\ 6 n m)).
1001 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6
1002 [#n (cases n) normalize /3/
1008 theorem eqb_n_n: ∀n.
\ 5a href="cic:/matita/arithmetics/nat/eqb.fix(0,0,1)"
\ 6eqb
\ 5/a
\ 6 n n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/basics/bool/bool.con(0,1,0)"
\ 6true
\ 5/a
\ 6.
1009 #n (elim n) normalize // qed.
1011 theorem eqb_true_to_eq: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/eqb.fix(0,0,1)"
\ 6eqb
\ 5/a
\ 6 n m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/basics/bool/bool.con(0,1,0)"
\ 6true
\ 5/a
\ 6 → n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 m.
1012 #n #m @(
\ 5a href="cic:/matita/arithmetics/nat/eqb_elim.def(5)"
\ 6eqb_elim
\ 5/a
\ 6 n m) // #_ #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/ qed.
1014 theorem eqb_false_to_not_eq: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
\ 5a href="cic:/matita/arithmetics/nat/eqb.fix(0,0,1)"
\ 6eqb
\ 5/a
\ 6 n m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/basics/bool/bool.con(0,2,0)"
\ 6false
\ 5/a
\ 6 → n
\ 5a title="leibnitz's non-equality" href="cic:/fakeuri.def(1)"
\ 6≠
\ 5/a
\ 6 m.
1015 #n #m @(
\ 5a href="cic:/matita/arithmetics/nat/eqb_elim.def(5)"
\ 6eqb_elim
\ 5/a
\ 6 n m) /2/ qed.
1017 theorem eq_to_eqb_true: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.n
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 m →
\ 5a href="cic:/matita/arithmetics/nat/eqb.fix(0,0,1)"
\ 6eqb
\ 5/a
\ 6 n m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/basics/bool/bool.con(0,1,0)"
\ 6true
\ 5/a
\ 6.
1020 theorem not_eq_to_eqb_false: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
1021 n
\ 5a title="leibnitz's non-equality" href="cic:/fakeuri.def(1)"
\ 6≠
\ 5/a
\ 6 m →
\ 5a href="cic:/matita/arithmetics/nat/eqb.fix(0,0,1)"
\ 6eqb
\ 5/a
\ 6 n m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/basics/bool/bool.con(0,2,0)"
\ 6false
\ 5/a
\ 6.
1022 #n #m #noteq @
\ 5a href="cic:/matita/arithmetics/nat/eqb_elim.def(5)"
\ 6eqb_elim
\ 5/a
\ 6// #Heq @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/ qed.
1026 [ O ⇒
\ 5a href="cic:/matita/basics/bool/bool.con(0,1,0)"
\ 6true
\ 5/a
\ 6
1029 [ O ⇒
\ 5a href="cic:/matita/basics/bool/bool.con(0,2,0)"
\ 6false
\ 5/a
\ 6
1030 | (S q) ⇒ leb p q]].
1032 theorem leb_elim: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. ∀P:
\ 5a href="cic:/matita/basics/bool/bool.ind(1,0,0)"
\ 6bool
\ 5/a
\ 6 → Prop.
1033 (n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m → P
\ 5a href="cic:/matita/basics/bool/bool.con(0,1,0)"
\ 6true
\ 5/a
\ 6) → (n
\ 5a title="natural 'neither less nor equal to'" href="cic:/fakeuri.def(1)"
\ 6≰
\ 5/a
\ 6 m → P
\ 5a href="cic:/matita/basics/bool/bool.con(0,2,0)"
\ 6false
\ 5/a
\ 6) → P (
\ 5a href="cic:/matita/arithmetics/nat/leb.fix(0,0,1)"
\ 6leb
\ 5/a
\ 6 n m).
1034 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 normalize
1037 |#n #m #Hind #P #Pt #Pf @Hind
1038 [#lenm @Pt @
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6 // |#nlenm @Pf /2/ ]
1042 theorem leb_true_to_le:∀n,m.
\ 5a href="cic:/matita/arithmetics/nat/leb.fix(0,0,1)"
\ 6leb
\ 5/a
\ 6 n m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/basics/bool/bool.con(0,1,0)"
\ 6true
\ 5/a
\ 6 → n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m.
1043 #n #m @
\ 5a href="cic:/matita/arithmetics/nat/leb_elim.def(6)"
\ 6leb_elim
\ 5/a
\ 6 // #_ #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/ qed.
1045 theorem leb_false_to_not_le:∀n,m.
1046 \ 5a href="cic:/matita/arithmetics/nat/leb.fix(0,0,1)"
\ 6leb
\ 5/a
\ 6 n m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/basics/bool/bool.con(0,2,0)"
\ 6false
\ 5/a
\ 6 → n
\ 5a title="natural 'neither less nor equal to'" href="cic:/fakeuri.def(1)"
\ 6≰
\ 5/a
\ 6 m.
1047 #n #m @
\ 5a href="cic:/matita/arithmetics/nat/leb_elim.def(6)"
\ 6leb_elim
\ 5/a
\ 6 // #_ #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/ qed.
1049 theorem le_to_leb_true: ∀n,m. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m →
\ 5a href="cic:/matita/arithmetics/nat/leb.fix(0,0,1)"
\ 6leb
\ 5/a
\ 6 n m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/basics/bool/bool.con(0,1,0)"
\ 6true
\ 5/a
\ 6.
1050 #n #m @
\ 5a href="cic:/matita/arithmetics/nat/leb_elim.def(6)"
\ 6leb_elim
\ 5/a
\ 6 // #H #H1 @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/ qed.
1052 theorem not_le_to_leb_false: ∀n,m. n
\ 5a title="natural 'neither less nor equal to'" href="cic:/fakeuri.def(1)"
\ 6≰
\ 5/a
\ 6 m →
\ 5a href="cic:/matita/arithmetics/nat/leb.fix(0,0,1)"
\ 6leb
\ 5/a
\ 6 n m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/basics/bool/bool.con(0,2,0)"
\ 6false
\ 5/a
\ 6.
1053 #n #m @
\ 5a href="cic:/matita/arithmetics/nat/leb_elim.def(6)"
\ 6leb_elim
\ 5/a
\ 6 // #H #H1 @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /2/ qed.
1055 theorem lt_to_leb_false: ∀n,m. m
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 n →
\ 5a href="cic:/matita/arithmetics/nat/leb.fix(0,0,1)"
\ 6leb
\ 5/a
\ 6 n m
\ 5a title="leibnitz's equality" href="cic:/fakeuri.def(1)"
\ 6=
\ 5/a
\ 6 \ 5a href="cic:/matita/basics/bool/bool.con(0,2,0)"
\ 6false
\ 5/a
\ 6.
1059 ndefinition ltb ≝λn,m. leb (S n) m.
1061 theorem ltb_elim: ∀n,m:nat. ∀P:bool → Prop.
1062 (n < m → P true) → (n ≮ m → P false) → P (ltb n m).
1064 napply leb_elim /3/ qed.
1066 theorem ltb_true_to_lt:∀n,m.ltb n m = true → n < m.
1067 #n #m #Hltb napply leb_true_to_le nassumption
1070 theorem ltb_false_to_not_lt:∀n,m.
1071 ltb n m = false → n ≮ m.
1072 #n #m #Hltb napply leb_false_to_not_le nassumption
1075 theorem lt_to_ltb_true: ∀n,m. n < m → ltb n m = true.
1076 #n #m #Hltb napply le_to_leb_true nassumption
1079 theorem le_to_ltb_false: ∀n,m. m \le n → ltb n m = false.
1080 #n #m #Hltb napply lt_to_leb_false /2/
1084 definition min:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 ≝
1085 λn.λm.
\ 5a href="cic:/matita/basics/bool/if_then_else.def(1)"
\ 6if_then_else
\ 5/a
\ 6 ? (
\ 5a href="cic:/matita/arithmetics/nat/leb.fix(0,0,1)"
\ 6leb
\ 5/a
\ 6 n m) n m.
1087 definition max:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 →
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 ≝
1088 λn.λm.
\ 5a href="cic:/matita/basics/bool/if_then_else.def(1)"
\ 6if_then_else
\ 5/a
\ 6 ? (
\ 5a href="cic:/matita/arithmetics/nat/leb.fix(0,0,1)"
\ 6leb
\ 5/a
\ 6 n m) m n.
1090 lemma commutative_min:
\ 5a href="cic:/matita/basics/relations/commutative.def(1)"
\ 6commutative
\ 5/a
\ 6 ?
\ 5a href="cic:/matita/arithmetics/nat/min.def(2)"
\ 6min
\ 5/a
\ 6.
1091 #n #m normalize @
\ 5a href="cic:/matita/arithmetics/nat/leb_elim.def(6)"
\ 6leb_elim
\ 5/a
\ 6
1092 [@
\ 5a href="cic:/matita/arithmetics/nat/leb_elim.def(6)"
\ 6leb_elim
\ 5/a
\ 6 normalize /2/
1093 |#notle >(
\ 5a href="cic:/matita/arithmetics/nat/le_to_leb_true.def(7)"
\ 6le_to_leb_true
\ 5/a
\ 6 …) // @(
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6 ? (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m)) /2/
1096 lemma le_minr: ∀i,n,m. i
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/min.def(2)"
\ 6min
\ 5/a
\ 6 n m → i
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m.
1097 #i #n #m normalize @
\ 5a href="cic:/matita/arithmetics/nat/leb_elim.def(6)"
\ 6leb_elim
\ 5/a
\ 6 normalize /2/ qed.
1099 lemma le_minl: ∀i,n,m. i
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/min.def(2)"
\ 6min
\ 5/a
\ 6 n m → i
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n.
1102 lemma to_min: ∀i,n,m. i
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 n → i
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 m → i
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 \ 5a href="cic:/matita/arithmetics/nat/min.def(2)"
\ 6min
\ 5/a
\ 6 n m.
1103 #i #n #m #lein #leim normalize (cases (
\ 5a href="cic:/matita/arithmetics/nat/leb.fix(0,0,1)"
\ 6leb
\ 5/a
\ 6 n m))
1106 lemma commutative_max:
\ 5a href="cic:/matita/basics/relations/commutative.def(1)"
\ 6commutative
\ 5/a
\ 6 ?
\ 5a href="cic:/matita/arithmetics/nat/max.def(2)"
\ 6max
\ 5/a
\ 6.
1107 #n #m normalize @
\ 5a href="cic:/matita/arithmetics/nat/leb_elim.def(6)"
\ 6leb_elim
\ 5/a
\ 6
1108 [@
\ 5a href="cic:/matita/arithmetics/nat/leb_elim.def(6)"
\ 6leb_elim
\ 5/a
\ 6 normalize /2/
1109 |#notle >(
\ 5a href="cic:/matita/arithmetics/nat/le_to_leb_true.def(7)"
\ 6le_to_leb_true
\ 5/a
\ 6 …) // @(
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6 ? (
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 m)) /2/
1112 lemma le_maxl: ∀i,n,m.
\ 5a href="cic:/matita/arithmetics/nat/max.def(2)"
\ 6max
\ 5/a
\ 6 n m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 i → n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 i.
1113 #i #n #m normalize @
\ 5a href="cic:/matita/arithmetics/nat/leb_elim.def(6)"
\ 6leb_elim
\ 5/a
\ 6 normalize /2/ qed.
1115 lemma le_maxr: ∀i,n,m.
\ 5a href="cic:/matita/arithmetics/nat/max.def(2)"
\ 6max
\ 5/a
\ 6 n m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 i → m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 i.
1118 lemma to_max: ∀i,n,m. n
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 i → m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 i →
\ 5a href="cic:/matita/arithmetics/nat/max.def(2)"
\ 6max
\ 5/a
\ 6 n m
\ 5a title="natural 'less or equal to'" href="cic:/fakeuri.def(1)"
\ 6≤
\ 5/a
\ 6 i.
1119 #i #n #m #leni #lemi normalize (cases (
\ 5a href="cic:/matita/arithmetics/nat/leb.fix(0,0,1)"
\ 6leb
\ 5/a
\ 6 n m))