Skip to content

Commit ec840e9

Browse files
committed
use subject-lifter instead of structure-op
1 parent 5216e36 commit ec840e9

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
@@ -471,8 +471,8 @@ find-max-classes [M|Mixins] [C|Classes] :-
471471
].
472472
find-max-classes [M|_] _ :- coq.error "HB: cannot find a class containing mixin" M.
473473

474-
pred is-structure-op-w-wrapper i:term, o:int, o:classname.
475-
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.
476-
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.
477-
is-structure-op-w-wrapper (global GR) N Class :- tag GR Class N, wrapper-mixin _ GR _.
478-
is-structure-op-w-wrapper (app[global GR|_]) N Class :- tag GR Class N, wrapper-mixin _ GR _.
474+
pred is-subject-lifter i:term, o:int, o:classname.
475+
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.
476+
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.
477+
is-subject-lifter (global GR) N Class :- tag GR Class N, wrapper-mixin _ GR _.
478+
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
@@ -678,7 +678,7 @@ factory-on-some-structure-op? T VS F GR :- std.do! [
678678

679679
kind factory-on-subject type.
680680
type factory-on-the-type w-args factoryname -> factory-on-subject.
681-
type factory-on-structure-op term -> factoryname -> gref -> factory-on-subject.
681+
type factory-on-subject-lifter term -> factoryname -> gref -> factory-on-subject.
682682

683683
pred product->triples i:term, i:term, o:list factory-on-subject, o:bool.
684684
product->triples {{ lib:hb.prod lp:A lp:B }} T L ClosureCheck :- !,
@@ -688,10 +688,10 @@ product->triples {{ lib:hb.prod lp:A lp:B }} T L ClosureCheck :- !,
688688
product->triples {{ True }} _ [] tt :- !.
689689
product->triples {{ False }} _ [] ff :- !.
690690
product->triples A T [factory-on-the-type F] tt :- factory? A F, F = triple _ _ T, !.
691-
product->triples A _ [factory-on-structure-op A F OP] tt :- factory-on-some-structure-op? A [] F OP, !.
691+
product->triples A _ [factory-on-subject-lifter A F OP] tt :- factory-on-some-structure-op? A [] F OP, !.
692692
product->triples A T _ _ :-
693693
coq.error "HB: expecting a factory on" {coq.term->string T}
694-
"or a factory on a structure operation. Got:" {coq.term->string A}.
694+
"or a factory on a structure operation or tag. Got:" {coq.term->string A}.
695695

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

727727

structures.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ Elpi Export HB.check.
10551055
(** [HB.tag] declares a tag for mixin subjects
10561056
10571057
[[
1058-
HB.tag Definition N Params x := x
1058+
HB.tag Definition N Params (x : S.type) : Type := x
10591059
]]
10601060
10611061
*)
@@ -1095,7 +1095,7 @@ main [str G, str"|", int M] :- !,
10951095
class-of-nth-arg M Ty Class,
10961096
acc-clause current (tag GR Class M).
10971097

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

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

0 commit comments

Comments
 (0)