USA2022 P6
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.BigOperators.Ring.Finset
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Algebra.Order.Ring.Star
import Mathlib.AlgebraicTopology.SimplexCategory.Basic
import Mathlib.Combinatorics.SimpleGraph.Operations
import Mathlib.Data.Set.Card
theorem _root_.LeanGolf.compfiles.usa2022_p6 :
IsLeast {m : ℕ | ∃ G : SimpleGraph (Fin 2022), Completable G ∧ G.edgeSet.ncard = m}
answerTrusted statement context
noncomputable section
namespace Usa2022P6
open SimpleGraph
variable {V : Type*} [DecidableEq V] [Fintype V]
structure CanAdd (G : SimpleGraph V) (u v : V) : Prop where
ne : u ≠ v
not_adj : ¬ G.Adj u v
common : ∃ p q : V, p ≠ q ∧ G.Adj u p ∧ G.Adj v p ∧ G.Adj u q ∧ G.Adj v q
inductive Reachable : SimpleGraph V → SimpleGraph V → Prop
| refl (G : SimpleGraph V) : Reachable G G
| step {G H : SimpleGraph V} {u v : V} (h : Reachable G H) (hc : CanAdd H u v) :
Reachable G (H ⊔ SimpleGraph.edge u v)
def Completable (G : SimpleGraph V) : Prop := Reachable G ⊤
def xi (i : Fin 1010) : Fin 2022 := ⟨2 * i.val + 2, by lia⟩
def yi (i : Fin 1010) : Fin 2022 := ⟨2 * i.val + 3, by lia⟩
def constrEdges : Finset (Sym2 (Fin 2022)) :=
{s(0, 1)} ∪ Finset.biUnion Finset.univ (fun i : Fin 1010 =>
{s(1, xi i), s(xi i, yi i), s(yi i, 0)})
def constrGraph : SimpleGraph (Fin 2022) := SimpleGraph.fromEdgeSet ↑constrEdges
instance : DecidableRel constrGraph.Adj :=
inferInstanceAs (DecidableRel (SimpleGraph.fromEdgeSet (↑constrEdges : Set (Sym2 (Fin 2022)))).Adj)
abbrev answer : ℕ := 3031