import Mathlib.Data.Int.Basic /-! # Bonza functions (work in progress) A function `f : ℕ → ℕ` (on positive integers) is **bonza** if for all positive integers `a,b` we have `f(a) ∣ b^a - f(b)^{f(a)}`. Because the difference can be negative, we formalize divisibility in `ℤ`. This file provides: * the definition `Bonza` * an explicit example `g` with `g 4 = 16` * a skeleton statement of the universal linear bound `f n ≤ 4n` The number-theoretic core is not yet fully formalized; missing parts are marked with `sorry`. -/ /-- The bonza property (using `ℤ`-divisibility to avoid issues with subtraction in `ℕ`). -/ def Bonza (f : ℕ → ℕ) : Prop := (∀ a b : ℕ, 0 < a → 0 < b → (f a : ℤ) ∣ (b : ℤ)^a - (f b : ℤ)^(f a)) ∧ (∀ n : ℕ, 0 < n → 0 < f n) namespace Bonza variable {f : ℕ → ℕ} lemma pos (hf : Bonza f) {n : ℕ} (hn : 0 < n) : 0 < f n := (hf.2 _ hn) /-- `f 1 = 1` for any bonza function. -/ lemma f_one (hf : Bonza f) : f 1 = 1 := by sorry /-- For bonza functions, `f a ∣ a^a`. -/ lemma f_dvd_self_pow (hf : Bonza f) (a : ℕ) (ha : 0 < a) : f a ∣ a^a := by sorry end Bonza /-! ## An explicit extremal example Define * `g 1 = 1` * `g 2 = 4` * `g 4 = 16` * `g n = 1` if `n` is odd * `g n = 2` otherwise. This function satisfies `Bonza g`, and achieves `g 4 = 16 = 4 * 4`. -/ def g (n : ℕ) : ℕ := if n = 1 then 1 else if n = 2 then 4 else if n = 4 then 16 else if n % 2 = 1 then 1 else 2 lemma g_pos (n : ℕ) (hn : 0 < n) : 0 < g n := by unfold g by_cases h1 : n = 1 · simp [h1] by_cases h2 : n = 2 · simp [h1, h2] by_cases h4 : n = 4 · simp [h1, h2, h4] by_cases ho : n % 2 = 1 · simp [h1, h2, h4, ho] · simp [h1, h2, h4, ho] /-- `g` is bonza (proof by casework on the finite set of possible values of `g a`). -/ lemma bonza_g : Bonza g := by refine ⟨?_, ?_⟩ · intro a b ha hb sorry · intro n hn exact g_pos n hn lemma g_four : g 4 = 16 := by simp [g] /-! ## Target bound skeleton The intended final theorem is: `∀ f, Bonza f → ∀ n > 0, f n ≤ 4*n`. Together with `g 4 = 16`, this implies the optimal constant is `4`. -/ theorem bonza_linear_bound_skeleton (f : ℕ → ℕ) (hf : Bonza f) : ∀ n : ℕ, 0 < n → f n ≤ 4*n := by intro n hn sorry