l3lab/ntp-mathlib huggingface dataset:
theorem mul_sub_algebraMap_commutes [Ring A] [Algebra R A] (x : A) (r : R) :
    x * (x - algebraMap R A r) = (x - algebraMap R A r) * x := by 

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u_1
inst✝² : CommSemiring R
inst✝¹ : Ring A
inst✝ : Algebra R A
x : A
r : R
⊢ x * (x - (algebraMap R A) r) = (x - (algebraMap R A) r) * x

Next tactic:
rw [mul_sub, ← commutes, sub_mul]
theorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :
    x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by
  

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u_1
inst✝² : CommSemiring R
inst✝¹ : Ring A
inst✝ : Algebra R A
x : A
r : R
n : ℕ
⊢ x * (x - (algebraMap R A) r) ^ n = (x - (algebraMap R A) r) ^ n * x

Next tactic:
induction' n with n ih
theorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :
    x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by
  induction' n with n ih
  · 

Proof state:
case zero
R : Type u
S : Type v
A : Type w
B : Type u_1
inst✝² : CommSemiring R
inst✝¹ : Ring A
inst✝ : Algebra R A
x : A
r : R
⊢ x * (x - (algebraMap R A) r) ^ Nat.zero = (x - (algebraMap R A) r) ^ Nat.zero * x

Next tactic:
simp
theorem mul_sub_algebraMap_pow_commutes [Ring A] [Algebra R A] (x : A) (r : R) (n : ℕ) :
    x * (x - algebraMap R A r) ^ n = (x - algebraMap R A r) ^ n * x := by
  induction' n with n ih
  · simp
  · 

Proof state:
case succ
R : Type u
S : Type v
A : Type w
B : Type u_1
inst✝² : CommSemiring R
inst✝¹ : Ring A
inst✝ : Algebra R A
x : A
r : R
n : ℕ
ih : x * (x - (algebraMap R A) r) ^ n = (x - (algebraMap R A) r) ^ n * x
⊢ x * (x - (algebraMap R A) r) ^ Nat.succ n = (x - (algebraMap R A) r) ^ Nat.succ n * x

Next tactic:
rw [pow_succ, ← mul_assoc, mul_sub_algebraMap_commutes, mul_assoc, ih, ← mul_assoc]
/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.
See note [reducible non-instances]. -/
@[reducible]
def semiringToRing [Semiring A] [Algebra R A] : Ring A :=
  { Module.addCommMonoidToAddCommGroup R, (inferInstance : Semiring A) with
    intCast := fun z => algebraMap R A z
    intCast_ofNat := fun z => by 

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u_1
inst✝² : CommRing R
inst✝¹ : Semiring A
inst✝ : Algebra R A
src✝¹ : AddCommGroup A := Module.addCommMonoidToAddCommGroup R
src✝ : Semiring A := inferInstance
z : ℕ
⊢ IntCast.intCast ↑z = ↑z

Next tactic:
simp only [Int.cast_ofNat, map_natCast]
/-- A `Semiring` that is an `Algebra` over a commutative ring carries a natural `Ring` structure.
See note [reducible non-instances]. -/
@[reducible]
def semiringToRing [Semiring A] [Algebra R A] : Ring A :=
  { Module.addCommMonoidToAddCommGroup R, (inferInstance : Semiring A) with
    intCast := fun z => algebraMap R A z
    intCast_ofNat := fun z => by simp only [Int.cast_ofNat, map_natCast]
    intCast_negSucc := fun z => by 

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u_1
inst✝² : CommRing R
inst✝¹ : Semiring A
inst✝ : Algebra R A
src✝¹ : AddCommGroup A := Module.addCommMonoidToAddCommGroup R
src✝ : Semiring A := inferInstance
z : ℕ
⊢ IntCast.intCast (Int.negSucc z) = -↑(z + 1)

Next tactic:
simp
theorem End_algebraMap_isUnit_inv_apply_eq_iff {x : R}
    (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :
    (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' :=
  { mp := fun H => ((congr_arg h.unit H).symm.trans (End_isUnit_apply_inv_apply_of_isUnit h _)).symm
    mpr := fun H =>
      H.symm ▸ by
        

Proof state:
R : Type u
S : Type v
M : Type w
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring S
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
inst✝³ : Module S M
inst✝² : SMulCommClass S R M
inst✝¹ : SMul R S
inst✝ : IsScalarTower R S M
x : R
h : IsUnit ((algebraMap R (End S M)) x)
m m' : M
H : m = x • m'
⊢ ↑(IsUnit.unit h)⁻¹ (x • m') = m'

Next tactic:
apply_fun ⇑h.unit.val using ((Module.End_isUnit_iff _).mp h).injective
theorem End_algebraMap_isUnit_inv_apply_eq_iff {x : R}
    (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :
    (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' :=
  { mp := fun H => ((congr_arg h.unit H).symm.trans (End_isUnit_apply_inv_apply_of_isUnit h _)).symm
    mpr := fun H =>
      H.symm ▸ by
        apply_fun ⇑h.unit.val using ((Module.End_isUnit_iff _).mp h).injective
        

Proof state:
R : Type u
S : Type v
M : Type w
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring S
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
inst✝³ : Module S M
inst✝² : SMulCommClass S R M
inst✝¹ : SMul R S
inst✝ : IsScalarTower R S M
x : R
h : IsUnit ((algebraMap R (End S M)) x)
m m' : M
H : m = x • m'
⊢ ↑(IsUnit.unit h) (↑(IsUnit.unit h)⁻¹ (x • m')) = ↑(IsUnit.unit h) m'

Next tactic:
erw [End_isUnit_apply_inv_apply_of_isUnit]
theorem End_algebraMap_isUnit_inv_apply_eq_iff {x : R}
    (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :
    (↑(h.unit⁻¹) : Module.End S M) m = m' ↔ m = x • m' :=
  { mp := fun H => ((congr_arg h.unit H).symm.trans (End_isUnit_apply_inv_apply_of_isUnit h _)).symm
    mpr := fun H =>
      H.symm ▸ by
        apply_fun ⇑h.unit.val using ((Module.End_isUnit_iff _).mp h).injective
        erw [End_isUnit_apply_inv_apply_of_isUnit]
        

Proof state:
R : Type u
S : Type v
M : Type w
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring S
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
inst✝³ : Module S M
inst✝² : SMulCommClass S R M
inst✝¹ : SMul R S
inst✝ : IsScalarTower R S M
x : R
h : IsUnit ((algebraMap R (End S M)) x)
m m' : M
H : m = x • m'
⊢ x • m' = ↑(IsUnit.unit h) m'

Next tactic:
rfl
theorem End_algebraMap_isUnit_inv_apply_eq_iff' {x : R}
    (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :
    m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' :=
  { mp := fun H => ((congr_arg h.unit H).trans (End_isUnit_apply_inv_apply_of_isUnit h _)).symm
    mpr := fun H =>
      H.symm ▸ by
        

Proof state:
R : Type u
S : Type v
M : Type w
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring S
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
inst✝³ : Module S M
inst✝² : SMulCommClass S R M
inst✝¹ : SMul R S
inst✝ : IsScalarTower R S M
x : R
h : IsUnit ((algebraMap R (End S M)) x)
m m' : M
H : m = x • m'
⊢ m' = ↑(IsUnit.unit h)⁻¹ (x • m')

Next tactic:
apply_fun (↑h.unit : M → M) using ((Module.End_isUnit_iff _).mp h).injective
theorem End_algebraMap_isUnit_inv_apply_eq_iff' {x : R}
    (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :
    m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' :=
  { mp := fun H => ((congr_arg h.unit H).trans (End_isUnit_apply_inv_apply_of_isUnit h _)).symm
    mpr := fun H =>
      H.symm ▸ by
        apply_fun (↑h.unit : M → M) using ((Module.End_isUnit_iff _).mp h).injective
        

Proof state:
R : Type u
S : Type v
M : Type w
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring S
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
inst✝³ : Module S M
inst✝² : SMulCommClass S R M
inst✝¹ : SMul R S
inst✝ : IsScalarTower R S M
x : R
h : IsUnit ((algebraMap R (End S M)) x)
m m' : M
H : m = x • m'
⊢ ↑(IsUnit.unit h) m' = ↑(IsUnit.unit h) (↑(IsUnit.unit h)⁻¹ (x • m'))

Next tactic:
erw [End_isUnit_apply_inv_apply_of_isUnit]
theorem End_algebraMap_isUnit_inv_apply_eq_iff' {x : R}
    (h : IsUnit (algebraMap R (Module.End S M) x)) (m m' : M) :
    m' = (↑h.unit⁻¹ : Module.End S M) m ↔ m = x • m' :=
  { mp := fun H => ((congr_arg h.unit H).trans (End_isUnit_apply_inv_apply_of_isUnit h _)).symm
    mpr := fun H =>
      H.symm ▸ by
        apply_fun (↑h.unit : M → M) using ((Module.End_isUnit_iff _).mp h).injective
        erw [End_isUnit_apply_inv_apply_of_isUnit]
        

Proof state:
R : Type u
S : Type v
M : Type w
inst✝⁷ : CommSemiring R
inst✝⁶ : Semiring S
inst✝⁵ : AddCommMonoid M
inst✝⁴ : Module R M
inst✝³ : Module S M
inst✝² : SMulCommClass S R M
inst✝¹ : SMul R S
inst✝ : IsScalarTower R S M
x : R
h : IsUnit ((algebraMap R (End S M)) x)
m m' : M
H : m = x • m'
⊢ ↑(IsUnit.unit h) m' = x • m'

Next tactic:
rfl
/-- An alternate statement of `LinearMap.map_smul` for when `algebraMap` is more convenient to
work with than `•`. -/
theorem map_algebraMap_mul (f : A →ₗ[R] B) (a : A) (r : R) :
    f (algebraMap R A r * a) = algebraMap R B r * f a := by
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Semiring B
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : A →ₗ[R] B
a : A
r : R
⊢ f ((algebraMap R A) r * a) = (algebraMap R B) r * f a

Next tactic:
rw [← Algebra.smul_def, ← Algebra.smul_def, map_smul]
theorem map_mul_algebraMap (f : A →ₗ[R] B) (a : A) (r : R) :
    f (a * algebraMap R A r) = f a * algebraMap R B r := by
  

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Semiring B
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : A →ₗ[R] B
a : A
r : R
⊢ f (a * (algebraMap R A) r) = f a * (algebraMap R B) r

Next tactic:
rw [← Algebra.commutes, ← Algebra.commutes, map_algebraMap_mul]
instance nat_algebra_subsingleton : Subsingleton (Algebra ℕ R) :=
  ⟨fun P Q => by 

Proof state:
R : Type u_1
inst✝ : Semiring R
P Q : Algebra ℕ R
⊢ P = Q

Next tactic:
ext
instance nat_algebra_subsingleton : Subsingleton (Algebra ℕ R) :=
  ⟨fun P Q => by ext; 

Proof state:
case h
R : Type u_1
inst✝ : Semiring R
P Q : Algebra ℕ R
r✝ : ℕ
⊢ (algebraMap ℕ R) r✝ = (algebraMap ℕ R) r✝

Next tactic:
simp
theorem algebraMap_injective [CommRing R] [Ring A] [Nontrivial A] [Algebra R A]
    [NoZeroSMulDivisors R A] : Function.Injective (algebraMap R A) := by
  -- porting note: todo: drop implicit args
  

Proof state:
R : Type u_1
A : Type u_2
inst✝⁴ : CommRing R
inst✝³ : Ring A
inst✝² : Nontrivial A
inst✝¹ : Algebra R A
inst✝ : NoZeroSMulDivisors R A
⊢ Function.Injective ⇑(algebraMap R A)

Next tactic:
have := @smul_left_injective R A CommRing.toRing Ring.toAddCommGroup Algebra.toModule
    ‹_› 1 one_ne_zero
theorem algebraMap_injective [CommRing R] [Ring A] [Nontrivial A] [Algebra R A]
    [NoZeroSMulDivisors R A] : Function.Injective (algebraMap R A) := by
  -- porting note: todo: drop implicit args
  have := @smul_left_injective R A CommRing.toRing Ring.toAddCommGroup Algebra.toModule
    ‹_› 1 one_ne_zero
  

Proof state:
R : Type u_1
A : Type u_2
inst✝⁴ : CommRing R
inst✝³ : Ring A
inst✝² : Nontrivial A
inst✝¹ : Algebra R A
inst✝ : NoZeroSMulDivisors R A
this : Function.Injective fun c => c • 1
⊢ Function.Injective ⇑(algebraMap R A)

Next tactic:
simpa only [algebraMap_eq_smul_one'] using this
theorem algebra_compatible_smul (r : R) (m : M) : r • m = (algebraMap R A) r • m := by
  

Proof state:
R : Type u_1
inst✝¹⁰ : CommSemiring R
A : Type u_2
inst✝⁹ : Semiring A
inst✝⁸ : Algebra R A
M : Type u_3
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module A M
inst✝⁵ : Module R M
inst✝⁴ : IsScalarTower R A M
N : Type u_4
inst✝³ : AddCommMonoid N
inst✝² : Module A N
inst✝¹ : Module R N
inst✝ : IsScalarTower R A N
r : R
m : M
⊢ r • m = (algebraMap R A) r • m

Next tactic:
rw [← one_smul A m, ← smul_assoc, Algebra.smul_def, mul_one, one_smul]
theorem NoZeroSMulDivisors.trans (R A M : Type*) [CommRing R] [Ring A] [IsDomain A] [Algebra R A]
    [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M] [NoZeroSMulDivisors R A]
    [NoZeroSMulDivisors A M] : NoZeroSMulDivisors R M := by
  

Proof state:
R✝ : Type u_1
inst✝²⁰ : CommSemiring R✝
A✝ : Type u_2
inst✝¹⁹ : Semiring A✝
inst✝¹⁸ : Algebra R✝ A✝
M✝ : Type u_3
inst✝¹⁷ : AddCommMonoid M✝
inst✝¹⁶ : Module A✝ M✝
inst✝¹⁵ : Module R✝ M✝
inst✝¹⁴ : IsScalarTower R✝ A✝ M✝
N : Type u_4
inst✝¹³ : AddCommMonoid N
inst✝¹² : Module A✝ N
inst✝¹¹ : Module R✝ N
inst✝¹⁰ : IsScalarTower R✝ A✝ N
R : Type u_5
A : Type u_6
M : Type u_7
inst✝⁹ : CommRing R
inst✝⁸ : Ring A
inst✝⁷ : IsDomain A
inst✝⁶ : Algebra R A
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Module A M
inst✝² : IsScalarTower R A M
inst✝¹ : NoZeroSMulDivisors R A
inst✝ : NoZeroSMulDivisors A M
⊢ NoZeroSMulDivisors R M

Next tactic:
refine' ⟨fun {r m} h => _⟩
theorem NoZeroSMulDivisors.trans (R A M : Type*) [CommRing R] [Ring A] [IsDomain A] [Algebra R A]
    [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M] [NoZeroSMulDivisors R A]
    [NoZeroSMulDivisors A M] : NoZeroSMulDivisors R M := by
  refine' ⟨fun {r m} h => _⟩
  

Proof state:
R✝ : Type u_1
inst✝²⁰ : CommSemiring R✝
A✝ : Type u_2
inst✝¹⁹ : Semiring A✝
inst✝¹⁸ : Algebra R✝ A✝
M✝ : Type u_3
inst✝¹⁷ : AddCommMonoid M✝
inst✝¹⁶ : Module A✝ M✝
inst✝¹⁵ : Module R✝ M✝
inst✝¹⁴ : IsScalarTower R✝ A✝ M✝
N : Type u_4
inst✝¹³ : AddCommMonoid N
inst✝¹² : Module A✝ N
inst✝¹¹ : Module R✝ N
inst✝¹⁰ : IsScalarTower R✝ A✝ N
R : Type u_5
A : Type u_6
M : Type u_7
inst✝⁹ : CommRing R
inst✝⁸ : Ring A
inst✝⁷ : IsDomain A
inst✝⁶ : Algebra R A
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Module A M
inst✝² : IsScalarTower R A M
inst✝¹ : NoZeroSMulDivisors R A
inst✝ : NoZeroSMulDivisors A M
r : R
m : M
h : r • m = 0
⊢ r = 0 ∨ m = 0

Next tactic:
rw [algebra_compatible_smul A r m] at h
theorem NoZeroSMulDivisors.trans (R A M : Type*) [CommRing R] [Ring A] [IsDomain A] [Algebra R A]
    [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M] [NoZeroSMulDivisors R A]
    [NoZeroSMulDivisors A M] : NoZeroSMulDivisors R M := by
  refine' ⟨fun {r m} h => _⟩
  rw [algebra_compatible_smul A r m] at h
  

Proof state:
R✝ : Type u_1
inst✝²⁰ : CommSemiring R✝
A✝ : Type u_2
inst✝¹⁹ : Semiring A✝
inst✝¹⁸ : Algebra R✝ A✝
M✝ : Type u_3
inst✝¹⁷ : AddCommMonoid M✝
inst✝¹⁶ : Module A✝ M✝
inst✝¹⁵ : Module R✝ M✝
inst✝¹⁴ : IsScalarTower R✝ A✝ M✝
N : Type u_4
inst✝¹³ : AddCommMonoid N
inst✝¹² : Module A✝ N
inst✝¹¹ : Module R✝ N
inst✝¹⁰ : IsScalarTower R✝ A✝ N
R : Type u_5
A : Type u_6
M : Type u_7
inst✝⁹ : CommRing R
inst✝⁸ : Ring A
inst✝⁷ : IsDomain A
inst✝⁶ : Algebra R A
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Module A M
inst✝² : IsScalarTower R A M
inst✝¹ : NoZeroSMulDivisors R A
inst✝ : NoZeroSMulDivisors A M
r : R
m : M
h : (algebraMap R A) r • m = 0
⊢ r = 0 ∨ m = 0

Next tactic:
cases' smul_eq_zero.1 h with H H
theorem NoZeroSMulDivisors.trans (R A M : Type*) [CommRing R] [Ring A] [IsDomain A] [Algebra R A]
    [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M] [NoZeroSMulDivisors R A]
    [NoZeroSMulDivisors A M] : NoZeroSMulDivisors R M := by
  refine' ⟨fun {r m} h => _⟩
  rw [algebra_compatible_smul A r m] at h
  cases' smul_eq_zero.1 h with H H
  · 

Proof state:
case inl
R✝ : Type u_1
inst✝²⁰ : CommSemiring R✝
A✝ : Type u_2
inst✝¹⁹ : Semiring A✝
inst✝¹⁸ : Algebra R✝ A✝
M✝ : Type u_3
inst✝¹⁷ : AddCommMonoid M✝
inst✝¹⁶ : Module A✝ M✝
inst✝¹⁵ : Module R✝ M✝
inst✝¹⁴ : IsScalarTower R✝ A✝ M✝
N : Type u_4
inst✝¹³ : AddCommMonoid N
inst✝¹² : Module A✝ N
inst✝¹¹ : Module R✝ N
inst✝¹⁰ : IsScalarTower R✝ A✝ N
R : Type u_5
A : Type u_6
M : Type u_7
inst✝⁹ : CommRing R
inst✝⁸ : Ring A
inst✝⁷ : IsDomain A
inst✝⁶ : Algebra R A
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Module A M
inst✝² : IsScalarTower R A M
inst✝¹ : NoZeroSMulDivisors R A
inst✝ : NoZeroSMulDivisors A M
r : R
m : M
h : (algebraMap R A) r • m = 0
H : (algebraMap R A) r = 0
⊢ r = 0 ∨ m = 0

Next tactic:
have : Function.Injective (algebraMap R A) :=
      NoZeroSMulDivisors.iff_algebraMap_injective.1 inferInstance
theorem NoZeroSMulDivisors.trans (R A M : Type*) [CommRing R] [Ring A] [IsDomain A] [Algebra R A]
    [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M] [NoZeroSMulDivisors R A]
    [NoZeroSMulDivisors A M] : NoZeroSMulDivisors R M := by
  refine' ⟨fun {r m} h => _⟩
  rw [algebra_compatible_smul A r m] at h
  cases' smul_eq_zero.1 h with H H
  · have : Function.Injective (algebraMap R A) :=
      NoZeroSMulDivisors.iff_algebraMap_injective.1 inferInstance
    

Proof state:
case inl
R✝ : Type u_1
inst✝²⁰ : CommSemiring R✝
A✝ : Type u_2
inst✝¹⁹ : Semiring A✝
inst✝¹⁸ : Algebra R✝ A✝
M✝ : Type u_3
inst✝¹⁷ : AddCommMonoid M✝
inst✝¹⁶ : Module A✝ M✝
inst✝¹⁵ : Module R✝ M✝
inst✝¹⁴ : IsScalarTower R✝ A✝ M✝
N : Type u_4
inst✝¹³ : AddCommMonoid N
inst✝¹² : Module A✝ N
inst✝¹¹ : Module R✝ N
inst✝¹⁰ : IsScalarTower R✝ A✝ N
R : Type u_5
A : Type u_6
M : Type u_7
inst✝⁹ : CommRing R
inst✝⁸ : Ring A
inst✝⁷ : IsDomain A
inst✝⁶ : Algebra R A
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Module A M
inst✝² : IsScalarTower R A M
inst✝¹ : NoZeroSMulDivisors R A
inst✝ : NoZeroSMulDivisors A M
r : R
m : M
h : (algebraMap R A) r • m = 0
H : (algebraMap R A) r = 0
this : Function.Injective ⇑(algebraMap R A)
⊢ r = 0 ∨ m = 0

Next tactic:
left
theorem NoZeroSMulDivisors.trans (R A M : Type*) [CommRing R] [Ring A] [IsDomain A] [Algebra R A]
    [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M] [NoZeroSMulDivisors R A]
    [NoZeroSMulDivisors A M] : NoZeroSMulDivisors R M := by
  refine' ⟨fun {r m} h => _⟩
  rw [algebra_compatible_smul A r m] at h
  cases' smul_eq_zero.1 h with H H
  · have : Function.Injective (algebraMap R A) :=
      NoZeroSMulDivisors.iff_algebraMap_injective.1 inferInstance
    left
    

Proof state:
case inl.h
R✝ : Type u_1
inst✝²⁰ : CommSemiring R✝
A✝ : Type u_2
inst✝¹⁹ : Semiring A✝
inst✝¹⁸ : Algebra R✝ A✝
M✝ : Type u_3
inst✝¹⁷ : AddCommMonoid M✝
inst✝¹⁶ : Module A✝ M✝
inst✝¹⁵ : Module R✝ M✝
inst✝¹⁴ : IsScalarTower R✝ A✝ M✝
N : Type u_4
inst✝¹³ : AddCommMonoid N
inst✝¹² : Module A✝ N
inst✝¹¹ : Module R✝ N
inst✝¹⁰ : IsScalarTower R✝ A✝ N
R : Type u_5
A : Type u_6
M : Type u_7
inst✝⁹ : CommRing R
inst✝⁸ : Ring A
inst✝⁷ : IsDomain A
inst✝⁶ : Algebra R A
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Module A M
inst✝² : IsScalarTower R A M
inst✝¹ : NoZeroSMulDivisors R A
inst✝ : NoZeroSMulDivisors A M
r : R
m : M
h : (algebraMap R A) r • m = 0
H : (algebraMap R A) r = 0
this : Function.Injective ⇑(algebraMap R A)
⊢ r = 0

Next tactic:
exact (injective_iff_map_eq_zero _).1 this _ H
theorem NoZeroSMulDivisors.trans (R A M : Type*) [CommRing R] [Ring A] [IsDomain A] [Algebra R A]
    [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M] [NoZeroSMulDivisors R A]
    [NoZeroSMulDivisors A M] : NoZeroSMulDivisors R M := by
  refine' ⟨fun {r m} h => _⟩
  rw [algebra_compatible_smul A r m] at h
  cases' smul_eq_zero.1 h with H H
  · have : Function.Injective (algebraMap R A) :=
      NoZeroSMulDivisors.iff_algebraMap_injective.1 inferInstance
    left
    exact (injective_iff_map_eq_zero _).1 this _ H
  · 

Proof state:
case inr
R✝ : Type u_1
inst✝²⁰ : CommSemiring R✝
A✝ : Type u_2
inst✝¹⁹ : Semiring A✝
inst✝¹⁸ : Algebra R✝ A✝
M✝ : Type u_3
inst✝¹⁷ : AddCommMonoid M✝
inst✝¹⁶ : Module A✝ M✝
inst✝¹⁵ : Module R✝ M✝
inst✝¹⁴ : IsScalarTower R✝ A✝ M✝
N : Type u_4
inst✝¹³ : AddCommMonoid N
inst✝¹² : Module A✝ N
inst✝¹¹ : Module R✝ N
inst✝¹⁰ : IsScalarTower R✝ A✝ N
R : Type u_5
A : Type u_6
M : Type u_7
inst✝⁹ : CommRing R
inst✝⁸ : Ring A
inst✝⁷ : IsDomain A
inst✝⁶ : Algebra R A
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Module A M
inst✝² : IsScalarTower R A M
inst✝¹ : NoZeroSMulDivisors R A
inst✝ : NoZeroSMulDivisors A M
r : R
m : M
h : (algebraMap R A) r • m = 0
H : m = 0
⊢ r = 0 ∨ m = 0

Next tactic:
right
theorem NoZeroSMulDivisors.trans (R A M : Type*) [CommRing R] [Ring A] [IsDomain A] [Algebra R A]
    [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower R A M] [NoZeroSMulDivisors R A]
    [NoZeroSMulDivisors A M] : NoZeroSMulDivisors R M := by
  refine' ⟨fun {r m} h => _⟩
  rw [algebra_compatible_smul A r m] at h
  cases' smul_eq_zero.1 h with H H
  · have : Function.Injective (algebraMap R A) :=
      NoZeroSMulDivisors.iff_algebraMap_injective.1 inferInstance
    left
    exact (injective_iff_map_eq_zero _).1 this _ H
  · right
    

Proof state:
case inr.h
R✝ : Type u_1
inst✝²⁰ : CommSemiring R✝
A✝ : Type u_2
inst✝¹⁹ : Semiring A✝
inst✝¹⁸ : Algebra R✝ A✝
M✝ : Type u_3
inst✝¹⁷ : AddCommMonoid M✝
inst✝¹⁶ : Module A✝ M✝
inst✝¹⁵ : Module R✝ M✝
inst✝¹⁴ : IsScalarTower R✝ A✝ M✝
N : Type u_4
inst✝¹³ : AddCommMonoid N
inst✝¹² : Module A✝ N
inst✝¹¹ : Module R✝ N
inst✝¹⁰ : IsScalarTower R✝ A✝ N
R : Type u_5
A : Type u_6
M : Type u_7
inst✝⁹ : CommRing R
inst✝⁸ : Ring A
inst✝⁷ : IsDomain A
inst✝⁶ : Algebra R A
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
inst✝³ : Module A M
inst✝² : IsScalarTower R A M
inst✝¹ : NoZeroSMulDivisors R A
inst✝ : NoZeroSMulDivisors A M
r : R
m : M
h : (algebraMap R A) r • m = 0
H : m = 0
⊢ m = 0

Next tactic:
exact H
instance (priority := 100) IsScalarTower.to_smulCommClass : SMulCommClass R A M :=
  ⟨fun r a m => by
    

Proof state:
R : Type u_1
inst✝¹⁰ : CommSemiring R
A : Type u_2
inst✝⁹ : Semiring A
inst✝⁸ : Algebra R A
M : Type u_3
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module A M
inst✝⁵ : Module R M
inst✝⁴ : IsScalarTower R A M
N : Type u_4
inst✝³ : AddCommMonoid N
inst✝² : Module A N
inst✝¹ : Module R N
inst✝ : IsScalarTower R A N
r : R
a : A
m : M
⊢ r • a • m = a • r • m

Next tactic:
rw [algebra_compatible_smul A r (a • m), smul_smul, Algebra.commutes, mul_smul, ←
      algebra_compatible_smul]
/-- If there is a linear map `f : A →ₗ[R] B` that preserves `1`, then `algebraMap R B r` is
invertible when `algebraMap R A r` is. -/
abbrev Invertible.algebraMapOfInvertibleAlgebraMap (f : A →ₗ[R] B) (hf : f 1 = 1) {r : R}
    (h : Invertible (algebraMap R A r)) : Invertible (algebraMap R B r) where
  invOf := f ⅟(algebraMap R A r)
  invOf_mul_self := by 

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Semiring B
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : A →ₗ[R] B
hf : f 1 = 1
r : R
h : Invertible ((algebraMap R A) r)
⊢ f ⅟((algebraMap R A) r) * (algebraMap R B) r = 1

Next tactic:
rw [← Algebra.commutes, ← Algebra.smul_def, ← map_smul, Algebra.smul_def,
    mul_invOf_self, hf]
/-- If there is a linear map `f : A →ₗ[R] B` that preserves `1`, then `algebraMap R B r` is
invertible when `algebraMap R A r` is. -/
abbrev Invertible.algebraMapOfInvertibleAlgebraMap (f : A →ₗ[R] B) (hf : f 1 = 1) {r : R}
    (h : Invertible (algebraMap R A r)) : Invertible (algebraMap R B r) where
  invOf := f ⅟(algebraMap R A r)
  invOf_mul_self := by rw [← Algebra.commutes, ← Algebra.smul_def, ← map_smul, Algebra.smul_def,
    mul_invOf_self, hf]
  mul_invOf_self := by 

Proof state:
R : Type u_1
A : Type u_2
B : Type u_3
inst✝⁴ : CommSemiring R
inst✝³ : Semiring A
inst✝² : Semiring B
inst✝¹ : Algebra R A
inst✝ : Algebra R B
f : A →ₗ[R] B
hf : f 1 = 1
r : R
h : Invertible ((algebraMap R A) r)
⊢ (algebraMap R B) r * f ⅟((algebraMap R A) r) = 1

Next tactic:
rw [← Algebra.smul_def, ← map_smul, Algebra.smul_def, mul_invOf_self, hf]
theorem powHalf_leftMoves (n) : (powHalf n).LeftMoves = PUnit := by 

Proof state:
n : ℕ
⊢ LeftMoves (powHalf n) = PUnit.{u_1 + 1}

Next tactic:
cases n
theorem powHalf_leftMoves (n) : (powHalf n).LeftMoves = PUnit := by cases n <;> 

Proof state:
case zero
⊢ LeftMoves (powHalf Nat.zero) = PUnit.{u_1 + 1}

Next tactic:
rfl
theorem powHalf_leftMoves (n) : (powHalf n).LeftMoves = PUnit := by cases n <;> 

Proof state:
case succ
n✝ : ℕ
⊢ LeftMoves (powHalf (Nat.succ n✝)) = PUnit.{u_1 + 1}

Next tactic:
rfl
@[simp]
theorem powHalf_moveLeft (n i) : (powHalf n).moveLeft i = 0 := by 

Proof state:
n : ℕ
i : LeftMoves (powHalf n)
⊢ moveLeft (powHalf n) i = 0

Next tactic:
cases n
@[simp]
theorem powHalf_moveLeft (n i) : (powHalf n).moveLeft i = 0 := by cases n <;> 

Proof state:
case zero
i : LeftMoves (powHalf Nat.zero)
⊢ moveLeft (powHalf Nat.zero) i = 0

Next tactic:
cases i
@[simp]
theorem powHalf_moveLeft (n i) : (powHalf n).moveLeft i = 0 := by cases n <;> 

Proof state:
case succ
n✝ : ℕ
i : LeftMoves (powHalf (Nat.succ n✝))
⊢ moveLeft (powHalf (Nat.succ n✝)) i = 0

Next tactic:
cases i
@[simp]
theorem powHalf_moveLeft (n i) : (powHalf n).moveLeft i = 0 := by cases n <;> cases i <;> 

Proof state:
case zero.unit
⊢ moveLeft (powHalf Nat.zero) PUnit.unit = 0

Next tactic:
rfl
@[simp]
theorem powHalf_moveLeft (n i) : (powHalf n).moveLeft i = 0 := by cases n <;> cases i <;> 

Proof state:
case succ.unit
n✝ : ℕ
⊢ moveLeft (powHalf (Nat.succ n✝)) PUnit.unit = 0

Next tactic:
rfl
instance uniquePowHalfLeftMoves (n) : Unique (powHalf n).LeftMoves := by
  

Proof state:
n : ℕ
⊢ Unique (LeftMoves (powHalf n))

Next tactic:
cases n
instance uniquePowHalfLeftMoves (n) : Unique (powHalf n).LeftMoves := by
  cases n <;> 

Proof state:
case zero
⊢ Unique (LeftMoves (powHalf Nat.zero))

Next tactic:
exact PUnit.unique