| 1 |
From elpi Require Import elpi test_vernacular1. |
| 2 |
|
| 3 |
Elpi test.program1 "hello" x. |
| 4 |
Elpi test.program1 "hello" x y. |
| 5 |
|
| 6 |
#[fwd_compat_attr] Elpi Command foo. |
| 7 |
#[fwd_compat_attr] Elpi Accumulate " main _ :- coq.say {attributes}. ". |
| 8 |
#[fwd_compat_attr] Elpi Export foo. |
| 9 |
#[fwd_compat_attr] Elpi Query lp:{{ true }}. |
| 10 |
#[fwd_compat_attr] Elpi foo. |
| 11 |
#[fwd_compat_attr] foo. |
| 12 |
|
| 13 |
(* reentrance *) |
| 14 |
|
| 15 |
Elpi Command the_command. |
| 16 |
Elpi Accumulate lp:{{ |
| 17 |
pred mk-lem i:string. |
| 18 |
mk-lem Name :- std.do! [ |
| 19 |
Lem = {{ (1 + 1 = 2)%nat }}, |
| 20 |
std.assert-ok! (coq.elaborate-skeleton Lem _ ELem) "failed", |
| 21 |
std.assert-ok! (coq.typecheck {{ lp:Bo : lp:ELem }} _) "failed", |
| 22 |
coq.ltac.collect-goals Bo [SealedGoal] [], |
| 23 |
coq.ltac.open (g\gl\coq.ltac.call "ltac1_that_calls_elpi" [] g gl ok) SealedGoal [], |
| 24 |
% !tactic_mode should equal false here |
| 25 |
coq.env.add-const Name Bo ELem @transparent! C_, |
| 26 |
]. |
| 27 |
|
| 28 |
main [str Name] :- std.do! [ |
| 29 |
mk-lem Name |
| 30 |
]. |
| 31 |
}}. |
| 32 |
|
| 33 |
Elpi Export the_command. |
| 34 |
|
| 35 |
Elpi Tactic elpi_tac. |
| 36 |
Elpi Accumulate lp:{{ |
| 37 |
solve (goal _Ctx _ {{ (1 + 1 = lp:EX)%nat }} _ _) _ :- std.do! [ |
| 38 |
X = {{ 2%nat }}, |
| 39 |
std.assert-ok! (coq.elaborate-skeleton X _ EX) "failed", |
| 40 |
]. |
| 41 |
solve _ _ :- coq.ltac.fail _ "failed". |
| 42 |
}}. |
| 43 |
|
| 44 |
|
| 45 |
Ltac ltac1_that_calls_elpi := |
| 46 |
elpi elpi_tac; |
| 47 |
reflexivity. |
| 48 |
|
| 49 |
the_command xx. |