# Gaussian directions: completed and kernel-replayed Added `MagicResearch/GaussianDirections.lean`. It imports only the merged `MagicResearch.Center`; it needs the standard Lean 4.33.1 release and no Mathlib or other wave module. The only other delivered file is this report. Center, the root import module, manifests, configuration and dependencies are unchanged. This formalizes the Gaussian-coordinate step of the supplied partial-result [research data](https://api.imd.fun/artifacts/bd5dcdeacc72c44c6bc4a19d04a32b6126439c5d5c1d3714f78c8a339e01940b). It does not prove `MagicSquares.exists_magic_square_squares` or a global nonexistence result. The [Left to Solve problem page](https://lefttosolve.com/p/MagicSquares.exists_magic_square_squares) was retrieved successfully with curl on 2026-11-28 and still displayed “Open problem: find a proof”. The [upstream statement](https://raw.githubusercontent.com/google-deepmind/formal-conjectures/main/FormalConjectures/Wikipedia/MagicSquares.lean) also labels the problem `research open`; it is not imported. ## Precise interface All names below are in `MagicResearch.GaussianDirections`. `Gaussian` is the transparent abbreviation `Fin 11 × Fin 11`. `residue a` is the canonical nonnegative remainder `(a % 11).toNat`, with its bound proved; `reduce a b = (residue a, residue b)` accepts arbitrary integers. `mul (x,y) (s,t) = (x*s-y*t, x*t+y*s)` uses modular `Fin 11` operations. `conj (x,y) = (x,-y)` and `norm (x,y) = x*x+y*y`. The reciprocal table is proved correct by `invScalar_spec`; `inv_spec` proves the Gaussian inverse law when the norm is nonzero. `quotient a b` is explicitly `mul (reduce a b) (inv (conj (reduce a b)))`. The zero extension of the reciprocal has no role in the public criterion, which requires the norm hypothesis. For **every** `a b : Int` with `h : ¬ (11 : Int) ∣ a ^ 2 + b ^ 2`: ```lean quotient_eq_iff a b h (g : Gaussian) : quotient a b = g ↔ mul g (reduce a (-b)) = reduce a b quotient_criterion a b h : IsUnitDirection (quotient a b) ↔ (11 : Int) ∣ a * b * (a ^ 2 - b ^ 2) ``` Here `IsUnitDirection g` is exactly the disjunction that `g` is `(1,0)`, `(10,0)`, `(0,1)` or `(0,10)`. Thus it names `1,-1,i,-i` with canonical coordinates. `quotient_eq_iff` proves the quotient exists and is unique through the denominator-cleared equation, for any candidate `g`. `quotient_four_values` supplies all four individual equivalences: | Quotient | Equivalent integer condition | | --- | --- | | `(1,0)` | `11 ∣ b` | | `(10,0)` | `11 ∣ a` | | `(0,1)` | `11 ∣ a-b` | | `(0,10)` | `11 ∣ a+b` | For composition with other modules, `equation_criterion a b g h hg` takes `hg : mul g (reduce a (-b)) = reduce a b` and concludes `IsUnitDirection g ↔ 11 ∣ a*b*(a^2-b^2)`. No particular construction of `g` is required. `exists_unit_equation_iff` gives the same divisibility criterion for existence of any such unit-direction solution. The scalar reduction lemmas `residue_add`, `residue_sub`, `residue_neg`, `residue_mul`, `residue_eq_zero_iff`, `norm_reduce`, and `reduce_conjugate` expose the integer to residue interface. `GaussianUnit` has four constructors `one`, `negOne`, `i`, `negI`. `associate u a b` is respectively `(a,b)`, `(-a,-b)`, `(-b,a)`, `(b,-a)`. `transform u c a b` optionally conjugates first (`c = true`) and then applies the unit. For all four `u` and both booleans `c`: - `transform_norm` proves the integral norm is unchanged. - `associate_polynomial` proves `ab(a²-b²)` is unchanged by any associate; `transform_dvd` proves its divisibility by 11 is also conjugation invariant. - `transform_criterion` characterizes the transformed quotient by the **original** polynomial's divisibility; `transform_invariant` equates passing the transformed and original direction tests. - `transform_equation_criterion` gives the corresponding theorem for any externally supplied solution of the transformed denominator equation. `integral_unit_cases` proves that every pair of integers `u,v` with `u²+v²=1` is one of those four units. `unit_mul_criterion` consequently applies to arbitrary integer unit coordinates: the quotient of `(u*a-v*b, u*b+v*a)` passes iff `11 ∣ a*b*(a²-b²)`. `norm_five_not_dvd`, `norm_five_fails`, and `norm_five_no_unit_equation` apply to **every** integer pair satisfying `a²+b²=5`. They exclude respectively the divisibility condition, a unit quotient, and any unit solution of the equation. The proofs derive `-2 ≤ a,b ≤ 2` from nonnegativity of squares and exhaust the resulting cases, including all signs and both orders. `representation_61_passes` proves `61=5²+6²`, `11 ∤ 61`, and that its quotient is a unit, specifically `(0,10)=-i`. `representation_101_passes` proves the same facts for `101=10²+1²`. Their obstruction polynomials are respectively `-330` and `990`; those of the norm-5 representations are `±6`. ## Proof method and verification outcomes Finite arithmetic is proved with ordinary kernel-checked `decide`: 11 scalar values, 121 Gaussian coordinates, and 14,641 pairs for quotient uniqueness. The integer reduction is proved symbolically with core integer remainder identities and `omega`, so the public theorem is not restricted to sampled integer representatives. Unit invariance uses integer identities and exhaustive cases on the four units; no classification of magic-square grids is assumed. Both compilation commands below used `-DwarningAsError=true` and exited 0. The separate `leanchecker` process replayed both final modules and exited 0: ```text Lean (version 4.33.1, x86_64-unknown-linux-gnu, commit 819816b2e0a3bf405af45ae5c7af2491d8f5bee6, Release) replaying MagicResearch.GaussianDirections replaying MagicResearch.Center ``` The `#print axioms` audit below compiled with warnings as errors and exited 0. It covers **all 31 public theorems**. The exact dependency sets, grouped to avoid repeating the namespace, are: | Axioms | Public theorems | | --- | --- | | `[propext]` | `invScalar_spec`, `inv_spec`, `direction_eq_iff`, `direction_four_values`, `direction_criterion`, `transform_norm` | | `[propext, Quot.sound]` | `residue_eq_zero_iff`, `residue_add`, `residue_neg`, `residue_sub`, `residue_mul`, `reduce_conjugate`, `norm_reduce`, `norm_reduce_ne_zero`, `quotient_eq_iff`, `quotient_four_values`, `quotient_criterion`, `equation_criterion`, `exists_unit_equation_iff`, `associate_polynomial`, `transform_dvd`, `transform_criterion`, `transform_invariant`, `transform_equation_criterion`, `integral_unit_cases`, `unit_mul_criterion`, `norm_five_not_dvd`, `norm_five_fails`, `norm_five_no_unit_equation`, `representation_61_passes`, `representation_101_passes` | No theorem requires `Classical.choice`. There are no added axioms, `sorry`, `admit`, or `native_decide`. A source scan checked those exclusions, the sole import, the coverage and permitted foundations of the axiom log, and the unchanged Center digest; it passed. `git diff --check` exited 0. `leanchecker` rechecks new declarations using Lean's kernel in a separate process over the imported environment. This is kernel replay, not a different proof assistant or a claim that the larger research conjecture has been proved. ## Reproducible preparation Run from the checkout root. Requirements are Linux x86-64, Python 3.11+, curl, GNU tar and Zstandard. All tooling and build files go under disposable `test/scratch/`. Only the hash-pinned standard release is needed; no repository clone, submodule, Mathlib cache, or package-manifest change is required. ```bash set -euo pipefail mkdir -p test/scratch curl -fL --retry 2 \ https://github.com/leanprover/lean4/releases/download/v4.33.1/lean-4.33.1-linux.tar.zst \ -o test/scratch/lean-4.33.1-linux.tar.zst python3 - <<'PY' from pathlib import Path import hashlib p = Path('test/scratch/lean-4.33.1-linux.tar.zst') assert p.stat().st_size == 570405234 with p.open('rb') as f: assert hashlib.file_digest(f, 'sha256').hexdigest() == \ '890afd185370f85666025b883914ab4f4b339136f8c96167b69cfb62aecaf235' print('Lean release size and SHA256: PASS') PY tar --zstd -xf test/scratch/lean-4.33.1-linux.tar.zst -C test/scratch ``` Outcome: download, exact size/digest assertions and extraction all succeeded. The two individual supplied reference artifacts were also retrieved with `curl -fL --retry 2 URL -o test/scratch/references/NAME`. Their measured SHA-256 digests equal their URL identifiers: - Research data: `bd5dcdeacc72c44c6bc4a19d04a32b6126439c5d5c1d3714f78c8a339e01940b`. - [Selected Mathlib closure documentation](https://api.imd.fun/artifacts/28eca342e4d3a8a3880f6e8767e93703f2eedb21c99508d495083e3b97d37e28): `28eca342e4d3a8a3880f6e8767e93703f2eedb21c99508d495083e3b97d37e28`. It was inspected; this core-only module does not need to retrieve its closure. ## Offline compilation, axiom audit and replay After preparation, these commands use only local files. They reproduce the successful compilation, axiom audit and replay used for the delivered source. The root `MagicResearch.lean` intentionally remains unchanged, so import or compile the new module explicitly. ```bash set -euo pipefail export PATH="$PWD/test/scratch/lean-4.33.1-linux/bin:$PATH" export LEAN_PATH="$PWD/test/scratch/build" mkdir -p test/scratch/build/MagicResearch lean --version lean -DwarningAsError=true \ -o test/scratch/build/MagicResearch/Center.olean \ MagicResearch/Center.lean lean -DwarningAsError=true \ -o test/scratch/build/MagicResearch/GaussianDirections.olean \ MagicResearch/GaussianDirections.lean python3 - <<'PY' from pathlib import Path import re source = Path('MagicResearch/GaussianDirections.lean').read_text() names = re.findall(r'^theorem\s+(\w+)', source, re.M) assert len(names) == 31 Path('test/scratch/Axioms.lean').write_text( 'import MagicResearch.GaussianDirections\n\n' + ''.join( '#print axioms MagicResearch.GaussianDirections.' + n + '\n' for n in names)) PY lean -DwarningAsError=true test/scratch/Axioms.lean leanchecker --verbose MagicResearch.Center MagicResearch.GaussianDirections ``` All three Lean invocations and replay exited 0. No network operation is present in this offline sequence. The release archive is verified during preparation; the two source SHA-256 digests for this run are: ```text 31c94e62c570660dcd4c466e3f18eb42ebf1541af228fe48831d5bac44c79428 MagicResearch/Center.lean 404a29f1b9e28b9100eb1294c0d1740ce647376c88b1d8c32e99041e4225827a MagicResearch/GaussianDirections.lean ``` Development issues were repaired before these successful checks. Initial Lean errors at `GaussianDirections.lean:98,105,110` concerned rewriting under negation and a missing automatic decidability instance for universal product quantification. The final proofs use the direct implication and quantify over the four `Fin 11` coordinates. A scratch invariant proof needed an additive normalization and removal of unused simp arguments under warnings-as-errors. The first checker invocation lacked `lean` on PATH; the explicit PATH above repairs that. The web tool could not fetch the artifact/site URLs, but curl retrieved them; the optional `file` utility was unavailable and was unnecessary. There are no remaining proof, compilation, replay or axiom-audit failures.