Introduce a
Currently fixtypes can only be associated to unary predicates, but unsigned-byte-p and signed-byte-p are binary predicates.
This macro introduces unary recognizers, and associated fixtypes, of unsigned or signed bytes of specified sizes. It also generates various theorems, including some that relate the unary recognizers to the binary predicates.
Besides their use in fixtypes, the unary recognizers introduced by this macro support tau system reasoning.
(defbyte type :size ... :signed ... :pred ... :fix ... :equiv ... :parents ... :short ... :long ... )
A symbol that specifies the name of the fixtype.
A term that specifies the size of the bytes in bits. This must be one of the following: (1) an explicit positive integer value; (2) a named constant whose value is a positive integer; (3) a call of a nullary function (defined or constrained) that is guard-verified and provably denotes a positive integer.
This input must be supplied; there is no default.
A boolean that specifies whether the bytes are unsigned (
nil , the default) or signed (t ).
A symbol that specifies the name of the fixtype's recognizer. If this is
nil (the default), the name of the recognizer istype followed by-p .
A symbol that specifies the name of the fixtype's fixer. If this is
nil (the default), the name of the fixer istype followed by-fix .
A symbol that specifies the name of the fixtype's equivalence. If this is
nil (the default), the name of the equivalence istype followed by-equiv .
These, if present, are added to the XDOC topic generated for the fixtype.
The recognizer for the fixtype, guard-verified.
As a special case, if a function with this name already exists, it is not (re-)generated. This is mainly to accomodate the existing recognizers ACL2::bytep and ACL2::nibblep, but it is a more general mechanism.
A rewrite rule saying that
pred is boolean-valued.If
pred already exists (see above), it is assumed that a theorem like this already exists as well: thus, this theorem is not (re-)generated.
A forward chaining rule from
pred to the corresponding binary predicate unsigned-byte-p or signed-byte-p.
A rule that rewrites the binary predicate unsigned-byte-p or signed-byte-p to
pred . This rule is disabled by default, but may be useful in some proofs. Since this is the converse of the definition of the unary recognizer, a theory invariant is also generated preventing the enabling of both this rule and the definition of the unary recognizer.
A compound recognizer rule from
pred to natp (if the:signed input isnil or integerp (if the:signed input ist .
The fixer for the fixtype, guard-verified.
It fixes values outside of
pred to 0.
A rewrite rule saying that
fix always returns a value that satisfiespred .
A rewrite rule saying that
fix disappears when its argument satisfiespred .
The fixtype, via a call of deffixtype that also introduces the equivalence
equiv .
When the
size input is a unary function call, we also generate a rewrite and type prescription rule saying that the unary function call satisfies posp.
The above items are generated with XDOC documentation.
If
Introduce some theorems about a defbyte instance and functions in the IHS library.