data.finset.preimageMathlib.Data.Finset.Preimage

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

(last sync)

feat(combinatorics/simple_graph): More clique lemmas (#19203)

More lemmas about is_clique, is_n_clique, edge_set. Also define clique_free_on, a local version of clique_free.

Diff
@@ -61,6 +61,10 @@ finset.coe_injective (by simp)
   preimage sᶜ f (hf.inj_on _) = (preimage s f (hf.inj_on _))ᶜ :=
 finset.coe_injective (by simp)
 
+@[simp] lemma preimage_map (f : α ↪ β) (s : finset α) :
+  (s.map f).preimage f (f.injective.inj_on _) = s :=
+coe_injective $ by simp only [coe_preimage, coe_map, set.preimage_image_eq _ f.injective]
+
 lemma monotone_preimage {f : α → β} (h : injective f) :
   monotone (λ s, preimage s f (h.inj_on _)) :=
 λ s t hst x hx, mem_preimage.2 (hst $ mem_preimage.1 hx)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -163,7 +163,7 @@ theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
 theorem sigma_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σ a, β a)) (t : Finset α) :
     (t.Sigma fun a => s.Preimage (Sigma.mk a) <| sigma_mk_injective.InjOn _) =
       s.filterₓ fun a => a.1 ∈ t :=
-  by ext x; simp [and_comm']
+  by ext x; simp [and_comm]
 #align finset.sigma_preimage_mk Finset.sigma_preimage_mk
 -/
 
Diff
@@ -146,7 +146,7 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 #align finset.preimage_subset Finset.preimage_subset
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (u «expr ⊆ » t) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:642:2: warning: expanding binder collection (u «expr ⊆ » t) -/
 #print Finset.subset_map_iff /-
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
     s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by
Diff
@@ -118,7 +118,8 @@ theorem image_subset_iff_subset_preimage [DecidableEq β] {f : α → β} {s : F
 
 #print Finset.map_subset_iff_subset_preimage /-
 theorem map_subset_iff_subset_preimage {f : α ↪ β} {s : Finset α} {t : Finset β} :
-    s.map f ⊆ t ↔ s ⊆ t.Preimage f (f.Injective.InjOn _) := by classical
+    s.map f ⊆ t ↔ s ⊆ t.Preimage f (f.Injective.InjOn _) := by
+  classical rw [map_eq_image, image_subset_iff_subset_preimage]
 #align finset.map_subset_iff_subset_preimage Finset.map_subset_iff_subset_preimage
 -/
 
@@ -148,7 +149,13 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 /- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (u «expr ⊆ » t) -/
 #print Finset.subset_map_iff /-
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
-    s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by classical
+    s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by
+  classical
+  refine' ⟨fun h => ⟨_, preimage_subset h, _⟩, _⟩
+  · rw [map_eq_image, image_preimage, filter_true_of_mem fun x hx => _]
+    exact coe_map_subset_range _ _ (h hx)
+  · rintro ⟨u, hut, rfl⟩
+    exact map_subset_map.2 hut
 #align finset.subset_map_iff Finset.subset_map_iff
 -/
 
@@ -196,7 +203,10 @@ theorem prod_preimage' [CommMonoid β] (f : α → γ) [DecidablePred fun x => x
 @[to_additive]
 theorem prod_preimage [CommMonoid β] (f : α → γ) (s : Finset γ) (hf : Set.InjOn f (f ⁻¹' ↑s))
     (g : γ → β) (hg : ∀ x ∈ s, x ∉ Set.range f → g x = 1) :
-    ∏ x in s.Preimage f hf, g (f x) = ∏ x in s, g x := by classical
+    ∏ x in s.Preimage f hf, g (f x) = ∏ x in s, g x := by
+  classical
+  rw [prod_preimage', prod_filter_of_ne]
+  exact fun x hx => Not.imp_symm (hg x hx)
 #align finset.prod_preimage Finset.prod_preimage
 #align finset.sum_preimage Finset.sum_preimage
 -/
Diff
@@ -118,8 +118,7 @@ theorem image_subset_iff_subset_preimage [DecidableEq β] {f : α → β} {s : F
 
 #print Finset.map_subset_iff_subset_preimage /-
 theorem map_subset_iff_subset_preimage {f : α ↪ β} {s : Finset α} {t : Finset β} :
-    s.map f ⊆ t ↔ s ⊆ t.Preimage f (f.Injective.InjOn _) := by
-  classical rw [map_eq_image, image_subset_iff_subset_preimage]
+    s.map f ⊆ t ↔ s ⊆ t.Preimage f (f.Injective.InjOn _) := by classical
 #align finset.map_subset_iff_subset_preimage Finset.map_subset_iff_subset_preimage
 -/
 
@@ -149,13 +148,7 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 /- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (u «expr ⊆ » t) -/
 #print Finset.subset_map_iff /-
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
-    s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by
-  classical
-  refine' ⟨fun h => ⟨_, preimage_subset h, _⟩, _⟩
-  · rw [map_eq_image, image_preimage, filter_true_of_mem fun x hx => _]
-    exact coe_map_subset_range _ _ (h hx)
-  · rintro ⟨u, hut, rfl⟩
-    exact map_subset_map.2 hut
+    s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by classical
 #align finset.subset_map_iff Finset.subset_map_iff
 -/
 
@@ -203,10 +196,7 @@ theorem prod_preimage' [CommMonoid β] (f : α → γ) [DecidablePred fun x => x
 @[to_additive]
 theorem prod_preimage [CommMonoid β] (f : α → γ) (s : Finset γ) (hf : Set.InjOn f (f ⁻¹' ↑s))
     (g : γ → β) (hg : ∀ x ∈ s, x ∉ Set.range f → g x = 1) :
-    ∏ x in s.Preimage f hf, g (f x) = ∏ x in s, g x := by
-  classical
-  rw [prod_preimage', prod_filter_of_ne]
-  exact fun x hx => Not.imp_symm (hg x hx)
+    ∏ x in s.Preimage f hf, g (f x) = ∏ x in s, g x := by classical
 #align finset.prod_preimage Finset.prod_preimage
 #align finset.sum_preimage Finset.sum_preimage
 -/
Diff
@@ -95,10 +95,12 @@ theorem preimage_compl [DecidableEq α] [DecidableEq β] [Fintype α] [Fintype 
 #align finset.preimage_compl Finset.preimage_compl
 -/
 
+#print Finset.preimage_map /-
 @[simp]
 theorem preimage_map (f : α ↪ β) (s : Finset α) : (s.map f).Preimage f (f.Injective.InjOn _) = s :=
   coe_injective <| by simp only [coe_preimage, coe_map, Set.preimage_image_eq _ f.injective]
 #align finset.preimage_map Finset.preimage_map
+-/
 
 #print Finset.monotone_preimage /-
 theorem monotone_preimage {f : α → β} (h : Injective f) :
Diff
@@ -6,7 +6,7 @@ Authors: Johannes Hölzl, Mario Carneiro
 import Data.Set.Finite
 import Algebra.BigOperators.Basic
 
-#align_import data.finset.preimage from "leanprover-community/mathlib"@"327c3c0d9232d80e250dc8f65e7835b82b266ea5"
+#align_import data.finset.preimage from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
 
 /-!
 # Preimage of a `finset` under an injective map.
@@ -95,6 +95,11 @@ theorem preimage_compl [DecidableEq α] [DecidableEq β] [Fintype α] [Fintype 
 #align finset.preimage_compl Finset.preimage_compl
 -/
 
+@[simp]
+theorem preimage_map (f : α ↪ β) (s : Finset α) : (s.map f).Preimage f (f.Injective.InjOn _) = s :=
+  coe_injective <| by simp only [coe_preimage, coe_map, Set.preimage_image_eq _ f.injective]
+#align finset.preimage_map Finset.preimage_map
+
 #print Finset.monotone_preimage /-
 theorem monotone_preimage {f : α → β} (h : Injective f) :
     Monotone fun s => preimage s f (h.InjOn _) := fun s t hst x hx =>
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johannes Hölzl, Mario Carneiro
 -/
-import Mathbin.Data.Set.Finite
-import Mathbin.Algebra.BigOperators.Basic
+import Data.Set.Finite
+import Algebra.BigOperators.Basic
 
 #align_import data.finset.preimage from "leanprover-community/mathlib"@"327c3c0d9232d80e250dc8f65e7835b82b266ea5"
 
@@ -139,7 +139,7 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 #align finset.preimage_subset Finset.preimage_subset
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (u «expr ⊆ » t) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:641:2: warning: expanding binder collection (u «expr ⊆ » t) -/
 #print Finset.subset_map_iff /-
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
     s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johannes Hölzl, Mario Carneiro
-
-! This file was ported from Lean 3 source module data.finset.preimage
-! 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.Data.Set.Finite
 import Mathbin.Algebra.BigOperators.Basic
 
+#align_import data.finset.preimage from "leanprover-community/mathlib"@"327c3c0d9232d80e250dc8f65e7835b82b266ea5"
+
 /-!
 # Preimage of a `finset` under an injective map.
 
@@ -142,7 +139,7 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 #align finset.preimage_subset Finset.preimage_subset
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (u «expr ⊆ » t) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (u «expr ⊆ » t) -/
 #print Finset.subset_map_iff /-
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
     s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by
Diff
@@ -155,23 +155,29 @@ theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
 #align finset.subset_map_iff Finset.subset_map_iff
 -/
 
+#print Finset.sigma_preimage_mk /-
 theorem sigma_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σ a, β a)) (t : Finset α) :
     (t.Sigma fun a => s.Preimage (Sigma.mk a) <| sigma_mk_injective.InjOn _) =
       s.filterₓ fun a => a.1 ∈ t :=
   by ext x; simp [and_comm']
 #align finset.sigma_preimage_mk Finset.sigma_preimage_mk
+-/
 
+#print Finset.sigma_preimage_mk_of_subset /-
 theorem sigma_preimage_mk_of_subset {β : α → Type _} [DecidableEq α] (s : Finset (Σ a, β a))
     {t : Finset α} (ht : s.image Sigma.fst ⊆ t) :
     (t.Sigma fun a => s.Preimage (Sigma.mk a) <| sigma_mk_injective.InjOn _) = s := by
   rw [sigma_preimage_mk, filter_true_of_mem <| image_subset_iff.1 ht]
 #align finset.sigma_preimage_mk_of_subset Finset.sigma_preimage_mk_of_subset
+-/
 
+#print Finset.sigma_image_fst_preimage_mk /-
 theorem sigma_image_fst_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σ a, β a)) :
     ((s.image Sigma.fst).Sigma fun a => s.Preimage (Sigma.mk a) <| sigma_mk_injective.InjOn _) =
       s :=
   s.sigma_preimage_mk_of_subset (Subset.refl _)
 #align finset.sigma_image_fst_preimage_mk Finset.sigma_image_fst_preimage_mk
+-/
 
 end Preimage
 
@@ -189,6 +195,7 @@ theorem prod_preimage' [CommMonoid β] (f : α → γ) [DecidablePred fun x => x
 #align finset.sum_preimage' Finset.sum_preimage'
 -/
 
+#print Finset.prod_preimage /-
 @[to_additive]
 theorem prod_preimage [CommMonoid β] (f : α → γ) (s : Finset γ) (hf : Set.InjOn f (f ⁻¹' ↑s))
     (g : γ → β) (hg : ∀ x ∈ s, x ∉ Set.range f → g x = 1) :
@@ -198,6 +205,7 @@ theorem prod_preimage [CommMonoid β] (f : α → γ) (s : Finset γ) (hf : Set.
   exact fun x hx => Not.imp_symm (hg x hx)
 #align finset.prod_preimage Finset.prod_preimage
 #align finset.sum_preimage Finset.sum_preimage
+-/
 
 #print Finset.prod_preimage_of_bij /-
 @[to_additive]
Diff
@@ -179,10 +179,10 @@ end Preimage
 @[to_additive]
 theorem prod_preimage' [CommMonoid β] (f : α → γ) [DecidablePred fun x => x ∈ Set.range f]
     (s : Finset γ) (hf : Set.InjOn f (f ⁻¹' ↑s)) (g : γ → β) :
-    (∏ x in s.Preimage f hf, g (f x)) = ∏ x in s.filterₓ fun x => x ∈ Set.range f, g x := by
+    ∏ x in s.Preimage f hf, g (f x) = ∏ x in s.filterₓ fun x => x ∈ Set.range f, g x := by
   haveI := Classical.decEq γ <;>
     calc
-      (∏ x in preimage s f hf, g (f x)) = ∏ x in image f (preimage s f hf), g x :=
+      ∏ x in preimage s f hf, g (f x) = ∏ x in image f (preimage s f hf), g x :=
         Eq.symm <| prod_image <| by simpa only [mem_preimage, inj_on] using hf
       _ = ∏ x in s.filter fun x => x ∈ Set.range f, g x := by rw [image_preimage]
 #align finset.prod_preimage' Finset.prod_preimage'
@@ -192,7 +192,7 @@ theorem prod_preimage' [CommMonoid β] (f : α → γ) [DecidablePred fun x => x
 @[to_additive]
 theorem prod_preimage [CommMonoid β] (f : α → γ) (s : Finset γ) (hf : Set.InjOn f (f ⁻¹' ↑s))
     (g : γ → β) (hg : ∀ x ∈ s, x ∉ Set.range f → g x = 1) :
-    (∏ x in s.Preimage f hf, g (f x)) = ∏ x in s, g x := by
+    ∏ x in s.Preimage f hf, g (f x) = ∏ x in s, g x := by
   classical
   rw [prod_preimage', prod_filter_of_ne]
   exact fun x hx => Not.imp_symm (hg x hx)
@@ -203,7 +203,7 @@ theorem prod_preimage [CommMonoid β] (f : α → γ) (s : Finset γ) (hf : Set.
 @[to_additive]
 theorem prod_preimage_of_bij [CommMonoid β] (f : α → γ) (s : Finset γ)
     (hf : Set.BijOn f (f ⁻¹' ↑s) ↑s) (g : γ → β) :
-    (∏ x in s.Preimage f hf.InjOn, g (f x)) = ∏ x in s, g x :=
+    ∏ x in s.Preimage f hf.InjOn, g (f x) = ∏ x in s, g x :=
   prod_preimage _ _ hf.InjOn g fun x hxs hxf => (hxf <| hf.subset_range hxs).elim
 #align finset.prod_preimage_of_bij Finset.prod_preimage_of_bij
 #align finset.sum_preimage_of_bij Finset.sum_preimage_of_bij
Diff
@@ -185,7 +185,6 @@ theorem prod_preimage' [CommMonoid β] (f : α → γ) [DecidablePred fun x => x
       (∏ x in preimage s f hf, g (f x)) = ∏ x in image f (preimage s f hf), g x :=
         Eq.symm <| prod_image <| by simpa only [mem_preimage, inj_on] using hf
       _ = ∏ x in s.filter fun x => x ∈ Set.range f, g x := by rw [image_preimage]
-      
 #align finset.prod_preimage' Finset.prod_preimage'
 #align finset.sum_preimage' Finset.sum_preimage'
 -/
Diff
@@ -142,7 +142,7 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 #align finset.preimage_subset Finset.preimage_subset
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (u «expr ⊆ » t) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:638:2: warning: expanding binder collection (u «expr ⊆ » t) -/
 #print Finset.subset_map_iff /-
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
     s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by
Diff
@@ -147,11 +147,11 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
     s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by
   classical
-    refine' ⟨fun h => ⟨_, preimage_subset h, _⟩, _⟩
-    · rw [map_eq_image, image_preimage, filter_true_of_mem fun x hx => _]
-      exact coe_map_subset_range _ _ (h hx)
-    · rintro ⟨u, hut, rfl⟩
-      exact map_subset_map.2 hut
+  refine' ⟨fun h => ⟨_, preimage_subset h, _⟩, _⟩
+  · rw [map_eq_image, image_preimage, filter_true_of_mem fun x hx => _]
+    exact coe_map_subset_range _ _ (h hx)
+  · rintro ⟨u, hut, rfl⟩
+    exact map_subset_map.2 hut
 #align finset.subset_map_iff Finset.subset_map_iff
 -/
 
@@ -195,8 +195,8 @@ theorem prod_preimage [CommMonoid β] (f : α → γ) (s : Finset γ) (hf : Set.
     (g : γ → β) (hg : ∀ x ∈ s, x ∉ Set.range f → g x = 1) :
     (∏ x in s.Preimage f hf, g (f x)) = ∏ x in s, g x := by
   classical
-    rw [prod_preimage', prod_filter_of_ne]
-    exact fun x hx => Not.imp_symm (hg x hx)
+  rw [prod_preimage', prod_filter_of_ne]
+  exact fun x hx => Not.imp_symm (hg x hx)
 #align finset.prod_preimage Finset.prod_preimage
 #align finset.sum_preimage Finset.sum_preimage
 
Diff
@@ -145,7 +145,7 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 /- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (u «expr ⊆ » t) -/
 #print Finset.subset_map_iff /-
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
-    s ⊆ t.map f ↔ ∃ (u : _)(_ : u ⊆ t), s = u.map f := by
+    s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by
   classical
     refine' ⟨fun h => ⟨_, preimage_subset h, _⟩, _⟩
     · rw [map_eq_image, image_preimage, filter_true_of_mem fun x hx => _]
@@ -155,19 +155,19 @@ theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
 #align finset.subset_map_iff Finset.subset_map_iff
 -/
 
-theorem sigma_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σa, β a)) (t : Finset α) :
+theorem sigma_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σ a, β a)) (t : Finset α) :
     (t.Sigma fun a => s.Preimage (Sigma.mk a) <| sigma_mk_injective.InjOn _) =
       s.filterₓ fun a => a.1 ∈ t :=
   by ext x; simp [and_comm']
 #align finset.sigma_preimage_mk Finset.sigma_preimage_mk
 
-theorem sigma_preimage_mk_of_subset {β : α → Type _} [DecidableEq α] (s : Finset (Σa, β a))
+theorem sigma_preimage_mk_of_subset {β : α → Type _} [DecidableEq α] (s : Finset (Σ a, β a))
     {t : Finset α} (ht : s.image Sigma.fst ⊆ t) :
     (t.Sigma fun a => s.Preimage (Sigma.mk a) <| sigma_mk_injective.InjOn _) = s := by
   rw [sigma_preimage_mk, filter_true_of_mem <| image_subset_iff.1 ht]
 #align finset.sigma_preimage_mk_of_subset Finset.sigma_preimage_mk_of_subset
 
-theorem sigma_image_fst_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σa, β a)) :
+theorem sigma_image_fst_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σ a, β a)) :
     ((s.image Sigma.fst).Sigma fun a => s.Preimage (Sigma.mk a) <| sigma_mk_injective.InjOn _) =
       s :=
   s.sigma_preimage_mk_of_subset (Subset.refl _)
Diff
@@ -21,7 +21,7 @@ import Mathbin.Algebra.BigOperators.Basic
 
 open Set Function
 
-open BigOperators
+open scoped BigOperators
 
 universe u v w x
 
Diff
@@ -155,36 +155,18 @@ theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
 #align finset.subset_map_iff Finset.subset_map_iff
 -/
 
-/- warning: finset.sigma_preimage_mk -> Finset.sigma_preimage_mk is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : α -> Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (t : Finset.{u1} α), Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (i : α) => β i))) (Finset.sigma.{u1, u2} α (fun (a : α) => β a) t (fun (a : α) => Finset.preimage.{u2, max u1 u2} (β a) (Sigma.{u1, u2} α (fun (a : α) => β a)) s (Sigma.mk.{u1, u2} α (fun (a : α) => β a) a) (Function.Injective.injOn.{u2, max u1 u2} (β a) (Sigma.{u1, u2} α (fun (a : α) => β a)) (Sigma.mk.{u1, u2} α (fun (a : α) => β a) a) (sigma_mk_injective.{u1, u2} α (fun (a : α) => β a) a) (Set.preimage.{u2, max u1 u2} (β a) (Sigma.{u1, u2} α (fun (a : α) => β a)) (Sigma.mk.{u1, u2} α (fun (a : α) => β a) a) ((fun (a : Type.{max u1 u2}) (b : Type.{max u1 u2}) [self : HasLiftT.{succ (max u1 u2), succ (max u1 u2)} a b] => self.0) (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Set.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (HasLiftT.mk.{succ (max u1 u2), succ (max u1 u2)} (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Set.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (CoeTCₓ.coe.{succ (max u1 u2), succ (max u1 u2)} (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Set.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Finset.Set.hasCoeT.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))))) s))))) (Finset.filter.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a)) (fun (a : Sigma.{u1, u2} α (fun (a : α) => β a)) => Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) (Sigma.fst.{u1, u2} α (fun (a : α) => β a) a) t) (fun (a : Sigma.{u1, u2} α (fun (a : α) => β a)) => Finset.decidableMem.{u1} α (fun (a : α) (b : α) => _inst_1 a b) (Sigma.fst.{u1, u2} α (fun (a : α) => β a) a) t) s)
-but is expected to have type
-  forall {α : Type.{u2}} {β : α -> Type.{u1}} [_inst_1 : DecidableEq.{succ u2} α] (s : Finset.{max u1 u2} (Sigma.{u2, u1} α (fun (a : α) => β a))) (t : Finset.{u2} α), Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Sigma.{u2, u1} α (fun (i : α) => β i))) (Finset.sigma.{u2, u1} α (fun (a : α) => β a) t (fun (a : α) => Finset.preimage.{u1, max u2 u1} (β a) (Sigma.{u2, u1} α (fun (a : α) => β a)) s (Sigma.mk.{u2, u1} α (fun (a : α) => β a) a) (Function.Injective.injOn.{max u1 u2, u1} (β a) (Sigma.{u2, u1} α (fun (a : α) => β a)) (Sigma.mk.{u2, u1} α (fun (a : α) => β a) a) (sigma_mk_injective.{u2, u1} α (fun (a : α) => β a) a) (Set.preimage.{u1, max u2 u1} (β a) (Sigma.{u2, u1} α (fun (a : α) => β a)) (Sigma.mk.{u2, u1} α (fun (a : α) => β a) a) (Finset.toSet.{max u2 u1} (Sigma.{u2, u1} α (fun (a : α) => β a)) s))))) (Finset.filter.{max u2 u1} (Sigma.{u2, u1} α (fun (a : α) => β a)) (fun (a : Sigma.{u2, u1} α (fun (a : α) => β a)) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) (Sigma.fst.{u2, u1} α (fun (a : α) => β a) a) t) (fun (a : Sigma.{u2, u1} α (fun (a : α) => β a)) => Finset.decidableMem.{u2} α (fun (a : α) (b : α) => _inst_1 a b) (Sigma.fst.{u2, u1} α (fun (a : α) => β a) a) t) s)
-Case conversion may be inaccurate. Consider using '#align finset.sigma_preimage_mk Finset.sigma_preimage_mkₓ'. -/
 theorem sigma_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σa, β a)) (t : Finset α) :
     (t.Sigma fun a => s.Preimage (Sigma.mk a) <| sigma_mk_injective.InjOn _) =
       s.filterₓ fun a => a.1 ∈ t :=
   by ext x; simp [and_comm']
 #align finset.sigma_preimage_mk Finset.sigma_preimage_mk
 
-/- warning: finset.sigma_preimage_mk_of_subset -> Finset.sigma_preimage_mk_of_subset is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : α -> Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) {t : Finset.{u1} α}, (HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.hasSubset.{u1} α) (Finset.image.{max u1 u2, u1} (Sigma.{u1, u2} α (fun (a : α) => β a)) α (fun (a : α) (b : α) => _inst_1 a b) (Sigma.fst.{u1, u2} α (fun (a : α) => β a)) s) t) -> (Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (i : α) => β i))) (Finset.sigma.{u1, u2} α (fun (a : α) => β a) t (fun (a : α) => Finset.preimage.{u2, max u1 u2} (β a) (Sigma.{u1, u2} α (fun (a : α) => β a)) s (Sigma.mk.{u1, u2} α (fun (a : α) => β a) a) (Function.Injective.injOn.{u2, max u1 u2} (β a) (Sigma.{u1, u2} α (fun (a : α) => β a)) (Sigma.mk.{u1, u2} α (fun (a : α) => β a) a) (sigma_mk_injective.{u1, u2} α (fun (a : α) => β a) a) (Set.preimage.{u2, max u1 u2} (β a) (Sigma.{u1, u2} α (fun (a : α) => β a)) (Sigma.mk.{u1, u2} α (fun (a : α) => β a) a) ((fun (a : Type.{max u1 u2}) (b : Type.{max u1 u2}) [self : HasLiftT.{succ (max u1 u2), succ (max u1 u2)} a b] => self.0) (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Set.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (HasLiftT.mk.{succ (max u1 u2), succ (max u1 u2)} (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Set.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (CoeTCₓ.coe.{succ (max u1 u2), succ (max u1 u2)} (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Set.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Finset.Set.hasCoeT.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))))) s))))) s)
-but is expected to have type
-  forall {α : Type.{u2}} {β : α -> Type.{u1}} [_inst_1 : DecidableEq.{succ u2} α] (s : Finset.{max u1 u2} (Sigma.{u2, u1} α (fun (a : α) => β a))) {t : Finset.{u2} α}, (HasSubset.Subset.{u2} (Finset.{u2} α) (Finset.instHasSubsetFinset.{u2} α) (Finset.image.{max u1 u2, u2} (Sigma.{u2, u1} α (fun (a : α) => β a)) α (fun (a : α) (b : α) => _inst_1 a b) (Sigma.fst.{u2, u1} α (fun (a : α) => β a)) s) t) -> (Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Sigma.{u2, u1} α (fun (i : α) => β i))) (Finset.sigma.{u2, u1} α (fun (a : α) => β a) t (fun (a : α) => Finset.preimage.{u1, max u2 u1} (β a) (Sigma.{u2, u1} α (fun (a : α) => β a)) s (Sigma.mk.{u2, u1} α (fun (a : α) => β a) a) (Function.Injective.injOn.{max u1 u2, u1} (β a) (Sigma.{u2, u1} α (fun (a : α) => β a)) (Sigma.mk.{u2, u1} α (fun (a : α) => β a) a) (sigma_mk_injective.{u2, u1} α (fun (a : α) => β a) a) (Set.preimage.{u1, max u2 u1} (β a) (Sigma.{u2, u1} α (fun (a : α) => β a)) (Sigma.mk.{u2, u1} α (fun (a : α) => β a) a) (Finset.toSet.{max u2 u1} (Sigma.{u2, u1} α (fun (a : α) => β a)) s))))) s)
-Case conversion may be inaccurate. Consider using '#align finset.sigma_preimage_mk_of_subset Finset.sigma_preimage_mk_of_subsetₓ'. -/
 theorem sigma_preimage_mk_of_subset {β : α → Type _} [DecidableEq α] (s : Finset (Σa, β a))
     {t : Finset α} (ht : s.image Sigma.fst ⊆ t) :
     (t.Sigma fun a => s.Preimage (Sigma.mk a) <| sigma_mk_injective.InjOn _) = s := by
   rw [sigma_preimage_mk, filter_true_of_mem <| image_subset_iff.1 ht]
 #align finset.sigma_preimage_mk_of_subset Finset.sigma_preimage_mk_of_subset
 
-/- warning: finset.sigma_image_fst_preimage_mk -> Finset.sigma_image_fst_preimage_mk is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : α -> Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] (s : Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))), Eq.{succ (max u1 u2)} (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (i : α) => β i))) (Finset.sigma.{u1, u2} α (fun (a : α) => β a) (Finset.image.{max u1 u2, u1} (Sigma.{u1, u2} α (fun (a : α) => β a)) α (fun (a : α) (b : α) => _inst_1 a b) (Sigma.fst.{u1, u2} α (fun (a : α) => β a)) s) (fun (a : α) => Finset.preimage.{u2, max u1 u2} (β a) (Sigma.{u1, u2} α (fun (a : α) => β a)) s (Sigma.mk.{u1, u2} α (fun (a : α) => β a) a) (Function.Injective.injOn.{u2, max u1 u2} (β a) (Sigma.{u1, u2} α (fun (a : α) => β a)) (Sigma.mk.{u1, u2} α (fun (a : α) => β a) a) (sigma_mk_injective.{u1, u2} α (fun (a : α) => β a) a) (Set.preimage.{u2, max u1 u2} (β a) (Sigma.{u1, u2} α (fun (a : α) => β a)) (Sigma.mk.{u1, u2} α (fun (a : α) => β a) a) ((fun (a : Type.{max u1 u2}) (b : Type.{max u1 u2}) [self : HasLiftT.{succ (max u1 u2), succ (max u1 u2)} a b] => self.0) (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Set.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (HasLiftT.mk.{succ (max u1 u2), succ (max u1 u2)} (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Set.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (CoeTCₓ.coe.{succ (max u1 u2), succ (max u1 u2)} (Finset.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Set.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))) (Finset.Set.hasCoeT.{max u1 u2} (Sigma.{u1, u2} α (fun (a : α) => β a))))) s))))) s
-but is expected to have type
-  forall {α : Type.{u2}} {β : α -> Type.{u1}} [_inst_1 : DecidableEq.{succ u2} α] (s : Finset.{max u1 u2} (Sigma.{u2, u1} α (fun (a : α) => β a))), Eq.{max (succ u2) (succ u1)} (Finset.{max u1 u2} (Sigma.{u2, u1} α (fun (i : α) => β i))) (Finset.sigma.{u2, u1} α (fun (a : α) => β a) (Finset.image.{max u1 u2, u2} (Sigma.{u2, u1} α (fun (a : α) => β a)) α (fun (a : α) (b : α) => _inst_1 a b) (Sigma.fst.{u2, u1} α (fun (a : α) => β a)) s) (fun (a : α) => Finset.preimage.{u1, max u2 u1} (β a) (Sigma.{u2, u1} α (fun (a : α) => β a)) s (Sigma.mk.{u2, u1} α (fun (a : α) => β a) a) (Function.Injective.injOn.{max u1 u2, u1} (β a) (Sigma.{u2, u1} α (fun (a : α) => β a)) (Sigma.mk.{u2, u1} α (fun (a : α) => β a) a) (sigma_mk_injective.{u2, u1} α (fun (a : α) => β a) a) (Set.preimage.{u1, max u2 u1} (β a) (Sigma.{u2, u1} α (fun (a : α) => β a)) (Sigma.mk.{u2, u1} α (fun (a : α) => β a) a) (Finset.toSet.{max u2 u1} (Sigma.{u2, u1} α (fun (a : α) => β a)) s))))) s
-Case conversion may be inaccurate. Consider using '#align finset.sigma_image_fst_preimage_mk Finset.sigma_image_fst_preimage_mkₓ'. -/
 theorem sigma_image_fst_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σa, β a)) :
     ((s.image Sigma.fst).Sigma fun a => s.Preimage (Sigma.mk a) <| sigma_mk_injective.InjOn _) =
       s :=
@@ -208,12 +190,6 @@ theorem prod_preimage' [CommMonoid β] (f : α → γ) [DecidablePred fun x => x
 #align finset.sum_preimage' Finset.sum_preimage'
 -/
 
-/- warning: finset.prod_preimage -> Finset.prod_preimage is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : CommMonoid.{u2} β] (f : α -> γ) (s : Finset.{u3} γ) (hf : Set.InjOn.{u1, u3} α γ f (Set.preimage.{u1, u3} α γ f ((fun (a : Type.{u3}) (b : Type.{u3}) [self : HasLiftT.{succ u3, succ u3} a b] => self.0) (Finset.{u3} γ) (Set.{u3} γ) (HasLiftT.mk.{succ u3, succ u3} (Finset.{u3} γ) (Set.{u3} γ) (CoeTCₓ.coe.{succ u3, succ u3} (Finset.{u3} γ) (Set.{u3} γ) (Finset.Set.hasCoeT.{u3} γ))) s))) (g : γ -> β), (forall (x : γ), (Membership.Mem.{u3, u3} γ (Finset.{u3} γ) (Finset.hasMem.{u3} γ) x s) -> (Not (Membership.Mem.{u3, u3} γ (Set.{u3} γ) (Set.hasMem.{u3} γ) x (Set.range.{u3, succ u1} γ α f))) -> (Eq.{succ u2} β (g x) (OfNat.ofNat.{u2} β 1 (OfNat.mk.{u2} β 1 (One.one.{u2} β (MulOneClass.toHasOne.{u2} β (Monoid.toMulOneClass.{u2} β (CommMonoid.toMonoid.{u2} β _inst_1)))))))) -> (Eq.{succ u2} β (Finset.prod.{u2, u1} β α _inst_1 (Finset.preimage.{u1, u3} α γ s f hf) (fun (x : α) => g (f x))) (Finset.prod.{u2, u3} β γ _inst_1 s (fun (x : γ) => g x)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : CommMonoid.{u2} β] (f : α -> γ) (s : Finset.{u3} γ) (hf : Set.InjOn.{u1, u3} α γ f (Set.preimage.{u1, u3} α γ f (Finset.toSet.{u3} γ s))) (g : γ -> β), (forall (x : γ), (Membership.mem.{u3, u3} γ (Finset.{u3} γ) (Finset.instMembershipFinset.{u3} γ) x s) -> (Not (Membership.mem.{u3, u3} γ (Set.{u3} γ) (Set.instMembershipSet.{u3} γ) x (Set.range.{u3, succ u1} γ α f))) -> (Eq.{succ u2} β (g x) (OfNat.ofNat.{u2} β 1 (One.toOfNat1.{u2} β (Monoid.toOne.{u2} β (CommMonoid.toMonoid.{u2} β _inst_1)))))) -> (Eq.{succ u2} β (Finset.prod.{u2, u1} β α _inst_1 (Finset.preimage.{u1, u3} α γ s f hf) (fun (x : α) => g (f x))) (Finset.prod.{u2, u3} β γ _inst_1 s (fun (x : γ) => g x)))
-Case conversion may be inaccurate. Consider using '#align finset.prod_preimage Finset.prod_preimageₓ'. -/
 @[to_additive]
 theorem prod_preimage [CommMonoid β] (f : α → γ) (s : Finset γ) (hf : Set.InjOn f (f ⁻¹' ↑s))
     (g : γ → β) (hg : ∀ x ∈ s, x ∉ Set.range f → g x = 1) :
Diff
@@ -164,9 +164,7 @@ Case conversion may be inaccurate. Consider using '#align finset.sigma_preimage_
 theorem sigma_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σa, β a)) (t : Finset α) :
     (t.Sigma fun a => s.Preimage (Sigma.mk a) <| sigma_mk_injective.InjOn _) =
       s.filterₓ fun a => a.1 ∈ t :=
-  by
-  ext x
-  simp [and_comm']
+  by ext x; simp [and_comm']
 #align finset.sigma_preimage_mk Finset.sigma_preimage_mk
 
 /- warning: finset.sigma_preimage_mk_of_subset -> Finset.sigma_preimage_mk_of_subset is a dubious translation:
Diff
@@ -89,18 +89,14 @@ theorem preimage_union [DecidableEq α] [DecidableEq β] {f : α → β} {s t :
 #align finset.preimage_union Finset.preimage_union
 -/
 
-/- warning: finset.preimage_compl -> Finset.preimage_compl is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : DecidableEq.{succ u2} β] [_inst_3 : Fintype.{u1} α] [_inst_4 : Fintype.{u2} β] {f : α -> β} (s : Finset.{u2} β) (hf : Function.Injective.{succ u1, succ u2} α β f), Eq.{succ u1} (Finset.{u1} α) (Finset.preimage.{u1, u2} α β (HasCompl.compl.{u2} (Finset.{u2} β) (BooleanAlgebra.toHasCompl.{u2} (Finset.{u2} β) (Finset.booleanAlgebra.{u2} β _inst_4 (fun (a : β) (b : β) => _inst_2 a b))) s) f (Function.Injective.injOn.{u1, u2} α β f hf (Set.preimage.{u1, u2} α β f ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Finset.{u2} β) (Set.{u2} β) (HasLiftT.mk.{succ u2, succ u2} (Finset.{u2} β) (Set.{u2} β) (CoeTCₓ.coe.{succ u2, succ u2} (Finset.{u2} β) (Set.{u2} β) (Finset.Set.hasCoeT.{u2} β))) (HasCompl.compl.{u2} (Finset.{u2} β) (BooleanAlgebra.toHasCompl.{u2} (Finset.{u2} β) (Finset.booleanAlgebra.{u2} β _inst_4 (fun (a : β) (b : β) => _inst_2 a b))) s))))) (HasCompl.compl.{u1} (Finset.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Finset.{u1} α) (Finset.booleanAlgebra.{u1} α _inst_3 (fun (a : α) (b : α) => _inst_1 a b))) (Finset.preimage.{u1, u2} α β s f (Function.Injective.injOn.{u1, u2} α β f hf (Set.preimage.{u1, u2} α β f ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (Finset.{u2} β) (Set.{u2} β) (HasLiftT.mk.{succ u2, succ u2} (Finset.{u2} β) (Set.{u2} β) (CoeTCₓ.coe.{succ u2, succ u2} (Finset.{u2} β) (Set.{u2} β) (Finset.Set.hasCoeT.{u2} β))) s)))))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : DecidableEq.{succ u2} β] [_inst_3 : Fintype.{u1} α] [_inst_4 : Fintype.{u2} β] {f : α -> β} (s : Finset.{u2} β) (hf : Function.Injective.{succ u1, succ u2} α β f), Eq.{succ u1} (Finset.{u1} α) (Finset.preimage.{u1, u2} α β (HasCompl.compl.{u2} (Finset.{u2} β) (BooleanAlgebra.toHasCompl.{u2} (Finset.{u2} β) (Finset.instBooleanAlgebraFinset.{u2} β _inst_4 (fun (a : β) (b : β) => _inst_2 a b))) s) f (Function.Injective.injOn.{u2, u1} α β f hf (Set.preimage.{u1, u2} α β f (Finset.toSet.{u2} β (HasCompl.compl.{u2} (Finset.{u2} β) (BooleanAlgebra.toHasCompl.{u2} (Finset.{u2} β) (Finset.instBooleanAlgebraFinset.{u2} β _inst_4 (fun (a : β) (b : β) => _inst_2 a b))) s))))) (HasCompl.compl.{u1} (Finset.{u1} α) (BooleanAlgebra.toHasCompl.{u1} (Finset.{u1} α) (Finset.instBooleanAlgebraFinset.{u1} α _inst_3 (fun (a : α) (b : α) => _inst_1 a b))) (Finset.preimage.{u1, u2} α β s f (Function.Injective.injOn.{u2, u1} α β f hf (Set.preimage.{u1, u2} α β f (Finset.toSet.{u2} β s)))))
-Case conversion may be inaccurate. Consider using '#align finset.preimage_compl Finset.preimage_complₓ'. -/
+#print Finset.preimage_compl /-
 @[simp]
 theorem preimage_compl [DecidableEq α] [DecidableEq β] [Fintype α] [Fintype β] {f : α → β}
     (s : Finset β) (hf : Function.Injective f) :
     preimage (sᶜ) f (hf.InjOn _) = preimage s f (hf.InjOn _)ᶜ :=
   Finset.coe_injective (by simp)
 #align finset.preimage_compl Finset.preimage_compl
+-/
 
 #print Finset.monotone_preimage /-
 theorem monotone_preimage {f : α → β} (h : Injective f) :
Diff
@@ -146,7 +146,7 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 #align finset.preimage_subset Finset.preimage_subset
 -/
 
-/- ./././Mathport/Syntax/Translate/Basic.lean:628:2: warning: expanding binder collection (u «expr ⊆ » t) -/
+/- ./././Mathport/Syntax/Translate/Basic.lean:635:2: warning: expanding binder collection (u «expr ⊆ » t) -/
 #print Finset.subset_map_iff /-
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
     s ⊆ t.map f ↔ ∃ (u : _)(_ : u ⊆ t), s = u.map f := by

Changes in mathlib4

mathlib3
mathlib4
chore: Make Finset.preimage not depend on Finset.sum (#11601)

and Data.Finset.LocallyFinite not depend on Finset.sum too

Diff
@@ -4,7 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johannes Hölzl, Mario Carneiro
 -/
 import Mathlib.Data.Set.Finite
-import Mathlib.Algebra.BigOperators.Basic
 
 #align_import data.finset.preimage from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
 
@@ -12,11 +11,10 @@ import Mathlib.Algebra.BigOperators.Basic
 # Preimage of a `Finset` under an injective map.
 -/
 
+assert_not_exists Finset.sum
 
 open Set Function
 
-open BigOperators
-
 universe u v w x
 
 variable {α : Type u} {β : Type v} {ι : Sort w} {γ : Type x}
@@ -138,35 +136,4 @@ theorem sigma_image_fst_preimage_mk {β : α → Type*} [DecidableEq α] (s : Fi
 #align finset.sigma_image_fst_preimage_mk Finset.sigma_image_fst_preimage_mk
 
 end Preimage
-
-@[to_additive]
-theorem prod_preimage' [CommMonoid β] (f : α → γ) [DecidablePred fun x => x ∈ Set.range f]
-    (s : Finset γ) (hf : Set.InjOn f (f ⁻¹' ↑s)) (g : γ → β) :
-    (∏ x in s.preimage f hf, g (f x)) = ∏ x in s.filter fun x => x ∈ Set.range f, g x := by
-  haveI := Classical.decEq γ
-  calc
-    (∏ x in preimage s f hf, g (f x)) = ∏ x in image f (preimage s f hf), g x :=
-      Eq.symm <| prod_image <| by simpa only [mem_preimage, InjOn] using hf
-    _ = ∏ x in s.filter fun x => x ∈ Set.range f, g x := by rw [image_preimage]
-#align finset.prod_preimage' Finset.prod_preimage'
-#align finset.sum_preimage' Finset.sum_preimage'
-
-@[to_additive]
-theorem prod_preimage [CommMonoid β] (f : α → γ) (s : Finset γ) (hf : Set.InjOn f (f ⁻¹' ↑s))
-    (g : γ → β) (hg : ∀ x ∈ s, x ∉ Set.range f → g x = 1) :
-    (∏ x in s.preimage f hf, g (f x)) = ∏ x in s, g x := by
-  classical
-    rw [prod_preimage', prod_filter_of_ne]
-    exact fun x hx => Not.imp_symm (hg x hx)
-#align finset.prod_preimage Finset.prod_preimage
-#align finset.sum_preimage Finset.sum_preimage
-
-@[to_additive]
-theorem prod_preimage_of_bij [CommMonoid β] (f : α → γ) (s : Finset γ)
-    (hf : Set.BijOn f (f ⁻¹' ↑s) ↑s) (g : γ → β) :
-    (∏ x in s.preimage f hf.injOn, g (f x)) = ∏ x in s, g x :=
-  prod_preimage _ _ hf.injOn g fun _ hs h_f => (h_f <| hf.subset_range hs).elim
-#align finset.prod_preimage_of_bij Finset.prod_preimage_of_bij
-#align finset.sum_preimage_of_bij Finset.sum_preimage_of_bij
-
 end Finset
chore: tidy various files (#11490)
Diff
@@ -113,7 +113,7 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 #align finset.preimage_subset Finset.preimage_subset
 
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
-    s ⊆ t.map f ↔ ∃ u, u ⊆ t ∧ s = u.map f := by
+    s ⊆ t.map f ↔ ∃ u ⊆ t, s = u.map f := by
   classical
   simp_rw [← coe_subset, coe_map, subset_image_iff, map_eq_image, eq_comm]
 #align finset.subset_map_iff Finset.subset_map_iff
chore(*): use ∃ x ∈ s, _ instead of ∃ (x) (_ : x ∈ s), _ (#9184)

Search for [∀∃].*(_ and manually replace some occurrences with more readable versions. In case of , the new expressions are defeq to the old ones. In case of , they differ by exists_prop.

In some rare cases, golf proofs that needed fixing.

Diff
@@ -113,13 +113,9 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 #align finset.preimage_subset Finset.preimage_subset
 
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
-    s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by
+    s ⊆ t.map f ↔ ∃ u, u ⊆ t ∧ s = u.map f := by
   classical
-    refine' ⟨fun h => ⟨_, preimage_subset h, _⟩, _⟩
-    · rw [map_eq_image, image_preimage, filter_true_of_mem]
-      exact fun x hx ↦ coe_map_subset_range _ _ (h hx)
-    · rintro ⟨u, hut, rfl⟩
-      exact map_subset_map.2 hut
+  simp_rw [← coe_subset, coe_map, subset_image_iff, map_eq_image, eq_comm]
 #align finset.subset_map_iff Finset.subset_map_iff
 
 theorem sigma_preimage_mk {β : α → Type*} [DecidableEq α] (s : Finset (Σa, β a)) (t : Finset α) :
Diff
@@ -6,7 +6,7 @@ Authors: Johannes Hölzl, Mario Carneiro
 import Mathlib.Data.Set.Finite
 import Mathlib.Algebra.BigOperators.Basic
 
-#align_import data.finset.preimage from "leanprover-community/mathlib"@"2445c98ae4b87eabebdde552593519b9b6dc350c"
+#align_import data.finset.preimage from "leanprover-community/mathlib"@"3365b20c2ffa7c35e47e5209b89ba9abdddf3ffe"
 
 /-!
 # Preimage of a `Finset` under an injective map.
@@ -76,6 +76,11 @@ theorem preimage_compl [DecidableEq α] [DecidableEq β] [Fintype α] [Fintype 
   Finset.coe_injective (by simp)
 #align finset.preimage_compl Finset.preimage_compl
 
+@[simp]
+lemma preimage_map (f : α ↪ β) (s : Finset α) : (s.map f).preimage f (f.injective.injOn _) = s :=
+  coe_injective <| by simp only [coe_preimage, coe_map, Set.preimage_image_eq _ f.injective]
+#align finset.preimage_map Finset.preimage_map
+
 theorem monotone_preimage {f : α → β} (h : Injective f) :
     Monotone fun s => preimage s f (h.injOn _) := fun _ _ H _ hx =>
   mem_preimage.2 (H <| mem_preimage.1 hx)
fix: 'injective of' -> 'injective on' in Finset.preimage docstring (#6794)
Diff
@@ -25,7 +25,7 @@ namespace Finset
 
 section Preimage
 
-/-- Preimage of `s : Finset β` under a map `f` injective of `f ⁻¹' s` as a `Finset`.  -/
+/-- Preimage of `s : Finset β` under a map `f` injective on `f ⁻¹' s` as a `Finset`.  -/
 noncomputable def preimage (s : Finset β) (f : α → β) (hf : Set.InjOn f (f ⁻¹' ↑s)) : Finset α :=
   (s.finite_toSet.preimage hf).toFinset
 #align finset.preimage Finset.preimage
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
@@ -117,20 +117,20 @@ theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
       exact map_subset_map.2 hut
 #align finset.subset_map_iff Finset.subset_map_iff
 
-theorem sigma_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σa, β a)) (t : Finset α) :
+theorem sigma_preimage_mk {β : α → Type*} [DecidableEq α] (s : Finset (Σa, β a)) (t : Finset α) :
     (t.sigma fun a => s.preimage (Sigma.mk a) <| sigma_mk_injective.injOn _) =
       s.filter fun a => a.1 ∈ t := by
   ext x
   simp [and_comm]
 #align finset.sigma_preimage_mk Finset.sigma_preimage_mk
 
-theorem sigma_preimage_mk_of_subset {β : α → Type _} [DecidableEq α] (s : Finset (Σa, β a))
+theorem sigma_preimage_mk_of_subset {β : α → Type*} [DecidableEq α] (s : Finset (Σa, β a))
     {t : Finset α} (ht : s.image Sigma.fst ⊆ t) :
     (t.sigma fun a => s.preimage (Sigma.mk a) <| sigma_mk_injective.injOn _) = s := by
   rw [sigma_preimage_mk, filter_true_of_mem <| image_subset_iff.1 ht]
 #align finset.sigma_preimage_mk_of_subset Finset.sigma_preimage_mk_of_subset
 
-theorem sigma_image_fst_preimage_mk {β : α → Type _} [DecidableEq α] (s : Finset (Σa, β a)) :
+theorem sigma_image_fst_preimage_mk {β : α → Type*} [DecidableEq α] (s : Finset (Σa, β a)) :
     ((s.image Sigma.fst).sigma fun a => s.preimage (Sigma.mk a) <| sigma_mk_injective.injOn _) =
       s :=
   s.sigma_preimage_mk_of_subset (Subset.refl _)
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,15 +2,12 @@
 Copyright (c) 2017 Johannes Hölzl. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Johannes Hölzl, Mario Carneiro
-
-! This file was ported from Lean 3 source module data.finset.preimage
-! leanprover-community/mathlib commit 2445c98ae4b87eabebdde552593519b9b6dc350c
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.Set.Finite
 import Mathlib.Algebra.BigOperators.Basic
 
+#align_import data.finset.preimage from "leanprover-community/mathlib"@"2445c98ae4b87eabebdde552593519b9b6dc350c"
+
 /-!
 # Preimage of a `Finset` under an injective map.
 -/
fix: change compl precedence (#5586)

Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>

Diff
@@ -75,7 +75,7 @@ theorem preimage_union [DecidableEq α] [DecidableEq β] {f : α → β} {s t :
 @[simp, nolint simpNF] -- Porting note: linter complains that LHS doesn't simplify
 theorem preimage_compl [DecidableEq α] [DecidableEq β] [Fintype α] [Fintype β] {f : α → β}
     (s : Finset β) (hf : Function.Injective f) :
-    preimage (sᶜ) f (hf.injOn _) = preimage s f (hf.injOn _)ᶜ :=
+    preimage sᶜ f (hf.injOn _) = (preimage s f (hf.injOn _))ᶜ :=
   Finset.coe_injective (by simp)
 #align finset.preimage_compl Finset.preimage_compl
 
chore: formatting issues (#4947)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -111,7 +111,7 @@ theorem preimage_subset {f : α ↪ β} {s : Finset β} {t : Finset α} (hs : s
 #align finset.preimage_subset Finset.preimage_subset
 
 theorem subset_map_iff {f : α ↪ β} {s : Finset β} {t : Finset α} :
-    s ⊆ t.map f ↔ ∃ (u : _)(_ : u ⊆ t), s = u.map f := by
+    s ⊆ t.map f ↔ ∃ (u : _) (_ : u ⊆ t), s = u.map f := by
   classical
     refine' ⟨fun h => ⟨_, preimage_subset h, _⟩, _⟩
     · rw [map_eq_image, image_preimage, filter_true_of_mem]
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
@@ -150,7 +150,6 @@ theorem prod_preimage' [CommMonoid β] (f : α → γ) [DecidablePred fun x => x
     (∏ x in preimage s f hf, g (f x)) = ∏ x in image f (preimage s f hf), g x :=
       Eq.symm <| prod_image <| by simpa only [mem_preimage, InjOn] using hf
     _ = ∏ x in s.filter fun x => x ∈ Set.range f, g x := by rw [image_preimage]
-
 #align finset.prod_preimage' Finset.prod_preimage'
 #align finset.sum_preimage' Finset.sum_preimage'
 
chore: tidy various files (#2236)
Diff
@@ -12,7 +12,7 @@ import Mathlib.Data.Set.Finite
 import Mathlib.Algebra.BigOperators.Basic
 
 /-!
-# Preimage of a `finset` under an injective map.
+# Preimage of a `Finset` under an injective map.
 -/
 
 
chore: scoped BigOperators notation (#1952)
Diff
@@ -18,7 +18,7 @@ import Mathlib.Algebra.BigOperators.Basic
 
 open Set Function
 
--- open BigOperators -- Porting note: notation is global for now
+open BigOperators
 
 universe u v w x
 
feat: port Data.Finset.Preimage (#1746)

Dependencies 7 + 223

224 files ported (97.0%)
98243 lines ported (97.0%)
Show graph

The unported dependencies are