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

5 declarations, 0 contain sorry, 0 declared as axioms

USA Mathematical Olympiad 2006, Problem 1

Let p be a prime number and let s be an integer with 0 < s < p. Prove that there exist integers m and n with 0 < m < n < p and

{sm/p} < {sn/p} < s/p,

where {x} = x − ⌊x⌋ denotes the fractional part of x, if and only if s is not a divisor of p − 1.

Imports (5)
Imported by 1 file
  1. lemma Usa2006P1.residue_ne_zero If p is prime and 0 < s, k < p, then s * k ≢ 0 (mod p) line 59 source

    Source documentation

    If p is prime and 0 < s, k < p, then s * k ≢ 0 (mod p).

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

    Statement uses: Nat, Nat.Prime, LT.lt, OfNat.ofNat, Ne, HMod.hMod, HMul.hMul

    Proof uses: Eq, Dvd.dvd, Nat.dvd_of_mod_eq_zero, Or, False, Iff.mp, Nat.Prime.dvd_mul, absurd, LE.le, Nat.le_of_dvd, not_le_of_gt

    16 instances, coercions and auxiliary constants left out.

    Tactic trace: 7 steps

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

    lemma residue_ne_zero {p s : ℕ} (hp : p.Prime) (hs0 : 0 < s) (hs1 : s < p)
        {k : ℕ} (hk0 : 0 < k) (hk1 : k < p) : (s * k) % p ≠ 0 := by
    …
  2. def Usa2006P1.g The residue of 1 + k * t modulo p line 68 source

    Source documentation

    The residue of 1 + k * t modulo p.

    no axioms what this means

    Statement uses: Nat

    Proof uses: HMod.hMod, HAdd.hAdd, OfNat.ofNat, HMul.hMul

    7 instances, coercions and auxiliary constants left out.

    def g (p t k : ℕ) : ℕ := (1 + k * t) % p
  3. lemma Usa2006P1.fract_iff_mod The fractional part inequalities are equivalent to inequalities of residues line 71 source

    Source documentation

    The fractional part inequalities are equivalent to inequalities of residues.

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

    Statement uses: Nat, Nat.Prime, Iff, Exists, And, LT.lt, OfNat.ofNat, Rat, Int.fract, HDiv.hDiv, HMul.hMul, HMod.hMod

    Proof uses: cast, Eq.symm, Eq.trans, congrFun', congrArg, Nat.cast_zero, Nat.Prime.pos, Eq.mpr, id, Eq, Nat.cast_mul, Int.fract_div_natCast_eq_div_natCast_mod, propext, div_lt_div_iff_of_pos_right, Nat.cast_lt, Iff.rfl, Iff.intro, Exists.intro, And.intro, Iff.mp and 1 more

    80 instances, coercions and auxiliary constants left out.

    Tactic trace: 12 steps

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

    lemma fract_iff_mod (p s : ℕ) (hp : p.Prime) :
        (∃ m n : ℕ, 0 < m ∧ m < n ∧ n < p ∧
          Int.fract ((s : ℚ) * m / p) < Int.fract ((s : ℚ) * n / p) ∧
          Int.fract ((s : ℚ) * n / p) < (s : ℚ) / p) ↔
        ∃ m n : ℕ, 0 < m ∧ m < n ∧ n < p ∧ (s * m) % p < (s * n) % p ∧ (s * n) % p < s := by
    …
  4. lemma Usa2006P1.mod_iff_not_dvd Core statement: suitable residues exist iff s does not divide p - 1 line 92 source

    Source documentation

    Core statement: suitable residues exist iff s does not divide p - 1.

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

    Statement uses: Nat, Nat.Prime, LT.lt, OfNat.ofNat, Iff, Exists, And, HMod.hMod, HMul.hMul, Not, Dvd.dvd, HSub.hSub

    Proof uses: Nat.Prime.pos, LE.le, Nat.Prime.two_le, NeZero, NeZero.mk, LT.lt.ne', Fact, Fact.mk, Ne, ZMod, Eq, ZMod.val, congrArg, Eq.mp, ZMod.val_zero, Nat.mod_eq_of_lt, ZMod.val_natCast, Neg.neg, Inv.inv, Exists.intro and 106 more

    159 instances, coercions and auxiliary constants left out.

    Tactic trace: 230 steps (first 200 of 230)

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

    lemma mod_iff_not_dvd {p s : ℕ} (hp : p.Prime) (hs0 : 0 < s) (hs1 : s < p) :
        (∃ m n : ℕ, 0 < m ∧ m < n ∧ n < p ∧ (s * m) % p < (s * n) % p ∧ (s * n) % p < s) ↔
        ¬ s ∣ p - 1 := by
    …
  5. problem Usa2006P1.usa2006_p1 line 306 source

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

    Statement uses: Nat, Nat.Prime, LT.lt, OfNat.ofNat, Iff, Exists, And, Rat, Int.fract, HDiv.hDiv, HMul.hMul, Not, Dvd.dvd, HSub.hSub

    Proof uses: Eq.mpr, HMod.hMod, id, Eq, congrArg, propext, Usa2006P1.fract_iff_mod, Usa2006P1.mod_iff_not_dvd

    35 instances, coercions and auxiliary constants left out.

    Tactic trace: 2 steps

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