(ZFC) set-theoretic definition of natural numbers.
Project description
ZFC: set-theoretic definition of natural numbers in Python
Installation
pip install pyZFC
Introduction and examples
NaturalNumber
is the class of natural numbers defined
as von Neumann ordinals in the ZFC set theory.
0 is defined as the empty set {}
,
and the rest of the natural numbers
are defined recursively as n + 1 = n ∪ {n}
,
i.e.,
0 = {},
1 = {0},
2 = {0, 1},
3 = {0, 1, 2},
...
Following the definition, you can do all kinds of
set operations on natural numbers, e.g., checking
whether a NaturalNumber
contains another.
>>> from zfc import NaturalNumber
>>> NaturalNumber(1) in NaturalNumber(2)
True
>>> NaturalNumber(1) & NaturalNumber(2)
1 # the intersection of 1={0} and 2={0,1} is {0}, which is exactly 1.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyZFC-0.2.0.tar.gz
(6.7 kB
view hashes)
Built Distribution
pyZFC-0.2.0-py3-none-any.whl
(5.4 kB
view hashes)