Compfiles/Imo1974P6.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

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.

Imports (3)
Imported by 1 file
  1. theorem Imo1974P6.setOf_eval_eq_zero The integers k with Q.eval k = 0 are exactly the roots of Q line 36 source

    Source documentation

    The integers k with Q.eval k = 0 are exactly the roots of Q.

    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.roots

    Proof uses: Set.ext, Eq.mpr, Iff, Membership.mem, Multiset, id, congrArg, Eq.trans, Polynomial.IsRoot, propext, Polynomial.mem_roots, Polynomial.IsRoot.def, Iff.rfl

    27 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
    …
  2. theorem Imo1974P6.finite_eval_eq_zero A nonzero integer polynomial has only finitely many integer roots line 43 source

    Source 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.eval

    Proof uses: Eq.mpr, Finset, Multiset.toFinset, Polynomial.roots, id, congrArg, Set, Imo1974P6.setOf_eval_eq_zero, Finset.finite_toSet

    13 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
    …
  3. theorem Imo1974P6.ncard_eval_eq_zero_le A nonzero integer polynomial has at most natDegree distinct integer roots line 50 source

    Source documentation

    A nonzero integer polynomial has at most natDegree distinct 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.natDegree

    Proof 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
    …
  4. theorem Imo1974P6.setOf_eval_eq_one P k = 1 means that k is a root of P - 1 line 56 source

    Source documentation

    P k = 1 means that k is a root of P - 1.

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

    Statement uses: Polynomial, Int, Eq, Set, Set.ofPred, Polynomial.eval, OfNat.ofNat, HSub.hSub

    Proof uses: Set.ext, of_eq_true, Iff, Membership.mem, Eq.trans, True, congrArg, congrFun', funext, Polynomial.eval_sub, Polynomial.eval_one, iff_self

    26 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

  5. theorem Imo1974P6.setOf_eval_eq_neg_one P k = -1 means that k is a root of P + 1 line 62 source

    Source documentation

    P k = -1 means that k is a root of P + 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.hAdd

    Proof uses: Set.ext, of_eq_true, Iff, Membership.mem, Eq.trans, True, congrArg, congrFun', funext, Polynomial.eval_add, Polynomial.eval_one, iff_self

    27 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

  6. theorem Imo1974P6.sub_dvd_two Key divisibility: if P r = 1 and P k = -1, then k - r ∣ 2 line 68 source

    Source documentation

    Key divisibility: if P r = 1 and P k = -1, then k - 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.hSub

    Proof 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_ofNat

    37 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

  7. theorem Imo1974P6.ncard_le_of_exists_min Main step: if r is a least integer with P r = ±1 and P r = 1, then at most deg P + 2 integers satisfy P k = ±1 line 77 source

    Source documentation

    Main step: if r is a least integer with P r = ±1 and P r = 1, then at most deg P + 2 integers satisfy P 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.hAdd

    Proof 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.inr and 24 more

    62 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

  8. problem Imo1974P6.imo1974_p6 line 117 source

    standard 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.hAdd

    Proof 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.elim and 37 more

    78 instances, coercions and auxiliary constants left out.

    Tactic trace: 60 steps

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