combinatorics.double_countingMathlib.Combinatorics.DoubleCounting

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2022 Yaël Dillies. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
 -/
-import Algebra.BigOperators.Order
+import Algebra.Order.BigOperators.Group.Finset
 
 #align_import combinatorics.double_counting from "leanprover-community/mathlib"@"327c3c0d9232d80e250dc8f65e7835b82b266ea5"
 
Diff
@@ -144,7 +144,14 @@ theorem card_mul_eq_card_mul [∀ a b, Decidable (r a b)]
 
 #print Finset.card_le_card_of_forall_subsingleton /-
 theorem card_le_card_of_forall_subsingleton (hs : ∀ a ∈ s, ∃ b, b ∈ t ∧ r a b)
-    (ht : ∀ b ∈ t, ({a ∈ s | r a b} : Set α).Subsingleton) : s.card ≤ t.card := by classical
+    (ht : ∀ b ∈ t, ({a ∈ s | r a b} : Set α).Subsingleton) : s.card ≤ t.card := by
+  classical simpa using
+    card_mul_le_card_mul _
+      (fun a h =>
+        card_pos.2 <|
+          (by rw [← coe_nonempty, coe_bipartite_above]; exact hs _ h :
+            (t.bipartite_above r a).Nonempty))
+      fun b h => card_le_one.2 <| by simp_rw [mem_bipartite_below]; exact ht _ h
 #align finset.card_le_card_of_forall_subsingleton Finset.card_le_card_of_forall_subsingleton
 -/
 
Diff
@@ -144,14 +144,7 @@ theorem card_mul_eq_card_mul [∀ a b, Decidable (r a b)]
 
 #print Finset.card_le_card_of_forall_subsingleton /-
 theorem card_le_card_of_forall_subsingleton (hs : ∀ a ∈ s, ∃ b, b ∈ t ∧ r a b)
-    (ht : ∀ b ∈ t, ({a ∈ s | r a b} : Set α).Subsingleton) : s.card ≤ t.card := by
-  classical simpa using
-    card_mul_le_card_mul _
-      (fun a h =>
-        card_pos.2 <|
-          (by rw [← coe_nonempty, coe_bipartite_above]; exact hs _ h :
-            (t.bipartite_above r a).Nonempty))
-      fun b h => card_le_one.2 <| by simp_rw [mem_bipartite_below]; exact ht _ h
+    (ht : ∀ b ∈ t, ({a ∈ s | r a b} : Set α).Subsingleton) : s.card ≤ t.card := by classical
 #align finset.card_le_card_of_forall_subsingleton Finset.card_le_card_of_forall_subsingleton
 -/
 
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2022 Yaël Dillies. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
 -/
-import Mathbin.Algebra.BigOperators.Order
+import Algebra.BigOperators.Order
 
 #align_import combinatorics.double_counting from "leanprover-community/mathlib"@"327c3c0d9232d80e250dc8f65e7835b82b266ea5"
 
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2022 Yaël Dillies. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
-
-! This file was ported from Lean 3 source module combinatorics.double_counting
-! leanprover-community/mathlib commit 327c3c0d9232d80e250dc8f65e7835b82b266ea5
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.BigOperators.Order
 
+#align_import combinatorics.double_counting from "leanprover-community/mathlib"@"327c3c0d9232d80e250dc8f65e7835b82b266ea5"
+
 /-!
 # Double countings
 
Diff
@@ -71,14 +71,18 @@ theorem bipartiteBelow_swap : t.bipartiteBelow (swap r) a = t.bipartiteAbove r a
 #align finset.bipartite_below_swap Finset.bipartiteBelow_swap
 -/
 
+#print Finset.bipartiteAbove_swap /-
 theorem bipartiteAbove_swap : s.bipartiteAbove (swap r) b = s.bipartiteBelow r b :=
   rfl
 #align finset.bipartite_above_swap Finset.bipartiteAbove_swap
+-/
 
+#print Finset.coe_bipartiteBelow /-
 @[simp, norm_cast]
 theorem coe_bipartiteBelow : (s.bipartiteBelow r b : Set α) = {a ∈ s | r a b} :=
   coe_filter _ _
 #align finset.coe_bipartite_below Finset.coe_bipartiteBelow
+-/
 
 #print Finset.coe_bipartiteAbove /-
 @[simp, norm_cast]
@@ -89,10 +93,12 @@ theorem coe_bipartiteAbove : (t.bipartiteAbove r a : Set β) = {b ∈ t | r a b}
 
 variable {s t a a' b b'}
 
+#print Finset.mem_bipartiteBelow /-
 @[simp]
 theorem mem_bipartiteBelow {a : α} : a ∈ s.bipartiteBelow r b ↔ a ∈ s ∧ r a b :=
   mem_filter
 #align finset.mem_bipartite_below Finset.mem_bipartiteBelow
+-/
 
 #print Finset.mem_bipartiteAbove /-
 @[simp]
@@ -101,11 +107,14 @@ theorem mem_bipartiteAbove {b : β} : b ∈ t.bipartiteAbove r a ↔ b ∈ t ∧
 #align finset.mem_bipartite_above Finset.mem_bipartiteAbove
 -/
 
+#print Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow /-
 theorem sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow [∀ a b, Decidable (r a b)] :
     ∑ a in s, (t.bipartiteAbove r a).card = ∑ b in t, (s.bipartiteBelow r b).card := by
   simp_rw [card_eq_sum_ones, bipartite_above, bipartite_below, sum_filter]; exact sum_comm
 #align finset.sum_card_bipartite_above_eq_sum_card_bipartite_below Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow
+-/
 
+#print Finset.card_mul_le_card_mul /-
 /-- Double counting argument. Considering `r` as a bipartite graph, the LHS is a lower bound on the
 number of edges while the RHS is an upper bound. -/
 theorem card_mul_le_card_mul [∀ a b, Decidable (r a b)]
@@ -117,6 +126,7 @@ theorem card_mul_le_card_mul [∀ a b, Decidable (r a b)]
       (sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow _)
     _ ≤ _ := t.sum_le_card_nsmul _ _ hn
 #align finset.card_mul_le_card_mul Finset.card_mul_le_card_mul
+-/
 
 #print Finset.card_mul_le_card_mul' /-
 theorem card_mul_le_card_mul' [∀ a b, Decidable (r a b)]
@@ -126,13 +136,16 @@ theorem card_mul_le_card_mul' [∀ a b, Decidable (r a b)]
 #align finset.card_mul_le_card_mul' Finset.card_mul_le_card_mul'
 -/
 
+#print Finset.card_mul_eq_card_mul /-
 theorem card_mul_eq_card_mul [∀ a b, Decidable (r a b)]
     (hm : ∀ a ∈ s, (t.bipartiteAbove r a).card = m)
     (hn : ∀ b ∈ t, (s.bipartiteBelow r b).card = n) : s.card * m = t.card * n :=
   (card_mul_le_card_mul _ (fun a ha => (hm a ha).ge) fun b hb => (hn b hb).le).antisymm <|
     card_mul_le_card_mul' _ (fun a ha => (hn a ha).ge) fun b hb => (hm b hb).le
 #align finset.card_mul_eq_card_mul Finset.card_mul_eq_card_mul
+-/
 
+#print Finset.card_le_card_of_forall_subsingleton /-
 theorem card_le_card_of_forall_subsingleton (hs : ∀ a ∈ s, ∃ b, b ∈ t ∧ r a b)
     (ht : ∀ b ∈ t, ({a ∈ s | r a b} : Set α).Subsingleton) : s.card ≤ t.card := by
   classical simpa using
@@ -143,6 +156,7 @@ theorem card_le_card_of_forall_subsingleton (hs : ∀ a ∈ s, ∃ b, b ∈ t 
             (t.bipartite_above r a).Nonempty))
       fun b h => card_le_one.2 <| by simp_rw [mem_bipartite_below]; exact ht _ h
 #align finset.card_le_card_of_forall_subsingleton Finset.card_le_card_of_forall_subsingleton
+-/
 
 #print Finset.card_le_card_of_forall_subsingleton' /-
 theorem card_le_card_of_forall_subsingleton' (ht : ∀ b ∈ t, ∃ a, a ∈ s ∧ r a b)
@@ -161,15 +175,19 @@ namespace Fintype
 
 variable [Fintype α] [Fintype β] {r : α → β → Prop}
 
+#print Fintype.card_le_card_of_leftTotal_unique /-
 theorem card_le_card_of_leftTotal_unique (h₁ : LeftTotal r) (h₂ : LeftUnique r) :
     Fintype.card α ≤ Fintype.card β :=
   card_le_card_of_forall_subsingleton r (by simpa using h₁) fun b _ a₁ ha₁ a₂ ha₂ => h₂ ha₁.2 ha₂.2
 #align fintype.card_le_card_of_left_total_unique Fintype.card_le_card_of_leftTotal_unique
+-/
 
+#print Fintype.card_le_card_of_rightTotal_unique /-
 theorem card_le_card_of_rightTotal_unique (h₁ : RightTotal r) (h₂ : RightUnique r) :
     Fintype.card β ≤ Fintype.card α :=
   card_le_card_of_forall_subsingleton' r (by simpa using h₁) fun b _ a₁ ha₁ a₂ ha₂ => h₂ ha₁.2 ha₂.2
 #align fintype.card_le_card_of_right_total_unique Fintype.card_le_card_of_rightTotal_unique
+-/
 
 end Fintype
 
Diff
@@ -102,7 +102,7 @@ theorem mem_bipartiteAbove {b : β} : b ∈ t.bipartiteAbove r a ↔ b ∈ t ∧
 -/
 
 theorem sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow [∀ a b, Decidable (r a b)] :
-    (∑ a in s, (t.bipartiteAbove r a).card) = ∑ b in t, (s.bipartiteBelow r b).card := by
+    ∑ a in s, (t.bipartiteAbove r a).card = ∑ b in t, (s.bipartiteBelow r b).card := by
   simp_rw [card_eq_sum_ones, bipartite_above, bipartite_below, sum_filter]; exact sum_comm
 #align finset.sum_card_bipartite_above_eq_sum_card_bipartite_below Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow
 
Diff
@@ -116,7 +116,6 @@ theorem card_mul_le_card_mul [∀ a b, Decidable (r a b)]
     _ = ∑ b in t, (s.bipartiteBelow r b).card :=
       (sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow _)
     _ ≤ _ := t.sum_le_card_nsmul _ _ hn
-    
 #align finset.card_mul_le_card_mul Finset.card_mul_le_card_mul
 
 #print Finset.card_mul_le_card_mul' /-
Diff
@@ -76,13 +76,13 @@ theorem bipartiteAbove_swap : s.bipartiteAbove (swap r) b = s.bipartiteBelow r b
 #align finset.bipartite_above_swap Finset.bipartiteAbove_swap
 
 @[simp, norm_cast]
-theorem coe_bipartiteBelow : (s.bipartiteBelow r b : Set α) = { a ∈ s | r a b } :=
+theorem coe_bipartiteBelow : (s.bipartiteBelow r b : Set α) = {a ∈ s | r a b} :=
   coe_filter _ _
 #align finset.coe_bipartite_below Finset.coe_bipartiteBelow
 
 #print Finset.coe_bipartiteAbove /-
 @[simp, norm_cast]
-theorem coe_bipartiteAbove : (t.bipartiteAbove r a : Set β) = { b ∈ t | r a b } :=
+theorem coe_bipartiteAbove : (t.bipartiteAbove r a : Set β) = {b ∈ t | r a b} :=
   coe_filter _ _
 #align finset.coe_bipartite_above Finset.coe_bipartiteAbove
 -/
@@ -135,19 +135,19 @@ theorem card_mul_eq_card_mul [∀ a b, Decidable (r a b)]
 #align finset.card_mul_eq_card_mul Finset.card_mul_eq_card_mul
 
 theorem card_le_card_of_forall_subsingleton (hs : ∀ a ∈ s, ∃ b, b ∈ t ∧ r a b)
-    (ht : ∀ b ∈ t, ({ a ∈ s | r a b } : Set α).Subsingleton) : s.card ≤ t.card := by
+    (ht : ∀ b ∈ t, ({a ∈ s | r a b} : Set α).Subsingleton) : s.card ≤ t.card := by
   classical simpa using
-      card_mul_le_card_mul _
-        (fun a h =>
-          card_pos.2 <|
-            (by rw [← coe_nonempty, coe_bipartite_above]; exact hs _ h :
-              (t.bipartite_above r a).Nonempty))
-        fun b h => card_le_one.2 <| by simp_rw [mem_bipartite_below]; exact ht _ h
+    card_mul_le_card_mul _
+      (fun a h =>
+        card_pos.2 <|
+          (by rw [← coe_nonempty, coe_bipartite_above]; exact hs _ h :
+            (t.bipartite_above r a).Nonempty))
+      fun b h => card_le_one.2 <| by simp_rw [mem_bipartite_below]; exact ht _ h
 #align finset.card_le_card_of_forall_subsingleton Finset.card_le_card_of_forall_subsingleton
 
 #print Finset.card_le_card_of_forall_subsingleton' /-
 theorem card_le_card_of_forall_subsingleton' (ht : ∀ b ∈ t, ∃ a, a ∈ s ∧ r a b)
-    (hs : ∀ a ∈ s, ({ b ∈ t | r a b } : Set β).Subsingleton) : t.card ≤ s.card :=
+    (hs : ∀ a ∈ s, ({b ∈ t | r a b} : Set β).Subsingleton) : t.card ≤ s.card :=
   card_le_card_of_forall_subsingleton (swap r) ht hs
 #align finset.card_le_card_of_forall_subsingleton' Finset.card_le_card_of_forall_subsingleton'
 -/
Diff
@@ -37,7 +37,7 @@ and `t`.
 
 open Finset Function Relator
 
-open BigOperators
+open scoped BigOperators
 
 variable {α β : Type _}
 
Diff
@@ -71,22 +71,10 @@ theorem bipartiteBelow_swap : t.bipartiteBelow (swap r) a = t.bipartiteAbove r a
 #align finset.bipartite_below_swap Finset.bipartiteBelow_swap
 -/
 
-/- warning: finset.bipartite_above_swap -> Finset.bipartiteAbove_swap is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : α -> β -> Prop) (s : Finset.{u1} α) (b : β) [_inst_2 : forall (a : α), Decidable (r a b)], Eq.{succ u1} (Finset.{u1} α) (Finset.bipartiteAbove.{u2, u1} β α (Function.swap.{succ u1, succ u2, 1} α β (fun (ᾰ : α) (ᾰ : β) => Prop) r) s b (fun (a : α) => _inst_2 a)) (Finset.bipartiteBelow.{u1, u2} α β r s b (fun (a : α) => _inst_2 a))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : α -> β -> Prop) (s : Finset.{u2} α) (b : β) [_inst_2 : forall (a : α), Decidable (r a b)], Eq.{succ u2} (Finset.{u2} α) (Finset.bipartiteAbove.{u1, u2} β α (Function.swap.{succ u2, succ u1, 1} α β (fun (ᾰ : α) (ᾰ : β) => Prop) r) s b (fun (a : α) => _inst_2 a)) (Finset.bipartiteBelow.{u2, u1} α β r s b (fun (a : α) => _inst_2 a))
-Case conversion may be inaccurate. Consider using '#align finset.bipartite_above_swap Finset.bipartiteAbove_swapₓ'. -/
 theorem bipartiteAbove_swap : s.bipartiteAbove (swap r) b = s.bipartiteBelow r b :=
   rfl
 #align finset.bipartite_above_swap Finset.bipartiteAbove_swap
 
-/- warning: finset.coe_bipartite_below -> Finset.coe_bipartiteBelow is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : α -> β -> Prop) (s : Finset.{u1} α) (b : β) [_inst_2 : forall (a : α), Decidable (r a b)], Eq.{succ u1} (Set.{u1} α) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) (Finset.{u1} α) (Set.{u1} α) (HasLiftT.mk.{succ u1, succ u1} (Finset.{u1} α) (Set.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} (Finset.{u1} α) (Set.{u1} α) (Finset.Set.hasCoeT.{u1} α))) (Finset.bipartiteBelow.{u1, u2} α β r s b (fun (a : α) => _inst_2 a))) (Sep.sep.{u1, u1} α (Set.{u1} α) (Set.hasSep.{u1} α) (fun (a : α) => r a b) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) (Finset.{u1} α) (Set.{u1} α) (HasLiftT.mk.{succ u1, succ u1} (Finset.{u1} α) (Set.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} (Finset.{u1} α) (Set.{u1} α) (Finset.Set.hasCoeT.{u1} α))) s))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : α -> β -> Prop) (s : Finset.{u2} α) (b : β) [_inst_2 : forall (a : α), Decidable (r a b)], Eq.{succ u2} (Set.{u2} α) (Finset.toSet.{u2} α (Finset.bipartiteBelow.{u2, u1} α β r s b (fun (a : α) => _inst_2 a))) (setOf.{u2} α (fun (a : α) => And (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) (r a b)))
-Case conversion may be inaccurate. Consider using '#align finset.coe_bipartite_below Finset.coe_bipartiteBelowₓ'. -/
 @[simp, norm_cast]
 theorem coe_bipartiteBelow : (s.bipartiteBelow r b : Set α) = { a ∈ s | r a b } :=
   coe_filter _ _
@@ -101,12 +89,6 @@ theorem coe_bipartiteAbove : (t.bipartiteAbove r a : Set β) = { b ∈ t | r a b
 
 variable {s t a a' b b'}
 
-/- warning: finset.mem_bipartite_below -> Finset.mem_bipartiteBelow is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : α -> β -> Prop) {s : Finset.{u1} α} {b : β} [_inst_2 : forall (a : α), Decidable (r a b)] {a : α}, Iff (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a (Finset.bipartiteBelow.{u1, u2} α β r s b (fun (a : α) => _inst_2 a))) (And (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s) (r a b))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : α -> β -> Prop) {s : Finset.{u2} α} {b : β} [_inst_2 : forall (a : α), Decidable (r a b)] {a : α}, Iff (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a (Finset.bipartiteBelow.{u2, u1} α β r s b (fun (a : α) => _inst_2 a))) (And (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) (r a b))
-Case conversion may be inaccurate. Consider using '#align finset.mem_bipartite_below Finset.mem_bipartiteBelowₓ'. -/
 @[simp]
 theorem mem_bipartiteBelow {a : α} : a ∈ s.bipartiteBelow r b ↔ a ∈ s ∧ r a b :=
   mem_filter
@@ -119,23 +101,11 @@ theorem mem_bipartiteAbove {b : β} : b ∈ t.bipartiteAbove r a ↔ b ∈ t ∧
 #align finset.mem_bipartite_above Finset.mem_bipartiteAbove
 -/
 
-/- warning: finset.sum_card_bipartite_above_eq_sum_card_bipartite_below -> Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : α -> β -> Prop) {s : Finset.{u1} α} {t : Finset.{u2} β} [_inst_3 : forall (a : α) (b : β), Decidable (r a b)], Eq.{1} Nat (Finset.sum.{0, u1} Nat α Nat.addCommMonoid s (fun (a : α) => Finset.card.{u2} β (Finset.bipartiteAbove.{u1, u2} α β r t a (fun (a_1 : β) => _inst_3 a a_1)))) (Finset.sum.{0, u2} Nat β Nat.addCommMonoid t (fun (b : β) => Finset.card.{u1} α (Finset.bipartiteBelow.{u1, u2} α β r s b (fun (a : α) => _inst_3 a b))))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : α -> β -> Prop) {s : Finset.{u2} α} {t : Finset.{u1} β} [_inst_3 : forall (a : α) (b : β), Decidable (r a b)], Eq.{1} Nat (Finset.sum.{0, u2} Nat α Nat.addCommMonoid s (fun (a : α) => Finset.card.{u1} β (Finset.bipartiteAbove.{u2, u1} α β r t a (fun (a_1 : β) => _inst_3 a a_1)))) (Finset.sum.{0, u1} Nat β Nat.addCommMonoid t (fun (b : β) => Finset.card.{u2} α (Finset.bipartiteBelow.{u2, u1} α β r s b (fun (a : α) => _inst_3 a b))))
-Case conversion may be inaccurate. Consider using '#align finset.sum_card_bipartite_above_eq_sum_card_bipartite_below Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelowₓ'. -/
 theorem sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow [∀ a b, Decidable (r a b)] :
     (∑ a in s, (t.bipartiteAbove r a).card) = ∑ b in t, (s.bipartiteBelow r b).card := by
   simp_rw [card_eq_sum_ones, bipartite_above, bipartite_below, sum_filter]; exact sum_comm
 #align finset.sum_card_bipartite_above_eq_sum_card_bipartite_below Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow
 
-/- warning: finset.card_mul_le_card_mul -> Finset.card_mul_le_card_mul is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : α -> β -> Prop) {s : Finset.{u1} α} {t : Finset.{u2} β} {m : Nat} {n : Nat} [_inst_3 : forall (a : α) (b : β), Decidable (r a b)], (forall (a : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s) -> (LE.le.{0} Nat Nat.hasLe m (Finset.card.{u2} β (Finset.bipartiteAbove.{u1, u2} α β r t a (fun (a_1 : β) => _inst_3 a a_1))))) -> (forall (b : β), (Membership.Mem.{u2, u2} β (Finset.{u2} β) (Finset.hasMem.{u2} β) b t) -> (LE.le.{0} Nat Nat.hasLe (Finset.card.{u1} α (Finset.bipartiteBelow.{u1, u2} α β r s b (fun (a : α) => _inst_3 a b))) n)) -> (LE.le.{0} Nat Nat.hasLe (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) (Finset.card.{u1} α s) m) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) (Finset.card.{u2} β t) n))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : α -> β -> Prop) {s : Finset.{u2} α} {t : Finset.{u1} β} {m : Nat} {n : Nat} [_inst_3 : forall (a : α) (b : β), Decidable (r a b)], (forall (a : α), (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) -> (LE.le.{0} Nat instLENat m (Finset.card.{u1} β (Finset.bipartiteAbove.{u2, u1} α β r t a (fun (a_1 : β) => _inst_3 a a_1))))) -> (forall (b : β), (Membership.mem.{u1, u1} β (Finset.{u1} β) (Finset.instMembershipFinset.{u1} β) b t) -> (LE.le.{0} Nat instLENat (Finset.card.{u2} α (Finset.bipartiteBelow.{u2, u1} α β r s b (fun (a : α) => _inst_3 a b))) n)) -> (LE.le.{0} Nat instLENat (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (Finset.card.{u2} α s) m) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (Finset.card.{u1} β t) n))
-Case conversion may be inaccurate. Consider using '#align finset.card_mul_le_card_mul Finset.card_mul_le_card_mulₓ'. -/
 /-- Double counting argument. Considering `r` as a bipartite graph, the LHS is a lower bound on the
 number of edges while the RHS is an upper bound. -/
 theorem card_mul_le_card_mul [∀ a b, Decidable (r a b)]
@@ -157,12 +127,6 @@ theorem card_mul_le_card_mul' [∀ a b, Decidable (r a b)]
 #align finset.card_mul_le_card_mul' Finset.card_mul_le_card_mul'
 -/
 
-/- warning: finset.card_mul_eq_card_mul -> Finset.card_mul_eq_card_mul is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : α -> β -> Prop) {s : Finset.{u1} α} {t : Finset.{u2} β} {m : Nat} {n : Nat} [_inst_3 : forall (a : α) (b : β), Decidable (r a b)], (forall (a : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s) -> (Eq.{1} Nat (Finset.card.{u2} β (Finset.bipartiteAbove.{u1, u2} α β r t a (fun (a_1 : β) => _inst_3 a a_1))) m)) -> (forall (b : β), (Membership.Mem.{u2, u2} β (Finset.{u2} β) (Finset.hasMem.{u2} β) b t) -> (Eq.{1} Nat (Finset.card.{u1} α (Finset.bipartiteBelow.{u1, u2} α β r s b (fun (a : α) => _inst_3 a b))) n)) -> (Eq.{1} Nat (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) (Finset.card.{u1} α s) m) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat Nat.hasMul) (Finset.card.{u2} β t) n))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : α -> β -> Prop) {s : Finset.{u2} α} {t : Finset.{u1} β} {m : Nat} {n : Nat} [_inst_3 : forall (a : α) (b : β), Decidable (r a b)], (forall (a : α), (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) -> (Eq.{1} Nat (Finset.card.{u1} β (Finset.bipartiteAbove.{u2, u1} α β r t a (fun (a_1 : β) => _inst_3 a a_1))) m)) -> (forall (b : β), (Membership.mem.{u1, u1} β (Finset.{u1} β) (Finset.instMembershipFinset.{u1} β) b t) -> (Eq.{1} Nat (Finset.card.{u2} α (Finset.bipartiteBelow.{u2, u1} α β r s b (fun (a : α) => _inst_3 a b))) n)) -> (Eq.{1} Nat (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (Finset.card.{u2} α s) m) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (Finset.card.{u1} β t) n))
-Case conversion may be inaccurate. Consider using '#align finset.card_mul_eq_card_mul Finset.card_mul_eq_card_mulₓ'. -/
 theorem card_mul_eq_card_mul [∀ a b, Decidable (r a b)]
     (hm : ∀ a ∈ s, (t.bipartiteAbove r a).card = m)
     (hn : ∀ b ∈ t, (s.bipartiteBelow r b).card = n) : s.card * m = t.card * n :=
@@ -170,12 +134,6 @@ theorem card_mul_eq_card_mul [∀ a b, Decidable (r a b)]
     card_mul_le_card_mul' _ (fun a ha => (hn a ha).ge) fun b hb => (hm b hb).le
 #align finset.card_mul_eq_card_mul Finset.card_mul_eq_card_mul
 
-/- warning: finset.card_le_card_of_forall_subsingleton -> Finset.card_le_card_of_forall_subsingleton is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} (r : α -> β -> Prop) {s : Finset.{u1} α} {t : Finset.{u2} β}, (forall (a : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s) -> (Exists.{succ u2} β (fun (b : β) => And (Membership.Mem.{u2, u2} β (Finset.{u2} β) (Finset.hasMem.{u2} β) b t) (r a b)))) -> (forall (b : β), (Membership.Mem.{u2, u2} β (Finset.{u2} β) (Finset.hasMem.{u2} β) b t) -> (Set.Subsingleton.{u1} α (Sep.sep.{u1, u1} α (Set.{u1} α) (Set.hasSep.{u1} α) (fun (a : α) => r a b) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) (Finset.{u1} α) (Set.{u1} α) (HasLiftT.mk.{succ u1, succ u1} (Finset.{u1} α) (Set.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} (Finset.{u1} α) (Set.{u1} α) (Finset.Set.hasCoeT.{u1} α))) s)))) -> (LE.le.{0} Nat Nat.hasLe (Finset.card.{u1} α s) (Finset.card.{u2} β t))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} (r : α -> β -> Prop) {s : Finset.{u2} α} {t : Finset.{u1} β}, (forall (a : α), (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) -> (Exists.{succ u1} β (fun (b : β) => And (Membership.mem.{u1, u1} β (Finset.{u1} β) (Finset.instMembershipFinset.{u1} β) b t) (r a b)))) -> (forall (b : β), (Membership.mem.{u1, u1} β (Finset.{u1} β) (Finset.instMembershipFinset.{u1} β) b t) -> (Set.Subsingleton.{u2} α (setOf.{u2} α (fun (a : α) => And (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) (r a b))))) -> (LE.le.{0} Nat instLENat (Finset.card.{u2} α s) (Finset.card.{u1} β t))
-Case conversion may be inaccurate. Consider using '#align finset.card_le_card_of_forall_subsingleton Finset.card_le_card_of_forall_subsingletonₓ'. -/
 theorem card_le_card_of_forall_subsingleton (hs : ∀ a ∈ s, ∃ b, b ∈ t ∧ r a b)
     (ht : ∀ b ∈ t, ({ a ∈ s | r a b } : Set α).Subsingleton) : s.card ≤ t.card := by
   classical simpa using
@@ -204,23 +162,11 @@ namespace Fintype
 
 variable [Fintype α] [Fintype β] {r : α → β → Prop}
 
-/- warning: fintype.card_le_card_of_left_total_unique -> Fintype.card_le_card_of_leftTotal_unique is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Fintype.{u1} α] [_inst_2 : Fintype.{u2} β] {r : α -> β -> Prop}, (Relator.LeftTotal.{u1, u2} α β r) -> (Relator.LeftUnique.{u1, u2} α β r) -> (LE.le.{0} Nat Nat.hasLe (Fintype.card.{u1} α _inst_1) (Fintype.card.{u2} β _inst_2))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Fintype.{u2} α] [_inst_2 : Fintype.{u1} β] {r : α -> β -> Prop}, (Relator.LeftTotal.{u2, u1} α β r) -> (Relator.LeftUnique.{u2, u1} α β r) -> (LE.le.{0} Nat instLENat (Fintype.card.{u2} α _inst_1) (Fintype.card.{u1} β _inst_2))
-Case conversion may be inaccurate. Consider using '#align fintype.card_le_card_of_left_total_unique Fintype.card_le_card_of_leftTotal_uniqueₓ'. -/
 theorem card_le_card_of_leftTotal_unique (h₁ : LeftTotal r) (h₂ : LeftUnique r) :
     Fintype.card α ≤ Fintype.card β :=
   card_le_card_of_forall_subsingleton r (by simpa using h₁) fun b _ a₁ ha₁ a₂ ha₂ => h₂ ha₁.2 ha₂.2
 #align fintype.card_le_card_of_left_total_unique Fintype.card_le_card_of_leftTotal_unique
 
-/- warning: fintype.card_le_card_of_right_total_unique -> Fintype.card_le_card_of_rightTotal_unique is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Fintype.{u1} α] [_inst_2 : Fintype.{u2} β] {r : α -> β -> Prop}, (Relator.RightTotal.{u1, u2} α β r) -> (Relator.RightUnique.{u1, u2} α β r) -> (LE.le.{0} Nat Nat.hasLe (Fintype.card.{u2} β _inst_2) (Fintype.card.{u1} α _inst_1))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Fintype.{u2} α] [_inst_2 : Fintype.{u1} β] {r : α -> β -> Prop}, (Relator.RightTotal.{u2, u1} α β r) -> (Relator.RightUnique.{u2, u1} α β r) -> (LE.le.{0} Nat instLENat (Fintype.card.{u1} β _inst_2) (Fintype.card.{u2} α _inst_1))
-Case conversion may be inaccurate. Consider using '#align fintype.card_le_card_of_right_total_unique Fintype.card_le_card_of_rightTotal_uniqueₓ'. -/
 theorem card_le_card_of_rightTotal_unique (h₁ : RightTotal r) (h₂ : RightUnique r) :
     Fintype.card β ≤ Fintype.card α :=
   card_le_card_of_forall_subsingleton' r (by simpa using h₁) fun b _ a₁ ha₁ a₂ ha₂ => h₂ ha₁.2 ha₂.2
Diff
@@ -126,10 +126,8 @@ but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} (r : α -> β -> Prop) {s : Finset.{u2} α} {t : Finset.{u1} β} [_inst_3 : forall (a : α) (b : β), Decidable (r a b)], Eq.{1} Nat (Finset.sum.{0, u2} Nat α Nat.addCommMonoid s (fun (a : α) => Finset.card.{u1} β (Finset.bipartiteAbove.{u2, u1} α β r t a (fun (a_1 : β) => _inst_3 a a_1)))) (Finset.sum.{0, u1} Nat β Nat.addCommMonoid t (fun (b : β) => Finset.card.{u2} α (Finset.bipartiteBelow.{u2, u1} α β r s b (fun (a : α) => _inst_3 a b))))
 Case conversion may be inaccurate. Consider using '#align finset.sum_card_bipartite_above_eq_sum_card_bipartite_below Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelowₓ'. -/
 theorem sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow [∀ a b, Decidable (r a b)] :
-    (∑ a in s, (t.bipartiteAbove r a).card) = ∑ b in t, (s.bipartiteBelow r b).card :=
-  by
-  simp_rw [card_eq_sum_ones, bipartite_above, bipartite_below, sum_filter]
-  exact sum_comm
+    (∑ a in s, (t.bipartiteAbove r a).card) = ∑ b in t, (s.bipartiteBelow r b).card := by
+  simp_rw [card_eq_sum_ones, bipartite_above, bipartite_below, sum_filter]; exact sum_comm
 #align finset.sum_card_bipartite_above_eq_sum_card_bipartite_below Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow
 
 /- warning: finset.card_mul_le_card_mul -> Finset.card_mul_le_card_mul is a dubious translation:
@@ -184,13 +182,9 @@ theorem card_le_card_of_forall_subsingleton (hs : ∀ a ∈ s, ∃ b, b ∈ t 
       card_mul_le_card_mul _
         (fun a h =>
           card_pos.2 <|
-            (by
-              rw [← coe_nonempty, coe_bipartite_above]
-              exact hs _ h : (t.bipartite_above r a).Nonempty))
-        fun b h =>
-        card_le_one.2 <| by
-          simp_rw [mem_bipartite_below]
-          exact ht _ h
+            (by rw [← coe_nonempty, coe_bipartite_above]; exact hs _ h :
+              (t.bipartite_above r a).Nonempty))
+        fun b h => card_le_one.2 <| by simp_rw [mem_bipartite_below]; exact ht _ h
 #align finset.card_le_card_of_forall_subsingleton Finset.card_le_card_of_forall_subsingleton
 
 #print Finset.card_le_card_of_forall_subsingleton' /-
Diff
@@ -146,7 +146,7 @@ theorem card_mul_le_card_mul [∀ a b, Decidable (r a b)]
   calc
     _ ≤ ∑ a in s, (t.bipartiteAbove r a).card := s.card_nsmul_le_sum _ _ hm
     _ = ∑ b in t, (s.bipartiteBelow r b).card :=
-      sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow _
+      (sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow _)
     _ ≤ _ := t.sum_le_card_nsmul _ _ hn
     
 #align finset.card_mul_le_card_mul Finset.card_mul_le_card_mul

Changes in mathlib4

mathlib3
mathlib4
chore: split Subsingleton,Nontrivial off of Data.Set.Basic (#11832)

Moves definition of and lemmas related to Set.Subsingleton and Set.Nontrivial to a new file, so that Basic can be shorter.

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
 -/
 import Mathlib.Algebra.Order.BigOperators.Group.Finset
-import Mathlib.Data.Set.Basic
+import Mathlib.Data.Set.Subsingleton
 
 #align_import combinatorics.double_counting from "leanprover-community/mathlib"@"1126441d6bccf98c81214a0780c73d499f6721fe"
 
chore: Sort big operator order lemmas (#11750)

Take the content of

  • some of Algebra.BigOperators.List.Basic
  • some of Algebra.BigOperators.List.Lemmas
  • some of Algebra.BigOperators.Multiset.Basic
  • some of Algebra.BigOperators.Multiset.Lemmas
  • Algebra.BigOperators.Multiset.Order
  • Algebra.BigOperators.Order

and sort it into six files:

Here are the design decisions at play:

  • Pure algebra and big operators algebra shouldn't import (algebraic) order theory. This PR makes that better, but not perfect because we still import Data.Nat.Order.Basic in a few List files.
  • It's Algebra.Order.BigOperators instead of Algebra.BigOperators.Order because algebraic order theory is more of a theory than big operators algebra. Another reason is that algebraic order theory is the only way to mix pure order and pure algebra, while there are more ways to mix pure finiteness and pure algebra than just big operators.
  • There are separate files for group/monoid lemmas vs ring lemmas. Groups/monoids are the natural setup for big operators, so their lemmas shouldn't be mixed with ring lemmas that involves both addition and multiplication. As a result, everything under Algebra.Order.BigOperators.Group should be additivisable (except a few Nat- or Int-specific lemmas). In contrast, things under Algebra.Order.BigOperators.Ring are more prone to having heavy imports.
  • Lemmas are separated according to List vs Multiset vs Finset. This is not strictly necessary, and can be relaxed in cases where there aren't that many lemmas to be had. As an example, I could split out the AbsoluteValue lemmas from Algebra.Order.BigOperators.Ring.Finset to a file Algebra.Order.BigOperators.Ring.AbsoluteValue and it could stay this way until too many lemmas are in this file (or a split is needed for import reasons), in which case we would need files Algebra.Order.BigOperators.Ring.AbsoluteValue.Finset, Algebra.Order.BigOperators.Ring.AbsoluteValue.Multiset, etc...
  • Finsupp big operator and finprod/finsum order lemmas also belong in Algebra.Order.BigOperators. I haven't done so in this PR because the diff is big enough like that.
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2022 Yaël Dillies. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
 -/
-import Mathlib.Algebra.BigOperators.Order
+import Mathlib.Algebra.Order.BigOperators.Group.Finset
 import Mathlib.Data.Set.Basic
 
 #align_import combinatorics.double_counting from "leanprover-community/mathlib"@"1126441d6bccf98c81214a0780c73d499f6721fe"
chore(*): shake imports (#10199)
  • Remove Data.Set.Basic from scripts/noshake.json.
  • Remove an exception that was used by examples only, move these examples to a new test file.
  • Drop an exception for Order.Filter.Basic dependency on Control.Traversable.Instances, as the relevant parts were moved to Order.Filter.ListTraverse.
  • Run lake exe shake --fix.
Diff
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
 -/
 import Mathlib.Algebra.BigOperators.Order
+import Mathlib.Data.Set.Basic
 
 #align_import combinatorics.double_counting from "leanprover-community/mathlib"@"1126441d6bccf98c81214a0780c73d499f6721fe"
 
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -33,7 +33,7 @@ open Finset Function Relator
 
 open BigOperators
 
-variable {α β : Type _}
+variable {α β : Type*}
 
 /-! ### Bipartite graph -/
 
chore: fix grammar mistakes (#6121)
Diff
@@ -16,7 +16,7 @@ This file gathers a few double counting arguments.
 
 In a bipartite graph (considered as a relation `r : α → β → Prop`), we can bound the number of edges
 between `s : Finset α` and `t : Finset β` by the minimum/maximum of edges over all `a ∈ s` times the
-the size of `s`. Similarly for `t`. Combining those two yields inequalities between the sizes of `s`
+size of `s`. Similarly for `t`. Combining those two yields inequalities between the sizes of `s`
 and `t`.
 
 * `bipartiteBelow`: `s.bipartiteBelow r b` are the elements of `s` below `b` wrt to `r`. Its size
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2022 Yaël Dillies. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Yaël Dillies
-
-! This file was ported from Lean 3 source module combinatorics.double_counting
-! leanprover-community/mathlib commit 1126441d6bccf98c81214a0780c73d499f6721fe
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.BigOperators.Order
 
+#align_import combinatorics.double_counting from "leanprover-community/mathlib"@"1126441d6bccf98c81214a0780c73d499f6721fe"
+
 /-!
 # Double countings
 
chore: fix #align lines (#3640)

This PR fixes two things:

  • Most align statements for definitions and theorems and instances that are separated by two newlines from the relevant declaration (s/\n\n#align/\n#align). This is often seen in the mathport output after ending calc blocks.
  • All remaining more-than-one-line #align statements. (This was needed for a script I wrote for #3630.)
Diff
@@ -96,7 +96,6 @@ theorem card_mul_le_card_mul [∀ a b, Decidable (r a b)]
     _ = ∑ b in t, (s.bipartiteBelow r b).card :=
       sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow _
     _ ≤ _ := t.sum_le_card_nsmul _ _ hn
-
 #align finset.card_mul_le_card_mul Finset.card_mul_le_card_mul
 
 theorem card_mul_le_card_mul' [∀ a b, Decidable (r a b)]
chore: fix align linebreaks (#3103)

Apparently we have CI scripts that assume those fall on a single line. The command line used to fix the aligns was:

find . -type f -name "*.lean" -exec sed -i -E 'N;s/^#align ([^[:space:]]+)\n *([^[:space:]]+)$/#align \1 \2/' {} \;

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -84,8 +84,7 @@ theorem sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow [∀ a b, Decidable (
     (∑ a in s, (t.bipartiteAbove r a).card) = ∑ b in t, (s.bipartiteBelow r b).card := by
   simp_rw [card_eq_sum_ones, bipartiteAbove, bipartiteBelow, sum_filter]
   exact sum_comm
-#align finset.sum_card_bipartite_above_eq_sum_card_bipartite_below
-  Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow
+#align finset.sum_card_bipartite_above_eq_sum_card_bipartite_below Finset.sum_card_bipartiteAbove_eq_sum_card_bipartiteBelow
 
 /-- Double counting argument. Considering `r` as a bipartite graph, the LHS is a lower bound on the
 number of edges while the RHS is an upper bound. -/
chore: scoped BigOperators notation (#1952)
Diff
@@ -34,8 +34,7 @@ and `t`.
 
 open Finset Function Relator
 
--- Porting note: commented out the next line
--- open BigOperators
+open BigOperators
 
 variable {α β : Type _}
 
feat port: Combinatorics.DoubleCounting (#1715)

Dependencies 3 + 206

207 files ported (98.6%)
90290 lines ported (98.9%)
Show graph

The unported dependencies are