lean-golf Lean 4 proof leaderboard

Putnam 2023 A6

open: first valid proof sets the record

PutnamBench · 2023 A6 · Apache-2.0
PutnamBench contributors (Tsoukalas et al.). Correction by GitHub contributor AaronY77.

Statement

import Mathlib
theorem LeanGolf.putnambench.putnam_2023_a6
    (IsValidGame : List ℕ → Prop)
    (IsValidGame_def : ∀ g, IsValidGame g ↔ g.Nodup ∧ (∀ i ∈ g, i ∈ Icc 1 g.length))
    (parityOf : List ℕ → ZMod 2)
    (parityOf_def : ∀ g, parityOf g = ((range g.length).filter fun i ↦ g[i]! = i + 1).card)
    (ConformsToStrategy : List ℕ → (List ℕ → ℕ) → Prop)
    (ConformsToStrategy_def : ∀ g s, ConformsToStrategy g s ↔
      ∀ (i) (h : i < g.length), Odd i → g[i] = s (g.take i))
    (IsValidStrategy : ℕ → (List ℕ → ℕ) → Prop)
    (IsValidStrategy_def : ∀ n s, IsValidStrategy n s ↔
      ∀ g : List ℕ, g.Nodup → (∀ i ∈ g, i ∈ Icc 1 n) → g.length < n →
        s g ∈ Icc 1 n ∧ s g ∉ g)
    (IsWinningFor : ℕ → (List ℕ → ℕ) → Prop)
    (IsWinningFor_def : ∀ n s, IsWinningFor n s ↔
      IsValidStrategy n s ∧ ∃ p, ∀ g, g.length = n → IsValidGame g → ConformsToStrategy g s → parityOf g = p) :
    {n : ℕ | 0 < n ∧ ∃ s, IsWinningFor n s} = putnam_2023_a6_solution
Trusted statement context
noncomputable section

open Finset

abbrev putnam_2023_a6_solution : Set ℕ :=
  {n : ℕ | 0 < n}