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 #
Turing.MultiTapeTM.ComputableInPolyTime.binary_pair: the pairing function, with both arguments and the result in binary.Turing.MultiTapeTM.ComputableInPolyTime.binary_pair': the same for computed arguments, forfun_prop.
theorem Turing.MultiTapeTM.ComputableInPolyTime.binary_pair' {α : Type} {input : α ↪ List Bool} {left right : α → ℕ} (hleft : ComputableInPolyTime left input encNat) (hright : ComputableInPolyTime right input encNat) :
Pair computed binary values, fixing their intermediate encodings for proof search.