AFTD Auto-Formalizing Theoretical Domains

digraph_expansion_submodular

theoremverifiedformalization

For a finite type V with decidable equality, a directed graph G on V with decidable adjacency relation, and any two finite vertex sets X and Y, the expansion function digraph_expansion G is submodular: digraph_expansion G (X ∩ Y) + digraph_expansion G (X ∪ Y) ≤ digraph_expansion G X + digraph_expansion G Y.

Statement

theorem digraph_expansion_submodular {V : Type*} [Fintype V] [DecidableEq V]
    (G : Digraph V) [DecidableRel G.Adj] (X Y : Finset V) :
    digraph_expansion G (X ∩ Y) + digraph_expansion G (X ∪ Y) ≤
      digraph_expansion G X + digraph_expansion G Y
Formalizes
scout/2611-32872-a-short-proof-of-seymour-s-second-neighborhood-conjecture.md:238
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • digraph_expansionFor a finite directed graph G and a vertex subset X, the expansion b(X) is the cardinality of the out-boundary ∂^+ X.
  • digraph_closed_out_nbrFor a finite directed graph G and a vertex subset X, the closed out-neighborhood N_G^+[X] is the union of X and all vertices y such that…

Read back from the Lean

For any finite type V with decidable equality, any directed graph G : Digraph V with decidable adjacency relation G.Adj, and any two finite subsets X, Y : Finset V, the out-boundary expansion of X ∩ Y plus the out-boundary expansion of X ∪ Y is at most the out-boundary expansion of X plus the out-boundary expansion of Y (that is, the out-boundary expansion function is submodular).

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

The proof, explained

The expansion of a vertex set S in a directed graph is defined as the size of its out-boundary, which is its closed out-neighborhood N⁺(S) minus S. Since S ⊆ N⁺(S), this expansion can be expressed simply as |N⁺(S)| - |S|. The proof establishes that closed out-neighborhoods distribute over unions (N⁺(X ∪ Y) = N⁺(X) ∪ N⁺(Y)) and are sub-distributive over intersections (N⁺(X ∩ Y) ⊆ N⁺(X) ∩ N⁺(Y)). Applying the principle of inclusion-exclusion to both the closed out-neighborhoods and the sets X and Y then implies the submodularity inequality via linear arithmetic.

  1. Every vertex set S is a subset of its closed out-neighborhood N⁺(S).

    By definition, the closed out-neighborhood N⁺(S) is S ∪ {y | ∃ x ∈ S, G.Adj x y}. Any z ∈ S belongs to this union via the left disjunct (`Or.inl`).

    lines 1–7

    uses Finset.mem_union, Or.inl

    private lemma digraph_expansion_submodular_subset_closed_out_nbr {V : Type*} [Fintype V] [DecidableEq V]
        (G : Digraph V) [DecidableRel G.Adj] (S : Finset V) :
        S ⊆ digraph_closed_out_nbr G S := by
      intro z hz
      simp only [digraph_closed_out_nbr, Finset.mem_union]
      exact Or.inl hz
    
  2. The closed out-neighborhood of a union is the union of the closed out-neighborhoods: N⁺(X ∪ Y) = N⁺(X) ∪ N⁺(Y). automation

    By set extensionality, an element z is in N⁺(X ∪ Y) if and only if z ∈ X ∪ Y or some vertex in X ∪ Y has an edge to z. Expanding definitions of union and set comprehension, this is equivalent to z ∈ N⁺(X) ∨ z ∈ N⁺(Y), which `aesop` verifies.

    lines 8–15

    uses Finset.mem_union, Finset.mem_filter, Finset.mem_univ, true_and

    private lemma digraph_expansion_submodular_closed_out_nbr_union {V : Type*} [Fintype V] [DecidableEq V]
        (G : Digraph V) [DecidableRel G.Adj] (X Y : Finset V) :
        digraph_closed_out_nbr G (X ∪ Y) = digraph_closed_out_nbr G X ∪ digraph_closed_out_nbr G Y := by
      ext z
      simp only [digraph_closed_out_nbr, Finset.mem_union, Finset.mem_filter, Finset.mem_univ,
        true_and]
      aesop
    
  3. The closed out-neighborhood of an intersection is contained in the intersection of the closed out-neighborhoods: N⁺(X ∩ Y) ⊆ N⁺(X) ∩ N⁺(Y). automation

    If a vertex z is in X ∩ Y or receives an edge from X ∩ Y, then it is in (or receives an edge from) both X and Y. Expanding definitions and simplifying memberships, `aesop` confirms that z ∈ N⁺(X) and z ∈ N⁺(Y).

    lines 16–23

    uses Finset.mem_union, Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_inter

    private lemma digraph_expansion_submodular_closed_out_nbr_inter {V : Type*} [Fintype V] [DecidableEq V]
        (G : Digraph V) [DecidableRel G.Adj] (X Y : Finset V) :
        digraph_closed_out_nbr G (X ∩ Y) ⊆ digraph_closed_out_nbr G X ∩ digraph_closed_out_nbr G Y := by
      intro z hz
      simp only [digraph_closed_out_nbr, Finset.mem_union, Finset.mem_filter, Finset.mem_univ,
        true_and, Finset.mem_inter] at hz ⊢
      aesop
    
  4. For any vertex set S, the expansion of S equals |N⁺(S)| - |S|.

    The out-boundary expansion of S is defined as |N⁺(S) \ S|. Because S ⊆ N⁺(S), `Finset.card_sdiff_of_subset` simplifies this to |N⁺(S)| - |S|.

    lines 24–32

    uses Finset.card_sdiff_of_subset, digraph_expansion_submodular_subset_closed_out_nbr

    /-- The out-boundary expansion function b on vertex finsets of a directed graph is submodular. -/
    theorem digraph_expansion_submodular {V : Type*} [Fintype V] [DecidableEq V]
        (G : Digraph V) [DecidableRel G.Adj] (X Y : Finset V) :
        digraph_expansion G (X ∩ Y) + digraph_expansion G (X ∪ Y) ≤
          digraph_expansion G X + digraph_expansion G Y := by
      have hexp : ∀ S : Finset V, digraph_expansion G S = (digraph_closed_out_nbr G S).card - S.card := by
        intro S
        simp only [digraph_expansion, digraph_out_boundary]
        exact Finset.card_sdiff_of_subset (digraph_expansion_submodular_subset_closed_out_nbr G S)
  5. The submodularity goal is rewritten in terms of cardinalities of closed out-neighborhoods and sets.

    Rewriting with the previous formula replaces digraph_expansion G S with |N⁺(S)| - |S| for each of X ∩ Y, X ∪ Y, X, and Y.

    line 33

      rw [hexp, hexp, hexp, hexp]
  6. The union and intersection relations for closed out-neighborhoods are instantiated, and each set is bounded in size by its closed out-neighborhood.

    The helper lemmas give N⁺(X ∪ Y) = N⁺(X) ∪ N⁺(Y) and N⁺(X ∩ Y) ⊆ N⁺(X) ∩ N⁺(Y). In addition, since S ⊆ N⁺(S), monotonicity of cardinality (`Finset.card_le_card`) yields |S| ≤ |N⁺(S)| for X, Y, X ∩ Y, and X ∪ Y.

    lines 34–43

    uses digraph_expansion_submodular_closed_out_nbr_union, digraph_expansion_submodular_closed_out_nbr_inter, Finset.card_le_card, digraph_expansion_submodular_subset_closed_out_nbr

      have hunion := digraph_expansion_submodular_closed_out_nbr_union G X Y
      have hint := digraph_expansion_submodular_closed_out_nbr_inter G X Y
      have hX : X.card ≤ (digraph_closed_out_nbr G X).card :=
        Finset.card_le_card (digraph_expansion_submodular_subset_closed_out_nbr G X)
      have hY : Y.card ≤ (digraph_closed_out_nbr G Y).card :=
        Finset.card_le_card (digraph_expansion_submodular_subset_closed_out_nbr G Y)
      have hXY : (X ∩ Y).card ≤ (digraph_closed_out_nbr G (X ∩ Y)).card :=
        Finset.card_le_card (digraph_expansion_submodular_subset_closed_out_nbr G (X ∩ Y))
      have hXUY : (X ∪ Y).card ≤ (digraph_closed_out_nbr G (X ∪ Y)).card :=
        Finset.card_le_card (digraph_expansion_submodular_subset_closed_out_nbr G (X ∪ Y))
  7. Inclusion-exclusion identities hold for the closed out-neighborhoods and for X and Y. automation

    By `Finset.card_union_add_card_inter`, |N⁺(X) ∪ N⁺(Y)| + |N⁺(X) ∩ N⁺(Y)| = |N⁺(X)| + |N⁺(Y)| and |X ∪ Y| + |X ∩ Y| = |X| + |Y|. Furthermore, the inclusion N⁺(X ∩ Y) ⊆ N⁺(X) ∩ N⁺(Y) yields |N⁺(X ∩ Y)| ≤ |N⁺(X) ∩ N⁺(Y)|.

    lines 44–53

    uses Finset.card_union_add_card_inter, Finset.card_le_card

      have hcardunion : (digraph_closed_out_nbr G X ∪ digraph_closed_out_nbr G Y).card
          + (digraph_closed_out_nbr G X ∩ digraph_closed_out_nbr G Y).card
          = (digraph_closed_out_nbr G X).card + (digraph_closed_out_nbr G Y).card :=
        Finset.card_union_add_card_inter _ _
      have hintercard : (digraph_closed_out_nbr G (X ∩ Y)).card ≤
          (digraph_closed_out_nbr G X ∩ digraph_closed_out_nbr G Y).card :=
        Finset.card_le_card hint
      have hxycard : (X ∪ Y).card + (X ∩ Y).card = X.card + Y.card := by
        have := Finset.card_union_add_card_inter X Y
        omega
  8. The expansion function is submodular: digraph_expansion G (X ∩ Y) + digraph_expansion G (X ∪ Y) ≤ digraph_expansion G X + digraph_expansion G Y. automation

    Substituting N⁺(X) ∪ N⁺(Y) for N⁺(X ∪ Y), the goal becomes a system of linear inequalities on natural numbers over the established bounds and inclusion-exclusion equalities, which `omega` closes.

    lines 54–55

      rw [hunion] at *
      omega
Or.inl
Infers the disjunction `a ∨ b` from a proof of `a`.
Finset.mem_union
An element belongs to `s ∪ t` if and only if it belongs to `s` or to `t`.
Finset.mem_filter
An element belongs to `Finset.filter p s` if and only if it belongs to `s` and satisfies predicate `p`.
Finset.mem_univ
Every element of a finite type belongs to the universal finset `Finset.univ`.
true_and
The conjunction `True ∧ p` is logically equivalent to `p`.
Finset.mem_inter
An element belongs to `s₁ ∩ s₂` if and only if it belongs to `s₁` and to `s₂`.
Finset.card_sdiff_of_subset
If `s ⊆ t`, the cardinality of the difference `t \ s` equals `t.card - s.card`.
digraph_expansion_submodular_subset_closed_out_nbr
For any vertex set `S` in a directed graph `G`, `S` is a subset of its closed out-neighborhood `digraph_closed_out_nbr G S`.
digraph_expansion_submodular_closed_out_nbr_union
The closed out-neighborhood of `X ∪ Y` equals the union of the closed out-neighborhoods of `X` and `Y`.
digraph_expansion_submodular_closed_out_nbr_inter
The closed out-neighborhood of `X ∩ Y` is a subset of the intersection of the closed out-neighborhoods of `X` and `Y`.
Finset.card_le_card
If `s ⊆ t`, then the cardinality of `s` is at most that of `t`.
Finset.card_union_add_card_inter
For any finsets `s` and `t`, the sum of the cardinalities of `s ∪ t` and `s ∩ t` equals the sum of the cardinalities of `s` and `t`.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

private lemma digraph_expansion_submodular_subset_closed_out_nbr {V : Type*} [Fintype V] [DecidableEq V]    (G : Digraph V) [DecidableRel G.Adj] (S : Finset V) :    S ⊆ digraph_closed_out_nbr G S := by  intro z hz  simp only [digraph_closed_out_nbr, Finset.mem_union]  exact Or.inl hzprivate lemma digraph_expansion_submodular_closed_out_nbr_union {V : Type*} [Fintype V] [DecidableEq V]    (G : Digraph V) [DecidableRel G.Adj] (X Y : Finset V) :    digraph_closed_out_nbr G (X ∪ Y) = digraph_closed_out_nbr G X ∪ digraph_closed_out_nbr G Y := by  ext z  simp only [digraph_closed_out_nbr, Finset.mem_union, Finset.mem_filter, Finset.mem_univ,    true_and]  aesopprivate lemma digraph_expansion_submodular_closed_out_nbr_inter {V : Type*} [Fintype V] [DecidableEq V]    (G : Digraph V) [DecidableRel G.Adj] (X Y : Finset V) :    digraph_closed_out_nbr G (X ∩ Y) ⊆ digraph_closed_out_nbr G X ∩ digraph_closed_out_nbr G Y := by  intro z hz  simp only [digraph_closed_out_nbr, Finset.mem_union, Finset.mem_filter, Finset.mem_univ,    true_and, Finset.mem_inter] at hz ⊢  aesop/-- The out-boundary expansion function b on vertex finsets of a directed graph is submodular. -/theorem digraph_expansion_submodular {V : Type*} [Fintype V] [DecidableEq V]    (G : Digraph V) [DecidableRel G.Adj] (X Y : Finset V) :    digraph_expansion G (X ∩ Y) + digraph_expansion G (X ∪ Y) ≤      digraph_expansion G X + digraph_expansion G Y := by  have hexp : ∀ S : Finset V, digraph_expansion G S = (digraph_closed_out_nbr G S).card - S.card := by    intro S    simp only [digraph_expansion, digraph_out_boundary]    exact Finset.card_sdiff_of_subset (digraph_expansion_submodular_subset_closed_out_nbr G S)  rw [hexp, hexp, hexp, hexp]  have hunion := digraph_expansion_submodular_closed_out_nbr_union G X Y  have hint := digraph_expansion_submodular_closed_out_nbr_inter G X Y  have hX : X.card ≤ (digraph_closed_out_nbr G X).card :=    Finset.card_le_card (digraph_expansion_submodular_subset_closed_out_nbr G X)  have hY : Y.card ≤ (digraph_closed_out_nbr G Y).card :=    Finset.card_le_card (digraph_expansion_submodular_subset_closed_out_nbr G Y)  have hXY : (X ∩ Y).card ≤ (digraph_closed_out_nbr G (X ∩ Y)).card :=    Finset.card_le_card (digraph_expansion_submodular_subset_closed_out_nbr G (X ∩ Y))  have hXUY : (X ∪ Y).card ≤ (digraph_closed_out_nbr G (X ∪ Y)).card :=    Finset.card_le_card (digraph_expansion_submodular_subset_closed_out_nbr G (X ∪ Y))  have hcardunion : (digraph_closed_out_nbr G X ∪ digraph_closed_out_nbr G Y).card      + (digraph_closed_out_nbr G X ∩ digraph_closed_out_nbr G Y).card      = (digraph_closed_out_nbr G X).card + (digraph_closed_out_nbr G Y).card :=    Finset.card_union_add_card_inter _ _  have hintercard : (digraph_closed_out_nbr G (X ∩ Y)).card ≤      (digraph_closed_out_nbr G X ∩ digraph_closed_out_nbr G Y).card :=    Finset.card_le_card hint  have hxycard : (X ∪ Y).card + (X ∩ Y).card = X.card + Y.card := by    have := Finset.card_union_add_card_inter X Y    omega  rw [hunion] at *  omega
See it in the graphDiscuss this resultChallenge it