Debian Codegraph @

apps/coercion/tests/test_open.v

raw
1 From elpi.apps Require Import coercion.
2 From Corelib Require Import ssreflect.
3
4 Ltac my_solver := try ((repeat apply: le_n_S); apply: le_0_n).
5
6 Elpi Accumulate coercion lp:{{
7
8 coercion _ X Ty {{ @sig lp:Ty lp:P }} Solution :- std.do! [
9 % we unfold letins since the solve is dumb
10 (pi a b b1\ copy a b :- def a _ _ b, !, copy b b1) => copy X X1,
11 % we build the solution
12 Solution = {{ @exist lp:Ty lp:P lp:X1 _ }},
13 % we call the solver
14 coq.ltac.collect-goals Solution [G] [],
15 coq.ltac.open (x\y\coq.ltac.call-ltac1 "my_solver" x y ok) G [],
16 ].
17
18 }}.
19
20 Goal {x : nat | x > 0}.
21 apply: 3.
22 Qed.
23
24 Definition add1 n : {x : nat | x > 0} :=
25 match n with
26 | O => 1
27 | S x as y => y
28 end.
29
30 Check 1.