| 1 |
Declare ML Module "rocq-elpi.cs". |
| 2 |
From elpi Require Import elpi. |
| 3 |
|
| 4 |
Elpi Db cs.db lp:{{ |
| 5 |
|
| 6 |
% predicate [cs Ctx Proj Rhs Sol] used to find Sol such that Proj Sol = Rhs, where |
| 7 |
% - [Ctx] is the context |
| 8 |
% - [Proj] is the projector of some structure, applied to the structure's parameters if any |
| 9 |
% - [Rhs] the term to find a structure on. |
| 10 |
:index (0 6 6) |
| 11 |
pred cs i:goal-ctx, i:term, i:term, o:term. |
| 12 |
|
| 13 |
}}. |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
Elpi Tactic canonical_solution. |
| 18 |
Elpi Accumulate Db cs.db. |
| 19 |
Elpi Accumulate canonical_solution lp:{{ |
| 20 |
|
| 21 |
solve (goal Ctx _ _Ty Sol [trm Proj, trm Rhs]) _ :- |
| 22 |
cs Ctx Proj Rhs Sol, |
| 23 |
% std.assert! (P = {{ eq_refl lp:Lhs }}) "cs: wrong solution". |
| 24 |
true. |
| 25 |
|
| 26 |
}}. |
| 27 |
Elpi CS canonical_solution. |