Compfiles/Usa2023P4.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
22 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2023, Problem 4
Positive integers a and N are fixed, and N positive integers are written on a blackboard. Alice and Bob play the following game. On Alice's turn, she must replace some integer n on the board with n + a, and on Bob's turn he must replace some even integer n on the board with n/2. Alice goes first and they alternate turns. If Bob has no valid moves on his turn the game ends.
After analyzing the N integers on the board, Bob realizes that, regardless of what moves Alices makes, he will be able to force the game to end eventually. Show that, in fact, no matter what either player does, for these values of a and N and these particular N integers, the game is guaranteed to end, regardless of either player's moves.
Imports (2)
Imported by 1 file
- inductive
Usa2023P4.Playerline 36 sourceno axioms what this means
- abbrev
Usa2023P4.Blackboardline 40 sourceno axioms what this means
Statement uses:
NatProof uses:
Fin,PNat - structure
Usa2023P4.Stateline 42 sourceno axioms what this means
Statement uses:
Nat - theorem
Usa2023P4.halve_evenline 46 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Even,Nat,LT.lt,OfNat.ofNat,HDiv.hDivProof uses:
Subtype.mk,Eq,HAdd.hAdd,id16 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- def
Usa2023P4.valid_movesline 51 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat, Usa2023P4.State,SetProof uses:
Usa2023P4.valid_moves.match_1, Usa2023P4.Blackboard,Set.ofPred,Exists,Fin,Eq,Usa2023P4.State.mk,Function.update,HAdd.hAdd,Usa2023P4.Player.Bob,Even,Subtype.mk,LT.lt,OfNat.ofNat,HDiv.hDiv,Usa2023P4.Player.Alice10 instances, coercions and auxiliary constants left out.
- inductive
Usa2023P4.BobCanForceEndline 60 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat, Usa2023P4.State - inductive
Usa2023P4.EndInevitableline 70 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat, Usa2023P4.State - lemma
Usa2023P4.lemma1The N=1 case is degenerate line 79 sourceSource documentation
The N=1 case is degenerate.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat, Usa2023P4.State,OfNat.ofNat,Nat, Usa2023P4.BobCanForceEnd, Usa2023P4.EndInevitableProof uses:
Usa2023P4.BobCanForceEnd.rec, Usa2023P4.Blackboard,Eq,Set, Usa2023P4.valid_moves,Usa2023P4.State.mk,Usa2023P4.Player.Bob,EmptyCollection.emptyCollection,Usa2023P4.EndInevitable.BaseCase,Membership.mem,Usa2023P4.EndInevitable.Step,Fin,Exists,Even,Function.update,Subtype.mk,LT.lt,HDiv.hDiv,Usa2023P4.Player.Alice,Eq.mprand 10 more15 instances, coercions and auxiliary constants left out.
Tactic trace: 13 steps
Open to load the checked before-and-after goal states.
lemma lemma1 (a : ℕ+) (s : State 1) (he : BobCanForceEnd a 1 s) : EndInevitable a 1 s := by …Mentions: Usa2023P4.State, Usa2023P4.BobCanForceEnd, Usa2023P4.EndInevitable
- inductive
Usa2023P4.EndInevitableInend is inevitable in M moves line 97 sourceSource documentation
end is inevitable in M moves
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat, Usa2023P4.Stateinductive EndInevitableIn (a : ℕ+) (n : ℕ) : ℕ → State n → Prop where …
Mentions: Usa2023P4.State
- lemma
Usa2023P4.end_inevitable_nline 106 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat, Usa2023P4.State, Usa2023P4.EndInevitableIn, Usa2023P4.EndInevitableProof uses:
Usa2023P4.EndInevitableIn.rec,Eq,Set, Usa2023P4.valid_moves,EmptyCollection.emptyCollection,Usa2023P4.EndInevitable.BaseCase, Usa2023P4.Blackboard,Membership.mem,Usa2023P4.State.mk,Usa2023P4.Player.Bob,Usa2023P4.EndInevitable.Step,Usa2023P4.Player.Alice2 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2023P4.lemma3line 113 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Usa2023P4.Blackboard,Eq,Finset.sum,Fin,Finset.univ,padicValNat,OfNat.ofNat,Not,EvenProof uses:
LT.lt,Dvd.dvd,Iff.mp,even_iff_two_dvd,HPow.hPow,Nat.succ,LE.le,Nat.pow_dvd_iff_le_padicValNat,PNat.ne_zero,Eq.mp,Membership.mem,Finset,congrArg,propext,Finset.sum_eq_zero_iff,AddUnits,Finset.mem_univ42 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2023P4.lemma5line 125 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,padicValNat,HAdd.hAddProof uses:
Decidable.byContradiction,Not,Dvd.dvd,HPow.hPow,pow_padicValNat_dvd,Nat.pow_dvd_of_le_of_pow_dvd,Eq.mp,LE.le,Iff.mpr,Nat.dvd_add_iff_left,Iff.mp,Nat.pow_dvd_iff_le_padicValNat,Nat.ne_zero_of_lt22 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2023P4.lemma5'line 137 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,padicValNat,Eq,HAdd.hAddProof uses:
Dvd.dvd,HPow.hPow,pow_padicValNat_dvd,Exists,Nat.exists_eq_add_of_le,HMul.hMul,Eq.mpr,id,congrArg,Eq.mp,pow_add,add_assoc,mul_assoc,Eq.symm,mul_add,Eq.refl,Dvd.intro,LE.le,Iff.mp,Nat.pow_dvd_iff_le_padicValNatand 21 more72 instances, coercions and auxiliary constants left out.
Tactic trace: 42 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2023P4.alice_move_preserves_nuline 192 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat, Usa2023P4.Blackboard,Fin,LT.lt,padicValNat,OfNat.ofNat, Usa2023P4.State,Membership.mem,Set, Usa2023P4.valid_moves,Usa2023P4.State.mk,Usa2023P4.Player.Alice,Usa2023P4.State.boardProof uses:
Eq,Function.update,HAdd.hAdd,Usa2023P4.Player.Bob,Exists,id,dite,Eq.mpr,congrArg,Function.update_self, Usa2023P4.lemma5,PNat.pos,Not,Function.update_of_ne,Ne.symm,Eq.symm13 instances, coercions and auxiliary constants left out.
Tactic trace: 19 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2023P4.alice_move_preserves_nu'line 216 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat, Usa2023P4.Blackboard,Fin,LT.lt,padicValNat,OfNat.ofNat, Usa2023P4.State,Membership.mem,Set, Usa2023P4.valid_moves,Usa2023P4.State.mk,Usa2023P4.Player.Alice,Eq,Usa2023P4.State.boardProof uses:
Function.update,HAdd.hAdd,Usa2023P4.Player.Bob,Exists,id,dite,Eq.mpr,congrArg,Function.update_self, Usa2023P4.lemma5',PNat.pos,Not,Function.update_of_ne,Ne.symm,Eq.refl,Eq.symm13 instances, coercions and auxiliary constants left out.
Tactic trace: 18 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2023P4.bob_moves_after_aliceline 239 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat, Usa2023P4.Blackboard, Usa2023P4.State,Membership.mem,Set, Usa2023P4.valid_moves,Usa2023P4.State.mk,Usa2023P4.Player.Alice,Exists,Eq,Usa2023P4.Player.BobProof uses:
Fin,Function.update,HAdd.hAdd,of_eq_true,Eq.trans,True,congrArg,funext,And, Usa2023P4.Player,Usa2023P4.State.mk.injEq,eq_self,and_true,Eq.symm8 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2023P4.lemma6line 247 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Even,Eq,HAdd.hAdd,padicValNat,HDiv.hDivProof uses:
Dvd.dvd,Iff.mp,even_iff_two_dvd,LE.le,Eq.mpr,HPow.hPow,id,congrArg,Eq.symm,propext,Nat.pow_dvd_iff_le_padicValNat,pow_one,HSub.hSub,padicValNat.div38 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2023P4.lemma2'When N ≥ 2, if ν2(x) < ν2(a) for all x ∈ S, the game must terminate in ∑_{x∈S} ν2(x) moves, no matter what either player does line 257 sourceSource comment
When N ≥ 2, if ν2(x) < ν2(a) for all x ∈ S, the game must terminate in ∑_{x∈S} ν2(x) moves, no matter what either player does.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat,LT.lt,OfNat.ofNat, Usa2023P4.State,Fin,padicValNat,Usa2023P4.State.board, Usa2023P4.EndInevitableIn,Finset.sum,Finset.univProof uses:
Nat.recAux,Eq,Not,Even, Usa2023P4.lemma3, Usa2023P4.Blackboard, Usa2023P4.Player,Usa2023P4.State.mk,Usa2023P4.Player.Bob,Usa2023P4.EndInevitableIn.BaseCase,id,Set, Usa2023P4.valid_moves,EmptyCollection.emptyCollection,Eq.mpr,Set.ofPred,Exists,Function.update,Subtype.mk,HDiv.hDivand 52 more55 instances, coercions and auxiliary constants left out.
Tactic trace: 158 steps
Open to load the checked before-and-after goal states.
lemma lemma2' (a : ℕ+) (N : ℕ) (hN : 1 < N) (s0 : State N) (hd : ∀ i : Fin N, padicValNat 2 (s0.board i) < padicValNat 2 a) : EndInevitableIn a N (∑ i : Fin N, padicValNat 2 (s0.board i)) s0 := by …Mentions: Usa2023P4.State, Usa2023P4.EndInevitableIn
- lemma
Usa2023P4.lemma2When N ≥ 2, if ν2(x) < ν2(a) for all x ∈ S, the game must terminate no matter what either player does line 399 sourceSource comment
When N ≥ 2, if ν2(x) < ν2(a) for all x ∈ S, the game must terminate no matter what either player does.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat,LT.lt,OfNat.ofNat, Usa2023P4.State,Fin,padicValNat,Usa2023P4.State.board, Usa2023P4.EndInevitableProof uses: Usa2023P4.end_inevitable_n,
Finset.sum,Finset.univ, Usa2023P4.lemma2'8 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
lemma lemma2 (a : ℕ+) (N : ℕ) (hN : 1 < N) (s0 : State N) (hd : ∀ i : Fin N, padicValNat 2 (s0.board i) < padicValNat 2 a) : EndInevitable a N s0 := by …Mentions: Usa2023P4.State, Usa2023P4.EndInevitable
- lemma
Usa2023P4.lemma7Key fact: when ν₂(x) = ν₂(a), ν₂(x+a) ≥ ν₂(a) + 1 line 405 sourceSource comment
Key fact: when ν₂(x) = ν₂(a), ν₂(x+a) ≥ ν₂(a) + 1standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,padicValNat,LE.le,HAdd.hAddProof uses:
Eq.mpr,id,congrArg,rfl,Dvd.dvd,HPow.hPow,Eq.symm,Eq.mp,pow_padicValNat_dvd,HMul.hMul,Not,False,pow_succ,mul_dvd_mul_left,dvd_mul_right,Iff.mp,Nat.pow_dvd_iff_le_padicValNat,HMod.hMod,propext,Nat.dvd_iff_mod_eq_zeroand 3 more34 instances, coercions and auxiliary constants left out.
Tactic trace: 35 steps
Open to load the checked before-and-after goal states.
lemma lemma7 {x a : ℕ} (hx : 0 < x) (ha : 0 < a) (heq : padicValNat 2 x = padicValNat 2 a) : padicValNat 2 a + 1 ≤ padicValNat 2 (x + a) := by … - lemma
Usa2023P4.alice_prevents_endWhen N ≥ 2, if ∃ i with ν₂(b i) ≥ ν₂(a) (+ offset by turn), then ¬BobCanForceEnd line 436 sourceSource comment
When N ≥ 2, if ∃ i with ν₂(b i) ≥ ν₂(a) (+ offset by turn), then ¬BobCanForceEnd.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat,LT.lt,OfNat.ofNat, Usa2023P4.State, Usa2023P4.BobCanForceEnd,Exists,Fin,LE.le,HAdd.hAdd,padicValNat,Usa2023P4.alice_prevents_end.match_1, Usa2023P4.Player,Usa2023P4.State.turn,Unit,Usa2023P4.State.board,FalseProof uses:
Usa2023P4.BobCanForceEnd.rec, Usa2023P4.Blackboard,Eq,Set, Usa2023P4.valid_moves,Usa2023P4.State.mk,Usa2023P4.Player.Bob,EmptyCollection.emptyCollection,Even,Eq.mpr,Dvd.dvd,id,congrArg,propext,even_iff_two_dvd,Nat.dvd_of_pow_dvd,pow_padicValNat_dvd,Eq.mp,Not,Membership.memand 26 more49 instances, coercions and auxiliary constants left out.
Tactic trace: 61 steps
Open to load the checked before-and-after goal states.
lemma alice_prevents_end (a : ℕ+) (N : ℕ) (hN : 1 < N) (s : State N) (he : BobCanForceEnd a N s) (hinv : ∃ i : Fin N, padicValNat 2 ↑a + (match s.turn with | .Alice => 0 | .Bob => 1) ≤ padicValNat 2 ↑(s.board i)) : False := by …Mentions: Usa2023P4.State, Usa2023P4.BobCanForceEnd
- problem
Usa2023P4.usa2023_p4line 488 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
PNat,Nat,LT.lt,OfNat.ofNat, Usa2023P4.Blackboard, Usa2023P4.BobCanForceEnd,Usa2023P4.State.mk,Usa2023P4.Player.Alice, Usa2023P4.EndInevitableProof uses:
Eq,Or,LE.le.eq_or_lt, Usa2023P4.lemma1,Fin,padicValNat,Decidable.byContradiction,Not,LE.le,Exists,False,Eq.mp,Eq.trans,Mathlib.Tactic.Push.not_forall_eq,congrArg,funext, Usa2023P4.alice_prevents_end,Exists.intro,HAdd.hAdd,Usa2023P4.alice_prevents_end.match_1and 6 more20 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.