@@ -142,12 +142,16 @@ theorem isBipartiteWith_neighborSet_disjoint' (h : G.IsBipartiteWith s t) (hw :
142142 Disjoint (G.neighborSet w) t :=
143143 Set.disjoint_of_subset_left (isBipartiteWith_neighborSet_subset' h hw) h.disjoint
144144
145- variable {s t : Finset V} [DecidableRel G.Adj]
145+ variable {s t : Finset V}
146146
147147section
148148
149149variable [Fintype ↑(G.neighborSet v)] [Fintype ↑(G.neighborSet w)]
150150
151+ section decidableRel
152+
153+ variable [DecidableRel G.Adj]
154+
151155/-- If `G.IsBipartiteWith s t` and `v ∈ s`, then the neighbor finset of `v` is the set of vertices
152156in `s` adjacent to `v` in `G`. -/
153157theorem isBipartiteWith_neighborFinset (h : G.IsBipartiteWith s t) (hv : v ∈ s) :
@@ -156,19 +160,35 @@ theorem isBipartiteWith_neighborFinset (h : G.IsBipartiteWith s t) (hv : v ∈ s
156160 rw [mem_neighborFinset, mem_filter, iff_and_self]
157161 exact h.mem_of_mem_adj hv
158162
163+ /-- If `G.IsBipartiteWith s t` and `w ∈ t`, then the neighbor finset of `w` is the set of vertices
164+ in `s` adjacent to `w` in `G`. -/
165+ theorem isBipartiteWith_neighborFinset' (h : G.IsBipartiteWith s t) (hw : w ∈ t) :
166+ G.neighborFinset w = { v ∈ s | G.Adj v w } := by
167+ ext v
168+ rw [mem_neighborFinset, adj_comm, mem_filter, iff_and_self]
169+ exact h.mem_of_mem_adj' hw
170+
159171/-- If `G.IsBipartiteWith s t` and `v ∈ s`, then the neighbor finset of `v` is the set of vertices
160172"above" `v` according to the adjacency relation of `G`. -/
161173theorem isBipartiteWith_bipartiteAbove (h : G.IsBipartiteWith s t) (hv : v ∈ s) :
162174 G.neighborFinset v = bipartiteAbove G.Adj t v := by
163175 rw [isBipartiteWith_neighborFinset h hv, bipartiteAbove]
164176
177+ /-- If `G.IsBipartiteWith s t` and `w ∈ t`, then the neighbor finset of `w` is the set of vertices
178+ "below" `w` according to the adjacency relation of `G`. -/
179+ theorem isBipartiteWith_bipartiteBelow (h : G.IsBipartiteWith s t) (hw : w ∈ t) :
180+ G.neighborFinset w = bipartiteBelow G.Adj s w := by
181+ rw [isBipartiteWith_neighborFinset' h hw, bipartiteBelow]
182+
183+ end decidableRel
184+
165185/-- If `G.IsBipartiteWith s t` and `v ∈ s`, then the neighbor finset of `v` is a subset of `s`. -/
166186theorem isBipartiteWith_neighborFinset_subset (h : G.IsBipartiteWith s t) (hv : v ∈ s) :
167187 G.neighborFinset v ⊆ t := by
188+ classical
168189 rw [isBipartiteWith_neighborFinset h hv]
169190 exact filter_subset (G.Adj v ·) t
170191
171- omit [DecidableRel G.Adj] in
172192/-- If `G.IsBipartiteWith s t` and `v ∈ s`, then the neighbor finset of `v` is disjoint to `s`. -/
173193theorem isBipartiteWith_neighborFinset_disjoint (h : G.IsBipartiteWith s t) (hv : v ∈ s) :
174194 Disjoint (G.neighborFinset v) s := by
@@ -181,27 +201,13 @@ theorem isBipartiteWith_degree_le (h : G.IsBipartiteWith s t) (hv : v ∈ s) : G
181201 rw [← card_neighborFinset_eq_degree]
182202 exact card_le_card (isBipartiteWith_neighborFinset_subset h hv)
183203
184- /-- If `G.IsBipartiteWith s t` and `w ∈ t`, then the neighbor finset of `w` is the set of vertices
185- in `s` adjacent to `w` in `G`. -/
186- theorem isBipartiteWith_neighborFinset' (h : G.IsBipartiteWith s t) (hw : w ∈ t) :
187- G.neighborFinset w = { v ∈ s | G.Adj v w } := by
188- ext v
189- rw [mem_neighborFinset, adj_comm, mem_filter, iff_and_self]
190- exact h.mem_of_mem_adj' hw
191-
192- /-- If `G.IsBipartiteWith s t` and `w ∈ t`, then the neighbor finset of `w` is the set of vertices
193- "below" `w` according to the adjacency relation of `G`. -/
194- theorem isBipartiteWith_bipartiteBelow (h : G.IsBipartiteWith s t) (hw : w ∈ t) :
195- G.neighborFinset w = bipartiteBelow G.Adj s w := by
196- rw [isBipartiteWith_neighborFinset' h hw, bipartiteBelow]
197-
198204/-- If `G.IsBipartiteWith s t` and `w ∈ t`, then the neighbor finset of `w` is a subset of `s`. -/
199205theorem isBipartiteWith_neighborFinset_subset' (h : G.IsBipartiteWith s t) (hw : w ∈ t) :
200206 G.neighborFinset w ⊆ s := by
207+ classical
201208 rw [isBipartiteWith_neighborFinset' h hw]
202209 exact filter_subset (G.Adj · w) s
203210
204- omit [DecidableRel G.Adj] in
205211/-- If `G.IsBipartiteWith s t` and `w ∈ t`, then the neighbor finset of `w` is disjoint to `t`. -/
206212theorem isBipartiteWith_neighborFinset_disjoint' (h : G.IsBipartiteWith s t) (hw : w ∈ t) :
207213 Disjoint (G.neighborFinset w) t := by
@@ -222,6 +228,7 @@ of the degrees of vertices in `t`.
222228See `Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow`. -/
223229theorem isBipartiteWith_sum_degrees_eq [G.LocallyFinite] (h : G.IsBipartiteWith s t) :
224230 ∑ v ∈ s, G.degree v = ∑ w ∈ t, G.degree w := by
231+ classical
225232 simp_rw [← sum_attach t, ← sum_attach s, ← card_neighborFinset_eq_degree]
226233 conv_lhs =>
227234 rhs; intro v
@@ -233,7 +240,7 @@ theorem isBipartiteWith_sum_degrees_eq [G.LocallyFinite] (h : G.IsBipartiteWith
233240 sum_attach t fun v ↦ #(bipartiteBelow G.Adj s v)]
234241 exact sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow G.Adj
235242
236- variable [Fintype V]
243+ variable [Fintype V] [DecidableRel G.Adj]
237244
238245lemma isBipartiteWith_sum_degrees_eq_twice_card_edges [DecidableEq V] (h : G.IsBipartiteWith s t) :
239246 ∑ v ∈ s ∪ t, G.degree v = 2 * #G.edgeFinset := by
0 commit comments