Skip to content

Commit ee42b2d

Browse files
committed
[TC] primitive constructor for fold in instance (pre-)compilation
1 parent f421547 commit ee42b2d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

apps/tc/elpi/ho_compile.elpi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace tc {
2121
decompile-term-aux (pglobal _ _ as T) L T' L :- !, copy T T', !.
2222
decompile-term-aux (sort _ as T) L T' L :- !, copy T T', !.
2323
decompile-term-aux (uvar as X) L X L :- !.
24+
decompile-term-aux (primitive _ as X) L X L :- !.
2425

2526
decompile-term-aux (tc.maybe-eta-tm T S) (pr [X|XS] L1) Y (pr XS' [NL | L2]) :- !,
2627
name Y X S,
@@ -325,6 +326,8 @@ namespace tc {
325326
get-uva-pair-arity Y L Z.
326327

327328
pred decompile-problematic-term i:term, i:list prop, o:term, o:list prop.
329+
decompile-problematic-term (primitive _ as C) A C A :- !.
330+
328331
decompile-problematic-term (tc.maybe-eta-tm T S) L V [tc.link.eta V T' | L2] :-
329332
prune V S, !, fold-map T L T' L2.
330333

apps/tc/elpi/ho_precompile.elpi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ namespace tc {
104104
precompile-aux _ (global _ as C) A C A :- !.
105105
precompile-aux _ (pglobal _ _ as C) A C A :- !.
106106
precompile-aux _ (sort _ as C) A C A :- !.
107+
precompile-aux _ (primitive _ as C) A C A :- !.
107108

108109
% Detect maybe-eta term
109110
% TODO: should I precompile also the type of the fun and put it in the output term
@@ -141,7 +142,6 @@ namespace tc {
141142
% precompile-aux IsP Ty A Ty1 A1, pi x\ is-name x => precompile-aux IsP (F x) A1 (F1 x) A2.
142143
% precompile-aux IsP (match T Rty B) A (match T1 Rty1 B1) A3 :- !,
143144
% precompile-aux IsP T A T1 A1, precompile-aux IsP Rty A1 Rty1 A2, std.fold-map B A2 (precompile-aux IsP) B1 A3.
144-
% precompile-aux _ (primitive _ as C) A C A :- !.
145145
% precompile-aux IsP (uvar M L as X) A W A1 :- var X, !, std.fold-map L A (precompile-aux IsP) L1 A1, coq.mk-app-uvar M L1 W.
146146
% % when used in CHR rules
147147
% precompile-aux IsP (uvar X L) A (uvar X L1) A1 :- std.fold-map L A (precompile-aux IsP) L1 A1.
@@ -225,6 +225,7 @@ namespace tc {
225225
precompile-aux (global _ as C) A C A :- !.
226226
precompile-aux (pglobal _ _ as C) A C A :- !.
227227
precompile-aux (sort _ as C) A C A :- !.
228+
precompile-aux (primitive _ as C) A C A :- !.
228229

229230
% Detect maybe-eta term
230231
precompile-aux (fun Name Ty B as T) N (tc.maybe-eta-tm (fun Name Ty' B') Scope) M :-

0 commit comments

Comments
 (0)