Documentation

Complexitylib.Classes.P.Pairing

Polynomial-time pairing and unpairing #

The pairing codec pair of Complexitylib.Encoding.Pairing is the library's canonical way to hand a machine two strings at once. This file records that the codec is polynomial-time in both directions: pairing two polynomial-time values is polynomial-time, and so are the projections pairFst / pairSnd, whose scanners are the block machines of Cobham's algebra.

Main results #

Polynomial-time facts #

The first projection is polynomial-time.

The second projection is polynomial-time.

theorem Complexity.mem_FP_pair {a b : List BoolList Bool} (ha : a FP) (hb : b FP) :
(fun (z : List Bool) => pair (a z) (b z)) FP

Pairing is polynomial-time: two polynomial-time functions can be evaluated on a common input and paired in polynomial time.

theorem Complexity.mem_FP_pair_right {f : List BoolList Bool} (hf : f FP) :
(fun (x : List Bool) => pair (f x) x) FP

Pairing the input on the right of a polynomial-time value is polynomial-time. This is mem_FP_pairWithInput; the mirror image is mem_FP_pair id_mem_FP hf.

A language of the first component of a pair is polynomial-time decidable.

A language of the second component of a pair is polynomial-time decidable.