Skip to content

Add C196 three-read alignment and finite-menu masking - #1062

Merged
Vilin97 merged 2 commits into
LeanPool:mainfrom
VanGogh7777:vangogh7777/c196-split-mask
Nov 28, 2026
Merged

Vilin97 merged 2 commits into
LeanPool:mainfrom
VanGogh7777:vangogh7777/c196-split-mask

Conversation

@VanGogh7777

Copy link
Copy Markdown
Contributor

C196 calibrated three-read separation and finite-menu masking

Extend the existing C196 Lean Pool project with the checked proofs of Theorem 4 and Proposition 7 from the same v0.3 manuscript. The original matching-rate and smooth-witness modules are unchanged.

Theorem 4, p. 4, Eqs. (24)–(28), gives the explicit calibrated margin, alignment equivalence, weighted exponential-square identity and deterministic error bounds for three readings. It assumes a probability measure with the supplied projection-moment law, axis overlap (c^2 \le 1), and (t > 0). It uses one profile (w \ge 1) and integrable reads at ((2t,0), (t,t), (0,2t)). The identification of physical round area with the supplied moment law remains analytic. Registered Split formalization

Proposition 7, p. 6, Eq. (35), proves local exact matching for a finite menu of distinct controls near a fixed nonaligned reference angle. It uses a finite open-positive measure and a constant reference profile above one. The explicit exponential-sum witness stays above one and matches every reference read. Registered Mask formalization

The masking proof reuses the project's existing Cartesian sphere and energy definitions. The finite-menu certificate and kernel belong to the new proof dependency closure. Both result groups use the existing proofs from the C196 source snapshot.

Mark Gladden is the responsible maintainer. AI produced the Lean proofs under his direction. The code and manuscript are released under Apache-2.0.

@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

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

No new blocking issue was found in the attribution-only update.RetriggerView in Greptile

[Low impact] No new blocking issue was found in the attribution-only update.

Summary

Adds calibrated three-read bounds and exact finite-menu masking near a nonaligned angle.

  • Three calibrated reads expose axis alignment through an explicit margin.
  • Nearby sphere angles keep every finite-menu read matched.

Reviews (2) · Last reviewed commit: "Preserve C196 source attribution and ada..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Proof profile (new / modified Lean files)

lake build wall time (changed modules): 20.03 s (= 0.33 min) — user 15.04 s, sys 4.82 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.

A base→head comparison was attempted but its measurements are unavailable (see the run log); modified files are omitted from the tables below.

Statement changes

✅ No statements changed — all 0 tracked declarations across 2 modified files kept their type; only proofs / definition bodies changed.

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.

Total heartbeats: 91,874 maxHeartbeats units across 7 valid files (785 added LOC).

Sum of lean --profile: 9808.8 ms (= 9.81 s) across 7 valid files. Import-excluded time: 5305.8 ms (= 5.31 s).

Count-heartbeats wall-clock total: 20.55 s. Repeated import cost inside lean --profile: 4503.0 ms (= 4.50 s).

Heartbeat values sum disjoint root command traces with trace.profiler.useHeartbeats and synchronous elaboration, converted from raw allocations to maxHeartbeats units by dividing by 1000. They include command elaboration and kernel checking, exclude imports, and include profiler overhead; they are not comparable to the deprecated linter's totals. 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) Commands Errors
LeanPool/VenNullClockRoundRates/ThreeRead.lean 204 38,904 4.74 2.71 2.14 0.57 46 0
LeanPool/VenNullClockRoundRates/LocalMask.lean 105 21,143 3.88 2.11 1.01 1.10 13 0
LeanPool/VenNullClockRoundRates/LocalMaskGram.lean 120 17,777 3.96 1.46 0.90 0.56 20 0
LeanPool/VenNullClockRoundRates/LocalMaskAngular.lean 136 9,272 2.88 1.10 0.54 0.57 11 0
LeanPool/VenNullClockRoundRates/ThreeReadModel.lean 74 2,756 1.53 0.85 0.28 0.57 18 0
LeanPool/VenNullClockRoundRates/LocalMaskModel.lean 87 1,564 1.76 0.82 0.25 0.57 16 0
LeanPool/VenNullClockRoundRates/LocalMaskSphereModel.lean 41 458 1.80 0.75 0.19 0.57 10 0
LeanPool/VenNullClockRoundRates.lean 11 — — — — — 0 1
LeanPool/VenNullClockRoundRates/Imports.lean 7 — — — — — 0 1
Total 785 91,874 20.55 9.81 5.31 4.50 134 2

Aggregate phase totals

Phase Time
import 4503.0 ms (= 4.50 s)
interpretation 1860.0 ms (= 1.86 s)
typeclass inference 1042.2 ms (= 1.04 s)
tactic execution 590.0 ms (= 0.59 s)
type checking 320.7 ms (= 0.32 s)
simp 252.7 ms (= 0.25 s)
ring 219.7 ms (= 0.22 s)
elaboration 210.0 ms (= 0.21 s)
initialization 187.5 ms (= 0.19 s)
blocked (unaccounted) 174.0 ms (= 0.17 s)
share common exprs 85.9 ms (= 0.09 s)
norm_num 82.8 ms (= 0.08 s)

Slowest changed modules (from lake build)

Changed module Lake time
LeanPool.VenNullClockRoundRates.ThreeReadModel 2.30 s
LeanPool.VenNullClockRoundRates.LocalMaskModel 2.20 s
LeanPool.VenNullClockRoundRates.LocalMaskSphereModel 2.10 s
LeanPool.VenNullClockRoundRates.ThreeRead 1.90 s
LeanPool.VenNullClockRoundRates.LocalMaskGram 1.60 s
LeanPool.VenNullClockRoundRates.LocalMask 1.30 s
LeanPool.VenNullClockRoundRates.LocalMaskAngular 1.10 s
Per-file `lean --profile` output

LeanPool/VenNullClockRoundRates/LocalMask.lean

import took 1.1s
cumulative profiling times:
	attribute application 0.054ms
	blocked (unaccounted) 170ms
	congr simp thm 0.917ms
	declTypeLinter 2.81ms
	dsimp 4.59ms
	elaboration 13.2ms
	fix level params 0.604ms
	import 1.1s
	initialization 26.3ms
	instantiate metavars 1.76ms
	interpretation 361ms
	let-to-have transformation 0.0435ms
	linting 12.9ms
	module linting 0.0219ms
	norm_num 1.56ms
	parsing 5.64ms
	process pre-definitions 6.73ms
	ring 28.9ms
	share common exprs 9.06ms
	simp 37.3ms
	tactic execution 93ms
	tacticAnalysis 2.37ms
	type checking 37.7ms
	typeclass inference 189ms
real 2.23
user 1.47
sys 0.54

LeanPool/VenNullClockRoundRates/LocalMaskAngular.lean

import took 569ms
cumulative profiling times:
	attribute application 0.0314ms
	congr simp thm 0.614ms
	declTypeLinter 3.02ms
	dsimp 0.555ms
	elaboration 11.1ms
	fix level params 0.333ms
	import 569ms
	initialization 26.9ms
	instantiate metavars 1.06ms
	interpretation 217ms
	let-to-have transformation 0.0342ms
	linting 10.2ms
	module linting 0.0167ms
	norm_num 0.681ms
	parsing 6.36ms
	process pre-definitions 4.47ms
	ring 12ms
	share common exprs 3.7ms
	simp 10.3ms
	tactic execution 100ms
	tacticAnalysis 2.21ms
	type checking 21.1ms
	typeclass inference 104ms
real 1.37
user 1.16
sys 0.47

LeanPool/VenNullClockRoundRates/LocalMaskGram.lean

import took 560ms
cumulative profiling times:
	attribute application 0.0477ms
	blocked (unaccounted) 1.53ms
	congr simp thm 1.48ms
	declTypeLinter 4.21ms
	dsimp 5.35ms
	elaboration 27.5ms
	fix level params 0.796ms
	import 560ms
	initialization 27.1ms
	instantiate metavars 1.16ms
	interpretation 220ms
	let-to-have transformation 0.0715ms
	linting 10.7ms
	module linting 0.0244ms
	norm_num 0.214ms
	parsing 5.9ms
	process pre-definitions 4.35ms
	ring 4.84ms
	share common exprs 3.21ms
	simp 143ms
	tactic execution 125ms
	tacticAnalysis 3.08ms
	type checking 39.3ms
	typeclass inference 276ms
real 1.50
user 1.48
sys 0.50

LeanPool/VenNullClockRoundRates/LocalMaskModel.lean

import took 575ms
cumulative profiling times:
	attribute application 0.0447ms
	compilation (IR) 0.0781ms
	compilation (LCNF base) 1.24ms
	compilation (LCNF impure) 0.276ms
	compilation (LCNF mono) 0.5ms
	declTypeLinter 3.57ms
	elaboration 21ms
	fix level params 0.0884ms
	import 575ms
	initialization 26.8ms
	instantiate metavars 0.0883ms
	interpretation 156ms
	let-to-have transformation 0.0503ms
	linting 5.78ms
	module linting 0.0213ms
	parsing 4.25ms
	process pre-definitions 2.6ms
	share common exprs 0.364ms
	tacticAnalysis 1.45ms
	type checking 4.49ms
	typeclass inference 18.9ms
real 1.25
user 0.86
sys 0.48

LeanPool/VenNullClockRoundRates/LocalMaskSphereModel.lean

import took 566ms
cumulative profiling times:
	attribute application 0.0168ms
	declTypeLinter 1.21ms
	elaboration 8.7ms
	fix level params 0.0188ms
	import 566ms
	initialization 26.7ms
	instantiate metavars 0.0177ms
	interpretation 137ms
	let-to-have transformation 0.97ms
	linting 2.33ms
	module linting 0.0181ms
	parsing 1.89ms
	process pre-definitions 0.768ms
	share common exprs 0.0862ms
	tacticAnalysis 0.759ms
	type checking 2.16ms
	typeclass inference 5.45ms
real 1.21
user 0.79
sys 0.47

LeanPool/VenNullClockRoundRates/ThreeRead.lean

import took 566ms
interpretation of Mathlib.Tactic._aux_Mathlib_Tactic_Linarith_Frontend___elabRules_Mathlib_Tactic_nlinarith_1._boxed took 104ms
cumulative profiling times:
	attribute application 0.201ms
	blocked (unaccounted) 2.5ms
	compilation (IR) 0.552ms
	compilation (LCNF base) 3.35ms
	compilation (LCNF impure) 1.87ms
	compilation (LCNF mono) 2.31ms
	congr simp thm 4.37ms
	declTypeLinter 8.27ms
	dsimp 3.88ms
	elaboration 103ms
	fix level params 4.47ms
	import 566ms
	initialization 26.9ms
	instantiate metavars 3.52ms
	interpretation 615ms
	let-to-have transformation 0.256ms
	linting 34.5ms
	module linting 0.0235ms
	norm_num 80.3ms
	parsing 11.3ms
	process pre-definitions 35.2ms
	ring 174ms
	share common exprs 69ms
	simp 62.1ms
	tactic execution 272ms
	tacticAnalysis 4.68ms
	type checking 209ms
	typeclass inference 412ms
real 1.85
user 2.72
sys 0.52

LeanPool/VenNullClockRoundRates/ThreeReadModel.lean

import took 567ms
cumulative profiling times:
	attribute application 0.0575ms
	compilation (IR) 0.237ms
	compilation (LCNF base) 5.7ms
	compilation (LCNF impure) 0.839ms
	compilation (LCNF mono) 1.47ms
	declTypeLinter 5.25ms
	elaboration 25.5ms
	fix level params 0.116ms
	import 567ms
	initialization 26.8ms
	instantiate metavars 0.17ms
	interpretation 154ms
	let-to-have transformation 0.0633ms
	linting 5.67ms
	module linting 0.0207ms
	parsing 4.01ms
	process pre-definitions 3.58ms
	share common exprs 0.458ms
	tacticAnalysis 1.88ms
	type checking 6.92ms
	typeclass inference 36.8ms
real 1.27
user 0.89
sys 0.48

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

@Vilin97

Vilin97 commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

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

Reviewed head: 6a1171cf53662cce3521aefed564ed0490010679

Verdict: 🛑 request_changes

The PR adds a calibrated three-read alignment test and a finite-menu masking proof to C196, then exports them through the project’s import modules. Both C196 Lake targets built on Lean 4.36.0. The masking specialization repeats existing sphere proofs and restates the observation definitions used by its generic proof.

Aspect Value
Scope Integration of two proof developments into C196
Introduces tech debt 🛑 yes
Maintainability 🛑 regressed
Brittleness 🛑 more_brittle
Risk 🟡 medium

Reuse the existing geometry lemmas and define the sphere observation model through the generic masking API so future changes only need to be made once.

Findings (2)

  • duplicated-proof — LeanPool/VenNullClockRoundRates/LocalMask.lean:76
    sphere_local_masking reconstructs the OpensMeasurableSpace instance and repeats the continuity and energy-bound proofs from Geometry.lean. Import Geometry and use its instance, VenRate.first_cont, VenRate.second_cont, and VenRate.en_bounds. The interval bounds give the required absolute-value bounds via abs_of_nonneg. This removes the second copy of the sphere coordinate and rotation arguments.
  • duplicated-definition — LeanPool/VenNullClockRoundRates/LocalMaskSphereModel.lean:23
    sphereKernel repeats kernel, and SphereMaskingCertificate spells out the same finite sum and weighted integral as synthesis and read. The final proof in LocalMask.lean relies on all three pairs of expressions being definitionally equal. Define sphereKernel as a specialization of kernel and use synthesis and read in the certificate so the public sphere model and the generic proof share the same definitions.

Tokens: 1,431,447 in / 9,328 out · Tier: codex-subscription · Effort: xhigh · Billing: Codex subscription quota (no API credits) · Estimated cost: $5.8657 (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.
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 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved for d85be119c549a9ac5f69235132ae3bb41084cfa0, pending required CI on this commit.

  • Theorem 4 derives the explicit angular margin from the supplied projection moments. The formalization proves the weighted-square identity, the equality criterion for alignment, and the deterministic 4ε and 8ε bounds. The card states the projection-moment hypothesis. C196 manuscript, p. 4
  • Proposition 7 proves exact matching of the whole finite menu near a fixed nonaligned angle with a single strictly positive profile. The proof establishes the open image and kernel independence, solves the finite Gram system, and uses the vanishing correction at the reference angle to preserve the strict lower bound. This adds a result beyond the existing matching-rate bounds. Pinned Lean source
  • I restored the upstream proof-authorship credit and added adaptation notices to all seven copied modules. The commit also identifies the existing shared NOTICE as applying to both source snapshots. The patch changes comments only, and the existing result signatures and proofs are unchanged. Apache-2.0, section 4

Two follow-ups are advisory. The sphere continuity and bounds proofs could reuse the existing geometry lemmas. The manuscript could also supply a source pin for the ancillary projectionLaw_of_uniform reference. The submitted certificate explicitly assumes the projection law.

@Vilin97
Vilin97 added this pull request to the merge queue Nov 28, 2026
Merged via the queue into LeanPool:main with commit eab3eee Nov 28, 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.

2 participants