Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] any down side to making all definitions Instances?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] any down side to making all definitions Instances?


Chronological Thread 
  • From: Jonathan Leivent <jonikelee AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] any down side to making all definitions Instances?
  • Date: Thu, 8 Sep 2016 11:37:49 -0400
  • 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-qt0-f175.google.com
  • Ironport-phdr: 9a23:sRVAMRXeSBI0ukTXWTkardU/9W7V8LGtZVwlr6E/grcLSJyIuqrYZRODt8tkgFKBZ4jH8fUM07OQ6PG5HzJaqsbQ+DBaKdoXCE9D0Z1X1yUbQ+e7SmTDZMbwaCI7GMkQHHRExFqcdXZvJcDlelfJqWez5zNBUj/2NA5yO/inUtWK15f/hKiO/MjYZBwNjz6ga5tzKg+3pEPfrJo4m4xnf4Q2zBLVonJOM8BbxH1lI07byxT74Maz8Zpu/gxfvvsg84hLVqCsLPdwdqBREDlzazN938bsrxSWFQY=



On 09/08/2016 11:19 AM, Jonathan Leivent wrote:


On 09/08/2016 10:25 AM, Théo Zimmermann wrote:
Wow, I'm impressed!
Of course, when discussing this feature, we started by looking for a way to
implement it using Ltac.
We had come up with something that used tactics-in-terms but you could only
match on exact types, not on patterns.
At the last Coq coding sprint, when Pierre-Évariste started the
implementation, I don't think there was anyone there who could see that it
could be implemented without a line of OCaml.
Still, there is a limitation to what the code you provide can do: you
cannot use pattern variables ?x (like when using Search). We realized
recently that this is something that cortouche handles (no example of this
has been added yet, though).

My understanding of what is going on with those underscores is that the type expression in "exact (hyp : is_foo _ _)" is an open_constr. Which means one can use something like ?x pattern variables - ?[X] evar names. However, one has to use ?[X] as the first occurrence of X, then use "?X" as the others - and so one must know which part of the pattern Coq will try to match first.

Here's an example of using evar names as non-linear patterns:

Parameter is_bar : nat -> nat -> Prop.

Lemma example_with_evar_names :
is_bar 1 0 -> is_bar 1 1 -> is_bar 0 1 -> exists n1 n2, is_bar n1 n2 /\ is_bar n1 n2.
Proof.
intros.
do 2 eexists; split.
exact (hyp: is_bar ?[X] ?X). (*second subgoal is now is_bar 1 1*)
exact (hyp: is_bar 1 1).
Qed.

-- Jonathan





Archive powered by MHonArc 2.6.18.

Top of Page