{
  "id": "7262",
  "ident": "NS.07262",
  "slug": "papers-catchupconjecture",
  "title": "The Catch-Up game and conjecture",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Let $T_N = \\sum_{k=1}^{N} k = \\frac{N(N+1)}{2}$.\nIf $T_N$ is even (equivalently $N \\equiv 0 \\pmod 4$ or $N \\equiv 3 \\pmod 4$),\nthen under optimal play the game `Catch-Up($\\{1, \\ldots, N\\}$)` ends in a draw.",
  "subjects": [
    "math.NT",
    "math.OC",
    "msc:11",
    "msc:91"
  ],
  "tags": [],
  "collection": "papers",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "CatchUp.value_of_even_mul_succ_self_div_two",
  "statement_lean": "theorem value_of_even_mul_succ_self_div_two\n    (N : ℕ) (h_even : Even (N * (N + 1) / 2)) :\n    value (.Icc 1 N) = .draw",
  "challenge_source": "/-\nCopyright 2025 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# The Catch-Up game and conjecture\n\nThe game **Catch-Up** (Isaksen–Ismail–Brams–Nealen, 2015) is a two-player, perfect-information game\nplayed on a finite nonempty set `S` of positive integers. Each time a player removes a number from\n`S`, that number is added to the player’s score.\n\n**Rules.**\n* The scores start at `0`. Player `p1` starts by removing **exactly one** number from `S`.\n* After the first move, players alternate turns. On a turn, the current player removes **one or more**\n  numbers from `S`, one at a time, and must keep removing numbers until their score becomes\n  **at least** the opponent’s score; before the final pick they must remain **strictly behind**.\n* If the current player cannot catch up (in particular, even taking all remaining numbers would still\n  leave them behind), the game ends immediately: the current player receives all remaining numbers.\n\nWhen `S` is empty, the player with higher score wins; equal scores give a draw.\n\nIn this file we define:\n* `Player` and `Outcome`,\n* the recursive evaluator `value` (optimal play),\n* the conjecture `value_of_even_mul_succ_self_div_two`.\n\n## Example\nFor `S = {1,2,3,4}` one play is: `p1` takes `2`, `p2` takes `1` then `4`, and `p1` takes `3`,\nending with scores `(5,5)`.\n\n## References\nA. Isaksen, M. Ismail, S. J. Brams, A. Nealen,\n*Catch-Up: A Game in Which the Lead Alternates,* Game & Puzzle Design 1(2), 38–49 (2015).\n\n-/\n\n@[expose] public section\n\nnamespace CatchUp\n\n/--\nAn arbitrary two elements type indexing the players in the Catch-Up game.\n-/\ninductive Player\n  | p1\n  | p2\nderiving DecidableEq, Repr\n\n/-- Returns the other player. -/\ndef Player.other : Player → Player\n  | p1 => p2\n  | p2 => p1\n\n/-- The possible outcomes of a Catch-Up game. -/\ninductive Outcome\n  | win\n  | loss\n  | draw\nderiving DecidableEq, Repr\n\n/-- Negates an outcome, swapping win and loss. Used when switching player perspectives. -/\ndef Outcome.neg : Outcome → Outcome\n  | win => loss\n  | loss => win\n  | draw => draw\n\n/--\nComputes the best outcome for the current player from a list of possible outcomes.\nWin > Draw > Loss.\n-/\ndef Outcome.best (os : List Outcome) : Outcome :=\n  os.foldl (fun\n    | .win,  _     => .win\n    | _,     .win  => .win\n    | .draw, _     => .draw\n    | _,     .draw => .draw\n    | _,     _     => .loss) .loss\n\n\n/-\nDefine the recursive game value functions.\n-/\n\n/--\n`value remaining s_me s_opp isFirstMove` evaluates the position where:\n\n* `remaining` is the set `S'` of numbers not yet taken.\n* `s_me` is the current score of the player who is about to act (the “current player”).\n* `s_opp` is the opponent’s current score.\n* `isFirstMove` indicates whether we are in the special very first move of the whole game,\n  where the rules force exactly one pick and then the turn passes.\n\nThe result is the game-theoretic value from the current player’s point of view:\n`.win` / `.loss` / `.draw`, assuming optimal play from both sides.\n\nWe model a single *turn* (which may consist of several picks `$x_1,...,x_k$`) by recursion:\nthe current player chooses one number `x`; if they are still strictly behind after taking it, they must\ncontinue the same turn (so the recursive call keeps the same “current player”);\nonce they catch up (score ≥ opponent), the turn ends and we swap players.\n-/\nnoncomputable def valueAux (remaining : Finset ℕ) (s_me s_opp : ℕ) (isFirstMove : Bool) : Outcome :=\n  -- If no numbers remain, the game is over. Compare final scores.\n  if remaining = ∅ then\n    if s_me > s_opp then\n      -- Current player ends with strictly larger score.\n      .win\n    else if s_opp > s_me then\n      -- Opponent ends with strictly larger score.\n      .loss\n    else\n      -- Scores are equal.\n      .draw\n  else\n    -- Terminal rule / pruning:\n    -- If even taking *all* remaining numbers would still leave the current player behind,\n    -- then there is no legal catch-up sequence (in the TeX: no `$x_1,...,x_k$` with final sum ≥ gap).\n    -- By the rules, the current player takes everything and the game ends immediately,\n    -- but under this inequality they must still lose.\n    if s_me + remaining.sum (fun x => x) < s_opp then\n      .loss\n    else\n      -- Otherwise, the current player can pick some `$x \\in$ remaining`.\n      -- We evaluate every possible next pick under optimal play, then take the best outcome.\n      let moves := remaining.attach.toList\n      let outcomes := moves.map (fun ⟨x, _⟩ =>\n        -- Take `x`: update current player's score and remove `x` from the set.\n        let s_me' := s_me + x\n        let remaining' := remaining.erase x\n\n        if isFirstMove then\n          -- First move rule (TeX item (1)):\n          -- On the first move, `p1` must take exactly one element and then the turn passes.\n          -- We therefore swap roles, evaluate from the opponent’s perspective, and negate\n          -- to convert back to the current player's perspective.\n          (valueAux remaining' s_opp s_me' false).neg\n        else\n          -- Subsequent move rule (TeX item (2)):\n          -- On a turn, the current player must keep taking numbers while strictly behind,\n          -- and stops as soon as they reach or exceed the opponent.\n          if s_me' ≥ s_opp then\n            -- We have caught up (or overtaken) on this pick: the turn ends and the opponent moves next.\n            -- Swap players and negate to return to the current player's perspective.\n            (valueAux remaining' s_opp s_me' false).neg\n          else\n            -- Still strictly behind after taking `x`: rules force us to continue the same turn,\n            -- so the same player remains “current” in the recursive call.\n            valueAux remaining' s_me' s_opp false\n      )\n      -- Optimal play: choose the best outcome among all legal next picks.\n      .best outcomes\ntermination_by remaining.card\ndecreasing_by\n  all_goals\n    simpa [remaining'] using Finset.card_erase_lt_of_mem ‹_›\n\n/-- Public API: The game-theoretic value of Catch-Up on the set `S`, assuming optimal play.\nReturns `.win` if player 1 wins, `.loss` if player 2 wins, `.draw` if the game is tied. -/\nnoncomputable def value (S : Finset ℕ) : Outcome :=\n  valueAux S 0 0 true\n\n/--\nLet $T_N = \\sum_{k=1}^{N} k = \\frac{N(N+1)}{2}$.\nIf $T_N$ is even (equivalently $N \\equiv 0 \\pmod 4$ or $N \\equiv 3 \\pmod 4$),\nthen under optimal play the game `Catch-Up($\\{1, \\ldots, N\\}$)` ends in a draw.\n-/\n@[category research open, AMS 11 91]\ntheorem value_of_even_mul_succ_self_div_two\n    (N : ℕ) (h_even : Even (N * (N + 1) / 2)) :\n    value (.Icc 1 N) = .draw := by\n  sorry\n\nend CatchUp\n",
  "statement_hash": "53b9153986d279c1512993a9d3ffe80ff8c53233f59a82998dea36326e0f2790",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}