| 1 |
Declare ML Module "rocq-elpi.coercion". |
| 2 |
From elpi Require Import elpi. |
| 3 |
|
| 4 |
Elpi Db coercion.db lp:{{ |
| 5 |
|
| 6 |
% predicate [coercion Ctx V Inferred Expected Res] used to add new coercion, with |
| 7 |
% - [Ctx] is the context |
| 8 |
% - [V] is the value to be coerced |
| 9 |
% - [Inferred] is the type of [V] |
| 10 |
% - [Expected] is the type [V] should be coerced to |
| 11 |
% - [Res] is the result (of type [Expected]) |
| 12 |
% Be careful not to trigger coercion as this may loop. |
| 13 |
:index(_ _ 10 10) |
| 14 |
pred coercion i:goal-ctx, i:term, i:term, i:term, o:term. |
| 15 |
|
| 16 |
}}. |
| 17 |
|
| 18 |
Elpi Tactic coercion. |
| 19 |
Elpi Accumulate Db Header coercion.db. |
| 20 |
Elpi Accumulate lp:{{ |
| 21 |
|
| 22 |
solve (goal Ctx _ Ty Sol [trm V, trm VTy]) _ :- coercion Ctx V VTy Ty Sol. |
| 23 |
|
| 24 |
}}. |
| 25 |
Elpi Accumulate Db coercion.db. |
| 26 |
|
| 27 |
Elpi CoercionFallbackTactic coercion. |