Compfiles/UK2024R1P4.lean
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
- determine
UK2024R1P4.SolutionSetline 28 sourceno axioms what this means
Statement uses:
Set,NatProof uses:
Insert.insert,OfNat.ofNat,Singleton.singleton3 instances, coercions and auxiliary constants left out.
- lemma
UK2024R1P4.two_pow_sub_two_gtFor n ≥ 5, n + 1 < 2^(n-2) line 33 sourceSource 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.hSubProof uses:
Nat.le_induction,of_decide_eq_true,id,Eq,Bool,Decidable.decide,Bool.true,Eq.refl,Eq.mpr,congrArg,HMul.hMul,pow_succ29 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 …
- lemma
UK2024R1P4.sq_boundKey inequality (*): if n·2ⁿ + 1 is a perfect square and n ≥ 2, then 2^(n-1) ≤ 2n + 2 line 48 sourceSource 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.hSubProof 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_eqand 101 more151 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
- lemma
UK2024R1P4.not_square_ge_fiveFor n ≥ 5, n·2ⁿ + 1 is not a perfect square: the bound (*) combined withtwo_pow_sub_two_gtis immediately contradictory line 98 sourceSource documentation
For n ≥ 5, n·2ⁿ + 1 is not a perfect square: the bound (*) combined with
two_pow_sub_two_gtis 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.hPowProof uses:
HSub.hSub, UK2024R1P4.sq_bound,LT.lt, UK2024R1P4.two_pow_sub_two_gt,Eq,Eq.mpr,id,congrArg27 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 …
- problem
UK2024R1P4.uk2024_r1_p4line 108 sourcestandard 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.hPowProof 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.mpand 15 more38 instances, coercions and auxiliary constants left out.
Tactic trace: 19 steps
Open to load the checked before-and-after goal states.