Skip to content

Reduce frame validation to complement masks - #338

Merged
Vilin97 merged 1 commit into
mainfrom
fix/frame-complement-checker
Aug 14, 2026
Merged

Vilin97 merged 1 commit into
mainfrom
fix/frame-complement-checker

Conversation

@Vilin97

@Vilin97 Vilin97 commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • prove that, for U = T \ I, replacing I by Uᶜ preserves the capacity side and can only add frame witnesses
  • enumerate the resulting 2^t support masks instead of all 3^t pairs I ⊆ T
  • retain ordinary kernel-checked rfl certificates, with no native_decide, trust escape hatch, option change, or resource-limit increase
  • migrate booster, exact-frame, and residue certificates to the single checker and remove the obsolete raw ternary checker

The change removes 682 lines and adds 169. FrameBoosters.lean shrinks from 350 lines to 113 while keeping only private staged certificate leaves plus one general public combination theorem.

Validation

  • fresh-head Lean Action CI: all shards, assembly, linters, and quality checks green
  • lake build LeanPool.FrontierMathOpenHypergraphs
  • lake exe lint-style on all four changed modules
  • lake exe runLinter on all four changed modules
  • git diff --check

Proof profiling reports 447 → 203 deterministic heartbeat units (-54.6%) and 197 → 74 declarations. Its head-side file rows are partial because the profiler measures modified files against base dependency oleans, where the new checker does not exist. A valid same-machine direct Lean comparison with each revision’s own dependencies and fresh target outputs gives FrameBoosters 265.18s → 84.16s wall (-68.3%) and 702.30s → 218.21s user CPU (-68.9%); both runs completed successfully. Current-head LLM review approves with no tech debt, improved maintainability, greater robustness, and low risk; current-head Greptile gives 5/5 with no findings.

@Vilin97
Vilin97 changed the base branch from fix/exposition-syntax-replay to bump/exposition-syntax-replay August 13, 2026 20:22
@greptile-apps

greptile-apps Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR replaces ternary (T, I) frame validation with complement-mask validation over U = T \ I, reducing certificate enumeration from 3^t to 2^t.

  • Proves that complement checks imply every original frame inequality.
  • Adds a binary mask checker and its soundness theorem.
  • Migrates booster, exact-frame, and residue certificates to the new checker.
  • Removes the obsolete raw ternary checker and supporting proof machinery.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameDefs.lean Introduces the complement reduction, binary mask enumeration, and kernel-checked soundness proof while removing the raw ternary checker.
LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean Migrates booster certificates to complement masks, retaining correctly staged leaves for the larger specifications.
LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameExact.lean Migrates all exact small-frame certificates to the complement checker without changing bank indices.
LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameResidues.lean Migrates all residue-gadget certificates to the complement checker without changing bank indices.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Choose support mask U] --> B[Check witnesses for T = univ and I = complement U]
  B --> C[Bound witnesses by sum of capacities over U]
  D[Arbitrary I subset T] --> E[Set U = T minus I]
  E --> F[Original witnesses are included in complement witnesses]
  C --> G[Original frame inequality]
  F --> G
Loading

Reviews (2): Last reviewed commit: "Reduce frame validation to complement ma..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown
Contributor

Proof profile (new / modified Lean files)

Statement changes

⚠️ 10 declarations changed their statement across 1 file — a statement change is more than a refactor. Confirm each one is intended.

⚠️ Statements changed (10)
  • HypergraphLowerBound.booster_4_check_0 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_check_1 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_0 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_1 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_0 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_00 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_01 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_1 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_10 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_11 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean

Also: 10 declarations added, 80 removed. A reorganization moves declarations between files, which shows up here as an add in one file and a remove in another.

➕ Declarations added (10)
  • HypergraphLowerBound.booster_4_checkComplementValid — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_checkComplementValid — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_checkComplementValid — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.FrameSpec.checkComplementValid — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameDefs.lean
  • HypergraphLowerBound.FrameSpec.checkComplementValid_sound — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameDefs.lean
  • HypergraphLowerBound.FrameSpec.isValid_of_complement_checks — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameDefs.lean
  • HypergraphLowerBound.checkComplementMasksDown — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameDefs.lean
  • HypergraphLowerBound.checkComplementMasksDown_sound — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameDefs.lean
  • HypergraphLowerBound.checkComplementMasksDown_step_true — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameDefs.lean
  • HypergraphLowerBound.maskFinset — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameDefs.lean
➖ Declarations removed (80)
  • HypergraphLowerBound.booster1Spec — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_1_check_0 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_1_check_1 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_1_check_2 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_1_rawCheckValid — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_check_00 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_check_01 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_check_02 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_check_10 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_check_11 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_check_12 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_check_2 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_check_20 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_check_21 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_check_22 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_4_rawCheckValid — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_00 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_01 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_02 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_10 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_11 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_12 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_2 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_20 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_21 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_check_22 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_5_rawCheckValid — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_000 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_001 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_002 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_010 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_011 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_012 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_02 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_020 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_021 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_022 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_100 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_101 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_102 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_110 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_111 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_112 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_12 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_120 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_121 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_122 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_200 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_201 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • HypergraphLowerBound.booster_6_check_202 — LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean
  • … +30 more

Statements are compared textually against the merge base (comments and whitespace ignored; by proof terms embedded in a type are treated as proof-irrelevant), the same method as physlib's /check-golf. Anonymous instances and examples are not tracked.

Compile cost of modified files — base → head

Heartbeats: 447 → 203 (-244, -54.6%). Declarations: 197 → 74.

Per-file wall sum: 699.6 s → 25.1 s (-96.4%). Wall clock is measured under parallel load and is noisy; heartbeats are deterministic and are the regression signal.

Files: 4 compared — 0 cheaper, 0 costlier, 4 within noise (threshold: |Δ heartbeats| ≥ 1,000 and ≥ 1%). Measurement errors: 0 base-side / 3 head-side file(s), marked ⚠; their heartbeat counts are partial.

Both sides are elaborated against the merge-base build of the pool — sound when only proofs and definition bodies change; a file whose statements changed may fail there and is flagged ⚠. Heartbeats come from Mathlib's linter.countHeartbeats, in maxHeartbeats units. Δ lines counts added/deleted lines from this PR diff.

File Δ lines HB base HB head Δ HB Δ HB % Wall base (s) Wall head (s)
LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameBoosters.lean ⚠ +44/-282 164 8 -156 -95.1% 618.06 6.28
LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameExact.lean ⚠ +21/-21 44 2 -42 -95.5% 47.26 6.37
LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameResidues.lean ⚠ +12/-12 26 2 -24 -92.3% 10.88 2.44
LeanPool/FrontierMathOpenHypergraphs/Uniform/FrameDefs.lean +92/-367 213 191 -22 -10.3% 23.38 10.03
Total +169/-682 447 203 -244 -54.6% 699.6 25.1

Advisory only — never blocks merge. Full log uploaded as the proof-profile artifact.

@Vilin97

Vilin97 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

The proof-profile warning is understood and the statement changes are intentional: all affected declarations are private certificate leaves whose types now mention the replacement binary checker. The profile’s head-side 6.28s row is partial because modified FrameBoosters.lean is deliberately measured against base dependency oleans, where the new FrameDefs declarations do not exist.

A valid same-machine comparison, invoking Lean directly with each revision’s own dependency setup and writing the target artifacts to a fresh temporary directory, gives:

  • base: 265.18s wall / 702.30s user
  • head: 84.16s wall / 218.21s user
  • wall reduction: 68.3%; CPU reduction: 68.9%

Both commands completed successfully. The hosted profile independently records the base at 618.06s under runner load and deterministic heartbeat totals falling 447 → 203 overall; its 3 head-side error markers are the expected cross-revision dependency limitation, not proof failures. Fresh-head Lean Action CI is green.

@Vilin97

Vilin97 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@Vilin97

Vilin97 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

@greptileai

@github-actions

Copy link
Copy Markdown
Contributor

🤖 LLM review — refactor (gpt-5.6-sol)

Reviewed head: c69e2a37b1fe74a8f4cc7e3f2350983156e69190

Verdict: ✅ approve

The refactor replaces the raw ternary-mask validator and its conversion machinery with a complement-mask reduction, a binary recursive checker, and shorter staged rfl certificates across boosters, exact frames, and residues. The new soundness argument retains explicit structure while removing substantial bespoke bitmask plumbing, and the reported heartbeat and wall-time reductions indicate lower compile cost.

Aspect Value
Scope checker redesign and certificate migration
Introduces tech debt ✅ no
Maintainability ✅ improved
Brittleness ✅ more_robust
Risk ✅ low

The smaller checker, simpler two-branch soundness proof, and reduced certificate tree leave this code easier to maintain and cheaper to compile without replacing structure with opaque automation.


Tokens: 18,799 in / 1,698 out · Tier: flex · Effort: xhigh · Cost: $0.0725
Automated review against .github/REFACTOR_REVIEW_RULES.md. Disagree? Reply on the PR; rules can be updated in a PR of their own.

@Vilin97
Vilin97 changed the base branch from bump/exposition-syntax-replay to main August 14, 2026 04:23
@Vilin97
Vilin97 merged commit 8853357 into main Aug 14, 2026
27 checks passed
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