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.Graph.Simple

30 declarations. Mathlib docs · Source

Simple graphs

This file defines two type classes for graphs Graph α β: Loopless and Simple.

Main definitions

  • Loopless: a graph is loopless if it has no loops
  • Simple: a graph is simple if it has no multiple edges between the same pair of vertices
  • toSimpleGraph: a function that constructs a SimpleGraph V(G) from a Graph G
  • ofSimpleGraph: a function that constructs a Graph α (Sym2 α) from a SimpleGraph α

TODO: Show ofSimpleGraph (toSimpleGraph G) is isomorphic to G when isomorphism on Graph is defined.

class Graph.Loopless E3 #

{α : Type u_1} → {β : Type u_2} → Graph α β → Prop

A loopless graph is one where the ends of every edge are distinct.

theorem Graph.loopless_iff E0 #

∀ {α : Type u_1} {β : Type u_2} (G : Graph α β), G.Loopless ↔ ∀ (e : β) (x : α), ¬G.IsLoopAt e x

ctor Graph.Loopless.mk E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, (∀ (e : β) (x : α), ¬G.IsLoopAt e x) → G.Loopless

theorem Graph.Loopless.not_isLoopAt E1 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} [self : G.Loopless] (e : β) (x : α), ¬G.IsLoopAt e x

theorem Graph.not_isLoopAt E0 #

∀ {α : Type u_1} {β : Type u_2} (G : Graph α β) [G.Loopless] (e : β) (x : α), ¬G.IsLoopAt e x

theorem Graph.not_adj_self E1 #

∀ {α : Type u_1} {β : Type u_2} (G : Graph α β) [G.Loopless] (x : α), ¬G.Adj x x

theorem Graph.Adj.ne E1 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} {u v : α} [G.Loopless], G.Adj u v → u ≠ v

theorem Graph.IsLink.ne E1 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} {u v : α} {e : β} [G.Loopless], G.IsLink e u v → u ≠ v

theorem Graph.loopless_iff_forall_ne_of_adj E1 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, G.Loopless ↔ ∀ (u v : α), G.Adj u v → u ≠ v

theorem Graph.vertexSet_nontrivial_of_edgeSet_nonempty_of_loopless E1 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} [G.Loopless], G.edgeSet.Nonempty → G.vertexSet.Nontrivial

theorem Graph.Loopless.anti E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β} [hG : G.Loopless], H ≤ G → H.Loopless

theorem Graph.Inc.isNonloopAt E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} {u : α} {e : β} [G.Loopless], G.Inc e u → G.IsNonloopAt e u

class Graph.Simple E3 #

{α : Type u_1} → {β : Type u_2} → Graph α β → Prop

A Simple graph is a Loopless graph where no pair of vertices are the ends of more than one edge.

theorem Graph.simple_iff E0 #

∀ {α : Type u_1} {β : Type u_2} (G : Graph α β),
  G.Simple ↔ G.Loopless ∧ ∀ ⦃e f : β⦄ ⦃x y : α⦄, G.IsLink e x y → G.IsLink f x y → e = f

ctor Graph.Simple.mk E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} [toLoopless : G.Loopless],
  (∀ ⦃e f : β⦄ ⦃x y : α⦄, G.IsLink e x y → G.IsLink f x y → e = f) → G.Simple

instance Graph.Simple.toLoopless E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} [self : G.Simple], G.Loopless

theorem Graph.IsLink.eq E1 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} {u v : α} {e f : β} [G.Simple], G.IsLink e u v → G.IsLink f u v → e = f

theorem Graph.Simple.anti E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β} [G.Simple], H ≤ G → H.Simple

instance Graph.instSimpleNoEdge E0 #

∀ {α : Type u_1} {β : Type u_2} (V : Set α), (Graph.noEdge V β).Simple

instance Graph.instSimpleBot E0 #

∀ {α : Type u_1} {β : Type u_2}, ⊥.Simple

def Graph.toSimpleGraph E3 #

{α : Type u_1} → {β : Type u_2} → (G : Graph α β) → SimpleGraph ↑G.vertexSet

Construct a simple graph from a graph.

theorem Graph.toSimpleGraph_adj E0 #

∀ {α : Type u_1} {β : Type u_2} (G : Graph α β) (u v : ↑G.vertexSet), G.toSimpleGraph.Adj u v = (u ≠ v ∧ G.Adj ↑u ↑v)

theorem Graph.toSimpleGraph_adj_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} [G.Loopless] (u v : ↑G.vertexSet), G.toSimpleGraph.Adj u v ↔ G.Adj ↑u ↑v

theorem Graph.toSimpleGraph_mono E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β} (h : G ≤s H), G.toSimpleGraph ≤ ⋯ ▸ H.toSimpleGraph

def Graph.ofSimpleGraph E3 #

{α : Type u_1} → SimpleGraph α → Graph α (Sym2 α)

Construct a graph from a simple graph. It has every element of the vertex type as a vertex.

theorem Graph.edgeSet_ofSimpleGraph E0 #

∀ {α : Type u_1} (G : SimpleGraph α), (Graph.ofSimpleGraph G).edgeSet = G.edgeSet

theorem Graph.vertexSet_ofSimpleGraph E0 #

∀ {α : Type u_1} (G : SimpleGraph α), (Graph.ofSimpleGraph G).vertexSet = Set.univ

theorem Graph.ofSimpleGraph_adj_iff E0 #

∀ {α : Type u_1} {G : SimpleGraph α} (u v : α), (Graph.ofSimpleGraph G).Adj u v ↔ G.Adj u v

def Graph.toSimpleGraphOfSimpleGraphIso E1 #

{α : Type u_1} → (G : SimpleGraph α) → (Graph.ofSimpleGraph G).toSimpleGraph ≃g G

The isomorphism between toSimpleGraph (ofSimpleGraph G) and G.