HOL.ChurchNumerals (hol v1.0.1)

View Source

This module gives an implementation for creating church numerals and the terms needed for addition and multiplication.

Examples

iex> mk_num(1) |> PrettyPrint.pp_term(true)
"(2 1. 2 1)"

iex> plus(mk_num(1), mk_num(2)) |> PrettyPrint.pp_term(true)
"(2 1. 2 (2 (2 1)))"

iex> mult(mk_num(2), mk_num(3)) |> PrettyPrint.pp_term(true)
"(2 1. 2 (2 (2 (2 (2 (2 1))))))"

iex> mult_term() |> PrettyPrint.pp_term(true)
"(6 5 4 3. 6 (2. 5 (1. 4 1) 2) 3)"

Summary

Functions

Returns a lambda term representing the given integer as a church numeral

Applies the mult_term() to the given numbers.

Returns the lamda term that represents the multiplication function: λ 6 5 4 3. 6 (2. 5 (1. 4 1) 2) 3

Applies the plus_term() to the given numbers.

Returns the lamda term that represents the addition function: "λ 5 4 3 2. 5 (1. 3 1) (4 (1. 3 1) 2"

Applies the succ_term() to a given number.

Returns the lamda term that represents the successor function: "λ 4 3 2. 3 (4 (1. 3 1) 2)"

Functions

mk_num(n)

@spec mk_num(non_neg_integer()) :: HOL.Data.hol_term()

Returns a lambda term representing the given integer as a church numeral

mult(m, n)

Applies the mult_term() to the given numbers.

Shorthand for mk_appl_term(mk_appl_term(mult_term(), m), n)

mult_term()

@spec mult_term() :: HOL.Data.hol_term()

Returns the lamda term that represents the multiplication function: λ 6 5 4 3. 6 (2. 5 (1. 4 1) 2) 3

plus(m, n)

Applies the plus_term() to the given numbers.

Shorthand for mk_appl_term(mk_appl_term(plus_term(), m), n)

plus_term()

@spec plus_term() :: HOL.Data.hol_term()

Returns the lamda term that represents the addition function: "λ 5 4 3 2. 5 (1. 3 1) (4 (1. 3 1) 2"

succ(n)

Applies the succ_term() to a given number.

Shorthand for mk_appl_term(succ_term(), n)

succ_term()

@spec succ_term() :: HOL.Data.hol_term()

Returns the lamda term that represents the successor function: "λ 4 3 2. 3 (4 (1. 3 1) 2)"