Loops over a range of indices — proof internals #
The helper facts behind Complexitylib.Classes.P.Range. Concatenation over a
range is a loop whose state carries the output so far, the index in unary, and
the input; iterate_mem_FP_of_polyBound runs it, and the bound on its state
comes from the rule alone, since a polynomial-time rule has polynomially long
outputs and the loop runs at most as often as its argument is long. The rest is
the one-bit marks, and the arithmetic behind computing a maximum as a count.
Contents #
listStep,listStep_iterate— the loop and what it accumulatesentryCat— the accumulated output, indexed by the number of roundsbitstringEncode_of_entries— accumulating entry encodings encodes the listcatRange_mem_FP_internal— concatenation over a range is polynomial-timeisEmptyMark_mem_FP_internal,nonemptyMark_mem_FP— the one-bit marksmaxProbe_mem_FP,length_maxProbe_pair— the test behindmaxFn
The loop #
The bits the loop has accumulated after n steps.
Equations
- Complexity.entryCat E x n = List.flatMap (fun (i : ℕ) => E (Complexity.pair x (List.replicate i true))) (List.range n)
Instances For
Encoding a list #
theorem
Complexity.bitstringEncode_of_entries
{α : Type}
[DataEncode α]
{E : List Bool → List Bool}
{x : List Bool}
(l : List α)
(h : ∀ (i : ℕ) (hi : i < l.length), E (pair x (List.replicate i true)) = DataEncode.bitstringEncode l[i])
:
The accumulation is the encoding. If each step writes the encoding of the corresponding entry, the loop writes the inner part of the list's own encoding.