Documentation

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

The pairing function on binary naturals in polynomial time #

Mathlib's pairing function Nat.pair a b is b * b + a when a < b and a * a + a + b otherwise. It is therefore a case distinction between binary sums and products, and is computable in polynomial time on the binary encoding Turing.MultiTapeTM.encNat. The unary version is Turing.MultiTapeTM.ComputableInPolyTime.unary_pair.

Main results #

The natural-number pairing function Nat.pair, with both arguments and the result in binary.

theorem Turing.MultiTapeTM.ComputableInPolyTime.binary_pair' {α : Type} {input : α ↪ List Bool} {left right : α → ℕ} (hleft : ComputableInPolyTime left input encNat) (hright : ComputableInPolyTime right input encNat) :
ComputableInPolyTime (fun (a : α) => Nat.pair (left a) (right a)) input encNat

Pair computed binary values, fixing their intermediate encodings for proof search.