| 1 |
%========================================================================% |
| 2 |
% Library wordn % |
| 3 |
%========================================================================% |
| 4 |
|
| 5 |
SUMMARY OF THE wordn LIBRARY |
| 6 |
============================ |
| 7 |
|
| 8 |
|
| 9 |
The wordn library consists of several theories whose ancestry |
| 10 |
is as below: |
| 11 |
|
| 12 |
wordn_base wordn_bitops wordn_num |
| 13 |
| | | |
| 14 |
| | | |
| 15 |
------------------------------ |
| 16 |
| |
| 17 |
wordn |
| 18 |
|
| 19 |
Each thoery may have a number of definitions and/or theorems stored in it, |
| 20 |
and there may also be some derived rules and conversions associated with it. |
| 21 |
A brief description of each theory and a list of ML functions available |
| 22 |
with the library is given below. |
| 23 |
|
| 24 |
|
| 25 |
wordn_base: |
| 26 |
This thoery is for defining the types of n-bit words. For a |
| 27 |
speific word length N, a type, namely :wordN, can be defined, together |
| 28 |
with a constructor WORDN and a destructor BITSN. The underlying |
| 29 |
representation type of :wordN is :(bool)list and the subset of |
| 30 |
:(bool)list which represents :wordN satisfies (\l. length l = N). |
| 31 |
As far as the users concern, the representation of :wordn is hidden |
| 32 |
unless you really want to work with :(bool)list rather than :wordn. |
| 33 |
|
| 34 |
There are serval theorems stored in this theory, but they |
| 35 |
should be of no interest to the users. There are also a number of ML |
| 36 |
functions implementing derived rules and conversions, such as proving |
| 37 |
induction theorem, and so on. |
| 38 |
|
| 39 |
wordn_bitops: |
| 40 |
This theory is for defining bitwise operators and proving |
| 41 |
theorems about them. There are ML functions performing these tasks. To |
| 42 |
define a (binary) bitwise operator on a type :wordN, the user should |
| 43 |
supply a function of type :bool->bool->bool, eg. $/\ and the name of |
| 44 |
the new constant as a string, eg. `ANDN`. A constant |
| 45 |
ANDN:wordN->wordN->wordN will be defined for you. To prove a theorem |
| 46 |
stating the symmetry of the operator ANDN, the user should supply the |
| 47 |
definiton and a theorem stating the symmetry of the underlying |
| 48 |
operator, namely CONJ_SYM, then a theorem |
| 49 |
|- !w1 w2. w1 ANDN w2 = w2 ANDN w1 |
| 50 |
will be derived. There are also function for defining constant to |
| 51 |
split a word into two parts and to join two words into a longer word. |
| 52 |
For example, JOIN_n_m:(wordn # wordm) -> wordl and |
| 53 |
SPLIT_n_m:wordl -> (wordn # wordn). |
| 54 |
|
| 55 |
The above two theories and associated functions treat a word just as a |
| 56 |
bit vector. They do not concern with how these bits are interpreted. |
| 57 |
In contrast, the theory wordn_num maps n-bit words to natural numbers. |
| 58 |
|
| 59 |
wordn_num: |
| 60 |
This theory interprets n-bit words as natural numbers in a |
| 61 |
big-endian format, ie. #011 = 3. Constants for mapping between :wordn |
| 62 |
and :num can be defined. And there are conversions for the some |
| 63 |
purposes. |
| 64 |
|
| 65 |
wordn: |
| 66 |
This theory contains no definition nor theorems. It just acts |
| 67 |
as a common descendant for all the theories. |
| 68 |
|
| 69 |
Since the library has been organized as modules, theories implementing |
| 70 |
other interpretations, eg. integers and little-endian, can be added |
| 71 |
without difficuty. |
| 72 |
|
| 73 |
A list of User functions |
| 74 |
======================== |
| 75 |
|
| 76 |
define_wordn_type = - : (string -> int -> thm) |
| 77 |
define a type for n-bit word. |
| 78 |
|
| 79 |
prove_BITS_one_one = - : (thm -> thm) |
| 80 |
prove_BITS_onto = - : (thm -> thm) |
| 81 |
prove_WORD_one_one = - : (thm -> thm) |
| 82 |
prove_WORD_onto = - : (thm -> thm) |
| 83 |
prove_LENGTH_BITS_thm = - : (thm -> thm) |
| 84 |
prove_BITS_WORD = - : (thm -> thm) |
| 85 |
prove_function_defn_thm = - : (thm -> thm) |
| 86 |
prove_wordn_induction_thm = - : (thm -> thm) |
| 87 |
prove_wordn_cases_thm = - : (thm -> thm) |
| 88 |
prove theorems about the type and its constructor and destructor. |
| 89 |
|
| 90 |
new_wordn_definition = - : (bool -> thm -> string -> conv) |
| 91 |
define new constants on the wordn type. |
| 92 |
|
| 93 |
wordn_CASES_TAC = - : (term -> thm_tactic) |
| 94 |
wordn_X_CASES_TAC = - : (term -> thm -> term list -> tactic) |
| 95 |
tactics for working with :wordn. |
| 96 |
|
| 97 |
define_bit_op = - : (thm -> string -> string -> conv) |
| 98 |
define_bin_bit_op = - : (bool -> thm -> string -> string -> conv) |
| 99 |
define bitwise operators, such as NOTn, ANDn. |
| 100 |
|
| 101 |
prove_not_thm = - : (thm -> thm -> thm -> thm -> thm) |
| 102 |
prove_sym_thm = - : (thm -> thm -> thm -> thm) |
| 103 |
prove_assoc_thm = - : (thm -> thm -> thm -> thm -> thm) |
| 104 |
prove theorems about bitwise operators. |
| 105 |
|
| 106 |
define_word_val = - : (thm -> (string # string) -> (string # string) -> thm list) |
| 107 |
define mapping function between :wordn and :num. |
| 108 |
|
| 109 |
prove_word_val = - : (thm -> thm -> thm -> thm) |
| 110 |
prove_NWORD_MOD = - : (thm -> thm) |
| 111 |
prove theorems on this mapping. |
| 112 |
|
| 113 |
VAL_CONV = - : conv |
| 114 |
wordn_NVAL_CONV = - : (thm -> thm -> conv) |
| 115 |
NVAL_CONV = - : (thm -> thm -> conv) |
| 116 |
wordn_NWORD_CONV = - : (thm -> conv) |
| 117 |
NWORD_CONV = - : (thm -> thm -> conv) |
| 118 |
conversions for this mapping. |
| 119 |
|
| 120 |
define_wordn_msb = - : (thm -> string -> thm) |
| 121 |
prove_msb_thm = - : (thm -> thm -> thm) |
| 122 |
MSB_CONV = - : (thm -> conv) |
| 123 |
Most Significant Bit. |
| 124 |
|
| 125 |
define_wordn_lsb = - : (thm -> string -> thm) |
| 126 |
prove_lsb_thm = - : (thm -> thm -> thm) |
| 127 |
LSB_CONV = - : (thm -> conv) |
| 128 |
Least Significant Bit. |
| 129 |
|
| 130 |
define_wordn_bit = - : (thm -> string -> thm) |
| 131 |
prove_bit_thm = - : (thm -> thm -> int -> thm) |
| 132 |
BIT_CONV = - : (thm -> conv) |
| 133 |
Extract the i-th bit of a word. |
| 134 |
|
| 135 |
define_wordn_seg = - : (thm -> string -> int -> thm) |
| 136 |
prove_seg_thm = - : (thm -> thm -> int -> thm) |
| 137 |
SEG_CONV = - : (thm -> conv) |
| 138 |
Extract an m-bit segment from an n-bit word. |
| 139 |
|
| 140 |
define_wordn_pad = - : (thm -> string -> int -> thm) |
| 141 |
prove_pad_thm = - : (thm -> thm -> thm -> int -> thm) |
| 142 |
PAD_CONV = - : (thm -> conv) |
| 143 |
update an m-bit segement within an n-bit word. |
| 144 |
|
| 145 |
define_wordn_partition = - : ((string # string) -> thm list -> (thm # thm)) |
| 146 |
wordn_JOIN_CONV = - : (thm -> conv) |
| 147 |
wordn_SPLIT_CONV = - : (thm -> conv) |
| 148 |
prove_partition_thm = - : ((thm # thm) -> proof) |
| 149 |
split a word into two segments or join two words to form a longer word. |
| 150 |
|
| 151 |
define_wordn_shift_right = - : (thm -> string -> thm) |
| 152 |
prove_shift_right_thm = - : (thm -> thm -> thm) |
| 153 |
SHR_CONV = - : (thm -> conv -> conv) |
| 154 |
shift right. |
| 155 |
|
| 156 |
define_wordn_shift_left = - : (thm -> string -> thm) |
| 157 |
prove_shift_left_thm = - : (thm -> thm -> thm) |
| 158 |
SHL_CONV = - : (thm -> conv -> conv) |
| 159 |
shift left. |
| 160 |
|
| 161 |
define_wordn_rotate_right = - : (thm -> string -> thm) |
| 162 |
prove_rotate_right_thm = - : (thm -> thm -> thm) |
| 163 |
ROR_CONV = - : (thm -> conv) |
| 164 |
rotate right. |
| 165 |
|
| 166 |
define_wordn_rotate_left = - : (thm -> string -> thm) |
| 167 |
prove_rotate_left_thm = - : (thm -> thm -> thm) |
| 168 |
ROL_CONV = - : (thm -> conv) |
| 169 |
rotate left. |