evinism / evinism/lambda-explorer

Partial application

未关闭
#126 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
69
派生
10
PR 合并指标
30 天内没有已合并 PR

描述

`NAND TRUE` yields a function which works correctly (`λf₂.λa.λb.f₂ba`). But when using `(NAND TRUE) TRUE` get an incorrect result (`λa.λb.a`) which is different from manually writing `(λf₂.λa.λb.f₂ba) TRUE` which yields `λa.λb.b`.

Am I conceptualizing this incorrectly or is this a bug?

```
> TRUE
λa.λb.a

> NAND
λf₁.λf₂.λa.λb.f₁(f₂ba)a

> NAND TRUE
λf₂.λa.λb.f₂ba

> NAND TRUE TRUE
λa.λb.a

> (λf₂.λa.λb.f₂ba) TRUE
λa.λb.b

> (NAND TRUE) TRUE
λa.λb.a

```

```
> (λf₂.λa.λb.f₂ba) TRUE
λa.λb.b
(-)
Free Variables:
Rendered from AST: (λf₂.λa.λb.f₂ba)(λa.λb.a)
Beta-reduced: λa.λb.(λa.λb.a)ba
Eta-reduced: [eta irreducible]
Normal Form: λa.λb.b
Normal As Church Numeral: 0
Normal As Church Boolean: false
steps to normal form:

(λf₂.λa.λb.f₂ba)(λa.λb.a)
λa.λb.(λa.λb.a)ba
λa.λb.(λε₁.b)a
λa.λb.b

> (NAND TRUE) TRUE
λa.λb.a

Free Variables:
Rendered from AST: (λf₁.λf₂.λa.λb.f₁(f₂ba)a)(λa.λb.a)(λa.λb.a)
Beta-reduced: [beta irreducible]
Eta-reduced: [eta irreducible]
Normal Form: λa.λb.a
Normal As Church Numeral: [not a church numeral]
Normal As Church Boolean: true
steps to normal form:

(λf₁.λf₂.λa.λb.f₁(f₂ba)a)(λa.λb.a)(λa.λb.a)
(λf₂.λa.λb.(λa.λb.a)(f₂ba)a)(λa.λb.a)
λa.λb.(λa.λb.a)((λa.λb.a)ba)a
λa.λb.(λε₁.(λa.λb.a)ba)a
λa.λb.(λε₁.λb.a)ba
λa.λb.(λε₁.a)a
λa.λb.a
```

贡献指南

这个仓库没有索引到贡献指南

调研方向

首先在 REPL 中复现这两个表达式,并比较它们的归约轨迹和范式。调查 NAND TRUE 的部分应用为何不同于手动展开的 lambda 表达式。当等价表达式产生相同的预期结果,并且现有归约输出仍报告正确的范式时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
compilers
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。