AFTD Auto-Formalizing Theoretical Domains

op309_canonical_clean_component_class_confined

theoremverified

If every outside edge meeting a selected component also has an uncovered endpoint, canonical port equalities cannot propagate from an outside edge meeting that component to an edge that misses it.

Statement

theorem op309_canonical_clean_component_class_confined
    {V A : Type*} [Fintype V] [DecidableEq V]
    (G : SimpleGraph V) [DecidableRel G.Adj] (R : Finset G.edgeSet)
    (q : Sum G.edgeSet (V × Fin 3) → A)
    (hq : op309_canonical_padded_port_classes G R q)
    (v : V) (hv : ∃ e ∈ R, v ∈ e.1)
    (hclean : ∀ z : G.edgeSet, z ∉ R →
      (∃ a : V, a ∈ z.1 ∧ (op309_selected_edge_graph G R).Reachable v a) →
      ∃ u : V, u ∈ z.1 ∧ ∀ e ∈ R, u ∉ e.1)
    (e f : G.edgeSet) (he : e ∉ R) (hf : f ∉ R)
    (heC : ∃ a : V, a ∈ e.1 ∧ (op309_selected_edge_graph G R).Reachable v a)
    (heq : q (.inl e) = q (.inl f)) :
    ∃ a : V, a ∈ f.1 ∧ (op309_selected_edge_graph G R).Reachable v a
Source
OP-309 canonical-port high-girth clean-component argument.
Verified
27 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3

The proof, explained

The theorem is proved by induction along the chain of canonical port equivalences connecting the outside edges e and f. First, we show that every vertex reachable from v in the selected-edge subgraph H is covered by an edge in R; consequently, every clean outside edge meeting the component of v has a unique covered endpoint, which must be in v's component. In each transition step of the equivalence chain between edges y and z, the step relation connects a covered endpoint of y to a covered endpoint of z via a path in H. By the induction hypothesis and the endpoint uniqueness lemma, the endpoint in y is reachable from v, so reachability propagates along the path to the endpoint in z.

  1. Introduce the selected-edge subgraph H spanned by the edges in R.

    We enable classical logic and define H to be the subgraph whose edges are precisely those in the selected set R.

    lines 14–15

      classical
      let H := op309_selected_edge_graph G R
  2. Every vertex reachable from v in H is incident to at least one edge of R.

    Let x be reachable from v in H. If x = v, it is covered by R by the initial hypothesis hv. If x ≠ v, any path from v to x in H ends with an edge between x and some neighbor w. Because H is induced by R, the edge {x, w} corresponds to some selected edge g ∈ R, which makes x an endpoint of g.

    lines 16–29

    uses Ne.symm, SimpleGraph.fromEdgeSet_adj, Finset.mem_image.mp

      have hcov : ∀ x : V, H.Reachable v x → ∃ g ∈ R, x ∈ g.1 := by
        intro x hx
        by_cases h : x = v
        · subst x
          exact hv
        · have hne : v ≠ x := Ne.symm h
          obtain ⟨w, hw⟩ := hx.nonempty_neighborSet_right hne
          have hm : s(x,w) ∈ R.image Subtype.val := by
            change (SimpleGraph.fromEdgeSet (↑(R.image Subtype.val) : Set (Sym2 V))).Adj x w at hw
            exact ((SimpleGraph.fromEdgeSet_adj _).mp hw).1
          obtain ⟨g, hg, hgw⟩ := Finset.mem_image.mp hm
          refine ⟨g, hg, ?_⟩
          rw [hgw]
          simp
  3. For any outside edge z ∉ R meeting the connected component of v in H, any endpoint of z covered by R must lie in that component.

    Suppose z has an endpoint a reachable from v, and let x ∈ z be any endpoint covered by R. By the cleanliness hypothesis hclean, z has an uncovered endpoint u (incident to no edge in R). Since x is covered, x ≠ u; and since a is reachable from v, our coverage lemma implies a is covered, so a ≠ u. Since the edge z = {a, y} has only two endpoints and u ≠ a, the uncovered endpoint must be u = y. Because x ≠ u = y, x must be a, which is reachable from v.

    lines 30–51

    uses Sym2.mem_iff_exists.mp, Sym2.mem_iff, False.elim

      have hstay (z : G.edgeSet) (hz : z ∉ R)
          (hm : ∃ a : V, a ∈ z.1 ∧ H.Reachable v a)
          (x : V) (hx : x ∈ z.1) (hxc : ∃ g ∈ R, x ∈ g.1) : H.Reachable v x := by
        obtain ⟨a, ha, hva⟩ := hm
        obtain ⟨u, hu, hu0⟩ := hclean z hz ⟨a, ha, hva⟩
        have hxu : x ≠ u := by
          intro h
          subst x
          obtain ⟨g, hg, hxg⟩ := hxc
          exact hu0 g hg hxg
        have hau : a ≠ u := by
          intro h
          subst a
          obtain ⟨g, hg, hug⟩ := hcov u hva
          exact hu0 g hg hug
        obtain ⟨y, hy⟩ := Sym2.mem_iff_exists.mp ha
        rw [hy, Sym2.mem_iff] at hu hx
        rcases hu with hua | huy
        · exact False.elim (hau hua.symm)
        · rcases hx with hxa | hxy
          · simpa [hxa] using hva
          · exact False.elim (hxu (hxy.trans huy.symm))
  4. The outside edges e and f are connected by a reflexive-transitive chain of canonical port transitions.

    By the definition of canonical padded port classes, the port equality q(e) = q(f) implies that e and f are connected by a sequence of single-step transitions in the reflexive-transitive closure. We instantiate this chain and clear the hypotheses that are no longer needed.

    lines 52–53

      have hc := hq e f he hf heq
      clear hf heq hq
  5. The base case of zero transitions holds immediately.

    We induct on the chain of port transitions. In the base case of zero steps, f = e, and e meets the component of v by assumption heC.

    lines 54–55

      induction hc with
      | refl => exact heC
  6. The property propagates across each single transition step, completing the induction.

    In the inductive step, assume the property holds for an edge y and consider a transition step from y to z. The step definition provides endpoints a ∈ y and b ∈ z that are both covered by R and connected by a path in H. By our earlier lemma, since y meets the component of v and a is covered by R, a is reachable from v. Concatenating the path from v to a with the path from a to b shows that b ∈ z is reachable from v, so z also meets the component.

    lines 56–62

    uses Finset.mem_filter.mp

      | tail hxy hyz ih =>
        rcases hyz with ⟨hy, hz, hyzq, a, b, hay, hbz, hac, hbc, hab⟩
        have hca : ∃ g ∈ R, a ∈ g.1 := by
          obtain ⟨g, hg⟩ := hac
          exact ⟨g, (Finset.mem_filter.mp hg).1, (Finset.mem_filter.mp hg).2⟩
        have hva : H.Reachable v a := hstay _ hy ih a hay hca
        exact ⟨b, hbz, hva.trans hab⟩
Ne.symm
Symmetry of inequality: if a ≠ b, then b ≠ a.
SimpleGraph.fromEdgeSet_adj
Two vertices v and w are adjacent in the graph induced by an edge set s if and only if {v, w} ∈ s and v ≠ w.
Finset.mem_image.mp
An element is in the image of a finite set under a function f if and only if it equals f(a) for some element a in that set.
Sym2.mem_iff_exists.mp
A vertex x belongs to an unordered pair z if and only if z = {x, y} for some vertex y.
Sym2.mem_iff
A vertex a belongs to the unordered pair {b, c} if and only if a = b or a = c.
False.elim
From a contradiction (False), any statement follows.
Finset.mem_filter.mp
If an element belongs to a filtered finite set, then it belongs to the original set and satisfies the filter predicate.

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 op309_canonical_clean_component_class_confined    {V A : Type*} [Fintype V] [DecidableEq V]    (G : SimpleGraph V) [DecidableRel G.Adj] (R : Finset G.edgeSet)    (q : Sum G.edgeSet (V × Fin 3) → A)    (hq : op309_canonical_padded_port_classes G R q)    (v : V) (hv : ∃ e ∈ R, v ∈ e.1)    (hclean : ∀ z : G.edgeSet, z ∉ R →      (∃ a : V, a ∈ z.1 ∧ (op309_selected_edge_graph G R).Reachable v a) →      ∃ u : V, u ∈ z.1 ∧ ∀ e ∈ R, u ∉ e.1)    (e f : G.edgeSet) (he : e ∉ R) (hf : f ∉ R)    (heC : ∃ a : V, a ∈ e.1 ∧ (op309_selected_edge_graph G R).Reachable v a)    (heq : q (.inl e) = q (.inl f)) :    ∃ a : V, a ∈ f.1 ∧ (op309_selected_edge_graph G R).Reachable v a := by  classical  let H := op309_selected_edge_graph G R  have hcov : ∀ x : V, H.Reachable v x → ∃ g ∈ R, x ∈ g.1 := by    intro x hx    by_cases h : x = v    · subst x      exact hv    · have hne : v ≠ x := Ne.symm h      obtain ⟨w, hw⟩ := hx.nonempty_neighborSet_right hne      have hm : s(x,w) ∈ R.image Subtype.val := by        change (SimpleGraph.fromEdgeSet (↑(R.image Subtype.val) : Set (Sym2 V))).Adj x w at hw        exact ((SimpleGraph.fromEdgeSet_adj _).mp hw).1      obtain ⟨g, hg, hgw⟩ := Finset.mem_image.mp hm      refine ⟨g, hg, ?_⟩      rw [hgw]      simp  have hstay (z : G.edgeSet) (hz : z ∉ R)      (hm : ∃ a : V, a ∈ z.1 ∧ H.Reachable v a)      (x : V) (hx : x ∈ z.1) (hxc : ∃ g ∈ R, x ∈ g.1) : H.Reachable v x := by    obtain ⟨a, ha, hva⟩ := hm    obtain ⟨u, hu, hu0⟩ := hclean z hz ⟨a, ha, hva⟩    have hxu : x ≠ u := by      intro h      subst x      obtain ⟨g, hg, hxg⟩ := hxc      exact hu0 g hg hxg    have hau : a ≠ u := by      intro h      subst a      obtain ⟨g, hg, hug⟩ := hcov u hva      exact hu0 g hg hug    obtain ⟨y, hy⟩ := Sym2.mem_iff_exists.mp ha    rw [hy, Sym2.mem_iff] at hu hx    rcases hu with hua | huy    · exact False.elim (hau hua.symm)    · rcases hx with hxa | hxy      · simpa [hxa] using hva      · exact False.elim (hxu (hxy.trans huy.symm))  have hc := hq e f he hf heq  clear hf heq hq  induction hc with  | refl => exact heC  | tail hxy hyz ih =>    rcases hyz with ⟨hy, hz, hyzq, a, b, hay, hbz, hac, hbc, hab⟩    have hca : ∃ g ∈ R, a ∈ g.1 := by      obtain ⟨g, hg⟩ := hac      exact ⟨g, (Finset.mem_filter.mp hg).1, (Finset.mem_filter.mp hg).2⟩    have hva : H.Reachable v a := hstay _ hy ih a hay hca    exact ⟨b, hbz, hva.trans hab⟩
See it in the graphDiscuss this resultChallenge it