Skip to content

Commit 88a0190

Browse files
committed
use subject-lifter instead of structure-op
1 parent 99cb905 commit 88a0190

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

HB/common/database.elpi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,8 @@ find-max-classes [M|Mixins] [C|Classes] :-
385385
].
386386
find-max-classes [M|_] _ :- coq.error "HB: cannot find a class containing mixin" M.
387387

388-
pred is-structure-op-w-wrapper i:term, o:int, o:classname.
389-
is-structure-op-w-wrapper (global (const C)) N Class :- exported-op M _ C, wrapper-mixin _ (const C) _, factory-nparams M N, mixin-first-class M Class.
390-
is-structure-op-w-wrapper (app[global (const C)|_]) N Class :- exported-op M _ C, wrapper-mixin _ (const C) _, factory-nparams M N, mixin-first-class M Class.
391-
is-structure-op-w-wrapper (global GR) N Class :- tag GR Class N, wrapper-mixin _ GR _.
392-
is-structure-op-w-wrapper (app[global GR|_]) N Class :- tag GR Class N, wrapper-mixin _ GR _.
388+
pred is-subject-lifter i:term, o:int, o:classname.
389+
is-subject-lifter (global (const C)) N Class :- exported-op M _ C, wrapper-mixin _ (const C) _, factory-nparams M N, mixin-first-class M Class.
390+
is-subject-lifter (app[global (const C)|_]) N Class :- exported-op M _ C, wrapper-mixin _ (const C) _, factory-nparams M N, mixin-first-class M Class.
391+
is-subject-lifter (global GR) N Class :- tag GR Class N, wrapper-mixin _ GR _.
392+
is-subject-lifter (app[global GR|_]) N Class :- tag GR Class N, wrapper-mixin _ GR _.

HB/common/utils.elpi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ failsafe-structure-inference T T1 :-
376376
factory?-split T _ F_Params Subject Args,
377377
std.map F_Params copy F_Params1,
378378
std.map Args copy Args1,
379-
is-structure-op-w-wrapper Subject NP Class,
379+
is-subject-lifter Subject NP Class,
380380
coq.safe-dest-app Subject OP ArgsOp,
381381
std.nth NP ArgsOp S,
382382
(var S ; name S), % TODO: should be the subject of the structure, not a random name

HB/instance.elpi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ declare-const Name BodySkel TyWPSkel CSL :- std.do! [
8585
private.declare-mixins-from-factory Factory TheType TheFactory ML TheMixins,
8686

8787
% regular instance %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88-
if (get-option "wrapper" ff ; not(is-structure-op-w-wrapper TheType _ _))
88+
if (get-option "wrapper" ff ; not(is-subject-lifter TheType _ _))
8989
% regular subject %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9090
(private.declare-regular-inst TheType ML TheMixins TyWP SectionName CSL)
9191
% wrapper %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

HB/structure.elpi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ factory-on-some-structure-op? T VS F GR :- std.do! [
674674

675675
kind factory-on-subject type.
676676
type factory-on-the-type w-args factoryname -> factory-on-subject.
677-
type factory-on-structure-op term -> factoryname -> gref -> factory-on-subject.
677+
type factory-on-subject-lifter term -> factoryname -> gref -> factory-on-subject.
678678

679679
pred product->triples i:term, i:term, o:list factory-on-subject, o:bool.
680680
product->triples {{ lib:hb.prod lp:A lp:B }} T L ClosureCheck :- !,
@@ -684,10 +684,10 @@ product->triples {{ lib:hb.prod lp:A lp:B }} T L ClosureCheck :- !,
684684
product->triples {{ True }} _ [] tt :- !.
685685
product->triples {{ False }} _ [] ff :- !.
686686
product->triples A T [factory-on-the-type F] tt :- factory? A F, F = triple _ _ T, !.
687-
product->triples A _ [factory-on-structure-op A F OP] tt :- factory-on-some-structure-op? A [] F OP, !.
687+
product->triples A _ [factory-on-subject-lifter A F OP] tt :- factory-on-some-structure-op? A [] F OP, !.
688688
product->triples A T _ _ :-
689689
coq.error "HB: expecting a factory on" {coq.term->string T}
690-
"or a factory on a structure operation. Got:" {coq.term->string A}.
690+
"or a factory on a structure operation or tag. Got:" {coq.term->string A}.
691691

692692
pred sigT->list-w-params i:term, o:w-params (list factory-on-subject), o:bool.
693693
sigT->list-w-params (fun N T B) L C :-
@@ -711,13 +711,13 @@ lift-to-the-subject (w-params.nil ID T Rest) (w-params.nil ID T Rest1) :-
711711
lift-to-the-subject.aux [] _ [].
712712
lift-to-the-subject.aux [factory-on-the-type F|Rest] T [F|Rest1] :-
713713
lift-to-the-subject.aux Rest T Rest1.
714-
lift-to-the-subject.aux [factory-on-structure-op _ F OP|Rest] T [WF|Rest1] :-
714+
lift-to-the-subject.aux [factory-on-subject-lifter _ F OP|Rest] T [WF|Rest1] :-
715715
wrapper-mixin Wrapper OP F, !,
716716
factory-nparams Wrapper NParams,
717717
coq.mk-app {coq.env.global Wrapper} {std.append {coq.mk-n-holes NParams} [T]} W,
718718
factory? W WF,
719719
lift-to-the-subject.aux Rest T Rest1.
720-
lift-to-the-subject.aux [factory-on-structure-op Expr _ _|_] _ _ :-
720+
lift-to-the-subject.aux [factory-on-subject-lifter Expr _ _|_] _ _ :-
721721
coq.error "NYI: automatic wrapping for" {coq.term->string Expr}.
722722

723723

structures.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ Elpi Export HB.check.
10141014
(** [HB.tag] declares a tag for mixin subjects
10151015
10161016
[[
1017-
HB.tag Definition N Params x := x
1017+
HB.tag Definition N Params (x : S.type) : Type := x
10181018
]]
10191019
10201020
*)
@@ -1054,7 +1054,7 @@ main [str G, str"|", int M] :- !,
10541054
class-of-nth-arg M Ty Class,
10551055
acc-clause current (tag GR Class M).
10561056

1057-
main _ :- coq.error "Usage: HB.tag Definition <Name> := <Builder> T ...\nUsage: HB.tag <gref> | <nparams>".
1057+
main _ :- coq.error "Usage: HB.tag Definition <Name> ... <subject> := T ...\nUsage: HB.tag <gref> | <nparams>".
10581058

10591059
pred class-of-nth-arg i:int, i:term, o:classname.
10601060
class-of-nth-arg 0 (prod _ (global S) _\_) Class :- class-def (class Class S _).

0 commit comments

Comments
 (0)