Skip to content

Commit 79f51f7

Browse files
committed
Less rules
1 parent ae7d0d1 commit 79f51f7

5 files changed

Lines changed: 110 additions & 556 deletions

File tree

‎RandomDo/ForMathlib/Probability/Distributions/Bernoulli.lean‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,11 @@ namespace ProbabilityTheory
2222

2323
variable {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y]
2424

25-
lemma bernoulliMeasure_bind (x y : X) (p : I) {g : X → Measure Y} (hg : Measurable g) :
26-
Ber(x, y, p).bind g = (toNNReal p : ℝ≥0∞) • g x + (toNNReal (σ p) : ℝ≥0∞) • g y := by
27-
rw [bernoulliMeasure_def, bind_add hg.aemeasurable, bind_smul, bind_smul, dirac_bind hg,
28-
dirac_bind hg]
29-
rfl
30-
3125
/-- Binding a Bernoulli distribution on a space whose points are measurable: the continuation needs
3226
no measurability, and the two weights are real numbers, so that `simp` can use it and `norm_num`
3327
can compute with the result. -/
3428
@[simp]
35-
lemma bernoulliMeasure_bind' [MeasurableSingletonClass X] (x y : X) (p : I) (g : X → Measure Y) :
29+
lemma bernoulliMeasure_bind [MeasurableSingletonClass X] (x y : X) (p : I) (g : X → Measure Y) :
3630
Ber(x, y, p).bind g = ENNReal.ofReal p • g x + ENNReal.ofReal (1 - p) • g y := by
3731
have h (q : I) : ((toNNReal q : NNReal) : ℝ≥0∞) = ENNReal.ofReal q := by
3832
rw [ENNReal.ofReal, Real.toNNReal_of_nonneg q.2.1]

‎RandomDo/Monad/While.lean‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module
88
public import RandomDo.Monad.Instances
99
public import RandomDo.Tactic.IsMarkov.Defs
1010
import RandomDo.Monad.Notation
11-
public import Mathlib.Probability.Distributions.Bernoulli
1211

1312
/-!
1413
# `while` loops
@@ -151,7 +150,8 @@ private lemma loopRun_succ (f : σ → Measure (ForInStep σ)) (n : ℕ) (b : σ
151150
loopRun f (n + 1) b = (f b).bind fun t ↦
152151
ForInStep.casesOn (motive := fun _ ↦ Measure σ) t (fun _ ↦ 0) (loopRun f n) := rfl
153152

154-
private lemma measurable_casesOn {γ : Type*} [MeasurableSpace γ] {d y : σ → γ}
153+
/-- A case analysis on the outcome of a step is measurable as soon as its two branches are. -/
154+
lemma measurable_casesOn {γ : Type*} [MeasurableSpace γ] {d y : σ → γ}
155155
(hd : Measurable d) (hy : Measurable y) :
156156
Measurable fun t : ForInStep σ ↦ ForInStep.casesOn (motive := fun _ ↦ γ) t d y :=
157157
fun _ hs ↦ ⟨hy hs, hd hs⟩

‎RandomDo/Tactic/IsMarkov/ForInStep.lean‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ largest one making both `ForInStep.yield` and `ForInStep.done` measurable.
2222
## Main results
2323
* `measurable_yield`, `measurable_run`, `measurable_isDone`: the maps relating `ForInStep β` to `β`
2424
and to `Bool` are measurable.
25-
* The points of `ForInStep β` are measurable as soon as those of `β` are, and `ForInStep.yield` is a
26-
measurable embedding.
25+
* The points of `ForInStep β` are measurable as soon as those of `β` are.
2726
* `measurable_CasesOn`: a case analysis on a `ForInStep`, measurable in each of its two branches, is
2827
measurable.
2928
* `IsMarkov.forInStepCasesOn`: the same statement for the Markov property.
@@ -65,17 +64,6 @@ instance [MeasurableSingletonClass β] : MeasurableSingletonClass (ForInStep β)
6564
-- A singleton's preimages under `yield` and `done` are a singleton and the empty set.
6665
constructor <;> cases t <;> change MeasurableSet (_ ⁻¹' _) <;> simp [Set.preimage]
6766

68-
lemma measurableEmbedding_yield : MeasurableEmbedding (ForInStep.yield : β → ForInStep β) where
69-
injective _ _ h := ForInStep.yield.inj h
70-
measurable := measurable_yield
71-
measurableSet_image' S hS := by
72-
refine ⟨?_, ?_⟩
73-
· change MeasurableSet (ForInStep.yield ⁻¹' _)
74-
rwa [Set.preimage_image_eq _ fun _ _ h ↦ ForInStep.yield.inj h]
75-
· change MeasurableSet (ForInStep.done ⁻¹' _)
76-
convert MeasurableSet.empty (α := β)
77-
ext; simp
78-
7967
instance [Countable β] : Countable (ForInStep β) :=
8068
Function.Injective.countable (f := fun t : ForInStep β ↦ (t.isDone, t.run)) <| by
8169
rintro (_ | _) (_ | _) h <;> simp_all

0 commit comments

Comments
 (0)