Skip to content

Commit 8a1ab38

Browse files
FissoreDgares
authored andcommitted
[TC] add test_hyp_in_concl (+ comment)
1 parent a8d5c12 commit 8a1ab38

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

apps/tc/tests/hyp_in_conl.v

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,34 @@ Module M3.
4949

5050
Set Warnings "+elpi".
5151

52-
Elpi Accumulate TC.Solver lp:{{
53-
:after "0"
54-
tc-elpi.apps.tc.tests.hyp_in_conl.M3.tc-A _ :- !, coq.error "Should not check for tc-A".
55-
tc-elpi.apps.tc.tests.hyp_in_conl.M3.tc-B _ _ :- !, coq.error "Should not check for tc-B".
56-
}}.
57-
Elpi Typecheck TC.Solver.
58-
5952
Section s.
60-
Context (A : A) (B : B A).
53+
Elpi Accumulate TC.Solver lp:{{
54+
:before "0" tc-elpi.apps.tc.tests.hyp_in_conl.M3.tc-A _ :- coq.say "In tc-A", fail.
55+
:before "0" tc-elpi.apps.tc.tests.hyp_in_conl.M3.tc-B _ _ :- coq.say "In tc-B", fail.
56+
}}.
57+
Elpi Typecheck TC.Solver.
58+
Local Instance AX : A := {}.
59+
Local Instance BX : A -> (B AX) := {}.
60+
61+
Elpi Accumulate TC.Solver lp:{{ print-goal. print-solution. }}.
62+
Definition d : C AX (BX _) := _.
63+
Definition d' : C _ (BX _) := _.
64+
Definition d'' : C AX _ := _.
65+
66+
Check (c _ _) : C AX _.
67+
68+
(*
69+
Here we give the solver a partial solution with a hole in it. This hole
70+
correspond to the premise of the typeclass B (an instance of A). Due to
71+
the var condition on the resolution of rule's premises, the premise of
72+
`C`, that is, `B X` is not solved since we have the partial solution `BX
73+
_`. (see: [here](https://github.com/LPCIC/coq-elpi/blob/889bd3fc16c31f35c850edf5a0df2f70ea9c655a/apps/tc/elpi/tc_aux.elpi#L124))
74+
*)
75+
Elpi Query TC.Solver lp:{{
76+
S = {{c AX (BX _)}},
77+
solve-aux1 [] {{C _ _}} S.
78+
}}.
6179

62-
Definition d : C A B := _.
6380
End s.
6481

6582
End M3.

0 commit comments

Comments
 (0)