Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 6379d39

Browse files
committed
feat(data/set/countable): protect lemmas (#15415)
We protect `set.countable_iff_exists_injective`, `set.countable_iff_exists_surjective`, and `set.countable.to_encodable` in order to avoid clashes with the theorems on the new `countable` typeclass.
1 parent 621cf7f commit 6379d39

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/data/countable/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import data.countable.defs
1010
/-!
1111
# Countable types
1212
13-
In this file we provide basis instances of the `countable` typeclass defined elsewhere.
13+
In this file we provide basic instances of the `countable` typeclass defined elsewhere.
1414
-/
1515

1616
universes u v w

src/data/set/countable.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ constructive analogue of countability. (For the most part, theorems about
2727
-/
2828
protected def countable (s : set α) : Prop := nonempty (encodable s)
2929

30-
lemma countable_iff_exists_injective {s : set α} :
30+
protected lemma countable_iff_exists_injective {s : set α} :
3131
s.countable ↔ ∃f:s → ℕ, injective f :=
3232
⟨λ ⟨h⟩, by exactI ⟨encode, encode_injective⟩,
3333
λ ⟨f, h⟩, ⟨⟨f, partial_inv f, partial_inv_left h⟩⟩⟩
@@ -36,13 +36,13 @@ lemma countable_iff_exists_injective {s : set α} :
3636
on `s`. -/
3737
lemma countable_iff_exists_inj_on {s : set α} :
3838
s.countable ↔ ∃ f : α → ℕ, inj_on f s :=
39-
countable_iff_exists_injective.trans
39+
set.countable_iff_exists_injective.trans
4040
⟨λ ⟨f, hf⟩, ⟨λ a, if h : a ∈ s then f ⟨a, h⟩ else 0,
4141
λ a as b bs h, congr_arg subtype.val $
4242
hf $ by simpa [as, bs] using h⟩,
4343
λ ⟨f, hf⟩, ⟨_, inj_on_iff_injective.1 hf⟩⟩
4444

45-
lemma countable_iff_exists_surjective [ne : nonempty α] {s : set α} :
45+
protected lemma countable_iff_exists_surjective [ne : nonempty α] {s : set α} :
4646
s.countable ↔ ∃f:ℕ → α, s ⊆ range f :=
4747
⟨λ ⟨h⟩, by inhabit α; exactI ⟨λ n, ((decode s n).map subtype.val).iget,
4848
λ a as, ⟨encode (⟨a, as⟩ : s), by simp [encodek]⟩⟩,
@@ -69,7 +69,7 @@ have (∃ f : ℕ → s, surjective f) → s.countable, from assume ⟨f, fsurj
6969
by split; assumption
7070

7171
/-- Convert `set.countable s` to `encodable s` (noncomputable). -/
72-
def countable.to_encodable {s : set α} : s.countable → encodable s :=
72+
protected def countable.to_encodable {s : set α} : s.countable → encodable s :=
7373
classical.choice
7474

7575
lemma countable_encodable' (s : set α) [H : encodable s] : s.countable :=
@@ -86,7 +86,7 @@ begin
8686
letI : encodable s := countable.to_encodable hc,
8787
letI : nonempty s := hs.to_subtype,
8888
have : (univ : set s).countable := countable_encodable _,
89-
rcases countable_iff_exists_surjective.1 this with ⟨g, hg⟩,
89+
rcases set.countable_iff_exists_surjective.1 this with ⟨g, hg⟩,
9090
have : range g = univ := univ_subset_iff.1 hg,
9191
use coe ∘ g,
9292
simp only [range_comp, this, image_univ, subtype.range_coe]

src/set_theory/cardinal/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ denumerable_iff.1 ⟨‹_›⟩
10381038

10391039
@[simp] lemma mk_set_le_aleph_0 (s : set α) : #s ≤ ℵ₀ ↔ s.countable :=
10401040
begin
1041-
rw [countable_iff_exists_injective], split,
1041+
rw [set.countable_iff_exists_injective], split,
10421042
{ rintro ⟨f'⟩, cases embedding.trans f' equiv.ulift.to_embedding with f hf, exact ⟨f, hf⟩ },
10431043
{ rintro ⟨f, hf⟩, exact ⟨embedding.trans ⟨f, hf⟩ equiv.ulift.symm.to_embedding⟩ }
10441044
end

src/topology/bases.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ If `α` might be empty, then `exists_countable_dense` is the main way to use sep
275275
lemma exists_dense_seq [separable_space α] [nonempty α] : ∃ u : ℕ → α, dense_range u :=
276276
begin
277277
obtain ⟨s : set α, hs, s_dense⟩ := exists_countable_dense α,
278-
cases countable_iff_exists_surjective.mp hs with u hu,
278+
cases set.countable_iff_exists_surjective.mp hs with u hu,
279279
exact ⟨u, s_dense.mono hu⟩,
280280
end
281281

src/topology/metric_space/kuratowski.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ begin
9191
haveI : inhabited α := ⟨basepoint⟩,
9292
have : ∃s:set α, s.countable ∧ dense s := exists_countable_dense α,
9393
rcases this with ⟨S, ⟨S_countable, S_dense⟩⟩,
94-
rcases countable_iff_exists_surjective.1 S_countable with ⟨x, x_range⟩,
94+
rcases set.countable_iff_exists_surjective.1 S_countable with ⟨x, x_range⟩,
9595
/- Use embedding_of_subset to construct the desired isometry -/
9696
exact ⟨embedding_of_subset x, embedding_of_subset_isometry x (S_dense.mono x_range)⟩ }
9797
end

0 commit comments

Comments
 (0)