Skip to content

Publish exact global certificate and reproducible replay for Erdős Problem 23 - #1

Merged
khanukov merged 1 commit into
mainfrom
release/exact-global-certificate
Aug 23, 2026
Merged

khanukov merged 1 commit into
mainfrom
release/exact-global-certificate

Conversation

@khanukov

Copy link
Copy Markdown
Owner

Summary

This PR publishes an externally reviewable, computer-assisted proof candidate for the Erdős–Győri–Simonovits triangle-free bipartization conjecture.

The exact order-10 dual objective is
[
\delta_\star=-9.878886951679021\ldots\times 10^{-4}<-9/10000<0.
]

Included

  • five-page review manuscript (LaTeX source and rendered PDF);
  • transparent exact JSON certificate, split into checksum-protected chunks;
  • independent exact-arithmetic dual verifier;
  • independent reconstruction of all 12,172 fixed-Gram moment coordinates from 87 nonnegative rational rank-one atoms;
  • generation, solving, rationalization, and K7 cache-building scripts;
  • compact certificate archive and self-contained full replay bundle;
  • SHA-256 manifests, artifact assembly/check scripts, review guide, status report, and scientific note;
  • GitHub Actions workflow that runs the full exact replay.

Verification already completed locally

  • all published part and assembled-file SHA-256 checks;
  • archive integrity and manifest checks;
  • exact moment reconstruction: 12,172 / 12,172 coordinates;
  • exact JSON certificate replay;
  • exact pickle certificate replay from the self-contained bundle;
  • matrix reconstruction: 10,188 × 12,172 with 11,560,170 nonzeros;
  • minimum exact dual residual: 0 at state 46;
  • exact negative objective and global-closure flag;
  • clean PDF rebuild and visual inspection of all five pages.

Run:

python3 -m pip install -r requirements-replay.txt
./scripts/check_artifacts.sh
./scripts/run_full_replay.sh

Review status

The finite computation has been replayed exactly, but the proof bridge and certificate have not yet received independent third-party peer review. The repository deliberately labels the result a proof candidate and identifies the mathematical trust boundary in README.md, REVIEW_GUIDE.md, and docs/VERIFICATION_REPORT.md.

…blem 23

Add the exact rational dual certificate, independent exact-arithmetic verifiers,
full and compact replay bundles, manuscript source/PDF, checksums, review guide,
and a GitHub Actions workflow that replays every proof artifact.
@khanukov
khanukov merged commit e35fca0 into main Aug 23, 2026
2 checks passed
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Publish exact certificate and reproducible replay for Erdős Problem 23

✨ Enhancement 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Publish exact dual certificate and replay bundles with SHA-256 manifests.
• Add independent exact verifiers for moment reconstruction and dual feasibility/objective.
• Automate assembly and full replay locally and in GitHub Actions.
Diagram

graph TD
  gha["GitHub Actions"] --> check["scripts/check_artifacts.sh"] --> assemble["scripts/assemble_artifacts.sh"] --> workdir[(".replay-work artifacts")]
  workdir --> replay["scripts/run_full_replay.sh"] --> bundle[("Full replay bundle")]
  bundle --> moment["verifier/verify_moment_vector.py"]
  bundle --> dual["verifier/verify_exact_fixed_gram_dual.py"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Publish large artifacts via GitHub Releases/Assets (keep repo lean)
  • ➕ Avoids committing large binary chunks into git history
  • ➕ Easier downloads for reviewers; better caching/CDN behavior
  • ➖ Harder to guarantee the exact bits used for a given commit without additional pinning
  • ➖ Requires extra tooling to fetch assets during CI/local replay
2. Use Git LFS for certificate/archive chunks
  • ➕ Keeps git history smaller while still versioning binaries
  • ➕ Improves clone performance for contributors not replaying artifacts
  • ➖ Introduces LFS dependency and quota/bandwidth considerations
  • ➖ Some environments disallow LFS; reproducibility for third parties can be harder
3. Mirror replay bundle to an archival DOI repository (e.g., Zenodo)
  • ➕ Long-term immutable storage and citation stability
  • ➕ Independent availability beyond GitHub
  • ➖ Extra release process and synchronization step
  • ➖ Still need in-repo checksums/manifests to bind DOI artifact to commit

Recommendation: The PR’s approach (chunked in-repo artifacts + SHA-256 manifests + fully independent verifiers + CI replay) is strong for bit-level reproducibility and external auditability. If repository size/history becomes a practical issue, consider additionally mirroring the full replay bundle to GitHub Releases or a DOI archive while retaining the in-repo manifest/checksum workflow to cryptographically bind any external download to a commit.

Files changed (29) +3341 / -1

Enhancement (11) +2338 / -0
MakefileAdd convenience targets for artifact checks, replay, and paper build +14/-0

Add convenience targets for artifact checks, replay, and paper build

• Adds 'make artifacts', 'make replay', and 'make paper' targets to standardize common verification and build commands.

Makefile

erdos23_global_exact_dual.json.part-001Add chunk of transparent exact JSON dual certificate +1/-0

Add chunk of transparent exact JSON dual certificate

• Adds a portion of the published exact rational dual certificate (chunked for repository storage) to be assembled into 'erdos23_global_exact_dual.json'.

certificate/erdos23_global_exact_dual.json.part-001

advance_from_explicit_dual.pyAdvance cutting-plane state from an explicit dual solution +143/-0

Advance cutting-plane state from an explicit dual solution

• Adds a helper script that validates a feasible explicit-dual solution, derives separation distributions, prunes slack rows, and appends newly separated K7/K8/Horn descriptors to the generator state.

generation/advance_from_explicit_dual.py

build_k7_compact_cache.pyDeterministically build resumable exact K7 count cache +168/-0

Deterministically build resumable exact K7 count cache

• Implements a per-root, atomic-write cache builder that stores K7 tensors as exact integer numerators over denominator 181440, producing a manifest-validated 'k7_compact_v1' directory.

generation/build_k7_compact_cache.py

generate_fixed_gram_lp.pyGenerate fixed-Gram LP row pool via exact descriptors +824/-0

Generate fixed-Gram LP row pool via exact descriptors

• Adds a generator that rebuilds the cutting-plane row pool (K7/K8/Horn + fixed Gram) from public data, storing rows as compact descriptors rather than floating sparse vectors.

generation/generate_fixed_gram_lp.py

rationalize_fixed_gram_dual.pyRationalize a floating dual into an exact certificate +343/-0

Rationalize a floating dual into an exact certificate

• Adds tooling to convert a feasible floating dual into an exact rational certificate by repairing envelope legs over integers and defining rho as the exact max load across all 12,172 states.

generation/rationalize_fixed_gram_dual.py

solve_fixed_gram_dual.pySolve explicit dual LP to seed exact rationalization +195/-0

Solve explicit dual LP to seed exact rationalization

• Adds an explicit-dual solver (HiGHS) that outputs multipliers, violations, and descriptor ordering for subsequent exact rationalization and cutting-plane advancement.

generation/solve_fixed_gram_dual.py

erdos23_full_solution_exact_certificate_2026-08-23.tar.gz.part-005Add chunk of compact exact-certificate archive +0/-0

Add chunk of compact exact-certificate archive

• Adds a binary chunk of the compact certificate tarball (stored as ordered parts) that is assembled into the final '.tar.gz' artifact under '.replay-work/'.

release/erdos23_full_solution_exact_certificate_2026-08-23.tar.gz.part-005

exact_arithmetic.pyAdd gmpy2-compatible exact arithmetic fallback +29/-0

Add gmpy2-compatible exact arithmetic fallback

• Provides a minimal 'Fraction'-based substitute for the subset of gmpy2 APIs used by the verifiers, keeping replay runnable without gmpy2.

verifier/exact_arithmetic.py

verify_exact_fixed_gram_dual.pyAdd independent exact dual verifier (no LP-generator imports) +409/-0

Add independent exact dual verifier (no LP-generator imports)

• Implements an independent replay that rebuilds K7/K8/Horn rows from combinatorial caches, constructs the sparse integer matrix, audits digit-split multiplication safety, and checks all exact residuals/objective and global-closure flag.

verifier/verify_exact_fixed_gram_dual.py

verify_moment_vector.pyAdd exact fixed-Gram moment-vector reconstruction verifier +212/-0

Add exact fixed-Gram moment-vector reconstruction verifier

• Recomputes all 12,172 fixed-Gram moments from public Gram atoms and regenerated flag data using exact rationals (gmpy2 or fallback), and checks equality against the frozen moment vector.

verifier/verify_moment_vector.py

Documentation (10) +815 / -1
README.mdDocument exact certificate result, replay instructions, and trust boundary +111/-1

Document exact certificate result, replay instructions, and trust boundary

• Replaces the placeholder README with a detailed overview of the conjecture, the negative exact objective, one-command replay steps, repository layout, and explicit trust boundary for reviewers.

README.md

REVIEW_GUIDE.mdAdd external review protocol and audit checklist +72/-0

Add external review protocol and audit checklist

• Provides a structured review procedure covering artifact integrity, independent exact replay, certificate-level audits, and the mathematical bridge assumptions to verify.

REVIEW_GUIDE.md

STATUS.mdRecord current verification status and remaining review requirements +31/-0

Record current verification status and remaining review requirements

• Captures the completed local verification results (objective, residuals, reconstructions) and lists remaining steps for third-party execution and human mathematical audit.

STATUS.md

README.mdExplain how to assemble the transparent JSON certificate +18/-0

Explain how to assemble the transparent JSON certificate

• Documents that the primary JSON certificate is stored as '.part-*' chunks and explains how to reconstruct it into '.replay-work/' with checksum verification.

certificate/README.md

FULL_REPLAY_BUNDLE_README.mdDocument replay-bundle usage from extracted archive root +26/-0

Document replay-bundle usage from extracted archive root

• Explains how to run moment reconstruction and exact dual replay directly from the unpacked full bundle, and what bundled public data/caches are used.

docs/FULL_REPLAY_BUNDLE_README.md

SCIENTIFIC_NOTE.mdProvide concise theorem statement and proof bridge outline +153/-0

Provide concise theorem statement and proof bridge outline

• Adds a short scientific note stating the theorem, describing the certified density band, summarizing the negative objective and row counts, and explaining how the finite certificate combines with cited results.

docs/SCIENTIFIC_NOTE.md

VERIFICATION_REPORT.mdAdd dated verification transcript and trust boundary summary +69/-0

Add dated verification transcript and trust boundary summary

• Records exact replay outputs for moment reconstruction and dual replay (including matrix shape/nnz, min residual state, and objective) and reiterates what remains outside machine verification.

docs/VERIFICATION_REPORT.md

erdos23_full_solution_draft.pdfPublish rendered five-page review draft (PDF) +0/-0

Publish rendered five-page review draft (PDF)

• Adds the compiled manuscript PDF referenced by the README and review materials for external reading and citation.

paper/erdos23_full_solution_draft.pdf

erdos23_full_solution_draft.texPublish LaTeX source for the review draft +319/-0

Publish LaTeX source for the review draft

• Adds the LaTeX source describing the conjecture, density split, finite relaxation, negative exact objective, and independent replay methodology and outputs.

paper/erdos23_full_solution_draft.tex

README.mdDocument chunked release archives and reconstruction +16/-0

Document chunked release archives and reconstruction

• Explains the two logical gzip archives, how they are stored as '.part-*' chunks, and how to assemble and verify them via the provided script and checksums.

release/README.md

Other (8) +188 / -0
exact-replay.ymlAdd CI workflow to run full exact replay +36/-0

Add CI workflow to run full exact replay

• Introduces a GitHub Actions workflow that installs replay dependencies, verifies committed/assembled artifacts, and runs the full replay script for both JSON and pickle certificates.

.github/workflows/exact-replay.yml

.gitignoreIgnore Python/LaTeX byproducts and replay work directory +7/-0

Ignore Python/LaTeX byproducts and replay work directory

• Adds ignore rules for Python cache/bytecode, LaTeX auxiliary files, and the generated '.replay-work/' directory.

.gitignore

ARTIFACT_SHA256SUMSPublish SHA-256 digests for all committed artifact chunks +39/-0

Publish SHA-256 digests for all committed artifact chunks

• Adds a checksum manifest covering the paper sources/PDF, certificate JSON parts, and release archive parts for external integrity verification.

ARTIFACT_SHA256SUMS

ASSEMBLED_SHA256SUMSPublish SHA-256 digests for assembled logical artifacts +3/-0

Publish SHA-256 digests for assembled logical artifacts

• Pins hashes for the assembled JSON certificate and the two assembled tar.gz archives produced by 'scripts/assemble_artifacts.sh'.

ASSEMBLED_SHA256SUMS

requirements-replay.txtPin minimal Python dependencies for replay +2/-0

Pin minimal Python dependencies for replay

• Pins 'numpy' and 'scipy' versions used by the replay/verifier scripts for consistent CI and local execution.

requirements-replay.txt

assemble_artifacts.shAssemble chunked artifacts into reproducible outputs +33/-0

Assemble chunked artifacts into reproducible outputs

• Concatenates '.part-*' files into assembled JSON and tar.gz artifacts under '.replay-work/' and verifies them against 'ASSEMBLED_SHA256SUMS'.

scripts/assemble_artifacts.sh

check_artifacts.shVerify committed artifact hashes and basic archive invariants +33/-0

Verify committed artifact hashes and basic archive invariants

• Checks 'ARTIFACT_SHA256SUMS', assembles artifacts, validates gzip integrity, sanity-checks expected K7 cache contents in the full archive, and byte-compiles Python sources.

scripts/check_artifacts.sh

run_full_replay.shEnd-to-end replay driver from self-contained bundle +35/-0

End-to-end replay driver from self-contained bundle

• Extracts the full replay bundle into a temp directory, verifies 'BUNDLE_SHA256SUMS', then runs exact moment reconstruction followed by exact dual replay for both JSON and pickle certificates.

scripts/run_full_replay.sh

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Unsafe pickle certificate load 🐞 Bug ⛨ Security
Description
verifier/verify_exact_fixed_gram_dual.py will pickle.load() any non-JSON --certificate,
enabling arbitrary code execution if a user points the verifier at an untrusted .pkl file. The
replay script explicitly iterates over erdos23_global_exact_dual.pkl, encouraging this unsafe path
by default.
Code

verifier/verify_exact_fixed_gram_dual.py[R113-115]

+    else:
+        with args.certificate.open("rb") as handle:
+            certificate = pickle.load(handle)
Evidence
The verifier unpickles non-JSON certificates, and the provided replay script exercises that .pkl
path by default.

verifier/verify_exact_fixed_gram_dual.py[111-115]
scripts/run_full_replay.sh[26-33]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`verify_exact_fixed_gram_dual.py` treats any non-`.json` certificate as a pickle and unpickles it. Pickle is not a safe interchange format and can execute arbitrary code during deserialization.

### Issue Context
This verifier is positioned as an "independent exact replay" tool and is likely to be run by third parties. The repo’s own replay script also runs the verifier over a `.pkl` certificate, making the unsafe path the default.

### Fix Focus Areas
- verifier/verify_exact_fixed_gram_dual.py[106-123]
- scripts/run_full_replay.sh[26-33]

### Suggested fix
- Make JSON the only accepted certificate format by default.
- If you must keep pickle support for legacy/internal artifacts, require an explicit opt-in flag such as `--allow-unsafe-pickle` (and otherwise fail fast with a clear error message).
- Update `scripts/run_full_replay.sh` to either:
 - verify only the JSON certificate, or
 - pass `--allow-unsafe-pickle` explicitly when verifying the `.pkl` file (so the risk is visible and intentional).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. NumPy allow_pickle enabled 🐞 Bug ⛨ Security
Description
Both verifiers load c5lift_cache.npz with allow_pickle=True, which will unpickle object arrays
and can execute code if the .npz is attacker-controlled. This unnecessarily expands the trust
boundary for --flagsdp inputs.
Code

verifier/verify_exact_fixed_gram_dual.py[138]

+    lift = np.load(flagsdp / "c5lift_cache.npz", allow_pickle=True)
Evidence
The PR introduces new verifiers that explicitly pass allow_pickle=True when loading the .npz
lift cache.

verifier/verify_exact_fixed_gram_dual.py[136-139]
verifier/verify_moment_vector.py[83-89]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`np.load(..., allow_pickle=True)` enables deserializing pickled Python objects embedded in `.npz` files. That is unsafe if inputs can be swapped.

### Issue Context
The verifiers accept `--flagsdp` paths and then load `c5lift_cache.npz` with `allow_pickle=True`. The code then accesses only numeric arrays (`nJ`, `Dval`, `Drow`, `Dcol`), which typically do not require pickling.

### Fix Focus Areas
- verifier/verify_exact_fixed_gram_dual.py[136-139]
- verifier/verify_moment_vector.py[83-89]

### Suggested fix
- Switch to `np.load(..., allow_pickle=False)`.
- If the current upstream `.npz` truly requires pickling, add a safer guard:
 - load with `allow_pickle=False` first; if it fails, exit with an explicit message that the file format is unsupported rather than enabling pickle.
 - alternatively, validate that all loaded arrays have non-object dtypes before proceeding.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Fork-only multiprocessing context 🐞 Bug ☼ Reliability
Description
verifier/verify_moment_vector.py hard-codes mp.get_context("fork") when --jobs > 1, which
fails on Windows (no fork start method) and will break multi-core verification on that platform.
This is a reliability/portability issue because docs and CI set --jobs above 1.
Code

verifier/verify_moment_vector.py[R175-176]

+        context = mp.get_context("fork")
+        pool = context.Pool(processes=jobs)
Evidence
The code explicitly requests the fork context in the multi-process branch, which is not available
on Windows; the PR also provides scripts/docs that use --jobs > 1.

verifier/verify_moment_vector.py[167-177]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Using `mp.get_context("fork")` is not portable: Windows does not support the `fork` start method, causing an exception when `--jobs` is greater than 1.

### Issue Context
The verifier supports parallel execution via `--jobs`, and the full replay guidance/workflow uses multiple jobs.

### Fix Focus Areas
- verifier/verify_moment_vector.py[167-178]

### Suggested fix
- Use a platform-aware start method:
 - Prefer `fork` where available for performance, but fall back to `spawn` when `fork` is unavailable.
 - Example pattern: try `mp.get_context("fork")`, except `ValueError` then use `mp.get_context("spawn")`.
- Optionally print a short note when falling back (so reviewers understand performance differences).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can turn these tips off under Display preferences

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment on lines +113 to +115
else:
with args.certificate.open("rb") as handle:
certificate = pickle.load(handle)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Unsafe pickle certificate load 🐞 Bug ⛨ Security

verifier/verify_exact_fixed_gram_dual.py will pickle.load() any non-JSON --certificate,
enabling arbitrary code execution if a user points the verifier at an untrusted .pkl file. The
replay script explicitly iterates over erdos23_global_exact_dual.pkl, encouraging this unsafe path
by default.
Agent Prompt
### Issue description
`verify_exact_fixed_gram_dual.py` treats any non-`.json` certificate as a pickle and unpickles it. Pickle is not a safe interchange format and can execute arbitrary code during deserialization.

### Issue Context
This verifier is positioned as an "independent exact replay" tool and is likely to be run by third parties. The repo’s own replay script also runs the verifier over a `.pkl` certificate, making the unsafe path the default.

### Fix Focus Areas
- verifier/verify_exact_fixed_gram_dual.py[106-123]
- scripts/run_full_replay.sh[26-33]

### Suggested fix
- Make JSON the only accepted certificate format by default.
- If you must keep pickle support for legacy/internal artifacts, require an explicit opt-in flag such as `--allow-unsafe-pickle` (and otherwise fail fast with a clear error message).
- Update `scripts/run_full_replay.sh` to either:
  - verify only the JSON certificate, or
  - pass `--allow-unsafe-pickle` explicitly when verifying the `.pkl` file (so the risk is visible and intentional).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


with (flagsdp / "cache_n9.pkl").open("rb") as handle:
cache = pickle.load(handle)
lift = np.load(flagsdp / "c5lift_cache.npz", allow_pickle=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Numpy allow_pickle enabled 🐞 Bug ⛨ Security

Both verifiers load c5lift_cache.npz with allow_pickle=True, which will unpickle object arrays
and can execute code if the .npz is attacker-controlled. This unnecessarily expands the trust
boundary for --flagsdp inputs.
Agent Prompt
### Issue description
`np.load(..., allow_pickle=True)` enables deserializing pickled Python objects embedded in `.npz` files. That is unsafe if inputs can be swapped.

### Issue Context
The verifiers accept `--flagsdp` paths and then load `c5lift_cache.npz` with `allow_pickle=True`. The code then accesses only numeric arrays (`nJ`, `Dval`, `Drow`, `Dcol`), which typically do not require pickling.

### Fix Focus Areas
- verifier/verify_exact_fixed_gram_dual.py[136-139]
- verifier/verify_moment_vector.py[83-89]

### Suggested fix
- Switch to `np.load(..., allow_pickle=False)`.
- If the current upstream `.npz` truly requires pickling, add a safer guard:
  - load with `allow_pickle=False` first; if it fails, exit with an explicit message that the file format is unsupported rather than enabling pickle.
  - alternatively, validate that all loaded arrays have non-object dtypes before proceeding.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +175 to +176
context = mp.get_context("fork")
pool = context.Pool(processes=jobs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

3. Fork-only multiprocessing context 🐞 Bug ☼ Reliability

verifier/verify_moment_vector.py hard-codes mp.get_context("fork") when --jobs > 1, which
fails on Windows (no fork start method) and will break multi-core verification on that platform.
This is a reliability/portability issue because docs and CI set --jobs above 1.
Agent Prompt
### Issue description
Using `mp.get_context("fork")` is not portable: Windows does not support the `fork` start method, causing an exception when `--jobs` is greater than 1.

### Issue Context
The verifier supports parallel execution via `--jobs`, and the full replay guidance/workflow uses multiple jobs.

### Fix Focus Areas
- verifier/verify_moment_vector.py[167-178]

### Suggested fix
- Use a platform-aware start method:
  - Prefer `fork` where available for performance, but fall back to `spawn` when `fork` is unavailable.
  - Example pattern: try `mp.get_context("fork")`, except `ValueError` then use `mp.get_context("spawn")`.
- Optionally print a short note when falling back (so reviewers understand performance differences).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant