@@ -35,7 +35,8 @@ Together, these four statements say that any two of the following properties imp
35
35
-/
36
36
37
37
38
- open BigOperators
38
+ open Finset
39
+ open scoped BigOperators
39
40
40
41
namespace Configuration
41
42
@@ -234,17 +235,11 @@ theorem HasLines.card_le [HasLines P L] [Fintype P] [Fintype L] :
234
235
∑ p, lineCount L p = ∑ l, pointCount P l := sum_lineCount_eq_sum_pointCount P L
235
236
_ ≤ ∑ l, lineCount L (f l) :=
236
237
(Finset.sum_le_sum fun l _ => HasLines.pointCount_le_lineCount (hf₂ l))
237
- _ = ∑ p in Finset.univ.image f, lineCount L p :=
238
- (Finset.sum_bij (fun l _ => f l) (fun l hl => Finset.mem_image_of_mem f hl)
239
- (fun l _ => rfl) (fun l₁ l₂ hl₁ hl₂ hl₃ => hf₁ hl₃) fun p => by
240
- rw [Finset.mem_image]
241
- exact fun ⟨a, ⟨h, h'⟩⟩ => ⟨a, ⟨h, h'.symm⟩⟩)
238
+ _ = ∑ p in univ.map ⟨f, hf₁⟩, lineCount L p := by rw [sum_map]; dsimp
242
239
_ < ∑ p, lineCount L p := by
243
240
obtain ⟨p, hp⟩ := not_forall.mp (mt (Fintype.card_le_of_surjective f) hc₂)
244
- refine'
245
- Finset.sum_lt_sum_of_subset (Finset.univ.image f).subset_univ (Finset.mem_univ p) _ _
246
- fun p _ _ => zero_le (lineCount L p)
247
- · simpa only [Finset.mem_image, exists_prop, Finset.mem_univ, true_and_iff]
241
+ refine sum_lt_sum_of_subset (subset_univ _) (mem_univ p) ?_ ?_ fun p _ _ ↦ zero_le _
242
+ · simpa only [Finset.mem_map, exists_prop, Finset.mem_univ, true_and_iff]
248
243
· rw [lineCount, Nat.card_eq_fintype_card, Fintype.card_pos_iff]
249
244
obtain ⟨l, _⟩ := @exists_line P L _ _ p
250
245
exact
@@ -267,16 +262,8 @@ theorem HasLines.exists_bijective_of_card_eq [HasLines P L] [Fintype P] [Fintype
267
262
classical
268
263
obtain ⟨f, hf1, hf2⟩ := Nondegenerate.exists_injective_of_card_le (ge_of_eq h)
269
264
have hf3 := (Fintype.bijective_iff_injective_and_card f).mpr ⟨hf1, h.symm⟩
270
- refine'
271
- ⟨f, hf3, fun l =>
272
- (Finset.sum_eq_sum_iff_of_le fun l _ => HasLines.pointCount_le_lineCount (hf2 l)).mp
273
- ((sum_lineCount_eq_sum_pointCount P L).symm.trans
274
- (Finset.sum_bij (fun l _ => f l) (fun l _ => Finset.mem_univ (f l))
275
- (fun l _ => refl (lineCount L (f l))) (fun l₁ l₂ hl₁ hl₂ hl => hf1 hl) fun p hp =>
276
- _).symm)
277
- l (Finset.mem_univ l)⟩
278
- obtain ⟨l, rfl⟩ := hf3.2 p
279
- exact ⟨l, Finset.mem_univ l, rfl⟩
265
+ exact ⟨f, hf3, fun l ↦ (sum_eq_sum_iff_of_le fun l _ ↦ pointCount_le_lineCount (hf2 l)).1
266
+ ((hf3.sum_comp _).trans (sum_lineCount_eq_sum_pointCount P L)).symm _ $ mem_univ _⟩
280
267
#align configuration.has_lines.exists_bijective_of_card_eq Configuration.HasLines.exists_bijective_of_card_eq
281
268
282
269
theorem HasLines.lineCount_eq_pointCount [HasLines P L] [Fintype P] [Fintype L]
@@ -290,15 +277,11 @@ theorem HasLines.lineCount_eq_pointCount [HasLines P L] [Fintype P] [Fintype L]
290
277
simp_rw [Finset.sum_const, Finset.card_univ, hPL, sum_lineCount_eq_sum_pointCount]
291
278
have step2 : ∑ i in s, lineCount L i.1 = ∑ i in s, pointCount P i.2 := by
292
279
rw [s.sum_finset_product Finset.univ fun p => Set.toFinset { l | p ∈ l }]
293
- rw [s.sum_finset_product_right Finset.univ fun l => Set.toFinset { p | p ∈ l }]
294
- refine'
295
- (Finset.sum_bij (fun l _ => f l) (fun l _ => Finset.mem_univ (f l)) (fun l hl => _)
296
- (fun _ _ _ _ h => hf1.1 h) fun p _ => _).symm
297
- · simp_rw [Finset.sum_const, Set.toFinset_card, ← Nat.card_eq_fintype_card]
298
- change pointCount P l • pointCount P l = lineCount L (f l) • lineCount L (f l)
299
- rw [hf2]
300
- · obtain ⟨l, hl⟩ := hf1.2 p
301
- exact ⟨l, Finset.mem_univ l, hl.symm⟩
280
+ rw [s.sum_finset_product_right Finset.univ fun l => Set.toFinset { p | p ∈ l }, eq_comm]
281
+ refine sum_bijective _ hf1 (by simp) fun l _ ↦ ?_
282
+ simp_rw [hf2, sum_const, Set.toFinset_card, ← Nat.card_eq_fintype_card]
283
+ change pointCount P l • _ = lineCount L (f l) • _
284
+ rw [hf2]
302
285
all_goals simp_rw [Finset.mem_univ, true_and_iff, Set.mem_toFinset]; exact fun p => Iff.rfl
303
286
have step3 : ∑ i in sᶜ, lineCount L i.1 = ∑ i in sᶜ, pointCount P i.2 := by
304
287
rwa [← s.sum_add_sum_compl, ← s.sum_add_sum_compl, step2, add_left_cancel_iff] at step1
0 commit comments