A toolkit for lambda calculus evaluation, combinator logic, and CLI-powered expression tracing.
Supports pretty-printing, lazy/eager reduction, trace generation, and built-in easter eggs.
Version: 1.1.0
Lambda Toolkit is a symbolic lambda calculus engine built with introspective evaluation, Church encodings, lazy reduction, and educational traceability. This toolkit supports recursive function modeling (via the Y combinator), semantic validation, and customizable expression registries for symbolic reasoning systems.
- Lazy beta-reduction
- Full De Bruijn indexing
- Step-by-step evaluation traces
- Expression registry (define/lookup)
- Church encodings (booleans, numerals, arithmetic, recursion)
- Validation (is_closed, is_normal_form, etc.)
- Mermaid architecture diagram
Install locally:
pip install .
Explore Church encodings:
from lambda_toolkit.core import lookup
print(lookup("TWO"))
Run validation:
from lambda_toolkit.validator import is_normal_form
print(is_normal_form(lookup("TWO")))
See example workflows in examples/
.
Apache 2.0
IF TRUE (λx.x) (λx. x x)
Should evaluate to λx.x
without touching the diverging branch (λx. x x)
.
Step 0:
( ( ( λx0.
λx1.
λx2.
( (x0
x1)
x2)
λx0.
λx1.
x0)
λx0.
x0)
λx0.
(x0
x0))
Step 1:
( ( λx0.
λx1.
( ( λx2.
λx3.
x2
x0)
x1)
λx0.
x0)
λx0.
(x0
x0))
Step 2:
( λx0.
( ( λx1.
λx2.
x1
λx1.
x1)
x0)
λx0.
(x0
x0))
Step 3:
( ( λx0.
λx1.
x0
λx0.
x0)
λx0.
(x0
x0))
Step 4:
( λx0.
λx1.
x1
λx0.
(x0
x0))
Final:
λx0.
x0
This shows that our evaluation strategy correctly short-circuits evaluation of unnecessary branches. Only TRUE
and the identity were evaluated.
--trace
: Show reduction steps (seeexample_generation.md
)monday
: Garfield's eternal return. Seeeaster_egg.md
.crowbar
: A nod to Half-Life. Seeeaster_egg.md
.
For implementation details, check core.md
and nodes.md
.