-- Mathlib/LinearAlgebra/Matrix/Diagonal.lean
theorem ker_diagonal_toLin' [DecidableEq m] (w : m → K) :
    ker (toLin' (diagonal w)) =
      ⨆ i ∈ { i | w i = 0 }, LinearMap.range (LinearMap.single K (fun _ => K) i)

Proof state:
m : Type u_1
inst✝² : Fintype m
K : Type u
inst✝¹ : Semifield K
inst✝ : DecidableEq m
w : m → K
this : ∀ (i : m), ker (proj i ∘ₗ toLin' (diagonal w)) = comap (toLin' (diagonal w)) (ker (proj i))
⊢ ⨅ i, ⨅ (_ : w i ≠ 0), ker (proj i) = ⨆ i ∈ {i | w i = 0}, LinearMap.range (single K (fun x => K) i)

Tactic:
have : univ ⊆ { i : m | w i = 0 } ∪ { i : m | w i = 0 }ᶜ := by rw [Set.union_compl_self]

Result:
m : Type u_1
inst✝² : Fintype m
K : Type u
inst✝¹ : Semifield K
inst✝ : DecidableEq m
w : m → K
this✝ : ∀ (i : m), ker (proj i ∘ₗ toLin' (diagonal w)) = comap (toLin' (diagonal w)) (ker (proj i))
this : univ ⊆ {i | w i = 0} ∪ {i | w i = 0}ᶜ
⊢ ⨅ i, ⨅ (_ : w i ≠ 0), ker (proj i) = ⨆ i ∈ {i | w i = 0}, LinearMap.range (single K (fun x => K) i)

Proof state:
m : Type u_1
inst✝² : Fintype m
K : Type u
inst✝¹ : Semifield K
inst✝ : DecidableEq m
w : m → K
this : ∀ (i : m), ker (proj i ∘ₗ toLin' (diagonal w)) = comap (toLin' (diagonal w)) (ker (proj i))
⊢ univ ⊆ {i | w i = 0} ∪ {i | w i = 0}ᶜ

Tactic:
rw [Set.union_compl_self]

Result:
no goals

Proof state:
m : Type u_1
inst✝² : Fintype m
K : Type u
inst✝¹ : Semifield K
inst✝ : DecidableEq m
w : m → K
this : ∀ (i : m), ker (proj i ∘ₗ toLin' (diagonal w)) = comap (toLin' (diagonal w)) (ker (proj i))
⊢ ⨅ i, comap (toLin' (diagonal w)) (ker (proj i)) = ⨆ i ∈ {i | w i = 0}, LinearMap.range (single K (fun x => K) i)

Tactic:
simp only [comap_iInf, ← this, proj_diagonal, ker_smul']

Result:
m : Type u_1
inst✝² : Fintype m
K : Type u
inst✝¹ : Semifield K
inst✝ : DecidableEq m
w : m → K
this : ∀ (i : m), ker (proj i ∘ₗ toLin' (diagonal w)) = comap (toLin' (diagonal w)) (ker (proj i))
⊢ ⨅ i, ⨅ (_ : w i ≠ 0), ker (proj i) = ⨆ i ∈ {i | w i = 0}, LinearMap.range (single K (fun x => K) i)

Proof state:
m : Type u_1
inst✝² : Fintype m
K : Type u
inst✝¹ : Semifield K
inst✝ : DecidableEq m
w : m → K
⊢ ⨅ i, comap (toLin' (diagonal w)) (ker (proj i)) = ⨆ i ∈ {i | w i = 0}, LinearMap.range (single K (fun x => K) i)

Tactic:
have := fun i : m => ker_comp (toLin' (diagonal w)) (proj i)

Result:
m : Type u_1
inst✝² : Fintype m
K : Type u
inst✝¹ : Semifield K
inst✝ : DecidableEq m
w : m → K
this : ∀ (i : m), ker (proj i ∘ₗ toLin' (diagonal w)) = comap (toLin' (diagonal w)) (ker (proj i))
⊢ ⨅ i, comap (toLin' (diagonal w)) (ker (proj i)) = ⨆ i ∈ {i | w i = 0}, LinearMap.range (single K (fun x => K) i)

Proof state:
m : Type u_1
inst✝² : Fintype m
K : Type u
inst✝¹ : Semifield K
inst✝ : DecidableEq m
w : m → K
this✝ : ∀ (i : m), ker (proj i ∘ₗ toLin' (diagonal w)) = comap (toLin' (diagonal w)) (ker (proj i))
this : univ ⊆ {i | w i = 0} ∪ {i | w i = 0}ᶜ
⊢ ⨅ i, ⨅ (_ : w i ≠ 0), ker (proj i) = ⨆ i ∈ {i | w i = 0}, LinearMap.range (single K (fun x => K) i)

Tactic:
exact (iSup_range_single_eq_iInf_ker_proj K (fun _ : m => K) disjoint_compl_right this
  (Set.toFinite _)).symm

Result:
no goals

Proof state:
m : Type u_1
inst✝² : Fintype m
K : Type u
inst✝¹ : Semifield K
inst✝ : DecidableEq m
w : m → K
⊢ ker (toLin' (diagonal w)) = ⨆ i ∈ {i | w i = 0}, LinearMap.range (single K (fun x => K) i)

Tactic:
rw [← comap_bot, ← iInf_ker_proj, comap_iInf]

Result:
m : Type u_1
inst✝² : Fintype m
K : Type u
inst✝¹ : Semifield K
inst✝ : DecidableEq m
w : m → K
⊢ ⨅ i, comap (toLin' (diagonal w)) (ker (proj i)) = ⨆ i ∈ {i | w i = 0}, LinearMap.range (single K (fun x => K) i)