]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/tests/elim.ma
ocaml 3.09 transition
[helm.git] / helm / matita / tests / elim.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 set "baseuri" "cic:/matita/tests/elim".
16 include "coq.ma".
17
18 inductive stupidtype: Set \def
19   | Base : stupidtype
20   | Next : stupidtype \to stupidtype
21   | Pair : stupidtype \to stupidtype \to stupidtype.
22   
23 alias symbol "eq" (instance 0) = "Coq's leibnitz's equality".
24 alias symbol "exists" (instance 0) = "Coq's exists".
25 alias symbol "or" (instance 0) = "Coq's logical or".
26 alias num (instance 0) = "natural number".
27 alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)".
28 alias id "refl_equal" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1)".
29   
30 theorem serious:
31   \forall a:stupidtype.
32     a = Base 
33   \lor 
34     (\exists b:stupidtype.a = Next b) 
35   \lor 
36     (\exists c,d:stupidtype.a = Pair c d).
37 intros.
38 elim a.
39 clear a.left.left.
40   reflexivity.
41 clear H.clear a.left.right.
42   exists.exact s.reflexivity.
43 clear H.clear H1.clear a.right.
44   exists.exact s.exists.exact s1.reflexivity.  
45 qed.
46
47 theorem t: 0=0 \to stupidtype.
48  intros; constructor 1.
49 qed.
50
51 (* In this test "elim t" should open a new goal 0=0 and put it in the *)
52 (* goallist so that the THEN tactical closes it using reflexivity.    *)
53 theorem foo: let ax \def refl_equal ? 0 in t ax = t ax.
54  elim t; reflexivity.
55 qed.
56
57 (* This test shows a bug where elim opens a new unus{ed,eful} goal *)
58
59 alias symbol "eq" (instance 0) = "Coq's leibnitz's equality".
60 alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)".
61
62 inductive sum (n:nat) : nat \to nat \to Set \def
63   k: \forall x,y. n = x + y \to sum n x y.
64   
65 theorem t': \forall x,y. \forall H: sum x y O.
66           match H with [ (k a b p) \Rightarrow a ] = x.
67  intros.
68  cut (y = y \to O = O \to match H with [ (k a b p) \Rightarrow a] = x).
69  apply Hcut; reflexivity.
70  apply
71   (sum_ind ?
72     (\lambda a,b,K. y=a \to O=b \to
73         match K with [ (k a b p) \Rightarrow a ] = x)
74      ? ? ? H).
75  goal 16.
76  simplify. intros.
77  generalize in match H1.
78  rewrite < H2; rewrite < H3.intro.
79  rewrite > H4.auto.
80 qed.