Riemann hypothesis: the Lean proof, cleaned up together
The 2026 Lean proof of the Riemann hypothesis and GRH, machine-checked by others, not refereed, no word from Clay; cleaned up together: more readable, faster to build, the theorems unchanged

| 1 | |
| 2 | # Copied from scripts/lake-cache-get.sh of leanprover-community/riemann-hypothesis (main). |
| 3 | set -euo pipefail |
| 4 | |
| 5 | if [[ "$#" != 1 || "$1" != get ]]; then |
| 6 | echo 'Usage: lake exe cache get' >&2 |
| 7 | exit 2 |
| 8 | fi |
| 9 | |
| 10 | RH_CACHE_ROOT="$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" |
| 11 | cd "$RH_CACHE_ROOT" |
| 12 | |
| 13 | # scripts/ci-cache-get.py needs Python 3.11 for tomllib. Say so before downloading anything. |
| 14 | if ! python3 -c 'import sys; sys.exit(sys.version_info < (3, 11))'; then |
| 15 | RH_CACHE_PYTHON="$(command -v python3 >/dev/null && python3 --version 2>&1 || echo none)" |
| 16 | echo "lake exe cache get needs Python 3.11 or newer as python3; found: $RH_CACHE_PYTHON" >&2 |
| 17 | exit 1 |
| 18 | fi |
| 19 | |
| 20 | # Mathlib's parallel unpacker and our 500 parallel downloads exceed the usual 1024-file soft limit. |
| 21 | # Best effort: macOS may refuse values above kern.maxfilesperproc even when the hard limit is unlimited. |
| 22 | RH_CACHE_FD_HARD="$(ulimit -Hn)" |
| 23 | RH_CACHE_FD_WANT=65536 |
| 24 | if [[ "$RH_CACHE_FD_HARD" != unlimited && "$RH_CACHE_FD_HARD" -lt "$RH_CACHE_FD_WANT" ]]; then |
| 25 | RH_CACHE_FD_WANT="$RH_CACHE_FD_HARD" |
| 26 | fi |
| 27 | if ! ulimit -Sn "$RH_CACHE_FD_WANT" 2>/dev/null; then |
| 28 | RH_CACHE_FD_MAX="$(sysctl -n kern.maxfilesperproc 2>/dev/null || true)" |
| 29 | if ! { [[ -n "$RH_CACHE_FD_MAX" ]] && ulimit -Sn "$RH_CACHE_FD_MAX" 2>/dev/null; }; then |
| 30 | echo "warning: could not raise the open-file limit above $(ulimit -Sn); downloads may fail" >&2 |
| 31 | fi |
| 32 | fi |
| 33 | |
| 34 | # Qualify Mathlib's executable because this package also supplies a cache target. |
| 35 | printf 'Fetching Mathlib cache...\n' |
| 36 | MATHLIB_CACHE_GET_URL="${MATHLIB_CACHE_GET_URL:-https://cache.mathlib.org/mathlib4}" \ |
| 37 | lake exe mathlib/cache get |
| 38 | |
| 39 | # Cache URLs live in lakefile.toml; users need no separate configuration file. |
| 40 | export LAKE_CACHE_DIR="$RH_CACHE_ROOT/.lake/cache" |
| 41 | |
| 42 | # Tau Ceti's oleans come from Tau Ceti's own public cache (service tauceti-public in lakefile.toml). |
| 43 | # tauceti-cache-get.py first checks that Tau Ceti and this project pin the same Mathlib commit. |
| 44 | printf 'Fetching Tau Ceti cache...\n' |
| 45 | python3 scripts/tauceti-cache-get.py |
| 46 | |
| 47 | # ci-cache-get.py registers the map, downloads and checks the artifacts (500 parallel transfers), |
| 48 | # unpacks them with one leantar process, then checks with `lake build --no-build`. |
| 49 | RH_CI_CACHE_STATUS=0 |
| 50 | python3 scripts/ci-cache-get.py || RH_CI_CACHE_STATUS=$? |
| 51 | if [[ "$RH_CI_CACHE_STATUS" == 3 ]]; then |
| 52 | echo 'No validated cache matches these build inputs; use lake build.' >&2 |
| 53 | fi |
| 54 | exit "$RH_CI_CACHE_STATUS" |