Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Automation with existential goals

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Automation with existential goals


Chronological Thread 
  • From: Jonathan Leivent <jonikelee AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Automation with existential goals
  • Date: Mon, 14 Nov 2016 10:03:47 -0500
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk0-f179.google.com
  • Ironport-phdr: 9a23:MTlM1BZSDOZKK9Ij9vJHdEb/LSx+4OfEezUN459isYplN5qZpsSybnLW6fgltlLVR4KTs6sC0LuN9fm4EjNZqdbZ6TZZL8wKD0dEwewt3CUeQ+e9QXXhK/DrayFoVO9jb3RCu0+BDE5OBczlbEfTqHDhpRQbGxH4KBYnbr+tQt2aue3siLv3o8GbI1gQxWn1XbQnJxKv6A7Vq8M+gI14K693xAGajGFPfrF0wmVhOVKamV7Y68au8Zh/u3BSvPQg9MNEXKjScKExTLgeBzMjZTNmrPb3vAXOGFPcrkAXVX8bx0cQDg==

Note this trick, though:

Inductive foo : Set :=
| bar : forall n, n = 7 -> foo.

Goal foo -> exists {n:nat}, n=7.
intros. eexists.
destruct H.
instantiate (1:=ltac:(destruct H)).
exact(e).

What that did: the evar generated by eexists has its own subgoal, which is shelved. The instantiate tactic has the interesting feature of being able to run another tactic in an evar's subgoal, even though instantiate itself is not called within that subgoal. Hence that second "destruct H" runs in the evar's subgoal. That second "destruct H" keeps the evolution of the two subgoals in step with respect to the new variables (n and e) revealed by the destruction, in just the same way as if that destruction had been done prior to the eexists.

WIthout instantiate, this can be done using unshelve to add the evar's subgoal to the proof focus, as in:

Inductive foo : Set :=
| bar : forall n, n = 7 -> foo.

Goal foo -> exists {n:nat}, n=7.
intros.
unshelve eexists.
all:destruct H.
2:exact(e).

Coincidentally, I am writing a draft of something I might make into a CEP about just this. It is an extension of the discussion with Hugo in bug https://coq.inria.fr/bugs/show_bug.cgi?id=3918 that he recently prompted me to look at again. My point in this draft will be that in many cases, the above trick keeps proofs solvable, whereas otherwise they become unsolvable - and so perhaps there should be a setting that makes this happen automatically when possible.

-- Jonathan





Archive powered by MHonArc 2.6.18.

Top of Page