]> matita.cs.unibo.it Git - helm.git/commitdiff
Reorganization of the library.
authorAndrea Asperti <andrea.asperti@unibo.it>
Fri, 12 Oct 2007 09:59:54 +0000 (09:59 +0000)
committerAndrea Asperti <andrea.asperti@unibo.it>
Fri, 12 Oct 2007 09:59:54 +0000 (09:59 +0000)
matita/library/nat/le_arith.ma
matita/library/nat/lt_arith.ma
matita/library/nat/primes.ma
matita/library/nat/totient.ma

index 9ab53fd7405a1946cf555974992c922dbdcc2acb..6ad389346a8b9e2347493f1b0b3299866feb7869 100644 (file)
@@ -20,9 +20,10 @@ include "nat/orders.ma".
 (* plus *)
 theorem monotonic_le_plus_r: 
 \forall n:nat.monotonic nat le (\lambda m.n + m).
-simplify.intros.elim n.
-simplify.assumption.
-simplify.apply le_S_S.assumption.
+simplify.intros.elim n
+  [simplify.assumption.
+  |simplify.apply le_S_S.assumption
+  ]
 qed.
 
 theorem le_plus_r: \forall p,n,m:nat. n \le m \to p + n \le p + m
@@ -41,9 +42,21 @@ theorem le_plus_l: \forall p,n,m:nat. n \le m \to n + p \le m + p
 theorem le_plus: \forall n1,n2,m1,m2:nat. n1 \le n2  \to m1 \le m2 
 \to n1 + m1 \le n2 + m2.
 intros.
+(**
+auto.
+*)
+apply (transitive_le (plus n1 m1) (plus n1 m2) (plus n2 m2) ? ?);
+  [apply (monotonic_le_plus_r n1 m1 m2 ?).
+   apply (H1).
+  |apply (monotonic_le_plus_l m2 n1 n2 ?).
+   apply (H).
+  ]
+(* end auto($Revision$) proof: TIME=0.61 SIZE=100 DEPTH=100 *)
+(*
 apply (trans_le ? (n2 + m1)).
 apply le_plus_l.assumption.
 apply le_plus_r.assumption.
+*)
 qed.
 
 theorem le_plus_n :\forall n,m:nat. m \le n + m.
index cce6626a0f43d9273c23a2be0ea6fa90fd55a105..a568ca408be94412a0203a82abf170709edfaa05 100644 (file)
@@ -262,6 +262,26 @@ apply lt_to_not_eq.assumption.
 intro.reflexivity.
 qed.
 
+(* times and plus *)
+theorem lt_times_plus_times: \forall a,b,n,m:nat. 
+a < n \to b < m \to a*m + b < n*m.
+intros 3.
+apply (nat_case n)
+  [intros.apply False_ind.apply (not_le_Sn_O ? H)
+  |intros.simplify.
+   rewrite < sym_plus.
+   unfold.
+   change with (S b+a*m1 \leq m1+m*m1).
+   apply le_plus
+    [assumption
+    |apply le_times
+      [apply le_S_S_to_le.assumption
+      |apply le_n
+      ]
+    ]
+  ]
+qed.
+
 (* div *) 
 
 theorem eq_mod_O_to_lt_O_div: \forall n,m:nat. O < m \to O < n\to n \mod m = O \to O < n / m. 
index f7d6970063c4cf9b06a1e771c73b50c876bc1894..6885a98474089bee8c3c83336afcde7fd3228356 100644 (file)
@@ -211,6 +211,14 @@ elim (le_to_or_lt_eq O n (le_O_n n))
   ]
 qed.
 
+theorem divides_div: \forall d,n. divides d n \to divides (n/d) n.
+intros.
+apply (witness ? ? d).
+apply sym_eq.
+apply divides_to_div.
+assumption.
+qed.
+
 theorem div_div: \forall n,d:nat. O < n \to divides d n \to 
 n/(n/d) = d.
 intros.
@@ -287,7 +295,8 @@ intros 2.apply (nat_case n)
   [apply (nat_case m)
     [intro.apply divides_n_n
     |simplify.intros.apply False_ind.
-     apply not_eq_true_false.apply sym_eq.assumption
+     apply not_eq_true_false.apply sym_eq.
+     assumption
     ]
   |intros.
    apply divides_b_true_to_divides1
@@ -345,6 +354,22 @@ elim (divides_b n m).reflexivity.
 absurd (n \divides m).assumption.assumption.
 qed.
 
+theorem divides_to_divides_b_true1 : \forall n,m:nat.
+O < m \to n \divides m \to divides_b n m = true.
+intro.
+elim (le_to_or_lt_eq O n (le_O_n n))
+  [apply divides_to_divides_b_true
+    [assumption|assumption]
+  |apply False_ind.
+   rewrite < H in H2.
+   elim H2.
+   simplify in H3.
+   apply (not_le_Sn_O O).
+   rewrite > H3 in H1.
+   assumption
+  ]
+qed.
+
 theorem not_divides_to_divides_b_false: \forall n,m:nat. O < n \to
 \lnot(n \divides m) \to (divides_b n m) = false.
 intros.
@@ -357,6 +382,18 @@ absurd (n \divides m).assumption.assumption.
 reflexivity.
 qed.
 
+theorem divides_b_div_true: 
+\forall d,n. O < n \to 
+  divides_b d n = true \to divides_b (n/d) n = true.
+intros.
+apply divides_to_divides_b_true1
+  [assumption
+  |apply divides_div.
+   apply divides_b_true_to_divides.
+   assumption
+  ]
+qed.
+
 theorem divides_b_true_to_lt_O: \forall n,m. O < n \to divides_b m n = true \to O < m.
 intros.
 elim (le_to_or_lt_eq ? ? (le_O_n m))
index a86986a81f743efd78b0dd004e38653c0788d601..9933490a2dda03f20da09be3124dee5919ec3d8e 100644 (file)
@@ -33,7 +33,9 @@ include "nat/iteration2.ma".
 definition totient : nat \to nat \def
 \lambda n.sigma_p n (\lambda m. eqb (gcd m n) (S O)) (\lambda m.S O).
 
-                                        
+lemma totient1: totient (S(S(S(S(S(S O)))))) = ?.
+[|simplify.
+                                
 theorem totient_times: \forall n,m:nat. (gcd m n) = (S O) \to
 totient (n*m) = (totient n)*(totient m).
 intros.