Function lambda_calculus::arithmetic::eq [] [src]

pub fn eq() -> Term

Applied to two Church-encoded numbers it returns a Church-encoded boolean indicating whether its first argument is egual to the second one.

EQ := λmn.AND (LEQ m n) (LEQ n m) = λ λ AND (LEQ 2 1) (LEQ 1 2)

Examples

use lambda_calculus::arithmetic::eq;
use lambda_calculus::booleans::{tru, fls};
use lambda_calculus::reduction::beta_full;

assert_eq!(beta_full(eq().app(0.into()).app(0.into())), tru());
assert_eq!(beta_full(eq().app(1.into()).app(1.into())), tru());
assert_eq!(beta_full(eq().app(0.into()).app(1.into())), fls());
assert_eq!(beta_full(eq().app(1.into()).app(0.into())), fls());