/-
Copyright (c) 2019 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau

! This file was ported from Lean 3 source module ring_theory.adjoin.basic
! leanprover-community/mathlib commit 69c6a5a12d8a2b159f20933e60115a4f2de62b58
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.Algebra.Algebra.Operations
import Mathbin.Algebra.Algebra.Subalgebra.Tower
import Mathbin.LinearAlgebra.Prod
import Mathbin.LinearAlgebra.Finsupp

/-!
# Adjoining elements to form subalgebras

> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
> Any changes to this file require a corresponding PR to mathlib4.

This file develops the basic theory of subalgebras of an R-algebra generated
by a set of elements. A basic interface for `adjoin` is set up.

## Tags

adjoin, algebra

-/

universe u v w

open Pointwise

open Submodule Subsemiring

variable {R : Type u} {A : Type v} {B : Type w}

namespace Algebra

section Semiring

variable [CommSemiring R] [Semiring A] [Semiring B]

variable [Algebra R A] [Algebra R B] {s t : Set A}

/- warning: algebra.subset_adjoin -> Algebra.subset_adjoin is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A}, HasSubset.Subset.{u2} (Set.{u2} A) (Set.hasSubset.{u2} A) s ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (SetLike.Set.hasCoeT.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A}, HasSubset.Subset.{u2} (Set.{u2} A) (Set.instHasSubsetSet.{u2} A) s (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))
Case conversion may be inaccurate. Consider using '#align algebra.subset_adjoin Algebra.subset_adjoinₓ'. -/
theorem subset_adjoin : s ⊆ adjoin R s :=
  Algebra.gc.le_u_l s
#align algebra.subset_adjoin Algebra.subset_adjoin

/- warning: algebra.adjoin_le -> Algebra.adjoin_le is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {S : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4}, (HasSubset.Subset.{u2} (Set.{u2} A) (Set.hasSubset.{u2} A) s ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (SetLike.Set.hasCoeT.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) S)) -> (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteSemilatticeInf.toPartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.Subalgebra.completeLattice.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) S)
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {S : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4}, (HasSubset.Subset.{u2} (Set.{u2} A) (Set.instHasSubsetSet.{u2} A) s (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) S)) -> (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.instCompleteLatticeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) S)
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_le Algebra.adjoin_leₓ'. -/
theorem adjoin_le {S : Subalgebra R A} (H : s ⊆ S) : adjoin R s ≤ S :=
  Algebra.gc.l_le H
#align algebra.adjoin_le Algebra.adjoin_le

/- warning: algebra.adjoin_eq_Inf -> Algebra.adjoin_eq_infₛ is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A}, Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) (InfSet.infₛ.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (ConditionallyCompleteLattice.toHasInf.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.Subalgebra.completeLattice.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (setOf.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (fun (p : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => HasSubset.Subset.{u2} (Set.{u2} A) (Set.hasSubset.{u2} A) s ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (SetLike.Set.hasCoeT.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) p))))
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A}, Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) (InfSet.infₛ.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (ConditionallyCompleteLattice.toInfSet.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.instCompleteLatticeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (setOf.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (fun (p : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => HasSubset.Subset.{u2} (Set.{u2} A) (Set.instHasSubsetSet.{u2} A) s (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) p))))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_eq_Inf Algebra.adjoin_eq_infₛₓ'. -/
theorem adjoin_eq_infₛ : adjoin R s = infₛ { p | s ⊆ p } :=
  le_antisymm (le_infₛ fun _ h => adjoin_le h) (infₛ_le subset_adjoin)
#align algebra.adjoin_eq_Inf Algebra.adjoin_eq_infₛ

/- warning: algebra.adjoin_le_iff -> Algebra.adjoin_le_iff is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {S : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4}, Iff (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteSemilatticeInf.toPartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.Subalgebra.completeLattice.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) S) (HasSubset.Subset.{u2} (Set.{u2} A) (Set.hasSubset.{u2} A) s ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (SetLike.Set.hasCoeT.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) S))
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {S : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4}, Iff (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.instCompleteLatticeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) S) (HasSubset.Subset.{u2} (Set.{u2} A) (Set.instHasSubsetSet.{u2} A) s (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) S))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_le_iff Algebra.adjoin_le_iffₓ'. -/
theorem adjoin_le_iff {S : Subalgebra R A} : adjoin R s ≤ S ↔ s ⊆ S :=
  Algebra.gc _ _
#align algebra.adjoin_le_iff Algebra.adjoin_le_iff

/- warning: algebra.adjoin_mono -> Algebra.adjoin_mono is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {t : Set.{u2} A}, (HasSubset.Subset.{u2} (Set.{u2} A) (Set.hasSubset.{u2} A) s t) -> (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteSemilatticeInf.toPartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.Subalgebra.completeLattice.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 t))
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {t : Set.{u2} A}, (HasSubset.Subset.{u2} (Set.{u2} A) (Set.instHasSubsetSet.{u2} A) s t) -> (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.instCompleteLatticeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 t))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_mono Algebra.adjoin_monoₓ'. -/
theorem adjoin_mono (H : s ⊆ t) : adjoin R s ≤ adjoin R t :=
  Algebra.gc.monotone_l H
#align algebra.adjoin_mono Algebra.adjoin_mono

/- warning: algebra.adjoin_eq_of_le -> Algebra.adjoin_eq_of_le is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} (S : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4), (HasSubset.Subset.{u2} (Set.{u2} A) (Set.hasSubset.{u2} A) s ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Set.{u2} A) (SetLike.Set.hasCoeT.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) S)) -> (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteSemilatticeInf.toPartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.Subalgebra.completeLattice.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) S (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) -> (Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) S)
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} (S : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4), (HasSubset.Subset.{u2} (Set.{u2} A) (Set.instHasSubsetSet.{u2} A) s (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) S)) -> (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.instCompleteLatticeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) S (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) -> (Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) S)
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_eq_of_le Algebra.adjoin_eq_of_leₓ'. -/
theorem adjoin_eq_of_le (S : Subalgebra R A) (h₁ : s ⊆ S) (h₂ : S ≤ adjoin R s) : adjoin R s = S :=
  le_antisymm (adjoin_le h₁) h₂
#align algebra.adjoin_eq_of_le Algebra.adjoin_eq_of_le

#print Algebra.adjoin_eq /-
theorem adjoin_eq (S : Subalgebra R A) : adjoin R ↑S = S :=
  adjoin_eq_of_le _ (Set.Subset.refl _) subset_adjoin
#align algebra.adjoin_eq Algebra.adjoin_eq
-/

/- warning: algebra.adjoin_Union -> Algebra.adjoin_unionᵢ is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {α : Type.{u3}} (s : α -> (Set.{u2} A)), Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Set.unionᵢ.{u2, succ u3} A α s)) (supᵢ.{u2, succ u3} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (ConditionallyCompleteLattice.toHasSup.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.Subalgebra.completeLattice.{u1, u2} R A _inst_1 _inst_2 _inst_4))) α (fun (i : α) => Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 (s i)))
but is expected to have type
  forall {R : Type.{u2}} {A : Type.{u3}} [_inst_1 : CommSemiring.{u2} R] [_inst_2 : Semiring.{u3} A] [_inst_4 : Algebra.{u2, u3} R A _inst_1 _inst_2] {α : Type.{u1}} (s : α -> (Set.{u3} A)), Eq.{succ u3} (Subalgebra.{u2, u3} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u2, u3} R A _inst_1 _inst_2 _inst_4 (Set.unionᵢ.{u3, succ u1} A α s)) (supᵢ.{u3, succ u1} (Subalgebra.{u2, u3} R A _inst_1 _inst_2 _inst_4) (ConditionallyCompleteLattice.toSupSet.{u3} (Subalgebra.{u2, u3} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u3} (Subalgebra.{u2, u3} R A _inst_1 _inst_2 _inst_4) (Algebra.instCompleteLatticeSubalgebra.{u2, u3} R A _inst_1 _inst_2 _inst_4))) α (fun (i : α) => Algebra.adjoin.{u2, u3} R A _inst_1 _inst_2 _inst_4 (s i)))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_Union Algebra.adjoin_unionᵢₓ'. -/
theorem adjoin_unionᵢ {α : Type _} (s : α → Set A) :
    adjoin R (Set.unionᵢ s) = ⨆ i : α, adjoin R (s i) :=
  (@Algebra.gc R A _ _ _).l_supᵢ
#align algebra.adjoin_Union Algebra.adjoin_unionᵢ

/- warning: algebra.adjoin_attach_bUnion -> Algebra.adjoin_attach_bunionᵢ is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] [_inst_6 : DecidableEq.{succ u2} A] {α : Type.{u3}} {s : Finset.{u3} α} (f : (coeSort.{succ u3, succ (succ u3)} (Finset.{u3} α) Type.{u3} (Finset.hasCoeToSort.{u3} α) s) -> (Finset.{u2} A)), Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Finset.{u2} A) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Finset.{u2} A) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Finset.{u2} A) (Set.{u2} A) (Finset.Set.hasCoeT.{u2} A))) (Finset.bunionᵢ.{u3, u2} (Subtype.{succ u3} α (fun (x : α) => Membership.Mem.{u3, u3} α (Finset.{u3} α) (Finset.hasMem.{u3} α) x s)) A (fun (a : A) (b : A) => _inst_6 a b) (Finset.attach.{u3} α s) f))) (supᵢ.{u2, succ u3} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (ConditionallyCompleteLattice.toHasSup.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.Subalgebra.completeLattice.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (coeSort.{succ u3, succ (succ u3)} (Finset.{u3} α) Type.{u3} (Finset.hasCoeToSort.{u3} α) s) (fun (x : coeSort.{succ u3, succ (succ u3)} (Finset.{u3} α) Type.{u3} (Finset.hasCoeToSort.{u3} α) s) => Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Finset.{u2} A) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Finset.{u2} A) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Finset.{u2} A) (Set.{u2} A) (Finset.Set.hasCoeT.{u2} A))) (f x))))
but is expected to have type
  forall {R : Type.{u2}} {A : Type.{u3}} [_inst_1 : CommSemiring.{u2} R] [_inst_2 : Semiring.{u3} A] [_inst_4 : Algebra.{u2, u3} R A _inst_1 _inst_2] [_inst_6 : DecidableEq.{succ u3} A] {α : Type.{u1}} {s : Finset.{u1} α} (f : (Subtype.{succ u1} α (fun (x : α) => Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x s)) -> (Finset.{u3} A)), Eq.{succ u3} (Subalgebra.{u2, u3} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u2, u3} R A _inst_1 _inst_2 _inst_4 (Finset.toSet.{u3} A (Finset.bunionᵢ.{u1, u3} (Subtype.{succ u1} α (fun (x : α) => Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x s)) A (fun (a : A) (b : A) => _inst_6 a b) (Finset.attach.{u1} α s) f))) (supᵢ.{u3, succ u1} (Subalgebra.{u2, u3} R A _inst_1 _inst_2 _inst_4) (ConditionallyCompleteLattice.toSupSet.{u3} (Subalgebra.{u2, u3} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toConditionallyCompleteLattice.{u3} (Subalgebra.{u2, u3} R A _inst_1 _inst_2 _inst_4) (Algebra.instCompleteLatticeSubalgebra.{u2, u3} R A _inst_1 _inst_2 _inst_4))) (Subtype.{succ u1} α (fun (x : α) => Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x s)) (fun (x : Subtype.{succ u1} α (fun (x : α) => Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x s)) => Algebra.adjoin.{u2, u3} R A _inst_1 _inst_2 _inst_4 (Finset.toSet.{u3} A (f x))))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_attach_bUnion Algebra.adjoin_attach_bunionᵢₓ'. -/
theorem adjoin_attach_bunionᵢ [DecidableEq A] {α : Type _} {s : Finset α} (f : s → Finset A) :
    adjoin R (s.attach.bunionᵢ f : Set A) = ⨆ x, adjoin R (f x) := by simpa [adjoin_Union]
#align algebra.adjoin_attach_bUnion Algebra.adjoin_attach_bunionᵢ

/- warning: algebra.adjoin_induction -> Algebra.adjoin_induction is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {p : A -> Prop} {x : A}, (Membership.Mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.hasMem.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) -> (forall (x : A), (Membership.Mem.{u2, u2} A (Set.{u2} A) (Set.hasMem.{u2} A) x s) -> (p x)) -> (forall (r : R), p (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (fun (_x : RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) => R -> A) (RingHom.hasCoeToFun.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (algebraMap.{u1, u2} R A _inst_1 _inst_2 _inst_4) r)) -> (forall (x : A) (y : A), (p x) -> (p y) -> (p (HAdd.hAdd.{u2, u2, u2} A A A (instHAdd.{u2} A (Distrib.toHasAdd.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) x y))) -> (forall (x : A) (y : A), (p x) -> (p y) -> (p (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (Distrib.toHasMul.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) x y))) -> (p x)
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {p : A -> Prop} {x : A}, (Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) -> (forall (x : A), (Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x s) -> (p x)) -> (forall (r : R), p (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2) (RingHom.instRingHomClassRingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (algebraMap.{u1, u2} R A _inst_1 _inst_2 _inst_4) r)) -> (forall (x : A) (y : A), (p x) -> (p y) -> (p (HAdd.hAdd.{u2, u2, u2} A A A (instHAdd.{u2} A (Distrib.toAdd.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) x y))) -> (forall (x : A) (y : A), (p x) -> (p y) -> (p (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) x y))) -> (p x)
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_induction Algebra.adjoin_inductionₓ'. -/
@[elab_as_elim]
theorem adjoin_induction {p : A → Prop} {x : A} (h : x ∈ adjoin R s) (Hs : ∀ x ∈ s, p x)
    (Halg : ∀ r, p (algebraMap R A r)) (Hadd : ∀ x y, p x → p y → p (x + y))
    (Hmul : ∀ x y, p x → p y → p (x * y)) : p x :=
  let S : Subalgebra R A :=
    { carrier := p
      mul_mem' := Hmul
      add_mem' := Hadd
      algebraMap_mem' := Halg }
  adjoin_le (show s ≤ S from Hs) h
#align algebra.adjoin_induction Algebra.adjoin_induction

/- warning: algebra.adjoin_induction₂ -> Algebra.adjoin_induction₂ is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {p : A -> A -> Prop} {a : A} {b : A}, (Membership.Mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.hasMem.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) a (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) -> (Membership.Mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.hasMem.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) b (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) -> (forall (x : A), (Membership.Mem.{u2, u2} A (Set.{u2} A) (Set.hasMem.{u2} A) x s) -> (forall (y : A), (Membership.Mem.{u2, u2} A (Set.{u2} A) (Set.hasMem.{u2} A) y s) -> (p x y))) -> (forall (r₁ : R) (r₂ : R), p (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (fun (_x : RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) => R -> A) (RingHom.hasCoeToFun.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (algebraMap.{u1, u2} R A _inst_1 _inst_2 _inst_4) r₁) (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (fun (_x : RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) => R -> A) (RingHom.hasCoeToFun.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (algebraMap.{u1, u2} R A _inst_1 _inst_2 _inst_4) r₂)) -> (forall (r : R) (x : A), (Membership.Mem.{u2, u2} A (Set.{u2} A) (Set.hasMem.{u2} A) x s) -> (p (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (fun (_x : RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) => R -> A) (RingHom.hasCoeToFun.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (algebraMap.{u1, u2} R A _inst_1 _inst_2 _inst_4) r) x)) -> (forall (r : R) (x : A), (Membership.Mem.{u2, u2} A (Set.{u2} A) (Set.hasMem.{u2} A) x s) -> (p x (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (fun (_x : RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) => R -> A) (RingHom.hasCoeToFun.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (algebraMap.{u1, u2} R A _inst_1 _inst_2 _inst_4) r))) -> (forall (x₁ : A) (x₂ : A) (y : A), (p x₁ y) -> (p x₂ y) -> (p (HAdd.hAdd.{u2, u2, u2} A A A (instHAdd.{u2} A (Distrib.toHasAdd.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) x₁ x₂) y)) -> (forall (x : A) (y₁ : A) (y₂ : A), (p x y₁) -> (p x y₂) -> (p x (HAdd.hAdd.{u2, u2, u2} A A A (instHAdd.{u2} A (Distrib.toHasAdd.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) y₁ y₂))) -> (forall (x₁ : A) (x₂ : A) (y : A), (p x₁ y) -> (p x₂ y) -> (p (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (Distrib.toHasMul.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) x₁ x₂) y)) -> (forall (x : A) (y₁ : A) (y₂ : A), (p x y₁) -> (p x y₂) -> (p x (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (Distrib.toHasMul.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) y₁ y₂))) -> (p a b)
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {p : A -> A -> Prop} {a : A} {b : A}, (Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) a (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) -> (Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) b (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) -> (forall (x : A), (Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x s) -> (forall (y : A), (Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) y s) -> (p x y))) -> (forall (r₁ : R) (r₂ : R), p (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2) (RingHom.instRingHomClassRingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (algebraMap.{u1, u2} R A _inst_1 _inst_2 _inst_4) r₁) (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2) (RingHom.instRingHomClassRingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (algebraMap.{u1, u2} R A _inst_1 _inst_2 _inst_4) r₂)) -> (forall (r : R) (x : A), (Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x s) -> (p (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2) (RingHom.instRingHomClassRingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (algebraMap.{u1, u2} R A _inst_1 _inst_2 _inst_4) r) x)) -> (forall (r : R) (x : A), (Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x s) -> (p x (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2)) R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2) (RingHom.instRingHomClassRingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (algebraMap.{u1, u2} R A _inst_1 _inst_2 _inst_4) r))) -> (forall (x₁ : A) (x₂ : A) (y : A), (p x₁ y) -> (p x₂ y) -> (p (HAdd.hAdd.{u2, u2, u2} A A A (instHAdd.{u2} A (Distrib.toAdd.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) x₁ x₂) y)) -> (forall (x : A) (y₁ : A) (y₂ : A), (p x y₁) -> (p x y₂) -> (p x (HAdd.hAdd.{u2, u2, u2} A A A (instHAdd.{u2} A (Distrib.toAdd.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) y₁ y₂))) -> (forall (x₁ : A) (x₂ : A) (y : A), (p x₁ y) -> (p x₂ y) -> (p (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) x₁ x₂) y)) -> (forall (x : A) (y₁ : A) (y₂ : A), (p x y₁) -> (p x y₂) -> (p x (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) y₁ y₂))) -> (p a b)
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_induction₂ Algebra.adjoin_induction₂ₓ'. -/
/-- Induction principle for the algebra generated by a set `s`: show that `p x y` holds for any
`x y ∈ adjoin R s` given that that it holds for `x y ∈ s` and that it satisfies a number of
natural properties. -/
@[elab_as_elim]
theorem adjoin_induction₂ {p : A → A → Prop} {a b : A} (ha : a ∈ adjoin R s) (hb : b ∈ adjoin R s)
    (Hs : ∀ x ∈ s, ∀ y ∈ s, p x y) (Halg : ∀ r₁ r₂, p (algebraMap R A r₁) (algebraMap R A r₂))
    (Halg_left : ∀ (r), ∀ x ∈ s, p (algebraMap R A r) x)
    (Halg_right : ∀ (r), ∀ x ∈ s, p x (algebraMap R A r))
    (Hadd_left : ∀ x₁ x₂ y, p x₁ y → p x₂ y → p (x₁ + x₂) y)
    (Hadd_right : ∀ x y₁ y₂, p x y₁ → p x y₂ → p x (y₁ + y₂))
    (Hmul_left : ∀ x₁ x₂ y, p x₁ y → p x₂ y → p (x₁ * x₂) y)
    (Hmul_right : ∀ x y₁ y₂, p x y₁ → p x y₂ → p x (y₁ * y₂)) : p a b :=
  by
  refine' adjoin_induction hb _ (fun r => _) (Hadd_right a) (Hmul_right a)
  ·
    exact
      adjoin_induction ha Hs Halg_left (fun x y Hx Hy z hz => Hadd_left x y z (Hx z hz) (Hy z hz))
        fun x y Hx Hy z hz => Hmul_left x y z (Hx z hz) (Hy z hz)
  ·
    exact
      adjoin_induction ha (Halg_right r) (fun r' => Halg r' r)
        (fun x y => Hadd_left x y ((algebraMap R A) r)) fun x y =>
        Hmul_left x y ((algebraMap R A) r)
#align algebra.adjoin_induction₂ Algebra.adjoin_induction₂

/- warning: algebra.adjoin_induction' -> Algebra.adjoin_induction' is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {p : (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) -> Prop}, (forall (x : A) (h : Membership.Mem.{u2, u2} A (Set.{u2} A) (Set.hasMem.{u2} A) x s), p (Subtype.mk.{succ u2} A (fun (x : A) => Membership.Mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.hasMem.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) x (Algebra.subset_adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s x h))) -> (forall (r : R), p (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) (fun (_x : RingHom.{u1, u2} R (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) => R -> (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (RingHom.hasCoeToFun.{u1, u2} R (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) (algebraMap.{u1, u2} R (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.algebra.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) r)) -> (forall (x : coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (y : coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)), (p x) -> (p y) -> (p (HAdd.hAdd.{u2, u2, u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (instHAdd.{u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (AddMemClass.add.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (AddZeroClass.toHasAdd.{u2} A (AddMonoid.toAddZeroClass.{u2} A (AddMonoidWithOne.toAddMonoid.{u2} A (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} A (NonAssocSemiring.toAddCommMonoidWithOne.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))))) (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4) (AddSubmonoidClass.to_addMemClass.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (AddMonoid.toAddZeroClass.{u2} A (AddMonoidWithOne.toAddMonoid.{u2} A (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} A (NonAssocSemiring.toAddCommMonoidWithOne.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SubsemiringClass.to_addSubmonoidClass.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Semiring.toNonAssocSemiring.{u2} A _inst_2) (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Subalgebra.subsemiringClass.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) x y))) -> (forall (x : coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (y : coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)), (p x) -> (p y) -> (p (HMul.hMul.{u2, u2, u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (instHMul.{u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (MulMemClass.mul.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (MulOneClass.toHasMul.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SubmonoidClass.to_mulMemClass.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SubsemiringClass.to_submonoidClass.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Semiring.toNonAssocSemiring.{u2} A _inst_2) (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Subalgebra.subsemiringClass.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) x y))) -> (forall (x : coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)), p x)
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {p : (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) -> Prop}, (forall (x : A) (h : Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x s), p (Subtype.mk.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) x (Algebra.subset_adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s x h))) -> (forall (r : R), p (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Semiring.toNonAssocSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Semiring.toNonAssocSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (RingHom.instRingHomClassRingHom.{u1, u2} R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))))))) (algebraMap.{u1, u2} R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.instAlgebraSubtypeMemSubalgebraInstMembershipInstSetLikeSubalgebraToSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) r)) -> (forall (x : Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (y : Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))), (p x) -> (p y) -> (p (HAdd.hAdd.{u2, u2, u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (instHAdd.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Distrib.toAdd.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (NonUnitalNonAssocSemiring.toDistrib.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subsemiring.toNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2) (Subalgebra.toSubsemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))))))) x y))) -> (forall (x : Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (y : Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))), (p x) -> (p y) -> (p (HMul.hMul.{u2, u2, u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (instHMul.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Submonoid.mul.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Subsemiring.toSubmonoid.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2) (Subalgebra.toSubsemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))))) x y))) -> (forall (x : Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))), p x)
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_induction' Algebra.adjoin_induction'ₓ'. -/
/-- The difference with `algebra.adjoin_induction` is that this acts on the subtype. -/
theorem adjoin_induction' {p : adjoin R s → Prop} (Hs : ∀ (x) (h : x ∈ s), p ⟨x, subset_adjoin h⟩)
    (Halg : ∀ r, p (algebraMap R _ r)) (Hadd : ∀ x y, p x → p y → p (x + y))
    (Hmul : ∀ x y, p x → p y → p (x * y)) (x : adjoin R s) : p x :=
  Subtype.recOn x fun x hx =>
    by
    refine' Exists.elim _ fun (hx : x ∈ adjoin R s) (hc : p ⟨x, hx⟩) => hc
    exact
      adjoin_induction hx (fun x hx => ⟨subset_adjoin hx, Hs x hx⟩)
        (fun r => ⟨Subalgebra.algebraMap_mem _ r, Halg r⟩)
        (fun x y hx hy =>
          Exists.elim hx fun hx' hx =>
            Exists.elim hy fun hy' hy => ⟨Subalgebra.add_mem _ hx' hy', Hadd _ _ hx hy⟩)
        fun x y hx hy =>
        Exists.elim hx fun hx' hx =>
          Exists.elim hy fun hy' hy => ⟨Subalgebra.mul_mem _ hx' hy', Hmul _ _ hx hy⟩
#align algebra.adjoin_induction' Algebra.adjoin_induction'

/- warning: algebra.adjoin_adjoin_coe_preimage -> Algebra.adjoin_adjoin_coe_preimage is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A}, Eq.{succ u2} (Subalgebra.{u1, u2} R (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.algebra.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Algebra.adjoin.{u1, u2} R (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.algebra.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Set.preimage.{u2, u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) A ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) A (HasLiftT.mk.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) A (CoeTCₓ.coe.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) A (coeBase.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) A (coeSubtype.{succ u2} A (fun (x : A) => Membership.Mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.hasMem.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))))))) s)) (Top.top.{u2} (Subalgebra.{u1, u2} R (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.algebra.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (CompleteLattice.toHasTop.{u2} (Subalgebra.{u1, u2} R (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.algebra.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Algebra.Subalgebra.completeLattice.{u1, u2} R (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.algebra.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))))
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A}, Eq.{succ u2} (Subalgebra.{u1, u2} R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.instAlgebraSubtypeMemSubalgebraInstMembershipInstSetLikeSubalgebraToSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Algebra.adjoin.{u1, u2} R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.instAlgebraSubtypeMemSubalgebraInstMembershipInstSetLikeSubalgebraToSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Set.preimage.{u2, u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) A (Subtype.val.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) s)) (Top.top.{u2} (Subalgebra.{u1, u2} R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.instAlgebraSubtypeMemSubalgebraInstMembershipInstSetLikeSubalgebraToSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (CompleteLattice.toTop.{u2} (Subalgebra.{u1, u2} R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.instAlgebraSubtypeMemSubalgebraInstMembershipInstSetLikeSubalgebraToSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))) (Algebra.instCompleteLatticeSubalgebra.{u1, u2} R (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) x (SetLike.coe.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))) _inst_1 (Subalgebra.toSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Subalgebra.instAlgebraSubtypeMemSubalgebraInstMembershipInstSetLikeSubalgebraToSemiring.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_adjoin_coe_preimage Algebra.adjoin_adjoin_coe_preimageₓ'. -/
@[simp]
theorem adjoin_adjoin_coe_preimage {s : Set A} : adjoin R ((coe : adjoin R s → A) ⁻¹' s) = ⊤ :=
  by
  refine'
    eq_top_iff.2 fun x =>
      adjoin_induction' (fun a ha => _) (fun r => _) (fun _ _ => _) (fun _ _ => _) x
  · exact subset_adjoin ha
  · exact Subalgebra.algebraMap_mem _ r
  · exact Subalgebra.add_mem _
  · exact Subalgebra.mul_mem _
#align algebra.adjoin_adjoin_coe_preimage Algebra.adjoin_adjoin_coe_preimage

#print Algebra.adjoin_union /-
theorem adjoin_union (s t : Set A) : adjoin R (s ∪ t) = adjoin R s ⊔ adjoin R t :=
  (Algebra.gc : GaloisConnection _ (coe : Subalgebra R A → Set A)).l_sup
#align algebra.adjoin_union Algebra.adjoin_union
-/

variable (R A)

/- warning: algebra.adjoin_empty -> Algebra.adjoin_empty is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) (A : Type.{u2}) [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2], Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 (EmptyCollection.emptyCollection.{u2} (Set.{u2} A) (Set.hasEmptyc.{u2} A))) (Bot.bot.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toHasBot.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.Subalgebra.completeLattice.{u1, u2} R A _inst_1 _inst_2 _inst_4)))
but is expected to have type
  forall (R : Type.{u1}) (A : Type.{u2}) [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2], Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 (EmptyCollection.emptyCollection.{u2} (Set.{u2} A) (Set.instEmptyCollectionSet.{u2} A))) (Bot.bot.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toBot.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.instCompleteLatticeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_empty Algebra.adjoin_emptyₓ'. -/
@[simp]
theorem adjoin_empty : adjoin R (∅ : Set A) = ⊥ :=
  show adjoin R ⊥ = ⊥ by
    apply GaloisConnection.l_bot
    exact Algebra.gc
#align algebra.adjoin_empty Algebra.adjoin_empty

/- warning: algebra.adjoin_univ -> Algebra.adjoin_univ is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) (A : Type.{u2}) [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2], Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Set.univ.{u2} A)) (Top.top.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toHasTop.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.Subalgebra.completeLattice.{u1, u2} R A _inst_1 _inst_2 _inst_4)))
but is expected to have type
  forall (R : Type.{u1}) (A : Type.{u2}) [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2], Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Set.univ.{u2} A)) (Top.top.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toTop.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.instCompleteLatticeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_univ Algebra.adjoin_univₓ'. -/
@[simp]
theorem adjoin_univ : adjoin R (Set.univ : Set A) = ⊤ :=
  eq_top_iff.2 fun x => subset_adjoin <| Set.mem_univ _
#align algebra.adjoin_univ Algebra.adjoin_univ

variable (R) {A} (s)

/- warning: algebra.adjoin_eq_span -> Algebra.adjoin_eq_span is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] (s : Set.{u2} A), Eq.{succ u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (coeFn.{succ u2, succ u2} (OrderEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))))))) (fun (_x : RelEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))))) => (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) -> (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (RelEmbedding.hasCoeToFun.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))))) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Submodule.span.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Set.{u2} A) (SetLike.Set.hasCoeT.{u2, u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) A (Submonoid.setLike.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))))) (Submonoid.closure.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) s)))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] (s : Set.{u2} A), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (FunLike.coe.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (fun (_x : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) _x) (EmbeddingLike.toFunLike.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Function.instEmbeddingLikeEmbedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) (RelEmbedding.toEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.680 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (x._@.Mathlib.Order.Hom.Basic._hyg.682 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instPartialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) x._@.Mathlib.Order.Hom.Basic._hyg.680 x._@.Mathlib.Order.Hom.Basic._hyg.682) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.695 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (x._@.Mathlib.Order.Hom.Basic._hyg.697 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) => LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))) x._@.Mathlib.Order.Hom.Basic._hyg.695 x._@.Mathlib.Order.Hom.Basic._hyg.697) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Submodule.span.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.coe.{u2, u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) A (Submonoid.instSetLikeSubmonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Submonoid.closure.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) s)))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_eq_span Algebra.adjoin_eq_spanₓ'. -/
theorem adjoin_eq_span : (adjoin R s).toSubmodule = span R (Submonoid.closure s) :=
  by
  apply le_antisymm
  · intro r hr
    rcases Subsemiring.mem_closure_iff_exists_list.1 hr with ⟨L, HL, rfl⟩
    clear hr
    induction' L with hd tl ih
    · exact zero_mem _
    rw [List.forall_mem_cons] at HL
    rw [List.map_cons, List.sum_cons]
    refine' Submodule.add_mem _ _ (ih HL.2)
    replace HL := HL.1
    clear ih tl
    suffices ∃ (z r : _)(hr : r ∈ Submonoid.closure s), SMul.smul z r = List.prod hd
      by
      rcases this with ⟨z, r, hr, hzr⟩
      rw [← hzr]
      exact smul_mem _ _ (subset_span hr)
    induction' hd with hd tl ih
    · exact ⟨1, 1, (Submonoid.closure s).one_mem', one_smul _ _⟩
    rw [List.forall_mem_cons] at HL
    rcases ih HL.2 with ⟨z, r, hr, hzr⟩
    rw [List.prod_cons, ← hzr]
    rcases HL.1 with (⟨hd, rfl⟩ | hs)
    · refine' ⟨hd * z, r, hr, _⟩
      rw [Algebra.smul_def, Algebra.smul_def, (algebraMap _ _).map_mul, _root_.mul_assoc]
    ·
      exact
        ⟨z, hd * r, Submonoid.mul_mem _ (Submonoid.subset_closure hs) hr,
          (mul_smul_comm _ _ _).symm⟩
  refine' span_le.2 _
  change Submonoid.closure s ≤ (adjoin R s).toSubsemiring.toSubmonoid
  exact Submonoid.closure_le.2 subset_adjoin
#align algebra.adjoin_eq_span Algebra.adjoin_eq_span

/- warning: algebra.span_le_adjoin -> Algebra.span_le_adjoin is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] (s : Set.{u2} A), LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))) (Submodule.span.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) s) (coeFn.{succ u2, succ u2} (OrderEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))))))) (fun (_x : RelEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))))) => (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) -> (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (RelEmbedding.hasCoeToFun.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))))) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] (s : Set.{u2} A), LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))) (Submodule.span.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) s) (FunLike.coe.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (fun (_x : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) _x) (EmbeddingLike.toFunLike.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Function.instEmbeddingLikeEmbedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) (RelEmbedding.toEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.680 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (x._@.Mathlib.Order.Hom.Basic._hyg.682 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instPartialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) x._@.Mathlib.Order.Hom.Basic._hyg.680 x._@.Mathlib.Order.Hom.Basic._hyg.682) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.695 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (x._@.Mathlib.Order.Hom.Basic._hyg.697 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) => LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))) x._@.Mathlib.Order.Hom.Basic._hyg.695 x._@.Mathlib.Order.Hom.Basic._hyg.697) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))
Case conversion may be inaccurate. Consider using '#align algebra.span_le_adjoin Algebra.span_le_adjoinₓ'. -/
theorem span_le_adjoin (s : Set A) : span R s ≤ (adjoin R s).toSubmodule :=
  span_le.mpr subset_adjoin
#align algebra.span_le_adjoin Algebra.span_le_adjoin

/- warning: algebra.adjoin_to_submodule_le -> Algebra.adjoin_toSubmodule_le is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {t : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)}, Iff (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))) (coeFn.{succ u2, succ u2} (OrderEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))))))) (fun (_x : RelEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))))) => (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) -> (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (RelEmbedding.hasCoeToFun.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))))) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) t) (HasSubset.Subset.{u2} (Set.{u2} A) (Set.hasSubset.{u2} A) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Set.{u2} A) (SetLike.Set.hasCoeT.{u2, u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) A (Submonoid.setLike.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))))) (Submonoid.closure.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) s)) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Set.{u2} A) (SetLike.Set.hasCoeT.{u2, u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) A (Submodule.setLike.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) t))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A} {t : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)}, Iff (LE.le.{u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Preorder.toLE.{u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (PartialOrder.toPreorder.{u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (OmegaCompletePartialOrder.toPartialOrder.{u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (CompleteLattice.instOmegaCompletePartialOrder.{u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))) (FunLike.coe.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (fun (_x : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) _x) (EmbeddingLike.toFunLike.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Function.instEmbeddingLikeEmbedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) (RelEmbedding.toEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.680 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (x._@.Mathlib.Order.Hom.Basic._hyg.682 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instPartialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) x._@.Mathlib.Order.Hom.Basic._hyg.680 x._@.Mathlib.Order.Hom.Basic._hyg.682) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.695 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (x._@.Mathlib.Order.Hom.Basic._hyg.697 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) => LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))) x._@.Mathlib.Order.Hom.Basic._hyg.695 x._@.Mathlib.Order.Hom.Basic._hyg.697) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) t) (HasSubset.Subset.{u2} (Set.{u2} A) (Set.instHasSubsetSet.{u2} A) (SetLike.coe.{u2, u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) A (Submonoid.instSetLikeSubmonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Submonoid.closure.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) s)) (SetLike.coe.{u2, u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) A (Submodule.setLike.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) t))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_to_submodule_le Algebra.adjoin_toSubmodule_leₓ'. -/
theorem adjoin_toSubmodule_le {s : Set A} {t : Submodule R A} :
    (adjoin R s).toSubmodule ≤ t ↔ ↑(Submonoid.closure s) ⊆ (t : Set A) := by
  rw [adjoin_eq_span, span_le]
#align algebra.adjoin_to_submodule_le Algebra.adjoin_toSubmodule_le

/- warning: algebra.adjoin_eq_span_of_subset -> Algebra.adjoin_eq_span_of_subset is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A}, (HasSubset.Subset.{u2} (Set.{u2} A) (Set.hasSubset.{u2} A) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Set.{u2} A) (SetLike.Set.hasCoeT.{u2, u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) A (Submonoid.setLike.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))))) (Submonoid.closure.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) s)) ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Set.{u2} A) (HasLiftT.mk.{succ u2, succ u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Set.{u2} A) (CoeTCₓ.coe.{succ u2, succ u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Set.{u2} A) (SetLike.Set.hasCoeT.{u2, u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) A (Submodule.setLike.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (Submodule.span.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) s))) -> (Eq.{succ u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (coeFn.{succ u2, succ u2} (OrderEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))))))) (fun (_x : RelEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))))) => (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) -> (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (RelEmbedding.hasCoeToFun.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))))) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Submodule.span.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) s))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A}, (HasSubset.Subset.{u2} (Set.{u2} A) (Set.instHasSubsetSet.{u2} A) (SetLike.coe.{u2, u2} (Submonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) A (Submonoid.instSetLikeSubmonoid.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Submonoid.closure.{u2} A (MulZeroOneClass.toMulOneClass.{u2} A (NonAssocSemiring.toMulZeroOneClass.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) s)) (SetLike.coe.{u2, u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) A (Submodule.setLike.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.span.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) s))) -> (Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (FunLike.coe.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (fun (_x : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) _x) (EmbeddingLike.toFunLike.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))) (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Function.instEmbeddingLikeEmbedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) (RelEmbedding.toEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.680 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (x._@.Mathlib.Order.Hom.Basic._hyg.682 : Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) => LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instPartialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) x._@.Mathlib.Order.Hom.Basic._hyg.680 x._@.Mathlib.Order.Hom.Basic._hyg.682) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.695 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (x._@.Mathlib.Order.Hom.Basic._hyg.697 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) => LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)))))) x._@.Mathlib.Order.Hom.Basic._hyg.695 x._@.Mathlib.Order.Hom.Basic._hyg.697) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) (Submodule.span.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) s))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_eq_span_of_subset Algebra.adjoin_eq_span_of_subsetₓ'. -/
theorem adjoin_eq_span_of_subset {s : Set A} (hs : ↑(Submonoid.closure s) ⊆ (span R s : Set A)) :
    (adjoin R s).toSubmodule = span R s :=
  le_antisymm ((adjoin_toSubmodule_le R).mpr hs) (span_le_adjoin R s)
#align algebra.adjoin_eq_span_of_subset Algebra.adjoin_eq_span_of_subset

#print Algebra.adjoin_span /-
@[simp]
theorem adjoin_span {s : Set A} : adjoin R (Submodule.span R s : Set A) = adjoin R s :=
  le_antisymm (adjoin_le (span_le_adjoin _ _)) (adjoin_mono Submodule.subset_span)
#align algebra.adjoin_span Algebra.adjoin_span
-/

#print Algebra.adjoin_image /-
theorem adjoin_image (f : A →ₐ[R] B) (s : Set A) : adjoin R (f '' s) = (adjoin R s).map f :=
  le_antisymm (adjoin_le <| Set.image_subset _ subset_adjoin) <|
    Subalgebra.map_le.2 <| adjoin_le <| Set.image_subset_iff.1 subset_adjoin
#align algebra.adjoin_image Algebra.adjoin_image
-/

#print Algebra.adjoin_insert_adjoin /-
@[simp]
theorem adjoin_insert_adjoin (x : A) : adjoin R (insert x ↑(adjoin R s)) = adjoin R (insert x s) :=
  le_antisymm
    (adjoin_le
      (Set.insert_subset.mpr
        ⟨subset_adjoin (Set.mem_insert _ _), adjoin_mono (Set.subset_insert _ _)⟩))
    (Algebra.adjoin_mono (Set.insert_subset_insert Algebra.subset_adjoin))
#align algebra.adjoin_insert_adjoin Algebra.adjoin_insert_adjoin
-/

/- warning: algebra.adjoin_prod_le -> Algebra.adjoin_prod_le is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} {B : Type.{u3}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_3 : Semiring.{u3} B] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] [_inst_5 : Algebra.{u1, u3} R B _inst_1 _inst_3] (s : Set.{u2} A) (t : Set.{u3} B), LE.le.{max u2 u3} (Subalgebra.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.semiring.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (Preorder.toLE.{max u2 u3} (Subalgebra.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.semiring.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (PartialOrder.toPreorder.{max u2 u3} (Subalgebra.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.semiring.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (CompleteSemilatticeInf.toPartialOrder.{max u2 u3} (Subalgebra.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.semiring.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (CompleteLattice.toCompleteSemilatticeInf.{max u2 u3} (Subalgebra.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.semiring.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (Algebra.Subalgebra.completeLattice.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.semiring.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)))))) (Algebra.adjoin.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.semiring.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5) (Set.prod.{u2, u3} A B s t)) (Subalgebra.prod.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) (Algebra.adjoin.{u1, u3} R B _inst_1 _inst_3 _inst_5 t))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} {B : Type.{u3}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_3 : Semiring.{u3} B] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] [_inst_5 : Algebra.{u1, u3} R B _inst_1 _inst_3] (s : Set.{u2} A) (t : Set.{u3} B), LE.le.{max u2 u3} (Subalgebra.{u1, max u3 u2} R (Prod.{u2, u3} A B) _inst_1 (Prod.instSemiringProd.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (Preorder.toLE.{max u2 u3} (Subalgebra.{u1, max u3 u2} R (Prod.{u2, u3} A B) _inst_1 (Prod.instSemiringProd.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (PartialOrder.toPreorder.{max u2 u3} (Subalgebra.{u1, max u3 u2} R (Prod.{u2, u3} A B) _inst_1 (Prod.instSemiringProd.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (OmegaCompletePartialOrder.toPartialOrder.{max u2 u3} (Subalgebra.{u1, max u3 u2} R (Prod.{u2, u3} A B) _inst_1 (Prod.instSemiringProd.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (CompleteLattice.instOmegaCompletePartialOrder.{max u2 u3} (Subalgebra.{u1, max u3 u2} R (Prod.{u2, u3} A B) _inst_1 (Prod.instSemiringProd.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (Algebra.instCompleteLatticeSubalgebra.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.instSemiringProd.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)))))) (Algebra.adjoin.{u1, max u3 u2} R (Prod.{u2, u3} A B) _inst_1 (Prod.instSemiringProd.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5) (Set.prod.{u2, u3} A B s t)) (Subalgebra.prod.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) (Algebra.adjoin.{u1, u3} R B _inst_1 _inst_3 _inst_5 t))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_prod_le Algebra.adjoin_prod_leₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem adjoin_prod_le (s : Set A) (t : Set B) :
    adjoin R (s ×ˢ t) ≤ (adjoin R s).Prod (adjoin R t) :=
  adjoin_le <| Set.prod_mono subset_adjoin subset_adjoin
#align algebra.adjoin_prod_le Algebra.adjoin_prod_le

/- warning: algebra.mem_adjoin_of_map_mul -> Algebra.mem_adjoin_of_map_mul is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} {B : Type.{u3}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_3 : Semiring.{u3} B] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] [_inst_5 : Algebra.{u1, u3} R B _inst_1 _inst_3] {s : Set.{u2} A} {x : A} {f : LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)}, (forall (a₁ : A) (a₂ : A), Eq.{succ u3} B (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (fun (_x : LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) => A -> B) (LinearMap.hasCoeToFun.{u1, u1, u2, u3} R R A B (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) f (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (Distrib.toHasMul.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) a₁ a₂)) (HMul.hMul.{u3, u3, u3} B B B (instHMul.{u3} B (Distrib.toHasMul.{u3} B (NonUnitalNonAssocSemiring.toDistrib.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))))) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (fun (_x : LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) => A -> B) (LinearMap.hasCoeToFun.{u1, u1, u2, u3} R R A B (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) f a₁) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (fun (_x : LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) => A -> B) (LinearMap.hasCoeToFun.{u1, u1, u2, u3} R R A B (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) f a₂))) -> (Membership.Mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.hasMem.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) -> (Membership.Mem.{u3, u3} B (Subalgebra.{u1, u3} R B _inst_1 _inst_3 _inst_5) (SetLike.hasMem.{u3, u3} (Subalgebra.{u1, u3} R B _inst_1 _inst_3 _inst_5) B (Subalgebra.setLike.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (fun (_x : LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) => A -> B) (LinearMap.hasCoeToFun.{u1, u1, u2, u3} R R A B (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) f x) (Algebra.adjoin.{u1, u3} R B _inst_1 _inst_3 _inst_5 (Set.image.{u2, u3} A B (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (fun (_x : LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) => A -> B) (LinearMap.hasCoeToFun.{u1, u1, u2, u3} R R A B (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) f) (Union.union.{u2} (Set.{u2} A) (Set.hasUnion.{u2} A) s (Singleton.singleton.{u2, u2} A (Set.{u2} A) (Set.hasSingleton.{u2} A) (OfNat.ofNat.{u2} A 1 (OfNat.mk.{u2} A 1 (One.one.{u2} A (AddMonoidWithOne.toOne.{u2} A (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} A (NonAssocSemiring.toAddCommMonoidWithOne.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))))))))))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} {B : Type.{u3}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_3 : Semiring.{u3} B] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] [_inst_5 : Algebra.{u1, u3} R B _inst_1 _inst_3] {s : Set.{u2} A} {x : A} {f : LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)}, (forall (a₁ : A) (a₂ : A), Eq.{succ u3} ((fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) a₁ a₂)) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) A (fun (_x : A) => (fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) _x) (LinearMap.instFunLikeLinearMap.{u1, u1, u2, u3} R R A B (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) f (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) a₁ a₂)) (HMul.hMul.{u3, u3, u3} ((fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) a₁) ((fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) a₂) ((fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) a₁) (instHMul.{u3} ((fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) a₁) (NonUnitalNonAssocSemiring.toMul.{u3} ((fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) a₁) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} ((fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) a₁) (Semiring.toNonAssocSemiring.{u3} ((fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) a₁) _inst_3)))) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) A (fun (_x : A) => (fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) _x) (LinearMap.instFunLikeLinearMap.{u1, u1, u2, u3} R R A B (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) f a₁) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) A (fun (_x : A) => (fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) _x) (LinearMap.instFunLikeLinearMap.{u1, u1, u2, u3} R R A B (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) f a₂))) -> (Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)) -> (Membership.mem.{u3, u3} ((fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) x) (Subalgebra.{u1, u3} R B _inst_1 _inst_3 _inst_5) (SetLike.instMembership.{u3, u3} (Subalgebra.{u1, u3} R B _inst_1 _inst_3 _inst_5) B (Subalgebra.instSetLikeSubalgebra.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) A (fun (_x : A) => (fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) _x) (LinearMap.instFunLikeLinearMap.{u1, u1, u2, u3} R R A B (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) f x) (Algebra.adjoin.{u1, u3} R B _inst_1 _inst_3 _inst_5 (Set.image.{u2, u3} A B (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (LinearMap.{u1, u1, u2, u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) A (fun (_x : A) => (fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => B) _x) (LinearMap.instFunLikeLinearMap.{u1, u1, u2, u3} R R A B (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) f) (Union.union.{u2} (Set.{u2} A) (Set.instUnionSet.{u2} A) s (Singleton.singleton.{u2, u2} A (Set.{u2} A) (Set.instSingletonSet.{u2} A) (OfNat.ofNat.{u2} A 1 (One.toOfNat1.{u2} A (Semiring.toOne.{u2} A _inst_2))))))))
Case conversion may be inaccurate. Consider using '#align algebra.mem_adjoin_of_map_mul Algebra.mem_adjoin_of_map_mulₓ'. -/
theorem mem_adjoin_of_map_mul {s} {x : A} {f : A →ₗ[R] B} (hf : ∀ a₁ a₂, f (a₁ * a₂) = f a₁ * f a₂)
    (h : x ∈ adjoin R s) : f x ∈ adjoin R (f '' (s ∪ {1})) :=
  by
  refine'
    @adjoin_induction R A _ _ _ _ (fun a => f a ∈ adjoin R (f '' (s ∪ {1}))) x h
      (fun a ha => subset_adjoin ⟨a, ⟨Set.subset_union_left _ _ ha, rfl⟩⟩) (fun r => _)
      (fun y z hy hz => by simpa [hy, hz] using Subalgebra.add_mem _ hy hz) fun y z hy hz => by
      simpa [hy, hz, hf y z] using Subalgebra.mul_mem _ hy hz
  have : f 1 ∈ adjoin R (f '' (s ∪ {1})) :=
    subset_adjoin ⟨1, ⟨Set.subset_union_right _ _ <| Set.mem_singleton 1, rfl⟩⟩
  replace this := Subalgebra.smul_mem (adjoin R (f '' (s ∪ {1}))) this r
  convert this
  rw [algebra_map_eq_smul_one]
  exact f.map_smul _ _
#align algebra.mem_adjoin_of_map_mul Algebra.mem_adjoin_of_map_mul

/- warning: algebra.adjoin_inl_union_inr_eq_prod -> Algebra.adjoin_inl_union_inr_eq_prod is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} {B : Type.{u3}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_3 : Semiring.{u3} B] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] [_inst_5 : Algebra.{u1, u3} R B _inst_1 _inst_3] (s : Set.{u2} A) (t : Set.{u3} B), Eq.{succ (max u2 u3)} (Subalgebra.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.semiring.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (Algebra.adjoin.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.semiring.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5) (Union.union.{max u2 u3} (Set.{max u2 u3} (Prod.{u2, u3} A B)) (Set.hasUnion.{max u2 u3} (Prod.{u2, u3} A B)) (Set.image.{u2, max u2 u3} A (Prod.{u2, u3} A B) (coeFn.{max (succ u2) (succ (max u2 u3)), max (succ u2) (succ (max u2 u3))} (LinearMap.{u1, u1, u2, max u2 u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A (Prod.{u2, u3} A B) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Prod.addCommMonoid.{u2, u3} A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Prod.module.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))) (fun (_x : LinearMap.{u1, u1, u2, max u2 u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A (Prod.{u2, u3} A B) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Prod.addCommMonoid.{u2, u3} A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Prod.module.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))) => A -> (Prod.{u2, u3} A B)) (LinearMap.hasCoeToFun.{u1, u1, u2, max u2 u3} R R A (Prod.{u2, u3} A B) (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Prod.addCommMonoid.{u2, u3} A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Prod.module.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (LinearMap.inl.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))) (Union.union.{u2} (Set.{u2} A) (Set.hasUnion.{u2} A) s (Singleton.singleton.{u2, u2} A (Set.{u2} A) (Set.hasSingleton.{u2} A) (OfNat.ofNat.{u2} A 1 (OfNat.mk.{u2} A 1 (One.one.{u2} A (AddMonoidWithOne.toOne.{u2} A (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} A (NonAssocSemiring.toAddCommMonoidWithOne.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))))))))) (Set.image.{u3, max u2 u3} B (Prod.{u2, u3} A B) (coeFn.{max (succ u3) (succ (max u2 u3)), max (succ u3) (succ (max u2 u3))} (LinearMap.{u1, u1, u3, max u2 u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) B (Prod.{u2, u3} A B) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Prod.addCommMonoid.{u2, u3} A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (Prod.module.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))) (fun (_x : LinearMap.{u1, u1, u3, max u2 u3} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) B (Prod.{u2, u3} A B) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Prod.addCommMonoid.{u2, u3} A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (Prod.module.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))) => B -> (Prod.{u2, u3} A B)) (LinearMap.hasCoeToFun.{u1, u1, u3, max u2 u3} R R B (Prod.{u2, u3} A B) (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Prod.addCommMonoid.{u2, u3} A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (Prod.module.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (LinearMap.inr.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))) (Union.union.{u3} (Set.{u3} B) (Set.hasUnion.{u3} B) t (Singleton.singleton.{u3, u3} B (Set.{u3} B) (Set.hasSingleton.{u3} B) (OfNat.ofNat.{u3} B 1 (OfNat.mk.{u3} B 1 (One.one.{u3} B (AddMonoidWithOne.toOne.{u3} B (AddCommMonoidWithOne.toAddMonoidWithOne.{u3} B (NonAssocSemiring.toAddCommMonoidWithOne.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))))))))))) (Subalgebra.prod.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) (Algebra.adjoin.{u1, u3} R B _inst_1 _inst_3 _inst_5 t))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} {B : Type.{u3}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_3 : Semiring.{u3} B] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] [_inst_5 : Algebra.{u1, u3} R B _inst_1 _inst_3] (s : Set.{u2} A) (t : Set.{u3} B), Eq.{max (succ u2) (succ u3)} (Subalgebra.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.instSemiringProd.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5)) (Algebra.adjoin.{u1, max u2 u3} R (Prod.{u2, u3} A B) _inst_1 (Prod.instSemiringProd.{u2, u3} A B _inst_2 _inst_3) (Prod.algebra.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5) (Union.union.{max u2 u3} (Set.{max u2 u3} (Prod.{u2, u3} A B)) (Set.instUnionSet.{max u2 u3} (Prod.{u2, u3} A B)) (Set.image.{u2, max u2 u3} A (Prod.{u2, u3} A B) (FunLike.coe.{max (succ u2) (succ u3), succ u2, max (succ u2) (succ u3)} (LinearMap.{u1, u1, u2, max u3 u2} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) A (Prod.{u2, u3} A B) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Prod.instAddCommMonoidSum.{u2, u3} A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Prod.module.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))) A (fun (_x : A) => (fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : A) => Prod.{u2, u3} A B) _x) (LinearMap.instFunLikeLinearMap.{u1, u1, u2, max u2 u3} R R A (Prod.{u2, u3} A B) (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Prod.instAddCommMonoidSum.{u2, u3} A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Prod.module.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (LinearMap.inl.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))) (Union.union.{u2} (Set.{u2} A) (Set.instUnionSet.{u2} A) s (Singleton.singleton.{u2, u2} A (Set.{u2} A) (Set.instSingletonSet.{u2} A) (OfNat.ofNat.{u2} A 1 (One.toOfNat1.{u2} A (Semiring.toOne.{u2} A _inst_2)))))) (Set.image.{u3, max u2 u3} B (Prod.{u2, u3} A B) (FunLike.coe.{max (succ u2) (succ u3), succ u3, max (succ u2) (succ u3)} (LinearMap.{u1, u1, u3, max u3 u2} R R (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) B (Prod.{u2, u3} A B) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Prod.instAddCommMonoidSum.{u2, u3} A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (Prod.module.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))) B (fun (_x : B) => (fun (x._@.Mathlib.Algebra.Module.LinearMap._hyg.6190 : B) => Prod.{u2, u3} A B) _x) (LinearMap.instFunLikeLinearMap.{u1, u1, u3, max u2 u3} R R B (Prod.{u2, u3} A B) (CommSemiring.toSemiring.{u1} R _inst_1) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Prod.instAddCommMonoidSum.{u2, u3} A B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5) (Prod.module.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (RingHom.id.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (LinearMap.inr.{u1, u2, u3} R A B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))) (Union.union.{u3} (Set.{u3} B) (Set.instUnionSet.{u3} B) t (Singleton.singleton.{u3, u3} B (Set.{u3} B) (Set.instSingletonSet.{u3} B) (OfNat.ofNat.{u3} B 1 (One.toOfNat1.{u3} B (Semiring.toOne.{u3} B _inst_3)))))))) (Subalgebra.prod.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_4 _inst_3 _inst_5 (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) (Algebra.adjoin.{u1, u3} R B _inst_1 _inst_3 _inst_5 t))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_inl_union_inr_eq_prod Algebra.adjoin_inl_union_inr_eq_prodₓ'. -/
theorem adjoin_inl_union_inr_eq_prod (s) (t) :
    adjoin R (LinearMap.inl R A B '' (s ∪ {1}) ∪ LinearMap.inr R A B '' (t ∪ {1})) =
      (adjoin R s).Prod (adjoin R t) :=
  by
  apply le_antisymm
  ·
    simp only [adjoin_le_iff, Set.insert_subset, Subalgebra.zero_mem, Subalgebra.one_mem,
      subset_adjoin,-- the rest comes from `squeeze_simp`
      Set.union_subset_iff,
      LinearMap.coe_inl, Set.mk_preimage_prod_right, Set.image_subset_iff, SetLike.mem_coe,
      Set.mk_preimage_prod_left, LinearMap.coe_inr, and_self_iff, Set.union_singleton,
      Subalgebra.coe_prod]
  · rintro ⟨a, b⟩ ⟨ha, hb⟩
    let P := adjoin R (LinearMap.inl R A B '' (s ∪ {1}) ∪ LinearMap.inr R A B '' (t ∪ {1}))
    have Ha : (a, (0 : B)) ∈ adjoin R (LinearMap.inl R A B '' (s ∪ {1})) :=
      mem_adjoin_of_map_mul R LinearMap.inl_map_mul ha
    have Hb : ((0 : A), b) ∈ adjoin R (LinearMap.inr R A B '' (t ∪ {1})) :=
      mem_adjoin_of_map_mul R LinearMap.inr_map_mul hb
    replace Ha : (a, (0 : B)) ∈ P := adjoin_mono (Set.subset_union_left _ _) Ha
    replace Hb : ((0 : A), b) ∈ P := adjoin_mono (Set.subset_union_right _ _) Hb
    simpa using Subalgebra.add_mem _ Ha Hb
#align algebra.adjoin_inl_union_inr_eq_prod Algebra.adjoin_inl_union_inr_eq_prod

/- warning: algebra.adjoin_comm_semiring_of_comm -> Algebra.adjoinCommSemiringOfComm is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A}, (forall (a : A), (Membership.Mem.{u2, u2} A (Set.{u2} A) (Set.hasMem.{u2} A) a s) -> (forall (b : A), (Membership.Mem.{u2, u2} A (Set.{u2} A) (Set.hasMem.{u2} A) b s) -> (Eq.{succ u2} A (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (Distrib.toHasMul.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) a b) (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (Distrib.toHasMul.{u2} A (NonUnitalNonAssocSemiring.toDistrib.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) b a)))) -> (CommSemiring.{u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s)))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] {s : Set.{u2} A}, (forall (a : A), (Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) a s) -> (forall (b : A), (Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) b s) -> (Eq.{succ u2} A (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) a b) (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) b a)))) -> (CommSemiring.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s))))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_comm_semiring_of_comm Algebra.adjoinCommSemiringOfCommₓ'. -/
/-- If all elements of `s : set A` commute pairwise, then `adjoin R s` is a commutative
semiring.  -/
def adjoinCommSemiringOfComm {s : Set A} (hcomm : ∀ a ∈ s, ∀ b ∈ s, a * b = b * a) :
    CommSemiring (adjoin R s) :=
  { (adjoin R s).toSemiring with
    mul_comm := fun x y => by
      ext
      simp only [Subalgebra.coe_mul]
      exact
        adjoin_induction₂ x.prop y.prop hcomm (fun _ _ => by rw [commutes])
          (fun r x hx => commutes r x) (fun r x hx => (commutes r x).symm)
          (fun _ _ _ h₁ h₂ => by simp only [add_mul, mul_add, h₁, h₂])
          (fun _ _ _ h₁ h₂ => by simp only [add_mul, mul_add, h₁, h₂])
          (fun x₁ x₂ y₁ h₁ h₂ => by rw [mul_assoc, h₂, ← mul_assoc y₁, ← h₁, mul_assoc x₁])
          fun x₁ x₂ y₁ h₁ h₂ => by rw [mul_assoc x₂, ← h₂, ← mul_assoc x₂, ← h₁, ← mul_assoc] }
#align algebra.adjoin_comm_semiring_of_comm Algebra.adjoinCommSemiringOfComm

/- warning: algebra.adjoin_singleton_one -> Algebra.adjoin_singleton_one is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2], Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Singleton.singleton.{u2, u2} A (Set.{u2} A) (Set.hasSingleton.{u2} A) (OfNat.ofNat.{u2} A 1 (OfNat.mk.{u2} A 1 (One.one.{u2} A (AddMonoidWithOne.toOne.{u2} A (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} A (NonAssocSemiring.toAddCommMonoidWithOne.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))))))) (Bot.bot.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toHasBot.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.Subalgebra.completeLattice.{u1, u2} R A _inst_1 _inst_2 _inst_4)))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2], Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Singleton.singleton.{u2, u2} A (Set.{u2} A) (Set.instSingletonSet.{u2} A) (OfNat.ofNat.{u2} A 1 (One.toOfNat1.{u2} A (Semiring.toOne.{u2} A _inst_2))))) (Bot.bot.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toBot.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.instCompleteLatticeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_singleton_one Algebra.adjoin_singleton_oneₓ'. -/
theorem adjoin_singleton_one : adjoin R ({1} : Set A) = ⊥ :=
  eq_bot_iff.2 <| adjoin_le <| Set.singleton_subset_iff.2 <| SetLike.mem_coe.2 <| one_mem _
#align algebra.adjoin_singleton_one Algebra.adjoin_singleton_one

/- warning: algebra.self_mem_adjoin_singleton -> Algebra.self_mem_adjoin_singleton is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] (x : A), Membership.Mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.hasMem.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.setLike.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Singleton.singleton.{u2, u2} A (Set.{u2} A) (Set.hasSingleton.{u2} A) x))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] (x : A), Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)) x (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 (Singleton.singleton.{u2, u2} A (Set.{u2} A) (Set.instSingletonSet.{u2} A) x))
Case conversion may be inaccurate. Consider using '#align algebra.self_mem_adjoin_singleton Algebra.self_mem_adjoin_singletonₓ'. -/
theorem self_mem_adjoin_singleton (x : A) : x ∈ adjoin R ({x} : Set A) :=
  Algebra.subset_adjoin (Set.mem_singleton_iff.mpr rfl)
#align algebra.self_mem_adjoin_singleton Algebra.self_mem_adjoin_singleton

end Semiring

section CommSemiring

variable [CommSemiring R] [CommSemiring A]

variable [Algebra R A] {s t : Set A}

variable (R s t)

#print Algebra.adjoin_union_eq_adjoin_adjoin /-
theorem adjoin_union_eq_adjoin_adjoin :
    adjoin R (s ∪ t) = (adjoin (adjoin R s) t).restrictScalars R :=
  le_antisymm
    (closure_mono <|
      Set.union_subset (Set.range_subset_iff.2 fun r => Or.inl ⟨algebraMap R (adjoin R s) r, rfl⟩)
        (Set.union_subset_union_left _ fun x hxs => ⟨⟨_, subset_adjoin hxs⟩, rfl⟩))
    (closure_le.2 <|
      Set.union_subset (Set.range_subset_iff.2 fun x => adjoin_mono (Set.subset_union_left _ _) x.2)
        (Set.Subset.trans (Set.subset_union_right _ _) subset_adjoin))
#align algebra.adjoin_union_eq_adjoin_adjoin Algebra.adjoin_union_eq_adjoin_adjoin
-/

/- warning: algebra.adjoin_union_coe_submodule -> Algebra.adjoin_union_coe_submodule is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : CommSemiring.{u2} A] [_inst_3 : Algebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2)] (s : Set.{u2} A) (t : Set.{u2} A), Eq.{succ u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (coeFn.{succ u2, succ u2} (OrderEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))))))) (fun (_x : RelEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))))))) => (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) -> (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))) (RelEmbedding.hasCoeToFun.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))))))) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 (Union.union.{u2} (Set.{u2} A) (Set.hasUnion.{u2} A) s t))) (HMul.hMul.{u2, u2, u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (instHMul.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.mul.{u1, u2} R _inst_1 A (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (coeFn.{succ u2, succ u2} (OrderEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))))))) (fun (_x : RelEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))))))) => (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) -> (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))) (RelEmbedding.hasCoeToFun.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))))))) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 s)) (coeFn.{succ u2, succ u2} (OrderEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))))))) (fun (_x : RelEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))))))) => (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) -> (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))) (RelEmbedding.hasCoeToFun.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.partialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))))) (LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteSemilatticeInf.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.toCompleteSemilatticeInf.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))))))) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 t)))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : CommSemiring.{u2} A] [_inst_3 : Algebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2)] (s : Set.{u2} A) (t : Set.{u2} A), Eq.{succ u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 (Union.union.{u2} (Set.{u2} A) (Set.instUnionSet.{u2} A) s t))) (FunLike.coe.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))) (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (fun (_x : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) _x) (EmbeddingLike.toFunLike.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))) (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Function.instEmbeddingLikeEmbedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))) (RelEmbedding.toEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.680 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (x._@.Mathlib.Order.Hom.Basic._hyg.682 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.instPartialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))) x._@.Mathlib.Order.Hom.Basic._hyg.680 x._@.Mathlib.Order.Hom.Basic._hyg.682) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.695 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (x._@.Mathlib.Order.Hom.Basic._hyg.697 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) => LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))))) x._@.Mathlib.Order.Hom.Basic._hyg.695 x._@.Mathlib.Order.Hom.Basic._hyg.697) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 (Union.union.{u2} (Set.{u2} A) (Set.instUnionSet.{u2} A) s t))) (HMul.hMul.{u2, u2, u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 s)) ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 t)) ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 s)) (instHMul.{u2} ((fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 s)) (Submodule.mul.{u1, u2} R _inst_1 A (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (FunLike.coe.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))) (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (fun (_x : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) _x) (EmbeddingLike.toFunLike.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))) (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Function.instEmbeddingLikeEmbedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))) (RelEmbedding.toEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.680 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (x._@.Mathlib.Order.Hom.Basic._hyg.682 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.instPartialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))) x._@.Mathlib.Order.Hom.Basic._hyg.680 x._@.Mathlib.Order.Hom.Basic._hyg.682) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.695 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (x._@.Mathlib.Order.Hom.Basic._hyg.697 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) => LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))))) x._@.Mathlib.Order.Hom.Basic._hyg.695 x._@.Mathlib.Order.Hom.Basic._hyg.697) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 s)) (FunLike.coe.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))) (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (fun (_x : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => (fun (x._@.Mathlib.Data.FunLike.Embedding._hyg.19 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) _x) (EmbeddingLike.toFunLike.{succ u2, succ u2, succ u2} (Function.Embedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))) (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Function.instEmbeddingLikeEmbedding.{succ u2, succ u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))) (RelEmbedding.toEmbedding.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.680 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (x._@.Mathlib.Order.Hom.Basic._hyg.682 : Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) => LE.le.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Preorder.toLE.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (PartialOrder.toPreorder.{u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.instPartialOrder.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))) x._@.Mathlib.Order.Hom.Basic._hyg.680 x._@.Mathlib.Order.Hom.Basic._hyg.682) (fun (x._@.Mathlib.Order.Hom.Basic._hyg.695 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (x._@.Mathlib.Order.Hom.Basic._hyg.697 : Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) => LE.le.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Preorder.toLE.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (PartialOrder.toPreorder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (OmegaCompletePartialOrder.toPartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (CompleteLattice.instOmegaCompletePartialOrder.{u2} (Submodule.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Submodule.completeLattice.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))))) x._@.Mathlib.Order.Hom.Basic._hyg.695 x._@.Mathlib.Order.Hom.Basic._hyg.697) (Subalgebra.toSubmodule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 t)))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_union_coe_submodule Algebra.adjoin_union_coe_submoduleₓ'. -/
theorem adjoin_union_coe_submodule :
    (adjoin R (s ∪ t)).toSubmodule = (adjoin R s).toSubmodule * (adjoin R t).toSubmodule :=
  by
  rw [adjoin_eq_span, adjoin_eq_span, adjoin_eq_span, span_mul_span]
  congr 1 with z; simp [Submonoid.closure_union, Submonoid.mem_sup, Set.mem_mul]
#align algebra.adjoin_union_coe_submodule Algebra.adjoin_union_coe_submodule

#print Algebra.adjoin_adjoin_of_tower /-
theorem adjoin_adjoin_of_tower [Semiring B] [Algebra R B] [Algebra A B] [IsScalarTower R A B]
    (s : Set B) : adjoin A (adjoin R s : Set B) = adjoin A s :=
  by
  apply le_antisymm (adjoin_le _)
  · exact adjoin_mono subset_adjoin
  · change adjoin R s ≤ (adjoin A s).restrictScalars R
    refine' adjoin_le _
    exact subset_adjoin
#align algebra.adjoin_adjoin_of_tower Algebra.adjoin_adjoin_of_tower
-/

variable {R}

/- warning: algebra.pow_smul_mem_of_smul_subset_of_mem_adjoin -> Algebra.pow_smul_mem_of_smul_subset_of_mem_adjoin is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} {B : Type.{u3}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : CommSemiring.{u2} A] [_inst_3 : Algebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2)] [_inst_4 : CommSemiring.{u3} B] [_inst_5 : Algebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4)] [_inst_6 : Algebra.{u2, u3} A B _inst_2 (CommSemiring.toSemiring.{u3} B _inst_4)] [_inst_7 : IsScalarTower.{u1, u2, u3} R A B (SMulZeroClass.toHasSmul.{u1, u2} R A (AddZeroClass.toHasZero.{u2} A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))))) (SMulWithZero.toSmulZeroClass.{u1, u2} R A (MulZeroClass.toHasZero.{u1} R (MulZeroOneClass.toMulZeroClass.{u1} R (MonoidWithZero.toMulZeroOneClass.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))))) (AddZeroClass.toHasZero.{u2} A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))))) (MulActionWithZero.toSMulWithZero.{u1, u2} R A (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (AddZeroClass.toHasZero.{u2} A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))))) (Module.toMulActionWithZero.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))))) (SMulZeroClass.toHasSmul.{u2, u3} A B (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (SMulWithZero.toSmulZeroClass.{u2, u3} A B (MulZeroClass.toHasZero.{u2} A (MulZeroOneClass.toMulZeroClass.{u2} A (MonoidWithZero.toMulZeroOneClass.{u2} A (Semiring.toMonoidWithZero.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))) (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (MulActionWithZero.toSMulWithZero.{u2, u3} A B (Semiring.toMonoidWithZero.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (Module.toMulActionWithZero.{u2, u3} A B (CommSemiring.toSemiring.{u2} A _inst_2) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4)))) (Algebra.toModule.{u2, u3} A B _inst_2 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_6))))) (SMulZeroClass.toHasSmul.{u1, u3} R B (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (SMulWithZero.toSmulZeroClass.{u1, u3} R B (MulZeroClass.toHasZero.{u1} R (MulZeroOneClass.toMulZeroClass.{u1} R (MonoidWithZero.toMulZeroOneClass.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))))) (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (MulActionWithZero.toSMulWithZero.{u1, u3} R B (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (Module.toMulActionWithZero.{u1, u3} R B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4)))) (Algebra.toModule.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5)))))] (r : A) (s : Set.{u3} B) (B' : Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5), (HasSubset.Subset.{u3} (Set.{u3} B) (Set.hasSubset.{u3} B) (SMul.smul.{u2, u3} A (Set.{u3} B) (Set.smulSet.{u2, u3} A B (SMulZeroClass.toHasSmul.{u2, u3} A B (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (SMulWithZero.toSmulZeroClass.{u2, u3} A B (MulZeroClass.toHasZero.{u2} A (MulZeroOneClass.toMulZeroClass.{u2} A (MonoidWithZero.toMulZeroOneClass.{u2} A (Semiring.toMonoidWithZero.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))) (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (MulActionWithZero.toSMulWithZero.{u2, u3} A B (Semiring.toMonoidWithZero.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (Module.toMulActionWithZero.{u2, u3} A B (CommSemiring.toSemiring.{u2} A _inst_2) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4)))) (Algebra.toModule.{u2, u3} A B _inst_2 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_6)))))) r s) ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) (Set.{u3} B) (HasLiftT.mk.{succ u3, succ u3} (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) (Set.{u3} B) (CoeTCₓ.coe.{succ u3, succ u3} (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) (Set.{u3} B) (SetLike.Set.hasCoeT.{u3, u3} (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) B (Subalgebra.setLike.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5)))) B')) -> (forall {x : B}, (Membership.Mem.{u3, u3} B (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) (SetLike.hasMem.{u3, u3} (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) B (Subalgebra.setLike.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5)) x (Algebra.adjoin.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5 s)) -> (Membership.Mem.{u3, u3} B (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) (SetLike.hasMem.{u3, u3} (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) B (Subalgebra.setLike.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5)) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (RingHom.{u2, u3} A B (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))) (fun (_x : RingHom.{u2, u3} A B (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))) => A -> B) (RingHom.hasCoeToFun.{u2, u3} A B (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))) (algebraMap.{u2, u3} A B _inst_2 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_6) r) B') -> (Exists.{1} Nat (fun (n₀ : Nat) => forall (n : Nat), (GE.ge.{0} Nat Nat.hasLe n n₀) -> (Membership.Mem.{u3, u3} B (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) (SetLike.hasMem.{u3, u3} (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) B (Subalgebra.setLike.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5)) (SMul.smul.{u2, u3} A B (SMulZeroClass.toHasSmul.{u2, u3} A B (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (SMulWithZero.toSmulZeroClass.{u2, u3} A B (MulZeroClass.toHasZero.{u2} A (MulZeroOneClass.toMulZeroClass.{u2} A (MonoidWithZero.toMulZeroOneClass.{u2} A (Semiring.toMonoidWithZero.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))) (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (MulActionWithZero.toSMulWithZero.{u2, u3} A B (Semiring.toMonoidWithZero.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (AddZeroClass.toHasZero.{u3} B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))))))) (Module.toMulActionWithZero.{u2, u3} A B (CommSemiring.toSemiring.{u2} A _inst_2) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4)))) (Algebra.toModule.{u2, u3} A B _inst_2 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_6))))) (HPow.hPow.{u2, 0, u2} A Nat A (instHPow.{u2, 0} A Nat (Monoid.Pow.{u2} A (MonoidWithZero.toMonoid.{u2} A (Semiring.toMonoidWithZero.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))) r n) x) B'))))
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} {B : Type.{u3}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : CommSemiring.{u2} A] [_inst_3 : Algebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2)] [_inst_4 : CommSemiring.{u3} B] [_inst_5 : Algebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4)] [_inst_6 : Algebra.{u2, u3} A B _inst_2 (CommSemiring.toSemiring.{u3} B _inst_4)] [_inst_7 : IsScalarTower.{u1, u2, u3} R A B (Algebra.toSMul.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (Algebra.toSMul.{u2, u3} A B _inst_2 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_6) (Algebra.toSMul.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5)] (r : A) (s : Set.{u3} B) (B' : Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5), (HasSubset.Subset.{u3} (Set.{u3} B) (Set.instHasSubsetSet.{u3} B) (HSMul.hSMul.{u2, u3, u3} A (Set.{u3} B) (Set.{u3} B) (instHSMul.{u2, u3} A (Set.{u3} B) (Set.smulSet.{u2, u3} A B (Algebra.toSMul.{u2, u3} A B _inst_2 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_6))) r s) (SetLike.coe.{u3, u3} (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) B (Subalgebra.instSetLikeSubalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) B')) -> (forall {x : B}, (Membership.mem.{u3, u3} B (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) (SetLike.instMembership.{u3, u3} (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) B (Subalgebra.instSetLikeSubalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5)) x (Algebra.adjoin.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5 s)) -> (Membership.mem.{u3, u3} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : A) => B) r) (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) (SetLike.instMembership.{u3, u3} (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) B (Subalgebra.instSetLikeSubalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5)) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (RingHom.{u2, u3} A B (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))) A (fun (_x : A) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : A) => B) _x) (MulHomClass.toFunLike.{max u2 u3, u2, u3} (RingHom.{u2, u3} A B (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))) A B (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (NonUnitalNonAssocSemiring.toMul.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4)))) (NonUnitalRingHomClass.toMulHomClass.{max u2 u3, u2, u3} (RingHom.{u2, u3} A B (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))) A B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))) (RingHomClass.toNonUnitalRingHomClass.{max u2 u3, u2, u3} (RingHom.{u2, u3} A B (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4))) A B (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4)) (RingHom.instRingHomClassRingHom.{u2, u3} A B (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)) (Semiring.toNonAssocSemiring.{u3} B (CommSemiring.toSemiring.{u3} B _inst_4)))))) (algebraMap.{u2, u3} A B _inst_2 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_6) r) B') -> (Exists.{1} Nat (fun (n₀ : Nat) => forall (n : Nat), (GE.ge.{0} Nat instLENat n n₀) -> (Membership.mem.{u3, u3} B (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) (SetLike.instMembership.{u3, u3} (Subalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5) B (Subalgebra.instSetLikeSubalgebra.{u1, u3} R B _inst_1 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_5)) (HSMul.hSMul.{u2, u3, u3} A B B (instHSMul.{u2, u3} A B (Algebra.toSMul.{u2, u3} A B _inst_2 (CommSemiring.toSemiring.{u3} B _inst_4) _inst_6)) (HPow.hPow.{u2, 0, u2} A Nat A (instHPow.{u2, 0} A Nat (Monoid.Pow.{u2} A (MonoidWithZero.toMonoid.{u2} A (Semiring.toMonoidWithZero.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))) r n) x) B'))))
Case conversion may be inaccurate. Consider using '#align algebra.pow_smul_mem_of_smul_subset_of_mem_adjoin Algebra.pow_smul_mem_of_smul_subset_of_mem_adjoinₓ'. -/
theorem pow_smul_mem_of_smul_subset_of_mem_adjoin [CommSemiring B] [Algebra R B] [Algebra A B]
    [IsScalarTower R A B] (r : A) (s : Set B) (B' : Subalgebra R B) (hs : r • s ⊆ B') {x : B}
    (hx : x ∈ adjoin R s) (hr : algebraMap A B r ∈ B') : ∃ n₀ : ℕ, ∀ n ≥ n₀, r ^ n • x ∈ B' :=
  by
  change x ∈ (adjoin R s).toSubmodule at hx
  rw [adjoin_eq_span, Finsupp.mem_span_iff_total] at hx
  rcases hx with ⟨l, rfl : (l.sum fun (i : Submonoid.closure s) (c : R) => c • ↑i) = x⟩
  choose n₁ n₂ using fun x : Submonoid.closure s => Submonoid.pow_smul_mem_closure_smul r s x.Prop
  use l.support.sup n₁
  intro n hn
  rw [Finsupp.smul_sum]
  refine' B'.to_submodule.sum_mem _
  intro a ha
  have : n ≥ n₁ a := le_trans (Finset.le_sup ha) hn
  dsimp only
  rw [← tsub_add_cancel_of_le this, pow_add, ← smul_smul, ←
    IsScalarTower.algebraMap_smul A (l a) (a : B), smul_smul (r ^ n₁ a), mul_comm, ← smul_smul,
    smul_def, map_pow, IsScalarTower.algebraMap_smul]
  apply Subalgebra.mul_mem _ (Subalgebra.pow_mem _ hr _) _
  refine' Subalgebra.smul_mem _ _ _
  change _ ∈ B'.to_submonoid
  rw [← Submonoid.closure_eq B'.to_submonoid]
  apply Submonoid.closure_mono hs (n₂ a)
#align algebra.pow_smul_mem_of_smul_subset_of_mem_adjoin Algebra.pow_smul_mem_of_smul_subset_of_mem_adjoin

/- warning: algebra.pow_smul_mem_adjoin_smul -> Algebra.pow_smul_mem_adjoin_smul is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : CommSemiring.{u2} A] [_inst_3 : Algebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2)] (r : R) (s : Set.{u2} A) {x : A}, (Membership.Mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) x (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 s)) -> (Exists.{1} Nat (fun (n₀ : Nat) => forall (n : Nat), (GE.ge.{0} Nat Nat.hasLe n n₀) -> (Membership.Mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (SMul.smul.{u1, u2} R A (SMulZeroClass.toHasSmul.{u1, u2} R A (AddZeroClass.toHasZero.{u2} A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))))) (SMulWithZero.toSmulZeroClass.{u1, u2} R A (MulZeroClass.toHasZero.{u1} R (MulZeroOneClass.toMulZeroClass.{u1} R (MonoidWithZero.toMulZeroOneClass.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))))) (AddZeroClass.toHasZero.{u2} A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))))) (MulActionWithZero.toSMulWithZero.{u1, u2} R A (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (AddZeroClass.toHasZero.{u2} A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))))) (Module.toMulActionWithZero.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))))) (HPow.hPow.{u1, 0, u1} R Nat R (instHPow.{u1, 0} R Nat (Monoid.Pow.{u1} R (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))))) r n) x) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 (SMul.smul.{u1, u2} R (Set.{u2} A) (Set.smulSet.{u1, u2} R A (SMulZeroClass.toHasSmul.{u1, u2} R A (AddZeroClass.toHasZero.{u2} A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))))) (SMulWithZero.toSmulZeroClass.{u1, u2} R A (MulZeroClass.toHasZero.{u1} R (MulZeroOneClass.toMulZeroClass.{u1} R (MonoidWithZero.toMulZeroOneClass.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))))) (AddZeroClass.toHasZero.{u2} A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))))) (MulActionWithZero.toSMulWithZero.{u1, u2} R A (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (AddZeroClass.toHasZero.{u2} A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2))))))) (Module.toMulActionWithZero.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (CommSemiring.toSemiring.{u2} A _inst_2)))) (Algebra.toModule.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)))))) r s)))))
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : CommSemiring.{u2} A] [_inst_3 : Algebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2)] (r : R) (s : Set.{u2} A) {x : A}, (Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) x (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 s)) -> (Exists.{1} Nat (fun (n₀ : Nat) => forall (n : Nat), (GE.ge.{0} Nat instLENat n n₀) -> (Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (HSMul.hSMul.{u1, u2, u2} R A A (instHSMul.{u1, u2} R A (Algebra.toSMul.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3)) (HPow.hPow.{u1, 0, u1} R Nat R (instHPow.{u1, 0} R Nat (Monoid.Pow.{u1} R (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))))) r n) x) (Algebra.adjoin.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3 (HSMul.hSMul.{u1, u2, u2} R (Set.{u2} A) (Set.{u2} A) (instHSMul.{u1, u2} R (Set.{u2} A) (Set.smulSet.{u1, u2} R A (Algebra.toSMul.{u1, u2} R A _inst_1 (CommSemiring.toSemiring.{u2} A _inst_2) _inst_3))) r s)))))
Case conversion may be inaccurate. Consider using '#align algebra.pow_smul_mem_adjoin_smul Algebra.pow_smul_mem_adjoin_smulₓ'. -/
theorem pow_smul_mem_adjoin_smul (r : R) (s : Set A) {x : A} (hx : x ∈ adjoin R s) :
    ∃ n₀ : ℕ, ∀ n ≥ n₀, r ^ n • x ∈ adjoin R (r • s) :=
  pow_smul_mem_of_smul_subset_of_mem_adjoin r s _ subset_adjoin hx (Subalgebra.algebraMap_mem _ _)
#align algebra.pow_smul_mem_adjoin_smul Algebra.pow_smul_mem_adjoin_smul

end CommSemiring

section Ring

variable [CommRing R] [Ring A]

variable [Algebra R A] {s t : Set A}

variable {R s t}

/- warning: algebra.adjoin_int -> Algebra.adjoin_int is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (s : Set.{u1} R), Eq.{succ u1} (Subalgebra.{0, u1} Int R Int.commSemiring (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (algebraInt.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Algebra.adjoin.{0, u1} Int R Int.commSemiring (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (algebraInt.{u1} R (CommRing.toRing.{u1} R _inst_1)) s) (subalgebraOfSubring.{u1} R (CommRing.toRing.{u1} R _inst_1) (Subring.closure.{u1} R (CommRing.toRing.{u1} R _inst_1) s))
but is expected to have type
  forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (s : Set.{u1} R), Eq.{succ u1} (Subalgebra.{0, u1} Int R Int.instCommSemiringInt (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (algebraInt.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Algebra.adjoin.{0, u1} Int R Int.instCommSemiringInt (Ring.toSemiring.{u1} R (CommRing.toRing.{u1} R _inst_1)) (algebraInt.{u1} R (CommRing.toRing.{u1} R _inst_1)) s) (subalgebraOfSubring.{u1} R (CommRing.toRing.{u1} R _inst_1) (Subring.closure.{u1} R (CommRing.toRing.{u1} R _inst_1) s))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_int Algebra.adjoin_intₓ'. -/
theorem adjoin_int (s : Set R) : adjoin ℤ s = subalgebraOfSubring (Subring.closure s) :=
  le_antisymm (adjoin_le Subring.subset_closure)
    (Subring.closure_le.2 subset_adjoin : Subring.closure s ≤ (adjoin ℤ s).toSubring)
#align algebra.adjoin_int Algebra.adjoin_int

/- warning: algebra.mem_adjoin_iff -> Algebra.mem_adjoin_iff is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommRing.{u1} R] [_inst_2 : Ring.{u2} A] [_inst_3 : Algebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2)] {s : Set.{u2} A} {x : A}, Iff (Membership.Mem.{u2, u2} A (Subalgebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.hasMem.{u2, u2} (Subalgebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3)) x (Algebra.adjoin.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3 s)) (Membership.Mem.{u2, u2} A (Subring.{u2} A _inst_2) (SetLike.hasMem.{u2, u2} (Subring.{u2} A _inst_2) A (Subring.setLike.{u2} A _inst_2)) x (Subring.closure.{u2} A _inst_2 (Union.union.{u2} (Set.{u2} A) (Set.hasUnion.{u2} A) (Set.range.{u2, succ u1} A R (coeFn.{max (succ u1) (succ u2), max (succ u1) (succ u2)} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) (Semiring.toNonAssocSemiring.{u2} A (Ring.toSemiring.{u2} A _inst_2))) (fun (_x : RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) (Semiring.toNonAssocSemiring.{u2} A (Ring.toSemiring.{u2} A _inst_2))) => R -> A) (RingHom.hasCoeToFun.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) (Semiring.toNonAssocSemiring.{u2} A (Ring.toSemiring.{u2} A _inst_2))) (algebraMap.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3))) s)))
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} [_inst_1 : CommRing.{u1} R] [_inst_2 : Ring.{u2} A] [_inst_3 : Algebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2)] {s : Set.{u2} A} {x : A}, Iff (Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3)) x (Algebra.adjoin.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3 s)) (Membership.mem.{u2, u2} A (Subring.{u2} A _inst_2) (SetLike.instMembership.{u2, u2} (Subring.{u2} A _inst_2) A (Subring.instSetLikeSubring.{u2} A _inst_2)) x (Subring.closure.{u2} A _inst_2 (Union.union.{u2} (Set.{u2} A) (Set.instUnionSet.{u2} A) (Set.range.{u2, succ u1} A R (FunLike.coe.{max (succ u1) (succ u2), succ u1, succ u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) (Semiring.toNonAssocSemiring.{u2} A (Ring.toSemiring.{u2} A _inst_2))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => A) _x) (MulHomClass.toFunLike.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) (Semiring.toNonAssocSemiring.{u2} A (Ring.toSemiring.{u2} A _inst_2))) R A (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))))) (NonUnitalNonAssocSemiring.toMul.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (Ring.toSemiring.{u2} A _inst_2)))) (NonUnitalRingHomClass.toMulHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) (Semiring.toNonAssocSemiring.{u2} A (Ring.toSemiring.{u2} A _inst_2))) R A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1)))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A (Ring.toSemiring.{u2} A _inst_2))) (RingHomClass.toNonUnitalRingHomClass.{max u1 u2, u1, u2} (RingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) (Semiring.toNonAssocSemiring.{u2} A (Ring.toSemiring.{u2} A _inst_2))) R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) (Semiring.toNonAssocSemiring.{u2} A (Ring.toSemiring.{u2} A _inst_2)) (RingHom.instRingHomClassRingHom.{u1, u2} R A (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) (Semiring.toNonAssocSemiring.{u2} A (Ring.toSemiring.{u2} A _inst_2)))))) (algebraMap.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3))) s)))
Case conversion may be inaccurate. Consider using '#align algebra.mem_adjoin_iff Algebra.mem_adjoin_iffₓ'. -/
theorem mem_adjoin_iff {s : Set A} {x : A} :
    x ∈ adjoin R s ↔ x ∈ Subring.closure (Set.range (algebraMap R A) ∪ s) :=
  ⟨fun hx =>
    Subsemiring.closure_induction hx Subring.subset_closure (Subring.zero_mem _) (Subring.one_mem _)
      (fun _ _ => Subring.add_mem _) fun _ _ => Subring.mul_mem _,
    suffices Subring.closure (Set.range ⇑(algebraMap R A) ∪ s) ≤ (adjoin R s).toSubring from @this x
    Subring.closure_le.2 Subsemiring.subset_closure⟩
#align algebra.mem_adjoin_iff Algebra.mem_adjoin_iff

#print Algebra.adjoin_eq_ring_closure /-
theorem adjoin_eq_ring_closure (s : Set A) :
    (adjoin R s).toSubring = Subring.closure (Set.range (algebraMap R A) ∪ s) :=
  Subring.ext fun x => mem_adjoin_iff
#align algebra.adjoin_eq_ring_closure Algebra.adjoin_eq_ring_closure
-/

variable (R)

/- warning: algebra.adjoin_comm_ring_of_comm -> Algebra.adjoinCommRingOfComm is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommRing.{u1} R] [_inst_2 : Ring.{u2} A] [_inst_3 : Algebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2)] {s : Set.{u2} A}, (forall (a : A), (Membership.Mem.{u2, u2} A (Set.{u2} A) (Set.hasMem.{u2} A) a s) -> (forall (b : A), (Membership.Mem.{u2, u2} A (Set.{u2} A) (Set.hasMem.{u2} A) b s) -> (Eq.{succ u2} A (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (Distrib.toHasMul.{u2} A (Ring.toDistrib.{u2} A _inst_2))) a b) (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (Distrib.toHasMul.{u2} A (Ring.toDistrib.{u2} A _inst_2))) b a)))) -> (CommRing.{u2} (coeSort.{succ u2, succ (succ u2)} (Subalgebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3) Type.{u2} (SetLike.hasCoeToSort.{u2, u2} (Subalgebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.setLike.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3)) (Algebra.adjoin.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3 s)))
but is expected to have type
  forall (R : Type.{u1}) {A : Type.{u2}} [_inst_1 : CommRing.{u1} R] [_inst_2 : Ring.{u2} A] [_inst_3 : Algebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2)] {s : Set.{u2} A}, (forall (a : A), (Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) a s) -> (forall (b : A), (Membership.mem.{u2, u2} A (Set.{u2} A) (Set.instMembershipSet.{u2} A) b s) -> (Eq.{succ u2} A (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (NonUnitalNonAssocRing.toMul.{u2} A (NonAssocRing.toNonUnitalNonAssocRing.{u2} A (Ring.toNonAssocRing.{u2} A _inst_2)))) a b) (HMul.hMul.{u2, u2, u2} A A A (instHMul.{u2} A (NonUnitalNonAssocRing.toMul.{u2} A (NonAssocRing.toNonUnitalNonAssocRing.{u2} A (Ring.toNonAssocRing.{u2} A _inst_2)))) b a)))) -> (CommRing.{u2} (Subtype.{succ u2} A (fun (x : A) => Membership.mem.{u2, u2} A (Subalgebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3) (SetLike.instMembership.{u2, u2} (Subalgebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3) A (Subalgebra.instSetLikeSubalgebra.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3)) x (Algebra.adjoin.{u1, u2} R A (CommRing.toCommSemiring.{u1} R _inst_1) (Ring.toSemiring.{u2} A _inst_2) _inst_3 s))))
Case conversion may be inaccurate. Consider using '#align algebra.adjoin_comm_ring_of_comm Algebra.adjoinCommRingOfCommₓ'. -/
/-- If all elements of `s : set A` commute pairwise, then `adjoin R s` is a commutative
ring.  -/
def adjoinCommRingOfComm {s : Set A} (hcomm : ∀ a ∈ s, ∀ b ∈ s, a * b = b * a) :
    CommRing (adjoin R s) :=
  { (adjoin R s).toRing, adjoinCommSemiringOfComm R hcomm with }
#align algebra.adjoin_comm_ring_of_comm Algebra.adjoinCommRingOfComm

end Ring

end Algebra

open Algebra Subalgebra

namespace AlgHom

variable [CommSemiring R] [Semiring A] [Semiring B] [Algebra R A] [Algebra R B]

#print AlgHom.map_adjoin /-
theorem map_adjoin (φ : A →ₐ[R] B) (s : Set A) : (adjoin R s).map φ = adjoin R (φ '' s) :=
  (adjoin_image _ _ _).symm
#align alg_hom.map_adjoin AlgHom.map_adjoin
-/

#print AlgHom.adjoin_le_equalizer /-
theorem adjoin_le_equalizer (φ₁ φ₂ : A →ₐ[R] B) {s : Set A} (h : s.EqOn φ₁ φ₂) :
    adjoin R s ≤ φ₁.equalizer φ₂ :=
  adjoin_le h
#align alg_hom.adjoin_le_equalizer AlgHom.adjoin_le_equalizer
-/

/- warning: alg_hom.ext_of_adjoin_eq_top -> AlgHom.ext_of_adjoin_eq_top is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} {A : Type.{u2}} {B : Type.{u3}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_3 : Semiring.{u3} B] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] [_inst_5 : Algebra.{u1, u3} R B _inst_1 _inst_3] {s : Set.{u2} A}, (Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) (Top.top.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toHasTop.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.Subalgebra.completeLattice.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) -> (forall {{φ₁ : AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5}} {{φ₂ : AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5}}, (Set.EqOn.{u2, u3} A B (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) (fun (_x : AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) => A -> B) ([anonymous].{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) φ₁) (coeFn.{max (succ u2) (succ u3), max (succ u2) (succ u3)} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) (fun (_x : AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) => A -> B) ([anonymous].{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) φ₂) s) -> (Eq.{max (succ u2) (succ u3)} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) φ₁ φ₂))
but is expected to have type
  forall {R : Type.{u1}} {A : Type.{u2}} {B : Type.{u3}} [_inst_1 : CommSemiring.{u1} R] [_inst_2 : Semiring.{u2} A] [_inst_3 : Semiring.{u3} B] [_inst_4 : Algebra.{u1, u2} R A _inst_1 _inst_2] [_inst_5 : Algebra.{u1, u3} R B _inst_1 _inst_3] {s : Set.{u2} A}, (Eq.{succ u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.adjoin.{u1, u2} R A _inst_1 _inst_2 _inst_4 s) (Top.top.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (CompleteLattice.toTop.{u2} (Subalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4) (Algebra.instCompleteLatticeSubalgebra.{u1, u2} R A _inst_1 _inst_2 _inst_4)))) -> (forall {{φ₁ : AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5}} {{φ₂ : AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5}}, (Set.EqOn.{u2, u3} A B (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) A (fun (_x : A) => (fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : A) => B) _x) (SMulHomClass.toFunLike.{max u2 u3, u1, u2, u3} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) R A B (SMulZeroClass.toSMul.{u1, u2} R A (AddMonoid.toZero.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (DistribSMul.toSMulZeroClass.{u1, u2} R A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (DistribMulAction.toDistribSMul.{u1, u2} R A (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Module.toDistribMulAction.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (SMulZeroClass.toSMul.{u1, u3} R B (AddMonoid.toZero.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))))) (DistribSMul.toSMulZeroClass.{u1, u3} R B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))))) (DistribMulAction.toDistribSMul.{u1, u3} R B (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Module.toDistribMulAction.{u1, u3} R B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))))) (DistribMulActionHomClass.toSMulHomClass.{max u2 u3, u1, u2, u3} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) R A B (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Module.toDistribMulAction.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Module.toDistribMulAction.{u1, u3} R B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (NonUnitalAlgHomClass.toDistribMulActionHomClass.{max u2 u3, u1, u2, u3} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) R A B (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)) (Module.toDistribMulAction.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Module.toDistribMulAction.{u1, u3} R B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (AlgHom.instNonUnitalAlgHomClassToMonoidToMonoidWithZeroToSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToDistribMulActionToAddCommMonoidToModuleToDistribMulActionToAddCommMonoidToModule.{u1, u2, u3, max u2 u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) (AlgHom.algHomClass.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5))))) φ₁) (FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) A (fun (_x : A) => (fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : A) => B) _x) (SMulHomClass.toFunLike.{max u2 u3, u1, u2, u3} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) R A B (SMulZeroClass.toSMul.{u1, u2} R A (AddMonoid.toZero.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (DistribSMul.toSMulZeroClass.{u1, u2} R A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (DistribMulAction.toDistribSMul.{u1, u2} R A (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Module.toDistribMulAction.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4))))) (SMulZeroClass.toSMul.{u1, u3} R B (AddMonoid.toZero.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))))) (DistribSMul.toSMulZeroClass.{u1, u3} R B (AddMonoid.toAddZeroClass.{u3} B (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))))) (DistribMulAction.toDistribSMul.{u1, u3} R B (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Module.toDistribMulAction.{u1, u3} R B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5))))) (DistribMulActionHomClass.toSMulHomClass.{max u2 u3, u1, u2, u3} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) R A B (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (AddCommMonoid.toAddMonoid.{u3} B (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)))) (Module.toDistribMulAction.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Module.toDistribMulAction.{u1, u3} R B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (NonUnitalAlgHomClass.toDistribMulActionHomClass.{max u2 u3, u1, u2, u3} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) R A B (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3)) (Module.toDistribMulAction.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_4)) (Module.toDistribMulAction.{u1, u3} R B (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} B (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} B (Semiring.toNonAssocSemiring.{u3} B _inst_3))) (Algebra.toModule.{u1, u3} R B _inst_1 _inst_3 _inst_5)) (AlgHom.instNonUnitalAlgHomClassToMonoidToMonoidWithZeroToSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToDistribMulActionToAddCommMonoidToModuleToDistribMulActionToAddCommMonoidToModule.{u1, u2, u3, max u2 u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5 (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) (AlgHom.algHomClass.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5))))) φ₂) s) -> (Eq.{max (succ u2) (succ u3)} (AlgHom.{u1, u2, u3} R A B _inst_1 _inst_2 _inst_3 _inst_4 _inst_5) φ₁ φ₂))
Case conversion may be inaccurate. Consider using '#align alg_hom.ext_of_adjoin_eq_top AlgHom.ext_of_adjoin_eq_topₓ'. -/
theorem ext_of_adjoin_eq_top {s : Set A} (h : adjoin R s = ⊤) ⦃φ₁ φ₂ : A →ₐ[R] B⦄
    (hs : s.EqOn φ₁ φ₂) : φ₁ = φ₂ :=
  ext fun x => adjoin_le_equalizer φ₁ φ₂ hs <| h.symm ▸ trivial
#align alg_hom.ext_of_adjoin_eq_top AlgHom.ext_of_adjoin_eq_top

end AlgHom