@@ -5,8 +5,8 @@ namespace structure {
55
66% HB.structure Definition S P1 P2 := { T of F1 P1 T & F2 P1 (P2*P2) T }
77% cons p1\ cons p2\ nil t\ [triple f1 [p1] t,triple f2 [p1, {{p1 * p2}}] t]
8- pred declare i:string, i:term.
9- declare Module B :- std.do! [
8+ pred declare i:string, i:term, i:universe .
9+ declare Module B Sort :- std.do! [
1010 purge-id B B1, std.assert-ok! (coq.elaborate-skeleton B1 _ B2) "illtyped structure definition",
1111 private.sigT->list-w-params B2 GRFSwP ClosureCheck,
1212
@@ -35,7 +35,7 @@ declare Module B :- std.do! [
3535
3636 log.coq.env.begin-module Module none,
3737
38- private.declare-class+structure MLwP
38+ private.declare-class+structure MLwP Sort
3939 ClassName Structure SortProjection ClassProjection Factories StructKeyClause,
4040
4141 w-params.map MLwP (_\_\_\ mk-nil) NilwP,
@@ -493,17 +493,20 @@ pred synthesize-fields.body i:list term, i:term, i:list (w-args mixinname), o:in
493493synthesize-fields.body _Params T ML (record "axioms_" {{ Type }} "Class" FS) :-
494494 synthesize-fields T ML FS.
495495
496- pred mk-record+sort-field i:name, i:term, i:(term -> record-decl), o:indt-decl.
497- mk-record+sort-field _ T F (record RecordName {{ Type }} "Pack" (field _ "sort" T F)) :-
498- if (get-option "infer" _) (RecordName = "type_") (RecordName = "type").
496+ pred mk-record+sort-field i:universe, i:name, i:term, i:(term -> record-decl), o:indt-decl.
497+ mk-record+sort-field Sort _ T F (record RecordName (sort Sort) "Pack" (field _ "sort" T F)) :- !, std.do! [
498+ if (get-option "infer" _) (RecordName = "type_") (RecordName = "type")
499+ ].
499500
500501pred mk-class-field i:classname, i:list term, i:term, i:list (w-args mixinname), o:record-decl.
501502mk-class-field ClassName Params T _ (field [canonical ff] "class" (app [global ClassName|Args]) _\end-record) :-
502503 std.append Params [T] Args.
503504
504505% Builds the axioms record and the factories from this class to each mixin
505- pred declare-class+structure i:mixins, o:factoryname, o:structure, o:term, o:term, o:list prop, o:prop.
506- declare-class+structure MLwP (indt ClassInd) (indt StructureInd) SortProjection ClassProjection AllFactories (structure-key SortP ClassP (indt StructureInd)):- std.do! [
506+ pred declare-class+structure i:mixins, i:universe, o:factoryname, o:structure, o:term, o:term, o:list prop, o:prop.
507+ declare-class+structure MLwP Sort
508+ (indt ClassInd) (indt StructureInd) SortProjection ClassProjection AllFactories
509+ (structure-key SortP ClassP (indt StructureInd)):- std.do! [
507510
508511 if-verbose (coq.say {header} "declare axioms record"MLwP ),
509512
@@ -525,7 +528,7 @@ declare-class+structure MLwP (indt ClassInd) (indt StructureInd) SortProjection
525528
526529 if-verbose (coq.say {header} "declare type record"),
527530
528- w-params.then MLwP (mk-parameter explicit) mk-record+sort-field
531+ w-params.then MLwP (mk-parameter explicit) ( mk-record+sort-field Sort)
529532 (mk-class-field (indt ClassInd)) StructureDeclaration,
530533
531534 std.assert-ok! (coq.typecheck-indt-decl StructureDeclaration) "declare: illtyped",
0 commit comments