Skip to content
This repository was archived by the owner on Oct 14, 2026. It is now read-only.

Layer 1 formal verification: Lean 4 + Mathlib pilot, fail-closed formalization gate, cross-repo handoff - #3

Closed
d6g8k5htny-coder wants to merge 5 commits into
mainfrom
cursor/formal-verification-layer-e0e6
Closed

d6g8k5htny-coder wants to merge 5 commits into
mainfrom
cursor/formal-verification-layer-e0e6

Conversation

@d6g8k5htny-coder

@d6g8k5htny-coder d6g8k5htny-coder commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds Layer 1 — formal verification on top of the existing Layer 0 research verification stack (provenance/SHA-256, explicit scope, review-status ladder, fail-closed Math- hard gate, verification museum). Layer 0 is unchanged; Layer 1 is strictly additive and fail-closed.

Scientific effect: NONE. lemma_closed stays false. mathematical_acceptance stays false. Nothing here is a theorem discharge or claim closure.

What is added (formal/)

  • Lean 4 + Mathlib project (formal/lean/, toolchain leanprover/lean4:v4.34.1, Mathlib v4.34.1) — pilot on the SIDE24 coefficient bound (Math- coefficients/side24_v1/PROOF.md, pinned by commit/blob/sha256).
    • Ledger.lean: constant-image lemma, e^x partial-sum bounds, 10^125 < exp 288, 512·e^{-864} < 1/2, covariance/density comparison bounds, exponent budgets.
    • ConeMoment.lean: cone antiderivative + FTC identity, D2 = 29/6 − √6 with rational enclosure, and the §1 Gaussian inputs now kernel-checked: E[s^4] = 25/3 and E[exp(−s²/2)] = √(3/8) for N(0, 5/3) (via Mathlib gaussianReal, MGF iterated derivatives, and the Gaussian integral).
    • Reference.lean: reference coefficient definition, rational enclosure endpoints, periodization bound, and enclosure_of_reference (kernel-checked, conditional on the parent-defined coefficient c : ℕ → ℝ, which is parametrized rather than axiomatized).
  • FORMALIZATION_STATUS.json — 22 components: 16 kernel-checked, 6 specified, all formalization_review: author-side. Ladders: none < specified < proved < kernel-checked; review none | author-side | nonauthor-aligned. Rule: declared ≤ verifiable, otherwise the gate fails. assumed_axioms registry is empty.
  • formal_gate.py — fail-closed gate: verbatim lean_statement binding, sorry/axiom scan, #print axioms standard-axiom check, byte pins (SOURCE_FILES.json), deterministic build evidence (BUILD_EVIDENCE.json), review-record verification, same-provider review earns no independence credit. Emits hard-gate tokens (FORMAL_SPECIFIED, KERNEL_CHECKED_AUTHOR_SIDE, KERNEL_CHECKED_CONDITIONAL, KERNEL_CHECKED_NONAUTHOR_ALIGNED).
  • Blueprint-lite (formal/blueprint/, blueprint_check.py) — leanblueprint content.tex with \lean{}/\leanok/\uses{} for every component; checker enforces the informal↔formal binding.
  • GLOSSARY.md — project terms ("elder density", "lifetime coefficient", "Universal Law mathematics", …) → standard objects → Lean names; RN/24-jet/JETMOD remain UNMAPPED and say so.
  • FORMALIZATION_REVIEW_LANE.md — distinct formalization reviewer checklist and record format (formal/reviews/).
  • Tests: test_formal_gate.py + test_blueprint_check.py — 27 tests, 33 semantic mutants, normal and -O modes; run_validation.py writes REPORT.json (with optional --with-lean evidence check).
  • CI (.github/workflows/formal-gate.yml): gate-controls (pins, validation, counts) and lean-kernel (lake build via pinned lean-action with Mathlib cache, evidence --check, gate, blueprint check, clean tree).

Coordination (handoff/)

Cloud Agent writes to trial, main, Math-, governance- are refused (measured 403), so this branch carries a handoff package instead: owner pre-approval record, per-repo offered tasks, PORT.md (portable pieces for trial), MATH_HARD_GATE_EXTENSION.md (node formalization field, tokens, sync tool, tests to add), and agents/*.AGENTS.md.patch for each sibling repo. AGENTS.md and README.md in this repo point to formal/ and handoff/.

Verification

  • python3 formal/run_validation.py --output /tmp/fv --with-lean → passed: true, 27 distinct tests, 33 distinct semantic mutants.
  • lake build clean, no sorry, all kernel-checked declarations depend only on propext, Classical.choice, Quot.sound.
  • CI green on both jobs for the previous revision; latest revision adds the two Gaussian moment theorems (previously specified, now kernel-checked).
Open in Web Open in Cursor 

cursoragent and others added 5 commits September 27, 2026 21:46
…ation gate

Lean 4 (v4.34.1) + Mathlib project under formal/lean formalizing the
arithmetic ledger, cone-moment integral/algebra and the reference-to-
enclosure implication of Math- coefficients/side24_v1/PROOF.md.
formal_gate.py checks declared formalization status (none/specified/
proved/kernel-checked) against pinned bytes and #print axioms evidence.
Scientific effect NONE; lemma_closed stays false.

Co-authored-by: Dylan Roy <d6g8k5htny@privaterelay.appleid.com>
…ion replay

Assumed-axiom registry moves to the status file top level; kernel evidence
depending on a registered axiom yields KERNEL_CHECKED_CONDITIONAL and never
satisfies the formal lane. run_validation.py replays normal/optimized modes
and optionally regenerates BUILD_EVIDENCE.json for byte comparison.

Co-authored-by: Dylan Roy <d6g8k5htny@privaterelay.appleid.com>
…eview lane, Layer 1 README

blueprint_check.py binds every \lean{} environment to a status component and
allows \leanok only on kernel-checked components. Workflow runs the Python
controls and a lean-action job that rebuilds with the Mathlib cache and
refuses any BUILD_EVIDENCE.json byte difference.

Co-authored-by: Dylan Roy <d6g8k5htny@privaterelay.appleid.com>
Per-repo AGENTS.md patches (trial, main, Math-, governance-) generated
against their current tips, Math- hard-gate extension spec, port
instructions, and the owner pre-approval record. Sandbox AGENTS/README
point at formal/ and handoff/. Measured 403 write scope recorded.

Co-authored-by: Dylan Roy <d6g8k5htny@privaterelay.appleid.com>
…/2) = sqrt(3/8))

Replaces the specified gaussian_inputs_statement with two theorems proved
against Mathlib gaussianReal: the fourth moment via iteratedDeriv of
mgf_id_gaussianReal, the exponential moment via integral_gaussian.
Pins, evidence, status, blueprint and docs regenerated together.

Co-authored-by: Dylan Roy <d6g8k5htny@privaterelay.appleid.com>

Copy link
Copy Markdown
Owner Author

Formal-lane convergence request — OpenAI/ChatGPT under Dylan's delegated integration authority. Math-#92 is merged (source cc2989c1280f4f227d0c6aa30c8841d6ba01e46e, merge 867d9e34b60186ff46ab5b3ecf8ad5ba6a5cc8b4); main#177 guide is merged; main#178 also merged during this audit. Keep this sandbox's useful component proofs as scoped experimental evidence, but do not apply the generated AGENTS patches or port another root formal registry without reconciling current defaults. Please offer the unique cone-integral/exponential components through exact source/target/assumption bindings into the Math- lane, preserving original bytes and scientific NONE. Main#95 is the shared coordination issue; new main#180 captures public source heads and replays the primary installed toolchain. No completed review or acknowledgment is inferred from this request.

Copy link
Copy Markdown
Owner Author

Closing at the owner's request to resolve open PRs. FORMALIZATION_STATUS.json has the package award itself kernel-checked for 16 components, with its own register. That conflicts with the unified contract, where only a trusted run receipt says kernel-checked (main #181/#188). The branch is preserved. Per comment 5860295053, the cone-integral and exponential components can be offered into the Math- formal/ lane with exact bindings.


Generated by Claude Code

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants