视觉 Lambda 演算 – 一个复活在网络上的毕业论文项目 (2008)
Show HN: Visual Lambda Calculus – a thesis project (2008) revived for the web

原始链接: https://github.com/bntre/visual-lambda

Visual Lambda 是一款图形化工具,用于探索无类型 lambda 演算,使用“气泡表示法”,将表达式表示为动画树状图。最初是一个硕士论文项目,旨在为学生、教育工作者和研究人员提供一种直观的方式来理解 λ 演算和归约策略。 用户可以操作 lambda 项,执行 beta 归约(具有撤销/重做功能),并通过将项拖动到彼此上来创建应用。该项目包含预定义的表达式和交互式“Lambda 谜题”,用户必须构造项以通过归约隔离隐藏的“硬币”。 可在网上试用 ([https://bntre.github.io/visual-lambda/](https://bntre.github.io/visual-lambda/)),Visual Lambda 使用 Python 3.8+ 和 pygame-ce 构建。作者承认该实现有些过时,但他们认为气泡表示法仍然是一种有前景的可视化方法,并建议未来开发中可以改进交互性和视觉保真度。该项目采用 GNU Lesser General Public License v3.0 许可。

## 视觉 Lambda 演算 – 交互式网页版 一位开发者将最初为 2008 年硕士论文创建的项目复活并发布为网页应用 (https://bntre.github.io/visual-lambda/)。**视觉 Lambda** 是一个用于探索 lambda 演算的图形化环境,使用“气泡表示法”将项表示为可拖动的二维结构,并以视觉方式模拟 beta 规约。 该项目在 GitHub 上可用 (https://github.com/bntre/visual-lambda),旨在使 lambda 演算的抽象概念更直观。它还包括“Lambda 谜题”——挑战用户构建特定的 lambda 项以实现目标。 用户甚至可以通过唯一的 URL 创建和分享他们自己的谜题。开发者提供了比较视频的链接,展示了 John Tromp 的 Lambda 图和气泡表示法,以便提供背景信息。
相关文章

原文

The project was migrated from https://code.google.com/archive/p/visual-lambda/ and from https://bitbucket.org/bntr/visual-lambda.

logo

Visual Lambda is a graphical environment and visual programming tool for exploring untyped lambda calculus using Bubble Notation.
It represents lambda expressions as colorful, tree-like 2D structures and animates beta-reduction smoothly, making reductions easy to follow.

The project started as a master's thesis (2008); see the thesis for details: visual_lambda.pdf.

This might be useful for students, educators and researchers who want an intuitive, interactive way to explore λ‑calculus and reduction strategies.

Try it live: https://bntre.github.io/visual-lambda/

Lambda puzzles challenge: https://bntre.github.io/visual-lambda/#workspace=puzzles

Or alternatively: https://bntr.itch.io/visual-lambda

Screenshot

Basics

Watch a short demo to get an idea of how Bubble Notation works:
https://www.youtube.com/watch?v=aRgu8S3Pnb8

Factorial 3

Other video examples:

Old GIF examples:

Dependencies

  • Python 3.8+
  • pygame-ce 2.5.6
pip install pygame-ce==2.5.6
python main.py

The workspace contains lambda terms and text labels. You can drag any of them with the mouse.

The last touched term becomes selected. Selected subterms are highlighted with a red outline.

You can modify a whole term or any selected subterm using the right toolbar.
Hover over buttons to see tooltips and keyboard shortcuts.

Use the Play button at the bottom to perform a beta-reduction step.
Each term keeps its own reduction history, so you can undo and redo steps.

To create an application, drag one term onto another subterm (the target area is highlighted in dark red).
Note: the dropped term loses its reduction history - make a copy first if you want to preserve it.

Lambda mode and reduction strategy can be changed in the left menu.

For the full list of keyboard shortcuts and detailed controls, see controls.txt.

The repository includes a small library of predefined expressions that you can paste into the console: see library.txt.

Visual Lambda also includes a small interactive challenge:
Lambda Puzzles https://bntre.github.io/visual-lambda/#workspace=puzzles

The puzzle set contains several tasks in Bubble Notation with gradually increasing difficulty.
In each puzzle, a golden coin (represented as a yellow free variable) is hidden inside a lambda term.
Your goal is to construct another term (a "key") and apply it in such a way that, after full beta-reduction, only the coin remains.

Solving_a_puzzle.mp4

I still think Bubble Notation is a promising way to represent lambda terms, but this implementation is a bit dated.
A modern reimplementation could improve interaction and visuals.
Possible directions:

  • Make terms feel more "springy" and react to dragging with natural, physics-like motion.
  • Revisit the lazy-evaluation visualization to make it clearer and more robust.
  • Visual Lambda is licensed under the GNU Lesser General Public License v3.0.
  • This project also includes Open Sans, licensed under the SIL Open Font License 1.1.
联系我们 contact @ memedata.com