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.Subgraph

99 declarations. Mathlib docs · Source

Subgraphs of multigraphs

This file develops the basic theory of subgraphs for multigraphs Graph α β: the subgraph relation, standard classes of subgraphs (spanning, induced, closed), and the bottom element ⊥.

Main definitions

  • H ≤ G: the subgraph relation as a partial order on graphs. This is the preferred spelling over H.IsSubgraph G which it is definitionally equal to.
  • H ≤s G (Graph.IsSpanningSubgraph): H has the same vertex set as G.
  • H ≤i G (Graph.IsInducedSubgraph): H contains every ambient link between its vertices.
  • H ≤c G (Graph.IsClosedSubgraph): H is a union of components of G.
  • ⊥: empty graph with no vertices or edges as its bottom element.

Implementation notes

Following the overall design of Graph, subgraphs are terms of the same type Graph α β rather than a separate Subgraph structure. This allows us to reuse notation and lemmas uniformly and to express the subgraph order directly as a partial order on Graph α β.

G ≤ H is the canonical spelling for "G is a subgraph of H". This is definitionally equal to G.IsSubgraph H which exists only for implementation reasons. The explicit IsSubgraph structure is defined so that stronger subgraph notions (such as IsSpanningSubgraph, IsInducedSubgraph, and IsClosedSubgraph) can extend it. This allows them to inherit fundamental fields and lemmas like vertexSet_mono and edgeSet_mono without lemma duplication. However, in statements and proofs, users use G ≤ H instead. The relation ≤ is the simp normal form, and the API is developed entirely in terms of it.

Tags

graphs, subgraph, induced subgraph, spanning subgraph, closed subgraph

Spanning Subgraphs

Induced Subgraphs

Closed Subgraphs

structure Graph.IsSubgraph E1 #

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

IsSubgraph H G is NOT the preferred spelling for the subgraph relation. Please use H ≤ G instead.

theorem Graph.isSubgraph_iff E0 #

∀ {α : Type u_1} {β : Type u_2} (H G : Graph α β),
  H.IsSubgraph G ↔
    autoParam (H.vertexSet ⊆ G.vertexSet) Graph.IsSubgraph.vertexSet_mono._autoParam ∧
      autoParam (∀ ⦃e : β⦄ ⦃x y : α⦄, H.IsLink e x y → G.IsLink e x y) Graph.IsSubgraph.isLink_mono._autoParam

ctor Graph.IsSubgraph.mk E0 #

∀ {α : Type u_1} {β : Type u_2} {H G : Graph α β},
  autoParam (H.vertexSet ⊆ G.vertexSet) Graph.IsSubgraph.vertexSet_mono._autoParam →
    autoParam (∀ ⦃e : β⦄ ⦃x y : α⦄, H.IsLink e x y → G.IsLink e x y) Graph.IsSubgraph.isLink_mono._autoParam →
      H.IsSubgraph G

theorem Graph.IsSubgraph.vertexSet_mono E1 #

∀ {α : Type u_1} {β : Type u_2} {H G : Graph α β}, H.IsSubgraph G → H.vertexSet ⊆ G.vertexSet

theorem Graph.IsSubgraph.trans E1 #

∀ {α : Type u_1} {β : Type u_2} {G G₁ H : Graph α β}, H.IsSubgraph G → G.IsSubgraph G₁ → H.IsSubgraph G₁

theorem Graph.IsSubgraph.antisymm E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β}, H.IsSubgraph G → G.IsSubgraph H → H = G

instance Graph.instPartialOrder E0 #

{α : Type u_1} → {β : Type u_2} → PartialOrder (Graph α β)

H ≤ G means H is a subgraph of G. It is defined as V(H) ⊆ V(G) and every link of H being a link of G.

theorem Graph.isSubgraph_iff_le E0 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β}, H.IsSubgraph G ↔ H ≤ G

theorem Graph.IsLink.mono E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {e : β} {G H : Graph α β}, H ≤ G → H.IsLink e x y → G.IsLink e x y

theorem Graph.IsSubgraph.edgeSet_mono E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β}, H ≤ G → H.edgeSet ⊆ G.edgeSet

theorem Graph.Compatible.of_le_le E1 #

∀ {α : Type u_1} {β : Type u_2} {G H₁ H₂ : Graph α β}, H₁ ≤ G → H₂ ≤ G → H₁.Compatible H₂

Two subgraphs of the same graph are compatible.

theorem Graph.Compatible.of_le E1 #

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

theorem Graph.Compatible.of_ge E1 #

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

theorem Graph.IsSubgraph.compatible E1 #

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

Alias of Graph.Compatible.of_le.

theorem Graph.IsSubgraph.compatible' E1 #

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

Alias of Graph.Compatible.of_ge.

theorem Graph.Compatible.anti_left E1 #

∀ {α : Type u_1} {β : Type u_2} {G G₁ H : Graph α β}, G₁ ≤ G → G.Compatible H → G₁.Compatible H

theorem Graph.Compatible.anti_right E1 #

∀ {α : Type u_1} {β : Type u_2} {G H H₁ : Graph α β}, H₁ ≤ H → G.Compatible H → G.Compatible H₁

theorem Graph.Compatible.anti E1 #

∀ {α : Type u_1} {β : Type u_2} {G G₁ H H₁ : Graph α β}, G₁ ≤ G → H₁ ≤ H → G.Compatible H → G₁.Compatible H₁

theorem Graph.Inc.mono E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β}, H ≤ G → H.Inc e x → G.Inc e x

theorem Graph.IsSubgraph.inc_congr E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β}, H ≤ G → e ∈ H.edgeSet → (H.Inc e x ↔ G.Inc e x)

theorem Graph.IsSubgraph.inc_eqOn E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β}, H ≤ G → Set.EqOn H.Inc G.Inc H.edgeSet

theorem Graph.IsLoopAt.mono E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β}, H ≤ G → H.IsLoopAt e x → G.IsLoopAt e x

theorem Graph.IsSubgraph.isLoopAt_congr E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β},
  H ≤ G → e ∈ H.edgeSet → (H.IsLoopAt e x ↔ G.IsLoopAt e x)

theorem Graph.IsSubgraph.isLoopAt_eqOn E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β}, H ≤ G → Set.EqOn H.IsLoopAt G.IsLoopAt H.edgeSet

theorem Graph.IsNonloopAt.mono E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β}, H ≤ G → H.IsNonloopAt e x → G.IsNonloopAt e x

theorem Graph.IsSubgraph.isNonloopAt_congr E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β},
  H ≤ G → e ∈ H.edgeSet → (H.IsNonloopAt e x ↔ G.IsNonloopAt e x)

theorem Graph.IsSubgraph.isNonloopAt_eqOn E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β}, H ≤ G → Set.EqOn H.IsNonloopAt G.IsNonloopAt H.edgeSet

theorem Graph.Adj.mono E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {G H : Graph α β}, H ≤ G → H.Adj x y → G.Adj x y

theorem Graph.le_iff_compatible_subset_subset E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β},
  G ≤ H ↔ G.Compatible H ∧ G.vertexSet ⊆ H.vertexSet ∧ G.edgeSet ⊆ H.edgeSet

theorem Graph.Compatible.le_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {H₁ H₂ : Graph α β},
  H₁.Compatible H₂ → (H₁ ≤ H₂ ↔ H₁.vertexSet ⊆ H₂.vertexSet ∧ H₁.edgeSet ⊆ H₂.edgeSet)

theorem Graph.Compatible.ext E1 #

∀ {α : Type u_1} {β : Type u_2} {H₁ H₂ : Graph α β},
  H₁.vertexSet = H₂.vertexSet → H₁.edgeSet = H₂.edgeSet → H₁.Compatible H₂ → H₁ = H₂

theorem Graph.vertexSet_ssubset_or_edgeSet_ssubset_of_lt E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β}, G < H → G.vertexSet ⊂ H.vertexSet ∨ G.edgeSet ⊂ H.edgeSet

theorem Graph.noEdge_le_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} {X : Set α}, Graph.noEdge X β ≤ G ↔ X ⊆ G.vertexSet

theorem Graph.le_noEdge_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β} {X : Set α}, G ≤ Graph.noEdge X β ↔ G.vertexSet ⊆ X ∧ G.edgeSet = ∅

structure Graph.IsSpanningSubgraph E3 #

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

H ≤s G (Graph.IsSpanningSubgraph) is a subgraph of G with the same vertex set.

theorem Graph.isSpanningSubgraph_iff E0 #

∀ {α : Type u_1} {β : Type u_2} (H G : Graph α β), H ≤s G ↔ H.IsSubgraph G ∧ H.vertexSet = G.vertexSet

ctor Graph.IsSpanningSubgraph.mk E0 #

∀ {α : Type u_1} {β : Type u_2} {H G : Graph α β}, H.IsSubgraph G → H.vertexSet = G.vertexSet → H ≤s G

theorem Graph.IsSpanningSubgraph.le E1 #

∀ {α : Type u_1} {β : Type u_2} {H G : Graph α β}, H ≤s G → H.IsSubgraph G

theorem Graph.IsSpanningSubgraph.vertexSet_eq E0 #

∀ {α : Type u_1} {β : Type u_2} {H G : Graph α β}, H ≤s G → H.vertexSet = G.vertexSet

def Graph.«term_≤s_» E1 #

Lean.TrailingParserDescr

H ≤s G (Graph.IsSpanningSubgraph) is a subgraph of G with the same vertex set.

theorem Graph.IsSpanningSubgraph.trans E1 #

∀ {α : Type u_1} {β : Type u_2} {G G₁ G₂ : Graph α β}, G ≤s G₁ → G₁ ≤s G₂ → G ≤s G₂

instance Graph.IsSpanningSubgraph.instIsPartialOrder E0 #

∀ {α : Type u_1} {β : Type u_2}, IsPartialOrder (Graph α β) fun x1 x2 ↦ x1 ≤s x2

theorem Graph.IsSpanningSubgraph.rfl E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, G ≤s G

theorem Graph.IsSpanningSubgraph.anti_right E1 #

∀ {α : Type u_1} {β : Type u_2} {G H K : Graph α β}, H ≤ K → K ≤ G → H ≤s G → H ≤s K

theorem Graph.IsSpanningSubgraph.mono_left E1 #

∀ {α : Type u_1} {β : Type u_2} {G H K : Graph α β}, H ≤ K → K ≤ G → H ≤s G → K ≤s G

theorem Graph.IsSpanningSubgraph.ext_of_edgeSet E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β}, H.edgeSet = G.edgeSet → H ≤s G → H = G

theorem Graph.IsSpanningSubgraph.banana_mono E1 #

∀ {α : Type u_1} {β : Type u_2} {u v : α} {F₁ F₂ : Set β}, F₁ ⊆ F₂ → Graph.banana u v F₁ ≤s Graph.banana u v F₂

structure Graph.IsInducedSubgraph E3 #

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

H ≤i G (Graph.IsInducedSubgraph) is a subgraph of G such that every link of G involving two vertices of H is also a link of H.

theorem Graph.isInducedSubgraph_iff E0 #

∀ {α : Type u_1} {β : Type u_2} (H G : Graph α β),
  H.IsInducedSubgraph G ↔
    H.IsSubgraph G ∧ ∀ ⦃e : β⦄ ⦃x y : α⦄, G.IsLink e x y → x ∈ H.vertexSet → y ∈ H.vertexSet → H.IsLink e x y

ctor Graph.IsInducedSubgraph.mk E0 #

∀ {α : Type u_1} {β : Type u_2} {H G : Graph α β},
  H.IsSubgraph G →
    (∀ ⦃e : β⦄ ⦃x y : α⦄, G.IsLink e x y → x ∈ H.vertexSet → y ∈ H.vertexSet → H.IsLink e x y) → H.IsInducedSubgraph G

theorem Graph.IsInducedSubgraph.le E1 #

∀ {α : Type u_1} {β : Type u_2} {H G : Graph α β}, H.IsInducedSubgraph G → H.IsSubgraph G

def Graph.«term_≤i_» E1 #

Lean.TrailingParserDescr

H ≤i G (Graph.IsInducedSubgraph) is a subgraph of G such that every link of G involving two vertices of H is also a link of H.

theorem Graph.IsInducedSubgraph.trans E1 #

∀ {α : Type u_1} {β : Type u_2} {G G₁ G₂ : Graph α β},
  G.IsInducedSubgraph G₁ → G₁.IsInducedSubgraph G₂ → G.IsInducedSubgraph G₂

instance Graph.IsInducedSubgraph.instIsPartialOrder E0 #

∀ {α : Type u_1} {β : Type u_2}, IsPartialOrder (Graph α β) fun x1 x2 ↦ x1.IsInducedSubgraph x2

theorem Graph.IsInducedSubgraph.rfl E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, G.IsInducedSubgraph G

theorem Graph.IsInducedSubgraph.adj_congr E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {G H : Graph α β},
  x ∈ H.vertexSet → y ∈ H.vertexSet → H.IsInducedSubgraph G → (H.Adj x y ↔ G.Adj x y)

theorem Graph.IsInducedSubgraph.anti_right E1 #

∀ {α : Type u_1} {β : Type u_2} {G H K : Graph α β}, H ≤ K → K ≤ G → H.IsInducedSubgraph G → H.IsInducedSubgraph K

theorem Graph.IsInducedSubgraph.le_of_le_subset E1 #

∀ {α : Type u_1} {β : Type u_2} {G H K : Graph α β}, K ≤ G → K.vertexSet ⊆ H.vertexSet → H.IsInducedSubgraph G → K ≤ H

theorem Graph.IsInducedSubgraph.ext_of_vertexSet E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β}, H.vertexSet = G.vertexSet → H.IsInducedSubgraph G → H = G

theorem Graph.IsSubgraph.not_isInducedSubgraph_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β},
  H ≤ G → (¬H.IsInducedSubgraph G ↔ ∃ e x y, G.IsLink e x y ∧ x ∈ H.vertexSet ∧ y ∈ H.vertexSet ∧ e ∉ H.edgeSet)

structure Graph.IsClosedSubgraph E3 #

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

H ≤c G (Graph.IsClosedSubgraph) is a union of components of G.

theorem Graph.isClosedSubgraph_iff E0 #

∀ {α : Type u_1} {β : Type u_2} (H G : Graph α β),
  H.IsClosedSubgraph G ↔ H.IsInducedSubgraph G ∧ ∀ ⦃e : β⦄ ⦃x : α⦄, G.Inc e x → x ∈ H.vertexSet → e ∈ H.edgeSet

ctor Graph.IsClosedSubgraph.mk E0 #

∀ {α : Type u_1} {β : Type u_2} {H G : Graph α β},
  H.IsInducedSubgraph G → (∀ ⦃e : β⦄ ⦃x : α⦄, G.Inc e x → x ∈ H.vertexSet → e ∈ H.edgeSet) → H.IsClosedSubgraph G

theorem Graph.IsClosedSubgraph.isInducedSubgraph E1 #

∀ {α : Type u_1} {β : Type u_2} {H G : Graph α β}, H.IsClosedSubgraph G → H.IsInducedSubgraph G

theorem Graph.IsClosedSubgraph.closed E1 #

∀ {α : Type u_1} {β : Type u_2} {H G : Graph α β},
  H.IsClosedSubgraph G → ∀ ⦃e : β⦄ ⦃x : α⦄, G.Inc e x → x ∈ H.vertexSet → e ∈ H.edgeSet

def Graph.«term_≤c_» E1 #

Lean.TrailingParserDescr

H ≤c G (Graph.IsClosedSubgraph) is a union of components of G.

theorem Graph.IsClosedSubgraph.mk' E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β},
  H ≤ G → (∀ ⦃e : β⦄ ⦃x : α⦄, G.Inc e x → x ∈ H.vertexSet → e ∈ H.edgeSet) → H.IsClosedSubgraph G

theorem Graph.IsClosedSubgraph.trans E1 #

∀ {α : Type u_1} {β : Type u_2} {G G₁ G₂ : Graph α β},
  G.IsClosedSubgraph G₁ → G₁.IsClosedSubgraph G₂ → G.IsClosedSubgraph G₂

instance Graph.IsClosedSubgraph.instIsPartialOrder E0 #

∀ {α : Type u_1} {β : Type u_2}, IsPartialOrder (Graph α β) fun x1 x2 ↦ x1.IsClosedSubgraph x2

theorem Graph.IsClosedSubgraph.rfl E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, G.IsClosedSubgraph G

theorem Graph.IsClosedSubgraph.inc_congr E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β},
  x ∈ H.vertexSet → H.IsClosedSubgraph G → (H.Inc e x ↔ G.Inc e x)

theorem Graph.IsClosedSubgraph.adj_congr E1 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {G H : Graph α β},
  x ∈ H.vertexSet → H.IsClosedSubgraph G → (H.Adj x y ↔ G.Adj x y)

theorem Graph.IsClosedSubgraph.mem_iff_of_adj E0 #

∀ {α : Type u_1} {β : Type u_2} {x y : α} {G H : Graph α β},
  G.Adj x y → H.IsClosedSubgraph G → (x ∈ H.vertexSet ↔ y ∈ H.vertexSet)

theorem Graph.IsClosedSubgraph.anti_right E1 #

∀ {α : Type u_1} {β : Type u_2} {G G₁ H : Graph α β}, H ≤ G₁ → G₁ ≤ G → H.IsClosedSubgraph G → H.IsClosedSubgraph G₁

theorem Graph.IsInducedSubgraph.not_isClosedSubgraph_iff_exists_adj E1 #

∀ {α : Type u_1} {β : Type u_2} {G H : Graph α β},
  H.IsInducedSubgraph G → (¬H.IsClosedSubgraph G ↔ ∃ x y, G.Adj x y ∧ x ∈ H.vertexSet ∧ y ∉ H.vertexSet)

instance Graph.instOrderBot E0 #

{α : Type u_1} → {β : Type u_2} → OrderBot (Graph α β)

instance Graph.instInhabited E0 #

{α : Type u_1} → {β : Type u_2} → Inhabited (Graph α β)

theorem Graph.noEdge_empty E0 #

∀ {α : Type u_1} {β : Type u_2}, Graph.noEdge ∅ β = ⊥

theorem Graph.vertexSet_bot E0 #

∀ {α : Type u_1} {β : Type u_2}, ⊥.vertexSet = ∅

theorem Graph.edgeSet_bot E0 #

∀ {α : Type u_1} {β : Type u_2}, ⊥.edgeSet = ∅

theorem Graph.bot_isClosedSubgraph E0 #

∀ {α : Type u_1} {β : Type u_2} (G : Graph α β), ⊥.IsClosedSubgraph G

theorem Graph.vertexSet_eq_empty_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, G.vertexSet = ∅ ↔ G = ⊥

theorem Graph.ne_bot_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, G ≠ ⊥ ↔ G.vertexSet.Nonempty

theorem Graph.vertexSet_not_nonempty_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, ¬G.vertexSet.Nonempty ↔ G = ⊥

theorem Graph.ne_bot_of_mem_vertexSet E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {G : Graph α β}, x ∈ G.vertexSet → G ≠ ⊥

theorem Graph.isSpanningSubgraph_bot_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, G ≤s ⊥ ↔ G = ⊥

theorem Graph.isInducedSubgraph_bot_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, G.IsInducedSubgraph ⊥ ↔ G = ⊥

theorem Graph.isClosedSubgraph_bot_iff E0 #

∀ {α : Type u_1} {β : Type u_2} {G : Graph α β}, G.IsClosedSubgraph ⊥ ↔ G = ⊥

theorem Graph.not_disjoint_of_mem_mem E1 #

∀ {α : Type u_1} {β : Type u_2} {x : α} {G H : Graph α β}, x ∈ G.vertexSet → x ∈ H.vertexSet → ¬Disjoint G H