coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Marianna Rapoport <mrapoport AT uwaterloo.ca>
- To: coq-club AT inria.fr
- Subject: [Coq-Club] Overloading notation for different types in Coq
- Date: Thu, 18 May 2017 13:57:39 -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 v4IHvdbh024365
- Ironport-phdr: 9a23:R4fycxwEhX2SI6bXCy+O+j09IxM/srCxBDY+r6Qd1OIeIJqq85mqBkHD//Il1AaPBtSFra8bw6qO6ua7CDNGuc7A+Fk5M7VyFDY9yv8q1zQ6B8CEDUCpZNXLVAcdWPp4aVl+4nugOlJUEsutL3fbo3m18CJAUk6nbVk9Kev6AJPdgNqq3O6u5ZLTfx9IhD2gar9uMRm6twvcu80XjId4Kqs8yAbCrn9Ud+hL329lK1aekhTm6sus4JJv9jlbtu48+cJHTaj1cKM0QKBCAjghL247+tDguwPZTQuI6HscU2EWnQRNDgPY8hz0XYr/vzXjuOZl1yaUIcP5TbYvWTS/9KhrUwPniD0GNzEi7m7ajNF7gb9BrxKgoxx/xJPUYJ2QOfFjcK7RYc8WSGxcVctXSidPAJ6zb5EXAuQCPehWsYbyqVQSohW5CweiGfjixSVKi3Lsx6A3yfgtHAPA0Qc9H9wOqnPUrNDtOakVS++11qjIwi/Fb/NQwzj29ZTGfQo5ofGLRbJwdtDRyVUyHA7Ci1WQs5bqPyuS1uQVtGib9fZgWPmyi28psQ5xviagxt0oionOgYIZ0EzL+j9gzYszONa2S1Z7bMa5HJdOsyyWLY97T8E4T211pio3yacKtJy4cSQSyZkqxgTTZ+Gaf4SV+B7uW/ydLSlmiH9nfr+0mgy8/lK6yuLmU8m5yFZKoTRBktnLrn0N0h3T6s6ASvtm5EuhxDiO2BrP6u5aO0A0ka3bK5k7zrEsjJUfqUXDHinol0XqlKKaa1so9+yy5+njYLjqvIKQO5F3hw3kMKkjmdSzAeEiPQgPW2ib9/681Lrm/UDhRbVKlOc5krHesJDCIsQbvLK5DhRI0oct8Rm/Eymp0M4cnXkAK1JJYg6IgJLxN1HUPP/4Feu/g0irkDpz2//GOaThDozRIXjHjbfuZq1w61VcyQo21dBQ/YhYCrAHIPLpW0/+rsbUDhEjM1/8/+GyA9Jkk4gaRGinA6mDMaqUv0XbyPgoJrypbZUUsTD7IrAf7ubplXgjhRdJeLOgxZwPb2qkNul5KlmUe37rhZEKGDFZ7UIFUOX2hQjaAnZobHGoUvdk6w==
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?
- [Coq-Club] Overloading notation for different types in Coq, Marianna Rapoport, 05/18/2017
- Re: [Coq-Club] Overloading notation for different types in Coq, Marianna Rapoport, 05/18/2017
- Re: [Coq-Club] Overloading notation for different types in Coq, Gaetan Gilbert, 05/18/2017
- Re: [Coq-Club] Overloading notation for different types in Coq, Marianna Rapoport, 05/18/2017
- Re: [Coq-Club] Overloading notation for different types in Coq, Marianna Rapoport, 05/19/2017
- Re: [Coq-Club] Overloading notation for different types in Coq, Abhishek Anand, 05/20/2017
- Re: [Coq-Club] Overloading notation for different types in Coq, Marianna Rapoport, 05/21/2017
- Re: [Coq-Club] Overloading notation for different types in Coq, Abhishek Anand, 05/20/2017
- Re: [Coq-Club] Overloading notation for different types in Coq, Marianna Rapoport, 05/19/2017
- Re: [Coq-Club] Overloading notation for different types in Coq, Marianna Rapoport, 05/18/2017
Archive powered by MHonArc 2.6.18.