AFTD Auto-Formalizing Theoretical Domains

digraph_residual_subset_out_nbr

theoremverified

For a finite type V with decidable equality, directed graphs G and H of type Digraph V with decidable adjacency relations, and any vertex v : V, the residual set digraph_residual_at G H v is a subset of the closed out-neighborhood digraph_closed_out_nbr H {v}.

Statement

theorem digraph_residual_subset_out_nbr {V : Type*} [Fintype V] [DecidableEq V]
    (G H : Digraph V) [DecidableRel G.Adj] [DecidableRel H.Adj] (v : V) :
    digraph_residual_at G H v ⊆ digraph_closed_out_nbr H {v}
Source
arXiv:2611.32872 p. 3
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • digraph_residual_atFor a finite type V with decidable equality, directed graphs G and H of type Digraph V with decidable adjacency relations, and a vertex v…
  • 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…
Used by 1

Read back from the Lean

For any finite type $V$ with decidable equality, any two directed graphs $G$ and $H$ on $V$ with decidable adjacency relations, and any vertex $v : V$, the residual set digraph_residual_at G H v is a subset of the closed out-neighborhood digraph_closed_out_nbr H {v}.

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

To show that the residual set digraph_residual_at G H v is contained in the closed out-neighborhood digraph_closed_out_nbr H {v}, we consider an arbitrary vertex w in the residual set. By definition of the residual set, any vertex u that is equal to v or has an edge to v in G must either equal w or have an edge to w in H. Specializing this condition to u = v immediately shows that either w = v or v has an edge to w in H. In the former case w is v itself, and in the latter w is an out-neighbor of v in H; in both cases, w lies in the closed out-neighborhood of {v}.

  1. For any vertex w in the residual set of v, either w = v or v has a directed edge to w in H.

    To show the inclusion, let w be an arbitrary element of the residual set digraph_residual_at G H v. By definition, every vertex u that satisfies u = v or G.Adj u v must also satisfy u = w or H.Adj u w. Specializing this condition to u = v (which satisfies the premise since v = v) shows that either v = w or H.Adj v w.

    lines 5–7

    uses Finset.mem_filter, Finset.mem_univ, true_and, Or.inl

      intro w hw
      simp only [digraph_residual_at, Finset.mem_filter, Finset.mem_univ, true_and] at hw
      have h := hw v (Or.inl rfl)
  2. The goal that w belongs to the closed out-neighborhood digraph_closed_out_nbr H {v} reduces to showing that w = v or there exists a vertex x = v such that H.Adj x w.

    Unfolding the definition of the closed out-neighborhood digraph_closed_out_nbr H {v}, an element w belongs to this set if and only if w ∈ {v} (that is, w = v) or w is an out-neighbor in H of some vertex x ∈ {v} (that is, x = v and H.Adj x w).

    lines 8–9

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

      simp only [digraph_closed_out_nbr, Finset.mem_union, Finset.mem_singleton, Finset.mem_filter, Finset.mem_univ,
        true_and]
  3. In either case (v = w or H.Adj v w), w belongs to the closed out-neighborhood of {v} in H.

    We perform a case analysis on the disjunction v = w ∨ H.Adj v w. If v = w (so w = v), the left alternative w = v holds by reflexivity. If instead H.Adj v w, the right alternative holds by choosing x = v as the witness, since v = v and H.Adj v w. Both cases are resolved, completing the proof.

    lines 10–13

      rcases h with rfl | vadj
      · left; rfl
      · right
        exact ⟨v, rfl, vadj⟩
Finset.mem_filter
An element belongs to a filtered finset if and only if it belongs to the base finset and satisfies the filtering predicate.
Finset.mem_univ
Every element of a finite type belongs to the universal finset univ.
true_and
The conjunction True ∧ p simplifies to p.
Or.inl
From a proof of proposition a, infer the disjunction a ∨ b.
Finset.mem_union
An element belongs to the union of two finsets if and only if it belongs to at least one of the two sets.
Finset.mem_singleton
An element belongs to the singleton set {a} if and only if it equals a.

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

/-- The residual R_v at vertex v is contained in the closed out-neighborhood N_H⁺[v]. -/theorem digraph_residual_subset_out_nbr {V : Type*} [Fintype V] [DecidableEq V]    (G H : Digraph V) [DecidableRel G.Adj] [DecidableRel H.Adj] (v : V) :    digraph_residual_at G H v ⊆ digraph_closed_out_nbr H {v} := by  intro w hw  simp only [digraph_residual_at, Finset.mem_filter, Finset.mem_univ, true_and] at hw  have h := hw v (Or.inl rfl)  simp only [digraph_closed_out_nbr, Finset.mem_union, Finset.mem_singleton, Finset.mem_filter, Finset.mem_univ,    true_and]  rcases h with rfl | vadj  · left; rfl  · right    exact ⟨v, rfl, vadj⟩
See it in the graphDiscuss this resultChallenge it