Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssr breaks type-annotated patters in binders #11088

Open
llelf opened this issue Nov 9, 2019 · 2 comments
Open

ssr breaks type-annotated patters in binders #11088

llelf opened this issue Nov 9, 2019 · 2 comments
Labels
part: ssreflect The SSReflect proof language.

Comments

@llelf
Copy link
Contributor

llelf commented Nov 9, 2019

Description of the problem

Variant foo := Foo (a b : nat).

Module VANILLA.
     Definition F₁ '(Foo a b)       := a+b.
     Definition F₂ '(Foo a b : foo) := a+b.
End VANILLA.

From Coq Require Import ssreflect.

Module SSREFLECT.
     Definition F₁ '(Foo a b)       := a+b.
Fail Definition F₂ '(Foo a b : foo) := a+b.
(* invalid notation for pattern *)
End SSREFLECT.

Coq Version

8.9.1, 8.10.0, master

@gares
Copy link
Member

gares commented Nov 20, 2019

Maybe @ggonthier has an idea of where it could come from. SSR extends the syntax for binders, but I don't know that code very well.

@ggonthier
Copy link
Contributor

The conflict is not with the plugin code and the binder extension syntax. It's with the overloading of the cast t : T syntax in ssreflect.v. The latter is used to force the interpretation t in type_scope when T is Type or Prop. There's been some discussion around this #6078, #6133, including a PR to support this more generally #6134, but this wasn't merged in the end.
At any rate, the problem here is that the parsing rules for type-annotated patterns are too fragile and should either parse the pattern (at level 99) and cast explicitly, or else recognise a generic operator : as a cast.

@gares gares self-assigned this Nov 20, 2019
@llelf llelf added the part: ssreflect The SSReflect proof language. label May 8, 2020
@gares gares removed their assignment Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part: ssreflect The SSReflect proof language.
Projects
None yet
Development

No branches or pull requests

3 participants