data.set.countableMathlib.Data.Set.Countable

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -207,7 +207,7 @@ theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Pr
     refine' ⟨range s, countable_range s, forall_range_iff.2 hps, _⟩; rwa [sSup_range]
   · rintro ⟨S, hSc, hps, hS⟩
     rcases eq_empty_or_nonempty S with (rfl | hne)
-    · rw [sSup_empty] at hS ; haveI := subsingleton_of_bot_eq_top hS
+    · rw [sSup_empty] at hS; haveI := subsingleton_of_bot_eq_top hS
       rcases h with ⟨x, hx⟩; exact ⟨fun n => x, fun n => hx, Subsingleton.elim _ _⟩
     · rcases(Set.countable_iff_exists_surjective hne).1 hSc with ⟨s, hs⟩
       refine' ⟨fun n => s n, fun n => hps _ (s n).coe_prop, _⟩
Diff
@@ -3,9 +3,9 @@ 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
 -/
-import Mathbin.Data.Set.Finite
-import Mathbin.Data.Countable.Basic
-import Mathbin.Logic.Equiv.List
+import Data.Set.Finite
+import Data.Countable.Basic
+import Logic.Equiv.List
 
 #align_import data.set.countable from "leanprover-community/mathlib"@"4d392a6c9c4539cbeca399b3ee0afea398fbd2eb"
 
Diff
@@ -57,7 +57,7 @@ theorem to_countable (s : Set α) [Countable s] : s.Countable :=
 -/
 
 /-- Restate `set.countable` as a `countable` instance. -/
-alias countable_coe_iff ↔ _root_.countable.to_set countable.to_subtype
+alias ⟨_root_.countable.to_set, countable.to_subtype⟩ := countable_coe_iff
 #align countable.to_set Countable.to_set
 #align set.countable.to_subtype Set.Countable.to_subtype
 
@@ -134,7 +134,7 @@ protected theorem countable_iff_exists_surjective {s : Set α} (hs : s.Nonempty)
 #align set.countable_iff_exists_surjective Set.countable_iff_exists_surjective
 -/
 
-alias Set.countable_iff_exists_surjective ↔ countable.exists_surjective _
+alias ⟨countable.exists_surjective, _⟩ := Set.countable_iff_exists_surjective
 #align set.countable.exists_surjective Set.Countable.exists_surjective
 
 #print Set.countable_univ /-
@@ -259,10 +259,10 @@ theorem Countable.sUnion_iff {s : Set (Set α)} (hs : s.Countable) :
 #align set.countable.sUnion_iff Set.Countable.sUnion_iff
 -/
 
-alias countable.bUnion_iff ↔ _ countable.bUnion
+alias ⟨_, countable.bUnion⟩ := countable.bUnion_iff
 #align set.countable.bUnion Set.Countable.biUnion
 
-alias countable.sUnion_iff ↔ _ countable.sUnion
+alias ⟨_, countable.sUnion⟩ := countable.sUnion_iff
 #align set.countable.sUnion Set.Countable.sUnion
 
 #print Set.countable_union /-
Diff
@@ -2,16 +2,13 @@
 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
-
-! This file was ported from Lean 3 source module data.set.countable
-! leanprover-community/mathlib commit 4d392a6c9c4539cbeca399b3ee0afea398fbd2eb
-! 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.Data.Countable.Basic
 import Mathbin.Logic.Equiv.List
 
+#align_import data.set.countable from "leanprover-community/mathlib"@"4d392a6c9c4539cbeca399b3ee0afea398fbd2eb"
+
 /-!
 # Countable sets
 
Diff
@@ -200,6 +200,7 @@ protected theorem Countable.preimage {s : Set β} (hs : s.Countable) {f : α →
 #align set.countable.preimage Set.Countable.preimage
 -/
 
+#print Set.exists_seq_iSup_eq_top_iff_countable /-
 theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Prop} (h : ∃ x, p x) :
     (∃ s : ℕ → α, (∀ n, p (s n)) ∧ (⨆ n, s n) = ⊤) ↔
       ∃ S : Set α, S.Countable ∧ (∀ s ∈ S, p s) ∧ sSup S = ⊤ :=
@@ -215,6 +216,7 @@ theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Pr
       refine' ⟨fun n => s n, fun n => hps _ (s n).coe_prop, _⟩
       rwa [hs.supr_comp, ← sSup_eq_iSup']
 #align set.exists_seq_supr_eq_top_iff_countable Set.exists_seq_iSup_eq_top_iff_countable
+-/
 
 #print Set.exists_seq_cover_iff_countable /-
 theorem exists_seq_cover_iff_countable {p : Set α → Prop} (h : ∃ s, p s) :
@@ -266,14 +268,18 @@ alias countable.bUnion_iff ↔ _ countable.bUnion
 alias countable.sUnion_iff ↔ _ countable.sUnion
 #align set.countable.sUnion Set.Countable.sUnion
 
+#print Set.countable_union /-
 @[simp]
 theorem countable_union {s t : Set α} : (s ∪ t).Countable ↔ s.Countable ∧ t.Countable := by
   simp [union_eq_Union, and_comm]
 #align set.countable_union Set.countable_union
+-/
 
+#print Set.Countable.union /-
 theorem Countable.union {s t : Set α} (hs : s.Countable) (ht : t.Countable) : (s ∪ t).Countable :=
   countable_union.2 ⟨hs, ht⟩
 #align set.countable.union Set.Countable.union
+-/
 
 #print Set.countable_insert /-
 @[simp]
@@ -333,16 +339,20 @@ theorem countable_setOf_finite_subset {s : Set α} :
 #align set.countable_set_of_finite_subset Set.countable_setOf_finite_subset
 -/
 
+#print Set.countable_univ_pi /-
 theorem countable_univ_pi {π : α → Type _} [Finite α] {s : ∀ a, Set (π a)}
     (hs : ∀ a, (s a).Countable) : (pi univ s).Countable :=
   haveI := fun a => (hs a).to_subtype
   (Countable.of_equiv _ (Equiv.Set.univPi s).symm).to_set
 #align set.countable_univ_pi Set.countable_univ_pi
+-/
 
+#print Set.countable_pi /-
 theorem countable_pi {π : α → Type _} [Finite α] {s : ∀ a, Set (π a)} (hs : ∀ a, (s a).Countable) :
     {f : ∀ a, π a | ∀ a, f a ∈ s a}.Countable := by
   simpa only [← mem_univ_pi] using countable_univ_pi hs
 #align set.countable_pi Set.countable_pi
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 #print Set.Countable.prod /-
Diff
@@ -308,13 +308,13 @@ theorem Subsingleton.countable {s : Set α} (hs : s.Subsingleton) : s.Countable
 -/
 
 #print Set.countable_isTop /-
-theorem countable_isTop (α : Type _) [PartialOrder α] : { x : α | IsTop x }.Countable :=
+theorem countable_isTop (α : Type _) [PartialOrder α] : {x : α | IsTop x}.Countable :=
   (finite_isTop α).Countable
 #align set.countable_is_top Set.countable_isTop
 -/
 
 #print Set.countable_isBot /-
-theorem countable_isBot (α : Type _) [PartialOrder α] : { x : α | IsBot x }.Countable :=
+theorem countable_isBot (α : Type _) [PartialOrder α] : {x : α | IsBot x}.Countable :=
   (finite_isBot α).Countable
 #align set.countable_is_bot Set.countable_isBot
 -/
@@ -322,11 +322,11 @@ theorem countable_isBot (α : Type _) [PartialOrder α] : { x : α | IsBot x }.C
 #print Set.countable_setOf_finite_subset /-
 /-- The set of finite subsets of a countable set is countable. -/
 theorem countable_setOf_finite_subset {s : Set α} :
-    s.Countable → { t | Set.Finite t ∧ t ⊆ s }.Countable
+    s.Countable → {t | Set.Finite t ∧ t ⊆ s}.Countable
   | ⟨h⟩ => by
     skip
     refine'
-      countable.mono _ (countable_range fun t : Finset s => { a | ∃ h : a ∈ s, Subtype.mk a h ∈ t })
+      countable.mono _ (countable_range fun t : Finset s => {a | ∃ h : a ∈ s, Subtype.mk a h ∈ t})
     rintro t ⟨⟨ht⟩, ts⟩; skip
     refine' ⟨finset.univ.map (embedding_of_subset _ _ ts), Set.ext fun a => _⟩
     simpa using @ts a
@@ -340,7 +340,7 @@ theorem countable_univ_pi {π : α → Type _} [Finite α] {s : ∀ a, Set (π a
 #align set.countable_univ_pi Set.countable_univ_pi
 
 theorem countable_pi {π : α → Type _} [Finite α] {s : ∀ a, Set (π a)} (hs : ∀ a, (s a).Countable) :
-    { f : ∀ a, π a | ∀ a, f a ∈ s a }.Countable := by
+    {f : ∀ a, π a | ∀ a, f a ∈ s a}.Countable := by
   simpa only [← mem_univ_pi] using countable_univ_pi hs
 #align set.countable_pi Set.countable_pi
 
Diff
@@ -209,7 +209,7 @@ theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Pr
     refine' ⟨range s, countable_range s, forall_range_iff.2 hps, _⟩; rwa [sSup_range]
   · rintro ⟨S, hSc, hps, hS⟩
     rcases eq_empty_or_nonempty S with (rfl | hne)
-    · rw [sSup_empty] at hS; haveI := subsingleton_of_bot_eq_top hS
+    · rw [sSup_empty] at hS ; haveI := subsingleton_of_bot_eq_top hS
       rcases h with ⟨x, hx⟩; exact ⟨fun n => x, fun n => hx, Subsingleton.elim _ _⟩
     · rcases(Set.countable_iff_exists_surjective hne).1 hSc with ⟨s, hs⟩
       refine' ⟨fun n => s n, fun n => hps _ (s n).coe_prop, _⟩
Diff
@@ -26,7 +26,7 @@ open Function Set Encodable
 
 open Classical hiding some
 
-open Classical
+open scoped Classical
 
 universe u v w x
 
@@ -307,13 +307,17 @@ theorem Subsingleton.countable {s : Set α} (hs : s.Subsingleton) : s.Countable
 #align set.subsingleton.countable Set.Subsingleton.countable
 -/
 
+#print Set.countable_isTop /-
 theorem countable_isTop (α : Type _) [PartialOrder α] : { x : α | IsTop x }.Countable :=
   (finite_isTop α).Countable
 #align set.countable_is_top Set.countable_isTop
+-/
 
+#print Set.countable_isBot /-
 theorem countable_isBot (α : Type _) [PartialOrder α] : { x : α | IsBot x }.Countable :=
   (finite_isBot α).Countable
 #align set.countable_is_bot Set.countable_isBot
+-/
 
 #print Set.countable_setOf_finite_subset /-
 /-- The set of finite subsets of a countable set is countable. -/
Diff
@@ -200,12 +200,6 @@ protected theorem Countable.preimage {s : Set β} (hs : s.Countable) {f : α →
 #align set.countable.preimage Set.Countable.preimage
 -/
 
-/- warning: set.exists_seq_supr_eq_top_iff_countable -> Set.exists_seq_iSup_eq_top_iff_countable is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] {p : α -> Prop}, (Exists.{succ u1} α (fun (x : α) => p x)) -> (Iff (Exists.{succ u1} (Nat -> α) (fun (s : Nat -> α) => And (forall (n : Nat), p (s n)) (Eq.{succ u1} α (iSup.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (n : Nat) => s n)) (Top.top.{u1} α (CompleteLattice.toHasTop.{u1} α _inst_1))))) (Exists.{succ u1} (Set.{u1} α) (fun (S : Set.{u1} α) => And (Set.Countable.{u1} α S) (And (forall (s : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) s S) -> (p s)) (Eq.{succ u1} α (SupSet.sSup.{u1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) S) (Top.top.{u1} α (CompleteLattice.toHasTop.{u1} α _inst_1)))))))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] {p : α -> Prop}, (Exists.{succ u1} α (fun (x : α) => p x)) -> (Iff (Exists.{succ u1} (Nat -> α) (fun (s : Nat -> α) => And (forall (n : Nat), p (s n)) (Eq.{succ u1} α (iSup.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (n : Nat) => s n)) (Top.top.{u1} α (CompleteLattice.toTop.{u1} α _inst_1))))) (Exists.{succ u1} (Set.{u1} α) (fun (S : Set.{u1} α) => And (Set.Countable.{u1} α S) (And (forall (s : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) s S) -> (p s)) (Eq.{succ u1} α (SupSet.sSup.{u1} α (CompleteLattice.toSupSet.{u1} α _inst_1) S) (Top.top.{u1} α (CompleteLattice.toTop.{u1} α _inst_1)))))))
-Case conversion may be inaccurate. Consider using '#align set.exists_seq_supr_eq_top_iff_countable Set.exists_seq_iSup_eq_top_iff_countableₓ'. -/
 theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Prop} (h : ∃ x, p x) :
     (∃ s : ℕ → α, (∀ n, p (s n)) ∧ (⨆ n, s n) = ⊤) ↔
       ∃ S : Set α, S.Countable ∧ (∀ s ∈ S, p s) ∧ sSup S = ⊤ :=
@@ -272,23 +266,11 @@ alias countable.bUnion_iff ↔ _ countable.bUnion
 alias countable.sUnion_iff ↔ _ countable.sUnion
 #align set.countable.sUnion Set.Countable.sUnion
 
-/- warning: set.countable_union -> Set.countable_union is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {s : Set.{u1} α} {t : Set.{u1} α}, Iff (Set.Countable.{u1} α (Union.union.{u1} (Set.{u1} α) (Set.hasUnion.{u1} α) s t)) (And (Set.Countable.{u1} α s) (Set.Countable.{u1} α t))
-but is expected to have type
-  forall {α : Type.{u1}} {s : Set.{u1} α} {t : Set.{u1} α}, Iff (Set.Countable.{u1} α (Union.union.{u1} (Set.{u1} α) (Set.instUnionSet.{u1} α) s t)) (And (Set.Countable.{u1} α s) (Set.Countable.{u1} α t))
-Case conversion may be inaccurate. Consider using '#align set.countable_union Set.countable_unionₓ'. -/
 @[simp]
 theorem countable_union {s t : Set α} : (s ∪ t).Countable ↔ s.Countable ∧ t.Countable := by
   simp [union_eq_Union, and_comm]
 #align set.countable_union Set.countable_union
 
-/- warning: set.countable.union -> Set.Countable.union is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {s : Set.{u1} α} {t : Set.{u1} α}, (Set.Countable.{u1} α s) -> (Set.Countable.{u1} α t) -> (Set.Countable.{u1} α (Union.union.{u1} (Set.{u1} α) (Set.hasUnion.{u1} α) s t))
-but is expected to have type
-  forall {α : Type.{u1}} {s : Set.{u1} α} {t : Set.{u1} α}, (Set.Countable.{u1} α s) -> (Set.Countable.{u1} α t) -> (Set.Countable.{u1} α (Union.union.{u1} (Set.{u1} α) (Set.instUnionSet.{u1} α) s t))
-Case conversion may be inaccurate. Consider using '#align set.countable.union Set.Countable.unionₓ'. -/
 theorem Countable.union {s t : Set α} (hs : s.Countable) (ht : t.Countable) : (s ∪ t).Countable :=
   countable_union.2 ⟨hs, ht⟩
 #align set.countable.union Set.Countable.union
@@ -325,22 +307,10 @@ theorem Subsingleton.countable {s : Set α} (hs : s.Subsingleton) : s.Countable
 #align set.subsingleton.countable Set.Subsingleton.countable
 -/
 
-/- warning: set.countable_is_top -> Set.countable_isTop is a dubious translation:
-lean 3 declaration is
-  forall (α : Type.{u1}) [_inst_1 : PartialOrder.{u1} α], Set.Countable.{u1} α (setOf.{u1} α (fun (x : α) => IsTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α _inst_1)) x))
-but is expected to have type
-  forall (α : Type.{u1}) [_inst_1 : PartialOrder.{u1} α], Set.Countable.{u1} α (setOf.{u1} α (fun (x : α) => IsTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α _inst_1)) x))
-Case conversion may be inaccurate. Consider using '#align set.countable_is_top Set.countable_isTopₓ'. -/
 theorem countable_isTop (α : Type _) [PartialOrder α] : { x : α | IsTop x }.Countable :=
   (finite_isTop α).Countable
 #align set.countable_is_top Set.countable_isTop
 
-/- warning: set.countable_is_bot -> Set.countable_isBot is a dubious translation:
-lean 3 declaration is
-  forall (α : Type.{u1}) [_inst_1 : PartialOrder.{u1} α], Set.Countable.{u1} α (setOf.{u1} α (fun (x : α) => IsBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α _inst_1)) x))
-but is expected to have type
-  forall (α : Type.{u1}) [_inst_1 : PartialOrder.{u1} α], Set.Countable.{u1} α (setOf.{u1} α (fun (x : α) => IsBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α _inst_1)) x))
-Case conversion may be inaccurate. Consider using '#align set.countable_is_bot Set.countable_isBotₓ'. -/
 theorem countable_isBot (α : Type _) [PartialOrder α] : { x : α | IsBot x }.Countable :=
   (finite_isBot α).Countable
 #align set.countable_is_bot Set.countable_isBot
@@ -359,24 +329,12 @@ theorem countable_setOf_finite_subset {s : Set α} :
 #align set.countable_set_of_finite_subset Set.countable_setOf_finite_subset
 -/
 
-/- warning: set.countable_univ_pi -> Set.countable_univ_pi is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {π : α -> Type.{u2}} [_inst_1 : Finite.{succ u1} α] {s : forall (a : α), Set.{u2} (π a)}, (forall (a : α), Set.Countable.{u2} (π a) (s a)) -> (Set.Countable.{max u1 u2} (forall (i : α), π i) (Set.pi.{u1, u2} α (fun (a : α) => π a) (Set.univ.{u1} α) s))
-but is expected to have type
-  forall {α : Type.{u2}} {π : α -> Type.{u1}} [_inst_1 : Finite.{succ u2} α] {s : forall (a : α), Set.{u1} (π a)}, (forall (a : α), Set.Countable.{u1} (π a) (s a)) -> (Set.Countable.{max u2 u1} (forall (i : α), π i) (Set.pi.{u2, u1} α (fun (a : α) => π a) (Set.univ.{u2} α) s))
-Case conversion may be inaccurate. Consider using '#align set.countable_univ_pi Set.countable_univ_piₓ'. -/
 theorem countable_univ_pi {π : α → Type _} [Finite α] {s : ∀ a, Set (π a)}
     (hs : ∀ a, (s a).Countable) : (pi univ s).Countable :=
   haveI := fun a => (hs a).to_subtype
   (Countable.of_equiv _ (Equiv.Set.univPi s).symm).to_set
 #align set.countable_univ_pi Set.countable_univ_pi
 
-/- warning: set.countable_pi -> Set.countable_pi is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {π : α -> Type.{u2}} [_inst_1 : Finite.{succ u1} α] {s : forall (a : α), Set.{u2} (π a)}, (forall (a : α), Set.Countable.{u2} (π a) (s a)) -> (Set.Countable.{max u1 u2} (forall (a : α), π a) (setOf.{max u1 u2} (forall (a : α), π a) (fun (f : forall (a : α), π a) => forall (a : α), Membership.Mem.{u2, u2} (π a) (Set.{u2} (π a)) (Set.hasMem.{u2} (π a)) (f a) (s a))))
-but is expected to have type
-  forall {α : Type.{u2}} {π : α -> Type.{u1}} [_inst_1 : Finite.{succ u2} α] {s : forall (a : α), Set.{u1} (π a)}, (forall (a : α), Set.Countable.{u1} (π a) (s a)) -> (Set.Countable.{max u2 u1} (forall (a : α), π a) (setOf.{max u2 u1} (forall (a : α), π a) (fun (f : forall (a : α), π a) => forall (a : α), Membership.mem.{u1, u1} (π a) (Set.{u1} (π a)) (Set.instMembershipSet.{u1} (π a)) (f a) (s a))))
-Case conversion may be inaccurate. Consider using '#align set.countable_pi Set.countable_piₓ'. -/
 theorem countable_pi {π : α → Type _} [Finite α] {s : ∀ a, Set (π a)} (hs : ∀ a, (s a).Countable) :
     { f : ∀ a, π a | ∀ a, f a ∈ s a }.Countable := by
   simpa only [← mem_univ_pi] using countable_univ_pi hs
Diff
@@ -122,10 +122,8 @@ theorem countable_range [Countable ι] (f : ι → β) : (range f).Countable :=
 #print Set.countable_iff_exists_subset_range /-
 theorem countable_iff_exists_subset_range [Nonempty α] {s : Set α} :
     s.Countable ↔ ∃ f : ℕ → α, s ⊆ range f :=
-  ⟨fun h => by
-    inhabit α
-    exact ⟨enumerate_countable h default, subset_range_enumerate _ _⟩, fun ⟨f, hsf⟩ =>
-    (countable_range f).mono hsf⟩
+  ⟨fun h => by inhabit α; exact ⟨enumerate_countable h default, subset_range_enumerate _ _⟩,
+    fun ⟨f, hsf⟩ => (countable_range f).mono hsf⟩
 #align set.countable_iff_exists_subset_range Set.countable_iff_exists_subset_range
 -/
 
@@ -175,11 +173,8 @@ theorem countable_singleton (a : α) : ({a} : Set α).Countable :=
 -/
 
 #print Set.Countable.image /-
-theorem Countable.image {s : Set α} (hs : s.Countable) (f : α → β) : (f '' s).Countable :=
-  by
-  rw [image_eq_range]
-  haveI := hs.to_subtype
-  apply countable_range
+theorem Countable.image {s : Set α} (hs : s.Countable) (f : α → β) : (f '' s).Countable := by
+  rw [image_eq_range]; haveI := hs.to_subtype; apply countable_range
 #align set.countable.image Set.Countable.image
 -/
 
@@ -217,14 +212,11 @@ theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Pr
   by
   constructor
   · rintro ⟨s, hps, hs⟩
-    refine' ⟨range s, countable_range s, forall_range_iff.2 hps, _⟩
-    rwa [sSup_range]
+    refine' ⟨range s, countable_range s, forall_range_iff.2 hps, _⟩; rwa [sSup_range]
   · rintro ⟨S, hSc, hps, hS⟩
     rcases eq_empty_or_nonempty S with (rfl | hne)
-    · rw [sSup_empty] at hS
-      haveI := subsingleton_of_bot_eq_top hS
-      rcases h with ⟨x, hx⟩
-      exact ⟨fun n => x, fun n => hx, Subsingleton.elim _ _⟩
+    · rw [sSup_empty] at hS; haveI := subsingleton_of_bot_eq_top hS
+      rcases h with ⟨x, hx⟩; exact ⟨fun n => x, fun n => hx, Subsingleton.elim _ _⟩
     · rcases(Set.countable_iff_exists_surjective hne).1 hSc with ⟨s, hs⟩
       refine' ⟨fun n => s n, fun n => hps _ (s n).coe_prop, _⟩
       rwa [hs.supr_comp, ← sSup_eq_iSup']
@@ -248,9 +240,7 @@ theorem countable_of_injective_of_countable_image {s : Set α} {f : α → β} (
 
 #print Set.countable_iUnion /-
 theorem countable_iUnion {t : ι → Set α} [Countable ι] (ht : ∀ i, (t i).Countable) :
-    (⋃ i, t i).Countable := by
-  haveI := fun a => (ht a).to_subtype
-  rw [Union_eq_range_psigma]
+    (⋃ i, t i).Countable := by haveI := fun a => (ht a).to_subtype; rw [Union_eq_range_psigma];
   apply countable_range
 #align set.countable_Union Set.countable_iUnion
 -/
@@ -265,9 +255,7 @@ theorem countable_iUnion_iff [Countable ι] {t : ι → Set α} :
 
 #print Set.Countable.biUnion_iff /-
 theorem Countable.biUnion_iff {s : Set α} {t : ∀ a ∈ s, Set β} (hs : s.Countable) :
-    (⋃ a ∈ s, t a ‹_›).Countable ↔ ∀ a ∈ s, (t a ‹_›).Countable :=
-  by
-  haveI := hs.to_subtype
+    (⋃ a ∈ s, t a ‹_›).Countable ↔ ∀ a ∈ s, (t a ‹_›).Countable := by haveI := hs.to_subtype;
   rw [bUnion_eq_Union, countable_Union_iff, SetCoe.forall']
 #align set.countable.bUnion_iff Set.Countable.biUnion_iff
 -/
@@ -406,10 +394,7 @@ protected theorem Countable.prod {s : Set α} {t : Set β} (hs : s.Countable) (h
 
 #print Set.Countable.image2 /-
 theorem Countable.image2 {s : Set α} {t : Set β} (hs : s.Countable) (ht : t.Countable)
-    (f : α → β → γ) : (image2 f s t).Countable :=
-  by
-  rw [← image_prod]
-  exact (hs.prod ht).image _
+    (f : α → β → γ) : (image2 f s t).Countable := by rw [← image_prod]; exact (hs.prod ht).image _
 #align set.countable.image2 Set.Countable.image2
 -/
 
Diff
@@ -337,17 +337,25 @@ theorem Subsingleton.countable {s : Set α} (hs : s.Subsingleton) : s.Countable
 #align set.subsingleton.countable Set.Subsingleton.countable
 -/
 
-#print Set.countable_isTop /-
+/- warning: set.countable_is_top -> Set.countable_isTop is a dubious translation:
+lean 3 declaration is
+  forall (α : Type.{u1}) [_inst_1 : PartialOrder.{u1} α], Set.Countable.{u1} α (setOf.{u1} α (fun (x : α) => IsTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α _inst_1)) x))
+but is expected to have type
+  forall (α : Type.{u1}) [_inst_1 : PartialOrder.{u1} α], Set.Countable.{u1} α (setOf.{u1} α (fun (x : α) => IsTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α _inst_1)) x))
+Case conversion may be inaccurate. Consider using '#align set.countable_is_top Set.countable_isTopₓ'. -/
 theorem countable_isTop (α : Type _) [PartialOrder α] : { x : α | IsTop x }.Countable :=
   (finite_isTop α).Countable
 #align set.countable_is_top Set.countable_isTop
--/
 
-#print Set.countable_isBot /-
+/- warning: set.countable_is_bot -> Set.countable_isBot is a dubious translation:
+lean 3 declaration is
+  forall (α : Type.{u1}) [_inst_1 : PartialOrder.{u1} α], Set.Countable.{u1} α (setOf.{u1} α (fun (x : α) => IsBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α _inst_1)) x))
+but is expected to have type
+  forall (α : Type.{u1}) [_inst_1 : PartialOrder.{u1} α], Set.Countable.{u1} α (setOf.{u1} α (fun (x : α) => IsBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α _inst_1)) x))
+Case conversion may be inaccurate. Consider using '#align set.countable_is_bot Set.countable_isBotₓ'. -/
 theorem countable_isBot (α : Type _) [PartialOrder α] : { x : α | IsBot x }.Countable :=
   (finite_isBot α).Countable
 #align set.countable_is_bot Set.countable_isBot
--/
 
 #print Set.countable_setOf_finite_subset /-
 /-- The set of finite subsets of a countable set is countable. -/
Diff
@@ -205,36 +205,36 @@ protected theorem Countable.preimage {s : Set β} (hs : s.Countable) {f : α →
 #align set.countable.preimage Set.Countable.preimage
 -/
 
-/- warning: set.exists_seq_supr_eq_top_iff_countable -> Set.exists_seq_supᵢ_eq_top_iff_countable is a dubious translation:
+/- warning: set.exists_seq_supr_eq_top_iff_countable -> Set.exists_seq_iSup_eq_top_iff_countable is a dubious translation:
 lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] {p : α -> Prop}, (Exists.{succ u1} α (fun (x : α) => p x)) -> (Iff (Exists.{succ u1} (Nat -> α) (fun (s : Nat -> α) => And (forall (n : Nat), p (s n)) (Eq.{succ u1} α (supᵢ.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (n : Nat) => s n)) (Top.top.{u1} α (CompleteLattice.toHasTop.{u1} α _inst_1))))) (Exists.{succ u1} (Set.{u1} α) (fun (S : Set.{u1} α) => And (Set.Countable.{u1} α S) (And (forall (s : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) s S) -> (p s)) (Eq.{succ u1} α (SupSet.supₛ.{u1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) S) (Top.top.{u1} α (CompleteLattice.toHasTop.{u1} α _inst_1)))))))
+  forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] {p : α -> Prop}, (Exists.{succ u1} α (fun (x : α) => p x)) -> (Iff (Exists.{succ u1} (Nat -> α) (fun (s : Nat -> α) => And (forall (n : Nat), p (s n)) (Eq.{succ u1} α (iSup.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (n : Nat) => s n)) (Top.top.{u1} α (CompleteLattice.toHasTop.{u1} α _inst_1))))) (Exists.{succ u1} (Set.{u1} α) (fun (S : Set.{u1} α) => And (Set.Countable.{u1} α S) (And (forall (s : α), (Membership.Mem.{u1, u1} α (Set.{u1} α) (Set.hasMem.{u1} α) s S) -> (p s)) (Eq.{succ u1} α (SupSet.sSup.{u1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) S) (Top.top.{u1} α (CompleteLattice.toHasTop.{u1} α _inst_1)))))))
 but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] {p : α -> Prop}, (Exists.{succ u1} α (fun (x : α) => p x)) -> (Iff (Exists.{succ u1} (Nat -> α) (fun (s : Nat -> α) => And (forall (n : Nat), p (s n)) (Eq.{succ u1} α (supᵢ.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (n : Nat) => s n)) (Top.top.{u1} α (CompleteLattice.toTop.{u1} α _inst_1))))) (Exists.{succ u1} (Set.{u1} α) (fun (S : Set.{u1} α) => And (Set.Countable.{u1} α S) (And (forall (s : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) s S) -> (p s)) (Eq.{succ u1} α (SupSet.supₛ.{u1} α (CompleteLattice.toSupSet.{u1} α _inst_1) S) (Top.top.{u1} α (CompleteLattice.toTop.{u1} α _inst_1)))))))
-Case conversion may be inaccurate. Consider using '#align set.exists_seq_supr_eq_top_iff_countable Set.exists_seq_supᵢ_eq_top_iff_countableₓ'. -/
-theorem exists_seq_supᵢ_eq_top_iff_countable [CompleteLattice α] {p : α → Prop} (h : ∃ x, p x) :
+  forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] {p : α -> Prop}, (Exists.{succ u1} α (fun (x : α) => p x)) -> (Iff (Exists.{succ u1} (Nat -> α) (fun (s : Nat -> α) => And (forall (n : Nat), p (s n)) (Eq.{succ u1} α (iSup.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (n : Nat) => s n)) (Top.top.{u1} α (CompleteLattice.toTop.{u1} α _inst_1))))) (Exists.{succ u1} (Set.{u1} α) (fun (S : Set.{u1} α) => And (Set.Countable.{u1} α S) (And (forall (s : α), (Membership.mem.{u1, u1} α (Set.{u1} α) (Set.instMembershipSet.{u1} α) s S) -> (p s)) (Eq.{succ u1} α (SupSet.sSup.{u1} α (CompleteLattice.toSupSet.{u1} α _inst_1) S) (Top.top.{u1} α (CompleteLattice.toTop.{u1} α _inst_1)))))))
+Case conversion may be inaccurate. Consider using '#align set.exists_seq_supr_eq_top_iff_countable Set.exists_seq_iSup_eq_top_iff_countableₓ'. -/
+theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Prop} (h : ∃ x, p x) :
     (∃ s : ℕ → α, (∀ n, p (s n)) ∧ (⨆ n, s n) = ⊤) ↔
-      ∃ S : Set α, S.Countable ∧ (∀ s ∈ S, p s) ∧ supₛ S = ⊤ :=
+      ∃ S : Set α, S.Countable ∧ (∀ s ∈ S, p s) ∧ sSup S = ⊤ :=
   by
   constructor
   · rintro ⟨s, hps, hs⟩
     refine' ⟨range s, countable_range s, forall_range_iff.2 hps, _⟩
-    rwa [supₛ_range]
+    rwa [sSup_range]
   · rintro ⟨S, hSc, hps, hS⟩
     rcases eq_empty_or_nonempty S with (rfl | hne)
-    · rw [supₛ_empty] at hS
+    · rw [sSup_empty] at hS
       haveI := subsingleton_of_bot_eq_top hS
       rcases h with ⟨x, hx⟩
       exact ⟨fun n => x, fun n => hx, Subsingleton.elim _ _⟩
     · rcases(Set.countable_iff_exists_surjective hne).1 hSc with ⟨s, hs⟩
       refine' ⟨fun n => s n, fun n => hps _ (s n).coe_prop, _⟩
-      rwa [hs.supr_comp, ← supₛ_eq_supᵢ']
-#align set.exists_seq_supr_eq_top_iff_countable Set.exists_seq_supᵢ_eq_top_iff_countable
+      rwa [hs.supr_comp, ← sSup_eq_iSup']
+#align set.exists_seq_supr_eq_top_iff_countable Set.exists_seq_iSup_eq_top_iff_countable
 
 #print Set.exists_seq_cover_iff_countable /-
 theorem exists_seq_cover_iff_countable {p : Set α → Prop} (h : ∃ s, p s) :
     (∃ s : ℕ → Set α, (∀ n, p (s n)) ∧ (⋃ n, s n) = univ) ↔
       ∃ S : Set (Set α), S.Countable ∧ (∀ s ∈ S, p s) ∧ ⋃₀ S = univ :=
-  exists_seq_supᵢ_eq_top_iff_countable h
+  exists_seq_iSup_eq_top_iff_countable h
 #align set.exists_seq_cover_iff_countable Set.exists_seq_cover_iff_countable
 -/
 
@@ -246,43 +246,43 @@ theorem countable_of_injective_of_countable_image {s : Set α} {f : α → β} (
 #align set.countable_of_injective_of_countable_image Set.countable_of_injective_of_countable_image
 -/
 
-#print Set.countable_unionᵢ /-
-theorem countable_unionᵢ {t : ι → Set α} [Countable ι] (ht : ∀ i, (t i).Countable) :
+#print Set.countable_iUnion /-
+theorem countable_iUnion {t : ι → Set α} [Countable ι] (ht : ∀ i, (t i).Countable) :
     (⋃ i, t i).Countable := by
   haveI := fun a => (ht a).to_subtype
   rw [Union_eq_range_psigma]
   apply countable_range
-#align set.countable_Union Set.countable_unionᵢ
+#align set.countable_Union Set.countable_iUnion
 -/
 
-#print Set.countable_unionᵢ_iff /-
+#print Set.countable_iUnion_iff /-
 @[simp]
-theorem countable_unionᵢ_iff [Countable ι] {t : ι → Set α} :
+theorem countable_iUnion_iff [Countable ι] {t : ι → Set α} :
     (⋃ i, t i).Countable ↔ ∀ i, (t i).Countable :=
-  ⟨fun h i => h.mono <| subset_unionᵢ _ _, countable_unionᵢ⟩
-#align set.countable_Union_iff Set.countable_unionᵢ_iff
+  ⟨fun h i => h.mono <| subset_iUnion _ _, countable_iUnion⟩
+#align set.countable_Union_iff Set.countable_iUnion_iff
 -/
 
-#print Set.Countable.bunionᵢ_iff /-
-theorem Countable.bunionᵢ_iff {s : Set α} {t : ∀ a ∈ s, Set β} (hs : s.Countable) :
+#print Set.Countable.biUnion_iff /-
+theorem Countable.biUnion_iff {s : Set α} {t : ∀ a ∈ s, Set β} (hs : s.Countable) :
     (⋃ a ∈ s, t a ‹_›).Countable ↔ ∀ a ∈ s, (t a ‹_›).Countable :=
   by
   haveI := hs.to_subtype
   rw [bUnion_eq_Union, countable_Union_iff, SetCoe.forall']
-#align set.countable.bUnion_iff Set.Countable.bunionᵢ_iff
+#align set.countable.bUnion_iff Set.Countable.biUnion_iff
 -/
 
-#print Set.Countable.unionₛ_iff /-
-theorem Countable.unionₛ_iff {s : Set (Set α)} (hs : s.Countable) :
+#print Set.Countable.sUnion_iff /-
+theorem Countable.sUnion_iff {s : Set (Set α)} (hs : s.Countable) :
     (⋃₀ s).Countable ↔ ∀ a ∈ s, (a : _).Countable := by rw [sUnion_eq_bUnion, hs.bUnion_iff]
-#align set.countable.sUnion_iff Set.Countable.unionₛ_iff
+#align set.countable.sUnion_iff Set.Countable.sUnion_iff
 -/
 
 alias countable.bUnion_iff ↔ _ countable.bUnion
-#align set.countable.bUnion Set.Countable.bunionᵢ
+#align set.countable.bUnion Set.Countable.biUnion
 
 alias countable.sUnion_iff ↔ _ countable.sUnion
-#align set.countable.sUnion Set.Countable.unionₛ
+#align set.countable.sUnion Set.Countable.sUnion
 
 /- warning: set.countable_union -> Set.countable_union is a dubious translation:
 lean 3 declaration is

Changes in mathlib4

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

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

Diff
@@ -6,7 +6,7 @@ Authors: Johannes Hölzl
 import Mathlib.Data.Set.Finite
 import Mathlib.Data.Countable.Basic
 import Mathlib.Logic.Equiv.List
-import Mathlib.Data.Set.Basic
+import Mathlib.Data.Set.Subsingleton
 
 #align_import data.set.countable from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"
 
chore: Remove ball and bex from lemma names (#10816)

ball for "bounded forall" and bex for "bounded exists" are from experience very confusing abbreviations. This PR renames them to forall_mem and exists_mem in the few Set lemma names that mention them.

Also deprecate ball_image_of_ball, mem_image_elim, mem_image_elim_on since those lemmas are duplicates of the renamed lemmas (apart from argument order and implicitness, which I am also fixing by making the binder in the RHS of forall_mem_image semi-implicit), have obscure names and are completely unused.

Diff
@@ -195,7 +195,7 @@ theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Pr
       ∃ S : Set α, S.Countable ∧ (∀ s ∈ S, p s) ∧ sSup S = ⊤ := by
   constructor
   · rintro ⟨s, hps, hs⟩
-    refine' ⟨range s, countable_range s, forall_range_iff.2 hps, _⟩
+    refine' ⟨range s, countable_range s, forall_mem_range.2 hps, _⟩
     rwa [sSup_range]
   · rintro ⟨S, hSc, hps, hS⟩
     rcases eq_empty_or_nonempty S with (rfl | hne)
chore: scope open Classical (#11199)

We remove all but one open Classicals, instead preferring to use open scoped Classical. The only real side-effect this led to is moving a couple declarations to use Exists.choose instead of Classical.choose.

The first few commits are explicitly labelled regex replaces for ease of review.

Diff
@@ -26,7 +26,8 @@ sets, countable set
 
 noncomputable section
 
-open Function Set Encodable Classical
+open scoped Classical
+open Function Set Encodable
 
 universe u v w x
 
feat: range of enumerateCountable when the default value belongs to the set (#10787)
Diff
@@ -95,6 +95,26 @@ theorem subset_range_enumerate {s : Set α} (h : s.Countable) (default : α) :
     simp [enumerateCountable, Encodable.encodek]⟩
 #align set.subset_range_enumerate Set.subset_range_enumerate
 
+lemma range_enumerateCountable_subset {s : Set α} (h : s.Countable) (default : α) :
+    range (enumerateCountable h default) ⊆ insert default s := by
+  refine range_subset_iff.mpr (fun n ↦ ?_)
+  rw [enumerateCountable]
+  match @decode s (Countable.toEncodable h) n with
+  | none => exact mem_insert _ _
+  | some val => simp
+
+lemma range_enumerateCountable_of_mem {s : Set α} (h : s.Countable) {default : α}
+    (h_mem : default ∈ s) :
+    range (enumerateCountable h default) = s :=
+  subset_antisymm ((range_enumerateCountable_subset h _).trans_eq (insert_eq_of_mem h_mem))
+    (subset_range_enumerate h default)
+
+lemma enumerateCountable_mem {s : Set α} (h : s.Countable) {default : α} (h_mem : default ∈ s)
+    (n : ℕ) :
+    enumerateCountable h default n ∈ s := by
+  conv_rhs => rw [← range_enumerateCountable_of_mem h h_mem]
+  exact mem_range_self n
+
 end Enumerate
 
 theorem Countable.mono {s₁ s₂ : Set α} (h : s₁ ⊆ s₂) (hs : s₂.Countable) : s₁.Countable :=
refactor(Set/Countable): redefine Set.Countable (#9831)

Redefine Set.Countable s as _root_.Countable s. Fix compile, golf some of the broken proofs.

Diff
@@ -12,6 +12,16 @@ import Mathlib.Data.Set.Basic
 
 /-!
 # Countable sets
+
+In this file we define `Set.Countable s` as `Countable s`
+and prove basic properties of this definition.
+
+Note that this definition does not provide a computable encoding.
+For a noncomputable conversion to `Encodable s`, use `Set.Countable.nonempty_encodable`.
+
+## Keywords
+
+sets, countable set
 -/
 
 noncomputable section
@@ -24,23 +34,22 @@ variable {α : Type u} {β : Type v} {γ : Type w} {ι : Sort x}
 
 namespace Set
 
-/-- A set is countable if there exists an encoding of the set into the natural numbers.
-An encoding is an injection with a partial inverse, which can be viewed as a
-constructive analogue of countability. (For the most part, theorems about
-`Countable` will be classical and `Encodable` will be constructive.)
+/-- A set `s` is countable if the corresponding subtype is countable,
+i.e., there exists an injective map `f : s → ℕ`.
+
+Note that this is an abbreviation, so `hs : Set.Countable s` in the proof context
+is the same as an instance `Countable s`.
+For a constructive version, see `Encodable`.
 -/
-protected def Countable (s : Set α) : Prop :=
-  Nonempty (Encodable s)
+protected def Countable (s : Set α) : Prop := Countable s
 #align set.countable Set.Countable
 
 @[simp]
-theorem countable_coe_iff {s : Set α} : Countable s ↔ s.Countable :=
-  Encodable.nonempty_encodable.symm
+theorem countable_coe_iff {s : Set α} : Countable s ↔ s.Countable := .rfl
 #align set.countable_coe_iff Set.countable_coe_iff
 
 /-- Prove `Set.Countable` from a `Countable` instance on the subtype. -/
-theorem to_countable (s : Set α) [Countable s] : s.Countable :=
-  countable_coe_iff.mp ‹_›
+theorem to_countable (s : Set α) [Countable s] : s.Countable := ‹_›
 #align set.to_countable Set.to_countable
 
 /-- Restate `Set.Countable` as a `Countable` instance. -/
@@ -50,7 +59,7 @@ alias ⟨_root_.Countable.to_set, Countable.to_subtype⟩ := countable_coe_iff
 
 protected theorem countable_iff_exists_injective {s : Set α} :
     s.Countable ↔ ∃ f : s → ℕ, Injective f :=
-  countable_coe_iff.symm.trans (countable_iff_exists_injective s)
+  countable_iff_exists_injective s
 #align set.countable_iff_exists_injective Set.countable_iff_exists_injective
 
 /-- A set `s : Set α` is countable if and only if there exists a function `α → ℕ` injective
@@ -59,9 +68,14 @@ theorem countable_iff_exists_injOn {s : Set α} : s.Countable ↔ ∃ f : α →
   Set.countable_iff_exists_injective.trans exists_injOn_iff_injective.symm
 #align set.countable_iff_exists_inj_on Set.countable_iff_exists_injOn
 
+theorem countable_iff_nonempty_encodable {s : Set α} : s.Countable ↔ Nonempty (Encodable s) :=
+  Encodable.nonempty_encodable.symm
+
+alias ⟨Countable.nonempty_encodable, _⟩ := countable_iff_nonempty_encodable
+
 /-- Convert `Set.Countable s` to `Encodable s` (noncomputable). -/
-protected def Countable.toEncodable {s : Set α} : s.Countable → Encodable s :=
-  Classical.choice
+protected def Countable.toEncodable {s : Set α} (hs : s.Countable) : Encodable s :=
+  Classical.choice hs.nonempty_encodable
 #align set.countable.to_encodable Set.Countable.toEncodable
 
 section Enumerate
@@ -83,8 +97,8 @@ theorem subset_range_enumerate {s : Set α} (h : s.Countable) (default : α) :
 
 end Enumerate
 
-theorem Countable.mono {s₁ s₂ : Set α} (h : s₁ ⊆ s₂) : s₂.Countable → s₁.Countable
-  | ⟨H⟩ => ⟨@ofInj _ _ H _ (embeddingOfSubset _ _ h).2⟩
+theorem Countable.mono {s₁ s₂ : Set α} (h : s₁ ⊆ s₂) (hs : s₂.Countable) : s₁.Countable :=
+  have := hs.to_subtype; (inclusion_injective h).countable
 #align set.countable.mono Set.Countable.mono
 
 theorem countable_range [Countable ι] (f : ι → β) : (range f).Countable :=
@@ -104,7 +118,7 @@ natural numbers onto the subtype induced by the set.
 -/
 protected theorem countable_iff_exists_surjective {s : Set α} (hs : s.Nonempty) :
     s.Countable ↔ ∃ f : ℕ → s, Surjective f :=
-  countable_coe_iff.symm.trans <| @countable_iff_exists_surjective s hs.to_subtype
+  @countable_iff_exists_surjective s hs.to_subtype
 #align set.countable_iff_exists_surjective Set.countable_iff_exists_surjective
 
 alias ⟨Countable.exists_surjective, _⟩ := Set.countable_iff_exists_surjective
@@ -134,14 +148,15 @@ theorem Countable.exists_eq_range {s : Set α} (hc : s.Countable) (hs : s.Nonemp
 
 theorem Countable.image {s : Set α} (hs : s.Countable) (f : α → β) : (f '' s).Countable := by
   rw [image_eq_range]
-  haveI := hs.to_subtype
+  have := hs.to_subtype
   apply countable_range
 #align set.countable.image Set.Countable.image
 
 theorem MapsTo.countable_of_injOn {s : Set α} {t : Set β} {f : α → β} (hf : MapsTo f s t)
     (hf' : InjOn f s) (ht : t.Countable) : s.Countable :=
+  have := ht.to_subtype
   have : Injective (hf.restrict f s t) := (injOn_iff_injective.1 hf').codRestrict _
-  ⟨@Encodable.ofInj _ _ ht.toEncodable _ this⟩
+  this.countable
 #align set.maps_to.countable_of_inj_on Set.MapsTo.countable_of_injOn
 
 theorem Countable.preimage_of_injOn {s : Set β} (hs : s.Countable) {f : α → β}
@@ -185,7 +200,7 @@ theorem countable_of_injective_of_countable_image {s : Set α} {f : α → β} (
 
 theorem countable_iUnion {t : ι → Set α} [Countable ι] (ht : ∀ i, (t i).Countable) :
     (⋃ i, t i).Countable := by
-  haveI := fun a => (ht a).to_subtype
+  have := fun i ↦ (ht i).to_subtype
   rw [iUnion_eq_range_psigma]
   apply countable_range
 #align set.countable_Union Set.countable_iUnion
@@ -198,12 +213,12 @@ theorem countable_iUnion_iff [Countable ι] {t : ι → Set α} :
 
 theorem Countable.biUnion_iff {s : Set α} {t : ∀ a ∈ s, Set β} (hs : s.Countable) :
     (⋃ a ∈ s, t a ‹_›).Countable ↔ ∀ a (ha : a ∈ s), (t a ha).Countable := by
-  haveI := hs.to_subtype
+  have := hs.to_subtype
   rw [biUnion_eq_iUnion, countable_iUnion_iff, SetCoe.forall']
 #align set.countable.bUnion_iff Set.Countable.biUnion_iff
 
 theorem Countable.sUnion_iff {s : Set (Set α)} (hs : s.Countable) :
-    (⋃₀ s).Countable ↔ ∀ a ∈ s, (a : _).Countable := by rw [sUnion_eq_biUnion, hs.biUnion_iff]
+    (⋃₀ s).Countable ↔ ∀ a ∈ s, a.Countable := by rw [sUnion_eq_biUnion, hs.biUnion_iff]
 #align set.countable.sUnion_iff Set.Countable.sUnion_iff
 
 alias ⟨_, Countable.biUnion⟩ := Countable.biUnion_iff
@@ -233,8 +248,8 @@ protected theorem Countable.insert {s : Set α} (a : α) (h : s.Countable) : (in
   countable_insert.2 h
 #align set.countable.insert Set.Countable.insert
 
-theorem Finite.countable {s : Set α} : s.Finite → s.Countable
-  | ⟨_⟩ => Trunc.nonempty (Fintype.truncEncodable s)
+theorem Finite.countable {s : Set α} (hs : s.Finite) : s.Countable :=
+  have := hs.to_subtype; s.to_countable
 #align set.finite.countable Set.Finite.countable
 
 @[nontriviality]
@@ -257,8 +272,8 @@ theorem countable_isBot (α : Type*) [PartialOrder α] : { x : α | IsBot x }.Co
 /-- The set of finite subsets of a countable set is countable. -/
 theorem countable_setOf_finite_subset {s : Set α} (hs : s.Countable) :
     { t | Set.Finite t ∧ t ⊆ s }.Countable := by
-  haveI := hs.to_subtype
-  refine' Countable.mono _ (countable_range fun t : Finset s => Subtype.val '' (t : Set s))
+  have := hs.to_subtype
+  refine (countable_range fun t : Finset s => Subtype.val '' (t : Set s)).mono ?_
   rintro t ⟨ht, hts⟩
   lift t to Set s using hts
   lift t to Finset s using ht.of_finite_image (Subtype.val_injective.injOn _)
@@ -267,8 +282,7 @@ theorem countable_setOf_finite_subset {s : Set α} (hs : s.Countable) :
 
 theorem countable_univ_pi {π : α → Type*} [Finite α] {s : ∀ a, Set (π a)}
     (hs : ∀ a, (s a).Countable) : (pi univ s).Countable :=
-  haveI := fun a => (hs a).to_subtype
-  (Countable.of_equiv _ (Equiv.Set.univPi s).symm).to_set
+  have := fun a ↦ (hs a).to_subtype; .of_equiv _ (Equiv.Set.univPi s).symm
 #align set.countable_univ_pi Set.countable_univ_pi
 
 theorem countable_pi {π : α → Type*} [Finite α] {s : ∀ a, Set (π a)} (hs : ∀ a, (s a).Countable) :
@@ -277,10 +291,8 @@ theorem countable_pi {π : α → Type*} [Finite α] {s : ∀ a, Set (π a)} (hs
 #align set.countable_pi Set.countable_pi
 
 protected theorem Countable.prod {s : Set α} {t : Set β} (hs : s.Countable) (ht : t.Countable) :
-    Set.Countable (s ×ˢ t) := by
-  haveI : Countable s := hs.to_subtype
-  haveI : Countable t := ht.to_subtype
-  exact (Countable.of_equiv _ <| (Equiv.Set.prod _ _).symm).to_set
+    Set.Countable (s ×ˢ t) :=
+  have := hs.to_subtype; have := ht.to_subtype; .of_equiv _ <| (Equiv.Set.prod _ _).symm
 #align set.countable.prod Set.Countable.prod
 
 theorem Countable.image2 {s : Set α} {t : Set β} (hs : s.Countable) (ht : t.Countable)
chore(*): shake imports (#10199)
  • Remove Data.Set.Basic from scripts/noshake.json.
  • Remove an exception that was used by examples only, move these examples to a new test file.
  • Drop an exception for Order.Filter.Basic dependency on Control.Traversable.Instances, as the relevant parts were moved to Order.Filter.ListTraverse.
  • Run lake exe shake --fix.
Diff
@@ -6,6 +6,7 @@ Authors: Johannes Hölzl
 import Mathlib.Data.Set.Finite
 import Mathlib.Data.Countable.Basic
 import Mathlib.Logic.Equiv.List
+import Mathlib.Data.Set.Basic
 
 #align_import data.set.countable from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"
 
chore: missing spaces after rcases, convert and congrm (#7725)

Replace rcases( with rcases (. Same thing for convert( and congrm(. No other change.

Diff
@@ -166,7 +166,7 @@ theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Pr
       haveI := subsingleton_of_bot_eq_top hS
       rcases h with ⟨x, hx⟩
       exact ⟨fun _ => x, fun _ => hx, Subsingleton.elim _ _⟩
-    · rcases(Set.countable_iff_exists_surjective hne).1 hSc with ⟨s, hs⟩
+    · rcases (Set.countable_iff_exists_surjective hne).1 hSc with ⟨s, hs⟩
       refine' ⟨fun n => s n, fun n => hps _ (s n).coe_prop, _⟩
       rwa [hs.iSup_comp, ← sSup_eq_iSup']
 #align set.exists_seq_supr_eq_top_iff_countable Set.exists_seq_iSup_eq_top_iff_countable
feat: the complement of a countable set is path-connected in dimension > 1 (#6690)

Also show that spheres are path-connected in dimension > 1.

Diff
@@ -288,6 +288,27 @@ theorem Countable.image2 {s : Set α} {t : Set β} (hs : s.Countable) (ht : t.Co
   exact (hs.prod ht).image _
 #align set.countable.image2 Set.Countable.image2
 
+/-- If a family of disjoint sets is included in a countable set, then only countably many of
+them are nonempty. -/
+theorem countable_setOf_nonempty_of_disjoint {f : β → Set α}
+    (hf : Pairwise (Disjoint on f)) {s : Set α} (h'f : ∀ t, f t ⊆ s) (hs : s.Countable) :
+    Set.Countable {t | (f t).Nonempty} := by
+  rw [← Set.countable_coe_iff] at hs ⊢
+  have : ∀ t : {t // (f t).Nonempty}, ∃ x : s, x.1 ∈ f t := by
+    rintro ⟨t, ⟨x, hx⟩⟩
+    exact ⟨⟨x, (h'f t hx)⟩, hx⟩
+  choose F hF using this
+  have A : Injective F := by
+    rintro ⟨t, ht⟩ ⟨t', ht'⟩ htt'
+    have A : (f t ∩ f t').Nonempty := by
+      refine ⟨F ⟨t, ht⟩, hF _, ?_⟩
+      rw [htt']
+      exact hF _
+    simp only [Subtype.mk.injEq]
+    by_contra H
+    exact not_disjoint_iff_nonempty_inter.2 A (hf H)
+  exact Injective.countable A
+
 end Set
 
 theorem Finset.countable_toSet (s : Finset α) : Set.Countable (↑s : Set α) :=
feat: patch for new alias command (#6172)
Diff
@@ -43,7 +43,7 @@ theorem to_countable (s : Set α) [Countable s] : s.Countable :=
 #align set.to_countable Set.to_countable
 
 /-- Restate `Set.Countable` as a `Countable` instance. -/
-alias countable_coe_iff ↔ _root_.Countable.to_set Countable.to_subtype
+alias ⟨_root_.Countable.to_set, Countable.to_subtype⟩ := countable_coe_iff
 #align countable.to_set Countable.to_set
 #align set.countable.to_subtype Set.Countable.to_subtype
 
@@ -106,7 +106,7 @@ protected theorem countable_iff_exists_surjective {s : Set α} (hs : s.Nonempty)
   countable_coe_iff.symm.trans <| @countable_iff_exists_surjective s hs.to_subtype
 #align set.countable_iff_exists_surjective Set.countable_iff_exists_surjective
 
-alias Set.countable_iff_exists_surjective ↔ Countable.exists_surjective _
+alias ⟨Countable.exists_surjective, _⟩ := Set.countable_iff_exists_surjective
 #align set.countable.exists_surjective Set.Countable.exists_surjective
 
 theorem countable_univ [Countable α] : (univ : Set α).Countable :=
@@ -205,10 +205,10 @@ theorem Countable.sUnion_iff {s : Set (Set α)} (hs : s.Countable) :
     (⋃₀ s).Countable ↔ ∀ a ∈ s, (a : _).Countable := by rw [sUnion_eq_biUnion, hs.biUnion_iff]
 #align set.countable.sUnion_iff Set.Countable.sUnion_iff
 
-alias Countable.biUnion_iff ↔ _ Countable.biUnion
+alias ⟨_, Countable.biUnion⟩ := Countable.biUnion_iff
 #align set.countable.bUnion Set.Countable.biUnion
 
-alias Countable.sUnion_iff ↔ _ Countable.sUnion
+alias ⟨_, Countable.sUnion⟩ := Countable.sUnion_iff
 #align set.countable.sUnion Set.Countable.sUnion
 
 @[simp]
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
@@ -245,11 +245,11 @@ theorem Subsingleton.countable {s : Set α} (hs : s.Subsingleton) : s.Countable
   hs.finite.countable
 #align set.subsingleton.countable Set.Subsingleton.countable
 
-theorem countable_isTop (α : Type _) [PartialOrder α] : { x : α | IsTop x }.Countable :=
+theorem countable_isTop (α : Type*) [PartialOrder α] : { x : α | IsTop x }.Countable :=
   (finite_isTop α).countable
 #align set.countable_is_top Set.countable_isTop
 
-theorem countable_isBot (α : Type _) [PartialOrder α] : { x : α | IsBot x }.Countable :=
+theorem countable_isBot (α : Type*) [PartialOrder α] : { x : α | IsBot x }.Countable :=
   (finite_isBot α).countable
 #align set.countable_is_bot Set.countable_isBot
 
@@ -264,13 +264,13 @@ theorem countable_setOf_finite_subset {s : Set α} (hs : s.Countable) :
   exact mem_range_self _
 #align set.countable_set_of_finite_subset Set.countable_setOf_finite_subset
 
-theorem countable_univ_pi {π : α → Type _} [Finite α] {s : ∀ a, Set (π a)}
+theorem countable_univ_pi {π : α → Type*} [Finite α] {s : ∀ a, Set (π a)}
     (hs : ∀ a, (s a).Countable) : (pi univ s).Countable :=
   haveI := fun a => (hs a).to_subtype
   (Countable.of_equiv _ (Equiv.Set.univPi s).symm).to_set
 #align set.countable_univ_pi Set.countable_univ_pi
 
-theorem countable_pi {π : α → Type _} [Finite α] {s : ∀ a, Set (π a)} (hs : ∀ a, (s a).Countable) :
+theorem countable_pi {π : α → Type*} [Finite α] {s : ∀ a, Set (π a)} (hs : ∀ a, (s a).Countable) :
     { f : ∀ a, π a | ∀ a, f a ∈ s a }.Countable := by
   simpa only [← mem_univ_pi] using countable_univ_pi hs
 #align set.countable_pi Set.countable_pi
chore(*): add protected to *.insert theorems (#6142)

Otherwise code like

theorem ContMDiffWithinAt.mythm (h : x ∈ insert y s) : _ = _

interprets insert as ContMDiffWithinAt.insert, not Insert.insert.

Diff
@@ -228,7 +228,7 @@ theorem countable_insert {s : Set α} {a : α} : (insert a s).Countable ↔ s.Co
   simp only [insert_eq, countable_union, countable_singleton, true_and_iff]
 #align set.countable_insert Set.countable_insert
 
-theorem Countable.insert {s : Set α} (a : α) (h : s.Countable) : (insert a s).Countable :=
+protected theorem Countable.insert {s : Set α} (a : α) (h : s.Countable) : (insert a s).Countable :=
   countable_insert.2 h
 #align set.countable.insert Set.Countable.insert
 
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,16 +2,13 @@
 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
-
-! This file was ported from Lean 3 source module data.set.countable
-! leanprover-community/mathlib commit 1f0096e6caa61e9c849ec2adbd227e960e9dff58
-! 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.Data.Countable.Basic
 import Mathlib.Logic.Equiv.List
 
+#align_import data.set.countable from "leanprover-community/mathlib"@"1f0096e6caa61e9c849ec2adbd227e960e9dff58"
+
 /-!
 # Countable sets
 -/
feat: add SeparableSpace instances (#5801)
Diff
@@ -116,6 +116,9 @@ theorem countable_univ [Countable α] : (univ : Set α).Countable :=
   to_countable univ
 #align set.countable_univ Set.countable_univ
 
+theorem countable_univ_iff : (univ : Set α).Countable ↔ Countable α :=
+  countable_coe_iff.symm.trans (Equiv.Set.univ _).countable_iff
+
 /-- If `s : Set α` is a nonempty countable set, then there exists a map
 `f : ℕ → α` such that `s = range f`. -/
 theorem Countable.exists_eq_range {s : Set α} (hc : s.Countable) (hs : s.Nonempty) :
fix: precedences of ⨆⋃⋂⨅ (#5614)
Diff
@@ -154,7 +154,7 @@ protected theorem Countable.preimage {s : Set β} (hs : s.Countable) {f : α →
 #align set.countable.preimage Set.Countable.preimage
 
 theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Prop} (h : ∃ x, p x) :
-    (∃ s : ℕ → α, (∀ n, p (s n)) ∧ (⨆ n, s n) = ⊤) ↔
+    (∃ s : ℕ → α, (∀ n, p (s n)) ∧ ⨆ n, s n = ⊤) ↔
       ∃ S : Set α, S.Countable ∧ (∀ s ∈ S, p s) ∧ sSup S = ⊤ := by
   constructor
   · rintro ⟨s, hps, hs⟩
@@ -172,7 +172,7 @@ theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Pr
 #align set.exists_seq_supr_eq_top_iff_countable Set.exists_seq_iSup_eq_top_iff_countable
 
 theorem exists_seq_cover_iff_countable {p : Set α → Prop} (h : ∃ s, p s) :
-    (∃ s : ℕ → Set α, (∀ n, p (s n)) ∧ (⋃ n, s n) = univ) ↔
+    (∃ s : ℕ → Set α, (∀ n, p (s n)) ∧ ⋃ n, s n = univ) ↔
       ∃ S : Set (Set α), S.Countable ∧ (∀ s ∈ S, p s) ∧ ⋃₀ S = univ :=
   exists_seq_iSup_eq_top_iff_countable h
 #align set.exists_seq_cover_iff_countable Set.exists_seq_cover_iff_countable
chore: Rename to sSup/iSup (#3938)

As discussed on Zulip

Renames

  • supₛsSup
  • infₛsInf
  • supᵢiSup
  • infᵢiInf
  • bsupₛbsSup
  • binfₛbsInf
  • bsupᵢbiSup
  • binfᵢbiInf
  • csupₛcsSup
  • cinfₛcsInf
  • csupᵢciSup
  • cinfᵢciInf
  • unionₛsUnion
  • interₛsInter
  • unionᵢiUnion
  • interᵢiInter
  • bunionₛbsUnion
  • binterₛbsInter
  • bunionᵢbiUnion
  • binterᵢbiInter

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -153,28 +153,28 @@ protected theorem Countable.preimage {s : Set β} (hs : s.Countable) {f : α →
   hs.preimage_of_injOn (hf.injOn _)
 #align set.countable.preimage Set.Countable.preimage
 
-theorem exists_seq_supᵢ_eq_top_iff_countable [CompleteLattice α] {p : α → Prop} (h : ∃ x, p x) :
+theorem exists_seq_iSup_eq_top_iff_countable [CompleteLattice α] {p : α → Prop} (h : ∃ x, p x) :
     (∃ s : ℕ → α, (∀ n, p (s n)) ∧ (⨆ n, s n) = ⊤) ↔
-      ∃ S : Set α, S.Countable ∧ (∀ s ∈ S, p s) ∧ supₛ S = ⊤ := by
+      ∃ S : Set α, S.Countable ∧ (∀ s ∈ S, p s) ∧ sSup S = ⊤ := by
   constructor
   · rintro ⟨s, hps, hs⟩
     refine' ⟨range s, countable_range s, forall_range_iff.2 hps, _⟩
-    rwa [supₛ_range]
+    rwa [sSup_range]
   · rintro ⟨S, hSc, hps, hS⟩
     rcases eq_empty_or_nonempty S with (rfl | hne)
-    · rw [supₛ_empty] at hS
+    · rw [sSup_empty] at hS
       haveI := subsingleton_of_bot_eq_top hS
       rcases h with ⟨x, hx⟩
       exact ⟨fun _ => x, fun _ => hx, Subsingleton.elim _ _⟩
     · rcases(Set.countable_iff_exists_surjective hne).1 hSc with ⟨s, hs⟩
       refine' ⟨fun n => s n, fun n => hps _ (s n).coe_prop, _⟩
-      rwa [hs.supᵢ_comp, ← supₛ_eq_supᵢ']
-#align set.exists_seq_supr_eq_top_iff_countable Set.exists_seq_supᵢ_eq_top_iff_countable
+      rwa [hs.iSup_comp, ← sSup_eq_iSup']
+#align set.exists_seq_supr_eq_top_iff_countable Set.exists_seq_iSup_eq_top_iff_countable
 
 theorem exists_seq_cover_iff_countable {p : Set α → Prop} (h : ∃ s, p s) :
     (∃ s : ℕ → Set α, (∀ n, p (s n)) ∧ (⋃ n, s n) = univ) ↔
       ∃ S : Set (Set α), S.Countable ∧ (∀ s ∈ S, p s) ∧ ⋃₀ S = univ :=
-  exists_seq_supᵢ_eq_top_iff_countable h
+  exists_seq_iSup_eq_top_iff_countable h
 #align set.exists_seq_cover_iff_countable Set.exists_seq_cover_iff_countable
 
 theorem countable_of_injective_of_countable_image {s : Set α} {f : α → β} (hf : InjOn f s)
@@ -182,38 +182,38 @@ theorem countable_of_injective_of_countable_image {s : Set α} {f : α → β} (
   (mapsTo_image _ _).countable_of_injOn hf hs
 #align set.countable_of_injective_of_countable_image Set.countable_of_injective_of_countable_image
 
-theorem countable_unionᵢ {t : ι → Set α} [Countable ι] (ht : ∀ i, (t i).Countable) :
+theorem countable_iUnion {t : ι → Set α} [Countable ι] (ht : ∀ i, (t i).Countable) :
     (⋃ i, t i).Countable := by
   haveI := fun a => (ht a).to_subtype
-  rw [unionᵢ_eq_range_psigma]
+  rw [iUnion_eq_range_psigma]
   apply countable_range
-#align set.countable_Union Set.countable_unionᵢ
+#align set.countable_Union Set.countable_iUnion
 
 @[simp]
-theorem countable_unionᵢ_iff [Countable ι] {t : ι → Set α} :
+theorem countable_iUnion_iff [Countable ι] {t : ι → Set α} :
     (⋃ i, t i).Countable ↔ ∀ i, (t i).Countable :=
-  ⟨fun h _ => h.mono <| subset_unionᵢ _ _, countable_unionᵢ⟩
-#align set.countable_Union_iff Set.countable_unionᵢ_iff
+  ⟨fun h _ => h.mono <| subset_iUnion _ _, countable_iUnion⟩
+#align set.countable_Union_iff Set.countable_iUnion_iff
 
-theorem Countable.bunionᵢ_iff {s : Set α} {t : ∀ a ∈ s, Set β} (hs : s.Countable) :
+theorem Countable.biUnion_iff {s : Set α} {t : ∀ a ∈ s, Set β} (hs : s.Countable) :
     (⋃ a ∈ s, t a ‹_›).Countable ↔ ∀ a (ha : a ∈ s), (t a ha).Countable := by
   haveI := hs.to_subtype
-  rw [bunionᵢ_eq_unionᵢ, countable_unionᵢ_iff, SetCoe.forall']
-#align set.countable.bUnion_iff Set.Countable.bunionᵢ_iff
+  rw [biUnion_eq_iUnion, countable_iUnion_iff, SetCoe.forall']
+#align set.countable.bUnion_iff Set.Countable.biUnion_iff
 
-theorem Countable.unionₛ_iff {s : Set (Set α)} (hs : s.Countable) :
-    (⋃₀ s).Countable ↔ ∀ a ∈ s, (a : _).Countable := by rw [unionₛ_eq_bunionᵢ, hs.bunionᵢ_iff]
-#align set.countable.sUnion_iff Set.Countable.unionₛ_iff
+theorem Countable.sUnion_iff {s : Set (Set α)} (hs : s.Countable) :
+    (⋃₀ s).Countable ↔ ∀ a ∈ s, (a : _).Countable := by rw [sUnion_eq_biUnion, hs.biUnion_iff]
+#align set.countable.sUnion_iff Set.Countable.sUnion_iff
 
-alias Countable.bunionᵢ_iff ↔ _ Countable.bunionᵢ
-#align set.countable.bUnion Set.Countable.bunionᵢ
+alias Countable.biUnion_iff ↔ _ Countable.biUnion
+#align set.countable.bUnion Set.Countable.biUnion
 
-alias Countable.unionₛ_iff ↔ _ Countable.unionₛ
-#align set.countable.sUnion Set.Countable.unionₛ
+alias Countable.sUnion_iff ↔ _ Countable.sUnion
+#align set.countable.sUnion Set.Countable.sUnion
 
 @[simp]
 theorem countable_union {s t : Set α} : (s ∪ t).Countable ↔ s.Countable ∧ t.Countable := by
-  simp [union_eq_unionᵢ, and_comm]
+  simp [union_eq_iUnion, and_comm]
 #align set.countable_union Set.countable_union
 
 theorem Countable.union {s t : Set α} (hs : s.Countable) (ht : t.Countable) : (s ∪ t).Countable :=
@@ -293,4 +293,3 @@ end Set
 theorem Finset.countable_toSet (s : Finset α) : Set.Countable (↑s : Set α) :=
   s.finite_toSet.countable
 #align finset.countable_to_set Finset.countable_toSet
-
chore: golf a proof (#2593)
Diff
@@ -179,8 +179,7 @@ theorem exists_seq_cover_iff_countable {p : Set α → Prop} (h : ∃ s, p s) :
 
 theorem countable_of_injective_of_countable_image {s : Set α} {f : α → β} (hf : InjOn f s)
     (hs : (f '' s).Countable) : s.Countable :=
-  let ⟨g, hg⟩ := countable_iff_exists_injOn.1 hs
-  countable_iff_exists_injOn.2 ⟨g ∘ f, hg.comp hf (mapsTo_image _ _)⟩
+  (mapsTo_image _ _).countable_of_injOn hf hs
 #align set.countable_of_injective_of_countable_image Set.countable_of_injective_of_countable_image
 
 theorem countable_unionᵢ {t : ι → Set α} [Countable ι] (ht : ∀ i, (t i).Countable) :
feat: port Topology.Order.Basic (#2052)
Diff
@@ -221,6 +221,9 @@ theorem Countable.union {s t : Set α} (hs : s.Countable) (ht : t.Countable) : (
   countable_union.2 ⟨hs, ht⟩
 #align set.countable.union Set.Countable.union
 
+theorem Countable.of_diff {s t : Set α} (h : (s \ t).Countable) (ht : t.Countable) : s.Countable :=
+  (h.union ht).mono (subset_diff_union _ _)
+
 @[simp]
 theorem countable_insert {s : Set α} {a : α} : (insert a s).Countable ↔ s.Countable := by
   simp only [insert_eq, countable_union, countable_singleton, true_and_iff]
chore: rename 2 lemmas (#1986)
  • Finset.countable_to_set -> Finset.countable_toSet
  • Continuous.is_open_preimage -> Continuous.isOpen_preimage
Diff
@@ -288,7 +288,7 @@ theorem Countable.image2 {s : Set α} {t : Set β} (hs : s.Countable) (ht : t.Co
 
 end Set
 
-theorem Finset.countable_to_set (s : Finset α) : Set.Countable (↑s : Set α) :=
+theorem Finset.countable_toSet (s : Finset α) : Set.Countable (↑s : Set α) :=
   s.finite_toSet.countable
-#align finset.countable_to_set Finset.countable_to_set
+#align finset.countable_to_set Finset.countable_toSet
 
Feat: port Data.Set.Countable (#1788)

Co-authored-by: Johan Commelin <johan@commelin.net>

Dependencies 6 + 233

234 files ported (97.5%)
99480 lines ported (97.9%)
Show graph

The unported dependencies are