1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/assembly/extra".
17 include "nat/div_and_mod.ma".
18 include "nat/primes.ma".
19 include "list/list.ma".
21 axiom mod_plus: ∀a,b,m. (a + b) \mod m = (a \mod m + b \mod m) \mod m.
22 axiom mod_mod: ∀a,n,m. n∣m → a \mod n = a \mod n \mod m.
23 axiom eq_mod_times_n_m_m_O: ∀n,m. O < m → n * m \mod m = O.
24 axiom eq_mod_to_eq_plus_mod: ∀a,b,c,m. a \mod m = b \mod m → (a+c) \mod m = (b+c) \mod m.
25 axiom eq_mod_times_times_mod: ∀a,b,n,m. m = a*n → (a*b) \mod m = a * (b \mod n).
26 axiom divides_to_eq_mod_mod_mod: ∀a,n,m. n∣m → a \mod m \mod n = a \mod n.
27 axiom le_to_le_plus_to_le : ∀a,b,c,d.b\leq d\rarr a+b\leq c+d\rarr a\leq c.
28 axiom or_lt_le : ∀n,m. n < m ∨ m ≤ n.
30 inductive cartesian_product (A,B: Type) : Type ≝
31 couple: ∀a:A.∀b:B. cartesian_product A B.
33 lemma le_to_lt: ∀n,m. n ≤ m → n < S m.
38 alias num (instance 0) = "natural number".
39 definition nat_of_bool ≝
40 λb. match b with [ true ⇒ 1 | false ⇒ 0 ].
42 theorem lt_trans: ∀x,y,z. x < y → y < z → x < z.
48 lemma leq_m_n_to_eq_div_n_m_S: ∀n,m:nat. 0 < m → m ≤ n → ∃z. n/m = S z.
51 apply (ex_intro ? ? (div_aux (pred n) (n-m) (pred m)));
56 clear Hcut; clear H2; clear H; (*clear m;*)
58 unfold in ⊢ (? ? % ?);
60 [ elim Hcut; clear Hcut;
63 change in ⊢ (? ? % ?) with
64 (match leb (S a1) a with
66 | false ⇒ S (div_aux a1 ((S a1) - S a) a)]);
68 [ apply (leb_elim (S a1) a);