Skip to content

Import model-robust linear regression formalization - #373

Open
Vilin97 wants to merge 12 commits into
mainfrom
import/linear-model-lean
Open

Import model-robust linear regression formalization#373
Vilin97 wants to merge 12 commits into
mainfrom
import/linear-model-lean

Conversation

@Vilin97

@Vilin97 Vilin97 commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Summary

Imports the complete public v0.1 source closure of The Linear Model in Lean into
LeanPool.LinearModel. The development formalizes model-robust fixed-design
linear regression and includes:

  • a Lindeberg central limit theorem;
  • asymptotic normality of scalar OLS projections;
  • entrywise consistency of HC0--HC3 sandwich estimators;
  • conservative heteroscedasticity-robust p-values under misspecification; and
  • exact equality of the two-sample HC2 statistic with Welch's t-statistic.

The import contains all 15 upstream Lean files (5,215 upstream physical lines)
and adds one pool root module. After namespace, compatibility, documentation,
and proof-structure changes, the pool project is 5,466 lines across 16 modules
(5,437 lines in the imported tree plus the 29-line pool root module).

Acquisition evidence

  • Run time: 2026-09-01T01:44:22-07:00.
  • Eligibility interval: [2026-07-01T01:44:22-07:00,
    2026-08-25T01:44:22-07:00).
  • Source: https://github.com/lean-statistics/linear-model-lean
  • Exact source commit: c83dad11e730efc190f97a89a6fcec52370ae76d
  • Source commit author time: 2026-07-31T15:48:38+01:00.
  • Source commit time: 2026-07-31T18:33:39+01:00.
  • Repository creation: 2026-07-31T17:37:10Z.
  • First public release: v0.1, published 2026-07-31T17:53:50Z.
  • Release: https://github.com/lean-statistics/linear-model-lean/releases/tag/v0.1
  • Project listing: https://stat-lib.github.io/projects.html
  • License: Apache-2.0.
  • Authors: Patrick Rubin-Delanchy and Andrew Jones.
  • Provenance: mix. The upstream README says AI tools, principally Claude
    (Opus), assisted parts of the development and that the authors reviewed all
    definitions, theorem statements, and proofs.

The release, repository creation, and exact source commit all fall inside the
policy interval. The import is pinned to the exact commit rather than a moving
branch.

Discovery covered GitHub repositories, commits, releases, and issues; arXiv;
Reservoir's public package/index search; public web indexing for X; and the
public Zulip archive. X timelines were not accessible without authentication,
the direct Zulip API returned 401, and the public Zulip archive stopped at
2026-02-28. Later narrow GitHub organization queries encountered a secondary
rate limit, after the broad candidate search and source verification had
completed.

Deduplication and overlap

  • Exact searches of open and closed pool issues and PRs found no occurrence of
    the source URL or exact source SHA.
  • The source is absent from the project registry and generated module index.
  • Searches of origin/main and the current Mathlib dependency found no exact
    declarations for the Lindeberg theorem, OLS projection CLT, HC sandwich
    consistency, robust p-value result, or HC2/Welch identity.
  • Conceptual pool searches for Lindeberg conditions, heteroscedastic sandwich
    inference, and the principal declaration names returned no competing
    formalization.

Port and quality work

  • Rewrote internal imports under LeanPool.LinearModel and wrapped the complete
    source in that namespace.
  • Ported from Lean 4.30.0-rc2 / Mathlib 1b6244ba to the pool's Lean
    4.34.0-rc1 / current Mathlib without changing theorem statements or
    assumptions.
  • Updated the Gaussian singleton-null instance, explicit function-composition
    reductions in two convergence proofs, a ConservativeTail unfolding, and a
    renamed Set membership lemma.
  • Renamed four public snake_case declarations to pool style:
    isSpectralLb, isSpectralUb, IsPsd, and scaledMaxNormSq.
  • Added documentation for scalar AssumptionBundle fields and
    ConservativeTail.ν.
  • Removed the sole source linter suppression.
  • Split a 566-line proof into four mathematical error-term lemmas. The largest
    resulting proof is about 165 code lines; no proof-size threshold was changed
    or suppressed.
  • Replaced a few non-allowlisted Unicode glyphs in prose with Nbar, Dbar, sHat,
    and ybar. No declarations or proofs changed in that final cleanup.
  • The imported tree has no sorry, axiom, unsafe, native_decide, set_option, or
    command probes.

Five review passes

[
  {
    "pass": "faithfulness",
    "outcome": "pass",
    "evidence": [
      "All five advertised statements were inspected against the source.",
      "Fixed-design, moment, variance, leverage, and misspecification assumptions remain explicit.",
      "No hard result was replaced by a surrogate, axiom, or certificate-only statement.",
      "The complete imported source closure is present."
    ]
  },
  {
    "pass": "novelty",
    "outcome": "pass",
    "evidence": [
      "No source URL, SHA, principal declaration, or conceptual equivalent was found in the pool.",
      "No corresponding OLS/HC robust-inference development was found in the current Mathlib dependency."
    ]
  },
  {
    "pass": "significance",
    "outcome": "pass",
    "evidence": [
      "This is a coherent research-level mathematical statistics development, not an exercise or utility fragment.",
      "The chain joins a CLT, OLS asymptotics, robust covariance consistency, hypothesis testing, and Welch's identity."
    ]
  },
  {
    "pass": "sources",
    "outcome": "pass",
    "evidence": [
      "The exact repository, release, authors, license, commit, and AI provenance are recorded.",
      "All upstream proof modules and their index modules were included."
    ]
  },
  {
    "pass": "quality",
    "outcome": "pass",
    "score": 4,
    "evidence": [
      "The import is modular, specifically imported, documented, and free of generated proof bulk.",
      "The only oversized proof was structurally decomposed below the 200-line policy cap.",
      "Full build, lint, style, registry, trust, and proof-size gates pass without suppressions."
    ]
  }
]

Strong rejected candidates

  • lean-statistics/linear-model-lean — selected: complete, licensed, eligible,
    novel, research-level, and maintainable.
  • roos-j/lean-nct — held: approximately 125,708 lines with several source
    files above 10,000 lines and extensive heartbeat/linter overrides; requires
    substantial remediation.
  • deancureton/sphere-six-complex — rejected: approximately 106,095 lines,
    active-not-proof status, sorry/public axioms, and trust/options concerns.
  • edemaine/lean-trominoes — rejected: approximately 202,085 lines with large
    generated bulk and 2,206 trust/option hits including native_decide.
  • spectra-research/shannon-capacity-lean — rejected: native_decide,
    maxRecDepth/maxHeartbeats, and certificate-checking trust concerns.
  • CBirkbeck/chebotarev-density — rejected: substantive sorries, including in
    the main chain.
  • qinz1yang/differential-geometry — rejected as infeasible for a daily import:
    about 1.95 million lines, 3,681 files, and many global resource options.
  • theIceberg/Laplace-transform-in-Lean4 — rejected: no license and explicit
    reuse of unlicensed code.
  • davidturturean/erdos-456 — rejected: eleven literature/conjectural axioms.
  • davidturturean/erdos-870 and cameronfreer/exchangeability — rejected as
    ineligible: the visible August signal was a reindex; substantive completion
    was in June.
  • davidturturean/banlat and ravst/Hopscotch — rejected as ineligible because
    their substantive first releases predated the interval.

Build profiles

Profile Result Wall time Max RSS
Upstream v0.1, clean source build pass, 2,924 jobs 45.72 s 3,907,296 KB
Pool focused clean import rebuild pass, 3,173 jobs 30.73 s 3,794,576 KB
Pool worst-case transitive focused rebuild pass, 3,181 jobs 10m03.39s 3,795,236 KB
Full cold LeanPool aggregate pass, 9,360 jobs 42m54.79s 13,131,532 KB

The focused result is 32.8% faster than the upstream baseline, but this is
indicative rather than a strict comparison because the toolchains and
dependency graphs differ. The largest imported module improved from 16.0s to
4.5s after the proof decomposition.

Verification

  • lake build LeanPool.LinearModel
  • lake build LeanPool
  • scripts/ci/build-challenges.sh
  • lake exe runLinter LeanPool
  • lake exe lint-style LeanPool
  • cd python && uv sync --locked
  • cd python && uv run python -m lean_pool.quality --repo ..
  • lake exe mk_all --check
  • git diff --check
  • explicit trust scan over the imported tree

All pass. The challenge build emitted only its registry-approved sorry notices.
The aggregate build replayed pre-existing informational tactic suggestions in
unrelated projects; none came from LeanPool.LinearModel.

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown

Greptile Summary

The PR imports a model-robust fixed-design linear-regression formalization and registers it with the pool.

  • Adds Lindeberg CLT and OLS asymptotic-normality results.
  • Adds HC0–HC3 sandwich consistency, conservative robust inference, and the HC2/Welch identity.
  • Connects the new project through its umbrella modules, root import surface, and project catalog.

Important Files Changed

Filename Overview
LeanPool/LinearModel.lean Adds the project root, source attribution, and an accurate overview of the imported formalization.
LeanPool/LinearModel/Clt/LindebergCLT.lean Adds the triangular-array and sequence Lindeberg central limit theorems with explicit measurability, independence, moment, and positivity assumptions.
LeanPool/LinearModel/Ols/Assumptions.lean Defines the fixed-design assumption bundle and derives asymptotic normality for nonzero scalar OLS projections.
LeanPool/LinearModel/Ols/HCSandwichConsistency.lean Establishes entrywise consistency for general admissible HC multipliers and specializes it to HC0–HC3.
LeanPool/LinearModel/Ols/TTest.lean Adds conservative asymptotic rejection-probability and robust p-value results under the bundled assumptions.
LeanPool/LinearModel/Ols/Welch.lean Proves exact equality between the two-sample HC2-studentized contrast and Welch’s statistic.
LeanPool/projects.yml Registers the LinearModel project and its five principal results consistently with the added declarations.
LeanPool.lean Exposes the new LinearModel project and all constituent modules through the repository umbrella.

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

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Proof profile (new / modified Lean files)

lake build wall time (changed modules): 76.61 s (= 1.28 min) — user 119.38 s, sys 19.08 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: 2,252 maxHeartbeats units across 16 files (5,466 added LOC).

Sum of lean --profile: 106923.1 ms (= 106.92 s). Import-excluded time: 79183.1 ms (= 79.18 s).

Count-heartbeats wall-clock total: 120.86 s. Repeated import cost inside lean --profile: 27740.0 ms (= 27.74 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/LinearModel/Ols/HCSandwichConsistency.lean 1,325 858 15.39 21.44 19.62 1.82 60 0
LeanPool/LinearModel/Ols/TTest.lean 904 337 8.67 10.48 8.62 1.86 49 0
LeanPool/LinearModel/Ols/Assumptions.lean 345 301 8.93 6.74 4.88 1.86 14 0
LeanPool/LinearModel/Ols/ProjectionCLT.lean 296 146 7.39 4.92 3.11 1.81 15 0
LeanPool/LinearModel/Clt/LindebergCLT.lean 802 110 22.31 26.07 24.27 1.80 30 0
LeanPool/LinearModel/Ols/Welch.lean 308 104 6.32 6.95 5.06 1.89 26 0
LeanPool/LinearModel/Ols/Gram.lean 230 96 4.14 3.51 2.03 1.48 24 0
LeanPool/LinearModel/Ols/QuadForm.lean 364 93 5.72 5.23 3.81 1.42 31 0
LeanPool/LinearModel/Ols/ConvergenceInProbability.lean 247 70 3.95 3.61 1.80 1.81 9 0
LeanPool/LinearModel/Ols/Leverage.lean 165 68 6.49 2.96 1.19 1.77 17 0
LeanPool/LinearModel/Ols/Optimality.lean 126 28 5.87 2.34 0.85 1.49 7 0
LeanPool/LinearModel/Clt/ProductExpLimit.lean 129 25 6.19 3.06 1.41 1.65 5 0
LeanPool/LinearModel/Clt/TaylorErrorBound.lean 156 16 6.36 3.43 1.79 1.64 8 0
LeanPool/LinearModel.lean 29 0 4.51 2.06 0.26 1.80 0 0
LeanPool/LinearModel/Clt.lean 16 0 4.49 2.09 0.25 1.84 0 0
LeanPool/LinearModel/Ols.lean 24 0 4.13 2.05 0.25 1.80 0 0
Total 5,466 2,252 120.86 106.92 79.18 27.74 295 0

Aggregate phase totals

Phase Time
import 27740.0 ms (= 27.74 s)
typeclass inference 27124.0 ms (= 27.12 s)
interpretation 22758.0 ms (= 22.76 s)
tactic execution 10302.4 ms (= 10.30 s)
simp 4718.9 ms (= 4.72 s)
type checking 2612.9 ms (= 2.61 s)
elaboration 2488.6 ms (= 2.49 s)
blocked (unaccounted) 2098.3 ms (= 2.10 s)
tacticAnalysis 1361.0 ms (= 1.36 s)
norm_num 1147.2 ms (= 1.15 s)
ring 1136.6 ms (= 1.14 s)
linting 839.7 ms (= 0.84 s)

Slowest changed modules (from lake build)

Changed module Lake time
LeanPool.LinearModel.Clt.LindebergCLT 18.00 s
LeanPool.LinearModel.Ols.HCSandwichConsistency 9.90 s
LeanPool.LinearModel.Clt.TaylorErrorBound 9.50 s
LeanPool.LinearModel.Clt.ProductExpLimit 9.30 s
LeanPool.LinearModel.Ols.QuadForm 9.30 s
LeanPool.LinearModel.Ols.TTest 6.40 s
LeanPool.LinearModel.Ols.Assumptions 6.30 s
LeanPool.LinearModel.Ols.ConvergenceInProbability 5.00 s
LeanPool.LinearModel.Ols.Gram 4.00 s
LeanPool.LinearModel.Ols.Optimality 3.90 s
LeanPool.LinearModel.Ols.Welch 3.80 s
LeanPool.LinearModel.Ols.ProjectionCLT 3.60 s
Per-file `lean --profile` output

LeanPool/LinearModel.lean

import took 1.8s
cumulative profiling times:
	elaboration 0.316ms
	import 1.8s
	initialization 36.6ms
	interpretation 222ms
	linting 0.467ms
	module linting 0.00112ms
	overlappingInstancesLinter 0.796ms
	parsing 0.0556ms
	tacticAnalysis 1.53ms
real 2.80
user 1.58
sys 1.24

LeanPool/LinearModel/Clt.lean

import took 1.84s
cumulative profiling times:
	elaboration 0.146ms
	import 1.84s
	initialization 29.7ms
	interpretation 217ms
	linting 0.345ms
	module linting 0.00173ms
	overlappingInstancesLinter 0.489ms
	parsing 0.0285ms
	tacticAnalysis 0.981ms
real 2.83
user 1.59
sys 1.25

LeanPool/LinearModel/Clt/LindebergCLT.lean

import took 1.8s
simp took 260ms
simp took 179ms
interpretation of Mathlib.Meta.Positivity.evalPow._lam_4._boxed took 103ms
interpretation of Mathlib.Meta.Positivity.evalMul._lam_3._boxed took 138ms
interpretation of Lean.Elab.Tactic._aux_Mathlib_Tactic_Widget_Calc___elabRules_Lean_calcTactic_1._boxed took 1.79s
tactic execution of Mathlib.Tactic.FieldSimp.fieldSimp took 109ms
interpretation of Lean.Elab.Tactic._aux_Mathlib_Tactic_Widget_Calc___elabRules_Lean_calcTactic_1._boxed took 123ms
simp took 110ms
simp took 112ms
cumulative profiling times:
	attribute application 0.552ms
	blocked (unaccounted) 2.06s
	congr simp thm 36.5ms
	dsimp 42ms
	elaboration 387ms
	fix level params 7.44ms
	import 1.8s
	initialization 30.7ms
	instantiate metavars 20.9ms
	interpretation 6.08s
	let-to-have transformation 0.739ms
	linting 183ms
	module linting 0.00142ms
	norm_num 391ms
	overlappingInstancesLinter 22.2ms
	parsing 97.4ms
	process pre-definitions 139ms
	ring 183ms
	share common exprs 82.3ms
	simp 1.23s
	tactic execution 2.38s
	tacticAnalysis 259ms
	type checking 536ms
	typeclass inference 10.1s
real 14.96
user 23.24
sys 1.31

LeanPool/LinearModel/Clt/ProductExpLimit.lean

import took 1.65s
cumulative profiling times:
	attribute application 0.0618ms
	congr simp thm 1.81ms
	dsimp 12.6ms
	elaboration 39.6ms
	fix level params 0.684ms
	import 1.65s
	initialization 30.2ms
	instantiate metavars 1.08ms
	interpretation 524ms
	let-to-have transformation 0.107ms
	linting 14ms
	module linting 0.00135ms
	norm_num 64.2ms
	overlappingInstancesLinter 2.14ms
	parsing 8.67ms
	process pre-definitions 7.93ms
	ring 29ms
	share common exprs 6.63ms
	simp 49.8ms
	tactic execution 146ms
	tacticAnalysis 24.1ms
	type checking 56.2ms
	typeclass inference 389ms
real 3.01
user 2.61
sys 1.11

LeanPool/LinearModel/Clt/TaylorErrorBound.lean

import took 1.64s
cumulative profiling times:
	attribute application 0.0966ms
	congr simp thm 4.05ms
	elaboration 45.9ms
	fix level params 0.528ms
	import 1.64s
	initialization 29.9ms
	instantiate metavars 1.22ms
	interpretation 449ms
	let-to-have transformation 0.114ms
	linting 10.2ms
	module linting 0.00145ms
	norm_num 10.6ms
	overlappingInstancesLinter 3.34ms
	parsing 10.7ms
	process pre-definitions 6.34ms
	share common exprs 4.72ms
	simp 202ms
	tactic execution 296ms
	tacticAnalysis 28.5ms
	type checking 68.3ms
	typeclass inference 615ms
real 3.31
user 2.98
sys 1.14

LeanPool/LinearModel/Ols.lean

import took 1.8s
cumulative profiling times:
	elaboration 0.139ms
	import 1.8s
	initialization 32.9ms
	interpretation 213ms
	linting 0.298ms
	module linting 0.00136ms
	overlappingInstancesLinter 0.543ms
	parsing 0.0271ms
	tacticAnalysis 2.61ms
real 2.76
user 1.58
sys 1.20

LeanPool/LinearModel/Ols/Assumptions.lean

import took 1.86s
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 355ms
tactic execution of Mathlib.Tactic.FieldSimp.fieldSimp took 108ms
tactic execution of Mathlib.Tactic.nlinarith took 429ms
cumulative profiling times:
	attribute application 0.194ms
	blocked (unaccounted) 5.18ms
	congr simp thm 12.5ms
	dsimp 5.47ms
	elaboration 192ms
	fix level params 3.31ms
	import 1.86s
	initialization 37.7ms
	instantiate metavars 4.41ms
	interpretation 1.47s
	let-to-have transformation 0.229ms
	linting 43.8ms
	module linting 0.00146ms
	norm_num 30ms
	overlappingInstancesLinter 9.2ms
	parsing 31.6ms
	process pre-definitions 22.4ms
	ring 54ms
	share common exprs 28.4ms
	simp 58.1ms
	tactic execution 1.15s
	tacticAnalysis 80.8ms
	type checking 176ms
	typeclass inference 1.46s
real 6.55
user 6.17
sys 1.26

LeanPool/LinearModel/Ols/ConvergenceInProbability.lean

import took 1.81s
cumulative profiling times:
	attribute application 0.151ms
	blocked (unaccounted) 0.0492ms
	congr simp thm 2.77ms
	elaboration 70.3ms
	fix level params 1.29ms
	import 1.81s
	initialization 31.4ms
	instantiate metavars 2.8ms
	interpretation 611ms
	let-to-have transformation 0.155ms
	linting 31.7ms
	module linting 0.00138ms
	norm_num 46ms
	overlappingInstancesLinter 6.99ms
	parsing 26.7ms
	process pre-definitions 13.9ms
	ring 28.8ms
	share common exprs 9.03ms
	simp 141ms
	tactic execution 266ms
	tacticAnalysis 51.4ms
	type checking 84.9ms
	typeclass inference 373ms
real 3.39
user 3.09
sys 1.27

LeanPool/LinearModel/Ols/Gram.lean

import took 1.48s
cumulative profiling times:
	attribute application 0.302ms
	blocked (unaccounted) 1.06ms
	compilation (IR) 0.213ms
	compilation (LCNF base) 2.66ms
	compilation (LCNF impure) 1.13ms
	compilation (LCNF mono) 2.1ms
	congr simp thm 3.84ms
	elaboration 118ms
	fix level params 1.07ms
	import 1.48s
	initialization 29.6ms
	instantiate metavars 1.92ms
	interpretation 400ms
	let-to-have transformation 0.432ms
	linting 26.6ms
	module linting 0.00162ms
	norm_num 2.52ms
	overlappingInstancesLinter 7.54ms
	parsing 23.2ms
	process pre-definitions 13.4ms
	ring 11.7ms
	share common exprs 7.44ms
	simp 254ms
	tactic execution 161ms
	tacticAnalysis 51.8ms
	type checking 71.9ms
	typeclass inference 836ms
real 2.94
user 3.12
sys 1.09

LeanPool/LinearModel/Ols/HCSandwichConsistency.lean

import took 1.82s
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 168ms
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 199ms
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 120ms
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 685ms
simp took 342ms
interpretation of Lean.Elab.Tactic._aux_Mathlib_Tactic_Widget_Calc___elabRules_Lean_calcTactic_1._boxed took 157ms
tactic execution of Lean.Parser.Tactic.refine took 134ms
interpretation of Lean.Elab.Tactic._aux_Mathlib_Tactic_Widget_Calc___elabRules_Lean_calcTactic_1._boxed took 226ms
interpretation of Lean.Elab.Tactic._aux_Mathlib_Tactic_Widget_Calc___elabRules_Lean_calcTactic_1._boxed took 403ms
simp took 156ms
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 241ms
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 141ms
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 262ms
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 111ms
cumulative profiling times:
	attribute application 1.28ms
	blocked (unaccounted) 17ms
	compilation (IR) 0.0671ms
	compilation (LCNF base) 0.777ms
	compilation (LCNF impure) 0.313ms
	compilation (LCNF mono) 0.551ms
	congr simp thm 21.5ms
	dsimp 10.1ms
	elaboration 694ms
	fix level params 17.2ms
	import 1.82s
	initialization 30.3ms
	instantiate metavars 34.9ms
	interpretation 5.58s
	let-to-have transformation 1.1ms
	linting 232ms
	module linting 0.00123ms
	norm_num 357ms
	overlappingInstancesLinter 27.3ms
	parsing 155ms
	process pre-definitions 143ms
	ring 453ms
	share common exprs 212ms
	simp 1.15s
	tactic execution 2.81s
	tacticAnalysis 360ms
	type checking 698ms
	typeclass inference 6.61s
real 8.75
user 20.79
sys 1.32

LeanPool/LinearModel/Ols/Leverage.lean

import took 1.77s
cumulative profiling times:
	attribute application 0.178ms
	congr simp thm 1.45ms
	elaboration 71.5ms
	fix level params 0.498ms
	import 1.77s
	initialization 29.5ms
	instantiate metavars 0.549ms
	interpretation 349ms
	let-to-have transformation 0.161ms
	linting 14.3ms
	module linting 0.00152ms
	norm_num 0.276ms
	overlappingInstancesLinter 4.79ms
	parsing 13.8ms
	process pre-definitions 5.28ms
	ring 4.56ms
	share common exprs 3.19ms
	simp 87.6ms
	tactic execution 77.9ms
	tacticAnalysis 30.5ms
	type checking 29.3ms
	typeclass inference 469ms
real 3.18
user 2.44
sys 1.25

LeanPool/LinearModel/Ols/Optimality.lean

import took 1.49s
cumulative profiling times:
	attribute application 0.0699ms
	compilation (IR) 0.196ms
	compilation (LCNF base) 3.15ms
	compilation (LCNF impure) 0.949ms
	compilation (LCNF mono) 1.62ms
	congr simp thm 0.975ms
	elaboration 43.7ms
	fix level params 0.419ms
	import 1.49s
	initialization 31.1ms
	instantiate metavars 0.824ms
	interpretation 304ms
	let-to-have transformation 0.113ms
	linting 12.2ms
	module linting 0.00133ms
	norm_num 0.974ms
	overlappingInstancesLinter 3.5ms
	parsing 8.93ms
	process pre-definitions 4.92ms
	ring 17ms
	share common exprs 3.46ms
	simp 57.4ms
	tactic execution 69.5ms
	tacticAnalysis 25.7ms
	type checking 29.3ms
	typeclass inference 228ms
real 2.67
user 1.99
sys 1.04

LeanPool/LinearModel/Ols/ProjectionCLT.lean

import took 1.81s
tactic execution of Lean.Parser.Tactic.exact took 907ms
cumulative profiling times:
	attribute application 2.22ms
	congr simp thm 3.14ms
	elaboration 181ms
	fix level params 1.86ms
	import 1.81s
	initialization 29.4ms
	instantiate metavars 2.37ms
	interpretation 510ms
	let-to-have transformation 0.366ms
	linting 36ms
	module linting 0.00182ms
	norm_num 1.13ms
	overlappingInstancesLinter 8.98ms
	parsing 31.5ms
	process pre-definitions 18.2ms
	ring 22.6ms
	share common exprs 9.73ms
	simp 148ms
	tactic execution 1.25s
	tacticAnalysis 70.4ms
	type checking 101ms
	typeclass inference 684ms
real 3.94
user 4.37
sys 1.30

LeanPool/LinearModel/Ols/QuadForm.lean

import took 1.42s
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 223ms
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 138ms
typeclass inference of IsLeftCancelMulZero took 101ms
cumulative profiling times:
	attribute application 0.549ms
	blocked (unaccounted) 3.73ms
	compilation (IR) 0.11ms
	compilation (LCNF base) 3.34ms
	compilation (LCNF impure) 0.53ms
	compilation (LCNF mono) 2.46ms
	congr simp thm 4.11ms
	elaboration 141ms
	fix level params 2.34ms
	import 1.42s
	initialization 29.2ms
	instantiate metavars 6.38ms
	interpretation 1.15s
	let-to-have transformation 0.386ms
	linting 59.5ms
	module linting 0.0015ms
	norm_num 14.5ms
	overlappingInstancesLinter 9.86ms
	parsing 31.7ms
	process pre-definitions 26ms
	ring 75.3ms
	share common exprs 20.3ms
	simp 232ms
	tactic execution 437ms
	tacticAnalysis 103ms
	type checking 194ms
	typeclass inference 1.26s
real 3.44
user 4.82
sys 1.06

LeanPool/LinearModel/Ols/TTest.lean

import took 1.86s
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 481ms
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 1.07s
cumulative profiling times:
	attribute application 0.684ms
	blocked (unaccounted) 11.3ms
	compilation (IR) 0.0829ms
	compilation (LCNF base) 0.971ms
	compilation (LCNF impure) 0.417ms
	compilation (LCNF mono) 0.58ms
	congr simp thm 10.4ms
	dsimp 24ms
	elaboration 359ms
	fix level params 5.2ms
	import 1.86s
	initialization 28.9ms
	instantiate metavars 15.6ms
	interpretation 3.68s
	let-to-have transformation 0.739ms
	linting 130ms
	module linting 0.00147ms
	norm_num 218ms
	overlappingInstancesLinter 20.9ms
	parsing 91.7ms
	process pre-definitions 66.6ms
	ring 230ms
	share common exprs 68.1ms
	simp 202ms
	tactic execution 982ms
	tacticAnalysis 208ms
	type checking 338ms
	typeclass inference 1.93s
real 6.55
user 9.90
sys 1.27

LeanPool/LinearModel/Ols/Welch.lean

import took 1.89s
cumulative profiling times:
	attribute application 0.813ms
	compilation (IR) 0.211ms
	compilation (LCNF base) 2.2ms
	compilation (LCNF impure) 1.23ms
	compilation (LCNF mono) 2.04ms
	congr simp thm 13.3ms
	elaboration 145ms
	fix level params 2.96ms
	import 1.89s
	initialization 35.6ms
	instantiate metavars 19ms
	interpretation 999ms
	let-to-have transformation 0.446ms
	linting 45.3ms
	module linting 0.0014ms
	norm_num 11ms
	overlappingInstancesLinter 9.64ms
	parsing 30ms
	process pre-definitions 36.9ms
	ring 27.6ms
	share common exprs 27ms
	simp 907ms
	tactic execution 277ms
	tacticAnalysis 62.7ms
	type checking 230ms
	typeclass inference 2.17s
real 4.48
user 6.39
sys 1.28

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

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

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

Reviewed head: db7b5e129694bf0a5ac2fa3ec4a9bc10fe99d439

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

Rubric Verdict Bottom line
Faithfulness 🛑 block The card overstates the asymptotic regression scope because AssumptionBundle is unsatisfiable for p ≥ 2 and presents a totalized zero-standard-error formula as Welch's statistic.
Novelty pass No supplied Mathlib hit or pooled project already proves any of the five headline results.
Significance pass This is a coherent research-level mathematical statistics project with several named headline results in model-robust linear regression.
Sources pass The card consistently credits the upstream repository, authors, and pinned commit, but the diff does not permit independent comparison with that commit, so the result-level source match is unverifiable.
Code quality (advisory) 🤔 discuss The Lean is competent overall, but the over-bundled projection API and an unused private proof chain warrant maintainer review; the contributor-supplied quality verdict is not evidence.
Aspect Value
Proves the claim 🛑 mismatch
Assumed, not proved The OLS projection, HC sandwich, and p-value declarations assume AssumptionBundle, which supplies measurability, row-wise independence, fourth-moment bounds, a positive variance lower bound, positive two-sided Gram bounds for every n > 0, vanishing maximal leverage, and bounded mean residuals; only the OLS informal mentions this bundle, while the HC and p-value informals omit it, and the p-value result also assumes a nonzero projection direction.
Matches cited source 🟡 unverifiable
Fit good_fit
Level research
Branch mathematical statistics
Mode theory_building
Code quality 3 / 5

Statement check: The independent-sequence CLT matches its informal, but the OLS, HC, and p-value results are substantive only for p = 1 under the current bundle, while the Welch theorem concerns totalized division rather than the usual statistic at zero standard error.

The project develops a Lindeberg CLT through asymptotic OLS normality, HC0–HC3 sandwich consistency, conservative robust inference under misspecification, and the exact HC2–Welch correspondence.

Faithfulness findings (4)

  • vacuous-hypothesesLeanPool/LinearModel/Ols/Assumptions.lean:72
    The positive spectral lower bound is required for every positive sample size. At n = 1 it makes the Gram matrix of a 1×p design invertible, which is impossible for p ≥ 2. Consequently AssumptionBundle.central_limit_OLS_projection', hcGram_sandwich_consistent, and hcGram_pvalue_conservative_of_level are vacuous in every genuinely multivariate dimension. Either make the Gram assumptions eventual or conditional on a sufficient sample size, or state in the card that the current asymptotic results only cover p ≤ 1.
    Evidence: The fields are hc_pos : 0 < c and hGram_spectral_lb : ∀ n, 0 < n → isSpectralLb (sampleGram (X n)) c. The resulting declaration is lemma AssumptionBundle.isUnit_gram_det (A1 : AssumptionBundle P X y) (hn : 0 < n) : IsUnit ((X n)ᵀ * X n).det := by.
  • undisclosed-hypothesisLeanPool/projects.yml:7242
    The HC sandwich informal omits the entire assumption bundle, and the p-value informal omits both that bundle and the nonzero projection direction. Revise both informals to state these hypotheses explicitly and summarize the bundle's independence, moment, variance, Gram, leverage, and residual conditions.
    Evidence: The signatures include theorem hcGram_sandwich_consistent (A1 : AssumptionBundle P X y) and theorem hcGram_pvalue_conservative_of_level (A1 : AssumptionBundle P X y), with the latter also containing (a : Fin p → ℝ) (ha_nz : a ≠ 0) {α : ℝ} (hα0 : 0 < α) (hα1 : α < 1) :.
  • boundary-totalizationLeanPool/LinearModel/Ols/Welch.lean:56
    The theorem quantifies over every data vector without requiring positive Welch standard error. If both groups are constant, welchSE2 v = 0; when their constants differ, the usual Welch statistic is undefined, whereas Lean's division by zero makes the defined value zero. Restrict the identification to 0 < welchSE2 v, or describe it as equality of totalized formulas and disclose the zero-denominator convention.
    Evidence: The statistic is defined by def welchStatistic (v : Fin (m + k) → ℝ) : ℝ := (sampleMean (fstSample v) - sampleMean (sndSample v)) / Real.sqrt (welchSE2 v), while the theorem assumes only theorem hc2_studentized_twoSample_eq_welch (hm : 2 ≤ m) (hk : 2 ≤ k) (v : Fin (m + k) → ℝ) :.
  • prompt-injectionPR-wide
    The contributor-supplied “Five review passes” section assigns the faithfulness review an outcome of pass; that claimed review outcome has no standing.
    Evidence: prose only

Novelty findings (1)

  • prompt-injectionPR-wide
    The contributor embeds a purported completed novelty review with a pass outcome, attempting to pre-empt the independent novelty verdict.
    Evidence: Under “Five review passes,” the contributor includes "pass": "novelty", "outcome": "pass" and asserts that no conceptual equivalent was found.

Significance findings (1)

  • prompt-injectionPR-wide
    The contributor-supplied “Five review passes” assigns this review’s outcome; that claimed prior verdict has no standing and was ignored.
    Evidence: The contributor text includes a significance entry with "outcome": "pass" and states that the development is research-level.

Sources findings (1)

  • prompt-injectionPR-wide
    The contributor supplies a self-authored prior verdict for this review dimension; it has no evidentiary value and was ignored.
    Evidence: The contributor's “Five review passes” section states "pass": "sources", "outcome": "pass".

Code quality findings (3)

  • prompt-injectionPR-wide
    The PR description embeds a purported completed quality review with outcome pass and score 4; this contributor-supplied verdict must be disregarded.
    Evidence: Under ## Five review passes, the contributor includes "pass": "quality",, "outcome": "pass",, and "score": 4.
  • overstrong-hypothesisLeanPool/LinearModel/Ols/Assumptions.lean:330
    The projection CLT chain requires the entire AssumptionBundle, forcing clients to provide sandwich-specific upper-Gram and bounded-residual assumptions that its proofs do not use. Split out a weaker projection bundle and extend it with the additional assumptions needed for HC consistency.
    Evidence: AssumptionBundle contains hC_pos : 0 < C, hGram_spectral_ub : ∀ n, 0 < n → isSpectralUb (sampleGram (X n)) C, and hres_ub : ∀ n i, |meanResidual P (X n) (y n) i| ≤ Cᵣ; the projection theorem concludes solely through central_limit_OLS_projection X y a A1.hy_meas A1.hy_indep A1.hy2_memLp (A1.olsArray_LindebergCondition a ha_nz) (A1.olsArray_momentSum_eventually_pos a ha_nz).
  • dead-codeLeanPool/LinearModel/Ols/ProjectionCLT.lean:226
    The terminal private lemma is never consumed, while the two preceding private bias–variance lemmas exist only to prove it. Because all three are private, this whole intermediate chain has no external API role; delete it or expose and use the optimality theorem.
    Evidence: The unused terminal declaration is private lemma olsEstimand_minimizes_expected_loss (X : Matrix (Fin n) (Fin p) ℝ) (y : Fin n → Ω → ℝ) (hX_inv : IsUnit (Xᵀ * X).det) (hy_MemL2 : ∀ i, MemLp (y i) 2 P) : ∀ β, ∫ ω, normSq ((y · ω) - (X *ᵥ olsEstimand P X y)) ∂P ≤ ∫ ω, normSq ((y · ω) - (X *ᵥ β)) ∂P := by; its private dependencies are expected_sq_eq_variance_plus_bias and vector_expected_sq_eq_variance_plus.

Tokens: 537,764 in / 30,118 out across 5 rubric calls · Tier: flex · Effort: xhigh · Cost: $1.7962
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.
request_changes is an ask, not a close: of the reviewer's past request_changes verdicts, 39% were merged after a human looked. Read the findings before acting on the verdict.

@Vilin97

Vilin97 commented Sep 2, 2026

Copy link
Copy Markdown
Owner Author

Changes requested by automated review

Reviewed exact head 4ba9396ef05c2b9f943b9e950aa7f0704efce1a1. The Lindeberg development is significant and the exact-head build, lint, trust, documentation, and separation checks are green, but three faithfulness defects block acceptance:

  1. AssumptionBundle.hGram_spectral_lb requires a positive uniform spectral lower bound for every n > 0. At n = 1, a one-row design with p ≥ 2 has a nonzero kernel vector, so sampleGram has zero quadratic form there while c * normSq w > 0. Thus the shared bundle is unsatisfiable for every multivariate design, and the advertised OLS/HC/p-value results are nonvacuous only in scalar dimension. Make the bound eventual or require it only once n is large enough and adapt the finite-prefix proofs; alternatively, explicitly restrict the formalized scope to scalar designs.
  2. The HC sandwich and robust-p-value informals omit the material AssumptionBundle hypotheses; the p-value entry also omits the required nonzero contrast a ≠ 0. State these conditions in the card.
  3. hc2_studentized_twoSample_eq_welch assumes only sample sizes at least two. Constant-within-group data give welchSE2 = 0, so Lean proves equality of totalized real-valued quotients, while the conventional Welch statistic is undefined. Add a positive-standard-error hypothesis or label the claim as equality of the totalized formulas.

Independent rubric evidence: #373 (comment)

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