Programming with polynomial-time string functions #
⚠️ Unreviewed by Bolton
Cobham's theorem makes FP a programming language: a function is
polynomial-time exactly when it belongs to the algebra, so a construction can be
written as a composition of small pieces instead of assembled as a machine. This
file collects the glue that makes the two levels interoperate.
The algebra is stated at every arity, over vectors of arguments, while FP is
unary; the bridge is the pairing. binFn_mem_FP turns a two-argument member of
the algebra into an FP closure rule, and the rest of the file is that rule
applied to the toolkit of
Complexitylib.Classes.P.Cobham.Internal.StringOps and
Complexitylib.Classes.P.Cobham.Internal.Algebra.
Main results #
Cobham.fstBlockFn,Cobham.sndBlockFn— the pair decoders, in the algebraunFn_mem_FP,binFn_mem_FP— algebra members becomeFPclosure rulesdropLenFn_mem_FP,orBitFn_mem_FP,lenLeFlagFn_mem_FP,eqFlagFn_mem_FP— the rules this givesconstFn_mem_FP— every constant is polynomial-timemem_FP_of_eq—FPrespects pointwise equality
From the algebra to FP closure rules #
A two-argument member of the algebra is an FP closure rule. The two
levels differ only in how arguments are presented: the algebra takes a vector,
FP takes the pairing of the two values.