l3lab/ntp-mathlib huggingface dataset:
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
            exfalso
            

Proof state:
case neg.h
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
⊢ False

Next tactic:
apply 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
            split_ifs at hi0 with hi hj hj
            · rwa [hi] at hik
            · rwa [hi] at hik
            · rwa [hj] at hjk
            exfalso
            apply hi0
            

Proof state:
case neg.h
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
⊢ 0 - 0 = 0

Next tactic:
rw [sub_zero]
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
            exfalso
            apply hi0
            rw [sub_zero]
          

Proof state:
case right
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}
⊢ (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:
simp [LinearMap.map_sub, totalize_of_le, hik, hjk, DirectedSystem.map_map,
            DirectSum.apply_eq_component, DirectSum.component.of]
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
            exfalso
            apply hi0
            rw [sub_zero]
          simp [LinearMap.map_sub, totalize_of_le, hik, hjk, DirectedSystem.map_map,
            DirectSum.apply_eq_component, DirectSum.component.of]⟩)
      ⟨ind, fun _ h => (Finset.not_mem_empty _ h).elim, LinearMap.map_zero _⟩
      (fun x y ⟨i, hi, hxi⟩ ⟨j, hj, hyj⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, fun l hl =>
          (Finset.mem_union.1 (DFinsupp.support_add hl)).elim (fun hl => le_trans (hi _ hl) hik)
            fun hl => le_trans (hj _ hl) hjk, by
          -- Porting note: this had been
          -- simp [LinearMap.map_add, hxi, hyj, toModule_totalize_of_le hik hi,
          --   toModule_totalize_of_le hjk hj]
          

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 y : DirectSum ι G
x✝¹ : ∃ j, (∀ k ∈ DFinsupp.support x, k ≤ j) ∧ (DirectSum.toModule R ι (G j) fun i => totalize G f i j) x = 0
x✝ : ∃ j, (∀ k ∈ DFinsupp.support y, k ≤ j) ∧ (DirectSum.toModule R ι (G j) fun i => totalize G f i j) y = 0
i : ι
hi : ∀ k ∈ DFinsupp.support x, k ≤ i
hxi : (DirectSum.toModule R ι (G i) fun i_1 => totalize G f i_1 i) x = 0
j : ι
hj : ∀ k ∈ DFinsupp.support y, k ≤ j
hyj : (DirectSum.toModule R ι (G j) fun i => totalize G f i j) y = 0
k : ι
hik : i ≤ k
hjk : j ≤ k
⊢ (DirectSum.toModule R ι (G k) fun i => totalize G f i k) (x + y) = 0

Next tactic:
simp only [map_add]
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
            exfalso
            apply hi0
            rw [sub_zero]
          simp [LinearMap.map_sub, totalize_of_le, hik, hjk, DirectedSystem.map_map,
            DirectSum.apply_eq_component, DirectSum.component.of]⟩)
      ⟨ind, fun _ h => (Finset.not_mem_empty _ h).elim, LinearMap.map_zero _⟩
      (fun x y ⟨i, hi, hxi⟩ ⟨j, hj, hyj⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, fun l hl =>
          (Finset.mem_union.1 (DFinsupp.support_add hl)).elim (fun hl => le_trans (hi _ hl) hik)
            fun hl => le_trans (hj _ hl) hjk, by
          -- Porting note: this had been
          -- simp [LinearMap.map_add, hxi, hyj, toModule_totalize_of_le hik hi,
          --   toModule_totalize_of_le hjk hj]
          simp only [map_add]
          

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 y : DirectSum ι G
x✝¹ : ∃ j, (∀ k ∈ DFinsupp.support x, k ≤ j) ∧ (DirectSum.toModule R ι (G j) fun i => totalize G f i j) x = 0
x✝ : ∃ j, (∀ k ∈ DFinsupp.support y, k ≤ j) ∧ (DirectSum.toModule R ι (G j) fun i => totalize G f i j) y = 0
i : ι
hi : ∀ k ∈ DFinsupp.support x, k ≤ i
hxi : (DirectSum.toModule R ι (G i) fun i_1 => totalize G f i_1 i) x = 0
j : ι
hj : ∀ k ∈ DFinsupp.support y, k ≤ j
hyj : (DirectSum.toModule R ι (G j) fun i => totalize G f i j) y = 0
k : ι
hik : i ≤ k
hjk : j ≤ k
⊢ (DirectSum.toModule R ι (G k) fun i => totalize G f i k) x +
      (DirectSum.toModule R ι (G k) fun i => totalize G f i k) y =
    0

Next tactic:
rw [toModule_totalize_of_le hik hi, toModule_totalize_of_le hjk 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
            · rwa [hi] at hik
            · rwa [hi] at hik
            · rwa [hj] at hjk
            exfalso
            apply hi0
            rw [sub_zero]
          simp [LinearMap.map_sub, totalize_of_le, hik, hjk, DirectedSystem.map_map,
            DirectSum.apply_eq_component, DirectSum.component.of]⟩)
      ⟨ind, fun _ h => (Finset.not_mem_empty _ h).elim, LinearMap.map_zero _⟩
      (fun x y ⟨i, hi, hxi⟩ ⟨j, hj, hyj⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, fun l hl =>
          (Finset.mem_union.1 (DFinsupp.support_add hl)).elim (fun hl => le_trans (hi _ hl) hik)
            fun hl => le_trans (hj _ hl) hjk, by
          -- Porting note: this had been
          -- simp [LinearMap.map_add, hxi, hyj, toModule_totalize_of_le hik hi,
          --   toModule_totalize_of_le hjk hj]
          simp only [map_add]
          rw [toModule_totalize_of_le hik hi, toModule_totalize_of_le hjk hj]
          

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 y : DirectSum ι G
x✝¹ : ∃ j, (∀ k ∈ DFinsupp.support x, k ≤ j) ∧ (DirectSum.toModule R ι (G j) fun i => totalize G f i j) x = 0
x✝ : ∃ j, (∀ k ∈ DFinsupp.support y, k ≤ j) ∧ (DirectSum.toModule R ι (G j) fun i => totalize G f i j) y = 0
i : ι
hi : ∀ k ∈ DFinsupp.support x, k ≤ i
hxi : (DirectSum.toModule R ι (G i) fun i_1 => totalize G f i_1 i) x = 0
j : ι
hj : ∀ k ∈ DFinsupp.support y, k ≤ j
hyj : (DirectSum.toModule R ι (G j) fun i => totalize G f i j) y = 0
k : ι
hik : i ≤ k
hjk : j ≤ k
⊢ (f i k hik) ((DirectSum.toModule R ι (G i) fun k => totalize (fun i => G i) f k i) x) +
      (f j k hjk) ((DirectSum.toModule R ι (G j) fun k => totalize (fun i => G i) f k j) y) =
    0

Next tactic:
simp [hxi, hyj]
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
            exfalso
            apply hi0
            rw [sub_zero]
          simp [LinearMap.map_sub, totalize_of_le, hik, hjk, DirectedSystem.map_map,
            DirectSum.apply_eq_component, DirectSum.component.of]⟩)
      ⟨ind, fun _ h => (Finset.not_mem_empty _ h).elim, LinearMap.map_zero _⟩
      (fun x y ⟨i, hi, hxi⟩ ⟨j, hj, hyj⟩ =>
        let ⟨k, hik, hjk⟩ := exists_ge_ge i j
        ⟨k, fun l hl =>
          (Finset.mem_union.1 (DFinsupp.support_add hl)).elim (fun hl => le_trans (hi _ hl) hik)
            fun hl => le_trans (hj _ hl) hjk, by
          -- Porting note: this had been
          -- simp [LinearMap.map_add, hxi, hyj, toModule_totalize_of_le hik hi,
          --   toModule_totalize_of_le hjk hj]
          simp only [map_add]
          rw [toModule_totalize_of_le hik hi, toModule_totalize_of_le hjk hj]
          simp [hxi, hyj]⟩)
      fun a x ⟨i, hi, hxi⟩ =>
      ⟨i, fun k hk => hi k (DirectSum.support_smul _ _ hk), 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 : ι
a : R
x : DirectSum ι G
x✝ : ∃ j, (∀ k ∈ DFinsupp.support x, k ≤ j) ∧ (DirectSum.toModule R ι (G j) fun i => totalize G f i j) x = 0
i : ι
hi : ∀ k ∈ DFinsupp.support x, k ≤ i
hxi : (DirectSum.toModule R ι (G i) fun i_1 => totalize G f i_1 i) x = 0
⊢ (DirectSum.toModule R ι (G i) fun i_1 => totalize G f i_1 i) (a • x) = 0

Next tactic:
simp [LinearMap.map_smul, hxi]
/-- A component that corresponds to zero in the direct limit is already zero in some
bigger module in the directed system. -/
theorem of.zero_exact [IsDirected ι (· ≤ ·)] {i x} (H : of R ι G f i x = 0) :
    ∃ j hij, f i j hij x = (0 : G j) :=
  haveI : Nonempty ι := ⟨i⟩
  let ⟨j, hj, hxj⟩ := of.zero_exact_aux H
  if hx0 : x = 0 then ⟨i, le_rfl, 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✝ : IsDirected ι fun x x_1 => x ≤ x_1
i : ι
x : G i
H : (of R ι G f i) x = 0
this : Nonempty ι
j : ι
hj : ∀ k ∈ DFinsupp.support ((DirectSum.lof R ι G i) x), k ≤ j
hxj : (DirectSum.toModule R ι (G j) fun i => totalize G (fun i j H => f i j H) i j) ((DirectSum.lof R ι G i) x) = 0
hx0 : x = 0
⊢ (f i i (_ : i ≤ i)) x = 0

Next tactic:
simp [hx0]
/-- A component that corresponds to zero in the direct limit is already zero in some
bigger module in the directed system. -/
theorem of.zero_exact [IsDirected ι (· ≤ ·)] {i x} (H : of R ι G f i x = 0) :
    ∃ j hij, f i j hij x = (0 : G j) :=
  haveI : Nonempty ι := ⟨i⟩
  let ⟨j, hj, hxj⟩ := of.zero_exact_aux H
  if hx0 : x = 0 then ⟨i, le_rfl, by simp [hx0]⟩
  else
    have hij : i ≤ j := hj _ <| 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✝ : IsDirected ι fun x x_1 => x ≤ x_1
i : ι
x : G i
H : (of R ι G f i) x = 0
this : Nonempty ι
j : ι
hj : ∀ k ∈ DFinsupp.support ((DirectSum.lof R ι G i) x), k ≤ j
hxj : (DirectSum.toModule R ι (G j) fun i => totalize G (fun i j H => f i j H) i j) ((DirectSum.lof R ι G i) x) = 0
hx0 : ¬x = 0
⊢ i ∈ DFinsupp.support ((DirectSum.lof R ι G i) x)

Next tactic:
simp [DirectSum.apply_eq_component, hx0]
/-- A component that corresponds to zero in the direct limit is already zero in some
bigger module in the directed system. -/
theorem of.zero_exact [IsDirected ι (· ≤ ·)] {i x} (H : of R ι G f i x = 0) :
    ∃ j hij, f i j hij x = (0 : G j) :=
  haveI : Nonempty ι := ⟨i⟩
  let ⟨j, hj, hxj⟩ := of.zero_exact_aux H
  if hx0 : x = 0 then ⟨i, le_rfl, by simp [hx0]⟩
  else
    have hij : i ≤ j := hj _ <| by simp [DirectSum.apply_eq_component, hx0]
    ⟨j, hij, by
      -- porting note: this had been
      -- simpa [totalize_of_le hij] using hxj
      

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✝ : IsDirected ι fun x x_1 => x ≤ x_1
i : ι
x : G i
H : (of R ι G f i) x = 0
this : Nonempty ι
j : ι
hj : ∀ k ∈ DFinsupp.support ((DirectSum.lof R ι G i) x), k ≤ j
hxj : (DirectSum.toModule R ι (G j) fun i => totalize G (fun i j H => f i j H) i j) ((DirectSum.lof R ι G i) x) = 0
hx0 : ¬x = 0
hij : i ≤ j
⊢ (f i j hij) x = 0

Next tactic:
simp only [DirectSum.toModule_lof] at hxj
/-- A component that corresponds to zero in the direct limit is already zero in some
bigger module in the directed system. -/
theorem of.zero_exact [IsDirected ι (· ≤ ·)] {i x} (H : of R ι G f i x = 0) :
    ∃ j hij, f i j hij x = (0 : G j) :=
  haveI : Nonempty ι := ⟨i⟩
  let ⟨j, hj, hxj⟩ := of.zero_exact_aux H
  if hx0 : x = 0 then ⟨i, le_rfl, by simp [hx0]⟩
  else
    have hij : i ≤ j := hj _ <| by simp [DirectSum.apply_eq_component, hx0]
    ⟨j, hij, by
      -- porting note: this had been
      -- simpa [totalize_of_le hij] using hxj
      simp only [DirectSum.toModule_lof] at hxj
      

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✝ : IsDirected ι fun x x_1 => x ≤ x_1
i : ι
x : G i
H : (of R ι G f i) x = 0
this : Nonempty ι
j : ι
hj : ∀ k ∈ DFinsupp.support ((DirectSum.lof R ι G i) x), k ≤ j
hx0 : ¬x = 0
hij : i ≤ j
hxj : (totalize G (fun i j H => f i j H) i j) x = 0
⊢ (f i j hij) x = 0

Next tactic:
rwa [totalize_of_le hij] at hxj
theorem lift_unique [IsDirected ι (· ≤ ·)] (F : DirectLimit G f →+ P) (x) :
    F x = lift G f P (fun i => F.comp (of G f i)) (fun i j hij x => by 

Proof state:
R : Type u
inst✝⁴ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝³ : Preorder ι
G : ι → Type w
inst✝² : (i : ι) → AddCommGroup (G i)
f : (i j : ι) → i ≤ j → G i →+ G j
P : Type u₁
inst✝¹ : AddCommGroup P
g : (i : ι) → G i →+ P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
F : DirectLimit G f →+ P
x✝ : DirectLimit G f
i j : ι
hij : i ≤ j
x : G i
⊢ ((fun i => AddMonoidHom.comp F (of G f i)) j) ((f i j hij) x) = ((fun i => AddMonoidHom.comp F (of G f i)) i) x

Next tactic:
simp
theorem lift_unique [IsDirected ι (· ≤ ·)] (F : DirectLimit G f →+ P) (x) :
    F x = lift G f P (fun i => F.comp (of G f i)) (fun i j hij x => by simp) x := by
  

Proof state:
R : Type u
inst✝⁴ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝³ : Preorder ι
G : ι → Type w
inst✝² : (i : ι) → AddCommGroup (G i)
f : (i j : ι) → i ≤ j → G i →+ G j
P : Type u₁
inst✝¹ : AddCommGroup P
g : (i : ι) → G i →+ P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
F : DirectLimit G f →+ P
x : DirectLimit G f
⊢ F x =
    (lift G f P (fun i => AddMonoidHom.comp F (of G f i))
        (_ : ∀ (i j : ι) (hij : i ≤ j) (x : G i), F ((of G f j) ((f i j hij) x)) = F ((of G f i) x)))
      x

Next tactic:
cases isEmpty_or_nonempty ι
theorem lift_unique [IsDirected ι (· ≤ ·)] (F : DirectLimit G f →+ P) (x) :
    F x = lift G f P (fun i => F.comp (of G f i)) (fun i j hij x => by simp) x := by
  cases isEmpty_or_nonempty ι
  · 

Proof state:
case inl
R : Type u
inst✝⁴ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝³ : Preorder ι
G : ι → Type w
inst✝² : (i : ι) → AddCommGroup (G i)
f : (i j : ι) → i ≤ j → G i →+ G j
P : Type u₁
inst✝¹ : AddCommGroup P
g : (i : ι) → G i →+ P
Hg : ∀ (i j : ι) (hij : i ≤ j) (x : G i), (g j) ((f i j hij) x) = (g i) x
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
F : DirectLimit G f →+ P
x : DirectLimit G f
h✝ : IsEmpty ι
⊢ F x =
    (lift G f P (fun i => AddMonoidHom.comp F (of G f i))
        (_ : ∀ (i j : ι) (hij : i ≤ j) (x : G i), F ((of G f j) ((f i j hij) x)) = F ((of G f i) x)))
      x

Next tactic:
simp_rw [Subsingleton.elim x 0, _root_.map_zero]