Skip to content

Commit 8cdd965

Browse files
authored
Merge pull request #362 from math-comp/speedup-insertion
Speedup `compress` clause insertion
2 parents 9dd967e + 489c11d commit 8cdd965

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

HB/common/synthesis.elpi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,16 @@ mixin-for T M MICompressed :- mixin-src T M Tm, !, std.do! [
191191
compress-coercion-paths MI MICompressed,
192192
].
193193

194+
pred compress-copy o:term, o:term.
195+
compress-copy X Y :- compress X Y, !.
196+
compress-copy (app L) (app L1) :- !, std.map L compress-copy L1.
197+
compress-copy X X.
198+
199+
194200
pred compress-coercion-paths i:term, o:term.
195201
compress-coercion-paths MI MICompressed :-
196202
if (get-option "compress_coercions" tt)
197-
(compress MI MICompressed)
203+
(compress-copy MI MICompressed)
198204
(MI = MICompressed).
199205

200206
pred mixin-for_mixin-builder i:prop, o:term.

HB/structure.elpi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ declare-coercion SortProjection ClassProjection
398398
std.map AllTgtSuper class_structure AllTgtSuperStructures,
399399

400400
mk-compression-clauses StructureF StructureT AllTgtSuperStructures AllCompressionClauses,
401-
std.forall AllCompressionClauses (c\ log.coq.env.accumulate current "hb.db" (clause _ (before "compress:begin") c)),
401+
std.forall AllCompressionClauses (c\ log.coq.env.accumulate current "hb.db" (clause _ _ c)),
402402
].
403403

404404

structures.v

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,6 @@ pred docstring o:loc, o:string.
232232
% terms, since this is what you get when you apply coercions)
233233
:index (4)
234234
pred compress o:term, o:term.
235-
:name "compress:begin"
236-
compress (app L) (app L1) :- !, std.map L compress L1.
237-
compress X X.
238235

239236
}}.
240237

tests/compress_coe.v.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Datatypes_prod__canonical__compress_coe_D =
1+
Datatypes_prod__canonical__compress_coe_D =
22
fun D D' : D.type =>
33
{|
44
D.sort := D.sort D * D.sort D';

tests/hnf.v.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
Datatypes_nat__canonical__hnf_S =
1+
Datatypes_nat__canonical__hnf_S =
22
{| S.sort := nat; S.class := {| S.hnf_M_mixin := HB_unnamed_mixin_12 |} |}
33
: S.type
4-
HB_unnamed_mixin_12 =
4+
HB_unnamed_mixin_12 =
55
{| M.x := f.y nat HB_unnamed_factory_10 + 1 |}
66
: M.axioms_ nat
7-
Datatypes_bool__canonical__hnf_S =
7+
Datatypes_bool__canonical__hnf_S =
88
{| S.sort := bool; S.class := {| S.hnf_M_mixin := HB_unnamed_mixin_16 |} |}
99
: S.type
10-
HB_unnamed_mixin_16 =
10+
HB_unnamed_mixin_16 =
1111
Builders_6.HB_unnamed_factory_8 bool HB_unnamed_factory_13
1212
: M.axioms_ bool

tests/infer.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ HB.mixin Record barm (A : Type) (P : foo.type) (B: Type) (T : Type) := {
1717
HB.structure Definition bar A P B := { T of barm A P B T }.
1818

1919
#[skip="8.1[0-5].*"] HB.check (bar.type_ bool nat bool).
20-
#[skip="8.16.*", fail] HB.check (bar.type_ bool nat bool).
20+
#[skip="8.1[67].*", fail] HB.check (bar.type_ bool nat bool).
2121
Print bar.phant_type.
2222
Print bar.type.
2323
Check bar.type bool nat bool.

0 commit comments

Comments
 (0)