Skip to content

Commit e6b39b8

Browse files
committed
Tidied up function definitions
1 parent 3d3323b commit e6b39b8

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

analysis/markov/src/Linleios/Evolve.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def simulate (env : Environment) (start : Probabilities) (ε : Float) : Nat →
110110
Compute the total probabilities of a set of states.
111111
-/
112112
def totalProbability (states : Probabilities) : Probability :=
113-
states.values.sum
113+
states.fold (Function.const State ∘ Add.add) 0
114114

115115
/--
116116
Compute 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
)

analysis/markov/src/Linleios/Types.lean

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,14 @@ structure State where
7474
canCertify : Bool
7575
deriving 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
/--
8978
The active states and their probabilities.
9079
-/
9180
def Probabilities := HashMap State Probability
9281
deriving Repr, EmptyCollection
9382

9483
instance : Inhabited Probabilities where
84+
-- TODO: Rewrite using `Singleton.singleton`.
9585
default := (∅ : Probabilities).insert Inhabited.default 1
9686

9787

0 commit comments

Comments
 (0)