Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Problem with scopes

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Problem with scopes


Chronological Thread 
  • From: Pierre Courtieu <pierre.courtieu AT gmail.com>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Problem with scopes
  • Date: Tue, 23 Aug 2016 18:27:06 +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-lf0-f44.google.com
  • Ironport-phdr: 9a23:gLfeGBSLe7REfE9kG+nV29hN8Npsv+yvbD5Q0YIujvd0So/mwa64bRGN2/xhgRfzUJnB7Loc0qyN4vmmAjBLsMbJ8ChbNscdD1ld0YRetjdjKfbNMVf8Iv/uYn5yN+V5f3ghwUuGN1NIEt31fVzYry76xzcTHhLiKVg9fbytScbshsi6n9q/54fUK10RwmHsOPUpcF7n/U2R7pBQ2to6bP5pi1PgmThhQ6xu32RmJFaezV7Xx/yb29pdyRlWoO8r7MVaUK/3LOwSRL1cCyk6YShuvJW4/TGKdwaE52MdX2MKiVIIRlGdtFCpFqv25wD9r6JW3DSQdZn9SqlxUjC/5Y9qTgXpgWEJLWhq3nvQj5lIja9Buh/pjBti2ZLVbZzdYOJ/c7nHcJURQndbQsdcSgROB4q9a80ECO9XbrUQlJX0u1Zb9Uj2PgKrHu66j2YQ3nI=

2016-08-23 16:54 GMT+02:00 Guillaume Melquiond
<guillaume.melquiond AT inria.fr>:
> On 23/08/2016 16:15, Beta Ziliani wrote:
>> Hi list,
>>
>> We've been fighting this issue for way too long, and now it's time to
>> ask the crowd. We like to override the notation for lists /only/ when
>> the list is the argument of certain definition. However, the notation is
>> being pervasive to every list. Aren’t scopes intended for that? What is
>> wrong with our understanding of scopes?

> Open scopes only control whether you need to explicitly tell Coq which
> interpretation scope to use (using %scope). They have no impact on
> whether a notation is enabled or disabled (be it for parsing or printing).

However intuitively one would think that when printing the choice of
notation is the one that needs no % at parsing (top of the scope
stack). And this is not the case.

[...]
Close Scope patterns_scope.
Close Scope pattern_scope.

(* Definition foo := ((with 0| 1| 2 end)). (* Fails, needs %patterns *) *)
Definition alist := [0;1;2]. (* succeeds withtout % *)
Print alist. (* (with 0| 1| 2 end)%patterns *)

This is rather confusing isn't it?

Strangely if one moves the "Import ListNotation" AFTER the "Close
Scope", it behaves more or less as expected... Except that:

Definition amatch := mmatch 0 with 0 => 1 | 1 => 2 end.
Print amatch. ===> amatch = mmatch 0 ([(0 => 1)%pattern; (1 => 2)%pattern])

%patterns


P.


> Best regards,
>
> Guillaume



Archive powered by MHonArc 2.6.18.

Top of Page