Polynomial-time arithmetic on unary counters #
Arithmetic on encUnary, built from Christian Reitwiessner's encodings and machine calculus.
Addition concatenates the unary words; multiplication folds addition while keeping a quadratic
bound on the accumulator. Fixed powers and fixed polynomials follow by composition. These
operations support polynomially bounded counters and list enumeration in reductions.
Main results #
Turing.MultiTapeTM.ComputableTidilyInPolyTime.indexed_polynomial_bound: a uniform polynomial bound over a polynomially bounded range of indices, without computing the selected index.Turing.MultiTapeTM.ComputableTidilyInPolyTime.unary_add,.unary_sub,.unary_mul: arithmetic on unary naturals.Turing.MultiTapeTM.ComputableTidilyInPolyTime.unary_min,.unary_max: the smaller and larger of two unary naturals.Turing.MultiTapeTM.ComputableTidilyInPolyTime.unary_le,.unary_lt,.unary_pair: comparisons and the natural-number pairing function.Turing.MultiTapeTM.ComputableTidilyInPolyTime.unary_le',.unary_lt': comparisons of computed operands with the intermediate unary encodings fixed for automation.Turing.MultiTapeTM.ComputableTidilyInPolyTime.unary_pow,.unary_eval: evaluation of a fixed power or polynomial, with input and output in unary.Turing.MultiTapeTM.ComputableTidilyInPolyTime.unary_to_binary: conversion from unary to the binary encodingencNat.
References #
The indexed bound is adapted from Cslib/Computability/Probabilistic/Encoding.lean on the cslib
crypto branch at 5ff69ca93402e7c947208dc56396d6d86203ccd8.
Interpret one Boolean as a unary zero or one.
A unary-output polynomial-time function is polynomially bounded in its unary input.
Efficient unary values share a polynomial bound over a polynomially bounded range of indices. Selecting an index does not require a computable choice.
Compare computed unary values, fixing their intermediate encodings before proof search.
Strictly compare computed unary values, with both operand encodings fixed.
Equality of computed unary counters, fixing the intermediate encoding for proof search.
A fixed power of a unary natural.
Evaluate a fixed polynomial on unary naturals, with its result also in unary.
Convert a unary natural to its binary encoding by incrementing a binary counter.
Plain polynomial-time automation #
Evaluate a fixed polynomial on unary naturals, with its result also in unary.
Add two computed unary naturals with the same full input context.
Subtract two computed unary naturals with the same full input context.
Multiply two computed unary naturals with the same full input context.
A fixed power of a unary natural.