2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department of the University of Bologna, Italy.
7 ||A|| This file is distributed under the terms of the
8 \ / GNU General Public License Version 2
10 V_______________________________________________________________ *)
12 include "basics/relations.ma".
14 inductive nat : Type[0] ≝
18 interpretation "Natural numbers" 'N = nat.
20 alias num (instance 0) = "natural number".
23 λn. match n with [ O ⇒
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6 | S p ⇒ p].
25 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).
28 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.
32 theorem inj_S : \forall n,m:nat.(S n)=(S m) \to n=m.
35 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.
36 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/not_to_not.def(3)"
\ 6not_to_not
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
38 definition not_zero:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6 → Prop ≝
39 λ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 ].
41 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.
42 #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.
44 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.
45 #n (elim n) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/not_eq_S.def(4)"
\ 6not_eq_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
48 ∀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.
49 (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.
50 #n #P (elim n) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace {}
\ 5/span
\ 6\ 5/span
\ 6/ qed.
53 ∀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.
54 (∀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)
55 → (∀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)
56 → (∀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))
57 → ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6. R n m.
58 #R #ROn #RSO #RSS #n (elim n) // #n0 #Rn0m #m (cases m) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace {}
\ 5/span
\ 6\ 5/span
\ 6/ qed.
60 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).
61 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 #n [ (cases n) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/Or.con(0,1,2)"
\ 6or_introl
\ 5/a
\ 6,
\ 5a href="cic:/matita/basics/logic/Or.con(0,2,2)"
\ 6or_intror
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ | /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/Or.con(0,2,2)"
\ 6or_intror
\ 5/a
\ 6,
\ 5a href="cic:/matita/basics/logic/sym_not_eq.def(4)"
\ 6sym_not_eq
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ | #m #Hind (cases Hind) /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/Or.con(0,1,2)"
\ 6or_introl
\ 5/a
\ 6,
\ 5a href="cic:/matita/basics/logic/Or.con(0,2,2)"
\ 6or_intror
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/not_eq_S.def(4)"
\ 6not_eq_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/]
64 (*************************** plus ******************************)
67 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) ].
69 interpretation "natural plus" 'plus x y = (plus x y).
71 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.
75 theorem plus_Sn_m: ∀n,m:nat. S (n + m) = S n + m.
79 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.
80 #n (elim n) normalize // qed.
82 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.
83 #n (elim n) normalize // qed.
86 theorem plus_Sn_m1: ∀n,m:nat. S m + n = n + S m.
87 #n (elim n) normalize // qed.
91 theorem plus_n_1 : ∀n:nat. S n = n+1.
95 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.
96 #n (elim n) normalize // qed.
98 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.
99 #n (elim n) normalize // qed.
101 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.
104 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).
105 #n (elim n) normalize /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/injective_S.def(4)"
\ 6injective_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
107 (* theorem inj_plus_r: \forall p,n,m:nat. p+n = p+m \to n=m
108 \def injective_plus_r.
110 theorem injective_plus_l: ∀m:nat.injective nat nat (λn.n+m).
113 (* theorem inj_plus_l: \forall p,n,m:nat. n+p = m+p \to n=m
114 \def injective_plus_l. *)
116 (*************************** times *****************************)
119 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) ].
121 interpretation "natural times" 'times x y = (times x y).
123 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.
126 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.
129 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.
132 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).
133 #n (elim n) normalize // qed.
135 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.
136 #n (elim n) normalize // qed.
138 (* variant sym_times : \forall n,m:nat. n*m = m*n \def
141 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.
142 #n (elim n) normalize // qed.
144 theorem distributive_times_plus_r :
145 ∀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.
148 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.
149 #n (elim n) normalize // qed.
151 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).
154 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.
157 (* ci servono questi risultati?
158 theorem times_O_to_O: ∀n,m:nat.n*m=O → n=O ∨ m=O.
160 #n #m #H normalize #H1 napply False_ind napply not_eq_O_S
163 theorem times_n_SO : ∀n:nat. n = n * S O.
166 theorem times_SSO_n : ∀n:nat. n + n = (S(S O)) * n.
169 nlemma times_SSO: \forall n.(S(S O))*(S n) = S(S((S(S O))*n)).
172 theorem or_eq_eq_S: \forall n.\exists m.
173 n = (S(S O))*m \lor n = S ((S(S O))*m).
176 ##|#a #H nelim H #b#ornelim or#aeq
183 (******************** ordering relations ************************)
185 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 ≝
187 | 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).
189 interpretation "natural 'less or equal to'" 'leq x y = (le x y).
191 interpretation "natural 'neither less nor equal to'" 'nleq x y = (Not (le x y)).
193 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.
195 interpretation "natural 'less than'" 'lt x y = (lt x y).
196 interpretation "natural 'not less than'" 'nless x y = (Not (lt x y)).
198 (* lemma eq_lt: ∀n,m. (n < m) = (S n ≤ m).
201 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.
203 interpretation "natural 'greater or equal to'" 'geq x y = (ge x y).
205 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.
207 interpretation "natural 'greater than'" 'gt x y = (gt x y).
208 interpretation "natural 'not greater than'" 'ngtr x y = (Not (gt x y)).
210 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.
211 #a #b #c #leab #lebc (elim lebc) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,2,1)"
\ 6le_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
215 theorem trans_le: \forall n,m,p:nat. n \leq m \to m \leq p \to n \leq p
216 \def transitive_le. *)
218 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.
219 #a #b #c #ltab #ltbc (elim ltbc) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,2,1)"
\ 6le_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/qed.
222 theorem trans_lt: \forall n,m,p:nat. lt n m \to lt m p \to lt n p
223 \def transitive_lt. *)
225 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.
226 #n #m #lenm (elim lenm) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,2,1)"
\ 6le_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
228 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.
229 #n (elim n) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,2,1)"
\ 6le_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
231 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.
232 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,2,1)"
\ 6le_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
234 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.
237 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.
238 #n #m #lenm (elim lenm) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
240 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.
242 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_pred.def(4)"
\ 6monotonic_pred
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
244 (* this are instances of the le versions
245 theorem lt_S_S_to_lt: ∀n,m. S n < S m → n < m.
248 theorem lt_to_lt_S_S: ∀n,m. n < m → S n < S m.
251 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.
252 #n #m #Hlt (elim Hlt) // qed.
255 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.
256 #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.
258 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.
259 /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/not_to_not.def(3)"
\ 6not_to_not
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/monotonic_pred.def(4)"
\ 6monotonic_pred
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
261 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.
262 /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/not_to_not.def(3)"
\ 6not_to_not
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
264 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).
265 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 #n /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/Or.con(0,1,2)"
\ 6or_introl
\ 5/a
\ 6,
\ 5a href="cic:/matita/basics/logic/Or.con(0,2,2)"
\ 6or_intror
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ #m * /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/Or.con(0,1,2)"
\ 6or_introl
\ 5/a
\ 6,
\ 5a href="cic:/matita/basics/logic/Or.con(0,2,2)"
\ 6or_intror
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/not_le_to_not_le_S_S.def(5)"
\ 6not_le_to_not_le_S_S
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
267 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).
268 #n #m @
\ 5a href="cic:/matita/arithmetics/nat/decidable_le.def(6)"
\ 6decidable_le
\ 5/a
\ 6 qed.
270 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.
271 #n (elim n) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/not_le_to_not_le_S_S.def(5)"
\ 6not_le_to_not_le_S_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
273 (* this is le_S_S_to_le
274 theorem lt_S_to_le: ∀n,m:nat. n < S m → n ≤ m.
278 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.
279 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
281 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.
282 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 #n
283 [#abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/absurd.def(2)"
\ 6absurd
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
284 |/
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
285 |#m #Hind #HnotleSS @
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/not_le_S_S_to_not_le.def(4)"
\ 6not_le_S_S_to_not_le
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
289 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.
290 #n #m #Hltnm (elim Hltnm) /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/not_to_not.def(3)"
\ 6not_to_not
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
292 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.
293 /
\ 5span class="autotactic"
\ 64
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/not_to_not.def(3)"
\ 6not_to_not
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/not_le_to_lt.def(5)"
\ 6not_le_to_lt
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/monotonic_pred.def(4)"
\ 6monotonic_pred
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
295 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.
296 #n #m #H @
\ 5a href="cic:/matita/arithmetics/nat/lt_to_not_le.def(7)"
\ 6lt_to_not_le
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ (* /3/ *) qed.
298 (* lt and le trans *)
300 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.
301 #n #m #p #H #H1 (elim H1) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/transitive_lt.def(3)"
\ 6transitive_lt
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
303 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.
304 #n #m #p #H (elim H) /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/transitive_lt.def(3)"
\ 6transitive_lt
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
306 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.
307 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/transitive_lt.def(3)"
\ 6transitive_lt
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
309 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.
310 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_to_lt_to_lt.def(4)"
\ 6le_to_lt_to_lt
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
313 theorem lt_SO_n_to_lt_O_pred_n: \forall n:nat.
314 (S O) \lt n \to O \lt (pred n).
316 apply (ltn_to_ltO (pred (S O)) (pred n) ?).
317 apply (lt_pred (S O) n)
323 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 →
324 ∀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.
325 #n (elim n) // #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/absurd.def(2)"
\ 6absurd
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
328 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.
329 #n #posn (cases posn) //
333 theorem lt_pred: \forall n,m.
334 O < n \to n < m \to pred n < pred m.
336 [intros.apply False_ind.apply (not_le_Sn_O ? H)
337 |intros.apply False_ind.apply (not_le_Sn_O ? H1)
338 |intros.simplify.unfold.apply le_S_S_to_le.assumption
342 theorem le_pred_to_le:
343 ∀n,m. O < m → pred n ≤ pred m → n ≤ m.
359 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.
360 #n #m #lenm (elim lenm) /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/Or.con(0,1,2)"
\ 6or_introl
\ 5/a
\ 6,
\ 5a href="cic:/matita/basics/logic/Or.con(0,2,2)"
\ 6or_intror
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le_to_lt_to_lt.def(4)"
\ 6le_to_lt_to_lt
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
363 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.
364 #n #m #H @
\ 5a href="cic:/matita/basics/logic/not_to_not.def(3)"
\ 6not_to_not
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/absurd.def(2)"
\ 6absurd
\ 5/a
\ 6,
\ 5a href="cic:/matita/basics/logic/Not.con(0,1,1)"
\ 6nmk
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
367 theorem eq_to_not_lt: ∀a,b:nat. a = b → a ≮ b.
372 apply (lt_to_not_eq b b)
378 theorem lt_n_m_to_not_lt_m_Sn: ∀n,m. n < m → m ≮ S n.
384 generalize in match (le_S_S ? ? H)
386 generalize in match (transitive_le ? ? ? H2 H1)
388 apply (not_le_Sn_n ? H3).
391 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.
392 #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) //
393 #Heq /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/not_to_not.def(3)"
\ 6not_to_not
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/not_le_to_lt.def(5)"
\ 6not_le_to_lt
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
395 nelim (Hneq Heq) qed. *)
398 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.
399 #n (cases n) // #a #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/absurd.def(2)"
\ 6absurd
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
401 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.
402 #n (cases n) // #a #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/absurd.def(2)"
\ 6absurd
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
404 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 →
405 ∀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.
406 #n #m #Hle #P (elim Hle) /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
410 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.
411 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 64
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/eq_f.def(3)"
\ 6eq_f
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le_n_O_to_eq.def(4)"
\ 6le_n_O_to_eq
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/monotonic_pred.def(4)"
\ 6monotonic_pred
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
414 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.
415 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/not_le_to_lt.def(5)"
\ 6not_le_to_lt
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
418 (* other abstract properties *)
419 theorem antisymmetric_le : antisymmetric nat le.
420 unfold antisymmetric.intros 2.
421 apply (nat_elim2 (\lambda n,m.(n \leq m \to m \leq n \to n=m))).
422 intros.apply le_n_O_to_eq.assumption.
423 intros.apply False_ind.apply (not_le_Sn_O ? H).
424 intros.apply eq_f.apply H.
425 apply le_S_S_to_le.assumption.
426 apply le_S_S_to_le.assumption.
429 theorem antisym_le: \forall n,m:nat. n \leq m \to m \leq n \to n=m
430 \def antisymmetric_le.
432 theorem le_n_m_to_lt_m_Sn_to_eq_n_m: ∀n,m. n ≤ m → m < S n → n=m.
435 generalize in match (le_S_S_to_le ? ? H1)
442 (* well founded induction principles *)
444 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.
445 (∀m.(∀p. p
\ 5a title="natural 'less than'" href="cic:/fakeuri.def(1)"
\ 6<
\ 5/a
\ 6 m → P p) → P m) → P n.
447 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) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
449 [#q #HleO (* applica male *)
450 @(
\ 5a href="cic:/matita/arithmetics/nat/le_n_O_elim.def(4)"
\ 6le_n_O_elim
\ 5/a
\ 6 ? HleO)
451 @H #p #ltpO @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/absurd.def(2)"
\ 6absurd
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ (* 3 *)
453 @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 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
457 (* some properties of functions *)
459 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).
461 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.
462 \ 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.
463 #f #incr #n #m #ltnm (elim ltnm) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/transitive_lt.def(3)"
\ 6transitive_lt
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
466 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.
467 \ 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.
468 #f #incr #n (elim n) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_to_lt_to_lt.def(4)"
\ 6le_to_lt_to_lt
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
471 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.
472 \ 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.
473 #f #incr #m (elim m) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/ex.con(0,1,2)"
\ 6ex_intro
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/#n * #a #lenfa
474 @(
\ 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)) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_to_lt_to_lt.def(4)"
\ 6le_to_lt_to_lt
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
477 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 →
478 ∀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).
479 #f #incr #m #lem (elim lem)
480 [@(
\ 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) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/And.con(0,1,2)"
\ 6conj
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
481 |#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
482 [@(
\ 5a href="cic:/matita/basics/logic/ex.con(0,1,2)"
\ 6ex_intro
\ 5/a
\ 6 ? ? a) % /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,2,1)"
\ 6le_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
483 |@(
\ 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)) % //
488 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.
489 \ 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.
490 #f #incr #n #m cases(
\ 5a href="cic:/matita/arithmetics/nat/decidable_le.def(6)"
\ 6decidable_le
\ 5/a
\ 6 n m)
491 [#lenm cases(
\ 5a href="cic:/matita/arithmetics/nat/le_to_or_lt_eq.def(5)"
\ 6le_to_or_lt_eq
\ 5/a
\ 6 … lenm) //
492 #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
493 @
\ 5a href="cic:/matita/arithmetics/nat/increasing_to_monotonic.def(4)"
\ 6increasing_to_monotonic
\ 5/a
\ 6 //
494 |#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
495 @
\ 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 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/not_le_to_lt.def(5)"
\ 6not_le_to_lt
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
499 (*********************** monotonicity ***************************)
500 theorem monotonic_le_plus_r:
501 ∀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).
502 #n #a #b (elim n) normalize //
503 #m #H #leab @
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace {}
\ 5/span
\ 6\ 5/span
\ 6/ qed.
506 theorem le_plus_r: ∀p,n,m:nat. n ≤ m → p + n ≤ p + m
507 ≝ monotonic_le_plus_r. *)
509 theorem monotonic_le_plus_l:
510 ∀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).
511 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_plus_r.def(3)"
\ 6monotonic_le_plus_r
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
514 theorem le_plus_l: \forall p,n,m:nat. n \le m \to n + p \le m + p
515 \def monotonic_le_plus_l. *)
517 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
518 → 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.
519 #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))
520 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_plus_l.def(6)"
\ 6monotonic_le_plus_l
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_plus_r.def(3)"
\ 6monotonic_le_plus_r
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
522 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.
523 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_plus_l.def(6)"
\ 6monotonic_le_plus_l
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
525 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.
526 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_plus.def(7)"
\ 6le_plus
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
528 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.
529 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
531 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.
532 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace {}
\ 5/span
\ 6\ 5/span
\ 6/ qed.
534 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.
537 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.
538 #a (elim a) normalize /
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_pred.def(4)"
\ 6monotonic_pred
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
540 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.
541 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_plus_to_le.def(5)"
\ 6le_plus_to_le
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
545 theorem monotonic_lt_plus_r:
546 ∀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).
547 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/increasing_to_monotonic.def(4)"
\ 6increasing_to_monotonic
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
550 variant lt_plus_r: \forall n,p,q:nat. p < q \to n + p < n + q \def
551 monotonic_lt_plus_r. *)
553 theorem monotonic_lt_plus_l:
554 ∀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).
555 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/increasing_to_monotonic.def(4)"
\ 6increasing_to_monotonic
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
558 variant lt_plus_l: \forall n,p,q:nat. p < q \to p + n < q + n \def
559 monotonic_lt_plus_l. *)
561 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.
562 #n #m #p #q #ltnm #ltpq
563 @(
\ 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))/
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_lt_plus_l.def(9)"
\ 6monotonic_lt_plus_l
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_plus_r.def(3)"
\ 6monotonic_le_plus_r
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
565 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.
566 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_plus_to_le.def(5)"
\ 6le_plus_to_le
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
568 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.
569 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/lt_plus_to_lt_l.def(6)"
\ 6lt_plus_to_lt_l
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
572 theorem le_to_lt_to_lt_plus: ∀a,b,c,d:nat.
573 a ≤ c → b < d → a + b < c+d.
574 (* bello /2/ un po' lento *)
575 #a #b #c #d #leac #lebd
576 normalize napplyS le_plus // qed.
580 theorem monotonic_le_times_r:
581 ∀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).
582 #n #x #y #lexy (elim n) normalize//(* lento /2/*)
583 #a #lea @
\ 5a href="cic:/matita/arithmetics/nat/le_plus.def(7)"
\ 6le_plus
\ 5/a
\ 6 //
587 theorem le_times_r: \forall p,n,m:nat. n \le m \to p*n \le p*m
588 \def monotonic_le_times_r. *)
591 theorem monotonic_le_times_l:
592 ∀m:nat.monotonic nat le (λn.n*m).
597 theorem le_times_l: \forall p,n,m:nat. n \le m \to n*p \le m*p
598 \def monotonic_le_times_l. *)
600 theorem le_times: ∀n1,n2,m1,m2:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
601 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.
602 #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)) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_times_r.def(8)"
\ 6monotonic_le_times_r
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
606 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.
607 #n #m #H /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_times_r.def(8)"
\ 6monotonic_le_times_r
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
609 theorem le_times_to_le:
610 ∀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.
611 #a @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 normalize
614 @(
\ 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)) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_times_r.def(8)"
\ 6monotonic_le_times_r
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
616 @
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6 @H /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_plus_to_le.def(5)"
\ 6le_plus_to_le
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
621 theorem le_S_times_2: ∀n,m.O < m → n ≤ m → S n ≤ 2*m.
622 #n #m #posm #lenm (* interessante *)
623 applyS (le_plus n m) // qed. *)
627 theorem lt_O_times_S_S: ∀n,m:nat.O < (S n)*(S m).
628 intros.simplify.unfold lt.apply le_S_S.apply le_O_n.
632 theorem lt_times_eq_O: \forall a,b:nat.
633 O < a → a * b = O → b = O.
640 rewrite > (S_pred a) in H1
642 apply (eq_to_not_lt O ((S (pred a))*(S m)))
645 | apply lt_O_times_S_S
652 theorem O_lt_times_to_O_lt: \forall a,c:nat.
653 O \lt (a * c) \to O \lt a.
665 lemma lt_times_to_lt_O: \forall i,n,m:nat. i < n*m \to O < m.
667 elim (le_to_or_lt_eq O ? (le_O_n m))
671 rewrite < times_n_O in H.
672 apply (not_le_Sn_O ? H)
677 theorem monotonic_lt_times_r:
678 ∀n:nat.monotonic nat lt (λm.(S n)*m).
682 simplify.rewrite < plus_n_O.rewrite < plus_n_O.assumption.
683 apply lt_plus.assumption.assumption.
686 theorem monotonic_lt_times_r:
687 ∀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)).
689 (elim ltnm) normalize
690 [/
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_lt_plus_l.def(9)"
\ 6monotonic_lt_plus_l
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
691 |#a #_ #lt1 @(
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6 … lt1) //
695 theorem monotonic_lt_times_l:
696 ∀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)).
697 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_lt_times_r.def(10)"
\ 6monotonic_lt_times_r
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
700 theorem lt_to_le_to_lt_times:
701 ∀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.
702 #n #m #p #q #ltnm #lepq #posq
703 @(
\ 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))
704 [@
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_times_r.def(8)"
\ 6monotonic_le_times_r
\ 5/a
\ 6 //
705 |@
\ 5a href="cic:/matita/arithmetics/nat/monotonic_lt_times_l.def(11)"
\ 6monotonic_lt_times_l
\ 5/a
\ 6 //
709 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.
710 #n #m #p #q #ltnm #ltpq @
\ 5a href="cic:/matita/arithmetics/nat/lt_to_le_to_lt_times.def(12)"
\ 6lt_to_le_to_lt_times
\ 5/a
\ 6\ 5span style="text-decoration: underline;"
\ 6 \ 5/span
\ 6/
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_plus_b.def(8)"
\ 6le_plus_b
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/ltn_to_ltO.def(5)"
\ 6ltn_to_ltO
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
713 theorem lt_times_n_to_lt_l:
714 ∀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.
715 #n #p #q #Hlt (elim (
\ 5a href="cic:/matita/arithmetics/nat/decidable_lt.def(7)"
\ 6decidable_lt
\ 5/a
\ 6 p q)) //
716 #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))
717 applyS
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_times_r.def(8)"
\ 6monotonic_le_times_r
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/not_lt_to_le.def(6)"
\ 6not_lt_to_le
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
720 theorem lt_times_n_to_lt_r:
721 ∀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.
722 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/lt_times_n_to_lt_l.def(9)"
\ 6lt_times_n_to_lt_l
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
725 theorem nat_compare_times_l : \forall n,p,q:nat.
726 nat_compare p q = nat_compare ((S n) * p) ((S n) * q).
727 intros.apply nat_compare_elim.intro.
728 apply nat_compare_elim.
731 apply (inj_times_r n).assumption.
732 apply lt_to_not_eq. assumption.
734 apply (lt_times_to_lt_r n).assumption.
735 apply le_to_not_lt.apply lt_to_le.assumption.
736 intro.rewrite < H.rewrite > nat_compare_n_n.reflexivity.
737 intro.apply nat_compare_elim.intro.
739 apply (lt_times_to_lt_r n).assumption.
740 apply le_to_not_lt.apply lt_to_le.assumption.
743 apply (inj_times_r n).assumption.
744 apply lt_to_not_eq.assumption.
749 theorem lt_times_plus_times: \forall a,b,n,m:nat.
750 a < n \to b < m \to a*m + b < n*m.
753 [intros.apply False_ind.apply (not_le_Sn_O ? H)
757 change with (S b+a*m1 \leq m1+m*m1).
761 [apply le_S_S_to_le.assumption
768 (************************** minus ******************************)
772 [ O ⇒
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,1,0)"
\ 6O
\ 5/a
\ 6
775 [ O ⇒
\ 5a href="cic:/matita/arithmetics/nat/nat.con(0,2,0)"
\ 6S
\ 5/a
\ 6 p
776 | S q ⇒ minus p q ]].
778 interpretation "natural minus" 'minus x y = (minus x y).
780 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.
783 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.
786 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.
789 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.
792 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.
793 #n (elim n) normalize // qed.
795 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).
796 (* qualcosa da capire qui
797 #n #m #lenm nelim lenm napplyS refl_eq. *)
798 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6
800 |#n #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/absurd.def(2)"
\ 6absurd
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
801 |#n #m #Hind #c applyS Hind /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_pred.def(4)"
\ 6monotonic_pred
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
806 theorem not_eq_to_le_to_le_minus:
807 ∀n,m.n ≠ m → n ≤ m → n ≤ m - 1.
808 #n * #m (cases m// #m normalize
809 #H #H1 napply le_S_S_to_le
810 napplyS (not_eq_to_le_to_lt n (S m) H H1)
813 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).
814 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 normalize //
818 ∀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.
819 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6
821 |#n #p #abs @
\ 5a href="cic:/matita/basics/logic/False_ind.fix(0,1,1)"
\ 6False_ind
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/basics/logic/absurd.def(2)"
\ 6absurd
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
822 |normalize/
\ 5span class="autotactic"
\ 63
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_pred.def(4)"
\ 6monotonic_pred
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
826 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.
827 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/plus_minus.def(5)"
\ 6plus_minus
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/le.con(0,1,1)"
\ 6le_n
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
829 theorem plus_minus_m_m: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
830 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.
831 #n #m #lemn @
\ 5a href="cic:/matita/basics/logic/sym_eq.def(2)"
\ 6sym_eq
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/plus_minus.def(5)"
\ 6plus_minus
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
833 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.
834 #n (elim n) // #a #Hind #m (cases m) // normalize #n/
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_S_S.def(2)"
\ 6le_S_S
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
837 theorem minus_to_plus :∀n,m,p:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
838 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.
839 #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) //
842 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.
843 #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))
846 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 →
847 \ 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.
848 #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) //.
854 theorem le_SO_minus: \forall n,m:nat.S n \leq m \to S O \leq m-n.
855 intros.elim H.elim (minus_Sn_n n).apply le_n.
856 rewrite > minus_Sn_m.
857 apply le_S.assumption.
858 apply lt_to_le.assumption.
861 theorem minus_le_S_minus_S: \forall n,m:nat. m-n \leq S (m-(S n)).
863 apply (nat_elim2 (\lambda n,m.m-n \leq S (m-(S n)))).
864 intro.elim n1.simplify.apply le_n_Sn.
865 simplify.rewrite < minus_n_O.apply le_n.
866 intros.simplify.apply le_n_Sn.
867 intros.simplify.apply H.
870 theorem lt_minus_S_n_to_le_minus_n : \forall n,m,p:nat. m-(S n) < p \to m-n \leq p.
873 (* end auto($Revision: 9739 $) proof: TIME=1.33 SIZE=100 DEPTH=100 *)
874 apply (trans_le (m-n) (S (m-(S n))) p).
875 apply minus_le_S_minus_S.
879 theorem le_minus_m: \forall n,m:nat. n-m \leq n.
880 intros.apply (nat_elim2 (\lambda m,n. n-m \leq n)).
881 intros.rewrite < minus_n_O.apply le_n.
882 intros.simplify.apply le_n.
883 intros.simplify.apply le_S.assumption.
886 theorem lt_minus_m: \forall n,m:nat. O < n \to O < m \to n-m \lt n.
887 intros.apply (lt_O_n_elim n H).intro.
888 apply (lt_O_n_elim m H1).intro.
889 simplify.unfold lt.apply le_S_S.apply le_minus_m.
892 theorem minus_le_O_to_le: \forall n,m:nat. n-m \leq O \to n \leq m.
894 apply (nat_elim2 (\lambda n,m:nat.n-m \leq O \to n \leq m)).
896 simplify.intros. assumption.
897 simplify.intros.apply le_S_S.apply H.assumption.
901 (* monotonicity and galois *)
903 theorem monotonic_le_minus_l:
904 ∀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.
905 @
\ 5a href="cic:/matita/arithmetics/nat/nat_elim2.def(2)"
\ 6nat_elim2
\ 5/a
\ 6 #p #q
906 [#lePO @(
\ 5a href="cic:/matita/arithmetics/nat/le_n_O_elim.def(4)"
\ 6le_n_O_elim
\ 5/a
\ 6 ? lePO) //
908 |#Hind #n (cases n) // #a #leSS @Hind /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_pred.def(4)"
\ 6monotonic_pred
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
912 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.
913 #n #m #p #lep @
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6
914 [|@
\ 5a href="cic:/matita/arithmetics/nat/le_plus_minus_m_m.def(9)"
\ 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 // ]
917 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.
918 #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) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_plus_l.def(6)"
\ 6monotonic_le_plus_l
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
921 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.
922 #n #m #p #lep /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_minus_l.def(10)"
\ 6monotonic_le_minus_l
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ qed.
924 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.
925 #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) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/transitive_le.def(3)"
\ 6transitive_le
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
928 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.
929 #a #b #c #H @
\ 5a href="cic:/matita/arithmetics/nat/not_le_to_lt.def(5)"
\ 6not_le_to_lt
\ 5/a
\ 6
930 @(
\ 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)) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_plus_to_minus_r.def(10)"
\ 6le_plus_to_minus_r
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
933 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.
934 #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(11)"
\ 6le_plus_to_minus
\ 5/a
\ 6 …))
935 @
\ 5a href="cic:/matita/arithmetics/nat/lt_to_not_le.def(7)"
\ 6lt_to_not_le
\ 5/a
\ 6 //
938 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.
939 #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(11)"
\ 6le_plus_to_minus
\ 5/a
\ 6 //
942 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.
943 #a #b #c #H @
\ 5a href="cic:/matita/arithmetics/nat/le_plus_to_minus_r.def(10)"
\ 6le_plus_to_minus_r
\ 5/a
\ 6 //
946 theorem monotonic_le_minus_r:
947 ∀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.
948 #p #q #n #lepq @
\ 5a href="cic:/matita/arithmetics/nat/le_plus_to_minus.def(11)"
\ 6le_plus_to_minus
\ 5/a
\ 6
949 @(
\ 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(9)"
\ 6le_plus_minus_m_m
\ 5/a
\ 6 ? q)) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_plus_r.def(3)"
\ 6monotonic_le_plus_r
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
952 theorem eq_minus_O: ∀n,m:
\ 5a href="cic:/matita/arithmetics/nat/nat.ind(1,0,0)"
\ 6nat
\ 5/a
\ 6.
953 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.
954 #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)) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_minus_r.def(12)"
\ 6monotonic_le_minus_r
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
957 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.
959 (cases (
\ 5a href="cic:/matita/arithmetics/nat/decidable_lt.def(7)"
\ 6decidable_lt
\ 5/a
\ 6 b c)) #Hbc
960 [>
\ 5a href="cic:/matita/arithmetics/nat/eq_minus_O.def(13)"
\ 6eq_minus_O
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_plus_b.def(8)"
\ 6le_plus_b
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/ >
\ 5a href="cic:/matita/arithmetics/nat/eq_minus_O.def(13)"
\ 6eq_minus_O
\ 5/a
\ 6 //
961 @
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_times_r.def(8)"
\ 6monotonic_le_times_r
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/le_plus_b.def(8)"
\ 6le_plus_b
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
962 |@
\ 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
963 @
\ 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) /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/not_lt_to_le.def(6)"
\ 6not_lt_to_le
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
966 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).
968 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
969 [@
\ 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
970 @
\ 5a href="cic:/matita/arithmetics/nat/minus_to_plus.def(8)"
\ 6minus_to_plus
\ 5/a
\ 6 //
971 |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 //]
972 #H >
\ 5a href="cic:/matita/arithmetics/nat/eq_minus_O.def(13)"
\ 6eq_minus_O
\ 5/a
\ 6 /
\ 5span class="autotactic"
\ 62
\ 5span class="autotrace"
\ 6 trace
\ 5a href="cic:/matita/arithmetics/nat/eq_minus_O.def(13)"
\ 6eq_minus_O
\ 5/a
\ 6,
\ 5a href="cic:/matita/arithmetics/nat/monotonic_le_minus_l.def(10)"
\ 6monotonic_le_minus_l
\ 5/a
\ 6\ 5/span
\ 6\ 5/span
\ 6/
977 theorem plus_minus: ∀n,m,p. p ≤ m → (n+m)-p = n +(m-p).
978 #n #m #p #lepm @plus_to_minus >(commutative_plus p)
979 >associative_plus <plus_minus_m_m //
982 theorem minus_minus: ∀n,m,p:nat. p ≤ m → m ≤ n →
985 @sym_eq @plus_to_minus <associative_plus <plus_minus_m_m //
986 <commutative_plus <plus_minus_m_m //
989 (*********************** boolean arithmetics ********************)
990 include "basics/bool.ma".
994 [ O ⇒ match m with [ O ⇒ true | S q ⇒ false]
995 | S p ⇒ match m with [ O ⇒ false | S q ⇒ eqb p q]
998 theorem eqb_elim : ∀ n,m:nat.∀ P:bool → Prop.
999 (n=m → (P true)) → (n ≠ m → (P false)) → (P (eqb n m)).
1001 [#n (cases n) normalize /3/
1007 theorem eqb_n_n: ∀n. eqb n n = true.
1008 #n (elim n) normalize // qed.
1010 theorem eqb_true_to_eq: ∀n,m:nat. eqb n m = true → n = m.
1011 #n #m @(eqb_elim n m) // #_ #abs @False_ind /2/ qed.
1013 theorem eqb_false_to_not_eq: ∀n,m:nat. eqb n m = false → n ≠ m.
1014 #n #m @(eqb_elim n m) /2/ qed.
1016 theorem eq_to_eqb_true: ∀n,m:nat.n = m → eqb n m = true.
1019 theorem not_eq_to_eqb_false: ∀n,m:nat.
1020 n ≠ m → eqb n m = false.
1021 #n #m #noteq @eqb_elim// #Heq @False_ind /2/ qed.
1029 | (S q) ⇒ leb p q]].
1031 theorem leb_elim: ∀n,m:nat. ∀P:bool → Prop.
1032 (n ≤ m → P true) → (n ≰ m → P false) → P (leb n m).
1033 @nat_elim2 normalize
1036 |#n #m #Hind #P #Pt #Pf @Hind
1037 [#lenm @Pt @le_S_S // |#nlenm @Pf /2/ ]
1041 theorem leb_true_to_le:∀n,m.leb n m = true → n ≤ m.
1042 #n #m @leb_elim // #_ #abs @False_ind /2/ qed.
1044 theorem leb_false_to_not_le:∀n,m.
1045 leb n m = false → n ≰ m.
1046 #n #m @leb_elim // #_ #abs @False_ind /2/ qed.
1048 theorem le_to_leb_true: ∀n,m. n ≤ m → leb n m = true.
1049 #n #m @leb_elim // #H #H1 @False_ind /2/ qed.
1051 theorem not_le_to_leb_false: ∀n,m. n ≰ m → leb n m = false.
1052 #n #m @leb_elim // #H #H1 @False_ind /2/ qed.
1054 theorem lt_to_leb_false: ∀n,m. m < n → leb n m = false.
1058 ndefinition ltb ≝λn,m. leb (S n) m.
1060 theorem ltb_elim: ∀n,m:nat. ∀P:bool → Prop.
1061 (n < m → P true) → (n ≮ m → P false) → P (ltb n m).
1063 napply leb_elim /3/ qed.
1065 theorem ltb_true_to_lt:∀n,m.ltb n m = true → n < m.
1066 #n #m #Hltb napply leb_true_to_le nassumption
1069 theorem ltb_false_to_not_lt:∀n,m.
1070 ltb n m = false → n ≮ m.
1071 #n #m #Hltb napply leb_false_to_not_le nassumption
1074 theorem lt_to_ltb_true: ∀n,m. n < m → ltb n m = true.
1075 #n #m #Hltb napply le_to_leb_true nassumption
1078 theorem le_to_ltb_false: ∀n,m. m \le n → ltb n m = false.
1079 #n #m #Hltb napply lt_to_leb_false /2/
1083 definition min: nat →nat →nat ≝
1084 λn.λm. if_then_else ? (leb n m) n m.
1086 definition max: nat →nat →nat ≝
1087 λn.λm. if_then_else ? (leb n m) m n.
1089 lemma commutative_min: commutative ? min.
1090 #n #m normalize @leb_elim
1091 [@leb_elim normalize /2/
1092 |#notle >(le_to_leb_true …) // @(transitive_le ? (S m)) /2/
1095 lemma le_minr: ∀i,n,m. i ≤ min n m → i ≤ m.
1096 #i #n #m normalize @leb_elim normalize /2/ qed.
1098 lemma le_minl: ∀i,n,m. i ≤ min n m → i ≤ n.
1101 lemma to_min: ∀i,n,m. i ≤ n → i ≤ m → i ≤ min n m.
1102 #i #n #m #lein #leim normalize (cases (leb n m))
1105 lemma commutative_max: commutative ? max.
1106 #n #m normalize @leb_elim
1107 [@leb_elim normalize /2/
1108 |#notle >(le_to_leb_true …) // @(transitive_le ? (S m)) /2/
1111 lemma le_maxl: ∀i,n,m. max n m ≤ i → n ≤ i.
1112 #i #n #m normalize @leb_elim normalize /2/ qed.
1114 lemma le_maxr: ∀i,n,m. max n m ≤ i → m ≤ i.
1117 lemma to_max: ∀i,n,m. n ≤ i → m ≤ i → max n m ≤ i.
1118 #i #n #m #leni #lemi normalize (cases (leb n m))