Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Complexity.PolyTime.Nat.Fin

Normalizing unary indices into fixed finite ranges #

Reducing a unary natural modulo a fixed positive bound gives an index in Fin bound. The output encoding is arbitrary: changing an encoding on a fixed finite type has constant cost. The modulus and encoding are fixed independently of the runtime input.

Main results #

theorem Turing.MultiTapeTM.ComputableInPolyTime.unary_finMod {bound : ℕ} (hbound : 0 < bound) (output : Fin bound ↪ List Bool) :
ComputableInPolyTime (fun (index : ℕ) => ⟨index % bound, ⋯⟩) encUnary output

Normalize a unary index into a fixed positive finite range, using any fixed output encoding.