lambda - 评估 lambda 演算:if false false true
问题描述
lambda 演算具有以下表达式:
e ::= Expressions x Variables (λx.e) Functions e e Function application
在此基础上,我们可以定义许多额外的构造,例如布尔值和条件语句:
let true = (λx.(λy.x)) false = (λx.(λy.y)) if = (λcond.(λthen.(λelse.cond then else)))
展示你的作品,展示对以下节目的评价:
if false false true
.
也许if(false (then false ( else true then true)))
?
但这正是它的意思。if false then false else true then true
.
我不知道如何处理它。
解决方案
有定义
true = (λx.(λy.x))
false = (λx.(λy.y))
if = (λcond.(λthen.(λelse.cond then else)))
定义,意味着
true x y = x
false x y = y
if cond then else = cond then else
因此,例如,
if true true false
-- if cond then else = cond then else
= true true false
-- true x y = x
= true
这里没有更多的定义可以应用,所以我们有我们的结果。
现在您可以尝试制定您的示例。
推荐阅读
- django - Django 的 SECURE_SSL_REDIRECT 和 Heroku 导致重定向的 Rest Framework POST 请求变为 GET 请求
- excel - 用标题填充列表框
- python - Python:在以特定单词开头和结尾的DataFrame字符串对象中获取数字
- html - 媒体最小宽度显示被类样式覆盖
- c++ - 斐波那契数列比奈矩阵的 C++ 实现
- python - 如何修复 pipenv 错误:找不到匹配的版本?
- node.js - 全局安装和使用特定的 NPM 依赖项
- python-3.x - REST API 和 POST 请求:url 中包含哪些数据,post 请求中包含哪些数据?
- c# - 用于TextBox的WPF ControlTemplate,当内部TextBox获得焦点时,模板化控件失去焦点
- java - Keycloak - spring boot - 外部登录网页