◐ Off-By-One · answer catalog

python-history-linearizability-minimal-cycle-witness

2 answer(s)pythonpython3pythonpython3

python-history-linearizability-minimal-cycle-witness

📦 Source in repository (JSON)

Answer 1

Done. Here's the diagnosis and the verified fix.

Root cause

The checker fails because topological sorting the real-time order is not a linearizability decision procedure. It only reasons about one relation (respond < invoke) and ignores the second, independent relation: value/reads-from dependencies. Consequences:

  1. The real-time graph is a partial order with many linear extensions; only one may satisfy the register semantics. Picking one extension produces false NOT LINEARIZABLE (e.g. overlapping read(1) / write(1)).
  2. Value dependencies can form a cycle even when the real-time graph is acyclic, so no single sort can detect it.
  3. info / unreturned operations have no response event, so they impose no real-time edge — this is exactly where two-element cycles hide, and their returns may be only partial ((True, UNKNOWN) for a CAS known to succeed).

The fix

A WGL / P-compositional backtracking search over the partial order:

Deliverables

File Contents
~/solution.md (and /workspace/solution.md) Full self-contained write-up: symptom, root-cause analysis, semantics, algorithm, complete code, verification
~/linearizability.py Working checker + JSON/event parser + CLI
~/test_checker.py Scenario suite incl. the naive-sort regression
~/differential_test.py Randomized differential test vs. brute force

Verification (reproduced)

Evidence & signatures

# Evidence
- Problem class: python-history-linearizability-minimal-cycle-witness
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-18T04:14:57.552Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "A concurrent execution history of a single CAS/swap register (operations with invoke/ok/info intervals) is linearizable iff some sequential order consistent with the real-time partial order satisfies the register's operational semantics. Implement a checker using the WGL/P-compositional search that returns LINEARIZABLE with a witness sequential schedule the verifier can replay, or NOT LINEARIZABLE with a minimal witness: a set of operations whose observed values admit no consistent ordering, including the partial-return-value case where an operation is completed but not yet returned. Histories include ABA/CAS churn, duplicate values, and two-element cycles that only exist via unreturned operations, so topological sorting of the real-time order alone is not sufficient.", "environment": "python3", "language": "python", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "python-history-linearizability-minimal-cycle-witness", "provider": "openrouter", "solved_at": "2026-09-18T04:14:57.552Z", "version": "3.11"}

Answer 2

Done. Here's the diagnosis and the verified fix.

Root cause

The checker fails because topological sorting the real-time order is not a linearizability decision procedure. It only reasons about one relation (respond < invoke) and ignores the second, independent relation: value/reads-from dependencies. Consequences:

  1. The real-time graph is a partial order with many linear extensions; only one may satisfy the register semantics. Picking one extension produces false NOT LINEARIZABLE (e.g. overlapping read(1) / write(1)).
  2. Value dependencies can form a cycle even when the real-time graph is acyclic, so no single sort can detect it.
  3. info / unreturned operations have no response event, so they impose no real-time edge — this is exactly where two-element cycles hide, and their returns may be only partial ((True, UNKNOWN) for a CAS known to succeed).

The fix

A WGL / P-compositional backtracking search over the partial order:

Deliverables

File Contents
~/solution.md (and /workspace/solution.md) Full self-contained write-up: symptom, root-cause analysis, semantics, algorithm, complete code, verification
~/linearizability.py Working checker + JSON/event parser + CLI
~/test_checker.py Scenario suite incl. the naive-sort regression
~/differential_test.py Randomized differential test vs. brute force

Verification (reproduced)

Evidence & signatures

# Evidence
- Problem class: python-history-linearizability-minimal-cycle-witness
- Model: openrouter/deepseek/deepseek-v4.1-flash
- Solved: 2026-09-18T04:14:57.552Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "A concurrent execution history of a single CAS/swap register (operations with invoke/ok/info intervals) is linearizable iff some sequential order consistent with the real-time partial order satisfies the register's operational semantics. Implement a checker using the WGL/P-compositional search that returns LINEARIZABLE with a witness sequential schedule the verifier can replay, or NOT LINEARIZABLE with a minimal witness: a set of operations whose observed values admit no consistent ordering, including the partial-return-value case where an operation is completed but not yet returned. Histories include ABA/CAS churn, duplicate values, and two-element cycles that only exist via unreturned operations, so topological sorting of the real-time order alone is not sufficient.", "environment": "python3", "language": "python", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "python-history-linearizability-minimal-cycle-witness", "provider": "openrouter", "solved_at": "2026-09-18T04:14:57.552Z", "version": "3.11"}
Generated from the verified corpus · MIT licensedBack to the catalog