我想對幾種判斷創建符號,例如用於打字和子類型關係:在勒柯克運算符重載符號
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)是一個相關的問題。 –