Skip to content

Import GapCVP hardness formalization - #396

Open
Vilin97 wants to merge 4 commits into
mainfrom
codex/import-openai-gapcvp-2026-09-04
Open

Import GapCVP hardness formalization#396
Vilin97 wants to merge 4 commits into
mainfrom
codex/import-openai-gapcvp-2026-09-04

Conversation

@Vilin97

@Vilin97 Vilin97 commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Summary

Imports the GapCVP development from OpenAI's ten-proofs at canonical commit
94bc0feb6a9ff12c7d31d6de640a725c9d43d2b6. The port proves four headline
NP-hardness results for approximate closest vector, binary nearest codeword,
binary syndrome decoding, and finite p-norm GapCVP.

The canonical four GapCVP.Comparator statement chunks are preserved exactly:

  • gapCVP400IsNPHard
  • binaryNearestCodewordIsNPHard
  • binarySyndromeDecodingIsNPHard
  • finitePNormGapCVPIsNPHard

This also incorporates implementation and proof refactorings from Dean Cureton's
optimized fork at commit 30c21d72a2ee3308d66c945387729d736e0cb305, so the
project is registered with mix provenance and both authors are credited.

Optimization and audit

  • Replaced the umbrella Mathlib import with a measured narrow frontier. The
    target graph falls from 8,724 to 3,221 jobs (63.1%).
  • Split the development into bounded incremental modules: 69 files total,
    largest module 8,115 non-comment code lines, largest proof block 190 lines.
  • Removed 28 dead kernel declarations and added one shared proof helper in the
    initial port: kernel-visible declarations fall from 8,046 to 8,019; source
    declaration commands fall from 8,029 to 8,009.
  • The review refactor then replaced 25 declarations with 25 live shared
    abstractions while deleting 881 physical / 899 non-comment code lines. It
    factors 14 repeated failure-trace recursions, the non-comparison phases of
    the two comparator machines, and the exact/finite-p physical-routing split.
  • Recomputed the four-root source/kernel closure after all splitting and API
    changes: 8,019 / 8,019 declarations reachable, zero dead nodes.
  • Kept implementation-only helpers private and checked every new exported type
    for private-name leakage; the small shared API is consumed across modules.
  • Removed prohibited diagnostics/options and cleaned all linter/style findings.
  • Searched the existing pool for matching lattice, coding-theory, reduction, and
    complexity abstractions. None had genuinely matching interfaces, so this adds
    no cross-project dependency.

Canonical source size is 130,430 physical / 120,836 non-comment code lines. The
fully compliant and review-optimized port is 135,914 physical / 122,598
non-comment code lines; the increase is the required per-file
headers/documentation, 100-column formatting, and honest continuation-module
scaffolding. The declaration counts above capture the semantic DCE independently
of that formatting overhead.

The canonical monolith does not compile on the pool's Lean 4.34 toolchain (it
stops at 100 errors after 2:05, peak RSS 11.07 GB). A true clean build of this
port succeeds in 4:41 at peak RSS 4.54 GB (3,221 jobs). The final dependency
extractor runs in 39.9s at peak RSS 5.52 GB.

Verification

  • lake build LeanPool.GapCVP
  • lake exe runLinter with all 69 GapCVP modules enumerated explicitly
  • lake exe lint-style with all 69 GapCVP modules enumerated explicitly
  • lake exe mk_all --check
  • current-main aggregate LeanPool.lean collision compile
  • full repository quality audit in the aggregate environment
  • exact normalized source-signature comparison for all four endpoints
  • #print axioms for all four endpoints: only propext, Classical.choice,
    and Quot.sound
  • compiled dependency extraction and four-root closure audit

@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown

Greptile Summary

The PR imports and registers the GapCVP hardness formalization as a chain of incremental Lean modules.

  • Adds four formal NP-hardness results covering approximate GapCVP, binary nearest codeword, binary syndrome decoding, and finite rational p-norm GapCVP.
  • Connects all added modules to the project entry module and aggregate import root.
  • Registers source, license, authorship, provenance, and headline-result metadata in the project catalog.

Important Files Changed

Filename Overview
LeanPool/GapCVP/Part01A.lean Introduces the foundational problem definitions, encodings, reductions, and shared machine-proof infrastructure used throughout the formalization.
LeanPool/GapCVP/Part18.lean Exposes the four advertised NP-hardness endpoints, whose formal types align with the catalog claims examined during this review.
LeanPool/GapCVP.lean Defines the project entry module by importing the terminal module in the complete linear dependency chain.
LeanPool.lean Adds every GapCVP module to the repository-wide aggregate import list.
LeanPool/projects.yml Registers the GapCVP project, its four main results, source revision, license, authors, and mixed provenance.

Reviews (4): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Proof profile (new / modified Lean files)

lake build wall time (changed modules): 446.14 s (= 7.44 min) — user 864.29 s, sys 64.97 s.

This build covers the changed modules and their dependency cones on top of the restored cache. The serial per-file sums below are useful for ranking slow files, not as a build budget.

Total heartbeats: 31,314 maxHeartbeats units across 69 files (136,795 added LOC).

Sum of lean --profile: 766440.4 ms (= 766.44 s). Import-excluded time: 644850.4 ms (= 644.85 s).

Count-heartbeats wall-clock total: 760.03 s. Repeated import cost inside lean --profile: 121590.0 ms (= 121.59 s).

Heartbeat values come from Mathlib's linter.countHeartbeats and are already in maxHeartbeats units. Per-file wall clocks are measured under parallel load and are noisier than heartbeats.

LOC counts added lines in the profiled Lean files from this PR diff.

File LOC Heartbeats (maxHB) Count wall (s) lean --profile (s) Without import (s) Import (s) Decls Errors
LeanPool/GapCVP/Part09.lean 8,644 14,859 44.73 66.84 64.94 1.90 428 0
LeanPool/GapCVP/Part01A.lean 7,748 1,185 22.67 30.04 28.39 1.65 495 0
LeanPool/GapCVP/Part08D.lean 5,839 1,168 19.29 24.64 22.89 1.75 384 0
LeanPool/GapCVP/Part13.lean 7,782 1,112 41.17 64.66 62.69 1.97 556 0
LeanPool/GapCVP/Part14B.lean 7,595 920 40.75 37.66 35.72 1.94 460 0
LeanPool/GapCVP/Part11C.lean 5,669 916 10.58 13.87 12.00 1.87 458 0
LeanPool/GapCVP/Part15.lean 7,711 862 23.84 37.25 35.30 1.95 431 0
LeanPool/GapCVP/Part10B.lean 4,419 722 14.93 13.74 11.83 1.91 361 0
LeanPool/GapCVP/Part12C.lean 4,068 592 37.73 27.58 25.68 1.90 296 0
LeanPool/GapCVP/Part03D.lean 2,316 590 16.72 12.81 11.15 1.66 109 0
LeanPool/GapCVP/Part06D.lean 3,800 522 15.21 14.06 12.37 1.69 261 0
LeanPool/GapCVP/Part02.lean 8,460 494 14.42 19.95 18.30 1.65 247 0
LeanPool/GapCVP/Part16A.lean 6,038 450 22.03 25.19 23.26 1.93 225 0
LeanPool/GapCVP/Part10A.lean 3,524 445 29.07 28.31 26.41 1.90 188 0
LeanPool/GapCVP/Part08A.lean 1,500 427 4.63 4.09 2.36 1.73 65 0
LeanPool/GapCVP/Part06A.lean 2,466 382 8.98 10.56 8.89 1.67 191 0
LeanPool/GapCVP/Part12B.lean 2,302 376 7.11 7.94 6.06 1.88 188 0
LeanPool/GapCVP/Part11B.lean 2,003 342 11.04 10.67 8.80 1.87 171 0
LeanPool/GapCVP/Part03C.lean 2,312 280 18.57 26.19 24.53 1.66 140 0
LeanPool/GapCVP/Part07C.lean 2,055 260 7.88 7.09 5.42 1.67 130 0
LeanPool/GapCVP/Part05C.lean 1,821 246 12.01 12.27 10.61 1.66 123 0
LeanPool/GapCVP/Part05B.lean 1,788 244 11.82 14.63 12.95 1.68 122 0
LeanPool/GapCVP/Part07A.lean 1,976 242 5.63 5.39 3.72 1.67 121 0
LeanPool/GapCVP/Part03A.lean 2,181 236 9.97 9.73 8.07 1.66 118 0
LeanPool/GapCVP/Part04F.lean 1,801 232 11.40 13.35 11.65 1.70 116 0
LeanPool/GapCVP/Part05D.lean 1,844 214 10.07 10.93 9.26 1.67 107 0
LeanPool/GapCVP/Part16B.lean 1,688 196 18.20 17.21 15.27 1.94 98 0
LeanPool/GapCVP/Part17.lean 2,342 192 10.77 11.92 9.98 1.94 96 0
LeanPool/GapCVP/Part12D.lean 1,561 188 9.72 6.49 4.55 1.94 94 0
LeanPool/GapCVP/Part07D.lean 1,550 184 14.59 14.25 12.55 1.70 92 0
LeanPool/GapCVP/Part08C.lean 1,556 166 5.31 4.98 3.18 1.80 83 0
LeanPool/GapCVP/Part06B.lean 1,307 164 9.03 8.80 7.13 1.67 82 0
LeanPool/GapCVP/Part04B.lean 2,079 144 10.17 10.41 8.66 1.75 72 0
LeanPool/GapCVP/Part07B.lean 1,088 138 10.62 10.75 9.07 1.68 69 0
LeanPool/GapCVP/Part18.lean 763 130 6.07 4.99 3.05 1.94 65 0
LeanPool/GapCVP/Part04E.lean 1,094 128 8.28 8.64 6.97 1.67 64 0
LeanPool/GapCVP/Part05E.lean 1,146 120 7.75 5.93 4.26 1.67 60 0
LeanPool/GapCVP/Part03E.lean 847 118 13.97 14.78 13.09 1.69 59 0
LeanPool/GapCVP/Part04D.lean 1,255 118 5.91 5.13 3.49 1.64 59 0
LeanPool/GapCVP/Part05F.lean 943 114 6.17 3.72 2.05 1.67 57 0
LeanPool/GapCVP/Part08B.lean 937 102 5.70 5.19 3.41 1.78 51 0
LeanPool/GapCVP/Part04C.lean 1,144 94 7.03 4.97 3.33 1.64 47 0
LeanPool/GapCVP/Part05A.lean 806 88 8.34 7.11 5.44 1.67 44 0
LeanPool/GapCVP/Part03B.lean 701 82 7.21 5.33 3.67 1.66 41 0
LeanPool/GapCVP/Part04A.lean 735 78 7.97 8.04 6.36 1.68 39 0
LeanPool/GapCVP/Part07E.lean 838 78 3.78 2.84 1.16 1.68 39 0
LeanPool/GapCVP/Part01B.lean 447 72 4.86 2.46 0.78 1.68 36 0
LeanPool/GapCVP/Part03F.lean 1,094 54 5.42 4.12 2.43 1.69 27 0
LeanPool/GapCVP/Part11A.lean 399 48 4.83 2.63 0.76 1.87 24 0
LeanPool/GapCVP/Part07G.lean 398 44 4.10 2.25 0.57 1.68 22 0
LeanPool/GapCVP/Part14A.lean 338 40 7.24 3.82 1.89 1.93 20 0
LeanPool/GapCVP/Part06C.lean 584 36 6.63 3.28 1.60 1.68 18 0
LeanPool/GapCVP/Part07F.lean 344 32 3.62 2.26 0.59 1.67 16 0
LeanPool/GapCVP/Part04G.lean 408 24 6.18 2.90 1.23 1.67 12 0
LeanPool/GapCVP/Part03G.lean 451 14 4.60 2.95 1.27 1.68 7 0
LeanPool/GapCVP/Part12A.lean 162 10 5.11 2.83 0.94 1.89 5 0
LeanPool/GapCVP.lean 20 0 4.08 2.13 0.24 1.89 0 0
LeanPool/GapCVP/Part01.lean 9 0 3.77 1.85 0.21 1.64 0 0
LeanPool/GapCVP/Part03.lean 9 0 4.69 1.87 0.22 1.65 0 0
LeanPool/GapCVP/Part04.lean 9 0 3.51 1.94 0.22 1.72 0 0
LeanPool/GapCVP/Part05.lean 9 0 4.31 1.91 0.23 1.68 0 0
LeanPool/GapCVP/Part06.lean 9 0 3.77 1.88 0.21 1.67 0 0
LeanPool/GapCVP/Part07.lean 9 0 2.88 1.90 0.22 1.68 0 0
LeanPool/GapCVP/Part08.lean 9 0 4.01 1.96 0.22 1.74 0 0
LeanPool/GapCVP/Part10.lean 9 0 5.70 2.08 0.22 1.86 0 0
LeanPool/GapCVP/Part11.lean 9 0 5.89 2.11 0.23 1.88 0 0
LeanPool/GapCVP/Part12.lean 9 0 4.72 2.10 0.22 1.88 0 0
LeanPool/GapCVP/Part14.lean 9 0 4.44 2.16 0.23 1.93 0 0
LeanPool/GapCVP/Part16.lean 9 0 6.83 2.16 0.23 1.93 0 0
Total 136,795 31,314 760.03 766.44 644.85 121.59 7989 0

Aggregate phase totals

Phase Time
tactic execution 201593.3 ms (= 201.59 s)
import 121590.0 ms (= 121.59 s)
interpretation 85579.0 ms (= 85.58 s)
typeclass inference 76797.9 ms (= 76.80 s)
simp 73299.0 ms (= 73.30 s)
elaboration 69877.5 ms (= 69.88 s)
blocked (unaccounted) 41361.1 ms (= 41.36 s)
type checking 40351.8 ms (= 40.35 s)
tacticAnalysis 14438.8 ms (= 14.44 s)
linting 7278.9 ms (= 7.28 s)
process pre-definitions 6488.2 ms (= 6.49 s)
parsing 6034.6 ms (= 6.03 s)

Slowest changed modules (from lake build)

Changed module Lake time
LeanPool.GapCVP.Part09 26.00 s
LeanPool.GapCVP.Part13 25.00 s
LeanPool.GapCVP.Part01A 20.00 s
LeanPool.GapCVP.Part14B 19.00 s
LeanPool.GapCVP.Part12C 17.00 s
LeanPool.GapCVP.Part15 13.00 s
LeanPool.GapCVP.Part10A 12.00 s
LeanPool.GapCVP.Part08D 11.00 s
LeanPool.GapCVP.Part16A 11.00 s
LeanPool.GapCVP.Part02 10.00 s
LeanPool.GapCVP.Part03C 10.00 s
LeanPool.GapCVP.Part07D 10.00 s

Comment truncated to fit GitHub's 64 KB limit. This PR profiles 69 files; the per-file table shows only the 69 hottest by heartbeats. The full table and raw lean --profile output for every file are in the run's step summary and proof-profile artifact.

Advisory only — never blocks merge.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🤖 LLM review (gpt-5.6-sol, 5 rubrics)

Reviewed head: a7499683d7798153c347246a73c481701132ff35

Verdict: 🤔 needs_discussion — computed from the rubric verdicts below, not chosen by a model.

Rubric Verdict Bottom line
Faithfulness 🤔 discuss The card and all four claimed endpoint statements are elided, so their quantifiers, hypotheses, and conclusions cannot be audited for faithfulness.
Novelty pass The prior-art searches ran for all four headlines and found no Mathlib or pooled declaration proving any of them.
Significance pass This is research-level theory building around a named hardness result for approximate closest vector.
Sources pass The identified upstream formalizations are credited, but the cited repository’s support for the claimed hardness endpoints is unverifiable from the partial diff.
Code quality (advisory) 🤔 discuss The simulation code is competent, but the comparator and statement-lifting paths duplicate enough proof infrastructure that a maintainer should decide whether to require another abstraction pass.
Aspect Value
Proves the claim unverifiable
Assumed, not proved Unverifiable: the headline theorem statements and the card summaries that would disclose bundled hypotheses are both omitted.
Matches cited source 🟡 unverifiable
Fit good_fit
Level research
Branch lattice complexity
Mode theory_building
Code quality 3 / 5

Statement check: The visible Lean contains supporting constructions, while the statements of gapCVP400IsNPHard, binaryNearestCodewordIsNPHard, binarySyndromeDecodingIsNPHard, and finitePNormGapCVPIsNPHard are absent.

The Lean develops polynomial-time Turing-machine, tableau, and CNF-reduction infrastructure toward GapCVP.Comparator.gapCVP400IsNPHard, a substantive result in lattice-based computational complexity.

Faithfulness findings (1)

  • elided-headlineLeanPool/GapCVP/Part18.lean
    Provide the card and the complete Lean statements of all headline declarations; without them, this review cannot compare the claimed NP-hardness results against their formal quantifiers, approximation regimes, reductions, or assumed inputs.
    Evidence: prose only

Code quality findings (2)

  • duplicate-proof-structurePR-wide
    Part03G and Part04B separately implement the same malformed length-prefixed-input case tree: missing first record, truncated first record, missing second record, truncated second record, and the total dispatcher. The trace composition and budget arguments are correspondingly parallel. Extend the existing DelimitedCompareTrace abstraction to cover these malformed branches, parameterized by the comparator step and output semantics, so parser or phase changes do not require synchronized edits to both families.
    Evidence: In LeanPool/GapCVP/Part03G.lean, delimitedCompare_totalTrace contains:
    cases unaryInputSplit input with | inl witness => obtain ⟨count, hinput⟩ := witness subst input exact delimitedCompare_missingFirstTrace count

In LeanPool/GapCVP/Part04B.lean, certifiedNatural_totalTrace repeats the dispatcher as:
cases unaryInputSplit input with | inl witness => obtain ⟨count, hinput⟩ := witness subst input exact certifiedNatural_missingFirstTrace count

The two files also separately declare delimitedCompare_truncatedFirstTrace, delimitedCompare_missingSecondTrace, delimitedCompare_truncatedSecondTrace and their certifiedNatural_ counterparts.

  • duplicate-definitionPR-wide
    The PR defines several independent recursive embeddings of Turing.TM2.Stmt, followed by parallel constructor-by-constructor simulation proofs. A reusable statement homomorphism parameterized by stack and label embeddings, state projection, and halt continuation would centralize this machinery. As written, changes to the statement language require synchronized updates to liftValidStatement, liftBoundedFoldWorkerStatement, liftFormulaPreservationCanonicalStmt, and liftOriginalSourcePreservingStatement, together with their stepAux proofs.
    Evidence: LeanPool/GapCVP/Part04D.lean contains:
    private def liftBoundedFoldWorkerStatement (tm : Turing.FinTM2) : Turing.TM2.Stmt tm.Γ tm.Λ tm.σ → Turing.TM2.Stmt (boundedFoldAlphabet tm) (BoundedFoldLabel tm) (BoundedFoldState tm) | .push k f next => .push (.inl k) (fun state => f state.2) (liftBoundedFoldWorkerStatement tm next)

LeanPool/GapCVP/Part05D.lean repeats the same traversal pattern:
private def liftOriginalSourcePreservingStatement (tm : Turing.FinTM2) : Turing.TM2.Stmt tm.Γ tm.Λ tm.σ → Turing.TM2.Stmt (originalSourcePreservingAlphabet tm) (OriginalSourcePreservingLabel tm) (OriginalSourcePreservingState tm) | .push stack value next => .push (.inl stack) (fun state => value state.2) (liftOriginalSourcePreservingStatement tm next)

The corresponding proofs are independently declared as liftBoundedFoldWorkerStatement_stepAux and liftOriginalSourcePreservingStatement_stepAux; the same file set also contains liftValidStatement_stepAux and liftFormulaPreservationCanonicalStmt_stepAux.


Tokens: 1,180,466 in / 14,954 out across 5 rubric calls · Tier: flex · Effort: xhigh · Cost: $3.1755
Each rubric is an independent review against .github/review-rubrics/ on top of .github/REVIEW_RULES.md. Disagree? Reply on the PR; rules can be updated in a PR of their own.

@Vilin97

Vilin97 commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

Addressed every code-quality finding at a7499683:

  • Removed the two redundant Fintype instances and verified the four endpoint closures no longer mention them.
  • Deleted all three empty continuation namespace shells.
  • Replaced the duplicated comparator pipeline with a documented NonComparisonStepLift interface and shared trace constructors/assembly. The two machines now share every non-comparison phase; phase 6 is the only specialized proof.
  • Promoted the generic stack sweep to TraceGolf and rewrote 14 repeated failure/cleanup recursions as chained sweeps; the old local helper and resulting dead wrappers are gone.
  • Removed the four exact theorem aliases and redirected every consumer to the original declarations.

The same pass also factored the 87%-similar exact/finite-p physical-routing case split through one narrowly scoped helper. Overall this review commit is 1,171 additions / 2,052 deletions (net -881 physical lines and -899 non-comment code lines). It replaces 25 declarations with 25 shared declarations, and the refreshed source+kernel closure finds all 8,019 project declarations reachable from the four endpoints (dead: 0).

For the faithfulness concern, Part18.lean remains byte-identical to the reviewed/canonical import, and all four normalized endpoint signatures remain exact. Their axiom sets are exactly [propext, Classical.choice, Quot.sound].

Exact-head verification is green: true clean 3,221-job build, aggregate collision compile, full quality audit, mk_all --check, explicit all-69-module Mathlib linter and style runs, proof-size maximum 190, and unchanged endpoint signature/axiom transcripts.

# Conflicts:
#	LeanPool/projects.yml
@Vilin97

Vilin97 commented Sep 5, 2026

Copy link
Copy Markdown
Owner Author

Automation disposition: needs-maintainer

Reviewed exact head ccb79d32da26322132aafb1d5449065e5d2baa32. The four GapCVP endpoint statements and the exact-head Lean/quality/trust gates are green, and the project is research-level and source-pinned. A safe autonomous merge is not justified: the import is 69 files / 136,033 added lines with a 446.14 s profile and roughly 4.5 GiB peak RSS, while the prior exact-head LLM review was necessarily partial and identified repeated machine-trace and statement-lifting families. Deciding whether this generated-scale architecture and compile burden meet the pool's maintainability bar requires a maintainer; no unrelated code change is requested.

@Vilin97 Vilin97 added the needs-maintainer Requires a maintainer decision; automation must not merge label Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-maintainer Requires a maintainer decision; automation must not merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant