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

Is that a problem of variable inference? #236

Open
ice1000 opened this issue Jul 14, 2020 · 5 comments
Open

Is that a problem of variable inference? #236

ice1000 opened this issue Jul 14, 2020 · 5 comments
Labels

Comments

@ice1000
Copy link
Contributor

ice1000 commented Jul 14, 2020

I have a proof that type-checks:

\import Arith.Int
\import Function
\import Homotopy.Sphere.Circle
\import Paths

\func transport-ap-assoc {A :\Type} (cover : A -> \Type)
                         {a a' : A} (p : a = a')
  : transport cover p = transport id (pmap cover p) \elim p
  | idp => idp

\func transport-code-loop : transport code (path loop) = isuc =>
  transport code (path loop)                    ==< transport-ap-assoc code (path loop) >==
  transport id (pmap code (path loop))          ==< pmap (transport id) lemma >==
  transport id (path (\lam i => code (loop i))) `qed
  \where {
    \func lemma : pmap code (path loop) = path (\lam i => code (loop i)) => idp
  }

I'm using a lemma whose type is whatever but the body is idp, which means its lhs and rhs are convertible.
However, when I inline lemma, say, replace it with idp directly, Arend gives me type error.

Why should this happen?

The does-not-work code:

\func transport-code-loop : transport code (path loop) = isuc =>
  transport code (path loop)                    ==< transport-ap-assoc code (path loop) >==
  transport id (pmap code (path loop))          ==< pmap (transport id) lemma >==
  transport id (path (\lam i => code (loop i))) `qed

The error message:

[ERROR] bug.ard:13:53: Type mismatch
  Expected type: transport id (pmap code (path loop)) = ?a'
    Actual type: transport id ?a = transport id ?a'
@ice1000
Copy link
Contributor Author

ice1000 commented Jul 14, 2020

I guess it tries to unify the two sides without trying to compute one of them.

@valis
Copy link
Collaborator

valis commented Jul 14, 2020

Can't you just write

\func transport-code-loop : transport code (path loop) = isuc => transport-ap-assoc code (path loop)

?

@ice1000
Copy link
Contributor Author

ice1000 commented Jul 14, 2020

That's not related to this inference problem. The proof can be simplified, and I'm aware of that

@valis
Copy link
Collaborator

valis commented Jul 14, 2020

Even \func transport-code-loop : transport code (path loop) = isuc => idp works.

@valis
Copy link
Collaborator

valis commented Jul 14, 2020

Anyway, the problem is pmap (transport id) idp. Arguments for pmap cannot be inferred from idp (since they are not specified there, but they are specified in lemma so it works with it) and they cannot be inferred from the expected type because one of them evaluates to isuc and it doesn't match the expression from the type of pmap (which is transport id ... ?a).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants