Debian Codegraph @

test-suite/bugs/bug_15916.v

raw
1 Set Universe Polymorphism. Set Printing Universes.
2
3 Module MultiInd.
4 Section S.
5 Universe u.
6
7 Cumulative Inductive I1 := C1 (_:Type@{u}).
8
9 Cumulative Inductive I2 := C2 (_:I1).
10 End S.
11
12 (* !!! should be covariant !!! *)
13 Fail Cumulative Inductive I3@{*u} := C3 (_:I2@{u}).
14
15 Cumulative Inductive I3@{u} := C3 (_:I2@{u}).
16
17 (* alternative test without the variance syntax: *)
18 Fail Check C3@{Type} _ : I3@{Set}. (* should fail but doesn't *)
19
20 Check C3@{Set} _ : I3@{Type}.
21 End MultiInd.
22
23 Module WithAxiom.
24 Section S.
25 Universe u.
26 Axiom t : Type@{u}. (* or even a Qed definition *)
27
28 Cumulative Inductive I1 := C1 (_:t).
29 End S.
30
31 (* !!! should be invariant !!! *)
32 Fail Cumulative Inductive I2@{*u} := C2 (_:I1@{u}).
33 Fail Cumulative Inductive I2@{+u} := C2 (_:I1@{u}).
34 Cumulative Inductive I2@{u} := C2 (_:I1@{u}).
35
36 (* !!! should not work !!! *)
37 Fail Polymorphic Definition lift_t@{u v|} (x:t@{u}) : t@{v}
38 := match (C1@{u} x) : I1@{v} with C1 y => y end.
39 Fail Polymorphic Definition lift_t@{u v|u < v +} (x:t@{u}) : t@{v}
40 := match (C1@{u} x) : I1@{v} with C1 y => y end.
41
42 (* sanity check that the above 2 test the right thing *)
43 Polymorphic Definition lift_t@{u v} (x:t@{u}) : t@{v}
44 := match (C1@{u} x) : I1@{v} with C1 y => y end.
45
46 End WithAxiom.
47
48 Module WithVars.
49
50 Module Rel.
51 Fail Cumulative Inductive foo@{*u +} (X:=Type@{u}) := C (_:X).
52
53 Cumulative Inductive foo@{+u +} (X:=Type@{u}) := C (_:X).
54 End Rel.
55
56 Module Var.
57 Section S.
58 Let X:=Type.
59 Cumulative Inductive foo := C (_:X).
60 End S.
61
62 Fail Cumulative Inductive bar@{*u} := C' (_:foo@{u}).
63 Cumulative Inductive bar@{+u} := C' (_:foo@{u}).
64 End Var.
65
66 End WithVars.