Writing out a list of encoded entries #
The encoding of a list is its entries' encodings run together inside one pair of brackets. So a machine that can produce each entry's encoding can produce the list's, by accumulating them in a loop.
The loop is iterate_mem_FP, and the state carries the accumulated bits, the
counter, and the input the entries are read from.
Main definitions #
Complexity.listStep— append the next entry's encoding
Main results #
Complexity.listStep_iterate— what the loop accumulatesComplexity.bitstringEncode_of_entries— the accumulation is the encodingComplexity.listEncFn_mem_FP,Complexity.listEncFn_eq— the loop is polynomial time and writes the encoding
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
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.
The loop as one function #
theorem
Complexity.listEncFn_eq_bitstringEncode
{α : Type}
[DataEncode α]
{E : List Bool → List Bool}
{z : List Bool}
(l : List α)
(hn : (pairFst z).length = l.length)
(h : ∀ (i : ℕ) (hi : i < l.length), E (pair (pairSnd z) (List.replicate i true)) = DataEncode.bitstringEncode l[i])
:
The loop writes the list's encoding.