The bit-query program #
bitAtProg on (y, m) — a bit string and a binary index — returns the m-th bit of y,
or the out-of-range marker ofNat 2: this is the answer a succinct description must give
([MNY, Definition 2.4]; bitQueryAnswer). It walks y while decrementing m in binary,
testing for zero at each step, so its cost is (|y| + 1) · bitAtIter (size y) |m| with
bitAtIter quadratic in |m| (each zero test and decrement copies the index). This is
where the (|m| + 1) ^ 2 factor of the succinctness budget of IsSuccinctDesc comes from.
The answer a succinct description must give to the bit-query m about the string
x: the m-th bit for m < |x|, and the out-of-range marker (the unary numeral 2)
otherwise.
Equations
- MIPRE.Cost.bitQueryAnswer x m = if h : m < List.length x then MIPRE.Cost.encode (List.get x ⟨m, h⟩) else MIPRE.Cost.Data.ofNat 2
Instances For
Cost of one iteration of bitAtProg with a string of size at most sy and an index of
L bits.
Equations
- MIPRE.Cost.Prog.bitAtIter sy L = sy + 8 * L + MIPRE.Cost.Prog.zeroBound L + MIPRE.Cost.Prog.decBound L + 20
Instances For
Body of bitAtProg: on state cons y m, stop with ofNat 2 if y is exhausted; else
test m for zero: if zero, stop with the head bit of y; otherwise continue with the tail
of y and m - 1.
Equations
- One or more equations did not get rendered due to their size.
Instances For
bitAtProg on cons (encode y) (encode m) computes bitQueryAnswer y m.
Instances For
The body when the index is nonzero: continue with the tail and the decremented index.
bitAtProg answers bit queries: on (encode y, encode m) it computes
bitQueryAnswer y m, in time (|y| + 1) · bitAtIter (size y) (Nat.size m).