File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1313jobs :
1414 build :
1515 runs-on : ubuntu-latest
16-
1716 steps :
1817 - uses : actions/checkout@v4
1918 - uses : leanprover/lean-action@v1
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ def forge {env : Environment} (state : State) : List (State × Probability) :=
4949 state with
5050 rbCount := state.rbCount + 1
5151 }
52- , env.pSpacingOkay
52+ , 1 - env.pSpacingOkay
5353 ⟩
5454 , ⟨
5555 {
@@ -72,3 +72,10 @@ def evolve (transition : State → List (State × Probability)) : Probabilities
7272 $ transition state
7373 )
7474 ∅
75+
76+ def simulate (transition : State → List (State × Probability)) (start : Probabilities) : Nat → Probabilities
77+ | 0 => start
78+ | n + 1 => simulate transition (evolve transition start) n
79+
80+ def totalProbability (states : Probabilities) : Probability :=
81+ states.values.sum
Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ import Linleios
55def env : Environment := makeEnvironment 0 .05 1 4 7
66
77def s0 : Probabilities := default
8- def s1 := evolve (@forge env) s0
8+ def sn := simulate (@forge env) s0 5
9+ def pn := totalProbability sn
910
1011def main : IO Unit :=
11- IO.println $ (reprPrec s1 0 ).pretty
12+ do
13+ IO.println $ (reprPrec sn 0 ).pretty
14+ IO.println $ (reprPrec pn 0 ).pretty
You can’t perform that action at this time.
0 commit comments