TUTORIAL2-EIGHTS-PROBLEM

This example was written almost entirely by Bill Young of
Computational Logic, Inc.

This simple example was brought to our attention as one that Paul
Jackson has solved using the NuPrl system. The challenge is to
prove the theorem:

for all n > 7, there exist naturals i and j such that: n = 3i + 5j.

In ACL2, we could phrase this theorem using quantification. However
we will start with a constructive approach, i.e., we will show that
values of i and j exist by writing a function that will
construct such values for given n. Suppose we had a function
(split n) that returns an appropriate pair (i . j). Our
theorem would be as follows:

Maybe you will have observed a pattern here; any natural number larger
than 10 can be obtained by adding some multiple of 3 to 8, 9, or 10.
This gives us the clue to constructing a proof. It is clear that we
can write split as follows:

Notice that we explicitly compute the values of i and j for
the cases of 8, 9, and 10, and for the degenerate case when n is
not a natural or is less than 8. For all naturals greater than
n, we decrement n by 3 and bump the number of 3's (the value
of i) by 1. We know that the recursion must terminate because any
integer value greater than 10 can eventually be reduced to 8, 9, or
10 by successively subtracting 3.

Let's try it on some examples:

ACL2 !>(split 28)
(6 . 2)

ACL2 !>(split 45)
(15 . 0)

ACL2 !>(split 335)
(110 . 1)

Finally, we submit our theorem split-splits, and the proof
succeeds. In this case, the prover is ``smart'' enough to induct
according to the pattern indicated by the function split.

For completeness, we'll note that we can state and prove a quantified
version of this theorem. We introduce the notion split-able to mean
that appropriate i and j exist for n.