1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "basics/pts.ma".
17 (*FEATURE: kind signatures in type declarations*)
19 inductive nat : Type[0] ≝ O: nat | S: nat → nat.
23 axiom test2: Type[1] → Type[1].
25 axiom test3: Prop → Type[1] → CProp[1] → Type[1] → Type[2].
27 axiom test4: ∀A:Type[1]. A → ∀B:Type[1]. B → ∀C:Prop. C → Type[1].
29 axiom test4': ∀C:Prop. C → C.
31 axiom test4'': ∀C:Prop. C → nat.
33 axiom test4''': ∀C:Type[1]. C.
35 axiom test4_5: (∀A:Type[0].A) → nat.
37 axiom test5: (Type[1] → Type[1]) → Type[1].
40 axiom test6: Type[1] → Prop.
42 definition dtest1: Type[1] ≝ nat → nat.
44 definition dtest2: Type[2] ≝ ∀A:Type[1]. A → A.
46 definition dtest3: Type[1] → Type[1] ≝ λA:Type[1]. A → A.
48 definition dtest4: Type[1] → Type[1] ≝ λA:Type[1].dtest3 A.
50 definition dtest5: Type[1] → Type[1] ≝ dtest3.
52 definition dtest6: Type[1] ≝ dtest3 nat.
54 inductive True : Prop ≝ I: True.
57 definition dtest7: Prop ≝ True → True.
60 definition dtest8: Type[1] ≝ dtest3 True.
63 definition dtest9: Type[1] ≝ dtest3 Prop.
65 definition dtest10: Type[1] → Type[1] → Type[1] ≝ λX,Y.X.
67 definition dtest11: Type[1] → nat → Type[1] → Type[1] ≝ λ_:Type[1].λ_:nat.λX:Type[1]. X → nat → test1.
70 definition dtest12 ≝ λ_:Type[1].λ_:nat.λX:Type[1]. X → nat → test1.
72 definition dtest13 ≝ dtest3 nat → dtest3 True → dtest3 Prop → nat.
74 definition dtest14 ≝ λX:Type[2]. X → X.
76 (*FEATURE: type the forall bound variables*)
77 definition dtest15 ≝ ∀T:Type[1] → Type[1]. T nat → T nat.
79 definition dtest16 ≝ ∀T:Type[1]. T → nat.
81 definition dtest17 ≝ ∀T:dtest14 Type[1]. T nat → dtest14 nat → dtest14 nat.
83 definition dtest18 ≝ λA,B:Type[0].λn:nat.λC:Type[0].A.
85 definition dtest19 ≝ dtest18 nat True O nat → dtest18 nat nat O nat.
87 definition dtest20 ≝ test5 test2.
89 (*BUG: lambda-lift the inner declaration;
90 to be traced, raises NotInFOmega; why?
91 definition dtest21 ≝ test5 (λX:Type[1].X).*)
93 definition ttest1 ≝ λx:nat.x.
95 (*BUG: clash of name due to capitalisation*)
96 (*definition Ttest1 ≝ λx:nat.x.*)
98 (*FEATURE: print binders in the l.h.s. without using lambda abstraction*)
99 definition ttest2 ≝ λT:Type[1].λx:T.x.
101 definition ttest3 ≝ λT:Type[1].λx:T.let y ≝ x in y.
103 definition ttest4 ≝ λT:Type[1].let y ≝ T in λx:y.x.
105 (*BUG IN HASKELL PRETTY PRINTING: all lets are let rec*)
106 (*definition ttest5 ≝ λT:Type[1].λy:T.let y ≝ y in y.*)
108 definition ttest6 ≝ ttest4 nat.
110 definition ttest7 ≝ λf:∀X:Type[1].X. f (nat → nat) O.
112 definition ttest8 ≝ λf:∀X:Type[1].X. f (True → True) I.
114 definition ttest9 ≝ λf:∀X:Type[1].X. f (True → nat) I.
116 definition ttest10 ≝ λf:∀X:Type[1].X. f (True → nat → nat) I O.
118 definition ttest11_aux ≝ λS:Type[1]. S → nat.
120 definition ttest11 ≝ λf:ttest11_aux True. f I.
122 definition ttest12 ≝ λf:True → nat. f I.
124 (*GENERAL BUG: name clashes when binders shadow each other in CIC*)
126 (*BUG: mutual type definitions not handled correctly: the ref is computed in a
129 (*BUG: multiple let-reced things are given the same (wrong) name*)
131 (*BUG: for OCaml: cofixpoint not distinguished from fixpoints*)
133 let rec rtest1 (n:nat) : nat ≝
138 let rec f (n:nat) : nat ≝
142 and g (n:nat) : nat ≝
147 (*BUG: pattern matching patterns when arguments have been deleted from
148 the constructor are wrong *)
150 (*BUG: constructor names in pattern should be capitalised correctly;
151 name clashes must be avoided*)
153 coinductive stream: Type[0] ≝ scons : nat → stream → stream.
155 let corec div (n:nat) : stream ≝ scons n (div (S n)).
157 axiom plus: nat → nat → nat.
159 definition rtest2 : nat → stream → nat ≝
160 λm,s. match s with [ scons n l ⇒ plus m n ].
163 let rec mkterm (n:nat) : nat ≝
167 and mktyp (n:nat) : Type[0] ≝
172 inductive meee: Type[0] → Type[0] ≝ .
174 inductive T1 : (Type[0] → Type[0]) → ∀B:Type[0]. nat → Type[0] → Type[0] ≝ .
176 inductive T2 : (Type[0] → Type[0]) → ∀B:Type[0]. B → Type[0] → Type[0] ≝ .
179 (*BUG: eliminators extracted anyway???*)
180 inductive T3 : (Type[0] → Type[0]) → CProp[2] ≝ .
182 definition erase ≝ λX:Type[0].Type[0].
184 axiom lt: nat → nat → Prop.
186 (*BUG: elimination principles not extracted *)
187 inductive myvect (A: Type[0]) (b:nat) : nat → Type[0] ≝
188 myemptyv : myvect A b O
189 | mycons: ∀n. lt n b → A → myvect A b n → myvect A b (S n).
191 inductive False: Prop ≝ .
193 inductive Empty: Type[0] ≝ .
195 inductive bool: Type[0] ≝ true: bool | false:bool.
197 inductive eq (A:Type[1]) (a:A) : A → Prop ≝ refl: eq A a a.
199 (* BUG: requires coercion *)
200 definition cast_bug1 ≝
201 λH:eq Type[0] bool nat. S (match H return λA:Type[0].λ_.A with [ refl ⇒ true ]).
203 (* BUG: requires top type *)
204 definition cast_bug2 ≝
206 match true return λb.match b with [ true ⇒ nat → nat | false ⇒ bool ] with
207 [ true ⇒ S | false ⇒ false ]