| 1 |
\DOC new_wordn_definition |
| 2 |
|
| 3 |
\TYPE {new_wordn_definition : (bool -> thm -> string -> conv)} |
| 4 |
|
| 5 |
\LIBRARY wordn |
| 6 |
|
| 7 |
\SYNOPSIS |
| 8 |
Defines a function over the types of n-bit words. |
| 9 |
|
| 10 |
\DESCRIBE |
| 11 |
The function {new_wordn_definition} provides a facility for defining |
| 12 |
functions on the types of n-bit words. It takes four arguments. The |
| 13 |
first is a boolean flag which indicates if the function being |
| 14 |
defined will be an infix or not. The second is a theorem stating the |
| 15 |
existence of functions on the type of n-bit words; this must be a |
| 16 |
theorem returned by {prove_function_defn_thm}. The third argument is a |
| 17 |
name under which the resulting definition will be saved in the current |
| 18 |
theory segment. And the fourth argument is a term giving the desired |
| 19 |
function definition. The value returned by {new_wordn_definiton} is a |
| 20 |
theorem stating the definition requested by the user. This theorem is |
| 21 |
derived by formal proof from an instance of the theorem given as the |
| 22 |
second argument. |
| 23 |
|
| 24 |
\FAILURE |
| 25 |
Failure occurs if HOL cannot prove there is a function satisfying the |
| 26 |
specification supplied as the last argument, or if any other condition |
| 27 |
for making constant specification (ie, the failure conditions of |
| 28 |
{new_specification}) is violated. |
| 29 |
|
| 30 |
\EXAMPLE |
| 31 |
Suppose that the type of 3-bit word has been defined by calling |
| 32 |
{define_wordn_type 3}, and the theorem returned by this type |
| 33 |
definition is bound to the name {word3}. Then, a call to the function |
| 34 |
{prove_function_defn_thm} with the theorem {word3} |
| 35 |
will result in the following theorem: |
| 36 |
{ |
| 37 |
word3_FNDEF |- !f. ?! fn. !b0 b1 b2. fn(WORD3[b0;b1;b2]) = f b0 b1 b2 |
| 38 |
} |
| 39 |
\noindent which is in the form expected by the function {new_wordn_definition}. |
| 40 |
The following definition will define a new constant on the type |
| 41 |
{:word3}: |
| 42 |
{ |
| 43 |
#let BIT1 = new_wordn_definition false word3_FNDEF `BIT1` |
| 44 |
# "BIT1(WORD3[b0;b1;b2]) = b1";; |
| 45 |
BIT1 = |
| 46 |
|- !b0 b1 b2. BIT1(WORD3[b0;b1;b2]) = b1 |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
\SEEALSO |
| 51 |
{define_wordn_type}, {new_specification}, {new_recursive_definition}, |
| 52 |
{prove_function_defn_thm}, {use_wordn}. |
| 53 |
|
| 54 |
\ENDDOC |