我想对几种判断创建符号,例如用于打字和子类型关系:在勒柯克运算符重载符号
Reserved Notation "Г '⊢' t '∈' T" (at level 40).
Reserved Notation "Г '⊢' T '<:' U" (at level 40).
Inductive typing_relation : context -> term -> type -> Prop := ...
where "Γ '⊢' t '∈' T" := (typing_relation Γ t T).
Inductive subtyping_relation : context -> type -> type -> Prop := ...
where "Г '⊢' T '<:' U" := (subtyping_relation Γ T U).
据我了解,勒柯克不会允许这种情况是因为⊢
操作在这些定义中被重载。
我如何才能让勒柯克推断重载运算符的定义(在这种情况下,⊢
)的基础上的类型的参数(如term
VS type
)(和/或基于被部分其他运营商符号,例如∈
vs <:
)?
(请注意,使用不同的符号会不会是一种选择,因为我的勒柯克程序定义了几种类型和子类型的关系。)
编辑:这里是一个小例子:
Inductive type : Type :=
| TBool : type.
Inductive term : Type :=
| tvar : nat -> term.
Definition context := nat -> (option type).
Reserved Notation "G '⊢' t '∈' T" (at level 40).
Inductive typing_relation : context -> term -> type -> Prop :=
| T_Var : forall G x T,
G x = Some T ->
G ⊢ tvar x ∈ T
where "G '⊢' t '∈' T" := (typing_relation G t T).
Reserved Notation "G '⊢' T '<:' U" (at level 40).
Inductive subtype_relation : context -> type -> type -> Prop :=
| S_Refl : forall G T,
G ⊢ T <: T
where "G '⊢' T '<:' U" := (subtype_relation G T U).
这导致错误:
Syntax error: '<:' or '∈' expected after [constr:operconstr level 200] (in [constr:operconstr]).
你会得到什么错误信息?另外,[mcve]会很好。 –
刚刚添加了一个例子! – amaurremi
[Here](http://stackoverflow.com/questions/42239138/syntax-error-with-in-coq-notations)是一个相关的问题。 –