(NOTE-LIB "naturals" T)
Loading ./numbers/naturals.lib
Finished loading ./numbers/naturals.lib
Loading ./numbers/naturals.o
Finished loading ./numbers/naturals.o
(#./numbers/naturals.lib #./numbers/naturals)
(DEFN PRODLIST
(LST)
(IF (LISTP LST)
(TIMES (CAR LST) (PRODLIST (CDR LST)))
1))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LST) decreases according to the well-founded relation LESSP in each
recursive call. Hence, PRODLIST is accepted under the definitional principle.
From the definition we can conclude that (NUMBERP (PRODLIST LST)) is a theorem.
[ 0.0 0.0 0.0 ]
PRODLIST
(DEFN SUMLIST
(LST)
(IF (LISTP LST)
(PLUS (CAR LST) (SUMLIST (CDR LST)))
0))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LST) decreases according to the well-founded relation LESSP in each
recursive call. Hence, SUMLIST is accepted under the definitional principle.
From the definition we can conclude that (NUMBERP (SUMLIST LST)) is a theorem.
[ 0.0 0.0 0.0 ]
SUMLIST
(DEFN LENGTH
(X)
(IF (LISTP X)
(ADD1 (LENGTH (CDR X)))
0))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT X) decreases according to the well-founded relation LESSP in each
recursive call. Hence, LENGTH is accepted under the principle of definition.
From the definition we can conclude that (NUMBERP (LENGTH X)) is a theorem.
[ 0.0 0.0 0.0 ]
LENGTH
(DEFN MAXLIST
(X)
(IF (LISTP X)
(IF (LISTP (CDR X))
(MAX (CAR X) (MAXLIST (CDR X)))
(FIX (CAR X)))
0))
Linear arithmetic and the lemma CDR-LESSP can be used to establish that
the measure (COUNT X) decreases according to the well-founded relation LESSP
in each recursive call. Hence, MAXLIST is accepted under the principle of
definition. Note that (NUMBERP (MAXLIST X)) is a theorem.
[ 0.0 0.0 0.0 ]
MAXLIST
(DEFN MIN
(X Y)
(IF (LESSP X Y) (FIX X) (FIX Y)))
From the definition we can conclude that (NUMBERP (MIN X Y)) is a theorem.
[ 0.0 0.0 0.0 ]
MIN
(DEFN MINLIST
(X)
(IF (LISTP X)
(IF (LISTP (CDR X))
(MIN (CAR X) (MINLIST (CDR X)))
(FIX (CAR X)))
0))
Linear arithmetic and the lemma CDR-LESSP can be used to establish that
the measure (COUNT X) decreases according to the well-founded relation LESSP
in each recursive call. Hence, MINLIST is accepted under the principle of
definition. Note that (NUMBERP (MINLIST X)) is a theorem.
[ 0.0 0.0 0.0 ]
MINLIST
(DEFN DELETE1
(ELT X)
(IF (LISTP X)
(IF (EQUAL ELT (CAR X))
(CDR X)
(CONS (CAR X) (DELETE1 ELT (CDR X))))
X))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT X) decreases according to the well-founded relation LESSP in each
recursive call. Hence, DELETE1 is accepted under the principle of definition.
[ 0.0 0.0 0.0 ]
DELETE1
(PROVE-LEMMA MAXLIST-DELETE1-REARRANGE
(REWRITE)
(IMPLIES (MEMBER B X)
(EQUAL (MAXLIST (CONS B (DELETE1 B X)))
(MAXLIST X))))
This conjecture simplifies, applying CAR-CONS and CDR-CONS, and expanding the
functions MAX and MAXLIST, to five new conjectures:
Case 5. (IMPLIES (AND (MEMBER B X)
(NOT (LESSP B (MAXLIST (DELETE1 B X))))
(NUMBERP B))
(EQUAL B (MAXLIST X))),
which we will name *1.
Case 4. (IMPLIES (AND (MEMBER B X)
(NOT (LISTP (DELETE1 B X)))
(NUMBERP B))
(EQUAL B (MAXLIST X))),
which we would usually push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us consider:
(IMPLIES (MEMBER B X)
(EQUAL (MAXLIST (CONS B (DELETE1 B X)))
(MAXLIST X))),
which we named *1 above. We will appeal to induction. Three inductions are
suggested by terms in the conjecture. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (NLISTP X) (p B X))
(IMPLIES (AND (NOT (NLISTP X))
(EQUAL B (CAR X)))
(p B X))
(IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL B (CAR X)))
(p B (CDR X)))
(p B X))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP can be used to show that the measure (COUNT X) decreases according to
the well-founded relation LESSP in each induction step of the scheme. The
above induction scheme produces four new conjectures:
Case 4. (IMPLIES (AND (NLISTP X) (MEMBER B X))
(EQUAL (MAXLIST (CONS B (DELETE1 B X)))
(MAXLIST X))),
which simplifies, rewriting with MEMBER-NON-LIST, and expanding the function
NLISTP, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP X))
(EQUAL B (CAR X))
(MEMBER B X))
(EQUAL (MAXLIST (CONS B (DELETE1 B X)))
(MAXLIST X))).
This simplifies, rewriting with CONS-CAR-CDR, and unfolding the definitions
of NLISTP, MEMBER, DELETE1, MAXLIST, and MAX, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL B (CAR X)))
(NOT (MEMBER B (CDR X)))
(MEMBER B X))
(EQUAL (MAXLIST (CONS B (DELETE1 B X)))
(MAXLIST X))),
which simplifies, opening up NLISTP and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL B (CAR X)))
(EQUAL (MAXLIST (CONS B (DELETE1 B (CDR X))))
(MAXLIST (CDR X)))
(MEMBER B X))
(EQUAL (MAXLIST (CONS B (DELETE1 B X)))
(MAXLIST X))),
which simplifies, rewriting with the lemmas CAR-CONS and CDR-CONS, and
unfolding the definitions of NLISTP, MAX, MAXLIST, MEMBER, DELETE1, LESSP,
and EQUAL, to 35 new goals:
Case 1.35.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(LISTP (CDR X))
(LESSP (CAR X) B)
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(NOT (NUMBERP (CAR X)))
(LESSP B 0))
(EQUAL 0 B)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.34.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(LISTP (CDR X))
(LESSP (CAR X) B)
(NOT (LISTP (DELETE1 B (CDR X))))
(NOT (NUMBERP (CAR X)))
(LESSP B 0))
(EQUAL 0 B)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.33.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(NOT (LESSP B 0)))
(EQUAL B 0)),
which again simplifies, rewriting with the lemma MEMBER-NON-LIST, and
expanding the functions DELETE1, MAXLIST, EQUAL, and LESSP, to:
T.
Case 1.32.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(EQUAL B 0)),
which again simplifies, rewriting with the lemma MEMBER-NON-LIST, and
expanding the definitions of DELETE1, MAXLIST, EQUAL, and LESSP, to:
T.
Case 1.31.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (LISTP (DELETE1 B (CDR X))))
(NOT (LESSP B 0)))
(EQUAL B 0)),
which again simplifies, appealing to the lemma MEMBER-NON-LIST, and
opening up DELETE1, MAXLIST, EQUAL, and LESSP, to:
T.
Case 1.30.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LESSP (CAR X) B))
(LISTP (DELETE1 B (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(EQUAL B 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.29.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LESSP (CAR X) B))
(NOT (NUMBERP (CAR X)))
(NOT (LESSP B 0)))
(EQUAL B 0)),
which again simplifies, unfolding LESSP, to:
T.
Case 1.28.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LESSP (CAR X) B))
(NUMBERP (CAR X))
(LISTP (DELETE1 B (CDR X))))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.27.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LESSP (CAR X) B))
(NUMBERP (CAR X)))
(LESSP B (CAR X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.26.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(LISTP (CDR X))
(LESSP (CAR X) B)
(NOT (LISTP (DELETE1 B (CDR X))))
(NUMBERP (CAR X)))
(NOT (LESSP B (CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.25.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(LISTP (CDR X))
(LESSP (CAR X) B)
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP (CAR X)))
(NOT (LESSP B (CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.24.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(LESSP B (CAR X))),
which again simplifies, rewriting with the lemma MEMBER-NON-LIST, and
unfolding the functions DELETE1, MAXLIST, EQUAL, and LESSP, to:
T.
Case 1.23.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X))
(LISTP (DELETE1 B (CDR X))))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))),
which again simplifies, applying MEMBER-NON-LIST, and opening up the
definitions of DELETE1, MAXLIST, EQUAL, and LESSP, to:
T.
Case 1.22.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LISTP (DELETE1 B (CDR X))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(LESSP B (CAR X))).
This again simplifies, applying MEMBER-NON-LIST, and unfolding DELETE1, to:
T.
Case 1.21.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LISTP (DELETE1 B (CDR X))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(LISTP (CDR X))
(LESSP (CAR X) B)
(NUMBERP (CAR X)))
(NOT (LESSP B (CAR X)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.20.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LISTP (DELETE1 B (CDR X))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LESSP (CAR X) B))
(NUMBERP (CAR X)))
(LESSP B (CAR X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.19.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LISTP (DELETE1 B (CDR X))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LESSP (CAR X) B))
(NOT (NUMBERP (CAR X)))
(NOT (LESSP B 0)))
(EQUAL B 0)),
which again simplifies, expanding the definition of LESSP, to:
T.
Case 1.18.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LISTP (DELETE1 B (CDR X))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (LESSP B 0)))
(EQUAL B 0)),
which again simplifies, applying MEMBER-NON-LIST, and unfolding the
function DELETE1, to:
T.
Case 1.17.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LISTP (DELETE1 B (CDR X))))
(NUMBERP B)
(EQUAL B (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(LISTP (CDR X))
(LESSP (CAR X) B)
(NOT (NUMBERP (CAR X)))
(LESSP B 0))
(EQUAL 0 B)).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.16.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NOT (NUMBERP B))
(EQUAL 0 (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(LISTP (DELETE1 B (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X))))
(NOT (EQUAL (MAXLIST (DELETE1 B (CDR X)))
0)))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(CAR X))),
which again simplifies, unfolding LESSP, to:
T.
Case 1.15.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NOT (NUMBERP B))
(EQUAL 0 (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NUMBERP (CAR X))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(EQUAL (CAR X) 0))
(EQUAL 0 (CAR X))),
which again simplifies, obviously, to:
T.
Case 1.14.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NOT (NUMBERP B))
(EQUAL 0 (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NUMBERP (CAR X))
(LISTP (DELETE1 B (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
0))
(EQUAL 0 (CAR X))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.13.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NOT (NUMBERP B))
(EQUAL 0 (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NUMBERP (CAR X))
(NOT (LISTP (DELETE1 B (CDR X))))
(EQUAL (CAR X) 0))
(EQUAL 0 (CAR X))),
which again simplifies, obviously, to:
T.
Case 1.12.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP B
(MAXLIST (DELETE1 B (CDR X)))))
(NOT (NUMBERP B))
(EQUAL 0 (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (NUMBERP (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
0)).
But this again simplifies, expanding LESSP, to:
T.
Case 1.11.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LISTP (DELETE1 B (CDR X))))
(NOT (NUMBERP B))
(EQUAL 0 (MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NUMBERP (CAR X))
(EQUAL (CAR X) 0))
(EQUAL 0 (CAR X))),
which again simplifies, obviously, to:
T.
Case 1.10.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP B
(MAXLIST (DELETE1 B (CDR X))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(LISTP (CDR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP B (MAXLIST (CDR X))))
(NOT (NUMBERP B)))
(EQUAL 0 (MAXLIST (CDR X)))).
This again simplifies, using linear arithmetic, to:
T.
Case 1.9.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP B
(MAXLIST (DELETE1 B (CDR X))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(LISTP (CDR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP B (MAXLIST (CDR X))))
(NUMBERP B))
(EQUAL B (MAXLIST (CDR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.8.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP B
(MAXLIST (DELETE1 B (CDR X))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (LESSP B 0))
(NUMBERP B))
(EQUAL B 0)),
which again simplifies, unfolding the definitions of LESSP and EQUAL, to:
(IMPLIES (AND (LISTP X)
(LISTP (DELETE1 B (CDR X)))
(LESSP B (MAXLIST (CDR X)))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(EQUAL (MAXLIST (CDR X)) 0)
(NOT (NUMBERP (CAR X)))
(NUMBERP B))
(EQUAL B 0)).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.7.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP B
(MAXLIST (DELETE1 B (CDR X))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP B (MAXLIST (CDR X))))
(EQUAL (MAXLIST (CDR X)) 0)),
which again simplifies, unfolding the definition of LESSP, to the formula:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X)))
(LESSP B (MAXLIST (CDR X))))
(EQUAL (MAXLIST (CDR X)) 0)).
This further simplifies, opening up the function DELETE1, to:
T.
Case 1.6.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP B
(MAXLIST (DELETE1 B (CDR X))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP B (MAXLIST (CDR X))))
(NUMBERP B))
(EQUAL B 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.5.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP B
(MAXLIST (DELETE1 B (CDR X))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (LESSP B (CAR X))))
(NOT (NUMBERP B))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.4.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP B
(MAXLIST (DELETE1 B (CDR X))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NUMBERP (CAR X))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (LESSP B (CAR X))))
(EQUAL 0 (CAR X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.3.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP B
(MAXLIST (DELETE1 B (CDR X))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP B (MAXLIST (CDR X))))
(EQUAL (MAXLIST (CDR X)) (CAR X))),
which again simplifies, trivially, to the new goal:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP B (MAXLIST (CDR X))))
(EQUAL (MAXLIST (CDR X)) (CAR X))),
which further simplifies, expanding DELETE1, to:
T.
Case 1.2.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP B
(MAXLIST (DELETE1 B (CDR X))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP B (MAXLIST (CDR X)))))
(EQUAL 0 (CAR X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP B
(MAXLIST (DELETE1 B (CDR X))))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (CDR X)))
(MEMBER B (CDR X))
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP B (MAXLIST (CDR X)))))
(NOT (NUMBERP B))),
which again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.1 ]
MAXLIST-DELETE1-REARRANGE
(DEFTHEORY INDUCTION-FN-DISABLES
(SUMLIST TIMES LENGTH MINLIST MAXLIST DELETE1 OCCURRENCES))
[ 0.0 0.0 0.0 ]
INDUCTION-FN-DISABLES
(PROVE-LEMMA MAX-GREATER-THAN-AVERAGE
(REWRITE)
(IMPLIES (AND (LISTP X)
(GEQ (SUMLIST X) (TIMES K (LENGTH X)))
(NOT (EQUAL (FIX K) (MAXLIST X))))
(LESSP K (MAXLIST X))))
WARNING: When the linear lemma MAX-GREATER-THAN-AVERAGE is stored under
(MAXLIST X) it contains the free variable K which will be chosen by
instantiating the hypothesis (NOT (LESSP (SUMLIST X) (TIMES K (LENGTH X)))).
WARNING: Note that the proposed lemma MAX-GREATER-THAN-AVERAGE is to be
stored as zero type prescription rules, zero compound recognizer rules, one
linear rule, and zero replacement rules.
This simplifies, opening up FIX and LESSP, to:
(IMPLIES (AND (LISTP X)
(NOT (LESSP (SUMLIST X)
(TIMES K (LENGTH X))))
(NUMBERP K)
(NOT (EQUAL K (MAXLIST X))))
(LESSP K (MAXLIST X))),
which we will name *1.
Perhaps we can prove it by induction. Six inductions are suggested by
terms in the conjecture. They merge into two likely candidate inductions,
both of which are unflawed. However, one of these is more likely than the
other. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p K (CDR X)))
(p K X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p K X))
(IMPLIES (NOT (LISTP X)) (p K X))).
Linear arithmetic and the lemma CDR-LESSP can be used to show that the measure
(COUNT X) decreases according to the well-founded relation LESSP in each
induction step of the scheme. The above induction scheme generates four new
conjectures:
Case 4. (IMPLIES (AND (LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES K (LENGTH (CDR X))))
(LISTP X)
(NOT (LESSP (SUMLIST X)
(TIMES K (LENGTH X))))
(NUMBERP K)
(NOT (EQUAL K (MAXLIST X))))
(LESSP K (MAXLIST X))),
which simplifies, applying the lemma TIMES-ADD1, and expanding the
definitions of SUMLIST, LENGTH, MAXLIST, MAX, and LESSP, to four new
conjectures:
Case 4.4.
(IMPLIES (AND (LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES K (LENGTH (CDR X))))
(LISTP X)
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS K (TIMES K (LENGTH (CDR X))))))
(NUMBERP K)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (EQUAL K (CAR X))))
(LESSP K (CAR X))),
which again simplifies, using linear arithmetic, to:
T.
Case 4.3.
(IMPLIES (AND (LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES K (LENGTH (CDR X))))
(LISTP X)
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS K (TIMES K (LENGTH (CDR X))))))
(NUMBERP K)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL K 0))
(NOT (EQUAL (MAXLIST (CDR X)) 0)))
(LESSP K (MAXLIST (CDR X)))),
which again simplifies, opening up PLUS and LESSP, to:
T.
Case 4.2.
(IMPLIES (AND (LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES K (LENGTH (CDR X))))
(LISTP X)
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS K (TIMES K (LENGTH (CDR X))))))
(NUMBERP K)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL K 0))
(EQUAL (MAXLIST (CDR X)) 0))
(LESSP K 0)),
which again simplifies, opening up the functions PLUS, EQUAL, and LESSP,
to:
(IMPLIES (AND (LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES K (LENGTH (CDR X))))
(LISTP X)
(NOT (LESSP (SUMLIST (CDR X))
(PLUS K (TIMES K (LENGTH (CDR X))))))
(NUMBERP K)
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL K 0)))
(NOT (EQUAL (MAXLIST (CDR X)) 0))).
This again simplifies, using linear arithmetic, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES K (LENGTH (CDR X))))
(LISTP X)
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS K (TIMES K (LENGTH (CDR X))))))
(NUMBERP K)
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (EQUAL K (MAXLIST (CDR X)))))
(LESSP K (MAXLIST (CDR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (LISTP (CDR X))
(EQUAL K (MAXLIST (CDR X)))
(LISTP X)
(NOT (LESSP (SUMLIST X)
(TIMES K (LENGTH X))))
(NUMBERP K)
(NOT (EQUAL K (MAXLIST X))))
(LESSP K (MAXLIST X))),
which simplifies, rewriting with COMMUTATIVITY-OF-TIMES and TIMES-ADD1, and
unfolding the functions SUMLIST, LENGTH, MAXLIST, MAX, and LESSP, to the
following two new goals:
Case 3.2.
(IMPLIES (AND (LISTP (CDR X))
(LISTP X)
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (MAXLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X))))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (EQUAL (MAXLIST (CDR X)) (CAR X))))
(LESSP (MAXLIST (CDR X)) (CAR X))).
But this again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP (CDR X))
(LISTP X)
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (MAXLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X))))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL (MAXLIST (CDR X)) 0)))
(LESSP (MAXLIST (CDR X))
(MAXLIST (CDR X)))),
which again simplifies, expanding the functions PLUS and LESSP, to:
T.
Case 2. (IMPLIES (AND (LISTP (CDR X))
(LESSP K (MAXLIST (CDR X)))
(LISTP X)
(NOT (LESSP (SUMLIST X)
(TIMES K (LENGTH X))))
(NUMBERP K)
(NOT (EQUAL K (MAXLIST X))))
(LESSP K (MAXLIST X))),
which simplifies, rewriting with the lemma TIMES-ADD1, and unfolding SUMLIST,
LENGTH, MAXLIST, MAX, and LESSP, to two new conjectures:
Case 2.2.
(IMPLIES (AND (LISTP (CDR X))
(LESSP K (MAXLIST (CDR X)))
(LISTP X)
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS K (TIMES K (LENGTH (CDR X))))))
(NUMBERP K)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (EQUAL K (CAR X))))
(LESSP K (CAR X))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP (CDR X))
(LESSP K (MAXLIST (CDR X)))
(LISTP X)
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS K (TIMES K (LENGTH (CDR X))))))
(NUMBERP K)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL K 0))
(EQUAL (MAXLIST (CDR X)) 0))
(LESSP K 0)),
which again simplifies, trivially, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP (CDR X)))
(LISTP X)
(NOT (LESSP (SUMLIST X)
(TIMES K (LENGTH X))))
(NUMBERP K)
(NOT (EQUAL K (MAXLIST X))))
(LESSP K (MAXLIST X))).
This simplifies, applying the lemma TIMES-ADD1, and unfolding the
definitions of SUMLIST, LENGTH, MAXLIST, EQUAL, and LESSP, to the following
two new goals:
Case 1.2.
(IMPLIES (AND (NOT (LISTP (CDR X)))
(LISTP X)
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS K (TIMES K (LENGTH (CDR X))))))
(NUMBERP K)
(NOT (NUMBERP (CAR X))))
(EQUAL K 0)).
However this again simplifies, unfolding the definition of PLUS, to the
conjecture:
(IMPLIES (AND (NOT (LISTP (CDR X)))
(LISTP X)
(NOT (LESSP (SUMLIST (CDR X))
(PLUS K (TIMES K (LENGTH (CDR X))))))
(NUMBERP K)
(NOT (NUMBERP (CAR X))))
(EQUAL K 0)).
This further simplifies, applying COMMUTATIVITY-OF-TIMES and
PLUS-ZERO-ARG2, and unfolding the functions SUMLIST, LENGTH, EQUAL, TIMES,
ZEROP, and LESSP, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LISTP (CDR X)))
(LISTP X)
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS K (TIMES K (LENGTH (CDR X))))))
(NUMBERP K)
(NUMBERP (CAR X))
(NOT (EQUAL K (CAR X))))
(LESSP K (CAR X))).
However this further simplifies, applying PLUS-ZERO-ARG2 and
COMMUTATIVITY-OF-TIMES, and expanding the functions SUMLIST, ZEROP, LENGTH,
EQUAL, and TIMES, to the new goal:
(IMPLIES (AND (NOT (LISTP (CDR X)))
(LISTP X)
(NOT (LESSP (CAR X) K))
(NUMBERP K)
(NUMBERP (CAR X))
(NOT (EQUAL K (CAR X))))
(LESSP K (CAR X))),
which again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
MAX-GREATER-THAN-AVERAGE
(PROVE-LEMMA MIN-LESS-THAN-AVERAGE
(REWRITE)
(IMPLIES (AND (LISTP X)
(LEQ (SUMLIST X) (TIMES K (LENGTH X)))
(NOT (EQUAL (FIX K) (MINLIST X))))
(LESSP (MINLIST X) K)))
WARNING: When the linear lemma MIN-LESS-THAN-AVERAGE is stored under
(MINLIST X) it contains the free variable K which will be chosen by
instantiating the hypothesis (NOT (LESSP (TIMES K (LENGTH X)) (SUMLIST X))).
WARNING: Note that the proposed lemma MIN-LESS-THAN-AVERAGE is to be stored
as zero type prescription rules, zero compound recognizer rules, one linear
rule, and zero replacement rules.
This simplifies, opening up FIX and LESSP, to the following two new goals:
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LESSP (TIMES K (LENGTH X))
(SUMLIST X)))
(NOT (NUMBERP K)))
(EQUAL 0 (MINLIST X))).
This again simplifies, expanding the definitions of TIMES, EQUAL, and LESSP,
to:
(IMPLIES (AND (LISTP X)
(EQUAL (SUMLIST X) 0)
(NOT (NUMBERP K)))
(EQUAL 0 (MINLIST X))).
Name the above subgoal *1.
Case 1. (IMPLIES (AND (LISTP X)
(NOT (LESSP (TIMES K (LENGTH X))
(SUMLIST X)))
(NUMBERP K)
(NOT (EQUAL K (MINLIST X))))
(LESSP (MINLIST X) K)),
which we would usually push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us consider:
(IMPLIES (AND (LISTP X)
(IF (LESSP (TIMES K (LENGTH X))
(SUMLIST X))
F T)
(NOT (EQUAL (FIX K) (MINLIST X))))
(LESSP (MINLIST X) K)).
We gave this the name *1 above. Perhaps we can prove it by induction. The
recursive terms in the conjecture suggest six inductions. They merge into two
likely candidate inductions, both of which are unflawed. However, one of
these is more likely than the other. We will induct according to the
following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X) K))
(p X K))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X K))
(IMPLIES (NOT (LISTP X)) (p X K))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme leads to the following four new
formulas:
Case 4. (IMPLIES (AND (LISTP (CDR X))
(NOT (IF (LESSP (TIMES K (LENGTH (CDR X)))
(SUMLIST (CDR X)))
F T))
(LISTP X)
(IF (LESSP (TIMES K (LENGTH X))
(SUMLIST X))
F T)
(NOT (EQUAL (FIX K) (MINLIST X))))
(LESSP (MINLIST X) K)).
This simplifies, rewriting with TIMES-ADD1, and unfolding the definitions of
LENGTH, SUMLIST, FIX, MINLIST, MIN, LESSP, NUMBERP, and EQUAL, to four new
goals:
Case 4.4.
(IMPLIES (AND (LISTP (CDR X))
(LESSP (TIMES K (LENGTH (CDR X)))
(SUMLIST (CDR X)))
(LISTP X)
(NOT (LESSP (PLUS K (TIMES K (LENGTH (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X)))))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (NUMBERP K)))
(EQUAL 0 (MINLIST (CDR X)))),
which again simplifies, applying PLUS-ZERO-ARG2 and EQUAL-PLUS-0, and
opening up the functions TIMES, EQUAL, LESSP, and ZEROP, to:
T.
Case 4.3.
(IMPLIES (AND (LISTP (CDR X))
(LESSP (TIMES K (LENGTH (CDR X)))
(SUMLIST (CDR X)))
(LISTP X)
(NOT (LESSP (PLUS K (TIMES K (LENGTH (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X)))))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NUMBERP K)
(NOT (EQUAL K (MINLIST (CDR X)))))
(LESSP (MINLIST (CDR X)) K)).
However this again simplifies, using linear arithmetic, to:
T.
Case 4.2.
(IMPLIES (AND (LISTP (CDR X))
(LESSP (TIMES K (LENGTH (CDR X)))
(SUMLIST (CDR X)))
(LISTP X)
(NOT (LESSP (PLUS K (TIMES K (LENGTH (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X)))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(NOT (NUMBERP K)))
(EQUAL 0 (CAR X))),
which again simplifies, rewriting with the lemmas PLUS-ZERO-ARG2 and
EQUAL-PLUS-0, and opening up the definitions of TIMES, EQUAL, LESSP, and
ZEROP, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP (CDR X))
(LESSP (TIMES K (LENGTH (CDR X)))
(SUMLIST (CDR X)))
(LISTP X)
(NOT (LESSP (PLUS K (TIMES K (LENGTH (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X)))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(NUMBERP K)
(NOT (EQUAL K (CAR X))))
(LESSP (CAR X) K)),
which again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (LISTP (CDR X))
(EQUAL (FIX K) (MINLIST (CDR X)))
(LISTP X)
(IF (LESSP (TIMES K (LENGTH X))
(SUMLIST X))
F T)
(NOT (EQUAL (FIX K) (MINLIST X))))
(LESSP (MINLIST X) K)),
which simplifies, applying PLUS-ZERO-ARG2, TIMES-ADD1, and EQUAL-PLUS-0, and
opening up the definitions of FIX, LENGTH, TIMES, ZEROP, SUMLIST, EQUAL,
LESSP, MINLIST, NUMBERP, and MIN, to:
T.
Case 2. (IMPLIES (AND (LISTP (CDR X))
(LESSP (MINLIST (CDR X)) K)
(LISTP X)
(IF (LESSP (TIMES K (LENGTH X))
(SUMLIST X))
F T)
(NOT (EQUAL (FIX K) (MINLIST X))))
(LESSP (MINLIST X) K)).
This simplifies, rewriting with TIMES-ADD1, and unfolding LENGTH, SUMLIST,
FIX, MINLIST, MIN, LESSP, NUMBERP, and EQUAL, to three new conjectures:
Case 2.3.
(IMPLIES (AND (LISTP (CDR X))
(LESSP (MINLIST (CDR X)) K)
(LISTP X)
(NOT (LESSP (PLUS K (TIMES K (LENGTH (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X)))))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (NUMBERP K)))
(EQUAL 0 (MINLIST (CDR X)))),
which again simplifies, expanding the definition of LESSP, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP (CDR X))
(LESSP (MINLIST (CDR X)) K)
(LISTP X)
(NOT (LESSP (PLUS K (TIMES K (LENGTH (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X)))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(NOT (NUMBERP K)))
(EQUAL 0 (CAR X))),
which again simplifies, unfolding the function LESSP, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP (CDR X))
(LESSP (MINLIST (CDR X)) K)
(LISTP X)
(NOT (LESSP (PLUS K (TIMES K (LENGTH (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X)))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(NUMBERP K)
(NOT (EQUAL K (CAR X))))
(LESSP (CAR X) K)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP (CDR X)))
(LISTP X)
(IF (LESSP (TIMES K (LENGTH X))
(SUMLIST X))
F T)
(NOT (EQUAL (FIX K) (MINLIST X))))
(LESSP (MINLIST X) K)),
which simplifies, appealing to the lemma TIMES-ADD1, and unfolding the
functions LENGTH, SUMLIST, FIX, MINLIST, EQUAL, and LESSP, to two new
conjectures:
Case 1.2.
(IMPLIES (AND (NOT (LISTP (CDR X)))
(LISTP X)
(NOT (LESSP (PLUS K (TIMES K (LENGTH (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X)))))
(NUMBERP (CAR X))
(NOT (NUMBERP K)))
(EQUAL 0 (CAR X))),
which again simplifies, applying PLUS-ZERO-ARG2 and EQUAL-PLUS-0, and
expanding the definitions of TIMES, ZEROP, EQUAL, and LESSP, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LISTP (CDR X)))
(LISTP X)
(NOT (LESSP (PLUS K (TIMES K (LENGTH (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X)))))
(NUMBERP (CAR X))
(NUMBERP K)
(NOT (EQUAL K (CAR X))))
(LESSP (CAR X) K)).
This further simplifies, rewriting with the lemmas COMMUTATIVITY-OF-TIMES
and PLUS-ZERO-ARG2, and unfolding LENGTH, EQUAL, TIMES, ZEROP, and SUMLIST,
to:
(IMPLIES (AND (NOT (LISTP (CDR X)))
(LISTP X)
(NOT (LESSP K (CAR X)))
(NUMBERP (CAR X))
(NUMBERP K)
(NOT (EQUAL K (CAR X))))
(LESSP (CAR X) K)).
But this again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
MIN-LESS-THAN-AVERAGE
(PROVE-LEMMA TIMES-MONOTONE-1
(REWRITE)
(IMPLIES (NOT (LESSP U V))
(NOT (LESSP (TIMES U Y) (TIMES V Y)))))
WARNING: When the linear lemma TIMES-MONOTONE-1 is stored under (TIMES V Y)
it contains the free variable U which will be chosen by instantiating the
hypothesis (NOT (LESSP U V)).
WARNING: When the linear lemma TIMES-MONOTONE-1 is stored under (TIMES U Y)
it contains the free variable V which will be chosen by instantiating the
hypothesis (NOT (LESSP U V)).
WARNING: Note that the proposed lemma TIMES-MONOTONE-1 is to be stored as
zero type prescription rules, zero compound recognizer rules, two linear rules,
and zero replacement rules.
This conjecture simplifies, applying CORRECTNESS-OF-CANCEL-LESSP-TIMES, and
expanding the functions ZEROP, NOT, FIX, and AND, to three new conjectures:
Case 3. (IMPLIES (AND (NOT (LESSP U V))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NUMBERP V)
(NOT (NUMBERP U)))
(NOT (LESSP 0 V))),
which again simplifies, expanding the functions LESSP and NUMBERP, to:
T.
Case 2. (IMPLIES (AND (NOT (LESSP U V))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (NUMBERP V))
(NUMBERP U))
(NOT (LESSP U 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LESSP U V))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (NUMBERP V))
(NOT (NUMBERP U)))
(NOT (LESSP 0 0))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TIMES-MONOTONE-1
(PROVE-LEMMA LESSP-TIMES-PRESERVED-IN-FIRST-ARG
(REWRITE)
(IMPLIES (AND (NOT (LESSP A (TIMES U Y)))
(NOT (LESSP U V)))
(NOT (LESSP A (TIMES V Y)))))
WARNING: When the linear lemma LESSP-TIMES-PRESERVED-IN-FIRST-ARG is stored
under (TIMES V Y) it contains the free variables U and A which will be chosen
by instantiating the hypothesis (NOT (LESSP A (TIMES U Y))).
WARNING: Note that the proposed lemma LESSP-TIMES-PRESERVED-IN-FIRST-ARG is
to be stored as zero type prescription rules, zero compound recognizer rules,
one linear rule, and zero replacement rules.
This conjecture simplifies, using linear arithmetic and applying
TIMES-MONOTONE-1, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LESSP-TIMES-PRESERVED-IN-FIRST-ARG
(PROVE-LEMMA MINLIST-MAIN-PROPERTY
(REWRITE)
(NOT (LESSP (SUMLIST X)
(TIMES (LENGTH X) (MINLIST X)))))
WARNING: Note that the proposed lemma MINLIST-MAIN-PROPERTY is to be stored
as zero type prescription rules, zero compound recognizer rules, one linear
rule, and zero replacement rules.
Give the conjecture the name *1.
We will try to prove it by induction. There are three plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme generates three new goals:
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))))
(NOT (LESSP (SUMLIST X)
(TIMES (LENGTH X) (MINLIST X))))),
which simplifies, applying SUB1-ADD1, and unfolding the functions SUMLIST,
LENGTH, MINLIST, MIN, and TIMES, to the following three new goals:
Case 3.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X)))))
(NOT (LESSP (CAR X) (MINLIST (CDR X)))))
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (MINLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))))).
However this again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X)))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X)))
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (CAR X)
(TIMES (LENGTH (CDR X)) (CAR X)))))),
which again simplifies, rewriting with COMMUTATIVITY-OF-TIMES and
CORRECTNESS-OF-CANCEL-LESSP-PLUS, and expanding the function FIX, to:
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X)))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X)))
(NOT (LESSP (SUMLIST (CDR X))
(TIMES (CAR X) (LENGTH (CDR X)))))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS V Z) to eliminate
(CDR X) and (CAR X). We thus obtain the new goal:
(IMPLIES (AND (LISTP Z)
(NOT (LESSP (SUMLIST Z)
(TIMES (LENGTH Z) (MINLIST Z))))
(LESSP V (MINLIST Z))
(NUMBERP V))
(NOT (LESSP (SUMLIST Z)
(TIMES V (LENGTH Z))))),
which we generalize by replacing (LENGTH Z) by Y, (SUMLIST Z) by A, and
(MINLIST Z) by U. We restrict the new variables by recalling the type
restriction lemma noted when LENGTH was introduced, the type restriction
lemma noted when SUMLIST was introduced, and the type restriction lemma
noted when MINLIST was introduced. We would thus like to prove:
(IMPLIES (AND (NUMBERP Y)
(NUMBERP A)
(NUMBERP U)
(LISTP Z)
(NOT (LESSP A (TIMES Y U)))
(LESSP V U)
(NUMBERP V))
(NOT (LESSP A (TIMES V Y)))),
which further simplifies, rewriting with COMMUTATIVITY-OF-TIMES, to:
(IMPLIES (AND (NUMBERP Y)
(NUMBERP A)
(NUMBERP U)
(LISTP Z)
(NOT (LESSP A (TIMES U Y)))
(LESSP V U)
(NUMBERP V))
(NOT (LESSP A (TIMES V Y)))),
which finally simplifies, using linear arithmetic and rewriting with
LESSP-TIMES-PRESERVED-IN-FIRST-ARG, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X)))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS 0
(TIMES (LENGTH (CDR X)) 0))))).
But this again simplifies, appealing to the lemma COMMUTATIVITY-OF-TIMES,
and unfolding the functions LESSP, PLUS, EQUAL, and TIMES, to:
T.
Case 2. (IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(NOT (LESSP (SUMLIST X)
(TIMES (LENGTH X) (MINLIST X))))),
which simplifies, applying the lemma SUB1-ADD1, and opening up the
definitions of SUMLIST, LENGTH, MINLIST, and TIMES, to two new goals:
Case 2.2.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS 0
(TIMES (LENGTH (CDR X)) 0))))),
which again simplifies, appealing to the lemma COMMUTATIVITY-OF-TIMES, and
expanding the functions PLUS, EQUAL, TIMES, and LESSP, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (CAR X)
(TIMES (LENGTH (CDR X)) (CAR X)))))),
which again simplifies, rewriting with the lemmas COMMUTATIVITY-OF-TIMES
and CORRECTNESS-OF-CANCEL-LESSP-PLUS, and expanding the definition of FIX,
to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(NOT (LESSP (SUMLIST (CDR X))
(TIMES (CAR X) (LENGTH (CDR X)))))).
But this further simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and
opening up SUMLIST, LENGTH, EQUAL, TIMES, and LESSP, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(NOT (LESSP (SUMLIST X)
(TIMES (LENGTH X) (MINLIST X))))).
This simplifies, expanding the definitions of SUMLIST, LENGTH, MINLIST,
TIMES, and LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.1 ]
MINLIST-MAIN-PROPERTY
(PROVE-LEMMA MINLIST-NOT-MAXLIST-IMPLIES-MINLIST-LESSP-AVERAGE-LEMMA NIL
(IMPLIES (NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP (TIMES (MINLIST X) (LENGTH X))
(SUMLIST X))))
This simplifies, appealing to the lemma COMMUTATIVITY-OF-TIMES, to the goal:
(IMPLIES (NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP (TIMES (LENGTH X) (MINLIST X))
(SUMLIST X))).
However this again simplifies, using linear arithmetic and applying the lemma
MINLIST-MAIN-PROPERTY, to the conjecture:
(IMPLIES (AND (EQUAL (TIMES (LENGTH X) (MINLIST X))
(SUMLIST X))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (SUMLIST X) (SUMLIST X))).
We use the above equality hypothesis by substituting:
(TIMES (LENGTH X) (MINLIST X))
for (SUMLIST X) and keeping the equality hypothesis. We would thus like to
prove:
(IMPLIES (AND (EQUAL (TIMES (LENGTH X) (MINLIST X))
(SUMLIST X))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (TIMES (LENGTH X) (MINLIST X))
(TIMES (LENGTH X) (MINLIST X)))),
which further simplifies, trivially, to:
(IMPLIES (AND (EQUAL (TIMES (LENGTH X) (MINLIST X))
(SUMLIST X))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (SUMLIST X) (SUMLIST X))),
which we would normally push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we have
previously done, give the name *1 to the original input, and work on it.
So now let us return to:
(IMPLIES (NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP (TIMES (MINLIST X) (LENGTH X))
(SUMLIST X))),
named *1. Let us appeal to the induction principle. The recursive terms in
the conjecture suggest five inductions. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme leads to four new formulas:
Case 4. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (TIMES (MINLIST X) (LENGTH X))
(SUMLIST X))),
which simplifies, applying COMMUTATIVITY-OF-TIMES, TIMES-ADD1, and
CORRECTNESS-OF-CANCEL-LESSP-PLUS, and unfolding the functions MINLIST, MIN,
MAXLIST, MAX, LENGTH, SUMLIST, LESSP, EQUAL, TIMES, PLUS, and FIX, to the
following four new conjectures:
Case 4.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (EQUAL (MAXLIST (CDR X)) (CAR X))))
(LESSP (PLUS (MAXLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X))))).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS V Z) to
eliminate (CDR X) and (CAR X). We must thus prove:
(IMPLIES (AND (LISTP Z)
(EQUAL (MINLIST Z) (MAXLIST Z))
(NOT (LESSP V (MAXLIST Z)))
(NUMBERP V)
(NOT (EQUAL (MAXLIST Z) V)))
(LESSP (PLUS (MAXLIST Z)
(TIMES (LENGTH Z) (MAXLIST Z)))
(PLUS V (SUMLIST Z)))).
We use the above equality hypothesis by substituting (MINLIST Z) for
(MAXLIST Z) and throwing away the equality. We would thus like to prove:
(IMPLIES (AND (LISTP Z)
(NOT (LESSP V (MINLIST Z)))
(NUMBERP V)
(NOT (EQUAL (MINLIST Z) V)))
(LESSP (PLUS (MINLIST Z)
(TIMES (LENGTH Z) (MINLIST Z)))
(PLUS V (SUMLIST Z)))),
which further simplifies, using linear arithmetic and appealing to the
lemma MINLIST-MAIN-PROPERTY, to:
T.
Case 4.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL (MAXLIST (CDR X)) 0)))
(NOT (EQUAL (SUMLIST (CDR X)) 0))),
which again simplifies, expanding LESSP, to:
T.
Case 4.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NUMBERP (CAR X))
(NOT (EQUAL (CAR X) (MAXLIST (CDR X)))))
(LESSP (TIMES (CAR X) (LENGTH (CDR X)))
(SUMLIST (CDR X)))),
which again simplifies, using linear arithmetic, appealing to the lemma
MIN-LESS-THAN-AVERAGE, and unfolding the definition of FIX, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (MAXLIST (CDR X)))))
(NOT (EQUAL (SUMLIST (CDR X)) 0))),
which again simplifies, expanding the function LESSP, to the conjecture:
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (MAXLIST (CDR X)))))
(NOT (EQUAL (SUMLIST (CDR X)) 0))).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS V Z) to
eliminate (CDR X) and (CAR X). This generates:
(IMPLIES (AND (LISTP Z)
(EQUAL (MINLIST Z) (MAXLIST Z))
(NOT (NUMBERP V))
(NOT (EQUAL 0 (MAXLIST Z))))
(NOT (EQUAL (SUMLIST Z) 0))).
We now use the first equality hypothesis by substituting (MINLIST Z) for
(MAXLIST Z) and throwing away the equality. We thus obtain:
(IMPLIES (AND (LISTP Z)
(NOT (NUMBERP V))
(NOT (EQUAL 0 (MINLIST Z))))
(NOT (EQUAL (SUMLIST Z) 0))),
which has an irrelevant term in it. By eliminating the term we get:
(IMPLIES (AND (LISTP Z)
(NOT (EQUAL 0 (MINLIST Z))))
(NOT (EQUAL (SUMLIST Z) 0))),
which we will finally name *1.1.
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (TIMES (MINLIST (CDR X))
(LENGTH (CDR X)))
(SUMLIST (CDR X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (TIMES (MINLIST X) (LENGTH X))
(SUMLIST X))).
This simplifies, rewriting with COMMUTATIVITY-OF-TIMES, TIMES-ADD1, and
CORRECTNESS-OF-CANCEL-LESSP-PLUS, and expanding the definitions of MINLIST,
MIN, MAXLIST, MAX, LENGTH, SUMLIST, LESSP, EQUAL, TIMES, PLUS, FIX, and
NUMBERP, to five new conjectures:
Case 3.5.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (TIMES (LENGTH (CDR X))
(MINLIST (CDR X)))
(SUMLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (EQUAL (MINLIST (CDR X)) (CAR X))))
(LESSP (PLUS (MINLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (TIMES (LENGTH (CDR X))
(MINLIST (CDR X)))
(SUMLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (EQUAL (MINLIST (CDR X)) 0)))
(NOT (EQUAL (SUMLIST (CDR X)) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (TIMES (LENGTH (CDR X))
(MINLIST (CDR X)))
(SUMLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))))
(LESSP (PLUS (MINLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (TIMES (LENGTH (CDR X))
(MINLIST (CDR X)))
(SUMLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(NOT (EQUAL (CAR X) (MAXLIST (CDR X)))))
(LESSP (TIMES (CAR X) (LENGTH (CDR X)))
(SUMLIST (CDR X)))),
which again simplifies, using linear arithmetic, applying
MIN-LESS-THAN-AVERAGE, and opening up the definition of FIX, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (TIMES (LENGTH (CDR X))
(MINLIST (CDR X)))
(SUMLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (MAXLIST (CDR X)))))
(NOT (EQUAL (SUMLIST (CDR X)) 0))).
But this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (TIMES (MINLIST X) (LENGTH X))
(SUMLIST X))),
which simplifies, opening up the definitions of MINLIST and MAXLIST, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (TIMES (MINLIST X) (LENGTH X))
(SUMLIST X))),
which simplifies, expanding MINLIST, MAXLIST, and EQUAL, to:
T.
So let us turn our attention to:
(IMPLIES (AND (LISTP Z)
(NOT (EQUAL 0 (MINLIST Z))))
(NOT (EQUAL (SUMLIST Z) 0))),
which we named *1.1 above. We will try to prove it by induction. Two
inductions are suggested by terms in the conjecture. However, they merge into
one likely candidate induction. We will induct according to the following
scheme:
(AND (IMPLIES (AND (LISTP Z)
(LISTP (CDR Z))
(p (CDR Z)))
(p Z))
(IMPLIES (AND (LISTP Z) (NOT (LISTP (CDR Z))))
(p Z))
(IMPLIES (NOT (LISTP Z)) (p Z))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT Z)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme leads to three new formulas:
Case 3. (IMPLIES (AND (LISTP (CDR Z))
(EQUAL 0 (MINLIST (CDR Z)))
(LISTP Z)
(NOT (EQUAL 0 (MINLIST Z))))
(NOT (EQUAL (SUMLIST Z) 0))),
which simplifies, expanding the definitions of MINLIST, NUMBERP, LESSP,
EQUAL, and MIN, to:
T.
Case 2. (IMPLIES (AND (LISTP (CDR Z))
(NOT (EQUAL (SUMLIST (CDR Z)) 0))
(LISTP Z)
(NOT (EQUAL 0 (MINLIST Z))))
(NOT (EQUAL (SUMLIST Z) 0))),
which simplifies, applying EQUAL-PLUS-0, and opening up the definitions of
MINLIST, MIN, and SUMLIST, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP (CDR Z)))
(LISTP Z)
(NOT (EQUAL 0 (MINLIST Z))))
(NOT (EQUAL (SUMLIST Z) 0))).
This simplifies, applying the lemma EQUAL-PLUS-0, and expanding MINLIST and
SUMLIST, to:
T.
That finishes the proof of *1.1, which also finishes the proof of *1.
Q.E.D.
[ 0.0 0.2 0.3 ]
MINLIST-NOT-MAXLIST-IMPLIES-MINLIST-LESSP-AVERAGE-LEMMA
(PROVE-LEMMA MINLIST-NOT-MAXLIST-IMPLIES-MINLIST-LESSP-AVERAGE
(REWRITE)
(IMPLIES (AND (LISTP X)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (MINLIST X) (FIX K)))
((USE (MINLIST-NOT-MAXLIST-IMPLIES-MINLIST-LESSP-AVERAGE-LEMMA))))
WARNING: Note that the linear lemma:
MINLIST-NOT-MAXLIST-IMPLIES-MINLIST-LESSP-AVERAGE
is being stored under the term (FIX K), which is unusual because FIX is a
nonrecursive function symbol.
WARNING: When the linear lemma:
MINLIST-NOT-MAXLIST-IMPLIES-MINLIST-LESSP-AVERAGE
is stored under (MINLIST X) it contains the free variable K which will be
chosen by instantiating the hypothesis:
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X))).
WARNING: When the linear lemma:
MINLIST-NOT-MAXLIST-IMPLIES-MINLIST-LESSP-AVERAGE
is stored under (FIX K) it contains the free variable X which will be chosen
by instantiating the hypothesis (LISTP X).
WARNING: Note that the proposed lemma:
MINLIST-NOT-MAXLIST-IMPLIES-MINLIST-LESSP-AVERAGE
is to be stored as zero type prescription rules, zero compound recognizer
rules, two linear rules, and zero replacement rules.
This formula simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and unfolding
NOT, IMPLIES, and FIX, to two new goals:
Case 2. (IMPLIES (AND (LESSP (TIMES (LENGTH X) (MINLIST X))
(SUMLIST X))
(LISTP X)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (NUMBERP K)))
(LESSP (MINLIST X) 0)),
which again simplifies, opening up the functions TIMES, EQUAL, and LESSP, to:
(IMPLIES (AND (LESSP (TIMES (LENGTH X) (MINLIST X))
(SUMLIST X))
(LISTP X)
(EQUAL (SUMLIST X) 0)
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(NUMBERP K)).
But this again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (LESSP (TIMES (LENGTH X) (MINLIST X))
(SUMLIST X))
(LISTP X)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NUMBERP K))
(LESSP (MINLIST X) K)),
which again simplifies, using linear arithmetic and rewriting with
TIMES-MONOTONE-1 and COMMUTATIVITY-OF-TIMES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
MINLIST-NOT-MAXLIST-IMPLIES-MINLIST-LESSP-AVERAGE
(PROVE-LEMMA MAXLIST-MAIN-PROPERTY
(REWRITE)
(NOT (LESSP (TIMES (LENGTH X) (MAXLIST X))
(SUMLIST X))))
WARNING: Note that the proposed lemma MAXLIST-MAIN-PROPERTY is to be stored
as zero type prescription rules, zero compound recognizer rules, one linear
rule, and zero replacement rules.
Give the conjecture the name *1.
We will try to prove it by induction. There are three plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme generates three new goals:
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))
(SUMLIST (CDR X)))))
(NOT (LESSP (TIMES (LENGTH X) (MAXLIST X))
(SUMLIST X)))),
which simplifies, applying SUB1-ADD1, and unfolding the functions LENGTH,
MAXLIST, MAX, TIMES, and SUMLIST, to the following three new goals:
Case 3.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))
(SUMLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X)))
(NOT (LESSP (PLUS (CAR X)
(TIMES (LENGTH (CDR X)) (CAR X)))
(PLUS (CAR X) (SUMLIST (CDR X)))))).
However this again simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES
and CORRECTNESS-OF-CANCEL-LESSP-PLUS, and unfolding the definition of FIX,
to the formula:
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))
(SUMLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X)))
(NOT (LESSP (TIMES (CAR X) (LENGTH (CDR X)))
(SUMLIST (CDR X))))).
But this again simplifies, using linear arithmetic and appealing to the
lemmas TIMES-MONOTONE-1 and COMMUTATIVITY-OF-TIMES, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))
(SUMLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP (PLUS 0 (TIMES (LENGTH (CDR X)) 0))
(PLUS (CAR X) (SUMLIST (CDR X)))))),
which again simplifies, applying COMMUTATIVITY-OF-TIMES, and unfolding the
functions LESSP, EQUAL, TIMES, and PLUS, to:
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))
(SUMLIST (CDR X))))
(EQUAL (MAXLIST (CDR X)) 0)
(NOT (NUMBERP (CAR X))))
(EQUAL (SUMLIST (CDR X)) 0)),
which again simplifies, applying COMMUTATIVITY-OF-TIMES, and unfolding
EQUAL, TIMES, and LESSP, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))
(SUMLIST (CDR X))))
(LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (LESSP (PLUS (MAXLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X))))
(PLUS (CAR X) (SUMLIST (CDR X)))))).
But this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(NOT (LESSP (TIMES (LENGTH X) (MAXLIST X))
(SUMLIST X)))),
which simplifies, rewriting with SUB1-ADD1, and opening up LENGTH, MAXLIST,
TIMES, and SUMLIST, to the following two new goals:
Case 2.2.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP (PLUS 0 (TIMES (LENGTH (CDR X)) 0))
(PLUS (CAR X) (SUMLIST (CDR X)))))).
But this again simplifies, appealing to the lemma COMMUTATIVITY-OF-TIMES,
and opening up the definitions of EQUAL, TIMES, PLUS, and LESSP, to the
conjecture:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (SUMLIST (CDR X)) 0)).
This further simplifies, opening up SUMLIST and EQUAL, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(NOT (LESSP (PLUS (CAR X)
(TIMES (LENGTH (CDR X)) (CAR X)))
(PLUS (CAR X) (SUMLIST (CDR X)))))),
which again simplifies, applying COMMUTATIVITY-OF-TIMES and
CORRECTNESS-OF-CANCEL-LESSP-PLUS, and opening up the function FIX, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(NOT (LESSP (TIMES (CAR X) (LENGTH (CDR X)))
(SUMLIST (CDR X))))),
which further simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and
unfolding the functions LENGTH, EQUAL, TIMES, SUMLIST, and LESSP, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(NOT (LESSP (TIMES (LENGTH X) (MAXLIST X))
(SUMLIST X)))).
This simplifies, expanding LENGTH, MAXLIST, TIMES, SUMLIST, and LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
MAXLIST-MAIN-PROPERTY
(PROVE-LEMMA MINLIST-NOT-MAXLIST-IMPLIES-MAXLIST-GREATERP-AVERAGE-LEMMA NIL
(IMPLIES (NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP (SUMLIST X)
(TIMES (MAXLIST X) (LENGTH X)))))
This simplifies, using linear arithmetic and appealing to the lemmas
LESSP-TIMES-PRESERVED-IN-FIRST-ARG, COMMUTATIVITY-OF-TIMES, and
MAXLIST-MAIN-PROPERTY, to the goal:
(IMPLIES (AND (EQUAL (TIMES (LENGTH X) (MAXLIST X))
(SUMLIST X))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (SUMLIST X)
(TIMES (MAXLIST X) (LENGTH X)))).
However this again simplifies, applying the lemma COMMUTATIVITY-OF-TIMES, to
the conjecture:
(IMPLIES (AND (EQUAL (TIMES (LENGTH X) (MAXLIST X))
(SUMLIST X))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (SUMLIST X) (SUMLIST X))).
We use the above equality hypothesis by substituting:
(TIMES (LENGTH X) (MAXLIST X))
for (SUMLIST X) and keeping the equality hypothesis. We would thus like to
prove:
(IMPLIES (AND (EQUAL (TIMES (LENGTH X) (MAXLIST X))
(SUMLIST X))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (TIMES (LENGTH X) (MAXLIST X))
(TIMES (LENGTH X) (MAXLIST X)))),
which further simplifies, trivially, to:
(IMPLIES (AND (EQUAL (TIMES (LENGTH X) (MAXLIST X))
(SUMLIST X))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (SUMLIST X) (SUMLIST X))),
which we would normally push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we have
previously done, give the name *1 to the original input, and work on it.
So now let us return to:
(IMPLIES (NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP (SUMLIST X)
(TIMES (MAXLIST X) (LENGTH X)))),
named *1. Let us appeal to the induction principle. The recursive terms in
the conjecture suggest five inductions. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme leads to four new formulas:
Case 4. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (SUMLIST X)
(TIMES (MAXLIST X) (LENGTH X)))),
which simplifies, applying TIMES-ADD1, CORRECTNESS-OF-CANCEL-LESSP-PLUS, and
COMMUTATIVITY-OF-TIMES, and unfolding the functions MINLIST, MIN, MAXLIST,
MAX, SUMLIST, LENGTH, FIX, PLUS, and LESSP, to the following four new
conjectures:
Case 4.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (EQUAL (MAXLIST (CDR X)) (CAR X))))
(LESSP (SUMLIST (CDR X))
(TIMES (CAR X) (LENGTH (CDR X))))).
But this again simplifies, using linear arithmetic, applying
MAX-GREATER-THAN-AVERAGE, and expanding the definition of FIX, to:
T.
Case 4.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL (MAXLIST (CDR X)) 0)))
(LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))))).
But this again simplifies, using linear arithmetic and appealing to the
lemma MAXLIST-MAIN-PROPERTY, to:
T.
Case 4.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NUMBERP (CAR X))
(NOT (EQUAL (CAR X) (MAXLIST (CDR X)))))
(LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (MAXLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))))),
which again simplifies, using linear arithmetic and applying
MAXLIST-MAIN-PROPERTY, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (MAXLIST (CDR X)))))
(LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))))).
This again simplifies, using linear arithmetic and appealing to the lemma
MAXLIST-MAIN-PROPERTY, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES (MAXLIST (CDR X))
(LENGTH (CDR X))))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (SUMLIST X)
(TIMES (MAXLIST X) (LENGTH X)))),
which simplifies, rewriting with COMMUTATIVITY-OF-TIMES, TIMES-ADD1,
CORRECTNESS-OF-CANCEL-LESSP-PLUS, and SUB1-ADD1, and opening up the
definitions of MINLIST, MIN, MAXLIST, MAX, SUMLIST, LENGTH, FIX, PLUS, LESSP,
and TIMES, to the following six new goals:
Case 3.6.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (EQUAL (MINLIST (CDR X)) (CAR X))))
(LESSP (SUMLIST (CDR X))
(TIMES (CAR X) (LENGTH (CDR X))))).
This again simplifies, using linear arithmetic and appealing to the lemmas
TIMES-MONOTONE-1 and COMMUTATIVITY-OF-TIMES, to:
T.
Case 3.5.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (EQUAL (MINLIST (CDR X)) 0))
(NOT (EQUAL (MAXLIST (CDR X)) 0)))
(LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (EQUAL (MINLIST (CDR X)) 0))
(EQUAL (MAXLIST (CDR X)) 0))
(LESSP (SUMLIST (CDR X))
(PLUS 0 (TIMES (LENGTH (CDR X)) 0)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X))))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))))
(LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (MAXLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X))))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(NOT (EQUAL (CAR X) (MAXLIST (CDR X)))))
(LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (MAXLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X))))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (MAXLIST (CDR X)))))
(LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MAXLIST (CDR X)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (SUMLIST X)
(TIMES (MAXLIST X) (LENGTH X)))),
which simplifies, opening up the definitions of MINLIST and MAXLIST, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (SUMLIST X)
(TIMES (MAXLIST X) (LENGTH X)))),
which simplifies, opening up the definitions of MINLIST, MAXLIST, and EQUAL,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.3 0.0 ]
MINLIST-NOT-MAXLIST-IMPLIES-MAXLIST-GREATERP-AVERAGE-LEMMA
(PROVE-LEMMA MINLIST-NOT-MAXLIST-IMPLIES-MAXLIST-GREATERP-AVERAGE
(REWRITE)
(IMPLIES (AND (LISTP X)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (FIX K) (MAXLIST X)))
((USE (MINLIST-NOT-MAXLIST-IMPLIES-MAXLIST-GREATERP-AVERAGE-LEMMA))))
WARNING: Note that the linear lemma:
MINLIST-NOT-MAXLIST-IMPLIES-MAXLIST-GREATERP-AVERAGE
is being stored under the term (FIX K), which is unusual because FIX is a
nonrecursive function symbol.
WARNING: When the linear lemma:
MINLIST-NOT-MAXLIST-IMPLIES-MAXLIST-GREATERP-AVERAGE
is stored under (MAXLIST X) it contains the free variable K which will be
chosen by instantiating the hypothesis:
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X))).
WARNING: When the linear lemma:
MINLIST-NOT-MAXLIST-IMPLIES-MAXLIST-GREATERP-AVERAGE
is stored under (FIX K) it contains the free variable X which will be chosen
by instantiating the hypothesis (LISTP X).
WARNING: Note that the proposed lemma:
MINLIST-NOT-MAXLIST-IMPLIES-MAXLIST-GREATERP-AVERAGE
is to be stored as zero type prescription rules, zero compound recognizer
rules, two linear rules, and zero replacement rules.
This formula simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and unfolding
NOT, IMPLIES, and FIX, to two new goals:
Case 2. (IMPLIES (AND (LESSP (SUMLIST X)
(TIMES (LENGTH X) (MAXLIST X)))
(LISTP X)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (NUMBERP K)))
(LESSP 0 (MAXLIST X))),
which again simplifies, using linear arithmetic, appealing to the lemma
MINLIST-NOT-MAXLIST-IMPLIES-MINLIST-LESSP-AVERAGE, and unfolding the
function FIX, to:
T.
Case 1. (IMPLIES (AND (LESSP (SUMLIST X)
(TIMES (LENGTH X) (MAXLIST X)))
(LISTP X)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NUMBERP K))
(LESSP K (MAXLIST X))),
which again simplifies, using linear arithmetic and rewriting with the
lemmas TIMES-MONOTONE-1 and COMMUTATIVITY-OF-TIMES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
MINLIST-NOT-MAXLIST-IMPLIES-MAXLIST-GREATERP-AVERAGE
(PROVE-LEMMA MINLIST-LESS-THAN-MAXLIST-MINUS-1
(REWRITE)
(IMPLIES (AND (LISTP X)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (MINLIST X)
(SUB1 (MAXLIST X))))
((USE (MINLIST-NOT-MAXLIST-IMPLIES-MINLIST-LESSP-AVERAGE)
(MINLIST-NOT-MAXLIST-IMPLIES-MAXLIST-GREATERP-AVERAGE))))
WARNING: When the linear lemma MINLIST-LESS-THAN-MAXLIST-MINUS-1 is stored
under (MINLIST X) it contains the free variable K which will be chosen by
instantiating the hypothesis (EQUAL (SUMLIST X) (TIMES K (LENGTH X))).
WARNING: When the linear lemma MINLIST-LESS-THAN-MAXLIST-MINUS-1 is stored
under (MAXLIST X) it contains the free variable K which will be chosen by
instantiating the hypothesis (EQUAL (SUMLIST X) (TIMES K (LENGTH X))).
WARNING: Note that the proposed lemma MINLIST-LESS-THAN-MAXLIST-MINUS-1 is to
be stored as zero type prescription rules, zero compound recognizer rules, two
linear rules, and zero replacement rules.
This conjecture simplifies, expanding the definitions of NOT, AND, FIX,
IMPLIES, TIMES, EQUAL, and LESSP, to two new formulas:
Case 2. (IMPLIES (AND (NOT (NUMBERP K))
(LESSP (MINLIST X) 0)
(NOT (EQUAL (MAXLIST X) 0))
(LISTP X)
(EQUAL (SUMLIST X) 0)
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (MINLIST X)
(SUB1 (MAXLIST X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NUMBERP K)
(LESSP (MINLIST X) K)
(LESSP K (MAXLIST X))
(LISTP X)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (MINLIST X)
(SUB1 (MAXLIST X)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
MINLIST-LESS-THAN-MAXLIST-MINUS-1
(PROVE-LEMMA MAXLIST-DELETE1-LEQ
(REWRITE)
(NOT (LESSP (MAXLIST LST)
(MAXLIST (DELETE1 A LST)))))
WARNING: Note that the proposed lemma MAXLIST-DELETE1-LEQ is to be stored as
zero type prescription rules, zero compound recognizer rules, one linear rule,
and zero replacement rules.
Give the conjecture the name *1.
Let us appeal to the induction principle. Two inductions are suggested
by terms in the conjecture. However, they merge into one likely candidate
induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(p (CDR LST) A))
(p LST A))
(IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST))))
(p LST A))
(IMPLIES (NOT (LISTP LST))
(p LST A))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT LST) decreases according to the well-founded relation LESSP in each
induction step of the scheme. The above induction scheme generates three new
conjectures:
Case 3. (IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST))))))
(NOT (LESSP (MAXLIST LST)
(MAXLIST (DELETE1 A LST))))),
which simplifies, expanding the functions MAXLIST, MAX, and DELETE1, to five
new formulas:
Case 3.5.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (EQUAL A (CAR LST)))
(NOT (LESSP (CAR LST) (MAXLIST (CDR LST))))
(NUMBERP (CAR LST)))
(NOT (LESSP (CAR LST)
(MAXLIST (CONS (CAR LST)
(DELETE1 A (CDR LST))))))),
which again simplifies, applying CAR-CONS and CDR-CONS, and unfolding the
functions MAX and MAXLIST, to the following three new goals:
Case 3.5.3.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (EQUAL A (CAR LST)))
(NOT (LESSP (CAR LST) (MAXLIST (CDR LST))))
(NUMBERP (CAR LST))
(LISTP (DELETE1 A (CDR LST))))
(NOT (LESSP (CAR LST)
(MAXLIST (DELETE1 A (CDR LST)))))).
But this again simplifies, using linear arithmetic, to:
T.
Case 3.5.2.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (EQUAL A (CAR LST)))
(NOT (LESSP (CAR LST) (MAXLIST (CDR LST))))
(NUMBERP (CAR LST))
(NOT (LESSP (CAR LST)
(MAXLIST (DELETE1 A (CDR LST))))))
(NOT (LESSP (CAR LST) (CAR LST)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.5.1.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (EQUAL A (CAR LST)))
(NOT (LESSP (CAR LST) (MAXLIST (CDR LST))))
(NUMBERP (CAR LST))
(NOT (LISTP (DELETE1 A (CDR LST)))))
(NOT (LESSP (CAR LST) (CAR LST)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.4.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (EQUAL A (CAR LST)))
(NOT (LESSP (CAR LST) (MAXLIST (CDR LST))))
(NOT (NUMBERP (CAR LST))))
(NOT (LESSP 0
(MAXLIST (CONS (CAR LST)
(DELETE1 A (CDR LST))))))),
which again simplifies, applying the lemmas CAR-CONS and CDR-CONS, and
unfolding LESSP, MAX, MAXLIST, and EQUAL, to the goal:
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (EQUAL A (CAR LST)))
(EQUAL (MAXLIST (CDR LST)) 0)
(NOT (NUMBERP (CAR LST)))
(LISTP (DELETE1 A (CDR LST))))
(EQUAL (MAXLIST (DELETE1 A (CDR LST)))
0)).
But this again simplifies, using linear arithmetic, to:
T.
Case 3.3.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (EQUAL A (CAR LST)))
(LESSP (CAR LST) (MAXLIST (CDR LST))))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (CONS (CAR LST)
(DELETE1 A (CDR LST))))))),
which again simplifies, applying CAR-CONS and CDR-CONS, and expanding MAX
and MAXLIST, to the following four new conjectures:
Case 3.3.4.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (EQUAL A (CAR LST)))
(LESSP (CAR LST) (MAXLIST (CDR LST)))
(NOT (LESSP (CAR LST)
(MAXLIST (DELETE1 A (CDR LST)))))
(NUMBERP (CAR LST)))
(NOT (LESSP (MAXLIST (CDR LST))
(CAR LST)))).
This again simplifies, using linear arithmetic, to:
T.
Case 3.3.3.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (EQUAL A (CAR LST)))
(LESSP (CAR LST) (MAXLIST (CDR LST)))
(NOT (LESSP (CAR LST)
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (NUMBERP (CAR LST))))
(NOT (LESSP (MAXLIST (CDR LST)) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.3.2.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (EQUAL A (CAR LST)))
(LESSP (CAR LST) (MAXLIST (CDR LST)))
(NOT (LISTP (DELETE1 A (CDR LST))))
(NOT (NUMBERP (CAR LST))))
(NOT (LESSP (MAXLIST (CDR LST)) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.3.1.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(NOT (EQUAL A (CAR LST)))
(LESSP (CAR LST) (MAXLIST (CDR LST)))
(NOT (LISTP (DELETE1 A (CDR LST))))
(NUMBERP (CAR LST)))
(NOT (LESSP (MAXLIST (CDR LST))
(CAR LST)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(EQUAL A (CAR LST))
(NOT (LESSP (CAR LST) (MAXLIST (CDR LST))))
(NOT (NUMBERP (CAR LST))))
(NOT (LESSP 0 (MAXLIST (CDR LST))))),
which again simplifies, unfolding the definition of LESSP, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP LST)
(LISTP (CDR LST))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (DELETE1 A (CDR LST)))))
(EQUAL A (CAR LST))
(LESSP (CAR LST) (MAXLIST (CDR LST))))
(NOT (LESSP (MAXLIST (CDR LST))
(MAXLIST (CDR LST))))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST))))
(NOT (LESSP (MAXLIST LST)
(MAXLIST (DELETE1 A LST))))),
which simplifies, expanding MAXLIST and DELETE1, to four new conjectures:
Case 2.4.
(IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST)))
(NOT (EQUAL A (CAR LST)))
(NOT (NUMBERP (CAR LST))))
(NOT (LESSP 0
(MAXLIST (CONS (CAR LST)
(DELETE1 A (CDR LST))))))),
which again simplifies, applying the lemmas CAR-CONS and CDR-CONS, and
expanding MAX, LESSP, MAXLIST, and EQUAL, to:
(IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST)))
(NOT (EQUAL A (CAR LST)))
(NOT (NUMBERP (CAR LST)))
(LISTP (DELETE1 A (CDR LST))))
(EQUAL (MAXLIST (DELETE1 A (CDR LST)))
0)).
This further simplifies, unfolding DELETE1, to:
T.
Case 2.3.
(IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST)))
(NOT (EQUAL A (CAR LST)))
(NUMBERP (CAR LST)))
(NOT (LESSP (CAR LST)
(MAXLIST (CONS (CAR LST)
(DELETE1 A (CDR LST))))))),
which again simplifies, rewriting with CAR-CONS and CDR-CONS, and opening
up the definitions of MAX and MAXLIST, to the following three new formulas:
Case 2.3.3.
(IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST)))
(NOT (EQUAL A (CAR LST)))
(NUMBERP (CAR LST))
(LISTP (DELETE1 A (CDR LST))))
(NOT (LESSP (CAR LST)
(MAXLIST (DELETE1 A (CDR LST)))))).
However this further simplifies, expanding the function DELETE1, to:
T.
Case 2.3.2.
(IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST)))
(NOT (EQUAL A (CAR LST)))
(NUMBERP (CAR LST))
(NOT (LESSP (CAR LST)
(MAXLIST (DELETE1 A (CDR LST))))))
(NOT (LESSP (CAR LST) (CAR LST)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.3.1.
(IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST)))
(NOT (EQUAL A (CAR LST)))
(NUMBERP (CAR LST))
(NOT (LISTP (DELETE1 A (CDR LST)))))
(NOT (LESSP (CAR LST) (CAR LST)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST)))
(EQUAL A (CAR LST))
(NOT (NUMBERP (CAR LST))))
(NOT (LESSP 0 (MAXLIST (CDR LST))))),
which again simplifies, unfolding the definitions of EQUAL and LESSP, to:
(IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST)))
(NOT (NUMBERP (CAR LST))))
(EQUAL (MAXLIST (CDR LST)) 0)).
But this further simplifies, opening up MAXLIST and EQUAL, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST)))
(EQUAL A (CAR LST))
(NUMBERP (CAR LST)))
(NOT (LESSP (CAR LST)
(MAXLIST (CDR LST))))),
which again simplifies, clearly, to the new conjecture:
(IMPLIES (AND (LISTP LST)
(NOT (LISTP (CDR LST)))
(NUMBERP (CAR LST)))
(NOT (LESSP (CAR LST)
(MAXLIST (CDR LST))))),
which further simplifies, opening up MAXLIST, EQUAL, and LESSP, to:
T.
Case 1. (IMPLIES (NOT (LISTP LST))
(NOT (LESSP (MAXLIST LST)
(MAXLIST (DELETE1 A LST))))),
which simplifies, expanding the definitions of MAXLIST, DELETE1, and LESSP,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
MAXLIST-DELETE1-LEQ
(PROVE-LEMMA MEMBER-IMPLIES-MAXLIST-GEQ
(REWRITE)
(IMPLIES (MEMBER A X)
(NOT (LESSP (MAXLIST X) A))))
WARNING: When the linear lemma MEMBER-IMPLIES-MAXLIST-GEQ is stored under
(MAXLIST X) it contains the free variable A which will be chosen by
instantiating the hypothesis (MEMBER A X).
WARNING: Note that the proposed lemma MEMBER-IMPLIES-MAXLIST-GEQ is to be
stored as zero type prescription rules, zero compound recognizer rules, one
linear rule, and zero replacement rules.
Name the conjecture *1.
We will appeal to induction. The recursive terms in the conjecture
suggest three inductions. They merge into two likely candidate inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (NLISTP X) (p X A))
(IMPLIES (AND (NOT (NLISTP X))
(EQUAL A (CAR X)))
(p X A))
(IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL A (CAR X)))
(p (CDR X) A))
(p X A))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP inform us that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme produces the following four new formulas:
Case 4. (IMPLIES (AND (NLISTP X) (MEMBER A X))
(NOT (LESSP (MAXLIST X) A))).
This simplifies, applying MEMBER-NON-LIST, and expanding NLISTP, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP X))
(EQUAL A (CAR X))
(MEMBER A X))
(NOT (LESSP (MAXLIST X) A))),
which simplifies, expanding the definitions of NLISTP, MEMBER, MAXLIST, and
MAX, to five new goals:
Case 3.5.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X)))
(NOT (LESSP (CAR X) (CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.4.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(NOT (LESSP (CAR X) (CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.3.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP 0 (CAR X)))),
which again simplifies, opening up LESSP, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP 0 (CAR X)))),
which again simplifies, unfolding the function LESSP, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (LESSP (MAXLIST (CDR X)) (CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL A (CAR X)))
(NOT (MEMBER A (CDR X)))
(MEMBER A X))
(NOT (LESSP (MAXLIST X) A))),
which simplifies, expanding NLISTP and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (MAXLIST (CDR X)) A))
(MEMBER A X))
(NOT (LESSP (MAXLIST X) A))),
which simplifies, expanding the functions NLISTP, MEMBER, MAXLIST, and MAX,
to four new goals:
Case 1.4.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (MAXLIST (CDR X)) A))
(MEMBER A (CDR X))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X)))
(NOT (LESSP (CAR X) A))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.3.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (MAXLIST (CDR X)) A))
(MEMBER A (CDR X))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP 0 A))),
which again simplifies, expanding the functions LESSP and EQUAL, to:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (MAXLIST (CDR X)) A))
(MEMBER A (CDR X))
(EQUAL (MAXLIST (CDR X)) 0)
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL A 0)))
(NOT (NUMBERP A))).
But this again simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (MAXLIST (CDR X)) A))
(MEMBER A (CDR X))
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP 0 A))),
which again simplifies, opening up the functions EQUAL and LESSP, to the
goal:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (MAXLIST (CDR X)) A))
(MEMBER A (CDR X))
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL A 0)))
(NOT (NUMBERP A))).
This again simplifies, clearly, to:
(IMPLIES (AND (LISTP X)
(NOT (LESSP (MAXLIST (CDR X)) A))
(MEMBER A (CDR X))
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL A 0)))
(NOT (NUMBERP A))),
which further simplifies, opening up the definitions of MAXLIST, EQUAL,
and LESSP, to:
T.
Case 1.1.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (MAXLIST (CDR X)) A))
(MEMBER A (CDR X))
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(NOT (LESSP (CAR X) A))),
which further simplifies, applying the lemma MEMBER-NON-LIST, and
expanding the functions MAXLIST, EQUAL, and LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MEMBER-IMPLIES-MAXLIST-GEQ
(PROVE-LEMMA DELETE1-PRESERVES-MAXLIST-WHEN-MAXLIST-OCCURS-MORE-THAN-ONCE
(REWRITE)
(IMPLIES (LESSP 1 (OCCURRENCES (MAXLIST X) X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT X))
(MAXLIST X))))
Give the conjecture the name *1.
Perhaps we can prove it by induction. The recursive terms in the
conjecture suggest four inductions. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(EQUAL (MAXLIST X) (CAR X))
(p ANY-ELEMENT (CDR X)))
(p ANY-ELEMENT X))
(IMPLIES (AND (LISTP X)
(NOT (EQUAL (MAXLIST X) (CAR X)))
(p ANY-ELEMENT (CDR X)))
(p ANY-ELEMENT X))
(IMPLIES (NOT (LISTP X))
(p ANY-ELEMENT X))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme leads to the following five new
conjectures:
Case 5. (IMPLIES (AND (LISTP X)
(EQUAL (MAXLIST X) (CAR X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT X))
(MAXLIST X))).
This simplifies, appealing to the lemmas SUB1-ADD1, EQUAL-OCCURRENCES-ZERO,
and MEMBER-NON-LIST, and unfolding MAXLIST, MAX, OCCURRENCES, SUB1, NUMBERP,
EQUAL, LESSP, DELETE1, and ADD1, to the following nine new goals:
Case 5.9.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(EQUAL (MAXLIST (CDR X)) (CAR X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(MEMBER (CAR X) (CDR X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
(CAR X))).
This again simplifies, using linear arithmetic, to:
T.
Case 5.8.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(EQUAL 0 (CAR X))
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT 0)))
(EQUAL (MAXLIST (CONS 0
(DELETE1 ANY-ELEMENT (CDR X))))
0)),
which again simplifies, applying CAR-CONS and CDR-CONS, and expanding MAX,
EQUAL, LESSP, NUMBERP, and MAXLIST, to the new conjecture:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(EQUAL 0 (CAR X))
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT 0))
(LISTP (DELETE1 ANY-ELEMENT (CDR X))))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
0)),
which further simplifies, expanding the function DELETE1, to:
T.
Case 5.7.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(EQUAL 0 (CAR X))
(LESSP 1 (OCCURRENCES 0 X))
(EQUAL ANY-ELEMENT 0))
(EQUAL (MAXLIST (CDR X)) 0)),
which again simplifies, clearly, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(EQUAL 0 (CAR X))
(LESSP 1 (OCCURRENCES 0 X)))
(EQUAL (MAXLIST (CDR X)) 0)),
which further simplifies, opening up the functions MAXLIST and EQUAL, to:
T.
Case 5.6.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(EQUAL 0 (CAR X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(EQUAL (MAXLIST (CDR X)) 0)
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT 0)))
(EQUAL (MAXLIST (CONS 0
(DELETE1 ANY-ELEMENT (CDR X))))
0)),
which again simplifies, applying CAR-CONS and CDR-CONS, and unfolding the
definitions of LESSP, MAX, EQUAL, NUMBERP, and MAXLIST, to the new
conjecture:
(IMPLIES (AND (LISTP X)
(EQUAL 0 (CAR X))
(NOT (LESSP 1 (OCCURRENCES 0 (CDR X))))
(EQUAL (MAXLIST (CDR X)) 0)
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT 0))
(LISTP (DELETE1 ANY-ELEMENT (CDR X))))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
0)),
which again simplifies, using linear arithmetic and applying
MAXLIST-DELETE1-LEQ, to:
T.
Case 5.5.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(EQUAL 0 (CAR X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(NOT (LISTP (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT 0)))
(EQUAL (MAXLIST (CONS 0
(DELETE1 ANY-ELEMENT (CDR X))))
0)).
However this again simplifies, applying EQUAL-OCCURRENCES-ZERO,
MEMBER-NON-LIST, CAR-CONS, and CDR-CONS, and opening up the definitions of
EQUAL, LESSP, MAX, NUMBERP, and MAXLIST, to the new conjecture:
(IMPLIES (AND (LISTP X)
(EQUAL (MAXLIST (CDR X)) 0)
(EQUAL 0 (CAR X))
(NOT (LISTP (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT 0))
(LISTP (DELETE1 ANY-ELEMENT (CDR X))))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
0)),
which again simplifies, using linear arithmetic and rewriting with
MAXLIST-DELETE1-LEQ, to:
T.
Case 5.4.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(EQUAL 0 (CAR X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(NOT (LISTP (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(EQUAL ANY-ELEMENT 0))
(EQUAL (MAXLIST (CDR X)) 0)).
But this again simplifies, using linear arithmetic, to:
T.
Case 5.3.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(EQUAL 0 (CAR X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(LISTP (CDR X))
(NOT (EQUAL (MAXLIST (CDR X)) 0))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X)) X))
(NOT (EQUAL ANY-ELEMENT 0)))
(EQUAL (MAXLIST (CONS 0
(DELETE1 ANY-ELEMENT (CDR X))))
(MAXLIST (CDR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 5.2.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(MEMBER (CAR X) (CDR X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
(CAR X))),
which again simplifies, using linear arithmetic and rewriting with
MEMBER-IMPLIES-MAXLIST-GEQ, to the new goal:
(IMPLIES (AND (EQUAL (MAXLIST (CDR X)) (CAR X))
(LISTP X)
(NOT (LESSP (CAR X) (CAR X)))
(NUMBERP (CAR X))
(NOT (LESSP 1
(OCCURRENCES (CAR X) (CDR X))))
(MEMBER (CAR X) (CDR X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
(CAR X))),
which again simplifies, rewriting with CAR-CONS and CDR-CONS, and
expanding the functions MAX and MAXLIST, to:
(IMPLIES (AND (EQUAL (MAXLIST (CDR X)) (CAR X))
(LISTP X)
(NOT (LESSP (CAR X) (CAR X)))
(NOT (LESSP 1
(OCCURRENCES (CAR X) (CDR X))))
(MEMBER (CAR X) (CDR X))
(NOT (EQUAL ANY-ELEMENT (CAR X)))
(LISTP (DELETE1 ANY-ELEMENT (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(CAR X))),
which again simplifies, using linear arithmetic and applying the lemma
MAXLIST-DELETE1-LEQ, to:
T.
Case 5.1.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(MEMBER (CAR X) (CDR X))
(EQUAL ANY-ELEMENT (CAR X)))
(EQUAL (MAXLIST (CDR X)) (CAR X))),
which again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-MAXLIST-GEQ, to:
T.
Case 4. (IMPLIES (AND (LISTP X)
(EQUAL (MAXLIST X) (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT X))
(MAXLIST X))).
This simplifies, rewriting with the lemmas SUB1-ADD1 and
EQUAL-OCCURRENCES-ZERO, and unfolding the definitions of MAXLIST, MAX,
OCCURRENCES, SUB1, NUMBERP, EQUAL, LESSP, DELETE1, and ADD1, to the
following nine new goals:
Case 4.9.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(EQUAL (MAXLIST (CDR X)) (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(CAR X))
(MEMBER (CAR X) (CDR X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
(CAR X))).
This again simplifies, using linear arithmetic, to:
T.
Case 4.8.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(EQUAL 0 (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT 0)))
(EQUAL (MAXLIST (CONS 0
(DELETE1 ANY-ELEMENT (CDR X))))
0)),
which again simplifies, applying the lemmas CAR-CONS and CDR-CONS, and
opening up the definitions of MAX, EQUAL, LESSP, NUMBERP, and MAXLIST, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(EQUAL 0 (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT 0))
(LISTP (DELETE1 ANY-ELEMENT (CDR X))))
(EQUAL (MAXLIST (CDR X)) 0)).
However this further simplifies, opening up the definitions of DELETE1,
MAXLIST, and EQUAL, to:
T.
Case 4.7.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(EQUAL 0 (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(EQUAL ANY-ELEMENT 0))
(EQUAL (MAXLIST (CDR X)) 0)),
which again simplifies, unfolding the functions DELETE1 and MAXLIST, to:
T.
Case 4.6.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(EQUAL 0 (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(EQUAL (MAXLIST (CDR X)) 0)
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT 0)))
(EQUAL (MAXLIST (CONS 0
(DELETE1 ANY-ELEMENT (CDR X))))
0)),
which again simplifies, rewriting with the lemmas CAR-CONS and CDR-CONS,
and expanding the functions LESSP, NUMBERP, MAX, MAXLIST, and EQUAL, to:
T.
Case 4.5.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(EQUAL 0 (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(NOT (LISTP (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT 0)))
(EQUAL (MAXLIST (CONS 0
(DELETE1 ANY-ELEMENT (CDR X))))
0)),
which again simplifies, rewriting with the lemmas CAR-CONS and CDR-CONS,
and expanding the definitions of EQUAL, LESSP, NUMBERP, MAX, and MAXLIST,
to:
T.
Case 4.4.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(EQUAL 0 (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(NOT (LISTP (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(EQUAL ANY-ELEMENT 0))
(EQUAL (MAXLIST (CDR X)) 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 4.3.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(EQUAL 0 (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(LISTP (CDR X))
(NOT (EQUAL (MAXLIST (CDR X)) 0))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X)) X))
(NOT (EQUAL ANY-ELEMENT 0)))
(EQUAL (MAXLIST (CONS 0
(DELETE1 ANY-ELEMENT (CDR X))))
(MAXLIST (CDR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 4.2.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(MEMBER (CAR X) (CDR X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
(CAR X))),
which again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-MAXLIST-GEQ, to:
(IMPLIES (AND (EQUAL (MAXLIST (CDR X)) (CAR X))
(LISTP X)
(NOT (LESSP (CAR X) (CAR X)))
(NUMBERP (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(CAR X))
(MEMBER (CAR X) (CDR X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
(CAR X))),
which again simplifies, rewriting with CAR-CONS and CDR-CONS, and
expanding the definitions of MAX and MAXLIST, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(MEMBER (CAR X) (CDR X))
(EQUAL ANY-ELEMENT (CAR X)))
(EQUAL (MAXLIST (CDR X)) (CAR X))).
However this again simplifies, using linear arithmetic and rewriting with
MEMBER-IMPLIES-MAXLIST-GEQ, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(NOT (EQUAL (MAXLIST X) (CAR X)))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT X))
(MAXLIST X))).
This simplifies, appealing to the lemmas EQUAL-OCCURRENCES-ZERO and
MEMBER-NON-LIST, and expanding MAXLIST, MAX, LESSP, DELETE1, EQUAL, MEMBER,
and OCCURRENCES, to the following four new conjectures:
Case 3.4.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (CAR X)))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(EQUAL (MAXLIST (CDR X)) 0)
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
0)).
However this again simplifies, appealing to the lemmas CAR-CONS and
CDR-CONS, and opening up the definitions of EQUAL, LESSP, MAX, and MAXLIST,
to:
(IMPLIES (AND (LISTP X)
(NOT (NUMBERP (CAR X)))
(NOT (LESSP 1 (OCCURRENCES 0 (CDR X))))
(EQUAL (MAXLIST (CDR X)) 0)
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT (CAR X)))
(LISTP (DELETE1 ANY-ELEMENT (CDR X))))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
0)).
This again simplifies, using linear arithmetic and rewriting with
MAXLIST-DELETE1-LEQ, to:
T.
Case 3.3.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (CAR X)))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(NOT (LISTP (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
0)).
This again simplifies, applying the lemmas EQUAL-OCCURRENCES-ZERO and
MEMBER-NON-LIST, and opening up the functions LESSP and MEMBER, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (CAR X)))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(NOT (LISTP (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(EQUAL ANY-ELEMENT (CAR X)))
(EQUAL (MAXLIST (CDR X)) 0)),
which again simplifies, opening up the function LESSP, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (CAR X)))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X))))
(LISTP (CDR X))
(NOT (EQUAL (MAXLIST (CDR X)) 0))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X)) X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
(MAXLIST (CDR X)))),
which again simplifies, unfolding LESSP, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (EQUAL (MAXLIST X) (CAR X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT X))
(MAXLIST X))),
which simplifies, applying EQUAL-OCCURRENCES-ZERO and MEMBER-NON-LIST, and
unfolding the definitions of MAXLIST, MAX, LESSP, DELETE1, EQUAL, MEMBER,
and OCCURRENCES, to the following five new conjectures:
Case 2.5.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (CAR X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(EQUAL (MAXLIST (CDR X)) 0)
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
0)).
But this again simplifies, appealing to the lemmas CAR-CONS and CDR-CONS,
and unfolding the definitions of EQUAL, LESSP, MAX, and MAXLIST, to:
T.
Case 2.4.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (CAR X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(NOT (LISTP (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
0)),
which again simplifies, rewriting with the lemmas EQUAL-OCCURRENCES-ZERO
and MEMBER-NON-LIST, and unfolding the definitions of LESSP and MEMBER, to:
T.
Case 2.3.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (CAR X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(NOT (LISTP (CDR X)))
(LESSP 1 (OCCURRENCES 0 X))
(EQUAL ANY-ELEMENT (CAR X)))
(EQUAL (MAXLIST (CDR X)) 0)),
which again simplifies, expanding LESSP, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP X)
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (CAR X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(LISTP (CDR X))
(NOT (EQUAL (MAXLIST (CDR X)) 0))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X)) X))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
(MAXLIST (CDR X)))),
which again simplifies, expanding the definition of LESSP, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (EQUAL (MAXLIST (CDR X)) (CAR X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X)))
(NOT (EQUAL ANY-ELEMENT (CAR X))))
(EQUAL (MAXLIST (CONS (CAR X)
(DELETE1 ANY-ELEMENT (CDR X))))
(MAXLIST (CDR X)))),
which again simplifies, applying CAR-CONS and CDR-CONS, and unfolding MAX
and MAXLIST, to the following two new goals:
Case 2.1.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (EQUAL (MAXLIST (CDR X)) (CAR X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X)))
(NOT (EQUAL ANY-ELEMENT (CAR X)))
(NOT (LISTP (DELETE1 ANY-ELEMENT (CDR X)))))
(EQUAL 0 (MAXLIST (CDR X)))).
But this again simplifies, expanding MAXLIST, to:
T.
Case 2.1.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (EQUAL (MAXLIST (CDR X)) (CAR X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT (CDR X)))
(MAXLIST (CDR X)))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X)))
(NOT (EQUAL ANY-ELEMENT (CAR X)))
(NOT (LISTP (DELETE1 ANY-ELEMENT (CDR X)))))
(NOT (NUMBERP (CAR X)))),
which again simplifies, opening up MAXLIST, to:
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (EQUAL (MAXLIST (CDR X)) (CAR X)))
(EQUAL 0 (MAXLIST (CDR X)))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X)))
(NOT (EQUAL ANY-ELEMENT (CAR X)))
(NOT (LISTP (DELETE1 ANY-ELEMENT (CDR X)))))
(NOT (NUMBERP (CAR X)))).
This again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(EQUAL (MAXLIST (DELETE1 ANY-ELEMENT X))
(MAXLIST X))),
which simplifies, unfolding the definitions of MAXLIST, OCCURRENCES, and
LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
DELETE1-PRESERVES-MAXLIST-WHEN-MAXLIST-OCCURS-MORE-THAN-ONCE
(PROVE-LEMMA DELETE1-OCCURRENCES
(REWRITE)
(EQUAL (OCCURRENCES A (DELETE1 B X))
(IF (AND (EQUAL A B) (MEMBER B X))
(SUB1 (OCCURRENCES A X))
(OCCURRENCES A X))))
This conjecture simplifies, opening up AND, to three new goals:
Case 3. (IMPLIES (NOT (EQUAL A B))
(EQUAL (OCCURRENCES A (DELETE1 B X))
(OCCURRENCES A X))),
which we will name *1.
Case 2. (IMPLIES (NOT (MEMBER B X))
(EQUAL (OCCURRENCES A (DELETE1 B X))
(OCCURRENCES A X))),
which we would usually push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us consider:
(EQUAL (OCCURRENCES A (DELETE1 B X))
(IF (AND (EQUAL A B) (MEMBER B X))
(SUB1 (OCCURRENCES A X))
(OCCURRENCES A X))),
which we named *1 above. We will appeal to induction. There are four
plausible inductions. However, they merge into one likely candidate induction.
We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X) (EQUAL B (CAR X)))
(p A B X))
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(p A B (CDR X)))
(p A B X))
(IMPLIES (NOT (LISTP X)) (p A B X))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme leads to the following three new
goals:
Case 3. (IMPLIES (AND (LISTP X) (EQUAL B (CAR X)))
(EQUAL (OCCURRENCES A (DELETE1 B X))
(IF (AND (EQUAL A B) (MEMBER B X))
(SUB1 (OCCURRENCES A X))
(OCCURRENCES A X)))).
This simplifies, rewriting with SUB1-ADD1, and unfolding the definitions of
DELETE1, MEMBER, AND, and OCCURRENCES, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(EQUAL (OCCURRENCES A (DELETE1 B (CDR X)))
(IF (AND (EQUAL A B) (MEMBER B (CDR X)))
(SUB1 (OCCURRENCES A (CDR X)))
(OCCURRENCES A (CDR X)))))
(EQUAL (OCCURRENCES A (DELETE1 B X))
(IF (AND (EQUAL A B) (MEMBER B X))
(SUB1 (OCCURRENCES A X))
(OCCURRENCES A X)))),
which simplifies, applying CDR-CONS and CAR-CONS, and opening up AND,
DELETE1, OCCURRENCES, and MEMBER, to the following three new goals:
Case 2.3.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(EQUAL A B)
(MEMBER B (CDR X))
(EQUAL (OCCURRENCES A (DELETE1 B (CDR X)))
(SUB1 (OCCURRENCES A (CDR X))))
(EQUAL A (CAR X)))
(EQUAL (OCCURRENCES A (CDR X))
(SUB1 (ADD1 (OCCURRENCES A (CDR X)))))).
This again simplifies, clearly, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(EQUAL A B)
(MEMBER B (CDR X))
(EQUAL (OCCURRENCES A (DELETE1 B (CDR X)))
(SUB1 (OCCURRENCES A (CDR X))))
(NOT (EQUAL A (CAR X)))
(NOT (MEMBER A (CDR X))))
(EQUAL (OCCURRENCES A
(CONS (CAR X) (DELETE1 A (CDR X))))
(OCCURRENCES A (CDR X)))).
This again simplifies, trivially, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(EQUAL A B)
(MEMBER B (CDR X))
(EQUAL (OCCURRENCES A (DELETE1 B (CDR X)))
(SUB1 (OCCURRENCES A (CDR X))))
(NOT (EQUAL A (CAR X)))
(MEMBER A (CDR X)))
(EQUAL (OCCURRENCES A
(CONS (CAR X) (DELETE1 A (CDR X))))
(SUB1 (OCCURRENCES A (CDR X))))).
This again simplifies, rewriting with CDR-CONS and CAR-CONS, and expanding
the function OCCURRENCES, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (OCCURRENCES A (DELETE1 B X))
(IF (AND (EQUAL A B) (MEMBER B X))
(SUB1 (OCCURRENCES A X))
(OCCURRENCES A X)))).
This simplifies, rewriting with MEMBER-NON-LIST, and unfolding DELETE1,
OCCURRENCES, AND, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
DELETE1-OCCURRENCES
(PROVE-LEMMA OCCURRENCE-IMPLIES-LISTP
(REWRITE)
(IMPLIES (LESSP 1 (OCCURRENCES A X))
(EQUAL (LISTP (DELETE1 A X)) T)))
Call the conjecture *1.
We will appeal to induction. There are two plausible inductions.
However, they merge into one likely candidate induction. We will induct
according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(EQUAL A (CAR X))
(p A (CDR X)))
(p A X))
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(p A (CDR X)))
(p A X))
(IMPLIES (NOT (LISTP X)) (p A X))).
Linear arithmetic and the lemma CDR-LESSP can be used to establish that the
measure (COUNT X) decreases according to the well-founded relation LESSP in
each induction step of the scheme. The above induction scheme generates five
new formulas:
Case 5. (IMPLIES (AND (LISTP X)
(EQUAL A (CAR X))
(NOT (LESSP 1 (OCCURRENCES A (CDR X))))
(LESSP 1 (OCCURRENCES A X)))
(LISTP (DELETE1 A X))),
which simplifies, applying SUB1-ADD1 and EQUAL-OCCURRENCES-ZERO, and
expanding the functions OCCURRENCES, SUB1, NUMBERP, EQUAL, LESSP, and
DELETE1, to:
(IMPLIES (AND (LISTP X)
(NOT (LESSP 1
(OCCURRENCES (CAR X) (CDR X))))
(MEMBER (CAR X) (CDR X)))
(LISTP (CDR X))),
which again simplifies, rewriting with MEMBER-NON-LIST, and expanding the
functions OCCURRENCES and LESSP, to:
T.
Case 4. (IMPLIES (AND (LISTP X)
(EQUAL A (CAR X))
(LISTP (DELETE1 A (CDR X)))
(LESSP 1 (OCCURRENCES A X)))
(LISTP (DELETE1 A X))).
This simplifies, applying SUB1-ADD1 and EQUAL-OCCURRENCES-ZERO, and
unfolding the definitions of OCCURRENCES, SUB1, NUMBERP, EQUAL, LESSP, and
DELETE1, to:
(IMPLIES (AND (LISTP X)
(LISTP (DELETE1 (CAR X) (CDR X)))
(MEMBER (CAR X) (CDR X)))
(LISTP (CDR X))).
But this again simplifies, opening up the function DELETE1, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(NOT (LESSP 1 (OCCURRENCES A (CDR X))))
(LESSP 1 (OCCURRENCES A X)))
(LISTP (DELETE1 A X))),
which simplifies, opening up the definition of OCCURRENCES, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(LISTP (DELETE1 A (CDR X)))
(LESSP 1 (OCCURRENCES A X)))
(LISTP (DELETE1 A X))),
which simplifies, expanding OCCURRENCES and DELETE1, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(LESSP 1 (OCCURRENCES A X)))
(LISTP (DELETE1 A X))),
which simplifies, opening up the functions OCCURRENCES and LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
OCCURRENCE-IMPLIES-LISTP
(PROVE-LEMMA MAXLIST-GEQ-MINLIST
(REWRITE)
(NOT (LESSP (MAXLIST X) (MINLIST X))))
WARNING: Note that the proposed lemma MAXLIST-GEQ-MINLIST is to be stored as
zero type prescription rules, zero compound recognizer rules, two linear rules,
and zero replacement rules.
Give the conjecture the name *1.
We will appeal to induction. Two inductions are suggested by terms in
the conjecture. However, they merge into one likely candidate induction. We
will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces the following three new
conjectures:
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (MAXLIST (CDR X))
(MINLIST (CDR X)))))
(NOT (LESSP (MAXLIST X) (MINLIST X)))).
This simplifies, expanding the functions MAXLIST, MAX, MINLIST, and MIN, to
the following five new conjectures:
Case 3.5.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (MAXLIST (CDR X))
(MINLIST (CDR X))))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP 0 (MINLIST (CDR X))))).
However this again simplifies, unfolding LESSP, to:
T.
Case 3.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (MAXLIST (CDR X))
(MINLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(NOT (LESSP (CAR X) (MAXLIST (CDR X)))))
(NOT (LESSP (CAR X) (CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (MAXLIST (CDR X))
(MINLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (LESSP (MAXLIST (CDR X)) (CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (MAXLIST (CDR X))
(MINLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X)))))
(NOT (LESSP 0 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (MAXLIST (CDR X))
(MINLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (LESSP (MAXLIST (CDR X)) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(NOT (LESSP (MAXLIST X) (MINLIST X)))),
which simplifies, unfolding the functions MAXLIST and MINLIST, to two new
goals:
Case 2.2.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP 0 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(NOT (LESSP (CAR X) (CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(NOT (LESSP (MAXLIST X) (MINLIST X)))),
which simplifies, unfolding MAXLIST, MINLIST, and LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MAXLIST-GEQ-MINLIST
(PROVE-LEMMA INDUCTION-FN-HELP-2-MAX-OCCURS-TWICE-LEMMA-1
(REWRITE)
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(EQUAL (MAXLIST (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(MAXLIST X))))
WARNING: Note that INDUCTION-FN-HELP-2-MAX-OCCURS-TWICE-LEMMA-1 contains the
free variable K which will be chosen by instantiating the hypothesis:
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X))).
This conjecture simplifies, using linear arithmetic, applying the lemmas
CAR-CONS, CDR-CONS, SUB1-ADD1, OCCURRENCE-IMPLIES-LISTP, DELETE1-OCCURRENCES,
and DELETE1-PRESERVES-MAXLIST-WHEN-MAXLIST-OCCURS-MORE-THAN-ONCE, and
expanding the definitions of MAX, MAXLIST, and LESSP, to the following five
new formulas:
Case 5. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(EQUAL (MAXLIST X) 0)
(NOT (LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))))
(EQUAL (SUB1 (MAXLIST X))
(MAXLIST X))).
However this again simplifies, using linear arithmetic and applying
MAXLIST-GEQ-MINLIST, to:
T.
Case 4. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(NOT (LESSP (MINLIST X)
(SUB1 (MAXLIST X))))
(NOT (LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))))
(EQUAL (SUB1 (MAXLIST X))
(MAXLIST X))).
However this again simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(NOT (LESSP (MINLIST X)
(SUB1 (MAXLIST X))))
(NOT (LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))))
(EQUAL (SUB1 (MAXLIST X))
(MAXLIST X))).
This again simplifies, using linear arithmetic and appealing to the lemma
MAXLIST-GEQ-MINLIST, to:
T.
Case 3. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(NOT (EQUAL (MAXLIST X) 0))
(LESSP (MINLIST X) (SUB1 (MAXLIST X)))
(NOT (LESSP (SUB1 (MAXLIST X))
(MAXLIST X))))
(EQUAL (SUB1 (MAXLIST X))
(MAXLIST X))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(EQUAL (MAXLIST X) 0)
(LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X))))
(EQUAL (ADD1 (MINLIST X))
(MAXLIST X))),
which again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 1. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(NOT (LESSP (MINLIST X)
(SUB1 (MAXLIST X))))
(LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X))))
(EQUAL (ADD1 (MINLIST X))
(MAXLIST X))).
But this again simplifies, using linear arithmetic and applying
MAXLIST-GEQ-MINLIST, to:
T.
Q.E.D.
[ 0.0 0.4 0.0 ]
INDUCTION-FN-HELP-2-MAX-OCCURS-TWICE-LEMMA-1
(PROVE-LEMMA MEMBER-DELETE1
(REWRITE)
(EQUAL (MEMBER A (DELETE1 B C))
(IF (EQUAL A B)
(LESSP 1 (OCCURRENCES B C))
(MEMBER A C))))
This conjecture simplifies, clearly, to two new conjectures:
Case 2. (IMPLIES (NOT (EQUAL A B))
(EQUAL (MEMBER A (DELETE1 B C))
(MEMBER A C))),
which we will name *1.
Case 1. (IMPLIES (EQUAL A B)
(EQUAL (MEMBER A (DELETE1 B C))
(LESSP 1 (OCCURRENCES A C)))).
This again simplifies, clearly, to the new conjecture:
(EQUAL (MEMBER B (DELETE1 B C))
(LESSP 1 (OCCURRENCES B C))),
which we would normally push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us return to:
(EQUAL (MEMBER A (DELETE1 B C))
(IF (EQUAL A B)
(LESSP 1 (OCCURRENCES B C))
(MEMBER A C))),
named *1. Let us appeal to the induction principle. The recursive terms in
the conjecture suggest three inductions. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP C)
(EQUAL B (CAR C))
(p A B (CDR C)))
(p A B C))
(IMPLIES (AND (LISTP C)
(NOT (EQUAL B (CAR C)))
(p A B (CDR C)))
(p A B C))
(IMPLIES (NOT (LISTP C)) (p A B C))).
Linear arithmetic and the lemma CDR-LESSP can be used to show that the measure
(COUNT C) decreases according to the well-founded relation LESSP in each
induction step of the scheme. The above induction scheme produces the
following three new goals:
Case 3. (IMPLIES (AND (LISTP C)
(EQUAL B (CAR C))
(EQUAL (MEMBER A (DELETE1 B (CDR C)))
(IF (EQUAL A B)
(LESSP 1 (OCCURRENCES B (CDR C)))
(MEMBER A (CDR C)))))
(EQUAL (MEMBER A (DELETE1 B C))
(IF (EQUAL A B)
(LESSP 1 (OCCURRENCES B C))
(MEMBER A C)))).
This simplifies, rewriting with SUB1-ADD1 and EQUAL-OCCURRENCES-ZERO, and
opening up the functions DELETE1, MEMBER, OCCURRENCES, SUB1, NUMBERP, EQUAL,
and LESSP, to:
T.
Case 2. (IMPLIES (AND (LISTP C)
(NOT (EQUAL B (CAR C)))
(EQUAL (MEMBER A (DELETE1 B (CDR C)))
(IF (EQUAL A B)
(LESSP 1 (OCCURRENCES B (CDR C)))
(MEMBER A (CDR C)))))
(EQUAL (MEMBER A (DELETE1 B C))
(IF (EQUAL A B)
(LESSP 1 (OCCURRENCES B C))
(MEMBER A C)))),
which simplifies, applying CDR-CONS and CAR-CONS, and unfolding the
definitions of DELETE1, MEMBER, and OCCURRENCES, to the following two new
formulas:
Case 2.2.
(IMPLIES (AND (LISTP C)
(NOT (EQUAL B (CAR C)))
(EQUAL A B)
(EQUAL (MEMBER A (DELETE1 B (CDR C)))
(LESSP 1 (OCCURRENCES B (CDR C))))
(NOT (EQUAL A (CAR C))))
(EQUAL (MEMBER A
(CONS (CAR C) (DELETE1 A (CDR C))))
(LESSP 1 (OCCURRENCES A (CDR C))))).
However this again simplifies, rewriting with CDR-CONS and CAR-CONS, and
unfolding MEMBER, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP C)
(NOT (EQUAL B (CAR C)))
(EQUAL A B)
(EQUAL (MEMBER A (DELETE1 B (CDR C)))
(LESSP 1 (OCCURRENCES B (CDR C))))
(EQUAL A (CAR C)))
(EQUAL (MEMBER A (CDR C))
(LESSP 1
(ADD1 (OCCURRENCES A (CDR C)))))).
This again simplifies, clearly, to:
T.
Case 1. (IMPLIES (NOT (LISTP C))
(EQUAL (MEMBER A (DELETE1 B C))
(IF (EQUAL A B)
(LESSP 1 (OCCURRENCES B C))
(MEMBER A C)))).
This simplifies, rewriting with MEMBER-NON-LIST, and expanding DELETE1,
OCCURRENCES, LESSP, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MEMBER-DELETE1
(PROVE-LEMMA MEMBER-IMPLIES-LISTP
(REWRITE)
(IMPLIES (MEMBER A X) (LISTP X)))
WARNING: Note that MEMBER-IMPLIES-LISTP contains the free variable A which
will be chosen by instantiating the hypothesis (MEMBER A X).
This conjecture simplifies, rewriting with MEMBER-NON-LIST, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
MEMBER-IMPLIES-LISTP
(PROVE-LEMMA INDUCTION-FN-HELP-2-MAX-OCCURS-TWICE-LEMMA-2
(REWRITE)
(IMPLIES
(AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(EQUAL (LESSP (OCCURRENCES (MAXLIST X)
(CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(OCCURRENCES (MAXLIST X) X))
T)))
WARNING: Note that INDUCTION-FN-HELP-2-MAX-OCCURS-TWICE-LEMMA-2 contains the
free variable K which will be chosen by instantiating the hypothesis:
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X))).
This conjecture simplifies, rewriting with CDR-CONS, CAR-CONS, MEMBER-DELETE1,
and DELETE1-OCCURRENCES, and unfolding the function OCCURRENCES, to the
following eight new formulas:
Case 8. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(NOT (EQUAL (MAXLIST X)
(SUB1 (MAXLIST X))))
(EQUAL (MAXLIST X) (ADD1 (MINLIST X)))
(NOT (MEMBER (MAXLIST X) X)))
(LESSP (ADD1 (OCCURRENCES (MAXLIST X) X))
(OCCURRENCES (MAXLIST X) X))).
But this again simplifies, rewriting with EQUAL-OCCURRENCES-ZERO, and
opening up the definition of LESSP, to:
T.
Case 7. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(EQUAL (MAXLIST X) (SUB1 (MAXLIST X)))
(NOT (EQUAL (MAXLIST X)
(ADD1 (MINLIST X))))
(NOT (MEMBER (MAXLIST X) X)))
(LESSP (ADD1 (OCCURRENCES (MAXLIST X) X))
(OCCURRENCES (MAXLIST X) X))).
This again simplifies, using linear arithmetic, to the goal:
(IMPLIES (AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(EQUAL (MAXLIST X) (SUB1 (MAXLIST X)))
(NOT (EQUAL (MAXLIST X)
(ADD1 (MINLIST X))))
(NOT (MEMBER (MAXLIST X) X)))
(LESSP (ADD1 (OCCURRENCES (MAXLIST X) X))
(OCCURRENCES (MAXLIST X) X))).
But this again simplifies, using linear arithmetic and applying
MAXLIST-GEQ-MINLIST, to:
T.
Case 6. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(NOT (EQUAL (MAXLIST X)
(SUB1 (MAXLIST X))))
(EQUAL (MAXLIST X) (ADD1 (MINLIST X)))
(MEMBER (MAXLIST X) X))
(LESSP (ADD1 (SUB1 (OCCURRENCES (MAXLIST X) X)))
(OCCURRENCES (MAXLIST X) X))).
This again simplifies, using linear arithmetic and appealing to the lemmas
MINLIST-LESS-THAN-MAXLIST-MINUS-1 and MEMBER-IMPLIES-LISTP, to:
(IMPLIES (AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(NOT (EQUAL (MAXLIST X)
(SUB1 (MAXLIST X))))
(EQUAL (MAXLIST X) (ADD1 (MINLIST X)))
(MEMBER (MAXLIST X) X))
(LESSP (ADD1 (SUB1 (OCCURRENCES (MAXLIST X) X)))
(OCCURRENCES (MAXLIST X) X))).
However this again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(EQUAL (MAXLIST X) (SUB1 (MAXLIST X)))
(NOT (EQUAL (MAXLIST X)
(ADD1 (MINLIST X))))
(MEMBER (MAXLIST X) X))
(LESSP (ADD1 (SUB1 (OCCURRENCES (MAXLIST X) X)))
(OCCURRENCES (MAXLIST X) X))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(EQUAL (MAXLIST X) (SUB1 (MAXLIST X)))
(NOT (EQUAL (MAXLIST X)
(ADD1 (MINLIST X))))
(MEMBER (MAXLIST X) X))
(LESSP (ADD1 (SUB1 (OCCURRENCES (MAXLIST X) X)))
(OCCURRENCES (MAXLIST X) X))).
But this again simplifies, using linear arithmetic and appealing to the
lemma MAXLIST-GEQ-MINLIST, to:
T.
Case 4. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(NOT (EQUAL (MAXLIST X)
(SUB1 (MAXLIST X))))
(NOT (EQUAL (MAXLIST X)
(ADD1 (MINLIST X))))
(NOT (MEMBER (MAXLIST X) X)))
(LESSP (OCCURRENCES (MAXLIST X) X)
(OCCURRENCES (MAXLIST X) X))),
which again simplifies, rewriting with EQUAL-OCCURRENCES-ZERO, and opening
up the definition of LESSP, to:
T.
Case 3. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(NOT (EQUAL (MAXLIST X)
(SUB1 (MAXLIST X))))
(NOT (EQUAL (MAXLIST X)
(ADD1 (MINLIST X))))
(MEMBER (MAXLIST X) X))
(LESSP (SUB1 (OCCURRENCES (MAXLIST X) X))
(OCCURRENCES (MAXLIST X) X))).
However this again simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (OCCURRENCES (MAXLIST X) X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(NOT (EQUAL (MAXLIST X)
(SUB1 (MAXLIST X))))
(NOT (EQUAL (MAXLIST X)
(ADD1 (MINLIST X))))
(MEMBER (MAXLIST X) X))
(LESSP (SUB1 (OCCURRENCES (MAXLIST X) X))
(OCCURRENCES (MAXLIST X) X))).
However this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(EQUAL (MAXLIST X) (SUB1 (MAXLIST X)))
(EQUAL (MAXLIST X) (ADD1 (MINLIST X)))
(NOT (MEMBER (MAXLIST X) X)))
(LESSP (ADD1 (ADD1 (OCCURRENCES (MAXLIST X) X)))
(OCCURRENCES (MAXLIST X) X))),
which again simplifies, using linear arithmetic, to the formula:
(IMPLIES (AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(EQUAL (MAXLIST X) (SUB1 (MAXLIST X)))
(EQUAL (MAXLIST X) (ADD1 (MINLIST X)))
(NOT (MEMBER (MAXLIST X) X)))
(LESSP (ADD1 (ADD1 (OCCURRENCES (MAXLIST X) X)))
(OCCURRENCES (MAXLIST X) X))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(EQUAL (MAXLIST X) (SUB1 (MAXLIST X)))
(EQUAL (MAXLIST X) (ADD1 (MINLIST X)))
(MEMBER (MAXLIST X) X))
(LESSP (ADD1 (ADD1 (SUB1 (OCCURRENCES (MAXLIST X) X))))
(OCCURRENCES (MAXLIST X) X))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X))
(EQUAL (MAXLIST X) (SUB1 (MAXLIST X)))
(EQUAL (MAXLIST X) (ADD1 (MINLIST X)))
(MEMBER (MAXLIST X) X))
(LESSP (ADD1 (ADD1 (SUB1 (OCCURRENCES (MAXLIST X) X))))
(OCCURRENCES (MAXLIST X) X))).
But this again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
INDUCTION-FN-HELP-2-MAX-OCCURS-TWICE-LEMMA-2
(DISABLE MEMBER-IMPLIES-LISTP)
[ 0.0 0.0 0.0 ]
MEMBER-IMPLIES-LISTP-OFF
(PROVE-LEMMA INDUCTION-FN-HELP-2-MAX-OCCURS-TWICE NIL
(LET ((X0 (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(ORD-LESSP (CONS (ADD1 (MAXLIST X0))
(OCCURRENCES (MAXLIST X0) X0))
(CONS (ADD1 (MAXLIST X))
(OCCURRENCES (MAXLIST X) X)))))
((DISABLE-THEORY INDUCTION-FN-DISABLES)))
This formula simplifies, rewriting with
INDUCTION-FN-HELP-2-MAX-OCCURS-TWICE-LEMMA-1, CDR-CONS, CAR-CONS, SUB1-ADD1,
and INDUCTION-FN-HELP-2-MAX-OCCURS-TWICE-LEMMA-2, and unfolding the functions
ORD-LESSP and LESSP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
INDUCTION-FN-HELP-2-MAX-OCCURS-TWICE
(PROVE-LEMMA MAXLIST-NOT-MINLIST-IMPLIES-LISTP NIL
(IMPLIES (NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LISTP X)))
This formula simplifies, expanding the functions MINLIST, MAXLIST, and EQUAL,
to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
MAXLIST-NOT-MINLIST-IMPLIES-LISTP
(PROVE-LEMMA MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER
(REWRITE)
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (MINLIST X)
(SUB1 (MAXLIST X))))
((USE (MAXLIST-NOT-MINLIST-IMPLIES-LISTP))))
WARNING: When the linear lemma MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER is
stored under (MINLIST X) it contains the free variable K which will be chosen
by instantiating the hypothesis (EQUAL (SUMLIST X) (TIMES K (LENGTH X))).
WARNING: When the linear lemma MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER is
stored under (MAXLIST X) it contains the free variable K which will be chosen
by instantiating the hypothesis (EQUAL (SUMLIST X) (TIMES K (LENGTH X))).
WARNING: Note that the proposed lemma:
MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER
is to be stored as zero type prescription rules, zero compound recognizer
rules, two linear rules, and zero replacement rules.
This simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to the new conjecture:
(IMPLIES (AND (EQUAL (MAXLIST X)
(PLUS 1 (MINLIST X)))
(IMPLIES (NOT (EQUAL (MINLIST X)
(PLUS 1 (MINLIST X))))
(LISTP X))
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X)
(PLUS 1 (MINLIST X)))))
(LESSP (MINLIST X)
(SUB1 (PLUS 1 (MINLIST X))))),
which again simplifies, rewriting with PLUS-ADD1-ARG1 and SUB1-ADD1, and
unfolding the definitions of EQUAL, PLUS, NOT, IMPLIES, and LESSP, to the
following three new formulas:
Case 3. (IMPLIES (AND (EQUAL (MAXLIST X) (ADD1 (MINLIST X)))
(EQUAL (MINLIST X) (MAXLIST X))
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X))))
(NOT (EQUAL (MAXLIST X) 0))).
But this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (EQUAL (MAXLIST X) (ADD1 (MINLIST X)))
(EQUAL (MINLIST X) (MAXLIST X))
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X))))
(LESSP (SUB1 (MAXLIST X))
(SUB1 (MAXLIST X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (EQUAL (MAXLIST X) (ADD1 (MINLIST X)))
(LISTP X)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (MINLIST X)
(SUB1 (MAXLIST X)))),
which again simplifies, using linear arithmetic and rewriting with
MINLIST-LESS-THAN-MAXLIST-MINUS-1, to:
(IMPLIES (AND (EQUAL (MAXLIST X) 0)
(EQUAL (MAXLIST X) (ADD1 (MINLIST X)))
(LISTP X)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP (MINLIST X)
(SUB1 (MAXLIST X)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER
(DISABLE MINLIST-LESS-THAN-MAXLIST-MINUS-1)
[ 0.0 0.0 0.0 ]
MINLIST-LESS-THAN-MAXLIST-MINUS-1-OFF
(PROVE-LEMMA MAXLIST-DELETE1-DELETE1
(REWRITE)
(NOT (LESSP (MAXLIST (DELETE1 B X))
(MAXLIST (DELETE1 B (DELETE1 A X))))))
WARNING: Note that the proposed lemma MAXLIST-DELETE1-DELETE1 is to be stored
as zero type prescription rules, zero compound recognizer rules, one linear
rule, and zero replacement rules.
Call the conjecture *1.
We will try to prove it by induction. There are two plausible inductions.
However, they merge into one likely candidate induction. We will induct
according to the following scheme:
(AND (IMPLIES (AND (LISTP X) (EQUAL B (CAR X)))
(p B X A))
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(p B (CDR X) A))
(p B X A))
(IMPLIES (NOT (LISTP X)) (p B X A))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme generates three new goals:
Case 3. (IMPLIES (AND (LISTP X) (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B X))
(MAXLIST (DELETE1 B (DELETE1 A X)))))),
which simplifies, opening up the function DELETE1, to two new formulas:
Case 3.2.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL A (CAR X))))
(NOT (LESSP (MAXLIST (CDR X))
(MAXLIST (DELETE1 (CAR X)
(CONS (CAR X)
(DELETE1 A (CDR X)))))))),
which again simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS,
and expanding the function DELETE1, to the goal:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X))))
(NOT (LESSP (MAXLIST (CDR X))
(MAXLIST (DELETE1 A (CDR X)))))).
But this again simplifies, using linear arithmetic and applying
MAXLIST-DELETE1-LEQ, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X) (EQUAL A (CAR X)))
(NOT (LESSP (MAXLIST (CDR X))
(MAXLIST (DELETE1 (CAR X) (CDR X)))))).
However this again simplifies, using linear arithmetic and applying the
lemma MAXLIST-DELETE1-LEQ, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X)))))))
(NOT (LESSP (MAXLIST (DELETE1 B X))
(MAXLIST (DELETE1 B (DELETE1 A X)))))),
which simplifies, rewriting with CAR-CONS and CDR-CONS, and opening up the
functions DELETE1, MAX, and MAXLIST, to the following nine new goals:
Case 2.9.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(EQUAL A (CAR X))
(NOT (LISTP (DELETE1 B (CDR X))))
(NUMBERP (CAR X)))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))).
This again simplifies, opening up the definitions of MAXLIST, EQUAL, and
LESSP, to:
T.
Case 2.8.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP (CAR X)))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B
(CONS (CAR X)
(DELETE1 A (CDR X)))))))),
which again simplifies, applying CDR-CONS and CAR-CONS, and expanding the
functions DELETE1, MAX, and MAXLIST, to the following three new
conjectures:
Case 2.8.3.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP (CAR X))
(LISTP (DELETE1 B (DELETE1 A (CDR X)))))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))).
This again simplifies, using linear arithmetic, to:
T.
Case 2.8.2.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP (CAR X))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (DELETE1 A (CDR X)))))))
(NOT (LESSP (CAR X) (CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.8.1.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(NUMBERP (CAR X))
(NOT (LISTP (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (LESSP (CAR X) (CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.7.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(NOT (LISTP (DELETE1 B (CDR X))))
(NUMBERP (CAR X)))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B
(CONS (CAR X)
(DELETE1 A (CDR X)))))))),
which again simplifies, applying CDR-CONS and CAR-CONS, and unfolding
MAXLIST, EQUAL, LESSP, DELETE1, and MAX, to:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(EQUAL (MAXLIST (DELETE1 B (DELETE1 A (CDR X))))
0)
(NOT (EQUAL A (CAR X)))
(NOT (LISTP (DELETE1 B (CDR X))))
(NUMBERP (CAR X)))
(NOT (LESSP (CAR X) (CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.6.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP 0
(MAXLIST (DELETE1 B
(CONS (CAR X)
(DELETE1 A (CDR X)))))))),
which again simplifies, applying the lemmas CDR-CONS and CAR-CONS, and
unfolding the functions LESSP, DELETE1, MAX, MAXLIST, and EQUAL, to:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(EQUAL (MAXLIST (DELETE1 B (CDR X)))
0)
(NOT (NUMBERP (CAR X)))
(LISTP (DELETE1 B (DELETE1 A (CDR X)))))
(EQUAL (MAXLIST (DELETE1 B (DELETE1 A (CDR X))))
0)).
However this again simplifies, using linear arithmetic, to:
T.
Case 2.5.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(NOT (LISTP (DELETE1 B (CDR X))))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP 0
(MAXLIST (DELETE1 B
(CONS (CAR X)
(DELETE1 A (CDR X)))))))),
which again simplifies, applying the lemmas CDR-CONS and CAR-CONS, and
expanding the definitions of MAXLIST, EQUAL, LESSP, DELETE1, and MAX, to:
T.
Case 2.4.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B
(CONS (CAR X)
(DELETE1 A (CDR X)))))))),
which again simplifies, rewriting with CDR-CONS and CAR-CONS, and opening
up the definitions of DELETE1, MAX, and MAXLIST, to the following four new
goals:
Case 2.4.4.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X))))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NUMBERP (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(CAR X)))).
But this again simplifies, using linear arithmetic, to:
T.
Case 2.4.3.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X))))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
0))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.4.2.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X))))
(NOT (LISTP (DELETE1 B (DELETE1 A (CDR X)))))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
0))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.4.1.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(NOT (EQUAL A (CAR X)))
(LISTP (DELETE1 B (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X))))
(NOT (LISTP (DELETE1 B (DELETE1 A (CDR X)))))
(NUMBERP (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.3.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(EQUAL A (CAR X))
(NOT (LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP 0
(MAXLIST (DELETE1 B (CDR X)))))),
which again simplifies, unfolding the function LESSP, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(EQUAL A (CAR X))
(NOT (LISTP (DELETE1 B (CDR X))))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP 0
(MAXLIST (DELETE1 B (CDR X)))))),
which again simplifies, expanding the definitions of MAXLIST, EQUAL, and
LESSP, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL B (CAR X)))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (DELETE1 A (CDR X))))))
(EQUAL A (CAR X))
(LISTP (DELETE1 B (CDR X)))
(LESSP (CAR X)
(MAXLIST (DELETE1 B (CDR X)))))
(NOT (LESSP (MAXLIST (DELETE1 B (CDR X)))
(MAXLIST (DELETE1 B (CDR X)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(NOT (LESSP (MAXLIST (DELETE1 B X))
(MAXLIST (DELETE1 B (DELETE1 A X)))))),
which simplifies, opening up the functions DELETE1, MAXLIST, and LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 4.1 0.1 ]
MAXLIST-DELETE1-DELETE1
(PROVE-LEMMA MEMBER-MAXLIST
(REWRITE)
(IMPLIES (NOT (EQUAL (MAXLIST Z) 0))
(MEMBER (MAXLIST Z) Z)))
Give the conjecture the name *1.
We will appeal to induction. There are three plausible inductions.
However, they merge into one likely candidate induction. We will induct
according to the following scheme:
(AND (IMPLIES (AND (LISTP Z)
(LISTP (CDR Z))
(p (CDR Z)))
(p Z))
(IMPLIES (AND (LISTP Z) (NOT (LISTP (CDR Z))))
(p Z))
(IMPLIES (NOT (LISTP Z)) (p Z))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT Z)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces the following four new
formulas:
Case 4. (IMPLIES (AND (LISTP Z)
(LISTP (CDR Z))
(EQUAL (MAXLIST (CDR Z)) 0)
(NOT (EQUAL (MAXLIST Z) 0)))
(MEMBER (MAXLIST Z) Z)).
This simplifies, opening up MAXLIST, LESSP, EQUAL, MAX, and MEMBER, to:
T.
Case 3. (IMPLIES (AND (LISTP Z)
(LISTP (CDR Z))
(MEMBER (MAXLIST (CDR Z)) (CDR Z))
(NOT (EQUAL (MAXLIST Z) 0)))
(MEMBER (MAXLIST Z) Z)).
This simplifies, opening up the definitions of MAXLIST, MAX, and MEMBER, to:
T.
Case 2. (IMPLIES (AND (LISTP Z)
(NOT (LISTP (CDR Z)))
(NOT (EQUAL (MAXLIST Z) 0)))
(MEMBER (MAXLIST Z) Z)).
This simplifies, opening up the definitions of MAXLIST and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP Z))
(NOT (EQUAL (MAXLIST Z) 0)))
(MEMBER (MAXLIST Z) Z)).
This simplifies, opening up the definitions of MAXLIST and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MEMBER-MAXLIST
(PROVE-LEMMA LESSP-MAXLIST-DELETE1-MAXLIST
(REWRITE)
(IMPLIES (AND (LESSP 0 (MAXLIST X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(LESSP (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST X))))
WARNING: Note that the proposed lemma LESSP-MAXLIST-DELETE1-MAXLIST is to be
stored as zero type prescription rules, zero compound recognizer rules, one
linear rule, and zero replacement rules.
This formula simplifies, using linear arithmetic and appealing to the lemma
MAXLIST-DELETE1-LEQ, to:
(IMPLIES (AND (EQUAL (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST X))
(LESSP 0 (MAXLIST X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(LESSP (MAXLIST X) (MAXLIST X))),
which again simplifies, unfolding the functions EQUAL and LESSP, to the
formula:
(IMPLIES (AND (EQUAL (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST X))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(LESSP (MAXLIST X) (MAXLIST X))).
We use the above equality hypothesis by substituting:
(MAXLIST (DELETE1 (MAXLIST X) X))
for (MAXLIST X) and keeping the equality hypothesis. We would thus like to
prove the new formula:
(IMPLIES (AND (EQUAL (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST X))
(NOT (EQUAL (MAXLIST (DELETE1 (MAXLIST X) X))
0))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (DELETE1 (MAXLIST X) X))
X))))
(LESSP (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST (DELETE1 (MAXLIST X) X)))),
which further simplifies, trivially, to:
(IMPLIES (AND (EQUAL (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST X))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(LESSP (MAXLIST X) (MAXLIST X))),
which we would normally push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we have
previously done, give the name *1 to the original input, and work on it.
So now let us return to:
(IMPLIES (AND (LESSP 0 (MAXLIST X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(LESSP (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST X))).
We named this *1. We will try to prove it by induction. Six inductions are
suggested by terms in the conjecture. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP can be used to prove that the
measure (COUNT X) decreases according to the well-founded relation LESSP in
each induction step of the scheme. The above induction scheme generates the
following five new formulas:
Case 5. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP 0 (MAXLIST (CDR X))))
(LESSP 0 (MAXLIST X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(LESSP (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST X))).
This simplifies, expanding the definitions of EQUAL, LESSP, MAXLIST, MAX,
and DELETE1, to:
T.
Case 4. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X)))
(LESSP 0 (MAXLIST X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(LESSP (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST X))).
This simplifies, rewriting with CAR-CONS, OCCURRENCE-IMPLIES-LISTP, CDR-CONS,
and DELETE1-PRESERVES-MAXLIST-WHEN-MAXLIST-OCCURS-MORE-THAN-ONCE, and
opening up the functions MAXLIST, MAX, DELETE1, LESSP, EQUAL, and
OCCURRENCES, to four new conjectures:
Case 4.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(LESSP 0 (CAR X))
(NOT (LESSP 1 (OCCURRENCES (CAR X) X))))
(LESSP (MAXLIST (CDR X)) (CAR X))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (MAXLIST (CDR X)) (CAR X))
(LISTP X)
(LISTP (CDR X))
(LESSP 1
(OCCURRENCES (CAR X) (CDR X)))
(NOT (LESSP (CAR X) (CAR X)))
(NUMBERP (CAR X))
(LESSP 0 (CAR X))
(NOT (LESSP 1 (OCCURRENCES (CAR X) X))))
(LESSP (CAR X) (CAR X))).
But this again simplifies, rewriting with SUB1-ADD1 and
EQUAL-OCCURRENCES-ZERO, and opening up EQUAL, LESSP, OCCURRENCES, SUB1,
and NUMBERP, to:
(IMPLIES (AND (EQUAL (MAXLIST (CDR X)) (CAR X))
(LISTP X)
(LISTP (CDR X))
(LESSP 1
(OCCURRENCES (CAR X) (CDR X)))
(NOT (EQUAL (CAR X) 0))
(NOT (MEMBER (CAR X) (CDR X))))
(LESSP (CAR X) (CAR X))),
which again simplifies, rewriting with EQUAL-OCCURRENCES-ZERO, and
expanding the definition of LESSP, to:
T.
Case 4.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(LESSP 0 0)
(NOT (EQUAL (MAXLIST (CDR X)) 0))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X)) X))))
(LESSP (MAXLIST (CDR X))
(MAXLIST (CDR X)))).
But this again simplifies, using linear arithmetic, to:
T.
Case 4.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(LESSP 0 0)
(EQUAL (MAXLIST (CDR X)) 0))
(LESSP 1 (OCCURRENCES 0 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP 1
(OCCURRENCES (MAXLIST (CDR X))
(CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP 0 (MAXLIST (CDR X)))
(EQUAL (MAXLIST (CDR X)) (CAR X))
(NOT (LESSP 1
(ADD1 (OCCURRENCES (MAXLIST (CDR X))
(CDR X))))))
(LESSP (CAR X) (CAR X))),
which again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (MAXLIST (DELETE1 (MAXLIST (CDR X)) (CDR X)))
(MAXLIST (CDR X)))
(LESSP 0 (MAXLIST X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(LESSP (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST X))),
which simplifies, rewriting with CAR-CONS and CDR-CONS, and expanding
MAXLIST, MAX, DELETE1, LESSP, EQUAL, and OCCURRENCES, to the following five
new conjectures:
Case 3.5.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (MAXLIST (DELETE1 (MAXLIST (CDR X)) (CDR X)))
(MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(LESSP 0 (CAR X))
(NOT (LESSP 1 (OCCURRENCES (CAR X) X))))
(LESSP (MAXLIST (CDR X)) (CAR X))).
However this again simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (MAXLIST (CDR X)) (CAR X))
(LISTP X)
(LISTP (CDR X))
(LESSP (MAXLIST (DELETE1 (CAR X) (CDR X)))
(CAR X))
(NOT (LESSP (CAR X) (CAR X)))
(NUMBERP (CAR X))
(LESSP 0 (CAR X))
(NOT (LESSP 1 (OCCURRENCES (CAR X) X))))
(LESSP (CAR X) (CAR X))).
But this again simplifies, unfolding the definitions of EQUAL and LESSP,
to:
(IMPLIES (AND (EQUAL (MAXLIST (CDR X)) (CAR X))
(LISTP X)
(LISTP (CDR X))
(LESSP (MAXLIST (DELETE1 (CAR X) (CDR X)))
(CAR X))
(NOT (EQUAL (CAR X) 0))
(NOT (LESSP 1 (OCCURRENCES (CAR X) X))))
(LESSP (CAR X) (CAR X))).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS V Z) to
eliminate (CDR X) and (CAR X). The result is:
(IMPLIES (AND (EQUAL (MAXLIST Z) V)
(LISTP Z)
(LESSP (MAXLIST (DELETE1 V Z)) V)
(NOT (EQUAL V 0))
(NOT (LESSP 1 (OCCURRENCES V (CONS V Z)))))
(LESSP V V)).
However this further simplifies, rewriting with the lemmas CDR-CONS,
CAR-CONS, SUB1-ADD1, EQUAL-OCCURRENCES-ZERO, and MEMBER-MAXLIST, and
opening up the definitions of OCCURRENCES, SUB1, NUMBERP, EQUAL, and LESSP,
to:
T.
Case 3.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (MAXLIST (DELETE1 (MAXLIST (CDR X)) (CDR X)))
(MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(LESSP 0 0)
(NOT (EQUAL (MAXLIST (CDR X)) 0))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X)) X)))
(EQUAL (MAXLIST (DELETE1 (MAXLIST (CDR X)) (CDR X)))
0))
(LESSP 0 (MAXLIST (CDR X)))),
which again simplifies, trivially, to:
T.
Case 3.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (MAXLIST (DELETE1 (MAXLIST (CDR X)) (CDR X)))
(MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(LESSP 0 0)
(NOT (EQUAL (MAXLIST (CDR X)) 0))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST (CDR X)) X)))
(NOT (LISTP (DELETE1 (MAXLIST (CDR X)) (CDR X)))))
(LESSP 0 (MAXLIST (CDR X)))).
But this again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (MAXLIST (DELETE1 (MAXLIST (CDR X)) (CDR X)))
(MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(LESSP 0 0)
(EQUAL (MAXLIST (CDR X)) 0))
(LESSP 1 (OCCURRENCES 0 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (MAXLIST (DELETE1 (MAXLIST (CDR X)) (CDR X)))
(MAXLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP 0 (MAXLIST (CDR X)))
(EQUAL (MAXLIST (CDR X)) (CAR X))
(NOT (LESSP 1
(ADD1 (OCCURRENCES (MAXLIST (CDR X))
(CDR X))))))
(LESSP (CAR X) (CAR X))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(LESSP 0 (MAXLIST X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(LESSP (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST X))),
which simplifies, opening up MAXLIST, EQUAL, LESSP, and DELETE1, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(LESSP 0 (MAXLIST X))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(LESSP (MAXLIST (DELETE1 (MAXLIST X) X))
(MAXLIST X))),
which simplifies, expanding MAXLIST and LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.9 0.0 ]
LESSP-MAXLIST-DELETE1-MAXLIST
(PROVE-LEMMA INDUCTION-FN-HELP-2-MAX-OCCURS-ONCE-MAIN-LEMMA
(REWRITE)
(IMPLIES
(AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(EQUAL (LESSP (MAXLIST (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(MAXLIST X))
T)))
WARNING: Note that INDUCTION-FN-HELP-2-MAX-OCCURS-ONCE-MAIN-LEMMA contains
the free variable K which will be chosen by instantiating the hypothesis:
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X))).
This formula simplifies, rewriting with the lemmas CAR-CONS, CDR-CONS, and
SUB1-ADD1, and opening up MAX, MAXLIST, and LESSP, to eight new formulas:
Case 8. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(EQUAL (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0)
(NOT (LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))))
(LESSP (SUB1 (MAXLIST X))
(MAXLIST X))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(EQUAL (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0)
(NOT (LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))))
(LESSP (SUB1 (MAXLIST X))
(MAXLIST X))).
However this again simplifies, using linear arithmetic and appealing to the
lemma MAXLIST-GEQ-MINLIST, to:
T.
Case 7. (IMPLIES
(AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(NOT (LESSP (MINLIST X)
(SUB1 (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))
(NOT (LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))))
(LESSP (SUB1 (MAXLIST X))
(MAXLIST X))),
which again simplifies, using linear arithmetic, to the formula:
(IMPLIES
(AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(NOT (LESSP (MINLIST X)
(SUB1 (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))
(NOT (LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))))
(LESSP (SUB1 (MAXLIST X))
(MAXLIST X))).
But this again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 6. (IMPLIES
(AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(LISTP (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(NOT (EQUAL (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0))
(LESSP (MINLIST X)
(SUB1 (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(NOT (LESSP (SUB1 (MAXLIST X))
(MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))
(LESSP (SUB1 (MAXLIST X))
(MAXLIST X))).
However this again simplifies, using linear arithmetic, to:
(IMPLIES
(AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(LISTP (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(NOT (EQUAL (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0))
(LESSP (MINLIST X)
(SUB1 (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(NOT (LESSP (SUB1 (MAXLIST X))
(MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))
(LESSP (SUB1 (MAXLIST X))
(MAXLIST X))).
However this again simplifies, using linear arithmetic and rewriting with
the lemma MAXLIST-GEQ-MINLIST, to:
T.
Case 5. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(NOT (LISTP (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(NOT (LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))))
(LESSP (SUB1 (MAXLIST X))
(MAXLIST X))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(NOT (LISTP (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(NOT (LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))))
(LESSP (SUB1 (MAXLIST X))
(MAXLIST X))).
This again simplifies, using linear arithmetic and applying
MAXLIST-GEQ-MINLIST, to:
T.
Case 4. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(EQUAL (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0)
(LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X))))
(LESSP (ADD1 (MINLIST X))
(MAXLIST X))).
However this again simplifies, using linear arithmetic and rewriting with
MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER, to the new formula:
(IMPLIES (AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(EQUAL (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0)
(LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X))))
(LESSP (ADD1 (MINLIST X))
(MAXLIST X))),
which again simplifies, using linear arithmetic and applying
MAXLIST-GEQ-MINLIST, to:
T.
Case 3. (IMPLIES
(AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(NOT (LESSP (MINLIST X)
(SUB1 (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))
(LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X))))
(LESSP (ADD1 (MINLIST X))
(MAXLIST X))).
However this again simplifies, using linear arithmetic and rewriting with
MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER, to:
(IMPLIES
(AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(NOT (LESSP (MINLIST X)
(SUB1 (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))
(LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X))))
(LESSP (ADD1 (MINLIST X))
(MAXLIST X))),
which again simplifies, using linear arithmetic and applying
MAXLIST-GEQ-MINLIST, to:
T.
Case 2. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(NOT (LISTP (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X))))
(LESSP (ADD1 (MINLIST X))
(MAXLIST X))).
But this again simplifies, using linear arithmetic and rewriting with
MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER, to:
(IMPLIES (AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(NOT (LISTP (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(LESSP (SUB1 (MAXLIST X))
(ADD1 (MINLIST X))))
(LESSP (ADD1 (MINLIST X))
(MAXLIST X))),
which again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 1. (IMPLIES
(AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(LISTP (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(NOT (EQUAL (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0))
(LESSP (MINLIST X)
(SUB1 (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(LESSP (SUB1 (MAXLIST X))
(MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(LESSP (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(MAXLIST X))).
This again simplifies, using linear arithmetic and appealing to the lemmas
LESSP-MAXLIST-DELETE1-MAXLIST, MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER, and
MAXLIST-DELETE1-DELETE1, to the goal:
(IMPLIES
(AND (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1 (OCCURRENCES (MAXLIST X) X)))
(LISTP (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(NOT (EQUAL (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0))
(LESSP (MINLIST X)
(SUB1 (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(LESSP (SUB1 (MAXLIST X))
(MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(LESSP (MAXLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(MAXLIST X))).
However this again simplifies, using linear arithmetic and applying
MAXLIST-GEQ-MINLIST, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
INDUCTION-FN-HELP-2-MAX-OCCURS-ONCE-MAIN-LEMMA
(PROVE-LEMMA INDUCTION-FN-HELP-2-MAX-OCCURS-ONCE NIL
(LET ((X0 (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP 1
(OCCURRENCES (MAXLIST X) X))))
(ORD-LESSP (CONS (ADD1 (MAXLIST X0))
(OCCURRENCES (MAXLIST X0) X0))
(CONS (ADD1 (MAXLIST X))
(OCCURRENCES (MAXLIST X) X)))))
((DISABLE OCCURRENCES MINLIST MAXLIST DELETE1)))
This conjecture simplifies, applying the lemmas CDR-CONS, ADD1-EQUAL, CAR-CONS,
SUB1-ADD1, and INDUCTION-FN-HELP-2-MAX-OCCURS-ONCE-MAIN-LEMMA, and unfolding
ORD-LESSP and LESSP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
INDUCTION-FN-HELP-2-MAX-OCCURS-ONCE
(PROVE-LEMMA INDUCTION-FN-HELP-2
(REWRITE)
(LET ((X0 (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(ORD-LESSP (CONS (ADD1 (MAXLIST X0))
(OCCURRENCES (MAXLIST X0) X0))
(CONS (ADD1 (MAXLIST X))
(OCCURRENCES (MAXLIST X) X)))))
((USE (INDUCTION-FN-HELP-2-MAX-OCCURS-TWICE)
(INDUCTION-FN-HELP-2-MAX-OCCURS-ONCE))
(DISABLE-THEORY T)
(ENABLE-THEORY GROUND-ZERO)))
WARNING: Note that INDUCTION-FN-HELP-2 contains the free variable K which
will be chosen by instantiating the hypothesis:
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X))).
This conjecture simplifies, appealing to the lemmas CDR-CONS, ADD1-EQUAL,
CAR-CONS, and SUB1-ADD1, and expanding the definitions of NOT, AND, ORD-LESSP,
LESSP, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
INDUCTION-FN-HELP-2
(DISABLE-THEORY INDUCTION-FN-DISABLES)
[ 0.0 0.0 0.0 ]
DISABLE-THEORY-AFTER-INDUCTION-FN-HELP-2-0
(DEFN INDUCTION-FN
(X K)
(IF (NOT (EQUAL (SUMLIST X)
(TIMES K (LENGTH X))))
T
(IF (EQUAL (MINLIST X) (MAXLIST X))
T
(INDUCTION-FN (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
K)))
((ORD-LESSP (CONS (ADD1 (MAXLIST X))
(OCCURRENCES (MAXLIST X) X)))))
The lemmas CAR-CONS, CDR-CONS, and INDUCTION-FN-HELP-2 and the definition
of ORDINALP establish that the measure:
(CONS (ADD1 (MAXLIST X))
(OCCURRENCES (MAXLIST X) X))
decreases according to the well-founded relation ORD-LESSP in each recursive
call. Hence, INDUCTION-FN is accepted under the principle of definition.
From the definition we can conclude that (TRUEP (INDUCTION-FN X K)) is a
theorem.
[ 0.0 0.0 0.0 ]
INDUCTION-FN
(ENABLE-THEORY INDUCTION-FN-DISABLES)
[ 0.0 0.0 0.0 ]
ENABLE-THEORY-AFTER-INDUCTION-FN-0
(PROVE-LEMMA SUMLIST-DELETE1-PLUS-VERSION NIL
(EQUAL (PLUS A (SUMLIST (DELETE1 A X)))
(IF (MEMBER A X)
(SUMLIST X)
(PLUS A (SUMLIST X)))))
This formula simplifies, trivially, to two new formulas:
Case 2. (IMPLIES (NOT (MEMBER A X))
(EQUAL (PLUS A (SUMLIST (DELETE1 A X)))
(PLUS A (SUMLIST X)))),
which again simplifies, appealing to the lemma
CORRECTNESS-OF-CANCEL-EQUAL-PLUS, and unfolding the function FIX, to:
(IMPLIES (NOT (MEMBER A X))
(EQUAL (SUMLIST (DELETE1 A X))
(SUMLIST X))).
Name the above subgoal *1.
Case 1. (IMPLIES (MEMBER A X)
(EQUAL (PLUS A (SUMLIST (DELETE1 A X)))
(SUMLIST X))),
which we would usually push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us consider:
(EQUAL (PLUS A (SUMLIST (DELETE1 A X)))
(IF (MEMBER A X)
(SUMLIST X)
(PLUS A (SUMLIST X)))),
which we named *1 above. We will appeal to induction. Six inductions are
suggested by terms in the conjecture. They merge into two likely candidate
inductions. However, only one is unflawed. We will induct according to the
following scheme:
(AND (IMPLIES (AND (LISTP X) (EQUAL A (CAR X)))
(p A X))
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(p A (CDR X)))
(p A X))
(IMPLIES (NOT (LISTP X)) (p A X))).
Linear arithmetic and the lemma CDR-LESSP can be used to prove that the
measure (COUNT X) decreases according to the well-founded relation LESSP in
each induction step of the scheme. The above induction scheme leads to three
new formulas:
Case 3. (IMPLIES (AND (LISTP X) (EQUAL A (CAR X)))
(EQUAL (PLUS A (SUMLIST (DELETE1 A X)))
(IF (MEMBER A X)
(SUMLIST X)
(PLUS A (SUMLIST X))))),
which simplifies, unfolding DELETE1, MEMBER, and SUMLIST, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(EQUAL (PLUS A (SUMLIST (DELETE1 A (CDR X))))
(IF (MEMBER A (CDR X))
(SUMLIST (CDR X))
(PLUS A (SUMLIST (CDR X))))))
(EQUAL (PLUS A (SUMLIST (DELETE1 A X)))
(IF (MEMBER A X)
(SUMLIST X)
(PLUS A (SUMLIST X))))),
which simplifies, applying CDR-CONS, CAR-CONS, and
CORRECTNESS-OF-CANCEL-EQUAL-PLUS, and opening up the definitions of DELETE1,
SUMLIST, MEMBER, and FIX, to the new goal:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(NOT (MEMBER A (CDR X)))
(EQUAL (PLUS A (SUMLIST (DELETE1 A (CDR X))))
(PLUS A (SUMLIST (CDR X)))))
(EQUAL (SUMLIST (DELETE1 A (CDR X)))
(SUMLIST (CDR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (PLUS A (SUMLIST (DELETE1 A X)))
(IF (MEMBER A X)
(SUMLIST X)
(PLUS A (SUMLIST X))))),
which simplifies, applying the lemmas PLUS-ZERO-ARG2 and MEMBER-NON-LIST,
and expanding the definitions of DELETE1, SUMLIST, and ZEROP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUMLIST-DELETE1-PLUS-VERSION
(PROVE-LEMMA SUMLIST-DELETE1
(REWRITE)
(EQUAL (SUMLIST (DELETE1 A X))
(IF (MEMBER A X)
(DIFFERENCE (SUMLIST X) A)
(SUMLIST X)))
((USE (SUMLIST-DELETE1-PLUS-VERSION))))
This formula simplifies, clearly, to two new conjectures:
Case 2. (IMPLIES (AND (NOT (MEMBER A X))
(EQUAL (PLUS A (SUMLIST (DELETE1 A X)))
(PLUS A (SUMLIST X))))
(EQUAL (SUMLIST (DELETE1 A X))
(SUMLIST X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (MEMBER A X)
(EQUAL (PLUS A (SUMLIST (DELETE1 A X)))
(SUMLIST X)))
(EQUAL (SUMLIST (DELETE1 A X))
(DIFFERENCE (SUMLIST X) A))),
which again simplifies, using linear arithmetic, to the goal:
(IMPLIES (AND (LESSP (SUMLIST X) A)
(MEMBER A X)
(EQUAL (PLUS A (SUMLIST (DELETE1 A X)))
(SUMLIST X)))
(EQUAL (SUMLIST (DELETE1 A X))
(DIFFERENCE (SUMLIST X) A))).
This again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
SUMLIST-DELETE1
(PROVE-LEMMA MAXLIST-0-IS-SUMLIST-0
(REWRITE)
(EQUAL (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X) 0)))
This formula simplifies, trivially, to two new conjectures:
Case 2. (IMPLIES (NOT (EQUAL (SUMLIST X) 0))
(NOT (EQUAL (MAXLIST X) 0))),
which we will name *1.
Case 1. (IMPLIES (EQUAL (SUMLIST X) 0)
(EQUAL (EQUAL (MAXLIST X) 0) T)).
This again simplifies, obviously, to the new formula:
(IMPLIES (EQUAL (SUMLIST X) 0)
(EQUAL (MAXLIST X) 0)),
which we would normally push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us return to:
(EQUAL (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X) 0)).
We named this *1. We will try to prove it by induction. There are two
plausible inductions. However, they merge into one likely candidate induction.
We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces three new goals:
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (EQUAL (MAXLIST (CDR X)) 0)
(EQUAL (SUMLIST (CDR X)) 0)))
(EQUAL (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X) 0))),
which simplifies, appealing to the lemmas EQUAL-PLUS-0 and PLUS-ZERO-ARG2,
and expanding the functions MAXLIST, MAX, SUMLIST, LESSP, and ZEROP, to two
new goals:
Case 3.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (SUMLIST (CDR X)) 0))
(NOT (EQUAL (MAXLIST (CDR X)) 0))
(NOT (LESSP (CAR X) (MAXLIST (CDR X)))))
(NOT (EQUAL (CAR X) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (SUMLIST (CDR X)) 0))
(NOT (EQUAL (MAXLIST (CDR X)) 0))
(NOT (LESSP (CAR X) (MAXLIST (CDR X)))))
(NUMBERP (CAR X))),
which again simplifies, opening up the function LESSP, to:
T.
Case 2. (IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(EQUAL (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X) 0))),
which simplifies, rewriting with the lemma EQUAL-PLUS-0, and opening up the
functions MAXLIST and SUMLIST, to two new formulas:
Case 2.2.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (EQUAL (SUMLIST (CDR X)) 0)
T)),
which again simplifies, trivially, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (SUMLIST (CDR X)) 0)),
which further simplifies, opening up the definitions of SUMLIST and EQUAL,
to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(EQUAL (CAR X) 0))
(EQUAL (EQUAL (SUMLIST (CDR X)) 0)
T)),
which again simplifies, clearly, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(EQUAL (CAR X) 0))
(EQUAL (SUMLIST (CDR X)) 0)),
which further simplifies, expanding SUMLIST and EQUAL, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X) 0))),
which simplifies, opening up the definitions of MAXLIST, EQUAL, and SUMLIST,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MAXLIST-0-IS-SUMLIST-0
(PROVE-LEMMA MAIN-LEMMA-BASE-CASE-LEMMA-1 NIL
(IMPLIES (EQUAL (MINLIST X) (MAXLIST X))
(EQUAL (EXP (MINLIST X) (LENGTH X))
(PRODLIST X))))
.
We use the above equality hypothesis by substituting (MINLIST X) for
(MAXLIST X) and keeping the equality hypothesis. This produces:
(IMPLIES (EQUAL (MINLIST X) (MAXLIST X))
(EQUAL (EXP (MINLIST X) (LENGTH X))
(PRODLIST X))),
which further simplifies, trivially, to:
(IMPLIES (EQUAL (MINLIST X) (MAXLIST X))
(EQUAL (EXP (MAXLIST X) (LENGTH X))
(PRODLIST X))),
which we would normally push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we have
previously done, give the name *1 to the original input, and work on it.
So now let us return to:
(IMPLIES (EQUAL (MINLIST X) (MAXLIST X))
(EQUAL (EXP (MINLIST X) (LENGTH X))
(PRODLIST X))),
named *1. Let us appeal to the induction principle. There are five plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP can be used to establish that the
measure (COUNT X) decreases according to the well-founded relation LESSP in
each induction step of the scheme. The above induction scheme generates the
following four new conjectures:
Case 4. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(EQUAL (MINLIST X) (MAXLIST X)))
(EQUAL (EXP (MINLIST X) (LENGTH X))
(PRODLIST X))).
This simplifies, applying the lemmas EXP-0-ARG1, EXP-ADD1, and
CORRECTNESS-OF-CANCEL-EQUAL-TIMES, and unfolding MINLIST, MIN, MAXLIST, MAX,
NUMBERP, LESSP, LENGTH, PRODLIST, TIMES, EQUAL, ZEROP, FIX, and OR, to the
following four new formulas:
Case 4.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(EQUAL (CAR X) (MAXLIST (CDR X)))
(NOT (EQUAL (CAR X) 0)))
(EQUAL (EXP (CAR X) (LENGTH (CDR X)))
(PRODLIST (CDR X)))).
However this again simplifies, using linear arithmetic and rewriting with
the lemma MAXLIST-GEQ-MINLIST, to:
T.
Case 4.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(EQUAL (MINLIST (CDR X)) (CAR X))
(NOT (EQUAL (CAR X) 0)))
(EQUAL (EXP (CAR X) (LENGTH (CDR X)))
(PRODLIST (CDR X)))),
which again simplifies, using linear arithmetic and applying
MAXLIST-GEQ-MINLIST, to:
T.
Case 4.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (TIMES 0 (EXP 0 (LENGTH (CDR X))))
(TIMES (CAR X) (PRODLIST (CDR X))))).
This again simplifies, using linear arithmetic and applying the lemma
MAXLIST-GEQ-MINLIST, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X)))
(EQUAL (TIMES (CAR X)
(EXP (CAR X) (LENGTH (CDR X))))
(TIMES (CAR X) (PRODLIST (CDR X))))),
which again simplifies, using linear arithmetic and applying the lemma
MAXLIST-GEQ-MINLIST, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (EXP (MINLIST (CDR X))
(LENGTH (CDR X)))
(PRODLIST (CDR X)))
(EQUAL (MINLIST X) (MAXLIST X)))
(EQUAL (EXP (MINLIST X) (LENGTH X))
(PRODLIST X))),
which simplifies, rewriting with EXP-0-ARG1, EXP-ADD1, and
CORRECTNESS-OF-CANCEL-EQUAL-TIMES, and opening up MINLIST, MIN, MAXLIST, MAX,
NUMBERP, LESSP, LENGTH, PRODLIST, TIMES, EQUAL, ZEROP, FIX, and OR, to the
following six new formulas:
Case 3.6.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (EXP (MINLIST (CDR X))
(LENGTH (CDR X)))
(PRODLIST (CDR X)))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(EQUAL (CAR X) (MAXLIST (CDR X)))
(NOT (EQUAL (CAR X) 0)))
(EQUAL (EXP (CAR X) (LENGTH (CDR X)))
(PRODLIST (CDR X)))).
However this again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 3.5.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (EXP (MINLIST (CDR X))
(LENGTH (CDR X)))
(PRODLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (TIMES 0 (EXP 0 (LENGTH (CDR X))))
(TIMES (CAR X) (PRODLIST (CDR X))))).
But this again simplifies, using linear arithmetic, to:
T.
Case 3.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (EXP (MINLIST (CDR X))
(LENGTH (CDR X)))
(PRODLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NUMBERP (CAR X)))
(EQUAL (TIMES (CAR X)
(EXP (CAR X) (LENGTH (CDR X))))
(TIMES (CAR X) (PRODLIST (CDR X))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (EXP (MINLIST (CDR X))
(LENGTH (CDR X)))
(PRODLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(EQUAL (MINLIST (CDR X)) (CAR X))
(NOT (EQUAL (CAR X) 0)))
(EQUAL (EXP (CAR X) (LENGTH (CDR X)))
(PRODLIST (CDR X)))),
which again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
(IMPLIES (AND (EQUAL (MAXLIST (CDR X)) (CAR X))
(LISTP X)
(LISTP (CDR X))
(EQUAL (EXP (MINLIST (CDR X))
(LENGTH (CDR X)))
(PRODLIST (CDR X)))
(NOT (LESSP (CAR X) (CAR X)))
(NUMBERP (CAR X))
(EQUAL (MINLIST (CDR X)) (CAR X))
(NOT (EQUAL (CAR X) 0)))
(EQUAL (EXP (CAR X) (LENGTH (CDR X)))
(PRODLIST (CDR X)))),
which again simplifies, trivially, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (EXP (MINLIST (CDR X))
(LENGTH (CDR X)))
(PRODLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (TIMES 0 (EXP 0 (LENGTH (CDR X))))
(TIMES (CAR X) (PRODLIST (CDR X))))).
This again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (EXP (MINLIST (CDR X))
(LENGTH (CDR X)))
(PRODLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X)))
(EQUAL (TIMES (CAR X)
(EXP (CAR X) (LENGTH (CDR X))))
(TIMES (CAR X) (PRODLIST (CDR X))))).
However this again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(EQUAL (MINLIST X) (MAXLIST X)))
(EQUAL (EXP (MINLIST X) (LENGTH X))
(PRODLIST X))).
This simplifies, rewriting with EXP-ADD1, and unfolding the definitions of
MINLIST, MAXLIST, LENGTH, and PRODLIST, to two new goals:
Case 2.2.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (TIMES 0 (EXP 0 (LENGTH (CDR X))))
(TIMES (CAR X) (PRODLIST (CDR X))))),
which again simplifies, applying EXP-0-ARG1, and opening up the functions
EQUAL and TIMES, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(EQUAL (TIMES (CAR X)
(EXP (CAR X) (LENGTH (CDR X))))
(TIMES (CAR X) (PRODLIST (CDR X))))).
However this again simplifies, rewriting with
CORRECTNESS-OF-CANCEL-EQUAL-TIMES, and unfolding the functions ZEROP, FIX,
and OR, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X))
(NOT (EQUAL (CAR X) 0)))
(EQUAL (EXP (CAR X) (LENGTH (CDR X)))
(PRODLIST (CDR X)))),
which further simplifies, appealing to the lemma EXP-0-ARG2, and unfolding
the functions LENGTH, PRODLIST, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(EQUAL (MINLIST X) (MAXLIST X)))
(EQUAL (EXP (MINLIST X) (LENGTH X))
(PRODLIST X))),
which simplifies, expanding MINLIST, MAXLIST, EQUAL, LENGTH, EXP, and
PRODLIST, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
MAIN-LEMMA-BASE-CASE-LEMMA-1
(PROVE-LEMMA MAIN-LEMMA-BASE-CASE-LEMMA-2-LEMMA NIL
(IMPLIES (EQUAL (MINLIST X) (MAXLIST X))
(EQUAL (SUMLIST X)
(TIMES (MINLIST X) (LENGTH X)))))
This conjecture simplifies, rewriting with COMMUTATIVITY-OF-TIMES, to:
(IMPLIES (EQUAL (MINLIST X) (MAXLIST X))
(EQUAL (SUMLIST X)
(TIMES (LENGTH X) (MAXLIST X)))).
We use the above equality hypothesis by substituting (MINLIST X) for
(MAXLIST X) and keeping the equality hypothesis. The result is the formula:
(IMPLIES (EQUAL (MINLIST X) (MAXLIST X))
(EQUAL (SUMLIST X)
(TIMES (LENGTH X) (MINLIST X)))).
This further simplifies, obviously, to the new formula:
(IMPLIES (EQUAL (MINLIST X) (MAXLIST X))
(EQUAL (SUMLIST X)
(TIMES (LENGTH X) (MAXLIST X)))),
which we would normally push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we have
previously done, give the name *1 to the original input, and work on it.
So now let us return to:
(IMPLIES (EQUAL (MINLIST X) (MAXLIST X))
(EQUAL (SUMLIST X)
(TIMES (MINLIST X) (LENGTH X)))),
named *1. Let us appeal to the induction principle. There are five plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme leads to four new conjectures:
Case 4. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(EQUAL (MINLIST X) (MAXLIST X)))
(EQUAL (SUMLIST X)
(TIMES (MINLIST X) (LENGTH X)))),
which simplifies, rewriting with TIMES-ADD1,
CORRECTNESS-OF-CANCEL-EQUAL-PLUS, SUB1-ADD1, and COMMUTATIVITY-OF-TIMES, and
expanding the functions MINLIST, MIN, MAXLIST, MAX, SUMLIST, PLUS, NUMBERP,
LESSP, LENGTH, EQUAL, TIMES, and FIX, to the following six new conjectures:
Case 4.6.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(EQUAL 0 (MAXLIST (CDR X))))
(EQUAL (SUMLIST (CDR X)) 0)).
This again simplifies, using linear arithmetic and applying
MAXLIST-GEQ-MINLIST, to:
T.
Case 4.5.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(EQUAL (CAR X) (MAXLIST (CDR X))))
(EQUAL (SUMLIST (CDR X))
(TIMES (CAR X) (LENGTH (CDR X))))).
But this again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 4.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(EQUAL (MINLIST (CDR X)) 0))
(EQUAL (SUMLIST (CDR X)) 0)).
But this again simplifies, rewriting with MAXLIST-0-IS-SUMLIST-0, and
unfolding LESSP, to:
T.
Case 4.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(EQUAL (MINLIST (CDR X)) (CAR X)))
(EQUAL (SUMLIST (CDR X))
(TIMES (CAR X) (LENGTH (CDR X))))).
However this again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 4.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS 0 (TIMES (LENGTH (CDR X)) 0)))).
However this again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X)))
(EQUAL (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (CAR X)
(TIMES (LENGTH (CDR X)) (CAR X))))).
But this again simplifies, using linear arithmetic and applying
MAXLIST-GEQ-MINLIST, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (SUMLIST (CDR X))
(TIMES (MINLIST (CDR X))
(LENGTH (CDR X))))
(EQUAL (MINLIST X) (MAXLIST X)))
(EQUAL (SUMLIST X)
(TIMES (MINLIST X) (LENGTH X)))).
This simplifies, applying COMMUTATIVITY-OF-TIMES, TIMES-ADD1,
CORRECTNESS-OF-CANCEL-EQUAL-PLUS, and SUB1-ADD1, and unfolding the
definitions of MINLIST, MIN, MAXLIST, MAX, SUMLIST, PLUS, NUMBERP, LESSP,
LENGTH, EQUAL, TIMES, and FIX, to eight new goals:
Case 3.8.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(EQUAL 0 (MAXLIST (CDR X))))
(EQUAL (SUMLIST (CDR X)) 0)),
which again simplifies, using linear arithmetic and applying
MAXLIST-GEQ-MINLIST, to:
T.
Case 3.7.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(EQUAL (CAR X) (MAXLIST (CDR X))))
(EQUAL (SUMLIST (CDR X))
(TIMES (CAR X) (LENGTH (CDR X))))).
However this again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 3.6.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS 0 (TIMES (LENGTH (CDR X)) 0)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 3.5.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NUMBERP (CAR X)))
(EQUAL (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (CAR X)
(TIMES (LENGTH (CDR X)) (CAR X))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(EQUAL (MINLIST (CDR X)) 0))
(EQUAL (SUMLIST (CDR X)) 0)),
which again simplifies, appealing to the lemma COMMUTATIVITY-OF-TIMES, and
unfolding EQUAL and TIMES, to:
T.
Case 3.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(EQUAL (MINLIST (CDR X)) (CAR X)))
(EQUAL (SUMLIST (CDR X))
(TIMES (CAR X) (LENGTH (CDR X))))),
which again simplifies, using linear arithmetic and appealing to the
lemmas MINLIST-MAIN-PROPERTY, MAXLIST-MAIN-PROPERTY, TIMES-MONOTONE-1, and
COMMUTATIVITY-OF-TIMES, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS 0 (TIMES (LENGTH (CDR X)) 0)))),
which again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (SUMLIST (CDR X))
(TIMES (LENGTH (CDR X))
(MINLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X)))
(EQUAL (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (CAR X)
(TIMES (LENGTH (CDR X)) (CAR X))))).
But this again simplifies, using linear arithmetic and applying the lemma
MAXLIST-GEQ-MINLIST, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(EQUAL (MINLIST X) (MAXLIST X)))
(EQUAL (SUMLIST X)
(TIMES (MINLIST X) (LENGTH X)))),
which simplifies, rewriting with SUB1-ADD1 and COMMUTATIVITY-OF-TIMES, and
opening up the definitions of MINLIST, MAXLIST, SUMLIST, LENGTH, and TIMES,
to the following two new conjectures:
Case 2.2.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS 0 (TIMES (LENGTH (CDR X)) 0)))).
But this again simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and
unfolding the definitions of PLUS, EQUAL, and TIMES, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(EQUAL (SUMLIST (CDR X)) 0)),
which further simplifies, expanding the definitions of SUMLIST and EQUAL,
to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(EQUAL (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (CAR X)
(TIMES (LENGTH (CDR X)) (CAR X))))),
which again simplifies, rewriting with COMMUTATIVITY-OF-TIMES and
CORRECTNESS-OF-CANCEL-EQUAL-PLUS, and opening up the definition of FIX, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(EQUAL (SUMLIST (CDR X))
(TIMES (CAR X) (LENGTH (CDR X))))),
which further simplifies, appealing to the lemma COMMUTATIVITY-OF-TIMES,
and unfolding the functions SUMLIST, LENGTH, EQUAL, and TIMES, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(EQUAL (MINLIST X) (MAXLIST X)))
(EQUAL (SUMLIST X)
(TIMES (MINLIST X) (LENGTH X)))),
which simplifies, opening up the functions MINLIST, MAXLIST, EQUAL, SUMLIST,
LENGTH, and TIMES, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.1 ]
MAIN-LEMMA-BASE-CASE-LEMMA-2-LEMMA
(PROVE-LEMMA MAIN-LEMMA-BASE-CASE-LEMMA-2-HACK NIL
(IMPLIES (AND (EQUAL (TIMES K N) SUMLIST)
(NOT (ZEROP N))
(EQUAL (TIMES N MAXLIST) SUMLIST))
(EQUAL (FIX K) (FIX MAXLIST))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES (AND (EQUAL (TIMES K N) SUMLIST)
(NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (TIMES N MAXLIST) SUMLIST))
(EQUAL (FIX K) (FIX MAXLIST))).
This simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES and
CORRECTNESS-OF-CANCEL-EQUAL-TIMES, and opening up ZEROP, FIX, OR, and EQUAL,
to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
MAIN-LEMMA-BASE-CASE-LEMMA-2-HACK
(PROVE-LEMMA EQUAL-LENGTH-0
(REWRITE)
(EQUAL (EQUAL (LENGTH X) 0)
(NOT (LISTP X))))
This formula simplifies, expanding the function NOT, to two new conjectures:
Case 2. (IMPLIES (NOT (EQUAL (LENGTH X) 0))
(LISTP X)),
which again simplifies, opening up the functions LENGTH and EQUAL, to:
T.
Case 1. (IMPLIES (EQUAL (LENGTH X) 0)
(NOT (LISTP X))),
which we will name *1.
We will appeal to induction. There is only one plausible induction. We
will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X) (p (CDR X)))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces the following two new
formulas:
Case 2. (IMPLIES (AND (NOT (EQUAL (LENGTH (CDR X)) 0))
(EQUAL (LENGTH X) 0))
(NOT (LISTP X))).
This simplifies, expanding LENGTH, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP (CDR X)))
(EQUAL (LENGTH X) 0))
(NOT (LISTP X))).
This simplifies, unfolding LENGTH, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
EQUAL-LENGTH-0
(PROVE-LEMMA MAIN-LEMMA-BASE-CASE-LEMMA-2 NIL
(IMPLIES (AND (LISTP X)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(EQUAL (MINLIST X) (MAXLIST X)))
(EQUAL (MINLIST X) (FIX K)))
((USE (MAIN-LEMMA-BASE-CASE-LEMMA-2-LEMMA)
(MAIN-LEMMA-BASE-CASE-LEMMA-2-HACK (SUMLIST (SUMLIST X))
(MAXLIST (MAXLIST X))
(N (LENGTH X))
(K K)))))
This formula simplifies, rewriting with COMMUTATIVITY-OF-TIMES and
EQUAL-LENGTH-0, and expanding the functions IMPLIES, ZEROP, NOT, AND, FIX,
TIMES, and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
MAIN-LEMMA-BASE-CASE-LEMMA-2
(PROVE-LEMMA MAIN-LEMMA-BASE-CASE
(REWRITE)
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(EQUAL (MINLIST X) (MAXLIST X)))
(EQUAL (EXP K (LENGTH X))
(PRODLIST X)))
((USE (MAIN-LEMMA-BASE-CASE-LEMMA-1)
(MAIN-LEMMA-BASE-CASE-LEMMA-2))))
This simplifies, rewriting with COMMUTATIVITY-OF-TIMES, EXP-0-ARG2, and
EQUAL-LENGTH-0, and expanding the definitions of IMPLIES, AND, FIX, SUMLIST,
LENGTH, EQUAL, TIMES, MINLIST, MAXLIST, PRODLIST, and EXP, to three new goals:
Case 3. (IMPLIES (AND (EQUAL (EXP (MAXLIST X) (LENGTH X))
(PRODLIST X))
(NOT (NUMBERP K))
(EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X) 0)
(EQUAL (MINLIST X) 0)
(NOT (LISTP X)))
(EQUAL 1 (PRODLIST X))),
which again simplifies, unfolding the functions LENGTH, EXP, PRODLIST, EQUAL,
MAXLIST, SUMLIST, and MINLIST, to:
T.
Case 2. (IMPLIES (AND (EQUAL (EXP (MAXLIST X) (LENGTH X))
(PRODLIST X))
(NOT (NUMBERP K))
(EQUAL (MAXLIST X) 0)
(EQUAL (SUMLIST X) 0)
(EQUAL (MINLIST X) 0)
(LISTP X))
(EQUAL 0 (PRODLIST X))),
which again simplifies, applying EQUAL-LENGTH-0 and EXP-0-ARG1, to:
T.
Case 1. (IMPLIES (AND (EQUAL (EXP (MAXLIST X) (LENGTH X))
(PRODLIST X))
(NUMBERP K)
(EQUAL (MAXLIST X) K)
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(EQUAL (MINLIST X) K))
(EQUAL (EXP K (LENGTH X))
(PRODLIST X))).
This again simplifies, obviously, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
MAIN-LEMMA-BASE-CASE
(PROVE-LEMMA LENGTH-DELETE1
(REWRITE)
(EQUAL (LENGTH (DELETE1 A X))
(IF (MEMBER A X)
(SUB1 (LENGTH X))
(LENGTH X))))
This simplifies, obviously, to two new formulas:
Case 2. (IMPLIES (NOT (MEMBER A X))
(EQUAL (LENGTH (DELETE1 A X))
(LENGTH X))),
which we will name *1.
Case 1. (IMPLIES (MEMBER A X)
(EQUAL (LENGTH (DELETE1 A X))
(SUB1 (LENGTH X)))),
which we would usually push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us consider:
(EQUAL (LENGTH (DELETE1 A X))
(IF (MEMBER A X)
(SUB1 (LENGTH X))
(LENGTH X))),
which we named *1 above. We will appeal to induction. Four inductions are
suggested by terms in the conjecture. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X) (EQUAL A (CAR X)))
(p A X))
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(p A (CDR X)))
(p A X))
(IMPLIES (NOT (LISTP X)) (p A X))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces the following three new
goals:
Case 3. (IMPLIES (AND (LISTP X) (EQUAL A (CAR X)))
(EQUAL (LENGTH (DELETE1 A X))
(IF (MEMBER A X)
(SUB1 (LENGTH X))
(LENGTH X)))).
This simplifies, applying SUB1-ADD1, and opening up the definitions of
DELETE1, MEMBER, and LENGTH, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(EQUAL (LENGTH (DELETE1 A (CDR X)))
(IF (MEMBER A (CDR X))
(SUB1 (LENGTH (CDR X)))
(LENGTH (CDR X)))))
(EQUAL (LENGTH (DELETE1 A X))
(IF (MEMBER A X)
(SUB1 (LENGTH X))
(LENGTH X)))),
which simplifies, rewriting with CDR-CONS, ADD1-SUB1, EQUAL-LENGTH-0, and
SUB1-ADD1, and expanding the definitions of DELETE1, LENGTH, and MEMBER, to:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(MEMBER A (CDR X))
(EQUAL (LENGTH (DELETE1 A (CDR X)))
(SUB1 (LENGTH (CDR X))))
(NOT (LISTP (CDR X))))
(EQUAL 1 (LENGTH (CDR X)))),
which further simplifies, appealing to the lemma MEMBER-NON-LIST, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (LENGTH (DELETE1 A X))
(IF (MEMBER A X)
(SUB1 (LENGTH X))
(LENGTH X)))),
which simplifies, applying the lemma MEMBER-NON-LIST, and opening up DELETE1,
LENGTH, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LENGTH-DELETE1
(DEFN NUMBERP-LISTP
(X)
(IF (LISTP X)
(AND (NUMBERP (CAR X))
(NUMBERP-LISTP (CDR X)))
(EQUAL X NIL)))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT X) decreases according to the well-founded relation LESSP in each
recursive call. Hence, NUMBERP-LISTP is accepted under the principle of
definition. Note that:
(OR (FALSEP (NUMBERP-LISTP X))
(TRUEP (NUMBERP-LISTP X)))
is a theorem.
[ 0.0 0.0 0.0 ]
NUMBERP-LISTP
(PROVE-LEMMA MEMBER-MINLIST
(REWRITE)
(IMPLIES (AND (LISTP X) (NUMBERP-LISTP X))
(MEMBER (MINLIST X) X)))
Call the conjecture *1.
Perhaps we can prove it by induction. Three inductions are suggested by
terms in the conjecture. However, they merge into one likely candidate
induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP can be used to prove that the
measure (COUNT X) decreases according to the well-founded relation LESSP in
each induction step of the scheme. The above induction scheme leads to three
new goals:
Case 3. (IMPLIES (AND (LISTP (CDR X))
(NOT (NUMBERP-LISTP (CDR X)))
(LISTP X)
(NUMBERP-LISTP X))
(MEMBER (MINLIST X) X)),
which simplifies, opening up the definition of NUMBERP-LISTP, to:
T.
Case 2. (IMPLIES (AND (LISTP (CDR X))
(MEMBER (MINLIST (CDR X)) (CDR X))
(LISTP X)
(NUMBERP-LISTP X))
(MEMBER (MINLIST X) X)),
which simplifies, expanding NUMBERP-LISTP, MINLIST, and MIN, to two new
goals:
Case 2.2.
(IMPLIES (AND (LISTP (CDR X))
(MEMBER (MINLIST (CDR X)) (CDR X))
(LISTP X)
(NUMBERP (CAR X))
(NUMBERP-LISTP (CDR X))
(NOT (LESSP (CAR X) (MINLIST (CDR X)))))
(MEMBER (MINLIST (CDR X)) X)),
which again simplifies, opening up the function MEMBER, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP (CDR X))
(MEMBER (MINLIST (CDR X)) (CDR X))
(LISTP X)
(NUMBERP (CAR X))
(NUMBERP-LISTP (CDR X))
(LESSP (CAR X) (MINLIST (CDR X))))
(MEMBER (CAR X) X)),
which again simplifies, opening up the definition of MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP (CDR X)))
(LISTP X)
(NUMBERP-LISTP X))
(MEMBER (MINLIST X) X)),
which simplifies, expanding the functions NUMBERP-LISTP, MINLIST, and MEMBER,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MEMBER-MINLIST
(PROVE-LEMMA NUMBERP-LISTP-DELETE1
(REWRITE)
(IMPLIES (NUMBERP-LISTP X)
(NUMBERP-LISTP (DELETE1 A X))))
Call the conjecture *1.
We will try to prove it by induction. The recursive terms in the
conjecture suggest two inductions. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X) (EQUAL A (CAR X)))
(p A X))
(IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(p A (CDR X)))
(p A X))
(IMPLIES (NOT (LISTP X)) (p A X))).
Linear arithmetic and the lemma CDR-LESSP can be used to establish that the
measure (COUNT X) decreases according to the well-founded relation LESSP in
each induction step of the scheme. The above induction scheme generates the
following four new formulas:
Case 4. (IMPLIES (AND (LISTP X)
(EQUAL A (CAR X))
(NUMBERP-LISTP X))
(NUMBERP-LISTP (DELETE1 A X))).
This simplifies, expanding the definitions of NUMBERP-LISTP and DELETE1, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(NOT (NUMBERP-LISTP (CDR X)))
(NUMBERP-LISTP X))
(NUMBERP-LISTP (DELETE1 A X))).
This simplifies, opening up the function NUMBERP-LISTP, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (EQUAL A (CAR X)))
(NUMBERP-LISTP (DELETE1 A (CDR X)))
(NUMBERP-LISTP X))
(NUMBERP-LISTP (DELETE1 A X))).
This simplifies, applying the lemmas CDR-CONS and CAR-CONS, and unfolding
NUMBERP-LISTP and DELETE1, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(NUMBERP-LISTP X))
(NUMBERP-LISTP (DELETE1 A X))).
This simplifies, unfolding the definitions of NUMBERP-LISTP, LISTP, and
DELETE1, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NUMBERP-LISTP-DELETE1
(PROVE-LEMMA ADD1-PLUS-SUB1-SECOND
(REWRITE)
(IMPLIES (NOT (ZEROP Y))
(EQUAL (ADD1 (PLUS X (SUB1 Y)))
(PLUS X Y))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, and
IMPLIES, to:
(IMPLIES (AND (NOT (EQUAL Y 0)) (NUMBERP Y))
(EQUAL (ADD1 (PLUS X (SUB1 Y)))
(PLUS X Y))).
This simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
ADD1-PLUS-SUB1-SECOND
(PROVE-LEMMA SUMLIST-GEQ-MAXLIST
(REWRITE)
(NOT (LESSP (SUMLIST X) (MAXLIST X))))
WARNING: Note that the proposed lemma SUMLIST-GEQ-MAXLIST is to be stored as
zero type prescription rules, zero compound recognizer rules, two linear rules,
and zero replacement rules.
Give the conjecture the name *1.
We will appeal to induction. Two inductions are suggested by terms in
the conjecture. However, they merge into one likely candidate induction. We
will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces the following three new
conjectures:
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(MAXLIST (CDR X)))))
(NOT (LESSP (SUMLIST X) (MAXLIST X)))).
This simplifies, expanding the functions SUMLIST, MAXLIST, and MAX, to the
following three new conjectures:
Case 3.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X)))
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(CAR X)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(MAXLIST (CDR X))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
0))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(MAXLIST (CDR X))))
(LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(MAXLIST (CDR X))))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(NOT (LESSP (SUMLIST X) (MAXLIST X)))),
which simplifies, expanding the functions SUMLIST and MAXLIST, to two new
goals:
Case 2.2.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (CAR X))))
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
0))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X)))
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(CAR X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(NOT (LESSP (SUMLIST X) (MAXLIST X)))),
which simplifies, unfolding the functions SUMLIST, MAXLIST, and LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUMLIST-GEQ-MAXLIST
(PROVE-LEMMA SUMLIST-GEQ-MINLIST
(REWRITE)
(NOT (LESSP (SUMLIST X) (MINLIST X))))
WARNING: Note that the proposed lemma SUMLIST-GEQ-MINLIST is to be stored as
zero type prescription rules, zero compound recognizer rules, two linear rules,
and zero replacement rules.
This formula simplifies, using linear arithmetic and rewriting with
SUMLIST-GEQ-MAXLIST and MAXLIST-GEQ-MINLIST, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
SUMLIST-GEQ-MINLIST
(PROVE-LEMMA SUMLIST-GEQ-MINLIST-PLUS-MAXLIST
(REWRITE)
(IMPLIES (NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP (SUMLIST X)
(PLUS (MINLIST X) (MAXLIST X))))))
WARNING: Note that the proposed lemma SUMLIST-GEQ-MINLIST-PLUS-MAXLIST is to
be stored as zero type prescription rules, zero compound recognizer rules,
three linear rules, and zero replacement rules.
This simplifies, applying COMMUTATIVITY-OF-PLUS, to:
(IMPLIES (NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (LESSP (SUMLIST X)
(PLUS (MAXLIST X) (MINLIST X))))),
which we will name *1.
Perhaps we can prove it by induction. The recursive terms in the
conjecture suggest five inductions. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces the following four new
goals:
Case 4. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(NOT (LESSP (SUMLIST X)
(PLUS (MAXLIST X) (MINLIST X))))).
This simplifies, applying CORRECTNESS-OF-CANCEL-LESSP-PLUS,
MAXLIST-0-IS-SUMLIST-0, and COMMUTATIVITY-OF-PLUS, and opening up the
definitions of MINLIST, MIN, MAXLIST, MAX, SUMLIST, FIX, PLUS, and LESSP, to
six new conjectures:
Case 4.6.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (EQUAL (MAXLIST (CDR X)) (CAR X))))
(NOT (LESSP (SUMLIST (CDR X))
(MAXLIST (CDR X))))),
which again simplifies, using linear arithmetic and rewriting with
SUMLIST-GEQ-MAXLIST, to:
T.
Case 4.5.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL (MAXLIST (CDR X)) 0))
(NOT (EQUAL (SUMLIST (CDR X)) 0)))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS 0 (MAXLIST (CDR X)))))).
However this again simplifies, using linear arithmetic and rewriting with
the lemma SUMLIST-GEQ-MAXLIST, to:
T.
Case 4.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL (MAXLIST (CDR X)) 0))
(EQUAL (SUMLIST (CDR X)) 0))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X)) 0)))),
which again simplifies, using linear arithmetic and applying
SUMLIST-GEQ-MAXLIST, to:
T.
Case 4.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NUMBERP (CAR X))
(NOT (EQUAL (CAR X) (MAXLIST (CDR X)))))
(NOT (LESSP (SUMLIST (CDR X))
(MAXLIST (CDR X))))).
But this again simplifies, using linear arithmetic and rewriting with
SUMLIST-GEQ-MAXLIST, to:
T.
Case 4.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (MAXLIST (CDR X))))
(NOT (EQUAL (SUMLIST (CDR X)) 0)))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS 0 (MAXLIST (CDR X)))))).
But this again simplifies, using linear arithmetic and rewriting with
SUMLIST-GEQ-MAXLIST, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (MAXLIST (CDR X))))
(EQUAL (SUMLIST (CDR X)) 0))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X)) 0)))).
However this again simplifies, using linear arithmetic and applying
SUMLIST-GEQ-MAXLIST, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(MINLIST (CDR X)))))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(NOT (LESSP (SUMLIST X)
(PLUS (MAXLIST X) (MINLIST X))))).
This simplifies, applying CORRECTNESS-OF-CANCEL-LESSP-PLUS,
MAXLIST-0-IS-SUMLIST-0, PLUS-ZERO-ARG2, and COMMUTATIVITY-OF-PLUS, and
unfolding MINLIST, MIN, MAXLIST, MAX, SUMLIST, FIX, PLUS, LESSP, ZEROP, and
NUMBERP, to seven new conjectures:
Case 3.7.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(MINLIST (CDR X)))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NUMBERP (CAR X))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (EQUAL (MINLIST (CDR X)) (CAR X))))
(NOT (LESSP (SUMLIST (CDR X))
(MINLIST (CDR X))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.6.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(MINLIST (CDR X)))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (EQUAL (MINLIST (CDR X)) 0))
(NOT (EQUAL (SUMLIST (CDR X)) 0)))
(NOT (LESSP (SUMLIST (CDR X))
(MAXLIST (CDR X))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.5.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(MINLIST (CDR X)))))
(NOT (LESSP (CAR X) (MAXLIST (CDR X))))
(NOT (NUMBERP (CAR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (EQUAL (MINLIST (CDR X)) 0))
(EQUAL (SUMLIST (CDR X)) 0))
(NOT (LESSP (SUMLIST (CDR X)) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.4.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(MINLIST (CDR X)))))
(LESSP (CAR X) (MAXLIST (CDR X)))
(NOT (LESSP (CAR X) (MINLIST (CDR X))))
(NOT (EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))))
(NOT (LESSP (PLUS (CAR X) (SUMLIST (CDR X)))
(PLUS (MAXLIST (CDR X))
(MINLIST (CDR X)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.3.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(MINLIST (CDR X)))))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP (CAR X) (MINLIST (CDR X)))
(NUMBERP (CAR X))
(NOT (EQUAL (CAR X) (MAXLIST (CDR X)))))
(NOT (LESSP (SUMLIST (CDR X))
(MAXLIST (CDR X))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(MINLIST (CDR X)))))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (MAXLIST (CDR X))))
(NOT (EQUAL (SUMLIST (CDR X)) 0)))
(NOT (LESSP (SUMLIST (CDR X))
(MAXLIST (CDR X))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (SUMLIST (CDR X))
(PLUS (MAXLIST (CDR X))
(MINLIST (CDR X)))))
(LESSP (CAR X) (MAXLIST (CDR X)))
(LESSP (CAR X) (MINLIST (CDR X)))
(NOT (NUMBERP (CAR X)))
(NOT (EQUAL 0 (MAXLIST (CDR X))))
(EQUAL (SUMLIST (CDR X)) 0))
(NOT (LESSP (SUMLIST (CDR X)) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(NOT (LESSP (SUMLIST X)
(PLUS (MAXLIST X) (MINLIST X))))),
which simplifies, unfolding the functions MINLIST and MAXLIST, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(NOT (LESSP (SUMLIST X)
(PLUS (MAXLIST X) (MINLIST X))))),
which simplifies, unfolding the definitions of MINLIST, MAXLIST, and EQUAL,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
SUMLIST-GEQ-MINLIST-PLUS-MAXLIST
(DISABLE PLUS)
[ 0.0 0.0 0.0 ]
PLUS-OFF
(PROVE-LEMMA PLUS-TIMES-SUB1-SECOND
(REWRITE)
(IMPLIES (NOT (ZEROP Y))
(EQUAL (PLUS X (TIMES X (SUB1 Y)))
(TIMES X Y))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the newly proposed PLUS-TIMES-SUB1-SECOND could!
This formula can be simplified, using the abbreviations ZEROP, NOT, and
IMPLIES, to:
(IMPLIES (AND (NOT (EQUAL Y 0)) (NUMBERP Y))
(EQUAL (PLUS X (TIMES X (SUB1 Y)))
(TIMES X Y))).
Applying the lemma SUB1-ELIM, replace Y by (ADD1 Z) to eliminate (SUB1 Y). We
employ the type restriction lemma noted when SUB1 was introduced to restrict
the new variable. We thus obtain:
(IMPLIES (AND (NUMBERP Z)
(NOT (EQUAL (ADD1 Z) 0)))
(EQUAL (PLUS X (TIMES X Z))
(TIMES X (ADD1 Z)))),
which simplifies, applying TIMES-ADD1, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
PLUS-TIMES-SUB1-SECOND
(DISABLE TIMES)
[ 0.0 0.0 0.0 ]
TIMES-OFF
(PROVE-LEMMA MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2
(REWRITE)
(IMPLIES (NOT (EQUAL (MINLIST X) (MAXLIST X)))
(LESSP 1 (LENGTH X))))
WARNING: Note that the proposed lemma:
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2
is to be stored as zero type prescription rules, zero compound recognizer
rules, one linear rule, and zero replacement rules.
Name the conjecture *1.
Perhaps we can prove it by induction. Three inductions are suggested by
terms in the conjecture. However, they merge into one likely candidate
induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(p (CDR X)))
(p X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme leads to the following four new
conjectures:
Case 4. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(EQUAL (MINLIST (CDR X))
(MAXLIST (CDR X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP 1 (LENGTH X))).
This simplifies, rewriting with the lemmas SUB1-ADD1 and EQUAL-LENGTH-0, and
opening up the definitions of MINLIST, MIN, MAXLIST, MAX, LENGTH, SUB1,
NUMBERP, EQUAL, and LESSP, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP 1 (LENGTH (CDR X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP 1 (LENGTH X))).
This simplifies, appealing to the lemmas SUB1-ADD1 and EQUAL-LENGTH-0, and
expanding MINLIST, MIN, MAXLIST, MAX, LENGTH, SUB1, NUMBERP, EQUAL, and
LESSP, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP 1 (LENGTH X))).
This simplifies, expanding the functions MINLIST and MAXLIST, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(NOT (EQUAL (MINLIST X) (MAXLIST X))))
(LESSP 1 (LENGTH X))).
This simplifies, unfolding MINLIST, MAXLIST, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2
(DISABLE PLUS-ADD1-ARG1)
[ 0.0 0.0 0.0 ]
PLUS-ADD1-ARG1-OFF
(DISABLE PLUS-ADD1-ARG2)
[ 0.0 0.0 0.0 ]
PLUS-ADD1-ARG2-OFF
(DISABLE TIMES-ADD1)
[ 0.0 0.0 0.0 ]
TIMES-ADD1-OFF
(DISABLE MAXLIST-0-IS-SUMLIST-0)
[ 0.0 0.0 0.0 ]
MAXLIST-0-IS-SUMLIST-0-OFF
(PROVE-LEMMA TIMES-PRODLIST-DELETE1
(REWRITE)
(IMPLIES (MEMBER A X)
(EQUAL (TIMES A (PRODLIST (DELETE1 A X)))
(PRODLIST X))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-TIMES, could be applied
whenever the newly proposed TIMES-PRODLIST-DELETE1 could!
Name the conjecture *1.
Perhaps we can prove it by induction. Three inductions are suggested by
terms in the conjecture. However, they merge into one likely candidate
induction. We will induct according to the following scheme:
(AND (IMPLIES (NLISTP X) (p A X))
(IMPLIES (AND (NOT (NLISTP X))
(EQUAL A (CAR X)))
(p A X))
(IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL A (CAR X)))
(p A (CDR X)))
(p A X))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP inform us that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme leads to the following four new conjectures:
Case 4. (IMPLIES (AND (NLISTP X) (MEMBER A X))
(EQUAL (TIMES A (PRODLIST (DELETE1 A X)))
(PRODLIST X))).
This simplifies, rewriting with the lemma MEMBER-NON-LIST, and opening up
the definition of NLISTP, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP X))
(EQUAL A (CAR X))
(MEMBER A X))
(EQUAL (TIMES A (PRODLIST (DELETE1 A X)))
(PRODLIST X))).
This simplifies, opening up the functions NLISTP, MEMBER, DELETE1, and
PRODLIST, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL A (CAR X)))
(NOT (MEMBER A (CDR X)))
(MEMBER A X))
(EQUAL (TIMES A (PRODLIST (DELETE1 A X)))
(PRODLIST X))).
This simplifies, unfolding NLISTP and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL A (CAR X)))
(EQUAL (TIMES A
(PRODLIST (DELETE1 A (CDR X))))
(PRODLIST (CDR X)))
(MEMBER A X))
(EQUAL (TIMES A (PRODLIST (DELETE1 A X)))
(PRODLIST X))).
This simplifies, applying CDR-CONS, CAR-CONS, and
CORRECTNESS-OF-CANCEL-EQUAL-TIMES, and expanding NLISTP, MEMBER, DELETE1,
PRODLIST, ZEROP, FIX, and OR, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
TIMES-PRODLIST-DELETE1
(PROVE-LEMMA PRODUCT-OF-MODIFIED-LIST-LEMMA
(REWRITE)
(IMPLIES (AND (NOT (EQUAL MIN MAX))
(MEMBER MIN X)
(MEMBER MAX X))
(EQUAL (TIMES MAX MIN
(PRODLIST (DELETE1 MAX (DELETE1 MIN X))))
(PRODLIST X))))
WARNING: the previously added lemma, COMMUTATIVITY2-OF-TIMES, could be
applied whenever the newly proposed PRODUCT-OF-MODIFIED-LIST-LEMMA could!
WARNING: the previously added lemma, COMMUTATIVITY-OF-TIMES, could be applied
whenever the newly proposed PRODUCT-OF-MODIFIED-LIST-LEMMA could!
Give the conjecture the name *1.
Perhaps we can prove it by induction. Four inductions are suggested by
terms in the conjecture. However, they merge into one likely candidate
induction. We will induct according to the following scheme:
(AND (IMPLIES (NLISTP X) (p MAX MIN X))
(IMPLIES (AND (NOT (NLISTP X))
(EQUAL MIN (CAR X)))
(p MAX MIN X))
(IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL MIN (CAR X)))
(p MAX MIN (CDR X)))
(p MAX MIN X))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP inform us that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme generates the following five new goals:
Case 5. (IMPLIES (AND (NLISTP X)
(NOT (EQUAL MIN MAX))
(MEMBER MIN X)
(MEMBER MAX X))
(EQUAL (TIMES MAX MIN
(PRODLIST (DELETE1 MAX (DELETE1 MIN X))))
(PRODLIST X))).
This simplifies, rewriting with MEMBER-NON-LIST, and expanding NLISTP, to:
T.
Case 4. (IMPLIES (AND (NOT (NLISTP X))
(EQUAL MIN (CAR X))
(NOT (EQUAL MIN MAX))
(MEMBER MIN X)
(MEMBER MAX X))
(EQUAL (TIMES MAX MIN
(PRODLIST (DELETE1 MAX (DELETE1 MIN X))))
(PRODLIST X))),
which simplifies, applying CORRECTNESS-OF-CANCEL-EQUAL-TIMES and
TIMES-PRODLIST-DELETE1, and opening up the functions NLISTP, MEMBER, DELETE1,
PRODLIST, ZEROP, FIX, and OR, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL MIN (CAR X)))
(NOT (MEMBER MIN (CDR X)))
(NOT (EQUAL MIN MAX))
(MEMBER MIN X)
(MEMBER MAX X))
(EQUAL (TIMES MAX MIN
(PRODLIST (DELETE1 MAX (DELETE1 MIN X))))
(PRODLIST X))).
This simplifies, expanding the functions NLISTP and MEMBER, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP X))
(NOT (EQUAL MIN (CAR X)))
(NOT (MEMBER MAX (CDR X)))
(NOT (EQUAL MIN MAX))
(MEMBER MIN X)
(MEMBER MAX X))
(EQUAL (TIMES MAX MIN
(PRODLIST (DELETE1 MAX (DELETE1 MIN X))))
(PRODLIST X))).
This simplifies, rewriting with CDR-CONS, CAR-CONS, and
TIMES-PRODLIST-DELETE1, and unfolding the functions NLISTP, MEMBER, DELETE1,
and PRODLIST, to:
T.
Case 1. (IMPLIES
(AND (NOT (NLISTP X))
(NOT (EQUAL MIN (CAR X)))
(EQUAL (TIMES MAX MIN
(PRODLIST (DELETE1 MAX (DELETE1 MIN (CDR X)))))
(PRODLIST (CDR X)))
(NOT (EQUAL MIN MAX))
(MEMBER MIN X)
(MEMBER MAX X))
(EQUAL (TIMES MAX MIN
(PRODLIST (DELETE1 MAX (DELETE1 MIN X))))
(PRODLIST X))),
which simplifies, appealing to the lemmas CDR-CONS, CAR-CONS, and
TIMES-PRODLIST-DELETE1, and unfolding the functions NLISTP, MEMBER, DELETE1,
and PRODLIST, to two new conjectures:
Case 1.2.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL MIN (CAR X)))
(EQUAL (TIMES MAX MIN
(PRODLIST (DELETE1 MAX (DELETE1 MIN (CDR X)))))
(PRODLIST (CDR X)))
(NOT (EQUAL MIN MAX))
(MEMBER MIN (CDR X))
(MEMBER MAX (CDR X))
(NOT (EQUAL MAX (CAR X))))
(EQUAL (TIMES MAX MIN
(PRODLIST (CONS (CAR X)
(DELETE1 MAX (DELETE1 MIN (CDR X))))))
(TIMES (CAR X) (PRODLIST (CDR X))))),
which again simplifies, applying CDR-CONS, CAR-CONS, and
CORRECTNESS-OF-CANCEL-EQUAL-TIMES, and opening up the functions PRODLIST,
ZEROP, FIX, and OR, to:
T.
Case 1.1.
(IMPLIES
(AND (LISTP X)
(NOT (EQUAL MIN (CAR X)))
(EQUAL (TIMES MAX MIN
(PRODLIST (DELETE1 MAX (DELETE1 MIN (CDR X)))))
(PRODLIST (CDR X)))
(NOT (EQUAL MIN MAX))
(MEMBER MIN (CDR X))
(MEMBER MAX (CDR X))
(EQUAL MAX (CAR X)))
(EQUAL (TIMES MAX MIN
(PRODLIST (DELETE1 MIN (CDR X))))
(TIMES (CAR X) (PRODLIST (CDR X))))).
But this again simplifies, applying MEMBER-DELETE1, TIMES-PRODLIST-DELETE1,
and COMMUTATIVITY2-OF-TIMES, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
PRODUCT-OF-MODIFIED-LIST-LEMMA
(DISABLE TIMES-PRODLIST-DELETE1)
[ 0.0 0.0 0.0 ]
TIMES-PRODLIST-DELETE1-OFF
(PROVE-LEMMA PRODUCT-OF-MODIFIED-LIST-LEMMA-2
(REWRITE)
(IMPLIES (AND (LESSP MIN MAX)
(NOT (ZEROP MAX)))
(EQUAL (TIMES (ADD1 MIN) (SUB1 MAX) REST)
(PLUS (TIMES MIN MAX REST)
(TIMES (DIFFERENCE MAX (ADD1 MIN))
REST))))
((ENABLE TIMES-ADD1 TIMES PLUS-ADD1-ARG1 PLUS-ADD1-ARG2 PLUS)
(DISABLE PLUS-TIMES-SUB1-SECOND ADD1-PLUS-SUB1-SECOND)))
WARNING: the previously added lemma, COMMUTATIVITY2-OF-TIMES, could be
applied whenever the newly proposed PRODUCT-OF-MODIFIED-LIST-LEMMA-2 could!
WARNING: the previously added lemma, COMMUTATIVITY-OF-TIMES, could be applied
whenever the newly proposed PRODUCT-OF-MODIFIED-LIST-LEMMA-2 could!
This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and
IMPLIES, to the new conjecture:
(IMPLIES (AND (LESSP MIN MAX)
(NOT (EQUAL MAX 0))
(NUMBERP MAX))
(EQUAL (TIMES (ADD1 MIN) (SUB1 MAX) REST)
(PLUS (TIMES MIN MAX REST)
(TIMES (DIFFERENCE MAX (ADD1 MIN))
REST)))),
which simplifies, applying COMMUTATIVITY-OF-TIMES, SUB1-ADD1,
TIMES-DISTRIBUTES-OVER-PLUS, COMMUTATIVITY2-OF-TIMES, DIFFERENCE-ADD1-ARG2,
and ASSOCIATIVITY-OF-PLUS, and unfolding the definition of TIMES, to the
following two new formulas:
Case 2. (IMPLIES (AND (LESSP MIN MAX)
(NOT (EQUAL MAX 0))
(NUMBERP MAX)
(NOT (NUMBERP MIN)))
(EQUAL (PLUS (TIMES REST (SUB1 MAX))
(TIMES REST (SUB1 MAX) 0))
(PLUS (TIMES MIN REST)
(TIMES MIN REST (SUB1 MAX))
(TIMES REST
(SUB1 (DIFFERENCE MAX MIN)))))).
This again simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES and
PLUS-ZERO-ARG2, and expanding the definitions of LESSP, EQUAL, TIMES, ZEROP,
DIFFERENCE, and PLUS, to:
T.
Case 1. (IMPLIES (AND (LESSP MIN MAX)
(NOT (EQUAL MAX 0))
(NUMBERP MAX)
(NUMBERP MIN))
(EQUAL (PLUS (TIMES REST (SUB1 MAX))
(TIMES REST (SUB1 MAX) MIN))
(PLUS (TIMES MIN REST)
(TIMES MIN REST (SUB1 MAX))
(TIMES REST
(SUB1 (DIFFERENCE MAX MIN)))))),
which again simplifies, rewriting with COMMUTATIVITY-OF-TIMES,
COMMUTATIVITY2-OF-TIMES, and CORRECTNESS-OF-CANCEL-EQUAL-PLUS, and expanding
FIX, to the new formula:
(IMPLIES (AND (LESSP MIN MAX)
(NOT (EQUAL MAX 0))
(NUMBERP MAX)
(NUMBERP MIN))
(EQUAL (TIMES REST (SUB1 MAX))
(PLUS (TIMES MIN REST)
(TIMES REST
(SUB1 (DIFFERENCE MAX MIN)))))).
Applying the lemmas DIFFERENCE-ELIM and SUB1-ELIM, replace MAX by
(PLUS MIN X) to eliminate (DIFFERENCE MAX MIN) and X by (ADD1 Z) to
eliminate (SUB1 X). We use the type restriction lemma noted when DIFFERENCE
was introduced and the type restriction lemma noted when SUB1 was introduced
to restrict the new variables. This produces the following three new
conjectures:
Case 1.3.
(IMPLIES (AND (LESSP MAX MIN)
(LESSP MIN MAX)
(NOT (EQUAL MAX 0))
(NUMBERP MAX)
(NUMBERP MIN))
(EQUAL (TIMES REST (SUB1 MAX))
(PLUS (TIMES MIN REST)
(TIMES REST
(SUB1 (DIFFERENCE MAX MIN)))))).
But this further simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (EQUAL X 0)
(NUMBERP X)
(NOT (LESSP (PLUS MIN X) MIN))
(LESSP MIN (PLUS MIN X))
(NOT (EQUAL (PLUS MIN X) 0))
(NUMBERP MIN))
(EQUAL (TIMES REST (SUB1 (PLUS MIN X)))
(PLUS (TIMES MIN REST)
(TIMES REST (SUB1 X))))),
which further simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP Z)
(NOT (EQUAL (ADD1 Z) 0))
(NOT (LESSP (PLUS MIN (ADD1 Z)) MIN))
(LESSP MIN (PLUS MIN (ADD1 Z)))
(NOT (EQUAL (PLUS MIN (ADD1 Z)) 0))
(NUMBERP MIN))
(EQUAL (TIMES REST
(SUB1 (PLUS MIN (ADD1 Z))))
(PLUS (TIMES MIN REST)
(TIMES REST Z)))),
which further simplifies, rewriting with the lemmas PLUS-ADD1-ARG2,
SUB1-ADD1, COMMUTATIVITY-OF-TIMES, and TIMES-DISTRIBUTES-OVER-PLUS, and
opening up the definitions of LESSP, EQUAL, PLUS, NUMBERP, and TIMES, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
PRODUCT-OF-MODIFIED-LIST-LEMMA-2
(PROVE-LEMMA POSITIVE-IMPLIES-NUMBERP NIL
(IMPLIES (LESSP MIN MAX)
(NUMBERP MAX)))
This conjecture simplifies, unfolding the definition of LESSP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
POSITIVE-IMPLIES-NUMBERP
(PROVE-LEMMA PRODUCT-OF-MODIFIED-LIST
(REWRITE)
(IMPLIES (AND (LESSP MIN MAX)
(MEMBER MIN X)
(MEMBER MAX X))
(LET ((REST (PRODLIST (DELETE1 MAX (DELETE1 MIN X)))))
(EQUAL (TIMES (ADD1 MIN) (SUB1 MAX) REST)
(PLUS (PRODLIST X)
(TIMES (DIFFERENCE MAX (ADD1 MIN))
REST)))))
((USE (POSITIVE-IMPLIES-NUMBERP))))
WARNING: the previously added lemma, COMMUTATIVITY2-OF-TIMES, could be
applied whenever the newly proposed PRODUCT-OF-MODIFIED-LIST could!
WARNING: the previously added lemma, COMMUTATIVITY-OF-TIMES, could be applied
whenever the newly proposed PRODUCT-OF-MODIFIED-LIST could!
This simplifies, using linear arithmetic, rewriting with
PRODUCT-OF-MODIFIED-LIST-LEMMA, COMMUTATIVITY2-OF-TIMES, DIFFERENCE-ADD1-ARG2,
and PRODUCT-OF-MODIFIED-LIST-LEMMA-2, and opening up the definition of IMPLIES,
to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
PRODUCT-OF-MODIFIED-LIST
(PROVE-LEMMA MAIN-LEMMA NIL
(LET ((N (LENGTH X)))
(IMPLIES (AND (NUMBERP-LISTP X)
(EQUAL (SUMLIST X) (TIMES K N)))
(NOT (LESSP (EXP K N) (PRODLIST X)))))
((INDUCT (INDUCTION-FN X K))
(DO-NOT-INDUCT T)))
This conjecture can be simplified, using the abbreviations NOT, IMPLIES, OR,
and AND, to three new conjectures:
Case 3. T,
which simplifies, clearly, to:
T.
Case 2. (IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(EQUAL (MINLIST X) (MAXLIST X))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))).
This simplifies, appealing to the lemma MAIN-LEMMA-BASE-CASE, to the new
conjecture:
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(EQUAL (MINLIST X) (MAXLIST X))
(NUMBERP-LISTP X))
(NOT (LESSP (PRODLIST X) (PRODLIST X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(IMPLIES
(AND
(NUMBERP-LISTP (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(EQUAL
(SUMLIST (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(TIMES K
(LENGTH (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))))
(NOT
(LESSP
(EXP K
(LENGTH (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))
(PRODLIST (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which simplifies, using linear arithmetic, appealing to the lemmas CDR-CONS,
CAR-CONS, NUMBERP-LISTP-DELETE1, MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER,
MEMBER-MAXLIST, MEMBER-DELETE1, SUMLIST-DELETE1, PLUS-ZERO-ARG2,
PLUS-DIFFERENCE-ARG2, LENGTH-DELETE1, ADD1-SUB1, EXP-ADD1,
COMMUTATIVITY2-OF-TIMES, DIFFERENCE-ADD1-ARG2, COMMUTATIVITY-OF-TIMES,
PRODUCT-OF-MODIFIED-LIST-LEMMA-2, TIMES-1-ARG1, EXP-0-ARG2, and
EQUAL-LENGTH-0, and unfolding the functions NUMBERP-LISTP, SUMLIST, ZEROP,
LENGTH, AND, PRODLIST, NOT, IMPLIES, and EXP, to 25 new goals:
Case 1.25.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(EQUAL (MAXLIST X) 0)
(IMPLIES
(AND
(NUMBERP-LISTP (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(EQUAL
(SUMLIST (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))
(TIMES K
(LENGTH (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))))
(NOT
(LESSP
(EXP K
(LENGTH (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))
(PRODLIST (CONS (SUB1 (MAXLIST X))
(CONS (ADD1 (MINLIST X))
(DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, using linear arithmetic and rewriting with
MAXLIST-GEQ-MINLIST, to:
T.
Case 1.24.
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(NOT (EQUAL (SUB1 (LENGTH X)) 0))
(NOT (LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X))))
(NOT (EQUAL (PLUS (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))
(TIMES K (ADD1 (SUB1 (LENGTH X))))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))).
However this again simplifies, using linear arithmetic and rewriting with
SUMLIST-GEQ-MINLIST-PLUS-MAXLIST and COMMUTATIVITY-OF-PLUS, to:
(IMPLIES (AND (EQUAL (SUMLIST X)
(PLUS (MINLIST X) (MAXLIST X)))
(EQUAL (PLUS (MINLIST X) (MAXLIST X))
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(NOT (EQUAL (SUB1 (LENGTH X)) 0))
(NOT (LESSP (MAXLIST X)
(DIFFERENCE (PLUS (MINLIST X) (MAXLIST X))
(MINLIST X))))
(NOT (EQUAL (PLUS (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))
(TIMES K (ADD1 (SUB1 (LENGTH X))))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, rewriting with COMMUTATIVITY-OF-PLUS,
EQUAL-LENGTH-0, EQUAL-SUB1-0, and ADD1-SUB1, to:
(IMPLIES (AND (EQUAL (SUMLIST X)
(PLUS (MAXLIST X) (MINLIST X)))
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(LISTP X)
(NOT (EQUAL (LENGTH X) 1))
(NOT (LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X))))
(NOT (EQUAL (PLUS (ADD1 (MINLIST X))
(SUB1 (MAXLIST X)))
(SUMLIST X)))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.23.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(NOT (EQUAL (SUB1 (LENGTH X)) 0))
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(NOT
(EQUAL
(PLUS (SUB1 (MAXLIST X))
(DIFFERENCE (PLUS (ADD1 (MINLIST X))
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(MAXLIST X)))
(TIMES K (ADD1 (SUB1 (LENGTH X))))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, rewriting with EQUAL-LENGTH-0, EQUAL-SUB1-0,
COMMUTATIVITY-OF-PLUS, PLUS-ZERO-ARG2, PLUS-DIFFERENCE-ARG2, and ADD1-SUB1,
and unfolding the definition of ZEROP, to the following four new
conjectures:
Case 1.23.4.
(IMPLIES
(AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(LISTP X)
(NOT (EQUAL (LENGTH X) 1))
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(LESSP (MINLIST X) (SUMLIST X))
(NOT (LESSP (MAXLIST X)
(DIFFERENCE (PLUS (SUMLIST X) (ADD1 (MINLIST X)))
(MINLIST X))))
(NOT (EQUAL (SUB1 (MAXLIST X))
(SUMLIST X)))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))).
However this again simplifies, using linear arithmetic, to the formula:
(IMPLIES
(AND (LESSP (SUMLIST X) (MINLIST X))
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(LISTP X)
(NOT (EQUAL (LENGTH X) 1))
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(LESSP (MINLIST X) (SUMLIST X))
(NOT (LESSP (MAXLIST X)
(DIFFERENCE (PLUS (SUMLIST X) (ADD1 (MINLIST X)))
(MINLIST X))))
(NOT (EQUAL (SUB1 (MAXLIST X))
(SUMLIST X)))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))).
This again simplifies, using linear arithmetic, to:
T.
Case 1.23.3.
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(LISTP X)
(NOT (EQUAL (LENGTH X) 1))
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(NOT (LESSP (MINLIST X) (SUMLIST X)))
(NOT (LESSP (MAXLIST X)
(ADD1 (MINLIST X))))
(NOT (EQUAL (SUB1 (MAXLIST X))
(SUMLIST X)))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (SUMLIST X) (MINLIST X))
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(LISTP X)
(NOT (EQUAL (LENGTH X) 1))
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(NOT (LESSP (MINLIST X) (SUMLIST X)))
(NOT (LESSP (MAXLIST X)
(ADD1 (MINLIST X))))
(NOT (EQUAL (SUB1 (MAXLIST X))
(SUMLIST X)))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))).
However this again simplifies, using linear arithmetic and applying
SUMLIST-GEQ-MINLIST-PLUS-MAXLIST and COMMUTATIVITY-OF-PLUS, to:
T.
Case 1.23.2.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(LISTP X)
(NOT (EQUAL (LENGTH X) 1))
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(LESSP (MINLIST X) (SUMLIST X))
(LESSP (MAXLIST X)
(DIFFERENCE (PLUS (SUMLIST X) (ADD1 (MINLIST X)))
(MINLIST X)))
(NOT
(EQUAL
(DIFFERENCE
(PLUS (SUB1 (MAXLIST X))
(DIFFERENCE (PLUS (SUMLIST X) (ADD1 (MINLIST X)))
(MINLIST X)))
(MAXLIST X))
(SUMLIST X)))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))).
But this again simplifies, using linear arithmetic, to two new
conjectures:
Case 1.23.2.2.
(IMPLIES
(AND
(LESSP (PLUS (SUB1 (MAXLIST X))
(DIFFERENCE (PLUS (SUMLIST X) (ADD1 (MINLIST X)))
(MINLIST X)))
(MAXLIST X))
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(LISTP X)
(NOT (EQUAL (LENGTH X) 1))
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(LESSP (MINLIST X) (SUMLIST X))
(LESSP (MAXLIST X)
(DIFFERENCE (PLUS (SUMLIST X) (ADD1 (MINLIST X)))
(MINLIST X)))
(NOT
(EQUAL
(DIFFERENCE
(PLUS (SUB1 (MAXLIST X))
(DIFFERENCE (PLUS (SUMLIST X) (ADD1 (MINLIST X)))
(MINLIST X)))
(MAXLIST X))
(SUMLIST X)))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.23.2.1.
(IMPLIES
(AND
(LESSP (PLUS (SUMLIST X) (ADD1 (MINLIST X)))
(MINLIST X))
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(LISTP X)
(NOT (EQUAL (LENGTH X) 1))
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(LESSP (MINLIST X) (SUMLIST X))
(LESSP (MAXLIST X)
(DIFFERENCE (PLUS (SUMLIST X) (ADD1 (MINLIST X)))
(MINLIST X)))
(NOT
(EQUAL
(DIFFERENCE
(PLUS (SUB1 (MAXLIST X))
(DIFFERENCE (PLUS (SUMLIST X) (ADD1 (MINLIST X)))
(MINLIST X)))
(MAXLIST X))
(SUMLIST X)))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.23.1.
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(LISTP X)
(NOT (EQUAL (LENGTH X) 1))
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(NOT (LESSP (MINLIST X) (SUMLIST X)))
(LESSP (MAXLIST X) (ADD1 (MINLIST X)))
(NOT (EQUAL (DIFFERENCE (PLUS (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))
(MAXLIST X))
(SUMLIST X)))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, using linear arithmetic, to the goal:
(IMPLIES (AND (LESSP (SUMLIST X) (MINLIST X))
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(LISTP X)
(NOT (EQUAL (LENGTH X) 1))
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(NOT (LESSP (MINLIST X) (SUMLIST X)))
(LESSP (MAXLIST X) (ADD1 (MINLIST X)))
(NOT (EQUAL (DIFFERENCE (PLUS (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))
(MAXLIST X))
(SUMLIST X)))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))).
However this again simplifies, using linear arithmetic and applying
SUMLIST-GEQ-MINLIST-PLUS-MAXLIST and COMMUTATIVITY-OF-PLUS, to:
T.
Case 1.22.
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(NOT (LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X))))
(NOT (EQUAL (PLUS (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))
(TIMES K 2)))
(NUMBERP-LISTP X)
(NOT (LISTP X)))
(NOT (LESSP 1 (PRODLIST X)))).
This again simplifies, using linear arithmetic, rewriting with
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, and unfolding the function
LENGTH, to:
T.
Case 1.21.
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(NOT (LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X))))
(NOT (EQUAL (PLUS (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))
(TIMES K 2)))
(NUMBERP-LISTP X)
(LISTP X)
(NUMBERP K))
(NOT (LESSP K (PRODLIST X)))).
But this again simplifies, using linear arithmetic and applying the lemma
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.20.
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(NOT (LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X))))
(NOT (EQUAL (PLUS (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))
(TIMES K 2)))
(NUMBERP-LISTP X)
(LISTP X)
(NOT (NUMBERP K)))
(NOT (LESSP 0 (PRODLIST X)))),
which again simplifies, using linear arithmetic and applying
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.19.
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (MEMBER (MINLIST X) X))
(EQUAL (LENGTH X) 0)
(NOT (LESSP (MAXLIST X) (SUMLIST X)))
(NOT (EQUAL (PLUS (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))
(TIMES K 2)))
(NUMBERP-LISTP X))
(NOT (LESSP 1 (PRODLIST X)))).
This again simplifies, using linear arithmetic and rewriting with
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.18.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(NOT
(EQUAL
(PLUS (SUB1 (MAXLIST X))
(DIFFERENCE (PLUS (ADD1 (MINLIST X))
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(MAXLIST X)))
(TIMES K 2)))
(NUMBERP-LISTP X)
(NOT (LISTP X)))
(NOT (LESSP 1 (PRODLIST X)))).
This again simplifies, using linear arithmetic, rewriting with
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, and expanding the function
LENGTH, to:
T.
Case 1.17.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(NOT
(EQUAL
(PLUS (SUB1 (MAXLIST X))
(DIFFERENCE (PLUS (ADD1 (MINLIST X))
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(MAXLIST X)))
(TIMES K 2)))
(NUMBERP-LISTP X)
(LISTP X)
(NUMBERP K))
(NOT (LESSP K (PRODLIST X)))).
This again simplifies, using linear arithmetic and rewriting with
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.16.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(LESSP (MAXLIST X)
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(NOT
(EQUAL
(PLUS (SUB1 (MAXLIST X))
(DIFFERENCE (PLUS (ADD1 (MINLIST X))
(DIFFERENCE (SUMLIST X) (MINLIST X)))
(MAXLIST X)))
(TIMES K 2)))
(NUMBERP-LISTP X)
(LISTP X)
(NOT (NUMBERP K)))
(NOT (LESSP 0 (PRODLIST X)))).
This again simplifies, using linear arithmetic and applying the lemma
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.15.
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (MEMBER (MINLIST X) X))
(NOT (EQUAL (LENGTH X) 0))
(NOT (LESSP (MAXLIST X) (SUMLIST X)))
(NOT (EQUAL (PLUS (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))
(TIMES K (ADD1 (LENGTH X)))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, using linear arithmetic and rewriting with
SUMLIST-GEQ-MAXLIST, to:
(IMPLIES (AND (EQUAL (SUMLIST X) (MAXLIST X))
(EQUAL (MAXLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (MEMBER (MINLIST X) X))
(NOT (EQUAL (LENGTH X) 0))
(NOT (LESSP (MAXLIST X) (MAXLIST X)))
(NOT (EQUAL (PLUS (SUB1 (MAXLIST X))
(ADD1 (MINLIST X)))
(TIMES K (ADD1 (LENGTH X)))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, rewriting with the lemmas EQUAL-LENGTH-0 and
COMMUTATIVITY-OF-PLUS, and unfolding LESSP, to the conjecture:
(IMPLIES (AND (EQUAL (SUMLIST X) (MAXLIST X))
(EQUAL (MAXLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (MEMBER (MINLIST X) X))
(LISTP X)
(NOT (LESSP (SUB1 (MAXLIST X))
(SUB1 (MAXLIST X))))
(NOT (EQUAL (PLUS (ADD1 (MINLIST X))
(SUB1 (MAXLIST X)))
(TIMES K (ADD1 (LENGTH X)))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))).
This again simplifies, rewriting with MEMBER-MINLIST, to:
T.
Case 1.14.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (MEMBER (MINLIST X) X))
(NOT (EQUAL (LENGTH X) 0))
(LESSP (MAXLIST X) (SUMLIST X))
(NOT (EQUAL (PLUS (SUB1 (MAXLIST X))
(DIFFERENCE (PLUS (ADD1 (MINLIST X)) (SUMLIST X))
(MAXLIST X)))
(TIMES K (ADD1 (LENGTH X)))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))).
However this again simplifies, applying the lemmas EQUAL-LENGTH-0,
COMMUTATIVITY-OF-PLUS, COMMUTATIVITY2-OF-PLUS, PLUS-ZERO-ARG2, and
PLUS-DIFFERENCE-ARG2, and expanding the function ZEROP, to two new
formulas:
Case 1.14.2.
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (MEMBER (MINLIST X) X))
(LISTP X)
(LESSP (MAXLIST X) (SUMLIST X))
(NOT (LESSP (MAXLIST X)
(PLUS (SUMLIST X)
(ADD1 (MINLIST X)))))
(NOT (EQUAL (SUB1 (MAXLIST X))
(TIMES K (ADD1 (LENGTH X)))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.14.1.
(IMPLIES (AND (EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (MEMBER (MINLIST X) X))
(LISTP X)
(LESSP (MAXLIST X) (SUMLIST X))
(LESSP (MAXLIST X)
(PLUS (SUMLIST X) (ADD1 (MINLIST X))))
(NOT (EQUAL (DIFFERENCE (PLUS (SUMLIST X)
(ADD1 (MINLIST X))
(SUB1 (MAXLIST X)))
(MAXLIST X))
(TIMES K (ADD1 (LENGTH X)))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, rewriting with the lemma MEMBER-MINLIST, to:
T.
Case 1.13.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (MEMBER (MINLIST X) X))
(EQUAL (LENGTH X) 0)
(LESSP (MAXLIST X) (SUMLIST X))
(NOT (EQUAL (PLUS (SUB1 (MAXLIST X))
(DIFFERENCE (PLUS (ADD1 (MINLIST X)) (SUMLIST X))
(MAXLIST X)))
(TIMES K 2)))
(NUMBERP-LISTP X))
(NOT (LESSP 1 (PRODLIST X)))),
which again simplifies, using linear arithmetic and applying
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.12.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (LESSP (MINLIST X) (MAXLIST X)))
(MEMBER (MINLIST X) X)
(NOT (EQUAL (SUB1 (LENGTH X)) 0))
(NOT
(LESSP (TIMES K (EXP K (SUB1 (LENGTH X))))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))).
This again simplifies, using linear arithmetic and applying the lemma
MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER, to:
T.
Case 1.11.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (LESSP (MINLIST X) (MAXLIST X)))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(NOT
(LESSP (TIMES K (EXP K 1))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0))))
(NUMBERP-LISTP X)
(NOT (LISTP X)))
(NOT (LESSP 1 (PRODLIST X)))),
which again simplifies, using linear arithmetic, appealing to the lemma
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, and expanding LENGTH, to:
T.
Case 1.10.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (LESSP (MINLIST X) (MAXLIST X)))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(NOT
(LESSP (TIMES K (EXP K 1))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0))))
(NUMBERP-LISTP X)
(LISTP X)
(NUMBERP K))
(NOT (LESSP K (PRODLIST X)))),
which again simplifies, using linear arithmetic and rewriting with
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.9.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (LESSP (MINLIST X) (MAXLIST X)))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(NOT
(LESSP (TIMES K (EXP K 1))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0))))
(NUMBERP-LISTP X)
(LISTP X)
(NOT (NUMBERP K)))
(NOT (LESSP 0 (PRODLIST X)))).
But this again simplifies, using linear arithmetic and applying the lemma
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.8.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (LESSP (MINLIST X) (MAXLIST X)))
(NOT (MEMBER (MINLIST X) X))
(EQUAL (LENGTH X) 0)
(NOT
(LESSP (TIMES K (EXP K 1))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0))))
(NUMBERP-LISTP X))
(NOT (LESSP 1 (PRODLIST X)))),
which again simplifies, using linear arithmetic and applying the lemma
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.7.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(NOT (LESSP (MINLIST X) (MAXLIST X)))
(NOT (MEMBER (MINLIST X) X))
(NOT (EQUAL (LENGTH X) 0))
(NOT
(LESSP (TIMES K (EXP K (LENGTH X)))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
0))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, using linear arithmetic and rewriting with the
lemma MINLIST-LESS-THAN-MAXLIST-MINUS-1-BETTER, to:
T.
Case 1.6.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(LESSP (MINLIST X) (MAXLIST X))
(MEMBER (MINLIST X) X)
(NOT (EQUAL (SUB1 (LENGTH X)) 0))
(NOT
(LESSP (TIMES K (EXP K (SUB1 (LENGTH X))))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(SUB1 (DIFFERENCE (MAXLIST X)
(MINLIST X)))))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, rewriting with the lemmas EQUAL-LENGTH-0,
EQUAL-SUB1-0, MEMBER-MAXLIST, PRODUCT-OF-MODIFIED-LIST-LEMMA, and
COMMUTATIVITY-OF-TIMES, and expanding EXP, to the goal:
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(LESSP (MINLIST X) (MAXLIST X))
(MEMBER (MINLIST X) X)
(LISTP X)
(NOT (EQUAL (LENGTH X) 1))
(NOT
(LESSP
(TIMES K (EXP K (SUB1 (LENGTH X))))
(PLUS (PRODLIST X)
(TIMES (SUB1 (DIFFERENCE (MAXLIST X) (MINLIST X)))
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))))
(NUMBERP-LISTP X))
(NOT (LESSP (TIMES K (EXP K (SUB1 (LENGTH X))))
(PRODLIST X)))).
This again simplifies, using linear arithmetic, to:
T.
Case 1.5.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(LESSP (MINLIST X) (MAXLIST X))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(NOT
(LESSP (TIMES K (EXP K 1))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(SUB1 (DIFFERENCE (MAXLIST X)
(MINLIST X)))))))
(NUMBERP-LISTP X)
(NOT (LISTP X)))
(NOT (LESSP 1 (PRODLIST X)))),
which again simplifies, using linear arithmetic, rewriting with the lemma
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, and opening up the
definition of LENGTH, to:
T.
Case 1.4.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(LESSP (MINLIST X) (MAXLIST X))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(NOT
(LESSP (TIMES K (EXP K 1))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(SUB1 (DIFFERENCE (MAXLIST X)
(MINLIST X)))))))
(NUMBERP-LISTP X)
(LISTP X)
(NUMBERP K))
(NOT (LESSP K (PRODLIST X)))),
which again simplifies, using linear arithmetic and rewriting with
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.3.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(LESSP (MINLIST X) (MAXLIST X))
(MEMBER (MINLIST X) X)
(EQUAL (SUB1 (LENGTH X)) 0)
(NOT
(LESSP (TIMES K (EXP K 1))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(SUB1 (DIFFERENCE (MAXLIST X)
(MINLIST X)))))))
(NUMBERP-LISTP X)
(LISTP X)
(NOT (NUMBERP K)))
(NOT (LESSP 0 (PRODLIST X)))).
This again simplifies, using linear arithmetic and applying
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.2.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(LESSP (MINLIST X) (MAXLIST X))
(NOT (MEMBER (MINLIST X) X))
(EQUAL (LENGTH X) 0)
(NOT
(LESSP (TIMES K (EXP K 1))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(SUB1 (DIFFERENCE (MAXLIST X)
(MINLIST X)))))))
(NUMBERP-LISTP X))
(NOT (LESSP 1 (PRODLIST X)))).
But this again simplifies, using linear arithmetic and rewriting with
MINLIST-NOT-MAXLIST-IMPLIES-LENGTH-AT-LEAST-2, to:
T.
Case 1.1.
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(LESSP (MINLIST X) (MAXLIST X))
(NOT (MEMBER (MINLIST X) X))
(NOT (EQUAL (LENGTH X) 0))
(NOT
(LESSP (TIMES K (EXP K (LENGTH X)))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))
(SUB1 (DIFFERENCE (MAXLIST X)
(MINLIST X)))))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))).
This again simplifies, applying EQUAL-LENGTH-0 and COMMUTATIVITY-OF-TIMES,
to the new formula:
(IMPLIES
(AND
(EQUAL (SUMLIST X)
(TIMES K (LENGTH X)))
(NOT (EQUAL (MINLIST X) (MAXLIST X)))
(NOT (EQUAL (MAXLIST X) 0))
(LESSP (MINLIST X) (MAXLIST X))
(NOT (MEMBER (MINLIST X) X))
(LISTP X)
(NOT
(LESSP
(TIMES K (EXP K (LENGTH X)))
(PLUS (TIMES (MAXLIST X)
(MINLIST X)
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X))))
(TIMES (SUB1 (DIFFERENCE (MAXLIST X) (MINLIST X)))
(PRODLIST (DELETE1 (MAXLIST X)
(DELETE1 (MINLIST X) X)))))))
(NUMBERP-LISTP X))
(NOT (LESSP (EXP K (LENGTH X))
(PRODLIST X)))),
which again simplifies, rewriting with MEMBER-MINLIST, to:
T.
Q.E.D.
[ 0.0 0.9 0.3 ]
MAIN-LEMMA
(DEFN SCALAR-PRODUCT
(SCALAR LST)
(IF (LISTP LST)
(CONS (TIMES SCALAR (CAR LST))
(SCALAR-PRODUCT SCALAR (CDR LST)))
NIL))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LST) decreases according to the well-founded relation LESSP in each
recursive call. Hence, SCALAR-PRODUCT is accepted under the principle of
definition. Note that:
(OR (LITATOM (SCALAR-PRODUCT SCALAR LST))
(LISTP (SCALAR-PRODUCT SCALAR LST)))
is a theorem.
[ 0.0 0.0 0.0 ]
SCALAR-PRODUCT
(PROVE-LEMMA SUMLIST-SCALAR-PRODUCT
(REWRITE)
(EQUAL (SUMLIST (SCALAR-PRODUCT SCALAR LST))
(TIMES SCALAR (SUMLIST LST))))
Name the conjecture *1.
We will appeal to induction. The recursive terms in the conjecture
suggest two inductions. However, they merge into one likely candidate
induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP LST) (p SCALAR (CDR LST)))
(p SCALAR LST))
(IMPLIES (NOT (LISTP LST))
(p SCALAR LST))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LST) decreases according to the well-founded relation LESSP in each
induction step of the scheme. The above induction scheme produces the
following two new formulas:
Case 2. (IMPLIES (AND (LISTP LST)
(EQUAL (SUMLIST (SCALAR-PRODUCT SCALAR (CDR LST)))
(TIMES SCALAR (SUMLIST (CDR LST)))))
(EQUAL (SUMLIST (SCALAR-PRODUCT SCALAR LST))
(TIMES SCALAR (SUMLIST LST)))).
This simplifies, applying CDR-CONS, CAR-CONS, and
TIMES-DISTRIBUTES-OVER-PLUS, and expanding SCALAR-PRODUCT and SUMLIST, to:
T.
Case 1. (IMPLIES (NOT (LISTP LST))
(EQUAL (SUMLIST (SCALAR-PRODUCT SCALAR LST))
(TIMES SCALAR (SUMLIST LST)))),
which simplifies, applying COMMUTATIVITY-OF-TIMES and EQUAL-TIMES-X-X, and
expanding the functions SCALAR-PRODUCT, SUMLIST, NUMBERP, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUMLIST-SCALAR-PRODUCT
(PROVE-LEMMA PRODLIST-SCALAR-PRODUCT
(REWRITE)
(EQUAL (PRODLIST (SCALAR-PRODUCT SCALAR LST))
(TIMES (EXP SCALAR (LENGTH LST))
(PRODLIST LST))))
This simplifies, appealing to the lemma COMMUTATIVITY-OF-TIMES, to the
conjecture:
(EQUAL (PRODLIST (SCALAR-PRODUCT SCALAR LST))
(TIMES (PRODLIST LST)
(EXP SCALAR (LENGTH LST)))).
Name the above subgoal *1.
Perhaps we can prove it by induction. There are three plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (AND (LISTP LST) (p SCALAR (CDR LST)))
(p SCALAR LST))
(IMPLIES (NOT (LISTP LST))
(p SCALAR LST))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LST) decreases according to the well-founded relation LESSP in each
induction step of the scheme. The above induction scheme leads to the
following two new conjectures:
Case 2. (IMPLIES (AND (LISTP LST)
(EQUAL (PRODLIST (SCALAR-PRODUCT SCALAR (CDR LST)))
(TIMES (PRODLIST (CDR LST))
(EXP SCALAR (LENGTH (CDR LST))))))
(EQUAL (PRODLIST (SCALAR-PRODUCT SCALAR LST))
(TIMES (PRODLIST LST)
(EXP SCALAR (LENGTH LST))))).
This simplifies, rewriting with ASSOCIATIVITY-OF-TIMES, CDR-CONS, CAR-CONS,
EXP-ADD1, and COMMUTATIVITY2-OF-TIMES, and expanding the functions
SCALAR-PRODUCT, PRODLIST, and LENGTH, to:
T.
Case 1. (IMPLIES (NOT (LISTP LST))
(EQUAL (PRODLIST (SCALAR-PRODUCT SCALAR LST))
(TIMES (PRODLIST LST)
(EXP SCALAR (LENGTH LST))))),
which simplifies, applying the lemma EXP-0-ARG2, and opening up the
definitions of SCALAR-PRODUCT, PRODLIST, LENGTH, TIMES, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
PRODLIST-SCALAR-PRODUCT
(PROVE-LEMMA LENGTH-SCALAR-PRODUCT
(REWRITE)
(EQUAL (LENGTH (SCALAR-PRODUCT N A))
(LENGTH A)))
Call the conjecture *1.
We will try to prove it by induction. The recursive terms in the
conjecture suggest two inductions. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP A) (p N (CDR A)))
(p N A))
(IMPLIES (NOT (LISTP A)) (p N A))).
Linear arithmetic and the lemma CDR-LESSP can be used to establish that the
measure (COUNT A) decreases according to the well-founded relation LESSP in
each induction step of the scheme. The above induction scheme generates the
following two new formulas:
Case 2. (IMPLIES (AND (LISTP A)
(EQUAL (LENGTH (SCALAR-PRODUCT N (CDR A)))
(LENGTH (CDR A))))
(EQUAL (LENGTH (SCALAR-PRODUCT N A))
(LENGTH A))).
This simplifies, applying CDR-CONS, and expanding the functions
SCALAR-PRODUCT and LENGTH, to:
T.
Case 1. (IMPLIES (NOT (LISTP A))
(EQUAL (LENGTH (SCALAR-PRODUCT N A))
(LENGTH A))),
which simplifies, opening up the functions SCALAR-PRODUCT, LENGTH, and EQUAL,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
LENGTH-SCALAR-PRODUCT
(PROVE-LEMMA NUMBERP-LISTP-SCALAR-PRODUCT
(REWRITE)
(IMPLIES (NUMBERP-LISTP A)
(NUMBERP-LISTP (SCALAR-PRODUCT N A))))
Call the conjecture *1.
We will try to prove it by induction. The recursive terms in the
conjecture suggest two inductions. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP A) (p N (CDR A)))
(p N A))
(IMPLIES (NOT (LISTP A)) (p N A))).
Linear arithmetic and the lemma CDR-LESSP can be used to establish that the
measure (COUNT A) decreases according to the well-founded relation LESSP in
each induction step of the scheme. The above induction scheme generates the
following three new formulas:
Case 3. (IMPLIES (AND (LISTP A)
(NOT (NUMBERP-LISTP (CDR A)))
(NUMBERP-LISTP A))
(NUMBERP-LISTP (SCALAR-PRODUCT N A))).
This simplifies, expanding the definition of NUMBERP-LISTP, to:
T.
Case 2. (IMPLIES (AND (LISTP A)
(NUMBERP-LISTP (SCALAR-PRODUCT N (CDR A)))
(NUMBERP-LISTP A))
(NUMBERP-LISTP (SCALAR-PRODUCT N A))).
This simplifies, appealing to the lemmas CDR-CONS and CAR-CONS, and opening
up NUMBERP-LISTP and SCALAR-PRODUCT, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP A))
(NUMBERP-LISTP A))
(NUMBERP-LISTP (SCALAR-PRODUCT N A))).
This simplifies, unfolding NUMBERP-LISTP, LISTP, and SCALAR-PRODUCT, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NUMBERP-LISTP-SCALAR-PRODUCT
(PROVE-LEMMA MAIN NIL
(IMPLIES (NUMBERP-LISTP A)
(LET ((N (LENGTH A)))
(GEQ (EXP (SUMLIST A) N)
(TIMES (EXP N N) (PRODLIST A)))))
((USE (MAIN-LEMMA (K (SUMLIST A))
(X (SCALAR-PRODUCT (LENGTH A) A))))))
This conjecture can be simplified, using the abbreviations IMPLIES,
LENGTH-SCALAR-PRODUCT, and SUMLIST-SCALAR-PRODUCT, to:
(IMPLIES
(AND (IMPLIES (AND (NUMBERP-LISTP (SCALAR-PRODUCT (LENGTH A) A))
(EQUAL (TIMES (LENGTH A) (SUMLIST A))
(TIMES (SUMLIST A) (LENGTH A))))
(NOT (LESSP (EXP (SUMLIST A) (LENGTH A))
(PRODLIST (SCALAR-PRODUCT (LENGTH A) A)))))
(NUMBERP-LISTP A))
(NOT (LESSP (EXP (SUMLIST A) (LENGTH A))
(TIMES (EXP (LENGTH A) (LENGTH A))
(PRODLIST A))))).
This simplifies, appealing to the lemmas NUMBERP-LISTP-SCALAR-PRODUCT,
COMMUTATIVITY-OF-TIMES, and PRODLIST-SCALAR-PRODUCT, and unfolding AND, NOT,
and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
MAIN
(PROVE-LEMMA SUMLIST-FOR
(REWRITE)
(EQUAL (SUMLIST A)
(FOR X IN A SUM X)))
WARNING: the newly proposed lemma, SUMLIST-FOR, could be applied whenever the
previously added lemma SUMLIST-SCALAR-PRODUCT could.
WARNING: the newly proposed lemma, SUMLIST-FOR, could be applied whenever the
previously added lemma SUMLIST-DELETE1 could.
Call the conjecture *1.
Let us appeal to the induction principle. There are two plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (AND (LISTP A) (p (CDR A)))
(p A))
(IMPLIES (NOT (LISTP A)) (p A))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT A)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces two new formulas:
Case 2. (IMPLIES (AND (LISTP A)
(EQUAL (SUMLIST (CDR A))
(FOR X IN (CDR A) SUM X)))
(EQUAL (SUMLIST A)
(FOR X IN A SUM X))),
which simplifies, applying the lemma REWRITE-EVAL$, and opening up SUMLIST,
EVAL$, FOR, EQUAL, and QUANTIFIER-OPERATION, to:
T.
Case 1. (IMPLIES (NOT (LISTP A))
(EQUAL (SUMLIST A)
(FOR X IN A SUM X))),
which simplifies, applying MEMBER-NON-LIST, and unfolding the definitions of
SUMLIST, FOR, CDR, ASSOC, QUANTIFIER-INITIAL-VALUE, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
SUMLIST-FOR
(PROVE-LEMMA PRODLIST-FOR
(REWRITE)
(EQUAL (PRODLIST A)
(FOR X IN A MULTIPLY X)))
WARNING: the newly proposed lemma, PRODLIST-FOR, could be applied whenever
the previously added lemma PRODLIST-SCALAR-PRODUCT could.
Call the conjecture *1.
Let us appeal to the induction principle. There are two plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (AND (LISTP A) (p (CDR A)))
(p A))
(IMPLIES (NOT (LISTP A)) (p A))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT A)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces two new formulas:
Case 2. (IMPLIES (AND (LISTP A)
(EQUAL (PRODLIST (CDR A))
(FOR X IN (CDR A) MULTIPLY X)))
(EQUAL (PRODLIST A)
(FOR X IN A MULTIPLY X))),
which simplifies, applying the lemma REWRITE-EVAL$, and opening up PRODLIST,
EVAL$, FOR, EQUAL, and QUANTIFIER-OPERATION, to:
T.
Case 1. (IMPLIES (NOT (LISTP A))
(EQUAL (PRODLIST A)
(FOR X IN A MULTIPLY X))),
which simplifies, applying MEMBER-NON-LIST, and unfolding the definitions of
PRODLIST, FOR, CDR, ASSOC, QUANTIFIER-INITIAL-VALUE, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
PRODLIST-FOR
(PROVE-LEMMA MAIN-AGAIN NIL
(IMPLIES (AND (NUMBERP-LISTP A)
(EQUAL N (LENGTH A)))
(GEQ (EXP (FOR X IN A SUM X) N)
(TIMES (EXP N N)
(FOR X IN A MULTIPLY X))))
((USE (MAIN))))
This conjecture can be simplified, using the abbreviations AND, IMPLIES,
PRODLIST-FOR, and SUMLIST-FOR, to:
(IMPLIES (AND (IMPLIES (NUMBERP-LISTP A)
(IF (LESSP (EXP (FOR X IN A SUM X) (LENGTH A))
(TIMES (EXP (LENGTH A) (LENGTH A))
(FOR X IN A MULTIPLY X)))
F T))
(NUMBERP-LISTP A)
(EQUAL N (LENGTH A)))
(NOT (LESSP (EXP (FOR X IN A SUM X) N)
(TIMES (EXP N N)
(FOR X IN A MULTIPLY X))))).
This simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and opening up the
functions EVAL$ and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
MAIN-AGAIN