Compfiles/Usa2003P6.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
37 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2003, Problem 6
At the vertices of a regular hexagon are written six nonnegative integers whose sum is 2003^2003. Bert is allowed to make moves of the following form: he may pick a vertex and replace the number written there by the absolute value of the difference between the numbers written at the two neighboring vertices. Prove that Bert can make a sequence of moves, after which the number 0 appears at all six vertices.
Imports (7)
Imported by 1 file
- abbrev
Usa2003P6.ConfA configuration of six integers at the vertices of a hexagon line 37 sourceSource documentation
A configuration of six integers at the vertices of a hexagon.
no axioms what this means
Proof uses:
ZMod,OfNat.ofNat,Nat,Int1 instances, coercions and auxiliary constants left out.
abbrev Conf := ZMod 6 → ℤ
- def
Usa2003P6.stepOne move at vertexj: replace the number atjby the absolute value of the difference of the numbers at the two neighboring vertices line 41 sourceSource documentation
One move at vertex
j: replace the number atjby the absolute value of the difference of the numbers at the two neighboring vertices.standard axioms: Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,NatProof uses:
Function.update,Int,abs,HSub.hSub,HAdd.hAdd21 instances, coercions and auxiliary constants left out.
def step (f : Conf) (j : ZMod 6) : Conf := Function.update f j |f (j - 1) - f (j + 1)|
Mentions: f, Usa2003P6.Conf
- def
Usa2003P6.MovesMoves f gmeans that configurationgcan be reached fromfby a sequence of moves line 45 sourceSource documentation
Moves f gmeans that configurationgcan be reached fromfby a sequence of moves.standard axioms: Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf
Proof uses:
Exists,List,ZMod,OfNat.ofNat,Nat,Eq,List.foldl, Usa2003P6.step1 instances, coercions and auxiliary constants left out.
def Moves (f g : Conf) : Prop := ∃ l : List (ZMod 6), l.foldl step f = g
Mentions: f, Usa2003P6.Conf, Usa2003P6.step
- lemma
Usa2003P6.Moves.reflline 47 sourcestandard axioms: Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf, Usa2003P6.Moves
Proof uses:
Exists.intro,List,ZMod,OfNat.ofNat,Nat,Eq,List.foldl, Usa2003P6.step,List.nil,rfl1 instances, coercions and auxiliary constants left out.
- lemma
Usa2003P6.Moves.transline 49 sourcestandard axioms: Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf, Usa2003P6.Moves
Proof uses:
List,ZMod,OfNat.ofNat,Nat,Eq,List.foldl, Usa2003P6.step,Exists.intro,HAppend.hAppend,Eq.mpr,id,congrArg,List.foldl_append,Eq.refl5 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- def
Usa2003P6.cmaxThe maximum entry of a configuration line 55 sourceSource documentation
The maximum entry of a configuration.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
IntProof uses:
Finset.max',Finset.image,ZMod,OfNat.ofNat,Nat,Finset.univ6 instances, coercions and auxiliary constants left out.
noncomputable def cmax (f : Conf) : ℤ := …
Mentions: f, Usa2003P6.Conf
- lemma
Usa2003P6.le_cmaxline 58 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat,LE.le,Int, Usa2003P6.cmaxProof uses:
Finset.le_max',Finset.image,Finset.univ,Finset.mem_image_of_mem,Finset.mem_univ7 instances, coercions and auxiliary constants left out.
- lemma
Usa2003P6.cmax_leline 61 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
Int,ZMod,OfNat.ofNat,Nat,LE.le, Usa2003P6.cmaxProof uses:
Finset.max'_le,Finset.image,Finset.univ,Membership.mem,Finset,And,Eq,Exists,Iff.mp,Finset.mem_image20 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.cmax_attainedline 67 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
Exists,ZMod,OfNat.ofNat,Nat,Eq,Int, Usa2003P6.cmaxProof uses:
Membership.mem,Finset,Finset.image,Finset.univ,Finset.max',Finset.Nonempty.image,Finset.univ_nonempty,Finset.max'_mem,And,Iff.mp,Finset.mem_image,Exists.intro12 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.odd_iff_castline 74 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Iff,Odd,Eq,ZMod,OfNat.ofNat,NatProof uses:
Iff.symm,ZMod.intCast_eq_one_iff_odd22 instances, coercions and auxiliary constants left out.
- lemma
Usa2003P6.even_iff_castline 77 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Iff,Even,Eq,ZMod,OfNat.ofNat,NatProof uses:
Iff.symm,ZMod.intCast_eq_zero_iff_even27 instances, coercions and auxiliary constants left out.
- lemma
Usa2003P6.odd_sum_iffline 80 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
Iff,Odd,Int,Finset.sum,ZMod,OfNat.ofNat,Nat,Finset.univ,EqProof uses:
Eq.mpr,id,congrArg,Eq.symm,Int.cast_sum, Usa2003P6.odd_iff_cast45 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.one_le_of_oddline 84 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,LE.le,OfNat.ofNat,OddProof uses:
Eq,HAdd.hAdd,HMul.hMul,Eq.symm22 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.two_le_of_even_posline 88 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,LT.lt,OfNat.ofNat,Even,LE.leProof uses:
Eq,HAdd.hAdd,Eq.symm12 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- def
Usa2003P6.step2The move on parity vectors: inZMod 2the absolute difference becomes a sum line 93 sourceSource documentation
The move on parity vectors: in
ZMod 2the absolute difference becomes a sum.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
ZMod,OfNat.ofNat,NatProof uses:
Function.update,HAdd.hAdd,HSub.hSub22 instances, coercions and auxiliary constants left out.
def step2 (v : ZMod 6 → ZMod 2) (j : ZMod 6) : ZMod 6 → ZMod 2 := …
- lemma
Usa2003P6.par_stepline 96 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat,Eq, Usa2003P6.step, Usa2003P6.step2Proof uses:
funext,dite,Eq.mpr,abs,Int,HSub.hSub,HAdd.hAdd,id,congr,congrArg,Function.update_self,ZMod.intCast_abs_mod_two,Int.cast_sub,Neg.neg,sub_eq_add_neg,of_decide_eq_true,Bool,Decidable.decide,Bool.true,Eq.refland 6 more51 instances, coercions and auxiliary constants left out.
Tactic trace: 11 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.par_foldlline 107 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
List,ZMod,OfNat.ofNat,Nat,Eq,List.foldl, Usa2003P6.step, Usa2003P6.step2Proof uses:
List.rec,Eq.refl,List.nil,id,List.cons,Eq.mpr,congrArg,Eq.symm, Usa2003P6.par_step16 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.step_nonnegline 118 sourcestandard axioms: Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat,LE.le,Int, Usa2003P6.stepProof uses:
dite,Eq,Eq.mpr,Function.update,abs,HSub.hSub,HAdd.hAdd,id,congrArg,Usa2003P6.step.eq_1,Function.update_self,abs_nonneg,Not,Function.update_of_ne31 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.foldl_nonnegline 127 sourcestandard axioms: Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat,LE.le,Int,List,List.foldl, Usa2003P6.stepProof uses:
List.rec,id,List.cons, Usa2003P6.step_nonneg6 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.abs_sub_le_ofline 136 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,LE.le,OfNat.ofNat,abs,HSub.hSubProof uses:
Iff.mpr,And,Neg.neg,abs_le,And.intro27 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.cmax_step_leline 140 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat,LE.le,Int, Usa2003P6.cmax, Usa2003P6.stepProof uses: Usa2003P6.cmax_le,
dite,Eq,Eq.mpr,Function.update,abs,HSub.hSub,HAdd.hAdd,id,congrArg,Usa2003P6.step.eq_1,Function.update_self,le_trans,Max.max, Usa2003P6.abs_sub_le_of,le_max_left,le_max_right,max_le, Usa2003P6.le_cmax,Notand 1 more28 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.cmax_foldl_leline 150 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat,LE.le,Int,List, Usa2003P6.cmax,List.foldl, Usa2003P6.stepProof uses:
List.rec,le_refl,List.nil,id,List.cons,le_trans, Usa2003P6.step_nonneg, Usa2003P6.cmax_step_le7 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- def
Usa2003P6.candsThe candidate move sequences used to reach a configuration with exactly one odd entry line 163 sourceSource documentation
The candidate move sequences used to reach a configuration with exactly one odd entry. Which one applies depends on the parity pattern of the starting configuration.
standard axioms: Quot.sound, propext what this means
Statement uses:
List,ZMod,OfNat.ofNat,NatProof uses:
List.cons,List.nil19 instances, coercions and auxiliary constants left out.
def cands : List (List (ZMod 6)) := …
- lemma
Usa2003P6.phase1_decideMachine-checked parity verification: from every parity vector with odd sum, one of the candidate sequences leads to a parity vector with exactly one odd entry line 170 sourceSource documentation
Machine-checked parity verification: from every parity vector with odd sum, one of the candidate sequences leads to a parity vector with exactly one odd entry.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
ZMod,OfNat.ofNat,Nat,Eq,Finset.sum,Finset.univ,Exists,List,And,Membership.mem, Usa2003P6.cands,List.foldl, Usa2003P6.step2,iteProof uses:
of_decide_eq_true,id,Bool,Decidable.decide,Bool.true,Eq.refl45 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
lemma phase1_decide : ∀ v : ZMod 6 → ZMod 2, (∑ i, v i) = 1 → ∃ l ∈ cands, ∃ p, ∀ i, (l.foldl step2 v) i = (if i = p then 1 else 0) := by …Mentions: Usa2003P6.cands, Usa2003P6.step2
- lemma
Usa2003P6.phase1line 174 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat,LE.le,Int,Odd,Finset.sum,Finset.univ,Exists,List,And,Eq,List.foldl, Usa2003P6.step, Usa2003P6.cmax,NeProof uses:
Membership.mem, Usa2003P6.cands, Usa2003P6.step2,ite, Usa2003P6.phase1_decide,Eq.mp,congrArg,propext, Usa2003P6.odd_sum_iff,Exists.intro,And.intro,rfl, Usa2003P6.foldl_nonneg, Usa2003P6.cmax_foldl_le,congr_fun, Usa2003P6.par_foldl,Eq.mpr,id,ite_eq_left,ite_eq_right51 instances, coercions and auxiliary constants left out.
Tactic trace: 16 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.step_comp_addline 196 sourcestandard axioms: Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat,Eq, Usa2003P6.step,Function.comp,Int,HAdd.hAddProof uses:
funext,id,dite,Function.update,abs,HSub.hSub,Eq.mpr,congrArg,Function.update_self,Lattice,AddGroup,Eq.rec,Eq.refl,HSub,Mathlib.Tactic.Ring.of_eq,Int.rawCast,inferInstance,Ring,Int.negOfNat,HMul.hMuland 27 more51 instances, coercions and auxiliary constants left out.
Tactic trace: 17 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.foldl_comp_addline 212 sourcestandard axioms: Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat,List,Eq,List.foldl, Usa2003P6.step,Function.comp,Int,HAdd.hAdd,List.mapProof uses:
List.rec,Eq.refl,List.nil,Eq.mpr,List.cons,id,congrArg,congrFun',List.map_cons, Usa2003P6.step_comp_add14 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.moves_comp_addline 221 sourcestandard axioms: Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat, Usa2003P6.Moves,Function.comp,Int,HAdd.hAddProof uses:
List,Eq,List.foldl, Usa2003P6.step,Exists.intro,List.map,HSub.hSub,Eq.mpr,id,congrArg, Usa2003P6.foldl_comp_add,List.map_map,funext,Mathlib.Tactic.Ring.of_eq,HMul.hMul,HPow.hPow,Nat.rawCast,Mathlib.Tactic.Ring.Common.add_congr,Int.rawCast,inferInstanceand 25 more40 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.abs_sub_le_mk1line 234 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,LE.le,OfNat.ofNat,HSub.hSub,absProof uses:
Iff.mpr,And,Neg.neg,abs_le,And.intro27 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.abs_sub_le_mk2line 238 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,LE.le,OfNat.ofNat,HSub.hSub,absProof uses:
Iff.mpr,And,Neg.neg,abs_le,And.intro27 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.phase2line 244 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat,LE.le,Int,Eq,Ne,Exists,And, Usa2003P6.Moves,Or,Odd,Finset.sum,Finset.univ,LT.lt, Usa2003P6.cmaxProof uses: Usa2003P6.one_le_of_odd,
Iff.mpr, Usa2003P6.odd_iff_cast,le_trans, Usa2003P6.le_cmax, Usa2003P6.cmax_attained,ite,funext,dite,Eq.mpr,id,congrArg,ite_eq_left,rfl,Eq.symm,Not,ite_eq_right,HSub.hSub,of_decide_eq_true,Booland 88 more122 instances, coercions and auxiliary constants left out.
Tactic trace: 266 steps (first 200 of 266)
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.winnable_auxline 465 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2003P6.Conf,
ZMod,OfNat.ofNat,Nat,LE.le,Int,Odd,Finset.sum,Finset.univ, Usa2003P6.MovesProof uses:
Eq,Int.toNat, Usa2003P6.cmax,Nat.strongRecOn,LT.lt,List,Exists,And,List.foldl, Usa2003P6.step,Ne, Usa2003P6.phase1,Function.comp,HAdd.hAdd,rfl,id,Eq.mpr,congrArg,zero_add,Iff.mprand 46 more80 instances, coercions and auxiliary constants left out.
Tactic trace: 61 steps
Open to load the checked before-and-after goal states.
- def
Usa2003P6.stepNOne move at vertexj, phrased on natural numbers line 529 sourceSource documentation
One move at vertex
j, phrased on natural numbers.standard axioms: Quot.sound, propext what this means
Statement uses:
ZMod,OfNat.ofNat,NatProof uses:
Function.update,Nat.dist,HSub.hSub,HAdd.hAdd18 instances, coercions and auxiliary constants left out.
def stepN (f : ZMod 6 → ℕ) (j : ZMod 6) : ZMod 6 → ℕ := …
Mentions: f
- lemma
Usa2003P6.dist_castline 532 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Int,Nat.dist,abs,HSub.hSubProof uses:
id,LE.le,Or,HAdd.hAdd,le_total,Eq.mpr,OfNat.ofNat,congrArg,Nat.sub_eq_zero_of_le,zero_add,Nat.cast_sub,Neg.neg,abs_of_nonpos,Mathlib.Tactic.Ring.of_eq,HMul.hMul,HPow.hPow,Nat.rawCast,Int.rawCast,inferInstance,Ringand 26 more62 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.stepN_castline 541 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
ZMod,OfNat.ofNat,Nat,Eq,Int, Usa2003P6.stepN, Usa2003P6.stepProof uses:
funext,dite,Eq.mpr,Function.update,Nat.dist,HSub.hSub,HAdd.hAdd,id,congrArg,Usa2003P6.stepN.eq_1,Function.update_self,abs, Usa2003P6.Conf,Usa2003P6.step.eq_1, Usa2003P6.dist_cast,Not,Function.update_of_ne,Eq.refl26 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2003P6.foldl_bridgeline 550 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
ZMod,OfNat.ofNat,Nat,List,Eq,Int,List.foldl, Usa2003P6.stepN, Usa2003P6.Conf, Usa2003P6.stepProof uses:
List.rec,Eq.refl,List.nil,id,List.cons,Eq.mpr,congrArg,Eq.symm, Usa2003P6.stepN_cast6 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- problem
Usa2003P6.usa2003_p6line 561 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
ZMod,OfNat.ofNat,Nat,Eq,Finset.sum,Finset.univ,HPow.hPow,Exists,List,List.foldl,Function.update,Nat.dist,HSub.hSub,HAdd.hAddProof uses:
LE.le,Int,Int.natCast_nonneg,Odd,Eq.mpr,id,congrArg,Eq.symm,Nat.cast_sum,Nat.cast_pow,Odd.pow,Exists.intro,HMul.hMul,rfl, Usa2003P6.Conf, Usa2003P6.step, Usa2003P6.Moves, Usa2003P6.winnable_aux, Usa2003P6.stepN, Usa2003P6.foldl_bridge and 6 more81 instances, coercions and auxiliary constants left out.
Tactic trace: 13 steps
Open to load the checked before-and-after goal states.