类型的定义在 agda 中不起作用

definition of a type doesn’t work in agda

agda 不能编译这个模块化算法的定义:

data mod (n : nat): n → Set where
    zeroM : mod n
    S : mod n → mod n
    equMod : { x : nat} → (x ≡ n) → (x ≡ zeroM)

错误:nat should be a sort, but isn’t

有人可以帮助我吗?

当你写 n -> Set 时,你需要 n 是一个类型,但它是一个自然数。我猜你只想写 data mod (n : nat) : Set 这意味着 mod : nat -> Set.