/-- Any ring homomorphism `f : R →+* T` which respects a relation `r : R → R → Prop`
factors uniquely through a morphism `RingQuot r →+* T`.
-/
irreducible_def lift {r : R → R → Prop} :
  { f : R →+* T // ∀ ⦃x y⦄, r x y → f x = f y } ≃ (RingQuot r →+* T) :=
  { toFun := fun f ↦ preLift f.prop
    invFun := fun F ↦ ⟨F.comp (mkRingHom r), fun x y h ↦ congr_arg F (mkRingHom_rel h)⟩
    left_inv := fun f ↦ by
      ext
      simp only [preLift_def, mkRingHom_def, RingHom.coe_comp, RingHom.coe_mk, MonoidHom.coe_mk,
                 OneHom.coe_mk, Function.comp_apply]
    right_inv := fun F ↦ by
      simp only [preLift_def]
      ext
      

Proof state:
case w.a
R : Type uR
inst✝⁴ : Semiring R
S : Type uS
inst✝³ : CommSemiring S
T : Type uT
A : Type uA
inst✝² : Semiring A
inst✝¹ : Algebra S A
r✝ : R → R → Prop
inst✝ : Semiring T
r : R → R → Prop
F : RingQuot r →+* T
x✝ : R
⊢ (RingHom.comp
        {
          toMonoidHom :=
            {
              toOneHom :=
                {
                  toFun := fun x =>
                    Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                      (_ : ∀ (a b : R), Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                      x.toQuot,
                  map_one' :=
                    (_ :
                      Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                          (_ :
                            ∀ (a b : R),
                              Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                          1.toQuot =
                        1) },
              map_mul' :=
                (_ :
                  ∀ (x y : RingQuot r),
                    OneHom.toFun
                        {
                          toFun := fun x =>
                            Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                              (_ :
                                ∀ (a b : R),
                                  Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                              x.toQuot,
                          map_one' :=
                            (_ :
                              Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                  (_ :
                                    ∀ (a b : R),
                                      Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                  1.toQuot =
                                1) }
                        (x * y) =
                      OneHom.toFun
                          {
                            toFun := fun x =>
                              Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                (_ :
                                  ∀ (a b : R),
                                    Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                x.toQuot,
                            map_one' :=
                              (_ :
                                Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                    (_ :
                                      ∀ (a b : R),
                                        Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                    1.toQuot =
                                  1) }
                          x *
                        OneHom.toFun
                          {
                            toFun := fun x =>
                              Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                (_ :
                                  ∀ (a b : R),
                                    Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                x.toQuot,
                            map_one' :=
                              (_ :
                                Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                    (_ :
                                      ∀ (a b : R),
                                        Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                    1.toQuot =
                                  1) }
                          y) },
          map_zero' :=
            (_ :
              Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                  (_ : ∀ (a b : R), Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                  0.toQuot =
                0),
          map_add' :=
            (_ :
              ∀ (x y : RingQuot r),
                OneHom.toFun
                    (↑{
                        toOneHom :=
                          {
                            toFun := fun x =>
                              Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                (_ :
                                  ∀ (a b : R),
                                    Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                x.toQuot,
                            map_one' :=
                              (_ :
                                Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                    (_ :
                                      ∀ (a b : R),
                                        Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                    1.toQuot =
                                  1) },
                        map_mul' :=
                          (_ :
                            ∀ (x y : RingQuot r),
                              OneHom.toFun
                                  {
                                    toFun := fun x =>
                                      Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                        (_ :
                                          ∀ (a b : R),
                                            Rel r a b →
                                              (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                        x.toQuot,
                                    map_one' :=
                                      (_ :
                                        Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                            (_ :
                                              ∀ (a b : R),
                                                Rel r a b →
                                                  (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                            1.toQuot =
                                          1) }
                                  (x * y) =
                                OneHom.toFun
                                    {
                                      toFun := fun x =>
                                        Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                          (_ :
                                            ∀ (a b : R),
                                              Rel r a b →
                                                (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                          x.toQuot,
                                      map_one' :=
                                        (_ :
                                          Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                              (_ :
                                                ∀ (a b : R),
                                                  Rel r a b →
                                                    (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                              1.toQuot =
                                            1) }
                                    x *
                                  OneHom.toFun
                                    {
                                      toFun := fun x =>
                                        Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                          (_ :
                                            ∀ (a b : R),
                                              Rel r a b →
                                                (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                          x.toQuot,
                                      map_one' :=
                                        (_ :
                                          Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                              (_ :
                                                ∀ (a b : R),
                                                  Rel r a b →
                                                    (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                              1.toQuot =
                                            1) }
                                    y) })
                    (x + y) =
                  OneHom.toFun
                      (↑{
                          toOneHom :=
                            {
                              toFun := fun x =>
                                Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                  (_ :
                                    ∀ (a b : R),
                                      Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                  x.toQuot,
                              map_one' :=
                                (_ :
                                  Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                      (_ :
                                        ∀ (a b : R),
                                          Rel r a b →
                                            (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                      1.toQuot =
                                    1) },
                          map_mul' :=
                            (_ :
                              ∀ (x y : RingQuot r),
                                OneHom.toFun
                                    {
                                      toFun := fun x =>
                                        Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                          (_ :
                                            ∀ (a b : R),
                                              Rel r a b →
                                                (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                          x.toQuot,
                                      map_one' :=
                                        (_ :
                                          Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                              (_ :
                                                ∀ (a b : R),
                                                  Rel r a b →
                                                    (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                              1.toQuot =
                                            1) }
                                    (x * y) =
                                  OneHom.toFun
                                      {
                                        toFun := fun x =>
                                          Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                            (_ :
                                              ∀ (a b : R),
                                                Rel r a b →
                                                  (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                            x.toQuot,
                                        map_one' :=
                                          (_ :
                                            Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                                (_ :
                                                  ∀ (a b : R),
                                                    Rel r a b →
                                                      (RingHom.comp F (mkRingHom r)) a =
                                                        (RingHom.comp F (mkRingHom r)) b)
                                                1.toQuot =
                                              1) }
                                      x *
                                    OneHom.toFun
                                      {
                                        toFun := fun x =>
                                          Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                            (_ :
                                              ∀ (a b : R),
                                                Rel r a b →
                                                  (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                            x.toQuot,
                                        map_one' :=
                                          (_ :
                                            Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                                (_ :
                                                  ∀ (a b : R),
                                                    Rel r a b →
                                                      (RingHom.comp F (mkRingHom r)) a =
                                                        (RingHom.comp F (mkRingHom r)) b)
                                                1.toQuot =
                                              1) }
                                      y) })
                      x +
                    OneHom.toFun
                      (↑{
                          toOneHom :=
                            {
                              toFun := fun x =>
                                Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                  (_ :
                                    ∀ (a b : R),
                                      Rel r a b → (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                  x.toQuot,
                              map_one' :=
                                (_ :
                                  Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                      (_ :
                                        ∀ (a b : R),
                                          Rel r a b →
                                            (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                      1.toQuot =
                                    1) },
                          map_mul' :=
                            (_ :
                              ∀ (x y : RingQuot r),
                                OneHom.toFun
                                    {
                                      toFun := fun x =>
                                        Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                          (_ :
                                            ∀ (a b : R),
                                              Rel r a b →
                                                (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                          x.toQuot,
                                      map_one' :=
                                        (_ :
                                          Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                              (_ :
                                                ∀ (a b : R),
                                                  Rel r a b →
                                                    (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                              1.toQuot =
                                            1) }
                                    (x * y) =
                                  OneHom.toFun
                                      {
                                        toFun := fun x =>
                                          Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                            (_ :
                                              ∀ (a b : R),
                                                Rel r a b →
                                                  (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                            x.toQuot,
                                        map_one' :=
                                          (_ :
                                            Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                                (_ :
                                                  ∀ (a b : R),
                                                    Rel r a b →
                                                      (RingHom.comp F (mkRingHom r)) a =
                                                        (RingHom.comp F (mkRingHom r)) b)
                                                1.toQuot =
                                              1) }
                                      x *
                                    OneHom.toFun
                                      {
                                        toFun := fun x =>
                                          Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                            (_ :
                                              ∀ (a b : R),
                                                Rel r a b →
                                                  (RingHom.comp F (mkRingHom r)) a = (RingHom.comp F (mkRingHom r)) b)
                                            x.toQuot,
                                        map_one' :=
                                          (_ :
                                            Quot.lift ⇑(RingHom.comp F (mkRingHom r))
                                                (_ :
                                                  ∀ (a b : R),
                                                    Rel r a b →
                                                      (RingHom.comp F (mkRingHom r)) a =
                                                        (RingHom.comp F (mkRingHom r)) b)
                                                1.toQuot =
                                              1) }
                                      y) })
                      y) }
        (mkRingHom r))
      x✝ =
    (RingHom.comp F (mkRingHom r)) x✝

Next tactic:
simp only [mkRingHom_def, RingHom.coe_comp, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk,
                 Function.comp_apply, forall_const]