lean-golf Lean 4 proof leaderboard

USA1994 P2

open: first valid proof sets the record

Compfiles · Usa · Apache-2.0
Copyright (c) 2026 The Compfiles Contributors. All rights reserved. Authors: Kimi K3

Statement

import Mathlib.Algebra.Field.ZMod
import Mathlib.Tactic.Ring
theorem _root_.LeanGolf.compfiles.usa1994_p2 :
    if does_exist then
      ∃ m : ZMod 99, Relation.ReflTransGen Move initial (target m)
    else
      ¬ ∃ m : ZMod 99, Relation.ReflTransGen Move initial (target m)
Trusted statement context
noncomputable section

namespace Usa1994P2

abbrev Val := ZMod 3

abbrev Config := ZMod 99 → Val

def initial : Config := fun i ↦
  if i.val = 98 then 2 else if i.val % 2 = 0 then 0 else 1

def targetPat (k : ℕ) : Val :=
  if k = 97 then 2 else if k = 98 then 1 else if k % 2 = 0 then 0 else 1

def target (m : ZMod 99) : Config := fun i ↦ targetPat (i - m).val

def Move (a b : Config) : Prop :=
  ∃ n v, v ≠ a n ∧ v ≠ a (n - 1) ∧ v ≠ a (n + 1) ∧ b = Function.update a n v

abbrev does_exist : Bool := false