Skip to Content.
Sympa Menu

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

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

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


Chronological Thread 
  • From: Joachim Breitner <mail AT joachim-breitner.de>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] Existential variables or holes in Lemma types
  • Date: Wed, 16 May 2018 11:38:00 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=mail AT joachim-breitner.de; spf=Neutral smtp.mailfrom=mail AT joachim-breitner.de; spf=None smtp.helo=postmaster AT hermes.serverama.de
  • Ironport-phdr: 9a23:/O3VIxWC6heukFaKnD62TidE2JzV8LGtZVwlr6E/grcLSJyIuqrYYxOGt8tkgFKBZ4jH8fUM07OQ7/i7HzRYqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba98IRmssQndqtQdjJd/JKo21hbHuGZDdf5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXMTRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KptVRTmijoINyQh/W/Ul8J+jLxVrhy9qBJ4zIHZe46VOOZkc67HZ94WWWhMU8BMXCJBGIO8aI4PAvIFM+ZftYbyu1sOrRq7BQKxGe7v0CFHhn7q3a08zeshCxzN0QslH90UsXTUqM74NKUVUe+v0KbIzTTDb/ZP1Tjm8ojHbBEhoe2KXb1ua8rd01QgGB3cg1iWtIfrMTSV1uEXvGia6eptTeCvi2k9pA5tojivx8IshpDSiYIP1F/E9Dl5wIArKt2iUkJ0fMCrHZ1NvC+ZL4t7Wt4uTmNptSogzrAKo4C3cDUExZg92hLSZfKKfo6V6Rz5TumROy13hHd9dbK/mRmy9U+gx/X8VsaqylZKqzRKksLWunAWyRPT8NaHReVn/ki73DaAzRrf5fxaLkwslKrbLYAuwqIom5YOs0nOHzX6lUHsgKOIa0kp9PKk5/npb7jovpOcMpV7igD6MqQggMy/BuE4PxALX2eB+OS80Kbu/U/+QLpQkvI2kqjZsJXDKcsAvK62HQ5V0pol6xmhFTeqyskXkmcfIFJfZB2Hl5TpO03JIP3gEfi/hE2snC53yPDCI73uGY7ALmPDkbfkZbZy8VRQyAs1zdBF5pJbEKsNIPzpWhy5iNuNBRggdgew3uzPCdNn14pYV3jcLLWeNfbwtlaD5uMqa8OWaY4JvjvnY6wg7v/qpX0+kFQdfKzs14EaaWy+E+4gL0jPMimkucsIDWpf5ll2d+ftklDXCWcCNUb3ZLo143QAMKzjCI7CQo63h7nbhXW5GZRdZmFDT1qWHHb0cYieHfsBOnjLfp1R1wccXL3kcLcPkAm0vVWjmbhgJ+HU+yhdv4ju1cRz6veVmRxgrWUpXfTY6HmESiRPpk1NRzIy2/om80xw0FKOyu5jjuZGGMZa4voPXgpobZM=

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/

Attachment: signature.asc
Description: This is a digitally signed message part




Archive powered by MHonArc 2.6.18.

Top of Page