\chapter{ML Functions in the reduce Library}
\input{entries-intro}
\DOC{ADD\_CONV}

\TYPE {\small\verb%ADD_CONV : conv%}\egroup

\SYNOPSIS
Calculates by inference the sum of two numerals.

\DESCRIBE
If {\small\verb%m%} and {\small\verb%n%} are numerals (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%ADD_CONV "m + n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- m + n = s
\end{verbatim}
}
\noindent where {\small\verb%s%} is the numeral that denotes the sum of the natural
numbers denoted by {\small\verb%m%} and {\small\verb%n%}.

\FAILURE
{\small\verb%ADD_CONV tm%} fails unless {\small\verb%tm%} is of the form  {\small\verb%"m + n"%}, where {\small\verb%m%} and
{\small\verb%n%} are numerals.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#ADD_CONV "75 + 25";;
|- 75 + 25 = 100
\end{verbatim}
}

\ENDDOC
\DOC{AND\_CONV}

\TYPE {\small\verb%AND_CONV : conv%}\egroup

\SYNOPSIS
Simplifies certain boolean conjunction expressions.

\DESCRIBE
If {\small\verb%tm%} corresponds to one of the forms given below, where {\small\verb%t%} is an arbitrary
term of type {\small\verb%bool%}, then {\small\verb%AND_CONV tm%} returns the corresponding theorem. Note
that in the last case the conjuncts need only be alpha-equivalent rather than
strictly identical.
{\par\samepage\setseps\small
\begin{verbatim}
   AND_CONV "T /\ t" = |- T /\ t = t
   AND_CONV "t /\ T" = |- t /\ T = t
   AND_CONV "F /\ t" = |- F /\ t = F
   AND_CONV "t /\ F" = |- t /\ F = F
   AND_CONV "t /\ t" = |- t /\ t = t
\end{verbatim}
}

\FAILURE
{\small\verb%AND_CONV tm%} fails unless {\small\verb%tm%} has one of the forms indicated above.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#AND_CONV "(x = T) /\ F";;
|- (x = T) /\ F = F

#AND_CONV "T /\ (x = T)";;
|- T /\ (x = T) = (x = T)

#AND_CONV "(?x. x=T) /\ (?y. y=T)";;
|- (?x. x = T) /\ (?y. y = T) = (?x. x = T)
\end{verbatim}
}

\ENDDOC
\DOC{BEQ\_CONV}

\TYPE {\small\verb%BEQ_CONV : conv%}\egroup

\SYNOPSIS
Simplifies certain expressions involving boolean equality.

\DESCRIBE
If {\small\verb%tm%} corresponds to one of the forms given below, where {\small\verb%t%} is an arbitrary
term of type {\small\verb%bool%}, then {\small\verb%BEQ_CONV tm%} returns the corresponding theorem. Note
that in the last case the left-hand and right-hand sides need only be
alpha-equivalent rather than strictly identical.
{\par\samepage\setseps\small
\begin{verbatim}
   BEQ_CONV "T = t" = |- T = t = t
   BEQ_CONV "t = T" = |- t = T = t
   BEQ_CONV "F = t" = |- F = t = ~t
   BEQ_CONV "t = F" = |- t = F = ~t
   BEQ_CONV "t = t" = |- t = t = T
\end{verbatim}
}

\FAILURE
{\small\verb%BEQ_CONV tm%} fails unless {\small\verb%tm%} has one of the forms indicated above.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#BEQ_CONV "T = T";;
|- (T = T) = T

#BEQ_CONV "F = T";;
|- (F = T) = F

#BEQ_CONV "(!x:*#**. x = (FST x,SND x)) = (!y:*#**. y = (FST y,SND y))";;
|- ((!x. x = FST x,SND x) = (!y. y = FST y,SND y)) = T
\end{verbatim}
}

\ENDDOC
\DOC{COND\_CONV}

\TYPE {\small\verb%COND_CONV : conv%}\egroup

\SYNOPSIS
Simplifies certain conditional expressions.

\DESCRIBE
If {\small\verb%tm%} corresponds to one of the forms given below, where {\small\verb%b%} has type {\small\verb%bool%}
and {\small\verb%t1%} and {\small\verb%t2%} have the same type, then {\small\verb%COND_CONV tm%} returns the
corresponding theorem. Note that in the last case the arms need only be
alpha-equivalent rather than strictly identical.
{\par\samepage\setseps\small
\begin{verbatim}
   COND_CONV "F => t1 | t2" = |- (T => t1 | t2) = t2
   COND_CONV "T => t1 | t2" = |- (T => t1 | t2) = t1
   COND_CONV "b => t | t    = |- (b => t | t) = t
\end{verbatim}
}

\FAILURE
{\small\verb%COND_CONV tm%} fails unless {\small\verb%tm%} has one of the forms indicated above.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#COND_CONV "F => F | T";;
|- (F => F | T) = T

#COND_CONV "T => F | T";;
|- (T => F | T) = F

#COND_CONV "b => (\x. SUC x) | (\p. SUC p)";;
|- (b => (\x. SUC x) | (\p. SUC p)) = (\x. SUC x)
\end{verbatim}
}

\ENDDOC
\DOC{DIV\_CONV}

\TYPE {\small\verb%DIV_CONV : conv%}\egroup

\SYNOPSIS
Calculates by inference the result of dividing, with truncation, one numeral by
another.

\DESCRIBE
If {\small\verb%m%} and {\small\verb%n%} are numerals (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%DIV_CONV "m DIV n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- m DIV n = s
\end{verbatim}
}
\noindent where {\small\verb%s%} is the numeral that denotes the result of dividing the
natural number denoted by {\small\verb%m%} by the natural number denoted by {\small\verb%n%}, with
truncation.

\FAILURE
{\small\verb%DIV_CONV tm%} fails unless {\small\verb%tm%} is of the form  {\small\verb%"m DIV n"%}, where {\small\verb%m%} and
{\small\verb%n%} are numerals, or if {\small\verb%n%} denotes zero.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#DIV_CONV "0 DIV 0";;
evaluation failed     DIV_CONV

#DIV_CONV "0 DIV 12";;
|- 0 DIV 12 = 0

#DIV_CONV "2 DIV 0";;
evaluation failed     DIV_CONV

#DIV_CONV "144 DIV 12";;
|- 144 DIV 12 = 12

#DIV_CONV "7 DIV 2";;
|- 7 DIV 2 = 3
\end{verbatim}
}

\ENDDOC
\DOC{EXP\_CONV}

\TYPE {\small\verb%EXP_CONV : conv%}\egroup

\SYNOPSIS
Calculates by inference the result of raising one numeral to the power of
another.

\DESCRIBE
If {\small\verb%m%} and {\small\verb%n%} are numerals (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%EXP_CONV "m EXP n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- m EXP n = s
\end{verbatim}
}
\noindent where {\small\verb%s%} is the numeral that denotes the result of raising the
natural number denoted by {\small\verb%m%} to the power of the natural number denoted
by {\small\verb%n%}.

\FAILURE
{\small\verb%EXP_CONV tm%} fails unless {\small\verb%tm%} is of the form  {\small\verb%"m EXP n"%}, where {\small\verb%m%} and
{\small\verb%n%} are numerals.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#EXP_CONV "0 EXP 0";;
|- 0 EXP 0 = 1

#EXP_CONV "15 EXP 0";;
|- 15 EXP 0 = 1

#EXP_CONV "12 EXP 1";;
|- 12 EXP 1 = 12

#EXP_CONV "2 EXP 6";;
|- 2 EXP 6 = 64
\end{verbatim}
}

\ENDDOC
\DOC{GE\_CONV}

\TYPE {\small\verb%GE_CONV : conv%}\egroup

\SYNOPSIS
Proves result of less-than-or-equal-to ordering on two numerals.

\DESCRIBE
If {\small\verb%m%} and {\small\verb%n%} are both numerals (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%GE_CONV "m >= n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- (m >= n) = T
\end{verbatim}
}
\noindent if the natural number denoted by {\small\verb%m%} is greater than or equal to that
denoted by {\small\verb%n%}, or
{\par\samepage\setseps\small
\begin{verbatim}
   |- (m >= n) = F
\end{verbatim}
}
\noindent otherwise.

\FAILURE
{\small\verb%GE_CONV tm%} fails unless {\small\verb%tm%} is of the form {\small\verb%"m >= n"%}, where {\small\verb%m%} and {\small\verb%n%}
are numerals.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#GE_CONV "15 >= 14";;
|- 15 >= 14 = T

#GE_CONV "100 >= 100";;
|- 100 >= 100 = T

#GE_CONV "0 >= 107";;
|- 0 >= 107 = F
\end{verbatim}
}

\ENDDOC
\DOC{GT\_CONV}

\TYPE {\small\verb%GT_CONV : conv%}\egroup

\SYNOPSIS
Proves result of greater-than ordering on two numerals.

\DESCRIBE
If {\small\verb%m%} and {\small\verb%n%} are both numerals (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%GT_CONV "m > n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- (m > n) = T
\end{verbatim}
}
\noindent if the natural number denoted by {\small\verb%m%} is greater than that denoted by
{\small\verb%n%}, or
{\par\samepage\setseps\small
\begin{verbatim}
   |- (m > n) = F
\end{verbatim}
}
\noindent otherwise.

\FAILURE
{\small\verb%GT_CONV tm%} fails unless {\small\verb%tm%} is of the form {\small\verb%"m > n"%}, where {\small\verb%m%} and {\small\verb%n%}
are numerals.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#GT_CONV "100 > 10";;
|- 100 > 10 = T

#GT_CONV "15 > 15";;
|- 15 > 15 = F

#GT_CONV "11 > 27";;
|- 11 > 27 = F
\end{verbatim}
}

\ENDDOC
\DOC{IMP\_CONV}

\TYPE {\small\verb%IMP_CONV : conv%}\egroup

\SYNOPSIS
Simplifies certain implicational expressions.

\DESCRIBE
If {\small\verb%tm%} corresponds to one of the forms given below, where {\small\verb%t%} is an arbitrary
term of type {\small\verb%bool%}, then {\small\verb%IMP_CONV tm%} returns the corresponding theorem. Note
that in the last case the antecedent and consequent need only be
alpha-equivalent rather than strictly identical.
{\par\samepage\setseps\small
\begin{verbatim}
   IMP_CONV "T ==> t" = |- T ==> t = t
   IMP_CONV "t ==> T" = |- t ==> T = T
   IMP_CONV "F ==> t" = |- F ==> t = T
   IMP_CONV "t ==> F" = |- t ==> F = ~t
   IMP_CONV "t ==> t" = |- t ==> t = T
\end{verbatim}
}

\FAILURE
{\small\verb%IMP_CONV tm%} fails unless {\small\verb%tm%} has one of the forms indicated above.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#IMP_CONV "T ==> F";;
|- T ==> F = F

#IMP_CONV "F ==> x";;
|- F ==> x = T

#IMP_CONV "(!z:(num)list. z = z) ==> (!x:(num)list. x = x)";;
|- (!z. z = z) ==> (!x. x = x) = T
\end{verbatim}
}

\ENDDOC
\DOC{LE\_CONV}

\TYPE {\small\verb%LE_CONV : conv%}\egroup

\SYNOPSIS
Proves result of less-than-or-equal-to ordering on two numerals.

\DESCRIBE
If {\small\verb%m%} and {\small\verb%n%} are both numerals (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%LE_CONV "m <= n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- (m <= n) = T
\end{verbatim}
}
\noindent if the natural number denoted by {\small\verb%m%} is less than or equal to that
denoted by {\small\verb%n%}, or
{\par\samepage\setseps\small
\begin{verbatim}
   |- (m <= n) = F
\end{verbatim}
}
\noindent otherwise.

\FAILURE
{\small\verb%LE_CONV tm%} fails unless {\small\verb%tm%} is of the form {\small\verb%"m <= n"%}, where {\small\verb%m%} and {\small\verb%n%}
are numerals.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#LE_CONV "12 <= 198";;
|- 12 <= 198 = T

#LE_CONV "46 <= 46";;
|- 46 <= 46 = T

#LE_CONV "13 <= 12";;
|- 13 <= 12 = F
\end{verbatim}
}

\ENDDOC
\DOC{LT\_CONV}

\TYPE {\small\verb%LT_CONV : conv%}\egroup

\SYNOPSIS
Proves result of less-than ordering on two numerals.

\DESCRIBE
If {\small\verb%m%} and {\small\verb%n%} are both numerals (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%LT_CONV "m < n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- (m < n) = T
\end{verbatim}
}
\noindent if the natural number denoted by {\small\verb%m%} is less than that denoted by
{\small\verb%n%}, or
{\par\samepage\setseps\small
\begin{verbatim}
   |- (m < n) = F
\end{verbatim}
}
\noindent otherwise.

\FAILURE
{\small\verb%LT_CONV tm%} fails unless {\small\verb%tm%} is of the form {\small\verb%"m < n"%}, where {\small\verb%m%} and {\small\verb%n%}
are numerals.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#LT_CONV "0 < 12";;
|- 0 < 12 = T

#LT_CONV "13 < 13";;
|- 13 < 13 = F

#LT_CONV "25 < 12";;
|- 25 < 12 = F
\end{verbatim}
}

\ENDDOC
\DOC{MOD\_CONV}

\TYPE {\small\verb%MOD_CONV : conv%}\egroup

\SYNOPSIS
Calculates by inference the remainder after dividing one numeral by another.

\DESCRIBE
If {\small\verb%m%} and {\small\verb%n%} are numerals (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%MOD_CONV "m MOD n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- m MOD n = s
\end{verbatim}
}
\noindent where {\small\verb%s%} is the numeral that denotes the remainder after dividing,
with truncation, the natural number denoted by {\small\verb%m%} by the natural
number denoted by {\small\verb%n%}.

\FAILURE
{\small\verb%MOD_CONV tm%} fails unless {\small\verb%tm%} is of the form  {\small\verb%"m MOD n"%}, where {\small\verb%m%} and
{\small\verb%n%} are numerals, or if {\small\verb%n%} denotes zero.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#MOD_CONV "0 MOD 0";;
evaluation failed     MOD_CONV

#MOD_CONV "0 MOD 12";;
|- 0 MOD 12 = 0

#MOD_CONV "2 MOD 0";;
evaluation failed     MOD_CONV

#MOD_CONV "144 MOD 12";;
|- 144 MOD 12 = 0

#MOD_CONV "7 MOD 2";;
|- 7 MOD 2 = 1
\end{verbatim}
}

\ENDDOC
\DOC{MUL\_CONV}

\TYPE {\small\verb%MUL_CONV : conv%}\egroup

\SYNOPSIS
Calculates by inference the product of two numerals.

\DESCRIBE
If {\small\verb%m%} and {\small\verb%n%} are numerals (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%MUL_CONV "m * n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- m * n = s
\end{verbatim}
}
\noindent where {\small\verb%s%} is the numeral that denotes the product of the natural
numbers denoted by {\small\verb%m%} and {\small\verb%n%}.

\FAILURE
{\small\verb%MUL_CONV tm%} fails unless {\small\verb%tm%} is of the form  {\small\verb%"m * n"%}, where {\small\verb%m%} and
{\small\verb%n%} are numerals.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#MUL_CONV "0 * 12";;
|- 0 * 12 = 0

#MUL_CONV "1 * 1";;
|- 1 * 1 = 1

#MUL_CONV "6 * 11";;
|- 6 * 11 = 66
\end{verbatim}
}

\ENDDOC
\DOC{NEQ\_CONV}

\TYPE {\small\verb%NEQ_CONV : conv%}\egroup

\SYNOPSIS
Proves equality or inequality of two numerals.

\DESCRIBE
If {\small\verb%m%} and {\small\verb%n%} are both numerals (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%NEQ_CONV "m = n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- (m = n) = T
\end{verbatim}
}
\noindent if {\small\verb%m%} and {\small\verb%n%} are identical, or
{\par\samepage\setseps\small
\begin{verbatim}
   |- (m = n) = F
\end{verbatim}
}
\noindent if {\small\verb%m%} and {\small\verb%n%} are distinct.

\FAILURE
{\small\verb%NEQ_CONV tm%} fails unless {\small\verb%tm%} is of the form {\small\verb%"m = n"%}, where {\small\verb%m%} and {\small\verb%n%}
are numerals.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#NEQ_CONV "12 = 12";;
|- (12 = 12) = T

#NEQ_CONV "14 = 25";;
|- (14 = 25) = F
\end{verbatim}
}

\ENDDOC
\DOC{NOT\_CONV}

\TYPE {\small\verb%NOT_CONV : conv%}\egroup

\SYNOPSIS
Simplifies certain boolean negation expressions.

\DESCRIBE
If {\small\verb%tm%} corresponds to one of the forms given below, where {\small\verb%t%} is an arbitrary
term of type {\small\verb%bool%}, then {\small\verb%NOT_CONV tm%} returns the corresponding theorem.
{\par\samepage\setseps\small
\begin{verbatim}
   NOT_CONV "~F"  = |-  ~F = T
   NOT_CONV "~T"  = |-  ~T = F
   NOT_CONV "~~t" = |- ~~t = t
\end{verbatim}
}

\FAILURE
{\small\verb%NOT_CONV tm%} fails unless {\small\verb%tm%} has one of the forms indicated above.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#NOT_CONV "~~~~T";;
|- ~~~~T = ~~T

#NOT_CONV "~~T";;
|- ~~T = T

#NOT_CONV "~T";;
|- ~T = F
\end{verbatim}
}

\ENDDOC
\DOC{OR\_CONV}

\TYPE {\small\verb%OR_CONV : conv%}\egroup

\SYNOPSIS
Simplifies certain boolean disjunction expressions.

\DESCRIBE
If {\small\verb%tm%} corresponds to one of the forms given below, where {\small\verb%t%} is an arbitrary
term of type {\small\verb%bool%}, then {\small\verb%OR_CONV tm%} returns the corresponding theorem. Note
that in the last case the disjuncts need only be alpha-equivalent rather than
strictly identical.
{\par\samepage\setseps\small
\begin{verbatim}
   OR_CONV "T \/ t" = |- T \/ t = T
   OR_CONV "t \/ T" = |- t \/ T = T
   OR_CONV "F \/ t" = |- F \/ t = t
   OR_CONV "t \/ F" = |- t \/ F = t
   OR_CONV "t \/ t" = |- t \/ t = t
\end{verbatim}
}

\FAILURE
{\small\verb%OR_CONV tm%} fails unless {\small\verb%tm%} has one of the forms indicated above.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#OR_CONV "F \/ T";;
|- F \/ T = T

#OR_CONV "X \/ F";;
|- X \/ F = X

#OR_CONV "(!n. n + 1 = SUC n) \/ (!m. m + 1 = SUC m)";;
|- (!n. n + 1 = SUC n) \/ (!m. m + 1 = SUC m) = (!n. n + 1 = SUC n)
\end{verbatim}
}

\ENDDOC
\DOC{PRE\_CONV}

\TYPE {\small\verb%PRE_CONV : conv%}\egroup

\SYNOPSIS
Calculates by inference the predecessor of a numeral.

\DESCRIBE
If {\small\verb%n%} is a numeral (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%PRE_CONV "PRE n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- PRE n = s
\end{verbatim}
}
\noindent where {\small\verb%s%} is the numeral that denotes the predecessor of the natural
number denoted by {\small\verb%n%}.

\FAILURE
{\small\verb%PRE_CONV tm%} fails unless {\small\verb%tm%} is of the form  {\small\verb%"PRE n"%}, where {\small\verb%n%} is
a numeral.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#PRE_CONV "PRE 0";;
|- PRE 0 = 0

#PRE_CONV "PRE 1";;
|- PRE 1 = 0

#PRE_CONV "PRE 22";;
|- PRE 22 = 21
\end{verbatim}
}

\ENDDOC
\DOC{REDUCE\_CONV}

\TYPE {\small\verb%REDUCE_CONV : conv%}\egroup

\SYNOPSIS
Performs arithmetic or boolean reduction at all levels possible.

\DESCRIBE
The conversion {\small\verb%REDUCE_CONV%} attempts to apply, in bottom-up order to all
suitable redexes, one of the following conversions from the {\small\verb%reduce%} library
(only one can succeed):
{\par\samepage\setseps\small
\begin{verbatim}
   ADD_CONV  AND_CONV  BEQ_CONV  COND_CONV
   DIV_CONV  EXP_CONV   GE_CONV    GT_CONV
   IMP_CONV   LE_CONV   LT_CONV   MOD_CONV
   MUL_CONV  NEQ_CONV  NOT_CONV    OR_CONV
   PRE_CONV  SBC_CONV  SUC_CONV
\end{verbatim}
}
\noindent In particular, it will prove the appropriate reduction for an
arbitrarily complicated expression constructed from numerals and the boolean
constants {\small\verb%T%} and {\small\verb%F%}.

\FAILURE
Never fails, but may give a reflexive equation.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#REDUCE_CONV "(2=3) = F";;
|- ((2 = 3) = F) = T

#REDUCE_CONV "(100 < 200) => (2 EXP (8 DIV 2)) | (3 EXP ((26 EXP 0) * 3))";;
|- (100 < 200 => 2 EXP (8 DIV 2) | 3 EXP ((26 EXP 0) * 3)) = 16

#REDUCE_CONV "(15 = 16) \/ (15 < 16)";;
|- (15 = 16) \/ 15 < 16 = T

#REDUCE_CONV "0 + x";;
|- 0 + x = 0 + x
\end{verbatim}
}

\SEEALSO
RED_CONV, REDUCE_RULE, REDUCE_TAC

\ENDDOC
\DOC{REDUCE\_RULE}

\TYPE {\small\verb%REDUCE_RULE : (thm -> thm)%}\egroup

\SYNOPSIS
Performs arithmetic or boolean reduction on a theorem at all levels possible.

\DESCRIBE
{\small\verb%REDUCE_RULE%} attempts to transform a theorem by applying {\small\verb%REDUCE_CONV%}.

\FAILURE
Never fails, but may just return the original theorem.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#REDUCE_RULE (ASSUME "x = (100 + (60 - 17))");;
. |- x = 143

#REDUCE_RULE (REFL "100 + 12 DIV 6");;
|- T
\end{verbatim}
}

\SEEALSO
RED_CONV, REDUCE_CONV, REDUCE_TAC

\ENDDOC
\DOC{REDUCE\_TAC}

\TYPE {\small\verb%REDUCE_TAC : tactic%}\egroup

\SYNOPSIS
Performs arithmetic or boolean reduction on a goal at all levels possible.

\DESCRIBE
{\small\verb%REDUCE_TAC%} attempts to transform a goal by applying {\small\verb%REDUCE_CONV%}.
It will prove any true goal which is constructed from numerals and the boolean
constants {\small\verb%T%} and {\small\verb%F%}.

\FAILURE
Never fails, but may not advance the goal.

\EXAMPLE
The following example takes a couple of minutes' CPU time:

{\par\samepage\setseps\small
\begin{verbatim}
   #g "((1 EXP 3) + (12 EXP 3) = 1729) /\ ((9 EXP 3) + (10 EXP 3) = 1729)";;
   "((1 EXP 3) + (12 EXP 3) = 1729) /\ ((9 EXP 3) + (10 EXP 3) = 1729)"

   () : void

   #e REDUCE_TAC;;
   OK..
   goal proved
   |- ((1 EXP 3) + (12 EXP 3) = 1729) /\ ((9 EXP 3) + (10 EXP 3) = 1729)

   Previous subproof:
   goal proved
   () : void
\end{verbatim}
}

\SEEALSO
RED_CONV, REDUCE_CONV, REDUCE_RULE

\ENDDOC
\DOC{RED\_CONV}

\TYPE {\small\verb%RED_CONV : conv%}\egroup

\SYNOPSIS
Performs arithmetic or boolean reduction at top level if possible.

\DESCRIBE
The conversion {\small\verb%RED_CONV%} attempts to apply, at the top level only, one
of the following conversions from the {\small\verb%reduce%} library (only one can succeed):
{\par\samepage\setseps\small
\begin{verbatim}
   ADD_CONV  AND_CONV  BEQ_CONV  COND_CONV
   DIV_CONV  EXP_CONV   GE_CONV    GT_CONV
   IMP_CONV   LE_CONV   LT_CONV   MOD_CONV
   MUL_CONV  NEQ_CONV  NOT_CONV    OR_CONV
   PRE_CONV  SBC_CONV  SUC_CONV
\end{verbatim}
}

\FAILURE
Fails if none of the above conversions are applicable at top level.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#RED_CONV "(2=3) = F";;
|- ((2 = 3) = F) = ~(2 = 3)

#RED_CONV "15 DIV 13";;
|- 15 DIV 13 = 1

#RED_CONV "100 + 100";;
|- 100 + 100 = 200

#RED_CONV "0 + x";;
evaluation failed     RED_CONV
\end{verbatim}
}

\SEEALSO
REDUCE_CONV, REDUCE_RULE, REDUCE_TAC

\ENDDOC
\DOC{SBC\_CONV}

\TYPE {\small\verb%SBC_CONV : conv%}\egroup

\SYNOPSIS
Calculates by inference the difference of two numerals.

\DESCRIBE
If {\small\verb%m%} and {\small\verb%n%} are numerals (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%SBC_CONV "m - n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- m - n = s
\end{verbatim}
}
\noindent where {\small\verb%s%} is the numeral that denotes the difference of the natural
numbers denoted by {\small\verb%m%} and {\small\verb%n%}.

\FAILURE
{\small\verb%SBC_CONV tm%} fails unless {\small\verb%tm%} is of the form  {\small\verb%"m - n"%}, where {\small\verb%m%} and
{\small\verb%n%} are numerals.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#SBC_CONV "25 - 30";;
|- 25 - 30 = 0

#SBC_CONV "200 - 200";;
|- 200 - 200 = 0

#SBC_CONV "60 - 17";;
|- 60 - 17 = 43
\end{verbatim}
}

\ENDDOC
\DOC{SUC\_CONV}

\TYPE {\small\verb%SUC_CONV : conv%}\egroup

\SYNOPSIS
Calculates by inference the successor of a numeral.

\DESCRIBE
If {\small\verb%n%} is a numeral (e.g. {\small\verb%0%}, {\small\verb%1%}, {\small\verb%2%}, {\small\verb%3%},...), then
{\small\verb%SUC_CONV "SUC n"%} returns the theorem:
{\par\samepage\setseps\small
\begin{verbatim}
   |- SUC n = s
\end{verbatim}
}
\noindent where {\small\verb%s%} is the numeral that denotes the successor of the natural
number denoted by {\small\verb%n%}.

\FAILURE
{\small\verb%SUC_CONV tm%} fails unless {\small\verb%tm%} is of the form  {\small\verb%"SUC n"%}, where {\small\verb%n%} is
a numeral.

\EXAMPLE
{\par\samepage\setseps\small
\begin{verbatim}
#SUC_CONV "SUC 33";;
|- SUC 33 = 34
\end{verbatim}
}

\ENDDOC
