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

12 declarations, 0 contain sorry, 0 declared as axioms

International Mathematical Olympiad 1986, Problem 3

To each vertex of a regular pentagon, an integer is assigned, in such a way that the sum of all five numbers is positive. If three consecutive vertices are assigned the numbers $x, y, z$ respectively and $y < 0$, then the following operation is allowed: $x, y, z$ are replaced by $x+y, -y, z+y$ respectively. Such an operation is performed repeatedly as long as at least one of the five numbers is negative. Determine whether this procedure necessarily comes to an end after a finite number of steps.

Imports (3)
Imported by 1 file
  1. def Imo1986P3.State State of the pentagon: an integer assigned to each vertex line 34 source

    Source documentation

    State of the pentagon: an integer assigned to each vertex.

    no axioms what this means

    Proof uses: Fin, OfNat.ofNat, Nat, Int

    1 instances, coercions and auxiliary constants left out.

    def State := Fin 5 → ℤ
  2. def Imo1986P3.State.sum The sum of all integers on the pentagon line 37 source

    Source documentation

    The sum of all integers on the pentagon.

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

    Statement uses: Imo1986P3.State, Int

    Proof uses: Finset.sum, Fin, OfNat.ofNat, Nat, Finset.univ

    3 instances, coercions and auxiliary constants left out.

    def State.sum (s : State) : ℤ := ∑ i : Fin 5, s i

    Mentions: Imo1986P3.State

  3. def Imo1986P3.move The operation performed at vertex i when s i < 0 line 40 source

    Source documentation

    The operation performed at vertex i when s i < 0.

    standard axioms: propext what this means

    Statement uses: Imo1986P3.State, Fin, OfNat.ofNat, Nat

    Proof uses: ite, Int, Eq, Bool, BEq.beq, HSub.hSub, Bool.true, HAdd.hAdd, Neg.neg

    13 instances, coercions and auxiliary constants left out.

    def move (s : State) (i : Fin 5) : State :=
    …

    Mentions: Imo1986P3.State

  4. def Imo1986P3.Step The transition relation Step next current asserts that next is obtained from current by applying the move operation at some vertex i where s i < 0 line 52 source

    Source documentation

    The transition relation Step next current asserts that next is obtained from current by applying the move operation at some vertex i where s i < 0. The order of arguments (next current) is chosen to match the convention of Acc.

    standard axioms: propext what this means

    Statement uses: Imo1986P3.State

    Proof uses: Exists, Fin, OfNat.ofNat, Nat, And, LT.lt, Int, Eq, Imo1986P3.move

    3 instances, coercions and auxiliary constants left out.

    def Step (next current : State) : Prop :=
    …

    Mentions: Imo1986P3.State

  5. def Imo1986P3.potential The potential function $V(s) = \sum (s_i - s_{i+2})^2$ line 69 source

    Source documentation

    The potential function $V(s) = \sum (s_i - s_{i+2})^2$.

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

    Statement uses: Imo1986P3.State, Int

    Proof uses: Finset.sum, Fin, OfNat.ofNat, Nat, Finset.univ, HPow.hPow, HSub.hSub, HAdd.hAdd

    13 instances, coercions and auxiliary constants left out.

    def potential (s : State) : ℤ :=
    …

    Mentions: Imo1986P3.State

  6. lemma Imo1986P3.sum_invariant The sum of the integers is invariant under the move operation line 73 source

    Source documentation

    The sum of the integers is invariant under the move operation.

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

    Statement uses: Imo1986P3.State, Fin, OfNat.ofNat, Nat, Eq, Int, Imo1986P3.State.sum, Imo1986P3.move

    Proof uses: id, Eq.mpr, Finset.sum, Finset.univ, HAdd.hAdd, congrArg, Fin.sum_univ_five, List, List.Mem, List.finRange, HEq, Membership.mem, Finset, Fintype.elems, Fintype.complete, List.cons, List.Mem.head, Fin.mk, Nat.le_of_lt, Nat.le_refl and 29 more

    59 instances, coercions and auxiliary constants left out.

    Tactic trace: 10 steps

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

    lemma sum_invariant (s : State) (i : Fin 5) : (move s i).sum = s.sum := by
    …

    Mentions: Imo1986P3.State, Imo1986P3.move

  7. lemma Imo1986P3.potential_diff The change in potential after a move operation line 85 source

    Source documentation

    The change in potential after a move operation. $V(s') - V(s) = 2 \cdot s_i \cdot S$ where $S$ is the total sum.

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

    Statement uses: Imo1986P3.State, Fin, OfNat.ofNat, Nat, Eq, Int, HSub.hSub, Imo1986P3.potential, Imo1986P3.move, HMul.hMul, Imo1986P3.State.sum

    Proof uses: id, Eq.mpr, Finset.sum, Finset.univ, HPow.hPow, HAdd.hAdd, congrArg, Fin.sum_univ_five, List, List.Mem, List.finRange, HEq, Membership.mem, Finset, Fintype.elems, Fintype.complete, List.cons, List.Mem.head, Fin.mk, Nat.le_of_lt and 85 more

    77 instances, coercions and auxiliary constants left out.

    Tactic trace: 10 steps

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

    lemma potential_diff (s : State) (i : Fin 5) :
        potential (move s i) - potential s = 2 * (s i) * s.sum := by
    …

    Mentions: Imo1986P3.State, Imo1986P3.potential, Imo1986P3.move

  8. lemma Imo1986P3.potential_decreasing If $s_i < 0$ and the total sum is positive, the potential strictly decreases line 99 source

    Source documentation

    If $s_i < 0$ and the total sum is positive, the potential strictly decreases.

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

    Statement uses: Imo1986P3.State, Fin, OfNat.ofNat, Nat, LT.lt, Int, Imo1986P3.State.sum, Imo1986P3.potential, Imo1986P3.move

    Proof uses: Eq, HSub.hSub, HMul.hMul, Imo1986P3.potential_diff, lt_of_not_ge, LE.le, Mathlib.Tactic.Linarith.lt_irrefl, Eq.mp, HAdd.hAdd, Neg.neg, congrArg, Mathlib.Tactic.Ring.of_eq, Mathlib.Tactic.Ring.Common.add_congr, Nat.rawCast, HPow.hPow, Int.rawCast, inferInstance, Ring, Int.negOfNat, Mathlib.Meta.NormNum.instAddMonoidWithOne and 54 more

    86 instances, coercions and auxiliary constants left out.

    Tactic trace: 4 steps

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

    lemma potential_decreasing (s : State) (i : Fin 5) (h_neg : s i < 0) (h_sum_pos : 0 < s.sum) :
        potential (move s i) < potential s := by
    …

    Mentions: Imo1986P3.State, Imo1986P3.potential, Imo1986P3.move

  9. lemma Imo1986P3.potential_nonneg The potential is always non-negative line 107 source

    Source documentation

    The potential is always non-negative.

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

    Statement uses: Imo1986P3.State, LE.le, Int, OfNat.ofNat, Imo1986P3.potential

    Proof uses: Eq.mpr, Finset.sum, Fin, Nat, Finset.univ, HPow.hPow, HSub.hSub, HAdd.hAdd, id, Eq, congrArg, Imo1986P3.potential.eq_1, Finset.sum_nonneg, Membership.mem, Finset, sq_nonneg

    36 instances, coercions and auxiliary constants left out.

    Tactic trace: 2 steps

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

    lemma potential_nonneg (s : State) : 0 ≤ potential s := by
    …

    Mentions: Imo1986P3.State, Imo1986P3.potential

  10. lemma Imo1986P3.potential_measure_decreases Since the potential is non-negative and decreasing, its value as a natural number also decreases line 113 source

    Source documentation

    Since the potential is non-negative and decreasing, its value as a natural number also decreases.

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

    Statement uses: Imo1986P3.State, Fin, OfNat.ofNat, Nat, LT.lt, Int, Imo1986P3.State.sum, Int.toNat, Imo1986P3.potential, Imo1986P3.move

    Proof uses: lt_of_not_ge, LE.le, Mathlib.Tactic.Linarith.lt_irrefl, Eq.mp, HAdd.hAdd, Neg.neg, HSub.hSub, congrArg, Mathlib.Tactic.Ring.of_eq, Mathlib.Tactic.Ring.Common.add_congr, HMul.hMul, HPow.hPow, Nat.rawCast, Int.rawCast, inferInstance, Ring, Int.negOfNat, Mathlib.Tactic.Ring.Common.neg_congr, Mathlib.Tactic.Ring.cast_pos, Mathlib.Meta.NormNum.isNat_ofNat and 37 more

    61 instances, coercions and auxiliary constants left out.

    Tactic trace: 4 steps

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

    lemma potential_measure_decreases (s : State) (i : Fin 5)
        (h_neg : s i < 0) (h_sum : 0 < s.sum) :
        (potential (move s i)).toNat < (potential s).toNat := by
    …

    Mentions: Imo1986P3.State, Imo1986P3.potential, Imo1986P3.move

  11. determine Imo1986P3.terminates line 124 source

    no axioms what this means

    Statement uses: Bool

    Proof uses: Bool.true

  12. problem Imo1986P3.imo1986_p3 line 126 source

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

    Statement uses: Imo1986P3.State, LT.lt, Int, OfNat.ofNat, Imo1986P3.State.sum, ite, Eq, Bool, Imo1986P3.terminates, Bool.true, Acc, Imo1986P3.Step, Not

    Proof uses: Nat.strong_induction_on, Nat, Int.toNat, Imo1986P3.potential, Acc.intro, Fin, And, Imo1986P3.move, Eq.mpr, id, congrArg, Imo1986P3.sum_invariant, Imo1986P3.potential_measure_decreases, Eq.refl, Eq.symm

    11 instances, coercions and auxiliary constants left out.

    Tactic trace: 14 steps

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