Skip to content

Commit 8a78dad

Browse files
authored
Merge pull request rocq-community#65 from MysaaJava/master
Removed fresh-type, merged param for global and pglobal
2 parents 4ed783c + f1c5324 commit 8a78dad

2 files changed

Lines changed: 11 additions & 33 deletions

File tree

elpi/aterm.elpi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,7 @@ namespace aterm.util {
9999
% The other cases are aglobal, apglobal, and (name X), which all leads to []
100100
classes _ [] none :- !.
101101

102+
func global i:aterm o:gref.
103+
global (aglobal G) G :- !.
104+
global (apglobal G _) G :- !.
102105
}

elpi/param.elpi

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -41,43 +41,18 @@ pred param i:aterm, i:aterm, o:term, o:term.
4141
func param.store aterm -> aterm, term, term.
4242

4343
% used in order not to typecheck+annotate twice the same term
44-
pred fresh-type.
4544

4645
% ==================================================================================================
4746

4847
% TrocqConv + TrocqConst
49-
param (aglobal GR as Tm) AT' Tm' GrefR :- !,
48+
param Tm AT' Tm' GrefR :- aterm.util.global Tm GR, !, std.do! [
5049
logging.debug (coq.say "[param] Rule const :" Tm "@" AT'),
51-
if (fresh-type) (
52-
% T' already comes from a call to annot.typecheck in the case for app
53-
% subtyping will be handled there
54-
% (we do not want to annot.typecheck several times a same constant, because it creates
55-
% fresh class variables twice, which would split the information)
56-
cstr.dep-gref GR AT' Tm' GRR,
57-
GrefR = pglobal GRR _
58-
) (
59-
std.do![
60-
annot.typecheck (aglobal GR) AT,
61-
annot.sub-type AT AT',
62-
cstr.dep-gref GR AT Tm' GRR,
63-
weaken AT AT' {aterm->term Tm} Tm' (pglobal GRR _) GrefR,
64-
]
65-
),
66-
logging.debug (coq.say "[param] Out rule const :" Tm' "∵" GrefR).
67-
68-
% universe-polymorphic case
69-
param (apglobal GR UI as Tm) AT' Tm' GrefR :- !,
70-
logging.debug (coq.say "[param] Rule pconst :" Tm "@" AT'),
71-
if (fresh-type) (
72-
cstr.dep-gref GR AT' Tm' GRR,
73-
GrefR = pglobal GRR UI
74-
) (
75-
annot.typecheck (apglobal GR UI) AT,
76-
annot.sub-type AT AT',
77-
cstr.dep-gref GR AT Tm' GRR,
78-
weaken AT AT' {aterm->term Tm} Tm' (pglobal GRR UI) GrefR
79-
),
80-
logging.debug (coq.say "[param] Out rule pconst :" Tm' "∵" GrefR).
50+
annot.typecheck Tm AT,
51+
annot.sub-type AT AT',
52+
cstr.dep-gref GR AT Tm' GRR,
53+
weaken AT AT' {aterm->term Tm} Tm' (pglobal GRR _) GrefR, %TODO We should replace with a coq.env.global here
54+
logging.debug (coq.say "[param] Out rule const :" Tm' "∵" GrefR)
55+
].
8156

8257
% TrocqConv + TrocqVar
8358
param X T2 X' Witness :- name X, !,
@@ -162,7 +137,7 @@ param
162137
param (aapp [F|Xs] as T) B (app [F'|Xs'] as T') Witness :- !, std.do! [
163138
logging.debug (coq.say "[param] Rule app :" T "@" B),
164139
annot.typecheck F TF,
165-
fresh-type => param F TF F' FR,
140+
param F TF F' FR,
166141
param.args TF B Xs Xs' XsR B0,
167142
coq.mk-app FR XsR AppR,
168143
weaken B0 B {aterm->term T} T' AppR Witness,

0 commit comments

Comments
 (0)