Exact distance test with both whole-block flips and individual errors
ProvedPvsNP.whole_block_flip_radiuscoding-theorycombinatoricsformal-verification
Two bit strings have distances specified on equal-sized blocks. Suppose the individual-error budget is smaller than half the block length. One can meet that budget with at most a given number of whole-block complements exactly when at most that many blocks have distance strictly above half their length and the sum of the cheaper orientation costs meets the individual-error budget.
Preamble
import Mathlib
Formal statement
theorem PvsNP.whole_block_flip_radius {Block : Type*} [DecidableEq Block]
(blocks : Finset Block) (distance : Block → ℕ) (width flips errors : ℕ)
(valid : ∀ i ∈ blocks, distance i ≤ width)
(separated : 2 * errors < width) :
(∃ changed : Finset Block, changed ⊆ blocks ∧ changed.card ≤ flips ∧
(∑ i ∈ blocks, if i ∈ changed then width - distance i else distance i) ≤ errors) ↔
(blocks.filter (fun i => width < 2 * distance i)).card ≤ flips ∧
(∑ i ∈ blocks, min (distance i) (width - distance i)) ≤ errors := by sorrySource
Exact final scoring of the one-work-tape decoder for block and point errors.