diff --git a/.github/workflows/torus-filtration.yml b/.github/workflows/torus-filtration.yml index becc58ff7..920bbcf0b 100644 --- a/.github/workflows/torus-filtration.yml +++ b/.github/workflows/torus-filtration.yml @@ -7,6 +7,7 @@ name: C254 torus filtration (isolated Lean companion) - 'formal/lakefile.toml' - 'formal/lake-manifest.json' - 'formal/lean-toolchain' + - 'specifications/lean_statements_20261010/Specifications/Field.lean' push: branches: [main] paths: @@ -15,13 +16,14 @@ name: C254 torus filtration (isolated Lean companion) - 'formal/lakefile.toml' - 'formal/lake-manifest.json' - 'formal/lean-toolchain' + - 'specifications/lean_statements_20261010/Specifications/Field.lean' workflow_dispatch: permissions: contents: read jobs: torus-filtration: runs-on: ubuntu-latest - # Provisional until one hosted dry run records the duration in the companion README: twelve `lean` + # Provisional until one hosted dry run records the duration in the companion README: the `lean` # invocations each load the full Mathlib .olean set, plus `leanchecker` on the companion modules # (the whole-closure leanchecker re-check does not fit a hosted job; see replay.sh and the README). timeout-minutes: 45 diff --git a/companions/torus_filtration_20261011/README.md b/companions/torus_filtration_20261011/README.md index 5efed09b4..41dd08778 100644 --- a/companions/torus_filtration_20261011/README.md +++ b/companions/torus_filtration_20261011/README.md @@ -1,9 +1,10 @@ -# C254 torus quotient and closed-superlevel filtration, with the C263 strict-cut and C264 ordinary-H0 modules (isolated Lean companion) +# C254 torus quotient and closed-superlevel filtration, with the C263 strict-cut and C264 ordinary-H0 modules and the C263 Field adapter (isolated Lean companion) Dylan Roy — delegated AI work. Source authors: OpenAI/Codex lanes (C254 for `TorusTopology` and `ClosedSuperlevel`; C263 for `SuperlevelBar`; C264 for `OrdinaryH0`). Compile fixes, the C264 -owner repair, the owner-authored controls module `OrdinaryH0Controls` (C264 owner task item 4) -and the companion: Anthropic/Claude lane. Scientific effect **NONE**. +owner repair, the owner-authored controls module `OrdinaryH0Controls` (C264 owner task item 4), +the owner-authored Field adapter `SuperlevelBarField` and the companion: Anthropic/Claude lane. +Scientific effect **NONE**. Organizational-independence credit **0** for every lane; no human review. Alignment status `PENDING_INDEPENDENT_REVIEW`. The two C26x modules are registered here as compiled successors under the handoffs' own **FORMAL HOLD** (see [C263 and C264 registration](#c263-and-c264-registration-2026-10-11)). @@ -19,7 +20,9 @@ records credit 0. FORMAL HOLD is unchanged: its disposition is for the C263/C264 handoff owners, not this companion, and alignment still needs a reviewer with nonzero organizational-independence credit. `OrdinaryH0Controls` is not a review and lifts nothing (see -[C264 owner task item 4 controls](#c264-owner-task-item-4-controls-2026-10-12)). +[C264 owner task item 4 controls](#c264-owner-task-item-4-controls-2026-10-12)). `SuperlevelBarField` +consumes the C263 definitions, so their FORMAL HOLD extends to it; it is not a review and lifts +nothing either (see [C263 Field adapter](#c263-field-adapter-2026-10-12)). Nothing here promotes, discharges or reclassifies any claim. ## Purpose and route rationale @@ -37,15 +40,20 @@ primary manifest at SHA-256 `40cb6ffc…` and the gate at `278989bb…`; any cha review scope for all three. The C255 route finding (6111255007) therefore recommended an isolated companion. This directory is that companion: -- it holds the compile-fixed modules and the owner-authored controls module under namespace - `TorusFiltration` and a five-line root module (`import TorusTopology`, `import ClosedSuperlevel`, - `import SuperlevelBar`, `import OrdinaryH0`, `import OrdinaryH0Controls`, in dependency order; the - two C26x modules joined on 2026-10-11, the controls module on 2026-10-12); +- it holds the compile-fixed modules, the owner-authored controls module and the owner-authored + Field adapter under namespace `TorusFiltration` and a six-line root module (`import TorusTopology`, + `import ClosedSuperlevel`, `import SuperlevelBar`, `import OrdinaryH0`, `import OrdinaryH0Controls`, + `import SuperlevelBarField`, in dependency order; the two C26x modules joined on 2026-10-11, the + controls module and the adapter on 2026-10-12); - it compiles them against the **same** pinned toolchain and dependency lock as `formal/` (`formal/lean-toolchain`, `formal/lakefile.toml`, `formal/lake-manifest.json`), which it reads but never edits; - it consumes nothing from the core: no import of `ResearchFormalCoreR1`, no pin on the core - tree, manifest or gate, and its replay runs neither `formal/gate.py` nor the formal tests. + tree, manifest or gate, and its replay runs neither `formal/gate.py` nor the formal tests; +- outside its own directory it compiles exactly one file, the statement packet's + `specifications/lean_statements_20261010/Specifications/Field.lean` (#419's packet, on `main`), + pinned by identity (`EXTERNAL_INPUTS` in `check.py`), because `SuperlevelBarField` imports it; + it edits nothing in that packet. ## Bound sources @@ -56,19 +64,23 @@ isolated companion. This directory is that companion: | This lane | local elaboration report 6111093545; pickup 6111139060 | | Original `TorusTopology.lean` (NOT_COMPILED) | SHA-256 `efa80d2879758b6d6473a0024a308ff758c308cdc8e4b5f400f39dde63a7f6f4`, 11542 bytes | | Original `ClosedSuperlevel.lean` (NOT_COMPILED) | SHA-256 `1fed3edada12b4dc7f5fcf874dae7ccde5d8f65af63cf103159debe58ba6789e`, 7827 bytes | -| Namespace mapping | `ResearchFormalCoreR1.` (handoff) -> `TorusFiltration.` (companion); no other name changes. `SuperlevelBar` and `OrdinaryH0` were authored directly in namespace `TorusFiltration`, and so was the owner-authored `OrdinaryH0Controls` | +| Namespace mapping | `ResearchFormalCoreR1.` (handoff) -> `TorusFiltration.` (companion); no other name changes. `SuperlevelBar` and `OrdinaryH0` were authored directly in namespace `TorusFiltration`, and so were the owner-authored `OrdinaryH0Controls` and `SuperlevelBarField` | | C263 handoff `SuperlevelBar.lean` (failed at the pin with warnings as errors) | SHA-256 `d74dc8b2c25eff5b90ce7133e51a0888c7885cae24ca6d5e648bc514089637a8`, 14904 bytes; Math- PR #428 comments 6113033147 (source), 6113033351 (nonauthor source review), 6113033545 (final handoff audit and owner task: 28/28 static checks, formal acceptance HOLD); allocation PR #419 comment 6112439759; this lane's compile report 428/6113229784 | | Registered `SuperlevelBar.lean` (successor) | SHA-256 `346eea948e18d5904422904006827930e27d3141ccbc19ee8ac2c24bcf65a4a9`, 15309 bytes; imports `Mathlib` only | | C264 handoff `OrdinaryH0.lean` (failed at the pin with warnings as errors) | SHA-256 `261dd0526d42890d8a4ac1225fcf47228eb3c9799af4106cb643a528bcbf968e`, 18469 bytes; Math- PR #428 comments 6113276830 (source, delivery 1/3), 6113277173 (nonauthor source review, 2/3), 6113277485 (verification and owner task, 3/3); this lane's failed-compile record 428/6113300903; owner repair handoff 428/6113372506; this lane's repair report with the full diff 428/6113438262 | | Registered `OrdinaryH0.lean` (successor) | SHA-256 `3d6b0d6b53413c484b1d010bccf0d53ae7f75becb2d747868f22dbd673fe0a88`, 19803 bytes; imports `Mathlib` and `ClosedSuperlevel` | | Owner-authored `OrdinaryH0Controls.lean` (C264 owner task item 4; no handoff bytes, not a successor) | SHA-256 `df9d3645282ca526b67eca3d5db691b622092a14b5fddee9be21013e39666184`, 29590 bytes; imports `Mathlib` and `OrdinaryH0`; Math- PR #428 comments 6113277485 (C264 owner task, item 4) and 6113277173 (the corrected CONTROL_OBLIGATIONS it instantiates); author: Anthropic/Claude lane | -| Toolchain | `leanprover/lean4:v4.34.1`, release commit `5045d0056413266e57c625dcd7c365b10e377c52`; Mathlib `d13f23b723b8a846827a245b89c10fc7d3f11612` via `formal/lake-manifest.json` | +| Owner-authored `SuperlevelBarField.lean` (C263 Field adapter; no handoff bytes, not a successor) | SHA-256 `8a2470431c3fda5e98859aa9372cbb8866ed5c5c722cea5dfc28cb577840bbad`, 11816 bytes; imports `Mathlib`, `SuperlevelBar` and `Specifications.Field`; Math- PR #428 comments 6112932068 (the adapter route, retained by this lane) and 6124097060 (allocation of its import line and compile step); author: Anthropic/Claude lane | +| External input `specifications/lean_statements_20261010/Specifications/Field.lean` (statement packet, not companion source) | SHA-256 `f22c91e082cd7e738ba47c9c3534e47ac687d066f0b78586d15103cf1132535e`, 27767 bytes, blob `cc40e9d19446b8a150401c574d3cfd56177f195f` (`main` `4afcca6a`); imports `Mathlib` only; compiled in the replay with the packet's own `-DautoImplicit=false` | +| Toolchain | `leanprover/lean4:v4.34.1`, release commit `5045d0056413266e57c625dcd7c365b10e377c52`; Mathlib `d13f23b723b8a846827a245b89c10fc7d3f11612` via `formal/lake-manifest.json` (the statement packet's own `lean-toolchain` and `lake-manifest.json` pin the same toolchain and the same nine package revisions) | `SOURCE_FILES.json` records bytes, SHA-256 and Git blob of every tracked companion file and the -workflow, the per-module declaration inventory and this provenance. `check.py source` refuses to +workflow, the per-module declaration inventory, this provenance and the external input's identity +(`external_inputs`, compared whole with `check.py`; `check.py source` also requires the file's +working bytes and its blob at HEAD to be exactly that identity). `check.py source` refuses to run unless the tracked tree, the working bytes and that manifest agree. -## What the 118 theorems and 35 definitions establish +## What the 130 theorems and 37 definitions establish Topology and scaffolding only: the period-lattice quotient, descent of periodic functions, path lifting with an **existential** endpoint, closed superlevel inclusions and their path-component @@ -78,9 +90,13 @@ and the natural comparison of Mathlib's actual ordinary singular H0 with compone coproducts, restricted along the closed-superlevel filtration (C264); and fixtures that apply seven of the 20 C264 theorems, neither naturality theorem among them, to named spaces and coefficient modules, every premise proved inside the fixture (`OrdinaryH0Controls`, -owner-authored for C264 owner task item 4). The sources label these +owner-authored for C264 owner task item 4); and one inhabitant of the statement packet's +`UniversalLaw.Spec.Field.SuperlevelBarInterface` built from the C263 definitions, with every +inhabitant's agreement with it on the guarded locus and a control showing that the interface +leaves the death height at essential points free (`SuperlevelBarField`, owner-authored; its elder +relation is the right-hand side of its own clause, so that clause holds by definition). The sources label these `proved`; the hosted receipt may call them `kernel-checked`; neither label is alignment or -acceptance. 153 declarations in all: 21 + 20 + 20 + 20 + 37 theorems, 6 abbrevs, 26 defs, 3 instances. +acceptance. 167 declarations in all: 21 + 20 + 20 + 20 + 37 + 12 theorems, 6 abbrevs, 28 defs, 3 instances. ### `TorusTopology` (21 theorems; 2 abbrevs, 6 defs, 3 instances) @@ -222,6 +238,25 @@ module names no other C264 theorem. | `ordinaryH0Control_bool_zeroCoeff_eq`, `ordinaryH0Control_point_zeroCoeff_eq_zero`, `ordinaryH0Control_separation_needs_nonzero`, `ordinaryH0Control_nonvanishing_needs_nonzero` | zero coefficients: the two point classes of `Bool` are equal although their components differ, and the point class of the one-point space is `0`; hence the separation and nonvanishing statements are false once `𝟙 R ≠ 0` is deleted (the C264 statements keep that hypothesis) | | `ordinaryH0Control_parabolaLeft`, `ordinaryH0Control_parabolaRight` (defs), `ordinaryH0Control_parabola_le`, `ordinaryH0Control_parabola_strict_growth`, `ordinaryH0Control_parabola_not_joined_quarter`, `ordinaryH0Control_parabola_joined`, `ordinaryH0Control_parabola_difference_zero`, `ordinaryH0Control_parabola_strict_difference_ne_zero` | closed superlevels of `x ↦ x ^ 2`: the points `-1` and `1` of the level at parameter `-1`; the strict inclusion into the level at `-1/4` (which gains `1/2`) keeps the difference of their classes nonzero, since no path joins them in `{x | 1/4 ≤ x ^ 2}` (intermediate value theorem through `0`); the inclusion into the level at `0`, the whole line, kills it | +### `SuperlevelBarField` (12 theorems; 2 defs) — C263 Field adapter + +Owner-authored by this lane (it imports `Mathlib`, `SuperlevelBar` and the statement packet's +`Specifications.Field`); not a handoff module, not a review of `SuperlevelBar`, and under the same +FORMAL HOLD, since it consumes the C263 definitions. `IsSmooth` gives continuity at `n = 0`, so +`superlevelBar_strict_cut` is the interface's maximin clause, and `superlevelBar_cut_unique` forces +every other death height at a nonessential point to agree. The construction discards each clause's +`IsLPeriodic` argument and uses `L` only in its type; the three uniqueness theorems take +`IsLPeriodic d L g` to apply an arbitrary inhabitant's clauses, and are false without it. + +| Declarations | What they state | +|---|---| +| `superlevelBarField_continuous` | a height that is smooth in the Field sense (`IsSmooth`) is continuous | +| `superlevelBarField_interface` (def), `superlevelBarField_nonempty` | for every `d` and `L`, the record with `deathHeight := superlevelBar_deathHeight`, `IsEssential := superlevelBar_isEssential` and `ElderPartner :=` the right-hand side of the `elderPartner_iff` clause inhabits `UniversalLaw.Spec.Field.SuperlevelBarInterface d L`; that clause holds by `Iff.rfl`, a definition, not a theorem about persistence | +| `superlevelBarField_deathHeight_eq`, `superlevelBarField_isEssential_iff`, `superlevelBarField_elderPartner_iff` | the record's three fields, by `rfl` / `Iff.rfl` | +| `superlevelBarField_essential_unique`, `superlevelBarField_deathHeight_unique`, `superlevelBarField_elderPartner_unique` | for every inhabitant `I` and every smooth `L`-periodic height: `I.IsEssential` is global maximality; at a nonessential point `I.deathHeight` is the C263 death height; on the Morse distinct-value locus `I.ElderPartner` is the record's | +| `superlevelBarField_shift` (def), `superlevelBarField_shift_deathHeight_const` | a second inhabitant, equal to the first except that its death height at essential points is a constant `c`; at a constant height its death height is `c` | +| `superlevelBarField_const_smooth`, `superlevelBarField_const_periodic`, `superlevelBarField_control_essential_free` | constant heights are smooth and `L`-periodic; at the constant height `0`, where every point is essential for both records, the record has death height `0` and its shift by `1` has death height `1`, and the two differ, so the nonessential hypothesis of `superlevelBarField_deathHeight_unique` cannot be dropped | + Audited definitions: `torus_E`, `torus_quotient` (abbrev); `torus_latticeVec`, `torus_periodBasis`, `torus_periodLattice`, `torus_proj`, `torus_isPeriodic`, `torus_descend`; instances `torus_lattice_discrete`, `torus_lattice_addSubgroup_discrete`, `torus_lattice_isZLattice`; @@ -231,8 +266,11 @@ Audited definitions: `torus_E`, `torus_quotient` (abbrev); `torus_latticeVec`, ` `ordinaryH0_componentCoproductFunctor`, `ordinaryH0_componentFiltration`, `ordinaryH0_simplicialPointClass`, `ordinaryH0_pointClass`, `ordinaryH0_naturalIso`, `ordinaryH0_filtrationIso`; `ordinaryH0Control_intCoeff`, `ordinaryH0Control_zeroCoeff`, `ordinaryH0Control_mod2Coeff` (abbrev), `ordinaryH0Control_collapse`, -`ordinaryH0Control_fst`, `ordinaryH0Control_parabolaLeft`, `ordinaryH0Control_parabolaRight`. Every one of the 153 -declarations is a `#print axioms` target. +`ordinaryH0Control_fst`, `ordinaryH0Control_parabolaLeft`, `ordinaryH0Control_parabolaRight`; +`superlevelBarField_interface`, `superlevelBarField_shift`. Every one of the 167 +declarations is a `#print axioms` target. The external `Specifications.Field` declarations are not +inventory targets; their axioms enter the audit through the adapter's declarations, whose +`#print axioms` reports are transitive. ## What is NOT established @@ -254,14 +292,19 @@ Copied from the handoff's own exclusions (TORUS_FILTRATION.md, source review F3 - smooth quotient charts, Morse index transfer, handle analysis, critical-free band invariance; - a compiled theorem naming the externally owned `Specifications.Field` module: the companion carries the literal formulas (`torus_field_latticeVec_formula`, `torus_field_periodic_formula`) - and does not import that file. + and does not import that file. (companion note, 2026-10-12, Math- #428 comment 6124097060, not + part of the copied exclusion: this stays true of the C254 modules; since 2026-10-12 the + owner-authored `SuperlevelBarField.lean` imports `Specifications.Field`, the only companion module + that does, see [C263 Field adapter](#c263-field-adapter-2026-10-12)) Copied from the C263 module's own docstrings (`SuperlevelBar.lean`): - an inhabitant of the separately owned Field or Lifetime record, an elder relation, Morse endpoint attainment, ordinary H0 bar pairing, finite-bar counts, a Gaussian field or weighted law, or scientific acceptance; the scalar zero on an empty set is a default, not an - essential-bar death; + essential-bar death; (companion note, 2026-10-12, not part of the copied text: this stays true of + `SuperlevelBar.lean`, whose bytes do not change; the owner-authored `SuperlevelBarField.lean` + constructs an inhabitant of the Field record from its definitions, and none of the Lifetime record) - closed-threshold attainment at the death height (the cut is strict; `superlevelBar_death_not_mem_clearance` says death is not a clearance); a finite death for an essential class; the death/start bound on the empty default branch (refuted by `superlevelBar_control_negative_essential`); compactness of @@ -294,6 +337,19 @@ Copied from the controls module's own docstrings (`OrdinaryH0Controls.lean`): nonvanishing; H0 of the empty space for coefficients other than `ℤ` and the zero module; path components of a non-discrete space beyond the explicit cases. +Copied from the adapter module's own docstring (`SuperlevelBarField.lean`): + +- an identification of `ElderPartner` with a persistence-module elder rule, the source's elder + event or its Borel measurability (the clause holds by definition, not as a theorem about + persistence); any use of periodicity or of `L` in the construction (the uniqueness theorems take + the periodicity hypothesis only to apply an arbitrary inhabitant's clauses, and are false without + it); a torus quotient; Morse genericity; any meaning of the value `0` that the C263 default gives + at essential points; anything about the separate + `UniversalLaw.Spec.Lifetime.SuperlevelBarInterface` (not inhabited here) or about any Lifetime + statement; scientific acceptance. The statement packet's own text "no inhabitant is constructed" + is about that packet and stays true of it; nothing in it changes. No claim-level label moves; + alignment stays PENDING_INDEPENDENT_REVIEW. + Compile success, the axiom audit, `leanchecker` and the negative controls say that Lean elaborated these statements with these proofs at this pin. They do not say that the statements are the ones the research programme needs; that is the pending independent alignment review. @@ -312,7 +368,8 @@ conditions (6113033545 item 4; 6113372506; 6113277485 item 5), among them a dist source-bound execution output and source-bound hosted evidence and custody, which they say a source review alone does not meet; its disposition is for the C263/C264 handoff owners and nothing in this companion moves it. Alignment still needs a reviewer with nonzero organizational-independence -credit. No review of the `OrdinaryH0Controls` bytes is recorded. +credit. No review of the `OrdinaryH0Controls` bytes is recorded, and none of the `SuperlevelBarField` +bytes. ## Compile fixes at the pin @@ -470,22 +527,25 @@ refuse. The lexer also treats a closed block comment as a token separator (`theo is `theorem hidden`) and lexes numerals as Lean does (`0alias` is `0` then `alias`; `0x1Ftheorem` is `0x1F` then `theorem`), both found by that verification. **The declaration census the receipt stands on is therefore not the scanner but `Census.lean`**, emitted by `check.py emit` and run -by the replay: Lean itself lists every constant the six companion modules (the five modules and +by the replay: Lean itself lists every constant the seven companion modules (the six modules and the root) add to the environment, tagged `internal` or `user` (`Name.isInternalDetail`: `_`-prefixed, `eq_n`, `match_n`, `proof_n`, `omega_n` or numeric components) and `range` or `generated` (whether Lean recorded a declaration range, which every declaration elaborated from source syntax carries and compiler-generated constants lack). `check.py finish` requires the -user-named ranged constants to equal the 153 inventoried names exactly, refuses any ranged +user-named ranged constants to equal the 167 inventoried names exactly, refuses any ranged constant with an internal-style name (a `where`-clause `proof_1` written by hand), and requires the user-named generated constants to equal `census_auxiliary` in `SOURCE_FILES.json` exactly (today `TorusFiltration.torus_periodBasis.congr_simp`, the simp-congruence lemma Lean generates -for `torus_periodBasis`; the C263, C264 and controls modules add no user-named generated constant), so that +for `torus_periodBasis`; the C263, C264, controls and adapter modules add no user-named generated constant), so that list can name only constants Lean generated; internal generated constants (abstracted proofs, equation lemmas, `_simp` auxiliaries, and `CategoryTheory.Limits.sigmaConst.eq_1`, the equation lemma Lean generated for a Mathlib definition that `OrdinaryH0.lean` unfolds and attributed to -that module) are counted and otherwise ignored: 27 at the pin for the six modules, of which 12 -belong to the C26x pair and 4 to `OrdinaryH0Controls` (`_proof_1` and `eq_1` of -`ordinaryH0Control_parabolaLeft` and `ordinaryH0Control_parabolaRight`). A declaration +that module) are counted and otherwise ignored: 31 at the pin for the seven modules, of which 12 +belong to the C26x pair, 4 to `OrdinaryH0Controls` (`_proof_1` and `eq_1` of +`ordinaryH0Control_parabolaLeft` and `ordinaryH0Control_parabolaRight`) and 4 to +`SuperlevelBarField` (`_proof_1` and `_proof_2` of `superlevelBarField_interface` and +`superlevelBarField_shift`). The census lists companion modules only: the external +`Specifications.Field` is not companion source and its constants are not inventory. A declaration the scanner missed is refused by the receipt whatever its spelling, because it was elaborated from source and therefore carries a range. A compile fix that needs a refused form must extend the scanner, the inventory and, for a new compiler-generated constant, `census_auxiliary`. @@ -496,7 +556,8 @@ the scanner, the inventory and, for a new compiler-generated constant, `census_a transcribed, not awarded here. - `kernel-checked` appears only in `receipt.json`, written by `check.py finish` after a hosted run in which every build exited `0`, `leanchecker` replayed the companion modules' declarations - through the kernel without output (the exact invocation is recorded in `leanchecker.cmd` and + and those of the external `Specifications.Field` (modules mode), or the whole import closure + (`--fresh`), through the kernel without output (the exact invocation is recorded in `leanchecker.cmd` and copied into the receipt), and every axiom report lies in `{propext, Classical.choice, Quot.sound}`. - The words `verified`, `closed` (as a status) and `accepted` do not describe anything in this companion. `alignment_status` stays `PENDING_INDEPENDENT_REVIEW`; `scientific_acceptance` is @@ -510,16 +571,21 @@ cache for `formal/` retrieved: bash companions/torus_filtration_20261011/replay.sh -The replay: binds HEAD to the manifest (`check.py source`), runs the Python tests in normal and +The replay: binds HEAD to the manifest (`check.py source`, which also binds the external +`Field.lean` by identity), runs the Python tests in normal and `-O` modes, emits the Lean audit files, then inside `lake env bash` from `formal/` records -`lean --version` and every installed package HEAD, compiles `TorusTopology`, `ClosedSuperlevel`, -`SuperlevelBar`, `OrdinaryH0`, `OrdinaryH0Controls` (in that dependency order) and the root +`lean --version` and every installed package HEAD, compiles the statement packet's +`Specifications/Field.lean` with the packet's own `-DautoImplicit=false` (no warnings-as-errors: it +is the packet's source, not the companion's) into `.lake/torus-filtration-spec`, which must not +pre-exist and comes first on `LEAN_PATH`, ahead of the companion directory (it holds only +`Specifications/Field.olean`, so it shadows nothing, and nothing can shadow it), compiles `TorusTopology`, `ClosedSuperlevel`, +`SuperlevelBar`, `OrdinaryH0`, `OrdinaryH0Controls`, `SuperlevelBarField` (in that dependency order) and the root `TorusFiltration` with `-DwarningAsError=true`, compiles `Positive.lean` (six concrete applications -of the C254 theorems; unchanged by both registrations), `Audit.lean` (153 `#print axioms`), -`Types.lean` (118 `#check` with `pp.explicit`), `Census.lean` (the elaborated declaration census +of the C254 theorems; unchanged by every registration since), `Audit.lean` (167 `#print axioms`), +`Types.lean` (130 `#check` with `pp.explicit`), `Census.lean` (the elaborated declaration census above), runs -`leanchecker TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls TorusFiltration`, -and runs eleven negative controls. The replay unsets `PYTHONOPTIMIZE` first, so each Python invocation runs in exactly the +`leanchecker Specifications.Field TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls SuperlevelBarField TorusFiltration`, +and runs twelve negative controls. The replay unsets `PYTHONOPTIMIZE` first, so each Python invocation runs in exactly the mode its command line names, and every `check.py` invocation prints the mode it runs in (`TORUS_FILTRATION_PYTHON: optimize=N`) to the job log (an invocation that argparse rejects exits 2 before that line; the replay never issues one). @@ -536,6 +602,7 @@ elaborated as `example : := by ` and must fail with exactly | `RejectMergerKillsPointClass` (C264 item 4) | false statement `CategoryTheory.CategoryStruct.comp (ordinaryH0_pointClass (TopCat.of Bool) ordinaryH0Control_intCoeff true) (((AlgebraicTopology.singularHomologyFunctor (ModuleCat.{0} ℤ) 0).obj ordinaryH0Control_intCoeff).map ordinaryH0Control_collapse) = 0` (the collapse `Bool → Unit` kills the individual point class of `true`; a merger kills the difference, not the class, and `ordinaryH0Control_collapse_image_ne_zero` says the image class is nonzero), tactic `simp only [ordinaryH0Control_collapse_image_ne_zero]` | exit 1, `⊢ False` | | `RejectSeparationWithoutNonzeroCoeff` (C264 item 4) | false statement `ordinaryH0_pointClass (TopCat.of Bool) ordinaryH0Control_zeroCoeff true ≠ ordinaryH0_pointClass (TopCat.of Bool) ordinaryH0Control_zeroCoeff false` (the two point classes of `Bool` differ with zero coefficients; `ordinaryH0Control_bool_zeroCoeff_eq` says they are equal, so the separation statement needs `𝟙 R ≠ 0`), tactic `simp [ordinaryH0Control_bool_zeroCoeff_eq]` | exit 1, `⊢ False` | | `RejectNonmergerKillsDifference` (C264 item 4) | false statement `CategoryTheory.CategoryStruct.comp (ordinaryH0_pointClass (TopCat.of (Bool × Bool)) ordinaryH0Control_intCoeff ((true, false) : Bool × Bool) - ordinaryH0_pointClass (TopCat.of (Bool × Bool)) ordinaryH0Control_intCoeff ((false, true) : Bool × Bool)) (((AlgebraicTopology.singularHomologyFunctor (ModuleCat.{0} ℤ) 0).obj ordinaryH0Control_intCoeff).map ordinaryH0Control_fst) = 0` (the non-injective projection kills a difference whose images `true` and `false` stay in distinct components; `ordinaryH0Control_fst_difference_ne_zero` says it does not), tactic `simp only [ordinaryH0Control_fst_difference_ne_zero]` | exit 1, `⊢ False` | +| `RejectEssentialDeathDetermined` (Field adapter) | false statement `(superlevelBarField_interface 1 1).deathHeight (fun _ => (0 : ℝ)) 0 = (superlevelBarField_shift 1 1 1).deathHeight (fun _ => (0 : ℝ)) 0` (the interface determines the death height at an essential point: at the constant height `0` of `ℝ^1` every point is essential, and `superlevelBarField_control_essential_free` says the two records give `0` and `1`), tactic `norm_num [superlevelBarField_deathHeight_eq, superlevelBar_death_const, superlevelBarField_shift_deathHeight_const]` | exit 1, `⊢ False` | | `RejectSorry` | `theorem injected : False := by sorry` | exit 0 with the `sorry` warning; audit refuses `sorryAx` | | `RejectCustomAxiom` | `axiom hiddenPremise : False` behind one intermediate theorem | exit 0; audit refuses `hiddenPremise` | | `RejectNativeDecide` | `native_decide` proof | exit 0; audit refuses `injected._native.native_decide.ax_1_1` | @@ -545,45 +612,56 @@ and only the axiom audit refuses them, which is what the audit is for. `check.py `re.fullmatch` on each log, so a crash, an extra error or a different exit code is a failed control, not a passed one. `check.py finish` refuses an evidence directory that already holds `receipt.json` (a receipt is written once and never replaced; a new attempt needs a fresh -directory) and requires exactly the 65 evidence files, each a regular file and nothing else: the -fifteen emitted Lean files (`Audit.lean`, `Types.lean`, `Positive.lean`, `Census.lean` and the -eleven controls' `.lean`), a `.log` and `.status` pair for each of the eleven Lean processes (six -module builds, `positive`, `axioms`, `types`, `census`, `leanchecker`), the eleven controls' +directory) and requires exactly the 72 evidence files, each a regular file and nothing else: the +sixteen emitted Lean files (`Audit.lean`, `Types.lean`, `Positive.lean`, `Census.lean` and the +twelve controls' `.lean`), a `.log` and `.status` pair for each of the thirteen Lean processes (the +external Field build `build-spec-Field`, seven module builds, `positive`, `axioms`, `types`, +`census`, `leanchecker`), the twelve controls' `.log`/`.status`, `leanchecker.cmd`, `packages.log`, `toolchain.log`, `source.json`, `tests.log` and `tests-optimized.log` (`EVIDENCE_FILES` in `check.py`; C262 finding G3; 44 members before the C263/C264 registration added two builds and two controls, 54 before the -item-4 controls added one build and three controls). It then -re-runs the source binding, re-derives the fifteen emitted Lean files and requires byte equality +item-4 controls added one build and three controls, 65 before the Field adapter added two builds +and one control). It then +re-runs the source binding, re-derives the sixteen emitted Lean files and requires byte equality with the ones Lean consumed, checks every status, the toolchain line, the installed package HEADs against `formal/lake-manifest.json`, the recorded `leanchecker` invocation, the axiom and -type inventories, the declaration census and the eleven controls, and writes `receipt.json` with -`log_sha256` over exactly those 65 files, created exclusively (`O_EXCL`, `O_NOFOLLOW`). The -evidence directory `.lake/torus-filtration-evidence` must not pre-exist. +type inventories, the declaration census and the twelve controls, and writes `receipt.json` (which +also carries the external input record `external_inputs`, and whose `scope_note`, in the default +modules mode, names the external `Specifications.Field` among what `leanchecker` replayed; in +`--fresh` mode it says the whole import closure was re-checked from scratch) with `log_sha256` over exactly those 72 files, created exclusively (`O_EXCL`, `O_NOFOLLOW`). The +evidence directory `.lake/torus-filtration-evidence` and the Field build directory +`.lake/torus-filtration-spec` must not pre-exist. ### What `leanchecker` checks here, and why not `--fresh` -All five modules `import Mathlib` (`OrdinaryH0` also imports `ClosedSuperlevel`, `OrdinaryH0Controls` also imports `OrdinaryH0`), so their import closure is all of Mathlib (6.1 GB of `.olean` +All six companion modules `import Mathlib` (`OrdinaryH0` also imports `ClosedSuperlevel`, `OrdinaryH0Controls` also imports `OrdinaryH0`, `SuperlevelBarField` also imports `SuperlevelBar` and `Specifications.Field`, which imports only `Mathlib`), so their import closure is all of Mathlib (6.1 GB of `.olean` files at the pin). `leanchecker --fresh TorusFiltration`, the shape of the D2 companions' step (`leanchecker --fresh D2MomentBridge`, affordable there only because that module imports `Mathlib.Tactic` and one Bochner file), re-checks that entire closure from scratch: measured locally against the pinned cache at 4 threads it was still running at 1500 s with 6.6 GB resident, so it cannot complete inside a hosted job. The hosted -default is therefore `leanchecker TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls TorusFiltration` -(before the C263/C264 registration it named the three C254 modules, and before the item-4 controls the -four modules and the root; `check.py finish` now refuses both shorter forms): leanchecker +default is therefore `leanchecker Specifications.Field TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls SuperlevelBarField TorusFiltration` +(before the C263/C264 registration it named the three C254 modules, before the item-4 controls the +four modules and the root, and before the Field adapter the five modules and the root without +`Specifications.Field`; `check.py finish` now refuses all three shorter forms): leanchecker builds the environment from the cached, prebuilt dependency `.olean` files (trusted, exactly as -`lean` itself trusts them when compiling the modules) and replays every declaration of the six -named modules through the kernel. Measured locally at `LEAN_NUM_THREADS=2`: 30 s wall and 6.6 GB +`lean` itself trusts them when compiling the modules) and replays every declaration of the eight +named modules through the kernel. `Specifications.Field` is named first because the replay compiled +it itself; its declarations are replayed rather than trusted from that `.olean`. Measured locally at `LEAN_NUM_THREADS=2`: 30 s wall and 6.6 GB resident for the three C254 modules; 53 s for the five (2026-10-11, this lane's pre-commit run on the registered bytes) with a peak of about 8.4 to 8.7 GiB resident (two runs, sampled every 2 s); for the six (2026-10-12, this lane, the registered Lean bytes, sampled every 1 s), 75 s wall including the `lake env` start-up with a sampled peak of 8.64 GiB in the pre-commit run, and about 56 s of `leanchecker` itself with a sampled peak of 9.31 GiB inside a full local replay, no output on success (one `lean` compile of `ClosedSuperlevel.lean` takes 9 s and 6.8 GB; `OrdinaryH0.lean` compiles in 12 s, -`OrdinaryH0Controls.lean` in 12 s at a sampled peak of 6.5 GiB). +`OrdinaryH0Controls.lean` in 12 s at a sampled peak of 6.5 GiB). For the eight (2026-10-12, this lane, +the registered Lean bytes of all seven sources, sampled every 1 s): 85 s wall including the `lake env` +start-up, a sampled peak of 8.87 GiB resident, no output, exit 0, in a probe on separately built `.olean` +files of those bytes (an earlier probe on a pre-commit form of the adapter took 91 s at a sampled +peak of 7.97 GiB). With `LEAN_NUM_THREADS` unset on a four-core machine the five-module `leanchecker` exceeded a 13.36 GiB memory limit and was killed (twice, 2026-10-11), so `replay.sh` defaults `LEAN_NUM_THREADS` -to 2, the hosted job's setting, when the operator has not set it; the six-module form was run only -at two threads. `replay.sh` writes the exact invocation to +to 2, the hosted job's setting, when the operator has not set it; the six- and eight-module forms were +run only at two threads. `replay.sh` writes the exact invocation to `leanchecker.cmd`; `check.py finish` accepts only the two pinned forms, requires the modules-mode log to be empty, and copies command and mode into `receipt.json` under `leanchecker`. An operator who wants the whole-closure re-check runs @@ -613,15 +691,24 @@ locally. At the registration commit the registered set had no hosted completion. artifact, and this README does not adopt its receipt or its timings. The item-4 set (six builds, the census, eleven controls, 65 files) adds one `lean` compile of about 12 s and three control runs of about 10 s each, and the six-module `leanchecker` took 56 to 75 s locally (with and without `lake env` start-up; measured 2026-10-12 at `LEAN_NUM_THREADS=2`; -a full local replay took 279 s); the item-4 commit has no hosted completion recorded here. +a full local replay took 279 s); the item-4 commit has no hosted completion recorded here. The +Field-adapter set (eight builds including the external Field, the census, twelve controls, 72 files) +adds the `Field.lean` compile, one module compile and one control run; a full local replay of +`a4136577`, a pre-commit form of the adapter commit identical to it in every Lean, gate (`check.py`), +replay and workflow byte and differing only in documentation, tests, the manifest records and the +commit message, took 395 s (2026-10-12, `LEAN_NUM_THREADS=2`), exit 0, with an empty +`build-spec-Field` log (a record of a computation on a worktree, not a receipt); the adapter commit +has no hosted completion recorded here. The replay writes `TorusTopology.olean`, `ClosedSuperlevel.olean`, `SuperlevelBar.olean`, -`OrdinaryH0.olean`, `OrdinaryH0Controls.olean` and `TorusFiltration.olean` +`OrdinaryH0.olean`, `OrdinaryH0Controls.olean`, `SuperlevelBarField.olean` and `TorusFiltration.olean` into the companion directory (Lean needs them on `LEAN_PATH` for the root module and the audit files). They are build artefacts and must never be committed: the repository has no root `.gitignore`, `git add -A` would stage them, and `check.py source` then refuses the companion with `tracked companion membership differs` until they are removed in a follow-up commit. -Delete them before committing. +Delete them before committing. The external `Field.olean` goes to `.lake/torus-filtration-spec`, +outside the source tree; delete that directory (and the evidence directory) before a second local +replay. Local protocol tests: `python3 -B -S companions/torus_filtration_20261011/test_torus_filtration.py` and the same with `-O`. They exercise `check.py` against a temporary Git fixture with @@ -697,6 +784,26 @@ narrower attribution stands for those runs and is not revised. and marks the relabel of the C254 naturality exclusion (Math- #428 comment 6116225936) as a dated companion note; no label moves. Details in [C264 owner task item 4 controls](#c264-owner-task-item-4-controls-2026-10-12). +- C263 Field adapter (2026-10-12, one forward commit on top of a non-force merge of `main` `4afcca6a` + into the item-4 head `f13aa5fb`; the merge brings in #419's statement packet and touches no companion + path; the `formal/` tree is `38b6d1a7…` on both sides): the owner-authored `SuperlevelBarField.lean` + (8a247043…) is added as module six; the root module imports six modules; `check.py` gains the + external input record `EXTERNAL_INPUTS` (the statement packet's `Field.lean`, bound by identity in + the working tree and at HEAD, and recorded in `SOURCE_FILES.json` as `external_inputs`, compared + whole), the per-module external-import rule `EXTERNAL_IMPORTS` (the scanner admits + `import Specifications.Field` in `SuperlevelBarField.lean` only, and no other `Specifications` + module anywhere), the external build `build-spec-Field` and the module build, the eight-module + `leanchecker` command naming `Specifications.Field` (the six-module form is now refused), a census + over seven modules, the false control `RejectEssentialDeathDetermined`, and a second owner-module + record (compared whole); `EVIDENCE_FILES` goes from 65 to 72 members. The Actions workflow gains + the one `Field.lean` path in both triggers, and its stale comment counting "twelve `lean` + invocations" (24 now: the external build, seven module builds, the positive, audit, types and + census files, and twelve controls) is reworded without a count, since the file changes anyway. + The same commit carries the nonblocking item D1 of the engineering readback 5486565076: SCOPE's + evidence boundary now excludes "nonvanishing or separation for a zero coefficient object" where it + excluded any claim at all for such an object. `Positive.lean`, the eleven earlier controls' emitted files and the five + earlier modules are byte-for-byte unchanged; no label moves. + Details in [C263 Field adapter](#c263-field-adapter-2026-10-12). ## C263 and C264 registration (2026-10-11) @@ -848,11 +955,83 @@ commit (each module build, the emitted positive, audit, types and census files, `leanchecker`, the eleven controls and the three siblings, exit 0 or the pinned diagnostic, this lane, 2026-10-12) is a record of a computation on a worktree, not a receipt. +## C263 Field adapter (2026-10-12) + +This commit registers one owner-authored Lean module, `SuperlevelBarField.lean`, the one external +input it imports, and one false control against it. It follows the adapter route this lane retained +in Math- #428 comment 6112932068 (item 2) and the allocation of its import line and compile step in +comment 6124097060, made once #419's statement packet was on `main`. **Registration is not review**, +and the module is not a review of `SuperlevelBar`: it consumes the C263 definitions, so the FORMAL +HOLD of `SuperlevelBar` extends to it (its disposition is for the C263/C264 handoff owners); +alignment stays `PENDING_INDEPENDENT_REVIEW`; organizational-independence credit 0 (the same project +account wrote the statement packet, the adapter and this gate); scientific effect NONE. + +| Item | `SuperlevelBarField.lean` | +|---|---| +| Route | Math- #428 comment 6112932068, item 2 (retained by this lane, not part of the C263 core handoff); allocation 6124097060 | +| Author | Anthropic/Claude lane (companion owner), delegated AI work for Dylan Roy; not a handoff successor (no handoff bytes exist) | +| Registered bytes | SHA-256 `8a2470431c3fda5e98859aa9372cbb8866ed5c5c722cea5dfc28cb577840bbad`, 11816 bytes, 205 lines | +| Imports | `Mathlib`, `SuperlevelBar`, `Specifications.Field` (the only companion module with an external import) | +| External input | `specifications/lean_statements_20261010/Specifications/Field.lean`, SHA-256 `f22c91e0…`, 27767 bytes, blob `cc40e9d1…`; `check.py source` requires both its working bytes and its blob at HEAD to be exactly this, so a change to it on `main` withholds the receipt until the record changes; the workflow triggers on that path | +| Compile step | inside `lake env bash` from `formal/`, before the companion modules: `lean -DautoImplicit=false --root= -o .lake/torus-filtration-spec/Specifications/Field.olean /Specifications/Field.lean`, with `.lake/torus-filtration-spec` first on `LEAN_PATH` (the packet's own `leanOptions`; no warnings-as-errors, since it is the packet's source; no second Mathlib, since the packet and `formal/` pin the same toolchain and package revisions, a parity the packet's own `check.py` (`check_lock`) enforces in its own CI; this companion does not read the packet's lakefile or manifest) | +| Declarations | 12 theorems, 2 defs, 0 abbrevs, 0 instances; every name prefixed `superlevelBarField_` | +| Range-aware census at the pin | 18 = 14 + 0 + 4 (user range + user generated + internal generated: `_proof_1` and `_proof_2` of `superlevelBarField_interface` and `superlevelBarField_shift`) | +| `census_auxiliary` | no new entry | +| `#print axioms` | all 14 within `{propext, Classical.choice, Quot.sound}` | +| New false control | `RejectEssentialDeathDetermined` | +| Provenance | `provenance.owner_modules` and `external_inputs` in `SOURCE_FILES.json`, compared whole with `OWNER_MODULES` and `EXTERNAL_INPUTS` in `check.py`; the protocol tests refuse tracked bytes that are not the recorded identities | +| Status | registered; no review of these bytes is recorded; FORMAL HOLD of `SuperlevelBar` unchanged and extended to this module; credit 0 | + +What the module shows (the declarations are listed under +[`SuperlevelBarField`](#superlevelbarfield-12-theorems-2-defs--c263-field-adapter)): the interface is +inhabited for every `d` and `L`, by the C263 data and the elder clause's own right-hand side; on +smooth `L`-periodic heights the interface determines essentiality, the death height at nonessential +points and, on the Morse distinct-value locus, the elder relation, so any inhabitant agrees with +this one there; at essential points it does not determine the death height, and two inhabitants +differ there. + +The control, a false statement whose tactic rewrites both sides to their values and must leave +exactly `⊢ False`: + +| Control | Intended reason for refusal | Diagnostic pinned from Lean at the pin | +|---|---|---| +| `RejectEssentialDeathDetermined` | the record and its shift by `1` would agree at an essential point if the interface determined the death height there; `superlevelBarField_deathHeight_eq`, `superlevelBar_death_const` and `superlevelBarField_shift_deathHeight_const` rewrite the two sides to `0` and `1` | `RejectEssentialDeathDetermined.lean:3:149: error: unsolved goals` / `⊢ False`, exit 1 | + +Discriminator: the same tactic on the true sibling (the shift by `0` instead of `1`), in the same +emitted format and under the same file name, proves it: exit 0 and no output, which `check.py +negative` refuses under either exit status (`FIELD_SIBLING_LOG` in the protocol tests). So the +control's `⊢ False` comes from the falsehood of its statement. The sibling run is a local record of +this lane (2026-10-12), not a member of the evidence directory; the control run is. + +Evidence count: `EVIDENCE_FILES` goes from 65 to 72 members: the `.log` and `.status` of +`build-spec-Field` and of `build-SuperlevelBarField` (4), and the control's `.lean`, `.log` and +`.status` (3). The census grows from 181 to 199 constants (167 user range, the one user-generated +`congr_simp`, 31 internal generated), `Audit.lean` from 153 to 167 `#print axioms`, `Types.lean` +from 118 to 130 `#check`, and the `leanchecker` command names eight modules. + +What this commit does not establish: any review of `SuperlevelBar` or of the adapter (FORMAL HOLD +unchanged and extended); that `ElderPartner` is a persistence-module elder rule, the source's elder +event, or Borel measurable (its clause holds by definition); any use of periodicity or of `L` in the +construction (the uniqueness theorems need the periodicity hypothesis to apply an inhabitant's +clauses); an +inhabitant of `UniversalLaw.Spec.Lifetime.SuperlevelBarInterface`, a separate structure that the +Lifetime statements consume (the adapter inhabits the Field copy only); any Lifetime statement or +density; any change to the statement packet, whose REGISTER text "no inhabitant is constructed" +is about the packet and stays true of it (no claim-level label moves; `Field.lean`'s formal +progress stays `specified`); alignment (`PENDING_INDEPENDENT_REVIEW`); any +organizational-independence credit (0). This lane's own adversarial checks before registration +were the same project account, credit 0, and are not a review. Local evidence for this commit +(the full replay of `a4136577` above, identical in every Lean, gate, replay and workflow byte: each +build, the emitted positive, audit, types and census files, the eight-module `leanchecker` and the +twelve controls, exit 0 or the pinned diagnostic; and the sibling run on the registered Lean bytes; +this lane, 2026-10-12) is a record of a computation on a worktree, not a receipt. + ## What this companion does not do It does not modify `formal/`, the D2 companions or their workflows. It does not enter the q0 dependency graph, raise any claim's grade, or substitute for the nonauthor source review, the independent alignment review or the operator's decisions. It does not lift the C263 or C264 FORMAL HOLD, and it does not review the successor bytes it registers; `OrdinaryH0Controls` is not -a review of `OrdinaryH0`. The hosted receipt is a +a review of `OrdinaryH0`, and `SuperlevelBarField` is not a review of `SuperlevelBar`, identifies no +persistence elder rule and changes nothing in the statement packet it imports. The hosted receipt is a record of a computation, not evidence of alignment with the research programme. diff --git a/companions/torus_filtration_20261011/SCOPE.md b/companions/torus_filtration_20261011/SCOPE.md index 1a9b5caf6..a68e8497a 100644 --- a/companions/torus_filtration_20261011/SCOPE.md +++ b/companions/torus_filtration_20261011/SCOPE.md @@ -1,14 +1,15 @@ -# Scope note: C254 torus quotient and closed-superlevel filtration companion, with the C263 strict-cut and C264 ordinary-H0 modules +# Scope note: C254 torus quotient and closed-superlevel filtration companion, with the C263 strict-cut and C264 ordinary-H0 modules and the C263 Field adapter Dylan Roy — delegated AI work. Source authors: OpenAI/Codex lanes (C254: `TorusTopology`, `ClosedSuperlevel`; C263: `SuperlevelBar`; C264: `OrdinaryH0`). Compile fixes, the C264 owner -repair, the owner-authored controls module `OrdinaryH0Controls` (C264 owner task item 4) and the -companion: Anthropic/Claude lane. Scientific effect NONE; +repair, the owner-authored controls module `OrdinaryH0Controls` (C264 owner task item 4), the +owner-authored Field adapter `SuperlevelBarField` and the companion: Anthropic/Claude lane. +Scientific effect NONE; organizational-independence credit 0; no human review; alignment `PENDING_INDEPENDENT_REVIEW`. -This note fixes what the 118 theorem statements and 35 audited definitions of the five modules +This note fixes what the 130 theorem statements and 37 audited definitions of the six modules (`TorusTopology.lean`, `ClosedSuperlevel.lean`, `SuperlevelBar.lean`, `OrdinaryH0.lean`, -`OrdinaryH0Controls.lean`; 153 declarations) cover and what they do not. An independent reviewer must compare each Lean +`OrdinaryH0Controls.lean`, `SuperlevelBarField.lean`; 167 declarations) cover and what they do not. An independent reviewer must compare each Lean statement with this note and with the handoffs' own scope (TORUS_FILTRATION.md in comment 6111059166 for C254; the module docstrings and Math- #428 comments 6113033545 and 6113372506 for C263 and C264) before any alignment record is written. The compile fixes and the C264 repair @@ -30,7 +31,11 @@ organizational-independence credit and was posted from the same project account. unchanged; its disposition is for the C263/C264 handoff owners, alignment still needs a reviewer with nonzero organizational-independence credit, and this note moves no label. `OrdinaryH0Controls` applies seven of the 20 C264 theorems (and three of its definitions) to concrete fixtures; it is not -a handoff module, not a review of `OrdinaryH0`, and lifts nothing. +a handoff module, not a review of `OrdinaryH0`, and lifts nothing. `SuperlevelBarField` builds an +inhabitant of the statement packet's `UniversalLaw.Spec.Field.SuperlevelBarInterface` from the C263 +definitions; it is not a handoff module and not a review of `SuperlevelBar`, the FORMAL HOLD of +`SuperlevelBar` extends to it, and its elder relation holds its clause by definition, not as a +theorem about persistence. ## Bound sources @@ -42,7 +47,7 @@ a handoff module, not a review of `OrdinaryH0`, and lifts nothing. this lane: 6111093545 (local elaboration report), 6111139060 (pickup). - Namespace mapping `ResearchFormalCoreR1.` (handoff) -> `TorusFiltration.` (companion); `SuperlevelBar` and `OrdinaryH0` were authored directly in namespace `TorusFiltration`, and so - was the owner-authored `OrdinaryH0Controls`. + were the owner-authored `OrdinaryH0Controls` and `SuperlevelBarField`. - C263 handoff `SuperlevelBar.lean` SHA-256 `d74dc8b2c25eff5b90ce7133e51a0888c7885cae24ca6d5e648bc514089637a8` (14904 bytes; Math- #428 comments 6113033147, 6113033351, 6113033545; allocation #419 comment 6112439759), failed at the @@ -65,6 +70,16 @@ a handoff module, not a review of `OrdinaryH0`, and lifts nothing. (29590 bytes; first compiled form `e825837f…`, 28503 bytes, differing only in the module-docstring paragraph on review status); imports `Mathlib` and `OrdinaryH0`; 37 theorems, 3 abbrevs, 4 defs, prefix `ordinaryH0Control_`. Census at the pin 48 = 44 + 0 + 4. +- Owner-authored `SuperlevelBarField.lean` (the C263 Field adapter, Math- #428 comments 6112932068 + and 6124097060; no handoff bytes, not a successor): SHA-256 + `8a2470431c3fda5e98859aa9372cbb8866ed5c5c722cea5dfc28cb577840bbad` (11816 bytes); imports + `Mathlib`, `SuperlevelBar` and `Specifications.Field`; 12 theorems, 2 defs, prefix + `superlevelBarField_`. Census at the pin 18 = 14 + 0 + 4. +- External input (statement packet, not companion source): + `specifications/lean_statements_20261010/Specifications/Field.lean`, SHA-256 + `f22c91e082cd7e738ba47c9c3534e47ac687d066f0b78586d15103cf1132535e`, 27767 bytes, blob + `cc40e9d19446b8a150401c574d3cfd56177f195f`, imports `Mathlib` only; compiled in the replay with the + packet's own `-DautoImplicit=false`; bound by identity in the working tree and at HEAD. - Pinned environment read from `formal/`: `leanprover/lean4:v4.34.1`, Mathlib `d13f23b723b8a846827a245b89c10fc7d3f11612`; nothing from the core is imported or pinned. @@ -72,7 +87,7 @@ a handoff module, not a review of `OrdinaryH0`, and lifts nothing. | Targets | Exact coverage | Not established | |---|---|---| -| `torus_field_latticeVec_formula`, `torus_basis_sum_eq_latticeVec`, `torus_lattice_mem_iff` | `torus_latticeVec d L n = ∑ i, EuclideanSpace.single i (L * n i)` by `rfl`; the integer combination of the `L`-scaled standard basis is that vector; lattice membership iff an integer vector produces the point | any elaborated theorem naming the externally owned `Specifications.Field` module; the companion carries the literal formula and does not import that file | +| `torus_field_latticeVec_formula`, `torus_basis_sum_eq_latticeVec`, `torus_lattice_mem_iff` | `torus_latticeVec d L n = ∑ i, EuclideanSpace.single i (L * n i)` by `rfl`; the integer combination of the `L`-scaled standard basis is that vector; lattice membership iff an integer vector produces the point | any elaborated theorem of the C254 modules naming the externally owned `Specifications.Field` module; they carry the literal formula and do not import that file (only the owner-authored `SuperlevelBarField` imports it, below) | | `torus_proj_surjective`, `torus_proj_continuous`, `torus_proj_eq_iff`, `torus_control_lattice_translate` | the quotient projection is surjective and continuous; `proj x = proj y ↔ ∃ n, y = x + torus_latticeVec d L n`; a lattice translate has the same image | a fundamental-domain parametrisation; uniqueness of representatives | | `torus_proj_isCoveringMap`, `torus_compact`, `torus_pathConnectedSpace` (with the three discreteness/`IsZLattice` instances) | the projection is a covering map; `IsCompact Set.univ` on the quotient; the quotient is path connected | a registered `CompactSpace` instance; smooth charts; any manifold structure | | `torus_field_periodic_formula`, `torus_periodic_respects`, `torus_descend_proj`, `torus_descend_continuous` | `torus_isPeriodic d L g` is literally the Field periodicity formula; periodic `g` respects the quotient relation; `descend g (proj x) = g x`; the descent is continuous when `g` is | smoothness of descended functions; derivative or Hessian invariance; Morse-index compatibility | @@ -86,7 +101,7 @@ a handoff module, not a review of `OrdinaryH0`, and lifts nothing. | `superlevelBar_death_eq_zero_of_empty`, `superlevelBar_death_eq_zero_of_essential`, `superlevelBar_death_eq_sSup_of_nonempty` | `superlevelBar_deathHeight` is `sSup` of the clearance set when nonempty and the declared default `0` when empty, hence `0` for essential inputs | a geometric death event or finite persistence interval at that `0`; a finite death for an essential class; the handoff's own words: the scalar zero on an empty set is a default, not an essential-bar death | | `superlevelBar_path_minimum`, `superlevelBar_clearance_nonempty`, `superlevelBar_clearance_nonempty_iff`, `superlevelBar_clearance_downward`, `superlevelBar_clearance_improve` | a continuous height attains a minimum on each path; for continuous `g` the clearance set is nonempty exactly off the essential locus (`Path.segment`, minimum minus one); clearance is downward closed; each strict witness has a strictly larger witness on its own path | a minimum over all paths or an optimal path; compactness of the whole Euclidean domain; a witness strictly above the supremum | | `superlevelBar_strict_cut`, `superlevelBar_death_le_start_of_nonempty`, `superlevelBar_death_le_start`, `superlevelBar_clearance_eq_Iio`, `superlevelBar_death_not_mem_clearance`, `superlevelBar_cut_unique` | for continuous nonessential inputs: `h < death ↔ h ∈ clearance`; death `≤ g M`; the clearance set is `Set.Iio death`; death is not a clearance; a real with the same strict cut is the death height | closed-threshold attainment at the death height; the death/start bound on the empty default branch; equality of arbitrary total interface records off the valid locus | -| `superlevelBar_death_const`, `superlevelBar_control_negative_essential` | a constant height has death `0` everywhere; the handoff's own control: the constant `-1` has death `0` and `¬ 0 ≤ -1`, so no unconditional death/start bound holds on the essential default | any finite ordinary bar for a constant height; an inhabitant of the separately owned Field or Lifetime record; an elder relation; Morse endpoint attainment; ordinary H0 bar pairing; finite-bar counts; a Gaussian field or weighted law | +| `superlevelBar_death_const`, `superlevelBar_control_negative_essential` | a constant height has death `0` everywhere; the handoff's own control: the constant `-1` has death `0` and `¬ 0 ≤ -1`, so no unconditional death/start bound holds on the essential default | any finite ordinary bar for a constant height; an inhabitant of the separately owned Field or Lifetime record (by these C263 declarations; the adapter below builds one of the Field record from them); an elder relation; Morse endpoint attainment; ordinary H0 bar pairing; finite-bar counts; a Gaussian field or weighted law | | `ordinaryH0_componentCoproductMap_iota`, `ordinaryH0_componentFiltration_map_iota` (C264) | the component functor `TopCat ⥤ Type` (objects `ZerothHomotopy X`, maps `superlevel_componentMap`) followed by `sigmaConst.obj R` sends the generator at `q` to the generator at `superlevel_componentMap f.hom q`; the same along a closed-superlevel inclusion `homOfLE hst` through `superlevel_componentInclusion` | that distinct source components stay distinct; a reverse inclusion or endpoint deletion; regularity, finite dimensionality or Morse hypotheses on the height | | `ordinaryH0_simplicialPointClass_iso`, `ordinaryH0_simplicialPointClass_map`, `ordinaryH0_toSSet_pointMap`, `ordinaryH0_pointClass_map`, `ordinaryH0_pointClass_iso`, `ordinaryH0_componentIota_isoInv`, `ordinaryH0_hom_ext` | in Mathlib's actual singular homology: the point class of a zero-simplex composed with `S.homology₀Iso R` is the generator at `SSet.π₀.mk x`; the actual homology map transports point classes; `TopCat.singularHomology₀Iso` sends `ordinaryH0_pointClass X R x` to the generator at `ZerothHomotopy.mk x` (and inversely); morphisms out of singular H0 agree if they agree on all point classes | a replacement or free-module definition standing in for singular H0; a transported or postulated substitute for the actual homology map; injectivity of the induced map; a distinguished geometric representative; a basis of geometric maxima or finiteness of components | | `ordinaryH0_iso_naturality` (with `ordinaryH0_naturalIso`) | Mathlib's objectwise comparison `TopCat.singularHomology₀Iso` commutes with every continuous map, proved from actual zero-cycle generators (the repaired proof: explicit reassociation of both sides), so it assembles into a natural isomorphism `(singularHomologyFunctor C 0).obj R ≅ ordinaryH0_componentCoproductFunctor R` | naturality by an added assumption or compatibility record (none is used); an interval decomposition or persistence-bar classification | @@ -101,6 +116,10 @@ a handoff module, not a review of `OrdinaryH0`, and lifts nothing. | `ordinaryH0Control_square_differences_ne_zero`, `ordinaryH0Control_fst_difference_zero`, `ordinaryH0Control_fst_difference_ne_zero` (with `ordinaryH0Control_fst`) | non-merger fixture: the non-injective first projection `Bool × Bool → Bool` kills the difference of `(true, false)` and `(true, true)` and keeps that of `(true, false)` and `(false, true)` nonzero; both differences are nonzero before the map | injectivity of the induced H0 map (which fails on the first pair) | | `ordinaryH0Control_bool_zeroCoeff_eq`, `ordinaryH0Control_point_zeroCoeff_eq_zero`, `ordinaryH0Control_separation_needs_nonzero`, `ordinaryH0Control_nonvanishing_needs_nonzero` | with zero coefficients the two point classes of `Bool` are equal although the components differ and the point class of the point is `0`; so the separation and nonvanishing statements are false without `𝟙 R ≠ 0` | any failure of the C264 statements, which keep that hypothesis | | `ordinaryH0Control_parabola_le`, `ordinaryH0Control_parabola_strict_growth`, `ordinaryH0Control_parabola_not_joined_quarter`, `ordinaryH0Control_parabola_joined`, `ordinaryH0Control_parabola_difference_zero`, `ordinaryH0Control_parabola_strict_difference_ne_zero` (with `ordinaryH0Control_parabolaLeft`, `ordinaryH0Control_parabolaRight`) | filtration fixture for `x ↦ x ^ 2`: `-1` and `1` in the closed superlevel at parameter `-1`; the strict inclusion into the level at `-1/4` keeps the difference of their classes nonzero (no path through `0` in `{x | 1/4 ≤ x ^ 2}`); the inclusion into the level at `0`, the whole line, kills it | a first merger level, threshold attainment, the behaviour strictly between `-1/4` and `0`; any Morse, interval, elder, count, Field or stochastic statement | +| `superlevelBarField_continuous`, `superlevelBarField_nonempty` (with `superlevelBarField_interface`) (Field adapter) | a height smooth in the Field sense is continuous; for every `d` and `L` the record with `deathHeight := superlevelBar_deathHeight`, `IsEssential := superlevelBar_isEssential` and `ElderPartner :=` the right-hand side of the `elderPartner_iff` clause inhabits `UniversalLaw.Spec.Field.SuperlevelBarInterface d L` (maximin clause from `superlevelBar_strict_cut`; essentiality clause from `superlevelBar_essential_iff`; elder clause by `Iff.rfl`) | a persistence-module elder rule, the source's elder event or its Borel measurability (the elder clause holds by definition); any use of periodicity or of `L` in the construction; a torus quotient; Morse genericity; an inhabitant of `UniversalLaw.Spec.Lifetime.SuperlevelBarInterface`; any Lifetime statement | +| `superlevelBarField_deathHeight_eq`, `superlevelBarField_isEssential_iff`, `superlevelBarField_elderPartner_iff` | the record's three fields, by `rfl` / `Iff.rfl` | any meaning of the value `0` the C263 default gives at essential points | +| `superlevelBarField_essential_unique`, `superlevelBarField_deathHeight_unique`, `superlevelBarField_elderPartner_unique` | for every inhabitant `I` and smooth `L`-periodic height: `I.IsEssential` is global maximality; at a nonessential point `I.deathHeight` is the C263 death height (`superlevelBar_cut_unique`); on the Morse distinct-value locus `I.ElderPartner` is the record's (the periodicity hypothesis is needed: it is what applies `I`'s clauses) | agreement at essential points (refuted below) or off the guarded locus, non-periodic heights included; that any inhabitant is the source's superlevel H0 object | +| `superlevelBarField_shift_deathHeight_const`, `superlevelBarField_const_smooth`, `superlevelBarField_const_periodic`, `superlevelBarField_control_essential_free` (with `superlevelBarField_shift`) | a second inhabitant whose death height at essential points is a constant `c`; constant heights are smooth and `L`-periodic; at the constant height `0`, where every point is essential for both records, the record gives `0`, its shift by `1` gives `1`, and they differ, so the nonessential hypothesis of the uniqueness theorem cannot be dropped | a preferred value at essential points | The audited definitions (`torus_E`, `torus_quotient`, `torus_latticeVec`, `torus_periodBasis`, `torus_periodLattice`, `torus_proj`, `torus_isPeriodic`, `torus_descend`, the three lattice @@ -111,7 +130,8 @@ instances, `superlevel_set`, `superlevel_inclusion`, `superlevel_componentMap`, `ordinaryH0_componentFiltration`, `ordinaryH0_simplicialPointClass`, `ordinaryH0_pointClass`, `ordinaryH0_naturalIso`, `ordinaryH0_filtrationIso`, `ordinaryH0Control_intCoeff`, `ordinaryH0Control_zeroCoeff`, `ordinaryH0Control_mod2Coeff`, `ordinaryH0Control_collapse`, -`ordinaryH0Control_fst`, `ordinaryH0Control_parabolaLeft`, `ordinaryH0Control_parabolaRight`) are +`ordinaryH0Control_fst`, `ordinaryH0Control_parabolaLeft`, `ordinaryH0Control_parabolaRight`, +`superlevelBarField_interface`, `superlevelBarField_shift`) are constructions and fixtures, not claims; they are audited so that no hidden axiom enters through a definition. @@ -127,6 +147,7 @@ definition. | `RejectMergerKillsPointClass` (C264 item 4) | a merger confused with the death of a class: the collapse `Bool → Unit` asserted to kill the individual point class of `true`; `ordinaryH0Control_collapse_image_ne_zero` rewrites it to `False`; `⊢ False` | | `RejectSeparationWithoutNonzeroCoeff` (C264 item 4) | a separation claim without its coefficient hypothesis: the two point classes of `Bool` asserted to differ with zero coefficients; `ordinaryH0Control_bool_zeroCoeff_eq` rewrites it to `False`; `⊢ False` | | `RejectNonmergerKillsDifference` (C264 item 4) | a non-injective map confused with a merger: the projection `Bool × Bool → Bool` asserted to kill the difference of `(true, false)` and `(false, true)`, whose images stay in distinct components; `ordinaryH0Control_fst_difference_ne_zero` rewrites it to `False`; `⊢ False` | +| `RejectEssentialDeathDetermined` (Field adapter) | the interface asserted to determine the death height at an essential point: the record and its shift by `1` asserted equal at the constant height `0` of `ℝ^1`; `superlevelBarField_deathHeight_eq`, `superlevelBar_death_const` and `superlevelBarField_shift_deathHeight_const` rewrite it to `0 = 1`; `⊢ False` | | `RejectSorry`, `RejectCustomAxiom`, `RejectNativeDecide` | an admitted proof, a hidden premise behind an intermediate theorem, and a native-code decision each pass Lean (exit 0) and must be refused by the transitive axiom audit (`sorryAx`, `hiddenPremise`, `injected._native.native_decide.ax_1_1`) | Each control is matched by `re.fullmatch` against its pinned diagnostic; the false-statement @@ -136,7 +157,8 @@ the three item-4 controls the same tactic on each control's true sibling stateme pin and leaves a different diagnostic (`` `simp` made no progress ``, or a goal other than `False` with an unused simp argument), which `negative` refuses; those sibling logs are pinned in the protocol tests as negative controls, so each control's `⊢ False` is attributable to the falsehood -of its statement. +of its statement. For the Field-adapter control the same tactic on its true sibling (the shift by +`0`) proves it, exit 0 and no output, which `negative` refuses under either exit status. The Python suite additionally refuses every weakening of `check.py` it knows about (wrong diagnostic, wrong exit code, unknown control, `sorryAx`, unknown or missing audit target, unrecognized audit text, missing or extra type, a diagnostic after the type listing, membership @@ -160,7 +182,15 @@ of the root, an `open scoped` line with a lowercase or missing namespace or anyt line, the pre-registration two-import root module and three-module `leanchecker` command, a module name outside `MODULES`, since the item-4 controls the pre-controls four-import root module and five-module `leanchecker` command, an import of `OrdinaryH0Controls` by an earlier module, the three item-4 controls' true-sibling -diagnostics, single-field changes to the owner-module record of `OrdinaryH0Controls` (hash, byte count, author, kind, +diagnostics, since the Field adapter an import of `Specifications.Field` by any module other than +`SuperlevelBarField`, an import of any other `Specifications` or `SpecificationProofs` module, of a +`Specifications.Field` submodule or of the bare package name, an import of `SuperlevelBarField` by an +earlier module, the pre-adapter five-import root module and six-module `leanchecker` command, an +external `Field.lean` edited in the working tree (also by one byte at equal length), edited and +committed, deleted, restored over a changed commit (staged or not) or reached through a symlinked +directory, a change to each single field of the external input record and of the adapter's owner +record, each of their fields dropped on its own, an added field, a dropped or added entry and an +emptied external record, the Field-adapter control's true-sibling outcome, single-field changes to the owner-module record of `OrdinaryH0Controls` (hash, byte count, author, kind, review status, census, credit, a dropped comment pointer, an added field, a dropped or added entry, the record copied into the successor record), and single-field changes to the successor record (a changed handoff or successor hash, a successor byte count or a C26x entry of `provenance.original_bytes`, a changed census line, a nonzero credit, a lifted or @@ -170,15 +200,16 @@ comparison in `metadata`, not by a control of their own). ## Evidence boundary -A green hosted run establishes, for these 153 declarations at this toolchain and dependency -lock, that Lean elaborated them with warnings as errors, that Lean's own census of the -constants the six modules (the five modules and the root) add to the environment -(`Census.lean`, with declaration-range and internal-name tags) has exactly these 153 as its +A green hosted run establishes, for these 167 declarations at this toolchain and dependency +lock, that Lean elaborated them with warnings as errors (and the external `Field.lean`, bound by +identity, with the packet's own options), that Lean's own census of the +constants the seven modules (the six modules and the root) add to the environment +(`Census.lean`, with declaration-range and internal-name tags) has exactly these 167 as its user-written declarations and exactly the one named compiler-generated auxiliary (internal -generated constants, 27 at the pin, are counted and otherwise ignored), that -`leanchecker TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls TorusFiltration` replayed the -companion modules' own -declarations through the kernel against the cached, prebuilt dependency `.olean` files (the +generated constants, 31 at the pin, are counted and otherwise ignored), that +`leanchecker Specifications.Field TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls SuperlevelBarField TorusFiltration` replayed the +companion modules' own declarations and those of the external `Specifications.Field` +through the kernel against the cached, prebuilt dependency `.olean` files (the import closure, all of Mathlib, is trusted from that cache and not re-checked; a `--fresh` re-check of the closure does not fit a hosted job and is available only as an operator's local run, which the receipt records as mode `fresh`), and that every transitive axiom lies in @@ -187,10 +218,13 @@ research programme, nothing about C253 or any q0 claim, and nothing the handoffs attainment, finite critical events, label tracking, naturality to singular-H0 generators beyond the functor laws (C254; the C264 module proves that naturality for Mathlib's actual H0 and nothing beyond it), interval decomposition, bar bijection, elder events, once-counting, any -identification of `PairLawInterface.p`, an inhabitant of the Field or Lifetime record, a Field -adapter, a Morse chart, a count identity, a Gaussian or stochastic law, closed-threshold -attainment at the C263 death height, reduced-H0 vanishing, or any claim for a zero coefficient -object; and, for `OrdinaryH0Controls`, nothing beyond its fixtures: no review of `OrdinaryH0`, no +identification of `PairLawInterface.p`, an inhabitant of the Lifetime record, a Morse chart, a count +identity, a Gaussian or stochastic law, closed-threshold attainment at the C263 death height, +reduced-H0 vanishing, or nonvanishing or separation for a zero coefficient object; for the +`SuperlevelBarField` adapter, which does build an inhabitant of the Field record, nothing beyond the +statements above: no persistence-module elder rule, no source elder event or its measurability, no +use of periodicity in the construction (its uniqueness theorems need the periodicity hypothesis), no +value at essential points, no Lifetime statement; and, for `OrdinaryH0Controls`, nothing beyond its fixtures: no review of `OrdinaryH0`, no first merger level or threshold attainment, no statement that its fixtures meet every row of the CONTROL_OBLIGATIONS matrix or that item 4 of the C264 owner task is closed. The receipt's `formalization_status: kernel-checked` is a record of that computation; `alignment_status` remains `PENDING_INDEPENDENT_REVIEW` and @@ -207,8 +241,9 @@ Lean execution as an open condition under FORMAL HOLD; no organizational-indepen posted from the same project account) exist; neither is a nonzero-credit review, and FORMAL HOLD is unchanged, its disposition being for the C263/C264 handoff owners. The registration of 2026-10-11 is not a review, and the compiler, repairer and registrar of both successors, and the author and -registrar of `OrdinaryH0Controls` (df9d3645…), is the companion's own lane at -organizational-independence credit 0. Aging approves nothing. +registrar of `OrdinaryH0Controls` (df9d3645…) and of `SuperlevelBarField` (8a247043…), is the +companion's own lane at organizational-independence credit 0; the FORMAL HOLD of `SuperlevelBar` +extends to the adapter, which consumes its definitions. Aging approves nothing. ## C264 owner task item 4 controls (2026-10-12) @@ -233,11 +268,34 @@ decomposition, elder correspondence, count identity, Field adapter or stochastic about connected (as opposed to path) components; a fixture for the 13 C264 theorems it does not name; any organizational-independence credit (0). +## C263 Field adapter (2026-10-12) + +The owner-authored `SuperlevelBarField.lean` (route: Math- #428 comment 6112932068, item 2, retained +by this lane; allocation of its import line and compile step: comment 6124097060) imports the +statement packet's `Specifications.Field`, the one external input of this companion, compiled in the +replay from its pinned bytes, and inhabits `UniversalLaw.Spec.Field.SuperlevelBarInterface d L` for +every `d` and `L` with the C263 death height and essentiality and the elder clause's own right-hand +side. It proves that on smooth `L`-periodic heights every inhabitant agrees with this one on +essentiality, on the death height at nonessential points and, on the Morse distinct-value locus, +on the elder relation, and that the interface leaves the death height at essential points free (a +second inhabitant differs there). It is registered with one false control +(`RejectEssentialDeathDetermined`, table above), refused with exactly `⊢ False` and discriminated +from its true sibling. The evidence directory grows from 65 to 72 members (two build pairs, one +control triple); the census from 181 to 199 constants (167 user range, 1 user generated, 31 +internal generated). It does not establish: a review of `SuperlevelBar` or of the adapter (FORMAL +HOLD unchanged and extended to the adapter); a persistence-module elder rule, the source's elder +event or its measurability; any use of periodicity or of `L` in the construction; an inhabitant of the +Lifetime record or +any Lifetime statement; any change to the statement packet (its REGISTER text +"no inhabitant is constructed" is about the packet and stays true of it; no claim-level label moves); alignment +(`PENDING_INDEPENDENT_REVIEW`); any organizational-independence credit (0). + ## Reproduction bash companions/torus_filtration_20261011/replay.sh python3 -B -S companions/torus_filtration_20261011/test_torus_filtration.py python3 -B -O -S companions/torus_filtration_20261011/test_torus_filtration.py -The replay must start without `.lake/torus-filtration-evidence` present and must not run -`formal/gate.py`, the formal tests, `lake build`, `lake update` or `lake exe cache`. +The replay must start without `.lake/torus-filtration-evidence` and `.lake/torus-filtration-spec` +present and must not run `formal/gate.py`, the formal tests, `lake build`, `lake update` or +`lake exe cache`. diff --git a/companions/torus_filtration_20261011/SOURCE_FILES.json b/companions/torus_filtration_20261011/SOURCE_FILES.json index 5248b61fa..c00edb600 100644 --- a/companions/torus_filtration_20261011/SOURCE_FILES.json +++ b/companions/torus_filtration_20261011/SOURCE_FILES.json @@ -54,6 +54,14 @@ ], "instance": [] }, + "SuperlevelBarField": { + "abbrev": [], + "def": [ + "superlevelBarField_interface", + "superlevelBarField_shift" + ], + "instance": [] + }, "TorusTopology": { "abbrev": [ "torus_E", @@ -74,11 +82,22 @@ ] } }, + "external_inputs": { + "specifications/lean_statements_20261010/Specifications/Field.lean": { + "bytes": 27767, + "compiled_with": "lean -DautoImplicit=false (the packet lakefile leanOptions), inside formal/ lake env", + "git_blob": "cc40e9d19446b8a150401c574d3cfd56177f195f", + "imported_by": "SuperlevelBarField", + "module": "Specifications.Field", + "sha256": "f22c91e082cd7e738ba47c9c3534e47ac687d066f0b78586d15103cf1132535e", + "status": "statement packet source (specified; not proved here); not companion source" + } + }, "files": { ".github/workflows/torus-filtration.yml": { - "bytes": 2084, - "git_blob": "becc58ff7e8362160c305bcdc8b386221966afad", - "sha256": "3b6b06856bad22f7e9d28f1caf0e1710db3284cd73d65bf6f7330bfbd45dc033" + "bytes": 2233, + "git_blob": "920bbcf0b0e58cc13a0e9e0d6debfd6e90f1cd11", + "sha256": "a4c986ae9e96e1af1dd8a41cac29421aad8cbda322e153b9aee37a93d4697cbf" }, "companions/torus_filtration_20261011/ClosedSuperlevel.lean": { "bytes": 8088, @@ -96,24 +115,29 @@ "sha256": "df9d3645282ca526b67eca3d5db691b622092a14b5fddee9be21013e39666184" }, "companions/torus_filtration_20261011/README.md": { - "bytes": 83629, - "git_blob": "5efed09b417eb9703268bed915b704bb301fbfa5", - "sha256": "a8d5c8dc1b9fb92572ad8b0d75753bf2a732beecbe55c1af58622775642d5d00" + "bytes": 102550, + "git_blob": "41dd08778188ddfbce2319dafe642671e6df4aae", + "sha256": "f587577832bd62e90a42711f0e984caeefa0648661032cd477330e8477e03895" }, "companions/torus_filtration_20261011/SCOPE.md": { - "bytes": 34269, - "git_blob": "1a9b5caf64e5699a9e32e60e7bd3571bcd4ac983", - "sha256": "b5daf6e22f6b738497f6df4fa9ec99622d95e41f952dd9dbdf196fa40a14b86f" + "bytes": 41948, + "git_blob": "a68e8497ad198981c2973e66de606640d7aaf778", + "sha256": "ac7ecaba59c6ff0912f3064c4cfe860dee256b593e248b0e0322a67b902892cf" }, "companions/torus_filtration_20261011/SuperlevelBar.lean": { "bytes": 15309, "git_blob": "b047384e20306ee030154885536c531633b88bd8", "sha256": "346eea948e18d5904422904006827930e27d3141ccbc19ee8ac2c24bcf65a4a9" }, + "companions/torus_filtration_20261011/SuperlevelBarField.lean": { + "bytes": 11816, + "git_blob": "f0300a6b459440e81064ef6f75990446a8a3db04", + "sha256": "8a2470431c3fda5e98859aa9372cbb8866ed5c5c722cea5dfc28cb577840bbad" + }, "companions/torus_filtration_20261011/TorusFiltration.lean": { - "bytes": 110, - "git_blob": "eb4bfab626feea0bbd45387fc23ae774e3663ec3", - "sha256": "09887f618ac7fbe7ac9569c185a6e28bb8ee39a0f75e2909bc46e49b35f9d07a" + "bytes": 136, + "git_blob": "7dff5dbab05ab90b4a2d21aa3a4d6f8bda35f65e", + "sha256": "cddb8bc93569edbcc913eb7c79e23f9a5a637924207aabc2c11c1ad7fe476a75" }, "companions/torus_filtration_20261011/TorusTopology.lean": { "bytes": 12257, @@ -121,19 +145,19 @@ "sha256": "ddb145b3f791c181d4f2a51e54e711937297bd6476ba55bcd5252b7ddb57cfe1" }, "companions/torus_filtration_20261011/check.py": { - "bytes": 55524, - "git_blob": "f225c0534af6da636f9fde21745b15383cea9ef0", - "sha256": "0bd3b51f207a0a57457173290dfdb295935fa9d65b74bfbe13c46f4d16c18874" + "bytes": 63394, + "git_blob": "45681a4b936f8a9a83985cbd47f54a4102ba66b4", + "sha256": "8ed25915a7de769bd9eb64032d50e09960ce49fd90e86404e20b356be4747450" }, "companions/torus_filtration_20261011/replay.sh": { - "bytes": 5765, - "git_blob": "c654e50413aab00ed402d0ef7228063749b3695b", - "sha256": "7e25689e51c52786ac1ac92f805b441c0304e420381c7cfc2512fa62346049a4" + "bytes": 7304, + "git_blob": "ffc29a41f01b7007abeeb1460d03e010f204c016", + "sha256": "0d481c72bbccbc5bd64250108a8481e7c1e66f2046592ef1e0341aab8d5030e2" }, "companions/torus_filtration_20261011/test_torus_filtration.py": { - "bytes": 132040, - "git_blob": "9aeae2df61c21d147f10227da274aaf6e0c000f8", - "sha256": "aed03604172e9ba35aaedd70297601a39aa3979efbbe18143d0329502418d97b" + "bytes": 158823, + "git_blob": "44e4445e6f78fcaaf930595c673cc7fdc8faf9fd", + "sha256": "fdd126fb0ca6281a7d4d08c1caeb6cfcbd0875d200f02b56ad2ef9f277250450" } }, "modules": [ @@ -141,7 +165,8 @@ "ClosedSuperlevel", "SuperlevelBar", "OrdinaryH0", - "OrdinaryH0Controls" + "OrdinaryH0Controls", + "SuperlevelBarField" ], "namespace": "TorusFiltration", "provenance": { @@ -158,7 +183,7 @@ }, "handoff_pr": "d6g8k5htny-coder/Math-#419", "human_review": "none", - "namespace_mapping": "ResearchFormalCoreR1. (handoff) -> TorusFiltration. (companion) for TorusTopology and ClosedSuperlevel; SuperlevelBar and OrdinaryH0 were authored directly in namespace TorusFiltration, and so was the owner-authored OrdinaryH0Controls", + "namespace_mapping": "ResearchFormalCoreR1. (handoff) -> TorusFiltration. (companion) for TorusTopology and ClosedSuperlevel; SuperlevelBar and OrdinaryH0 were authored directly in namespace TorusFiltration, and so were the owner-authored OrdinaryH0Controls and SuperlevelBarField", "organizational_independence_credit": 0, "original_bytes": { "C263-handoff/SuperlevelBar.lean": 14904, @@ -193,6 +218,27 @@ "organizational_independence_credit": 0, "review_status": "not a review of OrdinaryH0 and lifts nothing: the FORMAL HOLD of OrdinaryH0 (and of SuperlevelBar) is unchanged; no review of these bytes is recorded; registration is not review", "sha256": "df9d3645282ca526b67eca3d5db691b622092a14b5fddee9be21013e39666184" + }, + "SuperlevelBarField.lean": { + "author": "Anthropic/Claude lane (companion owner), delegated AI work for Dylan Roy", + "bytes": 11816, + "census_at_pin": "18 constants = 14 user range + 0 user generated + 4 internal generated (superlevelBarField_interface and superlevelBarField_shift: _proof_1 and _proof_2 each)", + "comments": { + "adapter_route_428": "6112932068", + "allocation_428": "6124097060" + }, + "declarations": "12 theorems, 0 abbrevs, 2 defs, 0 instances", + "imports": [ + "Mathlib", + "SuperlevelBar", + "Specifications.Field" + ], + "kind": "owner-authored adapter module; not a handoff successor (no handoff bytes exist); not a review", + "lane": "C263 Field adapter (the SuperlevelBarField route of Math- #428 comment 6112932068, item 2)", + "namespace": "authored directly in namespace TorusFiltration; every declaration carries the prefix superlevelBarField_", + "organizational_independence_credit": 0, + "review_status": "not a review of SuperlevelBar and lifts nothing: it consumes the C263 definitions, so the FORMAL HOLD of SuperlevelBar extends to it; ElderPartner holds its clause by definition (no persistence elder rule is identified); no review of these bytes is recorded; registration is not review", + "sha256": "8a2470431c3fda5e98859aa9372cbb8866ed5c5c722cea5dfc28cb577840bbad" } }, "source_author": "OpenAI/Codex lane (C254), delegated AI work for Dylan Roy", @@ -358,6 +404,20 @@ "superlevelBar_death_const", "superlevelBar_control_negative_essential" ], + "SuperlevelBarField": [ + "superlevelBarField_continuous", + "superlevelBarField_nonempty", + "superlevelBarField_deathHeight_eq", + "superlevelBarField_isEssential_iff", + "superlevelBarField_elderPartner_iff", + "superlevelBarField_essential_unique", + "superlevelBarField_deathHeight_unique", + "superlevelBarField_elderPartner_unique", + "superlevelBarField_shift_deathHeight_const", + "superlevelBarField_const_smooth", + "superlevelBarField_const_periodic", + "superlevelBarField_control_essential_free" + ], "TorusTopology": [ "torus_field_latticeVec_formula", "torus_basis_sum_eq_latticeVec", diff --git a/companions/torus_filtration_20261011/SuperlevelBarField.lean b/companions/torus_filtration_20261011/SuperlevelBarField.lean new file mode 100644 index 000000000..f0300a6b4 --- /dev/null +++ b/companions/torus_filtration_20261011/SuperlevelBarField.lean @@ -0,0 +1,205 @@ +import Mathlib +import SuperlevelBar +import Specifications.Field + +/-! +# C263 adapter: an inhabitant of the Field superlevel-bar interface + +Proves: the C263 strict-clearance data (`superlevelBar_deathHeight`, +`superlevelBar_isEssential`) together with the elder clause's own right-hand side +inhabit `UniversalLaw.Spec.Field.SuperlevelBarInterface d L` for every `d` and `L`; +on smooth `L`-periodic heights every inhabitant agrees with this one on essentiality, +on the death height at nonessential points and, on the Morse distinct-value locus, on +the elder relation; and the interface leaves the death height at essential points free +(two inhabitants differ there). + +Method: `IsSmooth` at `n = 0` gives continuity, so `superlevelBar_strict_cut` is the +maximin clause and `superlevelBar_cut_unique` forces agreement of any other death +height; `essential_iff` is `superlevelBar_essential_iff`; `ElderPartner` is defined as +the right-hand side of `elderPartner_iff`, so that clause holds by `Iff.rfl`. + +Does not establish: an identification of `ElderPartner` with a persistence-module elder +rule, the source's elder event or its Borel measurability (the clause holds by +definition, not as a theorem about persistence); any use of periodicity or of `L` in the +construction (the uniqueness theorems take the periodicity hypothesis only to apply an +arbitrary inhabitant's clauses, and are false without it); a torus quotient; Morse +genericity; any meaning of the value `0` that the C263 default +gives at essential points; anything about the separate +`UniversalLaw.Spec.Lifetime.SuperlevelBarInterface` (not inhabited here) or about any +Lifetime statement; scientific acceptance. The statement packet's own text "no +inhabitant is constructed" is about that packet and stays true of it; nothing in it +changes. No claim-level label moves; alignment stays PENDING_INDEPENDENT_REVIEW. + +Authored by the Anthropic/Claude lane (owner of this companion's gate), delegated AI +work for Dylan Roy, under the adapter route of Math- #428 comments 6112932068 and +6124097060; organizational-independence credit 0; no human review. It consumes the +C263 definitions, whose FORMAL HOLD extends to this module. The interface is +`specifications/lean_statements_20261010/Specifications/Field.lean`, blob +cc40e9d19446b8a150401c574d3cfd56177f195f, compiled in the same replay. +Target pin: Lean 4.34.1 / Mathlib d13f23b723b8a846827a245b89c10fc7d3f11612. +Elaboration, kernel audit and executed controls are recorded in separate source-bound +receipts; this text makes no execution claim. +-/ + +noncomputable section + +open UniversalLaw.Spec.Field + +namespace TorusFiltration + +/-- Proves: a smooth height in the Field sense is continuous. +Method: the `n = 0` instance of `IsSmooth` and `ContDiff.continuous`. +Does not establish: any regularity beyond continuity. -/ +theorem superlevelBarField_continuous {d : ℕ} {g : E d → ℝ} (hg : IsSmooth d g) : + Continuous g := + (hg 0).continuous + +/-- Proves: the C263 data inhabit the Field interface for every dimension and period. +Method: death height and essentiality are the C263 definitions, the maximin clause is +`superlevelBar_strict_cut`, and the elder relation is the right-hand side of its clause. +Does not establish: a persistence-module elder rule; `elderPartner_iff` holds by +definition, and periodicity and `L` are not used. -/ +def superlevelBarField_interface (d : ℕ) (L : ℝ) : SuperlevelBarInterface d L where + deathHeight := superlevelBar_deathHeight + IsEssential := superlevelBar_isEssential + ElderPartner := fun g M S => + IsNondegMax d g M ∧ IsIndexSaddle d g S ∧ ¬ superlevelBar_isEssential g M ∧ + superlevelBar_deathHeight g M = g S + essential_iff := fun g _ _ M => superlevelBar_essential_iff g M + deathHeight_maximin := fun g hs _ M hM h => + superlevelBar_strict_cut g (superlevelBarField_continuous hs) M hM h + elderPartner_iff := fun _ _ _ _ _ _ => Iff.rfl + +/-- Proves: the Field superlevel-bar interface is inhabited for every `d` and `L`. +Method: the record above. Does not establish: that any inhabitant is the source's +superlevel H0 object. -/ +theorem superlevelBarField_nonempty (d : ℕ) (L : ℝ) : + Nonempty (SuperlevelBarInterface d L) := + ⟨superlevelBarField_interface d L⟩ + +/-- Proves: the death height of the record is the C263 death height. +Method: `rfl`. Does not establish: a finite death for an essential point. -/ +theorem superlevelBarField_deathHeight_eq {d : ℕ} {L : ℝ} (g : E d → ℝ) (M : E d) : + (superlevelBarField_interface d L).deathHeight g M = superlevelBar_deathHeight g M := + rfl + +/-- Proves: essentiality in the record is global maximality. +Method: `Iff.rfl`. Does not establish: agreement with a persistence essential class. -/ +theorem superlevelBarField_isEssential_iff {d : ℕ} {L : ℝ} (g : E d → ℝ) (M : E d) : + (superlevelBarField_interface d L).IsEssential g M ↔ ∀ y, g y ≤ g M := + Iff.rfl + +/-- Proves: the elder relation of the record is, for every height, the right-hand side +of the interface clause. Method: `Iff.rfl`, since it is defined that way. +Does not establish: that this relation is ordinary elder death in any persistence sense. -/ +theorem superlevelBarField_elderPartner_iff {d : ℕ} {L : ℝ} (g : E d → ℝ) (M S : E d) : + (superlevelBarField_interface d L).ElderPartner g M S ↔ + (IsNondegMax d g M ∧ IsIndexSaddle d g S ∧ ¬ superlevelBar_isEssential g M ∧ + superlevelBar_deathHeight g M = g S) := + Iff.rfl + +/-- Proves: on smooth periodic heights every inhabitant's essentiality is global maximality. +Method: its own `essential_iff` clause. Does not establish: anything off that locus. -/ +theorem superlevelBarField_essential_unique {d : ℕ} {L : ℝ} (I : SuperlevelBarInterface d L) + (g : E d → ℝ) (hs : IsSmooth d g) (hp : IsLPeriodic d L g) (M : E d) : + I.IsEssential g M ↔ superlevelBar_isEssential g M := + I.essential_iff g hs hp M + +/-- Proves: on smooth periodic heights every inhabitant's death height at a nonessential +point is the C263 death height. Method: its maximin clause is a strict cut for the +clearance set, and `superlevelBar_cut_unique` leaves one such number. +Does not establish: agreement at essential points (see the control below). -/ +theorem superlevelBarField_deathHeight_unique {d : ℕ} {L : ℝ} (I : SuperlevelBarInterface d L) + (g : E d → ℝ) (hs : IsSmooth d g) (hp : IsLPeriodic d L g) (M : E d) + (hM : ¬ I.IsEssential g M) : + I.deathHeight g M = superlevelBar_deathHeight g M := by + have hM' : ¬ superlevelBar_isEssential g M := + fun h => hM ((superlevelBarField_essential_unique I g hs hp M).2 h) + exact superlevelBar_cut_unique g (superlevelBarField_continuous hs) M hM' _ + (fun h => I.deathHeight_maximin g hs hp M hM h) + +/-- Proves: on the Morse distinct-value locus of smooth periodic heights every inhabitant's +elder relation is the record's. Method: both are their clause's right-hand side, whose +essentiality and death-height terms agree by the two uniqueness theorems above. +Does not establish: agreement off the Morse distinct-value locus, where the interface +constrains no elder relation. -/ +theorem superlevelBarField_elderPartner_unique {d : ℕ} {L : ℝ} (I : SuperlevelBarInterface d L) + (g : E d → ℝ) (hs : IsSmooth d g) (hp : IsLPeriodic d L g) (hm : IsMorseDistinct d L g) + (M S : E d) : + I.ElderPartner g M S ↔ (superlevelBarField_interface d L).ElderPartner g M S := by + rw [I.elderPartner_iff g hs hp hm M S] + constructor + · rintro ⟨hmax, hsad, hne, hdeath⟩ + exact ⟨hmax, hsad, fun h => hne ((superlevelBarField_essential_unique I g hs hp M).2 h), + (superlevelBarField_deathHeight_unique I g hs hp M hne).symm.trans hdeath⟩ + · rintro ⟨hmax, hsad, hne, hdeath⟩ + have hne' : ¬ I.IsEssential g M := + fun h => hne ((superlevelBarField_essential_unique I g hs hp M).1 h) + exact ⟨hmax, hsad, hne', (superlevelBarField_deathHeight_unique I g hs hp M hne').trans hdeath⟩ + +/-- Proves: a second record, equal to the first except that its death height is the +constant `c` at essential points, also inhabits the interface. Method: off the essential +points it is the C263 death height, so the same strict cut applies; its elder relation is +again its clause's right-hand side. Does not establish: any preferred value at essential +points. -/ +def superlevelBarField_shift (d : ℕ) (L c : ℝ) : SuperlevelBarInterface d L where + deathHeight := fun g M => by + classical + exact if superlevelBar_isEssential g M then c else superlevelBar_deathHeight g M + IsEssential := superlevelBar_isEssential + ElderPartner := fun g M S => + IsNondegMax d g M ∧ IsIndexSaddle d g S ∧ ¬ superlevelBar_isEssential g M ∧ + (by classical + exact if superlevelBar_isEssential g M then c else superlevelBar_deathHeight g M) = g S + essential_iff := fun g _ _ M => superlevelBar_essential_iff g M + deathHeight_maximin := fun g hs _ M hM h => by + classical + rw [ite_eq_right hM] + exact superlevelBar_strict_cut g (superlevelBarField_continuous hs) M hM h + elderPartner_iff := fun _ _ _ _ _ _ => Iff.rfl + +/-- Proves: at a constant height the shifted record's death height is `c`. +Method: every point of a constant height is essential. Does not establish: a finite bar +for a constant height. -/ +theorem superlevelBarField_shift_deathHeight_const (d : ℕ) (L c b : ℝ) (M : E d) : + (superlevelBarField_shift d L c).deathHeight (fun _ => b) M = c := by + classical + show (if superlevelBar_isEssential (fun _ : E d => b) M then c + else superlevelBar_deathHeight (fun _ : E d => b) M) = c + have hM : superlevelBar_isEssential (fun _ : E d => b) M := fun _ => le_rfl + rw [ite_eq_left hM] + +/-- Proves: constant heights are smooth. Method: `contDiff_const`. +Does not establish: anything about nonconstant heights. -/ +theorem superlevelBarField_const_smooth (d : ℕ) (b : ℝ) : IsSmooth d (fun _ : E d => b) := + fun _ => contDiff_const + +/-- Proves: constant heights are `L`-periodic. Method: both sides are the constant. +Does not establish: anything about the lattice. -/ +theorem superlevelBarField_const_periodic (d : ℕ) (L b : ℝ) : + IsLPeriodic d L (fun _ : E d => b) := + fun _ _ => rfl + +/-- Proves: the nonessential hypothesis of `superlevelBarField_deathHeight_unique` cannot +be dropped: at the smooth periodic constant height `0` every point is essential for both +records, the record's death height there is `0`, its shift by `1` has death height `1`, +and the two differ. Method: `superlevelBar_death_const` and the shifted value. +Does not establish: anything about nonessential points, where all inhabitants agree. -/ +theorem superlevelBarField_control_essential_free (d : ℕ) (L : ℝ) (M : E d) : + IsSmooth d (fun _ : E d => (0 : ℝ)) ∧ IsLPeriodic d L (fun _ : E d => (0 : ℝ)) ∧ + (superlevelBarField_interface d L).IsEssential (fun _ => (0 : ℝ)) M ∧ + (superlevelBarField_shift d L 1).IsEssential (fun _ => (0 : ℝ)) M ∧ + (superlevelBarField_interface d L).deathHeight (fun _ => (0 : ℝ)) M = 0 ∧ + (superlevelBarField_shift d L 1).deathHeight (fun _ => (0 : ℝ)) M = 1 ∧ + (superlevelBarField_interface d L).deathHeight (fun _ => (0 : ℝ)) M ≠ + (superlevelBarField_shift d L 1).deathHeight (fun _ => (0 : ℝ)) M := by + have h0 : (superlevelBarField_interface d L).deathHeight (fun _ => (0 : ℝ)) M = 0 := by + rw [superlevelBarField_deathHeight_eq, superlevelBar_death_const] + have h1 : (superlevelBarField_shift d L 1).deathHeight (fun _ => (0 : ℝ)) M = 1 := + superlevelBarField_shift_deathHeight_const d L 1 0 M + refine ⟨superlevelBarField_const_smooth d 0, superlevelBarField_const_periodic d L 0, + fun _ => le_rfl, fun _ => le_rfl, h0, h1, ?_⟩ + rw [h0, h1] + norm_num + +end TorusFiltration diff --git a/companions/torus_filtration_20261011/TorusFiltration.lean b/companions/torus_filtration_20261011/TorusFiltration.lean index eb4bfab62..7dff5dbab 100644 --- a/companions/torus_filtration_20261011/TorusFiltration.lean +++ b/companions/torus_filtration_20261011/TorusFiltration.lean @@ -3,3 +3,4 @@ import ClosedSuperlevel import SuperlevelBar import OrdinaryH0 import OrdinaryH0Controls +import SuperlevelBarField diff --git a/companions/torus_filtration_20261011/check.py b/companions/torus_filtration_20261011/check.py index f225c0534..45681a4b9 100644 --- a/companions/torus_filtration_20261011/check.py +++ b/companions/torus_filtration_20261011/check.py @@ -4,12 +4,15 @@ The companion holds the C254 torus/closed-superlevel modules and, since the C263/C264 registration, the strict-cut module SuperlevelBar and the ordinary-H0 module OrdinaryH0; since 2026-10-12 also the owner-authored OrdinaryH0Controls (instantiated ordinary-H0 controls for C264 owner task item 4; not a handoff -successor, not a review). Not an acceptance engine, not a general Lean parser, not a review. It binds the +successor, not a review) and the owner-authored SuperlevelBarField (an inhabitant of the statement packet's +Field.SuperlevelBarInterface built from the C263 definitions; the one module that imports a file outside the +companion, Specifications.Field, which the replay compiles from its pinned bytes). Not an acceptance engine, not a general Lean parser, not a review. It binds the companion's bytes to Git HEAD, emits the audit/type/positive/negative Lean files, refuses negative-control logs that are not the intended diagnostic, and writes a receipt that records what ran. The companion consumes nothing from formal/ except the pinned toolchain, lakefile and dependency lock, so it pins no core tree, -manifest or gate. Scientific effect NONE; organizational-independence credit 0. +manifest or gate; outside its own directory it reads one more file, the statement +packet's Field.lean, pinned by identity in EXTERNAL_INPUTS. Scientific effect NONE; organizational-independence credit 0. """ import argparse import hashlib @@ -27,14 +30,34 @@ WORKFLOW = '.github/workflows/torus-filtration.yml' REPO = 'd6g8k5htny-coder/Math-' NAMESPACE = 'TorusFiltration' -# Dependency order: a module may `import` only Mathlib and companion modules listed before it (scan_module). -MODULES = ('TorusTopology', 'ClosedSuperlevel', 'SuperlevelBar', 'OrdinaryH0', 'OrdinaryH0Controls') +# Dependency order: a module may `import` only Mathlib and companion modules listed before it (scan_module), and +# the one module named in EXTERNAL_IMPORTS may also import the external modules listed for it there. +MODULES = ('TorusTopology', 'ClosedSuperlevel', 'SuperlevelBar', 'OrdinaryH0', 'OrdinaryH0Controls', 'SuperlevelBarField') ROOT_MODULE = 'TorusFiltration' ROOT_SOURCE = ''.join('import ' + m + '\n' for m in MODULES) REQUIRED_FILES = tuple(PACKAGE + '/' + n for n in ( 'TorusFiltration.lean', 'TorusTopology.lean', 'ClosedSuperlevel.lean', 'SuperlevelBar.lean', 'OrdinaryH0.lean', - 'OrdinaryH0Controls.lean', 'check.py', 'replay.sh', 'test_torus_filtration.py', 'README.md', 'SCOPE.md')) + (WORKFLOW,) + 'OrdinaryH0Controls.lean', 'SuperlevelBarField.lean', 'check.py', 'replay.sh', 'test_torus_filtration.py', 'README.md', + 'SCOPE.md')) + (WORKFLOW,) PINNED_CORE = ('formal/lakefile.toml', 'formal/lake-manifest.json', 'formal/lean-toolchain') +# The one file outside the companion that the replay compiles (Math- #428 comments 6112932068 and 6124097060): the +# statement packet's Field module (#419's packet, on main since #419 landed), which SuperlevelBarField imports. It is +# not companion source and not in REQUIRED_FILES: `source` requires its working-tree bytes AND its blob at HEAD to be +# exactly this identity, so any change to it on main withholds the receipt until this record changes with it. +# `metadata` requires SOURCE_FILES.json to carry exactly this record. replay.sh compiles it with the packet's own +# leanOptions (-DautoImplicit=false, no warnings-as-errors: it is the packet's source, not the companion's) into +# .lake/torus-filtration-spec, outside the source tree and outside the evidence directory. +SPEC_ROOT = 'specifications/lean_statements_20261010' +EXTERNAL_INPUTS = { + SPEC_ROOT + '/Specifications/Field.lean': { + 'module': 'Specifications.Field', 'bytes': 27767, + 'sha256': 'f22c91e082cd7e738ba47c9c3534e47ac687d066f0b78586d15103cf1132535e', + 'git_blob': 'cc40e9d19446b8a150401c574d3cfd56177f195f', + 'compiled_with': 'lean -DautoImplicit=false (the packet lakefile leanOptions), inside formal/ lake env', + 'imported_by': 'SuperlevelBarField', + 'status': 'statement packet source (specified; not proved here); not companion source'}} +# The external imports each companion module may name (scan_module); every other module may import none. +EXTERNAL_IMPORTS = {'SuperlevelBarField': ('Specifications.Field',)} TOOLCHAIN = 'leanprover/lean4:v4.34.1' LEAN_VERSION = re.compile(r'Lean \(version 4\.34\.1, [^()\r\n]+, commit 5045d0056413266e57c625dcd7c365b10e377c52, Release\)') CLAIM = '8a5c7a24-784b-4aaa-b951-cd9f37b0dc64' @@ -119,10 +142,29 @@ 'comments': {'owner_task_item_4_428': '6113277485', 'control_obligations_specification_428': '6113277173'}, 'review_status': 'not a review of OrdinaryH0 and lifts nothing: the FORMAL HOLD of OrdinaryH0 (and of SuperlevelBar) ' 'is unchanged; no review of these bytes is recorded; registration is not review', + 'organizational_independence_credit': 0}, + # The Field adapter (route retained by this lane at 6112932068, allocated at 6124097060): an inhabitant of + # UniversalLaw.Spec.Field.SuperlevelBarInterface built from the C263 definitions, with uniqueness on the guarded + # locus and a control showing the essential-point death height is left free. ElderPartner is defined as the right- + # hand side of its own clause, so that clause holds by Iff.rfl: a definition, not a theorem about persistence. + 'SuperlevelBarField.lean': { + 'lane': 'C263 Field adapter (the SuperlevelBarField route of Math- #428 comment 6112932068, item 2)', + 'author': 'Anthropic/Claude lane (companion owner), delegated AI work for Dylan Roy', + 'kind': 'owner-authored adapter module; not a handoff successor (no handoff bytes exist); not a review', + 'sha256': '8a2470431c3fda5e98859aa9372cbb8866ed5c5c722cea5dfc28cb577840bbad', 'bytes': 11816, + 'imports': ['Mathlib', 'SuperlevelBar', 'Specifications.Field'], + 'namespace': 'authored directly in namespace TorusFiltration; every declaration carries the prefix superlevelBarField_', + 'declarations': '12 theorems, 0 abbrevs, 2 defs, 0 instances', + 'census_at_pin': '18 constants = 14 user range + 0 user generated + 4 internal generated (superlevelBarField_interface ' + 'and superlevelBarField_shift: _proof_1 and _proof_2 each)', + 'comments': {'adapter_route_428': '6112932068', 'allocation_428': '6124097060'}, + 'review_status': 'not a review of SuperlevelBar and lifts nothing: it consumes the C263 definitions, so the FORMAL HOLD ' + 'of SuperlevelBar extends to it; ElderPartner holds its clause by definition (no persistence elder ' + 'rule is identified); no review of these bytes is recorded; registration is not review', 'organizational_independence_credit': 0}} NAMESPACE_MAPPING = ('ResearchFormalCoreR1. (handoff) -> TorusFiltration. (companion) for TorusTopology and ClosedSuperlevel; ' - 'SuperlevelBar and OrdinaryH0 were authored directly in namespace TorusFiltration, and so was the ' - 'owner-authored OrdinaryH0Controls') + 'SuperlevelBar and OrdinaryH0 were authored directly in namespace TorusFiltration, and so were the ' + 'owner-authored OrdinaryH0Controls and SuperlevelBarField') # Own copy of formal/gate.py's audit rules; the companion imports nothing from the core. ALLOWED = frozenset({'propext', 'Classical.choice', 'Quot.sound'}) NAME = r'[A-Za-z_][A-Za-z0-9_.]*' @@ -130,14 +172,19 @@ IDENT = r'[A-Za-z][A-Za-z0-9_]*' HEX40 = re.compile(r'[0-9a-f]{40}') HEX64 = re.compile(r'[0-9a-f]{64}') -BUILDS = tuple('build-' + m for m in MODULES + (ROOT_MODULE,)) + ('positive', 'axioms', 'types', 'census', 'leanchecker') -# The leanchecker invocations replay.sh may record in leanchecker.cmd. All five modules `import Mathlib`, so +# build-spec-Field: the external Field module (EXTERNAL_INPUTS), compiled first. +BUILDS = ('build-spec-Field',) + tuple('build-' + m for m in MODULES + (ROOT_MODULE,)) + ('positive', 'axioms', 'types', + 'census', 'leanchecker') +# The leanchecker invocations replay.sh may record in leanchecker.cmd. All six companion modules `import Mathlib` +# (SuperlevelBarField also imports Specifications.Field, which imports only Mathlib), so # `--fresh` (kernel re-check of the whole import closure) exceeds a hosted job: measured locally at 4 threads # it was still running at 1500 s with 6.6 GB resident. The hosted default replays the companion's own # declarations against the cached, prebuilt dependency .oleans (33 s at 2 threads locally for the C254 pair). The # modules form names every companion module and the root; a shorter form (the three-module form before the C263/C264 -# registration, the five-module form before OrdinaryH0Controls) is refused. -LEANCHECKER = {'leanchecker ' + ' '.join(MODULES + (ROOT_MODULE,)): 'modules', +# registration, the five-module form before OrdinaryH0Controls, the six-module form before SuperlevelBarField) is +# refused. Since SuperlevelBarField the modules form also names the external Specifications.Field first: the replay +# compiled it itself, so its declarations are replayed too rather than trusted from that .olean. +LEANCHECKER = {'leanchecker Specifications.Field ' + ' '.join(MODULES + (ROOT_MODULE,)): 'modules', 'leanchecker --fresh TorusFiltration': 'fresh'} ADMISSION = ('sorry', 'sorryAx', 'admit', 'axiom', 'native_decide', 'ofReduceBool', 'trustCompiler', 'unsafe', 'opaque', 'partial', 'implemented_by', 'extern', 'skipKernelTC', 'autoImplicit') @@ -202,10 +249,13 @@ def admission_tokens(text): DECLARATION = re.compile(r'(theorem|abbrev|instance|def|noncomputable def) (' + IDENT + r')(?=$|[\s:(\[{⦃])') # Column-0 prelude lines. `import` admits Mathlib and, since the C263/C264 registration, a companion module named in # MODULES (scan_module further requires it to precede the importing module in MODULES: no self, forward or root import; -# OrdinaryH0.lean imports ClosedSuperlevel and OrdinaryH0Controls.lean imports OrdinaryH0). +# OrdinaryH0.lean imports ClosedSuperlevel and OrdinaryH0Controls.lean imports OrdinaryH0). Since the Field adapter it +# also admits the external module Specifications.Field, which scan_module accepts only in SuperlevelBarField.lean +# (EXTERNAL_IMPORTS); no other Specifications module is admitted anywhere. # `open scoped ` activates scoped notation and instances only, a strictly smaller effect than the `open` # already admitted; both lines appear in OrdinaryH0.lean. Keys are tried in order, so `open scoped` precedes `open`. -PRELUDE = {'import': re.compile(r'import (?:Mathlib(?:\.[A-Za-z0-9_]+)*|' + '|'.join(MODULES) + ')'), +PRELUDE = {'import': re.compile(r'import (?:Mathlib(?:\.[A-Za-z0-9_]+)*|' + '|'.join(MODULES) + '|' + + '|'.join(re.escape(m) for ms in EXTERNAL_IMPORTS.values() for m in ms) + ')'), 'noncomputable section': re.compile(r'noncomputable section'), 'open scoped': re.compile(r'open scoped(?: [A-Z][A-Za-z0-9_.]*)+'), 'open': re.compile(r'open(?: [A-Z][A-Za-z0-9_.]*)+'), @@ -228,6 +278,11 @@ def admission_tokens(text): # (ordinaryH0Control_fst_difference_ne_zero). The same tactic on each control's true sibling statement leaves a # different diagnostic (`simp` made no progress, or a goal other than `False` plus an unused simp argument), which # `negative` refuses; all six diagnostics were pinned from actual Lean 4.34.1 output at the d13f23b7 pin. +# The Field-adapter control: RejectEssentialDeathDetermined asserts that the record and its shift by 1 have the same +# death height at the constant height 0 of R^1, where every point is essential: that is what the interface would give +# if it determined the death height at essential points, and superlevelBarField_control_essential_free refutes it +# (it states the two values, 0 and 1, and that they differ). The same tactic on the true sibling (shift by 0) proves it, exit 0 and no diagnostic, which +# `negative` refuses; both outcomes were observed with Lean 4.34.1 at the d13f23b7 pin. FALSE_CONTROLS = { 'RejectSuperlevelSignFlip': ('() ∈ superlevel_set (fun _ : Unit => (0 : ℝ)) (-1)', 'norm_num [superlevel_set]'), 'RejectSuperlevelBelowThreshold': ('(3 : ℝ) ∈ superlevel_set (fun x : ℝ => x) (-4)', 'norm_num [superlevel_set]'), @@ -249,7 +304,11 @@ def admission_tokens(text): '((true, false) : Bool × Bool) - ordinaryH0_pointClass (TopCat.of (Bool × Bool)) ordinaryH0Control_intCoeff ' '((false, true) : Bool × Bool)) (((AlgebraicTopology.singularHomologyFunctor (ModuleCat.{0} ℤ) 0).obj ' 'ordinaryH0Control_intCoeff).map ordinaryH0Control_fst) = 0', - 'simp only [ordinaryH0Control_fst_difference_ne_zero]')} + 'simp only [ordinaryH0Control_fst_difference_ne_zero]'), + 'RejectEssentialDeathDetermined': ('(superlevelBarField_interface 1 1).deathHeight (fun _ => (0 : ℝ)) 0 = ' + '(superlevelBarField_shift 1 1 1).deathHeight (fun _ => (0 : ℝ)) 0', + 'norm_num [superlevelBarField_deathHeight_eq, superlevelBar_death_const, ' + 'superlevelBarField_shift_deathHeight_const]')} # Admission injections; Lean accepts each file (exit 0), the transitive axiom audit must refuse it. # Diagnostics pinned from Lean 4.34.1 at the Mathlib d13f23b7 pin: the sorry warning uses backticks, and # native_decide introduces the auxiliary axiom `injected._native.native_decide.ax_1_1` (not Lean.ofReduceBool). @@ -261,9 +320,9 @@ def admission_tokens(text): 'RejectNativeDecide': ("theorem injected : (2 : Nat) + 2 = 4 := by native_decide\n", 'injected._native.native_decide.ax_1_1', '')} CONTROLS = tuple(FALSE_CONTROLS) + tuple(INJECTIONS) -# The exact membership of the evidence directory when `finish` runs (C262 gate review G3): the fifteen files emit() -# writes, a .log/.status pair per Lean process (six module builds, positive, axioms, types, census, leanchecker, eleven -# controls), the two protocol-test transcripts and the four environment records. +# The exact membership of the evidence directory when `finish` runs (C262 gate review G3): the sixteen files emit() +# writes, a .log/.status pair per Lean process (the external Field build, seven module builds, positive, axioms, types, +# census, leanchecker, twelve controls), the two protocol-test transcripts and the four environment records. # finish() refuses a directory with any member missing or unexpected, any member that is not a regular file, and # any directory already holding receipt.json: a receipt is written once and never replaced. EMITTED_FILES = ('Audit.lean', 'Types.lean', 'Positive.lean', 'Census.lean') + tuple(c + '.lean' for c in CONTROLS) @@ -276,12 +335,14 @@ def admission_tokens(text): # generated constants equal `census_auxiliary` exactly (so that whitelist can name only compiler-generated constants); # internal generated constants are counted and otherwise ignored (the C26x modules add twelve at the pin: equation # lemmas, abstracted proofs, a `_simp` auxiliary and the equation lemma Lean generated for Mathlib's `sigmaConst`; -# OrdinaryH0Controls adds four: `_proof_1` and `eq_1` of its two subtype-point definitions). +# OrdinaryH0Controls adds four: `_proof_1` and `eq_1` of its two subtype-point definitions; SuperlevelBarField: see its +# OWNER_MODULES census). The census lists companion modules only: the external Specifications.Field is not companion +# source, its constants are not inventory, and its axioms enter the audit through the companion declarations that use it. CENSUS = '''import TorusFiltration open Lean in #eval show Lean.Elab.Command.CommandElabM Unit from do let env ← Lean.getEnv - let modules : Array Lean.Name := #[`TorusTopology, `ClosedSuperlevel, `SuperlevelBar, `OrdinaryH0, `OrdinaryH0Controls, `TorusFiltration] + let modules : Array Lean.Name := #[`TorusTopology, `ClosedSuperlevel, `SuperlevelBar, `OrdinaryH0, `OrdinaryH0Controls, `SuperlevelBarField, `TorusFiltration] let idxs := modules.filterMap env.getModuleIdx? if idxs.size != modules.size then throwError "census: a companion module is not imported" let names := env.constants.fold (init := (#[] : Array Lean.Name)) fun acc n _ => @@ -296,11 +357,12 @@ def admission_tokens(text): EVIDENCE_FILES = frozenset(EMITTED_FILES) | {label + ext for label in BUILDS for ext in ('.log', '.status')} \ | {control + ext for control in CONTROLS for ext in ('.log', '.status')} \ | {'leanchecker.cmd', 'packages.log', 'toolchain.log', 'source.json', 'tests.log', 'tests-optimized.log'} -# 15 emitted + 11 processes x 2 + 11 controls x 2 + 6 records = 65 (44 before the C263/C264 registration added two -# module builds and two controls, 54 before OrdinaryH0Controls added one module build and three controls: 2 + 3 x 3). +# 16 emitted + 13 processes x 2 + 12 controls x 2 + 6 records = 72 (44 before the C263/C264 registration added two +# module builds and two controls, 54 before OrdinaryH0Controls added one module build and three controls: 2 + 3 x 3, +# 65 before SuperlevelBarField added two builds, the external Field and the module, and one control: 2 x 2 + 3). # An explicit check, not an `assert`: the gate must hold under -O too. -if len(EVIDENCE_FILES) != 65: - raise RuntimeError('EVIDENCE_FILES must enumerate exactly 65 members') +if len(EVIDENCE_FILES) != 72: + raise RuntimeError('EVIDENCE_FILES must enumerate exactly 72 members') POSITIVE = '''import TorusFiltration open TorusFiltration @@ -372,7 +434,10 @@ def git(*args): def metadata(): meta = strict((SIDE / 'SOURCE_FILES.json').read_bytes()) require(set(meta) == {'schema', 'scientific_effect', 'alignment_status', 'namespace', 'root_module', 'modules', - 'definitions', 'theorems', 'files', 'provenance', 'census_auxiliary'}, 'SOURCE_FILES schema keys') + 'definitions', 'theorems', 'files', 'provenance', 'census_auxiliary', 'external_inputs'}, + 'SOURCE_FILES schema keys') + # The external input record is compared whole: a changed path, hash, blob or label is one refusal. + require(meta['external_inputs'] == EXTERNAL_INPUTS, 'external input identity') aux = meta['census_auxiliary'] # Dotted names under the namespace; that each is compiler-generated is checked by the census (`finish` requires # every entry to appear without a declaration range), not by this schema rule. @@ -484,8 +549,9 @@ def strip_comments(text): def scan_module(text, module): """Declaration inventory of one companion module by whitelist; refuses every line it cannot place. - Outside comments, a column-0 line may only be `import Mathlib[.…]` or `import ` for a - companion module `M` listed before `module` in MODULES (both before the namespace), + Outside comments, a column-0 line may only be `import Mathlib[.…]`, `import ` for a + companion module `M` listed before `module` in MODULES, or `import ` for an external + module `X` listed for `module` in EXTERNAL_IMPORTS (all before the namespace), `noncomputable section`, `open `, `open scoped `, `universe …`, `variable …`, the single `namespace TorusFiltration` / `end TorusFiltration` pair, or a named `theorem`, `def`, `noncomputable def`, `abbrev` or `instance` inside that namespace. Any other @@ -535,6 +601,10 @@ def scan_module(text, module): # a companion import must name a module that precedes this one (acyclic, no self or forward import) require(line.split()[1] in MODULES[:MODULES.index(module)], 'companion import out of dependency order in ' + where + ': ' + line.split()[1]) + if keyword == 'import' and not line.split()[1].startswith('Mathlib') and line.split()[1] not in MODULES: + # an external import (the regex admits only those listed in EXTERNAL_IMPORTS) only in its own module + require(line.split()[1] in EXTERNAL_IMPORTS.get(module, ()), + 'external import outside its module in ' + where + ': ' + line.split()[1]) rest = line[len(keyword):] found = command_token(rest) require(found is None, 'command token outside a column-0 declaration in ' + where + ': ' + (found or '')) @@ -552,7 +622,7 @@ def check_modules(meta, side): for kind in ('abbrev', 'def', 'instance'): require(scan[kind] == meta['definitions'][module][kind], kind + ' inventory differs from source: ' + module) require((side / (ROOT_MODULE + '.lean')).read_text(encoding='utf-8') == ROOT_SOURCE, - 'root module must import exactly the five modules') + 'root module must import exactly the companion modules, in MODULES order') def environment(root): @@ -587,7 +657,14 @@ def source(): require(git('rev-parse', head + ':' + path) == ids[path]['git_blob'], 'dirty execution/source bytes: ' + path) if path in meta['files']: require(meta['files'][path] == ids[path], 'manifest source mismatch: ' + path) - diff = subprocess.run(['git', 'diff', '--exit-code', 'HEAD', '--', PACKAGE, WORKFLOW, *PINNED_CORE], + for path, record in sorted(EXTERNAL_INPUTS.items()): + parts = Path(path).parts + require(not any(ROOT.joinpath(*parts[:i]).is_symlink() for i in range(1, len(parts) + 1)), 'symlink source: ' + path) + require((ROOT / path).is_file(), 'external input absent: ' + path) + ids[path] = identity((ROOT / path).read_bytes()) + require(ids[path] == {k: record[k] for k in ('bytes', 'sha256', 'git_blob')}, 'external input mismatch: ' + path) + require(git('rev-parse', head + ':' + path) == record['git_blob'], 'external input not committed at HEAD: ' + path) + diff = subprocess.run(['git', 'diff', '--exit-code', 'HEAD', '--', PACKAGE, WORKFLOW, *PINNED_CORE, *EXTERNAL_INPUTS], cwd=ROOT, capture_output=True, text=True, timeout=60) require(diff.returncode == 0, 'uncommitted modification in bound paths') env = environment(ROOT) @@ -757,7 +834,8 @@ def finish(out): status = int((out / (control + '.status')).read_text().strip()) outcomes[control] = negative((out / (control + '.log')).read_text(), control, status) definitions = {kind: sum(len(meta['definitions'][m][kind]) for m in MODULES) for kind in ('abbrev', 'def', 'instance')} - replayed = ('the companion modules\' own declarations against the cached, prebuilt dependency .oleans' + replayed = ('the companion modules\' own declarations and those of the external Specifications.Field ' + '(EXTERNAL_INPUTS, compiled in the same replay) against the cached, prebuilt dependency .oleans' if mode == 'modules' else 'the whole import closure from scratch (--fresh)') receipt = { 'schema': 1, 'scientific_effect': 'NONE', 'formalization_status': 'kernel-checked', @@ -766,7 +844,7 @@ def finish(out): 'run_id': current['run_id'], 'run_attempt': current['run_attempt'], 'lean_version': version, 'dependency_revisions': installed, 'sources': current['sources'], 'declarations': current['declarations'], 'theorem_count': len(current['theorems']), 'definition_count': definitions, 'axioms': axioms, - 'negative_controls': outcomes, 'provenance': current['provenance'], + 'negative_controls': outcomes, 'provenance': current['provenance'], 'external_inputs': EXTERNAL_INPUTS, 'leanchecker': {'command': (out / 'leanchecker.cmd').read_text().strip(), 'mode': mode}, 'census': counted, 'scope_note': 'kernel-checked records that Lean elaborated these declarations at the pinned toolchain and ' diff --git a/companions/torus_filtration_20261011/replay.sh b/companions/torus_filtration_20261011/replay.sh index c654e5041..ffc29a41f 100644 --- a/companions/torus_filtration_20261011/replay.sh +++ b/companions/torus_filtration_20261011/replay.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash # Replay of the torus-filtration companion: TorusTopology and ClosedSuperlevel (C254), the registered -# SuperlevelBar (C263) and OrdinaryH0 (C264) successors, and the owner-authored OrdinaryH0Controls (C264 owner -# task item 4). It runs neither formal/gate.py nor the formal tests: the companion consumes only the pinned -# toolchain, lakefile and dependency lock from formal/, and its evidence is kernel-checked declarations, not -# alignment or acceptance. +# SuperlevelBar (C263) and OrdinaryH0 (C264) successors, the owner-authored OrdinaryH0Controls (C264 owner +# task item 4) and the owner-authored SuperlevelBarField (the C263 Field adapter), which imports the statement +# packet's Specifications.Field, compiled here first from its pinned bytes (check.py EXTERNAL_INPUTS). It runs +# neither formal/gate.py nor the formal tests: the companion consumes only the pinned toolchain, lakefile and +# dependency lock from formal/, and its evidence is kernel-checked declarations, not alignment or acceptance. set -euo pipefail # The outer Python mode is the one named on each command line below, never an ambient PYTHONOPTIMIZE (C262 G1). unset PYTHONOPTIMIZE @@ -14,18 +15,24 @@ export LEAN_NUM_THREADS="${LEAN_NUM_THREADS:-2}" ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" SIDE="$ROOT/companions/torus_filtration_20261011" OUT="$ROOT/.lake/torus-filtration-evidence" +# Build output of the external Field module: outside the source tree and outside the evidence directory. +SPEC_OUT="$ROOT/.lake/torus-filtration-spec" cd "$ROOT" test ! -e "$OUT" -mkdir -p "$OUT" +test ! -e "$SPEC_OUT" +mkdir -p "$OUT" "$SPEC_OUT/Specifications" python3 -B -S "$SIDE/check.py" source > "$OUT/source.json" python3 -B -S "$SIDE/test_torus_filtration.py" 2>&1 | tee "$OUT/tests.log" python3 -B -O -S "$SIDE/test_torus_filtration.py" 2>&1 | tee "$OUT/tests-optimized.log" python3 -B -S "$SIDE/check.py" emit "$OUT" -export TORUS_SIDE="$SIDE" TORUS_OUT="$OUT" TORUS_ROOT="$ROOT" +export TORUS_SIDE="$SIDE" TORUS_OUT="$OUT" TORUS_ROOT="$ROOT" TORUS_SPEC_OUT="$SPEC_OUT" cd "$ROOT/formal" lake env bash <<'INNER' set -euo pipefail -export LEAN_PATH="$TORUS_SIDE:${LEAN_PATH:-}" +# The fresh Field build comes first: it holds only Specifications/Field.olean and did not exist before this run, so +# it shadows nothing, and no other Specifications/Field.olean (say, an untracked one in the companion directory) can +# shadow it. +export LEAN_PATH="$TORUS_SPEC_OUT:$TORUS_SIDE:${LEAN_PATH:-}" export LEAN_SRC_PATH="$TORUS_SIDE:${LEAN_SRC_PATH:-}" lean --version > "$TORUS_OUT/toolchain.log" cat "$TORUS_OUT/toolchain.log" @@ -42,11 +49,15 @@ run_lean() { cat "$TORUS_OUT/$label.log" test "$code" -eq 0 } +# The statement packet's Field module, with the packet's own leanOptions (autoImplicit false) and without +# warnings-as-errors: it is the packet's source, not the companion's; only SuperlevelBarField imports it. +run_lean build-spec-Field lean -DautoImplicit=false --root="$TORUS_ROOT/specifications/lean_statements_20261010" -o "$TORUS_SPEC_OUT/Specifications/Field.olean" "$TORUS_ROOT/specifications/lean_statements_20261010/Specifications/Field.lean" run_lean build-TorusTopology lean -DwarningAsError=true --root="$TORUS_SIDE" -o "$TORUS_SIDE/TorusTopology.olean" "$TORUS_SIDE/TorusTopology.lean" run_lean build-ClosedSuperlevel lean -DwarningAsError=true --root="$TORUS_SIDE" -o "$TORUS_SIDE/ClosedSuperlevel.olean" "$TORUS_SIDE/ClosedSuperlevel.lean" run_lean build-SuperlevelBar lean -DwarningAsError=true --root="$TORUS_SIDE" -o "$TORUS_SIDE/SuperlevelBar.olean" "$TORUS_SIDE/SuperlevelBar.lean" run_lean build-OrdinaryH0 lean -DwarningAsError=true --root="$TORUS_SIDE" -o "$TORUS_SIDE/OrdinaryH0.olean" "$TORUS_SIDE/OrdinaryH0.lean" run_lean build-OrdinaryH0Controls lean -DwarningAsError=true --root="$TORUS_SIDE" -o "$TORUS_SIDE/OrdinaryH0Controls.olean" "$TORUS_SIDE/OrdinaryH0Controls.lean" +run_lean build-SuperlevelBarField lean -DwarningAsError=true --root="$TORUS_SIDE" -o "$TORUS_SIDE/SuperlevelBarField.olean" "$TORUS_SIDE/SuperlevelBarField.lean" run_lean build-TorusFiltration lean -DwarningAsError=true --root="$TORUS_SIDE" -o "$TORUS_SIDE/TorusFiltration.olean" "$TORUS_SIDE/TorusFiltration.lean" run_lean positive lean -DwarningAsError=true --root="$TORUS_OUT" "$TORUS_OUT/Positive.lean" run_lean axioms lean -DwarningAsError=true --root="$TORUS_OUT" "$TORUS_OUT/Audit.lean" @@ -54,20 +65,21 @@ run_lean types lean -DwarningAsError=true --root="$TORUS_OUT" "$TORUS_OUT/Types. run_lean census lean -DwarningAsError=true --root="$TORUS_OUT" "$TORUS_OUT/Census.lean" # Kernel replay of the companion modules' own declarations against the cached, prebuilt dependency # .oleans (30 s at 2 threads locally for the three C254 modules, 53 s for the five, 56 s for the six, 75 s with the -# `lake env` start-up). All five modules `import Mathlib` (OrdinaryH0 also imports ClosedSuperlevel, OrdinaryH0Controls -# imports OrdinaryH0), so `--fresh` (re-check of the whole import closure) does not fit a hosted job: still running -# at 1500 s with 6.6 GB resident at 4 threads. +# `lake env` start-up). Since SuperlevelBarField the external Specifications.Field, compiled above, is replayed too. +# All six companion modules `import Mathlib` (OrdinaryH0 also imports ClosedSuperlevel, OrdinaryH0Controls imports +# OrdinaryH0, SuperlevelBarField imports SuperlevelBar and Specifications.Field), so `--fresh` (re-check of the whole +# import closure) does not fit a hosted job: still running at 1500 s with 6.6 GB resident at 4 threads. # TORUS_LEANCHECKER_FRESH=1 selects it for an operator's local run; the receipt records which mode ran. if [ "${TORUS_LEANCHECKER_FRESH:-0}" = 1 ]; then LEANCHECKER_COMMAND='leanchecker --fresh TorusFiltration' else - LEANCHECKER_COMMAND='leanchecker TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls TorusFiltration' + LEANCHECKER_COMMAND='leanchecker Specifications.Field TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls SuperlevelBarField TorusFiltration' fi printf '%s\n' "$LEANCHECKER_COMMAND" > "$TORUS_OUT/leanchecker.cmd" # shellcheck disable=SC2086 run_lean leanchecker $LEANCHECKER_COMMAND # False statements about the companion's own definitions: Lean itself must refuse each with exactly `⊢ False`. -for control in RejectSuperlevelSignFlip RejectSuperlevelBelowThreshold RejectConstantNotPeriodic RejectEssentialDeathBound RejectReducedPointClass RejectMergerKillsPointClass RejectSeparationWithoutNonzeroCoeff RejectNonmergerKillsDifference; do +for control in RejectSuperlevelSignFlip RejectSuperlevelBelowThreshold RejectConstantNotPeriodic RejectEssentialDeathBound RejectReducedPointClass RejectMergerKillsPointClass RejectSeparationWithoutNonzeroCoeff RejectNonmergerKillsDifference RejectEssentialDeathDetermined; do code=0 lean -DwarningAsError=true --root="$TORUS_OUT" "$TORUS_OUT/$control.lean" >"$TORUS_OUT/$control.log" 2>&1 || code=$? printf '%s\n' "$code" >"$TORUS_OUT/$control.status" diff --git a/companions/torus_filtration_20261011/test_torus_filtration.py b/companions/torus_filtration_20261011/test_torus_filtration.py index 9aeae2df6..44e4445e6 100644 --- a/companions/torus_filtration_20261011/test_torus_filtration.py +++ b/companions/torus_filtration_20261011/test_torus_filtration.py @@ -89,6 +89,16 @@ 'abbrev': ['ordinaryH0Control_intCoeff', 'ordinaryH0Control_zeroCoeff', 'ordinaryH0Control_mod2Coeff'], 'def': ['ordinaryH0Control_collapse', 'ordinaryH0Control_fst', 'ordinaryH0Control_parabolaLeft', 'ordinaryH0Control_parabolaRight'], + 'instance': []}, + # owner-authored C263 Field adapter (8a247043…), as scan_module reports it; every name carries superlevelBarField_ + 'SuperlevelBarField': { + 'theorem': '''superlevelBarField_continuous superlevelBarField_nonempty superlevelBarField_deathHeight_eq + superlevelBarField_isEssential_iff superlevelBarField_elderPartner_iff superlevelBarField_essential_unique + superlevelBarField_deathHeight_unique superlevelBarField_elderPartner_unique + superlevelBarField_shift_deathHeight_const superlevelBarField_const_smooth superlevelBarField_const_periodic + superlevelBarField_control_essential_free'''.split(), + 'abbrev': [], + 'def': ['superlevelBarField_interface', 'superlevelBarField_shift'], 'instance': []}} HANDOFF_COMMENTS = ('6111056103', '6111059166', '6111059498', '6111059848', '6111255007', '6111093545', '6111139060') # Math- #428 (and the #419 allocation) comments the C26x successor record cites, per module. @@ -100,8 +110,15 @@ '261dd0526d42890d8a4ac1225fcf47228eb3c9799af4106cb643a528bcbf968e', 18469)} # The owner-authored controls module (no handoff bytes): its identity and the Math- #428 comments its record cites # (6113277485: C264 owner task, item 4; 6113277173: the corrected CONTROL_OBLIGATIONS it instantiates). -OWNER_IDENTITY = {'OrdinaryH0Controls.lean': ('df9d3645282ca526b67eca3d5db691b622092a14b5fddee9be21013e39666184', 29590)} -OWNER_COMMENTS = {'OrdinaryH0Controls.lean': {'6113277485', '6113277173'}} +OWNER_IDENTITY = {'OrdinaryH0Controls.lean': ('df9d3645282ca526b67eca3d5db691b622092a14b5fddee9be21013e39666184', 29590), + 'SuperlevelBarField.lean': ('8a2470431c3fda5e98859aa9372cbb8866ed5c5c722cea5dfc28cb577840bbad', 11816)} +# (6112932068: the adapter route this lane retained; 6124097060: the allocation of its import line and compile step.) +OWNER_COMMENTS = {'OrdinaryH0Controls.lean': {'6113277485', '6113277173'}, + 'SuperlevelBarField.lean': {'6112932068', '6124097060'}} +# The one external input (the statement packet's Field module, #419's packet on main): path and identity. +FIELD_PATH = 'specifications/lean_statements_20261010/Specifications/Field.lean' +FIELD_IDENTITY = {'bytes': 27767, 'sha256': 'f22c91e082cd7e738ba47c9c3534e47ac687d066f0b78586d15103cf1132535e', + 'git_blob': 'cc40e9d19446b8a150401c574d3cfd56177f195f'} LEAN_VERSION_LINE = 'Lean (version 4.34.1, x86_64-unknown-linux-gnu, commit 5045d0056413266e57c625dcd7c365b10e377c52, Release)\n' FALSE_LOG = '/tmp/evidence/{0}.lean:4:2: error: unsolved goals\n⊢ False\n' # The item-4 controls as Lean 4.34.1 printed them at the Mathlib d13f23b7 pin (this lane's pre-commit run on the @@ -121,21 +138,30 @@ 'RejectSeparationWithoutNonzeroCoeff': '/tmp/evidence/RejectSeparationWithoutNonzeroCoeff.lean:3:158: error: unsolved goals\n⊢ ¬ordinaryH0_pointClass (↧Bool) ordinaryH0Control_intCoeff true =\n ordinaryH0_pointClass (↧Bool) ordinaryH0Control_intCoeff false\n/tmp/evidence/RejectSeparationWithoutNonzeroCoeff.lean:4:8: error: This simp argument is unused:\n ordinaryH0Control_bool_zeroCoeff_eq\n\nHint: Omit it from the simp argument list.\n [apply] simp\n\nNote: This linter can be disabled with `set_option linter.unusedSimpArgs false`\n', 'RejectNonmergerKillsDifference': '/tmp/evidence/RejectNonmergerKillsDifference.lean:4:2: error: `simp` made no progress\n', } +# The Field-adapter control as Lean 4.34.1 printed it at the d13f23b7 pin (this lane's pre-commit run, 2026-10-12; only +# the directory is shortened), and the outcome of the same tactic on its TRUE sibling (the shift by 0 instead of 1): +# Lean proves the sibling, exit 0 and no output, which `negative` refuses under either status. +FIELD_CONTROL_LOG = '/tmp/evidence/RejectEssentialDeathDetermined.lean:3:149: error: unsolved goals\n⊢ False\n' +FIELD_SIBLING_LOG = '' SORRY_WARNING = "/tmp/evidence/RejectSorry.lean:2:8: warning: declaration uses `sorry`\n" INJECTED = "'injected' depends on axioms: [{0}]\n" -LEANCHECKER_MODULES = 'leanchecker TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls TorusFiltration' +LEANCHECKER_MODULES = ('leanchecker Specifications.Field TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls ' + 'SuperlevelBarField TorusFiltration') +LEANCHECKER_MODULES_BEFORE_FIELD = 'leanchecker TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls TorusFiltration' LEANCHECKER_MODULES_BEFORE_CONTROLS = 'leanchecker TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 TorusFiltration' LEANCHECKER_MODULES_BEFORE_C26X = 'leanchecker TorusTopology ClosedSuperlevel TorusFiltration' LEANCHECKER_FRESH = 'leanchecker --fresh TorusFiltration' EMITTED = ('Audit.lean', 'Types.lean', 'Positive.lean', 'Census.lean', 'RejectSuperlevelSignFlip.lean', 'RejectSuperlevelBelowThreshold.lean', 'RejectConstantNotPeriodic.lean', 'RejectEssentialDeathBound.lean', 'RejectReducedPointClass.lean', 'RejectMergerKillsPointClass.lean', 'RejectSeparationWithoutNonzeroCoeff.lean', - 'RejectNonmergerKillsDifference.lean', 'RejectSorry.lean', 'RejectCustomAxiom.lean', 'RejectNativeDecide.lean') + 'RejectNonmergerKillsDifference.lean', 'RejectEssentialDeathDetermined.lean', 'RejectSorry.lean', + 'RejectCustomAxiom.lean', 'RejectNativeDecide.lean') PYTHON_LINE = 'TORUS_FILTRATION_PYTHON: optimize=%d' % sys.flags.optimize # Compiler-generated internal constants as the real census lists them (abstracted proofs, equation lemmas); the fixture # census carries a few so the parser's `internal generated` branch is exercised. Rows four to fifteen are exactly the -# `internal generated` rows of the C263 and C264 range-aware censuses at the pin (1 + 11), and the last four those of -# OrdinaryH0Controls (`_proof_1` and `eq_1` of its two subtype-point definitions); the fifth, +# `internal generated` rows of the C263 and C264 range-aware censuses at the pin (1 + 11), the next four those of +# OrdinaryH0Controls (`_proof_1` and `eq_1` of its two subtype-point definitions), and the last four those of +# SuperlevelBarField (`_proof_1` and `_proof_2` of its two interface records); the fifth, # `CategoryTheory.Limits.sigmaConst.eq_1`, is the equation lemma Lean generated for a Mathlib definition that # OrdinaryH0.lean unfolds, attributed to the companion module, so the census parser must tolerate internal generated # constants outside the companion namespace. @@ -151,7 +177,9 @@ 'TorusFiltration.ordinaryH0_simplicialPointClass._proof_4', 'TorusFiltration.ordinaryH0_simplicialPointClass.eq_1', 'TorusFiltration.ordinaryH0Control_parabolaLeft._proof_1', 'TorusFiltration.ordinaryH0Control_parabolaLeft.eq_1', - 'TorusFiltration.ordinaryH0Control_parabolaRight._proof_1', 'TorusFiltration.ordinaryH0Control_parabolaRight.eq_1') + 'TorusFiltration.ordinaryH0Control_parabolaRight._proof_1', 'TorusFiltration.ordinaryH0Control_parabolaRight.eq_1', + 'TorusFiltration.superlevelBarField_interface._proof_1', 'TorusFiltration.superlevelBarField_interface._proof_2', + 'TorusFiltration.superlevelBarField_shift._proof_1', 'TorusFiltration.superlevelBarField_shift._proof_2') # The outer interpreter mode goes into the test transcript (tests.log / tests-optimized.log), so the hosted # evidence records which mode each suite ran in (C262 G1). print('TORUS_FILTRATION_TESTS: outer optimize=%d' % sys.flags.optimize, file=sys.stderr) @@ -220,6 +248,10 @@ def __init__(self, c, tmp): for name in ('replay.sh', 'test_torus_filtration.py', 'README.md', 'SCOPE.md'): (self.side / name).write_text('# fixture ' + name + '\n') (self.root / c.WORKFLOW).write_text('name: fixture\n') + # the external input is pinned by identity, so the fixture carries its real bytes (the replay's checkout has them) + for path in c.EXTERNAL_INPUTS: + (self.root / path).parent.mkdir(parents=True) + shutil.copy(ROOT / path, self.root / path) (self.root / 'formal/lean-toolchain').write_text('leanprover/lean4:v4.34.1\n') (self.root / 'formal/lakefile.toml').write_text('name = "fixture"\n') self.revisions = {'mathlib': 'd1' * 20, 'batteries': 'f2' * 20} @@ -384,21 +416,28 @@ def setUpClass(cls): def test_inventory_constants(self): names = [n for m in INVENTORY.values() for kind in m.values() for n in kind] self.assertEqual(len(names), len(set(names))) - self.assertEqual(sum(len(m['theorem']) for m in INVENTORY.values()), 118) + self.assertEqual(sum(len(m['theorem']) for m in INVENTORY.values()), 130) self.assertEqual([len(INVENTORY[m]['theorem']) for m in ('TorusTopology', 'ClosedSuperlevel', 'SuperlevelBar', 'OrdinaryH0', - 'OrdinaryH0Controls')], - [21, 20, 20, 20, 37]) - self.assertEqual(sum(len(m['def']) for m in INVENTORY.values()), 26) - self.assertEqual([len(INVENTORY[m]['def']) for m in INVENTORY], [6, 6, 3, 7, 4]) + 'OrdinaryH0Controls', 'SuperlevelBarField')], + [21, 20, 20, 20, 37, 12]) + self.assertEqual(sum(len(m['def']) for m in INVENTORY.values()), 28) + self.assertEqual([len(INVENTORY[m]['def']) for m in INVENTORY], [6, 6, 3, 7, 4, 2]) self.assertEqual(sum(len(m['abbrev']) for m in INVENTORY.values()), 6) - self.assertEqual([len(INVENTORY[m]['abbrev']) for m in INVENTORY], [2, 0, 1, 0, 3]) + self.assertEqual([len(INVENTORY[m]['abbrev']) for m in INVENTORY], [2, 0, 1, 0, 3, 0]) self.assertEqual(sum(len(m['instance']) for m in INVENTORY.values()), 3) - self.assertEqual(sum(len(kind) for m in INVENTORY.values() for kind in m.values()), 153) + self.assertEqual(sum(len(kind) for m in INVENTORY.values() for kind in m.values()), 167) self.assertEqual(sum(len(kind) for kind in INVENTORY['OrdinaryH0Controls'].values()), 44) - # every declaration of the controls module carries its own prefix, and no other module uses it - self.assertTrue(all(n.startswith('ordinaryH0Control_') for kind in INVENTORY['OrdinaryH0Controls'].values() for n in kind)) - self.assertFalse(any(n.startswith('ordinaryH0Control_') for m in self.c.MODULES[:-1] for kind in INVENTORY[m].values() for n in kind)) - self.assertEqual(len(INTERNAL_GENERATED), 19) + self.assertEqual(sum(len(kind) for kind in INVENTORY['SuperlevelBarField'].values()), 14) + # every declaration of each owner-authored module carries its own prefix, and no other module uses it + # (superlevelBar_ is a prefix of superlevelBarField_, so the C263 check excludes the adapter's names) + for owner, prefix in (('OrdinaryH0Controls', 'ordinaryH0Control_'), ('SuperlevelBarField', 'superlevelBarField_')): + self.assertTrue(all(n.startswith(prefix) for kind in INVENTORY[owner].values() for n in kind), owner) + self.assertFalse(any(n.startswith(prefix) for m in self.c.MODULES if m != owner for kind in INVENTORY[m].values() + for n in kind), owner) + self.assertTrue(all(n.startswith('superlevelBar_') for kind in INVENTORY['SuperlevelBar'].values() for n in kind)) + self.assertEqual(len(INTERNAL_GENERATED), 23) + for token in ('REPLAY_MEASUREMENT', 'LCK_MEASUREMENT', 'CENSUS_PENDING'): + self.assertNotIn(token, (SIDE / 'check.py').read_text(encoding='utf-8'), token) self.assertTrue(all(re.fullmatch(self.c.IDENT, n) for n in names)) self.assertEqual(tuple(INVENTORY), self.c.MODULES) @@ -408,9 +447,22 @@ def test_source_files_inventory_provenance_and_identities(self): self.assertEqual(meta['theorems'][module], INVENTORY[module]['theorem']) for kind in ('abbrev', 'def', 'instance'): self.assertEqual(meta['definitions'][module][kind], INVENTORY[module][kind]) - self.assertEqual(len(self.c.targets(meta)), 153) + self.assertEqual(len(self.c.targets(meta)), 167) self.assertEqual(self.c.theorem_targets(meta)[0], 'TorusFiltration.torus_field_latticeVec_formula') - self.assertEqual(self.c.theorem_targets(meta)[-1], 'TorusFiltration.ordinaryH0Control_parabola_strict_difference_ne_zero') + self.assertEqual(self.c.theorem_targets(meta)[-1], 'TorusFiltration.superlevelBarField_control_essential_free') + # The external input record: compared whole, the identity recorded in this test, and (when the file is present, as + # in the replay's checkout) the bytes in the tree ARE that identity. + self.assertEqual(meta['external_inputs'], self.c.EXTERNAL_INPUTS) + self.assertEqual(set(self.c.EXTERNAL_INPUTS), {FIELD_PATH}) + record = self.c.EXTERNAL_INPUTS[FIELD_PATH] + self.assertEqual({k: record[k] for k in ('bytes', 'sha256', 'git_blob')}, FIELD_IDENTITY) + self.assertEqual((record['module'], record['imported_by']), ('Specifications.Field', 'SuperlevelBarField')) + self.assertIn('-DautoImplicit=false', record['compiled_with']) + self.assertIn('not companion source', record['status']) + self.assertNotIn(FIELD_PATH, self.c.REQUIRED_FILES) + self.assertEqual(self.c.EXTERNAL_IMPORTS, {'SuperlevelBarField': ('Specifications.Field',)}) + if (ROOT / FIELD_PATH).is_file(): + self.assertEqual(self.c.identity((ROOT / FIELD_PATH).read_bytes()), FIELD_IDENTITY, 'tracked Field.lean is not the pinned input') prov = meta['provenance'] self.assertEqual(set(HANDOFF_COMMENTS), set(prov['handoff_comments'].values())) self.assertEqual(prov['handoff_pr'], 'd6g8k5htny-coder/Math-#419') @@ -447,26 +499,40 @@ def test_source_files_inventory_provenance_and_identities(self): self.assertIn('38 constants = 27 user range + 0 user generated + 11 internal generated', prov['successors']['OrdinaryH0.lean']['census_at_pin']) self.assertIn('authored directly in namespace TorusFiltration', prov['namespace_mapping']) self.assertIn('OrdinaryH0Controls', prov['namespace_mapping']) + self.assertIn('SuperlevelBarField', prov['namespace_mapping']) # The owner-authored record: compared whole, its identity is the tracked module's, it cites the item-4 task and the # CONTROL_OBLIGATIONS specification, it is not a handoff successor and not a review, and the FORMAL HOLD of # OrdinaryH0 is recorded as unchanged; credit 0. self.assertEqual(prov['owner_modules'], self.c.OWNER_MODULES) self.assertEqual(set(prov['owner_modules']), set(OWNER_IDENTITY)) self.assertFalse(set(prov['owner_modules']) & set(prov['successors'])) + # per-record labels: the review status names the module whose FORMAL HOLD it leaves in place, and the imports, + # census and declaration counts are those of the registered bytes + owner_labels = { + 'OrdinaryH0Controls.lean': (('not a review of OrdinaryH0', 'FORMAL HOLD of OrdinaryH0', 'unchanged'), + ['Mathlib', 'OrdinaryH0'], + '48 constants = 44 user range + 0 user generated + 4 internal generated', + '37 theorems, 3 abbrevs, 4 defs, 0 instances'), + 'SuperlevelBarField.lean': (('not a review of SuperlevelBar', 'FORMAL HOLD of SuperlevelBar extends to it', + 'by definition', 'no persistence elder rule'), + ['Mathlib', 'SuperlevelBar', 'Specifications.Field'], + '18 constants = 14 user range + 0 user generated + 4 internal generated', + '12 theorems, 0 abbrevs, 2 defs, 0 instances')} + self.assertEqual(set(owner_labels), set(OWNER_IDENTITY)) for name, (digest, size) in OWNER_IDENTITY.items(): record = prov['owner_modules'][name] + phrases, imports, census, declarations = owner_labels[name] self.assertEqual((record['sha256'], record['bytes']), (digest, size), name) self.assertEqual(set(record['comments'].values()), OWNER_COMMENTS[name], name) self.assertEqual(record['organizational_independence_credit'], 0) self.assertIn('Anthropic/Claude', record['author']) self.assertIn('not a handoff successor', record['kind']) self.assertIn('not a review', record['kind']) - self.assertIn('not a review of OrdinaryH0', record['review_status']) - self.assertIn('FORMAL HOLD of OrdinaryH0', record['review_status']) - self.assertIn('unchanged', record['review_status']) - self.assertEqual(record['imports'], ['Mathlib', 'OrdinaryH0']) - self.assertIn('48 constants = 44 user range + 0 user generated + 4 internal generated', record['census_at_pin']) - self.assertEqual(record['declarations'], '37 theorems, 3 abbrevs, 4 defs, 0 instances') + for phrase in phrases: + self.assertIn(phrase, record['review_status'], name) + self.assertEqual(record['imports'], imports, name) + self.assertIn(census, record['census_at_pin'], name) + self.assertEqual(record['declarations'], declarations, name) self.assertNotIn(name, {k.split('/')[-1] for k in self.c.ORIGINAL_SHA256}) tracked = ROOT / self.c.PACKAGE / name if tracked.is_file(): @@ -541,7 +607,17 @@ def test_module_scan_accepts_only_the_whitelisted_shapes(self): for text in (controls.replace('import Mathlib\n', 'import Mathlib\nimport OrdinaryH0\n', 1), controls.replace('import Mathlib\n', 'import Mathlib\nimport ClosedSuperlevel\nimport OrdinaryH0\n', 1)): self.assertEqual(self.c.scan_module(text, 'OrdinaryH0Controls'), INVENTORY['OrdinaryH0Controls']) - self.assertEqual(self.c.MODULES, ('TorusTopology', 'ClosedSuperlevel', 'SuperlevelBar', 'OrdinaryH0', 'OrdinaryH0Controls')) + # SuperlevelBarField.lean imports SuperlevelBar and the external Specifications.Field (EXTERNAL_IMPORTS), and opens + # the Field namespace + field = placeholder_module('SuperlevelBarField') + for text in (field.replace('import Mathlib\n', 'import Mathlib\nimport SuperlevelBar\nimport Specifications.Field\n', 1), + field.replace('import Mathlib\n', 'import Mathlib\nimport Specifications.Field\n', 1), + field.replace('import Mathlib\n', 'import Mathlib\nimport SuperlevelBar\nimport Specifications.Field\n\n' + 'noncomputable section\n\nopen UniversalLaw.Spec.Field\n', 1), + field.replace('import Mathlib\n', 'import Mathlib\nimport OrdinaryH0Controls\n', 1)): + self.assertEqual(self.c.scan_module(text, 'SuperlevelBarField'), INVENTORY['SuperlevelBarField']) + self.assertEqual(self.c.MODULES, ('TorusTopology', 'ClosedSuperlevel', 'SuperlevelBar', 'OrdinaryH0', 'OrdinaryH0Controls', + 'SuperlevelBarField')) def test_module_scan_refuses_admissions_and_unexpected_kinds(self): good = placeholder_module('ClosedSuperlevel') @@ -649,6 +725,16 @@ def inject(line): (good.replace('import Mathlib\n', 'import Mathlib\nimport SuperlevelBar\n', 1), 'companion import out of dependency order in ClosedSuperlevel:2: SuperlevelBar'), (good.replace('import Mathlib\n', 'import Mathlib\nimport OrdinaryH0\n', 1), 'companion import out of dependency order in ClosedSuperlevel:2: OrdinaryH0'), (good.replace('import Mathlib\n', 'import Mathlib\nimport OrdinaryH0Controls\n', 1), 'companion import out of dependency order in ClosedSuperlevel:2: OrdinaryH0Controls'), + (good.replace('import Mathlib\n', 'import Mathlib\nimport SuperlevelBarField\n', 1), 'companion import out of dependency order in ClosedSuperlevel:2: SuperlevelBarField'), + # the external Field module: admitted by the prelude regex, refused outside SuperlevelBarField; no other + # Specifications module, no submodule and no bare package name is admitted at all + (good.replace('import Mathlib\n', 'import Mathlib\nimport Specifications.Field\n', 1), 'external import outside its module in ClosedSuperlevel:2: Specifications.Field'), + (good.replace('import Mathlib\n', 'import Mathlib\nimport Specifications.Lifetime\n', 1), unexpected), + (good.replace('import Mathlib\n', 'import Mathlib\nimport Specifications\n', 1), unexpected), + (good.replace('import Mathlib\n', 'import Mathlib\nimport Specifications.Field.Hidden\n', 1), unexpected), + (good.replace('import Mathlib\n', 'import Mathlib\nimport SpecificationsXField\n', 1), unexpected), + (good.replace('import Mathlib\n', 'import Mathlib\nimport SpecificationProofs.Field\n', 1), unexpected), + (inject('import Specifications.Field'), 'import inside the namespace: ClosedSuperlevel:'), (good.replace('import Mathlib\n', 'import Mathlib\nimport TorusFiltration\n', 1), unexpected), (good.replace('import Mathlib\n', 'import Mathlib\nimport TorusTopology.Hidden\n', 1), unexpected), (good.replace('import Mathlib\n', 'import Mathlib\nimport TorusTopology Hidden\n', 1), unexpected), @@ -695,6 +781,26 @@ def inject(line): self.c.scan_module(placeholder_module('OrdinaryH0Controls').replace('import Mathlib\n', 'import Mathlib\nimport OrdinaryH0Controls\n', 1), 'OrdinaryH0Controls') with self.assertRaisesRegex(ValueError, 'unexpected column-0 line in OrdinaryH0Controls:2: import TorusFiltration'): self.c.scan_module(placeholder_module('OrdinaryH0Controls').replace('import Mathlib\n', 'import Mathlib\nimport TorusFiltration\n', 1), 'OrdinaryH0Controls') + # The adapter comes last: no module before it may import it or the external Field module; it may not import itself, + # the root or any other Specifications module. + field = placeholder_module('SuperlevelBarField') + for module in self.c.MODULES[:-1]: + with self.subTest(module=module), self.assertRaisesRegex(ValueError, 'external import outside its module in ' + module + ':2: Specifications.Field'): + self.c.scan_module(placeholder_module(module).replace('import Mathlib\n', 'import Mathlib\nimport Specifications.Field\n', 1), module) + with self.subTest(module=module), self.assertRaisesRegex(ValueError, 'companion import out of dependency order in ' + module + ':2: SuperlevelBarField'): + self.c.scan_module(placeholder_module(module).replace('import Mathlib\n', 'import Mathlib\nimport SuperlevelBarField\n', 1), module) + for text, message in ((field.replace('import Mathlib\n', 'import Mathlib\nimport SuperlevelBarField\n', 1), + 'companion import out of dependency order in SuperlevelBarField:2: SuperlevelBarField'), + (field.replace('import Mathlib\n', 'import Mathlib\nimport TorusFiltration\n', 1), + 'unexpected column-0 line in SuperlevelBarField:2: import TorusFiltration'), + (field.replace('import Mathlib\n', 'import Mathlib\nimport Specifications.Lifetime\n', 1), + 'unexpected column-0 line in SuperlevelBarField:2: import Specifications.Lifetime'), + (field.replace('import Mathlib\n', 'import Mathlib\nimport SpecificationProofs.Field\n', 1), + 'unexpected column-0 line in SuperlevelBarField:2: import SpecificationProofs.Field'), + (field.replace('namespace TorusFiltration\n', 'namespace TorusFiltration\nimport Specifications.Field\n'), + 'import inside the namespace: SuperlevelBarField:')): + with self.subTest(message=message), self.assertRaisesRegex(ValueError, re.escape(message)): + self.c.scan_module(text, 'SuperlevelBarField') with self.assertRaisesRegex(ValueError, 'not a companion module: TorusFiltration'): self.c.scan_module(good, 'TorusFiltration') with self.assertRaisesRegex(ValueError, 'not a companion module: Other'): @@ -756,6 +862,31 @@ def test_item4_controls_accept_their_pinned_logs_and_refuse_their_true_siblings( with self.subTest(discriminator=control), self.assertRaisesRegex(ValueError, 'not the intended False-goal diagnostic: ' + control): self.c.negative(log, control, 1) + def test_field_control_accepts_its_pinned_log_and_refuses_its_true_sibling(self): + # The Field-adapter control: Lean's diagnostic is accepted; the outcome of the same tactic on the true sibling + # (the shift by 0: proved, exit 0, no output) is refused under either status, and so is the control's log under + # any other control's name. Its statement names both adapter records and its tactic the three lemmas that make + # the two sides 0 and 1. + control = 'RejectEssentialDeathDetermined' + self.assertEqual(self.c.negative(FIELD_CONTROL_LOG, control, 1), 'REJECTED_BY_LEAN') + with self.assertRaisesRegex(ValueError, 'false-statement control must exit exactly one'): + self.c.negative(FIELD_SIBLING_LOG, control, 0) + with self.assertRaisesRegex(ValueError, 'not the intended False-goal diagnostic: ' + control): + self.c.negative(FIELD_SIBLING_LOG, control, 1) + for other in self.c.FALSE_CONTROLS: + if other != control: + with self.subTest(other=other), self.assertRaisesRegex(ValueError, 'not the intended False-goal diagnostic: ' + other): + self.c.negative(FIELD_CONTROL_LOG, other, 1) + statement, tactic = self.c.FALSE_CONTROLS[control] + self.assertEqual(statement, '(superlevelBarField_interface 1 1).deathHeight (fun _ => (0 : ℝ)) 0 = ' + '(superlevelBarField_shift 1 1 1).deathHeight (fun _ => (0 : ℝ)) 0') + self.assertEqual(tactic, 'norm_num [superlevelBarField_deathHeight_eq, superlevelBar_death_const, ' + 'superlevelBarField_shift_deathHeight_const]') + for lemma in ('superlevelBarField_deathHeight_eq', 'superlevelBarField_shift_deathHeight_const'): + self.assertIn(lemma, INVENTORY['SuperlevelBarField']['theorem']) + self.assertIn('superlevelBar_death_const', INVENTORY['SuperlevelBar']['theorem']) + self.assertIn('superlevelBarField_control_essential_free', INVENTORY['SuperlevelBarField']['theorem']) + def test_negative_injection_controls_require_the_audit_to_refuse(self): for control, (_, forbidden, _) in self.c.INJECTIONS.items(): good = good_injection_log(self.c, control) @@ -851,6 +982,12 @@ def test_leanchecker_mode_accepts_exactly_the_two_recorded_invocations(self): self.assertEqual(self.c.leanchecker_mode(LEANCHECKER_FRESH + '\n'), 'fresh') self.assertEqual(self.c.LEANCHECKER, {LEANCHECKER_MODULES: 'modules', LEANCHECKER_FRESH: 'fresh'}) for bad in ('', 'leanchecker TorusFiltration', 'leanchecker --fresh TorusTopology', 'leanchecker TorusTopology ClosedSuperlevel', + LEANCHECKER_MODULES_BEFORE_FIELD, LEANCHECKER_MODULES_BEFORE_FIELD.replace(' TorusFiltration', ' SuperlevelBarField TorusFiltration'), + 'leanchecker Specifications.Field ' + LEANCHECKER_MODULES_BEFORE_FIELD[12:], + LEANCHECKER_MODULES.replace('leanchecker Specifications.Field ', 'leanchecker ') + ' Specifications.Field', + LEANCHECKER_MODULES.replace(' SuperlevelBarField', ''), LEANCHECKER_MODULES.replace('Specifications.Field', 'Specifications'), + LEANCHECKER_MODULES.replace('Specifications.Field', 'Specifications.Field Specifications.Lifetime'), + LEANCHECKER_MODULES.replace(' OrdinaryH0Controls SuperlevelBarField', ' SuperlevelBarField OrdinaryH0Controls'), LEANCHECKER_MODULES_BEFORE_C26X, 'leanchecker TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0', LEANCHECKER_MODULES_BEFORE_CONTROLS, LEANCHECKER_MODULES_BEFORE_CONTROLS + ' OrdinaryH0Controls', 'leanchecker TorusTopology ClosedSuperlevel SuperlevelBar OrdinaryH0 OrdinaryH0Controls', @@ -874,14 +1011,17 @@ def test_emit_writes_exactly_the_audit_types_positive_and_controls(self): census = (out / 'Census.lean').read_text() self.assertTrue(census.startswith('import TorusFiltration\n')) for needed in ('isInternalDetail', 'findDeclarationRanges?', 'getModuleIdxFor?', '`TorusTopology', '`ClosedSuperlevel', - '`SuperlevelBar, `OrdinaryH0, `OrdinaryH0Controls, `TorusFiltration', 'CENSUS_END', '"internal" else "user"', - '"range" else "generated"'): + '`SuperlevelBar, `OrdinaryH0, `OrdinaryH0Controls, `SuperlevelBarField, `TorusFiltration', 'CENSUS_END', + '"internal" else "user"', '"range" else "generated"'): self.assertIn(needed, census) - self.assertIn('#[`TorusTopology, `ClosedSuperlevel, `SuperlevelBar, `OrdinaryH0, `OrdinaryH0Controls, `TorusFiltration]', census) + self.assertIn('#[`TorusTopology, `ClosedSuperlevel, `SuperlevelBar, `OrdinaryH0, `OrdinaryH0Controls, `SuperlevelBarField, ' + '`TorusFiltration]', census) + # the external module is not companion source: the census does not list it + self.assertNotIn('Specifications', census) audit = (out / 'Audit.lean').read_text().splitlines() self.assertEqual(audit[0], 'import TorusFiltration') self.assertEqual(audit[1:], ['#print axioms ' + n for n in self.c.targets(meta)]) - self.assertEqual(len(audit[1:]), 153) + self.assertEqual(len(audit[1:]), 167) types = (out / 'Types.lean').read_text().splitlines() self.assertEqual(types[:2], ['import TorusFiltration', 'set_option pp.explicit true']) self.assertEqual(types[2:], ['#check ' + n for n in self.c.theorem_targets(meta)]) @@ -908,7 +1048,8 @@ def test_emit_writes_exactly_the_audit_types_positive_and_controls(self): item4 = ('RejectMergerKillsPointClass', 'RejectSeparationWithoutNonzeroCoeff', 'RejectNonmergerKillsDifference') for prefix, names in (('superlevel_', ('RejectSuperlevelSignFlip', 'RejectSuperlevelBelowThreshold')), ('torus_', ('RejectConstantNotPeriodic',)), ('superlevelBar_', ('RejectEssentialDeathBound',)), - ('ordinaryH0_', ('RejectReducedPointClass',) + item4), ('ordinaryH0Control_', item4)): + ('ordinaryH0_', ('RejectReducedPointClass',) + item4), ('ordinaryH0Control_', item4), + ('superlevelBarField_', ('RejectEssentialDeathDetermined',))): for name in names: self.assertIn(prefix, self.c.FALSE_CONTROLS[name][0], name) # The item-4 controls, exactly: each tactic rewrites with the true fixture theorem the statement contradicts. @@ -934,14 +1075,14 @@ def test_emit_writes_exactly_the_audit_types_positive_and_controls(self): self.assertIn('≠ CategoryTheory.CategoryStruct.id (ModuleCat.of ℤ ℤ)', self.c.FALSE_CONTROLS['RejectReducedPointClass'][0]) self.assertEqual(list(self.c.CONTROLS), ['RejectSuperlevelSignFlip', 'RejectSuperlevelBelowThreshold', 'RejectConstantNotPeriodic', 'RejectEssentialDeathBound', 'RejectReducedPointClass', 'RejectMergerKillsPointClass', - 'RejectSeparationWithoutNonzeroCoeff', 'RejectNonmergerKillsDifference', 'RejectSorry', - 'RejectCustomAxiom', 'RejectNativeDecide']) - self.assertEqual(len(self.c.EVIDENCE_FILES), 65) - self.assertEqual(self.c.BUILDS, ('build-TorusTopology', 'build-ClosedSuperlevel', 'build-SuperlevelBar', 'build-OrdinaryH0', - 'build-OrdinaryH0Controls', 'build-TorusFiltration', 'positive', 'axioms', 'types', 'census', - 'leanchecker')) + 'RejectSeparationWithoutNonzeroCoeff', 'RejectNonmergerKillsDifference', + 'RejectEssentialDeathDetermined', 'RejectSorry', 'RejectCustomAxiom', 'RejectNativeDecide']) + self.assertEqual(len(self.c.EVIDENCE_FILES), 72) + self.assertEqual(self.c.BUILDS, ('build-spec-Field', 'build-TorusTopology', 'build-ClosedSuperlevel', 'build-SuperlevelBar', + 'build-OrdinaryH0', 'build-OrdinaryH0Controls', 'build-SuperlevelBarField', 'build-TorusFiltration', + 'positive', 'axioms', 'types', 'census', 'leanchecker')) self.assertEqual(self.c.ROOT_SOURCE, 'import TorusTopology\nimport ClosedSuperlevel\nimport SuperlevelBar\nimport OrdinaryH0\n' - 'import OrdinaryH0Controls\n') + 'import OrdinaryH0Controls\nimport SuperlevelBarField\n') self.assertEqual({v[1] for v in self.c.INJECTIONS.values()}, {'sorryAx', 'hiddenPremise', 'injected._native.native_decide.ax_1_1'}) self.assertTrue(all(re.fullmatch(self.c.NAME, v[1]) and v[1] not in self.c.ALLOWED for v in self.c.INJECTIONS.values())) @@ -966,10 +1107,15 @@ def paths(self, event): def test_path_triggers_exclude_the_core_tree(self): expected = ['companions/torus_filtration_20261011/**', '.github/workflows/torus-filtration.yml', - 'formal/lakefile.toml', 'formal/lake-manifest.json', 'formal/lean-toolchain'] + 'formal/lakefile.toml', 'formal/lake-manifest.json', 'formal/lean-toolchain', + 'specifications/lean_statements_20261010/Specifications/Field.lean'] self.assertEqual(self.paths('pull_request'), expected) self.assertEqual(self.paths('push'), expected) self.assertNotIn("'formal/**'", self.workflow) + # exactly the one external input, never the whole statement packet + self.assertEqual(list(self.c.EXTERNAL_INPUTS), [expected[-1]]) + self.assertNotIn("'specifications/**'", self.workflow) + self.assertNotIn("'specifications/lean_statements_20261010/**'", self.workflow) self.assertIn(' branches: [main]\n', self.workflow) self.assertIn(' workflow_dispatch:\n', self.workflow) self.assertIn('permissions:\n contents: read\n', self.workflow) @@ -1004,19 +1150,32 @@ def test_replay_contract(self): 'run_lean positive lean -DwarningAsError=true', 'run_lean axioms lean -DwarningAsError=true', 'run_lean types lean -DwarningAsError=true', 'run_lean census lean -DwarningAsError=true --root="$TORUS_OUT" "$TORUS_OUT/Census.lean"', - 'set -euo pipefail\n# The outer Python mode is the one named on each command line below, never an ambient PYTHONOPTIMIZE (C262 G1).\nunset PYTHONOPTIMIZE\n'): + 'set -euo pipefail\n# The outer Python mode is the one named on each command line below, never an ambient PYTHONOPTIMIZE (C262 G1).\nunset PYTHONOPTIMIZE\n', + # the external Field build: its own output directory, required absent, first on LEAN_PATH, ahead of the companion + 'SPEC_OUT="$ROOT/.lake/torus-filtration-spec"', 'test ! -e "$SPEC_OUT"', + 'export LEAN_PATH="$TORUS_SPEC_OUT:$TORUS_SIDE:${LEAN_PATH:-}"'): self.assertIn(required, self.replay, required) - positions = [] - for module in ('TorusTopology', 'ClosedSuperlevel', 'SuperlevelBar', 'OrdinaryH0', 'OrdinaryH0Controls', 'TorusFiltration'): + spec_line = ('run_lean build-spec-Field lean -DautoImplicit=false --root="$TORUS_ROOT/specifications/lean_statements_20261010" ' + '-o "$TORUS_SPEC_OUT/Specifications/Field.olean" "$TORUS_ROOT/specifications/lean_statements_20261010/Specifications/Field.lean"') + self.assertEqual(self.replay.count(spec_line), 1) + self.assertEqual(self.replay.count('build-spec-Field'), 1) + positions = [self.replay.index(spec_line)] + for module in ('TorusTopology', 'ClosedSuperlevel', 'SuperlevelBar', 'OrdinaryH0', 'OrdinaryH0Controls', 'SuperlevelBarField', + 'TorusFiltration'): line = ('run_lean build-%s lean -DwarningAsError=true --root="$TORUS_SIDE" -o "$TORUS_SIDE/%s.olean" "$TORUS_SIDE/%s.lean"' % (module, module, module)) self.assertEqual(self.replay.count(line), 1, module) positions.append(self.replay.index(line)) - # dependency order: TorusTopology, ClosedSuperlevel, SuperlevelBar, OrdinaryH0 (imports ClosedSuperlevel), - # OrdinaryH0Controls (imports OrdinaryH0), then the root + # dependency order: the external Field, TorusTopology, ClosedSuperlevel, SuperlevelBar, OrdinaryH0 (imports + # ClosedSuperlevel), OrdinaryH0Controls (imports OrdinaryH0), SuperlevelBarField (imports SuperlevelBar and Field), + # then the root self.assertEqual(positions, sorted(positions)) self.assertLess(positions[-1], self.replay.index('run_lean positive')) - self.assertEqual(len(re.findall(r'^run_lean build-', self.replay, re.M)), 6) + self.assertEqual(len(re.findall(r'^run_lean build-', self.replay, re.M)), 8) + # the external build is the only one without warnings-as-errors, and it writes outside the source tree + unguarded = [l for l in self.replay.splitlines() if l.startswith('run_lean build-') and '-DwarningAsError=true' not in l] + self.assertEqual(unguarded, [spec_line]) + self.assertNotIn('specifications/lean_statements_20261010/Specifications/Field.olean', self.replay) commands = '\n'.join(line for line in self.replay.splitlines() if not line.lstrip().startswith('#')) for forbidden in ('gate.py', 'formal/tests', 'lake build', 'lake update', 'lake exe cache', 'formal-evidence', 'ResearchFormalCoreR1'): @@ -1059,7 +1218,13 @@ def test_documents_keep_the_status_vocabulary(self): 'C264 owner task item 4 controls (2026-10-12)', 'not a review', # FORMAL HOLD rests on the handoffs' own listed conditions; the source-scoped review keeps # Lean execution open and states no credit; the readback records credit 0 - '6113277485 item 5', 'open condition', 'same project account', 'nonzero organizational-independence credit'): + '6113277485 item 5', 'open condition', 'same project account', 'nonzero organizational-independence credit', + # the C263 Field adapter: the module, its identity, census, route and allocation, the external + # input and its identity, the control, the definitional elder clause and the Lifetime boundary + 'SuperlevelBarField', '8a247043', 'superlevelBarField_', '18 = 14 + 0 + 4', '6112932068', '6124097060', + 'Specifications.Field', 'f22c91e0', 'cc40e9d1', 'RejectEssentialDeathDetermined', 'by definition', + 'C263 Field adapter (2026-10-12)', 'UniversalLaw.Spec.Lifetime.SuperlevelBarInterface', + 'no inhabitant is constructed', 'FORMAL HOLD of `SuperlevelBar`'): self.assertIn(required, text, name + ' lacks ' + required) flat = ' '.join(text.split()) for stale in ( @@ -1069,10 +1234,13 @@ def test_documents_keep_the_status_vocabulary(self): 'this README records none since', 'records none since', 'beyond the discrete cases', 'Each statement applies one of the C264', 'instantiates the C264 statements', 'concrete instances of those C264 statements', - 'so that each statement is seen in use'): + 'so that each statement is seen in use', + # D1 of readback 5486565076: the over-broad zero-coefficient exclusion, narrowed + 'or any claim for a zero coefficient object'): self.assertNotIn(stale, flat, name + ' keeps a corrected statement: ' + stale) self.assertNotIn(LEANCHECKER_MODULES_BEFORE_C26X + '`', text, name + ' still names the pre-registration leanchecker command as current') self.assertNotIn(LEANCHECKER_MODULES_BEFORE_CONTROLS + '`', text, name + ' still names the pre-controls leanchecker command as current') + self.assertNotIn(LEANCHECKER_MODULES_BEFORE_FIELD + '`', text, name + ' still names the pre-adapter leanchecker command as current') self.assertNotIn('`leanchecker --fresh` re-checked', text, name + ' describes the withdrawn --fresh step as run') self.assertNotIn('runs `leanchecker --fresh TorusFiltration`', text) prose = re.sub(r'`[^`\n]*`', '', text) @@ -1089,7 +1257,8 @@ def test_documents_keep_the_status_vocabulary(self): for statement, _ in self.c.FALSE_CONTROLS.values(): self.assertIn('`' + statement + '`', readme, 'control statement not quoted verbatim: ' + statement) for required in ('.olean', 'never be committed', 'NOT_RUN', 'TORUS_LEANCHECKER_FRESH', 'leanchecker.cmd', - 'exactly the 65 evidence files', 'Registration is not review', 'OrdinaryH0Controls.olean', + 'exactly the 72 evidence files', 'Registration is not review', 'OrdinaryH0Controls.olean', + 'SuperlevelBarField.olean', '.lake/torus-filtration-spec', 'build-spec-Field', 'FIELD_SIBLING_LOG', '6116225936', 'C254 alone did not establish this', 'DISCRIMINATOR_LOGS', # the relabel is a dated companion note, the hosted run of 940dffc9 is reported, not adopted '(companion note, 2026-10-12, Math- #428 comment 6116225936, not\n part of the copied exclusion', @@ -1100,11 +1269,18 @@ def test_documents_keep_the_status_vocabulary(self): # counts and phrases the item-4 controls commit moved 'exactly the 54 evidence files', 'those 54 files', 'What the 81 theorems and 28 definitions', 'Every one of the 109', 'four-line root module', 'the twelve emitted Lean files', - 'All four modules `import Mathlib`', '(none exists: this lane', 'no nonauthor review of the compiled successor\nbytes yet'): + 'All four modules `import Mathlib`', '(none exists: this lane', 'no nonauthor review of the compiled successor\nbytes yet', + # counts and phrases the Field adapter commit moved + 'exactly the 65 evidence files', 'those 65 files', 'What the 118 theorems and 35 definitions', + 'Every one of the 153', 'five-line root module', 'the fifteen emitted Lean files', 'All five modules `import Mathlib`', + 'and runs eleven negative controls', 'unchanged by both registrations', + # template tokens of the drafting round must never ship + 'REPLAY_MEASUREMENT', 'LCK_MEASUREMENT', 'CENSUS_PENDING'): self.assertNotIn(stale, readme, 'README keeps a superseded count or statement: ' + stale) scope = (SIDE / 'SCOPE.md').read_text(encoding='utf-8') for stale in ('41 theorem statements and 17 audited definitions', 'these 58 declarations', 'exactly these 58', - '81 theorem statements and 28 audited definitions', 'these 109 declarations', 'exactly these 109'): + '81 theorem statements and 28 audited definitions', 'these 109 declarations', 'exactly these 109', + '118 theorem statements and 35 audited definitions', 'these 153 declarations', 'exactly these 153'): self.assertNotIn(stale, scope, 'SCOPE keeps a superseded count: ' + stale) @@ -1116,12 +1292,13 @@ def test_clean_fixture_passes_and_records_identity(self): self.assertEqual(run.returncode, 0, run.stderr) result = json.loads(run.stdout) self.assertEqual(result['checked_commit'], f.git('rev-parse', 'HEAD').strip()) - self.assertEqual(set(result['sources']), set(self.c.REQUIRED_FILES) | {self.c.PACKAGE + '/SOURCE_FILES.json'}) - self.assertEqual(len(result['declarations']), 153) + self.assertEqual(set(result['sources']), set(self.c.REQUIRED_FILES) | {self.c.PACKAGE + '/SOURCE_FILES.json', FIELD_PATH}) + self.assertEqual(result['sources'][FIELD_PATH], FIELD_IDENTITY) + self.assertEqual(len(result['declarations']), 167) self.assertEqual(result['environment'], {'lean_toolchain': 'leanprover/lean4:v4.34.1', 'dependency_revisions': f.revisions}) self.assertEqual(result['run_id'], 'local') - self.assertEqual(len(result['theorems']), 118) + self.assertEqual(len(result['theorems']), 130) hosted = {'GITHUB_ACTIONS': 'true', 'GITHUB_SHA': result['checked_commit'], 'GITHUB_REPOSITORY': self.c.REPO, 'GITHUB_RUN_ID': '77', 'GITHUB_RUN_ATTEMPT': '2'} run = f.run('source', env=hosted) @@ -1164,6 +1341,49 @@ def test_membership_and_byte_mutations_are_detected(self): f.restore() self.assertFails(f.run('source'), 'symlink source: ' + self.c.PACKAGE + '/README.md') + def test_external_input_is_bound_by_identity(self): + # The statement packet's Field.lean: its bytes in the tree and its blob at HEAD must both be the pinned identity. + with tempfile.TemporaryDirectory() as tmp: + f = Fixture(self.c, tmp) + field = f.root / FIELD_PATH + original = field.read_bytes() + self.assertEqual(f.run('source').returncode, 0) + # an uncommitted edit, a committed edit, a deletion, and a working tree restored over a changed commit + field.write_bytes(original + b'\n') + self.assertFails(f.run('source'), 'external input mismatch: ' + FIELD_PATH) + # a same-length edit (one byte changed), uncommitted + same_length = original.replace(b'structure SuperlevelBarInterface', b'structure SuperlevelBarInterfacf', 1) + self.assertEqual(len(same_length), len(original)) + field.write_bytes(same_length) + self.assertFails(f.run('source'), 'external input mismatch: ' + FIELD_PATH) + field.write_bytes(original + b'\n') + f.commit() + self.assertFails(f.run('source'), 'external input mismatch: ' + FIELD_PATH) + field.write_bytes(original) + self.assertFails(f.run('source'), 'external input not committed at HEAD: ' + FIELD_PATH) + # the pinned bytes restored and staged, but HEAD still holds the edit + f.git('add', '--', FIELD_PATH) + self.assertFails(f.run('source'), 'external input not committed at HEAD: ' + FIELD_PATH) + f.commit() + self.assertEqual(f.run('source').returncode, 0) + field.write_bytes(original.replace(b'structure SuperlevelBarInterface', b'structure SuperlevelBarInterfaceX', 1)) + f.commit() + self.assertFails(f.run('source'), 'external input mismatch: ' + FIELD_PATH) + field.write_bytes(original) + f.commit() + field.unlink() + self.assertFails(f.run('source'), 'external input absent: ' + FIELD_PATH) + f.git('checkout', '--', FIELD_PATH) + self.assertEqual(f.run('source').returncode, 0) + # a symlink anywhere on its path is refused, even one that resolves to the pinned bytes + moved = f.root / 'elsewhere' + shutil.move(str(f.root / 'specifications'), str(moved)) + os.symlink('elsewhere', f.root / 'specifications') + self.assertFails(f.run('source'), 'symlink source: ' + FIELD_PATH) + (f.root / 'specifications').unlink() + shutil.move(str(moved), str(f.root / 'specifications')) + self.assertEqual(f.run('source').returncode, 0) + def test_module_mutations_are_detected(self): with tempfile.TemporaryDirectory() as tmp: f = Fixture(self.c, tmp) @@ -1216,10 +1436,14 @@ def test_module_mutations_are_detected(self): self.assertEqual(f.run('source').returncode, 0) (f.side / 'TorusFiltration.lean').write_text('import TorusTopology\n') f.restore() - self.assertFails(f.run('source'), 'root module must import exactly the five modules') - # the pre-registration root (two imports) and the pre-controls root (four imports) are refused too; so is a - # reordered, duplicated or unterminated import list + self.assertFails(f.run('source'), 'root module must import exactly the companion modules, in MODULES order') + # the pre-registration root (two imports), the pre-controls root (four imports) and the pre-adapter root (five + # imports) are refused too; so is a reordered, duplicated or unterminated import list, and a root that also + # imports the external Field module for root in ('import TorusTopology\nimport ClosedSuperlevel\n', + 'import TorusTopology\nimport ClosedSuperlevel\nimport SuperlevelBar\nimport OrdinaryH0\nimport OrdinaryH0Controls\n', + self.c.ROOT_SOURCE.replace('import OrdinaryH0Controls\nimport SuperlevelBarField\n', 'import SuperlevelBarField\nimport OrdinaryH0Controls\n'), + self.c.ROOT_SOURCE + 'import Specifications.Field\n', self.c.ROOT_SOURCE.rstrip('\n'), 'import TorusTopology\nimport ClosedSuperlevel\nimport SuperlevelBar\nimport OrdinaryH0\n', 'import TorusTopology\nimport ClosedSuperlevel\nimport OrdinaryH0\nimport SuperlevelBar\nimport OrdinaryH0Controls\n', 'import TorusTopology\nimport ClosedSuperlevel\nimport SuperlevelBar\nimport OrdinaryH0Controls\nimport OrdinaryH0\n', @@ -1227,7 +1451,7 @@ def test_module_mutations_are_detected(self): 'import TorusTopology\nimport ClosedSuperlevel\nimport SuperlevelBar\nimport OrdinaryH0\nimport OrdinaryH0Controls'): (f.side / 'TorusFiltration.lean').write_text(root) f.restore() - self.assertFails(f.run('source'), 'root module must import exactly the five modules') + self.assertFails(f.run('source'), 'root module must import exactly the companion modules, in MODULES order') (f.side / 'TorusFiltration.lean').write_text(self.c.ROOT_SOURCE) # companion imports through the CLI: OrdinaryH0 may import ClosedSuperlevel (as the registered module does); # ClosedSuperlevel may not import SuperlevelBar, and no module may import the root @@ -1255,6 +1479,21 @@ def test_module_mutations_are_detected(self): f.restore() self.assertFails(f.run('source'), 'companion import out of dependency order in ClosedSuperlevel:2: SuperlevelBar') module.write_text(original) + # the adapter may import SuperlevelBar and the external Field module (as the registered module does); no other + # module may import the external one + adapter = f.side / 'SuperlevelBarField.lean' + adapter_original = adapter.read_text() + adapter.write_text(adapter_original.replace('import Mathlib\n', 'import Mathlib\nimport SuperlevelBar\nimport Specifications.Field\n', 1)) + f.restore() + self.assertEqual(f.run('source').returncode, 0, 'the adapter importing SuperlevelBar and Specifications.Field is source') + adapter.write_text(adapter_original.replace('import Mathlib\n', 'import Mathlib\nimport Specifications.Lifetime\n', 1)) + f.restore() + self.assertFails(f.run('source'), 'unexpected column-0 line in SuperlevelBarField:2: import Specifications.Lifetime') + adapter.write_text(adapter_original) + controls.write_text(controls_original.replace('import Mathlib\n', 'import Mathlib\nimport Specifications.Field\n', 1)) + f.restore() + self.assertFails(f.run('source'), 'external import outside its module in OrdinaryH0Controls:2: Specifications.Field') + controls.write_text(controls_original) f.regenerate() meta = json.loads((f.side / 'SOURCE_FILES.json').read_text()) del meta['files'][self.c.PACKAGE + '/TorusTopology.lean'] @@ -1344,6 +1583,29 @@ def mutate(m): (setter(('provenance', 'owner_modules', 'Other.lean'), {}), 'owner module provenance identity'), (lambda m: m['provenance']['successors'].__setitem__('OrdinaryH0Controls.lean', m['provenance']['owner_modules']['OrdinaryH0Controls.lean']), 'successor provenance identity'), + # the adapter's owner record, compared whole + (setter(('provenance', 'owner_modules', 'SuperlevelBarField.lean', 'sha256'), '0' * 64), 'owner module provenance identity'), + (setter(('provenance', 'owner_modules', 'SuperlevelBarField.lean', 'imports'), ['Mathlib', 'SuperlevelBar']), 'owner module provenance identity'), + (setter(('provenance', 'owner_modules', 'SuperlevelBarField.lean', 'review_status'), 'review of SuperlevelBar; FORMAL HOLD lifted'), + 'owner module provenance identity'), + (setter(('provenance', 'owner_modules', 'SuperlevelBarField.lean', 'organizational_independence_credit'), 1), 'owner module provenance identity'), + (deleter(('provenance', 'owner_modules', 'SuperlevelBarField.lean')), 'owner module provenance identity'), + (deleter(('provenance', 'owner_modules', 'SuperlevelBarField.lean', 'comments', 'allocation_428')), 'owner module provenance identity'), + (setter(('provenance', 'owner_modules', 'SuperlevelBarField.lean', 'formal_status'), 'ACCEPTED'), 'owner module provenance identity'), + # the external input record, compared whole + (setter(('external_inputs', FIELD_PATH, 'sha256'), '0' * 64), 'external input identity'), + (setter(('external_inputs', FIELD_PATH, 'extra'), 1), 'external input identity'), + (setter(('external_inputs', FIELD_PATH, 'git_blob'), '0' * 40), 'external input identity'), + (setter(('external_inputs', FIELD_PATH, 'bytes'), 27768), 'external input identity'), + (setter(('external_inputs', FIELD_PATH, 'status'), 'proved'), 'external input identity'), + (setter(('external_inputs', FIELD_PATH, 'imported_by'), 'OrdinaryH0Controls'), 'external input identity'), + (deleter(('external_inputs', FIELD_PATH)), 'external input identity'), + (setter(('external_inputs', 'specifications/lean_statements_20261010/Specifications/Lifetime.lean'), {}), 'external input identity'), + (setter(('external_inputs',), {}), 'external input identity'), + (deleter(('external_inputs',)), 'SOURCE_FILES schema keys'), + (setter(('modules',), ['TorusTopology', 'ClosedSuperlevel', 'SuperlevelBar', 'OrdinaryH0', 'OrdinaryH0Controls']), 'module list'), + (deleter(('theorems', 'SuperlevelBarField')), 'per-module inventory keys'), + (lambda m: m['files'].__setitem__(FIELD_PATH, FIELD_IDENTITY), 'files inventory outside the companion'), (deleter(('provenance', 'owner_modules')), 'provenance key missing: owner_modules'), (deleter(('provenance', 'successors')), 'provenance key missing: successors'), (deleter(('provenance', 'original_bytes')), 'provenance key missing: original_bytes'), @@ -1401,6 +1663,18 @@ def mutate(m): (lambda m: json.dumps(m, indent=2, sort_keys=True).replace('"schema": 1', '"schema": NaN', 1) + '\n', 'nonfinite or noninteger JSON number'), ] + # every field of the adapter's owner record and of the external input record, each changed on its own + for key, value in c.OWNER_MODULES['SuperlevelBarField.lean'].items(): + cases.append((setter(('provenance', 'owner_modules', 'SuperlevelBarField.lean', key), [value]), 'owner module provenance identity')) + for key, value in c.EXTERNAL_INPUTS[FIELD_PATH].items(): + cases.append((setter(('external_inputs', FIELD_PATH, key), [value]), 'external input identity')) + # ... and each top-level field dropped on its own + for key in c.OWNER_MODULES['SuperlevelBarField.lean']: + cases.append((deleter(('provenance', 'owner_modules', 'SuperlevelBarField.lean', key)), 'owner module provenance identity')) + for key in c.EXTERNAL_INPUTS[FIELD_PATH]: + cases.append((deleter(('external_inputs', FIELD_PATH, key)), 'external input identity')) + self.assertEqual(len(c.OWNER_MODULES['SuperlevelBarField.lean']), 12) + self.assertEqual(len(c.EXTERNAL_INPUTS[FIELD_PATH]), 7) with tempfile.TemporaryDirectory() as tmp: f = Fixture(c, tmp) self.assertEqual(f.run('source').returncode, 0) @@ -1428,10 +1702,11 @@ def test_complete_evidence_yields_a_bounded_receipt(self): self.assertIs(receipt['scientific_acceptance'], False) self.assertEqual(receipt['lean_version'], LEAN_VERSION_LINE.strip()) self.assertEqual(receipt['dependency_revisions'], f.revisions) - self.assertEqual(len(receipt['declarations']), 153) - self.assertEqual(len(receipt['axioms']), 58 + 24 + 27 + 44) - self.assertEqual(receipt['theorem_count'], 118) - self.assertEqual(receipt['definition_count'], {'abbrev': 6, 'def': 26, 'instance': 3}) + self.assertEqual(len(receipt['declarations']), 167) + self.assertEqual(len(receipt['axioms']), 58 + 24 + 27 + 44 + 14) + self.assertEqual(receipt['theorem_count'], 130) + self.assertEqual(receipt['definition_count'], {'abbrev': 6, 'def': 28, 'instance': 3}) + self.assertEqual(receipt['sources'][FIELD_PATH], FIELD_IDENTITY) self.assertEqual(receipt['provenance']['successors'], self.c.SUCCESSORS) self.assertEqual(receipt['provenance']['owner_modules'], self.c.OWNER_MODULES) self.assertEqual(receipt['provenance']['original_bytes'], self.c.ORIGINAL_BYTES) @@ -1442,26 +1717,28 @@ def test_complete_evidence_yields_a_bounded_receipt(self): self.assertEqual(receipt['provenance']['claim'], self.c.CLAIM) self.assertEqual(receipt['provenance']['original_sha256'], self.c.ORIGINAL_SHA256) self.assertEqual(receipt['leanchecker'], {'command': LEANCHECKER_MODULES, 'mode': 'modules'}) - self.assertIn('own declarations against the cached', receipt['scope_note']) + self.assertIn('own declarations and those of the external Specifications.Field', receipt['scope_note']) + self.assertIn('against the cached', receipt['scope_note']) + self.assertEqual(receipt['external_inputs'], self.c.EXTERNAL_INPUTS) self.assertNotIn('--fresh', receipt['scope_note']) for name, digest in receipt['log_sha256'].items(): self.assertEqual(hashlib.sha256((out / name).read_bytes()).hexdigest(), digest, name) self.assertEqual(set(receipt['log_sha256']), {p.name for p in out.iterdir() if p.is_file()} - {'receipt.json'}) self.assertEqual(set(receipt['log_sha256']), set(self.c.EVIDENCE_FILES)) - self.assertEqual(len(receipt['log_sha256']), 65) - self.assertEqual(receipt['census'], {'constants': 153 + len(self.c.metadata()['census_auxiliary']) + len(INTERNAL_GENERATED), - 'user_declarations': 153, + self.assertEqual(len(receipt['log_sha256']), 72) + self.assertEqual(receipt['census'], {'constants': 167 + len(self.c.metadata()['census_auxiliary']) + len(INTERNAL_GENERATED), + 'user_declarations': 167, 'generated_user': sorted(self.c.metadata()['census_auxiliary']), 'internal_generated': len(INTERNAL_GENERATED)}) self.assertIn('census.log', receipt['log_sha256']) self.assertIn('axioms.log', receipt['log_sha256']) for name in ('build-SuperlevelBar', 'build-OrdinaryH0', 'build-OrdinaryH0Controls', 'RejectEssentialDeathBound', 'RejectReducedPointClass', 'RejectMergerKillsPointClass', 'RejectSeparationWithoutNonzeroCoeff', - 'RejectNonmergerKillsDifference'): + 'RejectNonmergerKillsDifference', 'build-spec-Field', 'build-SuperlevelBarField', 'RejectEssentialDeathDetermined'): self.assertIn(name + '.log', receipt['log_sha256']) self.assertIn(name + '.status', receipt['log_sha256']) for name in ('RejectEssentialDeathBound', 'RejectReducedPointClass', 'RejectMergerKillsPointClass', - 'RejectSeparationWithoutNonzeroCoeff', 'RejectNonmergerKillsDifference'): + 'RejectSeparationWithoutNonzeroCoeff', 'RejectNonmergerKillsDifference', 'RejectEssentialDeathDetermined'): self.assertIn(name + '.lean', receipt['log_sha256']) self.assertIn('leanchecker.cmd', receipt['log_sha256']) self.assertIn('Positive.lean', receipt['log_sha256']) @@ -1509,6 +1786,16 @@ def census_without(name): ('build-SuperlevelBar.status', '1\n', 'missing successful process: build-SuperlevelBar'), ('build-OrdinaryH0.status', '', 'missing successful process: build-OrdinaryH0'), ('build-OrdinaryH0Controls.status', '1\n', 'missing successful process: build-OrdinaryH0Controls'), + ('build-spec-Field.status', '1\n', 'missing successful process: build-spec-Field'), + ('build-SuperlevelBarField.status', '', 'missing successful process: build-SuperlevelBarField'), + ('leanchecker.cmd', LEANCHECKER_MODULES_BEFORE_FIELD + '\n', "unrecognized leanchecker invocation: '" + LEANCHECKER_MODULES_BEFORE_FIELD + "'"), + ('RejectEssentialDeathDetermined.log', FIELD_SIBLING_LOG, 'not the intended False-goal diagnostic: RejectEssentialDeathDetermined'), + ('RejectEssentialDeathDetermined.status', '0\n', 'false-statement control must exit exactly one'), + ('RejectEssentialDeathDetermined.lean', (out / 'RejectEssentialDeathDetermined.lean').read_text().replace('_shift 1 1 1)', '_shift 1 1 0)'), + 'emitted Lean file changed across execution: RejectEssentialDeathDetermined.lean'), + ('Census.lean', (out / 'Census.lean').read_text().replace(', `SuperlevelBarField', ''), + 'emitted Lean file changed across execution: Census.lean'), + ('census.log', census_without('TorusFiltration.superlevelBarField_shift'), "inventory targets absent from the census: ['TorusFiltration.superlevelBarField_shift']"), ('leanchecker.cmd', LEANCHECKER_MODULES_BEFORE_C26X + '\n', "unrecognized leanchecker invocation: '" + LEANCHECKER_MODULES_BEFORE_C26X + "'"), ('leanchecker.cmd', LEANCHECKER_MODULES_BEFORE_CONTROLS + '\n', "unrecognized leanchecker invocation: '" + LEANCHECKER_MODULES_BEFORE_CONTROLS + "'"), ('leanchecker.status', '', 'missing successful process: leanchecker'), @@ -1592,7 +1879,7 @@ def census_without(name): self.assertFalse((out / 'receipt.json').exists(), 'receipt written despite refusal') finally: (out / name).write_text(saved) - # C262 G3: every one of the 65 required evidence members is required; removing any one withholds the receipt. + # C262 G3: every one of the 72 required evidence members is required; removing any one withholds the receipt. self.assertEqual({p.name for p in out.iterdir()}, set(self.c.EVIDENCE_FILES)) for name in sorted(self.c.EVIDENCE_FILES): with self.subTest(removed=name):