9191\end{figure*}
9292
9393\begin{figure*}[h]
94+ \begin{AgdaSuppressSpace}
9495\emph{Protocol helper functions}
9596\begin{code}
9697hBLeader : BHBody → Certifiedℕ
@@ -101,22 +102,37 @@ hBNonce : BHBody → Nonce
101102hBNonce bhb = serHashToNonce (hash (encode "N" ∥ encode vrfRes))
102103 where open BHBody bhb
103104
105+ \end{code}
106+ \begin{AgdaAlign}
107+ \begin{code}
104108checkLeaderVal : Certifiedℕ → PosUnitInterval → ℚ → Type
105109checkLeaderVal (certℕ , certℕprf) (f , posf , f≤1) σ =
106- if f ≡ 1ℚ then ⊤ else λ{f≢1ℚ} →
107- let
108- p = pos certℕ ℚ./ (2 ^ 512)
109- p≢1ℚ = ↥p<↧p⇒p≢1 {p} (n<m⇒↥[n/m]<↧[n/m] certℕprf)
110- q = 1ℚ ℚ.- p
111- 1-f≥0 = p≤1⇒1-p≥0 f≤1
112- 1-f≢0 = p≢1⇒1-p≢0 f≢1ℚ
113- instance
114- q≢0ℚ = ℚ.≢-nonZero (p≢1⇒1-p≢0 p≢1ℚ)
115- 1-f>0 = ℚ.positive (≤∧≢⇒< 1-f≥0 $ ≢-sym 1-f≢0)
116- c = ln (1ℚ ℚ.- f)
117- in
118- ℚ.1/ q < exp ((ℚ.- σ) ℚ.* c)
110+ if f ≡ 1ℚ then ⊤ else
111+ \end{code}
112+ \begin{code}[hide]
113+ λ{f≢1ℚ} →
114+ \end{code}
115+ \begin{code}
116+ let
117+ p = pos certℕ ℚ./ (2 ^ 512)
118+ q = 1ℚ ℚ.- p
119+ \end{code}
120+ \begin{code}[hide]
121+ p≢1ℚ = ↥p<↧p⇒p≢1 {p} (n<m⇒↥[n/m]<↧[n/m] certℕprf)
122+ 1-f≥0 = p≤1⇒1-p≥0 f≤1
123+ 1-f≢0 = p≢1⇒1-p≢0 f≢1ℚ
124+ instance
125+ q≢0ℚ = ℚ.≢-nonZero (p≢1⇒1-p≢0 p≢1ℚ)
126+ 1-f>0 = ℚ.positive (≤∧≢⇒< 1-f≥0 $ ≢-sym 1-f≢0)
127+ \end{code}
128+ \begin{code}
129+ c = ln (1ℚ ℚ.- f)
130+ in
131+ ℚ.1/ q < exp ((ℚ.- σ) ℚ.* c)
119132
133+ \end{code}
134+ \end{AgdaAlign}
135+ \begin{code}
120136vrfChecks : Nonce → PoolDistr → PosUnitInterval → BHBody → Type
121137vrfChecks η₀ pd f bhb =
122138 case lookupPoolDistr pd hk of
@@ -131,6 +147,7 @@ vrfChecks η₀ pd f bhb =
131147 hk = hash issuerVk
132148 seed = slotToSeed slot XOR nonceToSeed η₀
133149\end{code}
150+ \end{AgdaSuppressSpace}
134151\caption{Protocol transition system helper functions}
135152\label{fig:ts-funs:prtcl}
136153\end{figure*}
0 commit comments