Zulip Chat Archive

Stream: mathlib4

Topic: projections of structure instances?


Kim Morrison (May 16 2024 at 11:19):

When I'm looking at a goal like

x : SemigroupCat
y : ({ obj := fun S  of (WithOne S), map := fun {X Y}  WithOne.map }.obj x)
 (WithOne.map (𝟙 x)) y = y

I want to start by reducing the { obj := ..., ... }.obj in the type of y to the value of the obj field.

I feel like I'm going crazy --- doesn't simp (or dsimp) usually do this out of the box?

Eric Wieser (May 16 2024 at 11:20):

When I've seen this fail in the past it's due to a semireducible type synonym being partially unfolded somewhere in the statement.

Kim Morrison (May 16 2024 at 11:21):

I can use simp only [Prefunctor.mk_obj] at y, but I can't make Prefunctor.mk_obj a simp lemma, because its head is a variable (after whnfR)!

Kim Morrison (May 16 2024 at 11:25):

Hmm, so far failing to see anything wrong even with pp.all.

Here's the code:

import Mathlib

open CategoryTheory

def adjoinOne' : SemigroupCat.{u}  MonCat.{u} where
  obj S := MonCat.of (WithOne S)
  map := WithOne.map
  map_id x := by ext y; dsimp at *; simp only [Prefunctor.mk_obj] at y; sorry
  map_comp := WithOne.map_comp

Kim Morrison (May 16 2024 at 11:25):

The simp only shouldn't be needed, I hope.

Eric Wieser (May 16 2024 at 11:27):

simp only at y works here (but only after the dsimp)

Eric Wieser (May 16 2024 at 11:28):

In fact, dsimp at y ⊢ works too, it's dsimp at * that fails

Kim Morrison (May 16 2024 at 11:28):

Okay, that is a bit weird.

Kim Morrison (May 16 2024 at 11:28):

Just simp at y seems fine too.

Eric Wieser (May 16 2024 at 11:29):

Well, this wouldn't be the first time that * behaves weirdly


Last updated: May 02 2025 at 03:31 UTC