menik1126 commited on
Commit
4e980d6
·
1 Parent(s): f7129ca

Add certified exact [[254,14,16]] Stage 5 evidence

Browse files
STAGE5_CERTIFIED_EXACT_FOM_GE_13.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Certified `[[254,14,16]]` quantum code
2
+
3
+ This dataset now includes a standalone certified Stage 5 lane for one
4
+ twisted-torus CSS-BB quantum code:
5
+
6
+ ```text
7
+ [[254,14,16]]
8
+ FOM = 14 * 16^2 / 254 = 1792/127 ~= 14.11023622047244
9
+ ```
10
+
11
+ The Stage 4 certificate, independent certificate-bound DistQLDPC replay,
12
+ Stage 5 final gate, known-answer gate, admissibility checks, and novelty replay
13
+ all passed. The public candidate ID is `503600e431e223bb2efe`.
14
+
15
+ Start with [`docs/STAGE5_CERTIFIED_EXACT_FOM_GE_13.md`](docs/STAGE5_CERTIFIED_EXACT_FOM_GE_13.md).
16
+ The machine-readable row is in
17
+ [`data/stage5_certified_exact_fom_ge_13.jsonl`](data/stage5_certified_exact_fom_ge_13.jsonl).
18
+
19
+ After materializing Git LFS objects, verify the complete dataset plus this
20
+ new certified lane with:
21
+
22
+ ```bash
23
+ git lfs pull --include='matrices/**'
24
+ sha256sum -c manifests/STAGE5_SHA256SUMS
25
+ python -B scripts/verify_dataset_stage5.py .
26
+ ```
27
+
28
+ The public verifier is solver-free. It checks the portable matrix algebra and
29
+ upper witness and validates the sanitized cryptographic bindings to both exact
30
+ DistQLDPC runs. No portable DRAT/LRAT lower-bound proof is claimed.
data/stage5_certified_exact_fom_ge_13.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"admissibility":{"binding_sha256":"c8b9f4d817ab9e88ec2f396f03a2b0bc163d0761656f7374c7f5880e3402bdb5","matrix_authority":"fresh-rebuild-from-construction","matrix_scope":["H_X","H_Z"],"maximum":6,"mode":"css-stabilizer-check-row-weight-at-most-6-v1","row_reduction_allowed":false,"schema_version":1},"authority":{"exact_under_pinned_solver_trust_model":true,"generic_pipeline_registration":false,"independent_release_gate_complete":true,"pipeline_promotion":false,"pipeline_stage4_certificate":true,"pipeline_stage5_final_gate":true,"portable_unsat_proof_certificate":false,"public_dataset_record":true,"publication_certificate":true,"stage3_typed_handoff_replay":true,"standalone_typed_release":true},"candidate_id":"503600e431e223bb2efe","canonical_digest":"1371fca099ef89ec013bc597207ef11af18b57eb34b2ad6480b7fa3801a750c6","code":"[[254,14,16]]","construction":{"A_terms":[[0,0],[0,22],[0,96]],"B_terms":[[0,1],[0,14],[0,121]],"ell":1,"family":"css-bb","geometry":{"family":"twisted_torus","schema_version":1,"twist":25},"m":127,"representation_id":"css-bb-twisted-torus-generator-v1"},"distance":{"exact":16,"lower_bound":16,"lower_bound_backend":"DistQLDPC/MaxCDCL","status":"EXACT_PROVEN","upper_bound":16,"upper_bound_backend":"python-sat/cadical195"},"evidence_class":"CERTIFIED_EXACT_WIN","fom":{"exact":{"decimal":14.11023622047244,"denominator":127,"numerator":1792},"excess_over_12":{"decimal":2.110236220472441,"denominator":127,"numerator":268},"excess_over_13":{"decimal":1.110236220472441,"denominator":127,"numerator":141},"strict_integer_margin":536},"known_answer_context":{"artifact_sha256":"7adf6f4a93cb321fa0501cbb62723370cdbc3a85db7d9e2565cc086ea6a00687","integrity_physical_file_sha256":"944ced82bf1f7de269752c316c32541478bb7e8fa4462b44daf2b20b8037b629","passed":true,"release_replayed":true,"semantic_replay_sha256":"a0c103db0a9eb0113a5e2e8fdc9a11e0dd193d14080237c6e3d27cdcf6476502","trust_sha256":"1e67120095a358bbcb2166a6804479655dc3bdd8b36c4d12bc56f73d5e741140"},"matrices":{"gx":{"array_sha256":"d2b4720434b9b047343545328d823ed22e3c0df7a8d953ae8b6b328c9a26d1a3","bytes":2057,"content_sha256":"89ad8dd9a8af7dc1dfbfa40708aba1d792d2ec75c549b96133159bbad06bf649","file_sha256":"faa9dfd321e1663bcb5538e79878829293605aace895fa58d1ddfba24eedbf53","nnz":912,"path":"matrices/503600e431e223bb2efe/Gx.mtx.gz","shape":[14,254]},"gz":{"array_sha256":"07143f00071d48b2e8c0681b516db3d76bfeb9f0223c54a5d3732199a18b3870","bytes":1972,"content_sha256":"b02f1ba21af93d3c7b2c93397c834a74431f49786873c15e79662ef57ab50534","file_sha256":"16405b89007fcccef60268d473a7fa3dd73a0ff9079b0dd8bf704822ba9c7557","nnz":846,"path":"matrices/503600e431e223bb2efe/Gz.mtx.gz","shape":[14,254]},"hx":{"array_sha256":"5d7d4d7ded8703a43deda393a870136305628b8b8d7714de58f050ccee3f6b1c","bytes":2226,"content_sha256":"0d3ee06bc862d2ab61e893aaaeef3fde5b4bfc643251aaf806a1a32a7093eba8","file_sha256":"9563d6958e7ffc13c1f616192cce41cf148d97db73b41e2eaa6af1c203bfe64a","nnz":762,"path":"matrices/503600e431e223bb2efe/Hx.mtx.gz","shape":[127,254]},"hz":{"array_sha256":"a80232c74b59c4b5ee20163f9badca65c1a1a84bdfb12b8aab3a04c622e93613","bytes":2175,"content_sha256":"eddac2800fc08955c7805b0880438f1c0e047c79fc2f1365b89f8b34ff3d4883","file_sha256":"90471fbfcf70f0147dc799df79f7e34d0552cdb3b28fef4bf8290372bfb25ef3","nnz":762,"path":"matrices/503600e431e223bb2efe/Hz.mtx.gz","shape":[127,254]}},"matrix_checks":{"commutation_violations":0,"css_commutation":true,"k_recomputed":14,"logical_basis_complete":true,"logical_duality":true,"max_check_weight":6,"max_qubit_degree":6,"max_sector_qubit_degree":3,"rank_x":120,"rank_z":120,"tanner_components":1},"novelty":{"canonical_digest":"1371fca099ef89ec013bc597207ef11af18b57eb34b2ad6480b7fa3801a750c6","checked":true,"matched_entries":[],"novel":true,"registry_internal_sha256":"536c733d68d344ed9fef9992bbeb1000900174ad0c500ddb7004126ae5c98408","status":"COMPLETE"},"parameters":{"k":14,"n":254},"record_kind":"stage5_certified_exact_fom_ge_13","record_sha256":"7ff6cf746934b791a09ad527687fc18643a234cfaa8e56bc28e606bbdb8b42b6","release_status":"CERTIFIED_STAGE5_TYPED_DISTQLDPC","schema_version":1,"source":{"loaded_source_fingerprint_sha256":"a817f77ddd961e895e8694112dd399daed6dd12cf4aff572d1f5e1d7f06e10c8","qcode_commit":"be725d40c96b49fbd7baa62257fcc2556f3bcd2a","release_manifest_physical_file_sha256":"cd12992dfe5ece37987ec8b343603db9f69330796b55d8494dbad5b758f2f589","release_manifest_semantic_sha256":"5f81c636c6e84b79054691b7d0412c9ec08368c7c694ae62cb94b236440931d5","stage3_handoff_artifact_sha256":"3a3fdbd8bf576cc728868db56621333a799b3e676a9bd148f7c14dcc9295d505","stage3_handoff_claim_sha256":"8c0150034c88e627ef02803afd1f301bbd385e1df4868f8eb9fb19134d6c6dbd","stage3_internal_artifact_sha256":"0367e0d6a138937b32bfd16954f041092944abaefa812177c017b75cc5600a0a","stage3_physical_file_sha256":"dbc31816793c86a2dfd06e380461f06bc5481e817495e589c054789e71934b60","stage4_certificate_payload_sha256":"543ebf6dda568e407ba560879fe5a316fc57badf1b641e8f9d5b380abcf6033e","stage4_certificate_physical_file_sha256":"e7e262988f1ee1dd5f40627a5b5ec908d68f655806b40c8ff9f21c4c60767c3f","stage4_certificate_semantic_sha256":"e77fbf5bc32f174386f349fdf9e29a72910db50a2c71937168cec2adfc83c7f3","stage5_fresh_solver_evidence_sha256":"59c3dd3bdf849b1336f43f407ec8814d7597c5db1d2a7e720d4fc55c58b84d04","stage5_verification_payload_sha256":"9d0a0bd40b13b6fc99d5347fd48a6b18686c0ecb62c692872a30573c18ab2d06","stage5_verification_physical_file_sha256":"26b2daa907580a0d09412c4480f2b7c2a5ae6d99ad43702abf24df968af52c5d"},"source_stage":"stage5_typed_distqldpc_release","source_status":"EXACT_PROVEN","source_target":{"binding_sha256":"5bdc62da94468e4a14dd2f73ac0654e28af7dcffea3b0e23d5d85ad8dff1f066","left_hand_side":3584,"mode":"scalar-fom-13-inclusive-v1","passed":true,"required_distance":16,"right_hand_side":3302,"strict":false},"target":{"certified_win":true,"left_hand_side":3584,"mode":"strict-fom-gt-12-v1","passes_strict_target":true,"required_distance":15,"right_hand_side":3048,"strict_integer_margin":536,"strict_predicate":"k*d*d > 12*n"}}
docs/STAGE5_CERTIFIED_EXACT_FOM_GE_13.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stage 5 certified exact FOM>=13 result
2
+
3
+ ## Result
4
+
5
+ The `stage5_certified_exact_fom_ge_13` lane publishes one twisted-torus
6
+ CSS-BB quantum code:
7
+
8
+ ```text
9
+ [[n,k,d]] = [[254,14,16]]
10
+ FOM = k d^2 / n = 1792/127 ~= 14.11023622047244
11
+ dataset gate: 14 * 16^2 = 3584 > 12 * 254 = 3048
12
+ source gate: 14 * 16^2 = 3584 >= 13 * 254 = 3302
13
+ ```
14
+
15
+ The public candidate ID is `503600e431e223bb2efe`, derived from the
16
+ construction key. Its independently canonicalized Stage 3 digest is
17
+ `1371fca099ef89ec013bc597207ef11af18b57eb34b2ad6480b7fa3801a750c6`.
18
+
19
+ The construction uses `ell=1`, `m=127`, twisted-torus parameter `twist=25`,
20
+
21
+ ```text
22
+ A = 1 + y^22 + y^96
23
+ B = y + y^14 + y^121.
24
+ ```
25
+
26
+ The public bundle contains `Hx`, `Hz`, and the exact `Gx`, `Gz` logical
27
+ basis used by the DistQLDPC instance. The solver-free verifier reconstructs
28
+ the checks from the construction and verifies ranks `120/120`, `k=14`, CSS
29
+ commutation, logical-basis completeness and duality, Tanner connectivity,
30
+ row weight at most 6, sector degree 3, combined degree 6, and the weight-16
31
+ X-logical upper witness.
32
+
33
+ ## Certification chain
34
+
35
+ The lower and upper bounds meet at 16:
36
+
37
+ - a pinned DistQLDPC/MaxCDCL `mto` run completed with
38
+ `d_lb=d_ub=d=o=16`;
39
+ - Stage 3 produced and replayed an `EXACT_PROVEN` typed handoff;
40
+ - Stage 4 built a source-bound typed DistQLDPC certificate;
41
+ - Stage 5 independently reran DistQLDPC under a new certificate-bound
42
+ checkpoint identity and again obtained exact distance 16;
43
+ - the known-answer, structural, novelty, target, and final publication gates
44
+ all passed.
45
+
46
+ The public evidence file is a sanitized allowlist of scientific hashes and
47
+ outcomes. It deliberately excludes local paths, commands, process IDs,
48
+ prompts, raw logs, progress files, and runtime filesystem metadata.
49
+
50
+ ## Trust boundary
51
+
52
+ The matrices and the weight-16 upper witness are portable and independently
53
+ checked by the included standard-library verifier. The lower bound is exact
54
+ under the pinned DistQLDPC/MaxCDCL binary and runtime and was independently
55
+ rerun. DistQLDPC did not produce a portable DRAT/LRAT proof object, so the
56
+ dataset does not claim one.
57
+
58
+ This is a standalone typed release. The Stage 4 and Stage 5 checks passed,
59
+ but the specialized proof type is not registered in the generic pipeline
60
+ dispatcher; therefore `generic_pipeline_registration` and
61
+ `pipeline_promotion` remain false while `publication_certificate` is true.
62
+
63
+ ## Files and verification
64
+
65
+ - `data/stage5_certified_exact_fom_ge_13.jsonl`
66
+ - `evidence/stage5_certified_exact_proofs.jsonl`
67
+ - `evidence/stage5_certified_exact_matrix_index.jsonl`
68
+ - `matrices/503600e431e223bb2efe/{Hx,Hz,Gx,Gz}.mtx.gz`
69
+ - `manifests/stage5_certified_exact_fom_ge_13.json`
70
+
71
+ After materializing Git LFS objects, run:
72
+
73
+ ```bash
74
+ git lfs pull --include='matrices/**'
75
+ python -B scripts/verify_stage5_certified_exact_fom_ge_13.py .
76
+ ```
77
+
78
+ The verifier invokes no distance solver. It validates the released algebra,
79
+ witness, self-hashes, physical file hashes, and the two independent exact-run
80
+ bindings recorded by the certified chain.
evidence/stage5_certified_exact_matrix_index.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"candidate_id":"503600e431e223bb2efe","canonical_digest":"1371fca099ef89ec013bc597207ef11af18b57eb34b2ad6480b7fa3801a750c6","k":14,"matrices":{"gx":{"array_sha256":"d2b4720434b9b047343545328d823ed22e3c0df7a8d953ae8b6b328c9a26d1a3","bytes":2057,"content_sha256":"89ad8dd9a8af7dc1dfbfa40708aba1d792d2ec75c549b96133159bbad06bf649","file_sha256":"faa9dfd321e1663bcb5538e79878829293605aace895fa58d1ddfba24eedbf53","nnz":912,"path":"matrices/503600e431e223bb2efe/Gx.mtx.gz","shape":[14,254]},"gz":{"array_sha256":"07143f00071d48b2e8c0681b516db3d76bfeb9f0223c54a5d3732199a18b3870","bytes":1972,"content_sha256":"b02f1ba21af93d3c7b2c93397c834a74431f49786873c15e79662ef57ab50534","file_sha256":"16405b89007fcccef60268d473a7fa3dd73a0ff9079b0dd8bf704822ba9c7557","nnz":846,"path":"matrices/503600e431e223bb2efe/Gz.mtx.gz","shape":[14,254]},"hx":{"array_sha256":"5d7d4d7ded8703a43deda393a870136305628b8b8d7714de58f050ccee3f6b1c","bytes":2226,"content_sha256":"0d3ee06bc862d2ab61e893aaaeef3fde5b4bfc643251aaf806a1a32a7093eba8","file_sha256":"9563d6958e7ffc13c1f616192cce41cf148d97db73b41e2eaa6af1c203bfe64a","nnz":762,"path":"matrices/503600e431e223bb2efe/Hx.mtx.gz","shape":[127,254]},"hz":{"array_sha256":"a80232c74b59c4b5ee20163f9badca65c1a1a84bdfb12b8aab3a04c622e93613","bytes":2175,"content_sha256":"eddac2800fc08955c7805b0880438f1c0e047c79fc2f1365b89f8b34ff3d4883","file_sha256":"90471fbfcf70f0147dc799df79f7e34d0552cdb3b28fef4bf8290372bfb25ef3","nnz":762,"path":"matrices/503600e431e223bb2efe/Hz.mtx.gz","shape":[127,254]}},"n":254,"record_kind":"stage5_certified_exact_matrix_index","record_sha256":"e2ed09a7d99846561de4a35b6041347e59104e09f21ccc5ece887183914c7313","schema_version":1}
evidence/stage5_certified_exact_proofs.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"admissibility":{"matrix_sha256":{"H_X":"30dc7d62ec17810d85cd4aefef3a18d3034a5e07e8e293c8b8bba8f1c96d201a","H_Z":"c17ff5e7e5e4235dea79a042332e55a0cff5667459fcf927bff87d423a45fa2f"},"max_check_row_weight":6,"passed":true,"policy_binding_sha256":"c8b9f4d817ab9e88ec2f396f03a2b0bc163d0761656f7374c7f5880e3402bdb5","report_sha256":"ab68dceda43b5282d8b74fa4aaa7706a8b422070071bc8c9b54580f80a271c79"},"authority":{"exact_under_pinned_solver_trust_model":true,"generic_pipeline_registration":false,"independent_release_gate_complete":true,"pipeline_promotion":false,"pipeline_stage4_certificate":true,"pipeline_stage5_final_gate":true,"portable_unsat_proof_certificate":false,"public_dataset_record":true,"publication_certificate":true,"stage3_typed_handoff_replay":true,"standalone_typed_release":true},"candidate_id":"503600e431e223bb2efe","canonical_digest":"1371fca099ef89ec013bc597207ef11af18b57eb34b2ad6480b7fa3801a750c6","distance_claim":{"exact":16,"lower_bound":16,"status":"EXACT_PROVEN","upper_bound":16},"evidence_class":"CERTIFIED_EXACT_WIN","evidence_sha256":"52a7f4a62c28375645712db1c6a227c22544a25d01b6de90e9f5800ceae06716","known_answer":{"artifact_sha256":"7adf6f4a93cb321fa0501cbb62723370cdbc3a85db7d9e2565cc086ea6a00687","integrity_physical_file_sha256":"944ced82bf1f7de269752c316c32541478bb7e8fa4462b44daf2b20b8037b629","passed":true,"release_replayed":true,"semantic_replay_sha256":"a0c103db0a9eb0113a5e2e8fdc9a11e0dd193d14080237c6e3d27cdcf6476502","trust_sha256":"1e67120095a358bbcb2166a6804479655dc3bdd8b36c4d12bc56f73d5e741140"},"limitations":{"lower_bound_trust_model":"pinned-distqldpc-maxcdcl-runtime","portable_unsat_certificate":false,"solver_invoked_by_public_verifier":false},"lower_bound_evidence":{"backend":{"algorithm":"MaxCDCL","binary_sha256":"9e09c544d5151d872dc1037dcb1440509e27b8b485a7f9ea5a15d6e55b36d3fa","distribution":"DistQLDPC","interface":"distqldpc-cli","source_commit":"c01fa93eb5e1e62948e4861e2c164a6b64fe88eb"},"cardinality_mode":"mto","decision_complete":true,"distqldpc_decisions_total":1,"distqldpc_decisions_verified":1,"exact_distance":16,"logical_detector_sha256":"5771b8c9daaf5fe00acae6f00482c9f802bb020bf5ae70ebfd1234c1dccecd37","logical_partitions_total":1,"logical_partitions_verified":1,"lower_bound":16,"outcome":"exact","portable_unsat_proof_certificate":false,"retryable":false,"solver_instance_array_sha256":{"Gx":"d2b4720434b9b047343545328d823ed22e3c0df7a8d953ae8b6b328c9a26d1a3","Gz":"07143f00071d48b2e8c0681b516db3d76bfeb9f0223c54a5d3732199a18b3870","Hx":"5d7d4d7ded8703a43deda393a870136305628b8b8d7714de58f050ccee3f6b1c","Hz":"a80232c74b59c4b5ee20163f9badca65c1a1a84bdfb12b8aab3a04c622e93613"},"stage3_exact":{"checkpoint_identity_sha256":"a0436039ddc6e08ffd7e6da3e923404c4c4802aa9055c19c807205fcb2800932","decision_complete":true,"elapsed_s":21513.579824514687,"evidence_sha256":"c41dbaf43b49955a7cf77851fcc00388eaa41daf5620b7012af980c4f49f8fe5","exact_distance":16,"instance_binding_sha256":"7c6fbd48ca92b696590cea37e5fbfcbdf8bebc85e436e59ccc6e074129bbeafe","lower_bound":16,"outcome":"exact","stdout_sha256":"e64418fb577e5021b7ec7693f195ed93d6732572a22a1751514d4aa46fa85227","terminal_file_sha256":"d336055574bec4076e3abd6c37cd3b839c000f89a241631f47c8cf0fd9bc5022","threshold_infeasible":true,"upper_bound":16},"stage5_independent_rerun":{"checkpoint_identity_sha256":"3a22d9205a4280161ea68b6ecf03c065bfaa1b042401476d04a67e17bfe13013","decision_complete":true,"elapsed_s":19798.601512420923,"evidence_sha256":"59c3dd3bdf849b1336f43f407ec8814d7597c5db1d2a7e720d4fc55c58b84d04","exact_distance":16,"instance_binding_sha256":"696c0a34a10d6bf207a94e86be56049a5f7f26ca10f8e7c9361ebc14abca9254","lower_bound":16,"outcome":"exact","stdout_sha256":"e64418fb577e5021b7ec7693f195ed93d6732572a22a1751514d4aa46fa85227","upper_bound":16,"verification_physical_file_sha256":"26b2daa907580a0d09412c4480f2b7c2a5ae6d99ad43702abf24df968af52c5d","verified":true},"threshold_infeasible":true,"upper_bound":16},"novelty":{"canonical_digest":"1371fca099ef89ec013bc597207ef11af18b57eb34b2ad6480b7fa3801a750c6","checked":true,"matched_entries":[],"novel":true,"registry_internal_sha256":"536c733d68d344ed9fef9992bbeb1000900174ad0c500ddb7004126ae5c98408","status":"COMPLETE"},"record_kind":"stage5_certified_exact_fom_ge_13_evidence","release_status":"CERTIFIED_STAGE5_TYPED_DISTQLDPC","schema_version":1,"source_status":"EXACT_PROVEN","stage3_typed_handoff":{"backend":"distqldpc","completed_lower_decisions":1,"completed_lower_partitions":1,"distqldpc_exact_distances":[16],"expected_lower_decisions":1,"expected_lower_partitions":1,"handoff_artifact_sha256":"3a3fdbd8bf576cc728868db56621333a799b3e676a9bd148f7c14dcc9295d505","handoff_claim_sha256":"8c0150034c88e627ef02803afd1f301bbd385e1df4868f8eb9fb19134d6c6dbd","internal_artifact_sha256":"0367e0d6a138937b32bfd16954f041092944abaefa812177c017b75cc5600a0a","lower_bound_threshold":15,"physical_file_sha256":"dbc31816793c86a2dfd06e380461f06bc5481e817495e589c054789e71934b60","qcode_commit":"be725d40c96b49fbd7baa62257fcc2556f3bcd2a","required_distance":16,"status":"EXACT_PROVEN","typed_replay_verified":true},"stage4_certificate":{"certificate_payload_sha256":"543ebf6dda568e407ba560879fe5a316fc57badf1b641e8f9d5b380abcf6033e","certificate_physical_file_sha256":"e7e262988f1ee1dd5f40627a5b5ec908d68f655806b40c8ff9f21c4c60767c3f","certificate_semantic_sha256":"e77fbf5bc32f174386f349fdf9e29a72910db50a2c71937168cec2adfc83c7f3","certificate_type":"qldpc-css-bb-sector-distqldpc-exact","exact_distance":16,"passed":true,"source_stage3_artifact_sha256":"3a3fdbd8bf576cc728868db56621333a799b3e676a9bd148f7c14dcc9295d505","source_stage3_checkpoint_identity_sha256":"a0436039ddc6e08ffd7e6da3e923404c4c4802aa9055c19c807205fcb2800932","target_binding_sha256":"5bdc62da94468e4a14dd2f73ac0654e28af7dcffea3b0e23d5d85ad8dff1f066"},"stage5_verification":{"distqldpc_decisions_total":1,"distqldpc_decisions_verified":1,"final_gate_accepted":true,"fom_target":true,"fresh_solver_evidence_sha256":"59c3dd3bdf849b1336f43f407ec8814d7597c5db1d2a7e720d4fc55c58b84d04","generic_pipeline_registration":false,"loaded_source_fingerprint_sha256":"a817f77ddd961e895e8694112dd399daed6dd12cf4aff572d1f5e1d7f06e10c8","logical_partitions_total":1,"logical_partitions_verified":1,"novelty":true,"passed":true,"release_manifest_physical_file_sha256":"cd12992dfe5ece37987ec8b343603db9f69330796b55d8494dbad5b758f2f589","release_manifest_semantic_sha256":"5f81c636c6e84b79054691b7d0412c9ec08368c7c694ae62cb94b236440931d5","replay_complete":true,"standalone_typed_release":true,"typed_lower":true,"upper":true,"verification_payload_sha256":"9d0a0bd40b13b6fc99d5347fd48a6b18686c0ecb62c692872a30573c18ab2d06","verification_physical_file_sha256":"26b2daa907580a0d09412c4480f2b7c2a5ae6d99ad43702abf24df968af52c5d"},"symmetry":{"covered_sectors":["X","Z"],"orbit_representatives":[0,127],"orbit_sizes":[127,127],"translation_symmetry_sha256":"a306a31866a4607586679680f14249f2a4eb6fc1a715a9e65a91c711c8758466","translation_verified":true,"weight_preserving":true,"xz_sector_isometry_sha256":"40b86f90a7dcb9509e8314a587284142c87989e282dc1ce2402c8a77705199b7","xz_sector_isometry_verified":true},"upper_bound_evidence":{"anchor_indices":[0,127],"backend":{"distribution":"python-sat","solver":"cadical195","version":"1.9.dev7"},"cnf":{"cardinality_encoding":"kmtotalizer","cnf_sha256":"0134860ae58624e9a1e4490388cb3d74c41cdc0bbe5a125f83aca8014a5abdaa"},"decision_complete":true,"evidence_sha256":"6630a19b00daacf9a5e96a93eedea288a26d8ca964f2cd73005ebd57a74cd178","formulation":"css-global-logical-threshold-cnf-v1","instance_binding_sha256":"8b89c49257fceb13404e2de33abd651d58f27057f271d56f282e7723c88fc31d","logical_syndrome":[1,1,1,1,1,0,0,1,1,0,0,0,0,1],"objective":16,"operator":{"length":254,"packed_hex":"0100000000000000000000040240140800200000002000000410000006088400","sha256":"f3c15e976dbc838d3aeb351747544e6f6c3a9d1e18a24fedd8833a99ba4838b8","weight":16},"outcome":"sat","retryable":false,"sector":"X"}}
manifests/STAGE5_SHA256SUMS ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 9438276a3d6d3d69c43e20605c064fb13463abf99e3d9e463e02442faba073de STAGE5_CERTIFIED_EXACT_FOM_GE_13.md
2
+ 7aa8ec61be1f38190dc811c01a2f15620f76f9f0378e5d1731213dddba897515 data/stage5_certified_exact_fom_ge_13.jsonl
3
+ 9b1cde0c665552e8656fae681e23ee9727410be1296dfbda2647d2957fd135f2 docs/STAGE5_CERTIFIED_EXACT_FOM_GE_13.md
4
+ 1a61d51a774694c7c93f8524226b30b1258dc63c64c6489f6d0e777cf184f20a evidence/stage5_certified_exact_matrix_index.jsonl
5
+ 33823e8112bc52b86713119d4b20feccd176fd952ec318d7957f83e747845422 evidence/stage5_certified_exact_proofs.jsonl
6
+ bd80fd90333a23d6630de3ccaccede2c9d211dced99ac6ad8668609e72d24b5a manifests/stage5_certified_exact_fom_ge_13.json
7
+ faa9dfd321e1663bcb5538e79878829293605aace895fa58d1ddfba24eedbf53 matrices/503600e431e223bb2efe/Gx.mtx.gz
8
+ 16405b89007fcccef60268d473a7fa3dd73a0ff9079b0dd8bf704822ba9c7557 matrices/503600e431e223bb2efe/Gz.mtx.gz
9
+ 9563d6958e7ffc13c1f616192cce41cf148d97db73b41e2eaa6af1c203bfe64a matrices/503600e431e223bb2efe/Hx.mtx.gz
10
+ 90471fbfcf70f0147dc799df79f7e34d0552cdb3b28fef4bf8290372bfb25ef3 matrices/503600e431e223bb2efe/Hz.mtx.gz
11
+ 0b7c7401c341cc2b8a6c90ddbeb3d7e7c46ab329b8eb396f9634b7f70cd0cc0b scripts/build_stage5_certified_exact_fom_ge_13.py
12
+ b2c1c72407c74867823e5f96c684fa87e279cfe0b81d41d842a61fe3336e1473 scripts/verify_dataset_stage5.py
13
+ 2cf2785f85790bd919317eeacdfe0bc6a32bd28c9ae2c6093a25503dcf228efc scripts/verify_stage5_certified_exact_fom_ge_13.py
manifests/stage5_certified_exact_fom_ge_13.json ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "authority": {
3
+ "exact_under_pinned_solver_trust_model": true,
4
+ "generic_pipeline_registration": false,
5
+ "independent_release_gate_complete": true,
6
+ "pipeline_promotion": false,
7
+ "pipeline_stage4_certificate": true,
8
+ "pipeline_stage5_final_gate": true,
9
+ "portable_unsat_proof_certificate": false,
10
+ "public_dataset_record": true,
11
+ "publication_certificate": true,
12
+ "stage3_typed_handoff_replay": true,
13
+ "standalone_typed_release": true
14
+ },
15
+ "candidate": {
16
+ "candidate_id": "503600e431e223bb2efe",
17
+ "canonical_digest": "1371fca099ef89ec013bc597207ef11af18b57eb34b2ad6480b7fa3801a750c6",
18
+ "code": "[[254,14,16]]",
19
+ "exact_fom_denominator": 127,
20
+ "exact_fom_numerator": 1792
21
+ },
22
+ "certified_win": true,
23
+ "dataset_base_commit": "f7129caeab7fe78943e504dfc48e268e23ee13fe",
24
+ "files": [
25
+ {
26
+ "bytes": 6073,
27
+ "path": "data/stage5_certified_exact_fom_ge_13.jsonl",
28
+ "rows": 1,
29
+ "sha256": "7aa8ec61be1f38190dc811c01a2f15620f76f9f0378e5d1731213dddba897515"
30
+ },
31
+ {
32
+ "bytes": 7968,
33
+ "path": "evidence/stage5_certified_exact_proofs.jsonl",
34
+ "rows": 1,
35
+ "sha256": "33823e8112bc52b86713119d4b20feccd176fd952ec318d7957f83e747845422"
36
+ },
37
+ {
38
+ "bytes": 1682,
39
+ "path": "evidence/stage5_certified_exact_matrix_index.jsonl",
40
+ "rows": 1,
41
+ "sha256": "1a61d51a774694c7c93f8524226b30b1258dc63c64c6489f6d0e777cf184f20a"
42
+ },
43
+ {
44
+ "bytes": 35746,
45
+ "path": "scripts/verify_stage5_certified_exact_fom_ge_13.py",
46
+ "sha256": "2cf2785f85790bd919317eeacdfe0bc6a32bd28c9ae2c6093a25503dcf228efc"
47
+ },
48
+ {
49
+ "bytes": 2226,
50
+ "path": "matrices/503600e431e223bb2efe/Hx.mtx.gz",
51
+ "sha256": "9563d6958e7ffc13c1f616192cce41cf148d97db73b41e2eaa6af1c203bfe64a"
52
+ },
53
+ {
54
+ "bytes": 2175,
55
+ "path": "matrices/503600e431e223bb2efe/Hz.mtx.gz",
56
+ "sha256": "90471fbfcf70f0147dc799df79f7e34d0552cdb3b28fef4bf8290372bfb25ef3"
57
+ },
58
+ {
59
+ "bytes": 2057,
60
+ "path": "matrices/503600e431e223bb2efe/Gx.mtx.gz",
61
+ "sha256": "faa9dfd321e1663bcb5538e79878829293605aace895fa58d1ddfba24eedbf53"
62
+ },
63
+ {
64
+ "bytes": 1972,
65
+ "path": "matrices/503600e431e223bb2efe/Gz.mtx.gz",
66
+ "sha256": "16405b89007fcccef60268d473a7fa3dd73a0ff9079b0dd8bf704822ba9c7557"
67
+ }
68
+ ],
69
+ "gate": "qcode-public-stage5-certified-exact-fom-ge-13-v1",
70
+ "manifest_sha256": "4b7afc66d251e9c89b9aba2f0550073644f20fc938bcb1e23ed7b5aee339f545",
71
+ "publication_certificate": true,
72
+ "release_status": "CERTIFIED_STAGE5_TYPED_DISTQLDPC",
73
+ "schema_version": 1,
74
+ "source": {
75
+ "loaded_source_fingerprint_sha256": "a817f77ddd961e895e8694112dd399daed6dd12cf4aff572d1f5e1d7f06e10c8",
76
+ "qcode_commit": "be725d40c96b49fbd7baa62257fcc2556f3bcd2a",
77
+ "release_manifest_physical_file_sha256": "cd12992dfe5ece37987ec8b343603db9f69330796b55d8494dbad5b758f2f589",
78
+ "release_manifest_semantic_sha256": "5f81c636c6e84b79054691b7d0412c9ec08368c7c694ae62cb94b236440931d5",
79
+ "stage3_handoff_artifact_sha256": "3a3fdbd8bf576cc728868db56621333a799b3e676a9bd148f7c14dcc9295d505",
80
+ "stage3_handoff_claim_sha256": "8c0150034c88e627ef02803afd1f301bbd385e1df4868f8eb9fb19134d6c6dbd",
81
+ "stage3_internal_artifact_sha256": "0367e0d6a138937b32bfd16954f041092944abaefa812177c017b75cc5600a0a",
82
+ "stage3_physical_file_sha256": "dbc31816793c86a2dfd06e380461f06bc5481e817495e589c054789e71934b60",
83
+ "stage4_certificate_payload_sha256": "543ebf6dda568e407ba560879fe5a316fc57badf1b641e8f9d5b380abcf6033e",
84
+ "stage4_certificate_physical_file_sha256": "e7e262988f1ee1dd5f40627a5b5ec908d68f655806b40c8ff9f21c4c60767c3f",
85
+ "stage4_certificate_semantic_sha256": "e77fbf5bc32f174386f349fdf9e29a72910db50a2c71937168cec2adfc83c7f3",
86
+ "stage5_fresh_solver_evidence_sha256": "59c3dd3bdf849b1336f43f407ec8814d7597c5db1d2a7e720d4fc55c58b84d04",
87
+ "stage5_verification_payload_sha256": "9d0a0bd40b13b6fc99d5347fd48a6b18686c0ecb62c692872a30573c18ab2d06",
88
+ "stage5_verification_physical_file_sha256": "26b2daa907580a0d09412c4480f2b7c2a5ae6d99ad43702abf24df968af52c5d"
89
+ },
90
+ "source_status": "EXACT_PROVEN",
91
+ "status": "CERTIFIED_EXACT_WIN"
92
+ }
matrices/503600e431e223bb2efe/Gx.mtx.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:faa9dfd321e1663bcb5538e79878829293605aace895fa58d1ddfba24eedbf53
3
+ size 2057
matrices/503600e431e223bb2efe/Gz.mtx.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16405b89007fcccef60268d473a7fa3dd73a0ff9079b0dd8bf704822ba9c7557
3
+ size 1972
matrices/503600e431e223bb2efe/Hx.mtx.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9563d6958e7ffc13c1f616192cce41cf148d97db73b41e2eaa6af1c203bfe64a
3
+ size 2226
matrices/503600e431e223bb2efe/Hz.mtx.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90471fbfcf70f0147dc799df79f7e34d0552cdb3b28fef4bf8290372bfb25ef3
3
+ size 2175
scripts/build_stage5_certified_exact_fom_ge_13.py ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Rebuild the public matrix bundle for the certified [[254,14,16]] code."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import gzip
8
+ import hashlib
9
+ import io
10
+ import json
11
+ import subprocess
12
+ import sys
13
+ from pathlib import Path
14
+ from typing import Any
15
+
16
+ CANDIDATE_ID = "503600e431e223bb2efe"
17
+ CANONICAL_DIGEST = "1371fca099ef89ec013bc597207ef11af18b57eb34b2ad6480b7fa3801a750c6"
18
+ QCODE_COMMIT = "be725d40c96b49fbd7baa62257fcc2556f3bcd2a"
19
+ EXPECTED_ARRAY_SHA256 = {
20
+ "Hx": "5d7d4d7ded8703a43deda393a870136305628b8b8d7714de58f050ccee3f6b1c",
21
+ "Hz": "a80232c74b59c4b5ee20163f9badca65c1a1a84bdfb12b8aab3a04c622e93613",
22
+ "Gx": "d2b4720434b9b047343545328d823ed22e3c0df7a8d953ae8b6b328c9a26d1a3",
23
+ "Gz": "07143f00071d48b2e8c0681b516db3d76bfeb9f0223c54a5d3732199a18b3870",
24
+ }
25
+ EXPECTED_SHAPES = {
26
+ "Hx": [127, 254], "Hz": [127, 254], "Gx": [14, 254], "Gz": [14, 254]
27
+ }
28
+ CLAIM = {
29
+ "ell": 1,
30
+ "m": 127,
31
+ "A_terms": [[0, 0], [0, 22], [0, 96]],
32
+ "B_terms": [[0, 1], [0, 14], [0, 121]],
33
+ "geometry": {"family": "twisted_torus", "schema_version": 1, "twist": 25},
34
+ }
35
+
36
+
37
+ def sha256_bytes(payload: bytes) -> str:
38
+ return hashlib.sha256(payload).hexdigest()
39
+
40
+
41
+ def array_sha256(name: str, matrix: Any) -> str:
42
+ digest = hashlib.sha256()
43
+ digest.update(name.encode())
44
+ digest.update(b"\0")
45
+ digest.update(json.dumps(list(matrix.shape), separators=(",", ":")).encode())
46
+ digest.update(b"\0")
47
+ digest.update(matrix.tobytes(order="C"))
48
+ return digest.hexdigest()
49
+
50
+
51
+ def content_sha256(matrix: Any) -> str:
52
+ header = json.dumps(
53
+ {"dtype": "uint8-gf2", "shape": list(matrix.shape)},
54
+ sort_keys=True,
55
+ separators=(",", ":"),
56
+ )
57
+ return sha256_bytes(header.encode() + b"\n" + matrix.tobytes(order="C"))
58
+
59
+
60
+ def matrix_market_gzip(name: str, matrix: Any) -> bytes:
61
+ rows, columns = map(int, matrix.shape)
62
+ entries = [
63
+ f"{row + 1} {column + 1} 1\n"
64
+ for row in range(rows)
65
+ for column in range(columns)
66
+ if int(matrix[row, column]) & 1
67
+ ]
68
+ body = (
69
+ "%%MatrixMarket matrix coordinate integer general\n"
70
+ f"% qcode candidate {CANDIDATE_ID} {name}; entries are GF(2)\n"
71
+ f"{rows} {columns} {len(entries)}\n"
72
+ + "".join(entries)
73
+ ).encode("ascii")
74
+ output = io.BytesIO()
75
+ with gzip.GzipFile(filename="", mode="wb", fileobj=output, compresslevel=9, mtime=0) as handle:
76
+ handle.write(body)
77
+ return output.getvalue()
78
+
79
+
80
+ def source_commit(repo: Path) -> str:
81
+ process = subprocess.run(
82
+ ["git", "rev-parse", "HEAD"], cwd=repo, check=True,
83
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True,
84
+ )
85
+ return process.stdout.strip()
86
+
87
+
88
+ def build(qcode_repo: Path) -> dict[str, Any]:
89
+ qcode_repo = qcode_repo.resolve(strict=True)
90
+ if source_commit(qcode_repo) != QCODE_COMMIT:
91
+ raise ValueError("qcode repository is not pinned to the release commit")
92
+ sys.path.insert(0, str(qcode_repo))
93
+ from evaluation.distance_distqldpc import distqldpc_matrix_bundle
94
+ from evaluation.sector_certificate import _matrices
95
+
96
+ _, hx, hz, lx, lz = _matrices(CLAIM)
97
+ matrices = distqldpc_matrix_bundle(hx, hz, lx, lz)
98
+ for name, matrix in matrices.items():
99
+ if list(matrix.shape) != EXPECTED_SHAPES[name]:
100
+ raise ValueError(f"{name} shape mismatch")
101
+ if array_sha256(name, matrix) != EXPECTED_ARRAY_SHA256[name]:
102
+ raise ValueError(f"{name} sealed array hash mismatch")
103
+ return matrices
104
+
105
+
106
+ def main() -> None:
107
+ parser = argparse.ArgumentParser()
108
+ parser.add_argument("--qcode-repo", required=True, type=Path)
109
+ parser.add_argument("--output-root", type=Path, default=Path("."))
110
+ arguments = parser.parse_args()
111
+ matrices = build(arguments.qcode_repo)
112
+ output = arguments.output_root.resolve() / "matrices" / CANDIDATE_ID
113
+ output.mkdir(parents=True, exist_ok=True)
114
+ report: dict[str, Any] = {
115
+ "candidate_id": CANDIDATE_ID,
116
+ "canonical_digest": CANONICAL_DIGEST,
117
+ "qcode_commit": QCODE_COMMIT,
118
+ "matrices": {},
119
+ }
120
+ for name, matrix in matrices.items():
121
+ path = output / f"{name}.mtx.gz"
122
+ payload = matrix_market_gzip(name, matrix)
123
+ with path.open("xb") as handle:
124
+ handle.write(payload)
125
+ handle.flush()
126
+ report["matrices"][name.lower()] = {
127
+ "path": path.relative_to(arguments.output_root.resolve()).as_posix(),
128
+ "shape": list(matrix.shape),
129
+ "array_sha256": array_sha256(name, matrix),
130
+ "content_sha256": content_sha256(matrix),
131
+ "file_sha256": sha256_bytes(payload),
132
+ "bytes": len(payload),
133
+ }
134
+ print(json.dumps(report, sort_keys=True, indent=2))
135
+
136
+
137
+ if __name__ == "__main__":
138
+ main()
scripts/verify_dataset_stage5.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Verify the original dataset snapshot and the certified Stage 5 lane."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import sys
8
+ from pathlib import Path
9
+
10
+
11
+ def main(root: Path) -> None:
12
+ scripts = str(Path(__file__).resolve().parent)
13
+ if scripts not in sys.path:
14
+ sys.path.insert(0, scripts)
15
+ from verify_dataset import main as verify_original_dataset
16
+ from verify_stage5_certified_exact_fom_ge_13 import verify as verify_stage5
17
+
18
+ root = root.resolve()
19
+ verify_original_dataset(root)
20
+ verify_stage5(root)
21
+
22
+
23
+ if __name__ == "__main__":
24
+ parser = argparse.ArgumentParser()
25
+ parser.add_argument("root", type=Path, nargs="?", default=Path("."))
26
+ arguments = parser.parse_args()
27
+ main(arguments.root)
scripts/verify_stage5_certified_exact_fom_ge_13.py ADDED
@@ -0,0 +1,854 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Verify the public certified [[254,14,16]] typed DistQLDPC release.
3
+
4
+ This verifier is intentionally solver-free. It reconstructs the CSS check
5
+ matrices, verifies the four published matrices and complete logical basis,
6
+ replays the weight-16 logical witness, and checks the sanitized bindings to
7
+ two completed DistQLDPC exact-distance runs and the Stage 3/4/5 release chain.
8
+
9
+ The distance lower bound remains a result under the pinned
10
+ DistQLDPC/MaxCDCL binary and runtime trust model. No portable DRAT/LRAT-style
11
+ UNSAT certificate is claimed by this dataset lane.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import gzip
17
+ import hashlib
18
+ import json
19
+ import sys
20
+ from pathlib import Path, PurePosixPath
21
+ from typing import Any
22
+
23
+
24
+ CANDIDATE_ID = "503600e431e223bb2efe"
25
+ CONSTRUCTION_KEY_SHA256 = (
26
+ "503600e431e223bb2efe406df1f23ea6698d5451ed1ef6a176566cb828c8f29f"
27
+ )
28
+ CANONICAL_DIGEST = (
29
+ "1371fca099ef89ec013bc597207ef11af18b57eb34b2ad6480b7fa3801a750c6"
30
+ )
31
+ QCODE_COMMIT = "be725d40c96b49fbd7baa62257fcc2556f3bcd2a"
32
+ HF_BASE_COMMIT = "f7129caeab7fe78943e504dfc48e268e23ee13fe"
33
+
34
+ DISTQLDPC_BINARY_SHA256 = (
35
+ "9e09c544d5151d872dc1037dcb1440509e27b8b485a7f9ea5a15d6e55b36d3fa"
36
+ )
37
+ DISTQLDPC_SOURCE_COMMIT = "c01fa93eb5e1e62948e4861e2c164a6b64fe88eb"
38
+ LOGICAL_DETECTOR_SHA256 = (
39
+ "5771b8c9daaf5fe00acae6f00482c9f802bb020bf5ae70ebfd1234c1dccecd37"
40
+ )
41
+ TARGET_BINDING_SHA256 = (
42
+ "5bdc62da94468e4a14dd2f73ac0654e28af7dcffea3b0e23d5d85ad8dff1f066"
43
+ )
44
+ ADMISSIBILITY_BINDING_SHA256 = (
45
+ "c8b9f4d817ab9e88ec2f396f03a2b0bc163d0761656f7374c7f5880e3402bdb5"
46
+ )
47
+ ADMISSIBILITY_REPORT_SHA256 = (
48
+ "ab68dceda43b5282d8b74fa4aaa7706a8b422070071bc8c9b54580f80a271c79"
49
+ )
50
+ CERTIFICATE_MATRIX_SHA256 = {
51
+ "H_X": "30dc7d62ec17810d85cd4aefef3a18d3034a5e07e8e293c8b8bba8f1c96d201a",
52
+ "H_Z": "c17ff5e7e5e4235dea79a042332e55a0cff5667459fcf927bff87d423a45fa2f",
53
+ }
54
+
55
+ STAGE3_PHYSICAL_FILE_SHA256 = (
56
+ "dbc31816793c86a2dfd06e380461f06bc5481e817495e589c054789e71934b60"
57
+ )
58
+ STAGE3_INTERNAL_ARTIFACT_SHA256 = (
59
+ "0367e0d6a138937b32bfd16954f041092944abaefa812177c017b75cc5600a0a"
60
+ )
61
+ STAGE3_HANDOFF_ARTIFACT_SHA256 = (
62
+ "3a3fdbd8bf576cc728868db56621333a799b3e676a9bd148f7c14dcc9295d505"
63
+ )
64
+ STAGE3_HANDOFF_CLAIM_SHA256 = (
65
+ "8c0150034c88e627ef02803afd1f301bbd385e1df4868f8eb9fb19134d6c6dbd"
66
+ )
67
+ STAGE4_CERTIFICATE_SEMANTIC_SHA256 = (
68
+ "e77fbf5bc32f174386f349fdf9e29a72910db50a2c71937168cec2adfc83c7f3"
69
+ )
70
+ STAGE4_CERTIFICATE_PAYLOAD_SHA256 = (
71
+ "543ebf6dda568e407ba560879fe5a316fc57badf1b641e8f9d5b380abcf6033e"
72
+ )
73
+ STAGE4_CERTIFICATE_PHYSICAL_FILE_SHA256 = (
74
+ "e7e262988f1ee1dd5f40627a5b5ec908d68f655806b40c8ff9f21c4c60767c3f"
75
+ )
76
+ STAGE5_VERIFICATION_PAYLOAD_SHA256 = (
77
+ "9d0a0bd40b13b6fc99d5347fd48a6b18686c0ecb62c692872a30573c18ab2d06"
78
+ )
79
+ STAGE5_VERIFICATION_PHYSICAL_FILE_SHA256 = (
80
+ "26b2daa907580a0d09412c4480f2b7c2a5ae6d99ad43702abf24df968af52c5d"
81
+ )
82
+ RELEASE_MANIFEST_SEMANTIC_SHA256 = (
83
+ "5f81c636c6e84b79054691b7d0412c9ec08368c7c694ae62cb94b236440931d5"
84
+ )
85
+ RELEASE_MANIFEST_PHYSICAL_FILE_SHA256 = (
86
+ "cd12992dfe5ece37987ec8b343603db9f69330796b55d8494dbad5b758f2f589"
87
+ )
88
+ LOADED_SOURCE_FINGERPRINT_SHA256 = (
89
+ "a817f77ddd961e895e8694112dd399daed6dd12cf4aff572d1f5e1d7f06e10c8"
90
+ )
91
+
92
+ KNOWN_ANSWER_ARTIFACT_SHA256 = (
93
+ "7adf6f4a93cb321fa0501cbb62723370cdbc3a85db7d9e2565cc086ea6a00687"
94
+ )
95
+ KNOWN_ANSWER_TRUST_SHA256 = (
96
+ "1e67120095a358bbcb2166a6804479655dc3bdd8b36c4d12bc56f73d5e741140"
97
+ )
98
+ KNOWN_ANSWER_INTEGRITY_PHYSICAL_FILE_SHA256 = (
99
+ "944ced82bf1f7de269752c316c32541478bb7e8fa4462b44daf2b20b8037b629"
100
+ )
101
+ KNOWN_ANSWER_SEMANTIC_REPLAY_SHA256 = (
102
+ "a0c103db0a9eb0113a5e2e8fdc9a11e0dd193d14080237c6e3d27cdcf6476502"
103
+ )
104
+ NOVELTY_REGISTRY_INTERNAL_SHA256 = (
105
+ "536c733d68d344ed9fef9992bbeb1000900174ad0c500ddb7004126ae5c98408"
106
+ )
107
+
108
+ PRIMARY_EXACT_EVIDENCE_SHA256 = (
109
+ "c41dbaf43b49955a7cf77851fcc00388eaa41daf5620b7012af980c4f49f8fe5"
110
+ )
111
+ PRIMARY_EXACT_TERMINAL_FILE_SHA256 = (
112
+ "d336055574bec4076e3abd6c37cd3b839c000f89a241631f47c8cf0fd9bc5022"
113
+ )
114
+ PRIMARY_EXACT_INSTANCE_BINDING_SHA256 = (
115
+ "7c6fbd48ca92b696590cea37e5fbfcbdf8bebc85e436e59ccc6e074129bbeafe"
116
+ )
117
+ PRIMARY_EXACT_CHECKPOINT_IDENTITY_SHA256 = (
118
+ "a0436039ddc6e08ffd7e6da3e923404c4c4802aa9055c19c807205fcb2800932"
119
+ )
120
+ EXACT_STDOUT_SHA256 = (
121
+ "e64418fb577e5021b7ec7693f195ed93d6732572a22a1751514d4aa46fa85227"
122
+ )
123
+ INDEPENDENT_EXACT_EVIDENCE_SHA256 = (
124
+ "59c3dd3bdf849b1336f43f407ec8814d7597c5db1d2a7e720d4fc55c58b84d04"
125
+ )
126
+ INDEPENDENT_EXACT_INSTANCE_BINDING_SHA256 = (
127
+ "696c0a34a10d6bf207a94e86be56049a5f7f26ca10f8e7c9361ebc14abca9254"
128
+ )
129
+ INDEPENDENT_EXACT_CHECKPOINT_IDENTITY_SHA256 = (
130
+ "3a22d9205a4280161ea68b6ecf03c065bfaa1b042401476d04a67e17bfe13013"
131
+ )
132
+
133
+ UPPER_EVIDENCE_SHA256 = (
134
+ "6630a19b00daacf9a5e96a93eedea288a26d8ca964f2cd73005ebd57a74cd178"
135
+ )
136
+ UPPER_CNF_SHA256 = (
137
+ "0134860ae58624e9a1e4490388cb3d74c41cdc0bbe5a125f83aca8014a5abdaa"
138
+ )
139
+ UPPER_INSTANCE_BINDING_SHA256 = (
140
+ "8b89c49257fceb13404e2de33abd651d58f27057f271d56f282e7723c88fc31d"
141
+ )
142
+ UPPER_OPERATOR_SHA256 = (
143
+ "f3c15e976dbc838d3aeb351747544e6f6c3a9d1e18a24fedd8833a99ba4838b8"
144
+ )
145
+ UPPER_OPERATOR_PACKED_HEX = (
146
+ "0100000000000000000000040240140800200000002000000410000006088400"
147
+ )
148
+ UPPER_LOGICAL_SYNDROME = [1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1]
149
+
150
+ XZ_SECTOR_ISOMETRY_SHA256 = (
151
+ "40b86f90a7dcb9509e8314a587284142c87989e282dc1ce2402c8a77705199b7"
152
+ )
153
+
154
+ EXPECTED_MATRICES = {
155
+ "hx": {
156
+ "path": f"matrices/{CANDIDATE_ID}/Hx.mtx.gz",
157
+ "shape": [127, 254],
158
+ "nnz": 762,
159
+ "array_sha256": "5d7d4d7ded8703a43deda393a870136305628b8b8d7714de58f050ccee3f6b1c",
160
+ "content_sha256": "0d3ee06bc862d2ab61e893aaaeef3fde5b4bfc643251aaf806a1a32a7093eba8",
161
+ "file_sha256": "9563d6958e7ffc13c1f616192cce41cf148d97db73b41e2eaa6af1c203bfe64a",
162
+ "bytes": 2226,
163
+ },
164
+ "hz": {
165
+ "path": f"matrices/{CANDIDATE_ID}/Hz.mtx.gz",
166
+ "shape": [127, 254],
167
+ "nnz": 762,
168
+ "array_sha256": "a80232c74b59c4b5ee20163f9badca65c1a1a84bdfb12b8aab3a04c622e93613",
169
+ "content_sha256": "eddac2800fc08955c7805b0880438f1c0e047c79fc2f1365b89f8b34ff3d4883",
170
+ "file_sha256": "90471fbfcf70f0147dc799df79f7e34d0552cdb3b28fef4bf8290372bfb25ef3",
171
+ "bytes": 2175,
172
+ },
173
+ "gx": {
174
+ "path": f"matrices/{CANDIDATE_ID}/Gx.mtx.gz",
175
+ "shape": [14, 254],
176
+ "nnz": 912,
177
+ "array_sha256": "d2b4720434b9b047343545328d823ed22e3c0df7a8d953ae8b6b328c9a26d1a3",
178
+ "content_sha256": "89ad8dd9a8af7dc1dfbfa40708aba1d792d2ec75c549b96133159bbad06bf649",
179
+ "file_sha256": "faa9dfd321e1663bcb5538e79878829293605aace895fa58d1ddfba24eedbf53",
180
+ "bytes": 2057,
181
+ },
182
+ "gz": {
183
+ "path": f"matrices/{CANDIDATE_ID}/Gz.mtx.gz",
184
+ "shape": [14, 254],
185
+ "nnz": 846,
186
+ "array_sha256": "07143f00071d48b2e8c0681b516db3d76bfeb9f0223c54a5d3732199a18b3870",
187
+ "content_sha256": "b02f1ba21af93d3c7b2c93397c834a74431f49786873c15e79662ef57ab50534",
188
+ "file_sha256": "16405b89007fcccef60268d473a7fa3dd73a0ff9079b0dd8bf704822ba9c7557",
189
+ "bytes": 1972,
190
+ },
191
+ }
192
+
193
+ EXPECTED_AUTHORITY = {
194
+ "stage3_typed_handoff_replay": True,
195
+ "exact_under_pinned_solver_trust_model": True,
196
+ "pipeline_stage4_certificate": True,
197
+ "pipeline_stage5_final_gate": True,
198
+ "independent_release_gate_complete": True,
199
+ "standalone_typed_release": True,
200
+ "generic_pipeline_registration": False,
201
+ "pipeline_promotion": False,
202
+ "portable_unsat_proof_certificate": False,
203
+ "publication_certificate": True,
204
+ "public_dataset_record": True,
205
+ }
206
+
207
+ REQUIRED_MANIFEST_PATHS = {
208
+ "data/stage5_certified_exact_fom_ge_13.jsonl",
209
+ "evidence/stage5_certified_exact_proofs.jsonl",
210
+ "evidence/stage5_certified_exact_matrix_index.jsonl",
211
+ "scripts/verify_stage5_certified_exact_fom_ge_13.py",
212
+ *(record["path"] for record in EXPECTED_MATRICES.values()),
213
+ }
214
+
215
+
216
+ def sha256(path: Path) -> str:
217
+ digest = hashlib.sha256()
218
+ with path.open("rb") as handle:
219
+ for block in iter(lambda: handle.read(1 << 20), b""):
220
+ digest.update(block)
221
+ return digest.hexdigest()
222
+
223
+
224
+ def canonical_sha256(value: dict[str, Any], omitted: str) -> str:
225
+ payload = {key: item for key, item in value.items() if key != omitted}
226
+ encoded = json.dumps(
227
+ payload,
228
+ sort_keys=True,
229
+ separators=(",", ":"),
230
+ ensure_ascii=False,
231
+ allow_nan=False,
232
+ ).encode()
233
+ return hashlib.sha256(encoded).hexdigest()
234
+
235
+
236
+ def load_jsonl_one(path: Path) -> dict[str, Any]:
237
+ lines = [line for line in path.read_text(encoding="utf-8").splitlines() if line]
238
+ assert len(lines) == 1, (path, "expected exactly one nonempty row", len(lines))
239
+ value = json.loads(lines[0])
240
+ assert isinstance(value, dict), path
241
+ return value
242
+
243
+
244
+ def safe_public_path(root: Path, value: str) -> Path:
245
+ assert isinstance(value, str) and value, value
246
+ pure = PurePosixPath(value)
247
+ assert not pure.is_absolute() and ".." not in pure.parts, value
248
+ assert "\\" not in value, value
249
+ path = root.joinpath(*pure.parts)
250
+ assert path.resolve().is_relative_to(root), value
251
+ assert path.is_file() and not path.is_symlink(), value
252
+ return path
253
+
254
+
255
+ def load_mtx(path: Path) -> tuple[list[list[int]], int]:
256
+ with gzip.open(path, "rt", encoding="ascii", newline="") as handle:
257
+ assert handle.readline().strip() == (
258
+ "%%MatrixMarket matrix coordinate integer general"
259
+ ), path
260
+ line = handle.readline()
261
+ while line.startswith("%"):
262
+ line = handle.readline()
263
+ rows, columns, declared_nnz = map(int, line.split())
264
+ assert rows > 0 and columns > 0 and declared_nnz >= 0
265
+ matrix = [[0] * columns for _ in range(rows)]
266
+ coordinates: set[tuple[int, int]] = set()
267
+ for line in handle:
268
+ if not line.strip():
269
+ continue
270
+ row, column, value = map(int, line.split())
271
+ assert value == 1
272
+ coordinate = (row - 1, column - 1)
273
+ assert 0 <= coordinate[0] < rows and 0 <= coordinate[1] < columns
274
+ assert coordinate not in coordinates, (path, coordinate)
275
+ coordinates.add(coordinate)
276
+ matrix[coordinate[0]][coordinate[1]] = 1
277
+ assert len(coordinates) == declared_nnz
278
+ return matrix, declared_nnz
279
+
280
+
281
+ def gf2_rank(matrix: list[list[int]]) -> int:
282
+ rows = [sum((value & 1) << column for column, value in enumerate(row)) for row in matrix]
283
+ rank = 0
284
+ while rows:
285
+ pivot = max(rows)
286
+ if not pivot:
287
+ break
288
+ bit = 1 << (pivot.bit_length() - 1)
289
+ rank += 1
290
+ rows = [value ^ pivot if value & bit else value for value in rows if value != pivot]
291
+ return rank
292
+
293
+
294
+ def content_sha256(matrix: list[list[int]]) -> str:
295
+ shape = [len(matrix), len(matrix[0]) if matrix else 0]
296
+ header = json.dumps(
297
+ {"dtype": "uint8-gf2", "shape": shape},
298
+ sort_keys=True,
299
+ separators=(",", ":"),
300
+ )
301
+ raw = bytes(value & 1 for row in matrix for value in row)
302
+ return hashlib.sha256(header.encode() + b"\n" + raw).hexdigest()
303
+
304
+
305
+ def dist_array_sha256(name: str, matrix: list[list[int]]) -> str:
306
+ shape = [len(matrix), len(matrix[0]) if matrix else 0]
307
+ raw = bytes(value & 1 for row in matrix for value in row)
308
+ return hashlib.sha256(
309
+ name.encode()
310
+ + b"\0"
311
+ + json.dumps(shape, separators=(",", ":")).encode()
312
+ + b"\0"
313
+ + raw
314
+ ).hexdigest()
315
+
316
+
317
+ def certificate_matrix_sha256(matrix: list[list[int]]) -> str:
318
+ rows = len(matrix)
319
+ columns = len(matrix[0]) if matrix else 0
320
+ flattened = [value & 1 for row in matrix for value in row]
321
+ packed = bytearray((len(flattened) + 7) // 8)
322
+ for index, value in enumerate(flattened):
323
+ packed[index // 8] |= value << (index % 8)
324
+ return hashlib.sha256(f"{rows}x{columns}:".encode() + packed).hexdigest()
325
+
326
+
327
+ def transpose(matrix: list[list[int]]) -> list[list[int]]:
328
+ return [list(column) for column in zip(*matrix)]
329
+
330
+
331
+ def hstack(left: list[list[int]], right: list[list[int]]) -> list[list[int]]:
332
+ assert len(left) == len(right)
333
+ return [a + b for a, b in zip(left, right)]
334
+
335
+
336
+ def parity(left: list[int], right: list[int]) -> int:
337
+ assert len(left) == len(right)
338
+ return sum(a & b for a, b in zip(left, right)) & 1
339
+
340
+
341
+ def twisted_polynomial_matrix(
342
+ ell: int,
343
+ m: int,
344
+ twist: int,
345
+ terms: list[list[int]],
346
+ ) -> list[list[int]]:
347
+ size = ell * m
348
+ matrix = [[0] * size for _ in range(size)]
349
+ for row in range(size):
350
+ x, y = divmod(row, m)
351
+ for dx, dy in terms:
352
+ wraps, reduced_x = divmod(x + dx, ell)
353
+ reduced_y = (y + dy - wraps * twist) % m
354
+ matrix[row][reduced_x * m + reduced_y] ^= 1
355
+ return matrix
356
+
357
+
358
+ def tanner_component_count(checks: list[list[int]]) -> int:
359
+ check_count = len(checks)
360
+ qubit_count = len(checks[0]) if checks else 0
361
+ adjacency = [[] for _ in range(check_count + qubit_count)]
362
+ for check, row in enumerate(checks):
363
+ for qubit, value in enumerate(row):
364
+ if value & 1:
365
+ adjacency[check].append(check_count + qubit)
366
+ adjacency[check_count + qubit].append(check)
367
+ unseen = set(range(len(adjacency)))
368
+ components = 0
369
+ while unseen:
370
+ components += 1
371
+ stack = [unseen.pop()]
372
+ while stack:
373
+ node = stack.pop()
374
+ for neighbor in adjacency[node]:
375
+ if neighbor in unseen:
376
+ unseen.remove(neighbor)
377
+ stack.append(neighbor)
378
+ return components
379
+
380
+
381
+ def unpack_operator(record: dict[str, Any]) -> list[int]:
382
+ length = int(record["length"])
383
+ packed = bytes.fromhex(record["packed_hex"])
384
+ assert len(packed) == (length + 7) // 8
385
+ bits = [(packed[index // 8] >> (index % 8)) & 1 for index in range(length)]
386
+ assert sum(bits) == record["weight"]
387
+ assert hashlib.sha256(f"{length}:".encode() + packed).hexdigest() == record["sha256"]
388
+ assert all(
389
+ not ((packed[index // 8] >> (index % 8)) & 1)
390
+ for index in range(length, len(packed) * 8)
391
+ )
392
+ return bits
393
+
394
+
395
+ def verify_no_operational_leak(value: Any, location: tuple[str, ...] = ()) -> None:
396
+ if isinstance(value, dict):
397
+ forbidden_keys = {
398
+ "command",
399
+ "command_flags",
400
+ "cwd",
401
+ "environment",
402
+ "interpreter_path",
403
+ "local_path",
404
+ "native_thread_environment",
405
+ "pgid",
406
+ "pid",
407
+ "progress_checkpoint_path",
408
+ "progress_path",
409
+ "prompt",
410
+ "requested_path",
411
+ "rerun_command",
412
+ "rerun_output_tail",
413
+ "resolved_path",
414
+ "session_id",
415
+ "stderr",
416
+ "stdout",
417
+ "venv_path",
418
+ "worktree",
419
+ }
420
+ leaked = set(value) & forbidden_keys
421
+ assert not leaked, (location, leaked)
422
+ for key, item in value.items():
423
+ verify_no_operational_leak(item, (*location, key))
424
+ elif isinstance(value, list):
425
+ for index, item in enumerate(value):
426
+ verify_no_operational_leak(item, (*location, str(index)))
427
+ elif isinstance(value, str):
428
+ forbidden_fragments = ("/root/", "/tmp/", "/var/tmp/", ".venv/")
429
+ assert not any(fragment in value for fragment in forbidden_fragments), (
430
+ location,
431
+ value,
432
+ )
433
+
434
+
435
+ def assert_source_bindings(source: dict[str, Any]) -> None:
436
+ expected = {
437
+ "qcode_commit": QCODE_COMMIT,
438
+ "stage3_physical_file_sha256": STAGE3_PHYSICAL_FILE_SHA256,
439
+ "stage3_internal_artifact_sha256": STAGE3_INTERNAL_ARTIFACT_SHA256,
440
+ "stage3_handoff_artifact_sha256": STAGE3_HANDOFF_ARTIFACT_SHA256,
441
+ "stage3_handoff_claim_sha256": STAGE3_HANDOFF_CLAIM_SHA256,
442
+ "stage4_certificate_semantic_sha256": STAGE4_CERTIFICATE_SEMANTIC_SHA256,
443
+ "stage4_certificate_payload_sha256": STAGE4_CERTIFICATE_PAYLOAD_SHA256,
444
+ "stage4_certificate_physical_file_sha256": STAGE4_CERTIFICATE_PHYSICAL_FILE_SHA256,
445
+ "stage5_verification_payload_sha256": STAGE5_VERIFICATION_PAYLOAD_SHA256,
446
+ "stage5_verification_physical_file_sha256": STAGE5_VERIFICATION_PHYSICAL_FILE_SHA256,
447
+ "stage5_fresh_solver_evidence_sha256": INDEPENDENT_EXACT_EVIDENCE_SHA256,
448
+ "release_manifest_semantic_sha256": RELEASE_MANIFEST_SEMANTIC_SHA256,
449
+ "release_manifest_physical_file_sha256": RELEASE_MANIFEST_PHYSICAL_FILE_SHA256,
450
+ "loaded_source_fingerprint_sha256": LOADED_SOURCE_FINGERPRINT_SHA256,
451
+ }
452
+ for key, expected_value in expected.items():
453
+ assert source[key] == expected_value, key
454
+
455
+
456
+ def verify_manifest(root: Path, manifest: dict[str, Any]) -> None:
457
+ assert canonical_sha256(manifest, "manifest_sha256") == manifest["manifest_sha256"]
458
+ assert manifest["schema_version"] == 1
459
+ assert manifest["gate"] == "qcode-public-stage5-certified-exact-fom-ge-13-v1"
460
+ assert manifest["status"] == "CERTIFIED_EXACT_WIN"
461
+ assert manifest["source_status"] == "EXACT_PROVEN"
462
+ assert manifest["release_status"] == "CERTIFIED_STAGE5_TYPED_DISTQLDPC"
463
+ assert manifest["certified_win"] is True
464
+ assert manifest["publication_certificate"] is True
465
+ assert manifest["dataset_base_commit"] == HF_BASE_COMMIT
466
+ assert manifest["authority"] == EXPECTED_AUTHORITY
467
+ assert manifest["candidate"] == {
468
+ "candidate_id": CANDIDATE_ID,
469
+ "canonical_digest": CANONICAL_DIGEST,
470
+ "code": "[[254,14,16]]",
471
+ "exact_fom_numerator": 1792,
472
+ "exact_fom_denominator": 127,
473
+ }
474
+ assert_source_bindings(manifest["source"])
475
+
476
+ seen: set[str] = set()
477
+ for item in manifest["files"]:
478
+ relative = item["path"]
479
+ assert relative not in seen, relative
480
+ seen.add(relative)
481
+ path = safe_public_path(root, relative)
482
+ assert path.stat().st_size == item["bytes"], relative
483
+ assert sha256(path) == item["sha256"], relative
484
+ if "rows" in item:
485
+ rows = len(
486
+ [line for line in path.read_text(encoding="utf-8").splitlines() if line]
487
+ )
488
+ assert rows == item["rows"], relative
489
+ assert REQUIRED_MANIFEST_PATHS <= seen
490
+
491
+
492
+ def verify(root: Path) -> None:
493
+ root = root.resolve(strict=True)
494
+ data = load_jsonl_one(root / "data/stage5_certified_exact_fom_ge_13.jsonl")
495
+ evidence = load_jsonl_one(root / "evidence/stage5_certified_exact_proofs.jsonl")
496
+ matrix_index = load_jsonl_one(
497
+ root / "evidence/stage5_certified_exact_matrix_index.jsonl"
498
+ )
499
+ manifest = json.loads(
500
+ (root / "manifests/stage5_certified_exact_fom_ge_13.json").read_text(
501
+ encoding="utf-8"
502
+ )
503
+ )
504
+ assert isinstance(manifest, dict)
505
+
506
+ assert canonical_sha256(data, "record_sha256") == data["record_sha256"]
507
+ assert canonical_sha256(evidence, "evidence_sha256") == evidence["evidence_sha256"]
508
+ assert canonical_sha256(matrix_index, "record_sha256") == matrix_index["record_sha256"]
509
+ verify_manifest(root, manifest)
510
+
511
+ assert data["schema_version"] == evidence["schema_version"] == 1
512
+ assert matrix_index["schema_version"] == 1
513
+ assert data["record_kind"] == "stage5_certified_exact_fom_ge_13"
514
+ assert evidence["record_kind"] == "stage5_certified_exact_fom_ge_13_evidence"
515
+ assert matrix_index["record_kind"] == "stage5_certified_exact_matrix_index"
516
+ assert data["evidence_class"] == evidence["evidence_class"] == "CERTIFIED_EXACT_WIN"
517
+ assert data["release_status"] == evidence["release_status"] == (
518
+ "CERTIFIED_STAGE5_TYPED_DISTQLDPC"
519
+ )
520
+ assert data["source_status"] == "EXACT_PROVEN"
521
+ assert data["source_stage"] == "stage5_typed_distqldpc_release"
522
+
523
+ for record in (data, evidence, matrix_index):
524
+ assert record["candidate_id"] == CANDIDATE_ID
525
+ assert record["canonical_digest"] == CANONICAL_DIGEST
526
+ assert data["authority"] == evidence["authority"] == EXPECTED_AUTHORITY
527
+ assert manifest["source"] == data["source"]
528
+ assert_source_bindings(data["source"])
529
+
530
+ construction = data["construction"]
531
+ assert construction["family"] == "css-bb"
532
+ assert construction["representation_id"] == "css-bb-twisted-torus-generator-v1"
533
+ key_payload = {
534
+ "ell": construction["ell"],
535
+ "m": construction["m"],
536
+ "A_terms": sorted(construction["A_terms"]),
537
+ "B_terms": sorted(construction["B_terms"]),
538
+ "geometry": construction["geometry"],
539
+ }
540
+ encoded_key = json.dumps(key_payload, sort_keys=True, separators=(",", ":"))
541
+ construction_key_sha256 = hashlib.sha256(encoded_key.encode()).hexdigest()
542
+ assert construction_key_sha256 == CONSTRUCTION_KEY_SHA256
543
+ assert construction_key_sha256[:20] == CANDIDATE_ID
544
+ assert construction["ell"] == 1 and construction["m"] == 127
545
+ assert construction["geometry"] == {
546
+ "family": "twisted_torus",
547
+ "schema_version": 1,
548
+ "twist": 25,
549
+ }
550
+ assert construction["A_terms"] == [[0, 0], [0, 22], [0, 96]]
551
+ assert construction["B_terms"] == [[0, 1], [0, 14], [0, 121]]
552
+
553
+ a_matrix = twisted_polynomial_matrix(
554
+ construction["ell"],
555
+ construction["m"],
556
+ construction["geometry"]["twist"],
557
+ construction["A_terms"],
558
+ )
559
+ b_matrix = twisted_polynomial_matrix(
560
+ construction["ell"],
561
+ construction["m"],
562
+ construction["geometry"]["twist"],
563
+ construction["B_terms"],
564
+ )
565
+ expected_hx = hstack(a_matrix, b_matrix)
566
+ expected_hz = hstack(transpose(b_matrix), transpose(a_matrix))
567
+
568
+ assert data["matrices"] == matrix_index["matrices"]
569
+ matrices: dict[str, list[list[int]]] = {}
570
+ for lower_name, expected_record in EXPECTED_MATRICES.items():
571
+ record = data["matrices"][lower_name]
572
+ assert record == expected_record
573
+ path = safe_public_path(root, record["path"])
574
+ matrix, nnz = load_mtx(path)
575
+ matrices[lower_name] = matrix
576
+ assert [len(matrix), len(matrix[0])] == record["shape"]
577
+ assert nnz == record["nnz"]
578
+ assert path.stat().st_size == record["bytes"]
579
+ assert sha256(path) == record["file_sha256"]
580
+ assert content_sha256(matrix) == record["content_sha256"]
581
+ assert dist_array_sha256(lower_name.capitalize(), matrix) == record["array_sha256"]
582
+
583
+ assert matrix_index["n"] == 254 and matrix_index["k"] == 14
584
+ assert matrices["hx"] == expected_hx
585
+ assert matrices["hz"] == expected_hz
586
+ hx, hz, gx, gz = matrices["hx"], matrices["hz"], matrices["gx"], matrices["gz"]
587
+
588
+ rank_x, rank_z = gf2_rank(hx), gf2_rank(hz)
589
+ checks = data["matrix_checks"]
590
+ assert rank_x == checks["rank_x"] == 120
591
+ assert rank_z == checks["rank_z"] == 120
592
+ assert 254 - rank_x - rank_z == checks["k_recomputed"] == 14
593
+ assert all(parity(x_check, z_check) == 0 for x_check in hx for z_check in hz)
594
+ assert checks["css_commutation"] is True
595
+ assert checks["commutation_violations"] == 0
596
+
597
+ assert all(parity(check, logical) == 0 for check in hx for logical in gx)
598
+ assert all(parity(check, logical) == 0 for check in hz for logical in gz)
599
+ duality = [[parity(z_logical, x_logical) for x_logical in gx] for z_logical in gz]
600
+ assert duality == [[int(row == column) for column in range(14)] for row in range(14)]
601
+ assert gf2_rank(hx + gz) == 134
602
+ assert gf2_rank(hz + gx) == 134
603
+ assert checks["logical_basis_complete"] is True
604
+ assert checks["logical_duality"] is True
605
+
606
+ assert max(map(sum, hx + hz)) == checks["max_check_weight"] == 6
607
+ sector_degree = max(
608
+ max(sum(row[column] for row in hx) for column in range(254)),
609
+ max(sum(row[column] for row in hz) for column in range(254)),
610
+ )
611
+ combined_degree = max(sum(row[column] for row in hx + hz) for column in range(254))
612
+ assert sector_degree == checks["max_sector_qubit_degree"] == 3
613
+ assert combined_degree == checks["max_qubit_degree"] == 6
614
+ assert tanner_component_count(hx + hz) == checks["tanner_components"] == 1
615
+
616
+ assert certificate_matrix_sha256(hx) == CERTIFICATE_MATRIX_SHA256["H_X"]
617
+ assert certificate_matrix_sha256(hz) == CERTIFICATE_MATRIX_SHA256["H_Z"]
618
+ admissibility = data["admissibility"]
619
+ assert admissibility["schema_version"] == 1
620
+ assert admissibility["mode"] == "css-stabilizer-check-row-weight-at-most-6-v1"
621
+ assert admissibility["maximum"] == 6
622
+ assert admissibility["matrix_authority"] == "fresh-rebuild-from-construction"
623
+ assert admissibility["matrix_scope"] == ["H_X", "H_Z"]
624
+ assert admissibility["row_reduction_allowed"] is False
625
+ assert admissibility["binding_sha256"] == ADMISSIBILITY_BINDING_SHA256
626
+ admissibility_report = evidence["admissibility"]
627
+ assert admissibility_report["passed"] is True
628
+ assert admissibility_report["policy_binding_sha256"] == ADMISSIBILITY_BINDING_SHA256
629
+ assert admissibility_report["report_sha256"] == ADMISSIBILITY_REPORT_SHA256
630
+ assert admissibility_report["matrix_sha256"] == CERTIFICATE_MATRIX_SHA256
631
+ assert admissibility_report["max_check_row_weight"] == 6
632
+
633
+ lower = evidence["lower_bound_evidence"]
634
+ assert lower["outcome"] == "exact"
635
+ assert lower["exact_distance"] == lower["lower_bound"] == lower["upper_bound"] == 16
636
+ assert lower["threshold_infeasible"] is True
637
+ assert lower["decision_complete"] is True
638
+ assert lower["retryable"] is False
639
+ assert lower["cardinality_mode"] == "mto"
640
+ assert lower["portable_unsat_proof_certificate"] is False
641
+ assert lower["distqldpc_decisions_verified"] == lower["distqldpc_decisions_total"] == 1
642
+ assert lower["logical_partitions_verified"] == lower["logical_partitions_total"] == 1
643
+ assert lower["backend"]["binary_sha256"] == DISTQLDPC_BINARY_SHA256
644
+ assert lower["backend"]["source_commit"] == DISTQLDPC_SOURCE_COMMIT
645
+ assert lower["logical_detector_sha256"] == LOGICAL_DETECTOR_SHA256
646
+ assert lower["solver_instance_array_sha256"] == {
647
+ name.capitalize(): record["array_sha256"]
648
+ for name, record in EXPECTED_MATRICES.items()
649
+ }
650
+
651
+ primary = lower["stage3_exact"]
652
+ assert primary["outcome"] == "exact"
653
+ assert primary["exact_distance"] == primary["lower_bound"] == primary["upper_bound"] == 16
654
+ assert primary["decision_complete"] is True and primary["threshold_infeasible"] is True
655
+ assert primary["evidence_sha256"] == PRIMARY_EXACT_EVIDENCE_SHA256
656
+ assert primary["terminal_file_sha256"] == PRIMARY_EXACT_TERMINAL_FILE_SHA256
657
+ assert primary["stdout_sha256"] == EXACT_STDOUT_SHA256
658
+ assert primary["instance_binding_sha256"] == PRIMARY_EXACT_INSTANCE_BINDING_SHA256
659
+ assert primary["checkpoint_identity_sha256"] == PRIMARY_EXACT_CHECKPOINT_IDENTITY_SHA256
660
+ assert abs(primary["elapsed_s"] - 21513.579824514687) < 1e-9
661
+
662
+ independent = lower["stage5_independent_rerun"]
663
+ assert independent["outcome"] == "exact"
664
+ assert independent["exact_distance"] == independent["lower_bound"] == independent["upper_bound"] == 16
665
+ assert independent["decision_complete"] is True
666
+ assert independent["verified"] is True
667
+ assert independent["evidence_sha256"] == INDEPENDENT_EXACT_EVIDENCE_SHA256
668
+ assert independent["stdout_sha256"] == EXACT_STDOUT_SHA256
669
+ assert independent["instance_binding_sha256"] == INDEPENDENT_EXACT_INSTANCE_BINDING_SHA256
670
+ assert independent["checkpoint_identity_sha256"] == INDEPENDENT_EXACT_CHECKPOINT_IDENTITY_SHA256
671
+ assert independent["verification_physical_file_sha256"] == (
672
+ STAGE5_VERIFICATION_PHYSICAL_FILE_SHA256
673
+ )
674
+ assert abs(independent["elapsed_s"] - 19798.601512420923) < 1e-9
675
+ assert primary["evidence_sha256"] != independent["evidence_sha256"]
676
+ assert primary["instance_binding_sha256"] != independent["instance_binding_sha256"]
677
+ assert primary["checkpoint_identity_sha256"] != independent["checkpoint_identity_sha256"]
678
+
679
+ upper = evidence["upper_bound_evidence"]
680
+ assert upper["outcome"] == "sat" and upper["sector"] == "X"
681
+ assert upper["objective"] == 16
682
+ assert upper["decision_complete"] is True and upper["retryable"] is False
683
+ assert upper["evidence_sha256"] == UPPER_EVIDENCE_SHA256
684
+ assert upper["instance_binding_sha256"] == UPPER_INSTANCE_BINDING_SHA256
685
+ assert upper["cnf"]["cnf_sha256"] == UPPER_CNF_SHA256
686
+ assert upper["cnf"]["cardinality_encoding"] == "kmtotalizer"
687
+ assert upper["backend"] == {
688
+ "distribution": "python-sat",
689
+ "solver": "cadical195",
690
+ "version": "1.9.dev7",
691
+ }
692
+ assert upper["anchor_indices"] == [0, 127]
693
+ operator_record = upper["operator"]
694
+ assert operator_record == {
695
+ "length": 254,
696
+ "packed_hex": UPPER_OPERATOR_PACKED_HEX,
697
+ "sha256": UPPER_OPERATOR_SHA256,
698
+ "weight": 16,
699
+ }
700
+ operator = unpack_operator(operator_record)
701
+ assert all(parity(check, operator) == 0 for check in hz)
702
+ syndrome = [parity(logical, operator) for logical in gx]
703
+ assert syndrome == upper["logical_syndrome"] == UPPER_LOGICAL_SYNDROME
704
+ assert any(syndrome)
705
+ assert gf2_rank(hx + [operator]) == rank_x + 1
706
+ assert any(operator[index] for index in upper["anchor_indices"])
707
+
708
+ symmetry = evidence["symmetry"]
709
+ assert symmetry["translation_verified"] is True
710
+ assert symmetry["orbit_representatives"] == [0, 127]
711
+ assert symmetry["orbit_sizes"] == [127, 127]
712
+ assert symmetry["xz_sector_isometry_verified"] is True
713
+ assert symmetry["xz_sector_isometry_sha256"] == XZ_SECTOR_ISOMETRY_SHA256
714
+ assert symmetry["covered_sectors"] == ["X", "Z"]
715
+ assert symmetry["weight_preserving"] is True
716
+
717
+ assert data["parameters"] == {"n": 254, "k": 14}
718
+ assert data["code"] == "[[254,14,16]]"
719
+ assert data["distance"] == {
720
+ "status": "EXACT_PROVEN",
721
+ "exact": 16,
722
+ "lower_bound": 16,
723
+ "upper_bound": 16,
724
+ "lower_bound_backend": "DistQLDPC/MaxCDCL",
725
+ "upper_bound_backend": "python-sat/cadical195",
726
+ }
727
+ assert evidence["distance_claim"] == {
728
+ "status": "EXACT_PROVEN",
729
+ "exact": 16,
730
+ "lower_bound": 16,
731
+ "upper_bound": 16,
732
+ }
733
+
734
+ fom = data["fom"]
735
+ assert fom["exact"]["numerator"] == 1792
736
+ assert fom["exact"]["denominator"] == 127
737
+ assert abs(fom["exact"]["decimal"] - 1792 / 127) < 1e-15
738
+ assert fom["excess_over_12"]["numerator"] == 268
739
+ assert fom["excess_over_12"]["denominator"] == 127
740
+ assert abs(fom["excess_over_12"]["decimal"] - 268 / 127) < 1e-15
741
+ assert fom["excess_over_13"]["numerator"] == 141
742
+ assert fom["excess_over_13"]["denominator"] == 127
743
+ assert abs(fom["excess_over_13"]["decimal"] - 141 / 127) < 1e-15
744
+
745
+ target = data["target"]
746
+ assert target["strict_predicate"] == "k*d*d > 12*n"
747
+ assert target["required_distance"] == 15
748
+ assert target["left_hand_side"] == 14 * 16 * 16 == 3584
749
+ assert target["right_hand_side"] == 12 * 254 == 3048
750
+ assert target["passes_strict_target"] is True
751
+ assert target["certified_win"] is True
752
+ assert fom["strict_integer_margin"] == 3584 - 3048 == 536
753
+
754
+ source_target = data["source_target"]
755
+ assert source_target == {
756
+ "mode": "scalar-fom-13-inclusive-v1",
757
+ "strict": False,
758
+ "binding_sha256": TARGET_BINDING_SHA256,
759
+ "required_distance": 16,
760
+ "left_hand_side": 3584,
761
+ "right_hand_side": 3302,
762
+ "passed": True,
763
+ }
764
+ assert 3584 >= 13 * 254 == 3302
765
+
766
+ novelty = data["novelty"]
767
+ assert novelty["checked"] is True
768
+ assert novelty["novel"] is True
769
+ assert novelty["status"] == "COMPLETE"
770
+ assert novelty["matched_entries"] == []
771
+ assert novelty["canonical_digest"] == CANONICAL_DIGEST
772
+ assert novelty["registry_internal_sha256"] == NOVELTY_REGISTRY_INTERNAL_SHA256
773
+ assert evidence["novelty"] == novelty
774
+
775
+ known_answer = data["known_answer_context"]
776
+ assert known_answer == evidence["known_answer"]
777
+ assert known_answer == {
778
+ "artifact_sha256": KNOWN_ANSWER_ARTIFACT_SHA256,
779
+ "trust_sha256": KNOWN_ANSWER_TRUST_SHA256,
780
+ "integrity_physical_file_sha256": KNOWN_ANSWER_INTEGRITY_PHYSICAL_FILE_SHA256,
781
+ "semantic_replay_sha256": KNOWN_ANSWER_SEMANTIC_REPLAY_SHA256,
782
+ "release_replayed": True,
783
+ "passed": True,
784
+ }
785
+
786
+ handoff = evidence["stage3_typed_handoff"]
787
+ assert handoff["status"] == "EXACT_PROVEN"
788
+ assert handoff["typed_replay_verified"] is True
789
+ assert handoff["backend"] == "distqldpc"
790
+ assert handoff["lower_bound_threshold"] == 15
791
+ assert handoff["required_distance"] == 16
792
+ assert handoff["completed_lower_decisions"] == handoff["expected_lower_decisions"] == 1
793
+ assert handoff["completed_lower_partitions"] == handoff["expected_lower_partitions"] == 1
794
+ assert handoff["distqldpc_exact_distances"] == [16]
795
+ assert handoff["physical_file_sha256"] == STAGE3_PHYSICAL_FILE_SHA256
796
+ assert handoff["internal_artifact_sha256"] == STAGE3_INTERNAL_ARTIFACT_SHA256
797
+ assert handoff["handoff_artifact_sha256"] == STAGE3_HANDOFF_ARTIFACT_SHA256
798
+ assert handoff["handoff_claim_sha256"] == STAGE3_HANDOFF_CLAIM_SHA256
799
+ assert handoff["qcode_commit"] == QCODE_COMMIT
800
+
801
+ stage4 = evidence["stage4_certificate"]
802
+ assert stage4["passed"] is True
803
+ assert stage4["certificate_type"] == "qldpc-css-bb-sector-distqldpc-exact"
804
+ assert stage4["certificate_semantic_sha256"] == STAGE4_CERTIFICATE_SEMANTIC_SHA256
805
+ assert stage4["certificate_payload_sha256"] == STAGE4_CERTIFICATE_PAYLOAD_SHA256
806
+ assert stage4["certificate_physical_file_sha256"] == (
807
+ STAGE4_CERTIFICATE_PHYSICAL_FILE_SHA256
808
+ )
809
+ assert stage4["source_stage3_artifact_sha256"] == STAGE3_HANDOFF_ARTIFACT_SHA256
810
+ assert stage4["source_stage3_checkpoint_identity_sha256"] == (
811
+ PRIMARY_EXACT_CHECKPOINT_IDENTITY_SHA256
812
+ )
813
+ assert stage4["target_binding_sha256"] == TARGET_BINDING_SHA256
814
+ assert stage4["exact_distance"] == 16
815
+
816
+ stage5 = evidence["stage5_verification"]
817
+ assert stage5["passed"] is True
818
+ assert stage5["replay_complete"] is True
819
+ assert stage5["final_gate_accepted"] is True
820
+ assert stage5["typed_lower"] is True and stage5["upper"] is True
821
+ assert stage5["novelty"] is True and stage5["fom_target"] is True
822
+ assert stage5["distqldpc_decisions_verified"] == stage5["distqldpc_decisions_total"] == 1
823
+ assert stage5["logical_partitions_verified"] == stage5["logical_partitions_total"] == 1
824
+ assert stage5["fresh_solver_evidence_sha256"] == INDEPENDENT_EXACT_EVIDENCE_SHA256
825
+ assert stage5["verification_payload_sha256"] == STAGE5_VERIFICATION_PAYLOAD_SHA256
826
+ assert stage5["verification_physical_file_sha256"] == (
827
+ STAGE5_VERIFICATION_PHYSICAL_FILE_SHA256
828
+ )
829
+ assert stage5["release_manifest_semantic_sha256"] == RELEASE_MANIFEST_SEMANTIC_SHA256
830
+ assert stage5["release_manifest_physical_file_sha256"] == (
831
+ RELEASE_MANIFEST_PHYSICAL_FILE_SHA256
832
+ )
833
+ assert stage5["loaded_source_fingerprint_sha256"] == LOADED_SOURCE_FINGERPRINT_SHA256
834
+ assert stage5["standalone_typed_release"] is True
835
+ assert stage5["generic_pipeline_registration"] is False
836
+
837
+ limitations = evidence["limitations"]
838
+ assert limitations["portable_unsat_certificate"] is False
839
+ assert limitations["lower_bound_trust_model"] == "pinned-distqldpc-maxcdcl-runtime"
840
+ assert limitations["solver_invoked_by_public_verifier"] is False
841
+
842
+ for record in (data, evidence, matrix_index, manifest):
843
+ verify_no_operational_leak(record)
844
+
845
+ print(
846
+ "PASS: certified [[254,14,16]], FOM=1792/127; construction, four "
847
+ "matrices, logical basis, witness, two exact-run bindings, and Stage "
848
+ "3/4/5 publication chain verified. Lower bound remains tied to the "
849
+ "pinned DistQLDPC/MaxCDCL trust model."
850
+ )
851
+
852
+
853
+ if __name__ == "__main__":
854
+ verify(Path(sys.argv[1]) if len(sys.argv) > 1 else Path("."))