Zulip Chat Archive
Stream: maths
Topic: cardinality of prime numbers
Bulhwi Cha (Jul 28 2023 at 18:42):
import Mathlib.Data.Nat.PrimeFin
import Mathlib.SetTheory.Cardinal.Basic
namespace Nat.Primes
instance countable' : Countable Primes := ⟨⟨Subtype.val, coe_nat_injective⟩⟩
def toSet := { p | Prime p }
instance infinite' : Infinite Primes :=
⟨fun finp ↦
have fins : toSet.Finite := @Set.toFinite ℕ toSet finp
infinite_setOf_prime fins⟩
open scoped Cardinal
theorem cardinal_mk_eq_aleph0 : #Primes = ℵ₀ := Cardinal.mk_eq_aleph0 Primes
end Nat.Primes
I've just proved in Lean that the cardinality of the type of prime numbers is aleph-null. Do we want to include some part of the above code in Mathlib?
Eric Wieser (Jul 28 2023 at 18:50):
I think those all look fine except def toSet := { p | Prime p }
which seems pretty useless
Kyle Miller (Jul 28 2023 at 18:53):
docs#Set.Infinite.to_subtype is how you're meant to go to docs#Infinite
You'd write instance : Infinite {p | Prime p} := Nat.infinite_setOf_prime.to_subtype
(untested)
Kyle Miller (Jul 28 2023 at 18:55):
This instance seems reasonable to add to Mathlib/Data/Nat/PrimeFin.lean
Bulhwi Cha (Jul 29 2023 at 14:46):
Thanks, everyone. I'll soon make a PR to Mathlib. Edit: see #6238.
Fixed code
Yury G. Kudryashov (Jul 29 2023 at 23:23):
Should we have a Denumerable
instance for primes?
Last updated: Dec 20 2023 at 11:08 UTC