File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,19 @@ deriving Repr
1919Fait Accompli sortition.
2020-/
2121def faSortition (nPools n : Nat) : List Sortition :=
22- let S (i : Nat) := ((nPools - i + 1 ).toFloat / nPools.toFloat)^ 10 - ((nPools - i ).toFloat / nPools.toFloat)^10
23- let ρ (i : Nat) := 1 - ((nPools - i).toFloat / nPools.toFloat)^10
24- let test (n i : Nat) : Bool := (1 - S i / ρ i)^2 < (n - i).toFloat / (n - i + 1 ).toFloat
22+ let ρ (i : Nat) := ((nPools - i + 1 ).toFloat / nPools.toFloat)^10
23+ let S (i : Nat) := ρ i - ((nPools - i).toFloat / nPools.toFloat)^10
24+ let test (i : Nat) : Bool := (1 - S i / ρ i)^2 < (n - i).toFloat / (n - i + 1 ).toFloat
2525 let i := (List.range nPools).map $ Add.add 1
26- let ⟨ persistent , nonpersistent ⟩ := i.partition $ test n
27- let ρStar := ρ $ persistent.length + 1
26+ let ⟨ persistent , nonpersistent ⟩ := i.partition test
27+ let n₁ := persistent.length
28+ let n₂ := n - n₁
29+ let ρStar := ρ $ n₁ + 1
2830 let persistent' := persistent.map $ fun i ↦ {stake := S i, probability := 1 }
2931 let nonpersistent' :=
3032 nonpersistent.map $ fun i ↦
3133 let Si := S i
32- {stake := Si, probability := Si / ρStar}
34+ {stake := Si, probability := 1 - Float.exp (- n₂.toFloat * Si / ρStar) }
3335 persistent' ++ nonpersistent'
3436
3537/--
Original file line number Diff line number Diff line change @@ -131,8 +131,8 @@ private def outcomeNearUnity (os : Outcomes) : Bool :=
131131 )
132132 $ group "Quorum" (
133133 check "All voters vote and all votes are received" (
134- ∀ τ : RangedFloat 0 .51 0 .76 ,
135- ∀ committeeSize : RangedNat 700 1000 ,
134+ ∀ τ : RangedFloat 0 .50 0 .90 ,
135+ ∀ committeeSize : RangedNat 600 1000 ,
136136 nearUnity $ pQuorum 1 committeeSize.value.toFloat τ.value
137137 )
138138 )
You can’t perform that action at this time.
0 commit comments