Compfiles/Imo2024P2.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
31 declarations, 0 contain sorry, 0 declared as axioms
International Mathematical Olympiad 2024, Problem 2
Determine all pairs (a,b) of positive integers for which there exist positive integers g and N such that
gcd(aⁿ + b, bⁿ + a), n = 1, 2, ...
holds for all integers n ≥ N.
Imports (2)
Imported by 1 file
- def
Imo2024P2.ConditionThe condition of the problem line 44 sourceSource documentation
The condition of the problem.
standard axioms: propext what this means
Statement uses:
NatProof uses:
And,LT.lt,OfNat.ofNat,Exists,LE.le,Eq,Nat.gcd,HAdd.hAdd,HPow.hPow9 instances, coercions and auxiliary constants left out.
def Condition (a b : ℕ) : Prop := …
- lemma
Imo2024P2.dvd_pow_iff_of_dvd_subline 47 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Int,Nat.Coprime,Dvd.dvd,Nat.totient,HSub.hSub,Iff,HAdd.hAdd,HPow.hPow,Eq,ZMod,Units,ZMod.unitOfCoprime,OfNat.ofNatProof uses:
HMul.hMul,Eq.mpr,Neg.neg,id,congrArg,zpow_add,zpow_mul',Eq.symm,propext,ZMod.natCast_eq_zero_iff,of_eq_true,Eq.trans,True,congr,congrFun',Nat.cast_add,Nat.cast_pow,zpow_natCast,Inv.inv,ZMod.pow_totientand 7 more89 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.a_posline 62 sourcestandard axioms: propext what this means
Statement uses:
Nat, Imo2024P2.Condition,LT.lt,OfNat.ofNatProof uses:
And.left,And,Exists,LE.le,Eq,Nat.gcd,HAdd.hAdd,HPow.hPow11 instances, coercions and auxiliary constants left out.
- lemma
Imo2024P2.Condition.b_posline 64 sourcestandard axioms: propext what this means
Statement uses:
Nat, Imo2024P2.Condition,LT.lt,OfNat.ofNatProof uses:
And.left,Exists,And,LE.le,Eq,Nat.gcd,HAdd.hAdd,HPow.hPow,And.right11 instances, coercions and auxiliary constants left out.
- def
Imo2024P2.Condition.gThe value ofgin the problem (determined byaandb) line 67 sourceSource documentation
The value of
gin the problem (determined byaandb).standard axioms: Classical.choice, propext what this means
Statement uses:
Nat, Imo2024P2.ConditionProof uses:
Exists.choose,Exists,And,LT.lt,OfNat.ofNat,LE.le,Eq,Nat.gcd,HAdd.hAdd,HPow.hPow10 instances, coercions and auxiliary constants left out.
noncomputable def g : ℕ := h.2.2.choose
- lemma
Imo2024P2.Condition.g_specline 69 sourcestandard axioms: Classical.choice, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Exists,And,LT.lt,OfNat.ofNat, Imo2024P2.Condition.g,LE.le,Eq,Nat.gcd,HAdd.hAdd,HPow.hPowProof uses:
Exists.choose_spec,And.right18 instances, coercions and auxiliary constants left out.
- def
Imo2024P2.Condition.NThe value ofNin the problem (any sufficiently large value) line 73 sourceSource documentation
The value of
Nin the problem (any sufficiently large value).standard axioms: Classical.choice, propext what this means
Statement uses:
Nat, Imo2024P2.ConditionProof uses:
Exists.choose,And,LT.lt,OfNat.ofNat, Imo2024P2.Condition.g,LE.le,Eq,Nat.gcd,HAdd.hAdd,HPow.hPow, Imo2024P2.Condition.g_spec9 instances, coercions and auxiliary constants left out.
noncomputable def N : ℕ := h.g_spec.choose
- lemma
Imo2024P2.Condition.N_specline 75 sourcestandard axioms: Classical.choice, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,And,LT.lt,OfNat.ofNat, Imo2024P2.Condition.g, Imo2024P2.Condition.N,LE.le,Eq,Nat.gcd,HAdd.hAdd,HPow.hPowProof uses:
Exists.choose_spec, Imo2024P2.Condition.g_spec18 instances, coercions and auxiliary constants left out.
- lemma
Imo2024P2.Condition.g_posline 78 sourcestandard axioms: Classical.choice, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,LT.lt,OfNat.ofNat, Imo2024P2.Condition.gProof uses:
And.left,And, Imo2024P2.Condition.N,LE.le,Eq,Nat.gcd,HAdd.hAdd,HPow.hPow, Imo2024P2.Condition.N_spec11 instances, coercions and auxiliary constants left out.
- lemma
Imo2024P2.Condition.N_posline 80 sourcestandard axioms: Classical.choice, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,LT.lt,OfNat.ofNat, Imo2024P2.Condition.NProof uses:
And.left,LE.le,Eq,Nat.gcd,HAdd.hAdd,HPow.hPow, Imo2024P2.Condition.g,And.right,And, Imo2024P2.Condition.N_spec11 instances, coercions and auxiliary constants left out.
- lemma
Imo2024P2.Condition.gcd_eq_gline 82 sourcestandard axioms: Classical.choice, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,LE.le, Imo2024P2.Condition.N,Eq,Nat.gcd,HAdd.hAdd,HPow.hPow, Imo2024P2.Condition.gProof uses:
And.right,LT.lt,OfNat.ofNat,And, Imo2024P2.Condition.N_spec16 instances, coercions and auxiliary constants left out.
- lemma
Imo2024P2.Condition.symmline 84 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.ConditionProof uses:
And.intro,LT.lt,OfNat.ofNat,And,Exists,LE.le,Eq,Nat.gcd,HAdd.hAdd,HPow.hPow, Imo2024P2.Condition.b_pos, Imo2024P2.Condition.a_pos,Exists.intro, Imo2024P2.Condition.g, Imo2024P2.Condition.N, Imo2024P2.Condition.g_pos, Imo2024P2.Condition.N_pos,Eq.mpr,id,congrArgand 2 more9 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.dvd_g_of_le_N_of_dvdline 89 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,LE.le, Imo2024P2.Condition.N,Dvd.dvd,HAdd.hAdd,HPow.hPow, Imo2024P2.Condition.gProof uses:
Eq.mpr,Nat.gcd,id,Eq,congrArg,Eq.symm, Imo2024P2.Condition.gcd_eq_g,And,propext,Nat.dvd_gcd_iff,And.intro16 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.a_coprime_ab_add_oneline 96 sourcestandard axioms: Quot.sound, propext what this means
Statement uses:
Nat,Nat.Coprime,HAdd.hAdd,HMul.hMul,OfNat.ofNatProof uses:
of_eq_true,Eq.trans,True,Nat.coprime_one_right_eq_true11 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- def
Imo2024P2.Condition.large_nA sufficiently large value of n, congruent to-1modφ (a * b + 1)line 100 sourceSource documentation
A sufficiently large value of n, congruent to
-1modφ (a * b + 1).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.ConditionProof uses:
HSub.hSub,HMul.hMul,HAdd.hAdd,Max.max, Imo2024P2.Condition.N, Imo2024P2.Condition.symm,OfNat.ofNat,Nat.totient8 instances, coercions and auxiliary constants left out.
noncomputable def large_n : ℕ := (max h.N h.symm.N + 1) * φ (a * b + 1) - 1
- lemma
Imo2024P2.Condition.symm_large_nline 102 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Eq, Imo2024P2.Condition.large_n, Imo2024P2.Condition.symmProof uses:
id,HSub,Eq.rec,HSub.hSub,Eq.refl,HMul.hMul,HAdd.hAdd,Max.max, Imo2024P2.Condition.N,OfNat.ofNat,Nat.totient,HMul,Eq.mpr,congrArg,max_comm,mul_comm15 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.N_le_large_nline 108 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,LE.le, Imo2024P2.Condition.N, Imo2024P2.Condition.large_nProof uses:
LT.lt,OfNat.ofNat,Nat.totient,HAdd.hAdd,HMul.hMul,Iff.mpr,Nat.totient_pos,Nat.add_pos_right,zero_lt_one,Eq.mpr,HSub.hSub,Max.max, Imo2024P2.Condition.symm,id,Eq,congrArg,Imo2024P2.Condition.large_n.eq_1,add_mul,one_mul,Nat.add_sub_assocand 13 more42 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.dvd_large_n_sub_neg_oneline 117 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Dvd.dvd,Int,Nat.totient,HAdd.hAdd,HMul.hMul,OfNat.ofNat,HSub.hSub, Imo2024P2.Condition.large_n,Neg.negProof uses:
of_eq_true,Eq.trans,Max.max, Imo2024P2.Condition.N, Imo2024P2.Condition.symm,True,congrArg,congrFun',Nat.cast_pred,LT.lt,LE.le,Or,congr,or_self,Function.swap,Nat.cast_mul,Nat.cast_add,Nat.cast_max,Nat.cast_one,sub_neg_eq_addand 1 more109 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- def
Imo2024P2.Condition.large_n_0A sufficiently large value of n, congruent to0modφ (a * b + 1)line 121 sourceSource documentation
A sufficiently large value of n, congruent to
0modφ (a * b + 1).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.ConditionProof uses:
HMul.hMul,Max.max, Imo2024P2.Condition.N, Imo2024P2.Condition.symm,Nat.totient,HAdd.hAdd,OfNat.ofNat6 instances, coercions and auxiliary constants left out.
noncomputable def large_n_0 : ℕ := (max h.N h.symm.N) * φ (a * b + 1)
- lemma
Imo2024P2.Condition.symm_large_n_0line 123 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Eq, Imo2024P2.Condition.large_n_0, Imo2024P2.Condition.symmProof uses:
id,HMul,Eq.rec,HMul.hMul,Eq.refl,Max.max, Imo2024P2.Condition.N,Eq.mpr,congrArg,max_comm,Nat.totient,HAdd.hAdd,OfNat.ofNat,mul_comm13 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.N_le_large_n_0line 129 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,LE.le, Imo2024P2.Condition.N, Imo2024P2.Condition.large_n_0Proof uses:
LT.lt,OfNat.ofNat,Nat.totient,HAdd.hAdd,HMul.hMul,Iff.mpr,Nat.totient_pos,Nat.add_pos_right,zero_lt_one,Eq.mpr,Max.max, Imo2024P2.Condition.symm,id,Eq,congrArg,Imo2024P2.Condition.large_n_0.eq_1,Nat.le_mul_of_pos_right,LE.le.trans,mul_le_mul',of_eq_trueand 6 more29 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.dvd_large_n_0_sub_zeroline 138 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Dvd.dvd,Int,Nat.totient,HAdd.hAdd,HMul.hMul,OfNat.ofNat,HSub.hSub, Imo2024P2.Condition.large_n_0Proof uses:
of_eq_true,Eq.trans,Max.max, Imo2024P2.Condition.N, Imo2024P2.Condition.symm,True,congrArg,congrFun',Nat.cast_mul,Nat.cast_max,sub_zero43 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.ab_add_one_dvd_a_pow_large_n_add_bline 141 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Dvd.dvd,HAdd.hAdd,HMul.hMul,OfNat.ofNat,HPow.hPow, Imo2024P2.Condition.large_nProof uses:
Eq.mpr,Eq,ZMod,Units,Int,ZMod.unitOfCoprime, Imo2024P2.Condition.a_coprime_ab_add_one,Neg.neg,id,congrArg,propext, Imo2024P2.dvd_pow_iff_of_dvd_sub, Imo2024P2.Condition.dvd_large_n_sub_neg_one,Inv.inv,zpow_neg,zpow_one,mul_add,Eq.trans,Eq.symm,Nat.cast_zeroand 14 more77 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.ab_add_one_dvd_b_pow_large_n_add_aline 154 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Dvd.dvd,HAdd.hAdd,HMul.hMul,OfNat.ofNat,HPow.hPow, Imo2024P2.Condition.large_nProof uses:
Eq.mpr, Imo2024P2.Condition.symm,eq_of_heq,Dvd,Eq,HEq,Eq.refl,HEq.refl,Eq.symm,id,congrArg,mul_comm, Imo2024P2.Condition.symm_large_n, Imo2024P2.Condition.ab_add_one_dvd_a_pow_large_n_add_b27 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.ab_add_one_dvd_gline 159 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Dvd.dvd,HAdd.hAdd,HMul.hMul,OfNat.ofNat, Imo2024P2.Condition.gProof uses: Imo2024P2.Condition.dvd_g_of_le_N_of_dvd, Imo2024P2.Condition.large_n, Imo2024P2.Condition.N_le_large_n, Imo2024P2.Condition.ab_add_one_dvd_a_pow_large_n_add_b, Imo2024P2.Condition.ab_add_one_dvd_b_pow_large_n_add_a
11 instances, coercions and auxiliary constants left out.
- lemma
Imo2024P2.Condition.ab_add_one_dvd_a_pow_large_n_0_add_bline 163 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Dvd.dvd,HAdd.hAdd,HMul.hMul,OfNat.ofNat,HPow.hPow, Imo2024P2.Condition.large_n_0Proof uses:
Dvd.dvd.trans, Imo2024P2.Condition.g, Imo2024P2.Condition.ab_add_one_dvd_g,Eq.mpr,Nat.gcd,id,Eq,congrArg,Eq.symm, Imo2024P2.Condition.gcd_eq_g, Imo2024P2.Condition.N_le_large_n_0,Nat.gcd_dvd_left21 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.ab_add_one_dvd_b_add_oneline 170 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Dvd.dvd,HAdd.hAdd,HMul.hMul,OfNat.ofNatProof uses:
Eq.mpr,id,Eq,congrArg,add_comm,HPow.hPow, Imo2024P2.Condition.large_n_0, Imo2024P2.Condition.ab_add_one_dvd_a_pow_large_n_0_add_b,ZMod,Eq.symm,propext,ZMod.natCast_eq_zero_iff,congrFun',Eq.trans,Nat.cast_add,Nat.cast_one,Eq.mp,Units,Nat.cast_zero,Intand 5 more50 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.a_eq_oneline 179 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Eq,OfNat.ofNatProof uses:
LE.le,HAdd.hAdd,HMul.hMul,Nat.le_of_dvd, Imo2024P2.Condition.ab_add_one_dvd_b_add_one,Eq.mpr,id,congrArg,one_mul,Eq.mp,propext,add_le_add_iff_right,Function.swap,Nat.le_of_mul_le_mul_right, Imo2024P2.Condition.b_pos,LT.lt, Imo2024P2.Condition.a_pos32 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2024P2.Condition.b_eq_oneline 189 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2024P2.Condition,Eq,OfNat.ofNatProof uses: Imo2024P2.Condition.a_eq_one, Imo2024P2.Condition.symm
1 instances, coercions and auxiliary constants left out.
- determine
Imo2024P2.solutionSetline 195 sourcestandard axioms: propext what this means
Statement uses:
Set,Prod,PNatProof uses:
Singleton.singleton,Prod.mk,OfNat.ofNat3 instances, coercions and auxiliary constants left out.
- problem
Imo2024P2.imo2024_p2IMO 2024 Problem 2: eventually constant gcd line 197 sourceL4DEL explanation
The only pair of positive integers (a, b) for which gcd(a^n + b, b^n + a) is eventually constant is (1, 1).
- Problem: determine all pairs of positive integers (a, b) such that gcd(a^n + b, b^n + a) takes one constant value g for all n at least some N. The formal answer is solutionSet = {(1, 1)}, stated as membership in solutionSet iff such g and N exist.
- Solution (complete, no sorry; imported from the Mathlib Archive per the file header): for (1, 1) every term is gcd(2, 2) = 2, so g = 2 and N = 1 work.
- Conversely, the file works modulo ab+1: for exponents congruent to -1 modulo phi(ab+1) the terms vanish modulo ab+1, so ab+1 divides g and all large terms, hence all terms, which forces a = b = 1.
Prerequisites: Imo2024P2.solutionSet
Sources and attribution: Pinned Lean source (47b19bbfe5f3)
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Iff,Membership.mem,Prod,Set, Imo2024P2.solutionSet,Prod.mk,Exists,Nat,LE.le,Eq,Nat.gcd,HAdd.hAdd,HPow.hPowProof uses:
Iff.intro,OfNat.ofNat,And,Eq.mp,Eq.trans,Singleton.singleton,Prod.mk.injEq,Exists.intro,of_eq_true,True,forall_congr,implies_congr,Eq.refl,congrFun',congrArg,congr,one_pow,Nat.gcd_self,eq_self,implies_trueand 12 more33 instances, coercions and auxiliary constants left out.
Tactic trace: 21 steps
Open to load the checked before-and-after goal states.
problem imo2024_p2 (a b : ℕ+) : (a, b) ∈ solutionSet ↔ ∃ g N : ℕ+, ∀ n : ℕ, N ≤ n → Nat.gcd (a^n + b) (b^n + a) = g := by …Mentions: Imo2024P2.solutionSet