Theorem: LinearMap.rank_diagonal
File: Mathlib/LinearAlgebra/Matrix/Diagonal.lean

tactic: have hu : univ ⊆ { i : m | w i = 0 }ᶜ ∪ { i : m | w i = 0 } := by rw [Set.compl_union_self]
state_before: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
⊢ (toLin' (Matrix.diagonal w)).rank = ↑(Fintype.card { i // w i ≠ 0 })
state_after: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
⊢ (toLin' (Matrix.diagonal w)).rank = ↑(Fintype.card { i // w i ≠ 0 })

tactic: have hd : Disjoint { i : m | w i ≠ 0 } { i : m | w i = 0 } := disjoint_compl_left
state_before: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
⊢ (toLin' (Matrix.diagonal w)).rank = ↑(Fintype.card { i // w i ≠ 0 })
state_after: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
hd : Disjoint {i | w i ≠ 0} {i | w i = 0}
⊢ (toLin' (Matrix.diagonal w)).rank = ↑(Fintype.card { i // w i ≠ 0 })

tactic: have B₁ := iSup_range_stdBasis_eq_iInf_ker_proj K (fun _ : m => K) hd hu (Set.toFinite _)
state_before: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
hd : Disjoint {i | w i ≠ 0} {i | w i = 0}
⊢ (toLin' (Matrix.diagonal w)).rank = ↑(Fintype.card { i // w i ≠ 0 })
state_after: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
hd : Disjoint {i | w i ≠ 0} {i | w i = 0}
B₁ : ⨆ i ∈ {i | w i ≠ 0}, range (stdBasis K (fun x => K) i) = ⨅ i ∈ {i | w i = 0}, ker (proj i)
⊢ (toLin' (Matrix.diagonal w)).rank = ↑(Fintype.card { i // w i ≠ 0 })

tactic: have B₂ := iInfKerProjEquiv K (fun _ ↦ K) hd hu
state_before: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
hd : Disjoint {i | w i ≠ 0} {i | w i = 0}
B₁ : ⨆ i ∈ {i | w i ≠ 0}, range (stdBasis K (fun x => K) i) = ⨅ i ∈ {i | w i = 0}, ker (proj i)
⊢ (toLin' (Matrix.diagonal w)).rank = ↑(Fintype.card { i // w i ≠ 0 })
state_after: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
hd : Disjoint {i | w i ≠ 0} {i | w i = 0}
B₁ : ⨆ i ∈ {i | w i ≠ 0}, range (stdBasis K (fun x => K) i) = ⨅ i ∈ {i | w i = 0}, ker (proj i)
B₂ : ↥(⨅ i ∈ {i | w i = 0}, ker (proj i)) ≃ₗ[K] (i : ↑{i | w i ≠ 0}) → (fun x => K) ↑i
⊢ (toLin' (Matrix.diagonal w)).rank = ↑(Fintype.card { i // w i ≠ 0 })

tactic: rw [LinearMap.rank, range_diagonal, B₁, ← @rank_fun' K]
state_before: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
hd : Disjoint {i | w i ≠ 0} {i | w i = 0}
B₁ : ⨆ i ∈ {i | w i ≠ 0}, range (stdBasis K (fun x => K) i) = ⨅ i ∈ {i | w i = 0}, ker (proj i)
B₂ : ↥(⨅ i ∈ {i | w i = 0}, ker (proj i)) ≃ₗ[K] (i : ↑{i | w i ≠ 0}) → (fun x => K) ↑i
⊢ (toLin' (Matrix.diagonal w)).rank = ↑(Fintype.card { i // w i ≠ 0 })
state_after: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
hd : Disjoint {i | w i ≠ 0} {i | w i = 0}
B₁ : ⨆ i ∈ {i | w i ≠ 0}, range (stdBasis K (fun x => K) i) = ⨅ i ∈ {i | w i = 0}, ker (proj i)
B₂ : ↥(⨅ i ∈ {i | w i = 0}, ker (proj i)) ≃ₗ[K] (i : ↑{i | w i ≠ 0}) → (fun x => K) ↑i
⊢ Module.rank K ↥(⨅ i ∈ {i | w i = 0}, ker (proj i)) = Module.rank K ({ i // w i ≠ 0 } → K)

tactic: apply LinearEquiv.rank_eq
state_before: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
hd : Disjoint {i | w i ≠ 0} {i | w i = 0}
B₁ : ⨆ i ∈ {i | w i ≠ 0}, range (stdBasis K (fun x => K) i) = ⨅ i ∈ {i | w i = 0}, ker (proj i)
B₂ : ↥(⨅ i ∈ {i | w i = 0}, ker (proj i)) ≃ₗ[K] (i : ↑{i | w i ≠ 0}) → (fun x => K) ↑i
⊢ Module.rank K ↥(⨅ i ∈ {i | w i = 0}, ker (proj i)) = Module.rank K ({ i // w i ≠ 0 } → K)
state_after: case f
m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
hd : Disjoint {i | w i ≠ 0} {i | w i = 0}
B₁ : ⨆ i ∈ {i | w i ≠ 0}, range (stdBasis K (fun x => K) i) = ⨅ i ∈ {i | w i = 0}, ker (proj i)
B₂ : ↥(⨅ i ∈ {i | w i = 0}, ker (proj i)) ≃ₗ[K] (i : ↑{i | w i ≠ 0}) → (fun x => K) ↑i
⊢ ↥(⨅ i ∈ {i | w i = 0}, ker (proj i)) ≃ₗ[K] { i // w i ≠ 0 } → K

tactic: apply B₂
state_before: case f
m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
hu : univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
hd : Disjoint {i | w i ≠ 0} {i | w i = 0}
B₁ : ⨆ i ∈ {i | w i ≠ 0}, range (stdBasis K (fun x => K) i) = ⨅ i ∈ {i | w i = 0}, ker (proj i)
B₂ : ↥(⨅ i ∈ {i | w i = 0}, ker (proj i)) ≃ₗ[K] (i : ↑{i | w i ≠ 0}) → (fun x => K) ↑i
⊢ ↥(⨅ i ∈ {i | w i = 0}, ker (proj i)) ≃ₗ[K] { i // w i ≠ 0 } → K
state_after: no goals

tactic: rw [Set.compl_union_self]
state_before: m : Type u_1
n : Type u_2
inst✝⁴ : Fintype m
inst✝³ : Fintype n
K : Type u
inst✝² : Field K
inst✝¹ : DecidableEq m
inst✝ : DecidableEq K
w : m → K
⊢ univ ⊆ {i | w i = 0}ᶜ ∪ {i | w i = 0}
state_after: no goals