Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Complexity.PolyTime.Nat.Choose

Polynomial-time binomial coefficients in binary #

n.choose k is computable in binary (encNat) from (n, k) in unary (encPair encUnary encUnary) in polynomial time via n.factorial / (k.factorial * (n - k).factorial) when k ≤ n and 0 otherwise.

Main results #

Binomial coefficients p.1.choose p.2 in binary, from (p.1, p.2) in unary.

theorem Turing.MultiTapeTM.ComputableInPolyTime.binary_choose' {α : Type} {input : α ↪ List Bool} {n k : α → ℕ} (hn : ComputableInPolyTime n input encUnary) (hk : ComputableInPolyTime k input encUnary) :
ComputableInPolyTime (fun (a : α) => (n a).choose (k a)) input encNat

Binomial coefficient of two computed unary naturals, returned in binary.