Compfiles/Imo1974P6.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
8 declarations, 0 contain sorry, 0 declared as axioms
International Mathematical Olympiad 1974, Problem 6
Let $P$ be a non-constant polynomial with integer coefficients. If $n(P)$ is the number of different integers $k$ such that $(P(k))^2 = 1$, prove that $n(P) - \deg(P) \leq 2$.
We formalize $n(P)$ as the cardinality (Set.ncard) of the set of integers
k with P.eval k ^ 2 = 1, and prove the equivalent inequality
n(P) ≤ deg(P) + 2.
Imported by 1 file
- theorem
Imo1974P6.setOf_eval_eq_zeroThe integerskwithQ.eval k = 0are exactly the roots ofQline 36 sourceSource documentation
The integers
kwithQ.eval k = 0are exactly the roots ofQ.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Polynomial,Int,Ne,OfNat.ofNat,Eq,Set,Set.ofPred,Polynomial.eval,Finset,Multiset.toFinset,Polynomial.rootsProof uses:
Set.ext,Eq.mpr,Iff,Membership.mem,Multiset,id,congrArg,Eq.trans,Polynomial.IsRoot,propext,Polynomial.mem_roots,Polynomial.IsRoot.def,Iff.rfl27 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
theorem setOf_eval_eq_zero {Q : Polynomial ℤ} (hQ : Q ≠ 0) : {k : ℤ | Q.eval k = 0} = ↑(Q.roots.toFinset) := by … - theorem
Imo1974P6.finite_eval_eq_zeroA nonzero integer polynomial has only finitely many integer roots line 43 sourceSource documentation
A nonzero integer polynomial has only finitely many integer roots.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Polynomial,Int,Ne,OfNat.ofNat,Set.Finite,Set.ofPred,Eq,Polynomial.evalProof uses:
Eq.mpr,Finset,Multiset.toFinset,Polynomial.roots,id,congrArg,Set, Imo1974P6.setOf_eval_eq_zero,Finset.finite_toSet13 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
theorem finite_eval_eq_zero {Q : Polynomial ℤ} (hQ : Q ≠ 0) : {k : ℤ | Q.eval k = 0}.Finite := by … - theorem
Imo1974P6.ncard_eval_eq_zero_leA nonzero integer polynomial has at mostnatDegreedistinct integer roots line 50 sourceSource documentation
A nonzero integer polynomial has at most
natDegreedistinct integer roots.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Polynomial,Int,Ne,OfNat.ofNat,LE.le,Nat,Set.ncard,Set.ofPred,Eq,Polynomial.eval,Polynomial.natDegreeProof uses:
Eq.mpr,Finset,Multiset.toFinset,Polynomial.roots,id,congrArg,Set, Imo1974P6.setOf_eval_eq_zero,Finset.card,Set.ncard_coe_finset,LE.le.trans,Multiset.card,Multiset.toFinset_card_le,Polynomial.card_roots'16 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
theorem ncard_eval_eq_zero_le {Q : Polynomial ℤ} (hQ : Q ≠ 0) : {k : ℤ | Q.eval k = 0}.ncard ≤ Q.natDegree := by … - theorem
Imo1974P6.setOf_eval_eq_oneP k = 1means thatkis a root ofP - 1line 56 sourceSource documentation
P k = 1means thatkis a root ofP - 1.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Polynomial,Int,Eq,Set,Set.ofPred,Polynomial.eval,OfNat.ofNat,HSub.hSubProof uses:
Set.ext,of_eq_true,Iff,Membership.mem,Eq.trans,True,congrArg,congrFun',funext,Polynomial.eval_sub,Polynomial.eval_one,iff_self26 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
theorem setOf_eval_eq_one (P : Polynomial ℤ) : {k : ℤ | P.eval k = 1} = {k : ℤ | (P - 1).eval k = 0} := by …Mentions: P
- theorem
Imo1974P6.setOf_eval_eq_neg_oneP k = -1means thatkis a root ofP + 1line 62 sourceSource documentation
P k = -1means thatkis a root ofP + 1.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Polynomial,Int,Eq,Set,Set.ofPred,Polynomial.eval,Neg.neg,OfNat.ofNat,HAdd.hAddProof uses:
Set.ext,of_eq_true,Iff,Membership.mem,Eq.trans,True,congrArg,congrFun',funext,Polynomial.eval_add,Polynomial.eval_one,iff_self27 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
theorem setOf_eval_eq_neg_one (P : Polynomial ℤ) : {k : ℤ | P.eval k = -1} = {k : ℤ | (P + 1).eval k = 0} := by …Mentions: P
- theorem
Imo1974P6.sub_dvd_twoKey divisibility: ifP r = 1andP k = -1, thenk - r ∣ 2line 68 sourceSource documentation
Key divisibility: if
P r = 1andP k = -1, thenk - r ∣ 2.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Polynomial,Int,Eq,Polynomial.eval,OfNat.ofNat,Neg.neg,Dvd.dvd,HSub.hSubProof uses:
Polynomial.sub_dvd_eval_sub,Eq.mp,Eq.trans,congrArg,Mathlib.Meta.NormNum.IsInt.neg_to_eq,Mathlib.Meta.NormNum.isInt_sub,Int.negOfNat,Int.ofNat,Eq.refl,Mathlib.Meta.NormNum.isInt_neg,Mathlib.Meta.NormNum.IsNat.to_isInt,Mathlib.Meta.NormNum.isNat_ofNat37 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
theorem sub_dvd_two {P : Polynomial ℤ} {r k : ℤ} (hr : P.eval r = 1) (hk : P.eval k = -1) : k - r ∣ 2 := by …Mentions: P
- theorem
Imo1974P6.ncard_le_of_exists_minMain step: ifris a least integer withP r = ±1andP r = 1, then at mostdeg P + 2integers satisfyP k = ±1line 77 sourceSource documentation
Main step: if
ris a least integer withP r = ±1andP r = 1, then at mostdeg P + 2integers satisfyP k = ±1.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Polynomial,Int,LT.lt,Nat,OfNat.ofNat,Polynomial.natDegree,Or,Eq,Polynomial.eval,Neg.neg,LE.le,Set.ncard,Union.union,Set,Set.ofPred,HAdd.hAddProof uses:
Ne,HSub.hSub,False.elim,False,Nat.lt_irrefl,Eq.mp,congrArg,Polynomial.natDegree_one,propext,sub_eq_zero,Polynomial.natDegree_sub_eq_left_of_natDegree_lt,Eq.mpr,id, Imo1974P6.setOf_eval_eq_one,Eq.symm, Imo1974P6.ncard_eval_eq_zero_le,Insert.insert,Singleton.singleton,Membership.mem,Or.inrand 24 more62 instances, coercions and auxiliary constants left out.
Tactic trace: 31 steps
Open to load the checked before-and-after goal states.
theorem ncard_le_of_exists_min {P : Polynomial ℤ} (hP : 0 < P.natDegree) {r : ℤ} (hmin : ∀ k : ℤ, P.eval k = 1 ∨ P.eval k = -1 → r ≤ k) (hr : P.eval r = 1) : ({k : ℤ | P.eval k = 1} ∪ {k : ℤ | P.eval k = -1}).ncard ≤ P.natDegree + 2 := by …Mentions: P
- problem
Imo1974P6.imo1974_p6line 117 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Polynomial,Int,LT.lt,Nat,OfNat.ofNat,Polynomial.natDegree,LE.le,Set.ncard,Set.ofPred,Eq,HPow.hPow,Polynomial.eval,HAdd.hAddProof uses:
Set,Union.union,Neg.neg,Set.ext,Eq.mpr,Iff,Membership.mem,Or,id,congrArg,sq_eq_one_iff,dite,Set.Nonempty,Classical.propDecidable,Set.Finite,Set.Finite.union,HSub.hSub, Imo1974P6.setOf_eval_eq_one, Imo1974P6.finite_eval_eq_zero,False.elimand 37 more78 instances, coercions and auxiliary constants left out.
Tactic trace: 60 steps
Open to load the checked before-and-after goal states.