Skip to content

WIP: Import Coarse-graining theory for elliptic equations - #507

Open
Vilin97 wants to merge 216 commits into
mainfrom
codex/import42-coarsegraining
Open

Vilin97 wants to merge 216 commits into
mainfrom
codex/import42-coarsegraining

Conversation

@Vilin97

@Vilin97 Vilin97 commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Imports scottnarmstrong/coarsegraining at 28ca42c02fd286c8f63a45be3344f6f82d026db3 into LeanPool.CoarseGraining.

The development covers function spaces, deterministic and probabilistic estimates, and quantitative stochastic homogenization, including the quenched minimal-scale theorem and a uniformly elliptic homogenization comparison estimate. All 1,590 production and required source modules remain included, with 1,640 destination files. The compatibility layer retains raw integral and cube-norm formulas for nonmeasurable inputs and proves bridges to current Mathlib seminorms under the appropriate measurability hypotheses. Endpoint descriptions retain their dimension, structural-law, adjoint-invariance, and force-regularity assumptions.

Current head (2026-10-02): Published b41b4be7f97cf915519120859baf1ec93825ca10, reconciled with the current bot branch and main c57dde95469483aaab58f4fac461f625468ebc29. The last complete, source-hash-guarded Lean 4.35.0-rc3 project build passed all 4,912 jobs with zero Lean errors; it still reported 2,456 distinct source warnings. Subsequent proof and formatting batches were validated with source-guarded scoped builds. The generated index checks (mk_all --check and the Python project-root check) and content-only diff against main pass. Fresh hosted CI on this head is running; Plan build has passed and Build pool is queued.

Open work: The zero-warning gate remains red on the previous hosted head, and the latest full local warning inventory is not yet refreshed after these scoped batches. Static-only quality still flags imported proofs above the 200-code-line limit. These source findings require proof and formatting changes before merge. No check, gate, waiver, compiler budget, or repository setting has been changed. Keep this PR WIP and unmerged.

Part of the requested 42-project import batch.

@Vilin97

Vilin97 commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

Changes requested by automated review

Reviewed exact head 78d00ae926b802f814dcefbc2bff1152e930dceb. The exact-head CoarseGraining build fails in multiple proof-bearing modules: rewrite failures and type mismatches in Besov/ProjectionCharacterization.lean, fractional Sobolev bridge and instance errors, CubePoisson solver rewrite/type errors, and unknown MeasureTheory.Measure.isProbabilityMeasure_map in HighContrast/Corridor/FixedPhase/EfronSteinAE.lean. Repair the imported closure, then rerun complete protected CI. Do not change the gates.

@Vilin97
Vilin97 marked this pull request as ready for review September 23, 2026 06:09
@Vilin97

Vilin97 commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@greptile-apps

greptile-apps Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Advisory cross-file review against Lean Pool's supervisory rubric. This is not by itself a significance, source-verification, or merge verdict.

Retrigger

[Low risk] Mathematical library code for coarse-graining theory.

The accepted finding is non-blocking: the two comparison proofs should share their norm conversion.

Findings

  1. P2 Two proofs repeat the conversion ▶
  2. P2 Comparison proofs repeat the work ▶
  3. P2 Returned coefficient lacks an identity ▶
  4. P2 Norm conversion is repeated ▶
  5. P2 Returned coefficient has no connection ▶

Summary

Adds LeanPool.CoarseGraining, with function spaces, deterministic estimates, probability results, and stochastic homogenization theorems.

  • The inspected headline wrappers retain dimension, structural-law, and force-regularity assumptions.
  • The fixed- and variable-exponent comparison proofs repeat the same norm conversion; a shared lemma would reduce maintenance work.
  • Review coverage is partial: the full diff was truncated, and not all 1,643 changed files were inspected. Complete import coverage, repository-wide novelty, full internal proof assumptions, measured cost, and upstream license/source fidelity remain unverified.
  • Vilin97 acknowledged warnings and proofs above the size limit as open work and requested that the PR remain WIP and unmerged.

Reviews (3) · Last reviewed commit: "Merge current main and migrate PR #507 t..." · Reviewed by Greptile

Comment thread LeanPool/projects.yml Outdated
@Vilin97

Vilin97 commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator Author

Changes requested by automated review

Reviewed exact current head 2491831fcf5ee7ebe6b201c364ff992a683ffd81. CoarseGraining still has rewrite/type mismatches across the Besov, fractional-Sobolev, CubePoisson, and high-contrast modules, including the unknown MeasureTheory.Measure.isProbabilityMeasure_map. Repair the dependent closure and rerun full protected CI.

@greptile-apps

This comment has been minimized.

@Vilin97

Vilin97 commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Changes requested by automated review

Reviewed head 73c0fd1364c20437f071b998b275b63436956e6d. Substantial completed uniformly elliptic specialization; not the entire broader homogenization program.

  1. Complete the pinned-toolchain integration. The previous source-identical build failed at a7f9659400e14e6834f3121b046284b32f6d9931. The same source-level blocker is present at this reviewed head; its error includes:

    error: LeanPool/CoarseGraining/Homogenization/Besov/ProjectionCharacterization.lean:63:6: Tactic `rewrite` failed: Did not find an occurrence of the pattern
    

    The file/dependency audit finds 1638 changed Lean files without the required module form. Repair the affected dependency closure, regenerate the module index, and obtain a warning-free full pool build plus the unchanged linter, quality and axiom gates. A project-only or previous-head build does not resolve this failure.

  2. Resolve the substantive source/interface defect. The endpoint setup includes 2 ≤ d and the structural law hypothesis includes adjoint invariance as well as stationarity/unit-range/isotropy. Disclose these conditions in the card’s quantitative-homogenization scope, or prove their removal. The current projection/ENNReal/CubePoisson elaboration failures also need repair.

Review coverage: complete changed-file inventory and full diff retained; 1638 changed project files, 575,301 lines, import reachability and executable trust-token scan; advertised endpoints and supporting definitions examined with bounded implementation sampling and existing review findings reconciled. Potential reusable value: Stochastic homogenization, cubes and PDE energy estimates. Source/provenance and prior-art evidence were considered separately from CI; these findings do not assert that every proof line was manually read. Earlier automated scores are advisory and are not approval of this failing head.

Exact-head reconciliation: the automatic main merge left all project Lean source and the pinned toolchain unchanged. This run restored the original parsed project card after the rebase parser dropped the title-first entry; parsed-card equality and the generated module-index check pass. The restoration is a narrowly scoped fast-forward commit from an isolated worktree. It does not repair the substantive blockers above; new CI is not assumed green.

github-actions Bot and others added 27 commits October 4, 2026 14:35
Preserve authored mathematics and metadata; regenerate public project indexes.
Comment on lines +561 to +565
have hB_le_H : B ≤ Kpos * H := by
dsimp [B, H, Kpos]
exact Ch03.Legacy.scaleNormalizedPositiveBesovVectorSeminormTwo_le_const_mul_sobolev
(originCube d m) (s := fixedComparisonS) g hs_pos hs_le_one hg
have hdata : E + B ≤ Kdata * (E + H) := by

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Comparison proofs repeat the work

homogenizationComparison_uniformEllipticity repeats the force-norm conversion and final estimate assembly from homogenizationComparison_uniformEllipticity_variableExponents. Changes to the compatibility bounds require the same repair in two proofs.

Extract the shared conversion into a helper that takes the exponent and the existing Besov estimate. Keep the law-independent choice of constants in the fixed-exponent theorem.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +459 to +460
∃ sigmaBar : ℝ,
0 < sigmaBar ∧

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Returned coefficient lacks an identity

The returned sigmaBar is constrained only by positivity. Neither ComparisonPair nor the estimate uses this witness; they use barSigmaLimit through S instead. A caller cannot identify the returned value with the homogenized coefficient from this theorem's type.

Remove the unused witness, or add sigmaBar = Ch05.Section57.barSigmaLimit S.hP S.hStruct.

Comment on lines +561 to +565
have hB_le_H : B ≤ Kpos * H := by
dsimp [B, H, Kpos]
exact Ch03.Legacy.scaleNormalizedPositiveBesovVectorSeminormTwo_le_const_mul_sobolev
(originCube d m) (s := fixedComparisonS) g hs_pos hs_le_one hg
have hdata : E + B ≤ Kdata * (E + H) := by

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Norm conversion is repeated

homogenizationComparison_uniformEllipticity repeats the constant bounds and Besov-to-Sobolev conversion from homogenizationComparison_uniformEllipticity_variableExponents. Both proofs establish hdata, apply the same two bridge lemmas, and finish with the same inequality chain. Maintainers must repair both copies when these dependencies change.

Extract a shared conversion lemma parameterized by the exponent and the internal estimate. Keep each theorem's choice of constants separate so the fixed theorem still chooses them before the law.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +459 to +460
∃ sigmaBar : ℝ,
0 < sigmaBar ∧

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Returned coefficient has no connection

homogenizationComparison_uniformEllipticity returns sigmaBar, but its statement only says that number is positive. Neither the comparison pair nor the estimate refers to it; both use the coefficient already fixed by S. Callers cannot prove that the returned number is that coefficient and must unpack an extra witness that gives them no useful information.

Remove this witness, or state that it equals Ch05.Section57.barSigmaLimit S.hP S.hStruct.

Comment on lines +561 to +576
have hB_le_H : B ≤ Kpos * H := by
dsimp [B, H, Kpos]
exact Ch03.Legacy.scaleNormalizedPositiveBesovVectorSeminormTwo_le_const_mul_sobolev
(originCube d m) (s := fixedComparisonS) g hs_pos hs_le_one hg
have hdata : E + B ≤ Kdata * (E + H) := by
have hE_le : E ≤ Kdata * E := by
calc
E = 1 * E := by ring
_ ≤ Kdata * E :=
mul_le_mul_of_nonneg_right hKdata_ge_one hE_nonneg
have hB_le_Kdata : B ≤ Kdata * H := by
exact hB_le_H.trans
(mul_le_mul_of_nonneg_right hKpos_le_Kdata hH_nonneg)
calc
E + B ≤ Kdata * E + Kdata * H := add_le_add hE_le hB_le_Kdata
_ = Kdata * (E + H) := by ring

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Two proofs repeat the conversion

homogenizationComparison_uniformEllipticity repeats the Besov-to-legacy conversion inside homogenizationComparison_uniformEllipticity_variableExponents: the same constants, data bound, negative-defect bound, and final multiplication. Changes to either bridge will need the same repair in both proofs.

Extract a shared conversion lemma parameterized by s and the incoming Besov bound. Keep each theorem's constant selection separate so the fixed-exponent theorem still chooses constants before the law.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This branch has not been deployed

No deployments
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