Skip to content

Commit 86e2e68

Browse files
committed
feat(Combinatorics/SimpleGraph/Clique): add lemmas about cliques in G ⊔ edge v w (#22370)
Add lemmas about cliques in a graph G versus cliques in G ⊔ edge v w. Refactor SimpleGraph.CliqueFree.sup_edge Co-authored-by: Lian Tattersall <lian.tattersall.20@alumni.ucl.ac.uk>
1 parent 1d296d5 commit 86e2e68

File tree

1 file changed

+35
-27
lines changed

1 file changed

+35
-27
lines changed

Mathlib/Combinatorics/SimpleGraph/Clique.lean

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,26 @@ theorem IsClique.of_induce {S : Subgraph G} {F : Set α} {A : Set F}
157157
intro _ ⟨_, ainA⟩ _ ⟨_, binA⟩ anb
158158
exact S.adj_sub (c ainA binA (Subtype.coe_ne_coe.mp anb)).2.2
159159

160+
lemma IsClique.sdiff_of_sup_edge {v w : α} {s : Set α} (hc : (G ⊔ edge v w).IsClique s) :
161+
G.IsClique (s \ {v}) := by
162+
intro _ hx _ hy hxy
163+
have := hc hx.1 hy.1 hxy
164+
simp_all [sup_adj, edge_adj]
165+
166+
lemma isClique_sup_edge_of_ne_sdiff {v w : α} {s : Set α} (h : v ≠ w ) (hv : G.IsClique (s \ {v}))
167+
(hw : G.IsClique (s \ {w})) : (G ⊔ edge v w).IsClique s := by
168+
intro x hx y hy hxy
169+
by_cases h' : x ∈ s \ {v} ∧ y ∈ s \ {v} ∨ x ∈ s \ {w} ∧ y ∈ s \ {w}
170+
· obtain (⟨hx, hy⟩ | ⟨hx, hy⟩) := h'
171+
· exact hv.mono le_sup_left hx hy hxy
172+
· exact hw.mono le_sup_left hx hy hxy
173+
· exact Or.inr ⟨by by_cases x = v <;> aesop, hxy⟩
174+
175+
lemma isClique_sup_edge_of_ne_iff {v w : α} {s : Set α} (h : v ≠ w) :
176+
(G ⊔ edge v w).IsClique s ↔ G.IsClique (s \ {v}) ∧ G.IsClique (s \ {w}) :=
177+
fun h' ↦ ⟨h'.sdiff_of_sup_edge, (edge_comm .. ▸ h').sdiff_of_sup_edge⟩,
178+
fun h' ↦ isClique_sup_edge_of_ne_sdiff h h'.1 h'.2
179+
160180
end Clique
161181

162182
/-! ### `n`-cliques -/
@@ -274,6 +294,11 @@ theorem IsNClique.of_induce {S : Subgraph G} {F : Set α} {s : Finset { x // x
274294
simp only [Subgraph.induce_verts, coe_map, card_map]
275295
exact ⟨cc.left.of_induce, cc.right⟩
276296

297+
lemma IsNClique.erase_of_sup_edge_of_mem [DecidableEq α] {v w : α} {s : Finset α} {n : ℕ}
298+
(hc : (G ⊔ edge v w).IsNClique n s) (hx : v ∈ s) : G.IsNClique (n - 1) (s.erase v) where
299+
isClique := coe_erase v _ ▸ hc.1.sdiff_of_sup_edge
300+
card_eq := by rw [card_erase_of_mem hx, hc.2]
301+
277302
end NClique
278303

279304
/-! ### Graphs without cliques -/
@@ -410,35 +435,18 @@ theorem cliqueFree_two : G.CliqueFree 2 ↔ G = ⊥ := by
410435
· rintro rfl
411436
exact cliqueFree_bot le_rfl
412437

438+
lemma CliqueFree.mem_of_sup_edge_isNClique {x y : α} {t : Finset α} {n : ℕ} (h : G.CliqueFree n)
439+
(hc : (G ⊔ edge x y).IsNClique n t) : x ∈ t := by
440+
by_contra! hf
441+
have ht : (t : Set α) \ {x} = t := sdiff_eq_left.mpr <| Set.disjoint_singleton_right.mpr hf
442+
exact h t ⟨ht ▸ hc.1.sdiff_of_sup_edge, hc.2
443+
444+
open Classical in
413445
/-- Adding an edge increases the clique number by at most one. -/
414446
protected theorem CliqueFree.sup_edge (h : G.CliqueFree n) (v w : α) :
415-
(G ⊔ edge v w).CliqueFree (n + 1) := by
416-
contrapose h
417-
obtain ⟨f, ha⟩ := topEmbeddingOfNotCliqueFree h
418-
simp only [ne_eq, top_adj] at ha
419-
rw [not_cliqueFree_iff]
420-
by_cases mw : w ∈ Set.range f
421-
· obtain ⟨x, hx⟩ := mw
422-
use ⟨f ∘ x.succAboveEmb, f.2.comp Fin.succAbove_right_injective⟩
423-
intro a b
424-
simp_rw [Embedding.coeFn_mk, comp_apply, Fin.succAboveEmb_apply, top_adj]
425-
have hs := @ha (x.succAbove a) (x.succAbove b)
426-
have ia : w ≠ f (x.succAbove a) :=
427-
(hx ▸ f.apply_eq_iff_eq x (x.succAbove a)).ne.mpr (x.succAbove_ne a).symm
428-
have ib : w ≠ f (x.succAbove b) :=
429-
(hx ▸ f.apply_eq_iff_eq x (x.succAbove b)).ne.mpr (x.succAbove_ne b).symm
430-
rw [sup_adj, edge_adj] at hs
431-
simp only [ia.symm, ib.symm, and_false, false_and, or_false] at hs
432-
rw [hs, Fin.succAbove_right_inj]
433-
· use ⟨f ∘ Fin.succEmb n, (f.2.of_comp_iff _).mpr (Fin.succ_injective _)⟩
434-
intro a b
435-
simp only [Fin.val_succEmb, Embedding.coeFn_mk, comp_apply, top_adj]
436-
have hs := @ha a.succ b.succ
437-
have ia : f a.succ ≠ w := by simp_all
438-
have ib : f b.succ ≠ w := by simp_all
439-
rw [sup_adj, edge_adj] at hs
440-
simp only [ia, ib, and_false, false_and, or_false] at hs
441-
rw [hs, Fin.succ_inj]
447+
(G ⊔ edge v w).CliqueFree (n + 1) :=
448+
fun _ hs ↦ (hs.erase_of_sup_edge_of_mem <|
449+
(h.mono n.le_succ).mem_of_sup_edge_isNClique hs).not_cliqueFree h
442450

443451
end CliqueFree
444452

0 commit comments

Comments
 (0)