A density-one approximation to the Erdős–Graham two-set permutation problem Xuyang Peng Run the commands from the directory containing paper.tex. Build the paper with latexmk -pdf paper.tex Lean 4 proofs of Theorems 1.1, 1.2 and 1.3 From a Linux environment with elan, Python 3.10+ and a C++17 compiler, run git clone https://github.com/Galuisss/erdos-197-lean cd erdos-197-lean git checkout 001fbfe085b7558f5b75b0f097b115d982fb0d45 ./build.sh The build uses the pinned Lean toolchain, rebuilds the row certificates, and runs Erdos197Density/FinalAudit.lean. The public theorem statements are in Erdos197Density/Statements.lean. The Python verification programs use Python 3.10+ and its standard library. Appendix A. Phase boundaries python3 anc/verify_phase_grid.py python3 anc/verify_phase_grid.py --rounds 2 --show-phases The default run constructs five rounds with 3, 9, 27, 81 and 243 rays. The first candidate is accepted at every insertion. The second command prints the rational phases for the first two rounds. Appendix B. Threefold and fourfold windows python3 anc/verify_density_bound.py This regenerates the complete single-gap bounds through length 192 and uses short_rows_fair_components.txt for the rows with specified holes. At missing fractions 1/66 and 1/43, the normalized expected pair counts are at most 0.266592 and 0.332288 up to o(1). The cut lower bounds are 259/968 and 99593/299538. The resulting missing counts are at least N/33 on [N,3N] and 3N/43 on [N,4N], for all sufficiently large N. Appendix C. Coupled differences and density bounds python3 anc/verify_joint_density_bound.py This rebuilds the single- and joint-gap price tables, checks the affine bounds and covers on 727 rational cells in each certificate, and integrates exactly, including the 20-level tail of 1/524288. The bounds apply to the profiles of the modulus-averaging lemma. Its cuts and the two integrals give the following strict comparisons. 2/41 0.463062 < 780/1681 alpha <= 39/41 1/18 0.493890 < 13297159/26869104 beta <= 17/18 The verifier also checks both comparisons after adding the finite modulus averaging error 2/(K+1) = 1/2048 at K = 4095 to each rounded upper bound. Regenerating the input tables Both archives include the tables and the Python programs used above. The Hexagon archive supplies the two certificates as JSON. The complete source archive also includes the C++ generators named in Appendices B and C and the C++ prefix check below. The Lean build independently proves the row bounds required for the density theorems. Use GCC or Clang in C++17 mode. Each short-row generator writes 238 rows. The complete-row generator writes the table next to its own script; the commands below run a temporary copy for comparison with the supplied file. tmp=$(mktemp -d) c++ -O3 -std=c++17 anc/verify_prefix_components.cpp -o "$tmp/single" "$tmp/single" --fair > "$tmp/short_single.txt" cmp "$tmp/short_single.txt" anc/short_rows_fair_components.txt c++ -O3 -std=c++17 anc/verify_joint_prefix_rows.cpp -o "$tmp/joint" "$tmp/joint" > "$tmp/short_joint.txt" cmp "$tmp/short_joint.txt" anc/short_rows_joint_doubling.txt cp anc/generate_joint_complete_rows.py "$tmp/" python3 "$tmp/generate_joint_complete_rows.py" cmp "$tmp/complete_rows_joint_doubling.txt" anc/complete_rows_joint_doubling.txt The complete-row calculation retains 131756 prefix words at length 192. Independent checks on small rows python3 anc/verify_complete_rows_small.py For each complete row of length 1 to 16, start with the empty prefix. A position y can be listed next exactly when, for every pair y-d, y+d in the row, both endpoints have been listed or both remain. Count paths to the full row and retain each prefix on such a path. Direct pair counts on each prefix check the single-gap bounds generated by complete_rows and the joint-gap bounds in complete_rows_joint_doubling.txt. The totals over these lengths are 340473 admissible orders and 2086 distinct prefixes. python3 anc/verify_joint_small.py The Python check enumerates every admissible order of each nonempty row of length 2 to 9 with at most four holes. It compares both fair-mark tables with direct counts on 20246 prefixes from 50414 orders of 631 subsets. In the complete source archive, the following additional check tests the comparison constraints on 53697 admissible orders and 23766 distinct prefixes. c++ -O3 -std=c++17 anc/verify_prefix_soundness.cpp -o "$tmp/soundness" "$tmp/soundness"