AGDA如何解决错误:无法求解以下约束

发布于 2025-01-26 07:12:28 字数 828 浏览 4 评论 0原文

此代码有什么问题?

编辑: 我正在发送所有代码,包括依赖关系,导入,标志等。

我无法弄清楚该错误可能在哪里。如果有人可以指导我如何解决此错误,我将非常感激。

{-#  OPTIONS --type-in-type --without-K  #-}

module Basic where

Type = Set

data Path {A : Type} : A → A → Type where
  id : {M : A} → Path M M

_≃_ : {A : Type} → A → A → Type
_≃_ = Path

infix 9 _≃_

ap :  {A B : Type} {M N : A}
      (f : A → B) → Path{A} M N → Path{B} (f M) (f N)
ap f id = id

ap≃ : ∀ {A} {B : A → Type} {f g : (x : A) → B x} 
      → Path f g → {x : A} → Path (f x) (g x)
ap≃ α {x} = ap (\ f → f x) α

postulate 
   λ≃  : ∀ {A} {B : A → Type} {f g : (x : A) → B x}
      → ((x : A) → Path (f x) (g x)) 

我遇到了这个错误:

Failed to solve the following constraints:
  Has bigger sort: _44
  piSort _25 (λ _ → Set) = Set
  Has bigger sort: _25

有帮助吗?

What is wrong with this code?

EDIT:
I'm sending all the code including dependencies, imports, flags, etc.

I can't figure out where the error might be. I would be very grateful if someone could direct me how to fix this error.

{-#  OPTIONS --type-in-type --without-K  #-}

module Basic where

Type = Set

data Path {A : Type} : A → A → Type where
  id : {M : A} → Path M M

_≃_ : {A : Type} → A → A → Type
_≃_ = Path

infix 9 _≃_

ap :  {A B : Type} {M N : A}
      (f : A → B) → Path{A} M N → Path{B} (f M) (f N)
ap f id = id

ap≃ : ∀ {A} {B : A → Type} {f g : (x : A) → B x} 
      → Path f g → {x : A} → Path (f x) (g x)
ap≃ α {x} = ap (\ f → f x) α

postulate 
   λ≃  : ∀ {A} {B : A → Type} {f g : (x : A) → B x}
      → ((x : A) → Path (f x) (g x)) 

I'm getting this error:

Failed to solve the following constraints:
  Has bigger sort: _44
  piSort _25 (λ _ → Set) = Set
  Has bigger sort: _25

Any help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我不会写诗 2025-02-02 07:12:28

我没有遇到完全相同的错误,但是我通过注释a使用类型typeλ≃的类型中进行检查。 :

postulate
   λ≃  : ∀ {A : Type} {B : A → Type} {f g : (x : A) → B x}
      → ((x : A) → Path (f x) (g x))

我看到的错误是因为AGDA通常会假设您可能要使用宇宙多态性,并且在λ≃类型中碰巧没有其他约束a 到最低的Universe 类型

I didn't get quite the same error, but I got the file to check by annotating A with type Type in the type of λ≃:

postulate
   λ≃  : ∀ {A : Type} {B : A → Type} {f g : (x : A) → B x}
      → ((x : A) → Path (f x) (g x))

The error I saw comes about because Agda will usually assume that you might want to use universe polymorphism, and there happens to be nothing else in the type of λ≃ that constrains A to the lowest universe Type.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文