Skip to content

Commit a738ac2

Browse files
committed
fix rebase
1 parent 78ba477 commit a738ac2

File tree

5 files changed

+22
-21
lines changed

5 files changed

+22
-21
lines changed

HB/common/synthesis.elpi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@ under-mixin-src-from-factory.do! TheType TheFactory LP :- std.do! [
113113

114114
% Given TheType makes the provided list of mixins and instances
115115
% available for inference.
116-
pred under-these-mixin-src.do! i:term, i:list mixinname, i:list constant, i:list prop.
117-
under-these-mixin-src.do! TheType ML TheMixins LP :- std.do! [
116+
pred under-these-mixin-src.do! i:term, i:list mixinname, i:list constant, o:list prop, i:list prop.
117+
under-these-mixin-src.do! TheType ML TheMixins ClausesHas LP :- std.do! [
118118
std.map2 ML TheMixins (m\mi\c\ c = mixin-src TheType m (global (const mi))) MLClauses,
119+
std.map-filter MLClauses mixin-src->has-mixin-instance ClausesHas,
119120
MLClauses => std.do! LP
120121
].
121122

HB/instance.elpi

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,18 @@ declare-const Name BodySkel TyWPSkel CSL :- std.do! [
8787
% regular instance %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8888
if (get-option "wrapper" ff ; not(is-subject-lifter TheType _ _))
8989
% regular subject %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90-
(private.declare-regular-inst TheType ML TheMixins TyWP SectionName CSL)
90+
(private.declare-regular-inst TheType ML TheMixins TyWP SectionName ClausesHas CSL)
9191
% wrapper %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92-
(private.declare-wrapper-inst TheType ML TheMixins TyWP SectionName CSL)
92+
(private.declare-wrapper-inst TheType ML TheMixins TyWP SectionName ClausesHas CSL)
9393
,
9494

9595
% shared to all branches
9696
if (get-option "export" tt)
9797
(coq.env.current-library File,
98-
std.map CSL (x\r\ sigma i c\ x = pr i c, r = instance-to-export File i c) Clauses)
99-
(Clauses = []),
98+
std.map CSL (x\r\ sigma i c\ x = pr i c, r = instance-to-export File i c) ClausesExp)
99+
(ClausesExp = []),
100+
101+
std.append ClausesHas ClausesExp Clauses,
100102
]),
101103

102104
% we accumulate clauses now that the section is over
@@ -416,13 +418,13 @@ declare-mixins-from-factory Factory T F ML TheMixins :- std.do! [
416418

417419
% [declare-structure-instance-from-mixins T ML MLI] given mixins ML and
418420
% their implementation MLI declares all structure instances for T
419-
pred declare-structure-instance-from-mixins i:term, i:list mixinname, i:list constant, o:list (pair id constant).
420-
declare-structure-instance-from-mixins T ML TheMixins CL :- std.do! [
421+
pred declare-structure-instance-from-mixins i:term, i:list mixinname, i:list constant, o:list prop, o:list (pair id constant).
422+
declare-structure-instance-from-mixins T ML TheMixins ClausesHas CL :- std.do! [
421423
% The order of the following two "under...do!" is crucial,
422424
% priority must be given to canonical mixins
423425
% as they are the ones which guarantee forgetful inheritance
424426
% hence we add these clauses last.
425-
synthesis.under-these-mixin-src.do! T ML TheMixins [
427+
synthesis.under-these-mixin-src.do! T ML TheMixins ClausesHas [
426428
synthesis.under-local-canonical-mixins-of.do! T [
427429
instance.declare-all T {findall-classes-for ML} CL,
428430
]
@@ -436,9 +438,9 @@ close-section-if-has-params _ SectionName :-
436438
log.coq.env.end-section-name SectionName.
437439

438440
pred declare-regular-inst i:term, i:list mixinname, i:list constant, i:arity, i:id,
439-
o:list (pair id constant).
440-
declare-regular-inst TheType ML TheMixins TyWP SectionName CSL :- std.do![
441-
private.declare-structure-instance-from-mixins TheType ML TheMixins CCSL,
441+
o:list prop, o:list (pair id constant).
442+
declare-regular-inst TheType ML TheMixins TyWP SectionName ClausesHas CSL :- std.do![
443+
private.declare-structure-instance-from-mixins TheType ML TheMixins ClausesHas CCSL,
442444

443445
% TODO: share between the two cases and put just after declare-mixins-from-factory
444446
% since it talks about the unwrapped mixins
@@ -450,13 +452,13 @@ declare-regular-inst TheType ML TheMixins TyWP SectionName CSL :- std.do![
450452
].
451453

452454
pred declare-wrapper-inst i:term, i:list mixinname, i:list constant, i:arity, i:id,
453-
o:list (pair id constant).
454-
declare-wrapper-inst TheType ML TheMixins TyWP SectionName CSL :- std.do![
455+
o:list prop, o:list (pair id constant).
456+
declare-wrapper-inst TheType ML TheMixins TyWP SectionName ClausesHas CSL :- std.do![
455457
coq.safe-dest-app TheType TheTypeKey _,
456458
std.assert! (TheTypeKey = global TheTypeKeyGR) "The subject to be wrapped has no key",
457459
private.close-section-if-has-params TyWP SectionName,
458460
private.wrap-mixins TheTypeKeyGR ML TheMixins TheNewType WML TheWrappedMixins,
459-
private.declare-structure-instance-from-mixins TheNewType WML TheWrappedMixins CSL,
461+
private.declare-structure-instance-from-mixins TheNewType WML TheWrappedMixins ClausesHas CSL,
460462
].
461463

462464
pred derive-wrapper-instances i:term, i:mixinname, o:term, o:constant.

tests/hnf.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ Print HB_unnamed_mixin_8.
1414

1515
HB.instance Definition _ := f.Build bool (3 + 2).
1616
Print Datatypes_bool__canonical__hnf_S.
17-
Print HB_unnamed_mixin_12.
17+
(* Print HB_unnamed_mixin_12. *)
1818

tests/hnf.v.out

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@ HB_unnamed_mixin_8 =
55
{| M.x := f.y nat HB_unnamed_factory_6 + 1 |}
66
: M.axioms_ nat
77
Datatypes_bool__canonical__hnf_S =
8-
{| S.sort := bool; S.class := {| S.hnf_M_mixin := HB_unnamed_mixin_12 |} |}
8+
{| S.sort := bool; S.class := {| S.hnf_M_mixin := hnf_f__to__hnf_M__11 |} |}
99
: S.type
10-
HB_unnamed_mixin_12 =
11-
Builders_2.HB_unnamed_factory_4 bool HB_unnamed_factory_9
12-
: M.axioms_ bool

tests/not_same_key.v.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
The command has indeed failed with message:
2-
HB: all mixins must have the same key
2+
HB: expecting a factory on T
3+
or a factory on a structure operation or tag. Got: B.phant_axioms T T1

0 commit comments

Comments
 (0)