l3lab/ntp-mathlib huggingface dataset:
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 ι
  · simp_rw [Subsingleton.elim x 0, _root_.map_zero]
  · 

Proof state:
case inr
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✝ : Nonempty ι
⊢ 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:
exact DirectLimit.induction_on x fun i x => by 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
  cases isEmpty_or_nonempty ι
  · simp_rw [Subsingleton.elim x 0, _root_.map_zero]
  · exact DirectLimit.induction_on x fun 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)
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✝ : Nonempty ι
i : ι
x : G i
⊢ F ((of G f i) 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)))
      ((of G f i) x)

Next tactic:
simp
lemma lift_injective [IsDirected ι (· ≤ ·)]
    (injective : ∀ i, Function.Injective <| g i) :
    Function.Injective (lift G f P g Hg) := 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
injective : ∀ (i : ι), Function.Injective ⇑(g i)
⊢ Function.Injective ⇑(lift G f P g Hg)

Next tactic:
cases isEmpty_or_nonempty ι
lemma lift_injective [IsDirected ι (· ≤ ·)]
    (injective : ∀ i, Function.Injective <| g i) :
    Function.Injective (lift G f P g Hg) := 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
injective : ∀ (i : ι), Function.Injective ⇑(g i)
h✝ : IsEmpty ι
⊢ Function.Injective ⇑(lift G f P g Hg)

Next tactic:
apply Function.injective_of_subsingleton
lemma lift_injective [IsDirected ι (· ≤ ·)]
    (injective : ∀ i, Function.Injective <| g i) :
    Function.Injective (lift G f P g Hg) := by
  cases isEmpty_or_nonempty ι
  · apply Function.injective_of_subsingleton
  

Proof state:
case inr
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
injective : ∀ (i : ι), Function.Injective ⇑(g i)
h✝ : Nonempty ι
⊢ Function.Injective ⇑(lift G f P g Hg)

Next tactic:
simp_rw [injective_iff_map_eq_zero] at injective ⊢
lemma lift_injective [IsDirected ι (· ≤ ·)]
    (injective : ∀ i, Function.Injective <| g i) :
    Function.Injective (lift G f P g Hg) := by
  cases isEmpty_or_nonempty ι
  · apply Function.injective_of_subsingleton
  simp_rw [injective_iff_map_eq_zero] at injective ⊢
  

Proof state:
case inr
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
h✝ : Nonempty ι
injective : ∀ (i : ι) (a : G i), (g i) a = 0 → a = 0
⊢ ∀ (a : DirectLimit G f), (lift G f P g Hg) a = 0 → a = 0

Next tactic:
intros z hz
lemma lift_injective [IsDirected ι (· ≤ ·)]
    (injective : ∀ i, Function.Injective <| g i) :
    Function.Injective (lift G f P g Hg) := by
  cases isEmpty_or_nonempty ι
  · apply Function.injective_of_subsingleton
  simp_rw [injective_iff_map_eq_zero] at injective ⊢
  intros z hz
  

Proof state:
case inr
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
h✝ : Nonempty ι
injective : ∀ (i : ι) (a : G i), (g i) a = 0 → a = 0
z : DirectLimit G f
hz : (lift G f P g Hg) z = 0
⊢ z = 0

Next tactic:
induction' z using DirectLimit.induction_on with _ g
lemma lift_injective [IsDirected ι (· ≤ ·)]
    (injective : ∀ i, Function.Injective <| g i) :
    Function.Injective (lift G f P g Hg) := by
  cases isEmpty_or_nonempty ι
  · apply Function.injective_of_subsingleton
  simp_rw [injective_iff_map_eq_zero] at injective ⊢
  intros z hz
  induction' z using DirectLimit.induction_on with _ g
  

Proof state:
case inr.ih
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
h✝ : Nonempty ι
injective : ∀ (i : ι) (a : G i), (g✝ i) a = 0 → a = 0
i✝ : ι
g : G i✝
hz : (lift G f P g✝ Hg) ((of G f i✝) g) = 0
⊢ (of G f i✝) g = 0

Next tactic:
rw [lift_of] at hz
lemma lift_injective [IsDirected ι (· ≤ ·)]
    (injective : ∀ i, Function.Injective <| g i) :
    Function.Injective (lift G f P g Hg) := by
  cases isEmpty_or_nonempty ι
  · apply Function.injective_of_subsingleton
  simp_rw [injective_iff_map_eq_zero] at injective ⊢
  intros z hz
  induction' z using DirectLimit.induction_on with _ g
  rw [lift_of] at hz
  

Proof state:
case inr.ih
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
h✝ : Nonempty ι
injective : ∀ (i : ι) (a : G i), (g✝ i) a = 0 → a = 0
i✝ : ι
g : G i✝
hz : (g✝ i✝) g = 0
⊢ (of G f i✝) g = 0

Next tactic:
rw [injective _ g hz, _root_.map_zero]
/--
Consider direct limits `lim G` and `lim G'` with direct system `f` and `f'` respectively, any
family of group homomorphisms `gᵢ : Gᵢ ⟶ G'ᵢ` such that `g ∘ f = f' ∘ g` induces a group
homomorphism `lim G ⟶ lim G'`.
-/
def map (g : (i : ι) → G i →+ G' i)
    (hg : ∀ i j h, (g j).comp (f i j h) = (f' i j h).comp (g i)) :
    DirectLimit G f →+ DirectLimit G' f' :=
  lift _ _ _ (fun i ↦ (of _ _ _).comp (g i)) fun i j h g ↦ 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
G' : ι → Type v'
inst✝¹ : (i : ι) → AddCommGroup (G' i)
f' : (i j : ι) → i ≤ j → G' i →+ G' j
G'' : ι → Type v''
inst✝ : (i : ι) → AddCommGroup (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j
g✝ : (i : ι) → G i →+ G' i
hg : ∀ (i j : ι) (h : i ≤ j), AddMonoidHom.comp (g✝ j) (f i j h) = AddMonoidHom.comp (f' i j h) (g✝ i)
i j : ι
h : i ≤ j
g : G i
⊢ ((fun i => AddMonoidHom.comp (of G' f' i) (g✝ i)) j) ((f i j h) g) =
    ((fun i => AddMonoidHom.comp (of G' f' i) (g✝ i)) i) g

Next tactic:
cases isEmpty_or_nonempty ι
/--
Consider direct limits `lim G` and `lim G'` with direct system `f` and `f'` respectively, any
family of group homomorphisms `gᵢ : Gᵢ ⟶ G'ᵢ` such that `g ∘ f = f' ∘ g` induces a group
homomorphism `lim G ⟶ lim G'`.
-/
def map (g : (i : ι) → G i →+ G' i)
    (hg : ∀ i j h, (g j).comp (f i j h) = (f' i j h).comp (g i)) :
    DirectLimit G f →+ DirectLimit G' f' :=
  lift _ _ _ (fun i ↦ (of _ _ _).comp (g i)) fun i j h g ↦ 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
G' : ι → Type v'
inst✝¹ : (i : ι) → AddCommGroup (G' i)
f' : (i j : ι) → i ≤ j → G' i →+ G' j
G'' : ι → Type v''
inst✝ : (i : ι) → AddCommGroup (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j
g✝ : (i : ι) → G i →+ G' i
hg : ∀ (i j : ι) (h : i ≤ j), AddMonoidHom.comp (g✝ j) (f i j h) = AddMonoidHom.comp (f' i j h) (g✝ i)
i j : ι
h : i ≤ j
g : G i
h✝ : IsEmpty ι
⊢ ((fun i => AddMonoidHom.comp (of G' f' i) (g✝ i)) j) ((f i j h) g) =
    ((fun i => AddMonoidHom.comp (of G' f' i) (g✝ i)) i) g

Next tactic:
exact Subsingleton.elim _ _
/--
Consider direct limits `lim G` and `lim G'` with direct system `f` and `f'` respectively, any
family of group homomorphisms `gᵢ : Gᵢ ⟶ G'ᵢ` such that `g ∘ f = f' ∘ g` induces a group
homomorphism `lim G ⟶ lim G'`.
-/
def map (g : (i : ι) → G i →+ G' i)
    (hg : ∀ i j h, (g j).comp (f i j h) = (f' i j h).comp (g i)) :
    DirectLimit G f →+ DirectLimit G' f' :=
  lift _ _ _ (fun i ↦ (of _ _ _).comp (g i)) fun i j h g ↦ by
    cases isEmpty_or_nonempty ι
    · exact Subsingleton.elim _ _
    · 

Proof state:
case inr
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
G' : ι → Type v'
inst✝¹ : (i : ι) → AddCommGroup (G' i)
f' : (i j : ι) → i ≤ j → G' i →+ G' j
G'' : ι → Type v''
inst✝ : (i : ι) → AddCommGroup (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j
g✝ : (i : ι) → G i →+ G' i
hg : ∀ (i j : ι) (h : i ≤ j), AddMonoidHom.comp (g✝ j) (f i j h) = AddMonoidHom.comp (f' i j h) (g✝ i)
i j : ι
h : i ≤ j
g : G i
h✝ : Nonempty ι
⊢ ((fun i => AddMonoidHom.comp (of G' f' i) (g✝ i)) j) ((f i j h) g) =
    ((fun i => AddMonoidHom.comp (of G' f' i) (g✝ i)) i) g

Next tactic:
have eq1 := FunLike.congr_fun (hg i j h) g
/--
Consider direct limits `lim G` and `lim G'` with direct system `f` and `f'` respectively, any
family of group homomorphisms `gᵢ : Gᵢ ⟶ G'ᵢ` such that `g ∘ f = f' ∘ g` induces a group
homomorphism `lim G ⟶ lim G'`.
-/
def map (g : (i : ι) → G i →+ G' i)
    (hg : ∀ i j h, (g j).comp (f i j h) = (f' i j h).comp (g i)) :
    DirectLimit G f →+ DirectLimit G' f' :=
  lift _ _ _ (fun i ↦ (of _ _ _).comp (g i)) fun i j h g ↦ by
    cases isEmpty_or_nonempty ι
    · exact Subsingleton.elim _ _
    · have eq1 := FunLike.congr_fun (hg i j h) g
      

Proof state:
case inr
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
G' : ι → Type v'
inst✝¹ : (i : ι) → AddCommGroup (G' i)
f' : (i j : ι) → i ≤ j → G' i →+ G' j
G'' : ι → Type v''
inst✝ : (i : ι) → AddCommGroup (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j
g✝ : (i : ι) → G i →+ G' i
hg : ∀ (i j : ι) (h : i ≤ j), AddMonoidHom.comp (g✝ j) (f i j h) = AddMonoidHom.comp (f' i j h) (g✝ i)
i j : ι
h : i ≤ j
g : G i
h✝ : Nonempty ι
eq1 : (AddMonoidHom.comp (g✝ j) (f i j h)) g = (AddMonoidHom.comp (f' i j h) (g✝ i)) g
⊢ ((fun i => AddMonoidHom.comp (of G' f' i) (g✝ i)) j) ((f i j h) g) =
    ((fun i => AddMonoidHom.comp (of G' f' i) (g✝ i)) i) g

Next tactic:
simp only [AddMonoidHom.coe_comp, Function.comp_apply] at eq1 ⊢
/--
Consider direct limits `lim G` and `lim G'` with direct system `f` and `f'` respectively, any
family of group homomorphisms `gᵢ : Gᵢ ⟶ G'ᵢ` such that `g ∘ f = f' ∘ g` induces a group
homomorphism `lim G ⟶ lim G'`.
-/
def map (g : (i : ι) → G i →+ G' i)
    (hg : ∀ i j h, (g j).comp (f i j h) = (f' i j h).comp (g i)) :
    DirectLimit G f →+ DirectLimit G' f' :=
  lift _ _ _ (fun i ↦ (of _ _ _).comp (g i)) fun i j h g ↦ by
    cases isEmpty_or_nonempty ι
    · exact Subsingleton.elim _ _
    · have eq1 := FunLike.congr_fun (hg i j h) g
      simp only [AddMonoidHom.coe_comp, Function.comp_apply] at eq1 ⊢
      

Proof state:
case inr
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
G' : ι → Type v'
inst✝¹ : (i : ι) → AddCommGroup (G' i)
f' : (i j : ι) → i ≤ j → G' i →+ G' j
G'' : ι → Type v''
inst✝ : (i : ι) → AddCommGroup (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j
g✝ : (i : ι) → G i →+ G' i
hg : ∀ (i j : ι) (h : i ≤ j), AddMonoidHom.comp (g✝ j) (f i j h) = AddMonoidHom.comp (f' i j h) (g✝ i)
i j : ι
h : i ≤ j
g : G i
h✝ : Nonempty ι
eq1 : (g✝ j) ((f i j h) g) = (f' i j h) ((g✝ i) g)
⊢ (of G' f' j) ((g✝ j) ((f i j h) g)) = (of G' f' i) ((g✝ i) g)

Next tactic:
rw [eq1, of_f]
@[simp] lemma map_id [IsDirected ι (· ≤ ·)] :
    map (fun i ↦ AddMonoidHom.id _) (fun _ _ _ ↦ rfl) = AddMonoidHom.id (DirectLimit G f) :=
  FunLike.ext _ _ fun x ↦ (isEmpty_or_nonempty ι).elim (fun _ ↦ Subsingleton.elim _ _) fun _ ↦
    x.induction_on fun i g ↦ 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
G' : ι → Type v'
inst✝² : (i : ι) → AddCommGroup (G' i)
f' : (i j : ι) → i ≤ j → G' i →+ G' j
G'' : ι → Type v''
inst✝¹ : (i : ι) → AddCommGroup (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x : DirectLimit G f
x✝ : Nonempty ι
i : ι
g : G i
⊢ (map (fun i => AddMonoidHom.id (G i))
        (_ :
          ∀ (x x_1 : ι) (x_2 : x ≤ x_1),
            AddMonoidHom.comp ((fun i => AddMonoidHom.id (G i)) x_1) (f x x_1 x_2) =
              AddMonoidHom.comp ((fun i => AddMonoidHom.id (G i)) x_1) (f x x_1 x_2)))
      ((of G f i) g) =
    (AddMonoidHom.id (DirectLimit G f)) ((of G f i) g)

Next tactic:
simp
lemma map_comp [IsDirected ι (· ≤ ·)]
    (g₁ : (i : ι) → G i →+ G' i) (g₂ : (i : ι) → G' i →+ G'' i)
    (hg₁ : ∀ i j h, (g₁ j).comp (f i j h) = (f' i j h).comp (g₁ i))
    (hg₂ : ∀ i j h, (g₂ j).comp (f' i j h) = (f'' i j h).comp (g₂ i)) :
    ((map g₂ hg₂).comp (map g₁ hg₁) :
      DirectLimit G f →+ DirectLimit G'' f'') =
    (map (fun i ↦ (g₂ i).comp (g₁ i)) 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)
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
G' : ι → Type v'
inst✝² : (i : ι) → AddCommGroup (G' i)
f' : (i j : ι) → i ≤ j → G' i →+ G' j
G'' : ι → Type v''
inst✝¹ : (i : ι) → AddCommGroup (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
g₁ : (i : ι) → G i →+ G' i
g₂ : (i : ι) → G' i →+ G'' i
hg₁ : ∀ (i j : ι) (h : i ≤ j), AddMonoidHom.comp (g₁ j) (f i j h) = AddMonoidHom.comp (f' i j h) (g₁ i)
hg₂ : ∀ (i j : ι) (h : i ≤ j), AddMonoidHom.comp (g₂ j) (f' i j h) = AddMonoidHom.comp (f'' i j h) (g₂ i)
i j : ι
h : i ≤ j
⊢ AddMonoidHom.comp ((fun i => AddMonoidHom.comp (g₂ i) (g₁ i)) j) (f i j h) =
    AddMonoidHom.comp (f'' i j h) ((fun i => AddMonoidHom.comp (g₂ i) (g₁ i)) i)

Next tactic:
rw [AddMonoidHom.comp_assoc, hg₁ i, ← AddMonoidHom.comp_assoc, hg₂ i,
        AddMonoidHom.comp_assoc]
lemma map_comp [IsDirected ι (· ≤ ·)]
    (g₁ : (i : ι) → G i →+ G' i) (g₂ : (i : ι) → G' i →+ G'' i)
    (hg₁ : ∀ i j h, (g₁ j).comp (f i j h) = (f' i j h).comp (g₁ i))
    (hg₂ : ∀ i j h, (g₂ j).comp (f' i j h) = (f'' i j h).comp (g₂ i)) :
    ((map g₂ hg₂).comp (map g₁ hg₁) :
      DirectLimit G f →+ DirectLimit G'' f'') =
    (map (fun i ↦ (g₂ i).comp (g₁ i)) fun i j h ↦ by
      rw [AddMonoidHom.comp_assoc, hg₁ i, ← AddMonoidHom.comp_assoc, hg₂ i,
        AddMonoidHom.comp_assoc] :
      DirectLimit G f →+ DirectLimit G'' f'') :=
  FunLike.ext _ _ fun x ↦ (isEmpty_or_nonempty ι).elim (fun _ ↦ Subsingleton.elim _ _) fun _ ↦
    x.induction_on fun i g ↦ 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
G' : ι → Type v'
inst✝² : (i : ι) → AddCommGroup (G' i)
f' : (i j : ι) → i ≤ j → G' i →+ G' j
G'' : ι → Type v''
inst✝¹ : (i : ι) → AddCommGroup (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
g₁ : (i : ι) → G i →+ G' i
g₂ : (i : ι) → G' i →+ G'' i
hg₁ : ∀ (i j : ι) (h : i ≤ j), AddMonoidHom.comp (g₁ j) (f i j h) = AddMonoidHom.comp (f' i j h) (g₁ i)
hg₂ : ∀ (i j : ι) (h : i ≤ j), AddMonoidHom.comp (g₂ j) (f' i j h) = AddMonoidHom.comp (f'' i j h) (g₂ i)
x : DirectLimit G f
x✝ : Nonempty ι
i : ι
g : G i
⊢ (AddMonoidHom.comp (map g₂ hg₂) (map g₁ hg₁)) ((of G f i) g) =
    (map (fun i => AddMonoidHom.comp (g₂ i) (g₁ i))
        (_ :
          ∀ (i j : ι) (h : i ≤ j),
            AddMonoidHom.comp ((fun i => AddMonoidHom.comp (g₂ i) (g₁ i)) j) (f i j h) =
              AddMonoidHom.comp (f'' i j h) ((fun i => AddMonoidHom.comp (g₂ i) (g₁ i)) i)))
      ((of G f i) g)

Next tactic:
simp
/--
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 ≃+ G' i)
    (he : ∀ i j h, (e j).toAddMonoidHom.comp (f i j h) = (f' i j h).comp (e i)) :
    DirectLimit G f ≃+ DirectLimit G' f' :=
  AddMonoidHom.toAddEquiv (map (e ·) he)
    (map (fun i ↦ (e i).symm) fun i j h ↦ FunLike.ext _ _ fun 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
G' : ι → Type v'
inst✝² : (i : ι) → AddCommGroup (G' i)
f' : (i j : ι) → i ≤ j → G' i →+ G' j
G'' : ι → Type v''
inst✝¹ : (i : ι) → AddCommGroup (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
e : (i : ι) → G i ≃+ G' i
he :
  ∀ (i j : ι) (h : i ≤ j),
    AddMonoidHom.comp (AddEquiv.toAddMonoidHom (e j)) (f i j h) = AddMonoidHom.comp (f' i j h) ↑(e i)
i j : ι
h : i ≤ j
x : G' i
⊢ (AddMonoidHom.comp ((fun i => ↑(AddEquiv.symm (e i))) j) (f' i j h)) x =
    (AddMonoidHom.comp (f i j h) ((fun i => ↑(AddEquiv.symm (e i))) i)) x

Next tactic:
have eq1 := FunLike.congr_fun (he i j h) ((e i).symm x)
/--
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 ≃+ G' i)
    (he : ∀ i j h, (e j).toAddMonoidHom.comp (f i j h) = (f' i j h).comp (e i)) :
    DirectLimit G f ≃+ DirectLimit G' f' :=
  AddMonoidHom.toAddEquiv (map (e ·) he)
    (map (fun i ↦ (e i).symm) fun i j h ↦ FunLike.ext _ _ fun x ↦ by
      have eq1 := FunLike.congr_fun (he i j h) ((e i).symm x)
      

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
G' : ι → Type v'
inst✝² : (i : ι) → AddCommGroup (G' i)
f' : (i j : ι) → i ≤ j → G' i →+ G' j
G'' : ι → Type v''
inst✝¹ : (i : ι) → AddCommGroup (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
e : (i : ι) → G i ≃+ G' i
he :
  ∀ (i j : ι) (h : i ≤ j),
    AddMonoidHom.comp (AddEquiv.toAddMonoidHom (e j)) (f i j h) = AddMonoidHom.comp (f' i j h) ↑(e i)
i j : ι
h : i ≤ j
x : G' i
eq1 :
  (AddMonoidHom.comp (AddEquiv.toAddMonoidHom (e j)) (f i j h)) ((AddEquiv.symm (e i)) x) =
    (AddMonoidHom.comp (f' i j h) ↑(e i)) ((AddEquiv.symm (e i)) x)
⊢ (AddMonoidHom.comp ((fun i => ↑(AddEquiv.symm (e i))) j) (f' i j h)) x =
    (AddMonoidHom.comp (f i j h) ((fun i => ↑(AddEquiv.symm (e i))) i)) x

Next tactic:
simp only [AddMonoidHom.coe_comp, AddEquiv.coe_toAddMonoidHom, Function.comp_apply,
        AddMonoidHom.coe_coe, AddEquiv.apply_symm_apply] at eq1 ⊢
/--
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 ≃+ G' i)
    (he : ∀ i j h, (e j).toAddMonoidHom.comp (f i j h) = (f' i j h).comp (e i)) :
    DirectLimit G f ≃+ DirectLimit G' f' :=
  AddMonoidHom.toAddEquiv (map (e ·) he)
    (map (fun i ↦ (e i).symm) fun i j h ↦ FunLike.ext _ _ fun x ↦ by
      have eq1 := FunLike.congr_fun (he i j h) ((e i).symm x)
      simp only [AddMonoidHom.coe_comp, AddEquiv.coe_toAddMonoidHom, Function.comp_apply,
        AddMonoidHom.coe_coe, AddEquiv.apply_symm_apply] at eq1 ⊢
      

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
G' : ι → Type v'
inst✝² : (i : ι) → AddCommGroup (G' i)
f' : (i j : ι) → i ≤ j → G' i →+ G' j
G'' : ι → Type v''
inst✝¹ : (i : ι) → AddCommGroup (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+ G'' j
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
e : (i : ι) → G i ≃+ G' i
he :
  ∀ (i j : ι) (h : i ≤ j),
    AddMonoidHom.comp (AddEquiv.toAddMonoidHom (e j)) (f i j h) = AddMonoidHom.comp (f' i j h) ↑(e i)
i j : ι
h : i ≤ j
x : G' i
eq1 : (e j) ((f i j h) ((AddEquiv.symm (e i)) x)) = (f' i j h) x
⊢ (AddEquiv.symm (e j)) ((f' i j h) x) = (f i j h) ((AddEquiv.symm (e i)) x)

Next tactic:
simp [← eq1, of_f]