Debian Codegraph @

apps/tc/elpi/WIP/deactivate_evar.elpi

raw
1 /*
2 when solving a goal in tc, we want to trigger the declared evar only after
3 the proof search. This means that, while the search is performed, we do not
4 risk to assign too early incorrect types (for example with wrong universes).
5 The evar typechecking is triggered after the search, just before refining the
6 proof with the original goal.
7 We use the guard declare-evars-now that to trigger the constraints to reproduce
8 this behavior.
9 */
10 % pred declare-evar-later i:list prop, i:term, i:term, i:term.
11 % pred declare-evars-now.
12
13 % constraint declare-evar-later declare-evars-now {
14 % rule declare-evars-now \ (declare-evar-later Ctx RawEv Ty Ev) <=> (declare-evars-now, Ctx => evar RawEv Ty Ev).
15 % rule \ declare-evars-now.
16 % }
17
18 % declare-evars-now :-
19 % declare_constraint declare-evars-now [_].
20
21 % We want to deactivate the evar declaration if coming from the
22 % original goal (the original type class problem to be solved)
23 % :before "default-declare-evar"
24 % :name "tc-solver-declare-evar"
25 % declare-evar Ctx X Ty E :- !,
26 % declare_constraint (declare-evar-later Ctx X Ty E) [_].
27