coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Pierre Courtieu <pierre.courtieu AT gmail.com>
- To: Coq Club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Automation with existential goals
- Date: Mon, 14 Nov 2016 11:54:47 +0100
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=pierre.courtieu AT gmail.com; spf=Pass smtp.mailfrom=pierre.courtieu AT gmail.com; spf=None smtp.helo=postmaster AT mail-wm0-f44.google.com
- Ironport-phdr: 9a23:5yGQnxwWx6VqtCDXCy+O+j09IxM/srCxBDY+r6Qd1OIUIJqq85mqBkHD//Il1AaPBtSArascwLOH+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZPebgFGiTanfL9+MBq6oRjVu8ILnYZsN6E9xwfTrHBVYepW32RoJVySnxb4+Mi9+YNo/jpTtfw86cNOSL32cKskQ7NWCjQmKH0169bwtRbfVwuP52ATXXsQnxFVHgXK9hD6XpP2sivnqupw3TSRMMPqQbwoXzmp8rxmQwH0higZKzE58XnXis1ug6JdvBKhvAF0z4rNbI2IKPZyYqbRcNUHTmRDQ8lRTTRMDYGyb4UPAeQPPvtWoZfhqFYVtxSyGROhCfnzxjNUhHL727Ax3eQ7EQHB2QwtB8gAsHXKo9XvLqcdT/2+wbfPzTXedfNWxTb955bVchs8pvyMRbNwftTLyUk1CQzJlEmfqYv4PzOPyuQNsnaU7/d7WOKgjm4osQBxojy1ysgwjYnJg5sYx1bZ/it62IY4Pd+1RUFhbdK5DpddtzuWOohoTs84TGxltyA3waAct5GhZigF0pEnygbfa/OZd4iI5QruVOOLLjd5gHJpYby+hxOu/US5xO3xWca53ExFripCldnMuXQN2ALJ5sebTft9+1+t2TeJ1w/N9uFJOUI5mKXBJ5I83LI9loAfvEfdEiPsl0j7g7eadkA+9eip7+TnbK/mppiZN4JskgH+M7ohmtalAesmKAQBQ2+b+fmm1L3//E32XqhKg+Y5kqncqp/aJMAbqrSlDA9S14Yv8wy/ACu+0NQEgXkHK0pIdw6Aj4jwIl3BPPT4DeqkjFm3izdqx/XGPqX7DZnXL3jDlq3hfbdn5EJGxgoz14MX25UBIbYYaNn3R0W54NffF1oyNxG+6+fhEtR0kI0EDzGhGKicZZvTvEWS66oEJPSWeI4YpX6pM/ko/eTjy3Q+hEUBfKS09ZQSYXG8WP9hJhPKMjLXnt4dHDJS7UIFR+vwhQjHCGYLag==
The problem is that eexists cannot use variables created later than eexists itself. This is not avoidable (at least in the current state of coq). So you have to create variables before applying eexists. Either by using destruct or some previously proven inversion lemmas (which is maybe easier to put in an automatic tactic).
P.
2016-11-14 11:00 GMT+01:00 Klaus Ostermann <klaus.ostermann AT uni-tuebingen.de>:
Hello Pierre,
thanks for the suggestion. Putting the "@ex" into the
ltac rule does seem to be a bit limiting, though. I'd need
different versions of the rule, one with and one without
the @ex. And maybe the goal looks different.
For instance, consider
Inductive foo : Set :=
| bar : forall n, n = 7 -> foo.
Inductive baz : nat -> Prop :=
| bam : forall n, n = 7 -> baz n.
Goal foo -> exists {n:nat}, baz n.
Usually I'd hope to be able to use
Hint Constructors baz.
to automate that proof, but again the goal that triggers
the proof becomes available only after "eexists".Klaus
Am 14/11/16 um 10:46 schrieb Pierre Courtieu:
Hi,
I am not sure when exactly you want to trigger the destruct but you can match goal on ex like below.
Ltac destruct_foo :=match goal with| H:foo |- @ex _ (fun n => @eq nat n 7) => destruct Hend.
Hint Extern 1 => destruct_foo:foo. (* you can add same pattern than above @ex... *)
Goal foo -> exists {n:nat}, n=7.intros.eauto with foo.
2016-11-14 10:22 GMT+01:00 Klaus Ostermann <klaus.ostermann AT uni-tuebingen.de>:
When proving a goal with an existential, it matters when
eexists is used. For instance, with
Inductive foo : Set :=
| bar : forall n, n = 7 -> foo.
the following proof works
Goal foo -> exists {n:nat}, n=7.
intros. destruct H. eexists. exact(e). Defined.
but this one yields a "cannot instantiate ... not in scope" error
Goal foo -> exists {n:nat}, n=7.
intros. eexists. destruct H. exact(e).
It's easy to correct this error in a manual proof, but it is not clear to
me how to deal with such goals in (goal-direct) proof automation.
In principle, I could automate proofs like that using something like
Hint Extern 1 (?n = 7) =>
match goal with
| [ H : foo |- ?n = 7 ] => destruct H
end.
but the hint won't fire until I used "eexists" first - but I need to use
eexists _after_ the "destruct".
Is there a way to solve this conundrum?
Klaus
- [Coq-Club] Automation with existential goals, Klaus Ostermann, 11/14/2016
- Re: [Coq-Club] Automation with existential goals, Pierre Courtieu, 11/14/2016
- Re: [Coq-Club] Automation with existential goals, Klaus Ostermann, 11/14/2016
- Re: [Coq-Club] Automation with existential goals, Pierre Courtieu, 11/14/2016
- Re: [Coq-Club] Automation with existential goals, Jonathan Leivent, 11/14/2016
- Re: [Coq-Club] Automation with existential goals, Jonathan Leivent, 11/16/2016
- Re: [Coq-Club] Automation with existential goals, Jonathan Leivent, 11/14/2016
- Re: [Coq-Club] Automation with existential goals, Pierre Courtieu, 11/14/2016
- Re: [Coq-Club] Automation with existential goals, Klaus Ostermann, 11/14/2016
- Re: [Coq-Club] Automation with existential goals, Pierre Courtieu, 11/14/2016
Archive powered by MHonArc 2.6.18.