1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| A.Asperti, C.Sacerdoti Coen, *)
8 (* ||A|| E.Tassi, S.Zacchiroli *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU Lesser General Public License Version 2.1 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/library_auto/nat/exp".
17 include "auto/nat/div_and_mod.ma".
19 let rec exp n m on m\def
22 | (S p) \Rightarrow (times n (exp n p)) ].
24 interpretation "natural exponent" 'exp a b = (cic:/matita/library_auto/nat/exp/exp.con a b).
26 theorem exp_plus_times : \forall n,p,q:nat.
27 n \sup (p + q) = (n \sup p) * (n \sup q).
30 (*[ rewrite < plus_n_O.
38 theorem exp_n_O : \forall n:nat. S O = n \sup O.
45 theorem exp_n_SO : \forall n:nat. n = n \sup (S O).
53 theorem exp_exp_times : \forall n,p,q:nat.
54 (n \sup p) \sup q = n \sup (p * q).
58 (*rewrite < times_n_O.
62 rewrite < exp_plus_times.
64 (*rewrite < times_n_Sm.
69 theorem lt_O_exp: \forall n,m:nat. O < n \to O < n \sup m.
74 | rewrite > times_n_SO.
75 apply le_times;assumption
79 theorem lt_m_exp_nm: \forall n,m:nat. (S O) < n \to m < n \sup m.
81 elim m;simplify;unfold lt;
83 | apply (trans_le ? ((S(S O))*(S n1)))
92 (*apply le_times;assumption*)
97 theorem exp_to_eq_O: \forall n,m:nat. (S O) < n
98 \to n \sup m = (S O) \to m = O.
101 [ apply le_S_S_to_le.
104 (*change with (m < n \sup m).
111 theorem injective_exp_r: \forall n:nat. (S O) < n \to
112 injective nat nat (\lambda m:nat. n \sup m).
115 apply (nat_elim2 (\lambda x,y.n \sup x = n \sup y \to x = y))
119 apply (exp_to_eq_O n)
125 apply (exp_to_eq_O n);assumption
129 (* esprimere inj_times senza S *)
130 cut (\forall a,b:nat.O < n \to n*a=n*b \to a=b)
138 | (*NB qui auto non chiude il goal, chiuso invece chiamando solo la tattica assumption*)
142 apply (nat_case n);intros;auto
144 apply (not_le_Sn_O O H3)
145 | apply (inj_times_r m1).
152 variant inj_exp_r: \forall p:nat. (S O) < p \to \forall n,m:nat.
153 p \sup n = p \sup m \to n = m \def