l3lab/ntp-mathlib huggingface dataset:
/-- In a Banach-algebra `𝔸` over `𝕂 = ℝ` or `𝕂 = ℂ`, if a family of elements `f i` mutually
commute then `exp 𝕂 (∑ i, f i) = ∏ i, exp 𝕂 (f i)`. -/
theorem exp_sum_of_commute {ι} (s : Finset ι) (f : ι → 𝔸)
    (h : (s : Set ι).Pairwise fun i j => Commute (f i) (f j)) :
    exp 𝕂 (∑ i in s, f i) =
      s.noncommProd (fun i => exp 𝕂 (f i)) fun i hi j hj _ => (h.of_refl hi hj).exp 𝕂 := by
  classical
    induction' s using Finset.induction_on with a s ha ih
    · simp
    rw [Finset.noncommProd_insert_of_not_mem _ _ _ _ ha, Finset.sum_insert ha, exp_add_of_commute,
      ih (h.mono <| Finset.subset_insert _ _)]
    

Proof state:
case insert
𝕂 : Type u_1
𝔸 : Type u_2
𝔹 : Type u_3
inst✝⁵ : IsROrC 𝕂
inst✝⁴ : NormedRing 𝔸
inst✝³ : NormedAlgebra 𝕂 𝔸
inst✝² : NormedRing 𝔹
inst✝¹ : NormedAlgebra 𝕂 𝔹
inst✝ : CompleteSpace 𝔸
ι : Type u_4
f : ι → 𝔸
a : ι
s : Finset ι
ha : a ∉ s
ih :
  ∀ (h : Set.Pairwise ↑s fun i j => Commute (f i) (f j)),
    exp 𝕂 (∑ i in s, f i) =
      Finset.noncommProd s (fun i => exp 𝕂 (f i)) (_ : ∀ i ∈ ↑s, ∀ j ∈ ↑s, i ≠ j → Commute (exp 𝕂 (f i)) (exp 𝕂 (f j)))
h : Set.Pairwise ↑(insert a s) fun i j => Commute (f i) (f j)
⊢ Commute (f a) (∑ x in s, f x)

Next tactic:
refine' Commute.sum_right _ _ _ fun i hi => _
/-- In a Banach-algebra `𝔸` over `𝕂 = ℝ` or `𝕂 = ℂ`, if a family of elements `f i` mutually
commute then `exp 𝕂 (∑ i, f i) = ∏ i, exp 𝕂 (f i)`. -/
theorem exp_sum_of_commute {ι} (s : Finset ι) (f : ι → 𝔸)
    (h : (s : Set ι).Pairwise fun i j => Commute (f i) (f j)) :
    exp 𝕂 (∑ i in s, f i) =
      s.noncommProd (fun i => exp 𝕂 (f i)) fun i hi j hj _ => (h.of_refl hi hj).exp 𝕂 := by
  classical
    induction' s using Finset.induction_on with a s ha ih
    · simp
    rw [Finset.noncommProd_insert_of_not_mem _ _ _ _ ha, Finset.sum_insert ha, exp_add_of_commute,
      ih (h.mono <| Finset.subset_insert _ _)]
    refine' Commute.sum_right _ _ _ fun i hi => _
    

Proof state:
case insert
𝕂 : Type u_1
𝔸 : Type u_2
𝔹 : Type u_3
inst✝⁵ : IsROrC 𝕂
inst✝⁴ : NormedRing 𝔸
inst✝³ : NormedAlgebra 𝕂 𝔸
inst✝² : NormedRing 𝔹
inst✝¹ : NormedAlgebra 𝕂 𝔹
inst✝ : CompleteSpace 𝔸
ι : Type u_4
f : ι → 𝔸
a : ι
s : Finset ι
ha : a ∉ s
ih :
  ∀ (h : Set.Pairwise ↑s fun i j => Commute (f i) (f j)),
    exp 𝕂 (∑ i in s, f i) =
      Finset.noncommProd s (fun i => exp 𝕂 (f i)) (_ : ∀ i ∈ ↑s, ∀ j ∈ ↑s, i ≠ j → Commute (exp 𝕂 (f i)) (exp 𝕂 (f j)))
h : Set.Pairwise ↑(insert a s) fun i j => Commute (f i) (f j)
i : ι
hi : i ∈ s
⊢ Commute (f a) (f i)

Next tactic:
exact h.of_refl (Finset.mem_insert_self _ _) (Finset.mem_insert_of_mem hi)
theorem exp_nsmul (n : ℕ) (x : 𝔸) : exp 𝕂 (n • x) = exp 𝕂 x ^ n := by
  

Proof state:
𝕂 : Type u_1
𝔸 : Type u_2
𝔹 : Type u_3
inst✝⁵ : IsROrC 𝕂
inst✝⁴ : NormedRing 𝔸
inst✝³ : NormedAlgebra 𝕂 𝔸
inst✝² : NormedRing 𝔹
inst✝¹ : NormedAlgebra 𝕂 𝔹
inst✝ : CompleteSpace 𝔸
n : ℕ
x : 𝔸
⊢ exp 𝕂 (n • x) = exp 𝕂 x ^ n

Next tactic:
induction' n with n ih
theorem exp_nsmul (n : ℕ) (x : 𝔸) : exp 𝕂 (n • x) = exp 𝕂 x ^ n := by
  induction' n with n ih
  · 

Proof state:
case zero
𝕂 : Type u_1
𝔸 : Type u_2
𝔹 : Type u_3
inst✝⁵ : IsROrC 𝕂
inst✝⁴ : NormedRing 𝔸
inst✝³ : NormedAlgebra 𝕂 𝔸
inst✝² : NormedRing 𝔹
inst✝¹ : NormedAlgebra 𝕂 𝔹
inst✝ : CompleteSpace 𝔸
x : 𝔸
⊢ exp 𝕂 (Nat.zero • x) = exp 𝕂 x ^ Nat.zero

Next tactic:
rw [Nat.zero_eq, zero_smul, pow_zero, exp_zero]
theorem exp_nsmul (n : ℕ) (x : 𝔸) : exp 𝕂 (n • x) = exp 𝕂 x ^ n := by
  induction' n with n ih
  · rw [Nat.zero_eq, zero_smul, pow_zero, exp_zero]
  · 

Proof state:
case succ
𝕂 : Type u_1
𝔸 : Type u_2
𝔹 : Type u_3
inst✝⁵ : IsROrC 𝕂
inst✝⁴ : NormedRing 𝔸
inst✝³ : NormedAlgebra 𝕂 𝔸
inst✝² : NormedRing 𝔹
inst✝¹ : NormedAlgebra 𝕂 𝔹
inst✝ : CompleteSpace 𝔸
x : 𝔸
n : ℕ
ih : exp 𝕂 (n • x) = exp 𝕂 x ^ n
⊢ exp 𝕂 (Nat.succ n • x) = exp 𝕂 x ^ Nat.succ n

Next tactic:
rw [succ_nsmul, pow_succ, exp_add_of_commute ((Commute.refl x).smul_right n), ih]
theorem _root_.Function.update_exp {ι : Type*} {𝔸 : ι → Type*} [Fintype ι] [DecidableEq ι]
    [∀ i, NormedRing (𝔸 i)] [∀ i, NormedAlgebra 𝕂 (𝔸 i)] [∀ i, CompleteSpace (𝔸 i)] (x : ∀ i, 𝔸 i)
    (j : ι) (xj : 𝔸 j) :
    Function.update (exp 𝕂 x) j (exp 𝕂 xj) = exp 𝕂 (Function.update x j xj) := by
  

Proof state:
𝕂 : Type u_1
𝔸✝ : Type u_2
𝔹 : Type u_3
inst✝¹⁰ : IsROrC 𝕂
inst✝⁹ : NormedRing 𝔸✝
inst✝⁸ : NormedAlgebra 𝕂 𝔸✝
inst✝⁷ : NormedRing 𝔹
inst✝⁶ : NormedAlgebra 𝕂 𝔹
inst✝⁵ : CompleteSpace 𝔸✝
ι : Type u_4
𝔸 : ι → Type u_5
inst✝⁴ : Fintype ι
inst✝³ : DecidableEq ι
inst✝² : (i : ι) → NormedRing (𝔸 i)
inst✝¹ : (i : ι) → NormedAlgebra 𝕂 (𝔸 i)
inst✝ : ∀ (i : ι), CompleteSpace (𝔸 i)
x : (i : ι) → 𝔸 i
j : ι
xj : 𝔸 j
⊢ Function.update (exp 𝕂 x) j (exp 𝕂 xj) = exp 𝕂 (Function.update x j xj)

Next tactic:
ext i
theorem _root_.Function.update_exp {ι : Type*} {𝔸 : ι → Type*} [Fintype ι] [DecidableEq ι]
    [∀ i, NormedRing (𝔸 i)] [∀ i, NormedAlgebra 𝕂 (𝔸 i)] [∀ i, CompleteSpace (𝔸 i)] (x : ∀ i, 𝔸 i)
    (j : ι) (xj : 𝔸 j) :
    Function.update (exp 𝕂 x) j (exp 𝕂 xj) = exp 𝕂 (Function.update x j xj) := by
  ext i
  

Proof state:
case h
𝕂 : Type u_1
𝔸✝ : Type u_2
𝔹 : Type u_3
inst✝¹⁰ : IsROrC 𝕂
inst✝⁹ : NormedRing 𝔸✝
inst✝⁸ : NormedAlgebra 𝕂 𝔸✝
inst✝⁷ : NormedRing 𝔹
inst✝⁶ : NormedAlgebra 𝕂 𝔹
inst✝⁵ : CompleteSpace 𝔸✝
ι : Type u_4
𝔸 : ι → Type u_5
inst✝⁴ : Fintype ι
inst✝³ : DecidableEq ι
inst✝² : (i : ι) → NormedRing (𝔸 i)
inst✝¹ : (i : ι) → NormedAlgebra 𝕂 (𝔸 i)
inst✝ : ∀ (i : ι), CompleteSpace (𝔸 i)
x : (i : ι) → 𝔸 i
j : ι
xj : 𝔸 j
i : ι
⊢ Function.update (exp 𝕂 x) j (exp 𝕂 xj) i = exp 𝕂 (Function.update x j xj) i

Next tactic:
simp_rw [Pi.exp_def]
theorem _root_.Function.update_exp {ι : Type*} {𝔸 : ι → Type*} [Fintype ι] [DecidableEq ι]
    [∀ i, NormedRing (𝔸 i)] [∀ i, NormedAlgebra 𝕂 (𝔸 i)] [∀ i, CompleteSpace (𝔸 i)] (x : ∀ i, 𝔸 i)
    (j : ι) (xj : 𝔸 j) :
    Function.update (exp 𝕂 x) j (exp 𝕂 xj) = exp 𝕂 (Function.update x j xj) := by
  ext i
  simp_rw [Pi.exp_def]
  

Proof state:
case h
𝕂 : Type u_1
𝔸✝ : Type u_2
𝔹 : Type u_3
inst✝¹⁰ : IsROrC 𝕂
inst✝⁹ : NormedRing 𝔸✝
inst✝⁸ : NormedAlgebra 𝕂 𝔸✝
inst✝⁷ : NormedRing 𝔹
inst✝⁶ : NormedAlgebra 𝕂 𝔹
inst✝⁵ : CompleteSpace 𝔸✝
ι : Type u_4
𝔸 : ι → Type u_5
inst✝⁴ : Fintype ι
inst✝³ : DecidableEq ι
inst✝² : (i : ι) → NormedRing (𝔸 i)
inst✝¹ : (i : ι) → NormedAlgebra 𝕂 (𝔸 i)
inst✝ : ∀ (i : ι), CompleteSpace (𝔸 i)
x : (i : ι) → 𝔸 i
j : ι
xj : 𝔸 j
i : ι
⊢ Function.update (fun i => exp 𝕂 (x i)) j (exp 𝕂 xj) i = exp 𝕂 (Function.update x j xj i)

Next tactic:
exact (Function.apply_update (fun i => exp 𝕂) x j xj i).symm
theorem exp_zsmul (z : ℤ) (x : 𝔸) : exp 𝕂 (z • x) = exp 𝕂 x ^ z := by
  

Proof state:
𝕂 : Type u_1
𝔸 : Type u_2
inst✝³ : IsROrC 𝕂
inst✝² : NormedDivisionRing 𝔸
inst✝¹ : NormedAlgebra 𝕂 𝔸
inst✝ : CompleteSpace 𝔸
z : ℤ
x : 𝔸
⊢ exp 𝕂 (z • x) = exp 𝕂 x ^ z

Next tactic:
obtain ⟨n, rfl | rfl⟩ := z.eq_nat_or_neg
theorem exp_zsmul (z : ℤ) (x : 𝔸) : exp 𝕂 (z • x) = exp 𝕂 x ^ z := by
  obtain ⟨n, rfl | rfl⟩ := z.eq_nat_or_neg
  · 

Proof state:
case intro.inl
𝕂 : Type u_1
𝔸 : Type u_2
inst✝³ : IsROrC 𝕂
inst✝² : NormedDivisionRing 𝔸
inst✝¹ : NormedAlgebra 𝕂 𝔸
inst✝ : CompleteSpace 𝔸
x : 𝔸
n : ℕ
⊢ exp 𝕂 (↑n • x) = exp 𝕂 x ^ ↑n

Next tactic:
rw [zpow_ofNat, coe_nat_zsmul, exp_nsmul]
theorem exp_zsmul (z : ℤ) (x : 𝔸) : exp 𝕂 (z • x) = exp 𝕂 x ^ z := by
  obtain ⟨n, rfl | rfl⟩ := z.eq_nat_or_neg
  · rw [zpow_ofNat, coe_nat_zsmul, exp_nsmul]
  · 

Proof state:
case intro.inr
𝕂 : Type u_1
𝔸 : Type u_2
inst✝³ : IsROrC 𝕂
inst✝² : NormedDivisionRing 𝔸
inst✝¹ : NormedAlgebra 𝕂 𝔸
inst✝ : CompleteSpace 𝔸
x : 𝔸
n : ℕ
⊢ exp 𝕂 (-↑n • x) = exp 𝕂 x ^ (-↑n)

Next tactic:
rw [zpow_neg, zpow_ofNat, neg_smul, exp_neg, coe_nat_zsmul, exp_nsmul]
/-- A version of `exp_sum_of_commute` for a commutative Banach-algebra. -/
theorem exp_sum {ι} (s : Finset ι) (f : ι → 𝔸) : exp 𝕂 (∑ i in s, f i) = ∏ i in s, exp 𝕂 (f i) := by
  

Proof state:
𝕂 : Type u_1
𝔸 : Type u_2
inst✝³ : IsROrC 𝕂
inst✝² : NormedCommRing 𝔸
inst✝¹ : NormedAlgebra 𝕂 𝔸
inst✝ : CompleteSpace 𝔸
ι : Type u_3
s : Finset ι
f : ι → 𝔸
⊢ exp 𝕂 (∑ i in s, f i) = ∏ i in s, exp 𝕂 (f i)

Next tactic:
rw [exp_sum_of_commute, Finset.noncommProd_eq_prod]
/-- A version of `exp_sum_of_commute` for a commutative Banach-algebra. -/
theorem exp_sum {ι} (s : Finset ι) (f : ι → 𝔸) : exp 𝕂 (∑ i in s, f i) = ∏ i in s, exp 𝕂 (f i) := by
  rw [exp_sum_of_commute, Finset.noncommProd_eq_prod]
  

Proof state:
case h
𝕂 : Type u_1
𝔸 : Type u_2
inst✝³ : IsROrC 𝕂
inst✝² : NormedCommRing 𝔸
inst✝¹ : NormedAlgebra 𝕂 𝔸
inst✝ : CompleteSpace 𝔸
ι : Type u_3
s : Finset ι
f : ι → 𝔸
⊢ Set.Pairwise ↑s fun i j => Commute (f i) (f j)
case h
𝕂 : Type u_1
𝔸 : Type u_2
inst✝³ : IsROrC 𝕂
inst✝² : NormedCommRing 𝔸
inst✝¹ : NormedAlgebra 𝕂 𝔸
inst✝ : CompleteSpace 𝔸
ι : Type u_3
s : Finset ι
f : ι → 𝔸
⊢ Set.Pairwise ↑s fun i j => Commute (f i) (f j)

Next tactic:
exact fun i _hi j _hj _ => Commute.all _ _
/-- If a normed ring `𝔸` is a normed algebra over two fields, then they define the same
`expSeries` on `𝔸`. -/
theorem expSeries_eq_expSeries (n : ℕ) (x : 𝔸) :
    (expSeries 𝕂 𝔸 n fun _ => x) = expSeries 𝕂' 𝔸 n fun _ => x := by
  

Proof state:
𝕂 : Type u_1
𝕂' : Type u_2
𝔸 : Type u_3
inst✝⁶ : Field 𝕂
inst✝⁵ : Field 𝕂'
inst✝⁴ : Ring 𝔸
inst✝³ : Algebra 𝕂 𝔸
inst✝² : Algebra 𝕂' 𝔸
inst✝¹ : TopologicalSpace 𝔸
inst✝ : TopologicalRing 𝔸
n : ℕ
x : 𝔸
⊢ ((expSeries 𝕂 𝔸 n) fun x_1 => x) = (expSeries 𝕂' 𝔸 n) fun x_1 => x

Next tactic:
rw [expSeries_apply_eq, expSeries_apply_eq, inv_nat_cast_smul_eq 𝕂 𝕂']
/-- If a normed ring `𝔸` is a normed algebra over two fields, then they define the same
exponential function on `𝔸`. -/
theorem exp_eq_exp : (exp 𝕂 : 𝔸 → 𝔸) = exp 𝕂' := by
  

Proof state:
𝕂 : Type u_1
𝕂' : Type u_2
𝔸 : Type u_3
inst✝⁶ : Field 𝕂
inst✝⁵ : Field 𝕂'
inst✝⁴ : Ring 𝔸
inst✝³ : Algebra 𝕂 𝔸
inst✝² : Algebra 𝕂' 𝔸
inst✝¹ : TopologicalSpace 𝔸
inst✝ : TopologicalRing 𝔸
⊢ exp 𝕂 = exp 𝕂'

Next tactic:
ext x
/-- If a normed ring `𝔸` is a normed algebra over two fields, then they define the same
exponential function on `𝔸`. -/
theorem exp_eq_exp : (exp 𝕂 : 𝔸 → 𝔸) = exp 𝕂' := by
  ext x
  

Proof state:
case h
𝕂 : Type u_1
𝕂' : Type u_2
𝔸 : Type u_3
inst✝⁶ : Field 𝕂
inst✝⁵ : Field 𝕂'
inst✝⁴ : Ring 𝔸
inst✝³ : Algebra 𝕂 𝔸
inst✝² : Algebra 𝕂' 𝔸
inst✝¹ : TopologicalSpace 𝔸
inst✝ : TopologicalRing 𝔸
x : 𝔸
⊢ exp 𝕂 x = exp 𝕂' x

Next tactic:
rw [exp, exp]
/-- If a normed ring `𝔸` is a normed algebra over two fields, then they define the same
exponential function on `𝔸`. -/
theorem exp_eq_exp : (exp 𝕂 : 𝔸 → 𝔸) = exp 𝕂' := by
  ext x
  rw [exp, exp]
  

Proof state:
case h
𝕂 : Type u_1
𝕂' : Type u_2
𝔸 : Type u_3
inst✝⁶ : Field 𝕂
inst✝⁵ : Field 𝕂'
inst✝⁴ : Ring 𝔸
inst✝³ : Algebra 𝕂 𝔸
inst✝² : Algebra 𝕂' 𝔸
inst✝¹ : TopologicalSpace 𝔸
inst✝ : TopologicalRing 𝔸
x : 𝔸
⊢ FormalMultilinearSeries.sum (expSeries 𝕂 𝔸) x = FormalMultilinearSeries.sum (expSeries 𝕂' 𝔸) x

Next tactic:
refine' tsum_congr fun n => _
/-- If a normed ring `𝔸` is a normed algebra over two fields, then they define the same
exponential function on `𝔸`. -/
theorem exp_eq_exp : (exp 𝕂 : 𝔸 → 𝔸) = exp 𝕂' := by
  ext x
  rw [exp, exp]
  refine' tsum_congr fun n => _
  

Proof state:
case h
𝕂 : Type u_1
𝕂' : Type u_2
𝔸 : Type u_3
inst✝⁶ : Field 𝕂
inst✝⁵ : Field 𝕂'
inst✝⁴ : Ring 𝔸
inst✝³ : Algebra 𝕂 𝔸
inst✝² : Algebra 𝕂' 𝔸
inst✝¹ : TopologicalSpace 𝔸
inst✝ : TopologicalRing 𝔸
x : 𝔸
n : ℕ
⊢ ((expSeries 𝕂 𝔸 n) fun x_1 => x) = (expSeries 𝕂' 𝔸 n) fun x_1 => x

Next tactic:
rw [expSeries_eq_expSeries 𝕂 𝕂' 𝔸 n x]
theorem nnnorm_coe_units (e : ℤˣ) : ‖(e : ℤ)‖₊ = 1 := by
  

Proof state:
e : ℤˣ
⊢ ‖↑e‖₊ = 1

Next tactic:
obtain rfl | rfl := units_eq_one_or e
theorem nnnorm_coe_units (e : ℤˣ) : ‖(e : ℤ)‖₊ = 1 := by
  obtain rfl | rfl := units_eq_one_or e <;>
    

Proof state:
case inl
⊢ ‖↑1‖₊ = 1

Next tactic:
simp only [Units.coe_neg_one, Units.val_one, nnnorm_neg, nnnorm_one]
theorem nnnorm_coe_units (e : ℤˣ) : ‖(e : ℤ)‖₊ = 1 := by
  obtain rfl | rfl := units_eq_one_or e <;>
    

Proof state:
case inr
⊢ ‖↑(-1)‖₊ = 1

Next tactic:
simp only [Units.coe_neg_one, Units.val_one, nnnorm_neg, nnnorm_one]
theorem norm_coe_units (e : ℤˣ) : ‖(e : ℤ)‖ = 1 := by
  

Proof state:
e : ℤˣ
⊢ ‖↑e‖ = 1

Next tactic:
rw [← coe_nnnorm, nnnorm_coe_units, NNReal.coe_one]
@[simp]
theorem toNat_add_toNat_neg_eq_nnnorm (n : ℤ) : ↑n.toNat + ↑(-n).toNat = ‖n‖₊ := by
  

Proof state:
n : ℤ
⊢ ↑(toNat n) + ↑(toNat (-n)) = ‖n‖₊

Next tactic:
rw [← Nat.cast_add, toNat_add_toNat_neg_eq_natAbs, NNReal.coe_natAbs]
@[simp]
theorem toNat_add_toNat_neg_eq_norm (n : ℤ) : ↑n.toNat + ↑(-n).toNat = ‖n‖ := by
  

Proof state:
n : ℤ
⊢ ↑(toNat n) + ↑(toNat (-n)) = ‖n‖

Next tactic:
simpa only [NNReal.coe_nat_cast, NNReal.coe_add] using
    congrArg NNReal.toReal (toNat_add_toNat_neg_eq_nnnorm n)
/-- Given a tower `A / ↥U / S / R` of algebras, where `U` is an `S`-subalgebra of `A`, reinterpret
`U` as an `R`-subalgebra of `A`. -/
def restrictScalars (U : Subalgebra S A) : Subalgebra R A :=
  { U with
    algebraMap_mem' := fun x ↦ by
      

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
M : Type v₁
inst✝¹⁰ : CommSemiring R
inst✝⁹ : CommSemiring S
inst✝⁸ : Semiring A
inst✝⁷ : Semiring B
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra S A
inst✝⁴ : Algebra R A
inst✝³ : Algebra S B
inst✝² : Algebra R B
inst✝¹ : IsScalarTower R S A
inst✝ : IsScalarTower R S B
U : Subalgebra S A
x : R
⊢ (algebraMap R A) x ∈ U.carrier

Next tactic:
rw [algebraMap_apply R S A]
/-- Given a tower `A / ↥U / S / R` of algebras, where `U` is an `S`-subalgebra of `A`, reinterpret
`U` as an `R`-subalgebra of `A`. -/
def restrictScalars (U : Subalgebra S A) : Subalgebra R A :=
  { U with
    algebraMap_mem' := fun x ↦ by
      rw [algebraMap_apply R S A]
      

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
M : Type v₁
inst✝¹⁰ : CommSemiring R
inst✝⁹ : CommSemiring S
inst✝⁸ : Semiring A
inst✝⁷ : Semiring B
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra S A
inst✝⁴ : Algebra R A
inst✝³ : Algebra S B
inst✝² : Algebra R B
inst✝¹ : IsScalarTower R S A
inst✝ : IsScalarTower R S B
U : Subalgebra S A
x : R
⊢ (algebraMap S A) ((algebraMap R S) x) ∈ U.carrier

Next tactic:
exact U.algebraMap_mem _
@[simp]
theorem restrictScalars_top : restrictScalars R (⊤ : Subalgebra S A) = ⊤ :=
  SetLike.coe_injective $ by 

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
M : Type v₁
inst✝¹⁰ : CommSemiring R
inst✝⁹ : CommSemiring S
inst✝⁸ : Semiring A
inst✝⁷ : Semiring B
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra S A
inst✝⁴ : Algebra R A
inst✝³ : Algebra S B
inst✝² : Algebra R B
inst✝¹ : IsScalarTower R S A
inst✝ : IsScalarTower R S B
⊢ ↑(restrictScalars R ⊤) = ↑⊤

Next tactic:
dsimp
theorem restrictScalars_injective :
    Function.Injective (restrictScalars R : Subalgebra S A → Subalgebra R A) := fun U V H ↦
  ext fun x ↦ by 

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
M : Type v₁
inst✝¹⁰ : CommSemiring R
inst✝⁹ : CommSemiring S
inst✝⁸ : Semiring A
inst✝⁷ : Semiring B
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra S A
inst✝⁴ : Algebra R A
inst✝³ : Algebra S B
inst✝² : Algebra R B
inst✝¹ : IsScalarTower R S A
inst✝ : IsScalarTower R S B
U V : Subalgebra S A
H : restrictScalars R U = restrictScalars R V
x : A
⊢ x ∈ U ↔ x ∈ V

Next tactic:
rw [← mem_restrictScalars R, H, mem_restrictScalars]
@[simp]
lemma range_isScalarTower_toAlgHom [CommSemiring R] [CommSemiring A]
    [Algebra R A] (S : Subalgebra R A) :
    LinearMap.range (IsScalarTower.toAlgHom R S A) = Subalgebra.toSubmodule S := by
  

Proof state:
R : Type u
S✝ : Type v
A : Type w
B : Type u₁
M : Type v₁
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
S : Subalgebra R A
⊢ LinearMap.range (toAlgHom R (↥S) A) = toSubmodule S

Next tactic:
ext
@[simp]
lemma range_isScalarTower_toAlgHom [CommSemiring R] [CommSemiring A]
    [Algebra R A] (S : Subalgebra R A) :
    LinearMap.range (IsScalarTower.toAlgHom R S A) = Subalgebra.toSubmodule S := by
  ext
  

Proof state:
case h
R : Type u
S✝ : Type v
A : Type w
B : Type u₁
M : Type v₁
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
S : Subalgebra R A
x✝ : A
⊢ x✝ ∈ LinearMap.range (toAlgHom R (↥S) A) ↔ x✝ ∈ toSubmodule S

Next tactic:
simp only [← Submodule.range_subtype (Subalgebra.toSubmodule S), LinearMap.mem_range,
    IsScalarTower.coe_toAlgHom', Subalgebra.mem_toSubmodule]
@[simp]
lemma range_isScalarTower_toAlgHom [CommSemiring R] [CommSemiring A]
    [Algebra R A] (S : Subalgebra R A) :
    LinearMap.range (IsScalarTower.toAlgHom R S A) = Subalgebra.toSubmodule S := by
  ext
  simp only [← Submodule.range_subtype (Subalgebra.toSubmodule S), LinearMap.mem_range,
    IsScalarTower.coe_toAlgHom', Subalgebra.mem_toSubmodule]
  

Proof state:
case h
R : Type u
S✝ : Type v
A : Type w
B : Type u₁
M : Type v₁
inst✝² : CommSemiring R
inst✝¹ : CommSemiring A
inst✝ : Algebra R A
S : Subalgebra R A
x✝ : A
⊢ (∃ y, (algebraMap (↥S) A) y = x✝) ↔ ∃ y, (Submodule.subtype (toSubmodule S)) y = x✝

Next tactic:
rfl
theorem adjoin_range_toAlgHom (t : Set A) :
    (Algebra.adjoin (toAlgHom R S A).range t).restrictScalars R =
      (Algebra.adjoin S t).restrictScalars R :=
  Subalgebra.ext fun z ↦
    show z ∈ Subsemiring.closure (Set.range (algebraMap (toAlgHom R S A).range A) ∪ t : Set A) ↔
         z ∈ Subsemiring.closure (Set.range (algebraMap S A) ∪ t : Set A) by
      

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
M : Type v₁
inst✝⁶ : CommSemiring R
inst✝⁵ : CommSemiring S
inst✝⁴ : CommSemiring A
inst✝³ : Algebra R S
inst✝² : Algebra S A
inst✝¹ : Algebra R A
inst✝ : IsScalarTower R S A
t : Set A
z : A
⊢ z ∈ Subsemiring.closure (Set.range ⇑(algebraMap (↥(AlgHom.range (toAlgHom R S A))) A) ∪ t) ↔
    z ∈ Subsemiring.closure (Set.range ⇑(algebraMap S A) ∪ t)

Next tactic:
suffices Set.range (algebraMap (toAlgHom R S A).range A) = Set.range (algebraMap S A) by
        rw [this]
theorem adjoin_range_toAlgHom (t : Set A) :
    (Algebra.adjoin (toAlgHom R S A).range t).restrictScalars R =
      (Algebra.adjoin S t).restrictScalars R :=
  Subalgebra.ext fun z ↦
    show z ∈ Subsemiring.closure (Set.range (algebraMap (toAlgHom R S A).range A) ∪ t : Set A) ↔
         z ∈ Subsemiring.closure (Set.range (algebraMap S A) ∪ t : Set A) by
      suffices Set.range (algebraMap (toAlgHom R S A).range A) = Set.range (algebraMap S A) by
        

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
M : Type v₁
inst✝⁶ : CommSemiring R
inst✝⁵ : CommSemiring S
inst✝⁴ : CommSemiring A
inst✝³ : Algebra R S
inst✝² : Algebra S A
inst✝¹ : Algebra R A
inst✝ : IsScalarTower R S A
t : Set A
z : A
this : Set.range ⇑(algebraMap (↥(AlgHom.range (toAlgHom R S A))) A) = Set.range ⇑(algebraMap S A)
⊢ z ∈ Subsemiring.closure (Set.range ⇑(algebraMap (↥(AlgHom.range (toAlgHom R S A))) A) ∪ t) ↔
    z ∈ Subsemiring.closure (Set.range ⇑(algebraMap S A) ∪ t)

Next tactic:
rw [this]
theorem adjoin_range_toAlgHom (t : Set A) :
    (Algebra.adjoin (toAlgHom R S A).range t).restrictScalars R =
      (Algebra.adjoin S t).restrictScalars R :=
  Subalgebra.ext fun z ↦
    show z ∈ Subsemiring.closure (Set.range (algebraMap (toAlgHom R S A).range A) ∪ t : Set A) ↔
         z ∈ Subsemiring.closure (Set.range (algebraMap S A) ∪ t : Set A) by
      suffices Set.range (algebraMap (toAlgHom R S A).range A) = Set.range (algebraMap S A) by
        rw [this]
      

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
M : Type v₁
inst✝⁶ : CommSemiring R
inst✝⁵ : CommSemiring S
inst✝⁴ : CommSemiring A
inst✝³ : Algebra R S
inst✝² : Algebra S A
inst✝¹ : Algebra R A
inst✝ : IsScalarTower R S A
t : Set A
z : A
⊢ Set.range ⇑(algebraMap (↥(AlgHom.range (toAlgHom R S A))) A) = Set.range ⇑(algebraMap S A)

Next tactic:
ext z
theorem adjoin_range_toAlgHom (t : Set A) :
    (Algebra.adjoin (toAlgHom R S A).range t).restrictScalars R =
      (Algebra.adjoin S t).restrictScalars R :=
  Subalgebra.ext fun z ↦
    show z ∈ Subsemiring.closure (Set.range (algebraMap (toAlgHom R S A).range A) ∪ t : Set A) ↔
         z ∈ Subsemiring.closure (Set.range (algebraMap S A) ∪ t : Set A) by
      suffices Set.range (algebraMap (toAlgHom R S A).range A) = Set.range (algebraMap S A) by
        rw [this]
      ext z
      

Proof state:
case h
R : Type u
S : Type v
A : Type w
B : Type u₁
M : Type v₁
inst✝⁶ : CommSemiring R
inst✝⁵ : CommSemiring S
inst✝⁴ : CommSemiring A
inst✝³ : Algebra R S
inst✝² : Algebra S A
inst✝¹ : Algebra R A
inst✝ : IsScalarTower R S A
t : Set A
z✝ z : A
⊢ z ∈ Set.range ⇑(algebraMap (↥(AlgHom.range (toAlgHom R S A))) A) ↔ z ∈ Set.range ⇑(algebraMap S A)

Next tactic:
exact ⟨fun ⟨⟨_, y, h1⟩, h2⟩ ↦ ⟨y, h2 ▸ h1⟩, fun ⟨y, hy⟩ ↦ ⟨⟨z, y, hy⟩, rfl⟩⟩
theorem inv_mem_iff {c d : C} (f : c ⟶ d) :
    Groupoid.inv f ∈ S.arrows d c ↔ f ∈ S.arrows c d := by
  

Proof state:
C : Type u
inst✝ : Groupoid C
S : Subgroupoid C
c d : C
f : c ⟶ d
⊢ Groupoid.inv f ∈ arrows S d c ↔ f ∈ arrows S c d

Next tactic:
constructor
theorem inv_mem_iff {c d : C} (f : c ⟶ d) :
    Groupoid.inv f ∈ S.arrows d c ↔ f ∈ S.arrows c d := by
  constructor
  · 

Proof state:
case mp
C : Type u
inst✝ : Groupoid C
S : Subgroupoid C
c d : C
f : c ⟶ d
⊢ Groupoid.inv f ∈ arrows S d c → f ∈ arrows S c d

Next tactic:
intro h
theorem inv_mem_iff {c d : C} (f : c ⟶ d) :
    Groupoid.inv f ∈ S.arrows d c ↔ f ∈ S.arrows c d := by
  constructor
  · intro h
    

Proof state:
case mp
C : Type u
inst✝ : Groupoid C
S : Subgroupoid C
c d : C
f : c ⟶ d
h : Groupoid.inv f ∈ arrows S d c
⊢ f ∈ arrows S c d

Next tactic:
simpa only [inv_eq_inv, IsIso.inv_inv] using S.inv h
theorem inv_mem_iff {c d : C} (f : c ⟶ d) :
    Groupoid.inv f ∈ S.arrows d c ↔ f ∈ S.arrows c d := by
  constructor
  · intro h
    simpa only [inv_eq_inv, IsIso.inv_inv] using S.inv h
  · 

Proof state:
case mpr
C : Type u
inst✝ : Groupoid C
S : Subgroupoid C
c d : C
f : c ⟶ d
⊢ f ∈ arrows S c d → Groupoid.inv f ∈ arrows S d c

Next tactic:
apply S.inv
theorem mul_mem_cancel_left {c d e : C} {f : c ⟶ d} {g : d ⟶ e} (hf : f ∈ S.arrows c d) :
    f ≫ g ∈ S.arrows c e ↔ g ∈ S.arrows d e := by
  

Proof state:
C : Type u
inst✝ : Groupoid C
S : Subgroupoid C
c d e : C
f : c ⟶ d
g : d ⟶ e
hf : f ∈ arrows S c d
⊢ f ≫ g ∈ arrows S c e ↔ g ∈ arrows S d e

Next tactic:
constructor
theorem mul_mem_cancel_left {c d e : C} {f : c ⟶ d} {g : d ⟶ e} (hf : f ∈ S.arrows c d) :
    f ≫ g ∈ S.arrows c e ↔ g ∈ S.arrows d e := by
  constructor
  · 

Proof state:
case mp
C : Type u
inst✝ : Groupoid C
S : Subgroupoid C
c d e : C
f : c ⟶ d
g : d ⟶ e
hf : f ∈ arrows S c d
⊢ f ≫ g ∈ arrows S c e → g ∈ arrows S d e

Next tactic:
rintro h
theorem mul_mem_cancel_left {c d e : C} {f : c ⟶ d} {g : d ⟶ e} (hf : f ∈ S.arrows c d) :
    f ≫ g ∈ S.arrows c e ↔ g ∈ S.arrows d e := by
  constructor
  · rintro h
    

Proof state:
case mp
C : Type u
inst✝ : Groupoid C
S : Subgroupoid C
c d e : C
f : c ⟶ d
g : d ⟶ e
hf : f ∈ arrows S c d
h : f ≫ g ∈ arrows S c e
⊢ g ∈ arrows S d e

Next tactic:
suffices Groupoid.inv f ≫ f ≫ g ∈ S.arrows d e by
      simpa only [inv_eq_inv, IsIso.inv_hom_id_assoc] using this
theorem mul_mem_cancel_left {c d e : C} {f : c ⟶ d} {g : d ⟶ e} (hf : f ∈ S.arrows c d) :
    f ≫ g ∈ S.arrows c e ↔ g ∈ S.arrows d e := by
  constructor
  · rintro h
    suffices Groupoid.inv f ≫ f ≫ g ∈ S.arrows d e by
      

Proof state:
C : Type u
inst✝ : Groupoid C
S : Subgroupoid C
c d e : C
f : c ⟶ d
g : d ⟶ e
hf : f ∈ arrows S c d
h : f ≫ g ∈ arrows S c e
this : Groupoid.inv f ≫ f ≫ g ∈ arrows S d e
⊢ g ∈ arrows S d e

Next tactic:
simpa only [inv_eq_inv, IsIso.inv_hom_id_assoc] using this
theorem mul_mem_cancel_left {c d e : C} {f : c ⟶ d} {g : d ⟶ e} (hf : f ∈ S.arrows c d) :
    f ≫ g ∈ S.arrows c e ↔ g ∈ S.arrows d e := by
  constructor
  · rintro h
    suffices Groupoid.inv f ≫ f ≫ g ∈ S.arrows d e by
      simpa only [inv_eq_inv, IsIso.inv_hom_id_assoc] using this
    · 

Proof state:
case mp
C : Type u
inst✝ : Groupoid C
S : Subgroupoid C
c d e : C
f : c ⟶ d
g : d ⟶ e
hf : f ∈ arrows S c d
h : f ≫ g ∈ arrows S c e
⊢ Groupoid.inv f ≫ f ≫ g ∈ arrows S d e

Next tactic:
apply S.mul (S.inv hf) h
theorem mul_mem_cancel_left {c d e : C} {f : c ⟶ d} {g : d ⟶ e} (hf : f ∈ S.arrows c d) :
    f ≫ g ∈ S.arrows c e ↔ g ∈ S.arrows d e := by
  constructor
  · rintro h
    suffices Groupoid.inv f ≫ f ≫ g ∈ S.arrows d e by
      simpa only [inv_eq_inv, IsIso.inv_hom_id_assoc] using this
    · apply S.mul (S.inv hf) h
  · 

Proof state:
case mpr
C : Type u
inst✝ : Groupoid C
S : Subgroupoid C
c d e : C
f : c ⟶ d
g : d ⟶ e
hf : f ∈ arrows S c d
⊢ g ∈ arrows S d e → f ≫ g ∈ arrows S c e

Next tactic:
apply S.mul hf