Skip to content

boyam01/four-distance-rational-study

Repository files navigation

Rational Distances to the Corners of a Unit Square — an Exact Computational Study

tests License: MIT Python SageMath

Open problem (the four-distance problem): does there exist a point in the unit square whose distances to all four corners are rational? This is the "rational distances from the corners of a square" question listed in Guy, Unsolved Problems in Number Theory (Problem D19). It is open to this day.

This repository is a fully reproducible exact-arithmetic search framework for that problem: integer/Fraction arithmetic only, no floating point in any mathematical predicate, every recorded claim backed by a rerunnable command and a pytest suite.

Scope disclaimer: this is computational evidence, not a proof. The recorded finite runs found no true solution and no improvement over the best known near-miss obstruction. Nothing here claims non-existence.

Key Results (recorded finite runs)

  • Whole-slice exclusions (2026-06). Two separate families, 128 slice theorems in total:
    • the flagship slice delta = 289/260 (height 289 — NOT part of the height-20 family below): a Mordell-Weil sieve over the certified rank-1, saturated B-fiber lattice excludes every triple candidate (TRIPLE_EXCLUDED_MODULO_EXACT_SET) — the defect-730 mirror pair admits no completion anywhere on its slice; moreover all three pairwise intersections are certified complete on the t-line (U_B∩U_C = {3/5, -5/3}, U_C∩U_D = {15/26, -26/15}, U_B∩U_D = empty, each in the strengthened equal-defect sense), and defect 730 is provably the only realizable near-miss defect there;
    • all 127 reduced slices delta = a/b with 1 < a/b, max(a, b) <= 20: every one carries a no-true-solution certificate (gate + torsion audit for most; audit-level BD torsion-completeness or rank-1 pair sieves with the universal t = -delta basepoint for the rest).
  • No true four-distance solution in:
    • K2,2 Pythagorean seed search up to N <= 10^6,
    • the delta = 289/260 Mordell-Weil fiber search,
    • a lightweight scan of 10 delta slices.
  • No triple fiber intersection detected anywhere tested: at delta = 289/260, U_B ∩ U_C = {3/5}, U_C ∩ U_D = {15/26}, U_B ∩ U_D = ∅, triple = (a mirror-symmetric near-miss pair, not progress toward a solution).
  • Best live obstruction remains defect = 730 (i.e. the fourth distance squared is 730 times a square), at P = (416/867, 260/289) — and on its own slice this is now provably optimal: the pairwise completeness certificates imply no near-miss with any other defect exists anywhere on delta = 289/260 (reports/defect_730_optimality.md).
  • Theorem-grade constraints: every feasible defect is 2^eps * p_1 ... p_r with all p_i == 1 (mod 4) — only 127 squarefree candidates below 730; no local (mod p^k) obstruction kills the six default delta slices at p <= 23, k <= 3.

Method Overview

The problem reduces to a slope closure system: with slopes A, B, C, D of the four corner-distance triangles,

A*C = B*D = A + B - 1,    S = { a/b in Q : a^2 + b^2 is a perfect square }

and a true solution needs A, B, C, D in S simultaneously. Fixing delta = C + 1/A turns each membership condition into a quartic genus-one fiber W^2 = F(u), analyzed with SageMath (Mordell-Weil ranks, generators, point generation) and bridged back into exact Python verification.

On top of the search core sits an exact filter stack (2026-06), each layer sound and pytest-covered:

Layer Module What it gives
Congruence pre-sieve modular_sieve_verifier.fast_pre_sieve mod-120 rejection of ~85-90% of non-members of S before any big-int work
Analytic rank gate sage_fiber_rank.sage --analytic-rank-gate exact L(E,1)/Omega != 0 certifies Jacobian rank 0 (Gross-Zagier-Kolyvagin), skipping hopeless Mordell-Weil searches
Norm parity theorem norm_parity.py feasible-defect filter from v_p(a^2+b^2) parity in Z[i]
Local certificates local_solubility.py mod p^k insolubility proofs that kill whole delta slices
Special cases special_case_filters.py edge/diagonal/midline candidates annotated theorem-dead

See research/four_distance/RESEARCH_ROADMAP.md for the staged research program (Mordell-Weil sieve certificates, high-genus Chabauty, surface analysis, symbolic elimination, large-scale K2,2 engineering).

Repository Layout

research/four_distance/    main module: searches, fibers, filters, tests, reports
  README.md                full framework documentation
  REPRODUCIBILITY.md       environments, commands, recorded checkpoints
  RESEARCH_ROADMAP.md      research program status
  data/                    CSV outputs of recorded runs
  reports/                 human-readable run reports
  tests/                   pytest suite (91 tests)
research/asg_bcd_formula/  standalone exact B/C/D formula pack

Quick Start

Docker (recommended — full referee verification):

docker build -t four-distance-study .
docker run --rm four-distance-study                          # tests + filters + Sage smoke
docker run --rm four-distance-study ./verify.sh certificates # re-derive headline certificates

Native:

pip install -r requirements.txt
pytest research -q                       # full suite, stdlib-only core

python research/four_distance/fiber_intersection_search.py --delta 289/260
python research/four_distance/delta_scan_lite.py --dry-run --max-deltas 1
python research/four_distance/norm_parity.py --limit 730
python research/four_distance/local_solubility.py --delta 289/260 --prime-limit 23 --k-max 3

Sage-dependent runs (Mordell-Weil fiber search) require SageMath 10.x:

sage research/four_distance/sage_fiber_rank.sage --delta 289/260 --all --max-multiple 100 --combo-bound 20 --strategic-only --sieve-primes 2000
python research/four_distance/sage_fiber_bridge.py --from-sage-csv research/four_distance/data/sage_fiber_points.csv --strategic-only --sieve-primes 2000
# Skip provable rank-0 fibers via the exact L-function gate:
sage research/four_distance/sage_fiber_rank.sage --delta 289/260 --all --analytic-rank-gate --max-multiple 100 --combo-bound 20

With conda-forge Sage, invoke scripts via the environment's python directly (see research/four_distance/REPRODUCIBILITY.md).

Visual Summary

defect histogram

intersection counts

delta scan comparison

Claim ledger and supervision audit

The repository's headline claims are indexed in a machine-readable ledger (research/four_distance/data/claim_ledger.json), each tagged by evidence level (theorem / program certificate / tested-only / heuristic / conjecture) and audited against five engineering-supervision gates by a quick checker:

python research/four_distance/supervision_audit.py

See ENGINEERING_SUPERVISION.md for the methodology and research/four_distance/reports/supervision_audit_report.md for the current standing.

Exactness and Verification Policy

  • Squarehood via math.isqrt on Python int; rationals via fractions.Fraction; no floating point in any mathematical predicate (enforced by source-scanning tests).
  • Modular sieves are rejection-only; every positive claim passes an exact integer check.
  • Necessary-condition gates (McCloskey 3-adic gate, analytic rank gate, local certificates) are labelled as such and never silently drop near-miss data in default modes.
  • The analytic-rank gate was runtime-validated: analytic ranks of the invariant-built Jacobians match independently computed algebraic ranks on all tested fibers (see REPRODUCIBILITY).
  • An adversarial cross-engine review of the filter stack is recorded in research/four_distance/reports/codex_adversarial_review_2026-06-12.md.

ASG/BCD Formula Export

research/asg_bcd_formula exports the exact Fraction/int version of the closure relations used throughout:

A*C = B*D = A+B-1
A = 2u/(1-u^2),  B = A*(delta-1),  C = delta - 1/A,
D = (A*delta-1)/(A*(delta-1)),  P = (1/(A*delta), 1/delta)

Known exported examples: delta=289/260, u=3/5 -> defects (1,1,730); delta=289/260, u=15/26 -> (730,1,1); delta=13/6, u=1/4 -> (1,1,17).

How to Cite

See CITATION.cff (GitHub's "Cite this repository" button). Please cite the repository URL and the commit hash of the run you reference.

References

  • R. K. Guy, Unsolved Problems in Number Theory, 3rd ed., Springer, 2004 — Problem D19 (rational distances from the corners of a square).
  • Module-level documentation in research/four_distance/README.md describes the slope-closure relation, the fixed-delta fiber parametrization, the McCloskey 3-adic gate, and the filter-stack theorems with proofs or proof sketches.

Keywords

rational distance problem · four-distance problem · unit square · Diophantine equations · elliptic curves · Mordell-Weil rank · quartic genus-one fibers · analytic rank / L-functions · congruence sieve · computational number theory · SageMath · exact arithmetic

License

MIT — see LICENSE.

About

Exact-arithmetic computational study of the unit-square four-distance problem (rational distances to all four corners, Guy UPINT D19): K2,2 search, slope closure, Sage Mordell-Weil quartic fibers, and a theorem-grade filter stack.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages