Checking that a witness is consistent #
A witness records an answer for every query slot. It comes from an actual proof only if slots reading the same proof position carry the same answer, and that is what this module checks: four nested loops over a pair of coin strings and a pair of query indices.
The check never looks at a position as a number. posAt returns each query
position as its own serialization, so slots reading the same position are
recognised by comparing strings — and a slot past the end of a query list is
recognised by that string being empty.
Main definitions #
Complexity.consLang— the consistency check, as a language ofpair x w
Main results #
Complexity.consLang_mem_P— the check is polynomial time
Reading the nested loop input #
The innermost input is pair (pair (pair (pair (pair x w) ρ) ρ') i) i', with
the four loop indices in unary.
Strip the last two indices.
Equations
Instances For
Strip the last three indices.
Equations
Instances For
The original pair x w.
Equations
Instances For
The input.
Equations
Instances For
The witness.
Equations
Instances For
The first coin index.
Equations
Instances For
The second coin index.
Equations
Instances For
The first query index.
Equations
Instances For
The second query index.
Equations
Instances For
The check #
The first coin string.
Equations
- Complexity.conRho r y = Complexity.coinStr (r (Complexity.conX y).length) (Complexity.conC1 y)
Instances For
The second coin string.
Equations
- Complexity.conRho' r y = Complexity.coinStr (r (Complexity.conX y).length) (Complexity.conC2 y)
Instances For
The position the first slot queries, as a string.
Equations
- Complexity.conP f r y = Complexity.posAt (f (Complexity.pair (Complexity.conX y) (Complexity.conRho r y))) (Complexity.conC3 y)
Instances For
The position the second slot queries, as a string.
Equations
- Complexity.conP' f r y = Complexity.posAt (f (Complexity.pair (Complexity.conX y) (Complexity.conRho' r y))) (Complexity.conC4 y)
Instances For
The answer recorded in the first slot.
Equations
- Complexity.conB Q y = Complexity.wBlock (Complexity.conW y) (Complexity.conC1 y * Q + Complexity.conC3 y) 1
Instances For
The answer recorded in the second slot.
Equations
- Complexity.conB' Q y = Complexity.wBlock (Complexity.conW y) (Complexity.conC2 y * Q + Complexity.conC4 y) 1
Instances For
Polynomial time #
The two inner loops, over the pair of query indices.
Equations
- Complexity.consL3 f r Q = {y : List Bool | ∀ i' < Q, Complexity.pair y (List.replicate i' true) ∈ Complexity.consInner f r Q}
Instances For
The outer of the two query-index loops.
Equations
- Complexity.consL2 f r Q = {y : List Bool | ∀ i < Q, Complexity.pair y (List.replicate i true) ∈ Complexity.consL3 f r Q}
Instances For
The outer loop over the second coin string.
Equations
- Complexity.consL1 f r Q = {y : List Bool | ∀ c' < 2 ^ r (Complexity.pairFst (Complexity.pairFst y)).length, Complexity.pair y (List.replicate c' true) ∈ Complexity.consL2 f r Q}
Instances For
The consistency check, as a language of pair x w.
Equations
- Complexity.consLang f r Q = {z : List Bool | ∀ c < 2 ^ r (Complexity.pairFst z).length, Complexity.pair z (List.replicate c true) ∈ Complexity.consL1 f r Q}
Instances For
What one iteration says #
The pieces on a packed argument #
Unfolding the loops #
The check is consistency #
The consistency check says exactly what it should.