Compfiles/Imo1986P3.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
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.
Imported by 1 file
- def
Imo1986P3.StateState of the pentagon: an integer assigned to each vertex line 34 sourceSource documentation
State of the pentagon: an integer assigned to each vertex.
no axioms what this means
Proof uses:
Fin,OfNat.ofNat,Nat,Int1 instances, coercions and auxiliary constants left out.
def State := Fin 5 → ℤ
- def
Imo1986P3.State.sumThe sum of all integers on the pentagon line 37 sourceSource documentation
The sum of all integers on the pentagon.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Imo1986P3.State,
IntProof uses:
Finset.sum,Fin,OfNat.ofNat,Nat,Finset.univ3 instances, coercions and auxiliary constants left out.
def State.sum (s : State) : ℤ := ∑ i : Fin 5, s i
Mentions: Imo1986P3.State
- def
Imo1986P3.moveThe operation performed at vertexiwhens i < 0line 40 sourceSource documentation
The operation performed at vertex
iwhens i < 0.standard axioms: propext what this means
Statement uses: Imo1986P3.State,
Fin,OfNat.ofNat,NatProof uses:
ite,Int,Eq,Bool,BEq.beq,HSub.hSub,Bool.true,HAdd.hAdd,Neg.neg13 instances, coercions and auxiliary constants left out.
def move (s : State) (i : Fin 5) : State := …
Mentions: Imo1986P3.State
- def
Imo1986P3.StepThe transition relationStep next currentasserts thatnextis obtained fromcurrentby applying the move operation at some vertexiwheres i < 0line 52 sourceSource documentation
The transition relation
Step next currentasserts thatnextis obtained fromcurrentby applying the move operation at some vertexiwheres i < 0. The order of arguments(next current)is chosen to match the convention ofAcc.standard axioms: propext what this means
Statement uses: Imo1986P3.State
Proof uses:
Exists,Fin,OfNat.ofNat,Nat,And,LT.lt,Int,Eq, Imo1986P3.move3 instances, coercions and auxiliary constants left out.
def Step (next current : State) : Prop := …
Mentions: Imo1986P3.State
- def
Imo1986P3.potentialThe potential function $V(s) = \sum (s_i - s_{i+2})^2$ line 69 sourceSource 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,
IntProof uses:
Finset.sum,Fin,OfNat.ofNat,Nat,Finset.univ,HPow.hPow,HSub.hSub,HAdd.hAdd13 instances, coercions and auxiliary constants left out.
def potential (s : State) : ℤ := …
Mentions: Imo1986P3.State
- lemma
Imo1986P3.sum_invariantThe sum of the integers is invariant under the move operation line 73 sourceSource 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.moveProof 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_refland 29 more59 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
- lemma
Imo1986P3.potential_diffThe change in potential after a move operation line 85 sourceSource 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.sumProof 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_ltand 85 more77 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
- lemma
Imo1986P3.potential_decreasingIf $s_i < 0$ and the total sum is positive, the potential strictly decreases line 99 sourceSource 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.moveProof 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.instAddMonoidWithOneand 54 more86 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
- lemma
Imo1986P3.potential_nonnegThe potential is always non-negative line 107 sourceSource 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.potentialProof 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_nonneg36 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
- lemma
Imo1986P3.potential_measure_decreasesSince the potential is non-negative and decreasing, its value as a natural number also decreases line 113 sourceSource 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.moveProof 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_ofNatand 37 more61 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
- determine
Imo1986P3.terminatesline 124 sourceno axioms what this means
Statement uses:
BoolProof uses:
Bool.true - problem
Imo1986P3.imo1986_p3line 126 sourcestandard 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,NotProof 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.symm11 instances, coercions and auxiliary constants left out.
Tactic trace: 14 steps
Open to load the checked before-and-after goal states.