l3lab/ntp-mathlib huggingface dataset:
/-- A `PseudoEMetricSpace` is always a paracompact space.
Formalization is based on [MR0236876]. -/
instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : ParacompactSpace α := by
  /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
    the comments and `2⁻¹ ^ k` in the code. -/
  have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
    ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
  have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := @fun m n h =>
    pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ENNReal.one_lt_two.le) h
  have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := fun n => by
    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel two_ne_zero two_ne_top]
  -- Consider an open covering `S : Set (Set α)`
  refine' ⟨fun ι s ho hcov => _⟩
  simp only [iUnion_eq_univ_iff] at hcov
  -- choose a well founded order on `S`
  -- porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
  let _ : LinearOrder ι := by 

Proof state:
α : Type u_1
inst✝ : PseudoEMetricSpace α
pow_pos : ∀ (k : ℕ), 0 < 2⁻¹ ^ k
hpow_le : ∀ {m n : ℕ}, m ≤ n → 2⁻¹ ^ n ≤ 2⁻¹ ^ m
h2pow : ∀ (n : ℕ), 2 * 2⁻¹ ^ (n + 1) = 2⁻¹ ^ n
ι : Type u_1
s : ι → Set α
ho : ∀ (a : ι), IsOpen (s a)
hcov : ∀ (x : α), ∃ i, x ∈ s i
⊢ LinearOrder ι

Next tactic:
classical exact linearOrderOfSTO WellOrderingRel
/-- A `PseudoEMetricSpace` is always a paracompact space.
Formalization is based on [MR0236876]. -/
instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : ParacompactSpace α := by
  /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
    the comments and `2⁻¹ ^ k` in the code. -/
  have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
    ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
  have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := @fun m n h =>
    pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ENNReal.one_lt_two.le) h
  have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := fun n => by
    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel two_ne_zero two_ne_top]
  -- Consider an open covering `S : Set (Set α)`
  refine' ⟨fun ι s ho hcov => _⟩
  simp only [iUnion_eq_univ_iff] at hcov
  -- choose a well founded order on `S`
  -- porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
  let _ : LinearOrder ι := by classical 

Proof state:
α : Type u_1
inst✝ : PseudoEMetricSpace α
pow_pos : ∀ (k : ℕ), 0 < 2⁻¹ ^ k
hpow_le : ∀ {m n : ℕ}, m ≤ n → 2⁻¹ ^ n ≤ 2⁻¹ ^ m
h2pow : ∀ (n : ℕ), 2 * 2⁻¹ ^ (n + 1) = 2⁻¹ ^ n
ι : Type u_1
s : ι → Set α
ho : ∀ (a : ι), IsOpen (s a)
hcov : ∀ (x : α), ∃ i, x ∈ s i
⊢ LinearOrder ι

Next tactic:
exact linearOrderOfSTO WellOrderingRel
/-- A `PseudoEMetricSpace` is always a paracompact space.
Formalization is based on [MR0236876]. -/
instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : ParacompactSpace α := by
  /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
    the comments and `2⁻¹ ^ k` in the code. -/
  have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
    ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
  have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := @fun m n h =>
    pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ENNReal.one_lt_two.le) h
  have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := fun n => by
    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel two_ne_zero two_ne_top]
  -- Consider an open covering `S : Set (Set α)`
  refine' ⟨fun ι s ho hcov => _⟩
  simp only [iUnion_eq_univ_iff] at hcov
  -- choose a well founded order on `S`
  -- porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
  let _ : LinearOrder ι := by classical exact linearOrderOfSTO WellOrderingRel
  

Proof state:
α : Type u_1
inst✝ : PseudoEMetricSpace α
pow_pos : ∀ (k : ℕ), 0 < 2⁻¹ ^ k
hpow_le : ∀ {m n : ℕ}, m ≤ n → 2⁻¹ ^ n ≤ 2⁻¹ ^ m
h2pow : ∀ (n : ℕ), 2 * 2⁻¹ ^ (n + 1) = 2⁻¹ ^ n
ι : Type u_1
s : ι → Set α
ho : ∀ (a : ι), IsOpen (s a)
hcov : ∀ (x : α), ∃ i, x ∈ s i
x✝ : LinearOrder ι := linearOrderOfSTO WellOrderingRel
⊢ ∃ β t, ∃ (_ : ∀ (b : β), IsOpen (t b)) (_ : ⋃ b, t b = univ), LocallyFinite t ∧ ∀ (b : β), ∃ a, t b ⊆ s a

Next tactic:
have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
/-- A `PseudoEMetricSpace` is always a paracompact space.
Formalization is based on [MR0236876]. -/
instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : ParacompactSpace α := by
  /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
    the comments and `2⁻¹ ^ k` in the code. -/
  have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
    ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
  have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := @fun m n h =>
    pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ENNReal.one_lt_two.le) h
  have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := fun n => by
    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel two_ne_zero two_ne_top]
  -- Consider an open covering `S : Set (Set α)`
  refine' ⟨fun ι s ho hcov => _⟩
  simp only [iUnion_eq_univ_iff] at hcov
  -- choose a well founded order on `S`
  -- porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
  let _ : LinearOrder ι := by classical exact linearOrderOfSTO WellOrderingRel
  have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
  -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
  

Proof state:
α : Type u_1
inst✝ : PseudoEMetricSpace α
pow_pos : ∀ (k : ℕ), 0 < 2⁻¹ ^ k
hpow_le : ∀ {m n : ℕ}, m ≤ n → 2⁻¹ ^ n ≤ 2⁻¹ ^ m
h2pow : ∀ (n : ℕ), 2 * 2⁻¹ ^ (n + 1) = 2⁻¹ ^ n
ι : Type u_1
s : ι → Set α
ho : ∀ (a : ι), IsOpen (s a)
hcov : ∀ (x : α), ∃ i, x ∈ s i
x✝ : LinearOrder ι := linearOrderOfSTO WellOrderingRel
wf : WellFounded fun x x_1 => x < x_1
⊢ ∃ β t, ∃ (_ : ∀ (b : β), IsOpen (t b)) (_ : ⋃ b, t b = univ), LocallyFinite t ∧ ∀ (b : β), ∃ a, t b ⊆ s a

Next tactic:
set ind : α → ι := fun x => wf.min { i : ι | x ∈ s i } (hcov x)
/-- A `PseudoEMetricSpace` is always a paracompact space.
Formalization is based on [MR0236876]. -/
instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : ParacompactSpace α := by
  /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
    the comments and `2⁻¹ ^ k` in the code. -/
  have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
    ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
  have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := @fun m n h =>
    pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ENNReal.one_lt_two.le) h
  have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := fun n => by
    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel two_ne_zero two_ne_top]
  -- Consider an open covering `S : Set (Set α)`
  refine' ⟨fun ι s ho hcov => _⟩
  simp only [iUnion_eq_univ_iff] at hcov
  -- choose a well founded order on `S`
  -- porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
  let _ : LinearOrder ι := by classical exact linearOrderOfSTO WellOrderingRel
  have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
  -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
  set ind : α → ι := fun x => wf.min { i : ι | x ∈ s i } (hcov x)
  

Proof state:
α : Type u_1
inst✝ : PseudoEMetricSpace α
pow_pos : ∀ (k : ℕ), 0 < 2⁻¹ ^ k
hpow_le : ∀ {m n : ℕ}, m ≤ n → 2⁻¹ ^ n ≤ 2⁻¹ ^ m
h2pow : ∀ (n : ℕ), 2 * 2⁻¹ ^ (n + 1) = 2⁻¹ ^ n
ι : Type u_1
s : ι → Set α
ho : ∀ (a : ι), IsOpen (s a)
hcov : ∀ (x : α), ∃ i, x ∈ s i
x✝ : LinearOrder ι := linearOrderOfSTO WellOrderingRel
wf : WellFounded fun x x_1 => x < x_1
ind : α → ι := fun x => WellFounded.min wf {i | x ∈ s i} (_ : ∃ i, x ∈ s i)
⊢ ∃ β t, ∃ (_ : ∀ (b : β), IsOpen (t b)) (_ : ⋃ b, t b = univ), LocallyFinite t ∧ ∀ (b : β), ∃ a, t b ⊆ s a

Next tactic:
have mem_ind : ∀ x, x ∈ s (ind x) := fun x => wf.min_mem _ (hcov x)
/-- A `PseudoEMetricSpace` is always a paracompact space.
Formalization is based on [MR0236876]. -/
instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : ParacompactSpace α := by
  /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
    the comments and `2⁻¹ ^ k` in the code. -/
  have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
    ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
  have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := @fun m n h =>
    pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ENNReal.one_lt_two.le) h
  have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := fun n => by
    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel two_ne_zero two_ne_top]
  -- Consider an open covering `S : Set (Set α)`
  refine' ⟨fun ι s ho hcov => _⟩
  simp only [iUnion_eq_univ_iff] at hcov
  -- choose a well founded order on `S`
  -- porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
  let _ : LinearOrder ι := by classical exact linearOrderOfSTO WellOrderingRel
  have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
  -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
  set ind : α → ι := fun x => wf.min { i : ι | x ∈ s i } (hcov x)
  have mem_ind : ∀ x, x ∈ s (ind x) := fun x => wf.min_mem _ (hcov x)
  

Proof state:
α : Type u_1
inst✝ : PseudoEMetricSpace α
pow_pos : ∀ (k : ℕ), 0 < 2⁻¹ ^ k
hpow_le : ∀ {m n : ℕ}, m ≤ n → 2⁻¹ ^ n ≤ 2⁻¹ ^ m
h2pow : ∀ (n : ℕ), 2 * 2⁻¹ ^ (n + 1) = 2⁻¹ ^ n
ι : Type u_1
s : ι → Set α
ho : ∀ (a : ι), IsOpen (s a)
hcov : ∀ (x : α), ∃ i, x ∈ s i
x✝ : LinearOrder ι := linearOrderOfSTO WellOrderingRel
wf : WellFounded fun x x_1 => x < x_1
ind : α → ι := fun x => WellFounded.min wf {i | x ∈ s i} (_ : ∃ i, x ∈ s i)
mem_ind : ∀ (x : α), x ∈ s (ind x)
⊢ ∃ β t, ∃ (_ : ∀ (b : β), IsOpen (t b)) (_ : ⋃ b, t b = univ), LocallyFinite t ∧ ∀ (b : β), ∃ a, t b ⊆ s a

Next tactic:
have nmem_of_lt_ind : ∀ {x i}, i < ind x → x ∉ s i := @fun x i hlt hxi =>
    wf.not_lt_min _ (hcov x) hxi hlt
/-- A `PseudoEMetricSpace` is always a paracompact space.
Formalization is based on [MR0236876]. -/
instance (priority := 100) instParacompactSpace [PseudoEMetricSpace α] : ParacompactSpace α := by
  /- We start with trivial observations about `1 / 2 ^ k`. Here and below we use `1 / 2 ^ k` in
    the comments and `2⁻¹ ^ k` in the code. -/
  have pow_pos : ∀ k : ℕ, (0 : ℝ≥0∞) < 2⁻¹ ^ k := fun k =>
    ENNReal.pow_pos (ENNReal.inv_pos.2 ENNReal.two_ne_top) _
  have hpow_le : ∀ {m n : ℕ}, m ≤ n → (2⁻¹ : ℝ≥0∞) ^ n ≤ 2⁻¹ ^ m := @fun m n h =>
    pow_le_pow_right_of_le_one' (ENNReal.inv_le_one.2 ENNReal.one_lt_two.le) h
  have h2pow : ∀ n : ℕ, 2 * (2⁻¹ : ℝ≥0∞) ^ (n + 1) = 2⁻¹ ^ n := fun n => by
    simp [pow_succ, ← mul_assoc, ENNReal.mul_inv_cancel two_ne_zero two_ne_top]
  -- Consider an open covering `S : Set (Set α)`
  refine' ⟨fun ι s ho hcov => _⟩
  simp only [iUnion_eq_univ_iff] at hcov
  -- choose a well founded order on `S`
  -- porting note: todo: add lemma that claims `∃ i : LinearOrder ι, WellFoundedLT ι`
  let _ : LinearOrder ι := by classical exact linearOrderOfSTO WellOrderingRel
  have wf : WellFounded ((· < ·) : ι → ι → Prop) := @IsWellFounded.wf ι WellOrderingRel _
  -- Let `ind x` be the minimal index `s : S` such that `x ∈ s`.
  set ind : α → ι := fun x => wf.min { i : ι | x ∈ s i } (hcov x)
  have mem_ind : ∀ x, x ∈ s (ind x) := fun x => wf.min_mem _ (hcov x)
  have nmem_of_lt_ind : ∀ {x i}, i < ind x → x ∉ s i := @fun x i hlt hxi =>
    wf.not_lt_min _ (hcov x) hxi hlt
  /- The refinement `D : ℕ → ι → Set α` is defined recursively. For each `n` and `i`, `D n i`
    is the union of balls `ball x (1 / 2 ^ n)` over all points `x` such that

    * `ind x = i`;
    * `x` does not belong to any `D m j`, `m < n`;
    * `ball x (3 / 2 ^ n) ⊆ s i`;

    We define this sequence using `Nat.strongRecOn'`, then restate it as `Dn` and `memD`.
  -/
  

Proof state:
α : Type u_1
inst✝ : PseudoEMetricSpace α
pow_pos : ∀ (k : ℕ), 0 < 2⁻¹ ^ k
hpow_le : ∀ {m n : ℕ}, m ≤ n → 2⁻¹ ^ n ≤ 2⁻¹ ^ m
h2pow : ∀ (n : ℕ), 2 * 2⁻¹ ^ (n + 1) = 2⁻¹ ^ n
ι : Type u_1
s : ι → Set α
ho : ∀ (a : ι), IsOpen (s a)
hcov : ∀ (x : α), ∃ i, x ∈ s i
x✝ : LinearOrder ι := linearOrderOfSTO WellOrderingRel
wf : WellFounded fun x x_1 => x < x_1
ind : α → ι := fun x => WellFounded.min wf {i | x ∈ s i} (_ : ∃ i, x ∈ s i)
mem_ind : ∀ (x : α), x ∈ s (ind x)
nmem_of_lt_ind : ∀ {x : α} {i : ι}, i < ind x → x ∉ s i
⊢ ∃ β t, ∃ (_ : ∀ (b : β), IsOpen (t b)) (_ : ⋃ b, t b = univ), LocallyFinite t ∧ ∀ (b : β), ∃ a, t b ⊆ s a

Next tactic:
set D : ℕ → ι → Set α := fun n =>
    Nat.strongRecOn' n fun n D' i =>
      ⋃ (x : α) (hxs : ind x = i) (hb : ball x (3 * 2⁻¹ ^ n) ⊆ s i) (hlt :
        ∀ (m : ℕ) (H : m < n), ∀ (j : ι), x ∉ D' m H j), ball x (2⁻¹ ^ n) with hD
@[simp]
theorem smul_stdBasisMatrix (i : m) (j : n) (a b : α) :
    b • stdBasisMatrix i j a = stdBasisMatrix i j (b • a) := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
a b : α
⊢ b • stdBasisMatrix i j a = stdBasisMatrix i j (b • a)

Next tactic:
unfold stdBasisMatrix
@[simp]
theorem smul_stdBasisMatrix (i : m) (j : n) (a b : α) :
    b • stdBasisMatrix i j a = stdBasisMatrix i j (b • a) := by
  unfold stdBasisMatrix
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
a b : α
⊢ (b • fun i' j' => if i = i' ∧ j = j' then a else 0) = fun i' j' => if i = i' ∧ j = j' then b • a else 0

Next tactic:
ext
@[simp]
theorem smul_stdBasisMatrix (i : m) (j : n) (a b : α) :
    b • stdBasisMatrix i j a = stdBasisMatrix i j (b • a) := by
  unfold stdBasisMatrix
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
a b : α
i✝ : m
x✝ : n
⊢ (b • fun i' j' => if i = i' ∧ j = j' then a else 0) i✝ x✝ = if i = i✝ ∧ j = x✝ then b • a else 0

Next tactic:
simp
@[simp]
theorem stdBasisMatrix_zero (i : m) (j : n) : stdBasisMatrix i j (0 : α) = 0 := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
⊢ stdBasisMatrix i j 0 = 0

Next tactic:
unfold stdBasisMatrix
@[simp]
theorem stdBasisMatrix_zero (i : m) (j : n) : stdBasisMatrix i j (0 : α) = 0 := by
  unfold stdBasisMatrix
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
⊢ (fun i' j' => if i = i' ∧ j = j' then 0 else 0) = 0

Next tactic:
ext
@[simp]
theorem stdBasisMatrix_zero (i : m) (j : n) : stdBasisMatrix i j (0 : α) = 0 := by
  unfold stdBasisMatrix
  ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
i✝ : m
x✝ : n
⊢ (if i = i✝ ∧ j = x✝ then 0 else 0) = OfNat.ofNat 0 i✝ x✝

Next tactic:
simp
theorem stdBasisMatrix_add (i : m) (j : n) (a b : α) :
    stdBasisMatrix i j (a + b) = stdBasisMatrix i j a + stdBasisMatrix i j b := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
a b : α
⊢ stdBasisMatrix i j (a + b) = stdBasisMatrix i j a + stdBasisMatrix i j b

Next tactic:
unfold stdBasisMatrix
theorem stdBasisMatrix_add (i : m) (j : n) (a b : α) :
    stdBasisMatrix i j (a + b) = stdBasisMatrix i j a + stdBasisMatrix i j b := by
  unfold stdBasisMatrix; 

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
a b : α
⊢ (fun i' j' => if i = i' ∧ j = j' then a + b else 0) =
    (fun i' j' => if i = i' ∧ j = j' then a else 0) + fun i' j' => if i = i' ∧ j = j' then b else 0

Next tactic:
ext
theorem stdBasisMatrix_add (i : m) (j : n) (a b : α) :
    stdBasisMatrix i j (a + b) = stdBasisMatrix i j a + stdBasisMatrix i j b := by
  unfold stdBasisMatrix; ext
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
a b : α
i✝ : m
x✝ : n
⊢ (if i = i✝ ∧ j = x✝ then a + b else 0) =
    ((fun i' j' => if i = i' ∧ j = j' then a else 0) + fun i' j' => if i = i' ∧ j = j' then b else 0) i✝ x✝

Next tactic:
split_ifs with h
theorem stdBasisMatrix_add (i : m) (j : n) (a b : α) :
    stdBasisMatrix i j (a + b) = stdBasisMatrix i j a + stdBasisMatrix i j b := by
  unfold stdBasisMatrix; ext
  split_ifs with h <;> 

Proof state:
case pos
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
a b : α
i✝ : m
x✝ : n
h : i = i✝ ∧ j = x✝
⊢ a + b = ((fun i' j' => if i = i' ∧ j = j' then a else 0) + fun i' j' => if i = i' ∧ j = j' then b else 0) i✝ x✝

Next tactic:
simp [h]
theorem stdBasisMatrix_add (i : m) (j : n) (a b : α) :
    stdBasisMatrix i j (a + b) = stdBasisMatrix i j a + stdBasisMatrix i j b := by
  unfold stdBasisMatrix; ext
  split_ifs with h <;> 

Proof state:
case neg
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝³ : DecidableEq l
inst✝² : DecidableEq m
inst✝¹ : DecidableEq n
inst✝ : Semiring α
i : m
j : n
a b : α
i✝ : m
x✝ : n
h : ¬(i = i✝ ∧ j = x✝)
⊢ 0 = ((fun i' j' => if i = i' ∧ j = j' then a else 0) + fun i' j' => if i = i' ∧ j = j' then b else 0) i✝ x✝

Next tactic:
simp [h]
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  

Proof state:
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
⊢ x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j)

Next tactic:
ext i j
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; 

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
⊢ x i j = Finset.sum Finset.univ (fun i => ∑ j : n, stdBasisMatrix i j (x i j)) i j

Next tactic:
symm
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
⊢ Finset.sum Finset.univ (fun i => ∑ j : n, stdBasisMatrix i j (x i j)) i j = x i j

Next tactic:
iterate 2 rw [Finset.sum_apply]
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  iterate 2 

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
⊢ Finset.sum Finset.univ (fun i => ∑ j : n, stdBasisMatrix i j (x i j)) i j = x i j

Next tactic:
rw [Finset.sum_apply]
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  iterate 2 

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
⊢ Finset.sum Finset.univ (fun c => Finset.sum Finset.univ (fun j => stdBasisMatrix c j (x c j)) i) j = x i j

Next tactic:
rw [Finset.sum_apply]
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  iterate 2 rw [Finset.sum_apply]
  -- Porting note: was `convert`
  

Proof state:
case a.h
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
⊢ ∑ c : m, Finset.sum Finset.univ (fun j => stdBasisMatrix c j (x c j)) i j = x i j

Next tactic:
refine (Fintype.sum_eq_single i ?_).trans ?_
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  iterate 2 rw [Finset.sum_apply]
  -- Porting note: was `convert`
  refine (Fintype.sum_eq_single i ?_).trans ?_; 

Proof state:
case a.h.refine_1
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
⊢ ∀ (x_1 : m), x_1 ≠ i → Finset.sum Finset.univ (fun j => stdBasisMatrix x_1 j (x x_1 j)) i j = 0
case a.h.refine_2
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
⊢ Finset.sum Finset.univ (fun j => stdBasisMatrix i j (x i j)) i j = x i j

Next tactic:
swap
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  iterate 2 rw [Finset.sum_apply]
  -- Porting note: was `convert`
  refine (Fintype.sum_eq_single i ?_).trans ?_; swap
  · -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply`
    

Proof state:
case a.h.refine_2
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
⊢ Finset.sum Finset.univ (fun j => stdBasisMatrix i j (x i j)) i j = x i j

Next tactic:
simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix]
theorem matrix_eq_sum_std_basis [Fintype m] [Fintype n] (x : Matrix m n α) :
    x = ∑ i : m, ∑ j : n, stdBasisMatrix i j (x i j) := by
  ext i j; symm
  iterate 2 rw [Finset.sum_apply]
  -- Porting note: was `convert`
  refine (Fintype.sum_eq_single i ?_).trans ?_; swap
  · -- Porting note: `simp` seems unwilling to apply `Fintype.sum_apply`
    simp (config := { unfoldPartialApp := true }) only [stdBasisMatrix]
    

Proof state:
case a.h.refine_2
l : Type u_1
m : Type u_2
n : Type u_3
R : Type u_4
α : Type u_5
inst✝⁵ : DecidableEq l
inst✝⁴ : DecidableEq m
inst✝³ : DecidableEq n
inst✝² : Semiring α
inst✝¹ : Fintype m
inst✝ : Fintype n
x : Matrix m n α
i : m
j : n
⊢ Finset.sum Finset.univ (fun x_1 i' j' => if i = i' ∧ x_1 = j' then x i x_1 else 0) i j = x i j

Next tactic:
rw [Fintype.sum_apply, Fintype.sum_apply]