11namespace tc {
22 shorten tc.{r-ar, range-arity}.
33
4+ % TODO: also replace (sort (typ X)) and (pglobal _ X) with holes in the place of X
5+ pred clean-term i:term, o:term.
6+ clean-term A B :-
7+ (pi t s r \ copy (tc.maybe-eta-tm t s) r :- !, copy t r, !) =>
8+ (pi t s r \ copy (tc.canonical-projection t s _) r :- !, copy t r, !) =>
9+ (pi t s r \ copy (tc.prod-range t s) r :- !, copy t r, !) =>
10+ (pi t s r \ copy (tc.maybe-llam-tm t s) r :- !, copy t r, !) =>
11+ (pi t s r \ copy (tc.coercion t s) r :- !, copy t r, !) =>
12+ std.assert! (copy A B) "[TC] clean-term error".
13+
414 namespace precomp {
515
616 namespace instance {
@@ -245,13 +255,13 @@ namespace tc {
245255
246256 decompile-term-aux (fun Name Ty Bo) (pr XS L) (fun Name Ty' Bo') (pr XS2 L3) :- !,
247257 (pi x\ is-name x => decompile-term-aux (Bo x) (pr XS []) (Bo' x) (pr XS1 (L1x x))),
248- close-prop-no-prune-pi-decl L1x Ty L1,
258+ close-prop-no-prune-pi-decl L1x {clean-term Ty} L1,
249259 decompile-term-aux Ty (pr XS1 L) Ty' (pr XS2 L2),
250260 std.append L1 L2 L3.
251261
252262 decompile-term-aux (prod Name Ty Bo) (pr XS L) (prod Name Ty' Bo') (pr XS2 L3) :- !,
253263 (pi x\ is-name x => decompile-term-aux (Bo x) (pr XS []) (Bo' x) (pr XS1 (L1x x))),
254- close-prop-no-prune-pi-decl L1x Ty L1,
264+ close-prop-no-prune-pi-decl L1x {clean-term Ty} L1,
255265 decompile-term-aux Ty (pr XS1 L) Ty' (pr XS2 L2),
256266 std.append L1 L2 L3.
257267
@@ -278,16 +288,6 @@ namespace tc {
278288
279289 }
280290
281- % TODO: also replace (sort (typ X)) and (pglobal _ X) with holes in the place of X
282- pred clean-term i:term, o:term.
283- clean-term A B :-
284- (pi t s r \ copy (tc.maybe-eta-tm t s) r :- !, copy t r, !) =>
285- (pi t s r \ copy (tc.canonical-projection t s _) r :- !, copy t r, !) =>
286- (pi t s r \ copy (tc.prod-range t s) r :- !, copy t r, !) =>
287- (pi t s r \ copy (tc.maybe-llam-tm t s) r :- !, copy t r, !) =>
288- (pi t s r \ copy (tc.coercion t s) r :- !, copy t r, !) =>
289- std.assert! (copy A B) "[TC] clean-term error".
290-
291291 pred main
292292 i:nat, % the number of problematic terms
293293 i:term, % the type of the instance
0 commit comments