Compfiles/Imo2023P1.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
17 declarations, 0 contain sorry, 0 declared as axioms
International Mathematical Olympiad 2023, Problem 1
Determine all composite integers n>1 that satisfy the following property: if d₁,d₂,...,dₖ are all the positive divisors of n with 1 = d₁ < d₂ < ... < dₖ = n, then dᵢ divides dᵢ₊₁ + dᵢ₊₂ for every 1 ≤ i ≤ k - 2.
Imports (2)
Imported by 1 file
- abbrev
Imo2023P1.ConsecutiveFactorsline 28 sourceno axioms what this means
Statement uses:
NatProof uses:
And,Dvd.dvd,LT.lt,Not,Exists2 instances, coercions and auxiliary constants left out.
- abbrev
Imo2023P1.Dividableline 31 sourceno axioms what this means
Statement uses:
NatProof uses:
And, Imo2023P1.ConsecutiveFactors,Dvd.dvd,HAdd.hAdd3 instances, coercions and auxiliary constants left out.
- lemma
Imo2023P1.PrimePow_nePowers of distinct primes are never equal line 39 sourceSource documentation
Powers of distinct primes are never equal.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Nat.Prime,Ne,Exists,And,GT.gt,OfNat.ofNat,Eq,HPow.hPowProof uses:
id,False,Finsupp,Nat.factorization,congrArg,Eq.rec,Eq.symm,Ne.symm,LT.lt.ne,Eq.mp,Finsupp.single,Finsupp.single_eq_of_ne,Finsupp.single_eq_same,Nat.Prime.factorization_pow20 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma PrimePow_ne {a b p q : ℕ} (p_prime : p.Prime) (q_prime : q.Prime) (p_ne_q : p ≠ q) (ha : ∃ k > 0, p ^ k = a) (hb : ∃ k > 0, q ^ k = b) : a ≠ b := by … - lemma
Imo2023P1.dvd_ne_zeroIf a number divides some non-zero number, it is also nonzero line 53 sourceSource documentation
If a number divides some non-zero number, it is also nonzero.
standard axioms: propext what this means
Statement uses:
Nat,Ne,OfNat.ofNat,Dvd.dvd,LT.ltProof uses:
Nat.zero_lt_of_ne_zero,Eq,Iff.mp,zero_dvd_iff,Eq.rec11 instances, coercions and auxiliary constants left out.
lemma dvd_ne_zero {a b : ℕ} (hb : b ≠ 0) (h : a ∣ b) : 0 < a := …Mentions: h
- lemma
Imo2023P1.dvd_n_fact_ne_zeroIf a primepdividesn, thenn.factorization p ≠ 0line 57 sourceSource documentation
If a prime
pdividesn, thenn.factorization p ≠ 0.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Ne,OfNat.ofNat,Nat.Prime,Dvd.dvd,Finsupp,Nat.factorizationProof uses:
id,Eq,Or,Not,Iff.mp,Nat.factorization_eq_zero_iff,not_or_intro,not_not_intro12 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
lemma dvd_n_fact_ne_zero {n p : ℕ} (n_ne_0 : n ≠ 0) (p_prime : p.Prime) (p_dvd_n : p ∣ n) : n.factorization p ≠ 0 := by … - lemma
Imo2023P1.mul_cmp_complComplementary factors are inversely ordered line 66 sourceSource documentation
Complementary factors are inversely ordered.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,HMul.hMulProof uses:
Nat.lt_of_mul_lt_mul_left,Eq.rec,Nat.mul_lt_mul_of_pos_right,Eq.symm8 instances, coercions and auxiliary constants left out.
lemma mul_cmp_compl {a b x y : ℕ} (hab : a < b) (hy : 0 < y) (h : a * x = b * y) : y < x := …Mentions: h
- theorem
Imo2023P1.p_succ_fact_zeroGiven primep, the factorization ofp + 1is0atpline 72 sourceSource documentation
Given prime
p, the factorization ofp + 1is0atp.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Nat.Prime,Eq,Finsupp,Nat.factorization,HAdd.hAdd,OfNat.ofNatProof uses:
Nat.factorization_eq_zero_of_not_dvd,Function.comp,Dvd.dvd,False,Nat.Prime.not_dvd_one,Iff.mp,Nat.dvd_add_self_left11 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
theorem p_succ_fact_zero {p : ℕ} (hp : p.Prime) : (p + 1).factorization p = 0 := by … - theorem
Imo2023P1.not_pow_cons_factors_other_primeIfp ^ e < c < p ^ (e + 1), then∃ qprime that dividescline 78 sourceSource documentation
If
p ^ e < c < p ^ (e + 1), then∃ qprime that dividesc.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Nat.Prime,GT.gt,HPow.hPow,LT.lt,HAdd.hAdd,OfNat.ofNat,Exists,And,Ne,Dvd.dvdProof uses:
Classical.byContradiction,Not,Eq,Finsupp,Nat.factorization,Finsupp.single,Exists.intro,Finsupp.ext,dite,Eq.mpr,id,congrArg,Finsupp.single_eq_same,Eq.refl,Finsupp.single_eq_of_ne,Or.elim,em,Decidable.byContradiction,And.intro,Nat.dvd_of_factorization_posand 14 more40 instances, coercions and auxiliary constants left out.
Tactic trace: 19 steps
Open to load the checked before-and-after goal states.
theorem not_pow_cons_factors_other_prime {p e c : ℕ} (hp : p.Prime) (c_gt_e : c > p ^ e) (c_lt_p_e_succ : c < p ^ (e + 1)) : ∃ q ≠ p, q.Prime ∧ q ∣ c := by … - theorem
Imo2023P1.inv_cons_factorsThe inverse factors of consecutive factors ofnare themselves consecutive factors ofnline 110 sourceSource documentation
The inverse factors of consecutive factors of
nare themselves consecutive factors ofn.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,HMul.hMul, Imo2023P1.ConsecutiveFactorsProof uses:
Nat.zero_lt_of_ne_zero,And.right,Ne,Iff.mp,And,Nat.mul_ne_zero_iff,Ne.symm,Eq.rec,LT.lt.ne,Dvd.dvd,Not,Exists, Imo2023P1.mul_cmp_compl,And.intro,Exists.intro,Eq.mp,congrArg,Nat.mul_comm,id,Falseand 1 more12 instances, coercions and auxiliary constants left out.
Tactic trace: 11 steps
Open to load the checked before-and-after goal states.
theorem inv_cons_factors {n a b x y : ℕ} (hn : 0 < n) (ha : n = a * x) (hb : n = b * y) (h : ConsecutiveFactors n a b) : ConsecutiveFactors n y x := by …Mentions: h, Imo2023P1.ConsecutiveFactors
- theorem
Imo2023P1.factorization_primeIfn.factorization p ≠ 0, thenpis prime line 135 sourceSource documentation
If
n.factorization p ≠ 0, thenpis prime.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Ne,Finsupp,Nat.factorization,OfNat.ofNat,Nat.PrimeProof uses:
dite,Not,False.elim,Nat.factorization_eq_zero_of_not_prime11 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
theorem factorization_prime {n p : ℕ} (h : n.factorization p ≠ 0) : p.Prime := by …Mentions: h
- theorem
Imo2023P1.ordCompl_of_non_prime_powIfnis not a prime power, then itsordCompl[p]with respect to anypis> 1line 142 sourceSource documentation
If
nis not a prime power, then itsordCompl[p]with respect to anypis> 1.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Not,IsPrimePow,GT.gt,HDiv.hDiv,HPow.hPow,Finsupp,Nat.factorizationProof uses:
Ne,Nat.ne_zero_of_lt,Decidable.byContradiction,Eq,LE.le,Nat.le_of_not_lt,Ne.symm,LT.lt.ne, Imo2023P1.dvd_ne_zero,Nat.ordCompl_dvd,Or.resolve_left,Iff.mp,Or,Nat.le_one_iff_eq_zero_or_eq_one,id,Eq.mpr,congrArg,Nat.factorization_one,Eq.refl,Nat.Primeand 30 more49 instances, coercions and auxiliary constants left out.
Tactic trace: 25 steps
Open to load the checked before-and-after goal states.
theorem ordCompl_of_non_prime_pow {n p : ℕ} (hn : 1 < n) (hp : ¬IsPrimePow n) : ordCompl[p] n > 1 := by … - theorem
Imo2023P1.minFac_cons_factorIfnis not a prime power, andpis its minimum factor, then the second smallest prime factorqis consecutive topto some power> 0line 196 sourceSource documentation
If
nis not a prime power, andpis its minimum factor, then the second smallest prime factorqis consecutive topto some power> 0.This theorem is key to solving the
Dividable → PrimePowerdirection of the problem.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Not,IsPrimePow,Exists,And,Nat.Prime,Ne,Nat.minFac, Imo2023P1.ConsecutiveFactors,HPow.hPow,HAdd.hAddProof uses:
Nat.ne_zero_of_lt,Nat.minFac_prime,Ne.symm,Nat.ne_of_lt,HDiv.hDiv,Finsupp,Nat.factorization,Eq,Finsupp.erase,congrArg,Nat.factorization_ordCompl,Dvd.dvd,Nat.ordCompl_dvd, Imo2023P1.ordCompl_of_non_prime_pow,Eq.mpr,id,Eq.symm,Eq.mp,Finsupp.erase_ne,Decidable.byContradictionand 76 more43 instances, coercions and auxiliary constants left out.
Tactic trace: 92 steps
Open to load the checked before-and-after goal states.
theorem minFac_cons_factor {n : ℕ} (hn : 1 < n) (h : ¬IsPrimePow n) : ∃ q e, q.Prime ∧ q ≠ n.minFac ∧ ConsecutiveFactors n (n.minFac ^ e) (n.minFac ^ (e + 1)) ∧ ConsecutiveFactors n (n.minFac ^ (e + 1)) q := by …Mentions: h, Imo2023P1.ConsecutiveFactors
- lemma
Imo2023P1.PrimePow_cons_are_p_apartThe consecutive factors of prime powers ofpare a factorpapart line 342 sourceSource documentation
The consecutive factors of prime powers of
pare a factorpapart.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Nat.Prime,Exists,And,LT.lt,OfNat.ofNat,Eq,HPow.hPow, Imo2023P1.ConsecutiveFactors,HMul.hMulProof uses:
Dvd.dvd,Not,LE.le,Iff.mp,Nat.dvd_prime_pow,Eq.rec,Eq.symm,Nat.pow_lt_pow_iff_right,Nat.Prime.one_lt,Eq.mpr,id,congrArg,HAdd.hAdd,Decidable.byContradiction,Nat.succ,Nat.lt_of_le_of_ne,Exists.intro,And.intro,Nat.exists_eq_add_of_lt,add_assocand 7 more37 instances, coercions and auxiliary constants left out.
Tactic trace: 20 steps
Open to load the checked before-and-after goal states.
lemma PrimePow_cons_are_p_apart {x y p n : ℕ} (p_prime : p.Prime) (hn : ∃ k, 0 < k ∧ p ^ k = n) (h : ConsecutiveFactors n x y) : x * p = y := by …Mentions: h, Imo2023P1.ConsecutiveFactors
- lemma
Imo2023P1.PrimePow_is_dividableProof that all prime powers areDividableline 378 sourceSource documentation
Proof that all prime powers are
Dividable.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,IsPrimePow,And,LT.lt,OfNat.ofNat, Imo2023P1.DividableProof uses:
And.intro,IsPrimePow.one_lt,Exists,Prime,Eq,HPow.hPow, Imo2023P1.ConsecutiveFactors,Dvd.dvd,HAdd.hAdd,HMul.hMul, Imo2023P1.PrimePow_cons_are_p_apart,Prime.nat_prime,Exists.intro,Eq.mpr,id,congrArg,Eq.symm,Mathlib.Tactic.Linarith.eq_of_not_lt_of_not_gt,Not.intro,Mathlib.Tactic.Linarith.lt_irrefland 68 more80 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
lemma PrimePow_is_dividable {n : ℕ} : IsPrimePow n → 1 < n ∧ Dividable n := by …Mentions: Imo2023P1.Dividable
- lemma
Imo2023P1.dividable_is_PrimePowProof that allDividablenumbers> 1are prime powers line 391 sourceSource documentation
Proof that all
Dividablenumbers> 1are prime powers.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,And,LT.lt,OfNat.ofNat, Imo2023P1.Dividable,IsPrimePowProof uses:
Nat.minFac,Nat.Prime,Nat.minFac_prime,Ne.symm,Nat.ne_of_lt,Decidable.byContradiction,Not,Exists,Ne, Imo2023P1.ConsecutiveFactors,HPow.hPow,HAdd.hAdd,False, Imo2023P1.minFac_cons_factor,Dvd.dvd,Eq,HMul.hMul,Nat.zero_lt_of_lt,And.intro, Imo2023P1.inv_cons_factors and 37 more68 instances, coercions and auxiliary constants left out.
Tactic trace: 36 steps
Open to load the checked before-and-after goal states.
lemma dividable_is_PrimePow {n : ℕ} (h : 1 < n ∧ Dividable n) : IsPrimePow n := by …Mentions: h, Imo2023P1.Dividable
- determine
Imo2023P1.solution_setline 447 sourcestandard axioms: propext what this means
Statement uses:
Set,NatProof uses:
Set.ofPred,And,Not,Nat.Prime,IsPrimePow1 instances, coercions and auxiliary constants left out.
- problem
Imo2023P1.imo2023_p1line 449 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Eq,Set,Nat, Imo2023P1.solution_set,Set.ofPred,And,LT.lt,OfNat.ofNat,Not,Nat.Prime, Imo2023P1.DividableProof uses:
Set.ext,Iff.intro,Membership.mem,IsPrimePow, Imo2023P1.PrimePow_is_dividable,And.intro, Imo2023P1.dividable_is_PrimePow9 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.