Zulip Chat Archive

Stream: Is there code for X?

Topic: diagram chase thingy


Alex Kontorovich (Apr 16 2021 at 21:26):

Surely this exists already in mathlib? (And if not, where would it reasonably go?)

import data.set.basic

lemma commutative_diagram_thingy {α β A B : Type*} {f : α → β} {g : A → B} {mA : A → α} {mB : B → β}
   (h : f ∘ mA = mB ∘ g) : ∀ K : set B, mA '' (g ⁻¹' K) ⊆ f ⁻¹' (mB '' K) :=
begin
  rintros K x ⟨a , ha₁, rfl⟩,
  change (f ∘ mA) a ∈ _,
  rw h,
  refine ⟨g a, ha₁, rfl⟩,
end

Adam Topaz (Apr 16 2021 at 21:37):

Does tidy solve this goal?

Adam Topaz (Apr 16 2021 at 21:39):

Oh it wont

Alex Kontorovich (Apr 16 2021 at 21:39):

Almost! Just doesn't know that the diagram commutes?... How do I tell it?

Adam Topaz (Apr 16 2021 at 21:40):

Maybe you can change the hypothesis to be "for all x, blah blah"?

Adam Topaz (Apr 16 2021 at 21:52):

import data.set.basic

lemma commutative_diagram_thingy {α β A B : Type*} {f : α → β} {g : A → B} {mA : A → α} {mB : B → β}
   (h : ∀ x, f (mA x) = mB (g x)) : ∀ K : set B, mA '' (g ⁻¹' K) ⊆ f ⁻¹' (mB '' K) :=
by tidy

David Wärn (Apr 16 2021 at 22:10):

This is also not so bad to do by hand if you use lemmas instead of unfolding definitions

import data.set.basic

lemma commutative_diagram_thingy {α β A B : Type*} {f : α → β} {g : A → B} {mA : A → α} {mB : B → β}
   (h : f ∘ mA = mB ∘ g) : ∀ K : set B, mA '' (g ⁻¹' K) ⊆ f ⁻¹' (mB '' K) :=
begin
  intro K,
  rw [←set.image_subset_iff, ←set.image_comp, h, set.image_comp],
  apply set.image_subset,
  apply set.image_preimage_subset,
end

Last updated: Feb 28 2026 at 14:05 UTC