Theorem: isIntegral_of_smul_mem_submodule
File: Mathlib/RingTheory/IntegralClosure.lean

tactic: let A' : Subalgebra R A :=
  { carrier := { x | ∀ n ∈ N, x • n ∈ N }
    mul_mem' := fun {a b} ha hb n hn => smul_smul a b n ▸ ha _ (hb _ hn)
    one_mem' := fun n hn => (one_smul A n).symm ▸ hn
    add_mem' := fun {a b} ha hb n hn => (add_smul a b n).symm ▸ N.add_mem (ha _ hn) (hb _ hn)
    zero_mem' := fun n _hn => (zero_smul A n).symm ▸ N.zero_mem
    algebraMap_mem' := fun r n hn => (algebraMap_smul A r n).symm ▸ N.smul_mem r hn }
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
⊢ IsIntegral R x

tactic: let f : A' →ₐ[R] Module.End R N :=
  AlgHom.ofLinearMap
    { toFun := fun x => (DistribMulAction.toLinearMap R M x).restrict x.prop
      map_add' := by intros x y; ext; exact add_smul _ _ _
      map_smul' := by intros r s; ext; apply smul_assoc }
    (by ext; apply one_smul)
    (by intros x y; ext; apply mul_smul)
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
⊢ IsIntegral R x

tactic: obtain ⟨a, ha₁, ha₂⟩ : ∃ a ∈ N, a ≠ (0 : M) := by
  by_contra h'
  push_neg  at h'
  apply hN
  rwa [eq_bot_iff]
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
⊢ IsIntegral R x

tactic: have : Function.Injective f := by
  show Function.Injective f.toLinearMap
  rw [← LinearMap.ker_eq_bot, eq_bot_iff]
  intro s hs
  have : s.1 • a = 0 := congr_arg Subtype.val (LinearMap.congr_fun hs ⟨a, ha₁⟩)
  exact Subtype.ext ((eq_zero_or_eq_zero_of_smul_eq_zero this).resolve_right ha₂)
state_before: case intro.intro
R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
a : M
ha₁ : a ∈ N
ha₂ : a ≠ 0
⊢ IsIntegral R x

tactic: show IsIntegral R (A'.val ⟨x, hx⟩)
state_before: case intro.intro
R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
a : M
ha₁ : a ∈ N
ha₂ : a ≠ 0
this : Function.Injective ↑f
⊢ IsIntegral R x

tactic: rw [isIntegral_algHom_iff A'.val Subtype.val_injective, ← isIntegral_algHom_iff f this]
state_before: case intro.intro
R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
a : M
ha₁ : a ∈ N
ha₂ : a ≠ 0
this : Function.Injective ↑f
⊢ IsIntegral R (↑(Subalgebra.val A') { val := x, property := hx })

tactic: haveI : Module.Finite R N := by rwa [Module.finite_def, Submodule.fg_top]
state_before: case intro.intro
R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
a : M
ha₁ : a ∈ N
ha₂ : a ≠ 0
this : Function.Injective ↑f
⊢ IsIntegral R (↑f { val := x, property := hx })

tactic: apply Module.End.isIntegral
state_before: case intro.intro
R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
a : M
ha₁ : a ∈ N
ha₂ : a ≠ 0
this✝ : Function.Injective ↑f
this : Module.Finite R { x // x ∈ N }
⊢ IsIntegral R (↑f { val := x, property := hx })

tactic: intros x y
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
⊢ ∀ (x y : { x // x ∈ A' }),
    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y

tactic: ext
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x✝ : A
hx : ∀ (n : M), n ∈ N → x✝ • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
x y : { x // x ∈ A' }
⊢ (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y

tactic: exact add_smul _ _ _
state_before: case h.a
R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x✝¹ : A
hx : ∀ (n : M), n ∈ N → x✝¹ • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
x y : { x // x ∈ A' }
x✝ : { x // x ∈ N }
⊢ ↑(↑((fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y)) x✝) =
    ↑(↑((fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y)
        x✝)

tactic: intros r s
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
⊢ ∀ (r : R) (x : { x // x ∈ A' }),
    AddHom.toFun
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
        (r • x) =
      ↑(RingHom.id R) r •
        AddHom.toFun
          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
            map_add' :=
              (_ :
                ∀ (x y : { x // x ∈ A' }),
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
          x

tactic: ext
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
r : R
s : { x // x ∈ A' }
⊢ AddHom.toFun
      { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
        map_add' :=
          (_ :
            ∀ (x y : { x // x ∈ A' }),
              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
      (r • s) =
    ↑(RingHom.id R) r •
      AddHom.toFun
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
        s

tactic: apply smul_assoc
state_before: case h.a
R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
r : R
s : { x // x ∈ A' }
x✝ : { x // x ∈ N }
⊢ ↑(↑(AddHom.toFun
            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
              map_add' :=
                (_ :
                  ∀ (x y : { x // x ∈ A' }),
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
            (r • s))
        x✝) =
    ↑(↑(↑(RingHom.id R) r •
            AddHom.toFun
              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                map_add' :=
                  (_ :
                    ∀ (x y : { x // x ∈ A' }),
                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
              s)
        x✝)

tactic: ext
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
⊢ ↑{
          toAddHom :=
            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
              map_add' :=
                (_ :
                  ∀ (x y : { x // x ∈ A' }),
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
          map_smul' :=
            (_ :
              ∀ (r : R) (s : { x // x ∈ A' }),
                AddHom.toFun
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                    (r • s) =
                  ↑(RingHom.id R) r •
                    AddHom.toFun
                      { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                        map_add' :=
                          (_ :
                            ∀ (x y : { x // x ∈ A' }),
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                      s) }
      1 =
    1

tactic: apply one_smul
state_before: case h.a
R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
x✝ : { x // x ∈ N }
⊢ ↑(↑(↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            1)
        x✝) =
    ↑(↑1 x✝)

tactic: intros x y
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
⊢ ∀ (x y : { x // x ∈ A' }),
    ↑{
            toAddHom :=
              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                map_add' :=
                  (_ :
                    ∀ (x y : { x // x ∈ A' }),
                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
            map_smul' :=
              (_ :
                ∀ (r : R) (s : { x // x ∈ A' }),
                  AddHom.toFun
                      { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                        map_add' :=
                          (_ :
                            ∀ (x y : { x // x ∈ A' }),
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                      (r • s) =
                    ↑(RingHom.id R) r •
                      AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        s) }
        (x * y) =
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          x *
        ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          y

tactic: ext
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x✝ : A
hx : ∀ (n : M), n ∈ N → x✝ • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
x y : { x // x ∈ A' }
⊢ ↑{
          toAddHom :=
            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
              map_add' :=
                (_ :
                  ∀ (x y : { x // x ∈ A' }),
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
          map_smul' :=
            (_ :
              ∀ (r : R) (s : { x // x ∈ A' }),
                AddHom.toFun
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                    (r • s) =
                  ↑(RingHom.id R) r •
                    AddHom.toFun
                      { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                        map_add' :=
                          (_ :
                            ∀ (x y : { x // x ∈ A' }),
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                      s) }
      (x * y) =
    ↑{
            toAddHom :=
              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                map_add' :=
                  (_ :
                    ∀ (x y : { x // x ∈ A' }),
                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
            map_smul' :=
              (_ :
                ∀ (r : R) (s : { x // x ∈ A' }),
                  AddHom.toFun
                      { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                        map_add' :=
                          (_ :
                            ∀ (x y : { x // x ∈ A' }),
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                      (r • s) =
                    ↑(RingHom.id R) r •
                      AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        s) }
        x *
      ↑{
            toAddHom :=
              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                map_add' :=
                  (_ :
                    ∀ (x y : { x // x ∈ A' }),
                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
            map_smul' :=
              (_ :
                ∀ (r : R) (s : { x // x ∈ A' }),
                  AddHom.toFun
                      { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                        map_add' :=
                          (_ :
                            ∀ (x y : { x // x ∈ A' }),
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                      (r • s) =
                    ↑(RingHom.id R) r •
                      AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        s) }
        y

tactic: apply mul_smul
state_before: case h.a
R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x✝¹ : A
hx : ∀ (n : M), n ∈ N → x✝¹ • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
x y : { x // x ∈ A' }
x✝ : { x // x ∈ N }
⊢ ↑(↑(↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y))
        x✝) =
    ↑(↑(↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
        x✝)

tactic: by_contra h'
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
⊢ ∃ a, a ∈ N ∧ a ≠ 0

tactic: push_neg  at h'
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
h' : ¬∃ a, a ∈ N ∧ a ≠ 0
⊢ False

tactic: apply hN
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
h' : ∀ (a : M), a ∈ N → a = 0
⊢ False

tactic: rwa [eq_bot_iff]
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
h' : ∀ (a : M), a ∈ N → a = 0
⊢ N = ⊥

tactic: show Function.Injective f.toLinearMap
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
a : M
ha₁ : a ∈ N
ha₂ : a ≠ 0
⊢ Function.Injective ↑f

tactic: rw [← LinearMap.ker_eq_bot, eq_bot_iff]
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
a : M
ha₁ : a ∈ N
ha₂ : a ≠ 0
⊢ Function.Injective ↑(AlgHom.toLinearMap f)

tactic: intro s hs
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
a : M
ha₁ : a ∈ N
ha₂ : a ≠ 0
⊢ LinearMap.ker (AlgHom.toLinearMap f) ≤ ⊥

tactic: have : s.1 • a = 0 := congr_arg Subtype.val (LinearMap.congr_fun hs ⟨a, ha₁⟩)
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
a : M
ha₁ : a ∈ N
ha₂ : a ≠ 0
s : { x // x ∈ A' }
hs : s ∈ LinearMap.ker (AlgHom.toLinearMap f)
⊢ s ∈ ⊥

tactic: exact Subtype.ext ((eq_zero_or_eq_zero_of_smul_eq_zero this).resolve_right ha₂)
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
a : M
ha₁ : a ∈ N
ha₂ : a ≠ 0
s : { x // x ∈ A' }
hs : s ∈ LinearMap.ker (AlgHom.toLinearMap f)
this : ↑s • a = 0
⊢ s ∈ ⊥

tactic: rwa [Module.finite_def, Submodule.fg_top]
state_before: R : Type u_2
A : Type u_3
B : Type ?u.566791
S : Type ?u.566794
inst✝¹⁰ : CommRing R
inst✝⁹ : CommRing A
inst✝⁸ : CommRing B
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R A
inst✝⁵ : Algebra R B
f✝ : R →+* S
M : Type u_1
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
inst✝² : Module A M
inst✝¹ : IsScalarTower R A M
inst✝ : NoZeroSMulDivisors A M
N : Submodule R M
hN : N ≠ ⊥
hN' : FG N
x : A
hx : ∀ (n : M), n ∈ N → x • n ∈ N
A' : Subalgebra R A :=
  {
    toSubsemiring :=
      {
        toSubmonoid :=
          {
            toSubsemigroup :=
              { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                mul_mem' :=
                  (_ :
                    ∀ {a b : A},
                      a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                        b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
            one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) },
        add_mem' :=
          (_ :
            ∀ {a b : A},
              a ∈
                  {
                        toSubsemigroup :=
                          { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                            mul_mem' :=
                              (_ :
                                ∀ {a b : A},
                                  a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                    b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                        one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                b ∈
                    {
                          toSubsemigroup :=
                            { carrier := {x | ∀ (n : M), n ∈ N → x • n ∈ N},
                              mul_mem' :=
                                (_ :
                                  ∀ {a b : A},
                                    a ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} →
                                      b ∈ {x | ∀ (n : M), n ∈ N → x • n ∈ N} → ∀ (n : M), n ∈ N → (a * b) • n ∈ N) },
                          one_mem' := (_ : ∀ (n : M), n ∈ N → 1 • n ∈ N) }.toSubsemigroup.carrier →
                  ∀ (n : M), n ∈ N → (a + b) • n ∈ N),
        zero_mem' := (_ : ∀ (n : M), n ∈ N → 0 • n ∈ N) },
    algebraMap_mem' := (_ : ∀ (r : R) (n : M), n ∈ N → ↑(algebraMap R A) r • n ∈ N) }
f : { x // x ∈ A' } →ₐ[R] Module.End R { x // x ∈ N } :=
  AlgHom.ofLinearMap
    {
      toAddHom :=
        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
          map_add' :=
            (_ :
              ∀ (x y : { x // x ∈ A' }),
                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
      map_smul' :=
        (_ :
          ∀ (r : R) (s : { x // x ∈ A' }),
            AddHom.toFun
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                (r • s) =
              ↑(RingHom.id R) r •
                AddHom.toFun
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) }
                  s) }
    (_ :
      ↑{
              toAddHom :=
                { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                  map_add' :=
                    (_ :
                      ∀ (x y : { x // x ∈ A' }),
                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (s : { x // x ∈ A' }),
                    AddHom.toFun
                        { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                          map_add' :=
                            (_ :
                              ∀ (x y : { x // x ∈ A' }),
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                    (x + y) =
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      y) }
                        (r • s) =
                      ↑(RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          s) }
          1 =
        1)
    (_ :
      ∀ (x y : { x // x ∈ A' }),
        ↑{
                toAddHom :=
                  { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                    map_add' :=
                      (_ :
                        ∀ (x y : { x // x ∈ A' }),
                          (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (s : { x // x ∈ A' }),
                      AddHom.toFun
                          { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                            map_add' :=
                              (_ :
                                ∀ (x y : { x // x ∈ A' }),
                                  (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                      (x + y) =
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        y) }
                          (r • s) =
                        ↑(RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            s) }
            (x * y) =
          ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              x *
            ↑{
                  toAddHom :=
                    { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                      map_add' :=
                        (_ :
                          ∀ (x y : { x // x ∈ A' }),
                            (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) (x + y) =
                              (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) x +
                                (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A')) y) },
                  map_smul' :=
                    (_ :
                      ∀ (r : R) (s : { x // x ∈ A' }),
                        AddHom.toFun
                            { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                              map_add' :=
                                (_ :
                                  ∀ (x y : { x // x ∈ A' }),
                                    (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                        (x + y) =
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          x +
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          y) }
                            (r • s) =
                          ↑(RingHom.id R) r •
                            AddHom.toFun
                              { toFun := fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'),
                                map_add' :=
                                  (_ :
                                    ∀ (x y : { x // x ∈ A' }),
                                      (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                          (x + y) =
                                        (fun x => LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            x +
                                          (fun x =>
                                              LinearMap.restrict (DistribMulAction.toLinearMap R M x) (_ : ↑x ∈ A'))
                                            y) }
                              s) }
              y)
a : M
ha₁ : a ∈ N
ha₂ : a ≠ 0
this : Function.Injective ↑f
⊢ Module.Finite R { x // x ∈ N }