l3lab/ntp-mathlib huggingface dataset:
theorem det_le {A : Matrix n n R} {abv : AbsoluteValue R S} {x : S} (hx : ∀ i j, abv (A i j) ≤ x) :
    abv A.det ≤ Nat.factorial (Fintype.card n) • x ^ Fintype.card n :=
  calc
    abv A.det = abv (∑ σ : Perm n, Perm.sign σ • ∏ i, A (σ i) i) := congr_arg abv (det_apply _)
    _ ≤ ∑ σ : Perm n, abv (Perm.sign σ • ∏ i, A (σ i) i) := abv.sum_le _ _
    _ = ∑ σ : Perm n, ∏ i, abv (A (σ i) i) :=
      (sum_congr rfl fun σ _ => by 

Proof state:
R : Type u_1
S : Type u_2
inst✝⁴ : CommRing R
inst✝³ : Nontrivial R
inst✝² : LinearOrderedCommRing S
n : Type u_3
inst✝¹ : Fintype n
inst✝ : DecidableEq n
A : Matrix n n R
abv : AbsoluteValue R S
x : S
hx : ∀ (i j : n), abv (A i j) ≤ x
σ : Perm n
x✝ : σ ∈ univ
⊢ abv (Perm.sign σ • ∏ i : n, A (σ i) i) = ∏ i : n, abv (A (σ i) i)

Next tactic:
rw [abv.map_units_int_smul, abv.map_prod]
theorem det_le {A : Matrix n n R} {abv : AbsoluteValue R S} {x : S} (hx : ∀ i j, abv (A i j) ≤ x) :
    abv A.det ≤ Nat.factorial (Fintype.card n) • x ^ Fintype.card n :=
  calc
    abv A.det = abv (∑ σ : Perm n, Perm.sign σ • ∏ i, A (σ i) i) := congr_arg abv (det_apply _)
    _ ≤ ∑ σ : Perm n, abv (Perm.sign σ • ∏ i, A (σ i) i) := abv.sum_le _ _
    _ = ∑ σ : Perm n, ∏ i, abv (A (σ i) i) :=
      (sum_congr rfl fun σ _ => by rw [abv.map_units_int_smul, abv.map_prod])
    _ ≤ ∑ σ : Perm n, ∏ _i : n, x :=
      (sum_le_sum fun _ _ => prod_le_prod (fun _ _ => abv.nonneg _) fun _ _ => hx _ _)
    _ = ∑ _σ : Perm n, x ^ Fintype.card n :=
      (sum_congr rfl fun _ _ => by 

Proof state:
R : Type u_1
S : Type u_2
inst✝⁴ : CommRing R
inst✝³ : Nontrivial R
inst✝² : LinearOrderedCommRing S
n : Type u_3
inst✝¹ : Fintype n
inst✝ : DecidableEq n
A : Matrix n n R
abv : AbsoluteValue R S
x : S
hx : ∀ (i j : n), abv (A i j) ≤ x
x✝¹ : Perm n
x✝ : x✝¹ ∈ univ
⊢ ∏ _i : n, x = x ^ Fintype.card n

Next tactic:
rw [prod_const, Finset.card_univ]
theorem det_le {A : Matrix n n R} {abv : AbsoluteValue R S} {x : S} (hx : ∀ i j, abv (A i j) ≤ x) :
    abv A.det ≤ Nat.factorial (Fintype.card n) • x ^ Fintype.card n :=
  calc
    abv A.det = abv (∑ σ : Perm n, Perm.sign σ • ∏ i, A (σ i) i) := congr_arg abv (det_apply _)
    _ ≤ ∑ σ : Perm n, abv (Perm.sign σ • ∏ i, A (σ i) i) := abv.sum_le _ _
    _ = ∑ σ : Perm n, ∏ i, abv (A (σ i) i) :=
      (sum_congr rfl fun σ _ => by rw [abv.map_units_int_smul, abv.map_prod])
    _ ≤ ∑ σ : Perm n, ∏ _i : n, x :=
      (sum_le_sum fun _ _ => prod_le_prod (fun _ _ => abv.nonneg _) fun _ _ => hx _ _)
    _ = ∑ _σ : Perm n, x ^ Fintype.card n :=
      (sum_congr rfl fun _ _ => by rw [prod_const, Finset.card_univ])
    _ = Nat.factorial (Fintype.card n) • x ^ Fintype.card n := by
      

Proof state:
R : Type u_1
S : Type u_2
inst✝⁴ : CommRing R
inst✝³ : Nontrivial R
inst✝² : LinearOrderedCommRing S
n : Type u_3
inst✝¹ : Fintype n
inst✝ : DecidableEq n
A : Matrix n n R
abv : AbsoluteValue R S
x : S
hx : ∀ (i j : n), abv (A i j) ≤ x
⊢ ∑ _σ : Perm n, x ^ Fintype.card n = Nat.factorial (Fintype.card n) • x ^ Fintype.card n

Next tactic:
rw [sum_const, Finset.card_univ, Fintype.card_perm]
theorem det_sum_le {ι : Type*} (s : Finset ι) {A : ι → Matrix n n R} {abv : AbsoluteValue R S}
    {x : S} (hx : ∀ k i j, abv (A k i j) ≤ x) :
    abv (det (∑ k in s, A k)) ≤
      Nat.factorial (Fintype.card n) • (Finset.card s • x) ^ Fintype.card n :=
  det_le fun i j =>
    calc
      abv ((∑ k in s, A k) i j) = abv (∑ k in s, A k i j) := by 

Proof state:
R : Type u_1
S : Type u_2
inst✝⁴ : CommRing R
inst✝³ : Nontrivial R
inst✝² : LinearOrderedCommRing S
n : Type u_3
inst✝¹ : Fintype n
inst✝ : DecidableEq n
ι : Type u_4
s : Finset ι
A : ι → Matrix n n R
abv : AbsoluteValue R S
x : S
hx : ∀ (k : ι) (i j : n), abv (A k i j) ≤ x
i j : n
⊢ abv (Finset.sum s (fun k => A k) i j) = abv (∑ k in s, A k i j)

Next tactic:
simp only [sum_apply]
theorem det_sum_smul_le {ι : Type*} (s : Finset ι) {c : ι → R} {A : ι → Matrix n n R}
    {abv : AbsoluteValue R S} {x : S} (hx : ∀ k i j, abv (A k i j) ≤ x) {y : S}
    (hy : ∀ k, abv (c k) ≤ y) :
    abv (det (∑ k in s, c k • A k)) ≤
      Nat.factorial (Fintype.card n) • (Finset.card s • y * x) ^ Fintype.card n := by
  

Proof state:
R : Type u_1
S : Type u_2
inst✝⁴ : CommRing R
inst✝³ : Nontrivial R
inst✝² : LinearOrderedCommRing S
n : Type u_3
inst✝¹ : Fintype n
inst✝ : DecidableEq n
ι : Type u_4
s : Finset ι
c : ι → R
A : ι → Matrix n n R
abv : AbsoluteValue R S
x : S
hx : ∀ (k : ι) (i j : n), abv (A k i j) ≤ x
y : S
hy : ∀ (k : ι), abv (c k) ≤ y
⊢ abv (det (∑ k in s, c k • A k)) ≤ Nat.factorial (Fintype.card n) • (card s • y * x) ^ Fintype.card n

Next tactic:
simpa only [smul_mul_assoc] using
    det_sum_le s fun k i j =>
      calc
        abv (c k * A k i j) = abv (c k) * abv (A k i j) := abv.map_mul _ _
        _ ≤ y * x := mul_le_mul (hy k) (hx k i j) (abv.nonneg _) ((abv.nonneg _).trans (hy k))
/-- Composition of morphisms in `Factorisation f`. -/
@[simps]
protected def Hom.comp {d₁ d₂ d₃ : Factorisation f}
    (f : Factorisation.Hom d₁ d₂) (g : Factorisation.Hom d₂ d₃) : Factorisation.Hom d₁ d₃ where
  h := f.h ≫ g.h
  ι_h := by 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : C
f✝ : X ⟶ Y
d₁ d₂ d₃ : Factorisation f✝
f : Factorisation.Hom d₁ d₂
g : Factorisation.Hom d₂ d₃
⊢ d₁.ι ≫ f.h ≫ g.h = d₃.ι

Next tactic:
rw [← Category.assoc, f.ι_h, g.ι_h]
/-- Composition of morphisms in `Factorisation f`. -/
@[simps]
protected def Hom.comp {d₁ d₂ d₃ : Factorisation f}
    (f : Factorisation.Hom d₁ d₂) (g : Factorisation.Hom d₂ d₃) : Factorisation.Hom d₁ d₃ where
  h := f.h ≫ g.h
  ι_h := by rw [← Category.assoc, f.ι_h, g.ι_h]
  h_π := by 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : C
f✝ : X ⟶ Y
d₁ d₂ d₃ : Factorisation f✝
f : Factorisation.Hom d₁ d₂
g : Factorisation.Hom d₂ d₃
⊢ (f.h ≫ g.h) ≫ d₃.π = d₁.π

Next tactic:
rw [Category.assoc, g.h_π, f.h_π]
instance : Unique ((Factorisation.initial : Factorisation f) ⟶ d) where
  default := Factorisation.initialHom d
  uniq f := by 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : C
f✝ : X ⟶ Y
d : Factorisation f✝
f : Factorisation.initial ⟶ d
⊢ f = default

Next tactic:
apply Factorisation.Hom.ext
instance : Unique ((Factorisation.initial : Factorisation f) ⟶ d) where
  default := Factorisation.initialHom d
  uniq f := by apply Factorisation.Hom.ext; 

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X Y : C
f✝ : X ⟶ Y
d : Factorisation f✝
f : Factorisation.initial ⟶ d
⊢ f.h = default.h

Next tactic:
simp [← f.ι_h]
instance : Unique (d ⟶ (Factorisation.terminal : Factorisation f)) where
  default := Factorisation.terminalHom d
  uniq f := by 

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : C
f✝ : X ⟶ Y
d : Factorisation f✝
f : d ⟶ Factorisation.terminal
⊢ f = default

Next tactic:
apply Factorisation.Hom.ext
instance : Unique (d ⟶ (Factorisation.terminal : Factorisation f)) where
  default := Factorisation.terminalHom d
  uniq f := by apply Factorisation.Hom.ext; 

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X Y : C
f✝ : X ⟶ Y
d : Factorisation f✝
f : d ⟶ Factorisation.terminal
⊢ f.h = default.h

Next tactic:
simp [← f.h_π]
instance partialOrder [PartialOrder β] : PartialOrder C(α, β) :=
  PartialOrder.lift (fun f => f.toFun) (fun f g _ => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : PartialOrder β
f g : C(α, β)
x✝ : (fun f => f.toFun) f = (fun f => f.toFun) g
⊢ f = g

Next tactic:
cases f
instance partialOrder [PartialOrder β] : PartialOrder C(α, β) :=
  PartialOrder.lift (fun f => f.toFun) (fun f g _ => by cases f; 

Proof state:
case mk
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : PartialOrder β
g : C(α, β)
toFun✝ : α → β
continuous_toFun✝ : Continuous toFun✝
x✝ : (fun f => f.toFun) (mk toFun✝) = (fun f => f.toFun) g
⊢ mk toFun✝ = g

Next tactic:
cases g
instance partialOrder [PartialOrder β] : PartialOrder C(α, β) :=
  PartialOrder.lift (fun f => f.toFun) (fun f g _ => by cases f; cases g; 

Proof state:
case mk.mk
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : TopologicalSpace α
inst✝² : TopologicalSpace β
inst✝¹ : TopologicalSpace γ
inst✝ : PartialOrder β
toFun✝¹ : α → β
continuous_toFun✝¹ : Continuous toFun✝¹
toFun✝ : α → β
continuous_toFun✝ : Continuous toFun✝
x✝ : (fun f => f.toFun) (mk toFun✝¹) = (fun f => f.toFun) (mk toFun✝)
⊢ mk toFun✝¹ = mk toFun✝

Next tactic:
congr
instance semilatticeSup [LinearOrder β] [OrderClosedTopology β] : SemilatticeSup C(α, β) :=
  { ContinuousMap.partialOrder,
    ContinuousMap.sup with
    le_sup_left := fun f g => le_def.mpr (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : LinearOrder β
inst✝ : OrderClosedTopology β
src✝¹ : PartialOrder C(α, β) := partialOrder
src✝ : Sup C(α, β) := sup
f g : C(α, β)
⊢ ∀ (a : α), f a ≤ (f ⊔ g) a

Next tactic:
simp [le_refl]
instance semilatticeSup [LinearOrder β] [OrderClosedTopology β] : SemilatticeSup C(α, β) :=
  { ContinuousMap.partialOrder,
    ContinuousMap.sup with
    le_sup_left := fun f g => le_def.mpr (by simp [le_refl])
    le_sup_right := fun f g => le_def.mpr (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : LinearOrder β
inst✝ : OrderClosedTopology β
src✝¹ : PartialOrder C(α, β) := partialOrder
src✝ : Sup C(α, β) := sup
f g : C(α, β)
⊢ ∀ (a : α), g a ≤ (f ⊔ g) a

Next tactic:
simp [le_refl]
instance semilatticeSup [LinearOrder β] [OrderClosedTopology β] : SemilatticeSup C(α, β) :=
  { ContinuousMap.partialOrder,
    ContinuousMap.sup with
    le_sup_left := fun f g => le_def.mpr (by simp [le_refl])
    le_sup_right := fun f g => le_def.mpr (by simp [le_refl])
    sup_le := fun f₁ f₂ g w₁ w₂ => le_def.mpr fun a => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : LinearOrder β
inst✝ : OrderClosedTopology β
src✝¹ : PartialOrder C(α, β) := partialOrder
src✝ : Sup C(α, β) := sup
f₁ f₂ g : C(α, β)
w₁ : f₁ ≤ g
w₂ : f₂ ≤ g
a : α
⊢ (f₁ ⊔ f₂) a ≤ g a

Next tactic:
simp [le_def.mp w₁ a, le_def.mp w₂ a]
instance semilatticeInf [LinearOrder β] [OrderClosedTopology β] : SemilatticeInf C(α, β) :=
  { ContinuousMap.partialOrder,
    ContinuousMap.inf with
    inf_le_left := fun f g => le_def.mpr (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : LinearOrder β
inst✝ : OrderClosedTopology β
src✝¹ : PartialOrder C(α, β) := partialOrder
src✝ : Inf C(α, β) := inf
f g : C(α, β)
⊢ ∀ (a : α), (f ⊓ g) a ≤ f a

Next tactic:
simp [le_refl]
instance semilatticeInf [LinearOrder β] [OrderClosedTopology β] : SemilatticeInf C(α, β) :=
  { ContinuousMap.partialOrder,
    ContinuousMap.inf with
    inf_le_left := fun f g => le_def.mpr (by simp [le_refl])
    inf_le_right := fun f g => le_def.mpr (by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : LinearOrder β
inst✝ : OrderClosedTopology β
src✝¹ : PartialOrder C(α, β) := partialOrder
src✝ : Inf C(α, β) := inf
f g : C(α, β)
⊢ ∀ (a : α), (f ⊓ g) a ≤ g a

Next tactic:
simp [le_refl]
instance semilatticeInf [LinearOrder β] [OrderClosedTopology β] : SemilatticeInf C(α, β) :=
  { ContinuousMap.partialOrder,
    ContinuousMap.inf with
    inf_le_left := fun f g => le_def.mpr (by simp [le_refl])
    inf_le_right := fun f g => le_def.mpr (by simp [le_refl])
    le_inf := fun f₁ f₂ g w₁ w₂ => le_def.mpr fun a => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : LinearOrder β
inst✝ : OrderClosedTopology β
src✝¹ : PartialOrder C(α, β) := partialOrder
src✝ : Inf C(α, β) := inf
f₁ f₂ g : C(α, β)
w₁ : f₁ ≤ f₂
w₂ : f₁ ≤ g
a : α
⊢ f₁ a ≤ (f₂ ⊓ g) a

Next tactic:
simp [le_def.mp w₁ a, le_def.mp w₂ a]
@[simp, norm_cast]
theorem sup'_coe {ι : Type*} {s : Finset ι} (H : s.Nonempty) (f : ι → C(β, γ)) :
    ((s.sup' H f : C(β, γ)) : β → γ) = s.sup' H fun a => (f a : β → γ) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : LinearOrder γ
inst✝ : OrderClosedTopology γ
ι : Type u_4
s : Finset ι
H : Finset.Nonempty s
f : ι → C(β, γ)
⊢ ⇑(Finset.sup' s H f) = Finset.sup' s H fun a => ⇑(f a)

Next tactic:
ext
@[simp, norm_cast]
theorem sup'_coe {ι : Type*} {s : Finset ι} (H : s.Nonempty) (f : ι → C(β, γ)) :
    ((s.sup' H f : C(β, γ)) : β → γ) = s.sup' H fun a => (f a : β → γ) := by
  ext
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁴ : TopologicalSpace α
inst✝³ : TopologicalSpace β
inst✝² : TopologicalSpace γ
inst✝¹ : LinearOrder γ
inst✝ : OrderClosedTopology γ
ι : Type u_4
s : Finset ι
H : Finset.Nonempty s
f : ι → C(β, γ)
x✝ : β
⊢ (Finset.sup' s H f) x✝ = Finset.sup' s H (fun a => ⇑(f a)) x✝

Next tactic:
simp [sup'_apply]
theorem hasPDF_iff_of_aemeasurable {X : Ω → E} {ℙ : Measure Ω}
    {μ : Measure E} (hX : AEMeasurable X ℙ) :
    HasPDF X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ := by
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
x✝ : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : Measure E
hX : AEMeasurable X
⊢ HasPDF X ℙ ↔ HaveLebesgueDecomposition (map X ℙ) μ ∧ map X ℙ ≪ μ

Next tactic:
rw [hasPDF_iff]
theorem hasPDF_iff_of_aemeasurable {X : Ω → E} {ℙ : Measure Ω}
    {μ : Measure E} (hX : AEMeasurable X ℙ) :
    HasPDF X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ := by
  rw [hasPDF_iff]
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
x✝ : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : Measure E
hX : AEMeasurable X
⊢ AEMeasurable X ∧ HaveLebesgueDecomposition (map X ℙ) μ ∧ map X ℙ ≪ μ ↔
    HaveLebesgueDecomposition (map X ℙ) μ ∧ map X ℙ ≪ μ

Next tactic:
simp only [hX, true_and]
/-- X `HasPDF` if there is a pdf `f` such that `map X ℙ = μ.withDensity f`. -/
theorem hasPDF_of_map_eq_withDensity {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
    (hX : AEMeasurable X ℙ) (f : E → ℝ≥0∞) (hf : AEMeasurable f μ) (h : map X ℙ = μ.withDensity f) :
    HasPDF X ℙ μ := by
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
x✝ : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : Measure E
hX : AEMeasurable X
f : E → ℝ≥0∞
hf : AEMeasurable f
h : map X ℙ = withDensity μ f
⊢ HasPDF X ℙ

Next tactic:
refine ⟨hX, ?_, ?_⟩
/-- X `HasPDF` if there is a pdf `f` such that `map X ℙ = μ.withDensity f`. -/
theorem hasPDF_of_map_eq_withDensity {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
    (hX : AEMeasurable X ℙ) (f : E → ℝ≥0∞) (hf : AEMeasurable f μ) (h : map X ℙ = μ.withDensity f) :
    HasPDF X ℙ μ := by
  refine ⟨hX, ?_, ?_⟩ <;> 

Proof state:
case refine_1
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
x✝ : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : Measure E
hX : AEMeasurable X
f : E → ℝ≥0∞
hf : AEMeasurable f
h : map X ℙ = withDensity μ f
⊢ HaveLebesgueDecomposition (map X ℙ) μ

Next tactic:
rw [h]
/-- X `HasPDF` if there is a pdf `f` such that `map X ℙ = μ.withDensity f`. -/
theorem hasPDF_of_map_eq_withDensity {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
    (hX : AEMeasurable X ℙ) (f : E → ℝ≥0∞) (hf : AEMeasurable f μ) (h : map X ℙ = μ.withDensity f) :
    HasPDF X ℙ μ := by
  refine ⟨hX, ?_, ?_⟩ <;> 

Proof state:
case refine_2
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
x✝ : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : Measure E
hX : AEMeasurable X
f : E → ℝ≥0∞
hf : AEMeasurable f
h : map X ℙ = withDensity μ f
⊢ map X ℙ ≪ μ

Next tactic:
rw [h]
/-- X `HasPDF` if there is a pdf `f` such that `map X ℙ = μ.withDensity f`. -/
theorem hasPDF_of_map_eq_withDensity {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
    (hX : AEMeasurable X ℙ) (f : E → ℝ≥0∞) (hf : AEMeasurable f μ) (h : map X ℙ = μ.withDensity f) :
    HasPDF X ℙ μ := by
  refine ⟨hX, ?_, ?_⟩ <;> rw [h]
  · 

Proof state:
case refine_1
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
x✝ : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : Measure E
hX : AEMeasurable X
f : E → ℝ≥0∞
hf : AEMeasurable f
h : map X ℙ = withDensity μ f
⊢ HaveLebesgueDecomposition (withDensity μ f) μ

Next tactic:
rw [withDensity_congr_ae hf.ae_eq_mk]
/-- X `HasPDF` if there is a pdf `f` such that `map X ℙ = μ.withDensity f`. -/
theorem hasPDF_of_map_eq_withDensity {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
    (hX : AEMeasurable X ℙ) (f : E → ℝ≥0∞) (hf : AEMeasurable f μ) (h : map X ℙ = μ.withDensity f) :
    HasPDF X ℙ μ := by
  refine ⟨hX, ?_, ?_⟩ <;> rw [h]
  · rw [withDensity_congr_ae hf.ae_eq_mk]
    

Proof state:
case refine_1
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
x✝ : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : Measure E
hX : AEMeasurable X
f : E → ℝ≥0∞
hf : AEMeasurable f
h : map X ℙ = withDensity μ f
⊢ HaveLebesgueDecomposition (withDensity μ (AEMeasurable.mk f hf)) μ

Next tactic:
exact haveLebesgueDecomposition_withDensity μ hf.measurable_mk
/-- X `HasPDF` if there is a pdf `f` such that `map X ℙ = μ.withDensity f`. -/
theorem hasPDF_of_map_eq_withDensity {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
    (hX : AEMeasurable X ℙ) (f : E → ℝ≥0∞) (hf : AEMeasurable f μ) (h : map X ℙ = μ.withDensity f) :
    HasPDF X ℙ μ := by
  refine ⟨hX, ?_, ?_⟩ <;> rw [h]
  · rw [withDensity_congr_ae hf.ae_eq_mk]
    exact haveLebesgueDecomposition_withDensity μ hf.measurable_mk
  · 

Proof state:
case refine_2
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
x✝ : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : Measure E
hX : AEMeasurable X
f : E → ℝ≥0∞
hf : AEMeasurable f
h : map X ℙ = withDensity μ f
⊢ withDensity μ f ≪ μ

Next tactic:
exact withDensity_absolutelyContinuous μ f
theorem pdf_of_not_aemeasurable {_ : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
    {X : Ω → E} (hX : ¬AEMeasurable X ℙ) : pdf X ℙ μ =ᵐ[μ] 0 := by
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
x✝ : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → E
hX : ¬AEMeasurable X
⊢ pdf X ℙ =ᶠ[ae μ] 0

Next tactic:
rw [pdf_def, map_of_not_aemeasurable hX]
theorem pdf_of_not_aemeasurable {_ : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
    {X : Ω → E} (hX : ¬AEMeasurable X ℙ) : pdf X ℙ μ =ᵐ[μ] 0 := by
  rw [pdf_def, map_of_not_aemeasurable hX]
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
x✝ : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → E
hX : ¬AEMeasurable X
⊢ rnDeriv 0 μ =ᶠ[ae μ] 0

Next tactic:
exact rnDeriv_zero μ
theorem aemeasurable_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
    (X : Ω → E) (h : ¬pdf X ℙ μ =ᵐ[μ] 0) : AEMeasurable X ℙ := by
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → E
h : ¬pdf X ℙ =ᶠ[ae μ] 0
⊢ AEMeasurable X

Next tactic:
contrapose! h
theorem aemeasurable_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E}
    (X : Ω → E) (h : ¬pdf X ℙ μ =ᵐ[μ] 0) : AEMeasurable X ℙ := by
  contrapose! h
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → E
h : ¬AEMeasurable X
⊢ pdf X ℙ =ᶠ[ae μ] 0

Next tactic:
exact pdf_of_not_aemeasurable h
theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
    (hac : map X ℙ ≪ μ) (hpdf : ¬pdf X ℙ μ =ᵐ[μ] 0) : HasPDF X ℙ μ := by
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → E
hac : map X ℙ ≪ μ
hpdf : ¬pdf X ℙ =ᶠ[ae μ] 0
⊢ HasPDF X ℙ

Next tactic:
refine ⟨?_, ?_, hac⟩
theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
    (hac : map X ℙ ≪ μ) (hpdf : ¬pdf X ℙ μ =ᵐ[μ] 0) : HasPDF X ℙ μ := by
  refine ⟨?_, ?_, hac⟩
  · 

Proof state:
case refine_1
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → E
hac : map X ℙ ≪ μ
hpdf : ¬pdf X ℙ =ᶠ[ae μ] 0
⊢ AEMeasurable X

Next tactic:
exact aemeasurable_of_pdf_ne_zero X hpdf
theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
    (hac : map X ℙ ≪ μ) (hpdf : ¬pdf X ℙ μ =ᵐ[μ] 0) : HasPDF X ℙ μ := by
  refine ⟨?_, ?_, hac⟩
  · exact aemeasurable_of_pdf_ne_zero X hpdf
  · 

Proof state:
case refine_2
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → E
hac : map X ℙ ≪ μ
hpdf : ¬pdf X ℙ =ᶠ[ae μ] 0
⊢ HaveLebesgueDecomposition (map X ℙ) μ

Next tactic:
contrapose! hpdf
theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
    (hac : map X ℙ ≪ μ) (hpdf : ¬pdf X ℙ μ =ᵐ[μ] 0) : HasPDF X ℙ μ := by
  refine ⟨?_, ?_, hac⟩
  · exact aemeasurable_of_pdf_ne_zero X hpdf
  · contrapose! hpdf
    

Proof state:
case refine_2
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → E
hac : map X ℙ ≪ μ
hpdf : ¬HaveLebesgueDecomposition (map X ℙ) μ
⊢ pdf X ℙ =ᶠ[ae μ] 0

Next tactic:
have := pdf_of_not_haveLebesgueDecomposition hpdf
theorem hasPDF_of_pdf_ne_zero {m : MeasurableSpace Ω} {ℙ : Measure Ω} {μ : Measure E} {X : Ω → E}
    (hac : map X ℙ ≪ μ) (hpdf : ¬pdf X ℙ μ =ᵐ[μ] 0) : HasPDF X ℙ μ := by
  refine ⟨?_, ?_, hac⟩
  · exact aemeasurable_of_pdf_ne_zero X hpdf
  · contrapose! hpdf
    have := pdf_of_not_haveLebesgueDecomposition hpdf
    

Proof state:
case refine_2
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → E
hac : map X ℙ ≪ μ
hpdf : ¬HaveLebesgueDecomposition (map X ℙ) μ
this : pdf X ℙ = 0
⊢ pdf X ℙ =ᶠ[ae μ] 0

Next tactic:
filter_upwards using congrFun this
@[measurability]
theorem measurable_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
    (μ : Measure E := by volume_tac) : Measurable (pdf X ℙ μ) := by
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : autoParam (Measure E) _auto✝
⊢ Measurable (pdf X ℙ)

Next tactic:
exact measurable_rnDeriv _ _
theorem set_lintegral_pdf_le_map {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
    (μ : Measure E := by volume_tac) {s : Set E} (hs : MeasurableSet s) :
    ∫⁻ x in s, pdf X ℙ μ x ∂μ ≤ map X ℙ s := by
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : autoParam (Measure E) _auto✝
s : Set E
hs : MeasurableSet s
⊢ ∫⁻ (x : E) in s, pdf X ℙ x ∂μ ≤ ↑↑(map X ℙ) s

Next tactic:
apply (withDensity_apply_le _ s).trans
theorem set_lintegral_pdf_le_map {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
    (μ : Measure E := by volume_tac) {s : Set E} (hs : MeasurableSet s) :
    ∫⁻ x in s, pdf X ℙ μ x ∂μ ≤ map X ℙ s := by
  apply (withDensity_apply_le _ s).trans
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : autoParam (Measure E) _auto✝
s : Set E
hs : MeasurableSet s
⊢ ↑↑(withDensity μ fun a => pdf X ℙ a) s ≤ ↑↑(map X ℙ) s

Next tactic:
exact withDensity_pdf_le_map _ _ _ s hs
theorem map_eq_withDensity_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
    (μ : Measure E := by volume_tac) [hX : HasPDF X ℙ μ] :
    map X ℙ = μ.withDensity (pdf X ℙ μ) := by
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : autoParam (Measure E) _auto✝
hX : HasPDF X ℙ
⊢ map X ℙ = withDensity μ (pdf X ℙ)

Next tactic:
rw [pdf_def, withDensity_rnDeriv_eq _ _ hX.absolutelyContinuous]
theorem map_eq_set_lintegral_pdf {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
    (μ : Measure E := by volume_tac) [hX : HasPDF X ℙ μ] {s : Set E}
    (hs : MeasurableSet s) : map X ℙ s = ∫⁻ x in s, pdf X ℙ μ x ∂μ := by
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
X : Ω → E
ℙ : Measure Ω
μ : autoParam (Measure E) _auto✝
hX : HasPDF X ℙ
s : Set E
hs : MeasurableSet s
⊢ ↑↑(map X ℙ) s = ∫⁻ (x : E) in s, pdf X ℙ x ∂μ

Next tactic:
rw [← withDensity_apply _ hs, map_eq_withDensity_pdf X ℙ μ]