The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V30. Combinatorics

Mathlib.Combinatorics.SimpleGraph.Operations

37 declarations and 2 deprecated aliases. Mathlib docs · Source

def SimpleGraph.replaceVertex E1 #

{V : Type u_1} → SimpleGraph V → V → V → [DecidableEq V] → SimpleGraph V

The graph formed by forgetting t's neighbours and instead giving it those of s. The s-t edge is removed if present.

theorem SimpleGraph.not_adj_replaceVertex_same E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (s t : V) [inst : DecidableEq V], ¬(G.replaceVertex s t).Adj s t

There is never an s-t edge in G.replaceVertex s t.

theorem SimpleGraph.replaceVertex_self E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (s : V) [inst : DecidableEq V], G.replaceVertex s s = G

theorem SimpleGraph.adj_replaceVertex_iff_of_ne_left E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (s : V) {t : V} [inst : DecidableEq V] {w : V},
  w ≠ t → ((G.replaceVertex s t).Adj s w ↔ G.Adj s w)

Except possibly for t, the neighbours of s in G.replaceVertex s t are its neighbours in G.

theorem SimpleGraph.adj_replaceVertex_iff_of_ne_right E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (s : V) {t : V} [inst : DecidableEq V] {w : V},
  w ≠ t → ((G.replaceVertex s t).Adj t w ↔ G.Adj s w)

Except possibly for itself, the neighbours of t in G.replaceVertex s t are the neighbours of s in G.

theorem SimpleGraph.adj_replaceVertex_iff_of_ne E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (s : V) {t : V} [inst : DecidableEq V] {v w : V},
  v ≠ t → w ≠ t → ((G.replaceVertex s t).Adj v w ↔ G.Adj v w)

Adjacency in G.replaceVertex s t which does not involve t is the same as that of G.

theorem SimpleGraph.edgeSet_replaceVertex_of_not_adj E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {s t : V} [inst : DecidableEq V],
  ¬G.Adj s t → (G.replaceVertex s t).edgeSet = G.edgeSet \ G.incidenceSet t ∪ (fun x ↦ s(x, t)) '' G.neighborSet s

theorem SimpleGraph.edgeSet_replaceVertex E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {s t : V} [inst : DecidableEq V],
  (G.replaceVertex s t).edgeSet = (G.edgeSet \ G.incidenceSet t ∪ (fun x ↦ s(x, t)) '' G.neighborSet s) \ {s(t, t)}

instance SimpleGraph.instDecidableRelAdjReplaceVertex E0 #

{V : Type u_1} →
  (G : SimpleGraph V) →
    {s t : V} → [inst : DecidableEq V] → [DecidableRel G.Adj] → DecidableRel (G.replaceVertex s t).Adj

theorem SimpleGraph.edgeFinset_replaceVertex_of_not_adj E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {s t : V} [inst : DecidableEq V] [inst_1 : Fintype V]
  [inst_2 : DecidableRel G.Adj],
  ¬G.Adj s t →
    (G.replaceVertex s t).edgeFinset =
      G.edgeFinset \ G.incidenceFinset t ∪ Finset.image (fun x ↦ s(x, t)) (G.neighborFinset s)

theorem SimpleGraph.edgeFinset_replaceVertex E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {s t : V} [inst : DecidableEq V] [inst_1 : Fintype V]
  [inst_2 : DecidableRel G.Adj],
  (G.replaceVertex s t).edgeFinset =
    (G.edgeFinset \ G.incidenceFinset t ∪ Finset.image (fun x ↦ s(x, t)) (G.neighborFinset s)) \ {s(t, t)}

theorem SimpleGraph.disjoint_sdiff_neighborFinset_image E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {s t : V} [inst : DecidableEq V] [inst_1 : Fintype V]
  [inst_2 : DecidableRel G.Adj],
  Disjoint (G.edgeFinset \ G.incidenceFinset t) (Finset.image (fun x ↦ s(x, t)) (G.neighborFinset s))

theorem SimpleGraph.card_edgeFinset_replaceVertex_of_not_adj E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {s t : V} [inst : DecidableEq V] [inst_1 : Fintype V]
  [inst_2 : DecidableRel G.Adj],
  ¬G.Adj s t → (G.replaceVertex s t).edgeFinset.card = G.edgeFinset.card + G.degree s - G.degree t

theorem SimpleGraph.card_edgeFinset_replaceVertex_of_adj E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {s t : V} [inst : DecidableEq V] [inst_1 : Fintype V]
  [inst_2 : DecidableRel G.Adj],
  G.Adj s t → (G.replaceVertex s t).edgeFinset.card = G.edgeFinset.card + G.degree s - G.degree t - 1

def SimpleGraph.edge E1 #

{V : Type u_1} → V → V → SimpleGraph V

The graph with a single s-t edge. It is empty iff s = t.

theorem SimpleGraph.edge_adj E1 #

∀ {V : Type u_1} (s t v w : V), (SimpleGraph.edge s t).Adj v w ↔ (v = s ∧ w = t ∨ v = t ∧ w = s) ∧ v ≠ w

theorem SimpleGraph.adj_edge E1 #

∀ {V : Type u_1} (s t : V) {v w : V}, (SimpleGraph.edge s t).Adj v w ↔ s(s, t) = s(v, w) ∧ v ≠ w

theorem SimpleGraph.edge_comm E1 #

∀ {V : Type u_1} (s t : V), SimpleGraph.edge s t = SimpleGraph.edge t s

theorem SimpleGraph.edge_le E0 #

∀ {V : Type u_1} (G : SimpleGraph V) (s t : V), SimpleGraph.edge s t ≤ G ↔ {s(s, t)} \ Sym2.diagSet ⊆ G.edgeSet

instance SimpleGraph.instDecidableRelAdjEdge E0 #

{V : Type u_1} → (s t : V) → [DecidableEq V] → DecidableRel (SimpleGraph.edge s t).Adj

theorem SimpleGraph.edge_self_eq_bot E0 #

∀ {V : Type u_1} (s : V), SimpleGraph.edge s s = ⊥

theorem SimpleGraph.sup_edge_self E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (s : V), G ⊔ SimpleGraph.edge s s = G

theorem SimpleGraph.lt_sup_edge E1 #

∀ {V : Type u_1} (G : SimpleGraph V) (s t : V), s ≠ t → ¬G.Adj s t → G < G ⊔ SimpleGraph.edge s t

theorem SimpleGraph.edge_le_iff E0 #

∀ {V : Type u_1} (G : SimpleGraph V) {v w : V}, SimpleGraph.edge v w ≤ G ↔ v = w ∨ G.Adj v w

theorem SimpleGraph.edgeSet_edge E0 #

∀ {V : Type u_1} (v w : V), (SimpleGraph.edge v w).edgeSet = {s(v, w)} \ Sym2.diagSet

theorem SimpleGraph.edgeSet_edge_subset E1 #

∀ {V : Type u_1} {v w : V}, (SimpleGraph.edge v w).edgeSet ⊆ {s(v, w)}

theorem SimpleGraph.edgeSet_edge_of_ne E1 #

∀ {V : Type u_1} {s t : V}, s ≠ t → (SimpleGraph.edge s t).edgeSet = {s(s, t)}

theorem SimpleGraph.sup_edge_of_adj E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {s t : V}, G.Adj s t → G ⊔ SimpleGraph.edge s t = G

theorem SimpleGraph.deleteEdges_edge E0 #

∀ {V : Type u_1} {u v : V} {s : Set (Sym2 V)}, s(u, v) ∈ s → (SimpleGraph.edge u v).deleteEdges s = ⊥

theorem SimpleGraph.disjoint_edge E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {u v : V}, Disjoint G (SimpleGraph.edge u v) ↔ ¬G.Adj u v

theorem SimpleGraph.sdiff_edge E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {u v : V}, ¬G.Adj u v → G \ SimpleGraph.edge u v = G

theorem SimpleGraph.biSup_fromEdgeSet_singleton_eq E0 #

∀ {V : Type u_1} (G : SimpleGraph V), ⨆ e ∈ G.edgeSet, SimpleGraph.fromEdgeSet {e} = G

theorem SimpleGraph.sSup_edge_eq E0 #

∀ {V : Type u_1} (G : SimpleGraph V), sSup {x | ∃ u v, ∃ (_ : G.Adj u v), SimpleGraph.edge u v = x} = G

theorem SimpleGraph.Subgraph.spanningCoe_sup_edge_le E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {s t : V} {H : (G ⊔ SimpleGraph.edge s t).Subgraph}, ¬H.Adj s t → H.spanningCoe ≤ G

instance SimpleGraph.instFintypeElemSym2EdgeSetEdge E0 #

{V : Type u_1} → {s t : V} → [DecidableEq V] → Fintype ↑(SimpleGraph.edge s t).edgeSet

theorem SimpleGraph.edgeFinset_sup_edge E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {s t : V} [inst : Fintype V] [inst_1 : DecidableRel G.Adj]
  [inst_2 : Fintype ↑(G ⊔ SimpleGraph.edge s t).edgeSet] (hn : ¬G.Adj s t),
  s ≠ t → (G ⊔ SimpleGraph.edge s t).edgeFinset = Finset.cons s(s, t) G.edgeFinset ⋯

theorem SimpleGraph.card_edgeFinset_sup_edge E1 #

∀ {V : Type u_1} (G : SimpleGraph V) {s t : V} [inst : Fintype V] [inst_1 : DecidableRel G.Adj]
  [inst_2 : Fintype ↑(G ⊔ SimpleGraph.edge s t).edgeSet],
  ¬G.Adj s t → s ≠ t → (G ⊔ SimpleGraph.edge s t).edgeFinset.card = G.edgeFinset.card + 1

Deprecated aliases

NameNew nameSince
SimpleGraph.edgeFinset_replaceVertex_of_adjSimpleGraph.edgeFinset_replaceVertex2026-10-31
SimpleGraph.edgeSet_replaceVertex_of_adjSimpleGraph.edgeSet_replaceVertex2026-10-31