-- Lean 4 proof step from Mathlib.Algebra.Algebra.Hom (goal)
Goal:
R : Type u
A : Type v
B : Type w
C : Type u₁
D : Type v₁
inst : CommSemiring R
inst_1 : Semiring A
inst_2 : Semiring B
inst_3 : Semiring C
inst_4 : Semiring D
inst_5 : Algebra R A
inst_6 : Algebra R B
inst_7 : Algebra R C
inst_8 : Algebra R D
g : A →ₐ[R] B
toFun : A → B
map_one' : toFun 1 = 1
map_mul' :
  ∀ (x y : A),
    { toFun := toFun, map_one' := map_one' : OneHom A B }.toFun (x * y) =
      { toFun := toFun, map_one' := map_one' : OneHom A B }.toFun x *
        { toFun := toFun, map_one' := map_one' : OneHom A B }.toFun y
map_zero' : (↑{ toFun := toFun, map_one' := map_one', map_mul' := map_mul' : A →* B } : OneHom A B).toFun 0 = 0
map_add' :
  ∀ (x y : A),
    (↑{ toFun := toFun, map_one' := map_one', map_mul' := map_mul' : A →* B } : OneHom A B).toFun (x + y) =
      (↑{ toFun := toFun, map_one' := map_one', map_mul' := map_mul' : A →* B } : OneHom A B).toFun x +
        (↑{ toFun := toFun, map_one' := map_one', map_mul' := map_mul' : A →* B } : OneHom A B).toFun y
commutes' :
  ∀ (r : R),
    (↑(↑{ toFun := toFun, map_one' := map_one', map_mul' := map_mul', map_zero' := map_zero', map_add' := map_add' :
                    A →+* B } :
                A →* B) :
            OneHom A B).toFun
        ((algebraMap R A : (a : R) → A) r) =
      (algebraMap R B : (a : R) → B) r
h :
  Eq (α := (a : A) → B)
    ((fun (f : A →ₐ[R] B) ↦ (↑(↑f.toRingHom : A →* B) : OneHom A B).toFun)
      { toFun := toFun, map_one' := map_one', map_mul' := map_mul', map_zero' := map_zero', map_add' := map_add',
        commutes' := commutes' })
    ((fun (f : A →ₐ[R] B) ↦ (↑(↑f.toRingHom : A →* B) : OneHom A B).toFun) g)
⊢ { toFun := toFun, map_one' := map_one', map_mul' := map_mul', map_zero' := map_zero', map_add' := map_add',
      commutes' := commutes' : A →ₐ[R] B } =
    g
have rcases : ∀ (toFun_1 : A → B) (map_one'_1 : toFun_1 1 = 1)
  (map_mul'_1 :
    ∀ (x y : A),
      { toFun := toFun_1, map_one' := map_one'_1 : OneHom A B }.toFun (x * y) =
        { toFun := toFun_1, map_one' := map_one'_1 : OneHom A B }.toFun x *
          { toFun := toFun_1, map_one' := map_one'_1 : OneHom A B }.toFun y)
  (map_zero'_1 :
    (↑{ toFun := toFun_1, map_one' := map_one'_1, map_mul' := map_mul'_1 : A →* B } : OneHom A B).toFun 0 = 0)
  (map_add'_1 :
    ∀ (x y : A),
      (↑{ toFun := toFun_1, map_one' := map_one'_1, map_mul' := map_mul'_1 : A →* B } : OneHom A B).toFun (x + y) =
        (↑{ toFun := toFun_1, map_one' := map_one'_1, map_mul' := map_mul'_1 : A →* B } : OneHom A B).toFun x +
          (↑{ toFun := toFun_1, map_one' := map_one'_1, map_mul' := map_mul'_1 : A →* B } : OneHom A B).toFun y)
  (commutes'_1 :
    ∀ (r : R),
      (↑(↑{ toFun := toFun_1, map_one' := map_one'_1, map_mul' := map_mul'_1, map_zero' := map_zero'_1,
                      map_add' := map_add'_1 : A →+* B } :
                  A →* B) :
              OneHom A B).toFun
          ((algebraMap R A : (a : R) → A) r) =
        (algebraMap R B : (a : R) → B) r)
  (h :
    Eq (α := (a : A) → B)
      ((fun (f : A →ₐ[R] B) ↦ (↑(↑f.toRingHom : A →* B) : OneHom A B).toFun)
        { toFun := toFun, map_one' := map_one', map_mul' := map_mul', map_zero' := map_zero', map_add' := map_add',
          commutes' := commutes' })
      ((fun (f : A →ₐ[R] B) ↦ (↑(↑f.toRingHom : A →* B) : OneHom A B).toFun)
        { toFun := toFun_1, map_one' := map_one'_1, map_mul' := map_mul'_1, map_zero' := map_zero'_1,
          map_add' := map_add'_1, commutes' := commutes'_1 })),
  { toFun := toFun, map_one' := map_one', map_mul' := map_mul', map_zero' := map_zero', map_add' := map_add',
      commutes' := commutes' : A →ₐ[R] B } =
    { toFun := toFun_1, map_one' := map_one'_1, map_mul' := map_mul'_1, map_zero' := map_zero'_1,
      map_add' := map_add'_1, commutes' := commutes'_1 }
Tactic: rcases g with ⟨⟨⟨⟨_, _⟩, _⟩, _, _⟩, _⟩
Cleared hypotheses: g, h