]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/library/nat/exp.ma
Towards chebyshev.
[helm.git] / matita / library / nat / exp.ma
index e40844e3f9b837a20226e0619780267b816bf763..49efe8525504d4f431e81de36ea702f7c9d46f76 100644 (file)
@@ -15,6 +15,7 @@
 set "baseuri" "cic:/matita/nat/exp".
 
 include "nat/div_and_mod.ma".
+include "nat/lt_arith.ma".
 
 let rec exp n m on m\def 
  match m with 
@@ -39,6 +40,12 @@ theorem exp_n_SO : \forall n:nat. n = n \sup (S O).
 intro.simplify.rewrite < times_n_SO.reflexivity.
 qed.
 
+theorem exp_SSO: \forall n. exp n (S(S O)) = n*n.
+intro.simplify.
+rewrite < times_n_SO.
+reflexivity.
+qed.
+
 theorem exp_exp_times : \forall n,p,q:nat. 
 (n \sup p) \sup q = n \sup (p * q).
 intros.
@@ -95,3 +102,91 @@ qed.
 variant inj_exp_r: \forall p:nat. (S O) < p \to \forall n,m:nat.
 p \sup n = p \sup m \to n = m \def
 injective_exp_r.
+
+theorem le_exp: \forall n,m,p:nat. O < p \to n \le m \to exp p n \le exp p m.
+apply nat_elim2
+  [intros.
+   apply lt_O_exp.assumption
+  |intros.
+   apply False_ind.
+   apply (le_to_not_lt ? ? ? H1).
+   apply le_O_n
+  |intros.
+   simplify.
+   apply le_times
+    [apply le_n
+    |apply H[assumption|apply le_S_S_to_le.assumption]
+    ]
+  ]
+qed.
+
+theorem lt_exp: \forall n,m,p:nat. S O < p \to n < m \to exp p n < exp p m.
+apply nat_elim2
+  [intros.
+   apply (lt_O_n_elim ? H1).intro.
+   simplify.unfold lt.
+   rewrite > times_n_SO.
+   apply le_times
+    [assumption
+    |apply lt_O_exp.
+     apply (trans_lt ? (S O))[apply le_n|assumption]
+    ]
+  |intros.
+   apply False_ind.
+   apply (le_to_not_lt ? ? ? H1).
+   apply le_O_n
+  |intros.simplify.
+   apply lt_times_r1
+    [apply (trans_lt ? (S O))[apply le_n|assumption]
+    |apply H
+      [apply H1
+      |apply le_S_S_to_le.assumption
+      ]
+    ]
+  ]
+qed.
+
+theorem le_exp_to_le: 
+\forall a,n,m. S O < a \to exp a n \le exp a m \to n \le m.
+intro.
+apply nat_elim2;intros
+  [apply le_O_n
+  |apply False_ind.
+   apply (le_to_not_lt ? ? H1).
+   simplify.
+   rewrite > times_n_SO.
+   apply lt_to_le_to_lt_times
+    [assumption
+    |apply lt_O_exp.apply lt_to_le.assumption
+    |apply lt_O_exp.apply lt_to_le.assumption
+    ]
+  |simplify in H2.
+   apply le_S_S.
+   apply H
+    [assumption
+    |apply (le_times_to_le a)
+      [apply lt_to_le.assumption|assumption]
+    ]
+  ]
+qed.
+
+theorem lt_exp_to_lt: 
+\forall a,n,m. S O < a \to exp a n < exp a m \to n < m.
+intros.
+elim (le_to_or_lt_eq n m)
+  [assumption
+  |apply False_ind.
+   apply (lt_to_not_eq ? ? H1).
+   rewrite < H2.
+   reflexivity
+  |apply (le_exp_to_le a)
+    [assumption
+    |apply lt_to_le.
+     assumption
+    ]
+  ]
+qed.
+     
+   
+   
+   
\ No newline at end of file