---
name: weingartner-q1-halving-reproduce
description: Reproduce the numerical check and the Lean proof behind "Halving the even top elements of the Schinzel–Szekeres set answers Weingartner's question on Erdős's lcm problem in the negative".
allowed-tools: Bash(curl *), Bash(python3 *), Bash(pip *), Bash(lake *)
---

# Reproduce the halving construction for Erdős problem #542

## Numerical check (not used in the proof)

Needs Python 3 with numpy (`pip install numpy`).

```bash
B=https://tomo3141592653.github.io/ayumurxiv/src/2612.00001v2/files
curl -LO $B/check.py
python3 check.py 600       # (1-sum_B)*log x = 0.5785, N(x)*log x/x = 0.0533, gain*log x = 0.2737, bad pairs 0
python3 check.py 3000      # 0.5628, 0.0560, 0.2838, bad pairs 0
python3 check.py 1000000   # 0.5594, 0.0588, 0.2850 (about a minute)
```

The expected output is in `$B/check.out`.

## Certified bounds (Section 3)

Needs numpy and python-flint (`pip install numpy python-flint`), about 3 GB of memory and 5–30 minutes per run.

```bash
for f in ay2.py cert.py cert_z.py run_all_cert.sh run_fam_cert.sh; do curl -LO $B/$f; done
python3 cert.py 2e8 10 20                    # G       >= 0.27389401...
python3 cert.py 2e8 0 20 3                   # G23     >= 0.021497396...
python3 cert.py 2e8 0 20 4                   # G'      >= 0.019962259...
python3 cert.py 2e8 -1 20 8                  # G''     >= 0.022870835...
python3 cert_z.py 2e8 3 240 280 20 13/60     # G_F1    >= 0.0081945497...
python3 cert_z.py 2e8 5 280 440 40 31/420    # G_F2    >= 0.0054737902...
```

The expected outputs are `$B/final_*.out`. The constant of Theorem 2 is 0.543804 minus the sum of the six bounds (rounded down to six decimals), 0.191914 < 0.1920.

## Lean proof

Needs elan (the Lean toolchain manager). The project pins Lean v4.34.1 and Mathlib commit d13f23b723b8a846827a245b89c10fc7d3f11612.

```bash
mkdir wq1 && cd wq1
for f in WQ1.lean lakefile.toml lake-manifest.json lean-toolchain; do curl -LO $B/lean/$f; done
lake exe cache get         # downloads the prebuilt Mathlib
lake env lean WQ1.lean     # no output means every theorem checked; the file has no sorry
```

`Sset_lcm`, `Sset_sub`, `Sset_sum` (Lemma 1), `four_mul_mem_E`, `Mset_card`, `Eset_sum_ge` (Lemma 2 and the counting identity) are proved without hypotheses. `main` and `not_question1` take Weingartner's Theorem 2 and Theorem 10 (with the Table 2 values) as hypotheses `hB` and `hA`.
