Skip to content

Commit 5950c73

Browse files
committed
[TC] mode ground with ground_term check + tc.link for coercions
1 parent 016d6d0 commit 5950c73

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

apps/tc/elpi/ho_link.elpi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ namespace tc {
144144
pred cs i:term, i:term.
145145
cs T1 T2 :- not (var T1), !, coq.unify-eq T1 T2 ok.
146146
cs (uvar _ as V) (app [_, Arg] as T) :- not (ground_term Arg), !, get-vars T Vars, declare_constraint (cs V T) [_, V | Vars].
147+
cs (uvar _ as V) (app [HD, _Arg] as T) :-
148+
tc.coercion-unify HD, !,
149+
get-vars T Vars, declare_constraint (cs V T) [_, V | Vars].
150+
147151
cs (uvar _ as V) (app [HD | _] as T) :-
148152
if (HD = global (const Proj), tc.proj->record Proj Record)
149153
(reduce-cs V T Record Proj)

apps/tc/elpi/modes.elpi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ namespace tc {
9797
action-to-accumulate _ _ [].
9898

9999
pred mode-check i:string, i:term.
100+
mode-check "+" T :- !, ground_term T.
100101
% heuristic: if we are in "+" mode, then all evars in T should only be
101102
% in that argument
103+
% note: this rule is never applied, the previous having a cut.
102104
mode-check "+" T :- !,
103105
std.findall-unary evars L,
104106
get-evars T EV,

apps/tc/tests/test_pending_mode.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Module ground1.
3636

3737
Goal exists (x : Type), C (list x).
3838
eexists.
39-
apply _.
39+
Fail apply _.
4040
Abort.
4141
End ground1.
4242

@@ -47,7 +47,7 @@ Module ground2.
4747

4848
Goal exists (x : Type), C (list x).
4949
eexists.
50-
apply _.
50+
Fail apply _.
5151
Abort.
5252
End ground2.
5353

@@ -64,14 +64,14 @@ Module ground3.
6464
End ground3.
6565

6666
Module ground4.
67-
Elpi TC.Pending_mode - +.
67+
Elpi TC.Pending_mode ! !.
6868
Class C {i : Type} (f : i -> i -> Prop).
6969
Instance i {X : Type}: C (@eq X). Qed.
7070
Hint Mode C ! ! : typeclass_instances.
7171

7272
Goal exists (X : Type), @C (list X) eq.
7373
eexists.
74-
apply _.
74+
apply _.
7575
Abort.
7676
End ground4.
7777

0 commit comments

Comments
 (0)