Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Existential variables or holes in Lemma types

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Existential variables or holes in Lemma types


Chronological Thread 
  • From: ikdc <ikdc AT mit.edu>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Existential variables or holes in Lemma types
  • Date: Wed, 16 May 2018 11:55:00 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=ikdc AT mit.edu; spf=Pass smtp.mailfrom=ikdc AT mit.edu; spf=None smtp.helo=postmaster AT dmz-mailsec-scanner-3.mit.edu
  • Importance: Normal
  • Ironport-phdr: 9a23:buERjhHK+xe9lzVumz+VFJ1GYnF86YWxBRYc798ds5kLTJ78pMmwAkXT6L1XgUPTWs2DsrQY07GQ6/iocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmDSwbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjDQhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VDK/5KlpVRDokj8KOTAk/m/UiMN+jLxVrxG7qRN+zIHbfI6bOeF+fqzGZ94WWXZNUtpTWiFHH4iyb5EPD+0EPetAron9pEYBogejDgSrBePvySJHiWPt0K0/0uQhDRvK0xI9ENITqXnZqsj+OqkVUeCw1qbIzDPDYutX2Tf78ojIcwoureuCXbJqacbRy04vGBnZgVWQqIzlOiqZ2f8Xs2eF7upgSeSvhHA9qw1rvzeg2MEhgZTKiIIN0l3I6CZ0zJwxKNGiVkJ2YcSoHIZfui2CKod7QdkuT3xrtSs+0LELup+2cDIExZg5wRPUduaJfJKS4h35UeacOTd4i2xheLK4nxu97E2gy+zlWsmxyllKry5FksLSuX8RzhDT8dSIReF7/kenxzmPzRnf5+9eLUAxlKrbN4QtzaAtmZoOqUjDHyn2l1vqjKKOa0kp+fKk5uD9brn4ppKQLZJ4hw7mPqQrgMO/AOA4MgYUX2ic/OSxzLzj/U7kT7pWlfA2l6jZsIzAKcsFu6G5HhdZ0pw/5BanEzemzNMYkGEbI1JCYRKLlpTmO1XTIP/jFvq/mFStkDJzx//cJLHhA5PNLmLCkLj7Z7p95VRcm0IPyoVU4IsRAbUcKtryXFXwvZrWFEwXKQuxlufkBN41goIdVWmnB66Fdq7erAnbtaoUP+CQadpN637GIP8/6qu21C5rqRomZaCsmKAvRjW9F/ViLV+eZCu+h9YdV2oGo1hnFbC4uBi5STdWIk2Kceck/DhqWoenEcHOSp3/2OXcjhf+JYVfYyV9Mn7JEXrscN7dCfsJemeXK85liTEPEKOqQokn2Avr70n/yqYhI+bJqHUV

The Derive extension does what you want.

https://coq.inria.fr/refman/addendum/miscellaneous-extensions.html



On May 16, 2018 11:38, Joachim Breitner <mail AT joachim-breitner.de> wrote:

Hi,

I am experimenting right now with something like this:

  Lemma foo_ind_aux:
    forall (P : _ -> Prop),
    { IHs : Prop |
      IHs -> forall x, WellFormed x -> P (foo x)
    }.
  Proof. intros P. eexists. intro IHs. … Defined.

  Definition foo_ind P := proj2_sig (foo_ind_aux P).

The context is that I have a complex function `foo` with a few cases,
and a predicate `WellFormed` on its domain. Previously, I had multiple
proofs about `foo`, with different conclusions, but all of them
duplicated a lot of structure; in particular every invocation of the
inductive hypothesis would repeat the same proofs to satisfy the
WellFormed-obligation of the inductive hypothesis.

With the above trick, I can do this once and for all and essentially
define a “functional induction scheme with built-in invariant
handling”. The neat thing is that I don't have to spell out the (rather
big) preconditions, but rather leave them as existential. When I then
use them in foo_ind_aux, Coq learns their actual type.
At the end, IHs is the conjunction of all the proof obligations that
you would expect in such an induction lemma.


But what I’d really like to do is to write directly

  Lemma foo_ind:
    forall (P : _ -> Prop) (IH1 : ?_) (IH2 : ?_),
    forall x, WellFormed x -> P (foo x)
  Proof. intros P IH1 IH2. … Qed.

where ?_ introduces an existential variable for the type of these
hypotheses that will become concrete during the proof.


Is a way of doing that?

Thanks,
Joachim

--
Joachim Breitner
  mail AT joachim-breitner.de
  http://www.joachim-breitner.de/





Archive powered by MHonArc 2.6.18.

Top of Page