Zulip Chat Archive

Stream: general

Topic: Type constructor for one obj but not the other?


debord (Sep 03 2024 at 22:51):

Hello. Here's the most MWE I can get from the context I'm working in:

import Mathlib.CategoryTheory.Products.Bifunctor

open CategoryTheory

universe v₁ u₁

variable (š’ž : Type u₁) [Category.{v₁} š’ž]

structure CatObj where
  F : š’žā„¤ š’ž

structure CatHom (F F' : CatObj š’ž) where
  Īø : NatTrans F.F F'.F

instance Cat : Category (CatObj š’ž) where
  Hom X Y := CatHom š’ž X Y
  id := sorry
  comp := sorry
  id_comp := sorry
  comp_id := sorry
  assoc := sorry

instance TPObj (F F' : CatObj š’ž) : CatObj š’ž where
  F := F'.F ā‹™ F.F

instance TPMapTheta (Īø : F ⟶ F') (Īø' : G ⟶ G') : NatTrans (TPObj š’ž F G).F (TPObj š’ž F' G').F where
  app A := Īø.Īø.app (G.F.obj A) ≫ F'.F.map (Īø'.Īø.app A)
  naturality := sorry

instance TPMap (Īø : F ⟶ F') (Īø' : G ⟶ G') : (TPObj š’ž F G) ⟶ (TPObj š’ž F' G') where
  Īø := TPMapTheta š’ž Īø Īø'

instance TP : ((CatObj š’ž) Ɨ (CatObj š’ž)) ℤ (CatObj š’ž) where
  obj C := TPObj š’ž C.1 C.2
  map F := TPMap š’ž F.1 F.2
  map_id X :=  by
    simp
    #check (TPMap š’ž (šŸ™ X.1) (šŸ™ X.2))
    #check šŸ™ (TPObj š’ž X.1 X.2)
    #check (TPMap š’ž (šŸ™ X.1) (šŸ™ X.2)).Īø
    #check (šŸ™ (TPObj š’ž X.1 X.2)).Īø

In the proof of map_id, why exactly is it the case that (TPMap š’ž (šŸ™ X.1) (šŸ™ X.2)) and šŸ™ (TPObj š’ž X.1 X.2) are both objects of type TPObj š’ž X.1 X.2 ⟶ TPObj š’ž X.1 X.2, and therefore should have the Īø constructor from CatHom, and (TPmap š’ž (šŸ™ X.1) (šŸ™ X.2)).Īø does indeed correctly check to have type NatTrans (TPObj š’ž X.1 X.2).F (TPObj š’ž X.1 X.2).F, but (šŸ™ (TPObj š’ž X.1 X.2)).Īø errors with

invalid field 'Īø', the environment does not contain 'Quiver.Hom.Īø'
  šŸ™ (TPObj š’ž X.1 X.2)
has type
  TPObj š’ž X.1 X.2 ⟶ TPObj š’ž X.1 X.2

and

invalid field notation, type is not of the form (C ...) where C is a constant
  šŸ™ (TPObj š’ž X.1 X.2)
has type
  CategoryStruct.toQuiver.1 (TPObj š’ž X.1 X.2) (TPObj š’ž X.1 X.2)

They're the same type, so why is the constructor accessible for one but not the other? What is even happening in the second error message, why is it occurring?

Kim Morrison (Sep 04 2024 at 02:54):

Surely

instance TPObj (F F' : CatObj š’ž) : CatObj š’ž where
  F := F'.F ā‹™ F.F

is wrong. This isn't a class, so you shouldn't be defining instances of it.

Kim Morrison (Sep 04 2024 at 02:56):

The problem is just that dot notation here doesn't know which structures to looking for the theta field in.

    #check CatHom.Īø (šŸ™ (TPObj š’ž X.1 X.2))

works fine.

debord (Sep 04 2024 at 07:42):

Ah, so it was that simple. Thank you, I managed to prove the theorem now. Thank you also for the tip on the instances, I had them as def at one point but I changed a lot of stuff while just trying things troubleshooting.


Last updated: May 02 2025 at 03:31 UTC