Polynomial-time logarithms and bounded powers #
The base-two logarithm is the binary representation's length minus one, with truncated subtraction handling zero. Unary input first uses the certified unary-to-binary conversion. Other fixed bases use repeated division with a linear bound on the encoded state. Ceiling logarithms follow from floor logarithms; raising a fixed factor to a ceiling logarithm uses the existing polynomial bound on logarithmically many multiplications. These latter certificates charge unary counter lengths; the bounded-power rule also accepts any caller's encoding with a certified unary size function.
Main results #
Turing.MultiTapeTM.ComputableTidilyInPolyTime.binary_log_two: compute the logarithm of a binary natural, returning its unary value.Turing.MultiTapeTM.ComputableTidilyInPolyTime.unary_log_two: the unary-input version.Turing.MultiTapeTM.ComputableTidilyInPolyTime.unary_log_const,.unary_clog_const: floor and ceiling logarithms in any fixed base on unary counters.Turing.MultiTapeTM.ComputableTidilyInPolyTime.unary_pow_clog_const: a fixed factor raised to a fixed-base ceiling logarithm, with unary output and complete intermediate-size bounds.Turing.MultiTapeTM.ComputableInPolyTime.unary_pow_clog_const: the same bounded power for plain certificates.
References #
The base-two logarithm is polynomial-time on binary naturals, with its result in unary.
The base-two logarithm is polynomial-time with both input and output in unary.
Fixed-base logarithms are polynomial-time on unary counters, including bases zero and one. The division loop maintains the logarithm identity and a linear bound on its complete state.
Ceiling logarithms in any fixed base are polynomial-time on unary counters.
Given an efficient unary size function, a fixed factor raised to its fixed-base ceiling logarithm has a polynomial-time unary output in the caller's original encoding. The bound charges every intermediate power, including the initial one when the factor is zero.
Turing.MultiTapeTM.ComputableTidilyInPolyTime.binary_log_two for plain certificates.
Turing.MultiTapeTM.ComputableTidilyInPolyTime.unary_clog_const for plain certificates.
Turing.MultiTapeTM.ComputableTidilyInPolyTime.unary_pow_clog_const for plain certificates.