l3lab/ntp-mathlib huggingface dataset:
open LinearEquiv LinearMap in
/--
Consider direct limits `lim G` and `lim G'` with direct system `f` and `f'` respectively, any
family of equivalences `eᵢ : Gᵢ ≅ G'ᵢ` such that `e ∘ f = f' ∘ e` induces an equivalence
`lim G ≅ lim G'`.
-/
def congr [IsDirected ι (· ≤ ·)]
    (e : (i : ι) → G i ≃ₗ[R] G' i) (he : ∀ i j h, e j ∘ₗ f i j h = f' i j h ∘ₗ e i) :
    DirectLimit G f ≃ₗ[R] DirectLimit G' f' :=
  LinearEquiv.ofLinear (map (e ·) he)
    (map (fun i ↦ (e i).symm) fun i j h ↦ by
      rw [toLinearMap_symm_comp_eq, ← comp_assoc, he i, comp_assoc, comp_coe, symm_trans_self,
        refl_toLinearMap, comp_id])
    (by simp [map_comp]) (by 

Proof state:
R : Type u
inst✝¹⁰ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁹ : Preorder ι
G : ι → Type w
inst✝⁸ : (i : ι) → AddCommGroup (G i)
inst✝⁷ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁶ : AddCommGroup P
inst✝⁵ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
G' : ι → Type v'
inst✝⁴ : (i : ι) → AddCommGroup (G' i)
inst✝³ : (i : ι) → Module R (G' i)
f' : (i j : ι) → i ≤ j → G' i →ₗ[R] G' j
G'' : ι → Type v''
inst✝² : (i : ι) → AddCommGroup (G'' i)
inst✝¹ : (i : ι) → Module R (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →ₗ[R] G'' j
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
e : (i : ι) → G i ≃ₗ[R] G' i
he : ∀ (i j : ι) (h : i ≤ j), ↑(e j) ∘ₗ f i j h = f' i j h ∘ₗ ↑(e i)
⊢ comp
      (map (fun i => ↑(LinearEquiv.symm (e i)))
        (_ :
          ∀ (i j : ι) (h : i ≤ j),
            (fun i => ↑(LinearEquiv.symm (e i))) j ∘ₗ f' i j h = f i j h ∘ₗ (fun i => ↑(LinearEquiv.symm (e i))) i))
      (map (fun x => ↑(e x)) he) =
    LinearMap.id

Next tactic:
simp [map_comp]
open LinearEquiv LinearMap in
lemma congr_symm_apply_of [IsDirected ι (· ≤ ·)]
    (e : (i : ι) → G i ≃ₗ[R] G' i) (he : ∀ i j h, e j ∘ₗ f i j h = f' i j h ∘ₗ e i)
    {i : ι} (g : G' i) :
    (congr e he).symm (of _ _ G' f' i g) = of _ _ G f i ((e i).symm g) :=
  map_apply_of _ (fun i j h ↦ by
    

Proof state:
R : Type u
inst✝¹⁰ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁹ : Preorder ι
G : ι → Type w
inst✝⁸ : (i : ι) → AddCommGroup (G i)
inst✝⁷ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁶ : AddCommGroup P
inst✝⁵ : Module R P
g✝ : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g✝ j) ((f i j hij) x) = (g✝ i) x
G' : ι → Type v'
inst✝⁴ : (i : ι) → AddCommGroup (G' i)
inst✝³ : (i : ι) → Module R (G' i)
f' : (i j : ι) → i ≤ j → G' i →ₗ[R] G' j
G'' : ι → Type v''
inst✝² : (i : ι) → AddCommGroup (G'' i)
inst✝¹ : (i : ι) → Module R (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →ₗ[R] G'' j
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
e : (i : ι) → G i ≃ₗ[R] G' i
he : ∀ (i j : ι) (h : i ≤ j), ↑(e j) ∘ₗ f i j h = f' i j h ∘ₗ ↑(e i)
i✝ : ι
g : G' i✝
i j : ι
h : i ≤ j
⊢ (fun i => ↑(LinearEquiv.symm (e i))) j ∘ₗ f' i j h = f i j h ∘ₗ (fun i => ↑(LinearEquiv.symm (e i))) i

Next tactic:
rw [toLinearMap_symm_comp_eq, ← comp_assoc, he i, comp_assoc, comp_coe, symm_trans_self,
      refl_toLinearMap, comp_id]
theorem toModule_totalize_of_le {x : DirectSum ι G} {i j : ι} (hij : i ≤ j)
    (hx : ∀ k ∈ x.support, k ≤ i) :
    DirectSum.toModule R ι (G j) (fun k => totalize G f k j) x =
      f i j hij (DirectSum.toModule R ι (G i) (fun k => totalize G f k i) x) := by
  

Proof state:
R : Type u
inst✝⁶ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → AddCommGroup (G i)
inst✝³ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝² : AddCommGroup P
inst✝¹ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝ : DirectedSystem G fun i j h => ⇑(f i j h)
x : DirectSum ι G
i j : ι
hij : i ≤ j
hx : ∀ k ∈ DFinsupp.support x, k ≤ i
⊢ (DirectSum.toModule R ι (G j) fun k => totalize G f k j) x =
    (f i j hij) ((DirectSum.toModule R ι (G i) fun k => totalize G f k i) x)

Next tactic:
rw [← @DFinsupp.sum_single ι G _ _ _ x]
theorem toModule_totalize_of_le {x : DirectSum ι G} {i j : ι} (hij : i ≤ j)
    (hx : ∀ k ∈ x.support, k ≤ i) :
    DirectSum.toModule R ι (G j) (fun k => totalize G f k j) x =
      f i j hij (DirectSum.toModule R ι (G i) (fun k => totalize G f k i) x) := by
  rw [← @DFinsupp.sum_single ι G _ _ _ x]
  

Proof state:
R : Type u
inst✝⁶ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → AddCommGroup (G i)
inst✝³ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝² : AddCommGroup P
inst✝¹ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝ : DirectedSystem G fun i j h => ⇑(f i j h)
x : DirectSum ι G
i j : ι
hij : i ≤ j
hx : ∀ k ∈ DFinsupp.support x, k ≤ i
⊢ (DirectSum.toModule R ι (G j) fun k => totalize G f k j) (DFinsupp.sum x DFinsupp.single) =
    (f i j hij) ((DirectSum.toModule R ι (G i) fun k => totalize G f k i) (DFinsupp.sum x DFinsupp.single))

Next tactic:
unfold DFinsupp.sum
theorem toModule_totalize_of_le {x : DirectSum ι G} {i j : ι} (hij : i ≤ j)
    (hx : ∀ k ∈ x.support, k ≤ i) :
    DirectSum.toModule R ι (G j) (fun k => totalize G f k j) x =
      f i j hij (DirectSum.toModule R ι (G i) (fun k => totalize G f k i) x) := by
  rw [← @DFinsupp.sum_single ι G _ _ _ x]
  unfold DFinsupp.sum
  

Proof state:
R : Type u
inst✝⁶ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → AddCommGroup (G i)
inst✝³ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝² : AddCommGroup P
inst✝¹ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝ : DirectedSystem G fun i j h => ⇑(f i j h)
x : DirectSum ι G
i j : ι
hij : i ≤ j
hx : ∀ k ∈ DFinsupp.support x, k ≤ i
⊢ (DirectSum.toModule R ι (G j) fun k => totalize G f k j)
      (Finset.sum (DFinsupp.support x) fun i => DFinsupp.single i (x i)) =
    (f i j hij)
      ((DirectSum.toModule R ι (G i) fun k => totalize G f k i)
        (Finset.sum (DFinsupp.support x) fun i => DFinsupp.single i (x i)))

Next tactic:
simp only [map_sum]
theorem toModule_totalize_of_le {x : DirectSum ι G} {i j : ι} (hij : i ≤ j)
    (hx : ∀ k ∈ x.support, k ≤ i) :
    DirectSum.toModule R ι (G j) (fun k => totalize G f k j) x =
      f i j hij (DirectSum.toModule R ι (G i) (fun k => totalize G f k i) x) := by
  rw [← @DFinsupp.sum_single ι G _ _ _ x]
  unfold DFinsupp.sum
  simp only [map_sum]
  

Proof state:
R : Type u
inst✝⁶ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → AddCommGroup (G i)
inst✝³ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝² : AddCommGroup P
inst✝¹ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝ : DirectedSystem G fun i j h => ⇑(f i j h)
x : DirectSum ι G
i j : ι
hij : i ≤ j
hx : ∀ k ∈ DFinsupp.support x, k ≤ i
⊢ (Finset.sum (DFinsupp.support x) fun x_1 =>
      (DirectSum.toModule R ι (G j) fun k => totalize G f k j) (DFinsupp.single x_1 (x x_1))) =
    Finset.sum (DFinsupp.support x) fun x_1 =>
      (f i j hij) ((DirectSum.toModule R ι (G i) fun k => totalize G f k i) (DFinsupp.single x_1 (x x_1)))

Next tactic:
refine' Finset.sum_congr rfl fun k hk => _
theorem toModule_totalize_of_le {x : DirectSum ι G} {i j : ι} (hij : i ≤ j)
    (hx : ∀ k ∈ x.support, k ≤ i) :
    DirectSum.toModule R ι (G j) (fun k => totalize G f k j) x =
      f i j hij (DirectSum.toModule R ι (G i) (fun k => totalize G f k i) x) := by
  rw [← @DFinsupp.sum_single ι G _ _ _ x]
  unfold DFinsupp.sum
  simp only [map_sum]
  refine' Finset.sum_congr rfl fun k hk => _
  

Proof state:
R : Type u
inst✝⁶ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → AddCommGroup (G i)
inst✝³ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝² : AddCommGroup P
inst✝¹ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝ : DirectedSystem G fun i j h => ⇑(f i j h)
x : DirectSum ι G
i j : ι
hij : i ≤ j
hx : ∀ k ∈ DFinsupp.support x, k ≤ i
k : ι
hk : k ∈ DFinsupp.support x
⊢ (DirectSum.toModule R ι (G j) fun k => totalize G f k j) (DFinsupp.single k (x k)) =
    (f i j hij) ((DirectSum.toModule R ι (G i) fun k => totalize G f k i) (DFinsupp.single k (x k)))

Next tactic:
rw [DirectSum.single_eq_lof R k (x k), DirectSum.toModule_lof, DirectSum.toModule_lof,
    totalize_of_le (hx k hk), totalize_of_le (le_trans (hx k hk) hij), DirectedSystem.map_map]
theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : DirectSum ι G}
    (H : (Submodule.Quotient.mk x : DirectLimit G f) = (0 : DirectLimit G f)) :
    ∃ j,
      (∀ k ∈ x.support, k ≤ j) ∧
        DirectSum.toModule R ι (G j) (fun i => totalize G f i j) x = (0 : G j) :=
  Nonempty.elim (by 

Proof state:
R : Type u
inst✝⁸ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁷ : Preorder ι
G : ι → Type w
inst✝⁶ : (i : ι) → AddCommGroup (G i)
inst✝⁵ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁴ : AddCommGroup P
inst✝³ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x : DirectSum ι G
H : Submodule.Quotient.mk x = 0
⊢ Nonempty ι

Next tactic:
infer_instance
theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : DirectSum ι G}
    (H : (Submodule.Quotient.mk x : DirectLimit G f) = (0 : DirectLimit G f)) :
    ∃ j,
      (∀ k ∈ x.support, k ≤ j) ∧
        DirectSum.toModule R ι (G j) (fun i => totalize G f i j) x = (0 : G j) :=
  Nonempty.elim (by infer_instance) fun ind : ι =>
    span_induction ((Quotient.mk_eq_zero _).1 H)
      (fun x ⟨i, j, hij, y, hxy⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, by
          

Proof state:
R : Type u
inst✝⁸ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁷ : Preorder ι
G : ι → Type w
inst✝⁶ : (i : ι) → AddCommGroup (G i)
inst✝⁵ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁴ : AddCommGroup P
inst✝³ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x✝¹ : DirectSum ι G
H : Submodule.Quotient.mk x✝¹ = 0
ind : ι
x : DirectSum ι G
x✝ : x ∈ {a | ∃ i j, ∃ (H : i ≤ j), ∃ x, (DirectSum.lof R ι G i) x - (DirectSum.lof R ι G j) ((f i j H) x) = a}
i j : ι
hij : i ≤ j
y : G i
hxy : (DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y) = x
k : ι
hik : i ≤ k
hjk : j ≤ k
⊢ (∀ k_1 ∈ DFinsupp.support x, k_1 ≤ k) ∧ (DirectSum.toModule R ι (G k) fun i => totalize G f i k) x = 0

Next tactic:
subst hxy
theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : DirectSum ι G}
    (H : (Submodule.Quotient.mk x : DirectLimit G f) = (0 : DirectLimit G f)) :
    ∃ j,
      (∀ k ∈ x.support, k ≤ j) ∧
        DirectSum.toModule R ι (G j) (fun i => totalize G f i j) x = (0 : G j) :=
  Nonempty.elim (by infer_instance) fun ind : ι =>
    span_induction ((Quotient.mk_eq_zero _).1 H)
      (fun x ⟨i, j, hij, y, hxy⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, by
          subst hxy
          

Proof state:
R : Type u
inst✝⁸ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁷ : Preorder ι
G : ι → Type w
inst✝⁶ : (i : ι) → AddCommGroup (G i)
inst✝⁵ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁴ : AddCommGroup P
inst✝³ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x : DirectSum ι G
H : Submodule.Quotient.mk x = 0
ind i j : ι
hij : i ≤ j
y : G i
k : ι
hik : i ≤ k
hjk : j ≤ k
x✝ :
  (DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y) ∈
    {a | ∃ i j, ∃ (H : i ≤ j), ∃ x, (DirectSum.lof R ι G i) x - (DirectSum.lof R ι G j) ((f i j H) x) = a}
⊢ (∀ k_1 ∈ DFinsupp.support ((DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y)), k_1 ≤ k) ∧
    (DirectSum.toModule R ι (G k) fun i => totalize G f i k)
        ((DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y)) =
      0

Next tactic:
constructor
theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : DirectSum ι G}
    (H : (Submodule.Quotient.mk x : DirectLimit G f) = (0 : DirectLimit G f)) :
    ∃ j,
      (∀ k ∈ x.support, k ≤ j) ∧
        DirectSum.toModule R ι (G j) (fun i => totalize G f i j) x = (0 : G j) :=
  Nonempty.elim (by infer_instance) fun ind : ι =>
    span_induction ((Quotient.mk_eq_zero _).1 H)
      (fun x ⟨i, j, hij, y, hxy⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, by
          subst hxy
          constructor
          · 

Proof state:
case left
R : Type u
inst✝⁸ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁷ : Preorder ι
G : ι → Type w
inst✝⁶ : (i : ι) → AddCommGroup (G i)
inst✝⁵ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁴ : AddCommGroup P
inst✝³ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x : DirectSum ι G
H : Submodule.Quotient.mk x = 0
ind i j : ι
hij : i ≤ j
y : G i
k : ι
hik : i ≤ k
hjk : j ≤ k
x✝ :
  (DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y) ∈
    {a | ∃ i j, ∃ (H : i ≤ j), ∃ x, (DirectSum.lof R ι G i) x - (DirectSum.lof R ι G j) ((f i j H) x) = a}
⊢ ∀ k_1 ∈ DFinsupp.support ((DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y)), k_1 ≤ k

Next tactic:
intro i0 hi0
theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : DirectSum ι G}
    (H : (Submodule.Quotient.mk x : DirectLimit G f) = (0 : DirectLimit G f)) :
    ∃ j,
      (∀ k ∈ x.support, k ≤ j) ∧
        DirectSum.toModule R ι (G j) (fun i => totalize G f i j) x = (0 : G j) :=
  Nonempty.elim (by infer_instance) fun ind : ι =>
    span_induction ((Quotient.mk_eq_zero _).1 H)
      (fun x ⟨i, j, hij, y, hxy⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, by
          subst hxy
          constructor
          · intro i0 hi0
            

Proof state:
case left
R : Type u
inst✝⁸ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁷ : Preorder ι
G : ι → Type w
inst✝⁶ : (i : ι) → AddCommGroup (G i)
inst✝⁵ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁴ : AddCommGroup P
inst✝³ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x : DirectSum ι G
H : Submodule.Quotient.mk x = 0
ind i j : ι
hij : i ≤ j
y : G i
k : ι
hik : i ≤ k
hjk : j ≤ k
x✝ :
  (DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y) ∈
    {a | ∃ i j, ∃ (H : i ≤ j), ∃ x, (DirectSum.lof R ι G i) x - (DirectSum.lof R ι G j) ((f i j H) x) = a}
i0 : ι
hi0 : i0 ∈ DFinsupp.support ((DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y))
⊢ i0 ≤ k

Next tactic:
rw [DFinsupp.mem_support_iff, DirectSum.sub_apply, ← DirectSum.single_eq_lof, ←
              DirectSum.single_eq_lof, DFinsupp.single_apply, DFinsupp.single_apply] at hi0
theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : DirectSum ι G}
    (H : (Submodule.Quotient.mk x : DirectLimit G f) = (0 : DirectLimit G f)) :
    ∃ j,
      (∀ k ∈ x.support, k ≤ j) ∧
        DirectSum.toModule R ι (G j) (fun i => totalize G f i j) x = (0 : G j) :=
  Nonempty.elim (by infer_instance) fun ind : ι =>
    span_induction ((Quotient.mk_eq_zero _).1 H)
      (fun x ⟨i, j, hij, y, hxy⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, by
          subst hxy
          constructor
          · intro i0 hi0
            rw [DFinsupp.mem_support_iff, DirectSum.sub_apply, ← DirectSum.single_eq_lof, ←
              DirectSum.single_eq_lof, DFinsupp.single_apply, DFinsupp.single_apply] at hi0
            

Proof state:
case left
R : Type u
inst✝⁸ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁷ : Preorder ι
G : ι → Type w
inst✝⁶ : (i : ι) → AddCommGroup (G i)
inst✝⁵ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁴ : AddCommGroup P
inst✝³ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x : DirectSum ι G
H : Submodule.Quotient.mk x = 0
ind i j : ι
hij : i ≤ j
y : G i
k : ι
hik : i ≤ k
hjk : j ≤ k
x✝ :
  (DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y) ∈
    {a | ∃ i j, ∃ (H : i ≤ j), ∃ x, (DirectSum.lof R ι G i) x - (DirectSum.lof R ι G j) ((f i j H) x) = a}
i0 : ι
hi0 : ((if h : i = i0 then Eq.recOn h y else 0) - if h : j = i0 then Eq.recOn h ((f i j hij) y) else 0) ≠ 0
⊢ i0 ≤ k

Next tactic:
split_ifs at hi0 with hi hj hj
theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : DirectSum ι G}
    (H : (Submodule.Quotient.mk x : DirectLimit G f) = (0 : DirectLimit G f)) :
    ∃ j,
      (∀ k ∈ x.support, k ≤ j) ∧
        DirectSum.toModule R ι (G j) (fun i => totalize G f i j) x = (0 : G j) :=
  Nonempty.elim (by infer_instance) fun ind : ι =>
    span_induction ((Quotient.mk_eq_zero _).1 H)
      (fun x ⟨i, j, hij, y, hxy⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, by
          subst hxy
          constructor
          · intro i0 hi0
            rw [DFinsupp.mem_support_iff, DirectSum.sub_apply, ← DirectSum.single_eq_lof, ←
              DirectSum.single_eq_lof, DFinsupp.single_apply, DFinsupp.single_apply] at hi0
            split_ifs at hi0 with hi hj hj
            · 

Proof state:
case pos
R : Type u
inst✝⁸ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁷ : Preorder ι
G : ι → Type w
inst✝⁶ : (i : ι) → AddCommGroup (G i)
inst✝⁵ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁴ : AddCommGroup P
inst✝³ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x : DirectSum ι G
H : Submodule.Quotient.mk x = 0
ind i j : ι
hij : i ≤ j
y : G i
k : ι
hik : i ≤ k
hjk : j ≤ k
x✝ :
  (DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y) ∈
    {a | ∃ i j, ∃ (H : i ≤ j), ∃ x, (DirectSum.lof R ι G i) x - (DirectSum.lof R ι G j) ((f i j H) x) = a}
i0 : ι
hi : i = i0
hj : j = i0
hi0 : Eq.recOn hi y - Eq.recOn hj ((f i j hij) y) ≠ 0
⊢ i0 ≤ k

Next tactic:
rwa [hi] at hik
theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : DirectSum ι G}
    (H : (Submodule.Quotient.mk x : DirectLimit G f) = (0 : DirectLimit G f)) :
    ∃ j,
      (∀ k ∈ x.support, k ≤ j) ∧
        DirectSum.toModule R ι (G j) (fun i => totalize G f i j) x = (0 : G j) :=
  Nonempty.elim (by infer_instance) fun ind : ι =>
    span_induction ((Quotient.mk_eq_zero _).1 H)
      (fun x ⟨i, j, hij, y, hxy⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, by
          subst hxy
          constructor
          · intro i0 hi0
            rw [DFinsupp.mem_support_iff, DirectSum.sub_apply, ← DirectSum.single_eq_lof, ←
              DirectSum.single_eq_lof, DFinsupp.single_apply, DFinsupp.single_apply] at hi0
            split_ifs at hi0 with hi hj hj
            · rwa [hi] at hik
            · 

Proof state:
case neg
R : Type u
inst✝⁸ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁷ : Preorder ι
G : ι → Type w
inst✝⁶ : (i : ι) → AddCommGroup (G i)
inst✝⁵ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁴ : AddCommGroup P
inst✝³ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x : DirectSum ι G
H : Submodule.Quotient.mk x = 0
ind i j : ι
hij : i ≤ j
y : G i
k : ι
hik : i ≤ k
hjk : j ≤ k
x✝ :
  (DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y) ∈
    {a | ∃ i j, ∃ (H : i ≤ j), ∃ x, (DirectSum.lof R ι G i) x - (DirectSum.lof R ι G j) ((f i j H) x) = a}
i0 : ι
hi : i = i0
hj : ¬j = i0
hi0 : Eq.recOn hi y - 0 ≠ 0
⊢ i0 ≤ k

Next tactic:
rwa [hi] at hik
theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : DirectSum ι G}
    (H : (Submodule.Quotient.mk x : DirectLimit G f) = (0 : DirectLimit G f)) :
    ∃ j,
      (∀ k ∈ x.support, k ≤ j) ∧
        DirectSum.toModule R ι (G j) (fun i => totalize G f i j) x = (0 : G j) :=
  Nonempty.elim (by infer_instance) fun ind : ι =>
    span_induction ((Quotient.mk_eq_zero _).1 H)
      (fun x ⟨i, j, hij, y, hxy⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, by
          subst hxy
          constructor
          · intro i0 hi0
            rw [DFinsupp.mem_support_iff, DirectSum.sub_apply, ← DirectSum.single_eq_lof, ←
              DirectSum.single_eq_lof, DFinsupp.single_apply, DFinsupp.single_apply] at hi0
            split_ifs at hi0 with hi hj hj
            · rwa [hi] at hik
            · rwa [hi] at hik
            · 

Proof state:
case pos
R : Type u
inst✝⁸ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁷ : Preorder ι
G : ι → Type w
inst✝⁶ : (i : ι) → AddCommGroup (G i)
inst✝⁵ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁴ : AddCommGroup P
inst✝³ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x : DirectSum ι G
H : Submodule.Quotient.mk x = 0
ind i j : ι
hij : i ≤ j
y : G i
k : ι
hik : i ≤ k
hjk : j ≤ k
x✝ :
  (DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y) ∈
    {a | ∃ i j, ∃ (H : i ≤ j), ∃ x, (DirectSum.lof R ι G i) x - (DirectSum.lof R ι G j) ((f i j H) x) = a}
i0 : ι
hi : ¬i = i0
hj : j = i0
hi0 : 0 - Eq.recOn hj ((f i j hij) y) ≠ 0
⊢ i0 ≤ k

Next tactic:
rwa [hj] at hjk
theorem of.zero_exact_aux [Nonempty ι] [IsDirected ι (· ≤ ·)] {x : DirectSum ι G}
    (H : (Submodule.Quotient.mk x : DirectLimit G f) = (0 : DirectLimit G f)) :
    ∃ j,
      (∀ k ∈ x.support, k ≤ j) ∧
        DirectSum.toModule R ι (G j) (fun i => totalize G f i j) x = (0 : G j) :=
  Nonempty.elim (by infer_instance) fun ind : ι =>
    span_induction ((Quotient.mk_eq_zero _).1 H)
      (fun x ⟨i, j, hij, y, hxy⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, by
          subst hxy
          constructor
          · intro i0 hi0
            rw [DFinsupp.mem_support_iff, DirectSum.sub_apply, ← DirectSum.single_eq_lof, ←
              DirectSum.single_eq_lof, DFinsupp.single_apply, DFinsupp.single_apply] at hi0
            split_ifs at hi0 with hi hj hj
            · rwa [hi] at hik
            · rwa [hi] at hik
            · rwa [hj] at hjk
            

Proof state:
case neg
R : Type u
inst✝⁸ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁷ : Preorder ι
G : ι → Type w
inst✝⁶ : (i : ι) → AddCommGroup (G i)
inst✝⁵ : (i : ι) → Module R (G i)
f : (i j : ι) → i ≤ j → G i →ₗ[R] G j
P : Type u₁
inst✝⁴ : AddCommGroup P
inst✝³ : Module R P
g : (i : ι) → G i →ₗ[R] P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝² : DirectedSystem G fun i j h => ⇑(f i j h)
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x : DirectSum ι G
H : Submodule.Quotient.mk x = 0
ind i j : ι
hij : i ≤ j
y : G i
k : ι
hik : i ≤ k
hjk : j ≤ k
x✝ :
  (DirectSum.lof R ι G i) y - (DirectSum.lof R ι G j) ((f i j hij) y) ∈
    {a | ∃ i j, ∃ (H : i ≤ j), ∃ x, (DirectSum.lof R ι G i) x - (DirectSum.lof R ι G j) ((f i j H) x) = a}
i0 : ι
hi : ¬i = i0
hj : ¬j = i0
hi0 : 0 - 0 ≠ 0
⊢ i0 ≤ k

Next tactic:
exfalso