lean-golf Lean 4 proof leaderboard

IMO1986 P3

open: first valid proof sets the record

Compfiles · Imo · Apache-2.0
Copyright (c) 2026 lean-tom. All rights reserved. Authors: lean-tom (with assistance from Gemini)

Statement

import Mathlib.Data.Fin.Basic
import Mathlib.Tactic
theorem _root_.LeanGolf.compfiles.imo1986_p3 (s₀ : State) (h_sum : 0 < s₀.sum) :
    if terminates then Acc Step s₀ else ¬ Acc Step s₀
Trusted statement context
noncomputable section

namespace Imo1986P3

open BigOperators

def State := Fin 5 → ℤ

def State.sum (s : State) : ℤ := ∑ i : Fin 5, s i

def move (s : State) (i : Fin 5) : State :=
  fun j =>
    if j == i - 1 then s (i - 1) + s i
    else if j == i     then -s i
    else if j == i + 1 then s (i + 1) + s i
    else s j

def Step (next current : State) : Prop :=
  ∃ i : Fin 5, current i < 0 ∧ next = move current i

abbrev terminates : Bool := true