HOL.ChurchNumerals (hol v1.0.1)
View SourceThis 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
@spec mk_num(non_neg_integer()) :: HOL.Data.hol_term()
Returns a lambda term representing the given integer as a church numeral
@spec mult(HOL.Data.hol_term(), HOL.Data.hol_term()) :: HOL.Data.hol_term()
Applies the mult_term()
to the given numbers.
Shorthand for mk_appl_term(mk_appl_term(mult_term(), m), n)
@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
@spec plus(HOL.Data.hol_term(), HOL.Data.hol_term()) :: HOL.Data.hol_term()
Applies the plus_term()
to the given numbers.
Shorthand for mk_appl_term(mk_appl_term(plus_term(), m), n)
@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"
@spec succ(HOL.Data.hol_term()) :: HOL.Data.hol_term()
Applies the succ_term()
to a given number.
Shorthand for mk_appl_term(succ_term(), n)
@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)"