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 [of_f]) x := by
  cases isEmpty_or_nonempty ι
  · apply FunLike.congr_fun
    apply Ideal.Quotient.ringHom_ext
    refine FreeCommRing.hom_ext fun ⟨i, _⟩ ↦ ?_
    exact IsEmpty.elim' inferInstance i
  · 

Proof state:
case inr
R : Type u
inst✝⁴ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝³ : Preorder ι
G : ι → Type w
inst✝² : (i : ι) → CommRing (G i)
f : (i j : ι) → i ≤ j → G i → G j
f' : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝¹ : CommRing 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 => RingHom.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 [lift_of]
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 [of_f]) x := by
  cases isEmpty_or_nonempty ι
  · apply FunLike.congr_fun
    apply Ideal.Quotient.ringHom_ext
    refine FreeCommRing.hom_ext fun ⟨i, _⟩ ↦ ?_
    exact IsEmpty.elim' inferInstance i
  · 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 : ι) → CommRing (G i)
f : (i j : ι) → i ≤ j → G i → G j
f' : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝¹ : CommRing 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 => RingHom.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 [lift_of]
lemma lift_injective [Nonempty ι] [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 : ι) → CommRing (G i)
f : (i j : ι) → i ≤ j → G i → G j
f' : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝² : CommRing 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✝¹ : Nonempty ι
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:
simp_rw [injective_iff_map_eq_zero] at injective ⊢
lemma lift_injective [Nonempty ι] [IsDirected ι (· ≤ ·)]
    (injective : ∀ i, Function.Injective <| g i) :
    Function.Injective (lift G f P g Hg) := by
  simp_rw [injective_iff_map_eq_zero] at injective ⊢
  

Proof state:
R : Type u
inst✝⁵ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → CommRing (G i)
f : (i j : ι) → i ≤ j → G i → G j
f' : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝² : CommRing 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✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
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 [Nonempty ι] [IsDirected ι (· ≤ ·)]
    (injective : ∀ i, Function.Injective <| g i) :
    Function.Injective (lift G f P g Hg) := by
  simp_rw [injective_iff_map_eq_zero] at injective ⊢
  intros z hz
  

Proof state:
R : Type u
inst✝⁵ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → CommRing (G i)
f : (i j : ι) → i ≤ j → G i → G j
f' : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝² : CommRing 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✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
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 [Nonempty ι] [IsDirected ι (· ≤ ·)]
    (injective : ∀ i, Function.Injective <| g i) :
    Function.Injective (lift G f P g Hg) := by
  simp_rw [injective_iff_map_eq_zero] at injective ⊢
  intros z hz
  induction' z using DirectLimit.induction_on with _ g
  

Proof state:
case ih
R : Type u
inst✝⁵ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → CommRing (G i)
f : (i j : ι) → i ≤ j → G i → G j
f' : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝² : CommRing 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✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
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 [Nonempty ι] [IsDirected ι (· ≤ ·)]
    (injective : ∀ i, Function.Injective <| g i) :
    Function.Injective (lift G f P g Hg) := by
  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 ih
R : Type u
inst✝⁵ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁴ : Preorder ι
G : ι → Type w
inst✝³ : (i : ι) → CommRing (G i)
f : (i j : ι) → i ≤ j → G i → G j
f' : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝² : CommRing 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✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
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 ring homomorphisms `gᵢ : Gᵢ ⟶ G'ᵢ` such that `g ∘ f = f' ∘ g` induces a ring
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 (fun _ _ h ↦ f _ _ h) →+* DirectLimit G' fun _ _ h ↦ f' _ _ h :=
  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 : ι) → CommRing (G i)
f✝ : (i j : ι) → i ≤ j → G i → G j
f'✝ : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝³ : CommRing 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
f : (i j : ι) → i ≤ j → G i →+* G j
G' : ι → Type v'
inst✝² : (i : ι) → CommRing (G' i)
f' : (i j : ι) → i ≤ j → G' i →+* G' j
G'' : ι → Type v''
inst✝¹ : (i : ι) → CommRing (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+* G'' j
inst✝ : Nonempty ι
g✝ : (i : ι) → G i →+* G' i
hg : ∀ (i j : ι) (h : i ≤ j), RingHom.comp (g✝ j) (f i j h) = RingHom.comp (f' i j h) (g✝ i)
i j : ι
h : i ≤ j
g : G i
⊢ ((fun i => RingHom.comp (of G' (fun x x_1 h => ⇑(f' x x_1 h)) i) (g✝ i)) j) ((f i j h) g) =
    ((fun i => RingHom.comp (of G' (fun x x_1 h => ⇑(f' x x_1 h)) 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 ring homomorphisms `gᵢ : Gᵢ ⟶ G'ᵢ` such that `g ∘ f = f' ∘ g` induces a ring
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 (fun _ _ h ↦ f _ _ h) →+* DirectLimit G' fun _ _ h ↦ f' _ _ h :=
  lift _ _ _ (fun i ↦ (of _ _ _).comp (g i)) fun i j h g ↦ by
      have eq1 := FunLike.congr_fun (hg i j h) g
      

Proof state:
R : Type u
inst✝⁶ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → CommRing (G i)
f✝ : (i j : ι) → i ≤ j → G i → G j
f'✝ : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝³ : CommRing 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
f : (i j : ι) → i ≤ j → G i →+* G j
G' : ι → Type v'
inst✝² : (i : ι) → CommRing (G' i)
f' : (i j : ι) → i ≤ j → G' i →+* G' j
G'' : ι → Type v''
inst✝¹ : (i : ι) → CommRing (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+* G'' j
inst✝ : Nonempty ι
g✝ : (i : ι) → G i →+* G' i
hg : ∀ (i j : ι) (h : i ≤ j), RingHom.comp (g✝ j) (f i j h) = RingHom.comp (f' i j h) (g✝ i)
i j : ι
h : i ≤ j
g : G i
eq1 : (RingHom.comp (g✝ j) (f i j h)) g = (RingHom.comp (f' i j h) (g✝ i)) g
⊢ ((fun i => RingHom.comp (of G' (fun x x_1 h => ⇑(f' x x_1 h)) i) (g✝ i)) j) ((f i j h) g) =
    ((fun i => RingHom.comp (of G' (fun x x_1 h => ⇑(f' x x_1 h)) i) (g✝ i)) i) g

Next tactic:
simp only [RingHom.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 ring homomorphisms `gᵢ : Gᵢ ⟶ G'ᵢ` such that `g ∘ f = f' ∘ g` induces a ring
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 (fun _ _ h ↦ f _ _ h) →+* DirectLimit G' fun _ _ h ↦ f' _ _ h :=
  lift _ _ _ (fun i ↦ (of _ _ _).comp (g i)) fun i j h g ↦ by
      have eq1 := FunLike.congr_fun (hg i j h) g
      simp only [RingHom.coe_comp, Function.comp_apply] at eq1 ⊢
      

Proof state:
R : Type u
inst✝⁶ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁵ : Preorder ι
G : ι → Type w
inst✝⁴ : (i : ι) → CommRing (G i)
f✝ : (i j : ι) → i ≤ j → G i → G j
f'✝ : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝³ : CommRing 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
f : (i j : ι) → i ≤ j → G i →+* G j
G' : ι → Type v'
inst✝² : (i : ι) → CommRing (G' i)
f' : (i j : ι) → i ≤ j → G' i →+* G' j
G'' : ι → Type v''
inst✝¹ : (i : ι) → CommRing (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+* G'' j
inst✝ : Nonempty ι
g✝ : (i : ι) → G i →+* G' i
hg : ∀ (i j : ι) (h : i ≤ j), RingHom.comp (g✝ j) (f i j h) = RingHom.comp (f' i j h) (g✝ i)
i j : ι
h : i ≤ j
g : G i
eq1 : (g✝ j) ((f i j h) g) = (f' i j h) ((g✝ i) g)
⊢ (of G' (fun x x_1 h => ⇑(f' x x_1 h)) j) ((g✝ j) ((f i j h) g)) = (of G' (fun x x_1 h => ⇑(f' x x_1 h)) i) ((g✝ i) g)

Next tactic:
rw [eq1, of_f]
@[simp] lemma map_id [IsDirected ι (· ≤ ·)] :
    map (fun i ↦ RingHom.id _) (fun _ _ _ ↦ rfl) =
    RingHom.id (DirectLimit G fun _ _ h ↦ f _ _ h) :=
  FunLike.ext _ _ fun x ↦ 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 : ι) → CommRing (G i)
f✝ : (i j : ι) → i ≤ j → G i → G j
f'✝ : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝⁴ : CommRing 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
f : (i j : ι) → i ≤ j → G i →+* G j
G' : ι → Type v'
inst✝³ : (i : ι) → CommRing (G' i)
f' : (i j : ι) → i ≤ j → G' i →+* G' j
G'' : ι → Type v''
inst✝² : (i : ι) → CommRing (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+* G'' j
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
x : DirectLimit G fun x x_1 h => ⇑(f x x_1 h)
i : ι
g : G i
⊢ (map (fun i => RingHom.id (G i))
        (_ :
          ∀ (x x_1 : ι) (x_2 : x ≤ x_1),
            RingHom.comp ((fun i => RingHom.id (G i)) x_1) (f x x_1 x_2) =
              RingHom.comp ((fun i => RingHom.id (G i)) x_1) (f x x_1 x_2)))
      ((of G (fun x x_1 h => ⇑(f x x_1 h)) i) g) =
    (RingHom.id (DirectLimit G fun x x_1 h => ⇑(f x x_1 h))) ((of G (fun x x_1 h => ⇑(f x x_1 h)) 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 (fun _ _ h ↦ f _ _ h) →+* DirectLimit G'' fun _ _ h ↦ f'' _ _ h) =
    (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 : ι) → CommRing (G i)
f✝ : (i j : ι) → i ≤ j → G i → G j
f'✝ : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝⁴ : CommRing 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
f : (i j : ι) → i ≤ j → G i →+* G j
G' : ι → Type v'
inst✝³ : (i : ι) → CommRing (G' i)
f' : (i j : ι) → i ≤ j → G' i →+* G' j
G'' : ι → Type v''
inst✝² : (i : ι) → CommRing (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+* G'' j
inst✝¹ : Nonempty ι
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), RingHom.comp (g₁ j) (f i j h) = RingHom.comp (f' i j h) (g₁ i)
hg₂ : ∀ (i j : ι) (h : i ≤ j), RingHom.comp (g₂ j) (f' i j h) = RingHom.comp (f'' i j h) (g₂ i)
i j : ι
h : i ≤ j
⊢ RingHom.comp ((fun i => RingHom.comp (g₂ i) (g₁ i)) j) (f i j h) =
    RingHom.comp (f'' i j h) ((fun i => RingHom.comp (g₂ i) (g₁ i)) i)

Next tactic:
rw [RingHom.comp_assoc, hg₁ i, ← RingHom.comp_assoc, hg₂ i, RingHom.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 (fun _ _ h ↦ f _ _ h) →+* DirectLimit G'' fun _ _ h ↦ f'' _ _ h) =
    (map (fun i ↦ (g₂ i).comp (g₁ i)) fun i j h ↦ by
      rw [RingHom.comp_assoc, hg₁ i, ← RingHom.comp_assoc, hg₂ i, RingHom.comp_assoc] :
      DirectLimit G (fun _ _ h ↦ f _ _ h) →+* DirectLimit G'' fun _ _ h ↦ f'' _ _ h) :=
  FunLike.ext _ _ fun x ↦ 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 : ι) → CommRing (G i)
f✝ : (i j : ι) → i ≤ j → G i → G j
f'✝ : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝⁴ : CommRing 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
f : (i j : ι) → i ≤ j → G i →+* G j
G' : ι → Type v'
inst✝³ : (i : ι) → CommRing (G' i)
f' : (i j : ι) → i ≤ j → G' i →+* G' j
G'' : ι → Type v''
inst✝² : (i : ι) → CommRing (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+* G'' j
inst✝¹ : Nonempty ι
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), RingHom.comp (g₁ j) (f i j h) = RingHom.comp (f' i j h) (g₁ i)
hg₂ : ∀ (i j : ι) (h : i ≤ j), RingHom.comp (g₂ j) (f' i j h) = RingHom.comp (f'' i j h) (g₂ i)
x : DirectLimit G fun x x_1 h => ⇑(f x x_1 h)
i : ι
g : G i
⊢ (RingHom.comp (map g₂ hg₂) (map g₁ hg₁)) ((of G (fun x x_1 h => ⇑(f x x_1 h)) i) g) =
    (map (fun i => RingHom.comp (g₂ i) (g₁ i))
        (_ :
          ∀ (i j : ι) (h : i ≤ j),
            RingHom.comp ((fun i => RingHom.comp (g₂ i) (g₁ i)) j) (f i j h) =
              RingHom.comp (f'' i j h) ((fun i => RingHom.comp (g₂ i) (g₁ i)) i)))
      ((of G (fun x x_1 h => ⇑(f x x_1 h)) 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).toRingHom.comp (f i j h) = (f' i j h).comp (e i)) :
    DirectLimit G (fun _ _ h ↦ f _ _ h) ≃+* DirectLimit G' fun _ _ h ↦ f' _ _ h :=
  RingEquiv.ofHomInv
    (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 : ι) → CommRing (G i)
f✝ : (i j : ι) → i ≤ j → G i → G j
f'✝ : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝⁴ : CommRing 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
f : (i j : ι) → i ≤ j → G i →+* G j
G' : ι → Type v'
inst✝³ : (i : ι) → CommRing (G' i)
f' : (i j : ι) → i ≤ j → G' i →+* G' j
G'' : ι → Type v''
inst✝² : (i : ι) → CommRing (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+* G'' j
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
e : (i : ι) → G i ≃+* G' i
he : ∀ (i j : ι) (h : i ≤ j), RingHom.comp (RingEquiv.toRingHom (e j)) (f i j h) = RingHom.comp (f' i j h) ↑(e i)
i j : ι
h : i ≤ j
x : G' i
⊢ (RingHom.comp ((fun i => ↑(RingEquiv.symm (e i))) j) (f' i j h)) x =
    (RingHom.comp (f i j h) ((fun i => ↑(RingEquiv.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).toRingHom.comp (f i j h) = (f' i j h).comp (e i)) :
    DirectLimit G (fun _ _ h ↦ f _ _ h) ≃+* DirectLimit G' fun _ _ h ↦ f' _ _ h :=
  RingEquiv.ofHomInv
    (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 : ι) → CommRing (G i)
f✝ : (i j : ι) → i ≤ j → G i → G j
f'✝ : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝⁴ : CommRing 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
f : (i j : ι) → i ≤ j → G i →+* G j
G' : ι → Type v'
inst✝³ : (i : ι) → CommRing (G' i)
f' : (i j : ι) → i ≤ j → G' i →+* G' j
G'' : ι → Type v''
inst✝² : (i : ι) → CommRing (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+* G'' j
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
e : (i : ι) → G i ≃+* G' i
he : ∀ (i j : ι) (h : i ≤ j), RingHom.comp (RingEquiv.toRingHom (e j)) (f i j h) = RingHom.comp (f' i j h) ↑(e i)
i j : ι
h : i ≤ j
x : G' i
eq1 :
  (RingHom.comp (RingEquiv.toRingHom (e j)) (f i j h)) ((RingEquiv.symm (e i)) x) =
    (RingHom.comp (f' i j h) ↑(e i)) ((RingEquiv.symm (e i)) x)
⊢ (RingHom.comp ((fun i => ↑(RingEquiv.symm (e i))) j) (f' i j h)) x =
    (RingHom.comp (f i j h) ((fun i => ↑(RingEquiv.symm (e i))) i)) x

Next tactic:
simp only [RingEquiv.toRingHom_eq_coe, RingHom.coe_comp, RingHom.coe_coe, Function.comp_apply,
        RingEquiv.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).toRingHom.comp (f i j h) = (f' i j h).comp (e i)) :
    DirectLimit G (fun _ _ h ↦ f _ _ h) ≃+* DirectLimit G' fun _ _ h ↦ f' _ _ h :=
  RingEquiv.ofHomInv
    (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 [RingEquiv.toRingHom_eq_coe, RingHom.coe_comp, RingHom.coe_coe, Function.comp_apply,
        RingEquiv.apply_symm_apply] at eq1 ⊢
      

Proof state:
R : Type u
inst✝⁷ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁶ : Preorder ι
G : ι → Type w
inst✝⁵ : (i : ι) → CommRing (G i)
f✝ : (i j : ι) → i ≤ j → G i → G j
f'✝ : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝⁴ : CommRing 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
f : (i j : ι) → i ≤ j → G i →+* G j
G' : ι → Type v'
inst✝³ : (i : ι) → CommRing (G' i)
f' : (i j : ι) → i ≤ j → G' i →+* G' j
G'' : ι → Type v''
inst✝² : (i : ι) → CommRing (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+* G'' j
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
e : (i : ι) → G i ≃+* G' i
he : ∀ (i j : ι) (h : i ≤ j), RingHom.comp (RingEquiv.toRingHom (e j)) (f i j h) = RingHom.comp (f' i j h) ↑(e i)
i j : ι
h : i ≤ j
x : G' i
eq1 : (e j) ((f i j h) ((RingEquiv.symm (e i)) x)) = (f' i j h) x
⊢ (RingEquiv.symm (e j)) ((f' i j h) x) = (f i j h) ((RingEquiv.symm (e i)) x)

Next tactic:
simp [← eq1, of_f]
/--
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).toRingHom.comp (f i j h) = (f' i j h).comp (e i)) :
    DirectLimit G (fun _ _ h ↦ f _ _ h) ≃+* DirectLimit G' fun _ _ h ↦ f' _ _ h :=
  RingEquiv.ofHomInv
    (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 [RingEquiv.toRingHom_eq_coe, RingHom.coe_comp, RingHom.coe_coe, Function.comp_apply,
        RingEquiv.apply_symm_apply] at eq1 ⊢
      simp [← eq1, of_f])
    (FunLike.ext _ _ fun x ↦ x.induction_on <| by 

Proof state:
R : Type u
inst✝⁷ : Ring R
ι : Type v
dec_ι : DecidableEq ι
inst✝⁶ : Preorder ι
G : ι → Type w
inst✝⁵ : (i : ι) → CommRing (G i)
f✝ : (i j : ι) → i ≤ j → G i → G j
f'✝ : (i j : ι) → i ≤ j → G i →+* G j
P : Type u₁
inst✝⁴ : CommRing 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
f : (i j : ι) → i ≤ j → G i →+* G j
G' : ι → Type v'
inst✝³ : (i : ι) → CommRing (G' i)
f' : (i j : ι) → i ≤ j → G' i →+* G' j
G'' : ι → Type v''
inst✝² : (i : ι) → CommRing (G'' i)
f'' : (i j : ι) → i ≤ j → G'' i →+* G'' j
inst✝¹ : Nonempty ι
inst✝ : IsDirected ι fun x x_1 => x ≤ x_1
e : (i : ι) → G i ≃+* G' i
he : ∀ (i j : ι) (h : i ≤ j), RingHom.comp (RingEquiv.toRingHom (e j)) (f i j h) = RingHom.comp (f' i j h) ↑(e i)
x : DirectLimit G fun x x_1 h => ⇑(f x x_1 h)
⊢ ∀ (i : ι) (x : G i),
    (RingHom.comp
          ↑(map (fun i => ↑(RingEquiv.symm (e i)))
              (_ :
                ∀ (i j : ι) (h : i ≤ j),
                  RingHom.comp ((fun i => ↑(RingEquiv.symm (e i))) j) (f' i j h) =
                    RingHom.comp (f i j h) ((fun i => ↑(RingEquiv.symm (e i))) i)))
          ↑(map (fun x => ↑(e x)) he))
        ((of G (fun x x_1 h => ⇑(f x x_1 h)) i) x) =
      (RingHom.id (DirectLimit G fun x x_1 h => ⇑(f x x_1 h))) ((of G (fun x x_1 h => ⇑(f x x_1 h)) i) x)

Next tactic:
simp