| 1 |
From elpi.apps Require Import tc. |
| 2 |
|
| 3 |
Class A (n : nat). |
| 4 |
Instance a : A 0 := {}. |
| 5 |
|
| 6 |
Class B (n : nat). |
| 7 |
|
| 8 |
Class C (n : nat). |
| 9 |
Instance b x: C x := {}. |
| 10 |
|
| 11 |
Lemma foo: forall (x n: nat) `{A x} `{C n}, True -> B n. Admitted. |
| 12 |
Lemma bar: forall (n: nat) `{A n}, True -> B n. Admitted. |
| 13 |
|
| 14 |
Goal exists n, B n. |
| 15 |
Proof. |
| 16 |
eexists. |
| 17 |
(* Note: `{A x} and `{C n} are solved with x = 0, n remains a hole *) |
| 18 |
(* Moreover, True remains as active goal + a shelved goal remain for n *) |
| 19 |
refine (foo _ _ _). |
| 20 |
auto. |
| 21 |
Unshelve. |
| 22 |
constructor. |
| 23 |
Qed. |
| 24 |
|
| 25 |
Goal exists x, B x. |
| 26 |
Proof. |
| 27 |
eexists. |
| 28 |
(* Note: `{A x} is solved with x = 0 *) |
| 29 |
refine (bar _ _). |
| 30 |
auto. |
| 31 |
Qed. |
| 32 |
|
| 33 |
|
| 34 |
Goal exists x, C x. |
| 35 |
Proof. |
| 36 |
eexists. |
| 37 |
apply _. |
| 38 |
Unshelve. |
| 39 |
constructor. |
| 40 |
Qed. |
| 41 |
|
| 42 |
Class Decision (P : Type). |
| 43 |
|
| 44 |
Goal forall (A : Type) (P1: A -> Prop), |
| 45 |
exists (P : A -> A -> A -> Prop), forall z y , (forall x, Decision (P1 x)) |
| 46 |
-> forall x, Decision (P z y x). |
| 47 |
Proof. |
| 48 |
eexists; intros. |
| 49 |
apply _. |
| 50 |
Unshelve. |
| 51 |
auto. |
| 52 |
Qed. |
| 53 |
|
| 54 |
Elpi Tactic A. |
| 55 |
Elpi Accumulate lp:{{ |
| 56 |
msolve L _ :- coq.ltac.fail _ "[TC] fail to solve" L. |
| 57 |
}}. |
| 58 |
Goal exists n, B n. |
| 59 |
eexists. |
| 60 |
Fail apply _. |
| 61 |
Abort. |
| 62 |
|
| 63 |
|