[英]Why can't I define `Eq` using only indices in Agda?
為什么我不能像這樣定義更明確的異構相等版本:
data Eq : (A : Set) -> A -> A -> Set where
Refl : (T : Set) -> (x : T) -> Eq T x x
這樣做時,出現以下錯誤:
The type of the constructor does not fit in the sort of the
datatype, since Set₁ is not less or equal than Set
when checking the constructor Refl in the declaration of Eq
我知道此錯誤與宇宙層次結構有關,但我不知道到底是什么。 它是否認為Eq T xx
應該是Set_1
,或者應該但不應該? 為什么Set_1
什么?
如果要定義的類型的索引類型在Set n
,則類型本身必須至少在Set n
。 在您的情況下,索引A
類型為Set
,因此其類型 位於 Set 1
(因為Set : Set 1
)。 因此, Eq
本身至少應處於Set 1
。
請注意,如果A : Set
是參數而不是索引 ,則上述內容將不適用,這就是為什么在Set
可以使用同質相等的原因。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.