l3lab/ntp-mathlib huggingface dataset:
/-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `𝕜`-linear map on Schwartz space,
where `B` is a continuous `𝕜`-linear map and `g` is a function of temperate growth. -/
def bilinLeftCLM (B : E →L[ℝ] F →L[ℝ] G) {g : D → F} (hg : g.HasTemperateGrowth) :
    𝓢(D, E) →L[ℝ] 𝓢(D, G) :=
  -- Todo (after port): generalize to `B : E →L[𝕜] F →L[𝕜] G` and `𝕜`-linear
    mkCLM
    (fun f x => B (f x) (g x))
    (fun _ _ _ => by
      simp only [map_add, add_left_inj, Pi.add_apply, eq_self_iff_true,
        ContinuousLinearMap.add_apply])
    (fun _ _ _ => by
      simp only [smul_apply, map_smul, ContinuousLinearMap.coe_smul', Pi.smul_apply,
        RingHom.id_apply])
    (fun f => (B.isBoundedBilinearMap.contDiff.restrict_scalars ℝ).comp (f.smooth'.prod hg.1))
    (by
      -- Porting note: rewrite this proof with `rel_congr`
      rintro ⟨k, n⟩
      rcases hg.norm_iteratedFDeriv_le_uniform_aux n with ⟨l, C, hC, hgrowth⟩
      use
        Finset.Iic (l + k, n), ‖B‖ * ((n : ℝ) + (1 : ℝ)) * n.choose (n / 2) * (C * 2 ^ (l + k)),
        by positivity
      intro f x
      have hxk : 0 ≤ ‖x‖ ^ k := by positivity
      have hnorm_mul :=
        ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear B f.smooth' hg.1 x (n := n) le_top
      refine' le_trans (mul_le_mul_of_nonneg_left hnorm_mul hxk) _
      rw [← mul_assoc (‖x‖ ^ k), mul_comm (‖x‖ ^ k)]
      

Proof state:
case right
𝕜 : Type u_1
𝕜' : Type u_2
D : Type u_3
E : Type u_4
F : Type u_5
G : Type u_6
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace ℝ F
inst✝³ : NormedAddCommGroup D
inst✝² : NormedSpace ℝ D
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
B : E →L[ℝ] F →L[ℝ] G
g : D → F
hg : Function.HasTemperateGrowth g
k n l : ℕ
C : ℝ
hC : 0 ≤ C
hgrowth : ∀ N ≤ n, ∀ (x : D), ‖iteratedFDeriv ℝ N g x‖ ≤ C * (1 + ‖x‖) ^ l
f : 𝓢(D, E)
x : D
hxk : 0 ≤ ‖x‖ ^ k
hnorm_mul :
  ‖iteratedFDeriv ℝ n (fun y => (B (toFun f y)) (g y)) x‖ ≤
    ‖B‖ *
      ∑ i in Finset.range (n + 1), ↑(Nat.choose n i) * ‖iteratedFDeriv ℝ i f.toFun x‖ * ‖iteratedFDeriv ℝ (n - i) g x‖
⊢ ‖B‖ * ‖x‖ ^ k *
      ∑ i in Finset.range (n + 1), ↑(Nat.choose n i) * ‖iteratedFDeriv ℝ i f.toFun x‖ * ‖iteratedFDeriv ℝ (n - i) g x‖ ≤
    ‖B‖ * (↑n + 1) * ↑(Nat.choose n (n / 2)) * (C * 2 ^ (l + k)) *
      (Finset.sup (Finset.Iic (l + k, n)) (schwartzSeminormFamily ℝ D E)) f

Next tactic:
simp_rw [mul_assoc ‖B‖]
/-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `𝕜`-linear map on Schwartz space,
where `B` is a continuous `𝕜`-linear map and `g` is a function of temperate growth. -/
def bilinLeftCLM (B : E →L[ℝ] F →L[ℝ] G) {g : D → F} (hg : g.HasTemperateGrowth) :
    𝓢(D, E) →L[ℝ] 𝓢(D, G) :=
  -- Todo (after port): generalize to `B : E →L[𝕜] F →L[𝕜] G` and `𝕜`-linear
    mkCLM
    (fun f x => B (f x) (g x))
    (fun _ _ _ => by
      simp only [map_add, add_left_inj, Pi.add_apply, eq_self_iff_true,
        ContinuousLinearMap.add_apply])
    (fun _ _ _ => by
      simp only [smul_apply, map_smul, ContinuousLinearMap.coe_smul', Pi.smul_apply,
        RingHom.id_apply])
    (fun f => (B.isBoundedBilinearMap.contDiff.restrict_scalars ℝ).comp (f.smooth'.prod hg.1))
    (by
      -- Porting note: rewrite this proof with `rel_congr`
      rintro ⟨k, n⟩
      rcases hg.norm_iteratedFDeriv_le_uniform_aux n with ⟨l, C, hC, hgrowth⟩
      use
        Finset.Iic (l + k, n), ‖B‖ * ((n : ℝ) + (1 : ℝ)) * n.choose (n / 2) * (C * 2 ^ (l + k)),
        by positivity
      intro f x
      have hxk : 0 ≤ ‖x‖ ^ k := by positivity
      have hnorm_mul :=
        ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear B f.smooth' hg.1 x (n := n) le_top
      refine' le_trans (mul_le_mul_of_nonneg_left hnorm_mul hxk) _
      rw [← mul_assoc (‖x‖ ^ k), mul_comm (‖x‖ ^ k)]
      simp_rw [mul_assoc ‖B‖]
      

Proof state:
case right
𝕜 : Type u_1
𝕜' : Type u_2
D : Type u_3
E : Type u_4
F : Type u_5
G : Type u_6
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace ℝ F
inst✝³ : NormedAddCommGroup D
inst✝² : NormedSpace ℝ D
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
B : E →L[ℝ] F →L[ℝ] G
g : D → F
hg : Function.HasTemperateGrowth g
k n l : ℕ
C : ℝ
hC : 0 ≤ C
hgrowth : ∀ N ≤ n, ∀ (x : D), ‖iteratedFDeriv ℝ N g x‖ ≤ C * (1 + ‖x‖) ^ l
f : 𝓢(D, E)
x : D
hxk : 0 ≤ ‖x‖ ^ k
hnorm_mul :
  ‖iteratedFDeriv ℝ n (fun y => (B (toFun f y)) (g y)) x‖ ≤
    ‖B‖ *
      ∑ i in Finset.range (n + 1), ↑(Nat.choose n i) * ‖iteratedFDeriv ℝ i f.toFun x‖ * ‖iteratedFDeriv ℝ (n - i) g x‖
⊢ ‖B‖ *
      (‖x‖ ^ k *
        ∑ x_1 in Finset.range (n + 1),
          ↑(Nat.choose n x_1) * ‖iteratedFDeriv ℝ x_1 f.toFun x‖ * ‖iteratedFDeriv ℝ (n - x_1) g x‖) ≤
    ‖B‖ *
      ((↑n + 1) * ↑(Nat.choose n (n / 2)) * (C * 2 ^ (l + k)) *
        (Finset.sup (Finset.Iic (l + k, n)) (schwartzSeminormFamily ℝ D E)) f)

Next tactic:
refine' mul_le_mul_of_nonneg_left _ (by positivity)
/-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `𝕜`-linear map on Schwartz space,
where `B` is a continuous `𝕜`-linear map and `g` is a function of temperate growth. -/
def bilinLeftCLM (B : E →L[ℝ] F →L[ℝ] G) {g : D → F} (hg : g.HasTemperateGrowth) :
    𝓢(D, E) →L[ℝ] 𝓢(D, G) :=
  -- Todo (after port): generalize to `B : E →L[𝕜] F →L[𝕜] G` and `𝕜`-linear
    mkCLM
    (fun f x => B (f x) (g x))
    (fun _ _ _ => by
      simp only [map_add, add_left_inj, Pi.add_apply, eq_self_iff_true,
        ContinuousLinearMap.add_apply])
    (fun _ _ _ => by
      simp only [smul_apply, map_smul, ContinuousLinearMap.coe_smul', Pi.smul_apply,
        RingHom.id_apply])
    (fun f => (B.isBoundedBilinearMap.contDiff.restrict_scalars ℝ).comp (f.smooth'.prod hg.1))
    (by
      -- Porting note: rewrite this proof with `rel_congr`
      rintro ⟨k, n⟩
      rcases hg.norm_iteratedFDeriv_le_uniform_aux n with ⟨l, C, hC, hgrowth⟩
      use
        Finset.Iic (l + k, n), ‖B‖ * ((n : ℝ) + (1 : ℝ)) * n.choose (n / 2) * (C * 2 ^ (l + k)),
        by positivity
      intro f x
      have hxk : 0 ≤ ‖x‖ ^ k := by positivity
      have hnorm_mul :=
        ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear B f.smooth' hg.1 x (n := n) le_top
      refine' le_trans (mul_le_mul_of_nonneg_left hnorm_mul hxk) _
      rw [← mul_assoc (‖x‖ ^ k), mul_comm (‖x‖ ^ k)]
      simp_rw [mul_assoc ‖B‖]
      refine' mul_le_mul_of_nonneg_left _ (by 

Proof state:
𝕜 : Type u_1
𝕜' : Type u_2
D : Type u_3
E : Type u_4
F : Type u_5
G : Type u_6
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace ℝ F
inst✝³ : NormedAddCommGroup D
inst✝² : NormedSpace ℝ D
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
B : E →L[ℝ] F →L[ℝ] G
g : D → F
hg : Function.HasTemperateGrowth g
k n l : ℕ
C : ℝ
hC : 0 ≤ C
hgrowth : ∀ N ≤ n, ∀ (x : D), ‖iteratedFDeriv ℝ N g x‖ ≤ C * (1 + ‖x‖) ^ l
f : 𝓢(D, E)
x : D
hxk : 0 ≤ ‖x‖ ^ k
hnorm_mul :
  ‖iteratedFDeriv ℝ n (fun y => (B (toFun f y)) (g y)) x‖ ≤
    ‖B‖ *
      ∑ i in Finset.range (n + 1), ↑(Nat.choose n i) * ‖iteratedFDeriv ℝ i f.toFun x‖ * ‖iteratedFDeriv ℝ (n - i) g x‖
⊢ 0 ≤ ‖B‖

Next tactic:
positivity
/-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `𝕜`-linear map on Schwartz space,
where `B` is a continuous `𝕜`-linear map and `g` is a function of temperate growth. -/
def bilinLeftCLM (B : E →L[ℝ] F →L[ℝ] G) {g : D → F} (hg : g.HasTemperateGrowth) :
    𝓢(D, E) →L[ℝ] 𝓢(D, G) :=
  -- Todo (after port): generalize to `B : E →L[𝕜] F →L[𝕜] G` and `𝕜`-linear
    mkCLM
    (fun f x => B (f x) (g x))
    (fun _ _ _ => by
      simp only [map_add, add_left_inj, Pi.add_apply, eq_self_iff_true,
        ContinuousLinearMap.add_apply])
    (fun _ _ _ => by
      simp only [smul_apply, map_smul, ContinuousLinearMap.coe_smul', Pi.smul_apply,
        RingHom.id_apply])
    (fun f => (B.isBoundedBilinearMap.contDiff.restrict_scalars ℝ).comp (f.smooth'.prod hg.1))
    (by
      -- Porting note: rewrite this proof with `rel_congr`
      rintro ⟨k, n⟩
      rcases hg.norm_iteratedFDeriv_le_uniform_aux n with ⟨l, C, hC, hgrowth⟩
      use
        Finset.Iic (l + k, n), ‖B‖ * ((n : ℝ) + (1 : ℝ)) * n.choose (n / 2) * (C * 2 ^ (l + k)),
        by positivity
      intro f x
      have hxk : 0 ≤ ‖x‖ ^ k := by positivity
      have hnorm_mul :=
        ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear B f.smooth' hg.1 x (n := n) le_top
      refine' le_trans (mul_le_mul_of_nonneg_left hnorm_mul hxk) _
      rw [← mul_assoc (‖x‖ ^ k), mul_comm (‖x‖ ^ k)]
      simp_rw [mul_assoc ‖B‖]
      refine' mul_le_mul_of_nonneg_left _ (by positivity)
      

Proof state:
case right
𝕜 : Type u_1
𝕜' : Type u_2
D : Type u_3
E : Type u_4
F : Type u_5
G : Type u_6
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace ℝ F
inst✝³ : NormedAddCommGroup D
inst✝² : NormedSpace ℝ D
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
B : E →L[ℝ] F →L[ℝ] G
g : D → F
hg : Function.HasTemperateGrowth g
k n l : ℕ
C : ℝ
hC : 0 ≤ C
hgrowth : ∀ N ≤ n, ∀ (x : D), ‖iteratedFDeriv ℝ N g x‖ ≤ C * (1 + ‖x‖) ^ l
f : 𝓢(D, E)
x : D
hxk : 0 ≤ ‖x‖ ^ k
hnorm_mul :
  ‖iteratedFDeriv ℝ n (fun y => (B (toFun f y)) (g y)) x‖ ≤
    ‖B‖ *
      ∑ i in Finset.range (n + 1), ↑(Nat.choose n i) * ‖iteratedFDeriv ℝ i f.toFun x‖ * ‖iteratedFDeriv ℝ (n - i) g x‖
⊢ ‖x‖ ^ k *
      ∑ x_1 in Finset.range (n + 1),
        ↑(Nat.choose n x_1) * ‖iteratedFDeriv ℝ x_1 f.toFun x‖ * ‖iteratedFDeriv ℝ (n - x_1) g x‖ ≤
    (↑n + 1) * ↑(Nat.choose n (n / 2)) * (C * 2 ^ (l + k)) *
      (Finset.sup (Finset.Iic (l + k, n)) (schwartzSeminormFamily ℝ D E)) f

Next tactic:
rw [Finset.mul_sum]
/-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `𝕜`-linear map on Schwartz space,
where `B` is a continuous `𝕜`-linear map and `g` is a function of temperate growth. -/
def bilinLeftCLM (B : E →L[ℝ] F →L[ℝ] G) {g : D → F} (hg : g.HasTemperateGrowth) :
    𝓢(D, E) →L[ℝ] 𝓢(D, G) :=
  -- Todo (after port): generalize to `B : E →L[𝕜] F →L[𝕜] G` and `𝕜`-linear
    mkCLM
    (fun f x => B (f x) (g x))
    (fun _ _ _ => by
      simp only [map_add, add_left_inj, Pi.add_apply, eq_self_iff_true,
        ContinuousLinearMap.add_apply])
    (fun _ _ _ => by
      simp only [smul_apply, map_smul, ContinuousLinearMap.coe_smul', Pi.smul_apply,
        RingHom.id_apply])
    (fun f => (B.isBoundedBilinearMap.contDiff.restrict_scalars ℝ).comp (f.smooth'.prod hg.1))
    (by
      -- Porting note: rewrite this proof with `rel_congr`
      rintro ⟨k, n⟩
      rcases hg.norm_iteratedFDeriv_le_uniform_aux n with ⟨l, C, hC, hgrowth⟩
      use
        Finset.Iic (l + k, n), ‖B‖ * ((n : ℝ) + (1 : ℝ)) * n.choose (n / 2) * (C * 2 ^ (l + k)),
        by positivity
      intro f x
      have hxk : 0 ≤ ‖x‖ ^ k := by positivity
      have hnorm_mul :=
        ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear B f.smooth' hg.1 x (n := n) le_top
      refine' le_trans (mul_le_mul_of_nonneg_left hnorm_mul hxk) _
      rw [← mul_assoc (‖x‖ ^ k), mul_comm (‖x‖ ^ k)]
      simp_rw [mul_assoc ‖B‖]
      refine' mul_le_mul_of_nonneg_left _ (by positivity)
      rw [Finset.mul_sum]
      

Proof state:
case right
𝕜 : Type u_1
𝕜' : Type u_2
D : Type u_3
E : Type u_4
F : Type u_5
G : Type u_6
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace ℝ F
inst✝³ : NormedAddCommGroup D
inst✝² : NormedSpace ℝ D
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
B : E →L[ℝ] F →L[ℝ] G
g : D → F
hg : Function.HasTemperateGrowth g
k n l : ℕ
C : ℝ
hC : 0 ≤ C
hgrowth : ∀ N ≤ n, ∀ (x : D), ‖iteratedFDeriv ℝ N g x‖ ≤ C * (1 + ‖x‖) ^ l
f : 𝓢(D, E)
x : D
hxk : 0 ≤ ‖x‖ ^ k
hnorm_mul :
  ‖iteratedFDeriv ℝ n (fun y => (B (toFun f y)) (g y)) x‖ ≤
    ‖B‖ *
      ∑ i in Finset.range (n + 1), ↑(Nat.choose n i) * ‖iteratedFDeriv ℝ i f.toFun x‖ * ‖iteratedFDeriv ℝ (n - i) g x‖
⊢ ∑ x_1 in Finset.range (n + 1),
      ‖x‖ ^ k * (↑(Nat.choose n x_1) * ‖iteratedFDeriv ℝ x_1 f.toFun x‖ * ‖iteratedFDeriv ℝ (n - x_1) g x‖) ≤
    (↑n + 1) * ↑(Nat.choose n (n / 2)) * (C * 2 ^ (l + k)) *
      (Finset.sup (Finset.Iic (l + k, n)) (schwartzSeminormFamily ℝ D E)) f

Next tactic:
have : (∑ _x : ℕ in Finset.range (n + 1), (1 : ℝ)) = n + 1 := by simp
/-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `𝕜`-linear map on Schwartz space,
where `B` is a continuous `𝕜`-linear map and `g` is a function of temperate growth. -/
def bilinLeftCLM (B : E →L[ℝ] F →L[ℝ] G) {g : D → F} (hg : g.HasTemperateGrowth) :
    𝓢(D, E) →L[ℝ] 𝓢(D, G) :=
  -- Todo (after port): generalize to `B : E →L[𝕜] F →L[𝕜] G` and `𝕜`-linear
    mkCLM
    (fun f x => B (f x) (g x))
    (fun _ _ _ => by
      simp only [map_add, add_left_inj, Pi.add_apply, eq_self_iff_true,
        ContinuousLinearMap.add_apply])
    (fun _ _ _ => by
      simp only [smul_apply, map_smul, ContinuousLinearMap.coe_smul', Pi.smul_apply,
        RingHom.id_apply])
    (fun f => (B.isBoundedBilinearMap.contDiff.restrict_scalars ℝ).comp (f.smooth'.prod hg.1))
    (by
      -- Porting note: rewrite this proof with `rel_congr`
      rintro ⟨k, n⟩
      rcases hg.norm_iteratedFDeriv_le_uniform_aux n with ⟨l, C, hC, hgrowth⟩
      use
        Finset.Iic (l + k, n), ‖B‖ * ((n : ℝ) + (1 : ℝ)) * n.choose (n / 2) * (C * 2 ^ (l + k)),
        by positivity
      intro f x
      have hxk : 0 ≤ ‖x‖ ^ k := by positivity
      have hnorm_mul :=
        ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear B f.smooth' hg.1 x (n := n) le_top
      refine' le_trans (mul_le_mul_of_nonneg_left hnorm_mul hxk) _
      rw [← mul_assoc (‖x‖ ^ k), mul_comm (‖x‖ ^ k)]
      simp_rw [mul_assoc ‖B‖]
      refine' mul_le_mul_of_nonneg_left _ (by positivity)
      rw [Finset.mul_sum]
      have : (∑ _x : ℕ in Finset.range (n + 1), (1 : ℝ)) = n + 1 := by 

Proof state:
𝕜 : Type u_1
𝕜' : Type u_2
D : Type u_3
E : Type u_4
F : Type u_5
G : Type u_6
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace ℝ F
inst✝³ : NormedAddCommGroup D
inst✝² : NormedSpace ℝ D
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
B : E →L[ℝ] F →L[ℝ] G
g : D → F
hg : Function.HasTemperateGrowth g
k n l : ℕ
C : ℝ
hC : 0 ≤ C
hgrowth : ∀ N ≤ n, ∀ (x : D), ‖iteratedFDeriv ℝ N g x‖ ≤ C * (1 + ‖x‖) ^ l
f : 𝓢(D, E)
x : D
hxk : 0 ≤ ‖x‖ ^ k
hnorm_mul :
  ‖iteratedFDeriv ℝ n (fun y => (B (toFun f y)) (g y)) x‖ ≤
    ‖B‖ *
      ∑ i in Finset.range (n + 1), ↑(Nat.choose n i) * ‖iteratedFDeriv ℝ i f.toFun x‖ * ‖iteratedFDeriv ℝ (n - i) g x‖
⊢ ∑ _x in Finset.range (n + 1), 1 = ↑n + 1

Next tactic:
simp
/-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `𝕜`-linear map on Schwartz space,
where `B` is a continuous `𝕜`-linear map and `g` is a function of temperate growth. -/
def bilinLeftCLM (B : E →L[ℝ] F →L[ℝ] G) {g : D → F} (hg : g.HasTemperateGrowth) :
    𝓢(D, E) →L[ℝ] 𝓢(D, G) :=
  -- Todo (after port): generalize to `B : E →L[𝕜] F →L[𝕜] G` and `𝕜`-linear
    mkCLM
    (fun f x => B (f x) (g x))
    (fun _ _ _ => by
      simp only [map_add, add_left_inj, Pi.add_apply, eq_self_iff_true,
        ContinuousLinearMap.add_apply])
    (fun _ _ _ => by
      simp only [smul_apply, map_smul, ContinuousLinearMap.coe_smul', Pi.smul_apply,
        RingHom.id_apply])
    (fun f => (B.isBoundedBilinearMap.contDiff.restrict_scalars ℝ).comp (f.smooth'.prod hg.1))
    (by
      -- Porting note: rewrite this proof with `rel_congr`
      rintro ⟨k, n⟩
      rcases hg.norm_iteratedFDeriv_le_uniform_aux n with ⟨l, C, hC, hgrowth⟩
      use
        Finset.Iic (l + k, n), ‖B‖ * ((n : ℝ) + (1 : ℝ)) * n.choose (n / 2) * (C * 2 ^ (l + k)),
        by positivity
      intro f x
      have hxk : 0 ≤ ‖x‖ ^ k := by positivity
      have hnorm_mul :=
        ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear B f.smooth' hg.1 x (n := n) le_top
      refine' le_trans (mul_le_mul_of_nonneg_left hnorm_mul hxk) _
      rw [← mul_assoc (‖x‖ ^ k), mul_comm (‖x‖ ^ k)]
      simp_rw [mul_assoc ‖B‖]
      refine' mul_le_mul_of_nonneg_left _ (by positivity)
      rw [Finset.mul_sum]
      have : (∑ _x : ℕ in Finset.range (n + 1), (1 : ℝ)) = n + 1 := by simp
      

Proof state:
case right
𝕜 : Type u_1
𝕜' : Type u_2
D : Type u_3
E : Type u_4
F : Type u_5
G : Type u_6
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace ℝ F
inst✝³ : NormedAddCommGroup D
inst✝² : NormedSpace ℝ D
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
B : E →L[ℝ] F →L[ℝ] G
g : D → F
hg : Function.HasTemperateGrowth g
k n l : ℕ
C : ℝ
hC : 0 ≤ C
hgrowth : ∀ N ≤ n, ∀ (x : D), ‖iteratedFDeriv ℝ N g x‖ ≤ C * (1 + ‖x‖) ^ l
f : 𝓢(D, E)
x : D
hxk : 0 ≤ ‖x‖ ^ k
hnorm_mul :
  ‖iteratedFDeriv ℝ n (fun y => (B (toFun f y)) (g y)) x‖ ≤
    ‖B‖ *
      ∑ i in Finset.range (n + 1), ↑(Nat.choose n i) * ‖iteratedFDeriv ℝ i f.toFun x‖ * ‖iteratedFDeriv ℝ (n - i) g x‖
this : ∑ _x in Finset.range (n + 1), 1 = ↑n + 1
⊢ ∑ x_1 in Finset.range (n + 1),
      ‖x‖ ^ k * (↑(Nat.choose n x_1) * ‖iteratedFDeriv ℝ x_1 f.toFun x‖ * ‖iteratedFDeriv ℝ (n - x_1) g x‖) ≤
    (↑n + 1) * ↑(Nat.choose n (n / 2)) * (C * 2 ^ (l + k)) *
      (Finset.sup (Finset.Iic (l + k, n)) (schwartzSeminormFamily ℝ D E)) f

Next tactic:
repeat rw [mul_assoc ((n : ℝ) + 1)]
/-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `𝕜`-linear map on Schwartz space,
where `B` is a continuous `𝕜`-linear map and `g` is a function of temperate growth. -/
def bilinLeftCLM (B : E →L[ℝ] F →L[ℝ] G) {g : D → F} (hg : g.HasTemperateGrowth) :
    𝓢(D, E) →L[ℝ] 𝓢(D, G) :=
  -- Todo (after port): generalize to `B : E →L[𝕜] F →L[𝕜] G` and `𝕜`-linear
    mkCLM
    (fun f x => B (f x) (g x))
    (fun _ _ _ => by
      simp only [map_add, add_left_inj, Pi.add_apply, eq_self_iff_true,
        ContinuousLinearMap.add_apply])
    (fun _ _ _ => by
      simp only [smul_apply, map_smul, ContinuousLinearMap.coe_smul', Pi.smul_apply,
        RingHom.id_apply])
    (fun f => (B.isBoundedBilinearMap.contDiff.restrict_scalars ℝ).comp (f.smooth'.prod hg.1))
    (by
      -- Porting note: rewrite this proof with `rel_congr`
      rintro ⟨k, n⟩
      rcases hg.norm_iteratedFDeriv_le_uniform_aux n with ⟨l, C, hC, hgrowth⟩
      use
        Finset.Iic (l + k, n), ‖B‖ * ((n : ℝ) + (1 : ℝ)) * n.choose (n / 2) * (C * 2 ^ (l + k)),
        by positivity
      intro f x
      have hxk : 0 ≤ ‖x‖ ^ k := by positivity
      have hnorm_mul :=
        ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear B f.smooth' hg.1 x (n := n) le_top
      refine' le_trans (mul_le_mul_of_nonneg_left hnorm_mul hxk) _
      rw [← mul_assoc (‖x‖ ^ k), mul_comm (‖x‖ ^ k)]
      simp_rw [mul_assoc ‖B‖]
      refine' mul_le_mul_of_nonneg_left _ (by positivity)
      rw [Finset.mul_sum]
      have : (∑ _x : ℕ in Finset.range (n + 1), (1 : ℝ)) = n + 1 := by simp
      repeat 

Proof state:
case right
𝕜 : Type u_1
𝕜' : Type u_2
D : Type u_3
E : Type u_4
F : Type u_5
G : Type u_6
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace ℝ F
inst✝³ : NormedAddCommGroup D
inst✝² : NormedSpace ℝ D
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
B : E →L[ℝ] F →L[ℝ] G
g : D → F
hg : Function.HasTemperateGrowth g
k n l : ℕ
C : ℝ
hC : 0 ≤ C
hgrowth : ∀ N ≤ n, ∀ (x : D), ‖iteratedFDeriv ℝ N g x‖ ≤ C * (1 + ‖x‖) ^ l
f : 𝓢(D, E)
x : D
hxk : 0 ≤ ‖x‖ ^ k
hnorm_mul :
  ‖iteratedFDeriv ℝ n (fun y => (B (toFun f y)) (g y)) x‖ ≤
    ‖B‖ *
      ∑ i in Finset.range (n + 1), ↑(Nat.choose n i) * ‖iteratedFDeriv ℝ i f.toFun x‖ * ‖iteratedFDeriv ℝ (n - i) g x‖
this : ∑ _x in Finset.range (n + 1), 1 = ↑n + 1
⊢ ∑ x_1 in Finset.range (n + 1),
      ‖x‖ ^ k * (↑(Nat.choose n x_1) * ‖iteratedFDeriv ℝ x_1 f.toFun x‖ * ‖iteratedFDeriv ℝ (n - x_1) g x‖) ≤
    (↑n + 1) * ↑(Nat.choose n (n / 2)) * (C * 2 ^ (l + k)) *
      (Finset.sup (Finset.Iic (l + k, n)) (schwartzSeminormFamily ℝ D E)) f

Next tactic:
rw [mul_assoc ((n : ℝ) + 1)]
/-- The map `f ↦ (x ↦ B (f x) (g x))` as a continuous `𝕜`-linear map on Schwartz space,
where `B` is a continuous `𝕜`-linear map and `g` is a function of temperate growth. -/
def bilinLeftCLM (B : E →L[ℝ] F →L[ℝ] G) {g : D → F} (hg : g.HasTemperateGrowth) :
    𝓢(D, E) →L[ℝ] 𝓢(D, G) :=
  -- Todo (after port): generalize to `B : E →L[𝕜] F →L[𝕜] G` and `𝕜`-linear
    mkCLM
    (fun f x => B (f x) (g x))
    (fun _ _ _ => by
      simp only [map_add, add_left_inj, Pi.add_apply, eq_self_iff_true,
        ContinuousLinearMap.add_apply])
    (fun _ _ _ => by
      simp only [smul_apply, map_smul, ContinuousLinearMap.coe_smul', Pi.smul_apply,
        RingHom.id_apply])
    (fun f => (B.isBoundedBilinearMap.contDiff.restrict_scalars ℝ).comp (f.smooth'.prod hg.1))
    (by
      -- Porting note: rewrite this proof with `rel_congr`
      rintro ⟨k, n⟩
      rcases hg.norm_iteratedFDeriv_le_uniform_aux n with ⟨l, C, hC, hgrowth⟩
      use
        Finset.Iic (l + k, n), ‖B‖ * ((n : ℝ) + (1 : ℝ)) * n.choose (n / 2) * (C * 2 ^ (l + k)),
        by positivity
      intro f x
      have hxk : 0 ≤ ‖x‖ ^ k := by positivity
      have hnorm_mul :=
        ContinuousLinearMap.norm_iteratedFDeriv_le_of_bilinear B f.smooth' hg.1 x (n := n) le_top
      refine' le_trans (mul_le_mul_of_nonneg_left hnorm_mul hxk) _
      rw [← mul_assoc (‖x‖ ^ k), mul_comm (‖x‖ ^ k)]
      simp_rw [mul_assoc ‖B‖]
      refine' mul_le_mul_of_nonneg_left _ (by positivity)
      rw [Finset.mul_sum]
      have : (∑ _x : ℕ in Finset.range (n + 1), (1 : ℝ)) = n + 1 := by simp
      repeat 

Proof state:
case right
𝕜 : Type u_1
𝕜' : Type u_2
D : Type u_3
E : Type u_4
F : Type u_5
G : Type u_6
inst✝⁷ : NormedAddCommGroup E
inst✝⁶ : NormedSpace ℝ E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedSpace ℝ F
inst✝³ : NormedAddCommGroup D
inst✝² : NormedSpace ℝ D
inst✝¹ : NormedAddCommGroup G
inst✝ : NormedSpace ℝ G
B : E →L[ℝ] F →L[ℝ] G
g : D → F
hg : Function.HasTemperateGrowth g
k n l : ℕ
C : ℝ
hC : 0 ≤ C
hgrowth : ∀ N ≤ n, ∀ (x : D), ‖iteratedFDeriv ℝ N g x‖ ≤ C * (1 + ‖x‖) ^ l
f : 𝓢(D, E)
x : D
hxk : 0 ≤ ‖x‖ ^ k
hnorm_mul :
  ‖iteratedFDeriv ℝ n (fun y => (B (toFun f y)) (g y)) x‖ ≤
    ‖B‖ *
      ∑ i in Finset.range (n + 1), ↑(Nat.choose n i) * ‖iteratedFDeriv ℝ i f.toFun x‖ * ‖iteratedFDeriv ℝ (n - i) g x‖
this : ∑ _x in Finset.range (n + 1), 1 = ↑n + 1
⊢ ∑ x_1 in Finset.range (n + 1),
      ‖x‖ ^ k * (↑(Nat.choose n x_1) * ‖iteratedFDeriv ℝ x_1 f.toFun x‖ * ‖iteratedFDeriv ℝ (n - x_1) g x‖) ≤
    (↑n + 1) * (↑(Nat.choose n (n / 2)) * (C * 2 ^ (l + k))) *
      (Finset.sup (Finset.Iic (l + k, n)) (schwartzSeminormFamily ℝ D E)) f

Next tactic:
rw [mul_assoc ((n : ℝ) + 1)]