]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/tests/fguidi.ma
another bug of auto
[helm.git] / helm / matita / tests / fguidi.ma
1 set "baseuri" "cic:/matita/tests/fguidi/".
2
3 alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)".
4 alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)".
5 alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)".
6 alias id "le" = "cic:/matita/fguidi/le.ind#xpointer(1/1)".
7 alias id "False_ind" = "cic:/Coq/Init/Logic/False_ind.con".
8 alias id "I" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1/1)". 
9 alias id "ex_intro" = "cic:/Coq/Init/Logic/ex.ind#xpointer(1/1/1)".
10 alias id "False" = "cic:/Coq/Init/Logic/False.ind#xpointer(1/1)".
11 alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)".
12
13 alias symbol "and" (instance 0) = "logical and".
14 alias symbol "eq" (instance 0) = "leibnitz's equality".
15 alias symbol "exists" (instance 0) = "exists".
16
17 definition is_S: nat \to Prop \def
18    \lambda n. match n with 
19       [ O     \Rightarrow False
20       | (S n) \Rightarrow True
21       ].
22
23 definition pred: nat \to nat \def
24    \lambda n. match n with
25       [ O     \Rightarrow O
26       | (S n) \Rightarrow n
27       ]. 
28
29 theorem eq_gen_S_O: \forall x. (S x = O) \to \forall P:Prop. P.
30 intros. apply False_ind. cut (is_S O). auto. elim H. exact I.
31 qed.
32
33 theorem eq_gen_S_O_cc: (\forall P:Prop. P) \to \forall x. (S x = O).
34 intros. auto.
35 qed.
36
37 theorem eq_gen_S_S: \forall m,n. (S m) = (S n) \to m = n. 
38 intros. cut (pred (S m)) = (pred (S n)). 
39 assumption. elim H. auto.
40 qed.
41
42 theorem eq_gen_S_S_cc: \forall m,n. m = n \to (S m) = (S n).
43 intros. elim H. auto.
44 qed.
45
46 inductive le: nat \to nat \to Prop \def
47      le_zero: \forall n. (le O n)
48    | le_succ: \forall m, n. (le m n) \to (le (S m) (S n)).
49
50 theorem le_refl: \forall x. (le x x).
51 intros. elim x. auto. auto.
52 qed.
53
54 theorem le_gen_x_O_aux: \forall x, y. (le x y) \to (y =O) \to 
55                         (x = O).
56 intros 3. elim H. auto. apply eq_gen_S_O. exact x2. auto.
57 qed.
58
59 theorem le_gen_x_O: \forall x. (le x O) \to (x = O).
60 intros. apply le_gen_x_O_aux. exact O. auto. auto.
61 qed.
62
63 theorem le_gen_x_O_cc: \forall x. (x = O) \to (le x O).
64 intros. elim H. auto.
65 qed.
66
67 theorem le_gen_S_x_aux: \forall m,x,y. (le y x) \to (y = S m) \to 
68                         (\exists n. x = (S n) \land (le m n)).
69 intros 4. elim H. 
70 apply eq_gen_S_O. exact m. elim H1. auto. 
71 cut x1 = m. elim Hcut. apply ex_intro. exact x2. auto. auto.
72 qed.
73
74 theorem le_gen_S_x: \forall m,x. (le (S m) x) \to 
75                     (\exists n. x = (S n) \land (le m n)).
76 intros. apply le_gen_S_x_aux. exact (S m). auto. auto.
77 qed.
78
79 theorem le_gen_S_x_cc: \forall m,x. (\exists n. x = (S n) \land (le m n)) \to
80                        (le (S m) x).
81 intros. elim H. elim H1. cut (S x1) = x. elim Hcut. auto. elim H2. auto.
82 qed.
83
84 theorem le_gen_S_S: \forall m,n. (le (S m) (S n)) \to (le m n).
85 intros.
86 lapply le_gen_S_x to H using H0. elim H0. elim H1. 
87 lapply eq_gen_S_S to H2 using H4. rewrite > H4. assumption.
88 qed.
89
90 theorem le_gen_S_S_cc: \forall m,n. (le m n) \to (le (S m) (S n)).
91 intros. auto.
92 qed.
93 (*
94 theorem le_trans: \forall x,y. (le x y) \to \forall z. (le y z) \to (le x z).
95 intros 1. elim x. 
96 clear x. auto.
97 clear H. fwd H1 [H]. decompose H.
98 *)