@@ -1877,12 +1877,17 @@ pred main-begin-declare-builders i:context-decl.
18771877main-begin-declare-builders CtxSkel :- std.do! [
18781878 Name is "Builders_" ^ {term_to_string {new_int}}, % TODO?
18791879 std.assert-ok! (elaborate-context-skel->factory CtxSkel Ctx GRF) "Context illtyped",
1880+ if-verbose (coq.say "HB: context to factory"),
18801881 coq.env.begin-module Name none,
1882+ if-verbose (coq.say "HB: begin module for builders"),
18811883 if (GRF = indt FRecord) (std.do! [
1884+ if-verbose (coq.say "HB: begin module Super"),
18821885 coq.env.begin-module "Super" none,
18831886 std.forall {coq.CS.canonical-projections FRecord} declare-old-constant,
1884- coq.env.end-module _]) (true),
1887+ coq.env.end-module _,
1888+ if-verbose (coq.say "HB: ended module Super")]) (true),
18851889 coq.env.begin-section Name,
1890+ if-verbose (coq.say "HB: postulating factories"),
18861891 builders-postulate-factories Ctx,
18871892].
18881893
@@ -1898,20 +1903,21 @@ postulate-factory-abbrev TheType Params Name Falias TheFactory :- std.do! [
18981903].
18991904
19001905% Only record fields can be exported as operations.
1901- pred define-factory-operations i:term, i:term, i:gref.
1902- define-factory-operations TheType TheFactory (indt I) :- !,
1903- coq.env.indt I _ NParams _ _ _ _,
1904- NHoles is NParams - 1,
1906+ pred define-factory-operations i:term, i:list term, i: term, i:gref.
1907+ define-factory-operations TheType Params TheFactory (indt I) :- !,
1908+ coq.env.indt I _ NIParams _ _ _ _,
1909+ NHoles is NIParams - 1 - {std.length Params} ,
19051910 coq.CS.canonical-projections I PL,
1906- std.forall PL (define-factory-operation TheType TheFactory NHoles).
1907- define-factory-operations _ _ _.
1911+ std.forall PL (define-factory-operation TheType Params TheFactory NHoles).
1912+ define-factory-operations _ _ _ _ .
19081913
1909- pred define-factory-operation i:term, i:term, i:int, i:option constant.
1910- define-factory-operation _ _ _ none.
1911- define-factory-operation TheType TheFactory NHoles (some P) :-
1914+ pred define-factory-operation i:term, i:list term, i: term, i:int, i:option constant.
1915+ define-factory-operation _ _ _ _ none.
1916+ define-factory-operation TheType Params TheFactory NHoles (some P) :-
19121917 coq.mk-n-holes NHoles Holes,
19131918 std.append Holes [TheFactory] Holes_Factory,
1914- T = app[global (const P), TheType|Holes_Factory],
1919+ std.append Params [TheType|Holes_Factory] Args,
1920+ T = app[global (const P)|Args],
19151921 std.assert-ok! (coq.typecheck T _) "Illtyped applied factory operation",
19161922 coq.gref->id (const P) Name,
19171923 @local! => coq.notation.add-abbreviation Name 0 T ff _.
@@ -1936,7 +1942,7 @@ builders-postulate-factories (context-item IDT _ TySkel none t\ context-item IDF
19361942 factory-requires GRF GRFMLwP, % TODO: remove, pass to main-declare-context the list-w-params-eta-expansion of GRF
19371943 main-declare-context TheType Params GRFMLwP _,
19381944 postulate-factory-abbrev TheType Params IDF GRF TheFactory,
1939- define-factory-operations TheType TheFactory GRF,
1945+ define-factory-operations TheType Params TheFactory GRF,
19401946 acc current (clause _ _ (current-mode (builder-from TheFactory GRF))),
19411947].
19421948
@@ -2039,6 +2045,8 @@ declare-factory-alias Ty1Skel GRFSwP Module TheType TheParams :- std.do! [
20392045
20402046 coq.env.end-section,
20412047
2048+ @global! => coq.arguments.set-implicit GRK [[]],
2049+
20422050 mk-phant-term (global GRK) PhGRK0,
20432051 if (mixin-first-class F _) (PhGRK = PhGRK0) (append-phant-unify PhGRK0 PhGRK),
20442052 mk-phant-abbrev "Build" PhGRK BuildConst _,
@@ -2099,6 +2107,8 @@ declare-mixin-or-factory Sort1 Fields0 GRFSwP Module TheType D TheParams :- std.
20992107 coq.env.end-section,
21002108 coq.env.indt R tt _ _ _ [K] _,
21012109 GRK = indc K,
2110+ @global! => coq.arguments.set-implicit (indt R) [[]],
2111+ @global! => coq.arguments.set-implicit GRK [[]],
21022112
21032113 % TODO: should this be in the Exports module?
21042114 if-verbose (coq.say "HB: declare notation axioms"),
0 commit comments