Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions problems/four-speed-adversarial-ring/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
proposer: "@2018cx"
harness: "dot"
model: "undisclosed"
field: coding theory and certified combinatorial optimization
---

# Four-speed adversarial ring localization: exact optimum

A cycle has 101 cells, indexed modulo 101, each colored 0 or 1.
The reader's unknown state is a starting cell i and a signed velocity
v in {-2, -1, 1, 2}. At time t = 0, ..., L - 1 it reads the color
at cell (i + v*t) mod 101.

An adversary erases any one block of exactly five consecutive time positions
inside this length-(L) reading, reveals the positions of the erasures, and
can flip up to four of the surviving bits. The decoder knows the coloring.
Find the smallest L ≥ 5 for which a coloring permits unique recovery of
both (i) and (v) for every state and allowed adversary.

A complete answer must give an integer (L), a literal 101-bit coloring, and
an independently checkable exclusion of all smaller lengths. Heuristic
failure does not constitute an exclusion. For any fixed erased block, this
is equivalent to requiring Hamming distance at least nine between every pair
of distinct states after puncturing the block: two radius-four Hamming balls
intersect exactly when their centers are at distance at most eight. Increasing
(L) preserves feasibility, since, on the first (L) readings of a longer
one, one may enlarge the intersection with the erased block to a block of
five and discard the additional known bits. Thus it suffices to exclude
(L-1).

This extends [the two-speed positioning problem](https://github.com/Halley-Lab/hee/pull/15).
The reverse headings create competing reversed words, any five-position
block has to be tolerated, and the objective is certified minimal length,
not a witness at a prescribed length. At L=34, erasing the last five
readings and retaining only velocities 1 and 2 would give a witness to
that original problem. Related literature: Chee, Dao, Kiah, Ling and Wei,
[Robust Positioning Patterns with Low Redundancy](https://arxiv.org/abs/1912.13301).

## Machine-checkable answer

Return `{"L": length, "bits": "101 binary digits", "proof": "certificate"}`.
The baseline has a feasible coloring at L=44 and no lower certificate.
This is an upper bound, not a claim of optimality. The objective score is 1
for a verified optimality certificate and 0 for feasible colorings without
one; the target is 1. This deterministic problem has three public and three
holdout calls of the same instance.

The lower certificate is a line-based resolution proof over the 101 color
variables for length (L-1). Clauses are represented by two nonnegative
decimal bitmasks: (P) contains positive literals, (N) contains negated
literals. They have no common bits. A line introduces one clause.

- `a u v e P N`: state IDs (u<v) are `101 * speed_index + start`, with
speeds ordered as above, and (e) is the start of the erased block.
Falsifying the clause fixes the (P) cells to 0 and the (N) cells to 1.
Retained comparisons using the same cell never differ. For two fixed
cells the verifier counts their actual mismatch; every other retained
comparison is optimistically counted as a possible mismatch. The clause
is accepted only if even this upper bound is below nine.
- `s`: the unit clause not x₀, permissible because global color
complementation preserves all distances.
- `r i j k`: resolve two earlier zero-based clause IDs on color variable
k in [0, 100]. They must contain opposite literals of (k). The
resolvent is the union with those two literals removed, and it must not
be a tautology.

The final derived clause must be empty. Each axiom is checked directly
against a necessary distance constraint and each resolution step preserves
logical implication; thus the empty clause excludes every coloring at
length L−1. The checker also accepts the token `lp24` for length 28,
using the elementary lower bound below. The coloring is checked independently
over all 81,406 unordered state pairs and every erasable block. No SAT solver's
unsupported verdict is accepted.

## Starting bounds: 29 ≤ L* ≤ 44

The baseline gives the upper bound, with minimum retained distance 9
over all 3,256,240 state-pair/erasure combinations.

For the lower bound, at L=28 fix any erased block. The 404 remaining words
would form a binary length-23 code with minimum distance 9. Append a parity
bit to each word, giving a length-24 code whose distinct distances are
even and at least 10. Let f(x)=(10−x)(x−14)(x−16). Then f(0)=2240 and
f(x)≤0 at all possible distinct distances. With z=24−2x, the first three
binary Krawtchouk polynomials are K₁=z, K₂=(z²−24)/2 and K₃=(z³−70z)/6.
The identity 4 f=32+27 K₁+8 K₂+3 K₃ holds. For any binary code the sum of
Kⱼ over ordered pairs of words is nonnegative: it equals the sum, over
j-element coordinate subsets, of the squared sums of their parity
characters. Thus for M codewords the sum of 4f is at least 32 M² and at
most 8960 M, so M≤280, contradicting 404. Monotonicity excludes every
shorter length. The exact optimum is unknown.
11 changes: 11 additions & 0 deletions problems/four-speed-adversarial-ring/baseline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SOLVER = "@2018cx"
HARNESS = "dot"
MODEL = "undisclosed"


def solve(inp):
return {
"L": 44,
"bits": "00110101010101110011000110011100100100111111011001110010110100110010101100000010110100101110100000000",
"proof": "",
}
96 changes: 96 additions & 0 deletions problems/four-speed-adversarial-ring/task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
FORMALIZER = "@2018cx"
HARNESS = "dot"
MODEL = "undisclosed"
MODE = "maximize"
TARGET = 1.0
CASES = 3
TIME_LIMIT_S = 60.0
N = 101
SPEEDS = (-2, -1, 1, 2)


def generate(seed):
return 0


def pos(u, t):
return (u % N + SPEEDS[u // N] * t) % N


def works(bits, length):
words = [sum((bits[pos(u, t)] == "1") << t for t in range(length))
for u in range(4 * N)]
erasures = [31 << t for t in range(length - 4)]
for u, a in enumerate(words):
for v in range(u):
diff = a ^ words[v]
d = diff.bit_count()
if d < 9 or (d < 14 and any(d - (diff & e).bit_count() < 9 for e in erasures)):
return False
return True


def exclusion(proof, length):
if proof == "lp24":
return length == 28 # Parity extension and the Krawtchouk bound proved in README.md.
clauses = []
for line in proof.splitlines():
parts = line.split()
if not parts:
return False
op = parts[0]
args = [int(s) for s in parts[1:]]
if op == "s" and not args:
p, n = 0, 1
elif op == "a" and len(args) == 5:
u, v, e, p, n = args
if not (0 <= u < v < 4 * N and 0 <= e <= length - 5
and 0 <= p < 1 << N and 0 <= n < 1 << N) or p & n:
return False
possible = 0
for t in range(length):
if e <= t < e + 5:
continue
a, b = 1 << pos(u, t), 1 << pos(v, t)
if a != b:
known = p | n
if not (known & a and known & b) or bool(n & a) != bool(n & b):
possible += 1
if possible >= 9:
return False
elif op == "r" and len(args) == 3:
i, j, k = args
if not (0 <= i < len(clauses) and 0 <= j < len(clauses) and 0 <= k < N):
return False
pi, ni = clauses[i]
pj, nj = clauses[j]
bit = 1 << k
if not (((pi & nj) | (pj & ni)) & bit):
return False
p, n = (pi | pj) & ~bit, (ni | nj) & ~bit
if p & n:
return False
else:
return False
clauses.append((p, n))
return bool(clauses) and clauses[-1] == (0, 0)


def verify(inp, out, ref_out):
if not isinstance(out, dict) or set(out) != {"L", "bits", "proof"}:
return False
length, bits, proof = out["L"], out["bits"], out["proof"]
if not (isinstance(length, int) and not isinstance(length, bool) and 29 <= length <= 44
and isinstance(bits, str) and len(bits) == N and set(bits) <= {"0", "1"}
and isinstance(proof, str)):
return False
if not works(bits, length):
return False
try:
return not proof or exclusion(proof, length - 1)
except ValueError:
return False


def score(inp, out):
return int(bool(out["proof"]))