AFTD Auto-Formalizing Theoretical Domains

add_pendant_edge

def

The simple graph obtained from a graph H on vertices W by attaching a new pendant edge at a designated vertex c in W, with the new vertex represented by none.

Statement

def add_pendant_edge {W : Type*} (H : SimpleGraph W) (c : W) : SimpleGraph (Option W)
Defined in
arXiv:2610.15145 Section 5.2
Verified
24 Oct 2026
Axioms
none listed

Read back from the Lean

Given a type W, a simple graph H on vertex type W, and a vertex c : W, add_pendant_edge H c defines the simple graph on vertex type Option W with adjacency relation Adj defined by: - Adj (some w₁) (some w₂) := H.Adj w₁ w₂ - Adj none (some w) := (w = c) - Adj (some w) none := (w = c) - Adj none none := False

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

Lean source view module on GitHub

/-- The graph obtained from H by attaching a new pendant edge at vertex c (represented on vertex type Option W). -/
def add_pendant_edge {W : Type*} (H : SimpleGraph W) (c : W) : SimpleGraph (Option W) := {
  Adj := fun u v => match u, v with
    | some w₁, some w₂ => H.Adj w₁ w₂
    | none, some w => w = c
    | some w, none => w = c
    | none, none => False
  symm := ⟨by
    rintro (_ | u) (_ | v) h
    · contradiction
    · exact (h : v = c)
    · exact (h : u = c)
    · exact H.adj_symm h⟩
  loopless := ⟨by
    rintro (_ | u) h
    · contradiction
    · exact H.loopless.irrefl u h⟩
}
See it in the graphDiscuss this resultChallenge it