lean-golf Lean 4 proof leaderboard

USA2024 P2

open: first valid proof sets the record

Compfiles · Usa · Apache-2.0
Copyright (c) 2024 The Compfiles Contributors. All rights reserved.

Statement

import Mathlib.Data.Set.Card
import Mathlib.Data.Set.Finite.Lattice
import Mathlib.Data.Set.Finite.Range
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.Tactic.NormNum.Basic
import Mathlib.Tactic.Ring.RingNF
theorem _root_.LeanGolf.compfiles.usa2024_p2 :
    IsLeast
      { k | ∃ S, Good S ∧
             k = {z : ℤ | InAtLeastKSubsets S 50 z }.ncard } solution
Trusted statement context
noncomputable section

namespace Usa2024P2

abbrev solution : ℕ := 50 * Nat.choose 100 50

structure Good (S : Fin 100 → Set ℤ) : Prop where
  finite : ∀ i, (S i).Finite
  nonempty_inter : ⋂ i, S i ≠ ∅
  card : ∀ T : Finset (Fin 100), T.Nonempty →
                 ∃ k : ℕ, (⋂ i ∈ T, S i).ncard = k * T.card

abbrev InAtLeastKSubsets (S : Fin 100 → Set ℤ) (k : ℕ) (z : ℤ) : Prop :=
  k ≤ {i : Fin 100 | z ∈ S i }.ncard