Zulip Chat Archive
Stream: general
Topic: notation fail
Kevin Buzzard (Apr 27 2019 at 20:37):
I am in a situation where this term compiles fine:
nonempty (đ.equiv (locally_ringed_valued_space.to_đ.restrict U) (đ.Spa A))
but if I put
notation A ` â `:50 B := nonempty (đ.equiv A B)
and try
(locally_ringed_valued_space.to_đ.restrict U) â (đ.Spa A)
I get the error
type mismatch at application (Îť (x_1 : đ âĽU) (x_2 : đ ?m_1[x_1]), x_1 â x_2) (đ.restrict U (đą.to_đ locally_ringed_valued_space)) (đ.Spa A) term đ.Spa A has type đ âĽ(Spa A) : Type (?+1) but is expected to have type đ ?m_1[đ.restrict U (đą.to_đ locally_ringed_valued_space)] : Type (max ? (?+1))
Similarly if I switch the two terms around I get
type mismatch at application (Îť (x_1 : đ âĽ(Spa A)) (x_2 : đ ?m_1[x_1]), x_1 â x_2) (đ.Spa A) (đ.restrict U (đą.to_đ locally_ringed_valued_space)) term đ.restrict U (đą.to_đ locally_ringed_valued_space) has type đ âĽU : Type (max u (?+1)) but is expected to have type đ ?m_1[đ.Spa A] : Type (max ? (?+1))
Is this a limitation of notation somehow? I'd be surprised -- I'd be more likely to believe that I'm not using it correctly or I've made some other error. If notation is just syntactic sugar then as far as I can see the thing that's failing just directly translates into the thing that's succeeding.
Kevin Buzzard (Apr 27 2019 at 20:40):
Oh! I've got to the bottom of it and it's part of the story which I didn't mention. The \iso
notation is overloaded, and for some reason Lean isn't trying as hard to unify because it is not sure which function I mean. If I change my notation to an un-overloaded one then it works.
Kevin Buzzard (Apr 27 2019 at 20:41):
I guess Lean is being more cautious in trying to unify because it doesn't want to end up spending a lot of time trying to typecheck something which doesn't typecheck, or something.
Last updated: Dec 20 2023 at 11:08 UTC