Set theory including ZFC axioms, ordinals, cardinals, axiom of choice, and forcing
Scope: ZFC axioms, ordinal and cardinal arithmetic, axiom of choice, transfinite induction, forcing Lines: ~380 Last Updated: 2025-10-25
Activate this skill when:
Zermelo-Fraenkel Set Theory with Choice:
# Conceptual representation of ZFC axioms
class ZFC:
"""
ZFC Axioms (informal Python representation):
1. Extensionality: Sets equal iff same elements
2. Empty Set: β set with no elements
3. Pairing: {a, b} exists for any a, b
4. Union: β S exists for any set S
5. Power Set: π«(S) exists for any S
6. Infinity: β infinite set (β)
7. Replacement: Image of set under function is set
8. Foundation: β-minimal element exists (no infinite β-descent)
9. Choice: β choice function for any family of non-empty sets
"""
@staticmethod
def extensionality(A: set, B: set) -> bool:
"""A = B iff βx: x β A β x β B"""
return A == B
@staticmethod
def empty_set() -> set:
"""β β
: βx: x β β
"""
return set()
@staticmethod
def pairing(a, b) -> set:
"""{a, b} exists"""
return {a, b}
@staticmethod
def union(S: set) -> set:
"""β S = {x : βA β S: x β A}"""
result = set()
for subset in S:
if isinstance(subset, (set, frozenset)):
result |= set(subset)
return result
@staticmethod
def power_set(S: set) -> set:
"""π«(S) = {A : A β S}"""
from itertools import chain, combinations
s_list = list(S)
return set(
frozenset(combo)
for combo in chain.from_iterable(
combinations(s_list, r) for r in range(len(s_list) + 1)
)
)
@staticmethod
def natural_numbers() -> set:
"""
Infinity axiom: β inductive set
β = {β
, {β
}, {β
, {β
}}, ...}
In practice, finite representation
"""
# von Neumann ordinals: 0={}, 1={0}, 2={0,1}, etc.
omega = set()
current = frozenset()
for _ in range(10): # Finite approximation
omega.add(current)
current = frozenset(omega)
return omega
# Example usage
zfc = ZFC()
empty = zfc.empty_set()
pair = zfc.pairing(1, 2)
union_result = zfc.union({frozenset({1, 2}), frozenset({2, 3})})
print(f"βͺ {{{{1,2}}, {{2,3}}}} = {union_result}") # {1, 2, 3}
power = zfc.power_set({1, 2})
print(f"π«({{1,2}}) = {power}") # {β
, {1}, {2}, {1,2}}
Definition: Well-ordered set where every element equals set of predecessors
von Neumann ordinals: Ξ± = {Ξ² : Ξ² < Ξ±}
class Ordinal:
"""Ordinal number implementation"""
def __init__(self, value):
"""
For finite ordinals: integer value
For Ο and beyond: special representation
"""
self.value = value
def __lt__(self, other):
if isinstance(other.value, int) and isinstance(self.value, int):
return self.value < other.value
elif self.value == 'omega':
return isinstance(other.value, int) # Ο > all finite ordinals
else:
# General ordinal comparison
return self._compare(other) < 0
def __eq__(self, other):
return self.value == other.value
def successor(self):
"""S(Ξ±) = Ξ± βͺ {Ξ±}"""
if isinstance(self.value, int):
return Ordinal(self.value + 1)
else:
return Ordinal(f"{self.value}+1")
def __repr__(self):
return f"Ordinal({self.value})"
# Ordinal arithmetic
def ordinal_addition(alpha: Ordinal, beta: Ordinal):
"""
Ξ± + Ξ² defined by transfinite recursion:
- Ξ± + 0 = Ξ±
- Ξ± + S(Ξ²) = S(Ξ± + Ξ²)
- Ξ± + Ξ» = sup{Ξ± + Ξ² : Ξ² < Ξ»} for limit Ξ»
"""
if beta.value == 0:
return alpha
elif isinstance(beta.value, int) and beta.value > 0:
# Finite case
return Ordinal(alpha.value + beta.value) if isinstance(alpha.value, int) else alpha
else:
# Limit case (simplified)
return Ordinal(f"{alpha.value}+{beta.value}")
def ordinal_multiplication(alpha: Ordinal, beta: Ordinal):
"""
Ξ± Β· Ξ² defined by transfinite recursion:
- Ξ± Β· 0 = 0
- Ξ± Β· S(Ξ²) = (Ξ± Β· Ξ²) + Ξ±
- Ξ± Β· Ξ» = sup{Ξ± Β· Ξ² : Ξ² < Ξ»} for limit Ξ»
"""
if beta.value == 0:
return Ordinal(0)
elif isinstance(alpha.value, int) and isinstance(beta.value, int):
return Ordinal(alpha.value * beta.value)
else:
return Ordinal(f"{alpha.value}Β·{beta.value}")
# Examples
omega = Ordinal('omega')
one = Ordinal(1)
print(f"1 + Ο = {ordinal_addition(one, omega)}") # Ο (NOT Ο+1!)
print(f"Ο + 1 = {ordinal_addition(omega, one)}") # Ο+1
print(f"2 Β· Ο = {ordinal_multiplication(Ordinal(2), omega)}") # Ο
print(f"Ο Β· 2 = {ordinal_multiplication(omega, Ordinal(2))}") # Ο+Ο = ΟΒ·2
Definition: Cardinality |A| measures "size" of set A
Finite cardinals: |A| = n for some n β β
Infinite cardinals:
class Cardinal:
"""Cardinal number representation"""
def __init__(self, name, value=None):
self.name = name
self.value = value # Ordinal representation
def __lt__(self, other):
"""ΞΊ < Ξ» if β injection but no bijection"""
# Simplified for demonstration
cardinal_order = {'aleph_0': 0, '2^aleph_0': 1, 'aleph_1': 2}
return cardinal_order.get(self.name, float('inf')) < cardinal_order.get(other.name, float('inf'))
def __eq__(self, other):
return self.name == other.name
def __repr__(self):
return f"Cardinal({self.name})"
# Cardinal arithmetic
def cardinal_addition(kappa: Cardinal, lambda_: Cardinal):
"""
ΞΊ + Ξ» = max(ΞΊ, Ξ») for infinite cardinals
"""
if kappa.name == 'aleph_0' and lambda_.name == 'aleph_0':
return Cardinal('aleph_0')
else:
return max(kappa, lambda_, key=lambda c: (c < kappa, c < lambda_))
def cardinal_multiplication(kappa: Cardinal, lambda_: Cardinal):
"""
ΞΊ Β· Ξ» = max(ΞΊ, Ξ») for infinite cardinals (assuming AC)
"""
return cardinal_addition(kappa, lambda_)
def cardinal_exponentiation(kappa: Cardinal, lambda_: Cardinal):
"""
ΞΊ^Ξ» = |{f : Ξ» β ΞΊ}|
Special case: 2^β΅β = continuum
"""
if kappa.name == '2' and lambda_.name == 'aleph_0':
return Cardinal('2^aleph_0')
else:
return Cardinal(f"{kappa.name}^{lambda_.name}")
# Examples
aleph_0 = Cardinal('aleph_0')
continuum = Cardinal('2^aleph_0')
print(f"β΅β + β΅β = {cardinal_addition(aleph_0, aleph_0)}") # β΅β
print(f"β΅β Β· β΅β = {cardinal_multiplication(aleph_0, aleph_0)}") # β΅β
print(f"2^β΅β = {cardinal_exponentiation(Cardinal('2'), aleph_0)}") # continuum
Axiom of Choice (AC): For any family {A_i}_{iβI} of non-empty sets, β choice function f: I β βA_i with f(i) β A_i
Equivalent formulations:
def choice_function(family: dict) -> dict:
"""
Given family {A_i : i β I}, construct choice function
f: I β β A_i with f(i) β A_i
In constructive math, may not exist without AC
"""
choice = {}
for index, set_i in family.items():
if not set_i:
raise ValueError(f"Set A_{index} is empty")
# Choose arbitrary element (requires AC in general)
choice[index] = next(iter(set_i))
return choice
# Example: Product of non-empty sets is non-empty
def cartesian_product_nonempty(sets: list[set]) -> bool:
"""
β A_i β β
iff βi: A_i β β
Requires AC for infinite products
"""
if not sets:
return True
# Use choice function
family = {i: s for i, s in enumerate(sets)}
try:
choice = choice_function(family)
return True
except ValueError:
return False
Principle: To prove P(Ξ±) for all ordinals Ξ±:
def transfinite_induction(property_P, ordinal_limit):
"""
Verify property P for all ordinals up to limit
property_P: function taking ordinal, returning bool
ordinal_limit: maximum ordinal to check
"""
# Base case
if not property_P(Ordinal(0)):
return False
# Successor case (check finite ordinals)
for alpha in range(ordinal_limit):
if not property_P(Ordinal(alpha)):
return False
# Verify successor step
if not property_P(Ordinal(alpha + 1)):
return False
# Limit case would check supremum property
# (simplified for finite case)
return True
# Example: Prove every ordinal is well-ordered
def is_well_ordered(alpha: Ordinal) -> bool:
"""Check if Ξ± is well-ordered"""
# Every ordinal is well-ordered by construction
return True
# Verify by transfinite induction
result = transfinite_induction(is_well_ordered, ordinal_limit=100)
print(f"All ordinals up to 100 are well-ordered: {result}")
Theorem: β and β have different cardinalities (|β| < |β|)
def cantors_diagonal():
"""
Prove no bijection β β (0,1)
Given any sequence of reals, construct real not in sequence
"""
# Suppose f: β β (0,1) is surjective
# Represent reals as infinite decimals
sequence = [
"0.1234567890...",
"0.9876543210...",
"0.5555555555...",
# ... infinite sequence
]
# Construct diagonal real differing at each position
diagonal = "0."
for i, real_str in enumerate(sequence[:10]): # Finite approximation
digit = real_str[2 + i] # i-th digit after decimal
# Choose different digit
new_digit = '5' if digit != '5' else '7'
diagonal += new_digit
print(f"Diagonal real: {diagonal}")
print("This real differs from every real in sequence")
print("Therefore, no surjection β β (0,1) exists")
return diagonal
CH: There is no cardinality strictly between β΅β and 2^β΅β
Statement: 2^β΅β = β΅β (continuum equals first uncountable cardinal)
Status: Independent of ZFC (neither provable nor disprovable)
def continuum_hypothesis():
"""
CH: 2^β΅β = β΅β
Results:
- GΓΆdel (1940): CH consistent with ZFC (using L, constructible universe)
- Cohen (1963): Β¬CH consistent with ZFC (using forcing)
- Therefore: CH independent of ZFC
"""
return {
'statement': '2^β΅β = β΅β',
'status': 'independent of ZFC',
'models': {
'L (constructible universe)': 'CH holds',
'forcing extensions': 'Β¬CH can hold (e.g., 2^β΅β = β΅β)'
}
}
Ξ£β°_n, Ξ β°_n: Levels of definability for subsets of β
class BorelHierarchy:
"""
Borel sets hierarchy:
- Ξ£β°β = open sets
- Ξ β°β = closed sets (complements of Ξ£β°β)
- Ξ£β°β = countable unions of Ξ β°β
- Ξ β°β = countable intersections of Ξ£β°β
- ...
"""
@staticmethod
def is_sigma_0_1(description: str) -> bool:
"""Check if set is Ξ£β°β (open)"""
return 'union of open intervals' in description
@staticmethod
def is_pi_0_1(description: str) -> bool:
"""Check if set is Ξ β°β (closed)"""
return 'complement of open set' in description or 'closed' in description
@staticmethod
def is_sigma_0_2(description: str) -> bool:
"""Check if set is Ξ£β°β"""
return 'countable union of closed sets' in description
| Set | Cardinality | Symbol | |-----|------------|--------| | β | Countable | β΅β | | β€ | Countable | β΅β | | β | Countable | β΅β | | β | Continuum | 2^β΅β | | π«(β) | Continuum | 2^β΅β | | β^β | Uncountable | 2^β΅β |
Addition (not commutative):
1 + Ο = Ο
Ο + 1 = Ο + 1 (β Ο)
Multiplication (not commutative):
2 Β· Ο = Ο
Ο Β· 2 = Ο + Ο (β Ο)
Exponentiation:
Ο^2 = Ο Β· Ο
2^Ο = sup{2^n : n < Ο} = Ο
| Statement | Status | |-----------|--------| | Continuum Hypothesis (CH) | Independent | | Axiom of Choice (AC) | Independent of ZF | | Generalized CH (GCH) | Independent |
β Treating ordinals like cardinals: Ο + 1 β 1 + Ο as ordinals β Ordinal arithmetic is not commutative
β Assuming CH is provable: CH independent of ZFC β Some models satisfy CH, others don't
β Confusing β and β: For ordinals, Ξ± β Ξ² iff Ξ± β Ξ² (proper subset) β In von Neumann ordinals, β and < coincide
β Assuming all sets are countable: β is uncountable by Cantor's theorem β Use diagonal argument to prove uncountability
abstract-algebra.md - Algebraic structures built on setsnumber-theory.md - Properties of specific sets (β, β€, β)topology-point-set.md - Topological spaces on setscategory-theory-foundations.md - Category of setsformal/lean-mathlib4.md - Formalizing set theory in LeanLast Updated: 2025-10-25 Format Version: 1.0 (Atomic)