Zulip Chat Archive

Stream: mathlib4

Topic: Quiver C^op synthesis failure


Matthew Ballard (May 08 2024 at 19:48):

Why does the following #synth fail:

set_option autoImplicit false

universe w v v₁ v₂ v₃ u u₁ u₂ u₃

class Quiver (V : Type u) where
Hom : V  V  Sort v

infixr:10 " ⟶ " => Quiver.Hom

structure Opposite (α : Type u) :=
  op :: unop : α

notation:max
α "ᵒᵖ" => Opposite α

open Opposite

variable {C : Type u₁}

variable [Quiver.{v₁} C]

instance Quiver.opposite {V} [Quiver V] : Quiver Vᵒᵖ :=
  fun a b => (unop b  unop a)ᵒᵖ

set_option trace.Meta.isDefEq true in
set_option trace.Meta.synthInstance true in
#synth Quiver Cᵒᵖ

Matthew Ballard (May 08 2024 at 20:05):

structure Opposite (α : Sort w)

fixes it

Matthew Ballard (May 08 2024 at 20:15):

So does

class Quiver (V : Type u) where
Hom : V  V  Type v

Matthew Ballard (May 08 2024 at 20:47):

What is the reason that the objects of a category are in Type u and not Sort u? I seem to remember some discussion of this before but cannot locate it

Joël Riou (May 08 2024 at 21:00):

Morphisms in quivers are allowed to be in Prop in order to allow graphs without multiple arrows.

Matthew Ballard (May 08 2024 at 21:01):

I saw that when I tried to change it and things broke fast :)

Matthew Ballard (May 08 2024 at 21:01):

But what about objects?

Matthew Ballard (May 08 2024 at 21:02):

Nothing seems to break if we do

class Quiver (V : Sort u)

Joël Riou (May 08 2024 at 21:04):

I would say there is little mathematical justification for doing this.

Matthew Ballard (May 09 2024 at 01:27):

Matthew Ballard said:

Nothing seems to break if we do

class Quiver (V : Sort u)

One thing broke ... and then everything did.

Kevin Buzzard (May 09 2024 at 10:22):

IIRC this was how it was in lean 3 -- at some point there was a refactor which allowed sorts but there were problems so they were refactored back? @Kim Morrison do you remember any more of the story?

Kim Morrison (May 09 2024 at 11:32):

Yeah, I tried it twice in the early days, both failures. I really can't remember why I want to, however. :-)

Matthew Ballard (May 09 2024 at 12:59):

Made Hom return a type and fixed enough CategoryTheory to build AlgebraicGeometry. Very anecdotal: elaboration is down about 10% for GammaSpecAdjunction which corresponds to a 5% speed up in the file.

I don't think this is the solution. I just think Lean is struggling with solving level constraints in the presence of autogenerated level metavariables

Matthew Ballard (May 09 2024 at 13:00):

This is blocking otherwise easy unifications and making it take longer, often much longer.

Matthew Ballard (May 09 2024 at 13:01):

I am also trying to create a minimized (ha!) example of the issue. But, I am learning how much AG touches


Last updated: May 02 2025 at 03:31 UTC