# Lambda-calculus: 布尔逻辑

Recap: λ-Combinators
A λ-Term without free variables is a combinator.

# Lambda-Calculus

$\text{TRUE}:= \lambda x.(\lambda y. x)$
$\text{FALSE}:= \lambda x.(\lambda y. y)$

TRUE 和FALSE 都是“函数”,TRUE 接受两个参数，返回第一个参数，FALSE接受两个参数，返回第二个参数。

$\text{NOT}:= \lambda a.(a)(\text{FALSE TRUE})$

WTF? … Let’s see…

$\neg \text{TRUE}=\text{FALSE}$
$\neg \text{FALSE}=\text{TRUE}$

    NOT TRUE
=   (λa.(a) (FALSE TRUE)) TRUE
=>  (TRUE) (FALSE TRUE)
=>  FALSE

NOT FALSE
=   (λa.(a) (FALSE TRUE)) FALSE
=>  (FALSE) (FALSE TRUE)
=>  TRUE



AND $\text{AND}:= \lambda xy.(x)(y)(\text{FALSE})$


AND X  Y
=>  (X) (Y) (FALSE)

x\y  | TRUE | FALSE
--------------------
TRUE | TRUE | FALSE
--------------------
FALSE| FALSE| FALSE


OR $\text{OR}:= \lambda xy.(x)(\text{TRUE})(y)$

     OR X Y
=>   X (TRUE) Y

x\y  | TRUE | FALSE
--------------------
TRUE | TRUE | TRUE
--------------------
FALSE| TRUE | FALSE


## 是否满足性质？

AND(x,y): {TRUE,FALSE}x{TRUE,FALSE} -> {TRUE,FALSE}
f = {<<TRUE,TRUE>,TRUE> , ...... }


F := λx.[x + 1]
G := λx.[x + 2 - 1]


SEE THIS

# Bool logic:

• True (1)
• False (0)

• AND $\wedge$
• OR $\vee$
• NOT $\neg$

• 结合律
• $x\vee (y\vee z) = (x\vee y) \vee z$
• $x\wedge (y\wedge z) = (x\wedge y) \wedge z$
• 交换律
• $x\vee y=y\vee x$
• $x\wedge y=y\wedge x$
• 分配率
• $x\wedge (y\vee z) = (x\wedge y)\vee (x\wedge z)$
• $x\vee (y\wedge z) = (x\vee y)\wedge (x\vee z)$
• identy
• $x\vee 0 = x$
• $x\wedge 1 = x$
• Annihilator
• $x\wedge 0 = 0$
• $y\vee1 = 1$
• Idempotence
• $x\vee x = x$
• $x\wedge x = x$
• Absorption
• $x\wedge (x\vee y)=x$
• $x\vee (x\wedge y)=x$
• Complementation
• $x\wedge \neg x = 0$
• $x\vee \neg x = 1$
• Double negation:
• $\neg(\neg x) = x$
• De Morgan laws:
• $\neg x \wedge \neg y = \neg(x\vee y)$
• $\neg x \vee \neg y = \neg(x\wedge y)$
Jun 9, 2021

the comment system on this blog works via email. The button

[optional] even better, encrypt the email with my public key

- don't modify the subject field
- specify a nickname, otherwise your comment will be shown as
anonymous
- you agree that the comment is to be made public.
- to take down a comment, send the request via email.


>> SEND COMMENT <<

Fun with Image Maps and SVGs via benji February 20, 2024

Over the past few weeks I've been playing around with making some images on my website interactive. My "informatics" class in high school taught us some basic HTML. By basic I mean in notepad and writing everything by hand, saving to a...

Goblin Week 2024 via Helvetica Blanc January 26, 2024

It snuck up on me, but I managed to draw my little goblins to celebrate the week! I love my children - they're like awful Pikmin. I've uploaded the whole parade as a print, as well as individual prints for each goblin. There's something very fu…

How to trust gpg keys via Travis Shears Personal Site October 27, 2023

After moving some GPG keys to a new computer I kept getting these trust warnings. It is NOT certain that the key belongs to the person named in the user ID.If you * really * know what you are doing, you may answer the next question with yes. Use this key a…

Generated by openring from webring