-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat Port Data.Rat.Denumerable (#2197)
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/- | ||
Copyright (c) 2019 Chris Hughes. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Chris Hughes | ||
! This file was ported from Lean 3 source module data.rat.denumerable | ||
! leanprover-community/mathlib commit dde670c9a3f503647fd5bfdf1037bad526d3397a | ||
! Please do not edit these lines, except to modify the commit id | ||
! if you have ported upstream changes. | ||
-/ | ||
import Mathlib.SetTheory.Cardinal.Basic | ||
|
||
/-! | ||
# Denumerability of ℚ | ||
This file proves that ℚ is infinite, denumerable, and deduces that it has cardinality `omega`. | ||
-/ | ||
|
||
|
||
namespace Rat | ||
|
||
open Denumerable | ||
|
||
instance : Infinite ℚ := | ||
Infinite.of_injective ((↑) : ℕ → ℚ) Nat.cast_injective | ||
|
||
private def denumerable_aux : ℚ ≃ { x : ℤ × ℕ // 0 < x.2 ∧ x.1.natAbs.coprime x.2 } | ||
where | ||
toFun x := ⟨⟨x.1, x.2⟩, Nat.pos_of_ne_zero x.3, x.4⟩ | ||
invFun x := ⟨x.1.1, x.1.2, ne_zero_of_lt x.2.1, x.2.2⟩ | ||
left_inv := fun ⟨_, _, _, _⟩ => rfl | ||
right_inv := fun ⟨⟨_, _⟩, _, _⟩ => rfl | ||
|
||
/-- **Denumerability of the Rational Numbers** -/ | ||
instance : Denumerable ℚ := by | ||
let T := { x : ℤ × ℕ // 0 < x.2 ∧ x.1.natAbs.coprime x.2 } | ||
letI : Infinite T := Infinite.of_injective _ denumerable_aux.injective | ||
letI : Encodable T := Encodable.Subtype.encodable | ||
letI : Denumerable T := ofEncodableOfInfinite T | ||
exact Denumerable.ofEquiv T denumerable_aux | ||
|
||
end Rat | ||
|
||
open Cardinal | ||
|
||
theorem Cardinal.mkRat : (#ℚ) = ℵ₀ := by simp only [mk_eq_aleph0] | ||
#align cardinal.mk_rat Cardinal.mkRat | ||
|