]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/character/preamble.ma
Preparing for 0.5.9 release.
[helm.git] / helm / software / matita / contribs / character / preamble.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "nat/exp.ma".
16 include "nat/relevant_equations.ma".
17
18 alias num (instance 0) = "natural number".
19
20 theorem plus_inv_O3: ∀m,n. 0 = n + m → 0 = n ∧ 0 = m.
21  intros 2; elim n names 0; clear n; simplify; intros;
22  [ autobatch | destruct ].
23 qed. 
24
25 theorem times_inv_O3_S: ∀x,y. 0 = x * (S y) → x = 0.
26  intros; rewrite < times_n_Sm in H;
27  lapply linear plus_inv_O3 to H; decompose;autobatch.
28 qed. 
29
30 theorem not_3_divides_1: ∀n. 1 = n * 3 → False.
31  intros 1; rewrite > sym_times; simplify;
32  elim n names 0; simplify; intros; destruct;
33  rewrite > sym_plus in Hcut; simplify in Hcut; destruct Hcut.
34 qed.
35
36 variant le_inv_S_S: ∀m,n. S m ≤ S n → m ≤ n 
37 ≝ le_S_S_to_le.
38
39 theorem plus_inv_S_S_S: ∀x,y,z. S x = S y + S z → S y ≤ x ∧ S z ≤ x.
40  simplify; intros; destruct;autobatch.
41 qed.
42
43 theorem times_inv_S_m_SS: ∀k,n,m. S n = m * (S (S k)) → m ≤ n.
44  intros 3; elim m names 0; clear m; simplify; intros; destruct;
45  clear H; autobatch by le_S_S, transitive_le, le_plus_n, le_plus_n_r. 
46 qed.
47
48 theorem plus_3_S3n: ∀n. S (S n * 3) = 3 + S (n * 3).
49  intros; autobatch depth = 1.
50 qed. 
51
52 theorem times_exp_x_y_Sz: ∀x,y,z. x * y \sup (S z) = (x * y \sup z) * y.
53  intros; autobatch depth = 1.
54 qed.
55
56 definition acc_nat: (nat → Prop) → nat →Prop ≝
57    λP:nat→Prop. λn. ∀m. m ≤ n → P m.
58
59 theorem wf_le: ∀P. P 0 → (∀n. acc_nat P n → P (S n)) → ∀n. acc_nat P n.
60  unfold acc_nat; intros 4; elim n names 0; clear n;
61  [ intros; autobatch by (eq_ind ? ? P), H, H2, le_n_O_to_eq.
62    (* lapply linear le_n_O_to_eq to H2; destruct; autobatch *)
63  | intros 3; elim m; clear m; intros; clear H3;
64    [ clear H H1; autobatch depth = 2
65    | clear H; lapply linear le_inv_S_S to H4;
66      apply H1; clear H1; intros;
67      apply H2; clear H2; autobatch depth = 2
68    ]
69  ].
70 qed.
71
72 theorem wf_nat_ind: 
73    ∀P:nat→Prop. P O → (∀n. (∀m. m ≤ n → P m) → P (S n)) → ∀n. P n.
74  intros; lapply linear depth=2 wf_le to H, H1 as H0; 
75   autobatch. 
76 qed.