Flat saved tapes for probabilistic list traversal #
A traversal can replay every call from its own fixed-width block of one uniform bit list. The component realization law is required only at values occurring in the input list. Equal input values still use distinct independent blocks, and zero-width blocks remain valid.
Main results #
Cslib.ProbComp.eval_mapM_of_uniformList: replay the original traversal with exactlylist.length * widthallocated bits.
theorem Cslib.ProbComp.eval_mapM_of_uniformList {α β : Type} (program : α → ProbComp β) (evaluate : α → List Bool → β) (width : ℕ) (list : List α) (hlaw : ∀ a ∈ list, (program a).eval = PMF.map (evaluate a) (BitString.uniformList width)) :
(List.mapM program list).eval = PMF.map (fun (tape : List Bool) => List.zipWith evaluate list (BitString.listRows list.length width tape))
(BitString.uniformList (list.length * width))
Independent fixed-width component seeds combine into one flat tape. The realization premise concerns only the actual input values; it imposes no law outside the supplied list. This is an exact distribution law and does not by itself assert computational efficiency.