@@ -77,6 +77,9 @@ lemma isClique_empty : G.IsClique ∅ := by simp
7777lemma isClique_singleton (a : α) : G.IsClique {a} := by simp
7878#align simple_graph.is_clique_singleton SimpleGraph.isClique_singleton
7979
80+ theorem IsClique.of_subsingleton {G : SimpleGraph α} (hs : s.Subsingleton) : G.IsClique s :=
81+ hs.pairwise G.Adj
82+
8083lemma isClique_pair : G.IsClique {a, b} ↔ a ≠ b → G.Adj a b := Set.pairwise_pair_of_symmetric G.symm
8184#align simple_graph.is_clique_pair SimpleGraph.isClique_pair
8285
@@ -100,12 +103,6 @@ theorem IsClique.mono (h : G ≤ H) : G.IsClique s → H.IsClique s := Set.Pairw
100103theorem IsClique.subset (h : t ⊆ s) : G.IsClique s → G.IsClique t := Set.Pairwise.mono h
101104#align simple_graph.is_clique.subset SimpleGraph.IsClique.subset
102105
103- protected theorem IsClique.map {s : Set α} (h : G.IsClique s) {f : α ↪ β} :
104- (G.map f).IsClique (f '' s) := by
105- rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ hab
106- exact ⟨a, b, h ha hb <| ne_of_apply_ne _ hab, rfl, rfl⟩
107- #align simple_graph.is_clique.map SimpleGraph.IsClique.map
108-
109106@[simp]
110107theorem isClique_bot_iff : (⊥ : SimpleGraph α).IsClique s ↔ (s : Set α).Subsingleton :=
111108 Set.pairwise_bot_iff
@@ -114,6 +111,66 @@ theorem isClique_bot_iff : (⊥ : SimpleGraph α).IsClique s ↔ (s : Set α).Su
114111alias ⟨IsClique.subsingleton, _⟩ := isClique_bot_iff
115112#align simple_graph.is_clique.subsingleton SimpleGraph.IsClique.subsingleton
116113
114+ protected theorem IsClique.map (h : G.IsClique s) {f : α ↪ β} : (G.map f).IsClique (f '' s) := by
115+ rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ hab
116+ exact ⟨a, b, h ha hb <| ne_of_apply_ne _ hab, rfl, rfl⟩
117+ #align simple_graph.is_clique.map SimpleGraph.IsClique.map
118+
119+ theorem isClique_map_iff_of_nontrivial {f : α ↪ β} {t : Set β} (ht : t.Nontrivial) :
120+ (G.map f).IsClique t ↔ ∃ (s : Set α), G.IsClique s ∧ f '' s = t := by
121+ refine ⟨fun h ↦ ⟨f ⁻¹' t, ?_, ?_⟩, by rintro ⟨x, hs, rfl⟩; exact hs.map⟩
122+ · rintro x (hx : f x ∈ t) y (hy : f y ∈ t) hne
123+ obtain ⟨u,v, huv, hux, hvy⟩ := h hx hy (by simpa)
124+ rw [EmbeddingLike.apply_eq_iff_eq] at hux hvy
125+ rwa [← hux, ← hvy]
126+ rw [Set.image_preimage_eq_iff]
127+ intro x hxt
128+ obtain ⟨y,hyt, hyne⟩ := ht.exists_ne x
129+ obtain ⟨u,v, -, rfl, rfl⟩ := h hyt hxt hyne
130+ exact Set.mem_range_self _
131+
132+ theorem isClique_map_iff {f : α ↪ β} {t : Set β} :
133+ (G.map f).IsClique t ↔ t.Subsingleton ∨ ∃ (s : Set α), G.IsClique s ∧ f '' s = t := by
134+ obtain (ht | ht) := t.subsingleton_or_nontrivial
135+ · simp [IsClique.of_subsingleton, ht]
136+ simp [isClique_map_iff_of_nontrivial ht, ht.not_subsingleton]
137+
138+ @[simp] theorem isClique_map_image_iff {f : α ↪ β} :
139+ (G.map f).IsClique (f '' s) ↔ G.IsClique s := by
140+ rw [isClique_map_iff, f.injective.subsingleton_image_iff]
141+ obtain (hs | hs) := s.subsingleton_or_nontrivial
142+ · simp [hs, IsClique.of_subsingleton]
143+ simp [or_iff_right hs.not_subsingleton, Set.image_eq_image f.injective]
144+ section DecidableEq
145+
146+ variable [DecidableEq β] {f : α ↪ β} {t : Finset β}
147+
148+ theorem isClique_map_finset_iff_of_nontrivial (ht : t.Nontrivial) :
149+ (G.map f).IsClique t ↔ ∃ (s : Finset α), G.IsClique s ∧ s.map f = t := by
150+ constructor
151+ · rw [isClique_map_iff_of_nontrivial (by simpa)]
152+ rintro ⟨s, hs, hst⟩
153+ obtain ⟨s, rfl⟩ := Set.Finite.exists_finset_coe <|
154+ (show s.Finite from Set.Finite.of_finite_image (by simp [hst]) f.injective.injOn)
155+ exact ⟨s,hs, Finset.coe_inj.1 (by simpa)⟩
156+ rintro ⟨s, hs, rfl⟩
157+ simpa using hs.map (f := f)
158+
159+ theorem isClique_map_finset_iff :
160+ (G.map f).IsClique t ↔ t.card ≤ 1 ∨ ∃ (s : Finset α), G.IsClique s ∧ s.map f = t := by
161+ obtain (ht | ht) := le_or_lt t.card 1
162+ · simp only [ht, true_or, iff_true]
163+ exact IsClique.of_subsingleton <| card_le_one.1 ht
164+ rw [isClique_map_finset_iff_of_nontrivial, ← not_lt]
165+ · simp [ht, Finset.map_eq_image]
166+ exact Finset.one_lt_card_iff_nontrivial.mp ht
167+
168+ protected theorem IsClique.finsetMap {f : α ↪ β} {s : Finset α} (h : G.IsClique s) :
169+ (G.map f).IsClique (s.map f) := by
170+ simpa
171+
172+ end DecidableEq
173+
117174end Clique
118175
119176/-! ### `n`-cliques -/
@@ -156,6 +213,16 @@ protected theorem IsNClique.map (h : G.IsNClique n s) {f : α ↪ β} :
156213 ⟨by rw [coe_map]; exact h.1 .map, (card_map _).trans h.2 ⟩
157214#align simple_graph.is_n_clique.map SimpleGraph.IsNClique.map
158215
216+ theorem isNClique_map_iff [DecidableEq β] (hn : 1 < n) {t : Finset β} {f : α ↪ β} :
217+ (G.map f).IsNClique n t ↔ ∃ s : Finset α, G.IsNClique n s ∧ s.map f = t := by
218+ rw [isNClique_iff, isClique_map_finset_iff, or_and_right,
219+ or_iff_right (by rintro ⟨h', rfl⟩; exact h'.not_lt hn)]
220+ constructor
221+ · rintro ⟨⟨s, hs, rfl⟩, rfl⟩
222+ simp [isNClique_iff, hs]
223+ rintro ⟨s, hs, rfl⟩
224+ simp [hs.card_eq, hs.clique]
225+
159226@[simp]
160227theorem isNClique_bot_iff : (⊥ : SimpleGraph α).IsNClique n s ↔ n ≤ 1 ∧ s.card = n := by
161228 rw [isNClique_iff, isClique_bot_iff]
@@ -297,6 +364,14 @@ theorem CliqueFree.comap {H : SimpleGraph β} (f : H ↪g G) : G.CliqueFree n
297364 intro h; contrapose h
298365 exact not_cliqueFree_of_top_embedding <| f.comp (topEmbeddingOfNotCliqueFree h)
299366
367+ @[simp] theorem cliqueFree_map_iff {f : α ↪ β} [DecidableEq β] [Nonempty α] :
368+ (G.map f).CliqueFree n ↔ G.CliqueFree n := by
369+ obtain (hle | hlt) := le_or_lt n 1
370+ · obtain (rfl | rfl) := Nat.le_one_iff_eq_zero_or_eq_one.1 hle
371+ · simp [CliqueFree]
372+ simp [CliqueFree, show ∃ (_ : β), True from ⟨f (Classical.arbitrary _), trivial⟩]
373+ simp [CliqueFree, isNClique_map_iff hlt]
374+
300375/-- See `SimpleGraph.cliqueFree_of_chromaticNumber_lt` for a tighter bound. -/
301376theorem cliqueFree_of_card_lt [Fintype α] (hc : card α < n) : G.CliqueFree n := by
302377 by_contra h
0 commit comments