Skip to content

Commit 650ca3d

Browse files
committed
put the eqb ast into a namespace
1 parent 028d3ed commit 650ca3d

File tree

6 files changed

+155
-155
lines changed

6 files changed

+155
-155
lines changed

apps/derive/elpi/eqType.elpi

+49-49
Original file line numberDiff line numberDiff line change
@@ -4,82 +4,82 @@
44

55
namespace derive.eqType.ast {
66

7-
pred translate-indt i:inductive, o:eqType, o:diagnostic.
7+
pred translate-indt i:inductive, o:eqb.eqType, o:diagnostic.
88
translate-indt I O D :-
99
coq.env.indt-decl I Decl,
1010
coq.env.indt I _ _ _ _ KN _,
1111
translate-param Decl I KN O D.
1212

13-
pred translate-param i:indt-decl, i:inductive, i:list constructor, o:eqType, o:diagnostic.
14-
translate-param (parameter ID _ Ty F) I KS (type-param F1) D :- whd Ty [] {{ Type }} _, !,
13+
pred translate-param i:indt-decl, i:inductive, i:list constructor, o:eqb.eqType, o:diagnostic.
14+
translate-param (parameter ID _ Ty F) I KS (eqb.type-param F1) D :- whd Ty [] {{ Type }} _, !,
1515
@pi-parameter ID Ty x\ pi y\ term->trm x y ok => translate-param (F x) I KS (F1 y) D.
16-
translate-param (parameter ID _ Ty F) I KS (value-param Ty1 F1) D :- term->trm Ty Ty1 ok, !,
16+
translate-param (parameter ID _ Ty F) I KS (eqb.value-param Ty1 F1) D :- term->trm Ty Ty1 ok, !,
1717
@pi-parameter ID Ty x\ pi y\ term->trm x y ok => translate-param (F x) I KS (F1 y) D.
1818
translate-param (parameter ID _ _ _) _ _ _ (error S) :- S is "unsupported parameter " ^ ID.
1919

20-
translate-param (inductive ID tt (arity (sort S)) F) I KS (inductive I F1) D :-
20+
translate-param (inductive ID tt (arity (sort S)) F) I KS (eqb.inductive I F1) D :-
2121
@pi-inductive ID (arity (sort S)) x\ pi y\ term->trm x y ok => translate-constructors (F x) KS (F1 y) D.
22-
translate-param (record _ _ _ F) I [K] (inductive I (y\ [constructor K (F1 y)])) D :- !,
22+
translate-param (record _ _ _ F) I [K] (eqb.inductive I (y\ [eqb.constructor K (F1 y)])) D :- !,
2323
pi y\ self y => translate-record-constructor F (F1 y) D.
2424
translate-param _ _ _ _ (error S) :- S is "unsupported inductive arity".
2525

26-
pred translate-constructors i:list indc-decl, i:list constructor, o:list constructor, o:diagnostic.
26+
pred translate-constructors i:list indc-decl, i:list constructor, o:list eqb.constructor, o:diagnostic.
2727
translate-constructors [] [] [] ok.
28-
translate-constructors [constructor _ A|KS] [K|KK] [constructor K Args|KS1] D :- std.do-ok! D [
28+
translate-constructors [constructor _ A|KS] [K|KK] [eqb.constructor K Args|KS1] D :- std.do-ok! D [
2929
translate-arguments {coq.arity->term A} Args,
3030
translate-constructors KS KK KS1,
3131
].
3232

33-
pred translate-arguments i:term, o:arguments, o:diagnostic.
33+
pred translate-arguments i:term, o:eqb.arguments, o:diagnostic.
3434
translate-arguments T T2 D :- whd1 T T1, !, translate-arguments T1 T2 D.
35-
translate-arguments (prod N Ty F) (irrelevant Ty1 F1) D :- not(pi x\ occurs x (F x)), irrelevant? Ty Ty1 ok, !,
35+
translate-arguments (prod N Ty F) (eqb.irrelevant Ty1 F1) D :- not(pi x\ occurs x (F x)), irrelevant? Ty Ty1 ok, !,
3636
@pi-decl N Ty x\ translate-arguments (F x) F1 D.
37-
translate-arguments (prod N Ty F) (regular Ty1 F1) D :- not(pi x\ occurs x (F x)), !, std.do-ok! D [
37+
translate-arguments (prod N Ty F) (eqb.regular Ty1 F1) D :- not(pi x\ occurs x (F x)), !, std.do-ok! D [
3838
term->trm Ty Ty1,
3939
(d\ @pi-decl N Ty x\ translate-arguments (F x) F1 d),
4040
].
41-
translate-arguments (prod N Ty F) (dependent Ty1 F1) D :- !, std.do-ok! D [
41+
translate-arguments (prod N Ty F) (eqb.dependent Ty1 F1) D :- !, std.do-ok! D [
4242
term->trm Ty Ty1,
4343
(d\ @pi-decl N Ty x\ pi y\ term->trm x y ok => translate-arguments (F x) (F1 y) d),
4444
].
45-
translate-arguments Ty (stop Ty1) D :- name Ty, term->trm Ty Ty1 D.
46-
translate-arguments (app [N|_] as Ty) (stop Ty1) D :- name N, term->trm Ty Ty1 D.
45+
translate-arguments Ty (eqb.stop Ty1) D :- name Ty, term->trm Ty Ty1 D.
46+
translate-arguments (app [N|_] as Ty) (eqb.stop Ty1) D :- name N, term->trm Ty Ty1 D.
4747
translate-arguments T _ (error S) :- S is "unsupported argument " ^ {coq.term->string T}.
4848

49-
pred translate-record-constructor i:record-decl, o:arguments, o:diagnostic.
50-
translate-record-constructor end-record (stop X) ok :- self X.
51-
translate-record-constructor (field _ ID Ty F) (irrelevant Ty1 F1) D :- not(pi x\ occurs x (F x)), irrelevant? Ty Ty1 ok, !,
49+
pred translate-record-constructor i:record-decl, o:eqb.arguments, o:diagnostic.
50+
translate-record-constructor end-record (eqb.stop X) ok :- self X.
51+
translate-record-constructor (field _ ID Ty F) (eqb.irrelevant Ty1 F1) D :- not(pi x\ occurs x (F x)), irrelevant? Ty Ty1 ok, !,
5252
@pi-parameter ID Ty x\ translate-record-constructor (F x) F1 D.
53-
translate-record-constructor (field _ ID Ty F) (regular Ty1 F1) D :- not(pi x\ occurs x (F x)), !, std.do-ok! D [
53+
translate-record-constructor (field _ ID Ty F) (eqb.regular Ty1 F1) D :- not(pi x\ occurs x (F x)), !, std.do-ok! D [
5454
term->trm Ty Ty1,
5555
(d\ @pi-parameter ID Ty x\ translate-record-constructor (F x) F1 d),
5656
].
57-
translate-record-constructor (field _ ID Ty F) (dependent Ty1 F1) D :- !, std.do-ok! D [
57+
translate-record-constructor (field _ ID Ty F) (eqb.dependent Ty1 F1) D :- !, std.do-ok! D [
5858
term->trm Ty Ty1,
5959
(d\ @pi-parameter ID Ty x\ pi y\ term->trm x y ok => translate-record-constructor (F x) (F1 y) d),
6060
].
6161
translate-record-constructor (field _ ID _ _) _ (error S) :- S is "unsupported record field " ^ ID.
6262

63-
pred self o:trm.
63+
pred self o:eqb.trm.
6464

65-
pred valid i:trm, o:diagnostic.
66-
valid {{ PrimInt63.int }} ok :- !.
67-
valid (global (indt I)) ok :- eqType I _, !.
68-
valid (app (indt I) A Args) D :- eqType I EQT, !, valid-eqType EQT [A|Args] D.
65+
pred valid i:eqb.trm, o:diagnostic.
66+
valid (eqb.global X) ok :- global X = {{ PrimInt63.int }}, !.
67+
valid (eqb.global (indt I)) ok :- eqType I _, !.
68+
valid (eqb.app (indt I) A Args) D :- eqType I EQT, !, valid-eqType EQT [A|Args] D.
6969
valid T (error S) :- S is "not an eqType: " ^ {std.any->string T}.
7070

71-
pred valid-eqType i:eqType, i:list trm, o:diagnostic.
72-
valid-eqType (inductive _ _) [] ok.
73-
valid-eqType (type-param F) [T|TS] D :- std.do-ok! D [
71+
pred valid-eqType i:eqb.eqType, i:list eqb.trm, o:diagnostic.
72+
valid-eqType (eqb.inductive _ _) [] ok.
73+
valid-eqType (eqb.type-param F) [T|TS] D :- std.do-ok! D [
7474
valid T,
7575
(d\ pi x\ valid-eqType (F x) TS d),
7676
].
77-
valid-eqType (value-param _ F) [_|TS] D :- std.do-ok! D [
77+
valid-eqType (eqb.value-param _ F) [_|TS] D :- std.do-ok! D [
7878
(d\ pi x\ valid-eqType (F x) TS d),
7979
].
8080

81-
pred irrelevant? i:term, o:trm, o:diagnostic.
82-
irrelevant? (app [{{ @eq }}, global (indt EqType), A, B]) (app EQ EQTYPE [A1,B1]) D :- std.do-ok! D [
81+
pred irrelevant? i:term, o:eqb.trm, o:diagnostic.
82+
irrelevant? (app [{{ @eq }}, global (indt EqType), A, B]) (eqb.app EQ EQTYPE [A1,B1]) D :- std.do-ok! D [
8383
std.lift-ok (eqType EqType _) "Not an eqType", %eqb-for Bool Bool _,
8484
std.lift-ok ({{ @eq }} = global EQ) "",
8585
term->trm (global (indt EqType)) EQTYPE,
@@ -88,17 +88,17 @@ irrelevant? (app [{{ @eq }}, global (indt EqType), A, B]) (app EQ EQTYPE [A1,B1]
8888
].
8989
irrelevant? T R D :- whd1 T T1, coq.say "whd" T T1, irrelevant? T1 R D.
9090

91-
pred term->trm i:term, o:trm, o:diagnostic.
92-
term->trm (global GR) (global GR) ok :- !.
93-
term->trm (app [global GRF,A|As]) (app GRF A1 As1) D :- !, std.do-ok! D [
91+
pred term->trm i:term, o:eqb.trm, o:diagnostic.
92+
term->trm (global GR) (eqb.global GR) ok :- !.
93+
term->trm (app [global GRF,A|As]) (eqb.app GRF A1 As1) D :- !, std.do-ok! D [
9494
term->trm A A1,
9595
map-ok! As term->trm As1,
9696
].
97-
term->trm {{ lp:A -> lp:B }} (app {{:gref lib:elpi.derive.arrow }} A1 [B1]) D :- std.do-ok! D [
97+
term->trm {{ lp:A -> lp:B }} (eqb.app {{:gref lib:elpi.derive.arrow }} A1 [B1]) D :- std.do-ok! D [
9898
term->trm A A1,
9999
term->trm B B1,
100100
].
101-
term->trm (app [N|As]) (app {{:gref lib:elpi.derive.apply }} N1 As1) D :- name N, !, std.do-ok! D [
101+
term->trm (app [N|As]) (eqb.app {{:gref lib:elpi.derive.apply }} N1 As1) D :- name N, !, std.do-ok! D [
102102
term->trm N N1,
103103
map-ok! As term->trm As1,
104104
].
@@ -108,28 +108,28 @@ pred map-ok! i:list A, i:(A -> B -> diagnostic -> prop), o:list B, o:diagnostic.
108108
map-ok! [] _ [] ok.
109109
map-ok! [X|XS] F [Y|YS] D :- F X Y D1, if (D1 = ok) (map-ok! XS F YS D) (D = D1).
110110

111-
pred validate-eqType i:eqType, o:diagnostic.
112-
validate-eqType (type-param F) D :- pi x\ valid x ok => validate-eqType (F x) D.
113-
validate-eqType (value-param _ F) D :-
111+
pred validate-eqType i:eqb.eqType, o:diagnostic.
112+
validate-eqType (eqb.type-param F) D :- pi x\ valid x ok => validate-eqType (F x) D.
113+
validate-eqType (eqb.value-param _ F) D :-
114114
pi x\ validate-eqType (F x) D.
115-
validate-eqType (inductive _ F) D :-
115+
validate-eqType (eqb.inductive _ F) D :-
116116
pi x\ valid x ok => validate-constructors (F x) D.
117117

118-
pred validate-constructors i:list constructor, o:diagnostic.
118+
pred validate-constructors i:list eqb.constructor, o:diagnostic.
119119
validate-constructors [] ok.
120-
validate-constructors [constructor _ Args|Ks] D :- std.do-ok! D [
120+
validate-constructors [eqb.constructor _ Args|Ks] D :- std.do-ok! D [
121121
validate-arguments Args,
122122
validate-constructors Ks
123123
].
124124

125-
pred validate-arguments i:arguments, o:diagnostic.
126-
validate-arguments (stop _) ok.
127-
validate-arguments (regular T Args) D :- std.do-ok! D [
125+
pred validate-arguments i:eqb.arguments, o:diagnostic.
126+
validate-arguments (eqb.stop _) ok.
127+
validate-arguments (eqb.regular T Args) D :- std.do-ok! D [
128128
valid T,
129129
validate-arguments Args,
130130
].
131-
validate-arguments (irrelevant _ Args) D :- validate-arguments Args D.
132-
validate-arguments (dependent T Args) D :- std.do-ok! D [
131+
validate-arguments (eqb.irrelevant _ Args) D :- validate-arguments Args D.
132+
validate-arguments (eqb.dependent T Args) D :- std.do-ok! D [
133133
valid T,
134134
(d\ pi x\ validate-arguments (Args x) d),
135135
].
@@ -145,9 +145,9 @@ main I [C] :-
145145

146146
namespace feqb {
147147

148-
pred trm->term i:trm, o:term.
149-
trm->term (global GR) (global GR) :- !.
150-
trm->term (app GR A AS) (app[global GR,A1|AS1]) :- !,
148+
pred trm->term i:eqb.trm, o:term.
149+
trm->term (eqb.global GR) (global GR) :- !.
150+
trm->term (eqb.app GR A AS) (app[global GR,A1|AS1]) :- !,
151151
trm->term A A1,
152152
std.map AS trm->term AS1.
153153
trm->term T _ :- coq.error "cannot translate trm" T "to term, did you forget to assume feqb.trm->term ?".

apps/derive/elpi/eqb.elpi

+28-28
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* license: GNU Lesser General Public License Version 2.1 or later */
33
/* ------------------------------------------------------------------------- */
44

5-
type feqb.trm->term trm -> term -> prop.
5+
type feqb.trm->term eqb.trm -> term -> prop.
66

77
macro @pi-trm N T F :-
88
pi x xx\ decl x N T => (feqb.trm->term xx x :- !) => F xx x.
@@ -46,29 +46,29 @@ derive.eqb.main (const C) Prefix CL :- std.do! [
4646
namespace derive.eqb.eqb {
4747

4848
% -----------------------------------------------------------------------------
49-
pred main i:eqType, i:eqType, i:list term, i:list term, i:term, o:term.
49+
pred main i:eqb.eqType, i:eqb.eqType, i:list term, i:list term, i:term, o:term.
5050

51-
main (type-param FI) (type-param FJ) PI PJ EF {{ fun (x : Type) (eqx : x -> x -> bool) => lp:(R x eqx) }} :-
51+
main (eqb.type-param FI) (eqb.type-param FJ) PI PJ EF {{ fun (x : Type) (eqx : x -> x -> bool) => lp:(R x eqx) }} :-
5252
@pi-trm `x` {{ Type }} y\x\
5353
@pi-decl `eqx` {{ lp:x -> lp:x -> bool }} eqx\
5454
main (FI y) (FJ y) [x|PI] [x|PJ] {coq.mk-app EF [x,eqx]} (R x eqx).
5555

56-
main (value-param TYI FI) (value-param TYJ FJ) PI PJ EF {{ fun (x : lp:TI) (y : lp:TJ) => lp:(R x y) }} :-
56+
main (eqb.value-param TYI FI) (eqb.value-param TYJ FJ) PI PJ EF {{ fun (x : lp:TI) (y : lp:TJ) => lp:(R x y) }} :-
5757
feqb.trm->term TYI TI,
5858
feqb.trm->term TYJ TJ,
5959
@pi-trm `x` TI xx\x\
6060
@pi-trm `y` TJ yy\y\
6161
main (FI xx) (FJ yy) [x|PI] [y|PJ] {coq.mk-app EF [x,y]} (R x y).
6262

63-
main (inductive Ind _) (inductive Ind _) PI PJ EF {{ fix rec (x1 : lp:I) (x2 : lp:J) {struct x1} : bool := lp:(R rec x1 x2) }} :- coq.env.recursive? Ind, !,
63+
main (eqb.inductive Ind _) (eqb.inductive Ind _) PI PJ EF {{ fix rec (x1 : lp:I) (x2 : lp:J) {struct x1} : bool := lp:(R rec x1 x2) }} :- coq.env.recursive? Ind, !,
6464
coq.mk-app (global (indt Ind)) {std.rev PI} I,
6565
coq.mk-app (global (indt Ind)) {std.rev PJ} J,
6666
@pi-decl `rec` {{ lp:I -> lp:J -> bool }} rec\
6767
@pi-decl `x1` I x1\
6868
@pi-decl `x2` J x2\
6969
do-match x1 I x2 J {coq.mk-app EF [rec]} (R rec x1 x2).
7070

71-
main (inductive Ind _) (inductive Ind _) PI PJ EF {{ fun (x1 : lp:I) (x2 : lp:J) => lp:(R x1 x2) }} :-
71+
main (eqb.inductive Ind _) (eqb.inductive Ind _) PI PJ EF {{ fun (x1 : lp:I) (x2 : lp:J) => lp:(R x1 x2) }} :-
7272
coq.mk-app (global (indt Ind)) {std.rev PI} I,
7373
coq.mk-app (global (indt Ind)) {std.rev PJ} J,
7474
@pi-decl `x1` I x1\
@@ -102,17 +102,17 @@ do-branch X2 J F K KTY Vars _ {{ @eqb_core_defs.eqb_body _ _ _ _ lp:FLDP lp:F lp
102102
% -----------------------------------------------------------------------------
103103
% example: eqb-for {{ list lp:A }} {{ @list_eqb lp:A lp:F }} :- eqb-for A F.
104104

105-
pred do-clause i:eqType, i:eqType, i:list term, i:list term, i:term, i:list prop, o:prop.
105+
pred do-clause i:eqb.eqType, i:eqb.eqType, i:list term, i:list term, i:term, i:list prop, o:prop.
106106

107-
do-clause (type-param AI) (type-param AJ) PI PJ F Todo (pi a ea\ C a ea) :- !,
107+
do-clause (eqb.type-param AI) (eqb.type-param AJ) PI PJ F Todo (pi a ea\ C a ea) :- !,
108108
pi x a ea\
109109
do-clause (AI x) (AJ x) [a|PI] [a|PJ] {coq.mk-app F [a,ea]} [eqb-for a a ea|Todo] (C a ea).
110110

111-
do-clause (value-param _ AI) (value-param _ AJ) PI PJ F Todo (pi a b\ C a b) :- !,
111+
do-clause (eqb.value-param _ AI) (eqb.value-param _ AJ) PI PJ F Todo (pi a b\ C a b) :- !,
112112
pi x a b\
113113
do-clause (AI x) (AJ x) [a|PI] [b|PJ] {coq.mk-app F [a,b]} Todo (C a b).
114114

115-
do-clause (inductive Ind _) (inductive Ind _) PI PJ F Todo (eqb-for I J F :- Todo) :-
115+
do-clause (eqb.inductive Ind _) (eqb.inductive Ind _) PI PJ F Todo (eqb-for I J F :- Todo) :-
116116
coq.mk-app (global (indt Ind)) {std.rev PI} I,
117117
coq.mk-app (global (indt Ind)) {std.rev PJ} J.
118118

@@ -122,22 +122,22 @@ do-clause (inductive Ind _) (inductive Ind _) PI PJ F Todo (eqb-for I J F :- Tod
122122
namespace derive.eqb.eqbf {
123123

124124
% -----------------------------------------------------------------------------
125-
pred main i:eqType, i:eqType, i:list term, i:list term, o:term.
125+
pred main i:eqb.eqType, i:eqb.eqType, i:list term, i:list term, o:term.
126126

127-
main (type-param FI) (type-param FJ) PI PJ {{ fun (p : Type) (eqp : p -> p -> bool) => lp:(R p eqp) }} :-
127+
main (eqb.type-param FI) (eqb.type-param FJ) PI PJ {{ fun (p : Type) (eqp : p -> p -> bool) => lp:(R p eqp) }} :-
128128
@pi-trm `P` {{ Type }} x\p\
129129
@pi-decl `eqP` {{ lp:p -> lp:p -> bool }} eqP\
130130
eqb-for p p eqP =>
131131
main (FI x) (FJ x) [p|PI] [p|PJ] (R p eqP).
132132

133-
main (value-param TYI FI) (value-param TYJ FJ) PI PJ {{ fun (x y : lp:T) => lp:(R x y) }} :-
133+
main (eqb.value-param TYI FI) (eqb.value-param TYJ FJ) PI PJ {{ fun (x y : lp:T) => lp:(R x y) }} :-
134134
feqb.trm->term TYI TI,
135135
feqb.trm->term TYJ TJ,
136136
@pi-trm `P` TI xx\x\
137137
@pi-trm `P` TJ yy\y\
138138
main (FI xx) (FJ yy) [x|PI] [y|PJ] (R x y).
139139

140-
main (inductive Ind F) (inductive Ind G) PI PJ {{ fun (rec : lp:I -> lp:J -> bool) (x : positive) => lp:(R rec x) }} :- std.do! [
140+
main (eqb.inductive Ind F) (eqb.inductive Ind G) PI PJ {{ fun (rec : lp:I -> lp:J -> bool) (x : positive) => lp:(R rec x) }} :- std.do! [
141141
std.rev PI ParamsI,
142142
std.rev PJ ParamsJ,
143143
coq.mk-app (global (indt Ind)) ParamsI I,
@@ -160,15 +160,15 @@ pred rty i:term, i:term, i:term, o:term.
160160
rty Fields_t_I Fields_t_J X {{ lp:Fields_t_I lp:X -> lp:Fields_t_J lp:X -> bool }}.
161161

162162
% -----------------------------------------------------------------------------
163-
pred fields i:list term, i:list term, i:pair constructor constructor, o:term.
163+
pred fields i:list term, i:list term, i:pair eqb.constructor eqb.constructor, o:term.
164164

165-
fields ParamsI ParamsJ (pr (constructor K (stop _)) (constructor K (stop _))) {{ fun (a : lp:BoxTy1) (b : lp:BoxTy2) => true }} :- std.do! [
165+
fields ParamsI ParamsJ (pr (eqb.constructor K (eqb.stop _)) (eqb.constructor K (eqb.stop _))) {{ fun (a : lp:BoxTy1) (b : lp:BoxTy2) => true }} :- std.do! [
166166
std.assert! (box-for K IB _) "derive.eqb: run derive.fields before",
167167
coq.mk-app (global (indt IB)) ParamsI BoxTy1,
168168
coq.mk-app (global (indt IB)) ParamsJ BoxTy2,
169169
].
170170

171-
fields ParamsI ParamsJ (pr (constructor K Args) (constructor K Args2)) {{ fun (a : lp:BoxTy1) (b : lp:BoxTy2) => lp:(R a b) }} :- std.do! [
171+
fields ParamsI ParamsJ (pr (eqb.constructor K Args) (eqb.constructor K Args2)) {{ fun (a : lp:BoxTy1) (b : lp:BoxTy2) => lp:(R a b) }} :- std.do! [
172172
std.assert! (box-for K IB _) "derive.eqb: run derive.fields before",
173173
coq.mk-app (global (indt IB)) ParamsI BoxTy1,
174174
coq.mk-app (global (indt IB)) ParamsJ BoxTy2,
@@ -180,14 +180,14 @@ fields ParamsI ParamsJ (pr (constructor K Args) (constructor K Args2)) {{ fun (a
180180
pred fields.rty1 i:term, i:list term, i:list term, o:term.
181181
fields.rty1 _ _ _ {{ bool }}.
182182

183-
pred fields.branch1 i:term, i:term, i:arguments, i:arguments, i:term, i:term, i:list term, i:list term, o:term.
183+
pred fields.branch1 i:term, i:term, i:eqb.arguments, i:eqb.arguments, i:term, i:term, i:list term, i:list term, o:term.
184184
fields.branch1 B BoxTy2 Args Args2 _ _ VarsA _ R :-
185185
coq.build-match B BoxTy2 fields.rty2 (fields.branch2 Args Args2 VarsA) R.
186186

187187
pred fields.rty2 i:term, i:list term, i:list term, o:term.
188188
fields.rty2 _ _ _ {{ bool }}.
189189

190-
pred fields.branch2 i:arguments, i:arguments, i:list term, i:term, i:term, i:list term, i:list term, o:term.
190+
pred fields.branch2 i:eqb.arguments, i:eqb.arguments, i:list term, i:term, i:term, i:list term, i:list term, o:term.
191191
fields.branch2 Args Args2 VarsA _ _ VarsB _ R :-
192192
fields.aux Args Args2 VarsA VarsB R.
193193

@@ -198,9 +198,9 @@ mk-eqb-for T1 _ _ :-
198198
Msg is "derive.eqb: missing boolean equality for " ^ {coq.term->string T1} ^ ", maybe use derive.eqb first",
199199
stop Msg.
200200

201-
pred fields.aux i:arguments, i:arguments, i:list term, i:list term, o:term.
201+
pred fields.aux i:eqb.arguments, i:eqb.arguments, i:list term, i:list term, o:term.
202202

203-
fields.aux (dependent TYX FX) (dependent TYY FY) [X|XS] [Y|YS] {{ lib:elpi.andb (lp:EQB lp:X lp:Y) lp:R1 }} :-
203+
fields.aux (eqb.dependent TYX FX) (eqb.dependent TYY FY) [X|XS] [Y|YS] {{ lib:elpi.andb (lp:EQB lp:X lp:Y) lp:R1 }} :-
204204
feqb.trm->term TYX TX,
205205
feqb.trm->term TYY TY,
206206
mk-eqb-for TX TY EQB,
@@ -209,31 +209,31 @@ fields.aux (dependent TYX FX) (dependent TYY FY) [X|XS] [Y|YS] {{ lib:elpi.andb
209209
fields.aux (FX a) (FY b) XS YS (R n m)),
210210
R1 = R X Y.
211211

212-
fields.aux (regular TYX FX) (regular TYY FY) [X|XS] [Y|YS] {{ lib:elpi.andb (lp:EQB lp:X lp:Y) lp:R }} :-
212+
fields.aux (eqb.regular TYX FX) (eqb.regular TYY FY) [X|XS] [Y|YS] {{ lib:elpi.andb (lp:EQB lp:X lp:Y) lp:R }} :-
213213
feqb.trm->term TYX TX,
214214
feqb.trm->term TYY TY,
215215
mk-eqb-for TX TY EQB,
216216
fields.aux FX FY XS YS R.
217217

218-
fields.aux (irrelevant _ FX) (irrelevant _ FY) [_|XS] [_|YS] R :- fields.aux FX FY XS YS R.
218+
fields.aux (eqb.irrelevant _ FX) (eqb.irrelevant _ FY) [_|XS] [_|YS] R :- fields.aux FX FY XS YS R.
219219

220-
fields.aux (stop _) (stop _) [] [] {{ true }}.
220+
fields.aux (eqb.stop _) (eqb.stop _) [] [] {{ true }}.
221221

222222
% -----------------------------------------------------------------------------
223223
% example:
224224
% eqb-fields {{ list lp:A }} {{ @list_eqb_fields lp:A lp:EA lp:ELA }} :-
225225
% eqb-for A EA, eqb-for {{ list lp:A }} ELA.
226-
pred do-clause i:eqType, i:eqType, i:list term, i:list term, i:term, i:list prop, o:prop.
226+
pred do-clause i:eqb.eqType, i:eqb.eqType, i:list term, i:list term, i:term, i:list prop, o:prop.
227227

228-
do-clause (type-param AI) (type-param AJ) PI PJ F Todo (pi a ea\ C a ea) :- !,
228+
do-clause (eqb.type-param AI) (eqb.type-param AJ) PI PJ F Todo (pi a ea\ C a ea) :- !,
229229
pi x a ea\
230230
do-clause (AI x) (AJ x) [a|PI] [a|PJ] {coq.mk-app F [a,ea]} [eqb-for a a ea|Todo] (C a ea).
231231

232-
do-clause (value-param _ AI) (value-param _ AJ) PI PJ F Todo (pi a b\ C a b) :- !,
232+
do-clause (eqb.value-param _ AI) (eqb.value-param _ AJ) PI PJ F Todo (pi a b\ C a b) :- !,
233233
pi x a b\
234234
do-clause (AI x) (AJ x) [a|PI] [b|PJ] {coq.mk-app F [a,b]} Todo (C a b).
235235

236-
do-clause (inductive Ind _) (inductive Ind _) PI PJ F Todo (pi ela\ eqb-fields I J (F1 ela) :- [C ela|Todo]) :- !,
236+
do-clause (eqb.inductive Ind _) (eqb.inductive Ind _) PI PJ F Todo (pi ela\ eqb-fields I J (F1 ela) :- [C ela|Todo]) :- !,
237237
coq.mk-app (global (indt Ind)) {std.rev PI} I,
238238
coq.mk-app (global (indt Ind)) {std.rev PJ} J,
239239
pi ela\

0 commit comments

Comments
 (0)