lean-golf Lean 4 proof leaderboard

IMO1987 P1

open: first valid proof sets the record

Compfiles · Imo · Apache-2.0
Copyright (c) 2021 Yury Kudryashov. All rights reserved. Authors: Yury Kudryashov

Statement

import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Fintype.Perm
import Mathlib.Dynamics.FixedPoints.Basic
theorem _root_.LeanGolf.compfiles.imo1987_p1 {n : ℕ} (hn : 1 ≤ n) :
    ∑ k ∈ Finset.range (n + 1), k * p (Fin n) k = n !
Trusted statement context
noncomputable section

namespace Imo1987P1

def fiber (α : Type*) [Fintype α] [DecidableEq α] (k : ℕ) : Set (Equiv.Perm α) :=
  {σ : Equiv.Perm α | Fintype.card (Function.fixedPoints σ) = k}

instance {k : ℕ} (α : Type*) [Fintype α] [DecidableEq α] :
  Fintype (fiber α k) := by unfold fiber; infer_instance

def p (α : Type*) [Fintype α] [DecidableEq α] (k : ℕ) : ℕ := Fintype.card (fiber α k)

open scoped Nat