AFTD Auto-Formalizing Theoretical Domains

top_is_d_immune

lemmaverifiedformalization

For any d and any finite vertex set of size at least 2d + 1, the complete simple graph is d-immune.

Statement

lemma top_is_d_immune {V : Type*} [Fintype V] [DecidableEq V]
    (d : ℕ) (hV : 2 * d + 1 ≤ Fintype.card V) :
    graph_is_d_immune (⊤ : SimpleGraph V) d
Formalizes
arXiv:2611.26556 Section 1
Verified
21 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • graph_is_d_immuneA finite simple graph G is d-immune if it has no d-cut.
  • graph_has_d_cutA finite simple graph G has a d-cut if there exists a subset A of vertices forming a d-cut.
  • graph_is_d_cutA subset A of vertices is a d-cut of a finite simple graph G if both A and its complement are nonempty, each vertex in A has at most d…

Read back from the Lean

For any finite type V with decidable equality, and any natural number d, if the cardinality of V is at least 2 * d + 1, then the complete graph on V (denoted ⊤ : SimpleGraph V) is d-immune (meaning it has no d-cut: there is no subset of vertices A such that A is nonempty, its complement Aᶜ is nonempty, every vertex in A has at most d neighbors outside A, and every vertex in Aᶜ has at most d neighbors inside A).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- In the complete graph, the neighbour finset of any vertex is the complement of
the singleton, for any choice of the finiteness instance on the neighbour set. -/
lemma top_is_d_immune_neighborFinset_top_at {V : Type*} [Fintype V] [DecidableEq V] (u : V)
    (i : Fintype ↑((⊤ : SimpleGraph V).neighborSet u)) :
    @SimpleGraph.neighborFinset V (⊤ : SimpleGraph V) u i = {u}ᶜ := by
  unfold SimpleGraph.neighborFinset
  ext x
  rw [@Set.mem_toFinset _ _ i, Finset.mem_compl, Finset.mem_singleton]
  simp [SimpleGraph.neighborSet, SimpleGraph.top_adj, eq_comm]

/-- The complete graph on at least 2d + 1 vertices is d-immune. -/
lemma top_is_d_immune {V : Type*} [Fintype V] [DecidableEq V]
    (d : ℕ) (hV : 2 * d + 1 ≤ Fintype.card V) :
    graph_is_d_immune (⊤ : SimpleGraph V) d := by
  rw [graph_is_d_immune, graph_has_d_cut]
  rintro ⟨A, hne, hcne, h1, h2⟩
  obtain ⟨u, hu⟩ := hne
  obtain ⟨v, hv⟩ := hcne
  have hvA : v ∉ A := by simpa using hv
  have hAcard : Aᶜ.card ≤ d := by
    have h := h1 u hu
    rw [top_is_d_immune_neighborFinset_top_at] at h
    have hEq : ({u}ᶜ : Finset V) \ A = Aᶜ := by
      ext x
      simp only [Finset.mem_sdiff, Finset.mem_compl, Finset.mem_singleton]
      constructor
      · rintro ⟨_, hx⟩; exact hx
      · intro hx; exact ⟨fun hux => hx (hux ▸ hu), hx⟩
    rwa [hEq] at h
  have hAcard2 : A.card ≤ d := by
    have h := h2 v hv
    rw [top_is_d_immune_neighborFinset_top_at] at h
    have hEq : ({v}ᶜ : Finset V) ∩ A = A := by
      ext x
      simp only [Finset.mem_inter, Finset.mem_compl, Finset.mem_singleton]
      constructor
      · rintro ⟨_, hx⟩; exact hx
      · intro hx; exact ⟨fun hvx => hvA (hvx ▸ hx), hx⟩
    rwa [hEq] at h
  have htot : A.card + Aᶜ.card = Fintype.card V := Finset.card_add_card_compl A
  omega
See it in the graphDiscuss this resultChallenge it