File tree Expand file tree Collapse file tree 2 files changed +3
-12
lines changed
analysis/markov/src/Linleios Expand file tree Collapse file tree 2 files changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ def simulate (env : Environment) (start : Probabilities) (ε : Float) : Nat →
110110Compute the total probabilities of a set of states.
111111-/
112112def totalProbability (states : Probabilities) : Probability :=
113- states.values.sum
113+ states.fold (Function.const State ∘ Add.add) 0
114114
115115/--
116116Compute the distribution of EB counts.
@@ -119,6 +119,7 @@ def ebDistribution : Probabilities → HashMap Nat Probability :=
119119 HashMap.fold
120120 (
121121 fun acc state p =>
122+ -- FIXME: Rewrite using `Function.const`.
122123 HashMap.mergeWith (fun _ => Add.add) acc
123124 $ singleton ⟨ state.ebCount , p ⟩
124125 )
Original file line number Diff line number Diff line change @@ -74,24 +74,14 @@ structure State where
7474 canCertify : Bool
7575deriving Repr, BEq, Hashable, Inhabited
7676
77- /--
78- The genesis state starts when zero counts.
79- -/
80- theorem genesis : (default : State).clock = 0 ∧ (default : State).rbCount = 0 ∧ (default : State).ebCount = 0 := by
81- constructor
82- rfl
83- constructor
84- rfl
85- rfl
86-
87-
8877/--
8978The active states and their probabilities.
9079-/
9180def Probabilities := HashMap State Probability
9281deriving Repr, EmptyCollection
9382
9483instance : Inhabited Probabilities where
84+ -- TODO: Rewrite using `Singleton.singleton`.
9585 default := (∅ : Probabilities).insert Inhabited.default 1
9686
9787
You can’t perform that action at this time.
0 commit comments