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: Pierre Courtieu <pierre.courtieu AT gmail.com>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Existential variables or holes in Lemma types
  • Date: Wed, 16 May 2018 18:12:15 +0200
  • Authentication-results: mail2-smtp-roc.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-ot0-f170.google.com
  • Ironport-phdr: 9a23:+z6LqBas15FaLwKLBGYRnuH/LSx+4OfEezUN459isYplN5qZr8m9bnLW6fgltlLVR4KTs6sC17KN9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCazbL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjm58axlVAHnhzsGNz4h8WHYlMpwjL5AoBm8oxBz2pPYbJ2JOPZ7eK7WYNEUSndbXstJWCNBDIGzYYsBAeQCIOhWsZXyqVQVoBuiHAmhHv/jxiNUinL026AxzuQvERvB3AwlB98AqnXUo8vvNKcIT+++0bfFzTLeb/NMxTf96ZbHcg08qvyLRbJwcNTeyVM1FwzblFmftYvlPy6P1uQRsmiU8fdgWPmgi24isQ5xozyvyt0whYnOg4IY01bJ/jh3zoYyIN23Uk97Ydi8HZtRsSGaLYp2Tdk4T2FmoiY20r8GuZmhcycWyJQnxhvfZ+WcfIiS/B3jVfqRITFmi3J/Yr6wmgi9/E69weP/Tsm5yFRHoyVfntXRqHwA1wbf58uZRvdn40us2yqD2gbO4e9eO080j7DUK5s5z74wiJUTtUPDEzfzmErsja+Wclwo+u+06+j7e7nmqIKQOo1ohg3kPaQuncu/Aes8MgcQRWSU5eO81Lj78U34RrVFkOE2n7HbvZ3VP8gXu7C1Dg9P3osg9RqzFSqq3dYEkXUfKVJKYhOHj4znO1HUJ/D4CO+yg0ytkDh13fDGJKPuDo/RIXjEjbfhZ6p9609Cxwou1t1f6JdUBasAIPL3QEP+qNvYDhohPwyu3+nnEMl91p8ZWW+XHqCZN7rSvUaU6eIrPumDf5QYuC39Kvgg//7hl2U1mV4bfamz3JsYcmq0Hvp8IxbRXX25qdAYWUwOowB2GOftkRiJVSNZT3e0RaM1oD8hXtGIF4DGE7isjaab0W+QGYBMemFLFxjYCXblbZ+JHfwLdTiOI8J8ujMBXLmlDYQm0Ef950fB17N7I7+MqWUjvpX52Y0wvrWLzEBgxXlPF82Yllq1YSRxl2IMSSUx2fkm80N4w1aHl6N/hq4BTIAB17ZySg4/cKXk4aliEdmrA1DOe96ITBCtRdD0WWhsHOJ0+McHZgNGI/vnjh3H2HD0UboclrjOA4Bst6yFgCC3KMF6xHLLkqImigt+Tw==

Hi Joachim,

I like this trick. Crafting induction principles is an efficient way to
ease proofs. I think ikdc is right: Derive is what you want.

I have several questions:
1) do you use functional induction in the proof of foo_ind_aux? It seems to
be a good idea.
2) I would expect (P x (foo x)) for the conclusion of foo_ind_aux instead
of (P (foo x)). Did you just simplify your example or do you manage to use
it like that?
3) the shape of this "functional scheme" is probably not accepted by
"induction ... using foo_ind". Does it? Or do you have to apply the
principle by hand?
Best regards
P.



Le mer. 16 mai 2018 à 17:55, ikdc
<ikdc AT mit.edu>
a écrit :

> 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