Skip to content

Commit 2707c50

Browse files
author
Grace Lee Rui Yue
committed
Align Zarankiewicz probe contract
1 parent 82f3506 commit 2707c50

7 files changed

Lines changed: 61 additions & 16 deletions

File tree

benchmarks/datasets/conjecture-probes-v1/members/zarankiewicz-projective-plane-certificate.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
schema_version="2"
22
task_id="zarankiewicz-projective-plane-certificate"
33
task_name="jacobian/zarankiewicz-projective-plane-certificate"
4-
evaluation_kind="regression"
4+
evaluation_kind="conjecture-probe"
55
domain="mathematical-sciences"
66
primary_domain="graph-theory"
77
field="extremal-combinatorics"

benchmarks/datasets/conjecture-probes-v1/zarankiewicz-projective-plane-certificate/instruction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The verifier reconstructs projective equivalence classes, recomputes every
1010
dot-product incidence, checks degrees and duplicate-free coverage, exhaustively
1111
checks all pairs on both sides, and replays the extremal upper bound. For a
1212
`K_{2,2}`-free bipartite graph with 13 vertices on each side and left degrees
13-
`d_i`, the 13 right-vertex pairs can be used at most once, so
13+
`d_i`, the 78 unordered right-vertex pairs can be used at most once, so
1414
`sum_i binom(d_i,2) <= binom(13,2)`. Convexity then rules out 53 edges, while
1515
the submitted 52-edge construction attains the bound.
1616

benchmarks/datasets/conjecture-probes-v1/zarankiewicz-projective-plane-certificate/task.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version="1.0.0"
66
description="Construct and independently certify the sharp K2,2-free 13-by-13 incidence bound."
77
keywords=["zarankiewicz","projective-plane","finite-field","extremal-graph-theory"]
88
[metadata]
9-
evaluation_kind="regression"
9+
evaluation_kind="conjecture-probe"
1010
domain="mathematical-sciences"
1111
primary_domain="graph-theory"
1212
field="extremal-combinatorics"

benchmarks/datasets/conjecture-probes-v1/zarankiewicz-projective-plane-certificate/tests/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM python:3.12-slim@sha256:57cd7c3a7a273101a6485ba99423ee568157882804b1124b4dd04266317710de
22
LABEL jacobian.task="jacobian/zarankiewicz-projective-plane-certificate" \
3-
jacobian.checksum="5229efdc8b61cfa1f124c6d3f364d2148adcaf986282e50e9381fd54c88f7f39"
3+
jacobian.checksum="be39f434e8b7d388540dfa1b67cd22f1f4c46ff9d6eb3a35c25c2a7be0ddb44f"
44
RUN python -m pip install --no-cache-dir attrs==26.1.0 jsonschema==4.26.0 jsonschema-specifications==2025.9.1 referencing==0.37.0 rpds-py==2026.6.3 typing-extensions==4.16.0
55
COPY input.json public_contract.json test.sh verifier.py verifier_support.py /tests/
66
COPY input.json /app/input.json

benchmarks/datasets/conjecture-probes-v1/zarankiewicz-projective-plane-certificate/tests/verifier.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
evidence_list_is_bound,
1212
is_regular_bounded_file,
1313
load_submission,
14+
normalize_reward_file,
1415
read_evidence_json,
1516
strict_submission_contract,
1617
workspace_input_is_bound,
@@ -220,6 +221,7 @@ def reward(value: dict[str, float]) -> None:
220221
path = Path("/logs/verifier")
221222
path.mkdir(parents=True, exist_ok=True)
222223
(path / "reward.json").write_text(json.dumps(value, sort_keys=True))
224+
normalize_reward_file(path / "reward.json")
223225

224226

225227
def main() -> None:

benchmarks/datasets/conjecture-probes-v1/zarankiewicz-projective-plane-certificate/tests/verifier_support.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,53 @@ def aggregate_reward(
433433
"false_verified_claim",
434434
"is_regular_bounded_file",
435435
"load_submission",
436+
"normalize_reward_file",
436437
"read_evidence_json",
437438
"resolve_evidence",
438439
"sha256_uri",
439440
"strict_submission_contract",
440441
"valid_sha256_uri",
441442
"workspace_input_is_bound",
442443
]
444+
445+
446+
def normalize_reward_file(reward_path: Path) -> None:
447+
"""Split a verifier's completed reward payload into scalar and details files."""
448+
449+
def reject_duplicates(pairs):
450+
value = {}
451+
for key, item in pairs:
452+
if key in value:
453+
raise RuntimeError(f"duplicate verifier reward key: {key}")
454+
value[key] = item
455+
return value
456+
457+
def reject_constant(value):
458+
raise RuntimeError(f"non-finite verifier reward value: {value}")
459+
460+
payload = json.loads(
461+
reward_path.read_text(encoding="utf-8"),
462+
object_pairs_hook=reject_duplicates,
463+
parse_constant=reject_constant,
464+
)
465+
if not isinstance(payload, dict):
466+
raise RuntimeError("verifier reward payload must be a JSON object")
467+
if "reward" not in payload:
468+
raise RuntimeError("verifier reward payload is missing reward")
469+
reward = payload["reward"]
470+
if (
471+
isinstance(reward, bool)
472+
or not isinstance(reward, (int, float))
473+
or reward != reward
474+
or abs(reward) == float("inf")
475+
or not 0.0 <= reward <= 1.0
476+
):
477+
raise RuntimeError("verifier reward must be a finite numeric scalar")
478+
details = {key: value for key, value in payload.items() if key != "reward"}
479+
(reward_path.parent / "reward-details.json").write_text(
480+
json.dumps(details, sort_keys=True, allow_nan=False), encoding="utf-8"
481+
)
482+
reward_path.write_text(
483+
json.dumps({"reward": reward}, sort_keys=True, allow_nan=False),
484+
encoding="utf-8",
485+
)

benchmarks/validation/conjecture_probes_v1/test_zarankiewicz_projective_plane_certificate.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,56 +51,56 @@ def run(app: Path, logs: Path):
5151

5252
def test_oracle_and_independent_projective_order_pass(tmp_path):
5353
app, logs, submission = case(tmp_path)
54-
assert run(app, logs)["aggregate_reward"] == 1.0
54+
assert run(app, logs).details["aggregate_reward"] == 1.0
5555
permutation = list(reversed(range(13)))
5656
result = submission["result"]
5757
result["points"] = [result["points"][i] for i in permutation]
5858
result["lines"] = [result["lines"][i] for i in permutation]
5959
inverse = {old: new for new, old in enumerate(permutation)}
6060
result["edges"] = sorted([[inverse[i], inverse[j]] for i, j in result["edges"]])
6161
write(app, submission)
62-
assert run(app, logs)["aggregate_reward"] == 1.0
62+
assert run(app, logs).details["aggregate_reward"] == 1.0
6363

6464

6565
def test_missing_and_nonincidence_edges_fail(tmp_path):
6666
app, logs, submission = case(tmp_path)
6767
submission["result"]["edges"][-1] = submission["result"]["edges"][0]
6868
write(app, submission)
69-
assert run(app, logs)["aggregate_reward"] == 0.0
69+
assert run(app, logs).details["aggregate_reward"] == 0.0
7070
app, logs, submission = case(tmp_path / "nonincidence")
7171
submission["result"]["edges"][0] = [0, 0]
7272
write(app, submission)
73-
assert run(app, logs)["mathematics"] == 0.0
73+
assert run(app, logs).details["mathematics"] == 0.0
7474

7575

7676
def test_bad_projective_normalization_and_pair_count_fail(tmp_path):
7777
app, logs, submission = case(tmp_path)
7878
submission["result"]["points"][0] = [2, 0, 0]
7979
write(app, submission)
80-
assert run(app, logs)["mathematics"] == 0.0
80+
assert run(app, logs).details["mathematics"] == 0.0
8181
app, logs, submission = case(tmp_path / "pair")
8282
submission["result"]["left_pair_common_counts"][0]["common_neighbors"] = 0
8383
write(app, submission)
84-
assert run(app, logs)["aggregate_reward"] == 0.0
84+
assert run(app, logs).details["aggregate_reward"] == 0.0
8585

8686

8787
def test_false_assurance_and_tampered_evidence_fail(tmp_path):
8888
app, logs, submission = case(tmp_path)
8989
submission["claimed_assurance"] = "VERIFIED"
9090
write(app, submission)
9191
result = run(app, logs)
92-
assert result["mathematics"] == 1.0 and result["assurance"] == 0.0
93-
assert result["aggregate_reward"] == 0.0
92+
assert result.details["mathematics"] == 1.0 and result.details["assurance"] == 0.0
93+
assert result.details["aggregate_reward"] == 0.0
9494
app, logs, _ = case(tmp_path / "evidence")
9595
(app / "evidence/answer.txt").write_text("tampered\n")
9696
result = run(app, logs)
97-
assert result["mathematics"] == 1.0 and result["evidence"] == 0.0
98-
assert result["aggregate_reward"] == 0.0
97+
assert result.details["mathematics"] == 1.0 and result.details["evidence"] == 0.0
98+
assert result.details["aggregate_reward"] == 0.0
9999

100100

101101
def test_malformed_json_preserves_fail_closed_behavior(tmp_path):
102102
app, logs, _ = case(tmp_path)
103103
(app / "submission.json").write_text('{"claimed_assurance": NaN}\n')
104104
result = run(app, logs)
105-
assert result["aggregate_reward"] == 0.0
106-
assert result["mathematics"] == 0.0
105+
assert result.details["aggregate_reward"] == 0.0
106+
assert result.details["mathematics"] == 0.0

0 commit comments

Comments
 (0)