l3lab/ntp-mathlib huggingface dataset:
/-- Morphisms between two direct sums over a hom orthogonal family `s : ι → C`
are equivalent to block diagonal matrices,
with blocks indexed by `ι`,
and matrix entries in `i`-th block living in the endomorphisms of `s i`. -/
@[simps]
noncomputable def matrixDecomposition (o : HomOrthogonal s) {α β : Type} [Fintype α] [Fintype β]
    {f : α → ι} {g : β → ι} :
    ((⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)) ≃
      ∀ i : ι, Matrix (g ⁻¹' {i}) (f ⁻¹' {i}) (End (s i)) where
  toFun z i j k :=
    eqToHom
        (by
          rcases k with ⟨k, ⟨⟩⟩
          simp) ≫
      biproduct.components z k j ≫
        eqToHom
          (by
            rcases j with ⟨j, ⟨⟩⟩
            simp)
  invFun z :=
    biproduct.matrix fun j k =>
      if h : f j = g k then z (f j) ⟨k, by simp [h]⟩ ⟨j, by simp⟩ ≫ eqToHom (by simp [h]) else 0
  left_inv z := by
    ext j k
    simp only [biproduct.matrix_π, biproduct.ι_desc]
    split_ifs with h
    · simp
      rfl
    · symm
      apply o.eq_zero h
  right_inv z := by
    ext i ⟨j, w⟩ ⟨k, ⟨⟩⟩
    

Proof state:
case h.h.mk.h.mk.refl
C : Type u
inst✝⁴ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝³ : HasZeroMorphisms C
inst✝² : HasFiniteBiproducts C
o : HomOrthogonal s
α β : Type
inst✝¹ : Fintype α
inst✝ : Fintype β
f : α → ι
g : β → ι
z : (i : ι) → Matrix (↑(g ⁻¹' {i})) (↑(f ⁻¹' {i})) (End (s i))
j : β
k : α
w : j ∈ g ⁻¹' {f k}
⊢ (fun z i j k => eqToHom (_ : s i = s (f ↑k)) ≫ biproduct.components z ↑k ↑j ≫ eqToHom (_ : s (g ↑j) = s i))
      ((fun z =>
          biproduct.matrix fun j k =>
            if h : f j = g k then
              z (f j) { val := k, property := (_ : k ∈ g ⁻¹' {f j}) } { val := j, property := (_ : j ∈ f ⁻¹' {f j}) } ≫
                eqToHom (_ : s (f j) = s (g k))
            else 0)
        z)
      (f k) { val := j, property := w } { val := k, property := (_ : f k = f k) } =
    z (f k) { val := j, property := w } { val := k, property := (_ : f k = f k) }

Next tactic:
simp only [eqToHom_refl, biproduct.matrix_components, Category.id_comp]
/-- Morphisms between two direct sums over a hom orthogonal family `s : ι → C`
are equivalent to block diagonal matrices,
with blocks indexed by `ι`,
and matrix entries in `i`-th block living in the endomorphisms of `s i`. -/
@[simps]
noncomputable def matrixDecomposition (o : HomOrthogonal s) {α β : Type} [Fintype α] [Fintype β]
    {f : α → ι} {g : β → ι} :
    ((⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)) ≃
      ∀ i : ι, Matrix (g ⁻¹' {i}) (f ⁻¹' {i}) (End (s i)) where
  toFun z i j k :=
    eqToHom
        (by
          rcases k with ⟨k, ⟨⟩⟩
          simp) ≫
      biproduct.components z k j ≫
        eqToHom
          (by
            rcases j with ⟨j, ⟨⟩⟩
            simp)
  invFun z :=
    biproduct.matrix fun j k =>
      if h : f j = g k then z (f j) ⟨k, by simp [h]⟩ ⟨j, by simp⟩ ≫ eqToHom (by simp [h]) else 0
  left_inv z := by
    ext j k
    simp only [biproduct.matrix_π, biproduct.ι_desc]
    split_ifs with h
    · simp
      rfl
    · symm
      apply o.eq_zero h
  right_inv z := by
    ext i ⟨j, w⟩ ⟨k, ⟨⟩⟩
    simp only [eqToHom_refl, biproduct.matrix_components, Category.id_comp]
    

Proof state:
case h.h.mk.h.mk.refl
C : Type u
inst✝⁴ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝³ : HasZeroMorphisms C
inst✝² : HasFiniteBiproducts C
o : HomOrthogonal s
α β : Type
inst✝¹ : Fintype α
inst✝ : Fintype β
f : α → ι
g : β → ι
z : (i : ι) → Matrix (↑(g ⁻¹' {i})) (↑(f ⁻¹' {i})) (End (s i))
j : β
k : α
w : j ∈ g ⁻¹' {f k}
⊢ (if h : f k = g j then
        z (f k) { val := j, property := (_ : j ∈ g ⁻¹' {f k}) } { val := k, property := (_ : k ∈ f ⁻¹' {f k}) } ≫
          eqToHom (_ : s (f k) = s (g j))
      else 0) ≫
      eqToHom (_ : s (g ↑{ val := j, property := w }) = s (f k)) =
    z (f k) { val := j, property := w } { val := k, property := (_ : f k = f k) }

Next tactic:
split_ifs with h
/-- Morphisms between two direct sums over a hom orthogonal family `s : ι → C`
are equivalent to block diagonal matrices,
with blocks indexed by `ι`,
and matrix entries in `i`-th block living in the endomorphisms of `s i`. -/
@[simps]
noncomputable def matrixDecomposition (o : HomOrthogonal s) {α β : Type} [Fintype α] [Fintype β]
    {f : α → ι} {g : β → ι} :
    ((⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)) ≃
      ∀ i : ι, Matrix (g ⁻¹' {i}) (f ⁻¹' {i}) (End (s i)) where
  toFun z i j k :=
    eqToHom
        (by
          rcases k with ⟨k, ⟨⟩⟩
          simp) ≫
      biproduct.components z k j ≫
        eqToHom
          (by
            rcases j with ⟨j, ⟨⟩⟩
            simp)
  invFun z :=
    biproduct.matrix fun j k =>
      if h : f j = g k then z (f j) ⟨k, by simp [h]⟩ ⟨j, by simp⟩ ≫ eqToHom (by simp [h]) else 0
  left_inv z := by
    ext j k
    simp only [biproduct.matrix_π, biproduct.ι_desc]
    split_ifs with h
    · simp
      rfl
    · symm
      apply o.eq_zero h
  right_inv z := by
    ext i ⟨j, w⟩ ⟨k, ⟨⟩⟩
    simp only [eqToHom_refl, biproduct.matrix_components, Category.id_comp]
    split_ifs with h
    · 

Proof state:
case pos
C : Type u
inst✝⁴ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝³ : HasZeroMorphisms C
inst✝² : HasFiniteBiproducts C
o : HomOrthogonal s
α β : Type
inst✝¹ : Fintype α
inst✝ : Fintype β
f : α → ι
g : β → ι
z : (i : ι) → Matrix (↑(g ⁻¹' {i})) (↑(f ⁻¹' {i})) (End (s i))
j : β
k : α
w : j ∈ g ⁻¹' {f k}
h : f k = g j
⊢ (z (f k) { val := j, property := (_ : j ∈ g ⁻¹' {f k}) } { val := k, property := (_ : k ∈ f ⁻¹' {f k}) } ≫
        eqToHom (_ : s (f k) = s (g j))) ≫
      eqToHom (_ : s (g ↑{ val := j, property := w }) = s (f k)) =
    z (f k) { val := j, property := w } { val := k, property := (_ : f k = f k) }

Next tactic:
simp
/-- Morphisms between two direct sums over a hom orthogonal family `s : ι → C`
are equivalent to block diagonal matrices,
with blocks indexed by `ι`,
and matrix entries in `i`-th block living in the endomorphisms of `s i`. -/
@[simps]
noncomputable def matrixDecomposition (o : HomOrthogonal s) {α β : Type} [Fintype α] [Fintype β]
    {f : α → ι} {g : β → ι} :
    ((⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)) ≃
      ∀ i : ι, Matrix (g ⁻¹' {i}) (f ⁻¹' {i}) (End (s i)) where
  toFun z i j k :=
    eqToHom
        (by
          rcases k with ⟨k, ⟨⟩⟩
          simp) ≫
      biproduct.components z k j ≫
        eqToHom
          (by
            rcases j with ⟨j, ⟨⟩⟩
            simp)
  invFun z :=
    biproduct.matrix fun j k =>
      if h : f j = g k then z (f j) ⟨k, by simp [h]⟩ ⟨j, by simp⟩ ≫ eqToHom (by simp [h]) else 0
  left_inv z := by
    ext j k
    simp only [biproduct.matrix_π, biproduct.ι_desc]
    split_ifs with h
    · simp
      rfl
    · symm
      apply o.eq_zero h
  right_inv z := by
    ext i ⟨j, w⟩ ⟨k, ⟨⟩⟩
    simp only [eqToHom_refl, biproduct.matrix_components, Category.id_comp]
    split_ifs with h
    · simp
    · 

Proof state:
case neg
C : Type u
inst✝⁴ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝³ : HasZeroMorphisms C
inst✝² : HasFiniteBiproducts C
o : HomOrthogonal s
α β : Type
inst✝¹ : Fintype α
inst✝ : Fintype β
f : α → ι
g : β → ι
z : (i : ι) → Matrix (↑(g ⁻¹' {i})) (↑(f ⁻¹' {i})) (End (s i))
j : β
k : α
w : j ∈ g ⁻¹' {f k}
h : ¬f k = g j
⊢ 0 ≫ eqToHom (_ : s (g ↑{ val := j, property := w }) = s (f k)) =
    z (f k) { val := j, property := w } { val := k, property := (_ : f k = f k) }

Next tactic:
exfalso
/-- Morphisms between two direct sums over a hom orthogonal family `s : ι → C`
are equivalent to block diagonal matrices,
with blocks indexed by `ι`,
and matrix entries in `i`-th block living in the endomorphisms of `s i`. -/
@[simps]
noncomputable def matrixDecomposition (o : HomOrthogonal s) {α β : Type} [Fintype α] [Fintype β]
    {f : α → ι} {g : β → ι} :
    ((⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)) ≃
      ∀ i : ι, Matrix (g ⁻¹' {i}) (f ⁻¹' {i}) (End (s i)) where
  toFun z i j k :=
    eqToHom
        (by
          rcases k with ⟨k, ⟨⟩⟩
          simp) ≫
      biproduct.components z k j ≫
        eqToHom
          (by
            rcases j with ⟨j, ⟨⟩⟩
            simp)
  invFun z :=
    biproduct.matrix fun j k =>
      if h : f j = g k then z (f j) ⟨k, by simp [h]⟩ ⟨j, by simp⟩ ≫ eqToHom (by simp [h]) else 0
  left_inv z := by
    ext j k
    simp only [biproduct.matrix_π, biproduct.ι_desc]
    split_ifs with h
    · simp
      rfl
    · symm
      apply o.eq_zero h
  right_inv z := by
    ext i ⟨j, w⟩ ⟨k, ⟨⟩⟩
    simp only [eqToHom_refl, biproduct.matrix_components, Category.id_comp]
    split_ifs with h
    · simp
    · exfalso
      

Proof state:
case neg.h
C : Type u
inst✝⁴ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝³ : HasZeroMorphisms C
inst✝² : HasFiniteBiproducts C
o : HomOrthogonal s
α β : Type
inst✝¹ : Fintype α
inst✝ : Fintype β
f : α → ι
g : β → ι
z : (i : ι) → Matrix (↑(g ⁻¹' {i})) (↑(f ⁻¹' {i})) (End (s i))
j : β
k : α
w : j ∈ g ⁻¹' {f k}
h : ¬f k = g j
⊢ False

Next tactic:
exact h w.symm
/-- `HomOrthogonal.matrixDecomposition` as an additive equivalence. -/
@[simps]
noncomputable def matrixDecompositionAddEquiv (o : HomOrthogonal s) {α β : Type} [Fintype α]
    [Fintype β] {f : α → ι} {g : β → ι} :
    ((⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)) ≃+
      ∀ i : ι, Matrix (g ⁻¹' {i}) (f ⁻¹' {i}) (End (s i)) :=
  { o.matrixDecomposition with
    map_add' := fun w z => by
      

Proof state:
C : Type u
inst✝⁴ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝³ : Preadditive C
inst✝² : HasFiniteBiproducts C
o : HomOrthogonal s
α β : Type
inst✝¹ : Fintype α
inst✝ : Fintype β
f : α → ι
g : β → ι
src✝ : ((⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)) ≃
  ((i : ι) → Matrix (↑((fun b => g b) ⁻¹' {i})) (↑((fun a => f a) ⁻¹' {i})) (End (s i))) :=
  matrixDecomposition o
w z : (⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)
⊢ Equiv.toFun
      { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
        right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
      (w + z) =
    Equiv.toFun
        { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
          right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
        w +
      Equiv.toFun
        { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
          right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
        z

Next tactic:
ext
/-- `HomOrthogonal.matrixDecomposition` as an additive equivalence. -/
@[simps]
noncomputable def matrixDecompositionAddEquiv (o : HomOrthogonal s) {α β : Type} [Fintype α]
    [Fintype β] {f : α → ι} {g : β → ι} :
    ((⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)) ≃+
      ∀ i : ι, Matrix (g ⁻¹' {i}) (f ⁻¹' {i}) (End (s i)) :=
  { o.matrixDecomposition with
    map_add' := fun w z => by
      ext
      

Proof state:
case h.a.h
C : Type u
inst✝⁴ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝³ : Preadditive C
inst✝² : HasFiniteBiproducts C
o : HomOrthogonal s
α β : Type
inst✝¹ : Fintype α
inst✝ : Fintype β
f : α → ι
g : β → ι
src✝ : ((⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)) ≃
  ((i : ι) → Matrix (↑((fun b => g b) ⁻¹' {i})) (↑((fun a => f a) ⁻¹' {i})) (End (s i))) :=
  matrixDecomposition o
w z : (⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)
x✝¹ : ι
i✝ : ↑(g ⁻¹' {x✝¹})
x✝ : ↑(f ⁻¹' {x✝¹})
⊢ Equiv.toFun
      { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
        right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
      (w + z) x✝¹ i✝ x✝ =
    (Equiv.toFun
          { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
            right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
          w +
        Equiv.toFun
          { toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
            right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }
          z)
      x✝¹ i✝ x✝

Next tactic:
dsimp [biproduct.components]
/-- `HomOrthogonal.matrixDecomposition` as an additive equivalence. -/
@[simps]
noncomputable def matrixDecompositionAddEquiv (o : HomOrthogonal s) {α β : Type} [Fintype α]
    [Fintype β] {f : α → ι} {g : β → ι} :
    ((⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)) ≃+
      ∀ i : ι, Matrix (g ⁻¹' {i}) (f ⁻¹' {i}) (End (s i)) :=
  { o.matrixDecomposition with
    map_add' := fun w z => by
      ext
      dsimp [biproduct.components]
      

Proof state:
case h.a.h
C : Type u
inst✝⁴ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝³ : Preadditive C
inst✝² : HasFiniteBiproducts C
o : HomOrthogonal s
α β : Type
inst✝¹ : Fintype α
inst✝ : Fintype β
f : α → ι
g : β → ι
src✝ : ((⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)) ≃
  ((i : ι) → Matrix (↑((fun b => g b) ⁻¹' {i})) (↑((fun a => f a) ⁻¹' {i})) (End (s i))) :=
  matrixDecomposition o
w z : (⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)
x✝¹ : ι
i✝ : ↑(g ⁻¹' {x✝¹})
x✝ : ↑(f ⁻¹' {x✝¹})
⊢ eqToHom (_ : s x✝¹ = s (f ↑x✝)) ≫
      (biproduct.ι (fun a => s (f a)) ↑x✝ ≫ (w + z) ≫ biproduct.π (fun b => s (g b)) ↑i✝) ≫
        eqToHom (_ : s (g ↑i✝) = s x✝¹) =
    eqToHom (_ : s x✝¹ = s (f ↑x✝)) ≫
        (biproduct.ι (fun a => s (f a)) ↑x✝ ≫ w ≫ biproduct.π (fun b => s (g b)) ↑i✝) ≫
          eqToHom (_ : s (g ↑i✝) = s x✝¹) +
      eqToHom (_ : s x✝¹ = s (f ↑x✝)) ≫
        (biproduct.ι (fun a => s (f a)) ↑x✝ ≫ z ≫ biproduct.π (fun b => s (g b)) ↑i✝) ≫ eqToHom (_ : s (g ↑i✝) = s x✝¹)

Next tactic:
simp
@[simp]
theorem matrixDecomposition_id (o : HomOrthogonal s) {α : Type} [Fintype α] {f : α → ι} (i : ι) :
    o.matrixDecomposition (𝟙 (⨁ fun a => s (f a))) i = 1 := by
  

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
o : HomOrthogonal s
α : Type
inst✝ : Fintype α
f : α → ι
i : ι
⊢ (matrixDecomposition o) (𝟙 (⨁ fun a => s (f a))) i = 1

Next tactic:
ext ⟨b, ⟨⟩⟩ ⟨a, j_property⟩
@[simp]
theorem matrixDecomposition_id (o : HomOrthogonal s) {α : Type} [Fintype α] {f : α → ι} (i : ι) :
    o.matrixDecomposition (𝟙 (⨁ fun a => s (f a))) i = 1 := by
  ext ⟨b, ⟨⟩⟩ ⟨a, j_property⟩
  

Proof state:
case a.mk.refl.h.mk
C : Type u
inst✝³ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
o : HomOrthogonal s
α : Type
inst✝ : Fintype α
f : α → ι
b a : α
j_property : a ∈ (fun a => f a) ⁻¹' {(fun b => f b) b}
⊢ (matrixDecomposition o) (𝟙 (⨁ fun a => s (f a))) ((fun b => f b) b)
      { val := b, property := (_ : (fun b => f b) b = (fun b => f b) b) } { val := a, property := j_property } =
    OfNat.ofNat 1 { val := b, property := (_ : (fun b => f b) b = (fun b => f b) b) }
      { val := a, property := j_property }

Next tactic:
simp only [Set.mem_preimage, Set.mem_singleton_iff] at j_property
@[simp]
theorem matrixDecomposition_id (o : HomOrthogonal s) {α : Type} [Fintype α] {f : α → ι} (i : ι) :
    o.matrixDecomposition (𝟙 (⨁ fun a => s (f a))) i = 1 := by
  ext ⟨b, ⟨⟩⟩ ⟨a, j_property⟩
  simp only [Set.mem_preimage, Set.mem_singleton_iff] at j_property
  

Proof state:
case a.mk.refl.h.mk
C : Type u
inst✝³ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
o : HomOrthogonal s
α : Type
inst✝ : Fintype α
f : α → ι
b a : α
j_property✝ : a ∈ (fun a => f a) ⁻¹' {(fun b => f b) b}
j_property : f a = f b
⊢ (matrixDecomposition o) (𝟙 (⨁ fun a => s (f a))) ((fun b => f b) b)
      { val := b, property := (_ : (fun b => f b) b = (fun b => f b) b) } { val := a, property := j_property✝ } =
    OfNat.ofNat 1 { val := b, property := (_ : (fun b => f b) b = (fun b => f b) b) }
      { val := a, property := j_property✝ }

Next tactic:
simp only [Category.comp_id, Category.id_comp, Category.assoc, End.one_def, eqToHom_refl,
    Matrix.one_apply, HomOrthogonal.matrixDecomposition_apply, biproduct.components]
@[simp]
theorem matrixDecomposition_id (o : HomOrthogonal s) {α : Type} [Fintype α] {f : α → ι} (i : ι) :
    o.matrixDecomposition (𝟙 (⨁ fun a => s (f a))) i = 1 := by
  ext ⟨b, ⟨⟩⟩ ⟨a, j_property⟩
  simp only [Set.mem_preimage, Set.mem_singleton_iff] at j_property
  simp only [Category.comp_id, Category.id_comp, Category.assoc, End.one_def, eqToHom_refl,
    Matrix.one_apply, HomOrthogonal.matrixDecomposition_apply, biproduct.components]
  

Proof state:
case a.mk.refl.h.mk
C : Type u
inst✝³ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
o : HomOrthogonal s
α : Type
inst✝ : Fintype α
f : α → ι
b a : α
j_property✝ : a ∈ (fun a => f a) ⁻¹' {(fun b => f b) b}
j_property : f a = f b
⊢ eqToHom (_ : s (f b) = s (f ↑{ val := a, property := j_property✝ })) ≫
      biproduct.ι (fun a => s (f a)) a ≫ biproduct.π (fun b => s (f b)) b =
    if { val := b, property := (_ : (fun b => f b) b = (fun b => f b) b) } = { val := a, property := j_property✝ } then
      𝟙 (s (f b))
    else 0

Next tactic:
split_ifs with h
@[simp]
theorem matrixDecomposition_id (o : HomOrthogonal s) {α : Type} [Fintype α] {f : α → ι} (i : ι) :
    o.matrixDecomposition (𝟙 (⨁ fun a => s (f a))) i = 1 := by
  ext ⟨b, ⟨⟩⟩ ⟨a, j_property⟩
  simp only [Set.mem_preimage, Set.mem_singleton_iff] at j_property
  simp only [Category.comp_id, Category.id_comp, Category.assoc, End.one_def, eqToHom_refl,
    Matrix.one_apply, HomOrthogonal.matrixDecomposition_apply, biproduct.components]
  split_ifs with h
  · 

Proof state:
case pos
C : Type u
inst✝³ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
o : HomOrthogonal s
α : Type
inst✝ : Fintype α
f : α → ι
b a : α
j_property✝ : a ∈ (fun a => f a) ⁻¹' {(fun b => f b) b}
j_property : f a = f b
h : { val := b, property := (_ : (fun b => f b) b = (fun b => f b) b) } = { val := a, property := j_property✝ }
⊢ eqToHom (_ : s (f b) = s (f ↑{ val := a, property := j_property✝ })) ≫
      biproduct.ι (fun a => s (f a)) a ≫ biproduct.π (fun b => s (f b)) b =
    𝟙 (s (f b))

Next tactic:
cases h
@[simp]
theorem matrixDecomposition_id (o : HomOrthogonal s) {α : Type} [Fintype α] {f : α → ι} (i : ι) :
    o.matrixDecomposition (𝟙 (⨁ fun a => s (f a))) i = 1 := by
  ext ⟨b, ⟨⟩⟩ ⟨a, j_property⟩
  simp only [Set.mem_preimage, Set.mem_singleton_iff] at j_property
  simp only [Category.comp_id, Category.id_comp, Category.assoc, End.one_def, eqToHom_refl,
    Matrix.one_apply, HomOrthogonal.matrixDecomposition_apply, biproduct.components]
  split_ifs with h
  · cases h
    

Proof state:
case pos.refl
C : Type u
inst✝³ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
o : HomOrthogonal s
α : Type
inst✝ : Fintype α
f : α → ι
b : α
j_property✝ : b ∈ (fun a => f a) ⁻¹' {(fun b => f b) b}
j_property : f b = f b
⊢ eqToHom (_ : s (f b) = s (f ↑{ val := b, property := j_property✝ })) ≫
      biproduct.ι (fun a => s (f a)) b ≫ biproduct.π (fun b => s (f b)) b =
    𝟙 (s (f b))

Next tactic:
simp
@[simp]
theorem matrixDecomposition_id (o : HomOrthogonal s) {α : Type} [Fintype α] {f : α → ι} (i : ι) :
    o.matrixDecomposition (𝟙 (⨁ fun a => s (f a))) i = 1 := by
  ext ⟨b, ⟨⟩⟩ ⟨a, j_property⟩
  simp only [Set.mem_preimage, Set.mem_singleton_iff] at j_property
  simp only [Category.comp_id, Category.id_comp, Category.assoc, End.one_def, eqToHom_refl,
    Matrix.one_apply, HomOrthogonal.matrixDecomposition_apply, biproduct.components]
  split_ifs with h
  · cases h
    simp
  · 

Proof state:
case neg
C : Type u
inst✝³ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
o : HomOrthogonal s
α : Type
inst✝ : Fintype α
f : α → ι
b a : α
j_property✝ : a ∈ (fun a => f a) ⁻¹' {(fun b => f b) b}
j_property : f a = f b
h : ¬{ val := b, property := (_ : (fun b => f b) b = (fun b => f b) b) } = { val := a, property := j_property✝ }
⊢ eqToHom (_ : s (f b) = s (f ↑{ val := a, property := j_property✝ })) ≫
      biproduct.ι (fun a => s (f a)) a ≫ biproduct.π (fun b => s (f b)) b =
    0

Next tactic:
simp at h
@[simp]
theorem matrixDecomposition_id (o : HomOrthogonal s) {α : Type} [Fintype α] {f : α → ι} (i : ι) :
    o.matrixDecomposition (𝟙 (⨁ fun a => s (f a))) i = 1 := by
  ext ⟨b, ⟨⟩⟩ ⟨a, j_property⟩
  simp only [Set.mem_preimage, Set.mem_singleton_iff] at j_property
  simp only [Category.comp_id, Category.id_comp, Category.assoc, End.one_def, eqToHom_refl,
    Matrix.one_apply, HomOrthogonal.matrixDecomposition_apply, biproduct.components]
  split_ifs with h
  · cases h
    simp
  · simp at h
    -- porting note: used to be `convert comp_zero`, but that does not work anymore
    

Proof state:
case neg
C : Type u
inst✝³ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
o : HomOrthogonal s
α : Type
inst✝ : Fintype α
f : α → ι
b a : α
j_property✝ : a ∈ (fun a => f a) ⁻¹' {(fun b => f b) b}
j_property : f a = f b
h : ¬b = a
⊢ eqToHom (_ : s (f b) = s (f ↑{ val := a, property := j_property✝ })) ≫
      biproduct.ι (fun a => s (f a)) a ≫ biproduct.π (fun b => s (f b)) b =
    0

Next tactic:
have : biproduct.ι (fun a ↦ s (f a)) a ≫ biproduct.π (fun b ↦ s (f b)) b = 0 := by
      simpa using biproduct.ι_π_ne _ (Ne.symm h)
@[simp]
theorem matrixDecomposition_id (o : HomOrthogonal s) {α : Type} [Fintype α] {f : α → ι} (i : ι) :
    o.matrixDecomposition (𝟙 (⨁ fun a => s (f a))) i = 1 := by
  ext ⟨b, ⟨⟩⟩ ⟨a, j_property⟩
  simp only [Set.mem_preimage, Set.mem_singleton_iff] at j_property
  simp only [Category.comp_id, Category.id_comp, Category.assoc, End.one_def, eqToHom_refl,
    Matrix.one_apply, HomOrthogonal.matrixDecomposition_apply, biproduct.components]
  split_ifs with h
  · cases h
    simp
  · simp at h
    -- porting note: used to be `convert comp_zero`, but that does not work anymore
    have : biproduct.ι (fun a ↦ s (f a)) a ≫ biproduct.π (fun b ↦ s (f b)) b = 0 := by
      

Proof state:
C : Type u
inst✝³ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
o : HomOrthogonal s
α : Type
inst✝ : Fintype α
f : α → ι
b a : α
j_property✝ : a ∈ (fun a => f a) ⁻¹' {(fun b => f b) b}
j_property : f a = f b
h : ¬b = a
⊢ biproduct.ι (fun a => s (f a)) a ≫ biproduct.π (fun b => s (f b)) b = 0

Next tactic:
simpa using biproduct.ι_π_ne _ (Ne.symm h)
@[simp]
theorem matrixDecomposition_id (o : HomOrthogonal s) {α : Type} [Fintype α] {f : α → ι} (i : ι) :
    o.matrixDecomposition (𝟙 (⨁ fun a => s (f a))) i = 1 := by
  ext ⟨b, ⟨⟩⟩ ⟨a, j_property⟩
  simp only [Set.mem_preimage, Set.mem_singleton_iff] at j_property
  simp only [Category.comp_id, Category.id_comp, Category.assoc, End.one_def, eqToHom_refl,
    Matrix.one_apply, HomOrthogonal.matrixDecomposition_apply, biproduct.components]
  split_ifs with h
  · cases h
    simp
  · simp at h
    -- porting note: used to be `convert comp_zero`, but that does not work anymore
    have : biproduct.ι (fun a ↦ s (f a)) a ≫ biproduct.π (fun b ↦ s (f b)) b = 0 := by
      simpa using biproduct.ι_π_ne _ (Ne.symm h)
    

Proof state:
case neg
C : Type u
inst✝³ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝² : Preadditive C
inst✝¹ : HasFiniteBiproducts C
o : HomOrthogonal s
α : Type
inst✝ : Fintype α
f : α → ι
b a : α
j_property✝ : a ∈ (fun a => f a) ⁻¹' {(fun b => f b) b}
j_property : f a = f b
h : ¬b = a
this : biproduct.ι (fun a => s (f a)) a ≫ biproduct.π (fun b => s (f b)) b = 0
⊢ eqToHom (_ : s (f b) = s (f ↑{ val := a, property := j_property✝ })) ≫
      biproduct.ι (fun a => s (f a)) a ≫ biproduct.π (fun b => s (f b)) b =
    0

Next tactic:
rw [this, comp_zero]
theorem matrixDecomposition_comp (o : HomOrthogonal s) {α β γ : Type} [Fintype α] [Fintype β]
    [Fintype γ] {f : α → ι} {g : β → ι} {h : γ → ι} (z : (⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b))
    (w : (⨁ fun b => s (g b)) ⟶ ⨁ fun c => s (h c)) (i : ι) :
    o.matrixDecomposition (z ≫ w) i = o.matrixDecomposition w i * o.matrixDecomposition z i := by
  

Proof state:
C : Type u
inst✝⁵ : Category.{v, u} C
ι : Type u_1
s : ι → C
inst✝⁴ : Preadditive C
inst✝³ : HasFiniteBiproducts C
o : HomOrthogonal s
α β γ : Type
inst✝² : Fintype α
inst✝¹ : Fintype β
inst✝ : Fintype γ
f : α → ι
g : β → ι
h : γ → ι
z : (⨁ fun a => s (f a)) ⟶ ⨁ fun b => s (g b)
w : (⨁ fun b => s (g b)) ⟶ ⨁ fun c => s (h c)
i : ι
⊢ (matrixDecomposition o) (z ≫ w) i = (matrixDecomposition o) w i * (matrixDecomposition o) z i

Next tactic:
ext ⟨c, ⟨⟩⟩ ⟨a, j_property⟩