Debian Codegraph @

test-suite/bugs/bug_4627.v

raw
1 Class sa (A:Type) := { }.
2
3 Record predicate A (sa:sa A) :=
4 { pred_fun: A->Prop }.
5 Record ABC : Type :=
6 { abc: Type }.
7 Record T :=
8 { T_abc: ABC }.
9
10
11 (*
12 sa: forall _ : Type@{Top.179}, Prop
13 predicate: forall (A : Type@{Top.205}) (_ : sa A), Type@{max(Set+1, Top.205)}
14 T: Type@{Top.208+1}
15 ABC: Type@{Top.208+1}
16 abc: forall _ : ABC, Type@{Top.208}
17
18 Top.205 <= Top.179 predicate <= sa.A
19 Set < Top.208 Set < abc
20 Set < Top.205 Set < predicate
21 *)
22
23 Definition foo : predicate T (Build_sa T) :=
24 {| pred_fun:= fun w => True |}.
25 (* *)
26 (* Top.208 < Top.205 <--- added by foo *)
27 (* *)
28
29 Check predicate nat (Build_sa nat).
30 (*
31
32 The issue is that the template polymorphic universe of [predicate], Top.205, does not get replaced with the universe of [nat] in the above line.
33 -Jason Gross
34
35 8.5 -- predicate nat (Build_sa nat): Type@{max(Set+1, Top.205)}
36 8.5 EXPECTED -- predicate nat (Build_sa nat): Type@{Set+1}
37 8.4pl4 -- predicate nat {| |}: Type (* max(Set, (Set)+1) *)
38 *)
39
40 (* This works in 8.4pl4 and SHOULD work in 8.5 *)
41 Definition bar : ABC :=
42 {| abc:= predicate nat (Build_sa nat) |}.
43 (*
44 The term "predicate nat (Build_sa nat)" has type
45 "Type@{max(Set+1, Top.205)}"
46 while it is expected to have type "Type@{Top.208}"
47 (universe inconsistency: Cannot enforce Top.205 <=
48 Top.208 because Top.208 < Top.205).
49 *)