Compfiles/UK2024R1P4.lean

GitHub source file

Explanation legend Lean4 Domain Explanation Language (L4DEL)

L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.

L4DEL
Lean4 Domain Explanation Language

Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.

Project sources: Pinned compfiles documentation, Pinned compfiles corpus index

5 declarations, 0 contain sorry, 0 declared as axioms

British Mathematical Olympiad 2024, Round 1, Problem 4

Find all positive integers n such that n × 2ⁿ + 1 is a square.

The answer is n = 2 and n = 3.

We follow the presentation by the problem author in https://eventuallyalmosteverywhere.wordpress.com/2024/01/10/finitely-many-solutions/, with modifications.

Imports (2)
Imported by 1 file
  1. determine UK2024R1P4.SolutionSet line 28 source

    no axioms what this means

    Statement uses: Set, Nat

    Proof uses: Insert.insert, OfNat.ofNat, Singleton.singleton

    3 instances, coercions and auxiliary constants left out.

  2. lemma UK2024R1P4.two_pow_sub_two_gt For n ≥ 5, n + 1 < 2^(n-2) line 33 source

    Source documentation

    For n ≥ 5, n + 1 < 2^(n-2).

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LE.le, OfNat.ofNat, LT.lt, HAdd.hAdd, HPow.hPow, HSub.hSub

    Proof uses: Nat.le_induction, of_decide_eq_true, id, Eq, Bool, Decidable.decide, Bool.true, Eq.refl, Eq.mpr, congrArg, HMul.hMul, pow_succ

    29 instances, coercions and auxiliary constants left out.

    Tactic trace: 6 steps

    Open to load the checked before-and-after goal states.

    lemma two_pow_sub_two_gt (n : ℕ) (hn : 5 ≤ n) : n + 1 < 2 ^ (n - 2) := by
    …
  3. lemma UK2024R1P4.sq_bound Key inequality (*): if n·2ⁿ + 1 is a perfect square and n ≥ 2, then 2^(n-1) ≤ 2n + 2 line 48 source

    Source documentation

    Key inequality (*): if n·2ⁿ + 1 is a perfect square and n ≥ 2, then 2^(n-1) ≤ 2n + 2.

    Strategy: factor n·2ⁿ = (k-1)(k+1). Since n·2ⁿ is even, k² = n·2ⁿ+1 is odd, so k is odd — write k = 2a+1. Then (k-1)(k+1) = 4a(a+1), so a(a+1) = n·2^(n-2). The integers a and a+1 are coprime with exactly one even, so the full factor 2^(n-2) lands on that even one.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LE.le, OfNat.ofNat, IsSquare, HAdd.hAdd, HMul.hMul, HPow.hPow, HSub.hSub

    Proof uses: Eq, Eq.symm, Odd, Even, Even.mul_left, Even.pow_of_ne_zero, even_two_mul, Eq.mpr, id, congrArg, Even.add_one, Nat.Odd.of_mul_left, Mathlib.Tactic.Linarith.eq_of_not_lt_of_not_gt, Not.intro, LT.lt, Mathlib.Tactic.Linarith.lt_irrefl, Int, Eq.mp, Neg.neg, Mathlib.Tactic.Ring.of_eq and 101 more

    151 instances, coercions and auxiliary constants left out.

    Tactic trace: 54 steps

    Open to load the checked before-and-after goal states.

    lemma sq_bound (n : ℕ) (hn : 2 ≤ n) (h : IsSquare (n * 2 ^ n + 1)) :
        2 ^ (n - 1) ≤ 2 * n + 2 := by
    …

    Mentions: h

  4. lemma UK2024R1P4.not_square_ge_five For n ≥ 5, n·2ⁿ + 1 is not a perfect square: the bound (*) combined with two_pow_sub_two_gt is immediately contradictory line 98 source

    Source documentation

    For n ≥ 5, n·2ⁿ + 1 is not a perfect square: the bound (*) combined with two_pow_sub_two_gt is immediately contradictory.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LE.le, OfNat.ofNat, Not, IsSquare, HAdd.hAdd, HMul.hMul, HPow.hPow

    Proof uses: HSub.hSub, UK2024R1P4.sq_bound, LT.lt, UK2024R1P4.two_pow_sub_two_gt, Eq, Eq.mpr, id, congrArg

    27 instances, coercions and auxiliary constants left out.

    Tactic trace: 9 steps

    Open to load the checked before-and-after goal states.

    lemma not_square_ge_five (n : ℕ) (hn : 5 ≤ n) : ¬ IsSquare (n * 2 ^ n + 1) := by
    …
  5. problem UK2024R1P4.uk2024_r1_p4 line 108 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LT.lt, OfNat.ofNat, Iff, Membership.mem, Set, UK2024R1P4.SolutionSet, IsSquare, HAdd.hAdd, HMul.hMul, HPow.hPow

    Proof uses: Iff.intro, Eq, Singleton.singleton, Mathlib.Meta.NormNum.isSquare_nat_of_isNat, Mathlib.Meta.NormNum.isNat_add, Eq.refl, Mathlib.Meta.NormNum.isNat_mul, Mathlib.Meta.NormNum.isNat_ofNat, Mathlib.Meta.NormNum.isNat_pow, Mathlib.Meta.NormNum.IsNatPowT.run, Mathlib.Meta.NormNum.IsNatPowT.bit0, Eq.symm, Mathlib.Meta.NormNum.IsNatPowT.bit1, dite, LE.le, absurd, UK2024R1P4.not_square_ge_five, Not, False.elim, Eq.mp and 15 more

    38 instances, coercions and auxiliary constants left out.

    Tactic trace: 19 steps

    Open to load the checked before-and-after goal states.