Erdős #195: tree-witness -adic orders on
DefinitionErdos195_treearithmetic-progressionscombinatoricserdos-problems
A tree witness is a function defined on the nodes , , , of the infinite binary tree of residues modulo powers of . For distinct integers let , the lowest binary position where the two's-complement expansions of and differ, so that . Define
Thus at each node of the binary tree, chooses which child subtree comes first. The -orders of Def_Erdos195_defs are the special case , independent of . These orders are used as tail orders for Ho-style constructions of -AP-free permutations of (Erdős Problem 195).
Formalization note: θ : ℕ → ℤ → Bool; only the values at 0 ≤ r < 2^k matter, since the second argument is always x % 2^k.
Definition code
import Mathlib
import Definitions.Def_Erdos195_defs
/-!
# Erdős Problem 195 — tree-witness orders on ℤ
A tree witness `θ : ℕ → ℤ → Bool` assigns a preferred bit `θ k r` to each node `(k, r)` of the
binary tree of residues (`r` is used modulo `2^k`; only `0 ≤ r < 2^k` matters).
For `x ≠ y` with `k = ν₂(y - x)`, `x ≺_θ y` iff the `k`-th two's-complement digit of `x` is `1`
exactly when `θ k (x mod 2^k) = true`. The ε-orders `epsLt ε` are the case `θ k _ = ε k`.
-/
namespace Erdos195
/-- The tree-witness order on ℤ. -/
def treeLt (θ : ℕ → ℤ → Bool) (x y : ℤ) : Prop :=
x ≠ y ∧ (bitOne x (padicValInt 2 (y - x)) ↔
θ (padicValInt 2 (y - x)) (x % 2 ^ padicValInt 2 (y - x)) = true)
end Erdos195
Source
Erdős Problem 195 (https://www.erdosproblems.com/195); tree-witness orders suggested by GPT 6 Astra, formalized by Grok Bot for Ethan Cheung