2.4"doublecheck"

This teachpack defines automated random test generation as a complement to
theorem proving. Each property declared via DoubleCheck is tested randomly by
Dracula, and verified logically by ACL2. For a gentle introduction, see
Doublecheck in
Dracula: A Guide to ACL2 in DrScheme.

Use defproperty to define DoubleCheck properties. Running the
properties opens a GUI displaying results, including success, failure, and the
values of randomly chosen variables.

Each defproperty form defines a property called name which
states that test must be true for all assignments to each var
in the bindings. DoubleCheck attempts to run the test repeat times
(default 50), but limits the attempts to generate satisfactory random data to
limit times (default 2500).

Dracula generates values for each var by running random-expr,
which defaults to (random-sexp). The var is generated until
hypothesis-expr evaluates to true (non-nil), or limit
attempts have been made (defaulting to the property’s limit, defaulting
to 50 as noted above).

2.4.2Random Distributions

Randomness is an inherently imperative process. As such, it is not reflected in
the logic of ACL2. The random distribution functions of DoubleCheck may only be
used within :value clauses of defproperty, or in other random
distributions.

Produces a natural number weighted to prefer small numbers, appropriate for
limiting the size of randomly produced values. This is the default distribution
for the length of random lists and the size of random s-expressions.

Chooses an expression from the clauses, each with the associated weight
(defaulting to 1), and yields its result; the other expressions are not
evaluated. This is useful with defrandom for defining recursive
distributions.

Be careful of the branching factor; a distribution with a high probability of
unbounded recursion is often unlikely to terminate. It is useful to give a
depth parameter to limit recursion.