Documentation

IMOSLLean4.Main.IMO2010.N5

IMO 2010 N5 (P3) #

Find all functions $f : ℕ⁺ → ℕ⁺$ such that $(f(m) + n)(f(n) + m)$ is a square for any positive integers $m$ and $n$.

Answer #

$f(n) = n$ and $f(n) = n + k$ for some $k ∈ ℕ⁺$.

Solution #

We follow the official solution. The implementation is more comfortably done over $ℕ$ (the natural numbers), so we also solve an even more general functional equation as follows: given a natural number $c$, find all functions $f : ℕ → ℕ$ such that $(f(m) + n + c)(f(n) + m + c)$ is a square any $m, n ∈ ℕ$.

def IMOSL.IMO2010N5.good (c : ) (f : ) :

A function f : ℕ → ℕ is called c-good if (f(m) + n + c)(f(n) + m + c) is a square for any m, n : ℕ.

Equations
Instances For
    theorem IMOSL.IMO2010N5.add_right_is_good (c k : ) :
    good c fun (x : ) => x + k

    The function n ↦ n + k is c-good for any c, k : ℕ.

    theorem IMOSL.IMO2010N5.step1_general {p a b : } (hp : Nat.Prime p) (h : ∃ (k : ), a * b = k ^ 2) {n : } (ha : p ^ (2 * n + 1) a) (ha0 : ¬p ^ (2 * n + 2) a) :
    p b

    Step 1: if ab is a square and ν_p(a) = 2n + 1 for some n : ℕ, then p ∣ b.

    theorem IMOSL.IMO2010N5.step1_modeq {p a b : } (hp : Nat.Prime p) (h : ∃ (k : ), a * b = k ^ 2) {n : } (ha : a p ^ (2 * n + 1) [MOD p ^ (2 * n + 2)]) :
    p b

    A version of Step 1 with a ≡ p^{2n + 1} (mod p^{2n + 2}).

    theorem IMOSL.IMO2010N5.step1_pow_one {p a b : } (hp : Nat.Prime p) (h : ∃ (k : ), a * b = k ^ 2) (ha : a p [MOD p ^ 2]) :
    p b

    A version of Step 1 with a ≡ p (mod p^2).

    theorem IMOSL.IMO2010N5.exists_add_modeq {b : } (hb : 0 < b) (a c : ) :
    ∃ (n : ), a + n c [MOD b]

    For any b > 0 and for any a, c : ℕ, there exists n : ℕ such that a + n ≡ c (mod b).

    theorem IMOSL.IMO2010N5.map_modeq_prime_imp_modeq {c : } {f : } {p k l : } (hf : good c f) (hp : Nat.Prime p) (h : f k f l [MOD p]) :
    k l [MOD p]

    If f is c-good and f(k) ≡ f(l) (mod p), then k ≡ l (mod p).

    theorem IMOSL.IMO2010N5.not_modeq_prime_imp₁ {k l : } (h : k l) (h0 : ∀ (p : ), Nat.Prime p¬k l [MOD p]) :
    l = k + 1

    If k ≤ l and k ≢ l (mod p) for every prime p, then l = k + 1.

    theorem IMOSL.IMO2010N5.not_modeq_prime_imp₂ {k l : } (h : ∀ (p : ), Nat.Prime p¬k l [MOD p]) :
    l = k + 1 k = l + 1

    If k ≢ l (mod p) for every prime p, then either l = k + 1 or k = l + 1.

    theorem IMOSL.IMO2010N5.step3 {f : } (hf : ∀ {p k l : }, Nat.Prime pf k f l [MOD p]k l [MOD p]) :
    ∃ (k : ), f = fun (x : ) => x + k

    Let f : ℕ → ℕ be a function such that f(k) ≡ f(l) (mod p) implies k ≡ l (mod p) for any k, l : ℕ and for any prime p. Then f = n ↦ n + k for some k : ℕ.

    theorem IMOSL.IMO2010N5.good_iff {c : } {f : } :
    good c f ∃ (k : ), f = fun (x : ) => x + k

    A function f : ℕ → ℕ is c-good if and only if it is of the form n ↦ n + k for some fixed k : ℕ.

    The ℕ+ version #

    theorem IMOSL.IMO2010N5.PNat_square_iff_Nat_square {m : ℕ+} :
    (∃ (k : ℕ+), m = k ^ 2) ∃ (k : ), m = k ^ 2

    A positive integer is a square over ℕ+ iff it is a square over .

    theorem IMOSL.IMO2010N5.exists_Nat_iff_zero_or_exists_PNat {P : Prop} :
    (∃ (n : ), P n) P 0 ∃ (n : ℕ+), P n

    Given a property P : ℕ → Prop, P(n) holds for some n : ℕ iff either P(0) holds or P(n) holds for some n : ℕ=.

    theorem IMOSL.IMO2010N5.final_solution {f : ℕ+ℕ+} :
    (∀ (m n : ℕ+), ∃ (k : ℕ+), (f m + n) * (f n + m) = k ^ 2) f = id ∃ (k : ℕ+), f = fun (x : ℕ+) => x + k

    Final solution