l3lab/ntp-mathlib huggingface dataset:
/-- Composition of an `L^p` function with a measure preserving function is an `L^p` function. -/
def compMeasurePreserving (f : α → β) (hf : MeasurePreserving f μ μb) :
    Lp E p μb →+ Lp E p μ where
  toFun g := ⟨g.1.compMeasurePreserving f hf, g.1.compMeasurePreserving_mem_Lp g.2 hf⟩
  map_zero' := rfl
  map_add' := by rintro ⟨⟨_⟩, _⟩ ⟨⟨_⟩, _⟩; 

Proof state:
case mk.mk.mk.mk
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
β : Type u_5
inst✝ : MeasurableSpace β
μb : Measure β
f✝ f : α → β
hf : MeasurePreserving f
val✝¹ : β →ₘ[μb] E
a✝¹ : { f // AEStronglyMeasurable f μb }
property✝¹ : Quot.mk Setoid.r a✝¹ ∈ Lp E p
val✝ : β →ₘ[μb] E
a✝ : { f // AEStronglyMeasurable f μb }
property✝ : Quot.mk Setoid.r a✝ ∈ Lp E p
⊢ ZeroHom.toFun
      {
        toFun := fun g =>
          { val := AEEqFun.compMeasurePreserving (↑g) f hf,
            property := (_ : AEEqFun.compMeasurePreserving (↑g) f hf ∈ Lp E p) },
        map_zero' :=
          (_ :
            (fun g =>
                  { val := AEEqFun.compMeasurePreserving (↑g) f hf,
                    property := (_ : AEEqFun.compMeasurePreserving (↑g) f hf ∈ Lp E p) })
                0 =
              (fun g =>
                  { val := AEEqFun.compMeasurePreserving (↑g) f hf,
                    property := (_ : AEEqFun.compMeasurePreserving (↑g) f hf ∈ Lp E p) })
                0) }
      ({ val := Quot.mk Setoid.r a✝¹, property := property✝¹ } +
        { val := Quot.mk Setoid.r a✝, property := property✝ }) =
    ZeroHom.toFun
        {
          toFun := fun g =>
            { val := AEEqFun.compMeasurePreserving (↑g) f hf,
              property := (_ : AEEqFun.compMeasurePreserving (↑g) f hf ∈ Lp E p) },
          map_zero' :=
            (_ :
              (fun g =>
                    { val := AEEqFun.compMeasurePreserving (↑g) f hf,
                      property := (_ : AEEqFun.compMeasurePreserving (↑g) f hf ∈ Lp E p) })
                  0 =
                (fun g =>
                    { val := AEEqFun.compMeasurePreserving (↑g) f hf,
                      property := (_ : AEEqFun.compMeasurePreserving (↑g) f hf ∈ Lp E p) })
                  0) }
        { val := Quot.mk Setoid.r a✝¹, property := property✝¹ } +
      ZeroHom.toFun
        {
          toFun := fun g =>
            { val := AEEqFun.compMeasurePreserving (↑g) f hf,
              property := (_ : AEEqFun.compMeasurePreserving (↑g) f hf ∈ Lp E p) },
          map_zero' :=
            (_ :
              (fun g =>
                    { val := AEEqFun.compMeasurePreserving (↑g) f hf,
                      property := (_ : AEEqFun.compMeasurePreserving (↑g) f hf ∈ Lp E p) })
                  0 =
                (fun g =>
                    { val := AEEqFun.compMeasurePreserving (↑g) f hf,
                      property := (_ : AEEqFun.compMeasurePreserving (↑g) f hf ∈ Lp E p) })
                  0) }
        { val := Quot.mk Setoid.r a✝, property := property✝ }

Next tactic:
rfl
/-- `MeasureTheory.Lp.compMeasurePreserving` as a linear map. -/
@[simps]
def compMeasurePreservingₗ (f : α → β) (hf : MeasurePreserving f μ μb) :
    Lp E p μb →ₗ[𝕜] Lp E p μ where
  __ := compMeasurePreserving f hf
  map_smul' c g := by 

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝⁶ : NormedAddCommGroup E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedAddCommGroup G
β : Type u_5
inst✝³ : MeasurableSpace β
μb : Measure β
f✝ : α → β
𝕜 : Type u_6
inst✝² : NormedRing 𝕜
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
f : α → β
hf : MeasurePreserving f
src✝ : ↥(Lp E p) →+ ↥(Lp E p) := compMeasurePreserving f hf
c : 𝕜
g : ↥(Lp E p)
⊢ AddHom.toFun
      { toFun := src✝.toFun,
        map_add' :=
          (_ : ∀ (x y : ↥(Lp E p)), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
      (c • g) =
    (RingHom.id 𝕜) c •
      AddHom.toFun
        { toFun := src✝.toFun,
          map_add' :=
            (_ :
              ∀ (x y : ↥(Lp E p)), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
        g

Next tactic:
rcases g with ⟨⟨_⟩, _⟩
/-- `MeasureTheory.Lp.compMeasurePreserving` as a linear map. -/
@[simps]
def compMeasurePreservingₗ (f : α → β) (hf : MeasurePreserving f μ μb) :
    Lp E p μb →ₗ[𝕜] Lp E p μ where
  __ := compMeasurePreserving f hf
  map_smul' c g := by rcases g with ⟨⟨_⟩, _⟩; 

Proof state:
case mk.mk
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝⁶ : NormedAddCommGroup E
inst✝⁵ : NormedAddCommGroup F
inst✝⁴ : NormedAddCommGroup G
β : Type u_5
inst✝³ : MeasurableSpace β
μb : Measure β
f✝ : α → β
𝕜 : Type u_6
inst✝² : NormedRing 𝕜
inst✝¹ : Module 𝕜 E
inst✝ : BoundedSMul 𝕜 E
f : α → β
hf : MeasurePreserving f
src✝ : ↥(Lp E p) →+ ↥(Lp E p) := compMeasurePreserving f hf
c : 𝕜
val✝ : β →ₘ[μb] E
a✝ : { f // AEStronglyMeasurable f μb }
property✝ : Quot.mk Setoid.r a✝ ∈ Lp E p
⊢ AddHom.toFun
      { toFun := src✝.toFun,
        map_add' :=
          (_ : ∀ (x y : ↥(Lp E p)), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
      (c • { val := Quot.mk Setoid.r a✝, property := property✝ }) =
    (RingHom.id 𝕜) c •
      AddHom.toFun
        { toFun := src✝.toFun,
          map_add' :=
            (_ :
              ∀ (x y : ↥(Lp E p)), ZeroHom.toFun (↑src✝) (x + y) = ZeroHom.toFun (↑src✝) x + ZeroHom.toFun (↑src✝) y) }
        { val := Quot.mk Setoid.r a✝, property := property✝ }

Next tactic:
rfl
theorem LipschitzWith.comp_memℒp {α E F} {K} [MeasurableSpace α] {μ : Measure α}
    [NormedAddCommGroup E] [NormedAddCommGroup F] {f : α → E} {g : E → F} (hg : LipschitzWith K g)
    (g0 : g 0 = 0) (hL : Memℒp f p μ) : Memℒp (g ∘ f) p μ :=
  have : ∀ x, ‖g (f x)‖ ≤ K * ‖f x‖ := fun x ↦ by
    -- TODO: add `LipschitzWith.nnnorm_sub_le` and `LipschitzWith.nnnorm_le`
    

Proof state:
α✝ : Type u_1
E✝ : Type u_2
F✝ : Type u_3
G : Type u_4
m m0 : MeasurableSpace α✝
p : ℝ≥0∞
q : ℝ
μ✝ ν : Measure α✝
inst✝⁵ : NormedAddCommGroup E✝
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedAddCommGroup G
g✝ : E✝ → F✝
c : ℝ≥0
α : Type u_5
E : Type u_6
F : Type u_7
K : ℝ≥0
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f : α → E
g : E → F
hg : LipschitzWith K g
g0 : g 0 = 0
hL : Memℒp f p
x : α
⊢ ‖g (f x)‖ ≤ ↑K * ‖f x‖

Next tactic:
simpa [g0] using hg.norm_sub_le (f x) 0
theorem MeasureTheory.Memℒp.of_comp_antilipschitzWith {α E F} {K'} [MeasurableSpace α]
    {μ : Measure α} [NormedAddCommGroup E] [NormedAddCommGroup F] {f : α → E} {g : E → F}
    (hL : Memℒp (g ∘ f) p μ) (hg : UniformContinuous g) (hg' : AntilipschitzWith K' g)
    (g0 : g 0 = 0) : Memℒp f p μ := by
  

Proof state:
α✝ : Type u_1
E✝ : Type u_2
F✝ : Type u_3
G : Type u_4
m m0 : MeasurableSpace α✝
p : ℝ≥0∞
q : ℝ
μ✝ ν : Measure α✝
inst✝⁵ : NormedAddCommGroup E✝
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedAddCommGroup G
g✝ : E✝ → F✝
c : ℝ≥0
α : Type u_5
E : Type u_6
F : Type u_7
K' : ℝ≥0
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f : α → E
g : E → F
hL : Memℒp (g ∘ f) p
hg : UniformContinuous g
hg' : AntilipschitzWith K' g
g0 : g 0 = 0
⊢ Memℒp f p

Next tactic:
have A : ∀ x, ‖f x‖ ≤ K' * ‖g (f x)‖ := by
    intro x
    -- TODO: add `AntilipschitzWith.le_mul_nnnorm_sub` and `AntilipschitzWith.le_mul_norm`
    rw [← dist_zero_right, ← dist_zero_right, ← g0]
    apply hg'.le_mul_dist
theorem MeasureTheory.Memℒp.of_comp_antilipschitzWith {α E F} {K'} [MeasurableSpace α]
    {μ : Measure α} [NormedAddCommGroup E] [NormedAddCommGroup F] {f : α → E} {g : E → F}
    (hL : Memℒp (g ∘ f) p μ) (hg : UniformContinuous g) (hg' : AntilipschitzWith K' g)
    (g0 : g 0 = 0) : Memℒp f p μ := by
  have A : ∀ x, ‖f x‖ ≤ K' * ‖g (f x)‖ := by
    

Proof state:
α✝ : Type u_1
E✝ : Type u_2
F✝ : Type u_3
G : Type u_4
m m0 : MeasurableSpace α✝
p : ℝ≥0∞
q : ℝ
μ✝ ν : Measure α✝
inst✝⁵ : NormedAddCommGroup E✝
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedAddCommGroup G
g✝ : E✝ → F✝
c : ℝ≥0
α : Type u_5
E : Type u_6
F : Type u_7
K' : ℝ≥0
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f : α → E
g : E → F
hL : Memℒp (g ∘ f) p
hg : UniformContinuous g
hg' : AntilipschitzWith K' g
g0 : g 0 = 0
⊢ ∀ (x : α), ‖f x‖ ≤ ↑K' * ‖g (f x)‖

Next tactic:
intro x
theorem MeasureTheory.Memℒp.of_comp_antilipschitzWith {α E F} {K'} [MeasurableSpace α]
    {μ : Measure α} [NormedAddCommGroup E] [NormedAddCommGroup F] {f : α → E} {g : E → F}
    (hL : Memℒp (g ∘ f) p μ) (hg : UniformContinuous g) (hg' : AntilipschitzWith K' g)
    (g0 : g 0 = 0) : Memℒp f p μ := by
  have A : ∀ x, ‖f x‖ ≤ K' * ‖g (f x)‖ := by
    intro x
    -- TODO: add `AntilipschitzWith.le_mul_nnnorm_sub` and `AntilipschitzWith.le_mul_norm`
    

Proof state:
α✝ : Type u_1
E✝ : Type u_2
F✝ : Type u_3
G : Type u_4
m m0 : MeasurableSpace α✝
p : ℝ≥0∞
q : ℝ
μ✝ ν : Measure α✝
inst✝⁵ : NormedAddCommGroup E✝
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedAddCommGroup G
g✝ : E✝ → F✝
c : ℝ≥0
α : Type u_5
E : Type u_6
F : Type u_7
K' : ℝ≥0
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f : α → E
g : E → F
hL : Memℒp (g ∘ f) p
hg : UniformContinuous g
hg' : AntilipschitzWith K' g
g0 : g 0 = 0
x : α
⊢ ‖f x‖ ≤ ↑K' * ‖g (f x)‖

Next tactic:
rw [← dist_zero_right, ← dist_zero_right, ← g0]
theorem MeasureTheory.Memℒp.of_comp_antilipschitzWith {α E F} {K'} [MeasurableSpace α]
    {μ : Measure α} [NormedAddCommGroup E] [NormedAddCommGroup F] {f : α → E} {g : E → F}
    (hL : Memℒp (g ∘ f) p μ) (hg : UniformContinuous g) (hg' : AntilipschitzWith K' g)
    (g0 : g 0 = 0) : Memℒp f p μ := by
  have A : ∀ x, ‖f x‖ ≤ K' * ‖g (f x)‖ := by
    intro x
    -- TODO: add `AntilipschitzWith.le_mul_nnnorm_sub` and `AntilipschitzWith.le_mul_norm`
    rw [← dist_zero_right, ← dist_zero_right, ← g0]
    

Proof state:
α✝ : Type u_1
E✝ : Type u_2
F✝ : Type u_3
G : Type u_4
m m0 : MeasurableSpace α✝
p : ℝ≥0∞
q : ℝ
μ✝ ν : Measure α✝
inst✝⁵ : NormedAddCommGroup E✝
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedAddCommGroup G
g✝ : E✝ → F✝
c : ℝ≥0
α : Type u_5
E : Type u_6
F : Type u_7
K' : ℝ≥0
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f : α → E
g : E → F
hL : Memℒp (g ∘ f) p
hg : UniformContinuous g
hg' : AntilipschitzWith K' g
g0 : g 0 = 0
x : α
⊢ dist (f x) 0 ≤ ↑K' * dist (g (f x)) (g 0)

Next tactic:
apply hg'.le_mul_dist
theorem MeasureTheory.Memℒp.of_comp_antilipschitzWith {α E F} {K'} [MeasurableSpace α]
    {μ : Measure α} [NormedAddCommGroup E] [NormedAddCommGroup F] {f : α → E} {g : E → F}
    (hL : Memℒp (g ∘ f) p μ) (hg : UniformContinuous g) (hg' : AntilipschitzWith K' g)
    (g0 : g 0 = 0) : Memℒp f p μ := by
  have A : ∀ x, ‖f x‖ ≤ K' * ‖g (f x)‖ := by
    intro x
    -- TODO: add `AntilipschitzWith.le_mul_nnnorm_sub` and `AntilipschitzWith.le_mul_norm`
    rw [← dist_zero_right, ← dist_zero_right, ← g0]
    apply hg'.le_mul_dist
  

Proof state:
α✝ : Type u_1
E✝ : Type u_2
F✝ : Type u_3
G : Type u_4
m m0 : MeasurableSpace α✝
p : ℝ≥0∞
q : ℝ
μ✝ ν : Measure α✝
inst✝⁵ : NormedAddCommGroup E✝
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedAddCommGroup G
g✝ : E✝ → F✝
c : ℝ≥0
α : Type u_5
E : Type u_6
F : Type u_7
K' : ℝ≥0
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f : α → E
g : E → F
hL : Memℒp (g ∘ f) p
hg : UniformContinuous g
hg' : AntilipschitzWith K' g
g0 : g 0 = 0
A : ∀ (x : α), ‖f x‖ ≤ ↑K' * ‖g (f x)‖
⊢ Memℒp f p

Next tactic:
have B : AEStronglyMeasurable f μ :=
    (hg'.uniformEmbedding hg).embedding.aestronglyMeasurable_comp_iff.1 hL.1
theorem MeasureTheory.Memℒp.of_comp_antilipschitzWith {α E F} {K'} [MeasurableSpace α]
    {μ : Measure α} [NormedAddCommGroup E] [NormedAddCommGroup F] {f : α → E} {g : E → F}
    (hL : Memℒp (g ∘ f) p μ) (hg : UniformContinuous g) (hg' : AntilipschitzWith K' g)
    (g0 : g 0 = 0) : Memℒp f p μ := by
  have A : ∀ x, ‖f x‖ ≤ K' * ‖g (f x)‖ := by
    intro x
    -- TODO: add `AntilipschitzWith.le_mul_nnnorm_sub` and `AntilipschitzWith.le_mul_norm`
    rw [← dist_zero_right, ← dist_zero_right, ← g0]
    apply hg'.le_mul_dist
  have B : AEStronglyMeasurable f μ :=
    (hg'.uniformEmbedding hg).embedding.aestronglyMeasurable_comp_iff.1 hL.1
  

Proof state:
α✝ : Type u_1
E✝ : Type u_2
F✝ : Type u_3
G : Type u_4
m m0 : MeasurableSpace α✝
p : ℝ≥0∞
q : ℝ
μ✝ ν : Measure α✝
inst✝⁵ : NormedAddCommGroup E✝
inst✝⁴ : NormedAddCommGroup F✝
inst✝³ : NormedAddCommGroup G
g✝ : E✝ → F✝
c : ℝ≥0
α : Type u_5
E : Type u_6
F : Type u_7
K' : ℝ≥0
inst✝² : MeasurableSpace α
μ : Measure α
inst✝¹ : NormedAddCommGroup E
inst✝ : NormedAddCommGroup F
f : α → E
g : E → F
hL : Memℒp (g ∘ f) p
hg : UniformContinuous g
hg' : AntilipschitzWith K' g
g0 : g 0 = 0
A : ∀ (x : α), ‖f x‖ ≤ ↑K' * ‖g (f x)‖
B : AEStronglyMeasurable f μ
⊢ Memℒp f p

Next tactic:
exact hL.of_le_mul B (Filter.eventually_of_forall A)
/-- When `g` is a Lipschitz function sending `0` to `0` and `f` is in `Lp`, then `g ∘ f` is well
defined as an element of `Lp`. -/
def compLp (hg : LipschitzWith c g) (g0 : g 0 = 0) (f : Lp E p μ) : Lp F p μ :=
  ⟨AEEqFun.comp g hg.continuous (f : α →ₘ[μ] E), by
    

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
f : ↥(Lp E p)
⊢ AEEqFun.comp g (_ : Continuous g) ↑f ∈ Lp F p

Next tactic:
suffices ∀ᵐ x ∂μ, ‖AEEqFun.comp g hg.continuous (f : α →ₘ[μ] E) x‖ ≤ c * ‖f x‖ from
      Lp.mem_Lp_of_ae_le_mul this
/-- When `g` is a Lipschitz function sending `0` to `0` and `f` is in `Lp`, then `g ∘ f` is well
defined as an element of `Lp`. -/
def compLp (hg : LipschitzWith c g) (g0 : g 0 = 0) (f : Lp E p μ) : Lp F p μ :=
  ⟨AEEqFun.comp g hg.continuous (f : α →ₘ[μ] E), by
    suffices ∀ᵐ x ∂μ, ‖AEEqFun.comp g hg.continuous (f : α →ₘ[μ] E) x‖ ≤ c * ‖f x‖ from
      Lp.mem_Lp_of_ae_le_mul this
    

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
f : ↥(Lp E p)
⊢ ∀ᵐ (x : α) ∂μ, ‖↑(AEEqFun.comp g (_ : Continuous g) ↑f) x‖ ≤ ↑c * ‖↑↑f x‖

Next tactic:
filter_upwards [AEEqFun.coeFn_comp g hg.continuous (f : α →ₘ[μ] E)] with a ha
/-- When `g` is a Lipschitz function sending `0` to `0` and `f` is in `Lp`, then `g ∘ f` is well
defined as an element of `Lp`. -/
def compLp (hg : LipschitzWith c g) (g0 : g 0 = 0) (f : Lp E p μ) : Lp F p μ :=
  ⟨AEEqFun.comp g hg.continuous (f : α →ₘ[μ] E), by
    suffices ∀ᵐ x ∂μ, ‖AEEqFun.comp g hg.continuous (f : α →ₘ[μ] E) x‖ ≤ c * ‖f x‖ from
      Lp.mem_Lp_of_ae_le_mul this
    filter_upwards [AEEqFun.coeFn_comp g hg.continuous (f : α →ₘ[μ] E)] with a ha
    

Proof state:
case h
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
f : ↥(Lp E p)
a : α
ha : ↑(AEEqFun.comp g (_ : Continuous g) ↑f) a = (g ∘ ↑↑f) a
⊢ ‖↑(AEEqFun.comp g (_ : Continuous g) ↑f) a‖ ≤ ↑c * ‖↑↑f a‖

Next tactic:
simp only [ha]
/-- When `g` is a Lipschitz function sending `0` to `0` and `f` is in `Lp`, then `g ∘ f` is well
defined as an element of `Lp`. -/
def compLp (hg : LipschitzWith c g) (g0 : g 0 = 0) (f : Lp E p μ) : Lp F p μ :=
  ⟨AEEqFun.comp g hg.continuous (f : α →ₘ[μ] E), by
    suffices ∀ᵐ x ∂μ, ‖AEEqFun.comp g hg.continuous (f : α →ₘ[μ] E) x‖ ≤ c * ‖f x‖ from
      Lp.mem_Lp_of_ae_le_mul this
    filter_upwards [AEEqFun.coeFn_comp g hg.continuous (f : α →ₘ[μ] E)] with a ha
    simp only [ha]
    

Proof state:
case h
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
f : ↥(Lp E p)
a : α
ha : ↑(AEEqFun.comp g (_ : Continuous g) ↑f) a = (g ∘ ↑↑f) a
⊢ ‖(g ∘ ↑↑f) a‖ ≤ ↑c * ‖↑↑f a‖

Next tactic:
rw [← dist_zero_right, ← dist_zero_right, ← g0]
/-- When `g` is a Lipschitz function sending `0` to `0` and `f` is in `Lp`, then `g ∘ f` is well
defined as an element of `Lp`. -/
def compLp (hg : LipschitzWith c g) (g0 : g 0 = 0) (f : Lp E p μ) : Lp F p μ :=
  ⟨AEEqFun.comp g hg.continuous (f : α →ₘ[μ] E), by
    suffices ∀ᵐ x ∂μ, ‖AEEqFun.comp g hg.continuous (f : α →ₘ[μ] E) x‖ ≤ c * ‖f x‖ from
      Lp.mem_Lp_of_ae_le_mul this
    filter_upwards [AEEqFun.coeFn_comp g hg.continuous (f : α →ₘ[μ] E)] with a ha
    simp only [ha]
    rw [← dist_zero_right, ← dist_zero_right, ← g0]
    

Proof state:
case h
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
f : ↥(Lp E p)
a : α
ha : ↑(AEEqFun.comp g (_ : Continuous g) ↑f) a = (g ∘ ↑↑f) a
⊢ dist ((g ∘ ↑↑f) a) (g 0) ≤ ↑c * dist (↑↑f a) 0

Next tactic:
exact hg.dist_le_mul (f a) 0
@[simp]
theorem compLp_zero (hg : LipschitzWith c g) (g0 : g 0 = 0) : hg.compLp g0 (0 : Lp E p μ) = 0 := by
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
⊢ compLp hg g0 0 = 0

Next tactic:
rw [Lp.eq_zero_iff_ae_eq_zero]
@[simp]
theorem compLp_zero (hg : LipschitzWith c g) (g0 : g 0 = 0) : hg.compLp g0 (0 : Lp E p μ) = 0 := by
  rw [Lp.eq_zero_iff_ae_eq_zero]
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
⊢ ↑↑(compLp hg g0 0) =ᵐ[μ] 0

Next tactic:
apply (coeFn_compLp _ _ _).trans
@[simp]
theorem compLp_zero (hg : LipschitzWith c g) (g0 : g 0 = 0) : hg.compLp g0 (0 : Lp E p μ) = 0 := by
  rw [Lp.eq_zero_iff_ae_eq_zero]
  apply (coeFn_compLp _ _ _).trans
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
⊢ g ∘ ↑↑0 =ᵐ[μ] 0

Next tactic:
filter_upwards [Lp.coeFn_zero E p μ] with _ ha
@[simp]
theorem compLp_zero (hg : LipschitzWith c g) (g0 : g 0 = 0) : hg.compLp g0 (0 : Lp E p μ) = 0 := by
  rw [Lp.eq_zero_iff_ae_eq_zero]
  apply (coeFn_compLp _ _ _).trans
  filter_upwards [Lp.coeFn_zero E p μ] with _ ha
  

Proof state:
case h
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
a✝ : α
ha : ↑↑0 a✝ = OfNat.ofNat 0 a✝
⊢ (g ∘ ↑↑0) a✝ = OfNat.ofNat 0 a✝

Next tactic:
simp only [ha, g0, Function.comp_apply, Pi.zero_apply]
theorem norm_compLp_sub_le (hg : LipschitzWith c g) (g0 : g 0 = 0) (f f' : Lp E p μ) :
    ‖hg.compLp g0 f - hg.compLp g0 f'‖ ≤ c * ‖f - f'‖ := by
  

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
f f' : ↥(Lp E p)
⊢ ‖compLp hg g0 f - compLp hg g0 f'‖ ≤ ↑c * ‖f - f'‖

Next tactic:
apply Lp.norm_le_mul_norm_of_ae_le_mul
theorem norm_compLp_sub_le (hg : LipschitzWith c g) (g0 : g 0 = 0) (f f' : Lp E p μ) :
    ‖hg.compLp g0 f - hg.compLp g0 f'‖ ≤ c * ‖f - f'‖ := by
  apply Lp.norm_le_mul_norm_of_ae_le_mul
  

Proof state:
case h
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
f f' : ↥(Lp E p)
⊢ ∀ᵐ (x : α) ∂μ, ‖↑↑(compLp hg g0 f - compLp hg g0 f') x‖ ≤ ↑c * ‖↑↑(f - f') x‖

Next tactic:
filter_upwards [hg.coeFn_compLp g0 f, hg.coeFn_compLp g0 f',
    Lp.coeFn_sub (hg.compLp g0 f) (hg.compLp g0 f'), Lp.coeFn_sub f f'] with a ha1 ha2 ha3 ha4
theorem norm_compLp_sub_le (hg : LipschitzWith c g) (g0 : g 0 = 0) (f f' : Lp E p μ) :
    ‖hg.compLp g0 f - hg.compLp g0 f'‖ ≤ c * ‖f - f'‖ := by
  apply Lp.norm_le_mul_norm_of_ae_le_mul
  filter_upwards [hg.coeFn_compLp g0 f, hg.coeFn_compLp g0 f',
    Lp.coeFn_sub (hg.compLp g0 f) (hg.compLp g0 f'), Lp.coeFn_sub f f'] with a ha1 ha2 ha3 ha4
  

Proof state:
case h
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
f f' : ↥(Lp E p)
a : α
ha1 : ↑↑(compLp hg g0 f) a = (g ∘ ↑↑f) a
ha2 : ↑↑(compLp hg g0 f') a = (g ∘ ↑↑f') a
ha3 : ↑↑(compLp hg g0 f - compLp hg g0 f') a = (↑↑(compLp hg g0 f) - ↑↑(compLp hg g0 f')) a
ha4 : ↑↑(f - f') a = (↑↑f - ↑↑f') a
⊢ ‖↑↑(compLp hg g0 f - compLp hg g0 f') a‖ ≤ ↑c * ‖↑↑(f - f') a‖

Next tactic:
simp only [ha1, ha2, ha3, ha4, ← dist_eq_norm, Pi.sub_apply, Function.comp_apply]
theorem norm_compLp_sub_le (hg : LipschitzWith c g) (g0 : g 0 = 0) (f f' : Lp E p μ) :
    ‖hg.compLp g0 f - hg.compLp g0 f'‖ ≤ c * ‖f - f'‖ := by
  apply Lp.norm_le_mul_norm_of_ae_le_mul
  filter_upwards [hg.coeFn_compLp g0 f, hg.coeFn_compLp g0 f',
    Lp.coeFn_sub (hg.compLp g0 f) (hg.compLp g0 f'), Lp.coeFn_sub f f'] with a ha1 ha2 ha3 ha4
  simp only [ha1, ha2, ha3, ha4, ← dist_eq_norm, Pi.sub_apply, Function.comp_apply]
  

Proof state:
case h
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
f f' : ↥(Lp E p)
a : α
ha1 : ↑↑(compLp hg g0 f) a = (g ∘ ↑↑f) a
ha2 : ↑↑(compLp hg g0 f') a = (g ∘ ↑↑f') a
ha3 : ↑↑(compLp hg g0 f - compLp hg g0 f') a = (↑↑(compLp hg g0 f) - ↑↑(compLp hg g0 f')) a
ha4 : ↑↑(f - f') a = (↑↑f - ↑↑f') a
⊢ dist (g (↑↑f a)) (g (↑↑f' a)) ≤ ↑c * dist (↑↑f a) (↑↑f' a)

Next tactic:
exact hg.dist_le_mul (f a) (f' a)
theorem norm_compLp_le (hg : LipschitzWith c g) (g0 : g 0 = 0) (f : Lp E p μ) :
    ‖hg.compLp g0 f‖ ≤ c * ‖f‖ := by 

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝² : NormedAddCommGroup E
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedAddCommGroup G
g : E → F
c : ℝ≥0
hg : LipschitzWith c g
g0 : g 0 = 0
f : ↥(Lp E p)
⊢ ‖compLp hg g0 f‖ ≤ ↑c * ‖f‖

Next tactic:
simpa using hg.norm_compLp_sub_le g0 f 0
theorem lipschitzWith_compLp [Fact (1 ≤ p)] (hg : LipschitzWith c g) (g0 : g 0 = 0) :
    LipschitzWith c (hg.compLp g0 : Lp E p μ → Lp F p μ) :=
  LipschitzWith.of_dist_le_mul fun f g => by 

Proof state:
α : Type u_1
E : Type u_2
F : Type u_3
G : Type u_4
m m0 : MeasurableSpace α
p : ℝ≥0∞
q : ℝ
μ ν : Measure α
inst✝³ : NormedAddCommGroup E
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedAddCommGroup G
g✝ : E → F
c : ℝ≥0
inst✝ : Fact (1 ≤ p)
hg : LipschitzWith c g✝
g0 : g✝ 0 = 0
f g : ↥(Lp E p)
⊢ dist (compLp hg g0 f) (compLp hg g0 g) ≤ ↑c * dist f g

Next tactic:
simp [dist_eq_norm, norm_compLp_sub_le]