Skip to content

Commit 4d9d215

Browse files
committed
A test file
1 parent aaa3656 commit 4d9d215

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

tests/test_polymorphism.v

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From elpi Require Import elpi.
2+
Set Universe Polymorphism.
3+
Set Polymorphic Inductive Cumulativity.
4+
Set Printing Universes.
5+
Set Debug "comInductive".
6+
Set Debug "elpi".
7+
8+
Module test_rocq.
9+
Record test : Type := mktest { foo : Type }.
10+
Print test. (* Record test@{u} : Type@{u+1} := mktest { foo : Type@{u} }. (* u |= *)*)
11+
End test_rocq.
12+
Module test_elpi.
13+
Elpi Command test_default.
14+
Elpi Query lp:"
15+
coq.env.add-indt (record ""test"" {{Type}} ""mktest""
16+
(field _ ""foo"" {{Type}} _ \ end-record)) _C.
17+
".
18+
Print test. (* Record test : Type@{test.u0} := mktest { foo : Type@{test.u1} }. *)
19+
(* we get a monomorphic universe *)
20+
End test_elpi.
21+
22+
Set Debug "ustate".
23+
Set Debug "univVariances".
24+
Set Debug "univMinim".
25+
Module test_explicit.
26+
Elpi Command test_explicit.
27+
Elpi Query lp:"
28+
@keep-alg-univs! => @univpoly! => @cumulative! => coq.env.add-indt (record ""test"" {{Type}} ""mktest""
29+
(field _ ""foo"" {{Type}} _ \ end-record)) _C.
30+
".
31+
Print test.
32+
(* Record test@{u u0} : Type@{u} := mktest { foo : Type@{u0} }. *)
33+
(* u(= (* for typing) in term, + in type) u0(= in term) |= u0 < u *) *)
34+
(* It's indeed polymorphic but we do not get the minimized version *)
35+
End test_explicit.
36+
37+
Module test_minimization.
38+
Elpi Command test_minimization.
39+
Elpi Query lp:"
40+
coq.univ.new U,
41+
coq.univ.variable U V,
42+
@keep-alg-univs! => @udecl! [V] ff [] tt => coq.env.add-indt (record ""test"" (sort (typ _)) ""mktest""
43+
(field _ ""foo"" (sort (typ U)) _ \ end-record)) _C.
44+
".
45+
Print test.
46+
(* It's indeed polymorphic but we do not get the minimized version *))
47+
End test_minimization.

0 commit comments

Comments
 (0)