# Grid bridge for the 3 × 3 magic square of squares Added `MagicResearch/GridBridge.lean` on the merged Center baseline `c49c47bb49aa031ae7e92ef314e0f0d26da02559`. The file is the exact 1,821-byte Lean block from the bridge report, with SHA-256 `a8ec4c634f7fb9872f363d29a8c3a436439360fa173e7c6f25d1abf5c35721c5`. The second deliverable is this result report. The bridge imports `MagicResearch.Center`, `Mathlib.Algebra.BigOperators.Fin`, and `Mathlib.Algebra.Group.Even`. Its build uses only the baseline Center and the pinned Mathlib import closure. [Bridge report and closure recipe][bridge] · [Merged Center source][center] ## Predicate and proof contracts The pinned upstream statement at `9097e2f90e66d2f6244209cb1c07f7120d17ec53` quantifies first over `m : Fin 3 → Fin 3 → ℕ` and then over `t : ℕ`. Its complete body is the right-associated conjunction of the following conditions, in order. [Pinned upstream statement][upstream] 1. Joint injectivity of the two-argument entry function, `m.Injective2`. 2. Positivity and `IsSquare` for every entry. For naturals, `IsSquare a` gives a natural `r` with `a = r * r`. [Mathlib definition][even] 3. Every row sum `∑ j, m i j` equals `t`. 4. Every column sum `∑ i, m i j` equals `t`. 5. The diagonal through `(0,0), (1,1), (2,2)` sums to `t`, in that order. 6. The diagonal through `(0,2), (1,1), (2,0)` sums to `t`, in that order. All names below are in `MagicResearch`. - `Grid m t` is that entire conjunction. I compared it to the upstream body with whitespace removed and obtained equality. - `Grid.hasMagicSum` takes `h : Grid m t` and returns `HasMagicSum m t`. For each fixed row or column index, `Fin.sum_univ_three` turns the quantified sum into three explicit terms. Specializing these equations at 0, 1 and 2 provides the first six fields of `HasMagicSum`. The diagonal equations are its final two fields. [Pinned Fin import][fin] - `Grid.center_and_opposite_pairs` takes the same hypothesis. Writing `c = m 1 1`, it returns `t = c + c + c` and the four equations giving `c + c` as the sums of `(0,0)/(2,2)`, `(0,1)/(2,1)`, `(0,2)/(2,0)`, and `(1,0)/(1,2)), in that order. The proof applies the existing Center theorem to `h.hasMagicSum`. Its center identity follows by adding the middle column and the diagonals and cancelling the two outer rows. The opposite-pair identities follow by cancelling the center on the corresponding four lines. [Merged Center source][center] - `exists_grid_iff_upstream` equates `(∃ m : Fin 3 → Fin 3 → ℕ, ∃ t : ℕ, Grid m t)` with the literal upstream proposition, including both existential binders. I compared the full right-hand side to upstream with whitespace removed and obtained equality. Lean proves the equivalence with `Iff.rfl` by unfolding `Grid`. This is a conditional result for the order-three problem. Any witness would give four three-term arithmetic progressions of distinct positive squares sharing the middle square. Left to Solve returned HTTP 200 and listed the problem as research open when checked. Bremner studies partial square configurations, and Rome and Yamagishi prove existence for all orders at least four and describe order three as open. [Left to Solve][problem] · [Bremner, *On squares of squares*][bremner] · [Rome and Yamagishi, *On the existence of magic squares of powers*][rome] ## Reproduce preparation and comparison Use Linux x86-64, Python 3, curl, GNU tar and Zstandard. From the checkout root, start with an empty scratch directory. The recipe reads the byte-pinned preparation block from the reviewed report and uses the two hash-checked helpers from its paired input. It fetches individual source files and compiled cache entries in the selected closure. The Mathlib revision is `0df444a360eaa60ab8c11dca51a86af692955474`. The Linux release is Lean 4.33.1, 570,405,234 bytes, SHA-256 `890afd185370f85666025b883914ab4f4b339136f8c96167b69cfb62aecaf235`. [Closure recipe][bridge] · [Paired dependency input][input] · [Lean release archive][release] ```bash checkout="$PWD" mkdir -p test/scratch/grid-reproduce/MagicResearch cd test/scratch/grid-reproduce cp "$checkout"/MagicResearch/{Center,GridBridge}.lean MagicResearch/ report=28eca342e4d3a8a3880f6e8767e93703f2eedb21c99508d495083e3b97d37e28 curl -fsSL "https://api.imd.fun/artifacts/$report" -o closure printf '%s closure\n' "$report" | sha256sum -c - python3 - <<'PY' from pathlib import Path import hashlib, re report = Path('closure').read_text() blocks = re.findall(r'```python\n(.*?)\n```', report, re.S) for path, prefix, digest in [ ('online.py', 'from pathlib import Path', 'd096e5b647075b5217f73689132843baf95894136a522f301669957cd4f04347'), ('no-network.py', 'import ctypes', 'dd69f4622742b1a7e25f7c5526ee03213738198336775a78221ba40fe125bd24'), ]: block = (next(b for b in blocks if b.startswith(prefix)) + '\n').encode() assert hashlib.sha256(block).hexdigest() == digest Path(path).write_bytes(block) PY python3 online.py sha256sum "$checkout"/MagicResearch/{Center,GridBridge}.lean ``` Center's expected SHA-256 is `31c94e62c570660dcd4c466e3f18eb42ebf1541af228fe48831d5bac44c79428`. Preparation checks the Lean release and the 839 archived dependency modules. The expected sorted `archives.tsv` SHA-256 is `0946208ddd39a20ecff44d551ef72bfff36bd5046e2386d6f21a3b93217b9cb5` and the archived dependencies total 68,585,420 bytes. ```bash curl -fsSL https://raw.githubusercontent.com/google-deepmind/formal-conjectures/9097e2f90e66d2f6244209cb1c07f7120d17ec53/FormalConjectures/Wikipedia/MagicSquares.lean -o upstream python3 - <<'PY' from pathlib import Path import re upstream = Path('upstream').read_text() statement = upstream.split('theorem exists_magic_square_squares :', 1)[1].split(':= by', 1)[0] source = Path('MagicResearch/GridBridge.lean').read_text() grid = source.split('def Grid (m : Fin 3 → Fin 3 → ℕ) (t : ℕ) : Prop :=', 1)[1] grid = grid.split('theorem Grid.hasMagicSum', 1)[0] rhs = source.split('↔', 1)[1].split(':= Iff.rfl', 1)[0].strip() def compact(text): return re.sub(r'\s+', '', text) assert compact(grid) == compact(statement.split('∃ t : ℕ,', 1)[1]) assert compact(rhs[1:-1]) == compact(statement) print('Complete Grid predicate and literal existential RHS match pinned upstream modulo whitespace') PY ``` The comparison passed. The fetched upstream file's SHA-256 was `615bd6c0479f6541f147269ead158bdebc63b75be45a24c0000d0e9e81464f14`. ## Offline compilation and kernel replay In the prepared scratch directory, save the following as `offline.sh`. It compiles the source files at their checkout paths. The Linux isolation wrapper uses `libseccomp.so.2` to block network syscalls and verifies that socket creation fails before invoking Bash. ```bash #!/usr/bin/env bash set -euo pipefail checkout=$(cd "${1:?pass the checkout root}" && pwd) export PATH="$PWD/lean-4.33.1-linux/bin:$PATH" mkdir -p replay-build/MagicResearch export LEAN_PATH="$PWD/replay-build:$PWD/compiled/.lake/build/lib/lean" for lib in "$PWD"/compiled/.lake/packages/*/.lake/build/lib/lean; do if [ -d "$lib" ]; then LEAN_PATH="$LEAN_PATH:$lib"; fi done lean --version lean --root="$checkout" -DwarningAsError=true -o replay-build/MagicResearch/Center.olean "$checkout/MagicResearch/Center.lean" lean --root="$checkout" -DwarningAsError=true -o replay-build/MagicResearch/GridBridge.olean "$checkout/MagicResearch/GridBridge.lean" leanchecker --verbose MagicResearch.Center MagicResearch.GridBridge lean -DwarningAsError=true --stdin <<'LEAN' import MagicResearch.GridBridge #print axioms MagicResearch.Grid LEAN ``` ```bash python3 no-network.py bash offline.sh "$checkout" ``` Preparation exited 0 and reported `Preparation, byte checks, sorted receipt: PASS`. I used parallel scratch prefetching of the same individual pinned source files to speed up preparation. The published recipe also fetches them directly. The sorted source receipt (module, byte length and SHA-256 for each source) had 839 entries and 81,807 bytes, with SHA-256 `42463b79a7c633ca21a21893e99d038cfcc03333b7ea7b44b8466d5b0144fe75`, matching the bridge report. The isolated compilation, separate `leanchecker` invocation and imported-definition axiom check all exited 0. A preliminary Center-only offline compile and replay also exited 0. The full run printed the following. ```text Network socket probe: EPERM (seccomp active) Lean (version 4.33.1, x86_64-unknown-linux-gnu, commit 819816b2e0a3bf405af45ae5c7af2491d8f5bee6, Release) 'MagicResearch.Grid.hasMagicSum' depends on axioms: [propext, Classical.choice, Quot.sound] 'MagicResearch.Grid.center_and_opposite_pairs' depends on axioms: [propext, Classical.choice, Quot.sound] 'MagicResearch.exists_grid_iff_upstream' depends on axioms: [propext, Classical.choice, Quot.sound] 'MagicResearch.center_and_opposite_pairs' depends on axioms: [propext, Quot.sound] replaying MagicResearch.GridBridge replaying MagicResearch.Center 'MagicResearch.Grid' depends on axioms: [propext, Classical.choice, Quot.sound] ``` The public bridge results use only the permitted foundations. The submitted source contains no placeholder proofs, added axioms, or `native_decide`. The checkout Git metadata is read-only. Staging the source failed at `.git/index.lock`, so the verified source remains in the worktree. The result report remains untracked for separate upload. [bridge]: https://api.imd.fun/artifacts/28eca342e4d3a8a3880f6e8767e93703f2eedb21c99508d495083e3b97d37e28 [input]: https://api.imd.fun/artifacts/9336882d0ce395294ddffa1cf492ead489457cc9a991d9747a71dc1da4a06758 [center]: https://raw.githubusercontent.com/identity-md-launches/goal-3516-left-solve/c49c47bb49aa031ae7e92ef314e0f0d26da02559/MagicResearch/Center.lean [upstream]: https://github.com/google-deepmind/formal-conjectures/blob/9097e2f90e66d2f6244209cb1c07f7120d17ec53/FormalConjectures/Wikipedia/MagicSquares.lean [fin]: https://github.com/leanprover-community/mathlib4/blob/0df444a360eaa60ab8c11dca51a86af692955474/Mathlib/Algebra/BigOperators/Fin.lean [even]: https://github.com/leanprover-community/mathlib4/blob/0df444a360eaa60ab8c11dca51a86af692955474/Mathlib/Algebra/Group/Even.lean [release]: https://github.com/leanprover/lean4/releases/download/v4.33.1/lean-4.33.1-linux.tar.zst [problem]: https://lefttosolve.com/p/MagicSquares.exists_magic_square_squares [bremner]: https://www.impan.pl/en/publishing-house/journals-and-series/acta-arithmetica/all/88/3/110732/on-squares-of-squares [rome]: https://link.springer.com/article/10.1007/s40993-025-00671-5