l3lab/ntp-mathlib huggingface dataset:
/-- A measurable subspace of a standard Borel space is standard Borel. -/
theorem _root_.MeasurableSet.standardBorel {s : Set α} (hs : MeasurableSet s) :
    StandardBorelSpace s := by
  obtain ⟨_, _, _, s_closed, _⟩ := hs.isClopenable'
  haveI := s_closed.polishSpace
  

Proof state:
case intro.intro.intro.intro
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
s : Set α
hs : MeasurableSet s
w✝ : TopologicalSpace α
left✝¹ : BorelSpace α
left✝ : PolishSpace α
s_closed : IsClosed s
right✝ : IsOpen s
this : PolishSpace ↑s
⊢ StandardBorelSpace ↑s

Next tactic:
infer_instance
/-- Any uncountable standard Borel space is Borel isomorphic to the Cantor space `ℕ → Bool`.-/
noncomputable def measurableEquivNatBoolOfNotCountable (h : ¬Countable α) : α ≃ᵐ (ℕ → Bool) := by
  

Proof state:
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
h : ¬Countable α
⊢ α ≃ᵐ (ℕ → Bool)

Next tactic:
apply Nonempty.some
/-- Any uncountable standard Borel space is Borel isomorphic to the Cantor space `ℕ → Bool`.-/
noncomputable def measurableEquivNatBoolOfNotCountable (h : ¬Countable α) : α ≃ᵐ (ℕ → Bool) := by
  apply Nonempty.some
  

Proof state:
case h
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
h : ¬Countable α
⊢ Nonempty (α ≃ᵐ (ℕ → Bool))

Next tactic:
letI := upgradeStandardBorel α
/-- Any uncountable standard Borel space is Borel isomorphic to the Cantor space `ℕ → Bool`.-/
noncomputable def measurableEquivNatBoolOfNotCountable (h : ¬Countable α) : α ≃ᵐ (ℕ → Bool) := by
  apply Nonempty.some
  letI := upgradeStandardBorel α
  

Proof state:
case h
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
h : ¬Countable α
this : UpgradedStandardBorel α := upgradeStandardBorel α
⊢ Nonempty (α ≃ᵐ (ℕ → Bool))

Next tactic:
obtain ⟨f, -, fcts, finj⟩ :=
    isClosed_univ.exists_nat_bool_injection_of_not_countable
      (by rwa [← countable_coe_iff, (Equiv.Set.univ _).countable_iff])
/-- Any uncountable standard Borel space is Borel isomorphic to the Cantor space `ℕ → Bool`.-/
noncomputable def measurableEquivNatBoolOfNotCountable (h : ¬Countable α) : α ≃ᵐ (ℕ → Bool) := by
  apply Nonempty.some
  letI := upgradeStandardBorel α
  obtain ⟨f, -, fcts, finj⟩ :=
    isClosed_univ.exists_nat_bool_injection_of_not_countable
      (by 

Proof state:
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
h : ¬Countable α
this : UpgradedStandardBorel α := upgradeStandardBorel α
⊢ ¬Set.Countable univ

Next tactic:
rwa [← countable_coe_iff, (Equiv.Set.univ _).countable_iff]
/-- Any uncountable standard Borel space is Borel isomorphic to the Cantor space `ℕ → Bool`.-/
noncomputable def measurableEquivNatBoolOfNotCountable (h : ¬Countable α) : α ≃ᵐ (ℕ → Bool) := by
  apply Nonempty.some
  letI := upgradeStandardBorel α
  obtain ⟨f, -, fcts, finj⟩ :=
    isClosed_univ.exists_nat_bool_injection_of_not_countable
      (by rwa [← countable_coe_iff, (Equiv.Set.univ _).countable_iff])
  

Proof state:
case h.intro.intro.intro
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
h : ¬Countable α
this : UpgradedStandardBorel α := upgradeStandardBorel α
f : (ℕ → Bool) → α
fcts : Continuous f
finj : Injective f
⊢ Nonempty (α ≃ᵐ (ℕ → Bool))

Next tactic:
obtain ⟨g, gmeas, ginj⟩ := MeasurableSpace.measurable_injection_nat_bool_of_countablyGenerated α
/-- Any uncountable standard Borel space is Borel isomorphic to the Cantor space `ℕ → Bool`.-/
noncomputable def measurableEquivNatBoolOfNotCountable (h : ¬Countable α) : α ≃ᵐ (ℕ → Bool) := by
  apply Nonempty.some
  letI := upgradeStandardBorel α
  obtain ⟨f, -, fcts, finj⟩ :=
    isClosed_univ.exists_nat_bool_injection_of_not_countable
      (by rwa [← countable_coe_iff, (Equiv.Set.univ _).countable_iff])
  obtain ⟨g, gmeas, ginj⟩ := MeasurableSpace.measurable_injection_nat_bool_of_countablyGenerated α
  

Proof state:
case h.intro.intro.intro.intro.intro
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
h : ¬Countable α
this : UpgradedStandardBorel α := upgradeStandardBorel α
f : (ℕ → Bool) → α
fcts : Continuous f
finj : Injective f
g : α → ℕ → Bool
gmeas : Measurable g
ginj : Injective g
⊢ Nonempty (α ≃ᵐ (ℕ → Bool))

Next tactic:
exact ⟨borelSchroederBernstein gmeas ginj fcts.measurable finj⟩
/-- The **Borel Isomorphism Theorem**: If two standard Borel spaces have the same cardinality,
they are Borel isomorphic.-/
noncomputable def Equiv.measurableEquiv (e : α ≃ β) : α ≃ᵐ β := by
  

Proof state:
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
e : α ≃ β
⊢ α ≃ᵐ β

Next tactic:
by_cases h : Countable α
/-- The **Borel Isomorphism Theorem**: If two standard Borel spaces have the same cardinality,
they are Borel isomorphic.-/
noncomputable def Equiv.measurableEquiv (e : α ≃ β) : α ≃ᵐ β := by
  by_cases h : Countable α
  · 

Proof state:
case pos
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
e : α ≃ β
h : Countable α
⊢ α ≃ᵐ β

Next tactic:
letI := Countable.of_equiv α e
/-- The **Borel Isomorphism Theorem**: If two standard Borel spaces have the same cardinality,
they are Borel isomorphic.-/
noncomputable def Equiv.measurableEquiv (e : α ≃ β) : α ≃ᵐ β := by
  by_cases h : Countable α
  · letI := Countable.of_equiv α e
    

Proof state:
case pos
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
e : α ≃ β
h : Countable α
this : Countable β := Countable.of_equiv α e
⊢ α ≃ᵐ β

Next tactic:
refine ⟨e, ?_, ?_⟩
/-- The **Borel Isomorphism Theorem**: If two standard Borel spaces have the same cardinality,
they are Borel isomorphic.-/
noncomputable def Equiv.measurableEquiv (e : α ≃ β) : α ≃ᵐ β := by
  by_cases h : Countable α
  · letI := Countable.of_equiv α e
    refine ⟨e, ?_, ?_⟩ <;> 

Proof state:
case pos.refine_1
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
e : α ≃ β
h : Countable α
this : Countable β := Countable.of_equiv α e
⊢ Measurable ⇑e

Next tactic:
apply measurable_of_countable
/-- The **Borel Isomorphism Theorem**: If two standard Borel spaces have the same cardinality,
they are Borel isomorphic.-/
noncomputable def Equiv.measurableEquiv (e : α ≃ β) : α ≃ᵐ β := by
  by_cases h : Countable α
  · letI := Countable.of_equiv α e
    refine ⟨e, ?_, ?_⟩ <;> 

Proof state:
case pos.refine_2
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
e : α ≃ β
h : Countable α
this : Countable β := Countable.of_equiv α e
⊢ Measurable ⇑e.symm

Next tactic:
apply measurable_of_countable
/-- The **Borel Isomorphism Theorem**: If two standard Borel spaces have the same cardinality,
they are Borel isomorphic.-/
noncomputable def Equiv.measurableEquiv (e : α ≃ β) : α ≃ᵐ β := by
  by_cases h : Countable α
  · letI := Countable.of_equiv α e
    refine ⟨e, ?_, ?_⟩ <;> apply measurable_of_countable
  

Proof state:
case neg
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
e : α ≃ β
h : ¬Countable α
⊢ α ≃ᵐ β

Next tactic:
refine' measurableEquivOfNotCountable h _
/-- The **Borel Isomorphism Theorem**: If two standard Borel spaces have the same cardinality,
they are Borel isomorphic.-/
noncomputable def Equiv.measurableEquiv (e : α ≃ β) : α ≃ᵐ β := by
  by_cases h : Countable α
  · letI := Countable.of_equiv α e
    refine ⟨e, ?_, ?_⟩ <;> apply measurable_of_countable
  refine' measurableEquivOfNotCountable h _
  

Proof state:
case neg
α : Type u_1
ι : Type u_2
β : Type u_3
inst✝³ : MeasurableSpace α
inst✝² : MeasurableSpace β
inst✝¹ : StandardBorelSpace α
inst✝ : StandardBorelSpace β
e : α ≃ β
h : ¬Countable α
⊢ ¬Countable β

Next tactic:
rwa [e.countable_iff] at h
theorem exists_nat_measurableEquiv_range_coe_fin_of_finite [Finite α] :
    ∃ n : ℕ, Nonempty (α ≃ᵐ range ((↑) : Fin n → ℝ)) := by
  

Proof state:
α : Type u_1
ι : Type u_2
inst✝² : MeasurableSpace α
inst✝¹ : StandardBorelSpace α
inst✝ : Finite α
⊢ ∃ n, Nonempty (α ≃ᵐ ↑(range fun x => ↑↑x))

Next tactic:
obtain ⟨n, ⟨n_equiv⟩⟩ := Finite.exists_equiv_fin α
theorem exists_nat_measurableEquiv_range_coe_fin_of_finite [Finite α] :
    ∃ n : ℕ, Nonempty (α ≃ᵐ range ((↑) : Fin n → ℝ)) := by
  obtain ⟨n, ⟨n_equiv⟩⟩ := Finite.exists_equiv_fin α
  

Proof state:
case intro.intro
α : Type u_1
ι : Type u_2
inst✝² : MeasurableSpace α
inst✝¹ : StandardBorelSpace α
inst✝ : Finite α
n : ℕ
n_equiv : α ≃ Fin n
⊢ ∃ n, Nonempty (α ≃ᵐ ↑(range fun x => ↑↑x))

Next tactic:
refine' ⟨n, ⟨PolishSpace.Equiv.measurableEquiv (n_equiv.trans _)⟩⟩
theorem exists_nat_measurableEquiv_range_coe_fin_of_finite [Finite α] :
    ∃ n : ℕ, Nonempty (α ≃ᵐ range ((↑) : Fin n → ℝ)) := by
  obtain ⟨n, ⟨n_equiv⟩⟩ := Finite.exists_equiv_fin α
  refine' ⟨n, ⟨PolishSpace.Equiv.measurableEquiv (n_equiv.trans _)⟩⟩
  

Proof state:
case intro.intro
α : Type u_1
ι : Type u_2
inst✝² : MeasurableSpace α
inst✝¹ : StandardBorelSpace α
inst✝ : Finite α
n : ℕ
n_equiv : α ≃ Fin n
⊢ Fin n ≃ ↑(range fun x => ↑↑x)

Next tactic:
exact Equiv.ofInjective _ (Nat.cast_injective.comp Fin.val_injective)
theorem measurableEquiv_range_coe_nat_of_infinite_of_countable [Infinite α] [Countable α] :
    Nonempty (α ≃ᵐ range ((↑) : ℕ → ℝ)) := by
  

Proof state:
α : Type u_1
ι : Type u_2
inst✝³ : MeasurableSpace α
inst✝² : StandardBorelSpace α
inst✝¹ : Infinite α
inst✝ : Countable α
⊢ Nonempty (α ≃ᵐ ↑(range Nat.cast))

Next tactic:
have : PolishSpace (range ((↑) : ℕ → ℝ)) :=
    Nat.closedEmbedding_coe_real.isClosedMap.closed_range.polishSpace
theorem measurableEquiv_range_coe_nat_of_infinite_of_countable [Infinite α] [Countable α] :
    Nonempty (α ≃ᵐ range ((↑) : ℕ → ℝ)) := by
  have : PolishSpace (range ((↑) : ℕ → ℝ)) :=
    Nat.closedEmbedding_coe_real.isClosedMap.closed_range.polishSpace
  

Proof state:
α : Type u_1
ι : Type u_2
inst✝³ : MeasurableSpace α
inst✝² : StandardBorelSpace α
inst✝¹ : Infinite α
inst✝ : Countable α
this : PolishSpace ↑(range Nat.cast)
⊢ Nonempty (α ≃ᵐ ↑(range Nat.cast))

Next tactic:
refine' ⟨PolishSpace.Equiv.measurableEquiv _⟩
theorem measurableEquiv_range_coe_nat_of_infinite_of_countable [Infinite α] [Countable α] :
    Nonempty (α ≃ᵐ range ((↑) : ℕ → ℝ)) := by
  have : PolishSpace (range ((↑) : ℕ → ℝ)) :=
    Nat.closedEmbedding_coe_real.isClosedMap.closed_range.polishSpace
  refine' ⟨PolishSpace.Equiv.measurableEquiv _⟩
  

Proof state:
α : Type u_1
ι : Type u_2
inst✝³ : MeasurableSpace α
inst✝² : StandardBorelSpace α
inst✝¹ : Infinite α
inst✝ : Countable α
this : PolishSpace ↑(range Nat.cast)
⊢ α ≃ ↑(range Nat.cast)

Next tactic:
refine' (nonempty_equiv_of_countable.some : α ≃ ℕ).trans _
theorem measurableEquiv_range_coe_nat_of_infinite_of_countable [Infinite α] [Countable α] :
    Nonempty (α ≃ᵐ range ((↑) : ℕ → ℝ)) := by
  have : PolishSpace (range ((↑) : ℕ → ℝ)) :=
    Nat.closedEmbedding_coe_real.isClosedMap.closed_range.polishSpace
  refine' ⟨PolishSpace.Equiv.measurableEquiv _⟩
  refine' (nonempty_equiv_of_countable.some : α ≃ ℕ).trans _
  

Proof state:
α : Type u_1
ι : Type u_2
inst✝³ : MeasurableSpace α
inst✝² : StandardBorelSpace α
inst✝¹ : Infinite α
inst✝ : Countable α
this : PolishSpace ↑(range Nat.cast)
⊢ ℕ ≃ ↑(range Nat.cast)

Next tactic:
exact Equiv.ofInjective ((↑) : ℕ → ℝ) Nat.cast_injective
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  

Proof state:
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
⊢ ∃ s, MeasurableSet s ∧ Nonempty (α ≃ᵐ ↑s)

Next tactic:
by_cases hα : Countable α
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · 

Proof state:
case pos
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
⊢ ∃ s, MeasurableSet s ∧ Nonempty (α ≃ᵐ ↑s)

Next tactic:
cases finite_or_infinite α
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · 

Proof state:
case pos.inl
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
h✝ : Finite α
⊢ ∃ s, MeasurableSet s ∧ Nonempty (α ≃ᵐ ↑s)

Next tactic:
obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      

Proof state:
case pos.inl.intro
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
h✝ : Finite α
n : ℕ
h_nonempty_equiv : Nonempty (α ≃ᵐ ↑(range fun x => ↑↑x))
⊢ ∃ s, MeasurableSet s ∧ Nonempty (α ≃ᵐ ↑s)

Next tactic:
refine' ⟨_, _, h_nonempty_equiv⟩
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      

Proof state:
case pos.inl.intro
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
h✝ : Finite α
n : ℕ
h_nonempty_equiv : Nonempty (α ≃ᵐ ↑(range fun x => ↑↑x))
⊢ MeasurableSet (range fun x => ↑↑x)

Next tactic:
letI : MeasurableSpace (Fin n) := borel (Fin n)
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      letI : MeasurableSpace (Fin n) := borel (Fin n)
      

Proof state:
case pos.inl.intro
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
h✝ : Finite α
n : ℕ
h_nonempty_equiv : Nonempty (α ≃ᵐ ↑(range fun x => ↑↑x))
this : MeasurableSpace (Fin n) := borel (Fin n)
⊢ MeasurableSet (range fun x => ↑↑x)

Next tactic:
haveI : BorelSpace (Fin n) := ⟨rfl⟩
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      letI : MeasurableSpace (Fin n) := borel (Fin n)
      haveI : BorelSpace (Fin n) := ⟨rfl⟩
      

Proof state:
case pos.inl.intro
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
h✝ : Finite α
n : ℕ
h_nonempty_equiv : Nonempty (α ≃ᵐ ↑(range fun x => ↑↑x))
this✝ : MeasurableSpace (Fin n) := borel (Fin n)
this : BorelSpace (Fin n)
⊢ MeasurableSet (range fun x => ↑↑x)

Next tactic:
refine' MeasurableEmbedding.measurableSet_range _
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      letI : MeasurableSpace (Fin n) := borel (Fin n)
      haveI : BorelSpace (Fin n) := ⟨rfl⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · 

Proof state:
case pos.inl.intro.refine'_1
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
h✝ : Finite α
n : ℕ
h_nonempty_equiv : Nonempty (α ≃ᵐ ↑(range fun x => ↑↑x))
this✝ : MeasurableSpace (Fin n) := borel (Fin n)
this : BorelSpace (Fin n)
⊢ MeasurableSpace (Fin n)

Next tactic:
infer_instance
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      letI : MeasurableSpace (Fin n) := borel (Fin n)
      haveI : BorelSpace (Fin n) := ⟨rfl⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · 

Proof state:
case pos.inl.intro.refine'_2
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
h✝ : Finite α
n : ℕ
h_nonempty_equiv : Nonempty (α ≃ᵐ ↑(range fun x => ↑↑x))
this✝ : MeasurableSpace (Fin n) := borel (Fin n)
this : BorelSpace (Fin n)
⊢ MeasurableEmbedding fun x => ↑↑x

Next tactic:
exact
          continuous_of_discreteTopology.measurableEmbedding
            (Nat.cast_injective.comp Fin.val_injective)
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      letI : MeasurableSpace (Fin n) := borel (Fin n)
      haveI : BorelSpace (Fin n) := ⟨rfl⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · exact
          continuous_of_discreteTopology.measurableEmbedding
            (Nat.cast_injective.comp Fin.val_injective)
    · 

Proof state:
case pos.inr
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
h✝ : Infinite α
⊢ ∃ s, MeasurableSet s ∧ Nonempty (α ≃ᵐ ↑s)

Next tactic:
refine' ⟨_, _, measurableEquiv_range_coe_nat_of_infinite_of_countable α⟩
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      letI : MeasurableSpace (Fin n) := borel (Fin n)
      haveI : BorelSpace (Fin n) := ⟨rfl⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · exact
          continuous_of_discreteTopology.measurableEmbedding
            (Nat.cast_injective.comp Fin.val_injective)
    · refine' ⟨_, _, measurableEquiv_range_coe_nat_of_infinite_of_countable α⟩
      

Proof state:
case pos.inr
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
h✝ : Infinite α
⊢ MeasurableSet (range Nat.cast)

Next tactic:
refine' MeasurableEmbedding.measurableSet_range _
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      letI : MeasurableSpace (Fin n) := borel (Fin n)
      haveI : BorelSpace (Fin n) := ⟨rfl⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · exact
          continuous_of_discreteTopology.measurableEmbedding
            (Nat.cast_injective.comp Fin.val_injective)
    · refine' ⟨_, _, measurableEquiv_range_coe_nat_of_infinite_of_countable α⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · 

Proof state:
case pos.inr.refine'_1
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
h✝ : Infinite α
⊢ MeasurableSpace ℕ

Next tactic:
infer_instance
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      letI : MeasurableSpace (Fin n) := borel (Fin n)
      haveI : BorelSpace (Fin n) := ⟨rfl⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · exact
          continuous_of_discreteTopology.measurableEmbedding
            (Nat.cast_injective.comp Fin.val_injective)
    · refine' ⟨_, _, measurableEquiv_range_coe_nat_of_infinite_of_countable α⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · 

Proof state:
case pos.inr.refine'_2
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : Countable α
h✝ : Infinite α
⊢ MeasurableEmbedding Nat.cast

Next tactic:
exact continuous_of_discreteTopology.measurableEmbedding Nat.cast_injective
/-- Any standard Borel space is measurably equivalent to a subset of the reals. -/
theorem exists_subset_real_measurableEquiv : ∃ s : Set ℝ, MeasurableSet s ∧ Nonempty (α ≃ᵐ s) := by
  by_cases hα : Countable α
  · cases finite_or_infinite α
    · obtain ⟨n, h_nonempty_equiv⟩ := exists_nat_measurableEquiv_range_coe_fin_of_finite α
      refine' ⟨_, _, h_nonempty_equiv⟩
      letI : MeasurableSpace (Fin n) := borel (Fin n)
      haveI : BorelSpace (Fin n) := ⟨rfl⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · exact
          continuous_of_discreteTopology.measurableEmbedding
            (Nat.cast_injective.comp Fin.val_injective)
    · refine' ⟨_, _, measurableEquiv_range_coe_nat_of_infinite_of_countable α⟩
      refine' MeasurableEmbedding.measurableSet_range _
      · infer_instance
      · exact continuous_of_discreteTopology.measurableEmbedding Nat.cast_injective
  · 

Proof state:
case neg
α : Type u_1
ι : Type u_2
inst✝¹ : MeasurableSpace α
inst✝ : StandardBorelSpace α
hα : ¬Countable α
⊢ ∃ s, MeasurableSet s ∧ Nonempty (α ≃ᵐ ↑s)

Next tactic:
refine'
      ⟨univ, MeasurableSet.univ,
        ⟨(PolishSpace.measurableEquivOfNotCountable hα _ : α ≃ᵐ (univ : Set ℝ))⟩⟩