assumption.
qed.
-theorem lt_times_to_lt_div: \forall m,n,q. O < q \to
-n < m*q \to n/q < m.
+theorem lt_times_to_lt_div: \forall m,n,q. n < m*q \to n/q < m.
intros.
-apply (lt_times_to_lt q ? ? H).
+apply (lt_times_to_lt q ? ? (lt_times_to_lt_O ? ? ? H)).
rewrite > sym_times.
rewrite > sym_times in ⊢ (? ? %).
apply (le_plus_to_le (n \mod q)).
[assumption
|apply le_plus_n
]
- |assumption
+ |apply (lt_times_to_lt_O ? ? ? H)
]
qed.
theorem lt_div: \forall n,m. O < m \to S O < n \to m/n < m.
intros.
-apply lt_times_to_lt_div
- [apply lt_to_le. assumption
- |rewrite > sym_times.
- apply lt_m_nm;assumption
- ]
+apply lt_times_to_lt_div.
+rewrite < sym_times.
+apply lt_m_nm;assumption.
qed.
theorem le_div_plus_S: \forall m,n,q. O < q \to
(m+n)/q \le S(m/q + n/q).
intros.
apply le_S_S_to_le.
-apply lt_times_to_lt_div
- [assumption
- |change in ⊢ (? ? %) with (q + (q + (m/q+n/q)*q)).
- rewrite > sym_times.
- rewrite > distr_times_plus.
- rewrite > sym_times.
- rewrite < assoc_plus in ⊢ (? ? (? ? %)).
- rewrite < assoc_plus.
- rewrite > sym_plus in ⊢ (? ? (? % ?)).
- rewrite > assoc_plus.
- apply lt_plus
- [change with (m < S(m/q)*q).
- apply lt_div_S.
- assumption
- |rewrite > sym_times.
- change with (n < S(n/q)*q).
- apply lt_div_S.
- assumption
- ]
+apply lt_times_to_lt_div.
+change in ⊢ (? ? %) with (q + (q + (m/q+n/q)*q)).
+rewrite > sym_times.
+rewrite > distr_times_plus.
+rewrite > sym_times.
+rewrite < assoc_plus in ⊢ (? ? (? ? %)).
+rewrite < assoc_plus.
+rewrite > sym_plus in ⊢ (? ? (? % ?)).
+rewrite > assoc_plus.
+apply lt_plus
+ [change with (m < S(m/q)*q).
+ apply lt_div_S.
+ assumption
+ |rewrite > sym_times.
+ change with (n < S(n/q)*q).
+ apply lt_div_S.
+ assumption
]
qed.
set "baseuri" "cic:/matita/nat/generic_iter_p".
+include "nat/div_and_mod_diseq.ma".
include "nat/primes.ma".
include "nat/ord.ma".
reflexivity.
qed.
-
-
theorem false_to_iter_p_gen_Sn:
\forall n:nat. \forall p:nat \to bool. \forall A:Type. \forall g:nat \to A.
\forall baseA:A. \forall plusA: A \to A \to A.
reflexivity.
qed.
-
theorem eq_iter_p_gen: \forall p1,p2:nat \to bool. \forall A:Type.
\forall g1,g2: nat \to A. \forall baseA: A.
\forall plusA: A \to A \to A. \forall n:nat.
]
qed.
-
-(* da spostare *)
-
+theorem eq_iter_p_gen_pred:
+\forall A:Type.
+\forall baseA: A.
+\forall plusA: A \to A \to A.
+\forall n,p,g.
+p O = true \to
+(symmetric A plusA) \to (associative A plusA) \to (\forall a:A.(plusA a baseA) = a) \to
+iter_p_gen (S n) (\lambda i.p (pred i)) A (\lambda i.g(pred i)) baseA plusA =
+plusA (iter_p_gen n p A g baseA plusA) (g O).
+intros.
+elim n
+ [rewrite > true_to_iter_p_gen_Sn
+ [simplify.apply H1
+ |assumption
+ ]
+ |apply (bool_elim ? (p n1));intro
+ [rewrite > true_to_iter_p_gen_Sn
+ [rewrite > true_to_iter_p_gen_Sn in ⊢ (? ? ? %)
+ [rewrite > H2 in ⊢ (? ? ? %).
+ apply eq_f.assumption
+ |assumption
+ ]
+ |assumption
+ ]
+ |rewrite > false_to_iter_p_gen_Sn
+ [rewrite > false_to_iter_p_gen_Sn in ⊢ (? ? ? %);assumption
+ |assumption
+ ]
+ ]
+ ]
+qed.
+
definition p_ord_times \def
\lambda p,m,x.
match p_ord x p with
]
qed.
-(* lemmino da postare *)
-theorem lt_times_to_lt_div: \forall i,n,m. i < n*m \to i/m < n.
-intros.
-cut (O < m)
- [apply (lt_times_n_to_lt m)
- [assumption
- |apply (le_to_lt_to_lt ? i)
- [rewrite > (div_mod i m) in \vdash (? ? %).
- apply le_plus_n_r.
- assumption
- |assumption
- ]
- ]
- |apply (lt_times_to_lt_O ? ? ? H)
- ]
-qed.
-
theorem iter_p_gen_knm:
\forall A:Type.
\forall baseA: A.
]
qed.
+theorem eq_sigma_p_pred:
+\forall n,p,g. p O = true \to
+sigma_p (S n) (\lambda i.p (pred i)) (\lambda i.g(pred i)) =
+plus (sigma_p n p g) (g O).
+intros.
+unfold sigma_p.
+apply eq_iter_p_gen_pred
+ [assumption
+ |apply symmetricIntPlus
+ |apply associative_plus
+ |intros.apply sym_eq.apply plus_n_O
+ ]
+qed.
+
(* monotonicity *)
theorem le_sigma_p:
\forall n:nat. \forall p:nat \to bool. \forall g1,g2:nat \to nat.
]
qed.
+lemma lt_times_to_lt_O: \forall i,n,m:nat. i < n*m \to O < m.
+intros.
+elim (le_to_or_lt_eq O ? (le_O_n m))
+ [assumption
+ |apply False_ind.
+ rewrite < H1 in H.
+ rewrite < times_n_O in H.
+ apply (not_le_Sn_O ? H)
+ ]
+qed.
+
(* times *)
theorem monotonic_lt_times_r:
\forall n:nat.monotonic nat lt (\lambda m.(S n)*m).
]
qed.
-
+theorem le_exp_Sn_n_SSSO: \forall n. (exp (S n) n) \le (S(S(S O))).
+intro.
+apply (trans_le ? (sigma_p (S n) (\lambda k.true) (\lambda k.(exp n n)/k!)))
+ [apply le_exp_sigma_p_exp
+ |apply (trans_le ? (sigma_p (S n) (\lambda i.true) (\lambda i.(exp n n)/(exp (S(S O)) i))))
+ [apply le_sigma_p.intros.
+ apply le_times_to_le_div
+ [apply lt_O_exp.
+ apply lt_O_S
+ |apply (trans_le ? ((S(S O))\sup i* n \sup n/i!))
+ [apply le_times_div_div_times.
+ apply lt_O_fact
+ |apply le_times_to_le_div2
+ [apply lt_O_fact
+ |rewrite < sym_times.
+ apply le_times_r.