use num_traits::Pow;
use transfinite::Ordinal;
fn tower(n: u32) -> Ordinal {
let mut current = Ordinal::omega();
for _ in 1..n {
current = Ordinal::omega().pow(current);
}
current
}
fn main() {
println!("Approaching ε₀: the tower ω, ω^ω, ω^(ω^ω), ...\n");
for n in 1..=4 {
let rung = tower(n);
println!(" rung {n}: {rung}");
}
println!();
println!("Each rung is strictly greater than the previous:");
for n in 1..=4 {
let here = tower(n);
let next = tower(n + 1);
let strictly_less = here < next;
let marker = if strictly_less { "✓" } else { "✗" };
println!(" {marker} rung {n} < rung {}", n + 1);
}
println!();
println!("All rungs are strictly less than ε₀.");
println!("ε₀ is defined as the smallest fixed point of ω^x = x, the");
println!("supremum of this very sequence. No ordinal expressible in this");
println!("crate equals ε₀: any attempt to construct ω^ε₀ via this API");
println!("would require ε₀ to appear inside its own Cantor Normal Form,");
println!("which the type system prevents (you would loop indefinitely).\n");
let rung_10 = tower(10);
let formatted = format!("{}", rung_10);
println!(
"Rung 10 has a string representation of length {}.",
formatted.len()
);
println!("Even at this depth, the underlying CNF data structure handles it");
println!("comfortably: just a recursive Vec<CnfTerm> of depth 10. Going");
println!("deeper is bounded by available memory rather than by any cap in");
println!("the type itself.\n");
println!("Summary: ε₀ is the upper boundary of what this crate represents.");
println!("Every ordinal you can construct via Ordinal::builder, From<u32>,");
println!("Add, Mul, or Pow lives strictly below it.");
}