AFTD Auto-Formalizing Theoretical Domains

SignedGraph.switch

def

The switching of a signed graph G at a vertex v is the signed graph with the same underlying graph where the sign of every edge incident to v is negated and all other edge signs remain unchanged.

Statement

def SignedGraph.switch {V : Type*} [DecidableEq V] (G : SignedGraph V) (v : V) : SignedGraph V
Defined in
arXiv:2611.13901, Sec. 2.1
Verified
11 Nov 2026
Axioms
none listed
Built on 1
  • SignedGraphA signed graph on vertex type V consists of an underlying simple graph and a signature assigning to each edge a value in {1, -1}.
Used by 6

Read back from the Lean

Given a type V with decidable equality, a signed graph G on V, and a vertex v : V, SignedGraph.switch G v defines a new signed graph on V whose underlying graph is G.graph, and whose edge sign function assigns - G.sgn e to each edge e containing v (i.e., v ∈ (e : Sym2 V)), and G.sgn e to each edge e not containing v.

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

/-- Switching a signed graph at a vertex negates the signs of incident edges. -/
def SignedGraph.switch {V : Type*} [DecidableEq V] (G : SignedGraph V) (v : V) : SignedGraph V where
  graph := G.graph
  sgn e := if (v ∈ (e : Sym2 V)) then - G.sgn e else G.sgn e
  sgn_mem := by
    intro e
    split_ifs
    · rcases G.sgn_mem e with h | h
      · right; omega
      · left; omega
    · exact G.sgn_mem e
See it in the graphDiscuss this resultChallenge it