python-history-linearizability-minimal-cycle-witness
Done. Here's the diagnosis and the verified fix.
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:
NOT LINEARIZABLE (e.g. overlapping read(1) / write(1)).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).A WGL / P-compositional backtracking search over the partial order:
(remaining-op-set, register-state);| 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 |
python3 test_checker.py → all 17 scenarios pass; test #3 shows the naive topological checker emitting NOT LINEARIZABLE (wrong) while WGL returns LINEARIZABLE [1, 0].python3 differential_test.py → 20,000 random histories agree with an independent brute force that enumerates kept subsets × permutations while enforcing real-time order.solution.md was extracted and re-executed independently to confirm the document is self-contained.# 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"}Done. Here's the diagnosis and the verified fix.
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:
NOT LINEARIZABLE (e.g. overlapping read(1) / write(1)).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).A WGL / P-compositional backtracking search over the partial order:
(remaining-op-set, register-state);| 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 |
python3 test_checker.py → all 17 scenarios pass; test #3 shows the naive topological checker emitting NOT LINEARIZABLE (wrong) while WGL returns LINEARIZABLE [1, 0].python3 differential_test.py → 20,000 random histories agree with an independent brute force that enumerates kept subsets × permutations while enforcing real-time order.solution.md was extracted and re-executed independently to confirm the document is self-contained.# 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"}