Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoeSort の説明に誤り #1150

Closed
Seasawher opened this issue Nov 22, 2024 · 0 comments · Fixed by #1151
Closed

CoeSort の説明に誤り #1150

Seasawher opened this issue Nov 22, 2024 · 0 comments · Fixed by #1151

Comments

@Seasawher
Copy link
Member

Coe とどう違うのかの説明が間違っている。現状の説明では、「型宇宙へ」強制する場合には CoeSort でないといけないかのように見えるが、以下のように Coe で型宇宙への強制を行うことができる。

CoeCoeSort の違いは、「強制のトリガーがどこにあるのか」で説明すべき。

def zero (α : Type) : Nat := 0

/-- `Type` のラッパー -/
structure AltType where
  base : Type

def A : AltType := ⟨Nat⟩

/--
error: application type mismatch
  zero A
argument
  A
has type
  AltType : Type 1
but is expected to have type
  Type : Type 1
-/
#guard_msgs in #eval zero A

instance : Coe AltType Type := ⟨fun S ↦ S.base⟩

-- ちゃんと評価できる
#eval zero A
@Seasawher Seasawher changed the title CoeSort の説明に誤りがある CoeSort の説明に誤り Nov 22, 2024
@Seasawher Seasawher self-assigned this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant