/-- Define an algebra homomorphism on a directed supremum of subalgebras by defining
it on each subalgebra, and proving that it agrees on the intersection of subalgebras. -/
noncomputable def iSupLift : ↥T →ₐ[R] B :=
  { toFun := Set.iUnionLift (fun i => ↑(K i)) (fun i x => f i x)
        (fun i j x hxi hxj => by
          let ⟨k, hik, hjk⟩ := dir i j
          dsimp
          rw [hf i k hik, hf j k hjk]
          rfl)
        T (by rw [hT, coe_iSup_of_directed dir])
    map_one' := by apply Set.iUnionLift_const _ (fun _ => 1) <;> simp
    map_zero' := by dsimp; apply Set.iUnionLift_const _ (fun _ => 0) <;> simp
    map_mul' := by
      subst hT; dsimp
      apply Set.iUnionLift_binary (coe_iSup_of_directed dir) dir _ (fun _ => (· * ·))
      on_goal 3 => rw [coe_iSup_of_directed dir]
      all_goals simp
    map_add' := by
      subst hT; 

Proof state:
R : Type u
A : Type v
B : Type w
inst✝⁵ : CommSemiring R
inst✝⁴ : Semiring A
inst✝³ : Algebra R A
inst✝² : Semiring B
inst✝¹ : Algebra R B
S : Subalgebra R A
ι : Type u_1
inst✝ : Nonempty ι
K : ι → Subalgebra R A
dir : Directed (fun x x_1 => x ≤ x_1) K
f : (i : ι) → ↥(K i) →ₐ[R] B
hf : ∀ (i j : ι) (h : K i ≤ K j), f i = AlgHom.comp (f j) (inclusion h)
⊢ ∀ (x y : ↥(iSup K)),
    OneHom.toFun
        (↑{
            toOneHom :=
              {
                toFun :=
                  Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                    (_ :
                      ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                        (fun i x => (f i) x) i { val := x, property := hxi } =
                          (fun i x => (f i) x) j { val := x, property := hxj })
                    ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                map_one' :=
                  (_ :
                    Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                        (_ :
                          ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                            (fun i x => (f i) x) i { val := x, property := hxi } =
                              (fun i x => (f i) x) j { val := x, property := hxj })
                        ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                      1) },
            map_mul' :=
              (_ :
                ∀ (x y : ↥(iSup K)),
                  OneHom.toFun
                      {
                        toFun :=
                          Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                            (_ :
                              ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                (fun i x => (f i) x) i { val := x, property := hxi } =
                                  (fun i x => (f i) x) j { val := x, property := hxj })
                            ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                        map_one' :=
                          (_ :
                            Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                (_ :
                                  ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                    (fun i x => (f i) x) i { val := x, property := hxi } =
                                      (fun i x => (f i) x) j { val := x, property := hxj })
                                ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                              1) }
                      (x * y) =
                    OneHom.toFun
                        {
                          toFun :=
                            Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                              (_ :
                                ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                  (fun i x => (f i) x) i { val := x, property := hxi } =
                                    (fun i x => (f i) x) j { val := x, property := hxj })
                              ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                          map_one' :=
                            (_ :
                              Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                  (_ :
                                    ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                      (fun i x => (f i) x) i { val := x, property := hxi } =
                                        (fun i x => (f i) x) j { val := x, property := hxj })
                                  ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                                1) }
                        x *
                      OneHom.toFun
                        {
                          toFun :=
                            Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                              (_ :
                                ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                  (fun i x => (f i) x) i { val := x, property := hxi } =
                                    (fun i x => (f i) x) j { val := x, property := hxj })
                              ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                          map_one' :=
                            (_ :
                              Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                  (_ :
                                    ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                      (fun i x => (f i) x) i { val := x, property := hxi } =
                                        (fun i x => (f i) x) j { val := x, property := hxj })
                                  ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                                1) }
                        y) })
        (x + y) =
      OneHom.toFun
          (↑{
              toOneHom :=
                {
                  toFun :=
                    Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                      (_ :
                        ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                          (fun i x => (f i) x) i { val := x, property := hxi } =
                            (fun i x => (f i) x) j { val := x, property := hxj })
                      ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                  map_one' :=
                    (_ :
                      Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                          (_ :
                            ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                              (fun i x => (f i) x) i { val := x, property := hxi } =
                                (fun i x => (f i) x) j { val := x, property := hxj })
                          ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                        1) },
              map_mul' :=
                (_ :
                  ∀ (x y : ↥(iSup K)),
                    OneHom.toFun
                        {
                          toFun :=
                            Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                              (_ :
                                ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                  (fun i x => (f i) x) i { val := x, property := hxi } =
                                    (fun i x => (f i) x) j { val := x, property := hxj })
                              ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                          map_one' :=
                            (_ :
                              Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                  (_ :
                                    ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                      (fun i x => (f i) x) i { val := x, property := hxi } =
                                        (fun i x => (f i) x) j { val := x, property := hxj })
                                  ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                                1) }
                        (x * y) =
                      OneHom.toFun
                          {
                            toFun :=
                              Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                (_ :
                                  ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                    (fun i x => (f i) x) i { val := x, property := hxi } =
                                      (fun i x => (f i) x) j { val := x, property := hxj })
                                ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                            map_one' :=
                              (_ :
                                Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                    (_ :
                                      ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i)
                                        (hxj : x ∈ (fun i => ↑(K i)) j),
                                        (fun i x => (f i) x) i { val := x, property := hxi } =
                                          (fun i x => (f i) x) j { val := x, property := hxj })
                                    ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                                  1) }
                          x *
                        OneHom.toFun
                          {
                            toFun :=
                              Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                (_ :
                                  ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                    (fun i x => (f i) x) i { val := x, property := hxi } =
                                      (fun i x => (f i) x) j { val := x, property := hxj })
                                ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                            map_one' :=
                              (_ :
                                Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                    (_ :
                                      ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i)
                                        (hxj : x ∈ (fun i => ↑(K i)) j),
                                        (fun i x => (f i) x) i { val := x, property := hxi } =
                                          (fun i x => (f i) x) j { val := x, property := hxj })
                                    ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                                  1) }
                          y) })
          x +
        OneHom.toFun
          (↑{
              toOneHom :=
                {
                  toFun :=
                    Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                      (_ :
                        ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                          (fun i x => (f i) x) i { val := x, property := hxi } =
                            (fun i x => (f i) x) j { val := x, property := hxj })
                      ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                  map_one' :=
                    (_ :
                      Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                          (_ :
                            ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                              (fun i x => (f i) x) i { val := x, property := hxi } =
                                (fun i x => (f i) x) j { val := x, property := hxj })
                          ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                        1) },
              map_mul' :=
                (_ :
                  ∀ (x y : ↥(iSup K)),
                    OneHom.toFun
                        {
                          toFun :=
                            Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                              (_ :
                                ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                  (fun i x => (f i) x) i { val := x, property := hxi } =
                                    (fun i x => (f i) x) j { val := x, property := hxj })
                              ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                          map_one' :=
                            (_ :
                              Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                  (_ :
                                    ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                      (fun i x => (f i) x) i { val := x, property := hxi } =
                                        (fun i x => (f i) x) j { val := x, property := hxj })
                                  ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                                1) }
                        (x * y) =
                      OneHom.toFun
                          {
                            toFun :=
                              Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                (_ :
                                  ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                    (fun i x => (f i) x) i { val := x, property := hxi } =
                                      (fun i x => (f i) x) j { val := x, property := hxj })
                                ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                            map_one' :=
                              (_ :
                                Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                    (_ :
                                      ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i)
                                        (hxj : x ∈ (fun i => ↑(K i)) j),
                                        (fun i x => (f i) x) i { val := x, property := hxi } =
                                          (fun i x => (f i) x) j { val := x, property := hxj })
                                    ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                                  1) }
                          x *
                        OneHom.toFun
                          {
                            toFun :=
                              Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                (_ :
                                  ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i) (hxj : x ∈ (fun i => ↑(K i)) j),
                                    (fun i x => (f i) x) i { val := x, property := hxi } =
                                      (fun i x => (f i) x) j { val := x, property := hxj })
                                ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)),
                            map_one' :=
                              (_ :
                                Set.iUnionLift (fun i => ↑(K i)) (fun i x => (f i) x)
                                    (_ :
                                      ∀ (i j : ι) (x : A) (hxi : x ∈ (fun i => ↑(K i)) i)
                                        (hxj : x ∈ (fun i => ↑(K i)) j),
                                        (fun i x => (f i) x) i { val := x, property := hxi } =
                                          (fun i x => (f i) x) j { val := x, property := hxj })
                                    ↑(iSup K) (_ : ↑(iSup K) ⊆ ⋃ i, ↑(K i)) 1 =
                                  1) }
                          y) })
          y

Next tactic:
dsimp