combinatorics.double_counting
⟷
Mathlib.Combinatorics.DoubleCounting
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.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -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"
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -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
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -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
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -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"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -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
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -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
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -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
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -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' /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -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'
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -37,7 +37,7 @@ and `t`.
open Finset Function Relator
-open BigOperators
+open scoped BigOperators
variable {α β : Type _}
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -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
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -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' /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/4c586d291f189eecb9d00581aeb3dd998ac34442
@@ -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
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
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.
@@ -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"
Take the content of
Algebra.BigOperators.List.Basic
Algebra.BigOperators.List.Lemmas
Algebra.BigOperators.Multiset.Basic
Algebra.BigOperators.Multiset.Lemmas
Algebra.BigOperators.Multiset.Order
Algebra.BigOperators.Order
and sort it into six files:
Algebra.Order.BigOperators.Group.List
. I credit Yakov for https://github.com/leanprover-community/mathlib/pull/8543.Algebra.Order.BigOperators.Group.Multiset
. Copyright inherited from Algebra.BigOperators.Multiset.Order
.Algebra.Order.BigOperators.Group.Finset
. Copyright inherited from Algebra.BigOperators.Order
.Algebra.Order.BigOperators.Ring.List
. I credit Stuart for https://github.com/leanprover-community/mathlib/pull/10184.Algebra.Order.BigOperators.Ring.Multiset
. I credit Ruben for https://github.com/leanprover-community/mathlib/pull/8787.Algebra.Order.BigOperators.Ring.Finset
. I credit Floris for https://github.com/leanprover-community/mathlib/pull/1294.Here are the design decisions at play:
Data.Nat.Order.Basic
in a few List
files.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.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.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.@@ -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"
Data.Set.Basic
from scripts/noshake.json
.example
s only,
move these example
s to a new test file.Order.Filter.Basic
dependency on Control.Traversable.Instances
,
as the relevant parts were moved to Order.Filter.ListTraverse
.lake exe shake --fix
.@@ -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"
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -33,7 +33,7 @@ open Finset Function Relator
open BigOperators
-variable {α β : Type _}
+variable {α β : Type*}
/-! ### Bipartite graph -/
@@ -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
@@ -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
This PR fixes two things:
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.#align
statements. (This was needed for a script I wrote for #3630.)@@ -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)]
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>
@@ -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. -/
@@ -34,8 +34,7 @@ and `t`.
open Finset Function Relator
--- Porting note: commented out the next line
--- open BigOperators
+open BigOperators
variable {α β : Type _}
The unported dependencies are