l3lab/ntp-mathlib huggingface dataset:
theorem linearIndependent_smul {ι : Type v₁} {b : ι → S} {ι' : Type w₁} {c : ι' → A}
    (hb : LinearIndependent R b) (hc : LinearIndependent S c) :
    LinearIndependent R fun p : ι × ι' => b p.1 • c p.2 := by
  rw [linearIndependent_iff'] at hb hc; rw [linearIndependent_iff'']; rintro s g hg hsg ⟨i, k⟩
  by_cases hik : (i, k) ∈ s
  · have h1 : ∑ i in s.image Prod.fst ×ˢ s.image Prod.snd, g i • b i.1 • c i.2 = 0 := by
      

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
b : ι → S
ι' : Type w₁
c : ι' → A
hb : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
hc : ∀ (s : Finset ι') (g : ι' → S), ∑ i in s, g i • c i = 0 → ∀ i ∈ s, g i = 0
s : Finset (ι × ι')
g : ι × ι' → R
hg : ∀ i ∉ s, g i = 0
hsg : ∑ i in s, g i • b i.1 • c i.2 = 0
i : ι
k : ι'
hik : (i, k) ∈ s
⊢ ∑ i in Finset.image Prod.fst s ×ˢ Finset.image Prod.snd s, g i • b i.1 • c i.2 = 0

Next tactic:
rw [← hsg]
theorem linearIndependent_smul {ι : Type v₁} {b : ι → S} {ι' : Type w₁} {c : ι' → A}
    (hb : LinearIndependent R b) (hc : LinearIndependent S c) :
    LinearIndependent R fun p : ι × ι' => b p.1 • c p.2 := by
  rw [linearIndependent_iff'] at hb hc; rw [linearIndependent_iff'']; rintro s g hg hsg ⟨i, k⟩
  by_cases hik : (i, k) ∈ s
  · have h1 : ∑ i in s.image Prod.fst ×ˢ s.image Prod.snd, g i • b i.1 • c i.2 = 0 := by
      rw [← hsg]
      

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
b : ι → S
ι' : Type w₁
c : ι' → A
hb : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
hc : ∀ (s : Finset ι') (g : ι' → S), ∑ i in s, g i • c i = 0 → ∀ i ∈ s, g i = 0
s : Finset (ι × ι')
g : ι × ι' → R
hg : ∀ i ∉ s, g i = 0
hsg : ∑ i in s, g i • b i.1 • c i.2 = 0
i : ι
k : ι'
hik : (i, k) ∈ s
⊢ ∑ i in Finset.image Prod.fst s ×ˢ Finset.image Prod.snd s, g i • b i.1 • c i.2 = ∑ i in s, g i • b i.1 • c i.2

Next tactic:
exact
        (Finset.sum_subset Finset.subset_product fun p _ hp =>
            show g p • b p.1 • c p.2 = 0 by rw [hg p hp, zero_smul]).symm
theorem linearIndependent_smul {ι : Type v₁} {b : ι → S} {ι' : Type w₁} {c : ι' → A}
    (hb : LinearIndependent R b) (hc : LinearIndependent S c) :
    LinearIndependent R fun p : ι × ι' => b p.1 • c p.2 := by
  rw [linearIndependent_iff'] at hb hc; rw [linearIndependent_iff'']; rintro s g hg hsg ⟨i, k⟩
  by_cases hik : (i, k) ∈ s
  · have h1 : ∑ i in s.image Prod.fst ×ˢ s.image Prod.snd, g i • b i.1 • c i.2 = 0 := by
      rw [← hsg]
      exact
        (Finset.sum_subset Finset.subset_product fun p _ hp =>
            show g p • b p.1 • c p.2 = 0 by 

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
b : ι → S
ι' : Type w₁
c : ι' → A
hb : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
hc : ∀ (s : Finset ι') (g : ι' → S), ∑ i in s, g i • c i = 0 → ∀ i ∈ s, g i = 0
s : Finset (ι × ι')
g : ι × ι' → R
hg : ∀ i ∉ s, g i = 0
hsg : ∑ i in s, g i • b i.1 • c i.2 = 0
i : ι
k : ι'
hik : (i, k) ∈ s
p : ι × ι'
x✝ : p ∈ Finset.image Prod.fst s ×ˢ Finset.image Prod.snd s
hp : p ∉ s
⊢ g p • b p.1 • c p.2 = 0

Next tactic:
rw [hg p hp, zero_smul]
theorem linearIndependent_smul {ι : Type v₁} {b : ι → S} {ι' : Type w₁} {c : ι' → A}
    (hb : LinearIndependent R b) (hc : LinearIndependent S c) :
    LinearIndependent R fun p : ι × ι' => b p.1 • c p.2 := by
  rw [linearIndependent_iff'] at hb hc; rw [linearIndependent_iff'']; rintro s g hg hsg ⟨i, k⟩
  by_cases hik : (i, k) ∈ s
  · have h1 : ∑ i in s.image Prod.fst ×ˢ s.image Prod.snd, g i • b i.1 • c i.2 = 0 := by
      rw [← hsg]
      exact
        (Finset.sum_subset Finset.subset_product fun p _ hp =>
            show g p • b p.1 • c p.2 = 0 by rw [hg p hp, zero_smul]).symm
    

Proof state:
case pos
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
b : ι → S
ι' : Type w₁
c : ι' → A
hb : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
hc : ∀ (s : Finset ι') (g : ι' → S), ∑ i in s, g i • c i = 0 → ∀ i ∈ s, g i = 0
s : Finset (ι × ι')
g : ι × ι' → R
hg : ∀ i ∉ s, g i = 0
hsg : ∑ i in s, g i • b i.1 • c i.2 = 0
i : ι
k : ι'
hik : (i, k) ∈ s
h1 : ∑ i in Finset.image Prod.fst s ×ˢ Finset.image Prod.snd s, g i • b i.1 • c i.2 = 0
⊢ g (i, k) = 0

Next tactic:
rw [Finset.sum_product_right] at h1
theorem linearIndependent_smul {ι : Type v₁} {b : ι → S} {ι' : Type w₁} {c : ι' → A}
    (hb : LinearIndependent R b) (hc : LinearIndependent S c) :
    LinearIndependent R fun p : ι × ι' => b p.1 • c p.2 := by
  rw [linearIndependent_iff'] at hb hc; rw [linearIndependent_iff'']; rintro s g hg hsg ⟨i, k⟩
  by_cases hik : (i, k) ∈ s
  · have h1 : ∑ i in s.image Prod.fst ×ˢ s.image Prod.snd, g i • b i.1 • c i.2 = 0 := by
      rw [← hsg]
      exact
        (Finset.sum_subset Finset.subset_product fun p _ hp =>
            show g p • b p.1 • c p.2 = 0 by rw [hg p hp, zero_smul]).symm
    rw [Finset.sum_product_right] at h1
    

Proof state:
case pos
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
b : ι → S
ι' : Type w₁
c : ι' → A
hb : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
hc : ∀ (s : Finset ι') (g : ι' → S), ∑ i in s, g i • c i = 0 → ∀ i ∈ s, g i = 0
s : Finset (ι × ι')
g : ι × ι' → R
hg : ∀ i ∉ s, g i = 0
hsg : ∑ i in s, g i • b i.1 • c i.2 = 0
i : ι
k : ι'
hik : (i, k) ∈ s
h1 : ∑ y in Finset.image Prod.snd s, ∑ x in Finset.image Prod.fst s, g (x, y) • b (x, y).1 • c (x, y).2 = 0
⊢ g (i, k) = 0

Next tactic:
simp_rw [← smul_assoc, ← Finset.sum_smul] at h1
theorem linearIndependent_smul {ι : Type v₁} {b : ι → S} {ι' : Type w₁} {c : ι' → A}
    (hb : LinearIndependent R b) (hc : LinearIndependent S c) :
    LinearIndependent R fun p : ι × ι' => b p.1 • c p.2 := by
  rw [linearIndependent_iff'] at hb hc; rw [linearIndependent_iff'']; rintro s g hg hsg ⟨i, k⟩
  by_cases hik : (i, k) ∈ s
  · have h1 : ∑ i in s.image Prod.fst ×ˢ s.image Prod.snd, g i • b i.1 • c i.2 = 0 := by
      rw [← hsg]
      exact
        (Finset.sum_subset Finset.subset_product fun p _ hp =>
            show g p • b p.1 • c p.2 = 0 by rw [hg p hp, zero_smul]).symm
    rw [Finset.sum_product_right] at h1
    simp_rw [← smul_assoc, ← Finset.sum_smul] at h1
    

Proof state:
case pos
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
b : ι → S
ι' : Type w₁
c : ι' → A
hb : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
hc : ∀ (s : Finset ι') (g : ι' → S), ∑ i in s, g i • c i = 0 → ∀ i ∈ s, g i = 0
s : Finset (ι × ι')
g : ι × ι' → R
hg : ∀ i ∉ s, g i = 0
hsg : ∑ i in s, g i • b i.1 • c i.2 = 0
i : ι
k : ι'
hik : (i, k) ∈ s
h1 : ∑ x in Finset.image Prod.snd s, (∑ i in Finset.image Prod.fst s, g (i, x) • b i) • c x = 0
⊢ g (i, k) = 0

Next tactic:
exact hb _ _ (hc _ _ h1 k (Finset.mem_image_of_mem _ hik)) i (Finset.mem_image_of_mem _ hik)
theorem linearIndependent_smul {ι : Type v₁} {b : ι → S} {ι' : Type w₁} {c : ι' → A}
    (hb : LinearIndependent R b) (hc : LinearIndependent S c) :
    LinearIndependent R fun p : ι × ι' => b p.1 • c p.2 := by
  rw [linearIndependent_iff'] at hb hc; rw [linearIndependent_iff'']; rintro s g hg hsg ⟨i, k⟩
  by_cases hik : (i, k) ∈ s
  · have h1 : ∑ i in s.image Prod.fst ×ˢ s.image Prod.snd, g i • b i.1 • c i.2 = 0 := by
      rw [← hsg]
      exact
        (Finset.sum_subset Finset.subset_product fun p _ hp =>
            show g p • b p.1 • c p.2 = 0 by rw [hg p hp, zero_smul]).symm
    rw [Finset.sum_product_right] at h1
    simp_rw [← smul_assoc, ← Finset.sum_smul] at h1
    exact hb _ _ (hc _ _ h1 k (Finset.mem_image_of_mem _ hik)) i (Finset.mem_image_of_mem _ hik)
  

Proof state:
case neg
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
b : ι → S
ι' : Type w₁
c : ι' → A
hb : ∀ (s : Finset ι) (g : ι → R), ∑ i in s, g i • b i = 0 → ∀ i ∈ s, g i = 0
hc : ∀ (s : Finset ι') (g : ι' → S), ∑ i in s, g i • c i = 0 → ∀ i ∈ s, g i = 0
s : Finset (ι × ι')
g : ι × ι' → R
hg : ∀ i ∉ s, g i = 0
hsg : ∑ i in s, g i • b i.1 • c i.2 = 0
i : ι
k : ι'
hik : (i, k) ∉ s
⊢ g (i, k) = 0

Next tactic:
exact hg _ hik
@[simp]
theorem Basis.smul_repr {ι : Type v₁} {ι' : Type w₁} (b : Basis ι R S) (c : Basis ι' S A) (x ij) :
    (b.smul c).repr x ij = b.repr (c.repr x ij.2) ij.1 := by 

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
ι' : Type w₁
b : Basis ι R S
c : Basis ι' S A
x : A
ij : ι × ι'
⊢ ((smul b c).repr x) ij = (b.repr ((c.repr x) ij.2)) ij.1

Next tactic:
simp [Basis.smul]
@[simp]
theorem Basis.smul_apply {ι : Type v₁} {ι' : Type w₁} (b : Basis ι R S) (c : Basis ι' S A) (ij) :
    (b.smul c) ij = b ij.1 • c ij.2 := by
  

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
ι' : Type w₁
b : Basis ι R S
c : Basis ι' S A
ij : ι × ι'
⊢ (smul b c) ij = b ij.1 • c ij.2

Next tactic:
obtain ⟨i, j⟩ := ij
@[simp]
theorem Basis.smul_apply {ι : Type v₁} {ι' : Type w₁} (b : Basis ι R S) (c : Basis ι' S A) (ij) :
    (b.smul c) ij = b ij.1 • c ij.2 := by
  obtain ⟨i, j⟩ := ij
  

Proof state:
case mk
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
ι' : Type w₁
b : Basis ι R S
c : Basis ι' S A
i : ι
j : ι'
⊢ (smul b c) (i, j) = b (i, j).1 • c (i, j).2

Next tactic:
rw [Basis.apply_eq_iff]
@[simp]
theorem Basis.smul_apply {ι : Type v₁} {ι' : Type w₁} (b : Basis ι R S) (c : Basis ι' S A) (ij) :
    (b.smul c) ij = b ij.1 • c ij.2 := by
  obtain ⟨i, j⟩ := ij
  rw [Basis.apply_eq_iff]
  

Proof state:
case mk
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
ι' : Type w₁
b : Basis ι R S
c : Basis ι' S A
i : ι
j : ι'
⊢ (smul b c).repr (b (i, j).1 • c (i, j).2) = fun₀ | (i, j) => 1

Next tactic:
ext ⟨i', j'⟩
@[simp]
theorem Basis.smul_apply {ι : Type v₁} {ι' : Type w₁} (b : Basis ι R S) (c : Basis ι' S A) (ij) :
    (b.smul c) ij = b ij.1 • c ij.2 := by
  obtain ⟨i, j⟩ := ij
  rw [Basis.apply_eq_iff]
  ext ⟨i', j'⟩
  

Proof state:
case mk.h.mk
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
ι' : Type w₁
b : Basis ι R S
c : Basis ι' S A
i : ι
j : ι'
i' : ι
j' : ι'
⊢ ((smul b c).repr (b (i, j).1 • c (i, j).2)) (i', j') = (fun₀ | (i, j) => 1) (i', j')

Next tactic:
rw [Basis.smul_repr, LinearEquiv.map_smul, Basis.repr_self, Finsupp.smul_apply,
    Finsupp.single_apply]
@[simp]
theorem Basis.smul_apply {ι : Type v₁} {ι' : Type w₁} (b : Basis ι R S) (c : Basis ι' S A) (ij) :
    (b.smul c) ij = b ij.1 • c ij.2 := by
  obtain ⟨i, j⟩ := ij
  rw [Basis.apply_eq_iff]
  ext ⟨i', j'⟩
  rw [Basis.smul_repr, LinearEquiv.map_smul, Basis.repr_self, Finsupp.smul_apply,
    Finsupp.single_apply]
  

Proof state:
case mk.h.mk
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
ι' : Type w₁
b : Basis ι R S
c : Basis ι' S A
i : ι
j : ι'
i' : ι
j' : ι'
⊢ (b.repr (b (i, j).1 • if (i, j).2 = (i', j').2 then 1 else 0)) (i', j').1 = (fun₀ | (i, j) => 1) (i', j')

Next tactic:
dsimp only
@[simp]
theorem Basis.smul_apply {ι : Type v₁} {ι' : Type w₁} (b : Basis ι R S) (c : Basis ι' S A) (ij) :
    (b.smul c) ij = b ij.1 • c ij.2 := by
  obtain ⟨i, j⟩ := ij
  rw [Basis.apply_eq_iff]
  ext ⟨i', j'⟩
  rw [Basis.smul_repr, LinearEquiv.map_smul, Basis.repr_self, Finsupp.smul_apply,
    Finsupp.single_apply]
  dsimp only
  

Proof state:
case mk.h.mk
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
ι' : Type w₁
b : Basis ι R S
c : Basis ι' S A
i : ι
j : ι'
i' : ι
j' : ι'
⊢ (b.repr (b i • if j = j' then 1 else 0)) i' = (fun₀ | (i, j) => 1) (i', j')

Next tactic:
split_ifs with hi
@[simp]
theorem Basis.smul_apply {ι : Type v₁} {ι' : Type w₁} (b : Basis ι R S) (c : Basis ι' S A) (ij) :
    (b.smul c) ij = b ij.1 • c ij.2 := by
  obtain ⟨i, j⟩ := ij
  rw [Basis.apply_eq_iff]
  ext ⟨i', j'⟩
  rw [Basis.smul_repr, LinearEquiv.map_smul, Basis.repr_self, Finsupp.smul_apply,
    Finsupp.single_apply]
  dsimp only
  split_ifs with hi
  · 

Proof state:
case pos
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
ι' : Type w₁
b : Basis ι R S
c : Basis ι' S A
i : ι
j : ι'
i' : ι
j' : ι'
hi : j = j'
⊢ (b.repr (b i • 1)) i' = (fun₀ | (i, j) => 1) (i', j')

Next tactic:
simp [hi, Finsupp.single_apply]
@[simp]
theorem Basis.smul_apply {ι : Type v₁} {ι' : Type w₁} (b : Basis ι R S) (c : Basis ι' S A) (ij) :
    (b.smul c) ij = b ij.1 • c ij.2 := by
  obtain ⟨i, j⟩ := ij
  rw [Basis.apply_eq_iff]
  ext ⟨i', j'⟩
  rw [Basis.smul_repr, LinearEquiv.map_smul, Basis.repr_self, Finsupp.smul_apply,
    Finsupp.single_apply]
  dsimp only
  split_ifs with hi
  · simp [hi, Finsupp.single_apply]
  · 

Proof state:
case neg
R : Type u
S : Type v
A : Type w
B : Type u₁
inst✝⁶ : CommSemiring R
inst✝⁵ : Semiring S
inst✝⁴ : AddCommMonoid A
inst✝³ : Algebra R S
inst✝² : Module S A
inst✝¹ : Module R A
inst✝ : IsScalarTower R S A
ι : Type v₁
ι' : Type w₁
b : Basis ι R S
c : Basis ι' S A
i : ι
j : ι'
i' : ι
j' : ι'
hi : ¬j = j'
⊢ (b.repr (b i • 0)) i' = (fun₀ | (i, j) => 1) (i', j')

Next tactic:
simp [hi]
/-- Extend the scalars of an `AlgHom`. -/
def AlgHom.extendScalars : @AlgHom B C D _ _ _ _ (f.restrictDomain B).toRingHom.toAlgebra where
  toFun := f.toFun
  map_one' := by 

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
C : Type u_1
D : Type u_2
inst✝⁸ : CommSemiring A
inst✝⁷ : CommSemiring C
inst✝⁶ : CommSemiring D
inst✝⁵ : Algebra A C
inst✝⁴ : Algebra A D
f : C →ₐ[A] D
inst✝³ : CommSemiring B
inst✝² : Algebra A B
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
src✝ : Algebra B D := RingHom.toAlgebra ↑(restrictDomain B f)
⊢ OneHom.toFun (↑↑↑f) 1 = 1

Next tactic:
simp only [toRingHom_eq_coe, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe,
    map_one]
/-- Extend the scalars of an `AlgHom`. -/
def AlgHom.extendScalars : @AlgHom B C D _ _ _ _ (f.restrictDomain B).toRingHom.toAlgebra where
  toFun := f.toFun
  map_one' := by simp only [toRingHom_eq_coe, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe,
    map_one]
  map_mul' := by 

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
C : Type u_1
D : Type u_2
inst✝⁸ : CommSemiring A
inst✝⁷ : CommSemiring C
inst✝⁶ : CommSemiring D
inst✝⁵ : Algebra A C
inst✝⁴ : Algebra A D
f : C →ₐ[A] D
inst✝³ : CommSemiring B
inst✝² : Algebra A B
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
src✝ : Algebra B D := RingHom.toAlgebra ↑(restrictDomain B f)
⊢ ∀ (x y : C),
    OneHom.toFun { toFun := f.toFun, map_one' := (_ : ↑↑↑f 1 = 1) } (x * y) =
      OneHom.toFun { toFun := f.toFun, map_one' := (_ : ↑↑↑f 1 = 1) } x *
        OneHom.toFun { toFun := f.toFun, map_one' := (_ : ↑↑↑f 1 = 1) } y

Next tactic:
simp only [toRingHom_eq_coe, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe,
    MonoidHom.toOneHom_coe, map_mul, MonoidHom.coe_coe, RingHom.coe_coe, forall_const]
/-- Extend the scalars of an `AlgHom`. -/
def AlgHom.extendScalars : @AlgHom B C D _ _ _ _ (f.restrictDomain B).toRingHom.toAlgebra where
  toFun := f.toFun
  map_one' := by simp only [toRingHom_eq_coe, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe,
    map_one]
  map_mul' := by simp only [toRingHom_eq_coe, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe,
    MonoidHom.toOneHom_coe, map_mul, MonoidHom.coe_coe, RingHom.coe_coe, forall_const]
  map_zero' := by 

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
C : Type u_1
D : Type u_2
inst✝⁸ : CommSemiring A
inst✝⁷ : CommSemiring C
inst✝⁶ : CommSemiring D
inst✝⁵ : Algebra A C
inst✝⁴ : Algebra A D
f : C →ₐ[A] D
inst✝³ : CommSemiring B
inst✝² : Algebra A B
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
src✝ : Algebra B D := RingHom.toAlgebra ↑(restrictDomain B f)
⊢ OneHom.toFun
      (↑{ toOneHom := { toFun := f.toFun, map_one' := (_ : ↑↑↑f 1 = 1) },
          map_mul' := (_ : ∀ (a a_1 : C), ↑↑f (a * a_1) = f a * f a_1) })
      0 =
    0

Next tactic:
simp only [toRingHom_eq_coe, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe,
    MonoidHom.toOneHom_coe, MonoidHom.coe_coe, map_zero]
/-- Extend the scalars of an `AlgHom`. -/
def AlgHom.extendScalars : @AlgHom B C D _ _ _ _ (f.restrictDomain B).toRingHom.toAlgebra where
  toFun := f.toFun
  map_one' := by simp only [toRingHom_eq_coe, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe,
    map_one]
  map_mul' := by simp only [toRingHom_eq_coe, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe,
    MonoidHom.toOneHom_coe, map_mul, MonoidHom.coe_coe, RingHom.coe_coe, forall_const]
  map_zero' := by simp only [toRingHom_eq_coe, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe,
    MonoidHom.toOneHom_coe, MonoidHom.coe_coe, map_zero]
  map_add' := by 

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
C : Type u_1
D : Type u_2
inst✝⁸ : CommSemiring A
inst✝⁷ : CommSemiring C
inst✝⁶ : CommSemiring D
inst✝⁵ : Algebra A C
inst✝⁴ : Algebra A D
f : C →ₐ[A] D
inst✝³ : CommSemiring B
inst✝² : Algebra A B
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
src✝ : Algebra B D := RingHom.toAlgebra ↑(restrictDomain B f)
⊢ ∀ (x y : C),
    OneHom.toFun
        (↑{ toOneHom := { toFun := f.toFun, map_one' := (_ : ↑↑↑f 1 = 1) },
            map_mul' := (_ : ∀ (a a_1 : C), ↑↑f (a * a_1) = f a * f a_1) })
        (x + y) =
      OneHom.toFun
          (↑{ toOneHom := { toFun := f.toFun, map_one' := (_ : ↑↑↑f 1 = 1) },
              map_mul' := (_ : ∀ (a a_1 : C), ↑↑f (a * a_1) = f a * f a_1) })
          x +
        OneHom.toFun
          (↑{ toOneHom := { toFun := f.toFun, map_one' := (_ : ↑↑↑f 1 = 1) },
              map_mul' := (_ : ∀ (a a_1 : C), ↑↑f (a * a_1) = f a * f a_1) })
          y

Next tactic:
simp only [toRingHom_eq_coe, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe,
    MonoidHom.toOneHom_coe, MonoidHom.coe_coe, map_add, RingHom.coe_coe, forall_const]
/-- `AlgHom`s from the top of a tower are equivalent to a pair of `AlgHom`s. -/
def algHomEquivSigma : (C →ₐ[A] D) ≃ Σf : B →ₐ[A] D, @AlgHom B C D _ _ _ _ f.toRingHom.toAlgebra
    where
  toFun f := ⟨f.restrictDomain B, f.extendScalars B⟩
  invFun fg :=
    let _ := fg.1.toRingHom.toAlgebra
    fg.2.restrictScalars A
  left_inv f := by
    

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
C : Type u_1
D : Type u_2
inst✝⁸ : CommSemiring A
inst✝⁷ : CommSemiring C
inst✝⁶ : CommSemiring D
inst✝⁵ : Algebra A C
inst✝⁴ : Algebra A D
f✝ : C →ₐ[A] D
inst✝³ : CommSemiring B
inst✝² : Algebra A B
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
f : C →ₐ[A] D
⊢ (fun fg =>
        let x := RingHom.toAlgebra ↑fg.fst;
        AlgHom.restrictScalars A fg.snd)
      ((fun f => { fst := AlgHom.restrictDomain B f, snd := AlgHom.extendScalars B f }) f) =
    f

Next tactic:
dsimp only
/-- `AlgHom`s from the top of a tower are equivalent to a pair of `AlgHom`s. -/
def algHomEquivSigma : (C →ₐ[A] D) ≃ Σf : B →ₐ[A] D, @AlgHom B C D _ _ _ _ f.toRingHom.toAlgebra
    where
  toFun f := ⟨f.restrictDomain B, f.extendScalars B⟩
  invFun fg :=
    let _ := fg.1.toRingHom.toAlgebra
    fg.2.restrictScalars A
  left_inv f := by
    dsimp only
    

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
C : Type u_1
D : Type u_2
inst✝⁸ : CommSemiring A
inst✝⁷ : CommSemiring C
inst✝⁶ : CommSemiring D
inst✝⁵ : Algebra A C
inst✝⁴ : Algebra A D
f✝ : C →ₐ[A] D
inst✝³ : CommSemiring B
inst✝² : Algebra A B
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
f : C →ₐ[A] D
⊢ AlgHom.restrictScalars A (AlgHom.extendScalars B f) = f

Next tactic:
ext
/-- `AlgHom`s from the top of a tower are equivalent to a pair of `AlgHom`s. -/
def algHomEquivSigma : (C →ₐ[A] D) ≃ Σf : B →ₐ[A] D, @AlgHom B C D _ _ _ _ f.toRingHom.toAlgebra
    where
  toFun f := ⟨f.restrictDomain B, f.extendScalars B⟩
  invFun fg :=
    let _ := fg.1.toRingHom.toAlgebra
    fg.2.restrictScalars A
  left_inv f := by
    dsimp only
    ext
    

Proof state:
case H
R : Type u
S : Type v
A : Type w
B : Type u₁
C : Type u_1
D : Type u_2
inst✝⁸ : CommSemiring A
inst✝⁷ : CommSemiring C
inst✝⁶ : CommSemiring D
inst✝⁵ : Algebra A C
inst✝⁴ : Algebra A D
f✝ : C →ₐ[A] D
inst✝³ : CommSemiring B
inst✝² : Algebra A B
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
f : C →ₐ[A] D
x✝ : C
⊢ (AlgHom.restrictScalars A (AlgHom.extendScalars B f)) x✝ = f x✝

Next tactic:
rfl
/-- `AlgHom`s from the top of a tower are equivalent to a pair of `AlgHom`s. -/
def algHomEquivSigma : (C →ₐ[A] D) ≃ Σf : B →ₐ[A] D, @AlgHom B C D _ _ _ _ f.toRingHom.toAlgebra
    where
  toFun f := ⟨f.restrictDomain B, f.extendScalars B⟩
  invFun fg :=
    let _ := fg.1.toRingHom.toAlgebra
    fg.2.restrictScalars A
  left_inv f := by
    dsimp only
    ext
    rfl
  right_inv := by
    

Proof state:
R : Type u
S : Type v
A : Type w
B : Type u₁
C : Type u_1
D : Type u_2
inst✝⁸ : CommSemiring A
inst✝⁷ : CommSemiring C
inst✝⁶ : CommSemiring D
inst✝⁵ : Algebra A C
inst✝⁴ : Algebra A D
f : C →ₐ[A] D
inst✝³ : CommSemiring B
inst✝² : Algebra A B
inst✝¹ : Algebra B C
inst✝ : IsScalarTower A B C
⊢ Function.RightInverse
    (fun fg =>
      let x := RingHom.toAlgebra ↑fg.fst;
      AlgHom.restrictScalars A fg.snd)
    fun f => { fst := AlgHom.restrictDomain B f, snd := AlgHom.extendScalars B f }

Next tactic:
rintro ⟨⟨⟨⟨⟨f, _⟩, _⟩, _⟩, _⟩, ⟨⟨⟨⟨g, _⟩, _⟩, _⟩, hg⟩⟩