Zulip Chat Archive
Stream: mathlib4
Topic: !4#2821
Jeremy Tan (Mar 11 2023 at 19:07):
In the last theorem
@[simps!]
def Functor.toOplaxFunctor (F : I ⥤ B) : OplaxFunctor (LocallyDiscrete I) B where
obj := F.obj
map X Y f := F.map f.as
map₂ i j f g η := eqToHom (congr_arg _ (eq_of_hom η))
mapId i := eqToHom (F.map_id i)
mapComp i j k f g := eqToHom (F.map_comp f.as g.as)
#align category_theory.functor.to_oplax_functor CategoryTheory.Functor.toOplaxFunctor
how can this kind of error message pop up?
synthesized type class instance is not definitionally equal to expression inferred by typing rules, synthesized
CategoryStruct.toQuiver
inferred
CategoryStruct.toQuiver
And how do I fix the "failed to synthesize instance" errors further up?
Kevin Buzzard (Mar 11 2023 at 19:19):
What does the error look like with set_option pp.all true
on? (put it on a line of its own before the declaration)
Eric Wieser (Mar 11 2023 at 19:30):
This error usually means you can't use the where
syntax and have to use @SomeStructure.mk (field := val)
instead
Eric Wieser (Mar 11 2023 at 19:30):
Though that depends which line the error appears on
Adam Topaz (Mar 11 2023 at 20:25):
I think you need to fix the errors in the beginning of the file before worrying about the error in the last definition.
Adam Topaz (Mar 11 2023 at 20:38):
I only took a quick look at this file, but it seems that there are some subtle points that will show up in porting this file due to some type synonyms being used (and possibly abused in mathlib3).
Adam Topaz (Mar 11 2023 at 21:00):
I got the file to build (and pushed).
Jeremy Tan (Mar 12 2023 at 08:13):
!4#2821 the mathlib3 proof almost works perfectly in mathlib4, but at the very start the coercion is applied too strongly resulting in a rewrite failure.
I could split into cases based on the comparison between 1, a and b but that would look a bit ungainly.
Should I rewrite the proof like that or is there a more elegant way around this?
Eric Wieser (Mar 12 2023 at 08:45):
I will take a look today
Jeremy Tan (Mar 12 2023 at 09:09):
Specifically ↑(a - (b - 1))
gets reduced to (↑a - (↑b - 1))
at the start and it can't be restored without introducing assumptions (new goals) on a and b
Jeremy Tan (Mar 12 2023 at 09:10):
The thing is, since the overarching field is now a division ring K
instead of only a semiring S
, I should be able to rewrite (↑a - (↑b - 1))
back to ↑(a - (b - 1))
without generating assumptions since all elements now have additive inverses, but I can't see a function to do that
Yaël Dillies (Mar 12 2023 at 09:56):
Insert brackets and coercion arrows so that Lean reads it as the intended thing again.
Jeremy Tan (Mar 12 2023 at 10:07):
is there any other kind of coercion arrow other than ↑
?
Jeremy Tan (Mar 12 2023 at 10:12):
Also this is not about introducing a coercion, but more about preventing one from rewriting the intended term
Jeremy Tan (Mar 12 2023 at 10:12):
(I am AFK right now for dinner)
Yaël Dillies (Mar 12 2023 at 10:14):
Yes there are other kinds of coercion, but here it's just a matter of writing ↑(a - (b - 1))
instead of a - (b - 1)
.
Jeremy Tan (Mar 12 2023 at 10:25):
whee, pushed the hotfix on mobile and the build succeeded! Thank you
Eric Wieser (Mar 12 2023 at 11:15):
I pushed some more fixes; there was no need to rewrite the proofs; one error was caused by implicit argument changes, and the other was a name clash
Last updated: Dec 20 2023 at 11:08 UTC