Skip to content

Commit a118834

Browse files
committed
feat(UnitInterval): x : I and its symmetric sum to 1 (#31396)
1 parent 6563fa2 commit a118834

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

Mathlib/MeasureTheory/Measure/Typeclasses/Probability.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Johannes Hölzl, Mario Carneiro
55
-/
66
import Mathlib.MeasureTheory.Measure.Typeclasses.Finite
7+
import Mathlib.Topology.UnitInterval
78

89
/-!
910
# Classes for probability measures
@@ -92,6 +93,11 @@ instance isProbabilityMeasure_ite {p : Prop} [Decidable p] {μ ν : Measure α}
9293
[IsProbabilityMeasure μ] [IsProbabilityMeasure ν] :
9394
IsProbabilityMeasure (ite p μ ν) := by split <;> infer_instance
9495

96+
open unitInterval in
97+
instance {μ ν : Measure α} [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] {p : I} :
98+
IsProbabilityMeasure (toNNReal p • μ + toNNReal (σ p) • ν) where
99+
measure_univ := by simp [← add_smul]
100+
95101
variable [IsProbabilityMeasure μ] {p : α → Prop} {f : β → α}
96102

97103
theorem Measure.isProbabilityMeasure_map {f : α → β} (hf : AEMeasurable f μ) :

Mathlib/Topology/UnitInterval.lean

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -385,19 +385,21 @@ theorem iccHomeoI_symm_apply_coe (a b : 𝕜) (h : a < b) (x : Set.Icc (0 : 𝕜
385385

386386
end
387387

388-
section NNReal
388+
namespace unitInterval
389389

390-
open unitInterval NNReal
390+
open NNReal
391391

392392
/-- The coercion from `I` to `ℝ≥0`. -/
393-
def unitInterval.toNNReal : I → ℝ≥0 := fun i ↦ ⟨i.1, i.2.1
393+
def toNNReal : I → ℝ≥0 := fun i ↦ ⟨i.1, i.2.1
394394

395-
@[fun_prop]
396-
lemma unitInterval.toNNReal_continuous : Continuous toNNReal := by
397-
delta toNNReal
398-
fun_prop
395+
@[simp] lemma toNNReal_zero : toNNReal 0 = 0 := rfl
396+
@[simp] lemma toNNReal_one : toNNReal 1 = 1 := rfl
399397

400-
@[simp]
401-
lemma unitInterval.coe_toNNReal (x : I) : ((toNNReal x) : ℝ) = x := rfl
398+
@[fun_prop] lemma toNNReal_continuous : Continuous toNNReal := by delta toNNReal; fun_prop
399+
400+
@[simp] lemma coe_toNNReal (x : I) : ((toNNReal x) : ℝ) = x := rfl
402401

403-
end NNReal
402+
@[simp] lemma toNNReal_add_toNNReal_symm (x : I) : toNNReal x + toNNReal (σ x) = 1 := by ext; simp
403+
@[simp] lemma toNNReal_symm_add_toNNReal (x : I) : toNNReal (σ x) + toNNReal x = 1 := by ext; simp
404+
405+
end unitInterval

0 commit comments

Comments
 (0)