Guarded binomial parity from a truncated clock
ProvedPvsNP.ClockTruncation.guarded_binomial_paritycomplexity-theory
Let be natural numbers with . Consider the parity of , with value zero when . This value is determined by and the flag . When the flag is set or , the result is one exactly when the bitwise intersection of and is zero. In the other cases the result is zero.
Preamble
import Mathlib.Data.Nat.Choose.Lucas
Formal statement
theorem PvsNP.ClockTruncation.guarded_binomial_parity {w t d q : ℕ} (hd : d < 2^w) (hq : q < 2^w) :
(if d ≤ t then (t-d+q).choose (t-d)%2 else 0) =
if 2^w ≤ t ∨ d ≤ t % 2^w then
(if (((t%2^w+2^w-d)%2^w) &&& q) = 0 then 1 else 0)
else 0 := by sorrySource
Clock-truncation corollary of Édouard Lucas, Théorie des Fonctions Numériques Simplement Périodiques (1878), https://www.jstor.org/stable/2369308.