l3lab/ntp-mathlib huggingface dataset:
/-- A Lebesgue Integral from -∞ to y can be expressed as the sum of one from -∞ to 0 and 0 to x -/
lemma lintegral_Iic_eq_lintegral_Iio_add_Icc {y z : ℝ} (f : ℝ → ℝ≥0∞) (hzy : z ≤ y) :
    ∫⁻ x in Iic y, f x = (∫⁻ x in Iio z, f x) + ∫⁻ x in Icc z y, f x := by
  rw [← Iio_union_Icc_eq_Iic hzy, lintegral_union measurableSet_Icc]
  rw [Set.disjoint_iff]
  rintro x ⟨h1 : x < _, h2, _⟩
  

Proof state:
case intro.intro
y z : ℝ
f : ℝ → ℝ≥0∞
hzy : z ≤ y
x : ℝ
h1 : x < z
h2 : z ≤ x
right✝ : x ≤ y
⊢ x ∈ ∅

Next tactic:
linarith
lemma lintegral_eq_lintegral_Ici_add_Iio (f : ℝ → ℝ≥0∞) (c : ℝ) :
    ∫⁻ x, f x = (∫⁻ x in Ici c, f x) + ∫⁻ x in Iio c, f x := by
  

Proof state:
f : ℝ → ℝ≥0∞
c : ℝ
⊢ ∫⁻ (x : ℝ), f x = (∫⁻ (x : ℝ) in Ici c, f x) + ∫⁻ (x : ℝ) in Iio c, f x

Next tactic:
have union : univ = {x : ℝ | x ≥ c} ∪ {x : ℝ | x < c} := by
    ext x; simp [le_or_lt]
lemma lintegral_eq_lintegral_Ici_add_Iio (f : ℝ → ℝ≥0∞) (c : ℝ) :
    ∫⁻ x, f x = (∫⁻ x in Ici c, f x) + ∫⁻ x in Iio c, f x := by
  have union : univ = {x : ℝ | x ≥ c} ∪ {x : ℝ | x < c} := by
    

Proof state:
f : ℝ → ℝ≥0∞
c : ℝ
⊢ univ = {x | x ≥ c} ∪ {x | x < c}

Next tactic:
ext x
lemma lintegral_eq_lintegral_Ici_add_Iio (f : ℝ → ℝ≥0∞) (c : ℝ) :
    ∫⁻ x, f x = (∫⁻ x in Ici c, f x) + ∫⁻ x in Iio c, f x := by
  have union : univ = {x : ℝ | x ≥ c} ∪ {x : ℝ | x < c} := by
    ext x; 

Proof state:
case h
f : ℝ → ℝ≥0∞
c x : ℝ
⊢ x ∈ univ ↔ x ∈ {x | x ≥ c} ∪ {x | x < c}

Next tactic:
simp [le_or_lt]
lemma lintegral_eq_lintegral_Ici_add_Iio (f : ℝ → ℝ≥0∞) (c : ℝ) :
    ∫⁻ x, f x = (∫⁻ x in Ici c, f x) + ∫⁻ x in Iio c, f x := by
  have union : univ = {x : ℝ | x ≥ c} ∪ {x : ℝ | x < c} := by
    ext x; simp [le_or_lt]
  

Proof state:
f : ℝ → ℝ≥0∞
c : ℝ
union : univ = {x | x ≥ c} ∪ {x | x < c}
⊢ ∫⁻ (x : ℝ), f x = (∫⁻ (x : ℝ) in Ici c, f x) + ∫⁻ (x : ℝ) in Iio c, f x

Next tactic:
calc
  ∫⁻ x, f x = ∫⁻ x in univ, f x ∂volume := (set_lintegral_univ f).symm
  _ = ∫⁻ x in {x | x ≥ c} ∪ {x | x < c} , f x ∂volume := by rw [← union]
  _ = _ := by
    apply lintegral_union (isOpen_gt' c).measurableSet
    rw [Set.disjoint_iff]
    rintro x ⟨hxge : x ≥ _, hxlt : x < _⟩
    linarith
lemma lintegral_eq_lintegral_Ici_add_Iio (f : ℝ → ℝ≥0∞) (c : ℝ) :
    ∫⁻ x, f x = (∫⁻ x in Ici c, f x) + ∫⁻ x in Iio c, f x := by
  have union : univ = {x : ℝ | x ≥ c} ∪ {x : ℝ | x < c} := by
    ext x; simp [le_or_lt]
  calc
  ∫⁻ x, f x = ∫⁻ x in univ, f x ∂volume := (set_lintegral_univ f).symm
  _ = ∫⁻ x in {x | x ≥ c} ∪ {x | x < c} , f x ∂volume := by 

Proof state:
f : ℝ → ℝ≥0∞
c : ℝ
union : univ = {x | x ≥ c} ∪ {x | x < c}
⊢ ∫⁻ (x : ℝ) in univ, f x = ∫⁻ (x : ℝ) in {x | x ≥ c} ∪ {x | x < c}, f x

Next tactic:
rw [← union]
lemma lintegral_eq_lintegral_Ici_add_Iio (f : ℝ → ℝ≥0∞) (c : ℝ) :
    ∫⁻ x, f x = (∫⁻ x in Ici c, f x) + ∫⁻ x in Iio c, f x := by
  have union : univ = {x : ℝ | x ≥ c} ∪ {x : ℝ | x < c} := by
    ext x; simp [le_or_lt]
  calc
  ∫⁻ x, f x = ∫⁻ x in univ, f x ∂volume := (set_lintegral_univ f).symm
  _ = ∫⁻ x in {x | x ≥ c} ∪ {x | x < c} , f x ∂volume := by rw [← union]
  _ = _ := by
    

Proof state:
f : ℝ → ℝ≥0∞
c : ℝ
union : univ = {x | x ≥ c} ∪ {x | x < c}
⊢ ∫⁻ (x : ℝ) in {x | x ≥ c} ∪ {x | x < c}, f x = (∫⁻ (x : ℝ) in Ici c, f x) + ∫⁻ (x : ℝ) in Iio c, f x

Next tactic:
apply lintegral_union (isOpen_gt' c).measurableSet
lemma lintegral_eq_lintegral_Ici_add_Iio (f : ℝ → ℝ≥0∞) (c : ℝ) :
    ∫⁻ x, f x = (∫⁻ x in Ici c, f x) + ∫⁻ x in Iio c, f x := by
  have union : univ = {x : ℝ | x ≥ c} ∪ {x : ℝ | x < c} := by
    ext x; simp [le_or_lt]
  calc
  ∫⁻ x, f x = ∫⁻ x in univ, f x ∂volume := (set_lintegral_univ f).symm
  _ = ∫⁻ x in {x | x ≥ c} ∪ {x | x < c} , f x ∂volume := by rw [← union]
  _ = _ := by
    apply lintegral_union (isOpen_gt' c).measurableSet
    

Proof state:
f : ℝ → ℝ≥0∞
c : ℝ
union : univ = {x | x ≥ c} ∪ {x | x < c}
⊢ Disjoint {x | x ≥ c} {b | b < c}

Next tactic:
rw [Set.disjoint_iff]
lemma lintegral_eq_lintegral_Ici_add_Iio (f : ℝ → ℝ≥0∞) (c : ℝ) :
    ∫⁻ x, f x = (∫⁻ x in Ici c, f x) + ∫⁻ x in Iio c, f x := by
  have union : univ = {x : ℝ | x ≥ c} ∪ {x : ℝ | x < c} := by
    ext x; simp [le_or_lt]
  calc
  ∫⁻ x, f x = ∫⁻ x in univ, f x ∂volume := (set_lintegral_univ f).symm
  _ = ∫⁻ x in {x | x ≥ c} ∪ {x | x < c} , f x ∂volume := by rw [← union]
  _ = _ := by
    apply lintegral_union (isOpen_gt' c).measurableSet
    rw [Set.disjoint_iff]
    

Proof state:
f : ℝ → ℝ≥0∞
c : ℝ
union : univ = {x | x ≥ c} ∪ {x | x < c}
⊢ {x | x ≥ c} ∩ {b | b < c} ⊆ ∅

Next tactic:
rintro x ⟨hxge : x ≥ _, hxlt : x < _⟩
lemma lintegral_eq_lintegral_Ici_add_Iio (f : ℝ → ℝ≥0∞) (c : ℝ) :
    ∫⁻ x, f x = (∫⁻ x in Ici c, f x) + ∫⁻ x in Iio c, f x := by
  have union : univ = {x : ℝ | x ≥ c} ∪ {x : ℝ | x < c} := by
    ext x; simp [le_or_lt]
  calc
  ∫⁻ x, f x = ∫⁻ x in univ, f x ∂volume := (set_lintegral_univ f).symm
  _ = ∫⁻ x in {x | x ≥ c} ∪ {x | x < c} , f x ∂volume := by rw [← union]
  _ = _ := by
    apply lintegral_union (isOpen_gt' c).measurableSet
    rw [Set.disjoint_iff]
    rintro x ⟨hxge : x ≥ _, hxlt : x < _⟩
    

Proof state:
case intro
f : ℝ → ℝ≥0∞
c : ℝ
union : univ = {x | x ≥ c} ∪ {x | x < c}
x : ℝ
hxge : x ≥ c
hxlt : x < c
⊢ x ∈ ∅

Next tactic:
linarith
lemma exponentialPdf_of_neg {r x : ℝ} (hx : x < 0) : exponentialPdf r x = 0 := by
  

Proof state:
r x : ℝ
hx : x < 0
⊢ exponentialPdf r x = 0

Next tactic:
simp only [exponentialPdf_eq, if_neg (not_le.mpr hx), ENNReal.ofReal_zero]
lemma exponentialPdf_of_nonneg {r x : ℝ} (hx : 0 ≤ x) :
    exponentialPdf r x = ENNReal.ofReal (r * rexp (-(r * x))) := by
  

Proof state:
r x : ℝ
hx : 0 ≤ x
⊢ exponentialPdf r x = ENNReal.ofReal (r * rexp (-(r * x)))

Next tactic:
simp only [exponentialPdf_eq, if_pos hx]
lemma hasDerivAt_exp_neg {r x : ℝ} (hr : 0 < r) :
    HasDerivAt (fun a ↦ -1/r * exp (-(r * a))) (exp (-(r * x))) x := by
  

Proof state:
r x : ℝ
hr : 0 < r
⊢ HasDerivAt (fun a => -1 / r * rexp (-(r * a))) (rexp (-(r * x))) x

Next tactic:
convert (((hasDerivAt_id x).const_mul (-r)).exp.const_mul (-1/r)) using 1
lemma hasDerivAt_exp_neg {r x : ℝ} (hr : 0 < r) :
    HasDerivAt (fun a ↦ -1/r * exp (-(r * a))) (exp (-(r * x))) x := by
  convert (((hasDerivAt_id x).const_mul (-r)).exp.const_mul (-1/r)) using 1 <;> 

Proof state:
case h.e'_6
r x : ℝ
hr : 0 < r
⊢ (fun a => -1 / r * rexp (-(r * a))) = fun y => -1 / r * rexp (-r * id y)

Next tactic:
field_simp
lemma hasDerivAt_exp_neg {r x : ℝ} (hr : 0 < r) :
    HasDerivAt (fun a ↦ -1/r * exp (-(r * a))) (exp (-(r * x))) x := by
  convert (((hasDerivAt_id x).const_mul (-r)).exp.const_mul (-1/r)) using 1 <;> 

Proof state:
case h.e'_7
r x : ℝ
hr : 0 < r
⊢ rexp (-(r * x)) = -1 / r * (rexp (-r * id x) * (-r * 1))

Next tactic:
field_simp
lemma hasDerivAt_neg_exp_mul_exp {r x : ℝ} :
    HasDerivAt (fun a ↦ -exp (-(r * a))) (r * exp (-(r * x))) x := by
  

Proof state:
r x : ℝ
⊢ HasDerivAt (fun a => -rexp (-(r * a))) (r * rexp (-(r * x))) x

Next tactic:
convert (((hasDerivAt_id x).const_mul (-r)).exp.const_mul (-1)) using 1
lemma hasDerivAt_neg_exp_mul_exp {r x : ℝ} :
    HasDerivAt (fun a ↦ -exp (-(r * a))) (r * exp (-(r * x))) x := by
  convert (((hasDerivAt_id x).const_mul (-r)).exp.const_mul (-1)) using 1
  · 

Proof state:
case h.e'_6
r x : ℝ
⊢ (fun a => -rexp (-(r * a))) = fun y => -1 * rexp (-r * id y)

Next tactic:
simp only [one_mul, id_eq, neg_mul]
lemma hasDerivAt_neg_exp_mul_exp {r x : ℝ} :
    HasDerivAt (fun a ↦ -exp (-(r * a))) (r * exp (-(r * x))) x := by
  convert (((hasDerivAt_id x).const_mul (-r)).exp.const_mul (-1)) using 1
  · simp only [one_mul, id_eq, neg_mul]
  

Proof state:
case h.e'_7
r x : ℝ
⊢ r * rexp (-(r * x)) = -1 * (rexp (-r * id x) * (-r * 1))

Next tactic:
simp only [id_eq, neg_mul, mul_one, mul_neg, one_mul, neg_neg, mul_comm]
/-- the Lebesgue-Integral of the exponential PDF over nonpositive Reals equals 0-/
lemma lintegral_exponentialPdf_of_nonpos {x r : ℝ} (hx : x ≤ 0) :
    ∫⁻ y in Iio x, exponentialPdf r y = 0 := by
  

Proof state:
x r : ℝ
hx : x ≤ 0
⊢ ∫⁻ (y : ℝ) in Iio x, exponentialPdf r y = 0

Next tactic:
rw [set_lintegral_congr_fun (g := fun _ ↦ 0) measurableSet_Iio]
/-- the Lebesgue-Integral of the exponential PDF over nonpositive Reals equals 0-/
lemma lintegral_exponentialPdf_of_nonpos {x r : ℝ} (hx : x ≤ 0) :
    ∫⁻ y in Iio x, exponentialPdf r y = 0 := by
  rw [set_lintegral_congr_fun (g := fun _ ↦ 0) measurableSet_Iio]
  · 

Proof state:
x r : ℝ
hx : x ≤ 0
⊢ ∫⁻ (x : ℝ) in Iio x, 0 = 0

Next tactic:
rw [lintegral_zero, ← ENNReal.ofReal_zero]
/-- the Lebesgue-Integral of the exponential PDF over nonpositive Reals equals 0-/
lemma lintegral_exponentialPdf_of_nonpos {x r : ℝ} (hx : x ≤ 0) :
    ∫⁻ y in Iio x, exponentialPdf r y = 0 := by
  rw [set_lintegral_congr_fun (g := fun _ ↦ 0) measurableSet_Iio]
  · rw [lintegral_zero, ← ENNReal.ofReal_zero]
  · 

Proof state:
x r : ℝ
hx : x ≤ 0
⊢ ∀ᵐ (x_1 : ℝ), x_1 ∈ Iio x → exponentialPdf r x_1 = 0

Next tactic:
simp only [exponentialPdf_eq, ge_iff_le, ENNReal.ofReal_eq_zero]
/-- the Lebesgue-Integral of the exponential PDF over nonpositive Reals equals 0-/
lemma lintegral_exponentialPdf_of_nonpos {x r : ℝ} (hx : x ≤ 0) :
    ∫⁻ y in Iio x, exponentialPdf r y = 0 := by
  rw [set_lintegral_congr_fun (g := fun _ ↦ 0) measurableSet_Iio]
  · rw [lintegral_zero, ← ENNReal.ofReal_zero]
  · simp only [exponentialPdf_eq, ge_iff_le, ENNReal.ofReal_eq_zero]
    

Proof state:
x r : ℝ
hx : x ≤ 0
⊢ ∀ᵐ (x_1 : ℝ), x_1 ∈ Iio x → (if 0 ≤ x_1 then r * rexp (-(r * x_1)) else 0) ≤ 0

Next tactic:
apply ae_of_all _ fun a (_ : a < _) ↦ by rw [if_neg (by linarith)]
/-- the Lebesgue-Integral of the exponential PDF over nonpositive Reals equals 0-/
lemma lintegral_exponentialPdf_of_nonpos {x r : ℝ} (hx : x ≤ 0) :
    ∫⁻ y in Iio x, exponentialPdf r y = 0 := by
  rw [set_lintegral_congr_fun (g := fun _ ↦ 0) measurableSet_Iio]
  · rw [lintegral_zero, ← ENNReal.ofReal_zero]
  · simp only [exponentialPdf_eq, ge_iff_le, ENNReal.ofReal_eq_zero]
    apply ae_of_all _ fun a (_ : a < _) ↦ by 

Proof state:
x r : ℝ
hx : x ≤ 0
a : ℝ
x✝ : a < x
⊢ (if 0 ≤ a then r * rexp (-(r * a)) else 0) ≤ 0

Next tactic:
rw [if_neg (by linarith)]
/-- the Lebesgue-Integral of the exponential PDF over nonpositive Reals equals 0-/
lemma lintegral_exponentialPdf_of_nonpos {x r : ℝ} (hx : x ≤ 0) :
    ∫⁻ y in Iio x, exponentialPdf r y = 0 := by
  rw [set_lintegral_congr_fun (g := fun _ ↦ 0) measurableSet_Iio]
  · rw [lintegral_zero, ← ENNReal.ofReal_zero]
  · simp only [exponentialPdf_eq, ge_iff_le, ENNReal.ofReal_eq_zero]
    apply ae_of_all _ fun a (_ : a < _) ↦ by rw [if_neg (by 

Proof state:
x r : ℝ
hx : x ≤ 0
a : ℝ
x✝ : a < x
⊢ ¬0 ≤ a

Next tactic:
linarith
/-- The exponential pdf is measurable. -/
lemma measurable_exponentialPdfReal (r : ℝ) :
    Measurable (exponentialPdfReal r) := by
  

Proof state:
r : ℝ
⊢ Measurable (exponentialPdfReal r)

Next tactic:
refine Measurable.ite ?hp ((measurable_id'.const_mul r).neg.exp.const_mul r) ?hg
/-- The exponential pdf is measurable. -/
lemma measurable_exponentialPdfReal (r : ℝ) :
    Measurable (exponentialPdfReal r) := by
  refine Measurable.ite ?hp ((measurable_id'.const_mul r).neg.exp.const_mul r) ?hg
  · 

Proof state:
case hp
r : ℝ
⊢ MeasurableSet {a | 0 ≤ a}

Next tactic:
exact measurableSet_Ici
/-- The exponential pdf is measurable. -/
lemma measurable_exponentialPdfReal (r : ℝ) :
    Measurable (exponentialPdfReal r) := by
  refine Measurable.ite ?hp ((measurable_id'.const_mul r).neg.exp.const_mul r) ?hg
  · exact measurableSet_Ici
  · 

Proof state:
case hg
r : ℝ
⊢ Measurable fun x => 0

Next tactic:
exact measurable_const
/-- the exponential Pdf is positive for all positive reals-/
lemma exponentialPdfReal_pos {x r : ℝ} {hr : 0 < r} (hx : 0 < x) :
    0 < exponentialPdfReal r x := by
  

Proof state:
x r : ℝ
hr : 0 < r
hx : 0 < x
⊢ 0 < exponentialPdfReal r x

Next tactic:
simp only [exponentialPdfReal, if_pos hx.le]
/-- the exponential Pdf is positive for all positive reals-/
lemma exponentialPdfReal_pos {x r : ℝ} {hr : 0 < r} (hx : 0 < x) :
    0 < exponentialPdfReal r x := by
  simp only [exponentialPdfReal, if_pos hx.le]
  

Proof state:
x r : ℝ
hr : 0 < r
hx : 0 < x
⊢ 0 < r * rexp (-(r * x))

Next tactic:
positivity
/-- The exponential Pdf is nonnegative-/
lemma exponentialPdfReal_nonneg {r : ℝ} (hr : 0 < r) (x : ℝ) :
    0 ≤ exponentialPdfReal r x := by
  

Proof state:
r : ℝ
hr : 0 < r
x : ℝ
⊢ 0 ≤ exponentialPdfReal r x

Next tactic:
unfold exponentialPdfReal
/-- The exponential Pdf is nonnegative-/
lemma exponentialPdfReal_nonneg {r : ℝ} (hr : 0 < r) (x : ℝ) :
    0 ≤ exponentialPdfReal r x := by
  unfold exponentialPdfReal; 

Proof state:
r : ℝ
hr : 0 < r
x : ℝ
⊢ 0 ≤ if 0 ≤ x then r * rexp (-(r * x)) else 0

Next tactic:
split_ifs
/-- The exponential Pdf is nonnegative-/
lemma exponentialPdfReal_nonneg {r : ℝ} (hr : 0 < r) (x : ℝ) :
    0 ≤ exponentialPdfReal r x := by
  unfold exponentialPdfReal; split_ifs <;> 

Proof state:
case pos
r : ℝ
hr : 0 < r
x : ℝ
h✝ : 0 ≤ x
⊢ 0 ≤ r * rexp (-(r * x))

Next tactic:
positivity
/-- The exponential Pdf is nonnegative-/
lemma exponentialPdfReal_nonneg {r : ℝ} (hr : 0 < r) (x : ℝ) :
    0 ≤ exponentialPdfReal r x := by
  unfold exponentialPdfReal; split_ifs <;> 

Proof state:
case neg
r : ℝ
hr : 0 < r
x : ℝ
h✝ : ¬0 ≤ x
⊢ 0 ≤ 0

Next tactic:
positivity
/-- A negative exponential function is integrable on Intervals in R≥0 -/
lemma exp_neg_integrableOn_Ioc {b x : ℝ} (hb : 0 < b) :
    IntegrableOn (fun x ↦ rexp (-(b * x))) (Ioc 0 x) := by
  

Proof state:
b x : ℝ
hb : 0 < b
⊢ IntegrableOn (fun x => rexp (-(b * x))) (Ioc 0 x)

Next tactic:
simp only [neg_mul_eq_neg_mul]
/-- A negative exponential function is integrable on Intervals in R≥0 -/
lemma exp_neg_integrableOn_Ioc {b x : ℝ} (hb : 0 < b) :
    IntegrableOn (fun x ↦ rexp (-(b * x))) (Ioc 0 x) := by
  simp only [neg_mul_eq_neg_mul]
  

Proof state:
b x : ℝ
hb : 0 < b
⊢ IntegrableOn (fun x => rexp (-b * x)) (Ioc 0 x)

Next tactic:
exact (exp_neg_integrableOn_Ioi _ hb).mono_set Ioc_subset_Ioi_self
/-- The Pdf of the exponential Distribution integrates to 1-/
@[simp]
lemma lintegral_exponentialPdf_eq_one (r : ℝ) (hr : 0 < r) : ∫⁻ x, exponentialPdf r x = 1 := by
  

Proof state:
r : ℝ
hr : 0 < r
⊢ ∫⁻ (x : ℝ), exponentialPdf r x = 1

Next tactic:
rw [lintegral_eq_lintegral_Ici_add_Iio (exponentialPdf r) 0, ← ENNReal.toReal_eq_one_iff]
/-- The Pdf of the exponential Distribution integrates to 1-/
@[simp]
lemma lintegral_exponentialPdf_eq_one (r : ℝ) (hr : 0 < r) : ∫⁻ x, exponentialPdf r x = 1 := by
  rw [lintegral_eq_lintegral_Ici_add_Iio (exponentialPdf r) 0, ← ENNReal.toReal_eq_one_iff]
  

Proof state:
r : ℝ
hr : 0 < r
⊢ ENNReal.toReal ((∫⁻ (x : ℝ) in Ici 0, exponentialPdf r x) + ∫⁻ (x : ℝ) in Iio 0, exponentialPdf r x) = 1

Next tactic:
have leftSide : ∫⁻ x in Iio 0, exponentialPdf r x = 0 := by
    rw [set_lintegral_congr_fun measurableSet_Iio
      (ae_of_all _ (fun x (hx : x < 0) ↦ exponentialPdf_of_neg hx)), lintegral_zero]
/-- The Pdf of the exponential Distribution integrates to 1-/
@[simp]
lemma lintegral_exponentialPdf_eq_one (r : ℝ) (hr : 0 < r) : ∫⁻ x, exponentialPdf r x = 1 := by
  rw [lintegral_eq_lintegral_Ici_add_Iio (exponentialPdf r) 0, ← ENNReal.toReal_eq_one_iff]
  have leftSide : ∫⁻ x in Iio 0, exponentialPdf r x = 0 := by
    

Proof state:
r : ℝ
hr : 0 < r
⊢ ∫⁻ (x : ℝ) in Iio 0, exponentialPdf r x = 0

Next tactic:
rw [set_lintegral_congr_fun measurableSet_Iio
      (ae_of_all _ (fun x (hx : x < 0) ↦ exponentialPdf_of_neg hx)), lintegral_zero]
/-- The Pdf of the exponential Distribution integrates to 1-/
@[simp]
lemma lintegral_exponentialPdf_eq_one (r : ℝ) (hr : 0 < r) : ∫⁻ x, exponentialPdf r x = 1 := by
  rw [lintegral_eq_lintegral_Ici_add_Iio (exponentialPdf r) 0, ← ENNReal.toReal_eq_one_iff]
  have leftSide : ∫⁻ x in Iio 0, exponentialPdf r x = 0 := by
    rw [set_lintegral_congr_fun measurableSet_Iio
      (ae_of_all _ (fun x (hx : x < 0) ↦ exponentialPdf_of_neg hx)), lintegral_zero]
  

Proof state:
r : ℝ
hr : 0 < r
leftSide : ∫⁻ (x : ℝ) in Iio 0, exponentialPdf r x = 0
⊢ ENNReal.toReal ((∫⁻ (x : ℝ) in Ici 0, exponentialPdf r x) + ∫⁻ (x : ℝ) in Iio 0, exponentialPdf r x) = 1

Next tactic:
have rightSide :
      ∫⁻ x in Ici 0, exponentialPdf r x = ∫⁻ x in Ici 0, ENNReal.ofReal (r * rexp (-(r * x))) :=
    set_lintegral_congr_fun isClosed_Ici.measurableSet
      (ae_of_all _ (fun x (hx : 0 ≤ x) ↦ exponentialPdf_of_nonneg hx))
/-- The Pdf of the exponential Distribution integrates to 1-/
@[simp]
lemma lintegral_exponentialPdf_eq_one (r : ℝ) (hr : 0 < r) : ∫⁻ x, exponentialPdf r x = 1 := by
  rw [lintegral_eq_lintegral_Ici_add_Iio (exponentialPdf r) 0, ← ENNReal.toReal_eq_one_iff]
  have leftSide : ∫⁻ x in Iio 0, exponentialPdf r x = 0 := by
    rw [set_lintegral_congr_fun measurableSet_Iio
      (ae_of_all _ (fun x (hx : x < 0) ↦ exponentialPdf_of_neg hx)), lintegral_zero]
  have rightSide :
      ∫⁻ x in Ici 0, exponentialPdf r x = ∫⁻ x in Ici 0, ENNReal.ofReal (r * rexp (-(r * x))) :=
    set_lintegral_congr_fun isClosed_Ici.measurableSet
      (ae_of_all _ (fun x (hx : 0 ≤ x) ↦ exponentialPdf_of_nonneg hx))
  

Proof state:
r : ℝ
hr : 0 < r
leftSide : ∫⁻ (x : ℝ) in Iio 0, exponentialPdf r x = 0
rightSide : ∫⁻ (x : ℝ) in Ici 0, exponentialPdf r x = ∫⁻ (x : ℝ) in Ici 0, ENNReal.ofReal (r * rexp (-(r * x)))
⊢ ENNReal.toReal ((∫⁻ (x : ℝ) in Ici 0, exponentialPdf r x) + ∫⁻ (x : ℝ) in Iio 0, exponentialPdf r x) = 1

Next tactic:
simp only [leftSide, add_zero]
/-- The Pdf of the exponential Distribution integrates to 1-/
@[simp]
lemma lintegral_exponentialPdf_eq_one (r : ℝ) (hr : 0 < r) : ∫⁻ x, exponentialPdf r x = 1 := by
  rw [lintegral_eq_lintegral_Ici_add_Iio (exponentialPdf r) 0, ← ENNReal.toReal_eq_one_iff]
  have leftSide : ∫⁻ x in Iio 0, exponentialPdf r x = 0 := by
    rw [set_lintegral_congr_fun measurableSet_Iio
      (ae_of_all _ (fun x (hx : x < 0) ↦ exponentialPdf_of_neg hx)), lintegral_zero]
  have rightSide :
      ∫⁻ x in Ici 0, exponentialPdf r x = ∫⁻ x in Ici 0, ENNReal.ofReal (r * rexp (-(r * x))) :=
    set_lintegral_congr_fun isClosed_Ici.measurableSet
      (ae_of_all _ (fun x (hx : 0 ≤ x) ↦ exponentialPdf_of_nonneg hx))
  simp only [leftSide, add_zero]
  

Proof state:
r : ℝ
hr : 0 < r
leftSide : ∫⁻ (x : ℝ) in Iio 0, exponentialPdf r x = 0
rightSide : ∫⁻ (x : ℝ) in Ici 0, exponentialPdf r x = ∫⁻ (x : ℝ) in Ici 0, ENNReal.ofReal (r * rexp (-(r * x)))
⊢ ENNReal.toReal (∫⁻ (x : ℝ) in Ici 0, exponentialPdf r x) = 1

Next tactic:
rw [rightSide, ENNReal.toReal_eq_one_iff, ← ENNReal.toReal_eq_one_iff]
/-- The Pdf of the exponential Distribution integrates to 1-/
@[simp]
lemma lintegral_exponentialPdf_eq_one (r : ℝ) (hr : 0 < r) : ∫⁻ x, exponentialPdf r x = 1 := by
  rw [lintegral_eq_lintegral_Ici_add_Iio (exponentialPdf r) 0, ← ENNReal.toReal_eq_one_iff]
  have leftSide : ∫⁻ x in Iio 0, exponentialPdf r x = 0 := by
    rw [set_lintegral_congr_fun measurableSet_Iio
      (ae_of_all _ (fun x (hx : x < 0) ↦ exponentialPdf_of_neg hx)), lintegral_zero]
  have rightSide :
      ∫⁻ x in Ici 0, exponentialPdf r x = ∫⁻ x in Ici 0, ENNReal.ofReal (r * rexp (-(r * x))) :=
    set_lintegral_congr_fun isClosed_Ici.measurableSet
      (ae_of_all _ (fun x (hx : 0 ≤ x) ↦ exponentialPdf_of_nonneg hx))
  simp only [leftSide, add_zero]
  rw [rightSide, ENNReal.toReal_eq_one_iff, ← ENNReal.toReal_eq_one_iff]
  

Proof state:
r : ℝ
hr : 0 < r
leftSide : ∫⁻ (x : ℝ) in Iio 0, exponentialPdf r x = 0
rightSide : ∫⁻ (x : ℝ) in Ici 0, exponentialPdf r x = ∫⁻ (x : ℝ) in Ici 0, ENNReal.ofReal (r * rexp (-(r * x)))
⊢ ENNReal.toReal (∫⁻ (x : ℝ) in Ici 0, ENNReal.ofReal (r * rexp (-(r * x)))) = 1

Next tactic:
rw [← integral_eq_lintegral_of_nonneg_ae (ae_of_all _ (fun _ ↦ by positivity))]
/-- The Pdf of the exponential Distribution integrates to 1-/
@[simp]
lemma lintegral_exponentialPdf_eq_one (r : ℝ) (hr : 0 < r) : ∫⁻ x, exponentialPdf r x = 1 := by
  rw [lintegral_eq_lintegral_Ici_add_Iio (exponentialPdf r) 0, ← ENNReal.toReal_eq_one_iff]
  have leftSide : ∫⁻ x in Iio 0, exponentialPdf r x = 0 := by
    rw [set_lintegral_congr_fun measurableSet_Iio
      (ae_of_all _ (fun x (hx : x < 0) ↦ exponentialPdf_of_neg hx)), lintegral_zero]
  have rightSide :
      ∫⁻ x in Ici 0, exponentialPdf r x = ∫⁻ x in Ici 0, ENNReal.ofReal (r * rexp (-(r * x))) :=
    set_lintegral_congr_fun isClosed_Ici.measurableSet
      (ae_of_all _ (fun x (hx : 0 ≤ x) ↦ exponentialPdf_of_nonneg hx))
  simp only [leftSide, add_zero]
  rw [rightSide, ENNReal.toReal_eq_one_iff, ← ENNReal.toReal_eq_one_iff]
  rw [← integral_eq_lintegral_of_nonneg_ae (ae_of_all _ (fun _ ↦ by 

Proof state:
r : ℝ
hr : 0 < r
leftSide : ∫⁻ (x : ℝ) in Iio 0, exponentialPdf r x = 0
rightSide : ∫⁻ (x : ℝ) in Ici 0, exponentialPdf r x = ∫⁻ (x : ℝ) in Ici 0, ENNReal.ofReal (r * rexp (-(r * x)))
x✝ : ℝ
⊢ OfNat.ofNat 0 x✝ ≤ r * rexp (-(r * x✝))

Next tactic:
positivity
/-- The Pdf of the exponential Distribution integrates to 1-/
@[simp]
lemma lintegral_exponentialPdf_eq_one (r : ℝ) (hr : 0 < r) : ∫⁻ x, exponentialPdf r x = 1 := by
  rw [lintegral_eq_lintegral_Ici_add_Iio (exponentialPdf r) 0, ← ENNReal.toReal_eq_one_iff]
  have leftSide : ∫⁻ x in Iio 0, exponentialPdf r x = 0 := by
    rw [set_lintegral_congr_fun measurableSet_Iio
      (ae_of_all _ (fun x (hx : x < 0) ↦ exponentialPdf_of_neg hx)), lintegral_zero]
  have rightSide :
      ∫⁻ x in Ici 0, exponentialPdf r x = ∫⁻ x in Ici 0, ENNReal.ofReal (r * rexp (-(r * x))) :=
    set_lintegral_congr_fun isClosed_Ici.measurableSet
      (ae_of_all _ (fun x (hx : 0 ≤ x) ↦ exponentialPdf_of_nonneg hx))
  simp only [leftSide, add_zero]
  rw [rightSide, ENNReal.toReal_eq_one_iff, ← ENNReal.toReal_eq_one_iff]
  rw [← integral_eq_lintegral_of_nonneg_ae (ae_of_all _ (fun _ ↦ by positivity))]
  · 

Proof state:
r : ℝ
hr : 0 < r
leftSide : ∫⁻ (x : ℝ) in Iio 0, exponentialPdf r x = 0
rightSide : ∫⁻ (x : ℝ) in Ici 0, exponentialPdf r x = ∫⁻ (x : ℝ) in Ici 0, ENNReal.ofReal (r * rexp (-(r * x)))
⊢ ∫ (a : ℝ) in Ici 0, r * rexp (-(r * a)) = 1

Next tactic:
have integrOn : IntegrableOn (fun x ↦ rexp (-(r * x))) (Ioi 0) := by
      simp only [← neg_mul, exp_neg_integrableOn_Ioi 0 hr]
/-- The Pdf of the exponential Distribution integrates to 1-/
@[simp]
lemma lintegral_exponentialPdf_eq_one (r : ℝ) (hr : 0 < r) : ∫⁻ x, exponentialPdf r x = 1 := by
  rw [lintegral_eq_lintegral_Ici_add_Iio (exponentialPdf r) 0, ← ENNReal.toReal_eq_one_iff]
  have leftSide : ∫⁻ x in Iio 0, exponentialPdf r x = 0 := by
    rw [set_lintegral_congr_fun measurableSet_Iio
      (ae_of_all _ (fun x (hx : x < 0) ↦ exponentialPdf_of_neg hx)), lintegral_zero]
  have rightSide :
      ∫⁻ x in Ici 0, exponentialPdf r x = ∫⁻ x in Ici 0, ENNReal.ofReal (r * rexp (-(r * x))) :=
    set_lintegral_congr_fun isClosed_Ici.measurableSet
      (ae_of_all _ (fun x (hx : 0 ≤ x) ↦ exponentialPdf_of_nonneg hx))
  simp only [leftSide, add_zero]
  rw [rightSide, ENNReal.toReal_eq_one_iff, ← ENNReal.toReal_eq_one_iff]
  rw [← integral_eq_lintegral_of_nonneg_ae (ae_of_all _ (fun _ ↦ by positivity))]
  · have integrOn : IntegrableOn (fun x ↦ rexp (-(r * x))) (Ioi 0) := by
      

Proof state:
r : ℝ
hr : 0 < r
leftSide : ∫⁻ (x : ℝ) in Iio 0, exponentialPdf r x = 0
rightSide : ∫⁻ (x : ℝ) in Ici 0, exponentialPdf r x = ∫⁻ (x : ℝ) in Ici 0, ENNReal.ofReal (r * rexp (-(r * x)))
⊢ IntegrableOn (fun x => rexp (-(r * x))) (Ioi 0)

Next tactic:
simp only [← neg_mul, exp_neg_integrableOn_Ioi 0 hr]