-- Mathlib/MeasureTheory/Function/ConditionalExpectation/CondexpL2.lean
theorem lintegral_nnnorm_condExpL2_indicator_le_real (hs : MeasurableSet s) (hμs : μ s ≠ ∞)
    (ht : MeasurableSet[m] t) (hμt : μ t ≠ ∞) :
    ∫⁻ a in t, ‖(condExpL2 ℝ ℝ hm (indicatorConstLp 2 hs hμs 1) : α → ℝ) a‖₊ ∂μ ≤ μ (s ∩ t)

Proof state:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
x : α
hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = s.indicator (fun x => 1) x
⊢ (fun x => ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊) x = s.indicator (fun x => 1) x

Tactic:
dsimp only

Result:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
x : α
hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = s.indicator (fun x => 1) x
⊢ ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ = s.indicator (fun x => 1) x

Proof state:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
h_eq : ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = ∫⁻ (x : α) in t, s.indicator (fun x => 1) x ∂μ
⊢ 1 * (μ.restrict (s ∩ t)) Set.univ = μ (s ∩ t)

Tactic:
simp only [one_mul, Set.univ_inter, MeasurableSet.univ, Measure.restrict_apply]

Result:
no goals

Proof state:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
h_eq : ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = ∫⁻ (x : α) in t, s.indicator (fun x => 1) x ∂μ
⊢ ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = μ (s ∩ t)

Tactic:
rw [h_eq, lintegral_indicator hs, lintegral_const, Measure.restrict_restrict hs]

Result:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
h_eq : ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = ∫⁻ (x : α) in t, s.indicator (fun x => 1) x ∂μ
⊢ 1 * (μ.restrict (s ∩ t)) Set.univ = μ (s ∩ t)

Proof state:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
x : α
hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = s.indicator (fun x => 1) x
⊢ ↑‖s.indicator (fun x => 1) x‖₊ = s.indicator (fun x => 1) x

Tactic:
simp_rw [Set.indicator_apply]

Result:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
x : α
hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = s.indicator (fun x => 1) x
⊢ ↑‖if x ∈ s then 1 else 0‖₊ = if x ∈ s then 1 else 0

Proof state:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
⊢ ∫⁻ (a : α) in t, ↑‖↑↑↑((condExpL2 ℝ ℝ hm) (indicatorConstLp 2 hs hμs 1)) a‖₊ ∂μ ≤ μ (s ∩ t)

Tactic:
refine (lintegral_nnnorm_condExpL2_le ht hμt _).trans (le_of_eq ?_)

Result:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
⊢ ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = μ (s ∩ t)

Proof state:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
⊢ ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = μ (s ∩ t)

Tactic:
have h_eq :
  ∫⁻ x in t, ‖(indicatorConstLp 2 hs hμs (1 : ℝ)) x‖₊ ∂μ =
    ∫⁻ x in t, s.indicator (fun _ => (1 : ℝ≥0∞)) x ∂μ := by
  refine lintegral_congr_ae (ae_restrict_of_ae ?_)
  refine (@indicatorConstLp_coeFn _ _ _ 2 _ _ _ hs hμs (1 : ℝ)).mono fun x hx => ?_
  dsimp only
  rw [hx]
  classical
  simp_rw [Set.indicator_apply]
  split_ifs <;> simp

Result:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
h_eq : ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = ∫⁻ (x : α) in t, s.indicator (fun x => 1) x ∂μ
⊢ ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = μ (s ∩ t)

Proof state:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
x : α
hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = s.indicator (fun x => 1) x
⊢ ↑‖if x ∈ s then 1 else 0‖₊ = if x ∈ s then 1 else 0

Tactic:
split_ifs <;> simp

Result:
no goals

Proof state:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
⊢ ∫⁻ (x : α) in t, ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ ∂μ = ∫⁻ (x : α) in t, s.indicator (fun x => 1) x ∂μ

Tactic:
refine lintegral_congr_ae (ae_restrict_of_ae ?_)

Result:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
⊢ ∀ᵐ (x : α) ∂μ, (fun x => ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊) x = s.indicator (fun x => 1) x

Proof state:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
x : α
hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = s.indicator (fun x => 1) x
⊢ ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊ = s.indicator (fun x => 1) x

Tactic:
rw [hx]

Result:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
x : α
hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = s.indicator (fun x => 1) x
⊢ ↑‖s.indicator (fun x => 1) x‖₊ = s.indicator (fun x => 1) x

Proof state:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
x : α
hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = s.indicator (fun x => 1) x
⊢ ↑‖s.indicator (fun x => 1) x‖₊ = s.indicator (fun x => 1) x

Tactic:
classical
simp_rw [Set.indicator_apply]
split_ifs <;> simp

Result:
no goals

Proof state:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
⊢ ∀ᵐ (x : α) ∂μ, (fun x => ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊) x = s.indicator (fun x => 1) x

Tactic:
refine (@indicatorConstLp_coeFn _ _ _ 2 _ _ _ hs hμs (1 : ℝ)).mono fun x hx => ?_

Result:
α : Type u_1
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
hm : m ≤ m0
hs : MeasurableSet s
hμs : μ s ≠ ⊤
ht : MeasurableSet t
hμt : μ t ≠ ⊤
x : α
hx : ↑↑(indicatorConstLp 2 hs hμs 1) x = s.indicator (fun x => 1) x
⊢ (fun x => ↑‖↑↑(indicatorConstLp 2 hs hμs 1) x‖₊) x = s.indicator (fun x => 1) x