AFTD Auto-Formalizing Theoretical Domains

required_edges_exhaust_low_ports

theoremverified

If a finite vertex set chooses one incident unordered pair per vertex and covers a set of required unordered pairs whose cardinality equals the number of vertices, every chosen pair is required.

Statement

theorem required_edges_exhaust_low_ports
    {V : Type*} [Fintype V] [DecidableEq V]
    (required : Finset (Sym2 V)) (low : V → V)
    (hcard : required.card = Fintype.card V)
    (hcover : ∀ e ∈ required, ∃ v : V, s(v, low v) = e) :
    ∀ v : V, s(v, low v) ∈ required
Source
Helper for the OP-874 truncation coloring campaign; the concrete instance is independently checked in experiments 33309, 33310, 33320, 33321 and 33322.
Verified
19 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 1

The proof, explained

The proof defines the set of chosen pairs as the image of the vertex set under the map v ↦ s(v, low v). Since every required pair is chosen by assumption, the required pairs form a subset of the chosen pairs. However, the number of chosen pairs is at most the number of vertices, which equals the number of required pairs. By the pigeonhole principle for finite sets of equal size, the required pairs and chosen pairs coincide, meaning every chosen pair is required.

  1. Define the finset of all chosen pairs as the image of V under the low-port map

    Working under classical logic, we introduce `selected` as the finset obtained by mapping each vertex v in the universal finset of V to its chosen pair s(v, low v).

    lines 7–8

      classical
      let selected : Finset (Sym2 V) := Finset.univ.image (fun v : V => s(v, low v))
  2. Every required pair is a chosen pair, so required ⊆ selected

    Given any required pair e, the covering hypothesis `hcover` provides a vertex v such that s(v, low v) = e. Since v belongs to the universal finset, e is in the image `selected`.

    lines 9–12

    uses Finset.mem_image.mpr, Finset.mem_univ

      have hsub : required ⊆ selected := by
        intro e he
        obtain ⟨v, hv⟩ := hcover e he
        exact Finset.mem_image.mpr ⟨v, Finset.mem_univ v, hv⟩
  3. The number of chosen pairs is at most the number of required pairs

    The cardinality of `selected` is bounded by the cardinality of the domain `Finset.univ`, which equals the number of vertices |V|. By the hypothesis `hcard`, |V| equals the cardinality of `required`.

    lines 13–17

    uses Finset.card_image_le, Finset.card_univ

      have hsize : selected.card ≤ required.card := by
        calc
          selected.card ≤ (Finset.univ : Finset V).card := Finset.card_image_le
          _ = Fintype.card V := Finset.card_univ
          _ = required.card := hcard.symm
  4. The set of required pairs equals the set of chosen pairs

    Since `required` is a subset of `selected` and `selected` has cardinality at most that of `required`, the two finite sets must be equal.

    line 18

    uses Finset.eq_of_subset_of_card_le

      have heq : required = selected := Finset.eq_of_subset_of_card_le hsub hsize
  5. For every vertex v, the chosen pair s(v, low v) is in required

    Let v be any vertex. By definition, s(v, low v) belongs to `selected`. Since `required = selected`, it follows that s(v, low v) belongs to `required`.

    lines 19–21

    uses Finset.mem_image.mpr, Finset.mem_univ

      intro v
      rw [heq]
      exact Finset.mem_image.mpr ⟨v, Finset.mem_univ v, rfl⟩
Finset.mem_image.mpr
An element is in the image of a finset under a function if it is the image of some element in the finset
Finset.mem_univ
Every element of a finite type belongs to the universal finset
Finset.card_image_le
The cardinality of the image of a finset under a function is at most the cardinality of the finset
Finset.card_univ
The cardinality of the universal finset of a finite type equals the cardinality of the type
Finset.eq_of_subset_of_card_le
If a finset is a subset of another finset whose cardinality is less than or equal to its own, the two finsets are equal

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 required_edges_exhaust_low_ports    {V : Type*} [Fintype V] [DecidableEq V]    (required : Finset (Sym2 V)) (low : V → V)    (hcard : required.card = Fintype.card V)    (hcover : ∀ e ∈ required, ∃ v : V, s(v, low v) = e) :    ∀ v : V, s(v, low v) ∈ required := by  classical  let selected : Finset (Sym2 V) := Finset.univ.image (fun v : V => s(v, low v))  have hsub : required ⊆ selected := by    intro e he    obtain ⟨v, hv⟩ := hcover e he    exact Finset.mem_image.mpr ⟨v, Finset.mem_univ v, hv⟩  have hsize : selected.card ≤ required.card := by    calc      selected.card ≤ (Finset.univ : Finset V).card := Finset.card_image_le      _ = Fintype.card V := Finset.card_univ      _ = required.card := hcard.symm  have heq : required = selected := Finset.eq_of_subset_of_card_le hsub hsize  intro v  rw [heq]  exact Finset.mem_image.mpr ⟨v, Finset.mem_univ v, rfl⟩
See it in the graphDiscuss this resultChallenge it