De Bruijn Numerals

Elegant or useless? Nerds feud over a brainy new number hack

TLDR: Marvin Borner proposed “de Bruijn numerals,” a clever way to encode numbers by depth in lambda calculus, but an old result says they can’t support a simple zero check. Commenters split: some cheer elegance, others say “use Scott–Mogensen,” while puzzle fans drop links.

Move over, Church numerals: Marvin Borner just pitched “de Bruijn numerals,” a way to encode numbers by how deep your references go. It’s math-chic and extremely nerdcore. But the crowd immediately split—some swooned over the elegance, others asked, “Cool trick, but can it do anything?” The catch: an old result says you can’t have a simple “is this zero?” check when your number’s representation keeps growing, and that’s a deal-breaker for many.

Veteran commenter tromp rolled in with the textbook hammer: adequacy means you need successor, predecessor, and a working zero-check—no cheating. Meanwhile, Joker_vD came in hot with the “Just use Scott–Mogensen” mic drop, even posting working snippets and basically turning the thread into a practical coding clinic. Non-theory folks like jagthebeetle confessed confusion (“Why does 4 already look like 4?”), prompting patient explanations of the spooky “depth” concept. And then emptybits derailed everyone into a side quest with Project Euler #941, urging: no spoilers, yes tears.

The vibe? Half art museum, half hardware store. One camp admires the clever construction; the other camp wants tools that cut wood. Jokes flew about “lambdas deeper than my inbox” and the zero? function “ghosting” everyone. It’s elegant, it’s divisive, and it’s peak nerddom—chef’s kiss.

Key Points

  • Borner proposes de Bruijn numerals: ⟨n⟩₍d₎ = λ^{S(n)} n, encoding numbers by reference depth in lambda calculus.
  • Example given: the number 4 encodes as λ^5 4.
  • Citing Wadsworth (1980), the article notes that numeral systems with increasing abstraction depth cannot be adequate (succ, pred, zero?).
  • Despite adequacy limits, Borner defines succ = λ^3 2 1 = b k and proves it maps ⟨n⟩₍d₎ to ⟨S(n)⟩₍d₎ via β‑reduction.
  • He defines pred = λ^2 1 0 0 = w and proves it maps ⟨S(n)⟩₍d₎ to ⟨n⟩₍d₎ via β‑reduction; zero testing remains problematic for conversions.

Hottest takes

"Just use Scott-Mogensen encoding, seriously." — Joker_vD
"A numeral system is adequate iff i..." — tromp
"I have failed thus far." — emptybits
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.