Skip to content

Commit fafd9d8

Browse files
committed
unfold hd phant_Build in HB.instance Definition
1 parent 94987ab commit fafd9d8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

structures.v

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,13 @@ hack-section-discharging B B1 :- current-mode (builder-from TheFactory _), !,
334334
B1 = {{ let _ : lp:TheFactoryTy := lp:TheFactory in lp:B }}.
335335
hack-section-discharging B B.
336336

337+
pred optimize-body i:term, o:term.
338+
optimize-body (app[global (const C)| Args]) Red :- phant-abbrev _ (const C) _, !,
339+
coq.env.const C (some B) _,
340+
hd-beta B Args HD Stack,
341+
unwind HD Stack Red.
342+
optimize-body X X.
343+
337344
main [const-decl Name (some BodySkel) TyWPSkel] :- !, std.do! [
338345
std.assert-ok! (coq.elaborate-arity-skeleton TyWPSkel _ TyWP) "Definition type illtyped",
339346
coq.arity->term TyWP Ty,
@@ -354,8 +361,9 @@ main [const-decl Name (some BodySkel) TyWPSkel] :- !, std.do! [
354361
factory-alias->gref FactoryAlias Factory,
355362
std.assert! (factory-nparams Factory NParams) "Not a factory synthesized by HB",
356363
hack-section-discharging SectionBody SectionBodyHack,
364+
optimize-body SectionBodyHack OptimizedBody,
357365
if (Name = "_") (RealName is "HB_unnamed_factory_" ^ {std.any->string {new_int} }) (RealName = Name),
358-
hb-add-const RealName SectionBodyHack _ @transparent! C,
366+
hb-add-const RealName OptimizedBody _ @transparent! C,
359367
TheFactory = (global (const C)),
360368
std.appendR {coq.mk-n-holes NParams} [TheType|_] Args,
361369
with-attributes (main-declare-instance TheType TheFactory Clauses),

0 commit comments

Comments
 (0)