Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] intros []

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] intros []


Chronological Thread 
  • From: Gabriel Scherer <gabriel.scherer AT gmail.com>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] intros []
  • Date: Thu, 21 Apr 2016 11:44:06 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gabriel.scherer AT gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer AT gmail.com; spf=None smtp.helo=postmaster AT mail-io0-f175.google.com
  • Ironport-phdr: 9a23:Yv7H2Rx1UGo2TjTXCy+O+j09IxM/srCxBDY+r6Qd0e0RIJqq85mqBkHD//Il1AaPBtWLrawUwLqH+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuSt6U0ZT8h7H60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGx48sgs/M9YUKj8Y79wDfkBVGxnYCgJ45jAsgCLZg+S7DNIWWIP1xFMHgLt7RfgX563vDGs5cRn3yzPEsT8V7E5XXyZ5KdmUhLywHMIPjQj8WzTzNd7jK9BrQiJqBl2woqSa4aQYqktNpjBdM8XEDISFv1aUDZMV8blN9MC

There is also a remark on the difference of behavior of algebraic patterns (my personal name for "conjunctive or disjunctive pattern") as terminal patterns or non-terminal in a sequence:

> Remark: intros p1 … pn is not fully equivalent to intros p1;…; intros pn for the following reasons:
> [...]

This remark mentions that you can use
  Set Bracketing Last Introduction Pattern.

to make all algebraic patterns behave as if they were non-terminal (always introduce all parameters):

Coq < Goal (A /\ B) -> C.
 
  ============================
   A /\ B -> C

Unnamed_thm < intros [].
 
  ============================
   A -> B -> C

Unnamed_thm < Restart.
 
  ============================
   A /\ B -> C

Unnamed_thm < Set Bracketing Last Introduction Pattern.

Unnamed_thm < intros [].
 
  H : A
  H0 : B
  ============================
   C

I would instead rather recommend always choosing all the names in the pattern. As Dominique says, you can always explicitly ask for name generation with

  intros [? ?].

but you can also use

  intros [**].

(intros [*] will only introduce the named-variables)

Another behavior of "intros" I found when investigating your question, and which I don't see documented, is that 8.4 will happily overshoot in the rest of the goal if you have more variables in a conjunctive pattern than there are arguments:

Coq < Goal A /\ B -> C -> D.
 
  ============================
   A /\ B -> C -> D

Unnamed_thm < intros [a b c].

  a : A
  b : B
  c : C
  ============================
   D

Under 8.5 I get a failure as I expected:

  ============================
   A /\ B -> C -> D

Unnamed_thm0 < intros [a b c].
Toplevel input, characters 12-13:
> intros [a b c].
>             ^
Error: Unexpected name (at most 2 introduction patterns were expected in the
branch).


On Thu, Apr 21, 2016 at 11:34 AM, Guillaume Melquiond <guillaume.melquiond AT inria.fr> wrote:
On 21/04/2016 17:10, Théo Zimmermann wrote:
> Hello,
>
> For a goal of the form A /\ B -> C, using intros [] yields the goal A ->
> B -> C (and does not add anything to the context). I would have rather
> expected that A and B be added to the context (this can be achieved with
> intros [] **).
>
> Is this a wanted behavior? If yes, is it documented somewhere? (I looked
> but did not find any mention of this pattern in the section of the
> manual devoted to intros intro_pattern_list).

See 8.3.2 of the reference manual:

"if the disjunctive pattern is part of a sequence of patterns, then Coq
completes the pattern so that all the arguments of the constructors of
the inductive type are introduced"

which implicitly means that, if the pattern is not part of a sequence
(or rather it is the last one), the arguments are not introduced unless
recursively asked for.

As far as I am concerned, I am fine with this behavior; I dislike it
when Coq invents names in my stead.

Best regards,

Guillaume




Archive powered by MHonArc 2.6.18.

Top of Page