@@ -157,22 +157,28 @@ process-asset-unnamed-parameters (asset-record _ Sort _ Fields) GRFS Module TheT
157157
158158pred declare-factory-alias i:term, i:list-w-params factoryname, i:id, i:term, i:list term.
159159declare-factory-alias Ty1Skel GRFSwP Module TheType TheParams :- std.do! [
160-
161160 % TODO maybe context.declare should just take GRFSwP and postulate
162161 % the parameters and the type
163- context.declare TheType TheParams GRFSwP Hyps _,
162+ context.declare TheType TheParams GRFSwP MixinSrcClauses SectionCanonicalInstance,
163+
164+ if-verbose (coq.say "HB: declare constant axioms_"),
164165
165166 std.assert-ok! (coq.elaborate-ty-skeleton Ty1Skel _ Ty1) "Illtyped alias factory",
166- log.coq.env.add-const-noimplicits "axioms_" Ty1 _ @transparent! C,
167+
168+ abstract-over-section TheParams TheType MixinSrcClauses SectionCanonicalInstance coq.abstract-const-decl (pr Ty1 _) (pr Ty1Closed _) Section,
169+ log.coq.env.add-const-noimplicits "axioms_" Ty1Closed _ @transparent! C,
167170
168171 std.assert! (safe-dest-app Ty1 (global PhF) _Args) "Argument must be a factory",
169172 std.assert! (factory-alias->gref PhF F) "BUG: Factory alias declaration missing",
170173 std.assert! (factory-constructor F FK) "BUG: Factory constructor missing",
171174
172- Hyps => synthesis.infer-all-mixin-args TheParams TheType FK MFK,
175+ MixinSrcClauses => synthesis.infer-all-mixin-args TheParams TheType FK MFK,
173176 std.assert-ok! (coq.typecheck MFK MFKTy) "BUG: typecking of former factory constructor failed",
174- (pi Args\ copy (app [global F|Args]) (global (const C))) => copy MFKTy MFKTyC,
175- log.coq.env.add-const-noimplicits "Axioms_" MFK MFKTyC @transparent! CK,
177+ (pi Args\ copy (app[global F|Args]) (app[global (const C)|Section])) => copy MFKTy MFKTyC,
178+
179+ abstract-over-section TheParams TheType MixinSrcClauses SectionCanonicalInstance coq.abstract-const-decl (pr MFK MFKTyC) (pr MFKClosed MFKTyCClosed) _,
180+ log.coq.env.add-const-noimplicits "Axioms_" MFKClosed MFKTyCClosed @transparent! CK,
181+
176182 GRK = const CK,
177183
178184 log.coq.env.end-section-name Module,
@@ -224,16 +230,16 @@ build-deps-for-projections R MLwP CL :- std.do! [
224230% variables that aoccur. We don't want that for mixin/factories, so we implement
225231% our own discharging. Note that definitions (like canonical instance) have
226232% to be abstracted too.
227- pred abstract-indt-decl- over-section i:list term, i:term, i:list prop, i:list constant, i:indt-decl, o:indt-decl .
228- abstract-indt-decl- over-section TheParams TheType MixinSrcClauses SectionCanonicalInstance RDecl RDeclClosed :-
233+ pred abstract-over-section i:list term, i:term, i:list prop, i:list constant, i:(list constant -> A -> A -> prop), i:A, o:A, o:list term .
234+ abstract-over-section TheParams TheType MixinSrcClauses SectionCanonicalInstance F X X1 Section :-
229235 % compute section variables to be used for discharging
230236 std.map MixinSrcClauses mixin-src_src Mixins,
231237 std.append TheParams [TheType|{std.rev Mixins}] Section,
232238 std.map Section (x\r\ x = global (const r)) SectionVars,
233239 % We discharge by hand the record declaration so that we can be sure all
234240 % parameters and mixins are abstracted (even if unused).
235241 coq.copy-clauses-for-unfold SectionCanonicalInstance CopyUnfold,
236- CopyUnfold => coq.abstract-indt-decl SectionVars RDecl RDeclClosed .
242+ CopyUnfold => F SectionVars X X1 .
237243
238244pred declare-mixin-or-factory i:term, i:record-decl, i:list-w-params factoryname, i:id, i:term, i:asset, i:list term.
239245declare-mixin-or-factory Sort1 Fields GRFSwP Module TheType D TheParams :- std.do! [
@@ -245,7 +251,7 @@ declare-mixin-or-factory Sort1 Fields GRFSwP Module TheType D TheParams :- std.d
245251 RDeclSkel = record "axioms_" Sort1 Kname Fields,
246252 std.assert-ok! (coq.elaborate-indt-decl-skeleton RDeclSkel RDecl) "record declaration illtyped",
247253
248- abstract-indt-decl- over-section TheParams TheType MixinSrcClauses SectionCanonicalInstance RDecl RDeclClosed,
254+ abstract-over-section TheParams TheType MixinSrcClauses SectionCanonicalInstance coq.abstract-indt-decl RDecl RDeclClosed _ ,
249255
250256 log.coq.env.add-indt RDeclClosed R,
251257 log.coq.env.end-section-name Module, % We need to anyway declare the record inside the section
0 commit comments