MAX5 AND MAX6: COMPACT, LOSSLESS LEAN SOURCE EDITION
3 November 2026

This edition consolidates the source presentation into 32 proof-payload files:
11 entry/interface Lean files, 15 readable chapters, two shared-template files,
two module/case catalogues and two compressed literal/generated-source files.
Together these occupy 39,088,255 bytes, compared with 102,069,914 bytes of
expanded Lean sources. Guides, tools and verification records are additional.

The distinction between source organisation and compilation is deliberate.
Expansion restores all 26,200 original compilation units: 10,143 for MAX5
and 16,057 for MAX6. This edition preserves the verified dependency graph.
It does not claim that the proof has become 32 independently compilable Lean
modules or that the mathematical argument has been shortened by 62 percent.

START READING

  max5/entry/Max5Optimality.lean
    PM2.WStar_eq_six : PM2.WStar = 6
    PM2.width_six_optimal : PM2.IsOptimal 6

  max6/entry/ContinuationMax6Optimality20261029.lean
    PM2.ContinuationMax6Optimality20261029.rational_PM2_MAX6_optimality
      : PM2.IsOptimal6 33

The Definitions.lean file beside each root gives the precise model. The
other entry files expose profile fidelity, transfer and global assembly.
READING_GUIDE.txt gives a route through the mathematical interfaces.
FAMILY_INDEX.txt lists the 287 templates representing 21,579 check modules.

The chapters contain complete source modules separated by labelled records.
Use the module names in the reading guide to search them. A .lean.in file is
preprocessed source, not one large Lean module: its module boundaries and
local scopes must be restored before compilation. Large literal tables and
generated source blocks are compressed separately so that the analytic
chapters remain easier to navigate. No entries or proof cases are dropped.

READ, CHECK AND EXPAND

Python 3.10 or later and its standard library are sufficient for these steps.
Run the commands from this directory.

  python3 tools/compact.py audit

  python3 tools/compact.py show max5 ShapeInvariants

  python3 tools/compact.py show max6 ContinuationFullTransfer

  python3 tools/compact.py expand ../expanded-PM2

The expansion destination must be new or empty. It receives separate max5
and max6 projects, each with its original PM2 source paths and toolchain pin.
Do not merge the two PM2 directories: their model definitions differ.

For an additional comparison against the accepted research workspace:

  python3 tools/compact.py audit --original-workspace "/path/to/Max5 + Max6"

To run the corruption tests:

  python3 tools/test_compact.py

To reproduce the source consolidation from the preceding audited clean edition:

  python3 tools/build_from_clean.py --source ../clean-source-2026-11-03 \
    --output ../reproduced-compact-payloads

This reproduces the source payloads and their manifest. It does not manufacture
kernel-replay receipts; those are records of the actual verification runs.

HOW THE CONSOLIDATION WORKS

Repeated sources are stored once as templates. Only explicitly recorded
decimal strings vary between instances. Leading zeros, signs in the surrounding
source, identifiers, bounds and the order of all cases are preserved exactly.
The catalogue records every instance and the hash of its complete expansion.

Ordinary modules remain verbatim in the chapter records. The two XZ payloads
also contain complete verbatim source records; decompression does not invent
certificate data or select a subset of it. The source decoder checks lengths,
hashes, duplicate modules, missing imports, unused records and full reachability
from the two final roots. It does not execute stored Python or Lean source.

The module catalogues use a shared storage-path table to avoid repeating long
paths. An omitted accepted_source_sha256 means that the expanded source hash
is also the accepted original source hash. Where the preceding clean edition
changed comments, both source hashes and the unchanged noncomment hash are
recorded. Original declaration names and theorem statements remain intact.

VERIFICATION PERFORMED FOR THIS EDITION

1. Every expanded Lean file was compared byte for byte with the audited clean
   source edition. A separate comparison script checked all 26,200 files
   independently of the source decoder.
2. Every accepted original source and compiled project object was rehashed:
   10,143 MAX5 pairs and 16,057 MAX6 pairs matched their accepted records.
3. All 26,316 files in the accepted external dependency snapshot and all eight
   package revisions were revalidated. External packages were not rebuilt.
4. Fresh independent kernel replay passed for both MAX5 final theorems, the
   MAX6 optimum, and its explicit all-real witness and lower-bound projections.
   The driver used trust level zero and doCheck=true, with the original
   4 GiB memory limit and 120-second stage limit. Its axiom allowlist was
   propext, Classical.choice and Quot.sound.
5. Fault-injection tests rejected changed case parameters, injected proof
   text, duplicate or missing modules, a theorem changed to an axiom, and a
   truncated compressed payload.

The accepted MAX6 proof had already passed its complete 16,057-module source
rebuild and final scope/completion audits on 31 October 2026. This edition
does not repeat that rebuild: it preserves the compilation units and their
proof code, revalidates their identities, and freshly replays the final saved
proofs. The new replay does not certify a different or merged module graph.

A hash establishes file identity, not a theorem. The expander is not an added
logical axiom: the restored Lean sources remain subject to the same compiler,
kernel and certificate checks. Any later mathematical edit needs new Lean
verification; changing a manifest hash does not establish a new theorem.

SCOPE

Both results concern rational PM2 directional width, with identities on all
real inputs. Features are all pairwise maxima, including the coordinates.
Allowed directions are differences of two size-two multisets of features.
The feature-linear term is free; counted directions are nonzero and pairwise
nonparallel, with nonzero rational coefficients. The bounds are 6 and 33.

This is not unrestricted ReLU-network optimality. The paper's separate
real-coefficient rationalization argument is not claimed as a Lean theorem
here. The R <= 29 restriction on the short private25 argument and the
source-array/physical-Z distinctions remain in the preserved proof sources.

DEPENDENCIES AND ORIGINALS

The toolchain is leanprover/lean4:v4.32.2. External libraries, build caches,
saved proof-object archives and the full historical build machinery remain
in the research workspace; this source distribution is not a self-contained
reproduction environment. Selected accepted receipts and the current audits
are in verification/. Original paths in those receipts are historical paths.

Neither accepted original source tree nor the preceding clean source edition
was edited. The direct eight-module merge pilot is retained separately in the
working directory; it compiled successfully but is not substituted into these
final proofs. A structural module refactor would be a separate verification
change. This edition makes the source distribution smaller and easier to read
while retaining the already verified small compilation units.
