Skip to content

Commit 1d84fce

Browse files
committed
Merge branch 'main' into forFix
2 parents 7610bd9 + e3d45dc commit 1d84fce

7 files changed

Lines changed: 14 additions & 11 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
# the single fetched commit.
4848
fetch-depth: 0 # Fetch all history for all branches and tags
4949

50-
- name: Build and lint project
50+
- name: Build, lint and test project
5151
uses: leanprover/lean-action@38fbc41a8c28c4cbaec22d7f7de508ec2e7c0dd9 # v1.5.0
5252
with:
5353
build: true

‎RandomDo/Measurable.lean‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ def Vector.measurableEquivTuple {n : ℕ} : Vector α n ≃ᵐ (Fin n → α) wh
117117
ext
118118
simp
119119

120-
instance : MeasurableSpace (Option α) := MeasurableSpace.map some inferInstance
120+
instance instMeasurableSpaceOption : MeasurableSpace (Option α) :=
121+
MeasurableSpace.map some inferInstance
121122

122123
theorem measurableSet_option_iff {s : Set (Option α)} :
123124
MeasurableSet s ↔ MeasurableSet (some ⁻¹' s) := Iff.rfl

‎RandomDo/Monad/ForInInstances.lean‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ section MeasurableSpace
2020

2121
variable {α : Type*} [MeasurableSpace α]
2222

23-
instance : MeasurableSpace (List α) :=
23+
instance instMeasurableSpaceList : MeasurableSpace (List α) :=
2424
MeasurableSpace.comap List.equivSigmaTuple inferInstance
2525

26-
instance : MeasurableSpace (Array α) :=
26+
instance instMeasurableSpaceArray : MeasurableSpace (Array α) :=
2727
MeasurableSpace.comap Array.toList inferInstance
2828

29-
instance {n : ℕ} : MeasurableSpace (Vector α n) :=
29+
instance instMeasurableSpaceVector {n : ℕ} : MeasurableSpace (Vector α n) :=
3030
MeasurableSpace.comap Vector.toArray inferInstance
3131

3232
instance instMeasurableSpaceSubarray : MeasurableSpace (Subarray α) :=
@@ -59,7 +59,7 @@ section Array
5959
{β : Type u} [mβ : MeasurableSpace β]
6060
(as : Array α) (b : β) (f : (a : α) → a ∈ as → β → m (ForInStep β)) : m β :=
6161
let sz := as.usize
62-
let rec @[specialize] loop (i : USize) (b : β) : m β := rdo
62+
let rec @[specialize, nolint docBlame] loop (i : USize) (b : β) : m β := rdo
6363
if i < sz then
6464
let a := as.uget i lcProof
6565
match (← f a lcProof b) with
@@ -74,7 +74,7 @@ section Array
7474
protected def Array.measurableSpaceForIn' [MeasurableSpaceMonad m]
7575
{β : Type u} [mβ : MeasurableSpace β]
7676
(as : Array α) (b : β) (f : (a : α) → a ∈ as → β → m (ForInStep β)) : m β :=
77-
let rec loop (i : Nat) (h : i ≤ as.size) (b : β) : m β := rdo
77+
let rec @[nolint docBlame] loop (i : Nat) (h : i ≤ as.size) (b : β) : m β := rdo
7878
match i, h with
7979
| 0, _ => mPure b
8080
| i+1, h =>
@@ -104,7 +104,7 @@ variable {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] [Ring α]
104104
protected def List.measurableSpaceForIn' [MeasurableSpaceMonad m]
105105
{β : Type u} [mβ : MeasurableSpace β] (as : @& List α) (init : β)
106106
(f : (a : α) → a ∈ as → β → m (ForInStep β)) : m β :=
107-
let rec @[specialize]
107+
let rec @[specialize, nolint docBlame]
108108
loop : (as' : @& List α) → (b : β) → Exists (fun bs => bs ++ as' = as) → m β
109109
| [], b, _ => mPure b
110110
| a::as', b, h => rdo

‎RandomDo/Monad/Instances.lean‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ open Function
5757
/-- A monad for random number generation. -/
5858
structure RandomM (Ω : Type w) [MeasurableSpace Ω] (P : Measure Ω)
5959
(α : Type u) [MeasurableSpace α] where
60+
/-- Draws a value from a state of the source of randomness, and hands back the state left for the
61+
next draw. -/
6062
sample : Ω → α × Ω
6163
measurePreserving : MeasurePreserving sample P ((Measure.map (Prod.fst ∘ sample) P).prod P)
6264

‎RandomDo/Monad/MeasurableSpace.lean‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ variable {f : (α : Type u) → [MeasurableSpace α] → Type v} [MeasurableSpac
142142
g₁ <$>ₘ g₀ <$>ₘ x = (fun a => g₁ (g₀ a)) <$>ₘ x :=
143143
(comp_mMap x hg₀ hg₁).symm
144144

145-
@[simp] theorem mMap_unit {a : f PUnit} : (fun _ => PUnit.unit) <$>ₘ a = a := by simp
146-
147145
open MeasurableSpaceBind MeasurableSpacePure MeasurableSpaceFunctor
148146

149147
/-- A `MeasurableSpaceMonad` satisfies the measurable space monad laws. -/

‎Test/Common.lean‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module
22

33
public import RandomDo
4+
public import Mathlib.Probability.Distributions.Bernoulli
45

56
set_option linter.style.header false
67

‎lakefile.toml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name = "RandomDo"
2-
defaultTargets = ["RandomDo", "Test"]
2+
defaultTargets = ["RandomDo"]
33
lintDriver = "batteries/runLinter"
4+
testDriver = "Test"
45

56
[leanOptions]
67
pp.unicode.fun = true

0 commit comments

Comments
 (0)