Repository navigation
Optimize FiveEighths cardinality bridge - #650
Conversation
|
Advisory cross-file review against Lean Pool's supervisory rubric. This is not by itself a significance, source-verification, or merge verdict. [Medium impact] No actionable defect was found in this proof-only change. SummaryReplaces the explicit cardinality equivalence in
Reviews (1) · Last reviewed commit: "Optimize commuting probability cardinali..." · Reviewed by Greptile |
There was a problem hiding this comment.
{
"summary": "At 21a45fe, commProb_eq_ncard_div_sq replaces a representation-only subtype equivalence with rw [commProb_def] followed by congr 1. Pinned Mathlib definitions identify Commute with multiplication equality and Nat.card of a set with Set.ncard, so no mathematical argument is hidden. Whole-file forward and inverse comparison preserves every statement, definition, import, and other proof. Exact-head Build pool and Build project succeeded. The reported 40.6% heartbeat reduction remains an author measurement; this review did not reproduce it. The configured review approves this exact head. The PR merged through the protected native queue on 2026-10-13 at 18:23:30 UTC. Combined Lean CI run 38444123438 succeeded at merge commit 018a230; the accepted proof blob is unchanged in that commit and current main.",
"assessment": {
"scope": "local proof simplification",
"introduces_tech_debt": false,
"maintainability": "improved",
"brittleness": "unchanged",
"risk": "low",
"assessment_one_sentence": "The targeted rewrite removes redundant representation plumbing while retaining a short, explicit proof and the complete public mathematics."
},
"verdict": "approve",
"findings": []
}
🤖 LLM review — refactor (
|
| Aspect | Value |
|---|---|
| Scope | proof golf |
| Introduces tech debt | ✅ no |
| Maintainability | ✅ improved |
| Brittleness | ➖ unchanged |
| Risk | ✅ low |
The refactor removes redundant proof machinery without introducing opaque automation or a material robustness risk, so it is safe to merge.
Tokens: 835,296 in / 6,998 out · Tier: codex-subscription · Effort: xhigh · Billing: Codex subscription quota (no API credits) · Estimated cost: $3.4462 (Standard API equivalent; uncached input) (long-context rate)
Automated review against .github/REFACTOR_REVIEW_RULES.md. Disagree? Reply on the PR; rules can be updated in a PR of their own.
Summary
Optimizes the existing
FiveEighthsTheoremproject at90a7c3320e0f79010d4ae72978377094092c546cby replacing the explicit subtype-cardinality equivalence incommProb_eq_ncard_div_sqwith Lean's definitional congruence after unfoldingcommProb_def. The public declaration and all project mathematics remain unchanged.Invariant audit
I generated a Lean environment manifest for all 45 declarations whose names contain
FiveEighths, recording each fully elaborated type, safety flag, and definition value (theorem proof values are intentionally excluded because proof terms may change). Comparing base and head found:Measurements
90a7c3320e0f79010d4ae72978377094092c546c21a45fec2357cd67bc7b2c42f9db1627ba2d0f26commProb_le_five_eighths_of_finitesource elaboration: 14,497,276 → 8,609,290 heartbeats (40.6% reduction), measured with Lean's synchronous command profiler andtrace.profiler.useHeartbeats=true.lake build LeanPool.FiveEighthsTheorem.Imports: base 1.53 s and optimized 1.70 s in separate runs; wall time is dominated by imports and varied with concurrent VM load, so the declaration heartbeat profile is the meaningful signal. A clean base build was 9.24 s; the clean optimized run rebuilt shared dependency caches and is not used as a direct comparison.Checks
lake build LeanPool.FiveEighthsTheoremlake build --wfail LeanPool.FiveEighthsTheoremlake exe mk_all --module --checklake exe runLinter LeanPool.FiveEighthsTheoremlake exe lint-style LeanPool.FiveEighthsTheoremlake shake --force --keep-public --explain LeanPool.FiveEighthsTheorem.Basic(no import reduction suggested)uv run python -m lean_pool.quality --repo .. --static-onlygit diff --checkThe full repository quality command was also attempted after the project build. It could not audit other projects because this worktree does not contain a full
LeanPoolbuild; it reported missing.oleanfiles for unbuilt projects. The selected project declaration manifest, build, linter, style, index, and static quality checks passed. CI's pool build is the complete repository validation.No CI/configuration/gate files or generated indexes were modified. This PR is intentionally open and has no auto-merge enabled.