Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Overloading notation for different types in Coq

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Overloading notation for different types in Coq


Chronological Thread 
  • From: Marianna Rapoport <mrapoport AT uwaterloo.ca>
  • To: Gaetan Gilbert <gaetan.gilbert AT ens-lyon.fr>, coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Overloading notation for different types in Coq
  • Date: Fri, 19 May 2017 16:59:45 -0400
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=mrapoport AT uwaterloo.ca; spf=Pass smtp.mailfrom=mrapoport AT uwaterloo.ca; spf=None smtp.helo=postmaster AT minos.uwaterloo.ca
  • Dkim-filter: OpenDKIM Filter v2.11.0 minos.uwaterloo.ca v4JKxkTD030982
  • Ironport-phdr: 9a23:RGpinhLCvpkybbh4ltmcpTZWNBhigK39O0sv0rFitYgeLfTxwZ3uMQTl6Ol3ixeRBMOAuqwC1rWe8/i5HzdRvtDZ6DFKWacPfiFGoP1VpTBoONSCB0z/IayiRA0BN+MGamVY+WqmO1NeAsf0ag6aiHSz6TkPBke3blItdaz6FYHIksu4yf259YHNbAVUnjq9Zq55IAmroQnLuMQbhYpvJrwxxxbLv3BEf/hayX5yKV+dmxvx5N288IJ//yhVpvks69NOXaLmcqs3SrBVEC4oP2cp6sP1qBLNVxGP5nwSUmUXlhpHHQ3I5wzkU5nyryX3qPNz1DGVMsPqQ780Xy+i77pwRx/zlCgHLT85/3rJhcF2kalWvQiupx17w47TfYGVKP9zdb7TcN8GWWZMWNtaWjdfCY2gcYQAE+sBPf5Zr4bjoVsOsQC+DhSoCO/21zNEmmP60ag83u88Ew/JwRYgEsoNvnrUstv6O6gcXvyywqfGzzrNcv1W1Czn54XKaB0su+uBUa5yfMfX1EIhFxnFjlKVqYH9OD2azP4Ns2mB4OpmU+KgkXMspR1rrTi3wccsko7JhpgJylvZ8ih5xZw1KsegSE58ed6kF4FQtz2BOotrTMItWX1otzggyr0Cvp67ezIGx4g9yBPGbfGMbouG4gr7WeqMPzt1gGhpdba9ihqo7ESs1O7xWtO23VtJtiZIk9jBumoQ2xDO98SLUPRw8l2/1TqR1Q3e7PxPL1oumqrBMZEhx6Y9lpoNvkTHGS/7gED2jK6QdkUj4eik8fnnY7v8qZ+AKYB0kAX+MqMpmsClHes3KBACX2md+euiyL3u5VD1TKtOg/EslqTUsorWKdkFqqO6GQNY0IUu5w66Dzi80dQYmXcHLEhCeBKCl4XpPkvOL+rgDfe4m1Ssly1rx+zdM738DJTCNGTDn6n7fbZ57E5czxA/wsxF6J5MELEOPOrzWlPttNzfFhI2Lwu0w//+BNph0oMeRHmAD7SCMKLStF+I/vggL/ONZI8Tojb9KuIq6+TgjX8jyhchevyG1JYLYXbwMfViKUiDfTK4jd4MDW4M+AU/SObnkkGqXDhIInKjWKR66CttTMqtCp6GTYSwipSA2j26F9tYfDNoEFeJRFLhbYSNXfEFIBibOsh5lSYYHeykUYY50gmprhPS1qVuMufO/iof85nqgosmr9bPnA0/oGQnR/+W1HuAGiQtxjsF

As a follow up on the turnstile notation, is it possible to avoid a parse conflict with the match notation of Ltac?

Minimal example:

Class VDash (A B C : Type) := vdash : A -> B -> C -> Prop.
Notation "G '|-' e '::' T" := (vdash G e T) (at level 40, e at level 59).

Ltac tactic :=
  solve [match goal with
  | H: _ |- _ => auto
  end].

The error I get is:

Syntax error: '::' expected after [constr:operconstr level 59] (in [constr:operconstr]).

On Thu, May 18, 2017, at 03:27 PM, Marianna Rapoport wrote:
> That's exactly what I was looking for. Thanks a lot!
>
> Marianna
>
> On Thu, May 18, 2017, at 02:05 PM, Gaetan Gilbert wrote:
> > With typeclasses you can do something like see attached file.
> >
> > Gaëtan Gilbert
> >
> > On 18/05/2017 19:57, Marianna Rapoport wrote:
> > > I would like to be able to define the same Coq notations for different
> > > inductive definitions, and distinguish the notations based on the
> > > types of their arguments.
> > >
> > > Here is a minimal example:
> > >
> > >     Inductive type : Type :=
> > >     | TBool : type.
> > >
> > >     Inductive term1 : Type :=
> > >     | tvar1 : term1.
> > >
> > >     Inductive term2 : Type :=
> > >     | tvar2 : term2.
> > >
> > >     Definition context := nat -> (option type).
> > >
> > >     Reserved Notation "G '⊢' t '::' T" (at level 40, t at level 59).
> > >
> > >     Inductive typing1 : context -> term1 -> type -> Prop :=
> > >      | T_Var1 : forall G T,
> > >           G ⊢ tvar1 :: T
> > >     where "G '⊢' t1 '::' T" := (typing1 G t1 T)
> > >     with typing2 : context -> term2 -> type -> Prop :=
> > >      | T_Var2 : forall G x T,
> > >           G ⊢ tvar2 :: T
> > >     where "G '⊢' t2 '::' T" := (typing2 G t2 T).
> > >
> > > As you see, there is a mutually inductive definition, in which I'd
> > > like to be able to use the same notation for different types of terms
> > > (`term1` and `term2`).
> > >
> > > The error I get when trying to compile this is `Error: Illegal
> > > application (Non-functional construction): The _expression_ "tvar1" of
> > > type "term1" cannot be applied to the term "x" : "?T"`.
> > >
> > > Is there a way to get this to work, maybe by using type classes?
> >
> > Email had 1 attachment:
> > + tc_notas.v
> >   1k (text/x-verilog)




Archive powered by MHonArc 2.6.18.

Top of Page