l3lab/ntp-mathlib huggingface dataset:
/-- For a fiber bundle `E` over `B` constructed using the `FiberPrebundle` mechanism,
continuity of a function `TotalSpace F E → X` on an open set `s` can be checked by precomposing at
each point with the pretrivialization used for the construction at that point. -/
theorem continuousOn_of_comp_right {X : Type*} [TopologicalSpace X] {f : TotalSpace F E → X}
    {s : Set B} (hs : IsOpen s) (hf : ∀ b ∈ s,
      ContinuousOn (f ∘ (a.pretrivializationAt b).toPartialEquiv.symm)
        ((s ∩ (a.pretrivializationAt b).baseSet) ×ˢ (Set.univ : Set F))) :
    @ContinuousOn _ _ a.totalSpaceTopology _ f (π F E ⁻¹' s) := by
  letI := a.totalSpaceTopology
  intro z hz
  

Proof state:
ι : Type u_1
B : Type u_2
F : Type u_3
X✝ : Type u_4
inst✝⁴ : TopologicalSpace X✝
E : B → Type u_5
inst✝³ : TopologicalSpace B
inst✝² : TopologicalSpace F
inst✝¹ : (x : B) → TopologicalSpace (E x)
a : FiberPrebundle F E
e : Pretrivialization F TotalSpace.proj
X : Type u_6
inst✝ : TopologicalSpace X
f : TotalSpace F E → X
s : Set B
hs : IsOpen s
hf :
  ∀ b ∈ s,
    ContinuousOn (f ∘ ↑(PartialEquiv.symm (pretrivializationAt a b).toPartialEquiv))
      ((s ∩ (pretrivializationAt a b).baseSet) ×ˢ univ)
this : TopologicalSpace (TotalSpace F E) := totalSpaceTopology a
z : TotalSpace F E
hz : z ∈ TotalSpace.proj ⁻¹' s
⊢ ContinuousWithinAt f (TotalSpace.proj ⁻¹' s) z

Next tactic:
let e : Trivialization F (π F E) :=
    a.trivializationOfMemPretrivializationAtlas (a.pretrivialization_mem_atlas z.proj)
/-- For a fiber bundle `E` over `B` constructed using the `FiberPrebundle` mechanism,
continuity of a function `TotalSpace F E → X` on an open set `s` can be checked by precomposing at
each point with the pretrivialization used for the construction at that point. -/
theorem continuousOn_of_comp_right {X : Type*} [TopologicalSpace X] {f : TotalSpace F E → X}
    {s : Set B} (hs : IsOpen s) (hf : ∀ b ∈ s,
      ContinuousOn (f ∘ (a.pretrivializationAt b).toPartialEquiv.symm)
        ((s ∩ (a.pretrivializationAt b).baseSet) ×ˢ (Set.univ : Set F))) :
    @ContinuousOn _ _ a.totalSpaceTopology _ f (π F E ⁻¹' s) := by
  letI := a.totalSpaceTopology
  intro z hz
  let e : Trivialization F (π F E) :=
    a.trivializationOfMemPretrivializationAtlas (a.pretrivialization_mem_atlas z.proj)
  

Proof state:
ι : Type u_1
B : Type u_2
F : Type u_3
X✝ : Type u_4
inst✝⁴ : TopologicalSpace X✝
E : B → Type u_5
inst✝³ : TopologicalSpace B
inst✝² : TopologicalSpace F
inst✝¹ : (x : B) → TopologicalSpace (E x)
a : FiberPrebundle F E
e✝ : Pretrivialization F TotalSpace.proj
X : Type u_6
inst✝ : TopologicalSpace X
f : TotalSpace F E → X
s : Set B
hs : IsOpen s
hf :
  ∀ b ∈ s,
    ContinuousOn (f ∘ ↑(PartialEquiv.symm (pretrivializationAt a b).toPartialEquiv))
      ((s ∩ (pretrivializationAt a b).baseSet) ×ˢ univ)
this : TopologicalSpace (TotalSpace F E) := totalSpaceTopology a
z : TotalSpace F E
hz : z ∈ TotalSpace.proj ⁻¹' s
e : Trivialization F TotalSpace.proj :=
  trivializationOfMemPretrivializationAtlas a (_ : pretrivializationAt a z.proj ∈ a.pretrivializationAtlas)
⊢ ContinuousWithinAt f (TotalSpace.proj ⁻¹' s) z

Next tactic:
refine' (e.continuousAt_of_comp_right _
    ((hf z.proj hz).continuousAt (IsOpen.mem_nhds _ _))).continuousWithinAt
/-- For a fiber bundle `E` over `B` constructed using the `FiberPrebundle` mechanism,
continuity of a function `TotalSpace F E → X` on an open set `s` can be checked by precomposing at
each point with the pretrivialization used for the construction at that point. -/
theorem continuousOn_of_comp_right {X : Type*} [TopologicalSpace X] {f : TotalSpace F E → X}
    {s : Set B} (hs : IsOpen s) (hf : ∀ b ∈ s,
      ContinuousOn (f ∘ (a.pretrivializationAt b).toPartialEquiv.symm)
        ((s ∩ (a.pretrivializationAt b).baseSet) ×ˢ (Set.univ : Set F))) :
    @ContinuousOn _ _ a.totalSpaceTopology _ f (π F E ⁻¹' s) := by
  letI := a.totalSpaceTopology
  intro z hz
  let e : Trivialization F (π F E) :=
    a.trivializationOfMemPretrivializationAtlas (a.pretrivialization_mem_atlas z.proj)
  refine' (e.continuousAt_of_comp_right _
    ((hf z.proj hz).continuousAt (IsOpen.mem_nhds _ _))).continuousWithinAt
  · 

Proof state:
case refine'_1
ι : Type u_1
B : Type u_2
F : Type u_3
X✝ : Type u_4
inst✝⁴ : TopologicalSpace X✝
E : B → Type u_5
inst✝³ : TopologicalSpace B
inst✝² : TopologicalSpace F
inst✝¹ : (x : B) → TopologicalSpace (E x)
a : FiberPrebundle F E
e✝ : Pretrivialization F TotalSpace.proj
X : Type u_6
inst✝ : TopologicalSpace X
f : TotalSpace F E → X
s : Set B
hs : IsOpen s
hf :
  ∀ b ∈ s,
    ContinuousOn (f ∘ ↑(PartialEquiv.symm (pretrivializationAt a b).toPartialEquiv))
      ((s ∩ (pretrivializationAt a b).baseSet) ×ˢ univ)
this : TopologicalSpace (TotalSpace F E) := totalSpaceTopology a
z : TotalSpace F E
hz : z ∈ TotalSpace.proj ⁻¹' s
e : Trivialization F TotalSpace.proj :=
  trivializationOfMemPretrivializationAtlas a (_ : pretrivializationAt a z.proj ∈ a.pretrivializationAtlas)
⊢ z.proj ∈ e.baseSet

Next tactic:
exact a.mem_base_pretrivializationAt z.proj
/-- For a fiber bundle `E` over `B` constructed using the `FiberPrebundle` mechanism,
continuity of a function `TotalSpace F E → X` on an open set `s` can be checked by precomposing at
each point with the pretrivialization used for the construction at that point. -/
theorem continuousOn_of_comp_right {X : Type*} [TopologicalSpace X] {f : TotalSpace F E → X}
    {s : Set B} (hs : IsOpen s) (hf : ∀ b ∈ s,
      ContinuousOn (f ∘ (a.pretrivializationAt b).toPartialEquiv.symm)
        ((s ∩ (a.pretrivializationAt b).baseSet) ×ˢ (Set.univ : Set F))) :
    @ContinuousOn _ _ a.totalSpaceTopology _ f (π F E ⁻¹' s) := by
  letI := a.totalSpaceTopology
  intro z hz
  let e : Trivialization F (π F E) :=
    a.trivializationOfMemPretrivializationAtlas (a.pretrivialization_mem_atlas z.proj)
  refine' (e.continuousAt_of_comp_right _
    ((hf z.proj hz).continuousAt (IsOpen.mem_nhds _ _))).continuousWithinAt
  · exact a.mem_base_pretrivializationAt z.proj
  · 

Proof state:
case refine'_2
ι : Type u_1
B : Type u_2
F : Type u_3
X✝ : Type u_4
inst✝⁴ : TopologicalSpace X✝
E : B → Type u_5
inst✝³ : TopologicalSpace B
inst✝² : TopologicalSpace F
inst✝¹ : (x : B) → TopologicalSpace (E x)
a : FiberPrebundle F E
e✝ : Pretrivialization F TotalSpace.proj
X : Type u_6
inst✝ : TopologicalSpace X
f : TotalSpace F E → X
s : Set B
hs : IsOpen s
hf :
  ∀ b ∈ s,
    ContinuousOn (f ∘ ↑(PartialEquiv.symm (pretrivializationAt a b).toPartialEquiv))
      ((s ∩ (pretrivializationAt a b).baseSet) ×ˢ univ)
this : TopologicalSpace (TotalSpace F E) := totalSpaceTopology a
z : TotalSpace F E
hz : z ∈ TotalSpace.proj ⁻¹' s
e : Trivialization F TotalSpace.proj :=
  trivializationOfMemPretrivializationAtlas a (_ : pretrivializationAt a z.proj ∈ a.pretrivializationAtlas)
⊢ IsOpen ((s ∩ (pretrivializationAt a z.proj).baseSet) ×ˢ univ)

Next tactic:
exact (hs.inter (a.pretrivializationAt z.proj).open_baseSet).prod isOpen_univ
/-- For a fiber bundle `E` over `B` constructed using the `FiberPrebundle` mechanism,
continuity of a function `TotalSpace F E → X` on an open set `s` can be checked by precomposing at
each point with the pretrivialization used for the construction at that point. -/
theorem continuousOn_of_comp_right {X : Type*} [TopologicalSpace X] {f : TotalSpace F E → X}
    {s : Set B} (hs : IsOpen s) (hf : ∀ b ∈ s,
      ContinuousOn (f ∘ (a.pretrivializationAt b).toPartialEquiv.symm)
        ((s ∩ (a.pretrivializationAt b).baseSet) ×ˢ (Set.univ : Set F))) :
    @ContinuousOn _ _ a.totalSpaceTopology _ f (π F E ⁻¹' s) := by
  letI := a.totalSpaceTopology
  intro z hz
  let e : Trivialization F (π F E) :=
    a.trivializationOfMemPretrivializationAtlas (a.pretrivialization_mem_atlas z.proj)
  refine' (e.continuousAt_of_comp_right _
    ((hf z.proj hz).continuousAt (IsOpen.mem_nhds _ _))).continuousWithinAt
  · exact a.mem_base_pretrivializationAt z.proj
  · exact (hs.inter (a.pretrivializationAt z.proj).open_baseSet).prod isOpen_univ
  

Proof state:
case refine'_3
ι : Type u_1
B : Type u_2
F : Type u_3
X✝ : Type u_4
inst✝⁴ : TopologicalSpace X✝
E : B → Type u_5
inst✝³ : TopologicalSpace B
inst✝² : TopologicalSpace F
inst✝¹ : (x : B) → TopologicalSpace (E x)
a : FiberPrebundle F E
e✝ : Pretrivialization F TotalSpace.proj
X : Type u_6
inst✝ : TopologicalSpace X
f : TotalSpace F E → X
s : Set B
hs : IsOpen s
hf :
  ∀ b ∈ s,
    ContinuousOn (f ∘ ↑(PartialEquiv.symm (pretrivializationAt a b).toPartialEquiv))
      ((s ∩ (pretrivializationAt a b).baseSet) ×ˢ univ)
this : TopologicalSpace (TotalSpace F E) := totalSpaceTopology a
z : TotalSpace F E
hz : z ∈ TotalSpace.proj ⁻¹' s
e : Trivialization F TotalSpace.proj :=
  trivializationOfMemPretrivializationAtlas a (_ : pretrivializationAt a z.proj ∈ a.pretrivializationAtlas)
⊢ ↑e z ∈ (s ∩ (pretrivializationAt a z.proj).baseSet) ×ˢ univ

Next tactic:
refine' ⟨_, mem_univ _⟩
/-- For a fiber bundle `E` over `B` constructed using the `FiberPrebundle` mechanism,
continuity of a function `TotalSpace F E → X` on an open set `s` can be checked by precomposing at
each point with the pretrivialization used for the construction at that point. -/
theorem continuousOn_of_comp_right {X : Type*} [TopologicalSpace X] {f : TotalSpace F E → X}
    {s : Set B} (hs : IsOpen s) (hf : ∀ b ∈ s,
      ContinuousOn (f ∘ (a.pretrivializationAt b).toPartialEquiv.symm)
        ((s ∩ (a.pretrivializationAt b).baseSet) ×ˢ (Set.univ : Set F))) :
    @ContinuousOn _ _ a.totalSpaceTopology _ f (π F E ⁻¹' s) := by
  letI := a.totalSpaceTopology
  intro z hz
  let e : Trivialization F (π F E) :=
    a.trivializationOfMemPretrivializationAtlas (a.pretrivialization_mem_atlas z.proj)
  refine' (e.continuousAt_of_comp_right _
    ((hf z.proj hz).continuousAt (IsOpen.mem_nhds _ _))).continuousWithinAt
  · exact a.mem_base_pretrivializationAt z.proj
  · exact (hs.inter (a.pretrivializationAt z.proj).open_baseSet).prod isOpen_univ
  refine' ⟨_, mem_univ _⟩
  

Proof state:
case refine'_3
ι : Type u_1
B : Type u_2
F : Type u_3
X✝ : Type u_4
inst✝⁴ : TopologicalSpace X✝
E : B → Type u_5
inst✝³ : TopologicalSpace B
inst✝² : TopologicalSpace F
inst✝¹ : (x : B) → TopologicalSpace (E x)
a : FiberPrebundle F E
e✝ : Pretrivialization F TotalSpace.proj
X : Type u_6
inst✝ : TopologicalSpace X
f : TotalSpace F E → X
s : Set B
hs : IsOpen s
hf :
  ∀ b ∈ s,
    ContinuousOn (f ∘ ↑(PartialEquiv.symm (pretrivializationAt a b).toPartialEquiv))
      ((s ∩ (pretrivializationAt a b).baseSet) ×ˢ univ)
this : TopologicalSpace (TotalSpace F E) := totalSpaceTopology a
z : TotalSpace F E
hz : z ∈ TotalSpace.proj ⁻¹' s
e : Trivialization F TotalSpace.proj :=
  trivializationOfMemPretrivializationAtlas a (_ : pretrivializationAt a z.proj ∈ a.pretrivializationAtlas)
⊢ (↑e z).1 ∈ s ∩ (pretrivializationAt a z.proj).baseSet

Next tactic:
rw [e.coe_fst]
/-- For a fiber bundle `E` over `B` constructed using the `FiberPrebundle` mechanism,
continuity of a function `TotalSpace F E → X` on an open set `s` can be checked by precomposing at
each point with the pretrivialization used for the construction at that point. -/
theorem continuousOn_of_comp_right {X : Type*} [TopologicalSpace X] {f : TotalSpace F E → X}
    {s : Set B} (hs : IsOpen s) (hf : ∀ b ∈ s,
      ContinuousOn (f ∘ (a.pretrivializationAt b).toPartialEquiv.symm)
        ((s ∩ (a.pretrivializationAt b).baseSet) ×ˢ (Set.univ : Set F))) :
    @ContinuousOn _ _ a.totalSpaceTopology _ f (π F E ⁻¹' s) := by
  letI := a.totalSpaceTopology
  intro z hz
  let e : Trivialization F (π F E) :=
    a.trivializationOfMemPretrivializationAtlas (a.pretrivialization_mem_atlas z.proj)
  refine' (e.continuousAt_of_comp_right _
    ((hf z.proj hz).continuousAt (IsOpen.mem_nhds _ _))).continuousWithinAt
  · exact a.mem_base_pretrivializationAt z.proj
  · exact (hs.inter (a.pretrivializationAt z.proj).open_baseSet).prod isOpen_univ
  refine' ⟨_, mem_univ _⟩
  rw [e.coe_fst]
  · 

Proof state:
case refine'_3
ι : Type u_1
B : Type u_2
F : Type u_3
X✝ : Type u_4
inst✝⁴ : TopologicalSpace X✝
E : B → Type u_5
inst✝³ : TopologicalSpace B
inst✝² : TopologicalSpace F
inst✝¹ : (x : B) → TopologicalSpace (E x)
a : FiberPrebundle F E
e✝ : Pretrivialization F TotalSpace.proj
X : Type u_6
inst✝ : TopologicalSpace X
f : TotalSpace F E → X
s : Set B
hs : IsOpen s
hf :
  ∀ b ∈ s,
    ContinuousOn (f ∘ ↑(PartialEquiv.symm (pretrivializationAt a b).toPartialEquiv))
      ((s ∩ (pretrivializationAt a b).baseSet) ×ˢ univ)
this : TopologicalSpace (TotalSpace F E) := totalSpaceTopology a
z : TotalSpace F E
hz : z ∈ TotalSpace.proj ⁻¹' s
e : Trivialization F TotalSpace.proj :=
  trivializationOfMemPretrivializationAtlas a (_ : pretrivializationAt a z.proj ∈ a.pretrivializationAtlas)
⊢ z.proj ∈ s ∩ (pretrivializationAt a z.proj).baseSet

Next tactic:
exact ⟨hz, a.mem_base_pretrivializationAt z.proj⟩
/-- For a fiber bundle `E` over `B` constructed using the `FiberPrebundle` mechanism,
continuity of a function `TotalSpace F E → X` on an open set `s` can be checked by precomposing at
each point with the pretrivialization used for the construction at that point. -/
theorem continuousOn_of_comp_right {X : Type*} [TopologicalSpace X] {f : TotalSpace F E → X}
    {s : Set B} (hs : IsOpen s) (hf : ∀ b ∈ s,
      ContinuousOn (f ∘ (a.pretrivializationAt b).toPartialEquiv.symm)
        ((s ∩ (a.pretrivializationAt b).baseSet) ×ˢ (Set.univ : Set F))) :
    @ContinuousOn _ _ a.totalSpaceTopology _ f (π F E ⁻¹' s) := by
  letI := a.totalSpaceTopology
  intro z hz
  let e : Trivialization F (π F E) :=
    a.trivializationOfMemPretrivializationAtlas (a.pretrivialization_mem_atlas z.proj)
  refine' (e.continuousAt_of_comp_right _
    ((hf z.proj hz).continuousAt (IsOpen.mem_nhds _ _))).continuousWithinAt
  · exact a.mem_base_pretrivializationAt z.proj
  · exact (hs.inter (a.pretrivializationAt z.proj).open_baseSet).prod isOpen_univ
  refine' ⟨_, mem_univ _⟩
  rw [e.coe_fst]
  · exact ⟨hz, a.mem_base_pretrivializationAt z.proj⟩
  · 

Proof state:
case refine'_3
ι : Type u_1
B : Type u_2
F : Type u_3
X✝ : Type u_4
inst✝⁴ : TopologicalSpace X✝
E : B → Type u_5
inst✝³ : TopologicalSpace B
inst✝² : TopologicalSpace F
inst✝¹ : (x : B) → TopologicalSpace (E x)
a : FiberPrebundle F E
e✝ : Pretrivialization F TotalSpace.proj
X : Type u_6
inst✝ : TopologicalSpace X
f : TotalSpace F E → X
s : Set B
hs : IsOpen s
hf :
  ∀ b ∈ s,
    ContinuousOn (f ∘ ↑(PartialEquiv.symm (pretrivializationAt a b).toPartialEquiv))
      ((s ∩ (pretrivializationAt a b).baseSet) ×ˢ univ)
this : TopologicalSpace (TotalSpace F E) := totalSpaceTopology a
z : TotalSpace F E
hz : z ∈ TotalSpace.proj ⁻¹' s
e : Trivialization F TotalSpace.proj :=
  trivializationOfMemPretrivializationAtlas a (_ : pretrivializationAt a z.proj ∈ a.pretrivializationAtlas)
⊢ z ∈ e.source

Next tactic:
rw [e.mem_source]
/-- For a fiber bundle `E` over `B` constructed using the `FiberPrebundle` mechanism,
continuity of a function `TotalSpace F E → X` on an open set `s` can be checked by precomposing at
each point with the pretrivialization used for the construction at that point. -/
theorem continuousOn_of_comp_right {X : Type*} [TopologicalSpace X] {f : TotalSpace F E → X}
    {s : Set B} (hs : IsOpen s) (hf : ∀ b ∈ s,
      ContinuousOn (f ∘ (a.pretrivializationAt b).toPartialEquiv.symm)
        ((s ∩ (a.pretrivializationAt b).baseSet) ×ˢ (Set.univ : Set F))) :
    @ContinuousOn _ _ a.totalSpaceTopology _ f (π F E ⁻¹' s) := by
  letI := a.totalSpaceTopology
  intro z hz
  let e : Trivialization F (π F E) :=
    a.trivializationOfMemPretrivializationAtlas (a.pretrivialization_mem_atlas z.proj)
  refine' (e.continuousAt_of_comp_right _
    ((hf z.proj hz).continuousAt (IsOpen.mem_nhds _ _))).continuousWithinAt
  · exact a.mem_base_pretrivializationAt z.proj
  · exact (hs.inter (a.pretrivializationAt z.proj).open_baseSet).prod isOpen_univ
  refine' ⟨_, mem_univ _⟩
  rw [e.coe_fst]
  · exact ⟨hz, a.mem_base_pretrivializationAt z.proj⟩
  · rw [e.mem_source]
    

Proof state:
case refine'_3
ι : Type u_1
B : Type u_2
F : Type u_3
X✝ : Type u_4
inst✝⁴ : TopologicalSpace X✝
E : B → Type u_5
inst✝³ : TopologicalSpace B
inst✝² : TopologicalSpace F
inst✝¹ : (x : B) → TopologicalSpace (E x)
a : FiberPrebundle F E
e✝ : Pretrivialization F TotalSpace.proj
X : Type u_6
inst✝ : TopologicalSpace X
f : TotalSpace F E → X
s : Set B
hs : IsOpen s
hf :
  ∀ b ∈ s,
    ContinuousOn (f ∘ ↑(PartialEquiv.symm (pretrivializationAt a b).toPartialEquiv))
      ((s ∩ (pretrivializationAt a b).baseSet) ×ˢ univ)
this : TopologicalSpace (TotalSpace F E) := totalSpaceTopology a
z : TotalSpace F E
hz : z ∈ TotalSpace.proj ⁻¹' s
e : Trivialization F TotalSpace.proj :=
  trivializationOfMemPretrivializationAtlas a (_ : pretrivializationAt a z.proj ∈ a.pretrivializationAtlas)
⊢ z.proj ∈ e.baseSet

Next tactic:
exact a.mem_base_pretrivializationAt z.proj
theorem toFunBilinear_apply_eq_sum (a : A) (p : R[X]) :
    toFunBilinear R A a p = p.sum fun n r => monomial n (a * algebraMap R A r) := by
  

Proof state:
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a : A
p : R[X]
⊢ ((toFunBilinear R A) a) p = sum p fun n r => (monomial n) (a * (algebraMap R A) r)

Next tactic:
simp only [toFunBilinear_apply_apply, aeval_def, eval₂_eq_sum, Polynomial.sum, Finset.smul_sum]
theorem toFunBilinear_apply_eq_sum (a : A) (p : R[X]) :
    toFunBilinear R A a p = p.sum fun n r => monomial n (a * algebraMap R A r) := by
  simp only [toFunBilinear_apply_apply, aeval_def, eval₂_eq_sum, Polynomial.sum, Finset.smul_sum]
  

Proof state:
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a : A
p : R[X]
⊢ (Finset.sum (support p) fun x => a • ((algebraMap R A[X]) (coeff p x) * X ^ x)) =
    Finset.sum (support p) fun x => (monomial x) (a * (algebraMap R A) (coeff p x))

Next tactic:
congr with i : 1
theorem toFunBilinear_apply_eq_sum (a : A) (p : R[X]) :
    toFunBilinear R A a p = p.sum fun n r => monomial n (a * algebraMap R A r) := by
  simp only [toFunBilinear_apply_apply, aeval_def, eval₂_eq_sum, Polynomial.sum, Finset.smul_sum]
  congr with i : 1
  

Proof state:
case e_f.h
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a : A
p : R[X]
i : ℕ
⊢ a • ((algebraMap R A[X]) (coeff p i) * X ^ i) = (monomial i) (a * (algebraMap R A) (coeff p i))

Next tactic:
rw [← Algebra.smul_def, ← C_mul', mul_smul_comm, C_mul_X_pow_eq_monomial, ← Algebra.commutes,
    ← Algebra.smul_def, smul_monomial]
theorem toFunLinear_mul_tmul_mul_aux_1 (p : R[X]) (k : ℕ) (h : Decidable ¬p.coeff k = 0) (a : A) :
    ite (¬coeff p k = 0) (a * (algebraMap R A) (coeff p k)) 0 = a * (algebraMap R A) (coeff p k) :=
  by 

Proof state:
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p : R[X]
k : ℕ
h : Decidable ¬coeff p k = 0
a : A
⊢ (if ¬coeff p k = 0 then a * (algebraMap R A) (coeff p k) else 0) = a * (algebraMap R A) (coeff p k)

Next tactic:
classical split_ifs <;> simp [*]
theorem toFunLinear_mul_tmul_mul_aux_1 (p : R[X]) (k : ℕ) (h : Decidable ¬p.coeff k = 0) (a : A) :
    ite (¬coeff p k = 0) (a * (algebraMap R A) (coeff p k)) 0 = a * (algebraMap R A) (coeff p k) :=
  by classical 

Proof state:
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p : R[X]
k : ℕ
h : Decidable ¬coeff p k = 0
a : A
⊢ (if ¬coeff p k = 0 then a * (algebraMap R A) (coeff p k) else 0) = a * (algebraMap R A) (coeff p k)

Next tactic:
split_ifs
theorem toFunLinear_mul_tmul_mul_aux_1 (p : R[X]) (k : ℕ) (h : Decidable ¬p.coeff k = 0) (a : A) :
    ite (¬coeff p k = 0) (a * (algebraMap R A) (coeff p k)) 0 = a * (algebraMap R A) (coeff p k) :=
  by classical split_ifs <;> 

Proof state:
case pos
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p : R[X]
k : ℕ
h : Decidable ¬coeff p k = 0
a : A
h✝ : coeff p k = 0
⊢ 0 = a * (algebraMap R A) (coeff p k)

Next tactic:
simp [*]
theorem toFunLinear_mul_tmul_mul_aux_1 (p : R[X]) (k : ℕ) (h : Decidable ¬p.coeff k = 0) (a : A) :
    ite (¬coeff p k = 0) (a * (algebraMap R A) (coeff p k)) 0 = a * (algebraMap R A) (coeff p k) :=
  by classical split_ifs <;> 

Proof state:
case neg
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
p : R[X]
k : ℕ
h : Decidable ¬coeff p k = 0
a : A
h✝ : ¬coeff p k = 0
⊢ a * (algebraMap R A) (coeff p k) = a * (algebraMap R A) (coeff p k)

Next tactic:
simp [*]
theorem toFunLinear_mul_tmul_mul_aux_2 (k : ℕ) (a₁ a₂ : A) (p₁ p₂ : R[X]) :
    a₁ * a₂ * (algebraMap R A) ((p₁ * p₂).coeff k) =
      (Finset.antidiagonal k).sum fun x =>
        a₁ * (algebraMap R A) (coeff p₁ x.1) * (a₂ * (algebraMap R A) (coeff p₂ x.2)) := by
  

Proof state:
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
k : ℕ
a₁ a₂ : A
p₁ p₂ : R[X]
⊢ a₁ * a₂ * (algebraMap R A) (coeff (p₁ * p₂) k) =
    Finset.sum (Finset.antidiagonal k) fun x =>
      a₁ * (algebraMap R A) (coeff p₁ x.1) * (a₂ * (algebraMap R A) (coeff p₂ x.2))

Next tactic:
simp_rw [mul_assoc, Algebra.commutes, ← Finset.mul_sum, mul_assoc, ← Finset.mul_sum]
theorem toFunLinear_mul_tmul_mul_aux_2 (k : ℕ) (a₁ a₂ : A) (p₁ p₂ : R[X]) :
    a₁ * a₂ * (algebraMap R A) ((p₁ * p₂).coeff k) =
      (Finset.antidiagonal k).sum fun x =>
        a₁ * (algebraMap R A) (coeff p₁ x.1) * (a₂ * (algebraMap R A) (coeff p₂ x.2)) := by
  simp_rw [mul_assoc, Algebra.commutes, ← Finset.mul_sum, mul_assoc, ← Finset.mul_sum]
  

Proof state:
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
k : ℕ
a₁ a₂ : A
p₁ p₂ : R[X]
⊢ a₁ * (a₂ * (algebraMap R A) (coeff (p₁ * p₂) k)) =
    a₁ *
      (a₂ *
        Finset.sum (Finset.antidiagonal k) fun x => (algebraMap R A) (coeff p₂ x.2) * (algebraMap R A) (coeff p₁ x.1))

Next tactic:
congr
theorem toFunLinear_mul_tmul_mul_aux_2 (k : ℕ) (a₁ a₂ : A) (p₁ p₂ : R[X]) :
    a₁ * a₂ * (algebraMap R A) ((p₁ * p₂).coeff k) =
      (Finset.antidiagonal k).sum fun x =>
        a₁ * (algebraMap R A) (coeff p₁ x.1) * (a₂ * (algebraMap R A) (coeff p₂ x.2)) := by
  simp_rw [mul_assoc, Algebra.commutes, ← Finset.mul_sum, mul_assoc, ← Finset.mul_sum]
  congr
  

Proof state:
case e_a.e_a
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
k : ℕ
a₁ a₂ : A
p₁ p₂ : R[X]
⊢ (algebraMap R A) (coeff (p₁ * p₂) k) =
    Finset.sum (Finset.antidiagonal k) fun x => (algebraMap R A) (coeff p₂ x.2) * (algebraMap R A) (coeff p₁ x.1)

Next tactic:
simp_rw [Algebra.commutes (coeff p₂ _), coeff_mul, map_sum, RingHom.map_mul]
theorem toFunLinear_mul_tmul_mul (a₁ a₂ : A) (p₁ p₂ : R[X]) :
    (toFunLinear R A) ((a₁ * a₂) ⊗ₜ[R] (p₁ * p₂)) =
      (toFunLinear R A) (a₁ ⊗ₜ[R] p₁) * (toFunLinear R A) (a₂ ⊗ₜ[R] p₂) := by
  

Proof state:
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
⊢ (toFunLinear R A) ((a₁ * a₂) ⊗ₜ[R] (p₁ * p₂)) = (toFunLinear R A) (a₁ ⊗ₜ[R] p₁) * (toFunLinear R A) (a₂ ⊗ₜ[R] p₂)

Next tactic:
classical
    simp only [toFunLinear_tmul_apply, toFunBilinear_apply_eq_sum]
    ext k
    simp_rw [coeff_sum, coeff_monomial, sum_def, Finset.sum_ite_eq', mem_support_iff, Ne.def]
    conv_rhs => rw [coeff_mul]
    simp_rw [finset_sum_coeff, coeff_monomial, Finset.sum_ite_eq', mem_support_iff, Ne.def, mul_ite,
      mul_zero, ite_mul, zero_mul]
    simp_rw [← ite_zero_mul (¬coeff p₁ _ = 0) (a₁ * (algebraMap R A) (coeff p₁ _))]
    simp_rw [← mul_ite_zero (¬coeff p₂ _ = 0) _ (_ * _)]
    simp_rw [toFunLinear_mul_tmul_mul_aux_1, toFunLinear_mul_tmul_mul_aux_2]
theorem toFunLinear_mul_tmul_mul (a₁ a₂ : A) (p₁ p₂ : R[X]) :
    (toFunLinear R A) ((a₁ * a₂) ⊗ₜ[R] (p₁ * p₂)) =
      (toFunLinear R A) (a₁ ⊗ₜ[R] p₁) * (toFunLinear R A) (a₂ ⊗ₜ[R] p₂) := by
  classical
    

Proof state:
R : Type u_1
A : Type u_2
inst✝² : CommSemiring R
inst✝¹ : Semiring A
inst✝ : Algebra R A
a₁ a₂ : A
p₁ p₂ : R[X]
⊢ (toFunLinear R A) ((a₁ * a₂) ⊗ₜ[R] (p₁ * p₂)) = (toFunLinear R A) (a₁ ⊗ₜ[R] p₁) * (toFunLinear R A) (a₂ ⊗ₜ[R] p₂)

Next tactic:
simp only [toFunLinear_tmul_apply, toFunBilinear_apply_eq_sum]