AFTD Auto-Formalizing Theoretical Domains

even_total_reservoir_absorbs_into_shore

theoremverified

In the displayed even-size union of two odd shores and an anticomplete reservoir, the reservoir may be absorbed into the second shore while preserving oddness, total size and the unique crossing-edge condition.

Statement

theorem even_total_reservoir_absorbs_into_shore
    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
    (X Y U : Finset V) (x y : V) (k : ℕ)
    (hXY : Disjoint X Y) (hXU : Disjoint X U) (hYU : Disjoint Y U)
    (hsize : X.card+Y.card+U.card=2*k)
    (hx : x ∈ X) (hy : y ∈ Y)
    (hcross : ∀ a ∈ X, ∀ b ∈ Y, G.Adj a b → a=x ∧ b=y)
    (hanti : ∀ a ∈ U, ∀ b ∈ X, ¬ G.Adj a b)
    (hoddX : Odd X.card) (hoddY : Odd Y.card) :
    Disjoint X (Y ∪ U) ∧ X.card+(Y ∪ U).card=2*k ∧
    x ∈ X ∧ y ∈ Y ∪ U ∧ Odd (Y ∪ U).card ∧
    (∀ a ∈ X, ∀ b ∈ Y ∪ U, G.Adj a b → a=x ∧ b=y)
Source
OP-1957; saturated barrier graph-to-count reduction.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

The theorem absorbs an anticomplete reservoir U into an odd shore Y, forming Y ∪ U, while preserving all configuration invariants. Because the total size |X| + |Y| + |U| = 2k is even and |X| and |Y| are odd, parity forcing ensures that |U| is even; hence |Y ∪ U| = |Y| + |U| remains odd and the combined size |X| + |Y ∪ U| remains 2k. Since X is disjoint from both Y and U, it is disjoint from Y ∪ U. Finally, because U has no edges to X, any edge between X and Y ∪ U must connect X and Y, preserving the unique crossing edge between x and y.

  1. The cardinality of the reservoir U is even.

    Because |X| and |Y| are odd, they can be written as 2a + 1 and 2b + 1 for natural numbers a and b. By Nat.even_or_odd, |U| is either even or odd. If |U| were odd, say 2c + 1, the total size |X| + |Y| + |U| would equal 2a + 2b + 2c + 3, which cannot equal the even number 2k. Linear arithmetic (omega) derives a contradiction in this case, establishing that |U| is even.

    lines 13–20

    uses Nat.even_or_odd

      classical
      have hu : Even U.card := by
        obtain ⟨a,ha⟩ := hoddX
        obtain ⟨b,hb⟩ := hoddY
        rcases Nat.even_or_odd U.card with h | h
        · exact h
        · obtain ⟨c,hc⟩ := h
          omega
  2. The combined shore Y ∪ U has odd cardinality.

    Since Y and U are disjoint, the cardinality of their union is |Y| + |U| by Finset.card_union_of_disjoint. Because |Y| is odd and |U| is even, their sum is odd.

    lines 21–23

    uses Finset.card_union_of_disjoint

      have hyu : Odd (Y ∪ U).card := by
        rw [Finset.card_union_of_disjoint hYU]
        exact hoddY.add_even hu
  3. The sum of the cardinalities of X and Y ∪ U equals 2k.

    Rewriting |Y ∪ U| as |Y| + |U| using Finset.card_union_of_disjoint, the expression |X| + |Y ∪ U| simplifies to |X| + |Y| + |U|, which equals 2k by the assumption hsize.

    lines 24–26

    uses Finset.card_union_of_disjoint

      have hsz : X.card+(Y ∪ U).card=2*k := by
        rw [Finset.card_union_of_disjoint hYU]
        omega
  4. The goal reduces to showing that X is disjoint from Y ∪ U and that the crossing edge between X and Y ∪ U is unique.

    We instantiate the main conjunction with the facts already established: total size 2k (hsz), vertex membership x ∈ X (hx), membership y ∈ Y ∪ U via Finset.mem_union_left, and oddness of |Y ∪ U| (hyu). This leaves two goals: disjointness of X and Y ∪ U, and the uniqueness of edges between X and Y ∪ U.

    line 27

    uses Finset.mem_union_left

      refine ⟨?_,hsz,hx,Finset.mem_union_left U hy,hyu,?_⟩
  5. X and Y ∪ U are disjoint.

    By Finset.disjoint_left.mpr, it suffices to show that no vertex z ∈ X belongs to Y ∪ U. Given z ∈ Y ∪ U, Finset.mem_union.mp splits into two cases: z ∈ Y or z ∈ U. The case z ∈ Y contradicts the disjointness of X and Y (Finset.disjoint_left.mp hXY), while z ∈ U contradicts the disjointness of X and U (Finset.disjoint_left.mp hXU).

    lines 28–32

    uses Finset.disjoint_left.mpr, Finset.mem_union.mp, Finset.disjoint_left.mp

      · apply Finset.disjoint_left.mpr
        intro z hzx hz
        rcases Finset.mem_union.mp hz with hzy | hzu
        · exact Finset.disjoint_left.mp hXY hzx hzy
        · exact Finset.disjoint_left.mp hXU hzx hzu
  6. The only edge between X and Y ∪ U is the edge between x and y.

    Let a ∈ X and b ∈ Y ∪ U be adjacent. By Finset.mem_union.mp, either b ∈ Y or b ∈ U. If b ∈ Y, the hypothesis hcross implies a = x and b = y. If b ∈ U, the symmetry of adjacency means there is an edge between U and X, contradicting the anticompleteness hypothesis hanti; this contradiction is discharged by False.elim.

    lines 33–36

    uses Finset.mem_union.mp, False.elim

      · intro a ha b hb hab
        rcases Finset.mem_union.mp hb with hb | hb
        · exact hcross a ha b hb hab
        · exact False.elim (hanti b hb a ha hab.symm)
Nat.even_or_odd
Every natural number is either even or odd.
Finset.card_union_of_disjoint
The cardinality of the union of two disjoint finite sets is the sum of their cardinalities.
Finset.mem_union_left
An element of a finite set s is also an element of s ∪ t.
Finset.disjoint_left.mpr
If no element of s belongs to t, then s and t are disjoint.
Finset.disjoint_left.mp
If two finite sets s and t are disjoint, no element of s belongs to t.
Finset.mem_union.mp
If an element belongs to the union s ∪ t, then it belongs to s or to t.
False.elim
From a contradiction, any proposition follows (ex falso quodlibet).

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

theorem even_total_reservoir_absorbs_into_shore    {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)    (X Y U : Finset V) (x y : V) (k : ℕ)    (hXY : Disjoint X Y) (hXU : Disjoint X U) (hYU : Disjoint Y U)    (hsize : X.card+Y.card+U.card=2*k)    (hx : x ∈ X) (hy : y ∈ Y)    (hcross : ∀ a ∈ X, ∀ b ∈ Y, G.Adj a b → a=x ∧ b=y)    (hanti : ∀ a ∈ U, ∀ b ∈ X, ¬ G.Adj a b)    (hoddX : Odd X.card) (hoddY : Odd Y.card) :    Disjoint X (Y ∪ U) ∧ X.card+(Y ∪ U).card=2*k ∧    x ∈ X ∧ y ∈ Y ∪ U ∧ Odd (Y ∪ U).card ∧    (∀ a ∈ X, ∀ b ∈ Y ∪ U, G.Adj a b → a=x ∧ b=y) := by  classical  have hu : Even U.card := by    obtain ⟨a,ha⟩ := hoddX    obtain ⟨b,hb⟩ := hoddY    rcases Nat.even_or_odd U.card with h | h    · exact h    · obtain ⟨c,hc⟩ := h      omega  have hyu : Odd (Y ∪ U).card := by    rw [Finset.card_union_of_disjoint hYU]    exact hoddY.add_even hu  have hsz : X.card+(Y ∪ U).card=2*k := by    rw [Finset.card_union_of_disjoint hYU]    omega  refine ⟨?_,hsz,hx,Finset.mem_union_left U hy,hyu,?_⟩  · apply Finset.disjoint_left.mpr    intro z hzx hz    rcases Finset.mem_union.mp hz with hzy | hzu    · exact Finset.disjoint_left.mp hXY hzx hzy    · exact Finset.disjoint_left.mp hXU hzx hzu  · intro a ha b hb hab    rcases Finset.mem_union.mp hb with hb | hb    · exact hcross a ha b hb hab    · exact False.elim (hanti b hb a ha hab.symm)
See it in the graphDiscuss this resultChallenge it