coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Ilia Zaichuk <zoickx AT ztld.org>
- To: <coq-club AT inria.fr>
- Subject: [Coq-Club] Straight reasoning with existential variables
- Date: Fri, 2 Aug 2019 19:40:22 +0200 (CEST)
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=zoickx AT ztld.org; spf=Pass smtp.mailfrom=zoickx AT ztld.org; spf=Pass smtp.helo=postmaster AT w4.tutanota.de
- Ironport-phdr: 9a23:CTY6RB3D9FeBFuD8smDT+DRfVm0co7zxezQtwd8ZsewSL/ad9pjvdHbS+e9qxAeQG9mCsbQV2qGG7+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6JvjvGo7Vks+7y/2+94fcbglVmjaxe7d/IRG5oQjSucQdnJdvJLs2xhbVuHVDZv5YxXlvJVKdnhb84tm/8Zt++ClOuPwv6tBNX7zic6s3UbJXAjImM3so5MLwrhnMURGP5noHXWoIlBdDHhXI4wv7Xpf1tSv6q/Z91SyHNsD4Ubw4RTKv5LptRRT1iikIKiQ5/XnZhMJwkqxVow+vqBNjzIPPeo6ZKOBzcbjBcd8GR2dMWNtaWSxbAoO7aosCF+kPPeJZr4bnulABrgGxBQiwC+Pv1z9IhWL90Ko70uQmEAHJwA8gHt0VvXXVsNX1MLodXfqyzKnSwjXOdvVb0ir+5ojQah0souyAUah+fMbLyEQjDR7Jg1SQpIHjIjibzP4Cs3KB4OplTe+vi3AoqwV2ojW3yMYhhZPFhp4IylDY7yp5xoE1JcGiR0JhfNGrDoNctyCcN4RoXsMvW2JltDsgxrAIo5K2fTIGxIkmyhPfc/CHdpKH4hPnVOafOzd4g3dldaq+hha18Eiv1u78V8av3VdLsipFlsTDumoK1xzJ5ciLUuF98Vu52TaTywDT7flJLlwzlarCMpIu3rowlocIvknYBS/3mED2jLeMeUk+++io7f7nYrT8qZOGOY90kFK2DqN7zse4GKEzNhUEd2md4+W1krP5qx7XWrJP29wyk6CRgpnbLsQGpebtEQhU2YUzwwSjCzvg184XyypUZGlZcQ6K2tC6c2rFJ+r1WK/m3gac1QxzzvWDBYXPR5XAKn+azuX+IfBh9lJVzg0vxJZT6sANU+1TELfIQkb08efgIFohKQXtm7T1FNFxkIQEVjDXW/7LAObpqVaNo9kXDayJbY4Rtiz6LqF9tezyiXN/nkUSL/Ck
Hello everyone,
Consider the following example:
Inductive sum : nat -> nat -> nat -> Prop :=
| SumO : forall a, sum 0 a a
| SumS : forall a b c, sum a (S b) c -> sum (S a) b c.
Theorem sum_exists :
forall a b, exists c, sum a b c.
Proof.
induction a; intro.
- exists b. constructor.
- eexists.
constructor.
specialize (IHa (S b)).
destruct IHa as [c IHa].
Fail apply IHa.
Abort.
The problem here (as suggested by [apply]) is that the shelved [?c] does not
have [c] in its scope. Fair enough. This problem has been coming up in a few of
my proofs lately, and I have learned to deal with it by moving the [destruct] -
the instantiation of [c] - above the [eexists].
However, this comes with a problem - it breaks the "flow of thought" in a proof.
You either have to know in advance what variables you need instantiated, or go
down to the point where you need them and move the instantiation above [eexists].
That would be fine for this small example, but in more complex proofs, it quickly
becomes unwieldy.
Without [eexists], I cannot apply the [SumS] constructor.
It is possible to add a lemma:
Lemma SumS_existential (a b : nat) :
(exists c, sum a (S b) c) -> exists c, sum (S a) b c.
Proof.
intros.
destruct H as [c H].
exists c. constructor.
assumption.
Qed.
, with which the proof goes smoothly. But this, once again, is unsustainable
for more complex problems. I have tried writing a generic lemma for
"existential implication", but was unsuccessful.
Can such a lemma exist? (Or is it a tactic I am looking for?)
I have also tried manipulating the contexts of the main goal and the existential
variables separately (via [Unshelve]), and failed at proving the lemma this way at all.
Is it at all possible to cleanly do that in this case?
Overall, how can I prove this lemma without getting the reasoning tangled?
Thanks and regards,
Ilia.
- [Coq-Club] Straight reasoning with existential variables, Ilia Zaichuk, 08/02/2019
- Re: [Coq-Club] Straight reasoning with existential variables, Joshua Gancher, 08/02/2019
- Re: [Coq-Club] Straight reasoning with existential variables, Xavier Leroy, 08/02/2019
- Re: [Coq-Club] Straight reasoning with existential variables, Joshua Gancher, 08/02/2019
Archive powered by MHonArc 2.6.18.