(BOOT-STRAP NQTHM)
[ 0.0 0.1 0.0 ]
GROUND-ZERO
(COMPILE-UNCOMPILED-DEFNS "tmp")
Loading tmp.o
Finished loading tmp.o
/v/hank/v28/boyer/nqthm-2nd/nqthm-1992/examples/basic/tmp.lisp
(DEFN FROM-TO
(I J)
(IF (LESSP J I)
NIL
(IF (EQUAL (FIX I) (FIX J))
(LIST (FIX J))
(APPEND (FROM-TO I (SUB1 J))
(LIST J)))))
Linear arithmetic, the lemmas COUNT-NUMBERP, SUB1-NNUMBERP, and
COUNT-NOT-LESSP, and the definitions of LESSP, EQUAL, COUNT, and FIX establish
that the measure (COUNT J) decreases according to the well-founded relation
LESSP in each recursive call. Hence, FROM-TO is accepted under the
definitional principle. Note that:
(OR (LITATOM (FROM-TO I J))
(LISTP (FROM-TO I J)))
is a theorem.
[ 0.0 0.0 0.0 ]
FROM-TO
(PROVE-LEMMA PLUS-RIGHT-ID2
(REWRITE)
(IMPLIES (NOT (NUMBERP Y))
(EQUAL (PLUS X Y) (FIX X))))
This simplifies, unfolding the definition of FIX, to the following two new
goals:
Case 2. (IMPLIES (AND (NOT (NUMBERP Y))
(NOT (NUMBERP X)))
(EQUAL (PLUS X Y) 0)).
This again simplifies, opening up the definitions of PLUS and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (NUMBERP Y)) (NUMBERP X))
(EQUAL (PLUS X Y) 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 (ZEROP X) (p X Y))
(IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) Y))
(p X Y))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definition
of ZEROP 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 two new formulas:
Case 2. (IMPLIES (AND (ZEROP X)
(NOT (NUMBERP Y))
(NUMBERP X))
(EQUAL (PLUS X Y) X)).
This simplifies, expanding the functions ZEROP, NUMBERP, EQUAL, and PLUS, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(EQUAL (PLUS (SUB1 X) Y) (SUB1 X))
(NOT (NUMBERP Y))
(NUMBERP X))
(EQUAL (PLUS X Y) X)).
This simplifies, using linear arithmetic, to the new conjecture:
(IMPLIES (AND (EQUAL X 0)
(NOT (ZEROP X))
(EQUAL (PLUS (SUB1 X) Y) (SUB1 X))
(NOT (NUMBERP Y))
(NUMBERP X))
(EQUAL (PLUS X Y) X)),
which again simplifies, expanding the function ZEROP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
PLUS-RIGHT-ID2
(PROVE-LEMMA PLUS-ADD1
(REWRITE)
(EQUAL (PLUS X (ADD1 Y))
(IF (NUMBERP Y)
(ADD1 (PLUS X Y))
(ADD1 X))))
This simplifies, obviously, to two new formulas:
Case 2. (IMPLIES (NOT (NUMBERP Y))
(EQUAL (PLUS X (ADD1 Y)) (ADD1 X))),
which again simplifies, rewriting with the lemma SUB1-TYPE-RESTRICTION, to
the conjecture:
(IMPLIES (NOT (NUMBERP Y))
(EQUAL (PLUS X 1) (ADD1 X))).
But this again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (NUMBERP Y)
(EQUAL (PLUS X (ADD1 Y))
(ADD1 (PLUS X Y)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
PLUS-ADD1
(PROVE-LEMMA COMMUTATIVITY2-OF-PLUS
(REWRITE)
(EQUAL (PLUS X (PLUS Y Z))
(PLUS Y (PLUS X Z))))
This simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
COMMUTATIVITY2-OF-PLUS
(PROVE-LEMMA COMMUTATIVITY-OF-PLUS
(REWRITE)
(EQUAL (PLUS X Y) (PLUS Y X)))
WARNING: the newly proposed lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the previously added lemma COMMUTATIVITY2-OF-PLUS could.
WARNING: the newly proposed lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the previously added lemma PLUS-ADD1 could.
WARNING: the newly proposed lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the previously added lemma PLUS-RIGHT-ID2 could.
This formula simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
COMMUTATIVITY-OF-PLUS
(PROVE-LEMMA ASSOCIATIVITY-OF-PLUS
(REWRITE)
(EQUAL (PLUS (PLUS X Y) Z)
(PLUS X (PLUS Y Z))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the newly proposed ASSOCIATIVITY-OF-PLUS could!
This simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
ASSOCIATIVITY-OF-PLUS
(PROVE-LEMMA PLUS-EQUAL-0
(REWRITE)
(EQUAL (EQUAL (PLUS A B) 0)
(AND (ZEROP A) (ZEROP B))))
This simplifies, opening up the functions ZEROP and AND, to six new
conjectures:
Case 6. (IMPLIES (AND (NOT (EQUAL (PLUS A B) 0))
(NOT (NUMBERP A)))
(NOT (EQUAL B 0))),
which again simplifies, applying PLUS-RIGHT-ID2 and COMMUTATIVITY-OF-PLUS,
and unfolding the functions NUMBERP and EQUAL, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL (PLUS A B) 0))
(NOT (NUMBERP A)))
(NUMBERP B)).
However this again simplifies, applying PLUS-RIGHT-ID2, and unfolding the
function EQUAL, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL (PLUS A B) 0))
(EQUAL A 0))
(NOT (EQUAL B 0))).
This again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL (PLUS A B) 0))
(EQUAL A 0))
(NUMBERP B)),
which again simplifies, applying the lemma PLUS-RIGHT-ID2, and opening up
the definitions of NUMBERP and EQUAL, to:
T.
Case 2. (IMPLIES (AND (EQUAL (PLUS A B) 0)
(NOT (EQUAL A 0)))
(NOT (NUMBERP A))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (EQUAL (PLUS A B) 0)
(NOT (EQUAL B 0)))
(NOT (NUMBERP B))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
PLUS-EQUAL-0
(PROVE-LEMMA DIFFERENCE-X-X
(REWRITE)
(EQUAL (DIFFERENCE X X) 0))
This conjecture simplifies, using linear arithmetic, to:
(IMPLIES (LESSP X X)
(EQUAL (DIFFERENCE X X) 0)).
But this again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIFFERENCE-X-X
(PROVE-LEMMA DIFFERENCE-PLUS
(REWRITE)
(AND (EQUAL (DIFFERENCE (PLUS X Y) X)
(FIX Y))
(EQUAL (DIFFERENCE (PLUS Y X) X)
(FIX Y))))
WARNING: Note that the proposed lemma DIFFERENCE-PLUS is to be stored as zero
type prescription rules, zero compound recognizer rules, zero linear rules,
and two replacement rules.
This formula can be simplified, using the abbreviation AND, to the following
two new conjectures:
Case 2. (EQUAL (DIFFERENCE (PLUS X Y) X)
(FIX Y)).
This simplifies, unfolding the function FIX, to the following two new
formulas:
Case 2.2.
(IMPLIES (NOT (NUMBERP Y))
(EQUAL (DIFFERENCE (PLUS X Y) X) 0)).
However this again simplifies, applying PLUS-RIGHT-ID2, to the following
two new goals:
Case 2.2.2.
(IMPLIES (AND (NOT (NUMBERP Y))
(NOT (NUMBERP X)))
(EQUAL (DIFFERENCE 0 X) 0)).
But this again simplifies, expanding EQUAL and DIFFERENCE, to:
T.
Case 2.2.1.
(IMPLIES (AND (NOT (NUMBERP Y)) (NUMBERP X))
(EQUAL (DIFFERENCE X X) 0)),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP X X)
(NOT (NUMBERP Y))
(NUMBERP X))
(EQUAL (DIFFERENCE X X) 0)).
However this again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (NUMBERP Y)
(EQUAL (DIFFERENCE (PLUS X Y) X) Y)),
which again simplifies, using linear arithmetic, to the conjecture:
(IMPLIES (AND (LESSP (PLUS X Y) X) (NUMBERP Y))
(EQUAL (DIFFERENCE (PLUS X Y) X) Y)).
This again simplifies, using linear arithmetic, to:
T.
Case 1. (EQUAL (DIFFERENCE (PLUS Y X) X)
(FIX Y)),
which simplifies, applying the lemma COMMUTATIVITY-OF-PLUS, and unfolding
FIX, to two new conjectures:
Case 1.2.
(IMPLIES (NOT (NUMBERP Y))
(EQUAL (DIFFERENCE (PLUS X Y) X) 0)),
which again simplifies, rewriting with the lemma PLUS-RIGHT-ID2, to two
new formulas:
Case 1.2.2.
(IMPLIES (AND (NOT (NUMBERP Y))
(NOT (NUMBERP X)))
(EQUAL (DIFFERENCE 0 X) 0)),
which again simplifies, expanding the definitions of EQUAL and
DIFFERENCE, to:
T.
Case 1.2.1.
(IMPLIES (AND (NOT (NUMBERP Y)) (NUMBERP X))
(EQUAL (DIFFERENCE X X) 0)),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP X X)
(NOT (NUMBERP Y))
(NUMBERP X))
(EQUAL (DIFFERENCE X X) 0)).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (NUMBERP Y)
(EQUAL (DIFFERENCE (PLUS X Y) X) Y)),
which again simplifies, using linear arithmetic, to the formula:
(IMPLIES (AND (LESSP (PLUS X Y) X) (NUMBERP Y))
(EQUAL (DIFFERENCE (PLUS X Y) X) Y)).
This again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIFFERENCE-PLUS
(PROVE-LEMMA PLUS-CANCELLATION
(REWRITE)
(EQUAL (EQUAL (PLUS A B) (PLUS A C))
(EQUAL (FIX B) (FIX C))))
This conjecture simplifies, expanding the definition of FIX, to the following
seven new formulas:
Case 7. (IMPLIES (AND (NUMBERP C)
(NUMBERP B)
(NOT (EQUAL B C)))
(NOT (EQUAL (PLUS A B) (PLUS A C)))).
This again simplifies, using linear arithmetic, to:
T.
Case 6. (IMPLIES (AND (NUMBERP C)
(NOT (NUMBERP B))
(NOT (EQUAL 0 C)))
(NOT (EQUAL (PLUS A B) (PLUS A C)))),
which again simplifies, rewriting with PLUS-RIGHT-ID2, to the following two
new conjectures:
Case 6.2.
(IMPLIES (AND (NUMBERP C)
(NOT (NUMBERP B))
(NOT (EQUAL 0 C))
(NOT (NUMBERP A)))
(NOT (EQUAL 0 (PLUS A C)))).
This again simplifies, using linear arithmetic, to:
T.
Case 6.1.
(IMPLIES (AND (NUMBERP C)
(NOT (NUMBERP B))
(NOT (EQUAL 0 C))
(NUMBERP A))
(NOT (EQUAL A (PLUS A C)))),
which again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (AND (NOT (NUMBERP C))
(NUMBERP B)
(NOT (EQUAL B 0)))
(NOT (EQUAL (PLUS A B) (PLUS A C)))),
which again simplifies, rewriting with PLUS-RIGHT-ID2, to the following two
new goals:
Case 5.2.
(IMPLIES (AND (NOT (NUMBERP C))
(NUMBERP B)
(NOT (EQUAL B 0))
(NOT (NUMBERP A)))
(NOT (EQUAL (PLUS A B) 0))).
This again simplifies, using linear arithmetic, to:
T.
Case 5.1.
(IMPLIES (AND (NOT (NUMBERP C))
(NUMBERP B)
(NOT (EQUAL B 0))
(NUMBERP A))
(NOT (EQUAL (PLUS A B) A))),
which again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (NUMBERP C))
(NOT (NUMBERP B)))
(EQUAL (EQUAL (PLUS A B) (PLUS A C))
T)),
which again simplifies, rewriting with the lemma PLUS-RIGHT-ID2, and opening
up EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (NUMBERP C)) (EQUAL B 0))
(EQUAL (EQUAL (PLUS A B) (PLUS A C))
T)),
which again simplifies, rewriting with COMMUTATIVITY-OF-PLUS and
PLUS-RIGHT-ID2, and expanding the functions EQUAL and PLUS, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP B)) (EQUAL 0 C))
(EQUAL (EQUAL (PLUS A B) (PLUS A C))
T)).
This again simplifies, applying PLUS-RIGHT-ID2 and COMMUTATIVITY-OF-PLUS,
and opening up EQUAL and PLUS, to:
T.
Case 1. (IMPLIES (AND (NUMBERP C)
(NUMBERP B)
(EQUAL B C))
(EQUAL (EQUAL (PLUS A B) (PLUS A C))
T)).
But this again simplifies, expanding the function EQUAL, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
PLUS-CANCELLATION
(PROVE-LEMMA DIFFERENCE-0
(REWRITE)
(IMPLIES (NOT (LESSP Y X))
(EQUAL (DIFFERENCE X Y) 0)))
Name the conjecture *1.
Let us appeal to the induction principle. 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 (OR (EQUAL X 0) (NOT (NUMBERP X)))
(p X Y))
(IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(p X Y))
(IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(p (SUB1 X) (SUB1 Y)))
(p X Y))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT can be used to show that the measure (COUNT Y) decreases
according to the well-founded relation LESSP in each induction step of the
scheme. Note, however, the inductive instance chosen for X. The above
induction scheme leads to the following four new goals:
Case 4. (IMPLIES (AND (OR (EQUAL X 0) (NOT (NUMBERP X)))
(NOT (LESSP Y X)))
(EQUAL (DIFFERENCE X Y) 0)).
This simplifies, expanding the definitions of NOT, OR, EQUAL, LESSP, and
DIFFERENCE, to:
T.
Case 3. (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(OR (EQUAL Y 0) (NOT (NUMBERP Y)))
(NOT (LESSP Y X)))
(EQUAL (DIFFERENCE X Y) 0)).
This simplifies, unfolding NOT, OR, EQUAL, and LESSP, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(LESSP (SUB1 Y) (SUB1 X))
(NOT (LESSP Y X)))
(EQUAL (DIFFERENCE X Y) 0)).
This simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP X 1)
(NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(LESSP (SUB1 Y) (SUB1 X))
(NOT (LESSP Y X)))
(EQUAL (DIFFERENCE X Y) 0)),
which again simplifies, opening up the definitions of SUB1, NUMBERP, EQUAL,
LESSP, NOT, and OR, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y))
0)
(NOT (LESSP Y X)))
(EQUAL (DIFFERENCE X Y) 0)),
which simplifies, using linear arithmetic, to three new conjectures:
Case 1.3.
(IMPLIES (AND (LESSP X Y)
(NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y))
0)
(NOT (LESSP Y X)))
(EQUAL (DIFFERENCE X Y) 0)),
which again simplifies, using linear arithmetic, to two new conjectures:
Case 1.3.2.
(IMPLIES (AND (LESSP (SUB1 X) (SUB1 Y))
(LESSP X Y)
(NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y))
0)
(NOT (LESSP Y X)))
(EQUAL (DIFFERENCE X Y) 0)),
which again simplifies, unfolding the functions LESSP, NOT, OR,
DIFFERENCE, and EQUAL, to:
T.
Case 1.3.1.
(IMPLIES (AND (LESSP X 1)
(LESSP X Y)
(NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y))
0)
(NOT (LESSP Y X)))
(EQUAL (DIFFERENCE X Y) 0)),
which again simplifies, unfolding SUB1, NUMBERP, EQUAL, LESSP, NOT, and
OR, to:
T.
Case 1.2.
(IMPLIES (AND (LESSP (SUB1 X) (SUB1 Y))
(NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y))
0)
(NOT (LESSP Y X)))
(EQUAL (DIFFERENCE X Y) 0)),
which again simplifies, expanding the definitions of NOT, OR, LESSP,
DIFFERENCE, and EQUAL, to:
T.
Case 1.1.
(IMPLIES (AND (LESSP X 1)
(NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y))
0)
(NOT (LESSP Y X)))
(EQUAL (DIFFERENCE X Y) 0)),
which again simplifies, opening up the definitions of SUB1, NUMBERP, EQUAL,
LESSP, NOT, and OR, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
DIFFERENCE-0
(PROVE-LEMMA EQUAL-DIFFERENCE-0
(REWRITE)
(EQUAL (EQUAL 0 (DIFFERENCE X Y))
(NOT (LESSP Y X))))
This conjecture simplifies, unfolding NOT, to two new conjectures:
Case 2. (IMPLIES (NOT (EQUAL 0 (DIFFERENCE X Y)))
(LESSP Y X)),
which again simplifies, rewriting with the lemma DIFFERENCE-0, and opening
up the definition of EQUAL, to:
T.
Case 1. (IMPLIES (EQUAL 0 (DIFFERENCE X Y))
(NOT (LESSP Y X))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EQUAL-DIFFERENCE-0
(PROVE-LEMMA DIFFERENCE-CANCELLATION-0
(REWRITE)
(EQUAL (EQUAL X (DIFFERENCE X Y))
(AND (NUMBERP X)
(OR (EQUAL X 0) (ZEROP Y)))))
This simplifies, opening up the functions ZEROP, OR, and AND, to five new
goals:
Case 5. (IMPLIES (EQUAL X (DIFFERENCE X Y))
(NUMBERP X)),
which again simplifies, obviously, to:
T.
Case 4. (IMPLIES (AND (EQUAL X (DIFFERENCE X Y))
(NOT (EQUAL X 0))
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))).
But this again simplifies, using linear arithmetic, to the conjecture:
(IMPLIES (AND (LESSP X Y)
(EQUAL X (DIFFERENCE X Y))
(NOT (EQUAL X 0))
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))).
This again simplifies, using linear arithmetic and applying DIFFERENCE-0, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL X (DIFFERENCE X Y)))
(NUMBERP X))
(NUMBERP Y)).
But this again simplifies, expanding the definition of DIFFERENCE, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL X (DIFFERENCE X Y)))
(NUMBERP X))
(NOT (EQUAL Y 0))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP X 0)
(NOT (EQUAL X (DIFFERENCE X 0))))
(NOT (NUMBERP X))).
But this again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL X (DIFFERENCE X Y)))
(NUMBERP X))
(NOT (EQUAL X 0))),
which again simplifies, using linear arithmetic, applying the lemma
DIFFERENCE-0, and expanding EQUAL, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIFFERENCE-CANCELLATION-0
(PROVE-LEMMA DIFFERENCE-CANCELLATION-1
(REWRITE)
(EQUAL (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y))
(IF (LESSP X Y)
(NOT (LESSP Y Z))
(IF (LESSP Z Y)
(NOT (LESSP Y X))
(EQUAL (FIX X) (FIX Z))))))
This simplifies, opening up NOT and FIX, to the following 11 new goals:
Case 11.(IMPLIES (AND (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y))
(NOT (LESSP X Y))
(NOT (LESSP Z Y))
(NOT (NUMBERP Z))
(NUMBERP X))
(EQUAL (EQUAL X 0) T)).
This again simplifies, using linear arithmetic, applying DIFFERENCE-0 and
EQUAL-DIFFERENCE-0, and expanding LESSP, to the following two new
conjectures:
Case 11.2.
(IMPLIES (AND (NOT (LESSP Y X))
(NOT (LESSP X Y))
(EQUAL Y 0)
(NOT (NUMBERP Z))
(NUMBERP X))
(EQUAL X 0)).
But this again simplifies, using linear arithmetic, to:
T.
Case 11.1.
(IMPLIES (AND (NOT (LESSP Y X))
(NOT (LESSP X Y))
(NOT (NUMBERP Y))
(NOT (NUMBERP Z))
(NUMBERP X))
(EQUAL X 0)),
which again simplifies, unfolding the definition of LESSP, to:
T.
Case 10.(IMPLIES (AND (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y))
(NOT (LESSP X Y))
(NOT (LESSP Z Y))
(NUMBERP Z)
(NOT (NUMBERP X)))
(EQUAL (EQUAL 0 Z) T)),
which again simplifies, using linear arithmetic, rewriting with DIFFERENCE-0
and EQUAL-DIFFERENCE-0, and opening up the functions LESSP and EQUAL, to the
following two new formulas:
Case 10.2.
(IMPLIES (AND (NOT (LESSP Y Z))
(EQUAL Y 0)
(NUMBERP Z)
(NOT (NUMBERP X)))
(EQUAL 0 Z)).
But this again simplifies, using linear arithmetic, to:
T.
Case 10.1.
(IMPLIES (AND (NOT (LESSP Y Z))
(NOT (NUMBERP Y))
(NUMBERP Z)
(NOT (NUMBERP X)))
(EQUAL 0 Z)),
which again simplifies, expanding the function LESSP, to:
T.
Case 9. (IMPLIES (AND (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y))
(NOT (LESSP X Y))
(NOT (LESSP Z Y))
(NUMBERP Z)
(NUMBERP X))
(EQUAL (EQUAL X Z) T)),
which again simplifies, obviously, to the new formula:
(IMPLIES (AND (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y))
(NOT (LESSP X Y))
(NOT (LESSP Z Y))
(NUMBERP Z)
(NUMBERP X))
(EQUAL X Z)),
which again simplifies, using linear arithmetic, to:
T.
Case 8. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y)))
(NOT (LESSP X Y))
(NOT (LESSP Z Y))
(NOT (NUMBERP Z)))
(NOT (EQUAL X 0))),
which again simplifies, using linear arithmetic, appealing to the lemma
DIFFERENCE-0, and unfolding the function EQUAL, to:
T.
Case 7. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y)))
(NOT (LESSP X Y))
(NOT (LESSP Z Y))
(NOT (NUMBERP X)))
(NOT (EQUAL 0 Z))),
which again simplifies, using linear arithmetic, applying DIFFERENCE-0, and
unfolding the function EQUAL, to:
T.
Case 6. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y)))
(NOT (LESSP X Y))
(NOT (LESSP Z Y))
(NUMBERP Z)
(NUMBERP X))
(NOT (EQUAL X Z))).
This again simplifies, clearly, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y)))
(LESSP X Y))
(LESSP Y Z)).
However this again simplifies, using linear arithmetic, applying
DIFFERENCE-0, and expanding the function EQUAL, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y)))
(NOT (LESSP X Y))
(NOT (LESSP Z Y))
(NOT (NUMBERP Z)))
(NUMBERP X)).
However this again simplifies, using linear arithmetic, applying
DIFFERENCE-0, and unfolding the definition of EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y)))
(NOT (LESSP X Y))
(LESSP Z Y))
(LESSP Y X)).
But this again simplifies, using linear arithmetic, to three new goals:
Case 3.3.
(IMPLIES (AND (NOT (NUMBERP Y))
(NOT (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y)))
(NOT (LESSP X Y))
(LESSP Z Y))
(LESSP Y X)),
which again simplifies, appealing to the lemma DIFFERENCE-0, and expanding
the definitions of DIFFERENCE and LESSP, to:
T.
Case 3.2.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y)))
(NOT (LESSP X Y))
(LESSP Z Y))
(LESSP Y X)),
which again simplifies, using linear arithmetic, applying DIFFERENCE-0,
and unfolding the function EQUAL, to:
T.
Case 3.1.
(IMPLIES (AND (NUMBERP X)
(NUMBERP Y)
(NOT (EQUAL (DIFFERENCE X X)
(DIFFERENCE Z X)))
(NOT (LESSP X X))
(LESSP Z X))
(LESSP X X)).
However this again simplifies, using linear arithmetic, applying
DIFFERENCE-0, and expanding the function EQUAL, to:
T.
Case 2. (IMPLIES (AND (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y))
(LESSP X Y))
(NOT (LESSP Y Z))).
However this again simplifies, using linear arithmetic and rewriting with
the lemmas DIFFERENCE-0 and EQUAL-DIFFERENCE-0, to:
T.
Case 1. (IMPLIES (AND (EQUAL (DIFFERENCE X Y)
(DIFFERENCE Z Y))
(NOT (LESSP X Y))
(LESSP Z Y))
(NOT (LESSP Y X))),
which again simplifies, using linear arithmetic and rewriting with
DIFFERENCE-0 and EQUAL-DIFFERENCE-0, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIFFERENCE-CANCELLATION-1
(DEFN DELETE
(X Y)
(IF (LISTP Y)
(IF (EQUAL X (CAR Y))
(CDR Y)
(CONS (CAR Y) (DELETE X (CDR Y))))
Y))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT Y) decreases according to the well-founded relation LESSP in each
recursive call. Hence, DELETE is accepted under the principle of definition.
[ 0.0 0.0 0.0 ]
DELETE
(DEFN SUBBAGP
(X Y)
(IF (LISTP X)
(IF (MEMBER (CAR X) Y)
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
F)
T))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT X) decreases according to the well-founded relation LESSP in each
recursive call. Hence, SUBBAGP is accepted under the principle of definition.
From the definition we can conclude that:
(OR (FALSEP (SUBBAGP X Y))
(TRUEP (SUBBAGP X Y)))
is a theorem.
[ 0.0 0.0 0.0 ]
SUBBAGP
(DEFN BAGDIFF
(X Y)
(IF (LISTP Y)
(IF (MEMBER (CAR Y) X)
(BAGDIFF (DELETE (CAR Y) X) (CDR Y))
(BAGDIFF X (CDR Y)))
X))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT Y) decreases according to the well-founded relation LESSP in each
recursive call. Hence, BAGDIFF is accepted under the definitional principle.
[ 0.0 0.0 0.0 ]
BAGDIFF
(DEFN BAGINT
(X Y)
(IF (LISTP X)
(IF (MEMBER (CAR X) Y)
(CONS (CAR X)
(BAGINT (CDR X) (DELETE (CAR X) Y)))
(BAGINT (CDR X) Y))
NIL))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT X) decreases according to the well-founded relation LESSP in each
recursive call. Hence, BAGINT is accepted under the principle of definition.
Note that (OR (LITATOM (BAGINT X Y)) (LISTP (BAGINT X Y))) is a theorem.
[ 0.0 0.0 0.0 ]
BAGINT
(PROVE-LEMMA DELETE-NON-MEMBER
(REWRITE)
(IMPLIES (NOT (MEMBER X Y))
(EQUAL (DELETE X Y) Y)))
Give the conjecture the name *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 (NLISTP Y) (p X Y))
(IMPLIES (AND (NOT (NLISTP Y))
(EQUAL X (CAR Y)))
(p X Y))
(IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(p X (CDR Y)))
(p X Y))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP inform us that the measure (COUNT Y) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme generates four new goals:
Case 4. (IMPLIES (AND (NLISTP Y) (NOT (MEMBER X Y)))
(EQUAL (DELETE X Y) Y)),
which simplifies, expanding NLISTP, MEMBER, and DELETE, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP Y))
(EQUAL X (CAR Y))
(NOT (MEMBER X Y)))
(EQUAL (DELETE X Y) Y)),
which simplifies, opening up the functions NLISTP and MEMBER, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(MEMBER X (CDR Y))
(NOT (MEMBER X Y)))
(EQUAL (DELETE X Y) Y)),
which simplifies, opening up the definitions of NLISTP and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(EQUAL (DELETE X (CDR Y)) (CDR Y))
(NOT (MEMBER X Y)))
(EQUAL (DELETE X Y) Y)),
which simplifies, rewriting with the lemma CONS-CAR-CDR, and unfolding the
functions NLISTP, MEMBER, and DELETE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
DELETE-NON-MEMBER
(PROVE-LEMMA MEMBER-DELETE
(REWRITE)
(IMPLIES (MEMBER X (DELETE U V))
(MEMBER X V)))
WARNING: Note that MEMBER-DELETE contains the free variable U which will be
chosen by instantiating the hypothesis (MEMBER X (DELETE U V)).
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 V) (EQUAL U (CAR V)))
(p X V U))
(IMPLIES (AND (LISTP V)
(NOT (EQUAL U (CAR V)))
(p X (CDR V) U))
(p X V U))
(IMPLIES (NOT (LISTP V)) (p X V U))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT V)
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 V)
(EQUAL U (CAR V))
(MEMBER X (DELETE U V)))
(MEMBER X V)),
which simplifies, expanding the functions DELETE and MEMBER, to:
T.
Case 3. (IMPLIES (AND (LISTP V)
(NOT (EQUAL U (CAR V)))
(NOT (MEMBER X (DELETE U (CDR V))))
(MEMBER X (DELETE U V)))
(MEMBER X V)),
which simplifies, appealing to the lemmas CDR-CONS and CAR-CONS, and
expanding DELETE and MEMBER, to:
T.
Case 2. (IMPLIES (AND (LISTP V)
(NOT (EQUAL U (CAR V)))
(MEMBER X (CDR V))
(MEMBER X (DELETE U V)))
(MEMBER X V)),
which simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
opening up the functions DELETE and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP V))
(MEMBER X (DELETE U V)))
(MEMBER X V)),
which simplifies, applying DELETE-NON-MEMBER, and unfolding the definition
of MEMBER, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MEMBER-DELETE
(PROVE-LEMMA COMMUTATIVITY-OF-DELETE
(REWRITE)
(EQUAL (DELETE X (DELETE Y Z))
(DELETE Y (DELETE X Z))))
Call the conjecture *1.
Perhaps we can 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) (EQUAL Y (CAR Z)))
(p X Y Z))
(IMPLIES (AND (LISTP Z)
(NOT (EQUAL Y (CAR Z)))
(p X Y (CDR Z)))
(p X Y Z))
(IMPLIES (NOT (LISTP Z)) (p X Y Z))).
Linear arithmetic and the lemma CDR-LESSP can be used to prove 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 goals:
Case 3. (IMPLIES (AND (LISTP Z) (EQUAL Y (CAR Z)))
(EQUAL (DELETE X (DELETE Y Z))
(DELETE Y (DELETE X Z)))),
which simplifies, opening up the definition of DELETE, to two new
conjectures:
Case 3.2.
(IMPLIES (AND (LISTP Z)
(NOT (EQUAL X (CAR Z))))
(EQUAL (DELETE X (CDR Z))
(DELETE (CAR Z)
(CONS (CAR Z) (DELETE X (CDR Z)))))),
which again simplifies, rewriting with CDR-CONS and CAR-CONS, and opening
up the function DELETE, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP Z) (EQUAL X (CAR Z)))
(EQUAL (DELETE X (CDR Z))
(DELETE (CAR Z) (CDR Z)))).
This again simplifies, obviously, to:
T.
Case 2. (IMPLIES (AND (LISTP Z)
(NOT (EQUAL Y (CAR Z)))
(EQUAL (DELETE X (DELETE Y (CDR Z)))
(DELETE Y (DELETE X (CDR Z)))))
(EQUAL (DELETE X (DELETE Y Z))
(DELETE Y (DELETE X Z)))).
This simplifies, applying CDR-CONS and CAR-CONS, and opening up DELETE, to:
(IMPLIES (AND (LISTP Z)
(NOT (EQUAL Y (CAR Z)))
(EQUAL (DELETE X (DELETE Y (CDR Z)))
(DELETE Y (DELETE X (CDR Z))))
(NOT (EQUAL X (CAR Z))))
(EQUAL (CONS (CAR Z)
(DELETE X (DELETE Y (CDR Z))))
(DELETE Y
(CONS (CAR Z) (DELETE X (CDR Z)))))).
But this again simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS,
and expanding the definition of DELETE, to:
T.
Case 1. (IMPLIES (NOT (LISTP Z))
(EQUAL (DELETE X (DELETE Y Z))
(DELETE Y (DELETE X Z)))),
which simplifies, applying DELETE-NON-MEMBER, and expanding the definition
of MEMBER, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
COMMUTATIVITY-OF-DELETE
(PROVE-LEMMA SUBBAGP-DELETE
(REWRITE)
(IMPLIES (SUBBAGP X (DELETE U Y))
(SUBBAGP X Y)))
WARNING: Note that SUBBAGP-DELETE contains the free variable U which will be
chosen by instantiating the hypothesis (SUBBAGP X (DELETE U Y)).
Give the conjecture the name *1.
Let us appeal to the induction principle. Three 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)
(MEMBER (CAR X) (DELETE U Y))
(p (CDR X) (DELETE (CAR X) Y) U))
(p X Y U))
(IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) (DELETE U Y))))
(p X Y U))
(IMPLIES (NOT (LISTP X)) (p X Y U))).
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. Note, however, the inductive instance chosen for Y. The above
induction scheme generates four new conjectures:
Case 4. (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) (DELETE U Y))
(NOT (SUBBAGP (CDR X)
(DELETE U (DELETE (CAR X) Y))))
(SUBBAGP X (DELETE U Y)))
(SUBBAGP X Y)),
which simplifies, applying COMMUTATIVITY-OF-DELETE, and opening up SUBBAGP,
to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) (DELETE U Y))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(SUBBAGP X (DELETE U Y)))
(SUBBAGP X Y)).
This simplifies, applying the lemmas COMMUTATIVITY-OF-DELETE and
MEMBER-DELETE, and unfolding the function SUBBAGP, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) (DELETE U Y)))
(SUBBAGP X (DELETE U Y)))
(SUBBAGP X Y)).
This simplifies, unfolding the function SUBBAGP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(SUBBAGP X (DELETE U Y)))
(SUBBAGP X Y)).
This simplifies, unfolding the definition of SUBBAGP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUBBAGP-DELETE
(PROVE-LEMMA SUBBAGP-CDR1
(REWRITE)
(IMPLIES (SUBBAGP X Y)
(SUBBAGP (CDR X) Y)))
.
Applying the lemma CAR-CDR-ELIM, replace X by (CONS V Z) to eliminate (CDR X)
and (CAR X). We thus obtain the following two new goals:
Case 2. (IMPLIES (AND (NOT (LISTP X)) (SUBBAGP X Y))
(SUBBAGP (CDR X) Y)).
But this simplifies, applying CDR-NLISTP, and expanding SUBBAGP and LISTP,
to:
T.
Case 1. (IMPLIES (SUBBAGP (CONS V Z) Y)
(SUBBAGP Z Y)).
However this simplifies, rewriting with CDR-CONS, CAR-CONS, and
SUBBAGP-DELETE, and expanding the definition of SUBBAGP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
SUBBAGP-CDR1
(PROVE-LEMMA SUBBAGP-CDR2
(REWRITE)
(IMPLIES (SUBBAGP X (CDR Y))
(SUBBAGP X Y)))
.
Applying the lemma CAR-CDR-ELIM, replace Y by (CONS V Z) to eliminate (CDR Y)
and (CAR Y). We thus obtain the following two new goals:
Case 2. (IMPLIES (AND (NOT (LISTP Y))
(SUBBAGP X (CDR Y)))
(SUBBAGP X Y)).
But this simplifies, applying CDR-NLISTP, and expanding MEMBER, LISTP, and
SUBBAGP, to:
T.
Case 1. (IMPLIES (SUBBAGP X Z)
(SUBBAGP X (CONS V Z))),
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 (SUBBAGP X (CDR Y))
(SUBBAGP X Y)),
which we named *1 above. 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)
(MEMBER (CAR X) (CDR Y))
(p (CDR X) (DELETE (CAR X) Y)))
(p X Y))
(IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) (CDR Y))))
(p X Y))
(IMPLIES (NOT (LISTP X)) (p X Y))).
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. Note, however, the inductive instance chosen for Y. The above
induction scheme leads to the following four new conjectures:
Case 4. (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) (CDR Y))
(NOT (SUBBAGP (CDR X)
(CDR (DELETE (CAR X) Y))))
(SUBBAGP X (CDR Y)))
(SUBBAGP X Y)).
This simplifies, unfolding SUBBAGP and MEMBER, to the following two new
conjectures:
Case 4.2.
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) (CDR Y))
(NOT (SUBBAGP (CDR X)
(CDR (DELETE (CAR X) Y))))
(SUBBAGP (CDR X)
(DELETE (CAR X) (CDR Y))))
(LISTP Y)).
But this again simplifies, rewriting with CDR-NLISTP, and opening up LISTP
and MEMBER, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) (CDR Y))
(NOT (SUBBAGP (CDR X)
(CDR (DELETE (CAR X) Y))))
(SUBBAGP (CDR X)
(DELETE (CAR X) (CDR Y))))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))).
This further simplifies, rewriting with CDR-NLISTP, DELETE-NON-MEMBER, and
SUBBAGP-CDR1, and unfolding the definitions of DELETE, MEMBER, LISTP, and
SUBBAGP, to the new formula:
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) (CDR Y))
(LISTP Y)
(NOT (EQUAL (CAR X) (CAR Y)))
(NOT (SUBBAGP (CDR X)
(CDR (CONS (CAR Y)
(DELETE (CAR X) (CDR Y))))))
(SUBBAGP (CDR X)
(DELETE (CAR X) (CDR Y))))
(SUBBAGP (CDR X)
(CONS (CAR Y)
(DELETE (CAR X) (CDR Y))))),
which again simplifies, rewriting with CDR-CONS, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) (CDR Y))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(SUBBAGP X (CDR Y)))
(SUBBAGP X Y)).
This simplifies, unfolding the definitions of SUBBAGP and MEMBER, to:
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) (CDR Y))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(SUBBAGP (CDR X)
(DELETE (CAR X) (CDR Y))))
(LISTP Y)),
which again simplifies, applying CDR-NLISTP, and opening up the functions
LISTP and MEMBER, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) (CDR Y)))
(SUBBAGP X (CDR Y)))
(SUBBAGP X Y)).
This simplifies, unfolding the definition of SUBBAGP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(SUBBAGP X (CDR Y)))
(SUBBAGP X Y)).
This simplifies, unfolding the function SUBBAGP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
SUBBAGP-CDR2
(PROVE-LEMMA SUBBAGP-BAGINT1
(REWRITE)
(SUBBAGP (BAGINT X Y) X))
Give the conjecture the name *1.
We will try to prove it by induction. There is only one suggested
induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(p (CDR X) (DELETE (CAR X) Y)))
(p X Y))
(IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) Y))
(p (CDR X) Y))
(p X Y))
(IMPLIES (NOT (LISTP X)) (p X Y))).
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. Note, however, the inductive instances chosen for Y. The
above induction scheme leads to three new formulas:
Case 3. (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(SUBBAGP (BAGINT (CDR X) (DELETE (CAR X) Y))
(CDR X)))
(SUBBAGP (BAGINT X Y) X)),
which simplifies, applying CDR-CONS and CAR-CONS, and opening up the
definitions of BAGINT, DELETE, MEMBER, and SUBBAGP, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) Y))
(SUBBAGP (BAGINT (CDR X) Y) (CDR X)))
(SUBBAGP (BAGINT X Y) X)).
This simplifies, applying SUBBAGP-CDR2, and unfolding BAGINT, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(SUBBAGP (BAGINT X Y) X)),
which simplifies, appealing to the lemmas CDR-NLISTP and SUBBAGP-CDR2, and
unfolding BAGINT and SUBBAGP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUBBAGP-BAGINT1
(PROVE-LEMMA SUBBAGP-BAGINT2
(REWRITE)
(SUBBAGP (BAGINT X Y) Y))
Give the conjecture the name *1.
We will try to prove it by induction. There is only one suggested
induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(p (CDR X) (DELETE (CAR X) Y)))
(p X Y))
(IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) Y))
(p (CDR X) Y))
(p X Y))
(IMPLIES (NOT (LISTP X)) (p X Y))).
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. Note, however, the inductive instances chosen for Y. The
above induction scheme leads to three new formulas:
Case 3. (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(SUBBAGP (BAGINT (CDR X) (DELETE (CAR X) Y))
(DELETE (CAR X) Y)))
(SUBBAGP (BAGINT X Y) Y)),
which simplifies, applying CDR-CONS and CAR-CONS, and opening up the
definitions of BAGINT and SUBBAGP, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) Y))
(SUBBAGP (BAGINT (CDR X) Y) Y))
(SUBBAGP (BAGINT X Y) Y)).
This simplifies, expanding BAGINT, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(SUBBAGP (BAGINT X Y) Y)).
This simplifies, applying SUBBAGP-CDR2, and opening up the functions BAGINT,
SUBBAGP, and LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUBBAGP-BAGINT2
(DEFN PLUS-FRINGE
(X)
(IF (AND (LISTP X) (EQUAL (CAR X) 'PLUS))
(APPEND (PLUS-FRINGE (CADR X))
(PLUS-FRINGE (CADDR X)))
(CONS X NIL)))
Linear arithmetic, the lemmas CAR-LESSEQP, CDR-LESSEQP, and CDR-LESSP,
and the definition of AND establish that the measure (COUNT X) decreases
according to the well-founded relation LESSP in each recursive call. Hence,
PLUS-FRINGE is accepted under the principle of definition. Note that
(LISTP (PLUS-FRINGE X)) is a theorem.
[ 0.0 0.0 0.0 ]
PLUS-FRINGE
(DEFN PLUS-TREE
(L)
(IF (NLISTP L)
''0
(IF (NLISTP (CDR L))
(LIST 'FIX (CAR L))
(IF (NLISTP (CDDR L))
(LIST 'PLUS (CAR L) (CADR L))
(LIST 'PLUS
(CAR L)
(PLUS-TREE (CDR L)))))))
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the
definition of NLISTP inform us that the measure (COUNT L) decreases according
to the well-founded relation LESSP in each recursive call. Hence, PLUS-TREE
is accepted under the principle of definition. Note that
(LISTP (PLUS-TREE L)) is a theorem.
[ 0.0 0.0 0.0 ]
PLUS-TREE
(DEFN CANCEL
(X)
(IF (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL))
(IF (AND (LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS))
(LIST 'EQUAL
(PLUS-TREE (BAGDIFF (PLUS-FRINGE (CADR X))
(BAGINT (PLUS-FRINGE (CADR X))
(PLUS-FRINGE (CADDR X)))))
(PLUS-TREE (BAGDIFF (PLUS-FRINGE (CADDR X))
(BAGINT (PLUS-FRINGE (CADR X))
(PLUS-FRINGE (CADDR X))))))
(IF (AND (LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X))))
(LIST 'IF
(LIST 'NUMBERP (CADDR X))
(LIST 'EQUAL
(PLUS-TREE (DELETE (CADDR X)
(PLUS-FRINGE (CADR X))))
''0)
(LIST 'QUOTE F))
(IF (AND (LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X))))
(LIST 'IF
(LIST 'NUMBERP (CADR X))
(LIST 'EQUAL
''0
(PLUS-TREE (DELETE (CADR X)
(PLUS-FRINGE (CADDR X)))))
(LIST 'QUOTE F))
X)))
X))
From the definition we can conclude that:
(OR (LISTP (CANCEL X))
(EQUAL (CANCEL X) X))
is a theorem.
[ 0.0 0.0 0.0 ]
CANCEL
(COMPILE-UNCOMPILED-DEFNS "tmp")
Loading tmp.o
Finished loading tmp.o
/v/hank/v28/boyer/nqthm-2nd/nqthm-1992/examples/basic/tmp.lisp
(PROVE-LEMMA NUMBERP-EVAL$-PLUS
(REWRITE)
(IMPLIES (AND (LISTP X) (EQUAL (CAR X) 'PLUS))
(NUMBERP (EVAL$ T X A))))
.
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate (CAR X)
and (CDR X). This produces:
(IMPLIES (EQUAL Z 'PLUS)
(NUMBERP (EVAL$ T (CONS Z V) A))),
which simplifies, applying REWRITE-EVAL$, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
NUMBERP-EVAL$-PLUS
(PROVE-LEMMA NUMBERP-EVAL$-PLUS-TREE
(REWRITE)
(NUMBERP (EVAL$ T (PLUS-TREE L) A)))
Call the conjecture *1.
We will try to prove it by induction. There is only one suggested
induction. We will induct according to the following scheme:
(AND (IMPLIES (NLISTP L) (p L A))
(IMPLIES (AND (NOT (NLISTP L))
(NLISTP (CDR L)))
(p L A))
(IMPLIES (AND (NOT (NLISTP L))
(NOT (NLISTP (CDR L)))
(NLISTP (CDDR L)))
(p L A))
(IMPLIES (AND (NOT (NLISTP L))
(NOT (NLISTP (CDR L)))
(NOT (NLISTP (CDDR L)))
(p (CDR L) A))
(p L A))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP can be used to establish that the measure (COUNT L) 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 (NLISTP L)
(NUMBERP (EVAL$ T (PLUS-TREE L) A))).
This simplifies, expanding the definitions of NLISTP, PLUS-TREE, CDR, CAR,
LISTP, LITATOM, EQUAL, EVAL$, and NUMBERP, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP L))
(NLISTP (CDR L)))
(NUMBERP (EVAL$ T (PLUS-TREE L) A))).
This simplifies, appealing to the lemmas REWRITE-EVAL$ and CAR-CONS, and
opening up NLISTP, PLUS-TREE, and FIX, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP L))
(NOT (NLISTP (CDR L)))
(NLISTP (CDDR L)))
(NUMBERP (EVAL$ T (PLUS-TREE L) A))).
This simplifies, rewriting with REWRITE-EVAL$, CAR-CONS, and CDR-CONS, and
unfolding the definitions of NLISTP and PLUS-TREE, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP L))
(NOT (NLISTP (CDR L)))
(NOT (NLISTP (CDDR L)))
(NUMBERP (EVAL$ T (PLUS-TREE (CDR L)) A)))
(NUMBERP (EVAL$ T (PLUS-TREE L) A))),
which simplifies, applying REWRITE-EVAL$, CAR-CONS, and CDR-CONS, and
expanding the functions NLISTP and PLUS-TREE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NUMBERP-EVAL$-PLUS-TREE
(PROVE-LEMMA MEMBER-IMPLIES-PLUS-TREE-GREATEREQP
(REWRITE)
(IMPLIES (MEMBER X Y)
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T X A)))))
WARNING: When the linear lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP is stored
under (EVAL$ T (PLUS-TREE Y) A) it contains the free variable X which will be
chosen by instantiating the hypothesis (MEMBER X Y).
WARNING: When the linear lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP is stored
under (EVAL$ T X A) it contains the free variable Y which will be chosen by
instantiating the hypothesis (MEMBER X Y).
WARNING: Note that the proposed lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP 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. Three 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 (NLISTP Y) (p Y A X))
(IMPLIES (AND (NOT (NLISTP Y))
(EQUAL X (CAR Y)))
(p Y A X))
(IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(p (CDR Y) A X))
(p Y A X))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP can be used to establish that the measure (COUNT Y) decreases according
to the well-founded relation LESSP in each induction step of the scheme. The
above induction scheme leads to four new goals:
Case 4. (IMPLIES (AND (NLISTP Y) (MEMBER X Y))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T X A)))),
which simplifies, unfolding the functions NLISTP and MEMBER, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP Y))
(EQUAL X (CAR Y))
(MEMBER X Y))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T X A)))),
which simplifies, opening up NLISTP, MEMBER, and PLUS-TREE, to three new
formulas:
Case 3.3.
(IMPLIES (AND (LISTP Y) (NOT (LISTP (CDR Y))))
(NOT (LESSP (EVAL$ T (LIST 'FIX (CAR Y)) A)
(EVAL$ T (CAR Y) A)))),
which again simplifies, rewriting with the lemmas REWRITE-EVAL$ and
CAR-CONS, and expanding FIX, to two new goals:
Case 3.3.2.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(NOT (LESSP 0 (EVAL$ T (CAR Y) A)))),
which again simplifies, opening up the function LESSP, to:
T.
Case 3.3.1.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NUMBERP (EVAL$ T (CAR Y) A)))
(NOT (LESSP (EVAL$ T (CAR Y) A)
(EVAL$ T (CAR Y) A)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(LISTP (CDDR Y)))
(NOT (LESSP (EVAL$ T
(LIST 'PLUS
(CAR Y)
(PLUS-TREE (CDR Y)))
A)
(EVAL$ T (CAR Y) A)))),
which again simplifies, rewriting with REWRITE-EVAL$, CAR-CONS, and
CDR-CONS, to the new conjecture:
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(LISTP (CDDR Y)))
(NOT (LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T (CAR Y) A)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y))))
(NOT (LESSP (EVAL$ T
(LIST 'PLUS (CAR Y) (CADR Y))
A)
(EVAL$ T (CAR Y) A)))),
which again simplifies, applying REWRITE-EVAL$, CAR-CONS, and CDR-CONS, to:
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y))))
(NOT (LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T (CAR Y) A)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(NOT (MEMBER X (CDR Y)))
(MEMBER X Y))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T X A)))),
which simplifies, unfolding the functions NLISTP and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X Y))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T X A)))),
which simplifies, opening up NLISTP, MEMBER, and PLUS-TREE, to three new
formulas:
Case 1.3.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y))))
(NOT (LESSP (EVAL$ T (LIST 'FIX (CAR Y)) A)
(EVAL$ T X A)))),
which again simplifies, applying the lemmas REWRITE-EVAL$ and CAR-CONS,
and opening up the definition of FIX, to two new conjectures:
Case 1.3.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(NOT (LESSP 0 (EVAL$ T X A)))),
which again simplifies, expanding the functions EQUAL and LESSP, to:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))).
This further simplifies, expanding the definitions of PLUS-TREE, CDR,
CAR, LISTP, LITATOM, EQUAL, EVAL$, and LESSP, to:
T.
Case 1.3.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(NUMBERP (EVAL$ T (CAR Y) A)))
(NOT (LESSP (EVAL$ T (CAR Y) A)
(EVAL$ T X A)))),
which further simplifies, expanding PLUS-TREE, CDR, CAR, LISTP, LITATOM,
EQUAL, EVAL$, LESSP, and MEMBER, to:
T.
Case 1.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y)))
(NOT (LESSP (EVAL$ T
(LIST 'PLUS
(CAR Y)
(PLUS-TREE (CDR Y)))
A)
(EVAL$ T X A)))),
which again simplifies, applying REWRITE-EVAL$, CAR-CONS, and CDR-CONS, to:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y)))
(NOT (LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y))))
(NOT (LESSP (EVAL$ T
(LIST 'PLUS (CAR Y) (CADR Y))
A)
(EVAL$ T X A)))),
which again simplifies, applying REWRITE-EVAL$, CAR-CONS, and CDR-CONS, to
the new conjecture:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y))))
(NOT (LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which further simplifies, rewriting with the lemmas REWRITE-EVAL$,
CAR-CONS, and PLUS-RIGHT-ID2, and opening up the functions PLUS-TREE and
FIX, to two new conjectures:
Case 1.1.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CADR Y) A)))
(NOT (LESSP 0 (EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NUMBERP (EVAL$ T (CAR Y) A)))
(NOT (LESSP (EVAL$ T (CAR Y) A)
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CADR Y) A))
(NOT (LESSP (EVAL$ T (CADR Y) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y))))
(NOT (LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP
(PROVE-LEMMA PLUS-TREE-DELETE
(REWRITE)
(EQUAL (EVAL$ T (PLUS-TREE (DELETE X Y)) A)
(IF (MEMBER X Y)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T X A))
(EVAL$ T (PLUS-TREE Y) A))))
This simplifies, clearly, to the following two new formulas:
Case 2. (IMPLIES (NOT (MEMBER X Y))
(EQUAL (EVAL$ T (PLUS-TREE (DELETE X Y)) A)
(EVAL$ T (PLUS-TREE Y) A))).
But this again simplifies, rewriting with DELETE-NON-MEMBER, to:
T.
Case 1. (IMPLIES (MEMBER X Y)
(EQUAL (EVAL$ T (PLUS-TREE (DELETE X Y)) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T X A)))).
Name the above subgoal *1.
We will appeal to induction. There are four plausible inductions. They
merge into two likely candidate inductions. However, only one is unflawed.
We will induct according to the following scheme:
(AND (IMPLIES (NLISTP Y) (p X Y A))
(IMPLIES (AND (NOT (NLISTP Y))
(EQUAL X (CAR Y)))
(p X Y A))
(IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(p X (CDR Y) A))
(p X Y A))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP can be used to show that the measure (COUNT Y) 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 (NLISTP Y) (MEMBER X Y))
(EQUAL (EVAL$ T (PLUS-TREE (DELETE X Y)) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T X A)))),
which simplifies, opening up the functions NLISTP and MEMBER, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP Y))
(EQUAL X (CAR Y))
(MEMBER X Y))
(EQUAL (EVAL$ T (PLUS-TREE (DELETE X Y)) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T X A)))),
which simplifies, opening up the definitions of NLISTP, MEMBER, DELETE, and
PLUS-TREE, to three new conjectures:
Case 3.3.
(IMPLIES (AND (LISTP Y) (NOT (LISTP (CDR Y))))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(DIFFERENCE (EVAL$ T (LIST 'FIX (CAR Y)) A)
(EVAL$ T (CAR Y) A)))),
which again simplifies, applying the lemmas REWRITE-EVAL$ and CAR-CONS,
and opening up the definition of FIX, to two new formulas:
Case 3.3.2.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(DIFFERENCE 0 (EVAL$ T (CAR Y) A)))),
which again simplifies, using linear arithmetic and applying
DIFFERENCE-0, to the new formula:
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
0)),
which further simplifies, opening up the definitions of PLUS-TREE, CDR,
CAR, LISTP, LITATOM, EQUAL, and EVAL$, to:
T.
Case 3.3.1.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(DIFFERENCE (EVAL$ T (CAR Y) A)
(EVAL$ T (CAR Y) A)))),
which again simplifies, using linear arithmetic and rewriting with
DIFFERENCE-0, to:
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
0)),
which further simplifies, expanding the functions PLUS-TREE, CDR, CAR,
LISTP, LITATOM, EQUAL, and EVAL$, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(LISTP (CDDR Y)))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(DIFFERENCE (EVAL$ T
(LIST 'PLUS
(CAR Y)
(PLUS-TREE (CDR Y)))
A)
(EVAL$ T (CAR Y) A)))),
which again simplifies, applying REWRITE-EVAL$, CAR-CONS, CDR-CONS,
NUMBERP-EVAL$-PLUS-TREE, and DIFFERENCE-PLUS, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y))))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(DIFFERENCE (EVAL$ T
(LIST 'PLUS (CAR Y) (CADR Y))
A)
(EVAL$ T (CAR Y) A)))).
However this again simplifies, appealing to the lemmas REWRITE-EVAL$,
CAR-CONS, CDR-CONS, and DIFFERENCE-PLUS, to two new goals:
Case 3.1.2.
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (NUMBERP (EVAL$ T (CADR Y) A))))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
0)),
which further simplifies, applying REWRITE-EVAL$ and CAR-CONS, and
opening up the functions PLUS-TREE, FIX, and EQUAL, to:
T.
Case 3.1.1.
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NUMBERP (EVAL$ T (CADR Y) A)))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T (CADR Y) A))).
But this further simplifies, rewriting with REWRITE-EVAL$ and CAR-CONS,
and unfolding PLUS-TREE and FIX, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(NOT (MEMBER X (CDR Y)))
(MEMBER X Y))
(EQUAL (EVAL$ T (PLUS-TREE (DELETE X Y)) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T X A)))).
This simplifies, unfolding NLISTP and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X Y))
(EQUAL (EVAL$ T (PLUS-TREE (DELETE X Y)) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T X A)))).
This simplifies, rewriting with CAR-CONS and CDR-CONS, and expanding the
functions NLISTP, MEMBER, DELETE, and PLUS-TREE, to nine new formulas:
Case 1.9.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(NOT (LISTP (DELETE X (CDR Y)))))
(EQUAL (EVAL$ T (LIST 'FIX (CAR Y)) A)
(DIFFERENCE (EVAL$ T (LIST 'FIX (CAR Y)) A)
(EVAL$ T X A)))),
which again simplifies, rewriting with EQUAL-DIFFERENCE-0, REWRITE-EVAL$,
CAR-CONS, and DIFFERENCE-CANCELLATION-0, and opening up the functions
PLUS-TREE, CDR, CAR, LISTP, LITATOM, EQUAL, EVAL$, and FIX, to:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))),
which again simplifies, using linear arithmetic and rewriting with
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to the following two new conjectures:
Case 1.9.2.
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))).
However this again simplifies, using linear arithmetic and rewriting
with the lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 1.9.1.
(IMPLIES (AND (NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))),
which again simplifies, clearly, to:
(IMPLIES (AND (EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))),
which further simplifies, using linear arithmetic, applying the lemma
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, and unfolding EVAL$, EQUAL, LITATOM,
LISTP, CAR, CDR, and PLUS-TREE, to:
T.
Case 1.8.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(LISTP (CDR (DELETE X (CDR Y)))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR Y)
(PLUS-TREE (DELETE X (CDR Y))))
A)
(DIFFERENCE (EVAL$ T (LIST 'FIX (CAR Y)) A)
(EVAL$ T X A)))),
which again simplifies, applying REWRITE-EVAL$, CAR-CONS, and CDR-CONS,
and unfolding FIX, to the following two new formulas:
Case 1.8.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(LISTP (CDR (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A))
(DIFFERENCE 0 (EVAL$ T X A)))).
But this again simplifies, using linear arithmetic, applying the lemma
DIFFERENCE-0, and opening up the function PLUS, to the goal:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(LISTP (CDR (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
0)).
But this further simplifies, using linear arithmetic, rewriting with
DIFFERENCE-0, and opening up the functions DELETE, PLUS-TREE, CDR, CAR,
LISTP, LITATOM, EQUAL, EVAL$, and MEMBER, to:
T.
Case 1.8.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(LISTP (CDR (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A))
(DIFFERENCE (EVAL$ T (CAR Y) A)
(EVAL$ T X A)))).
This further simplifies, using linear arithmetic, rewriting with the
lemma DIFFERENCE-0, and opening up the functions DELETE, PLUS-TREE, CDR,
CAR, LISTP, LITATOM, EQUAL, EVAL$, and MEMBER, to:
T.
Case 1.7.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y))))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR Y)
(CAR (DELETE X (CDR Y))))
A)
(DIFFERENCE (EVAL$ T (LIST 'FIX (CAR Y)) A)
(EVAL$ T X A)))),
which again simplifies, appealing to the lemmas REWRITE-EVAL$, CAR-CONS,
CDR-CONS, PLUS-RIGHT-ID2, and DIFFERENCE-CANCELLATION-0, and opening up
PLUS-TREE and FIX, to three new conjectures:
Case 1.7.3.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(EQUAL 0
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))),
which again simplifies, rewriting with EQUAL-DIFFERENCE-0, to the new
conjecture:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))),
which again simplifies, using linear arithmetic and appealing to the
lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to two new goals:
Case 1.7.3.2.
(IMPLIES
(AND (NOT (NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))),
which again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 1.7.3.1.
(IMPLIES
(AND (NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))).
This again simplifies, trivially, to:
(IMPLIES
(AND (EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))),
which finally simplifies, using linear arithmetic, rewriting with the
lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, and opening up the
functions EVAL$, EQUAL, LITATOM, LISTP, CAR, CDR, and PLUS-TREE, to:
T.
Case 1.7.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A))
(EQUAL (EVAL$ T (CAR (DELETE X (CDR Y))) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CAR (DELETE X (CDR Y))) A))
(DIFFERENCE 0 (EVAL$ T X A)))),
which again simplifies, using linear arithmetic, applying the lemma
DIFFERENCE-0, and opening up the definition of PLUS, to:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T (CAR (DELETE X (CDR Y))) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL (EVAL$ T (CAR (DELETE X (CDR Y))) A)
0)).
But this further simplifies, using linear arithmetic, applying
CAR-NLISTP and DIFFERENCE-0, and expanding DELETE, LISTP, LITATOM, EQUAL,
EVAL$, PLUS-TREE, CDR, CAR, and MEMBER, to:
T.
Case 1.7.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A))
(EQUAL (EVAL$ T (CAR (DELETE X (CDR Y))) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CAR (DELETE X (CDR Y))) A))
(DIFFERENCE (EVAL$ T (CAR Y) A)
(EVAL$ T X A)))).
This again simplifies, trivially, to:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T (CAR (DELETE X (CDR Y))) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(NOT (LISTP (CDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CAR (DELETE X (CDR Y))) A))
(DIFFERENCE (EVAL$ T (CAR Y) A)
(EVAL$ T X A)))),
which further simplifies, using linear arithmetic, applying the lemmas
CAR-NLISTP and DIFFERENCE-0, and opening up the definitions of DELETE,
LISTP, LITATOM, EQUAL, EVAL$, PLUS-TREE, CDR, CAR, and MEMBER, to:
T.
Case 1.6.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(NOT (LISTP (DELETE X (CDR Y)))))
(EQUAL (EVAL$ T (LIST 'FIX (CAR Y)) A)
(DIFFERENCE (EVAL$ T
(LIST 'PLUS
(CAR Y)
(PLUS-TREE (CDR Y)))
A)
(EVAL$ T X A)))),
which again simplifies, applying EQUAL-DIFFERENCE-0, REWRITE-EVAL$,
CAR-CONS, and CDR-CONS, and unfolding the functions PLUS-TREE, CDR, CAR,
LISTP, LITATOM, EQUAL, EVAL$, and FIX, to the following two new goals:
Case 1.6.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL 0
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))).
This again simplifies, using linear arithmetic and appealing to the
lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to three new goals:
Case 1.6.2.3.
(IMPLIES
(AND (NOT (NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL 0
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))),
which again simplifies, applying NUMBERP-EVAL$-PLUS-TREE, to:
T.
Case 1.6.2.2.
(IMPLIES
(AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL 0
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))).
However this again simplifies, using linear arithmetic, applying
NUMBERP-EVAL$-PLUS-TREE, PLUS-RIGHT-ID2, COMMUTATIVITY-OF-PLUS, and
DIFFERENCE-0, and expanding LESSP, NUMBERP, and EQUAL, to:
T.
Case 1.6.2.1.
(IMPLIES (AND (NUMBERP (EVAL$ T X A))
(NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL 0
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T X A))
(EVAL$ T X A)))).
However this again simplifies, applying PLUS-RIGHT-ID2,
COMMUTATIVITY-OF-PLUS, and DIFFERENCE-0, and expanding EQUAL, to:
T.
Case 1.6.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))).
However this again simplifies, using linear arithmetic and rewriting
with MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
(IMPLIES (AND (LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic and rewriting with the
lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 1.5.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(LISTP (CDR (DELETE X (CDR Y)))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR Y)
(PLUS-TREE (DELETE X (CDR Y))))
A)
(DIFFERENCE (EVAL$ T
(LIST 'PLUS
(CAR Y)
(PLUS-TREE (CDR Y)))
A)
(EVAL$ T X A)))),
which again simplifies, applying REWRITE-EVAL$, CAR-CONS, and CDR-CONS, to:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(LISTP (CDR (DELETE X (CDR Y)))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A))
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic, to two new goals:
Case 1.5.2.
(IMPLIES (AND (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(LISTP (CDR (DELETE X (CDR Y)))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A))
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic and rewriting with
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 1.5.1.
(IMPLIES (AND (LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(LISTP (CDR (DELETE X (CDR Y)))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A))
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))).
However this again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(LISTP (CDR (DELETE X (CDR Y)))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A))
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))).
But this again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 1.4.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y))))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR Y)
(CAR (DELETE X (CDR Y))))
A)
(DIFFERENCE (EVAL$ T
(LIST 'PLUS
(CAR Y)
(PLUS-TREE (CDR Y)))
A)
(EVAL$ T X A)))).
However this again simplifies, rewriting with REWRITE-EVAL$, CAR-CONS,
CDR-CONS, and PLUS-RIGHT-ID2, and opening up the definitions of PLUS-TREE
and FIX, to the following three new formulas:
Case 1.4.3.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(EQUAL 0
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL 0
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))).
However this again simplifies, applying the lemmas EQUAL-DIFFERENCE-0,
NUMBERP-EVAL$-PLUS-TREE, and DIFFERENCE-0, and unfolding the definitions
of PLUS and EQUAL, to:
T.
Case 1.4.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(EQUAL 0
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic, to two new formulas:
Case 1.4.2.2.
(IMPLIES
(AND (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(EQUAL 0
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic and applying the lemma
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 1.4.2.1.
(IMPLIES
(AND (LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(EQUAL 0
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic, to the conjecture:
(IMPLIES
(AND (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(EQUAL 0
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))).
This again simplifies, using linear arithmetic and appealing to the
lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 1.4.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A))
(EQUAL (EVAL$ T (CAR (DELETE X (CDR Y))) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y))))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CAR (DELETE X (CDR Y))) A))
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic, to two new conjectures:
Case 1.4.1.2.
(IMPLIES
(AND (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A))
(EQUAL (EVAL$ T (CAR (DELETE X (CDR Y))) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y))))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CAR (DELETE X (CDR Y))) A))
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 1.4.1.1.
(IMPLIES
(AND (LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A))
(EQUAL (EVAL$ T (CAR (DELETE X (CDR Y))) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y))))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CAR (DELETE X (CDR Y))) A))
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))).
This again simplifies, using linear arithmetic, to:
(IMPLIES
(AND (LESSP (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LESSP (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A))
(EQUAL (EVAL$ T (CAR (DELETE X (CDR Y))) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(LISTP (CDDR Y))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y))))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CAR (DELETE X (CDR Y))) A))
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (PLUS-TREE (CDR Y)) A))
(EVAL$ T X A)))).
This again simplifies, using linear arithmetic and rewriting with
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 1.3.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y)))))
(EQUAL (EVAL$ T (LIST 'FIX (CAR Y)) A)
(DIFFERENCE (EVAL$ T
(LIST 'PLUS (CAR Y) (CADR Y))
A)
(EVAL$ T X A)))).
However this again simplifies, applying the lemmas EQUAL-DIFFERENCE-0,
REWRITE-EVAL$, CAR-CONS, and CDR-CONS, and opening up the functions
PLUS-TREE, CDR, CAR, LISTP, LITATOM, EQUAL, EVAL$, and FIX, to two new
conjectures:
Case 1.3.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL 0
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic and rewriting with
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to the following three new formulas:
Case 1.3.2.3.
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL 0
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))).
However this again simplifies, rewriting with NUMBERP-EVAL$-PLUS-TREE,
to:
T.
Case 1.3.2.2.
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL 0
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))).
But this again simplifies, applying NUMBERP-EVAL$-PLUS-TREE, and
opening up the definitions of LESSP, PLUS, and DIFFERENCE, to:
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
0)
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NUMBERP (EVAL$ T (CADR Y) A))
(NOT (EQUAL (EVAL$ T (CADR Y) A) 0)))
(EQUAL 0 (EVAL$ T (CADR Y) A))),
which again simplifies, obviously, to:
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
0)
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NUMBERP (EVAL$ T (CADR Y) A)))
(EQUAL 0 (EVAL$ T (CADR Y) A))),
which finally simplifies, rewriting with REWRITE-EVAL$ and CAR-CONS,
and expanding PLUS-TREE and FIX, to:
T.
Case 1.3.2.1.
(IMPLIES (AND (NUMBERP (EVAL$ T X A))
(NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL 0
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))).
This again simplifies, applying the lemma EQUAL-DIFFERENCE-0, and
unfolding PLUS, to two new conjectures:
Case 1.3.2.1.2.
(IMPLIES (AND (NUMBERP (EVAL$ T X A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NOT (NUMBERP (EVAL$ T (CADR Y) A))))
(NOT (LESSP (EVAL$ T X A) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.3.2.1.1.
(IMPLIES (AND (NUMBERP (EVAL$ T X A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NUMBERP (EVAL$ T (CADR Y) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (CADR Y) A)))),
which further simplifies, applying the lemmas REWRITE-EVAL$,
CAR-CONS, CONS-CAR-CDR, and DELETE-NON-MEMBER, and opening up the
definitions of PLUS-TREE, FIX, MEMBER, and DELETE, to:
T.
Case 1.3.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which again simplifies, using linear arithmetic and rewriting with the
lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to three new conjectures:
Case 1.3.1.3.
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which again simplifies, rewriting with NUMBERP-EVAL$-PLUS-TREE, to:
T.
Case 1.3.1.2.
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))).
But this again simplifies, rewriting with NUMBERP-EVAL$-PLUS-TREE and
PLUS-EQUAL-0, and expanding LESSP and DIFFERENCE, to the following two
new conjectures:
Case 1.3.1.2.2.
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
0)
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CADR Y) A) 0))
(NUMBERP (EVAL$ T (CADR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A)))).
But this further simplifies, appealing to the lemmas REWRITE-EVAL$
and CAR-CONS, and expanding the definitions of PLUS-TREE and FIX, to:
T.
Case 1.3.1.2.1.
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
0)
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0)))
(EQUAL (EVAL$ T (CAR Y) A)
(PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A)))),
which further simplifies, applying the lemmas REWRITE-EVAL$,
CAR-CONS, CONS-CAR-CDR, DELETE-NON-MEMBER, and COMMUTATIVITY-OF-PLUS,
and unfolding the functions PLUS-TREE, FIX, MEMBER, DELETE, and PLUS,
to:
T.
Case 1.3.1.1.
(IMPLIES (AND (NUMBERP (EVAL$ T X A))
(NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which again simplifies, clearly, to:
(IMPLIES (AND (NUMBERP (EVAL$ T X A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (LISTP (DELETE X (CDR Y))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which further simplifies, applying the lemmas REWRITE-EVAL$, CAR-CONS,
CONS-CAR-CDR, DELETE-NON-MEMBER, COMMUTATIVITY-OF-PLUS, and
DIFFERENCE-PLUS, and expanding PLUS-TREE, FIX, LESSP, MEMBER, DELETE,
EQUAL, PLUS, and DIFFERENCE, to:
T.
Case 1.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(LISTP (CDR (DELETE X (CDR Y)))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR Y)
(PLUS-TREE (DELETE X (CDR Y))))
A)
(DIFFERENCE (EVAL$ T
(LIST 'PLUS (CAR Y) (CADR Y))
A)
(EVAL$ T X A)))),
which again simplifies, rewriting with REWRITE-EVAL$, CAR-CONS, and
CDR-CONS, to the new formula:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(LISTP (CDR (DELETE X (CDR Y)))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A))
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which further simplifies, rewriting with CONS-CAR-CDR, DELETE-NON-MEMBER,
REWRITE-EVAL$, and CAR-CONS, and opening up the functions MEMBER, DELETE,
PLUS-TREE, and FIX, to:
T.
Case 1.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T
(PLUS-TREE (DELETE X (CDR Y)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y))))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR Y)
(CAR (DELETE X (CDR Y))))
A)
(DIFFERENCE (EVAL$ T
(LIST 'PLUS (CAR Y) (CADR Y))
A)
(EVAL$ T X A)))).
This again simplifies, rewriting with REWRITE-EVAL$, CAR-CONS, CDR-CONS,
and PLUS-RIGHT-ID2, and expanding the functions PLUS-TREE and FIX, to the
following three new conjectures:
Case 1.1.3.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(EQUAL 0
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A))))
(EQUAL 0
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))).
This again simplifies, rewriting with EQUAL-DIFFERENCE-0, and opening up
the function PLUS, to the following two new goals:
Case 1.1.3.2.
(IMPLIES
(AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NOT (NUMBERP (EVAL$ T (CADR Y) A))))
(NOT (LESSP (EVAL$ T X A) 0))).
But this again simplifies, using linear arithmetic, to:
T.
Case 1.1.3.1.
(IMPLIES
(AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NUMBERP (EVAL$ T (CADR Y) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (CADR Y) A)))),
which again simplifies, using linear arithmetic and rewriting with
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to the following three new
conjectures:
Case 1.1.3.1.3.
(IMPLIES
(AND (NOT (NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NUMBERP (EVAL$ T (CADR Y) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (CADR Y) A)))).
But this again simplifies, applying NUMBERP-EVAL$-PLUS-TREE, to:
T.
Case 1.1.3.1.2.
(IMPLIES
(AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NUMBERP (EVAL$ T (CADR Y) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (CADR Y) A)))).
But this again simplifies, applying the lemma
NUMBERP-EVAL$-PLUS-TREE, and unfolding the function LESSP, to:
(IMPLIES
(AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
0)
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NUMBERP (EVAL$ T (CADR Y) A)))
(EQUAL (EVAL$ T (CADR Y) A) 0)).
However this finally simplifies, rewriting with CONS-CAR-CDR,
DELETE-NON-MEMBER, REWRITE-EVAL$, and CAR-CONS, and unfolding the
functions MEMBER, DELETE, PLUS-TREE, FIX, and EQUAL, to:
T.
Case 1.1.3.1.1.
(IMPLIES
(AND (NUMBERP (EVAL$ T X A))
(NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NUMBERP (EVAL$ T (CADR Y) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (CADR Y) A)))).
This again simplifies, trivially, to the new conjecture:
(IMPLIES
(AND (NUMBERP (EVAL$ T X A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NUMBERP (EVAL$ T (CADR Y) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (CADR Y) A)))),
which finally simplifies, rewriting with REWRITE-EVAL$, CAR-CONS,
CONS-CAR-CDR, and DELETE-NON-MEMBER, and unfolding PLUS-TREE, FIX,
MEMBER, and DELETE, to:
T.
Case 1.1.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(EQUAL 0
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))).
This again simplifies, appealing to the lemma EQUAL-DIFFERENCE-0, to:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))).
But this again simplifies, using linear arithmetic and rewriting with
the lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to three new conjectures:
Case 1.1.2.3.
(IMPLIES
(AND (NOT (NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which again simplifies, rewriting with the lemma
NUMBERP-EVAL$-PLUS-TREE, to:
T.
Case 1.1.2.2.
(IMPLIES
(AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A)
(EVAL$ T (PLUS-TREE (CDR Y)) A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which again simplifies, rewriting with NUMBERP-EVAL$-PLUS-TREE and
PLUS-EQUAL-0, and opening up LESSP and DIFFERENCE, to the following
two new formulas:
Case 1.1.2.2.2.
(IMPLIES
(AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
0)
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CADR Y) A) 0))
(NUMBERP (EVAL$ T (CADR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A)))).
But this finally simplifies, rewriting with CONS-CAR-CDR,
DELETE-NON-MEMBER, REWRITE-EVAL$, and CAR-CONS, and opening up the
definitions of MEMBER, DELETE, PLUS-TREE, FIX, and EQUAL, to:
T.
Case 1.1.2.2.1.
(IMPLIES
(AND (NOT (NUMBERP (EVAL$ T X A)))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
0)
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0)))
(EQUAL (EVAL$ T (CAR Y) A)
(PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A)))).
However this finally simplifies, applying the lemmas CONS-CAR-CDR,
DELETE-NON-MEMBER, REWRITE-EVAL$, CAR-CONS, and PLUS-RIGHT-ID2, and
expanding the definitions of MEMBER, DELETE, PLUS-TREE, FIX, and
EQUAL, to:
T.
Case 1.1.2.1.
(IMPLIES
(AND (NUMBERP (EVAL$ T X A))
(NUMBERP (EVAL$ T (PLUS-TREE (CDR Y)) A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which again simplifies, clearly, to:
(IMPLIES
(AND (NUMBERP (EVAL$ T X A))
(EQUAL (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NOT (NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A)))
(NOT (LESSP (EVAL$ T X A) (EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y)))))
(NUMBERP (EVAL$ T (CAR Y) A)))
(EQUAL (EVAL$ T (CAR Y) A)
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which finally simplifies, applying REWRITE-EVAL$, CAR-CONS,
CONS-CAR-CDR, DELETE-NON-MEMBER, and PLUS-RIGHT-ID2, and opening up
the functions PLUS-TREE, FIX, MEMBER, DELETE, LESSP, EQUAL, and
DIFFERENCE, to:
T.
Case 1.1.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CAR (DELETE X (CDR Y))) A))
(EQUAL (EVAL$ T (CAR (DELETE X (CDR Y))) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y))))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CAR (DELETE X (CDR Y))) A))
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))).
This again simplifies, clearly, to:
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(EQUAL (EVAL$ T (CAR (DELETE X (CDR Y))) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE (CDR Y)) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(LISTP (DELETE X (CDR Y)))
(NOT (LISTP (CDR (DELETE X (CDR Y))))))
(EQUAL (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CAR (DELETE X (CDR Y))) A))
(DIFFERENCE (PLUS (EVAL$ T (CAR Y) A)
(EVAL$ T (CADR Y) A))
(EVAL$ T X A)))),
which further simplifies, rewriting with the lemmas CONS-CAR-CDR,
DELETE-NON-MEMBER, REWRITE-EVAL$, CAR-CONS, PLUS-EQUAL-0, and
DIFFERENCE-CANCELLATION-0, and expanding MEMBER, DELETE, PLUS-TREE, and
FIX, to three new conjectures:
Case 1.1.1.3.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CADR Y) A))
(NOT (EQUAL X (CADR Y)))
(EQUAL (EVAL$ T (CADR Y) A)
(DIFFERENCE (EVAL$ T (CADR Y) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))),
which again simplifies, using linear arithmetic, to the formula:
(IMPLIES (AND (LESSP (EVAL$ T (CADR Y) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CADR Y) A))
(NOT (EQUAL X (CADR Y)))
(EQUAL (EVAL$ T (CADR Y) A)
(DIFFERENCE (EVAL$ T (CADR Y) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (EQUAL (EVAL$ T (CAR Y) A) 0))
(NUMBERP (EVAL$ T (CAR Y) A))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))).
However this finally simplifies, using linear arithmetic, applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, CAR-CONS, and REWRITE-EVAL$, and
expanding the functions FIX and PLUS-TREE, to:
T.
Case 1.1.1.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CADR Y) A))
(NOT (EQUAL X (CADR Y)))
(EQUAL (EVAL$ T (CADR Y) A)
(DIFFERENCE (EVAL$ T (CADR Y) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NOT (EQUAL (EVAL$ T (CADR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))).
However this again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (EVAL$ T (CADR Y) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CADR Y) A))
(NOT (EQUAL X (CADR Y)))
(EQUAL (EVAL$ T (CADR Y) A)
(DIFFERENCE (EVAL$ T (CADR Y) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(NOT (NUMBERP (EVAL$ T (CAR Y) A)))
(NOT (EQUAL (EVAL$ T (CADR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))).
However this finally simplifies, using linear arithmetic, applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, CAR-CONS, and REWRITE-EVAL$, and
expanding the functions FIX and PLUS-TREE, to:
T.
Case 1.1.1.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CADR Y) A))
(NOT (EQUAL X (CADR Y)))
(EQUAL (EVAL$ T (CADR Y) A)
(DIFFERENCE (EVAL$ T (CADR Y) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(EQUAL (EVAL$ T (CAR Y) A) 0)
(NOT (EQUAL (EVAL$ T (CADR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))).
However this again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (EVAL$ T (CADR Y) A)
(EVAL$ T X A))
(LISTP Y)
(NOT (EQUAL X (CAR Y)))
(NUMBERP (EVAL$ T (CADR Y) A))
(NOT (EQUAL X (CADR Y)))
(EQUAL (EVAL$ T (CADR Y) A)
(DIFFERENCE (EVAL$ T (CADR Y) A)
(EVAL$ T X A)))
(MEMBER X (CDR Y))
(LISTP (CDR Y))
(NOT (LISTP (CDDR Y)))
(EQUAL (EVAL$ T (CAR Y) A) 0)
(NOT (EQUAL (EVAL$ T (CADR Y) A) 0))
(NOT (EQUAL (EVAL$ T X A) 0)))
(NOT (NUMBERP (EVAL$ T X A)))).
This finally simplifies, using linear arithmetic, appealing to the
lemmas MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, CAR-CONS, and
REWRITE-EVAL$, and opening up the functions FIX and PLUS-TREE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 1.4 0.1 ]
PLUS-TREE-DELETE
(PROVE-LEMMA SUBBAGP-IMPLIES-PLUS-TREE-GREATEREQP
(REWRITE)
(IMPLIES (SUBBAGP X Y)
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE X) A)))))
WARNING: When the linear lemma SUBBAGP-IMPLIES-PLUS-TREE-GREATEREQP is stored
under (EVAL$ T (PLUS-TREE Y) A) it contains the free variable X which will be
chosen by instantiating the hypothesis (SUBBAGP X Y).
WARNING: When the linear lemma SUBBAGP-IMPLIES-PLUS-TREE-GREATEREQP is stored
under (EVAL$ T (PLUS-TREE X) A) it contains the free variable Y which will be
chosen by instantiating the hypothesis (SUBBAGP X Y).
WARNING: Note that the proposed lemma SUBBAGP-IMPLIES-PLUS-TREE-GREATEREQP is
to be stored as zero type prescription rules, zero compound recognizer rules,
two linear rules, and zero replacement rules.
Name the conjecture *1.
Perhaps we can prove it by induction. There are three plausible
inductions. 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)
(MEMBER (CAR X) Y)
(p (DELETE (CAR X) Y) A (CDR X)))
(p Y A X))
(IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) Y)))
(p Y A X))
(IMPLIES (NOT (LISTP X)) (p Y 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. Note, however, the inductive instance chosen for Y. The above
induction scheme leads to the following four new formulas:
Case 4. (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (SUBBAGP (CDR X) (DELETE (CAR X) Y)))
(SUBBAGP X Y))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE X) A)))).
This simplifies, opening up the definition of SUBBAGP, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (LESSP (EVAL$ T
(PLUS-TREE (DELETE (CAR X) Y))
A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP X Y))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE X) A)))).
This simplifies, applying PLUS-TREE-DELETE, and unfolding SUBBAGP and
PLUS-TREE, to three new formulas:
Case 3.3.
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(NOT (LISTP (CDR X))))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (LIST 'FIX (CAR X)) A)))),
which again simplifies, rewriting with the lemmas REWRITE-EVAL$ and
CAR-CONS, and opening up the definition of FIX, to two new formulas:
Case 3.3.2.
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.3.1.
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(NOT (LISTP (CDR X)))
(NUMBERP (EVAL$ T (CAR X) A)))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A)))),
which again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T
(LIST 'PLUS
(CAR X)
(PLUS-TREE (CDR X)))
A)))).
This again simplifies, rewriting with REWRITE-EVAL$, CAR-CONS, and
CDR-CONS, to:
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A))))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(LISTP X)
(MEMBER (CAR X) Y)
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A))))).
However this again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T
(LIST 'PLUS (CAR X) (CADR X))
A)))).
This again simplifies, rewriting with the lemmas REWRITE-EVAL$, CAR-CONS,
and CDR-CONS, to:
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A))))).
But this further simplifies, rewriting with REWRITE-EVAL$, CAR-CONS, and
PLUS-RIGHT-ID2, and expanding the definitions of PLUS-TREE and FIX, to the
following three new formulas:
Case 3.1.3.
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (NUMBERP (EVAL$ T (CADR X) A)))
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
0))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A) 0))).
However this again simplifies, using linear arithmetic, to:
T.
Case 3.1.2.
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (NUMBERP (EVAL$ T (CADR X) A)))
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
0))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NUMBERP (EVAL$ T (CAR X) A)))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A)))),
which again simplifies, using linear arithmetic and applying the lemma
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 3.1.1.
(IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NUMBERP (EVAL$ T (CADR X) A))
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A))))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(LISTP X)
(MEMBER (CAR X) Y)
(NUMBERP (EVAL$ T (CADR X) A))
(NOT (LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A))))).
However this again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) Y))
(SUBBAGP X Y))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE X) A)))).
This simplifies, unfolding the definition of SUBBAGP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X)) (SUBBAGP X Y))
(NOT (LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE X) A)))).
This simplifies, applying SUBBAGP-CDR2, and opening up SUBBAGP, PLUS-TREE,
CDR, CAR, LISTP, LITATOM, EQUAL, EVAL$, and LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
SUBBAGP-IMPLIES-PLUS-TREE-GREATEREQP
(PROVE-LEMMA PLUS-TREE-BAGDIFF
(REWRITE)
(IMPLIES (SUBBAGP X Y)
(EQUAL (EVAL$ T (PLUS-TREE (BAGDIFF Y X)) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE X) A)))))
Give the conjecture the name *1.
Perhaps we can prove it by induction. Four 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)
(MEMBER (CAR X) Y)
(p (DELETE (CAR X) Y) (CDR X) A))
(p Y X A))
(IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) Y))
(p Y (CDR X) A))
(p Y X A))
(IMPLIES (NOT (LISTP X)) (p Y 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. Note, however, the inductive instances chosen for Y. The
above induction scheme generates the following five new goals:
Case 5. (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (SUBBAGP (CDR X) (DELETE (CAR X) Y)))
(SUBBAGP X Y))
(EQUAL (EVAL$ T (PLUS-TREE (BAGDIFF Y X)) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE X) A)))).
This simplifies, unfolding the definition of SUBBAGP, to:
T.
Case 4. (IMPLIES
(AND (LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T
(PLUS-TREE (DELETE (CAR X) Y))
A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP X Y))
(EQUAL (EVAL$ T (PLUS-TREE (BAGDIFF Y X)) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE X) A)))).
This simplifies, rewriting with PLUS-TREE-DELETE, and expanding the
functions SUBBAGP, BAGDIFF, and PLUS-TREE, to three new conjectures:
Case 4.3.
(IMPLIES
(AND (LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(NOT (LISTP (CDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (LIST 'FIX (CAR X)) A)))),
which again simplifies, applying the lemmas REWRITE-EVAL$ and CAR-CONS,
and expanding FIX, to two new goals:
Case 4.3.2.
(IMPLIES
(AND
(LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
0))),
which again simplifies, using linear arithmetic, appealing to the lemmas
NUMBERP-EVAL$-PLUS-TREE and DIFFERENCE-0, and unfolding the functions
DIFFERENCE and EQUAL, to the goal:
(IMPLIES
(AND
(LISTP X)
(MEMBER (CAR X) Y)
(NOT (EQUAL (EVAL$ T (PLUS-TREE Y) A) 0))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(NOT (LISTP (CDR X)))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(EVAL$ T (PLUS-TREE Y) A))).
This further simplifies, applying the lemmas NUMBERP-EVAL$-PLUS-TREE,
PLUS-TREE-DELETE, and SUBBAGP-CDR2, and opening up BAGDIFF, DIFFERENCE,
PLUS-TREE, CDR, CAR, LISTP, LITATOM, EQUAL, EVAL$, and SUBBAGP, to:
T.
Case 4.3.1.
(IMPLIES
(AND
(LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(NOT (LISTP (CDR X)))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A)))),
which further simplifies, rewriting with the lemmas PLUS-TREE-DELETE,
EQUAL-DIFFERENCE-0, and SUBBAGP-CDR2, and expanding the definitions of
BAGDIFF, PLUS-TREE, CDR, CAR, LISTP, LITATOM, EQUAL, EVAL$, DIFFERENCE,
and SUBBAGP, to:
T.
Case 4.2.
(IMPLIES
(AND (LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T
(LIST 'PLUS
(CAR X)
(PLUS-TREE (CDR X)))
A)))),
which again simplifies, applying REWRITE-EVAL$, CAR-CONS, and CDR-CONS, to:
(IMPLIES
(AND (LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A))))),
which again simplifies, using linear arithmetic, to four new conjectures:
Case 4.2.4.
(IMPLIES
(AND
(LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A))
(LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A))))),
which again simplifies, using linear arithmetic and rewriting with
SUBBAGP-IMPLIES-PLUS-TREE-GREATEREQP and PLUS-TREE-DELETE, to:
(IMPLIES
(AND
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A))
(LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A))))),
which again simplifies, using linear arithmetic and appealing to the
lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 4.2.3.
(IMPLIES
(AND
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A))))),
which again simplifies, using linear arithmetic and rewriting with
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 4.2.2.
(IMPLIES
(AND
(NOT
(NUMBERP (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)))
(LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A))))).
This again simplifies, obviously, to:
T.
Case 4.2.1.
(IMPLIES
(AND
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A))))).
But this again simplifies, using linear arithmetic, to two new
conjectures:
Case 4.2.1.2.
(IMPLIES
(AND
(LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A))
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A))))),
which again simplifies, using linear arithmetic and applying
SUBBAGP-IMPLIES-PLUS-TREE-GREATEREQP and PLUS-TREE-DELETE, to:
(IMPLIES
(AND
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A))
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A))))),
which again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 4.2.1.1.
(IMPLIES
(AND
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(LISTP (CDDR X)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE (CDR X)) A))))).
But this again simplifies, using linear arithmetic and appealing to
the lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 4.1.
(IMPLIES
(AND (LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T
(LIST 'PLUS (CAR X) (CADR X))
A)))),
which again simplifies, appealing to the lemmas REWRITE-EVAL$, CAR-CONS,
and CDR-CONS, to:
(IMPLIES
(AND (LISTP X)
(MEMBER (CAR X) Y)
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A))))).
However this further simplifies, rewriting with REWRITE-EVAL$, CAR-CONS,
and PLUS-RIGHT-ID2, and opening up the definitions of PLUS-TREE and FIX,
to the following three new conjectures:
Case 4.1.3.
(IMPLIES
(AND
(LISTP X)
(MEMBER (CAR X) Y)
(NOT (NUMBERP (EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
0))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
0))).
This again simplifies, using linear arithmetic, applying the lemmas
NUMBERP-EVAL$-PLUS-TREE and DIFFERENCE-0, and opening up the functions
DIFFERENCE and EQUAL, to:
T.
Case 4.1.2.
(IMPLIES
(AND
(LISTP X)
(MEMBER (CAR X) Y)
(NOT (NUMBERP (EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
0))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A)))),
which again simplifies, using linear arithmetic, to three new goals:
Case 4.1.2.3.
(IMPLIES
(AND
(LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
0)
(LISTP X)
(MEMBER (CAR X) Y)
(NOT (NUMBERP (EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
0))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A)))),
which again simplifies, using linear arithmetic and rewriting with
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 4.1.2.2.
(IMPLIES
(AND
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(LISTP X)
(MEMBER (CAR X) Y)
(NOT (NUMBERP (EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
0))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A)))).
However this again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 4.1.2.1.
(IMPLIES
(AND
(NOT
(NUMBERP
(EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)))
(LISTP X)
(MEMBER (CAR X) Y)
(NOT (NUMBERP (EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
0))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A)))).
This again simplifies, clearly, to:
T.
Case 4.1.1.
(IMPLIES
(AND
(LISTP X)
(MEMBER (CAR X) Y)
(NUMBERP (EVAL$ T (CADR X) A))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A))))).
But this again simplifies, using linear arithmetic, to four new formulas:
Case 4.1.1.4.
(IMPLIES
(AND
(LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A))
(LISTP X)
(MEMBER (CAR X) Y)
(NUMBERP (EVAL$ T (CADR X) A))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A))))),
which again simplifies, using linear arithmetic, appealing to the
lemma DIFFERENCE-0, and opening up EQUAL, to:
(IMPLIES
(AND
(LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A))
(LISTP X)
(MEMBER (CAR X) Y)
(NUMBERP (EVAL$ T (CADR X) A))
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
0)).
But this finally simplifies, using linear arithmetic and rewriting
with the lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 4.1.1.3.
(IMPLIES
(AND
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(LISTP X)
(MEMBER (CAR X) Y)
(NUMBERP (EVAL$ T (CADR X) A))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A))))),
which again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 4.1.1.2.
(IMPLIES
(AND
(NOT
(NUMBERP
(EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)))
(LISTP X)
(MEMBER (CAR X) Y)
(NUMBERP (EVAL$ T (CADR X) A))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A))))).
This again simplifies, obviously, to:
T.
Case 4.1.1.1.
(IMPLIES
(AND
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A)))
(LISTP X)
(MEMBER (CAR X) Y)
(NUMBERP (EVAL$ T (CADR X) A))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A))))).
But this again simplifies, using linear arithmetic, to two new goals:
Case 4.1.1.1.2.
(IMPLIES
(AND
(LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A))
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A)))
(LISTP X)
(MEMBER (CAR X) Y)
(NUMBERP (EVAL$ T (CADR X) A))
(EQUAL
(EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A))))),
which again simplifies, using linear arithmetic, rewriting with
DIFFERENCE-0, and unfolding EQUAL, to:
(IMPLIES
(AND
(LESSP (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A))
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A)))
(LISTP X)
(MEMBER (CAR X) Y)
(NUMBERP (EVAL$ T (CADR X) A))
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EQUAL
(EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
0)),
which finally simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 4.1.1.1.1.
(IMPLIES
(AND
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(LESSP (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A)))
(LISTP X)
(MEMBER (CAR X) Y)
(NUMBERP (EVAL$ T (CADR X) A))
(EQUAL
(EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A))
(EVAL$ T (CADR X) A)))
(SUBBAGP (CDR X) (DELETE (CAR X) Y))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF (DELETE (CAR X) Y) (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A))))).
However this finally simplifies, using linear arithmetic and
applying the lemma MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) Y))
(NOT (SUBBAGP (CDR X) Y))
(SUBBAGP X Y))
(EQUAL (EVAL$ T (PLUS-TREE (BAGDIFF Y X)) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE X) A)))),
which simplifies, expanding SUBBAGP, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) Y))
(EQUAL (EVAL$ T
(PLUS-TREE (BAGDIFF Y (CDR X)))
A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(SUBBAGP X Y))
(EQUAL (EVAL$ T (PLUS-TREE (BAGDIFF Y X)) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE X) A)))),
which simplifies, opening up SUBBAGP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X)) (SUBBAGP X Y))
(EQUAL (EVAL$ T (PLUS-TREE (BAGDIFF Y X)) A)
(DIFFERENCE (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE X) A)))),
which simplifies, rewriting with SUBBAGP-CDR2 and NUMBERP-EVAL$-PLUS-TREE,
and expanding the functions SUBBAGP, BAGDIFF, PLUS-TREE, CDR, CAR, LISTP,
LITATOM, EQUAL, EVAL$, and DIFFERENCE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.7 0.1 ]
PLUS-TREE-BAGDIFF
(PROVE-LEMMA NUMBERP-EVAL$-BRIDGE
(REWRITE)
(IMPLIES (EQUAL (EVAL$ T Z A)
(EVAL$ T (PLUS-TREE X) A))
(NUMBERP (EVAL$ T Z A))))
WARNING: Note that NUMBERP-EVAL$-BRIDGE contains the free variable X which
will be chosen by instantiating the hypothesis:
(EQUAL (EVAL$ T Z A)
(EVAL$ T (PLUS-TREE X) A)).
.
We use the above equality hypothesis by substituting (EVAL$ T (PLUS-TREE X) A)
for (EVAL$ T Z A) and keeping the equality hypothesis. This produces the new
goal:
(IMPLIES (EQUAL (EVAL$ T Z A)
(EVAL$ T (PLUS-TREE X) A))
(NUMBERP (EVAL$ T (PLUS-TREE X) A))),
which simplifies, trivially, to:
(IMPLIES (EQUAL (EVAL$ T Z A)
(EVAL$ T (PLUS-TREE X) A))
(NUMBERP (EVAL$ T Z A))),
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 (EVAL$ T Z A)
(EVAL$ T (PLUS-TREE X) A))
(NUMBERP (EVAL$ T Z A))),
named *1. Let us appeal to the induction principle. Three inductions are
suggested by terms in the conjecture. They merge into two likely candidate
inductions, both of which are unflawed. So we will choose the one suggested
by the largest number of nonprimitive recursive functions. We will induct
according to the following scheme:
(AND (IMPLIES (LITATOM Z) (p Z A X))
(IMPLIES (AND (NOT (LITATOM Z)) (NLISTP Z))
(p Z A X))
(IMPLIES (AND (NOT (LITATOM Z))
(NOT (NLISTP Z))
(EQUAL (CAR Z) 'QUOTE))
(p Z A X))
(IMPLIES (AND (NOT (LITATOM Z))
(NOT (NLISTP Z))
(NOT (EQUAL (CAR Z) 'QUOTE))
(p (CDR Z) A X))
(p Z A X))).
Linear arithmetic, the lemmas CDR-LESSEQP, CDR-LESSP, CAR-LESSEQP, and
CAR-LESSP, and the definition of NLISTP inform us 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 five new conjectures:
Case 5. (IMPLIES (AND (LITATOM Z)
(EQUAL (EVAL$ T Z A)
(EVAL$ T (PLUS-TREE X) A)))
(NUMBERP (EVAL$ T Z A))),
which simplifies, unfolding the functions EVAL$ and EQUAL, to:
(IMPLIES (AND (LITATOM Z)
(EQUAL (CDR (ASSOC Z A))
(EVAL$ T (PLUS-TREE X) A)))
(NUMBERP (CDR (ASSOC Z A)))).
We use the above equality hypothesis by substituting:
(EVAL$ T (PLUS-TREE X) A)
for (CDR (ASSOC Z A)) and throwing away the equality. We thus obtain:
(IMPLIES (LITATOM Z)
(NUMBERP (EVAL$ T (PLUS-TREE X) A))),
which further simplifies, rewriting with the lemma NUMBERP-EVAL$-PLUS-TREE,
to:
T.
Case 4. (IMPLIES (AND (NOT (LITATOM Z))
(NLISTP Z)
(EQUAL (EVAL$ T Z A)
(EVAL$ T (PLUS-TREE X) A)))
(NUMBERP (EVAL$ T Z A))),
which simplifies, opening up NLISTP, EVAL$, and EQUAL, to:
(IMPLIES (AND (NOT (LITATOM Z))
(NOT (LISTP Z))
(EQUAL Z (EVAL$ T (PLUS-TREE X) A)))
(NUMBERP Z)).
But this again simplifies, applying NUMBERP-EVAL$-PLUS-TREE, to:
T.
Case 3. (IMPLIES (AND (NOT (LITATOM Z))
(NOT (NLISTP Z))
(EQUAL (CAR Z) 'QUOTE)
(EQUAL (EVAL$ T Z A)
(EVAL$ T (PLUS-TREE X) A)))
(NUMBERP (EVAL$ T Z A))).
This simplifies, expanding the functions NLISTP, EVAL$, and EQUAL, to the
new formula:
(IMPLIES (AND (NOT (LITATOM Z))
(LISTP Z)
(EQUAL (CAR Z) 'QUOTE)
(EQUAL (CADR Z)
(EVAL$ T (PLUS-TREE X) A)))
(NUMBERP (CADR Z))),
which again simplifies, obviously, to:
(IMPLIES (AND (LISTP Z)
(EQUAL (CAR Z) 'QUOTE)
(EQUAL (CADR Z)
(EVAL$ T (PLUS-TREE X) A)))
(NUMBERP (CADR Z))).
Applying the lemma CAR-CDR-ELIM, replace Z by (CONS V W) to eliminate
(CAR Z) and (CDR Z) and W by (CONS D C) to eliminate (CAR W) and (CDR W).
This produces the following two new conjectures:
Case 3.2.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL V 'QUOTE)
(EQUAL (CAR W)
(EVAL$ T (PLUS-TREE X) A)))
(NUMBERP (CAR W))).
But this further simplifies, rewriting with CAR-NLISTP, and unfolding the
definition of NUMBERP, to:
T.
Case 3.1.
(IMPLIES (AND (EQUAL V 'QUOTE)
(EQUAL D (EVAL$ T (PLUS-TREE X) A)))
(NUMBERP D)).
However this further simplifies, applying NUMBERP-EVAL$-PLUS-TREE, to:
T.
Case 2. (IMPLIES (AND (NOT (LITATOM Z))
(NOT (NLISTP Z))
(NOT (EQUAL (CAR Z) 'QUOTE))
(NOT (EQUAL (EVAL$ T (CDR Z) A)
(EVAL$ T (PLUS-TREE X) A)))
(EQUAL (EVAL$ T Z A)
(EVAL$ T (PLUS-TREE X) A)))
(NUMBERP (EVAL$ T Z A))).
This simplifies, applying the lemma NUMBERP-EVAL$-PLUS-TREE, and opening up
NLISTP, EVAL$, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (LITATOM Z))
(NOT (NLISTP Z))
(NOT (EQUAL (CAR Z) 'QUOTE))
(NUMBERP (EVAL$ T (CDR Z) A))
(EQUAL (EVAL$ T Z A)
(EVAL$ T (PLUS-TREE X) A)))
(NUMBERP (EVAL$ T Z A))).
This simplifies, applying the lemma NUMBERP-EVAL$-PLUS-TREE, and expanding
the definitions of NLISTP, EVAL$, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NUMBERP-EVAL$-BRIDGE
(PROVE-LEMMA BRIDGE-TO-SUBBAGP-IMPLIES-PLUS-TREE-GREATEREQP
(REWRITE)
(IMPLIES (AND (SUBBAGP Y (PLUS-FRINGE Z))
(EQUAL (EVAL$ T Z A)
(EVAL$ T
(PLUS-TREE (PLUS-FRINGE Z))
A)))
(EQUAL (LESSP (EVAL$ T Z A)
(EVAL$ T (PLUS-TREE Y) A))
F)))
This conjecture simplifies, using linear arithmetic and applying
SUBBAGP-IMPLIES-PLUS-TREE-GREATEREQP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
BRIDGE-TO-SUBBAGP-IMPLIES-PLUS-TREE-GREATEREQP
(PROVE-LEMMA EVAL$-PLUS-TREE-APPEND
(REWRITE)
(EQUAL (EVAL$ T (PLUS-TREE (APPEND X Y)) A)
(PLUS (EVAL$ T (PLUS-TREE X) A)
(EVAL$ T (PLUS-TREE Y) A))))
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 (AND (LISTP X) (p (CDR X) Y A))
(p X Y A))
(IMPLIES (NOT (LISTP X)) (p X Y A))).
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 generates the following two new
conjectures:
Case 2. (IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE (CDR X)) A)
(EVAL$ T (PLUS-TREE Y) A))))
(EQUAL (EVAL$ T (PLUS-TREE (APPEND X Y)) A)
(PLUS (EVAL$ T (PLUS-TREE X) A)
(EVAL$ T (PLUS-TREE Y) A)))).
This simplifies, rewriting with COMMUTATIVITY-OF-PLUS, CAR-CONS, and
CDR-CONS, and expanding APPEND and PLUS-TREE, to nine new formulas:
Case 2.9.
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(NOT (LISTP (APPEND (CDR X) Y))))
(EQUAL (EVAL$ T (LIST 'FIX (CAR X)) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (LIST 'FIX (CAR X)) A)))),
which again simplifies, appealing to the lemmas NUMBERP-EVAL$-PLUS-TREE,
PLUS-EQUAL-0, REWRITE-EVAL$, and CAR-CONS, and expanding the definitions
of PLUS-TREE, CDR, CAR, LISTP, LITATOM, EQUAL, EVAL$, FIX, and PLUS, to:
T.
Case 2.8.
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(LISTP (CDR (APPEND (CDR X) Y))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR X)
(PLUS-TREE (APPEND (CDR X) Y)))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (LIST 'FIX (CAR X)) A)))),
which again simplifies, applying REWRITE-EVAL$, CAR-CONS, and CDR-CONS,
and expanding the definition of FIX, to the following two new goals:
Case 2.8.2.
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(LISTP (CDR (APPEND (CDR X) Y)))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(EQUAL (PLUS (EVAL$ T (CAR X) A)
(EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A))
(PLUS (EVAL$ T (PLUS-TREE Y) A) 0))).
This again simplifies, applying NUMBERP-EVAL$-PLUS-TREE and
COMMUTATIVITY-OF-PLUS, and opening up PLUS and EQUAL, to:
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(LISTP (CDR (APPEND (CDR X) Y)))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(EVAL$ T (PLUS-TREE Y) A))),
which further simplifies, appealing to the lemmas
NUMBERP-EVAL$-PLUS-TREE and COMMUTATIVITY-OF-PLUS, and expanding APPEND,
PLUS-TREE, CDR, CAR, LISTP, LITATOM, EQUAL, EVAL$, and PLUS, to:
T.
Case 2.8.1.
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(LISTP (CDR (APPEND (CDR X) Y)))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (PLUS (EVAL$ T (CAR X) A)
(EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A))
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A)))),
which again simplifies, applying COMMUTATIVITY-OF-PLUS,
NUMBERP-EVAL$-PLUS-TREE, and PLUS-CANCELLATION, to the new formula:
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(LISTP (CDR (APPEND (CDR X) Y)))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(EVAL$ T (PLUS-TREE Y) A))),
which further simplifies, rewriting with NUMBERP-EVAL$-PLUS-TREE and
COMMUTATIVITY-OF-PLUS, and unfolding APPEND, PLUS-TREE, CDR, CAR, LISTP,
LITATOM, EQUAL, EVAL$, and PLUS, to:
T.
Case 2.7.
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y)))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR X)
(CAR (APPEND (CDR X) Y)))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (LIST 'FIX (CAR X)) A)))).
However this again simplifies, rewriting with REWRITE-EVAL$, CAR-CONS,
CDR-CONS, and PLUS-RIGHT-ID2, and opening up the definitions of PLUS-TREE
and FIX, to the following four new formulas:
Case 2.7.4.
(IMPLIES (AND (LISTP X)
(NOT (NUMBERP (EVAL$ T (CAR (APPEND (CDR X) Y)) A)))
(EQUAL 0
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y))))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(EQUAL 0
(PLUS (EVAL$ T (PLUS-TREE Y) A) 0))).
However this again simplifies, using linear arithmetic, to:
T.
Case 2.7.3.
(IMPLIES (AND (LISTP X)
(NOT (NUMBERP (EVAL$ T (CAR (APPEND (CDR X) Y)) A)))
(EQUAL 0
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y))))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (EVAL$ T (CAR X) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.7.2.
(IMPLIES (AND (LISTP X)
(NUMBERP (EVAL$ T (CAR (APPEND (CDR X) Y)) A))
(EQUAL (EVAL$ T (CAR (APPEND (CDR X) Y)) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y))))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(EQUAL (PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CAR (APPEND (CDR X) Y)) A))
(PLUS (EVAL$ T (PLUS-TREE Y) A) 0))),
which again simplifies, appealing to the lemmas NUMBERP-EVAL$-PLUS-TREE
and COMMUTATIVITY-OF-PLUS, and expanding the functions PLUS and EQUAL,
to the goal:
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T (CAR (APPEND (CDR X) Y)) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y))))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(EQUAL (EVAL$ T (CAR (APPEND (CDR X) Y)) A)
(EVAL$ T (PLUS-TREE Y) A))).
This further simplifies, rewriting with NUMBERP-EVAL$-PLUS-TREE,
COMMUTATIVITY-OF-PLUS, REWRITE-EVAL$, CAR-CONS, and NUMBERP-EVAL$-BRIDGE,
and opening up APPEND, PLUS-TREE, CDR, CAR, LISTP, LITATOM, EQUAL, EVAL$,
PLUS, and FIX, to:
T.
Case 2.7.1.
(IMPLIES (AND (LISTP X)
(NUMBERP (EVAL$ T (CAR (APPEND (CDR X) Y)) A))
(EQUAL (EVAL$ T (CAR (APPEND (CDR X) Y)) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y))))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CAR (APPEND (CDR X) Y)) A))
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CAR X) A)))).
However this again simplifies, appealing to the lemmas
COMMUTATIVITY-OF-PLUS, NUMBERP-EVAL$-PLUS-TREE, and PLUS-CANCELLATION,
to:
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T (CAR (APPEND (CDR X) Y)) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(NOT (LISTP (CDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y))))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (EVAL$ T (CAR (APPEND (CDR X) Y)) A)
(EVAL$ T (PLUS-TREE Y) A))).
But this further simplifies, rewriting with NUMBERP-EVAL$-PLUS-TREE,
COMMUTATIVITY-OF-PLUS, REWRITE-EVAL$, CAR-CONS, and NUMBERP-EVAL$-BRIDGE,
and opening up the functions APPEND, PLUS-TREE, CDR, CAR, LISTP, LITATOM,
EQUAL, EVAL$, PLUS, and FIX, to:
T.
Case 2.6.
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP (CDR X))
(LISTP (CDDR X))
(NOT (LISTP (APPEND (CDR X) Y))))
(EQUAL (EVAL$ T (LIST 'FIX (CAR X)) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T
(LIST 'PLUS
(CAR X)
(PLUS-TREE (CDR X)))
A)))).
However this again simplifies, rewriting with NUMBERP-EVAL$-PLUS-TREE,
PLUS-EQUAL-0, REWRITE-EVAL$, CAR-CONS, CDR-CONS, and COMMUTATIVITY-OF-PLUS,
and expanding PLUS-TREE, CDR, CAR, LISTP, LITATOM, EQUAL, EVAL$, FIX, and
PLUS, to:
T.
Case 2.5.
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP (CDR X))
(LISTP (CDDR X))
(LISTP (APPEND (CDR X) Y))
(LISTP (CDR (APPEND (CDR X) Y))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR X)
(PLUS-TREE (APPEND (CDR X) Y)))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T
(LIST 'PLUS
(CAR X)
(PLUS-TREE (CDR X)))
A)))).
However this again simplifies, rewriting with the lemmas REWRITE-EVAL$,
CAR-CONS, CDR-CONS, and COMMUTATIVITY2-OF-PLUS, to:
T.
Case 2.4.
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP (CDR X))
(LISTP (CDDR X))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y)))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR X)
(CAR (APPEND (CDR X) Y)))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T
(LIST 'PLUS
(CAR X)
(PLUS-TREE (CDR X)))
A)))),
which again simplifies, rewriting with REWRITE-EVAL$, CAR-CONS, CDR-CONS,
PLUS-RIGHT-ID2, COMMUTATIVITY-OF-PLUS, and COMMUTATIVITY2-OF-PLUS, and
expanding the definitions of PLUS-TREE, FIX, EQUAL, and PLUS, to:
T.
Case 2.3.
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NOT (LISTP (APPEND (CDR X) Y))))
(EQUAL (EVAL$ T (LIST 'FIX (CAR X)) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T
(LIST 'PLUS (CAR X) (CADR X))
A)))).
This again simplifies, rewriting with NUMBERP-EVAL$-PLUS-TREE,
PLUS-EQUAL-0, REWRITE-EVAL$, CAR-CONS, and CDR-CONS, and opening up
PLUS-TREE, CDR, CAR, LISTP, LITATOM, EQUAL, EVAL$, and FIX, to the
following two new goals:
Case 2.3.2.
(IMPLIES (AND (LISTP X)
(EQUAL 0 (EVAL$ T (PLUS-TREE Y) A))
(EQUAL 0
(EVAL$ T (PLUS-TREE (CDR X)) A))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NOT (LISTP (APPEND (CDR X) Y)))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(EQUAL 0
(PLUS 0
(EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A)))).
However this again simplifies, expanding PLUS and EQUAL, to:
(IMPLIES (AND (LISTP X)
(EQUAL 0 (EVAL$ T (PLUS-TREE Y) A))
(EQUAL 0
(EVAL$ T (PLUS-TREE (CDR X)) A))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NOT (LISTP (APPEND (CDR X) Y)))
(NOT (NUMBERP (EVAL$ T (CAR X) A)))
(NUMBERP (EVAL$ T (CADR X) A)))
(EQUAL 0 (EVAL$ T (CADR X) A))).
However this further simplifies, appealing to the lemmas REWRITE-EVAL$
and CAR-CONS, and expanding the functions PLUS-TREE and FIX, to:
T.
Case 2.3.1.
(IMPLIES (AND (LISTP X)
(EQUAL 0 (EVAL$ T (PLUS-TREE Y) A))
(EQUAL 0
(EVAL$ T (PLUS-TREE (CDR X)) A))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NOT (LISTP (APPEND (CDR X) Y)))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (EVAL$ T (CAR X) A)
(PLUS 0
(EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A)))),
which again simplifies, unfolding EQUAL and PLUS, to:
(IMPLIES (AND (LISTP X)
(EQUAL 0 (EVAL$ T (PLUS-TREE Y) A))
(EQUAL 0
(EVAL$ T (PLUS-TREE (CDR X)) A))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(NOT (LISTP (APPEND (CDR X) Y)))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (EVAL$ T (CAR X) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A)))).
However this further simplifies, applying REWRITE-EVAL$, CAR-CONS,
COMMUTATIVITY-OF-PLUS, and PLUS-RIGHT-ID2, and unfolding the functions
PLUS-TREE, FIX, EQUAL, and PLUS, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(LISTP (APPEND (CDR X) Y))
(LISTP (CDR (APPEND (CDR X) Y))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR X)
(PLUS-TREE (APPEND (CDR X) Y)))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T
(LIST 'PLUS (CAR X) (CADR X))
A)))).
But this again simplifies, applying the lemmas REWRITE-EVAL$, CAR-CONS,
CDR-CONS, COMMUTATIVITY2-OF-PLUS, and PLUS-CANCELLATION, to:
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(LISTP (APPEND (CDR X) Y))
(LISTP (CDR (APPEND (CDR X) Y))))
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CADR X) A)))).
This further simplifies, rewriting with REWRITE-EVAL$, CAR-CONS,
NUMBERP-EVAL$-PLUS-TREE, COMMUTATIVITY-OF-PLUS, and PLUS-RIGHT-ID2, and
expanding PLUS-TREE, FIX, EQUAL, and PLUS, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T
(PLUS-TREE (APPEND (CDR X) Y))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y)))))
(EQUAL (EVAL$ T
(LIST 'PLUS
(CAR X)
(CAR (APPEND (CDR X) Y)))
A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T
(LIST 'PLUS (CAR X) (CADR X))
A)))).
But this again simplifies, rewriting with the lemmas REWRITE-EVAL$,
CAR-CONS, CDR-CONS, PLUS-RIGHT-ID2, COMMUTATIVITY2-OF-PLUS, and
PLUS-CANCELLATION, and expanding PLUS-TREE and FIX, to three new formulas:
Case 2.1.3.
(IMPLIES (AND (LISTP X)
(NOT (NUMBERP (EVAL$ T (CAR (APPEND (CDR X) Y)) A)))
(EQUAL 0
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y))))
(NOT (NUMBERP (EVAL$ T (CAR X) A))))
(EQUAL 0
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CADR X) A)))),
which again simplifies, applying NUMBERP-EVAL$-PLUS-TREE and
PLUS-EQUAL-0, and unfolding the functions EQUAL and PLUS, to:
(IMPLIES (AND (LISTP X)
(NOT (NUMBERP (EVAL$ T (CAR (APPEND (CDR X) Y)) A)))
(EQUAL 0 (EVAL$ T (PLUS-TREE Y) A))
(EQUAL 0
(EVAL$ T (PLUS-TREE (CDR X)) A))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y))))
(NOT (NUMBERP (EVAL$ T (CAR X) A)))
(NUMBERP (EVAL$ T (CADR X) A)))
(EQUAL 0 (EVAL$ T (CADR X) A))),
which further simplifies, applying the lemmas REWRITE-EVAL$ and CAR-CONS,
and opening up the definitions of PLUS-TREE and FIX, to:
T.
Case 2.1.2.
(IMPLIES (AND (LISTP X)
(NOT (NUMBERP (EVAL$ T (CAR (APPEND (CDR X) Y)) A)))
(EQUAL 0
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y))))
(NUMBERP (EVAL$ T (CAR X) A)))
(EQUAL (EVAL$ T (CAR X) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CADR X) A)))),
which again simplifies, applying the lemmas NUMBERP-EVAL$-PLUS-TREE and
PLUS-EQUAL-0, and expanding EQUAL and PLUS, to two new conjectures:
Case 2.1.2.2.
(IMPLIES
(AND (LISTP X)
(NOT (NUMBERP (EVAL$ T (CAR (APPEND (CDR X) Y)) A)))
(EQUAL 0 (EVAL$ T (PLUS-TREE Y) A))
(EQUAL 0
(EVAL$ T (PLUS-TREE (CDR X)) A))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y))))
(NUMBERP (EVAL$ T (CAR X) A))
(NOT (NUMBERP (EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T (CAR X) A)
(PLUS (EVAL$ T (CAR X) A) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.2.1.
(IMPLIES
(AND (LISTP X)
(NOT (NUMBERP (EVAL$ T (CAR (APPEND (CDR X) Y)) A)))
(EQUAL 0 (EVAL$ T (PLUS-TREE Y) A))
(EQUAL 0
(EVAL$ T (PLUS-TREE (CDR X)) A))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y))))
(NUMBERP (EVAL$ T (CAR X) A))
(NUMBERP (EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T (CAR X) A)
(PLUS (EVAL$ T (CAR X) A)
(EVAL$ T (CADR X) A)))),
which further simplifies, appealing to the lemmas REWRITE-EVAL$,
CAR-CONS, and COMMUTATIVITY-OF-PLUS, and expanding PLUS-TREE, FIX,
NUMBERP, EQUAL, and PLUS, to:
T.
Case 2.1.1.
(IMPLIES (AND (LISTP X)
(NUMBERP (EVAL$ T (CAR (APPEND (CDR X) Y)) A))
(EQUAL (EVAL$ T (CAR (APPEND (CDR X) Y)) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y)))))
(EQUAL (EVAL$ T (CAR (APPEND (CDR X) Y)) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CADR X) A)))),
which again simplifies, clearly, to:
(IMPLIES (AND (LISTP X)
(EQUAL (EVAL$ T (CAR (APPEND (CDR X) Y)) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (PLUS-TREE (CDR X)) A)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(LISTP (APPEND (CDR X) Y))
(NOT (LISTP (CDR (APPEND (CDR X) Y)))))
(EQUAL (EVAL$ T (CAR (APPEND (CDR X) Y)) A)
(PLUS (EVAL$ T (PLUS-TREE Y) A)
(EVAL$ T (CADR X) A)))),
which further simplifies, appealing to the lemmas REWRITE-EVAL$,
CAR-CONS, NUMBERP-EVAL$-PLUS-TREE, COMMUTATIVITY-OF-PLUS, and
PLUS-RIGHT-ID2, and unfolding the definitions of PLUS-TREE, FIX, EQUAL,
and PLUS, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (EVAL$ T (PLUS-TREE (APPEND X Y)) A)
(PLUS (EVAL$ T (PLUS-TREE X) A)
(EVAL$ T (PLUS-TREE Y) A)))),
which simplifies, rewriting with NUMBERP-EVAL$-PLUS-TREE, and unfolding the
functions APPEND, PLUS-TREE, CDR, CAR, LISTP, LITATOM, EQUAL, EVAL$, and
PLUS, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.4 0.0 ]
EVAL$-PLUS-TREE-APPEND
(PROVE-LEMMA PLUS-TREE-PLUS-FRINGE
(REWRITE)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE X))
A)
(FIX (EVAL$ T X A)))
((INDUCT (PLUS-FRINGE X))))
This formula can be simplified, using the abbreviations NOT, OR, and AND, to
the following two new conjectures:
Case 2. (IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'PLUS)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADDR X)))
A)
(FIX (EVAL$ T (CADDR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR X)))
A)
(FIX (EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE X))
A)
(FIX (EVAL$ T X A)))).
This simplifies, rewriting with EVAL$-PLUS-TREE-APPEND, NUMBERP-EVAL$-PLUS,
and COMMUTATIVITY-OF-PLUS, and unfolding the definitions of FIX, EQUAL,
PLUS-FRINGE, and PLUS, to four new goals:
Case 2.4.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'PLUS)
(NOT (NUMBERP (EVAL$ T (CADDR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADDR X)))
A)
0)
(NOT (NUMBERP (EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR X)))
A)
0))
(EQUAL 0 (EVAL$ T X A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS D W) to eliminate (CDR V) and (CAR V), and
W by (CONS V C) to eliminate (CAR W) and (CDR W). This produces the
following three new goals:
Case 2.4.3.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'PLUS)
(NOT (NUMBERP (EVAL$ T (CADR V) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR V)))
A)
0)
(NOT (NUMBERP (EVAL$ T (CAR V) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CAR V)))
A)
0))
(EQUAL 0 (EVAL$ T (CONS Z V) A))).
However this further simplifies, rewriting with the lemma CDR-NLISTP,
and opening up CAR, LISTP, LITATOM, EQUAL, EVAL$, and NUMBERP, to:
T.
Case 2.4.2.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL Z 'PLUS)
(NOT (NUMBERP (EVAL$ T (CAR W) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CAR W)))
A)
0)
(NOT (NUMBERP (EVAL$ T D A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE D))
A)
0))
(EQUAL 0
(EVAL$ T (CONS Z (CONS D W)) A))),
which further simplifies, applying CAR-NLISTP, and expanding the
definitions of LISTP, LITATOM, EQUAL, EVAL$, and NUMBERP, to:
T.
Case 2.4.1.
(IMPLIES (AND (EQUAL Z 'PLUS)
(NOT (NUMBERP (EVAL$ T V A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE V))
A)
0)
(NOT (NUMBERP (EVAL$ T D A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE D))
A)
0))
(EQUAL 0
(EVAL$ T
(CONS Z (CONS D (CONS V C)))
A))).
This further simplifies, appealing to the lemmas REWRITE-EVAL$, CAR-CONS,
CDR-CONS, and PLUS-RIGHT-ID2, and expanding the definition of EQUAL, to:
T.
Case 2.3.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'PLUS)
(NOT (NUMBERP (EVAL$ T (CADDR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADDR X)))
A)
0)
(NUMBERP (EVAL$ T (CADR X) A))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR X)))
A)
(EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T (CADR X) A)
(EVAL$ T X A))),
which again simplifies, appealing to the lemma NUMBERP-EVAL$-BRIDGE, to:
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'PLUS)
(NOT (NUMBERP (EVAL$ T (CADDR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADDR X)))
A)
0)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR X)))
A)
(EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T (CADR X) A)
(EVAL$ T X A))).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS Z V) to
eliminate (CAR X) and (CDR X), V by (CONS D W) to eliminate (CDR V) and
(CAR V), and W by (CONS V C) to eliminate (CAR W) and (CDR W). This
generates three new formulas:
Case 2.3.3.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'PLUS)
(NOT (NUMBERP (EVAL$ T (CADR V) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR V)))
A)
0)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CAR V)))
A)
(EVAL$ T (CAR V) A)))
(EQUAL (EVAL$ T (CAR V) A)
(EVAL$ T (CONS Z V) A))),
which further simplifies, rewriting with the lemma CDR-NLISTP, and
unfolding CAR, LISTP, LITATOM, EQUAL, EVAL$, and NUMBERP, to:
T.
Case 2.3.2.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL Z 'PLUS)
(NOT (NUMBERP (EVAL$ T (CAR W) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CAR W)))
A)
0)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE D))
A)
(EVAL$ T D A)))
(EQUAL (EVAL$ T D A)
(EVAL$ T (CONS Z (CONS D W)) A))),
which further simplifies, rewriting with the lemma CAR-NLISTP, and
opening up the functions LISTP, LITATOM, EQUAL, EVAL$, and NUMBERP, to:
T.
Case 2.3.1.
(IMPLIES (AND (EQUAL Z 'PLUS)
(NOT (NUMBERP (EVAL$ T V A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE V))
A)
0)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE D))
A)
(EVAL$ T D A)))
(EQUAL (EVAL$ T D A)
(EVAL$ T
(CONS Z (CONS D (CONS V C)))
A))),
which further simplifies, rewriting with the lemmas REWRITE-EVAL$,
CAR-CONS, CDR-CONS, NUMBERP-EVAL$-BRIDGE, and PLUS-RIGHT-ID2, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'PLUS)
(NUMBERP (EVAL$ T (CADDR X) A))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADDR X)))
A)
(EVAL$ T (CADDR X) A))
(NOT (NUMBERP (EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR X)))
A)
0))
(EQUAL (EVAL$ T (CADDR X) A)
(EVAL$ T X A))),
which again simplifies, rewriting with NUMBERP-EVAL$-BRIDGE, to:
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'PLUS)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADDR X)))
A)
(EVAL$ T (CADDR X) A))
(NOT (NUMBERP (EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR X)))
A)
0))
(EQUAL (EVAL$ T (CADDR X) A)
(EVAL$ T X A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS D W) to eliminate (CDR V) and (CAR V), and
W by (CONS V C) to eliminate (CAR W) and (CDR W). We thus obtain the
following three new formulas:
Case 2.2.3.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'PLUS)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR V)))
A)
(EVAL$ T (CADR V) A))
(NOT (NUMBERP (EVAL$ T (CAR V) A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CAR V)))
A)
0))
(EQUAL (EVAL$ T (CADR V) A)
(EVAL$ T (CONS Z V) A))).
However this further simplifies, rewriting with CDR-NLISTP,
REWRITE-EVAL$, and CAR-NLISTP, and expanding CAR, PLUS-FRINGE, PLUS-TREE,
LISTP, LITATOM, EQUAL, EVAL$, FIX, and NUMBERP, to:
T.
Case 2.2.2.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL Z 'PLUS)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CAR W)))
A)
(EVAL$ T (CAR W) A))
(NOT (NUMBERP (EVAL$ T D A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE D))
A)
0))
(EQUAL (EVAL$ T (CAR W) A)
(EVAL$ T (CONS Z (CONS D W)) A))).
This further simplifies, applying CAR-NLISTP, REWRITE-EVAL$, CAR-CONS,
CDR-CONS, PLUS-RIGHT-ID2, and COMMUTATIVITY-OF-PLUS, and expanding the
functions PLUS-FRINGE, PLUS-TREE, CAR, LISTP, LITATOM, EQUAL, EVAL$, FIX,
and NUMBERP, to:
T.
Case 2.2.1.
(IMPLIES (AND (EQUAL Z 'PLUS)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE V))
A)
(EVAL$ T V A))
(NOT (NUMBERP (EVAL$ T D A)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE D))
A)
0))
(EQUAL (EVAL$ T V A)
(EVAL$ T
(CONS Z (CONS D (CONS V C)))
A))).
But this further simplifies, applying REWRITE-EVAL$, CAR-CONS, CDR-CONS,
and NUMBERP-EVAL$-BRIDGE, and unfolding PLUS, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'PLUS)
(NUMBERP (EVAL$ T (CADDR X) A))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADDR X)))
A)
(EVAL$ T (CADDR X) A))
(NUMBERP (EVAL$ T (CADR X) A))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR X)))
A)
(EVAL$ T (CADR X) A)))
(EQUAL (PLUS (EVAL$ T (CADR X) A)
(EVAL$ T (CADDR X) A))
(EVAL$ T X A))).
But this again simplifies, rewriting with NUMBERP-EVAL$-BRIDGE, to:
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'PLUS)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADDR X)))
A)
(EVAL$ T (CADDR X) A))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR X)))
A)
(EVAL$ T (CADR X) A)))
(EQUAL (PLUS (EVAL$ T (CADR X) A)
(EVAL$ T (CADDR X) A))
(EVAL$ T X A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS D W) to eliminate (CDR V) and (CAR V), and
W by (CONS V C) to eliminate (CAR W) and (CDR W). We would thus like to
prove the following three new conjectures:
Case 2.1.3.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'PLUS)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CADR V)))
A)
(EVAL$ T (CADR V) A))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CAR V)))
A)
(EVAL$ T (CAR V) A)))
(EQUAL (PLUS (EVAL$ T (CAR V) A)
(EVAL$ T (CADR V) A))
(EVAL$ T (CONS Z V) A))).
But this further simplifies, applying CDR-NLISTP, REWRITE-EVAL$, and
CAR-NLISTP, and opening up CAR, PLUS-FRINGE, PLUS-TREE, LISTP, LITATOM,
EQUAL, EVAL$, FIX, and PLUS, to:
T.
Case 2.1.2.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL Z 'PLUS)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE (CAR W)))
A)
(EVAL$ T (CAR W) A))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE D))
A)
(EVAL$ T D A)))
(EQUAL (PLUS (EVAL$ T D A)
(EVAL$ T (CAR W) A))
(EVAL$ T (CONS Z (CONS D W)) A))).
However this further simplifies, rewriting with CAR-NLISTP,
REWRITE-EVAL$, NUMBERP-EVAL$-BRIDGE, COMMUTATIVITY-OF-PLUS, CAR-CONS,
and CDR-CONS, and opening up the definitions of PLUS-FRINGE, PLUS-TREE,
CAR, LISTP, LITATOM, EQUAL, EVAL$, FIX, and PLUS, to:
T.
Case 2.1.1.
(IMPLIES (AND (EQUAL Z 'PLUS)
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE V))
A)
(EVAL$ T V A))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE D))
A)
(EVAL$ T D A)))
(EQUAL (PLUS (EVAL$ T D A) (EVAL$ T V A))
(EVAL$ T
(CONS Z (CONS D (CONS V C)))
A))).
However this further simplifies, applying the lemmas REWRITE-EVAL$,
CAR-CONS, and CDR-CONS, to:
T.
Case 1. (IMPLIES (NOT (AND (LISTP X)
(EQUAL (CAR X) 'PLUS)))
(EQUAL (EVAL$ T
(PLUS-TREE (PLUS-FRINGE X))
A)
(FIX (EVAL$ T X A)))),
which simplifies, applying CAR-CONS, CDR-CONS, and REWRITE-EVAL$, and
unfolding the functions AND, PLUS-FRINGE, LISTP, PLUS-TREE, EQUAL, EVAL$,
and FIX, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
PLUS-TREE-PLUS-FRINGE
(PROVE-LEMMA MEMBER-IMPLIES-NUMBERP
(REWRITE)
(IMPLIES (AND (MEMBER C (PLUS-FRINGE X))
(NUMBERP (EVAL$ T C A)))
(NUMBERP (EVAL$ T X A)))
((INDUCT (PLUS-FRINGE X))))
WARNING: Note that MEMBER-IMPLIES-NUMBERP contains the free variable C which
will be chosen by instantiating the hypothesis (MEMBER C (PLUS-FRINGE X)).
This formula can be simplified, using the abbreviations IMPLIES, NOT, OR, and
AND, to the following two new formulas:
Case 2. (IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'PLUS)
(IMPLIES (AND (MEMBER C (PLUS-FRINGE (CADDR X)))
(NUMBERP (EVAL$ T C A)))
(NUMBERP (EVAL$ T (CADDR X) A)))
(IMPLIES (AND (MEMBER C (PLUS-FRINGE (CADR X)))
(NUMBERP (EVAL$ T C A)))
(NUMBERP (EVAL$ T (CADR X) A)))
(MEMBER C (PLUS-FRINGE X))
(NUMBERP (EVAL$ T C A)))
(NUMBERP (EVAL$ T X A))).
This simplifies, applying NUMBERP-EVAL$-PLUS, and unfolding the definitions
of AND, IMPLIES, EQUAL, and PLUS-FRINGE, to:
T.
Case 1. (IMPLIES (AND (NOT (AND (LISTP X)
(EQUAL (CAR X) 'PLUS)))
(MEMBER C (PLUS-FRINGE X))
(NUMBERP (EVAL$ T C A)))
(NUMBERP (EVAL$ T X A))),
which simplifies, rewriting with CDR-CONS and CAR-CONS, and opening up the
definitions of AND, PLUS-FRINGE, MEMBER, LISTP, EQUAL, and EVAL$, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
MEMBER-IMPLIES-NUMBERP
(PROVE-LEMMA CADR-EVAL$-LIST
(REWRITE)
(AND (EQUAL (CAR (EVAL$ 'LIST X A))
(EVAL$ T (CAR X) A))
(EQUAL (CDR (EVAL$ 'LIST X A))
(IF (LISTP X)
(EVAL$ 'LIST (CDR X) A)
0))))
WARNING: Note that the proposed lemma CADR-EVAL$-LIST is to be stored as zero
type prescription rules, zero compound recognizer rules, zero linear rules,
and two replacement rules.
This formula can be simplified, using the abbreviation AND, to the following
two new conjectures:
Case 2. (EQUAL (CAR (EVAL$ 'LIST X A))
(EVAL$ T (CAR X) A)).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS Z V) to
eliminate (CAR X) and (CDR X). We must thus prove two new goals:
Case 2.2.
(IMPLIES (NOT (LISTP X))
(EQUAL (CAR (EVAL$ 'LIST X A))
(EVAL$ T (CAR X) A))),
which simplifies, rewriting with CAR-NLISTP, and unfolding the functions
EQUAL, EVAL$, CAR, LISTP, and LITATOM, to:
T.
Case 2.1.
(EQUAL (CAR (EVAL$ 'LIST (CONS Z V) A))
(EVAL$ T Z A)).
However this simplifies, applying CDR-CONS and CAR-CONS, and unfolding the
definitions of EQUAL and EVAL$, to:
T.
Case 1. (EQUAL (CDR (EVAL$ 'LIST X A))
(IF (LISTP X)
(EVAL$ 'LIST (CDR X) A)
0)).
This simplifies, trivially, to the following two new conjectures:
Case 1.2.
(IMPLIES (NOT (LISTP X))
(EQUAL (CDR (EVAL$ 'LIST X A)) 0)).
However this again simplifies, unfolding the functions EQUAL, EVAL$, and
CDR, to:
T.
Case 1.1.
(IMPLIES (LISTP X)
(EQUAL (CDR (EVAL$ 'LIST X A))
(EVAL$ 'LIST (CDR X) A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS V Z) to eliminate
(CDR X) and (CAR X). We would thus like to prove:
(EQUAL (CDR (EVAL$ 'LIST (CONS V Z) A))
(EVAL$ 'LIST Z A)),
which further simplifies, appealing to the lemmas CDR-CONS and CAR-CONS,
and expanding EQUAL and EVAL$, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
CADR-EVAL$-LIST
(PROVE-LEMMA EVAL$-QUOTE
(REWRITE)
(EQUAL (EVAL$ T (CONS 'QUOTE ARGS) A)
(CAR ARGS)))
This conjecture simplifies, rewriting with CDR-CONS and CAR-CONS, and
unfolding EQUAL and EVAL$, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EVAL$-QUOTE
(PROVE-LEMMA LISTP-EVAL$
(REWRITE)
(EQUAL (LISTP (EVAL$ 'LIST X A))
(LISTP X)))
Name the conjecture *1.
We will appeal to induction. There is only one plausible induction. We
will induct according to the following scheme:
(AND (IMPLIES (AND (EQUAL 'LIST 'LIST) (NLISTP X))
(p X A))
(IMPLIES (AND (EQUAL 'LIST 'LIST)
(NOT (NLISTP X))
(p (CDR X) A)
(p (CAR X) A))
(p X A))
(IMPLIES (AND (NOT (EQUAL 'LIST 'LIST))
(LITATOM X))
(p X A))
(IMPLIES (AND (NOT (EQUAL 'LIST 'LIST))
(NOT (LITATOM X))
(NLISTP X))
(p X A))
(IMPLIES (AND (NOT (EQUAL 'LIST 'LIST))
(NOT (LITATOM X))
(NOT (NLISTP X))
(EQUAL (CAR X) 'QUOTE))
(p X A))
(IMPLIES (AND (NOT (EQUAL 'LIST 'LIST))
(NOT (LITATOM X))
(NOT (NLISTP X))
(NOT (EQUAL (CAR X) 'QUOTE))
(p (CDR X) A))
(p X A))).
Linear arithmetic, the lemmas CDR-LESSEQP, CDR-LESSP, CAR-LESSEQP, and
CAR-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 six new
formulas:
Case 6. (IMPLIES (AND (EQUAL 'LIST 'LIST) (NLISTP X))
(EQUAL (LISTP (EVAL$ 'LIST X A))
(LISTP X))).
This simplifies, expanding the definitions of EQUAL, NLISTP, EVAL$, and
LISTP, to:
T.
Case 5. (IMPLIES (AND (EQUAL 'LIST 'LIST)
(NOT (NLISTP X))
(EQUAL (LISTP (EVAL$ 'LIST (CDR X) A))
(LISTP (CDR X)))
(EQUAL (LISTP (EVAL$ 'LIST (CAR X) A))
(LISTP (CAR X))))
(EQUAL (LISTP (EVAL$ 'LIST X A))
(LISTP X))).
This simplifies, expanding the definitions of EQUAL, NLISTP, and EVAL$, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL 'LIST 'LIST))
(LITATOM X))
(EQUAL (LISTP (EVAL$ 'LIST X A))
(LISTP X))).
This simplifies, trivially, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL 'LIST 'LIST))
(NOT (LITATOM X))
(NLISTP X))
(EQUAL (LISTP (EVAL$ 'LIST X A))
(LISTP X))).
This simplifies, trivially, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL 'LIST 'LIST))
(NOT (LITATOM X))
(NOT (NLISTP X))
(EQUAL (CAR X) 'QUOTE))
(EQUAL (LISTP (EVAL$ 'LIST X A))
(LISTP X))).
This simplifies, obviously, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL 'LIST 'LIST))
(NOT (LITATOM X))
(NOT (NLISTP X))
(NOT (EQUAL (CAR X) 'QUOTE))
(EQUAL (LISTP (EVAL$ 'LIST (CDR X) A))
(LISTP (CDR X))))
(EQUAL (LISTP (EVAL$ 'LIST X A))
(LISTP X))).
This simplifies, obviously, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LISTP-EVAL$
(PROVE-LEMMA CORRECTNESS-OF-CANCEL
((META EQUAL))
(EQUAL (EVAL$ T X A)
(EVAL$ T (CANCEL X) A))
((DISABLE EVAL$)))
This formula simplifies, opening up the function CANCEL, to the following five
new goals:
Case 5. (IMPLIES
(AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (EQUAL (CAADR X) 'PLUS))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X))))
(EQUAL
(EVAL$ T X A)
(EVAL$ T
(LIST 'IF
(LIST 'NUMBERP (CADR X))
(LIST 'EQUAL
''0
(PLUS-TREE (DELETE (CADR X)
(PLUS-FRINGE (CADDR X)))))
(LIST 'QUOTE F))
A))).
However this again simplifies, rewriting with REWRITE-EVAL$, CAR-CONS,
CDR-CONS, EVAL$-QUOTE, MEMBER-IMPLIES-NUMBERP, PLUS-TREE-PLUS-FRINGE,
PLUS-TREE-DELETE, and EQUAL-DIFFERENCE-0, and opening up CAR, to the
following three new formulas:
Case 5.3.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (EQUAL (CAADR X) 'PLUS))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X)))
(LESSP (EVAL$ T (CADR X) A)
(EVAL$ T (CADDR X) A)))
(EQUAL (EVAL$ T X A) F)).
This again simplifies, clearly, to the new goal:
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (EQUAL (CAADR X) 'PLUS))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X)))
(LESSP (EVAL$ T (CADR X) A)
(EVAL$ T (CADDR X) A)))
(NOT (EVAL$ T X A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and (CDR V), W
by (CONS V C) to eliminate (CAR W) and (CDR W), D by (CONS W X1) to
eliminate (CAR D) and (CDR D), W by (CONS D Z1) to eliminate (CAR W) and
(CDR W), D by (CONS V C) to eliminate (CAR D) and (CDR D), and V by
(CONS D X1) to eliminate (CAR V) and (CDR V). We would thus like to prove
the following five new goals:
Case 5.3.5.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(NOT (EQUAL (CAAR V) 'PLUS))
(LISTP (CADR V))
(EQUAL (CAADR V) 'PLUS)
(MEMBER (CAR V)
(PLUS-FRINGE (CADR V)))
(LESSP (EVAL$ T (CAR V) A)
(EVAL$ T (CADR V) A)))
(NOT (EVAL$ T (CONS Z V) A))).
This further simplifies, rewriting with CAR-NLISTP and CDR-NLISTP, and
opening up the functions CAR, EQUAL, and LISTP, to:
T.
Case 5.3.4.
(IMPLIES (AND (NOT (LISTP D))
(NOT (LISTP W))
(EQUAL Z 'EQUAL)
(NOT (EQUAL (CAR W) 'PLUS))
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(MEMBER W (PLUS-FRINGE (CAR D)))
(LESSP (EVAL$ T W A)
(EVAL$ T (CAR D) A)))
(NOT (EVAL$ T (CONS Z (CONS W D)) A))).
But this further simplifies, appealing to the lemma CAR-NLISTP, and
opening up the functions EQUAL and LISTP, to:
T.
Case 5.3.3.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL Z 'EQUAL)
(NOT (EQUAL (CAR W) 'PLUS))
(EQUAL D 'PLUS)
(MEMBER W (PLUS-FRINGE (CONS D X1)))
(LESSP (EVAL$ T W A)
(EVAL$ T (CONS D X1) A)))
(NOT (EVAL$ T
(CONS Z (CONS W (CONS (CONS D X1) C)))
A))),
which further simplifies, appealing to the lemmas CAR-NLISTP,
REWRITE-EVAL$, CAR-CONS, and CDR-CONS, and expanding EQUAL, to the goal:
(IMPLIES (AND (NOT (LISTP W))
(MEMBER W
(PLUS-FRINGE (CONS 'PLUS X1)))
(LESSP (EVAL$ T W A)
(PLUS (EVAL$ T (CAR X1) A)
(EVAL$ T (CADR X1) A))))
(NOT (EQUAL (EVAL$ T W A)
(PLUS (EVAL$ T (CAR X1) A)
(EVAL$ T (CADR X1) A))))).
However this finally simplifies, using linear arithmetic, to:
T.
Case 5.3.2.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(NOT (EQUAL V 'PLUS))
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(MEMBER (CONS V C)
(PLUS-FRINGE (CAR D)))
(LESSP (EVAL$ T (CONS V C) A)
(EVAL$ T (CAR D) A)))
(NOT (EVAL$ T
(CONS Z (CONS (CONS V C) D))
A))),
which further simplifies, applying CAR-NLISTP, and opening up the
definition of LISTP, to:
T.
Case 5.3.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(NOT (EQUAL V 'PLUS))
(EQUAL D 'PLUS)
(MEMBER (CONS V C)
(PLUS-FRINGE (CONS D Z1)))
(LESSP (EVAL$ T (CONS V C) A)
(EVAL$ T (CONS D Z1) A)))
(NOT (EVAL$ T
(CONS Z
(CONS (CONS V C)
(CONS (CONS D Z1) X1)))
A))).
However this further simplifies, applying REWRITE-EVAL$, CAR-CONS, and
CDR-CONS, to:
(IMPLIES (AND (NOT (EQUAL V 'PLUS))
(MEMBER (CONS V C)
(PLUS-FRINGE (CONS 'PLUS Z1)))
(LESSP (EVAL$ T (CONS V C) A)
(PLUS (EVAL$ T (CAR Z1) A)
(EVAL$ T (CADR Z1) A))))
(NOT (EQUAL (EVAL$ T (CONS V C) A)
(PLUS (EVAL$ T (CAR Z1) A)
(EVAL$ T (CADR Z1) A))))),
which finally simplifies, using linear arithmetic, to:
T.
Case 5.2.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (EQUAL (CAADR X) 'PLUS))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X)))
(NOT (NUMBERP (EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T X A) F)),
which again simplifies, trivially, to:
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (EQUAL (CAADR X) 'PLUS))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X)))
(NOT (NUMBERP (EVAL$ T (CADR X) A))))
(NOT (EVAL$ T X A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and (CDR V), W
by (CONS V C) to eliminate (CAR W) and (CDR W), D by (CONS W X1) to
eliminate (CAR D) and (CDR D), W by (CONS D Z1) to eliminate (CAR W) and
(CDR W), D by (CONS V C) to eliminate (CAR D) and (CDR D), and V by
(CONS D X1) to eliminate (CAR V) and (CDR V). We thus obtain the
following five new conjectures:
Case 5.2.5.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(NOT (EQUAL (CAAR V) 'PLUS))
(LISTP (CADR V))
(EQUAL (CAADR V) 'PLUS)
(MEMBER (CAR V)
(PLUS-FRINGE (CADR V)))
(NOT (NUMBERP (EVAL$ T (CAR V) A))))
(NOT (EVAL$ T (CONS Z V) A))).
But this further simplifies, rewriting with CAR-NLISTP and CDR-NLISTP,
and unfolding the definitions of CAR, EQUAL, and LISTP, to:
T.
Case 5.2.4.
(IMPLIES (AND (NOT (LISTP D))
(NOT (LISTP W))
(EQUAL Z 'EQUAL)
(NOT (EQUAL (CAR W) 'PLUS))
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(MEMBER W (PLUS-FRINGE (CAR D)))
(NOT (NUMBERP (EVAL$ T W A))))
(NOT (EVAL$ T (CONS Z (CONS W D)) A))).
This further simplifies, applying CAR-NLISTP, and unfolding EQUAL and
LISTP, to:
T.
Case 5.2.3.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL Z 'EQUAL)
(NOT (EQUAL (CAR W) 'PLUS))
(EQUAL D 'PLUS)
(MEMBER W (PLUS-FRINGE (CONS D X1)))
(NOT (NUMBERP (EVAL$ T W A))))
(NOT (EVAL$ T
(CONS Z (CONS W (CONS (CONS D X1) C)))
A))).
However this further simplifies, rewriting with the lemmas CAR-NLISTP,
REWRITE-EVAL$, CAR-CONS, and CDR-CONS, and expanding the function EQUAL,
to:
T.
Case 5.2.2.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(NOT (EQUAL V 'PLUS))
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(MEMBER (CONS V C)
(PLUS-FRINGE (CAR D)))
(NOT (NUMBERP (EVAL$ T (CONS V C) A))))
(NOT (EVAL$ T
(CONS Z (CONS (CONS V C) D))
A))),
which further simplifies, applying CAR-NLISTP, and expanding the
function LISTP, to:
T.
Case 5.2.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(NOT (EQUAL V 'PLUS))
(EQUAL D 'PLUS)
(MEMBER (CONS V C)
(PLUS-FRINGE (CONS D Z1)))
(NOT (NUMBERP (EVAL$ T (CONS V C) A))))
(NOT (EVAL$ T
(CONS Z
(CONS (CONS V C)
(CONS (CONS D Z1) X1)))
A))).
However this further simplifies, rewriting with REWRITE-EVAL$, CAR-CONS,
and CDR-CONS, to:
T.
Case 5.1.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (EQUAL (CAADR X) 'PLUS))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X)))
(NUMBERP (EVAL$ T (CADR X) A))
(NOT (LESSP (EVAL$ T (CADR X) A)
(EVAL$ T (CADDR X) A))))
(EQUAL (EVAL$ T X A) T)).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS Z V) to
eliminate (CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and
(CDR V), W by (CONS V C) to eliminate (CAR W) and (CDR W), D by
(CONS W X1) to eliminate (CAR D) and (CDR D), W by (CONS D Z1) to
eliminate (CAR W) and (CDR W), D by (CONS V C) to eliminate (CAR D) and
(CDR D), and V by (CONS D X1) to eliminate (CAR V) and (CDR V). We must
thus prove five new conjectures:
Case 5.1.5.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(NOT (EQUAL (CAAR V) 'PLUS))
(LISTP (CADR V))
(EQUAL (CAADR V) 'PLUS)
(MEMBER (CAR V)
(PLUS-FRINGE (CADR V)))
(NUMBERP (EVAL$ T (CAR V) A))
(NOT (LESSP (EVAL$ T (CAR V) A)
(EVAL$ T (CADR V) A))))
(EQUAL (EVAL$ T (CONS Z V) A) T)),
which further simplifies, applying CAR-NLISTP and CDR-NLISTP, and
unfolding CAR, EQUAL, and LISTP, to:
T.
Case 5.1.4.
(IMPLIES (AND (NOT (LISTP D))
(NOT (LISTP W))
(EQUAL Z 'EQUAL)
(NOT (EQUAL (CAR W) 'PLUS))
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(MEMBER W (PLUS-FRINGE (CAR D)))
(NUMBERP (EVAL$ T W A))
(NOT (LESSP (EVAL$ T W A)
(EVAL$ T (CAR D) A))))
(EQUAL (EVAL$ T (CONS Z (CONS W D)) A)
T)).
But this further simplifies, rewriting with CAR-NLISTP, and opening up
EQUAL and LISTP, to:
T.
Case 5.1.3.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL Z 'EQUAL)
(NOT (EQUAL (CAR W) 'PLUS))
(EQUAL D 'PLUS)
(MEMBER W (PLUS-FRINGE (CONS D X1)))
(NUMBERP (EVAL$ T W A))
(NOT (LESSP (EVAL$ T W A)
(EVAL$ T (CONS D X1) A))))
(EQUAL (EVAL$ T
(CONS Z (CONS W (CONS (CONS D X1) C)))
A)
T)).
This further simplifies, rewriting with the lemmas CAR-NLISTP,
REWRITE-EVAL$, CAR-CONS, and CDR-CONS, and opening up EQUAL, to:
(IMPLIES (AND (NOT (LISTP W))
(MEMBER W
(PLUS-FRINGE (CONS 'PLUS X1)))
(NUMBERP (EVAL$ T W A))
(NOT (LESSP (EVAL$ T W A)
(PLUS (EVAL$ T (CAR X1) A)
(EVAL$ T (CADR X1) A)))))
(EQUAL (EVAL$ T W A)
(PLUS (EVAL$ T (CAR X1) A)
(EVAL$ T (CADR X1) A)))).
But this again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, PLUS-TREE-PLUS-FRINGE, and
REWRITE-EVAL$, to:
T.
Case 5.1.2.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(NOT (EQUAL V 'PLUS))
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(MEMBER (CONS V C)
(PLUS-FRINGE (CAR D)))
(NUMBERP (EVAL$ T (CONS V C) A))
(NOT (LESSP (EVAL$ T (CONS V C) A)
(EVAL$ T (CAR D) A))))
(EQUAL (EVAL$ T
(CONS Z (CONS (CONS V C) D))
A)
T)).
However this further simplifies, using linear arithmetic and rewriting
with MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, PLUS-TREE-PLUS-FRINGE, and
MEMBER-IMPLIES-NUMBERP, to the following two new goals:
Case 5.1.2.2.
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T (CAR D) A)))
(NOT (LISTP D))
(NOT (EQUAL V 'PLUS))
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(MEMBER (CONS V C)
(PLUS-FRINGE (CAR D)))
(NUMBERP (EVAL$ T (CONS V C) A))
(NOT (LESSP (EVAL$ T (CONS V C) A)
(EVAL$ T (CAR D) A))))
(EQUAL (EVAL$ T
(CONS 'EQUAL (CONS (CONS V C) D))
A)
T)).
This again simplifies, applying CAR-NLISTP, and opening up LISTP, to:
T.
Case 5.1.2.1.
(IMPLIES (AND (NUMBERP (EVAL$ T (CAR D) A))
(EQUAL (EVAL$ T (CONS V C) A)
(EVAL$ T (CAR D) A))
(NOT (LISTP D))
(NOT (EQUAL V 'PLUS))
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(MEMBER (CONS V C)
(PLUS-FRINGE (CAR D)))
(NOT (LESSP (EVAL$ T (CAR D) A)
(EVAL$ T (CAR D) A))))
(EQUAL (EVAL$ T
(CONS 'EQUAL (CONS (CONS V C) D))
A)
T)).
But this again simplifies, rewriting with CAR-NLISTP, and unfolding
the function LISTP, to:
T.
Case 5.1.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(NOT (EQUAL V 'PLUS))
(EQUAL D 'PLUS)
(MEMBER (CONS V C)
(PLUS-FRINGE (CONS D Z1)))
(NUMBERP (EVAL$ T (CONS V C) A))
(NOT (LESSP (EVAL$ T (CONS V C) A)
(EVAL$ T (CONS D Z1) A))))
(EQUAL (EVAL$ T
(CONS Z
(CONS (CONS V C)
(CONS (CONS D Z1) X1)))
A)
T)).
This further simplifies, rewriting with the lemmas REWRITE-EVAL$,
CAR-CONS, and CDR-CONS, to:
(IMPLIES (AND (NOT (EQUAL V 'PLUS))
(MEMBER (CONS V C)
(PLUS-FRINGE (CONS 'PLUS Z1)))
(NUMBERP (EVAL$ T (CONS V C) A))
(NOT (LESSP (EVAL$ T (CONS V C) A)
(PLUS (EVAL$ T (CAR Z1) A)
(EVAL$ T (CADR Z1) A)))))
(EQUAL (EVAL$ T (CONS V C) A)
(PLUS (EVAL$ T (CAR Z1) A)
(EVAL$ T (CADR Z1) A)))).
However this again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, PLUS-TREE-PLUS-FRINGE, and
REWRITE-EVAL$, to:
T.
Case 4. (IMPLIES
(AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (LISTP (CADR X)))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X))))
(EQUAL
(EVAL$ T X A)
(EVAL$ T
(LIST 'IF
(LIST 'NUMBERP (CADR X))
(LIST 'EQUAL
''0
(PLUS-TREE (DELETE (CADR X)
(PLUS-FRINGE (CADDR X)))))
(LIST 'QUOTE F))
A))).
But this again simplifies, applying REWRITE-EVAL$, CAR-CONS, CDR-CONS,
EVAL$-QUOTE, MEMBER-IMPLIES-NUMBERP, PLUS-TREE-PLUS-FRINGE, PLUS-TREE-DELETE,
and EQUAL-DIFFERENCE-0, and unfolding CAR, to the following three new goals:
Case 4.3.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (LISTP (CADR X)))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X)))
(LESSP (EVAL$ T (CADR X) A)
(EVAL$ T (CADDR X) A)))
(EQUAL (EVAL$ T X A) F)).
This again simplifies, obviously, to:
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (LISTP (CADR X)))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X)))
(LESSP (EVAL$ T (CADR X) A)
(EVAL$ T (CADDR X) A)))
(NOT (EVAL$ T X A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and (CDR V), D
by (CONS V C) to eliminate (CAR D) and (CDR D), and V by (CONS D X1) to
eliminate (CAR V) and (CDR V). We would thus like to prove the following
three new conjectures:
Case 4.3.3.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(NOT (LISTP (CAR V)))
(LISTP (CADR V))
(EQUAL (CAADR V) 'PLUS)
(MEMBER (CAR V)
(PLUS-FRINGE (CADR V)))
(LESSP (EVAL$ T (CAR V) A)
(EVAL$ T (CADR V) A)))
(NOT (EVAL$ T (CONS Z V) A))).
This further simplifies, applying CAR-NLISTP and CDR-NLISTP, and
expanding the functions LISTP and CAR, to:
T.
Case 4.3.2.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(NOT (LISTP W))
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(MEMBER W (PLUS-FRINGE (CAR D)))
(LESSP (EVAL$ T W A)
(EVAL$ T (CAR D) A)))
(NOT (EVAL$ T (CONS Z (CONS W D)) A))).
This further simplifies, rewriting with CAR-NLISTP, and expanding the
definition of LISTP, to:
T.
Case 4.3.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(NOT (LISTP W))
(EQUAL D 'PLUS)
(MEMBER W (PLUS-FRINGE (CONS D X1)))
(LESSP (EVAL$ T W A)
(EVAL$ T (CONS D X1) A)))
(NOT (EVAL$ T
(CONS Z (CONS W (CONS (CONS D X1) C)))
A))).
This further simplifies, rewriting with REWRITE-EVAL$, CAR-CONS, and
CDR-CONS, to:
(IMPLIES (AND (NOT (LISTP W))
(MEMBER W
(PLUS-FRINGE (CONS 'PLUS X1)))
(LESSP (EVAL$ T W A)
(PLUS (EVAL$ T (CAR X1) A)
(EVAL$ T (CADR X1) A))))
(NOT (EQUAL (EVAL$ T W A)
(PLUS (EVAL$ T (CAR X1) A)
(EVAL$ T (CADR X1) A))))),
which finally simplifies, using linear arithmetic, to:
T.
Case 4.2.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (LISTP (CADR X)))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X)))
(NOT (NUMBERP (EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T X A) F)),
which again simplifies, clearly, to:
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (LISTP (CADR X)))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X)))
(NOT (NUMBERP (EVAL$ T (CADR X) A))))
(NOT (EVAL$ T X A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and (CDR V), D
by (CONS V C) to eliminate (CAR D) and (CDR D), and V by (CONS D X1) to
eliminate (CAR V) and (CDR V). We thus obtain the following three new
formulas:
Case 4.2.3.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(NOT (LISTP (CAR V)))
(LISTP (CADR V))
(EQUAL (CAADR V) 'PLUS)
(MEMBER (CAR V)
(PLUS-FRINGE (CADR V)))
(NOT (NUMBERP (EVAL$ T (CAR V) A))))
(NOT (EVAL$ T (CONS Z V) A))).
However this further simplifies, applying CAR-NLISTP and CDR-NLISTP, and
unfolding the functions LISTP and CAR, to:
T.
Case 4.2.2.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(NOT (LISTP W))
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(MEMBER W (PLUS-FRINGE (CAR D)))
(NOT (NUMBERP (EVAL$ T W A))))
(NOT (EVAL$ T (CONS Z (CONS W D)) A))).
But this further simplifies, rewriting with CAR-NLISTP, and opening up
the function LISTP, to:
T.
Case 4.2.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(NOT (LISTP W))
(EQUAL D 'PLUS)
(MEMBER W (PLUS-FRINGE (CONS D X1)))
(NOT (NUMBERP (EVAL$ T W A))))
(NOT (EVAL$ T
(CONS Z (CONS W (CONS (CONS D X1) C)))
A))).
This further simplifies, appealing to the lemmas REWRITE-EVAL$, CAR-CONS,
and CDR-CONS, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(NOT (LISTP (CADR X)))
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(MEMBER (CADR X)
(PLUS-FRINGE (CADDR X)))
(NUMBERP (EVAL$ T (CADR X) A))
(NOT (LESSP (EVAL$ T (CADR X) A)
(EVAL$ T (CADDR X) A))))
(EQUAL (EVAL$ T X A) T)).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and (CDR V), D
by (CONS V C) to eliminate (CAR D) and (CDR D), and V by (CONS D X1) to
eliminate (CAR V) and (CDR V). This produces the following three new
formulas:
Case 4.1.3.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(NOT (LISTP (CAR V)))
(LISTP (CADR V))
(EQUAL (CAADR V) 'PLUS)
(MEMBER (CAR V)
(PLUS-FRINGE (CADR V)))
(NUMBERP (EVAL$ T (CAR V) A))
(NOT (LESSP (EVAL$ T (CAR V) A)
(EVAL$ T (CADR V) A))))
(EQUAL (EVAL$ T (CONS Z V) A) T)).
This further simplifies, applying CAR-NLISTP and CDR-NLISTP, and opening
up the functions LISTP and CAR, to:
T.
Case 4.1.2.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(NOT (LISTP W))
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(MEMBER W (PLUS-FRINGE (CAR D)))
(NUMBERP (EVAL$ T W A))
(NOT (LESSP (EVAL$ T W A)
(EVAL$ T (CAR D) A))))
(EQUAL (EVAL$ T (CONS Z (CONS W D)) A)
T)).
This further simplifies, rewriting with CAR-NLISTP, and expanding the
function LISTP, to:
T.
Case 4.1.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(NOT (LISTP W))
(EQUAL D 'PLUS)
(MEMBER W (PLUS-FRINGE (CONS D X1)))
(NUMBERP (EVAL$ T W A))
(NOT (LESSP (EVAL$ T W A)
(EVAL$ T (CONS D X1) A))))
(EQUAL (EVAL$ T
(CONS Z (CONS W (CONS (CONS D X1) C)))
A)
T)).
However this further simplifies, applying REWRITE-EVAL$, CAR-CONS, and
CDR-CONS, to:
(IMPLIES (AND (NOT (LISTP W))
(MEMBER W
(PLUS-FRINGE (CONS 'PLUS X1)))
(NUMBERP (EVAL$ T W A))
(NOT (LESSP (EVAL$ T W A)
(PLUS (EVAL$ T (CAR X1) A)
(EVAL$ T (CADR X1) A)))))
(EQUAL (EVAL$ T W A)
(PLUS (EVAL$ T (CAR X1) A)
(EVAL$ T (CADR X1) A)))),
which again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, PLUS-TREE-PLUS-FRINGE, and
REWRITE-EVAL$, to:
T.
Case 3. (IMPLIES
(AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (EQUAL (CAADDR X) 'PLUS))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X))))
(EQUAL
(EVAL$ T X A)
(EVAL$ T
(LIST 'IF
(LIST 'NUMBERP (CADDR X))
(CONS 'EQUAL
(CONS (PLUS-TREE (DELETE (CADDR X)
(PLUS-FRINGE (CADR X))))
'('0)))
(LIST 'QUOTE F))
A))).
However this again simplifies, applying REWRITE-EVAL$, CAR-CONS, CDR-CONS,
MEMBER-IMPLIES-NUMBERP, PLUS-TREE-PLUS-FRINGE, PLUS-TREE-DELETE, EVAL$-QUOTE,
and EQUAL-DIFFERENCE-0, and expanding CAR, to the following three new
conjectures:
Case 3.3.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (EQUAL (CAADDR X) 'PLUS))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(LESSP (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T X A) F)).
This again simplifies, obviously, to:
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (EQUAL (CAADDR X) 'PLUS))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(LESSP (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A)))
(NOT (EVAL$ T X A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and (CDR V), W
by (CONS V C) to eliminate (CAR W) and (CDR W), D by (CONS W X1) to
eliminate (CAR D) and (CDR D), and W by (CONS D Z1) to eliminate (CAR W)
and (CDR W). This produces the following four new goals:
Case 3.3.4.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(LISTP (CAR V))
(EQUAL (CAAR V) 'PLUS)
(NOT (EQUAL (CAADR V) 'PLUS))
(MEMBER (CADR V)
(PLUS-FRINGE (CAR V)))
(LESSP (EVAL$ T (CADR V) A)
(EVAL$ T (CAR V) A)))
(NOT (EVAL$ T (CONS Z V) A))).
However this further simplifies, applying the lemma CAR-NLISTP, and
unfolding the function LISTP, to:
T.
Case 3.3.3.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(NOT (EQUAL (CAAR D) 'PLUS))
(MEMBER (CAR D)
(PLUS-FRINGE (CONS V C)))
(LESSP (EVAL$ T (CAR D) A)
(EVAL$ T (CONS V C) A)))
(NOT (EVAL$ T
(CONS Z (CONS (CONS V C) D))
A))),
which further simplifies, applying the lemmas CAR-NLISTP, REWRITE-EVAL$,
CAR-CONS, and CDR-CONS, and unfolding the definitions of CAR and EQUAL,
to the goal:
(IMPLIES (AND (NOT (LISTP D))
(MEMBER 0
(PLUS-FRINGE (CONS 'PLUS C)))
(LESSP (EVAL$ T 0 A)
(PLUS (EVAL$ T (CAR C) A)
(EVAL$ T (CADR C) A))))
(NOT (EQUAL (PLUS (EVAL$ T (CAR C) A)
(EVAL$ T (CADR C) A))
(EVAL$ T 0 A)))).
But this finally simplifies, using linear arithmetic, to:
T.
Case 3.3.2.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(NOT (EQUAL (CAR W) 'PLUS))
(MEMBER W (PLUS-FRINGE (CONS V C)))
(LESSP (EVAL$ T W A)
(EVAL$ T (CONS V C) A)))
(NOT (EVAL$ T
(CONS Z (CONS (CONS V C) (CONS W X1)))
A))),
which further simplifies, applying CAR-NLISTP, REWRITE-EVAL$, CAR-CONS,
and CDR-CONS, and unfolding the function EQUAL, to the new formula:
(IMPLIES (AND (NOT (LISTP W))
(MEMBER W
(PLUS-FRINGE (CONS 'PLUS C)))
(LESSP (EVAL$ T W A)
(PLUS (EVAL$ T (CAR C) A)
(EVAL$ T (CADR C) A))))
(NOT (EQUAL (PLUS (EVAL$ T (CAR C) A)
(EVAL$ T (CADR C) A))
(EVAL$ T W A)))),
which finally simplifies, using linear arithmetic, to:
T.
Case 3.3.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(NOT (EQUAL D 'PLUS))
(MEMBER (CONS D Z1)
(PLUS-FRINGE (CONS V C)))
(LESSP (EVAL$ T (CONS D Z1) A)
(EVAL$ T (CONS V C) A)))
(NOT (EVAL$ T
(CONS Z
(CONS (CONS V C)
(CONS (CONS D Z1) X1)))
A))),
which further simplifies, applying REWRITE-EVAL$, CAR-CONS, and CDR-CONS,
to the new conjecture:
(IMPLIES (AND (NOT (EQUAL D 'PLUS))
(MEMBER (CONS D Z1)
(PLUS-FRINGE (CONS 'PLUS C)))
(LESSP (EVAL$ T (CONS D Z1) A)
(PLUS (EVAL$ T (CAR C) A)
(EVAL$ T (CADR C) A))))
(NOT (EQUAL (PLUS (EVAL$ T (CAR C) A)
(EVAL$ T (CADR C) A))
(EVAL$ T (CONS D Z1) A)))),
which finally simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (EQUAL (CAADDR X) 'PLUS))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NOT (NUMBERP (EVAL$ T (CADDR X) A))))
(EQUAL (EVAL$ T X A) F)),
which again simplifies, clearly, to:
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (EQUAL (CAADDR X) 'PLUS))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NOT (NUMBERP (EVAL$ T (CADDR X) A))))
(NOT (EVAL$ T X A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and (CDR V), W
by (CONS V C) to eliminate (CAR W) and (CDR W), D by (CONS W X1) to
eliminate (CAR D) and (CDR D), and W by (CONS D Z1) to eliminate (CAR W)
and (CDR W). We thus obtain the following four new goals:
Case 3.2.4.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(LISTP (CAR V))
(EQUAL (CAAR V) 'PLUS)
(NOT (EQUAL (CAADR V) 'PLUS))
(MEMBER (CADR V)
(PLUS-FRINGE (CAR V)))
(NOT (NUMBERP (EVAL$ T (CADR V) A))))
(NOT (EVAL$ T (CONS Z V) A))).
However this further simplifies, applying the lemma CAR-NLISTP, and
opening up LISTP, to:
T.
Case 3.2.3.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(NOT (EQUAL (CAAR D) 'PLUS))
(MEMBER (CAR D)
(PLUS-FRINGE (CONS V C)))
(NOT (NUMBERP (EVAL$ T (CAR D) A))))
(NOT (EVAL$ T
(CONS Z (CONS (CONS V C) D))
A))),
which further simplifies, applying the lemmas CAR-NLISTP, REWRITE-EVAL$,
CAR-CONS, and CDR-CONS, and opening up CAR and EQUAL, to:
T.
Case 3.2.2.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(NOT (EQUAL (CAR W) 'PLUS))
(MEMBER W (PLUS-FRINGE (CONS V C)))
(NOT (NUMBERP (EVAL$ T W A))))
(NOT (EVAL$ T
(CONS Z (CONS (CONS V C) (CONS W X1)))
A))),
which further simplifies, rewriting with the lemmas CAR-NLISTP,
REWRITE-EVAL$, CAR-CONS, and CDR-CONS, and expanding the definition of
EQUAL, to:
T.
Case 3.2.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(NOT (EQUAL D 'PLUS))
(MEMBER (CONS D Z1)
(PLUS-FRINGE (CONS V C)))
(NOT (NUMBERP (EVAL$ T (CONS D Z1) A))))
(NOT (EVAL$ T
(CONS Z
(CONS (CONS V C)
(CONS (CONS D Z1) X1)))
A))),
which further simplifies, applying REWRITE-EVAL$, CAR-CONS, and CDR-CONS,
to:
T.
Case 3.1.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (EQUAL (CAADDR X) 'PLUS))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NUMBERP (EVAL$ T (CADDR X) A))
(NOT (LESSP (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T X A) T)).
However this again simplifies, using linear arithmetic and rewriting with
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, PLUS-TREE-PLUS-FRINGE, and
MEMBER-IMPLIES-NUMBERP, to the following two new conjectures:
Case 3.1.2.
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T (CADR X) A)))
(LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (EQUAL (CAADDR X) 'PLUS))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NUMBERP (EVAL$ T (CADDR X) A))
(NOT (LESSP (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T X A) T)).
However this again simplifies, rewriting with MEMBER-IMPLIES-NUMBERP, to:
T.
Case 3.1.1.
(IMPLIES (AND (NUMBERP (EVAL$ T (CADR X) A))
(EQUAL (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A))
(LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (EQUAL (CAADDR X) 'PLUS))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NOT (LESSP (EVAL$ T (CADR X) A)
(EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T X A) T)).
But this again simplifies, applying the lemmas NUMBERP-EVAL$-PLUS and
MEMBER-IMPLIES-NUMBERP, to:
(IMPLIES (AND (EQUAL (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A))
(LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (EQUAL (CAADDR X) 'PLUS))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NOT (LESSP (EVAL$ T (CADR X) A)
(EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T X A) T)).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS V Z) to
eliminate (CDR X) and (CAR X), Z by (CONS D W) to eliminate (CDR Z) and
(CAR Z), W by (CONS Z C) to eliminate (CAR W) and (CDR W), Z by
(CONS W X1) to eliminate (CAR Z) and (CDR Z), D by (CONS Z Z1) to
eliminate (CAR D) and (CDR D), D by (CONS W X1) to eliminate (CAR D) and
(CDR D), and D by (CONS Z C) to eliminate (CAR D) and (CDR D). We must
thus prove four new conjectures:
Case 3.1.1.4.
(IMPLIES (AND (NOT (LISTP Z))
(EQUAL (EVAL$ T (CADR Z) A)
(EVAL$ T (CAR Z) A))
(EQUAL V 'EQUAL)
(LISTP (CAR Z))
(EQUAL (CAAR Z) 'PLUS)
(NOT (EQUAL (CAADR Z) 'PLUS))
(MEMBER (CADR Z)
(PLUS-FRINGE (CAR Z)))
(NOT (LESSP (EVAL$ T (CAR Z) A)
(EVAL$ T (CAR Z) A))))
(EQUAL (EVAL$ T (CONS V Z) A) T)),
which finally simplifies, applying the lemmas CDR-NLISTP and
CAR-NLISTP, and expanding the definitions of CAR and LISTP, to:
T.
Case 3.1.1.3.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL (EVAL$ T (CAR W) A)
(EVAL$ T (CONS Z C) A))
(EQUAL V 'EQUAL)
(EQUAL Z 'PLUS)
(NOT (EQUAL (CAAR W) 'PLUS))
(MEMBER (CAR W)
(PLUS-FRINGE (CONS Z C)))
(NOT (LESSP (EVAL$ T (CONS Z C) A)
(EVAL$ T (CONS Z C) A))))
(EQUAL (EVAL$ T
(CONS V (CONS (CONS Z C) W))
A)
T)),
which finally simplifies, rewriting with CAR-NLISTP, REWRITE-EVAL$,
CAR-CONS, and CDR-CONS, and opening up the definitions of CAR and
EQUAL, to:
T.
Case 3.1.1.2.
(IMPLIES (AND (NOT (LISTP Z))
(EQUAL (EVAL$ T Z A)
(EVAL$ T (CONS W X1) A))
(EQUAL V 'EQUAL)
(EQUAL W 'PLUS)
(NOT (EQUAL (CAR Z) 'PLUS))
(MEMBER Z (PLUS-FRINGE (CONS W X1)))
(NOT (LESSP (EVAL$ T (CONS W X1) A)
(EVAL$ T (CONS W X1) A))))
(EQUAL (EVAL$ T
(CONS V (CONS (CONS W X1) (CONS Z C)))
A)
T)).
But this finally simplifies, appealing to the lemmas REWRITE-EVAL$,
CAR-NLISTP, CAR-CONS, and CDR-CONS, and opening up the definition of
EQUAL, to:
T.
Case 3.1.1.1.
(IMPLIES (AND (EQUAL (EVAL$ T (CONS W X1) A)
(EVAL$ T (CONS Z Z1) A))
(EQUAL V 'EQUAL)
(EQUAL Z 'PLUS)
(NOT (EQUAL W 'PLUS))
(MEMBER (CONS W X1)
(PLUS-FRINGE (CONS Z Z1)))
(NOT (LESSP (EVAL$ T (CONS Z Z1) A)
(EVAL$ T (CONS Z Z1) A))))
(EQUAL (EVAL$ T
(CONS V
(CONS (CONS Z Z1)
(CONS (CONS W X1) C)))
A)
T)),
which finally simplifies, applying REWRITE-EVAL$, CAR-CONS, and
CDR-CONS, and unfolding EQUAL, to:
T.
Case 2. (IMPLIES
(AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (LISTP (CADDR X)))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X))))
(EQUAL
(EVAL$ T X A)
(EVAL$ T
(LIST 'IF
(LIST 'NUMBERP (CADDR X))
(CONS 'EQUAL
(CONS (PLUS-TREE (DELETE (CADDR X)
(PLUS-FRINGE (CADR X))))
'('0)))
(LIST 'QUOTE F))
A))).
However this again simplifies, applying REWRITE-EVAL$, CAR-CONS, CDR-CONS,
MEMBER-IMPLIES-NUMBERP, PLUS-TREE-PLUS-FRINGE, PLUS-TREE-DELETE, EVAL$-QUOTE,
and EQUAL-DIFFERENCE-0, and unfolding the definition of CAR, to the
following three new conjectures:
Case 2.3.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (LISTP (CADDR X)))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(LESSP (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A)))
(EQUAL (EVAL$ T X A) F)).
This again simplifies, trivially, to the new conjecture:
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (LISTP (CADDR X)))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(LESSP (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A)))
(NOT (EVAL$ T X A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and (CDR V), W
by (CONS V C) to eliminate (CAR W) and (CDR W), and D by (CONS W X1) to
eliminate (CAR D) and (CDR D). We thus obtain the following three new
formulas:
Case 2.3.3.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(LISTP (CAR V))
(EQUAL (CAAR V) 'PLUS)
(NOT (LISTP (CADR V)))
(MEMBER (CADR V)
(PLUS-FRINGE (CAR V)))
(LESSP (EVAL$ T (CADR V) A)
(EVAL$ T (CAR V) A)))
(NOT (EVAL$ T (CONS Z V) A))).
However this further simplifies, applying CAR-NLISTP, and unfolding the
definition of LISTP, to:
T.
Case 2.3.2.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(NOT (LISTP (CAR D)))
(MEMBER (CAR D)
(PLUS-FRINGE (CONS V C)))
(LESSP (EVAL$ T (CAR D) A)
(EVAL$ T (CONS V C) A)))
(NOT (EVAL$ T
(CONS Z (CONS (CONS V C) D))
A))).
This further simplifies, appealing to the lemmas CAR-NLISTP,
REWRITE-EVAL$, CAR-CONS, and CDR-CONS, and expanding LISTP, to:
(IMPLIES (AND (NOT (LISTP D))
(MEMBER 0
(PLUS-FRINGE (CONS 'PLUS C)))
(LESSP (EVAL$ T 0 A)
(PLUS (EVAL$ T (CAR C) A)
(EVAL$ T (CADR C) A))))
(NOT (EQUAL (PLUS (EVAL$ T (CAR C) A)
(EVAL$ T (CADR C) A))
(EVAL$ T 0 A)))).
But this finally simplifies, using linear arithmetic, to:
T.
Case 2.3.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(NOT (LISTP W))
(MEMBER W (PLUS-FRINGE (CONS V C)))
(LESSP (EVAL$ T W A)
(EVAL$ T (CONS V C) A)))
(NOT (EVAL$ T
(CONS Z (CONS (CONS V C) (CONS W X1)))
A))),
which further simplifies, applying REWRITE-EVAL$, CAR-CONS, and CDR-CONS,
to:
(IMPLIES (AND (NOT (LISTP W))
(MEMBER W
(PLUS-FRINGE (CONS 'PLUS C)))
(LESSP (EVAL$ T W A)
(PLUS (EVAL$ T (CAR C) A)
(EVAL$ T (CADR C) A))))
(NOT (EQUAL (PLUS (EVAL$ T (CAR C) A)
(EVAL$ T (CADR C) A))
(EVAL$ T W A)))),
which finally simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (LISTP (CADDR X)))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NOT (NUMBERP (EVAL$ T (CADDR X) A))))
(EQUAL (EVAL$ T X A) F)),
which again simplifies, obviously, to the new formula:
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (LISTP (CADDR X)))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NOT (NUMBERP (EVAL$ T (CADDR X) A))))
(NOT (EVAL$ T X A))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and (CDR V), W
by (CONS V C) to eliminate (CAR W) and (CDR W), and D by (CONS W X1) to
eliminate (CAR D) and (CDR D). This produces the following three new
goals:
Case 2.2.3.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(LISTP (CAR V))
(EQUAL (CAAR V) 'PLUS)
(NOT (LISTP (CADR V)))
(MEMBER (CADR V)
(PLUS-FRINGE (CAR V)))
(NOT (NUMBERP (EVAL$ T (CADR V) A))))
(NOT (EVAL$ T (CONS Z V) A))).
However this further simplifies, appealing to the lemma CAR-NLISTP, and
unfolding LISTP, to:
T.
Case 2.2.2.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(NOT (LISTP (CAR D)))
(MEMBER (CAR D)
(PLUS-FRINGE (CONS V C)))
(NOT (NUMBERP (EVAL$ T (CAR D) A))))
(NOT (EVAL$ T
(CONS Z (CONS (CONS V C) D))
A))),
which further simplifies, rewriting with CAR-NLISTP, REWRITE-EVAL$,
CAR-CONS, and CDR-CONS, and unfolding the definition of LISTP, to:
T.
Case 2.2.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(NOT (LISTP W))
(MEMBER W (PLUS-FRINGE (CONS V C)))
(NOT (NUMBERP (EVAL$ T W A))))
(NOT (EVAL$ T
(CONS Z (CONS (CONS V C) (CONS W X1)))
A))).
However this further simplifies, applying the lemmas REWRITE-EVAL$,
CAR-CONS, and CDR-CONS, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (LISTP (CADDR X)))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NUMBERP (EVAL$ T (CADDR X) A))
(NOT (LESSP (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T X A) T)),
which again simplifies, using linear arithmetic and applying
MEMBER-IMPLIES-PLUS-TREE-GREATEREQP, PLUS-TREE-PLUS-FRINGE, and
MEMBER-IMPLIES-NUMBERP, to the following two new goals:
Case 2.1.2.
(IMPLIES (AND (NOT (NUMBERP (EVAL$ T (CADR X) A)))
(LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (LISTP (CADDR X)))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NUMBERP (EVAL$ T (CADDR X) A))
(NOT (LESSP (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T X A) T)).
But this again simplifies, applying MEMBER-IMPLIES-NUMBERP, to:
T.
Case 2.1.1.
(IMPLIES (AND (NUMBERP (EVAL$ T (CADR X) A))
(EQUAL (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A))
(LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (LISTP (CADDR X)))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NOT (LESSP (EVAL$ T (CADR X) A)
(EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T X A) T)).
However this again simplifies, applying the lemmas NUMBERP-EVAL$-PLUS
and MEMBER-IMPLIES-NUMBERP, to:
(IMPLIES (AND (EQUAL (EVAL$ T (CADDR X) A)
(EVAL$ T (CADR X) A))
(LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(NOT (LISTP (CADDR X)))
(MEMBER (CADDR X)
(PLUS-FRINGE (CADR X)))
(NOT (LESSP (EVAL$ T (CADR X) A)
(EVAL$ T (CADR X) A))))
(EQUAL (EVAL$ T X A) T)).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS V Z) to
eliminate (CDR X) and (CAR X), Z by (CONS D W) to eliminate (CDR Z) and
(CAR Z), W by (CONS Z C) to eliminate (CAR W) and (CDR W), D by
(CONS W X1) to eliminate (CAR D) and (CDR D), and D by (CONS Z C) to
eliminate (CAR D) and (CDR D). We must thus prove three new formulas:
Case 2.1.1.3.
(IMPLIES (AND (NOT (LISTP Z))
(EQUAL (EVAL$ T (CADR Z) A)
(EVAL$ T (CAR Z) A))
(EQUAL V 'EQUAL)
(LISTP (CAR Z))
(EQUAL (CAAR Z) 'PLUS)
(NOT (LISTP (CADR Z)))
(MEMBER (CADR Z)
(PLUS-FRINGE (CAR Z)))
(NOT (LESSP (EVAL$ T (CAR Z) A)
(EVAL$ T (CAR Z) A))))
(EQUAL (EVAL$ T (CONS V Z) A) T)),
which finally simplifies, rewriting with CDR-NLISTP and CAR-NLISTP,
and unfolding the definitions of CAR and LISTP, to:
T.
Case 2.1.1.2.
(IMPLIES (AND (NOT (LISTP W))
(EQUAL (EVAL$ T (CAR W) A)
(EVAL$ T (CONS Z C) A))
(EQUAL V 'EQUAL)
(EQUAL Z 'PLUS)
(NOT (LISTP (CAR W)))
(MEMBER (CAR W)
(PLUS-FRINGE (CONS Z C)))
(NOT (LESSP (EVAL$ T (CONS Z C) A)
(EVAL$ T (CONS Z C) A))))
(EQUAL (EVAL$ T
(CONS V (CONS (CONS Z C) W))
A)
T)).
This finally simplifies, applying CAR-NLISTP, REWRITE-EVAL$, CAR-CONS,
and CDR-CONS, and opening up the functions LISTP and EQUAL, to:
T.
Case 2.1.1.1.
(IMPLIES (AND (EQUAL (EVAL$ T Z A)
(EVAL$ T (CONS W X1) A))
(EQUAL V 'EQUAL)
(EQUAL W 'PLUS)
(NOT (LISTP Z))
(MEMBER Z (PLUS-FRINGE (CONS W X1)))
(NOT (LESSP (EVAL$ T (CONS W X1) A)
(EVAL$ T (CONS W X1) A))))
(EQUAL (EVAL$ T
(CONS V (CONS (CONS W X1) (CONS Z C)))
A)
T)).
However this finally simplifies, applying REWRITE-EVAL$, CAR-CONS, and
CDR-CONS, and unfolding EQUAL, to:
T.
Case 1. (IMPLIES
(AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS))
(EQUAL
(EVAL$ T X A)
(EVAL$ T
(LIST 'EQUAL
(PLUS-TREE (BAGDIFF (PLUS-FRINGE (CADR X))
(BAGINT (PLUS-FRINGE (CADR X))
(PLUS-FRINGE (CADDR X)))))
(PLUS-TREE (BAGDIFF (PLUS-FRINGE (CADDR X))
(BAGINT (PLUS-FRINGE (CADR X))
(PLUS-FRINGE (CADDR X))))))
A))).
This again simplifies, applying REWRITE-EVAL$, CAR-CONS, SUBBAGP-BAGINT1,
NUMBERP-EVAL$-PLUS, PLUS-TREE-PLUS-FRINGE, PLUS-TREE-BAGDIFF, CDR-CONS,
SUBBAGP-BAGINT2, BRIDGE-TO-SUBBAGP-IMPLIES-PLUS-TREE-GREATEREQP, and
DIFFERENCE-CANCELLATION-1, to the following two new goals:
Case 1.2.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(NOT (EQUAL (EVAL$ T (CADR X) A)
(EVAL$ T (CADDR X) A))))
(NOT (EVAL$ T X A))).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS Z V) to
eliminate (CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and
(CDR V), W by (CONS V C) to eliminate (CAR W) and (CDR W), D by
(CONS W X1) to eliminate (CAR D) and (CDR D), and W by (CONS D Z1) to
eliminate (CAR W) and (CDR W). The result is three new formulas:
Case 1.2.3.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(LISTP (CAR V))
(EQUAL (CAAR V) 'PLUS)
(LISTP (CADR V))
(EQUAL (CAADR V) 'PLUS)
(NOT (EQUAL (EVAL$ T (CAR V) A)
(EVAL$ T (CADR V) A))))
(NOT (EVAL$ T (CONS Z V) A))),
which further simplifies, applying CAR-NLISTP, and expanding LISTP, to:
T.
Case 1.2.2.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(NOT (EQUAL (EVAL$ T (CONS V C) A)
(EVAL$ T (CAR D) A))))
(NOT (EVAL$ T
(CONS Z (CONS (CONS V C) D))
A))).
This further simplifies, rewriting with CAR-NLISTP, and expanding the
function LISTP, to:
T.
Case 1.2.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(EQUAL D 'PLUS)
(NOT (EQUAL (EVAL$ T (CONS V C) A)
(EVAL$ T (CONS D Z1) A))))
(NOT (EVAL$ T
(CONS Z
(CONS (CONS V C)
(CONS (CONS D Z1) X1)))
A))).
But this further simplifies, rewriting with the lemmas REWRITE-EVAL$,
CAR-CONS, and CDR-CONS, to:
T.
Case 1.1.
(IMPLIES (AND (LISTP X)
(EQUAL (CAR X) 'EQUAL)
(LISTP (CADR X))
(EQUAL (CAADR X) 'PLUS)
(LISTP (CADDR X))
(EQUAL (CAADDR X) 'PLUS)
(EQUAL (EVAL$ T (CADR X) A)
(EVAL$ T (CADDR X) A)))
(EQUAL (EVAL$ T X A) T)).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS W D) to eliminate (CAR V) and (CDR V), W
by (CONS V C) to eliminate (CAR W) and (CDR W), D by (CONS W X1) to
eliminate (CAR D) and (CDR D), and W by (CONS D Z1) to eliminate (CAR W)
and (CDR W). We would thus like to prove the following three new formulas:
Case 1.1.3.
(IMPLIES (AND (NOT (LISTP V))
(EQUAL Z 'EQUAL)
(LISTP (CAR V))
(EQUAL (CAAR V) 'PLUS)
(LISTP (CADR V))
(EQUAL (CAADR V) 'PLUS)
(EQUAL (EVAL$ T (CAR V) A)
(EVAL$ T (CADR V) A)))
(EQUAL (EVAL$ T (CONS Z V) A) T)).
This further simplifies, applying CAR-NLISTP, and unfolding the
definition of LISTP, to:
T.
Case 1.1.2.
(IMPLIES (AND (NOT (LISTP D))
(EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(LISTP (CAR D))
(EQUAL (CAAR D) 'PLUS)
(EQUAL (EVAL$ T (CONS V C) A)
(EVAL$ T (CAR D) A)))
(EQUAL (EVAL$ T
(CONS Z (CONS (CONS V C) D))
A)
T)).
This further simplifies, applying CAR-NLISTP, and unfolding the
definition of LISTP, to:
T.
Case 1.1.1.
(IMPLIES (AND (EQUAL Z 'EQUAL)
(EQUAL V 'PLUS)
(EQUAL D 'PLUS)
(EQUAL (EVAL$ T (CONS V C) A)
(EVAL$ T (CONS D Z1) A)))
(EQUAL (EVAL$ T
(CONS Z
(CONS (CONS V C)
(CONS (CONS D Z1) X1)))
A)
T)).
But this further simplifies, applying the lemmas REWRITE-EVAL$, CAR-CONS,
and CDR-CONS, and opening up the definition of EQUAL, to:
T.
Q.E.D.
[ 0.0 0.5 0.1 ]
CORRECTNESS-OF-CANCEL
(DEFN REVERSE
(X)
(IF (LISTP X)
(APPEND (REVERSE (CDR X))
(CONS (CAR X) NIL))
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, REVERSE is accepted under the principle of definition.
Note that (OR (LITATOM (REVERSE X)) (LISTP (REVERSE X))) is a theorem.
[ 0.0 0.0 0.0 ]
REVERSE
(PROVE-LEMMA ASSOCIATIVITY-OF-APPEND
(REWRITE)
(EQUAL (APPEND (APPEND X Y) Z)
(APPEND X (APPEND Y Z))))
Call the conjecture *1.
Perhaps we can prove it by induction. Three 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) (p (CDR X) Y Z))
(p X Y Z))
(IMPLIES (NOT (LISTP X)) (p X Y Z))).
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 two
new goals:
Case 2. (IMPLIES (AND (LISTP X)
(EQUAL (APPEND (APPEND (CDR X) Y) Z)
(APPEND (CDR X) (APPEND Y Z))))
(EQUAL (APPEND (APPEND X Y) Z)
(APPEND X (APPEND Y Z)))),
which simplifies, applying the lemmas CDR-CONS and CAR-CONS, and opening up
the definition of APPEND, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (APPEND (APPEND X Y) Z)
(APPEND X (APPEND Y Z)))),
which simplifies, unfolding the function APPEND, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
ASSOCIATIVITY-OF-APPEND
(DEFN PLISTP
(X)
(IF (NLISTP X)
(EQUAL X NIL)
(PLISTP (CDR X))))
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the
definition of NLISTP can be used to establish that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each recursive call.
Hence, PLISTP is accepted under the principle of definition. From the
definition we can conclude that (OR (FALSEP (PLISTP X)) (TRUEP (PLISTP X))) is
a theorem.
[ 0.0 0.0 0.0 ]
PLISTP
(PROVE-LEMMA APPEND-RIGHT-ID
(REWRITE)
(IMPLIES (PLISTP X)
(EQUAL (APPEND X NIL) X)))
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 (NLISTP X) (p X))
(IMPLIES (AND (NOT (NLISTP X)) (p (CDR X)))
(p 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 produces the following three new formulas:
Case 3. (IMPLIES (AND (NLISTP X) (PLISTP X))
(EQUAL (APPEND X NIL) X)).
This simplifies, expanding the definitions of NLISTP, PLISTP, APPEND, and
EQUAL, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP X))
(NOT (PLISTP (CDR X)))
(PLISTP X))
(EQUAL (APPEND X NIL) X)).
This simplifies, expanding the definitions of NLISTP and PLISTP, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP X))
(EQUAL (APPEND (CDR X) NIL) (CDR X))
(PLISTP X))
(EQUAL (APPEND X NIL) X)).
This simplifies, appealing to the lemma CONS-CAR-CDR, and unfolding the
functions NLISTP, PLISTP, and APPEND, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
APPEND-RIGHT-ID
(PROVE-LEMMA PLISTP-REVERSE
(GENERALIZE REWRITE)
(PLISTP (REVERSE X)))
Call the conjecture *1.
Let us appeal to the induction principle. There is only one suggested
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 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 two new goals:
Case 2. (IMPLIES (AND (LISTP X)
(PLISTP (REVERSE (CDR X))))
(PLISTP (REVERSE X))),
which simplifies, expanding the definition of REVERSE, to the conjecture:
(IMPLIES (AND (LISTP X)
(PLISTP (REVERSE (CDR X))))
(PLISTP (APPEND (REVERSE (CDR X))
(LIST (CAR X))))).
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 (PLISTP (REVERSE Z))
(PLISTP (APPEND (REVERSE Z) (LIST V)))).
We will try to prove the above formula by generalizing it, replacing
(REVERSE Z) by Y. The result is:
(IMPLIES (PLISTP Y)
(PLISTP (APPEND Y (LIST V)))).
Give the above formula the name *1.1.
Case 1. (IMPLIES (NOT (LISTP X))
(PLISTP (REVERSE X))).
This simplifies, expanding REVERSE and PLISTP, to:
T.
So let us turn our attention to:
(IMPLIES (PLISTP Y)
(PLISTP (APPEND Y (LIST V)))),
named *1.1 above. Perhaps we can 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 (NLISTP Y) (p Y V))
(IMPLIES (AND (NOT (NLISTP Y)) (p (CDR Y) V))
(p Y V))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP establish that the measure (COUNT Y) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme generates the following three new conjectures:
Case 3. (IMPLIES (AND (NLISTP Y) (PLISTP Y))
(PLISTP (APPEND Y (LIST V)))).
This simplifies, applying CDR-CONS, and unfolding the definitions of NLISTP,
PLISTP, LISTP, and APPEND, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP Y))
(NOT (PLISTP (CDR Y)))
(PLISTP Y))
(PLISTP (APPEND Y (LIST V)))),
which simplifies, unfolding NLISTP and PLISTP, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP Y))
(PLISTP (APPEND (CDR Y) (LIST V)))
(PLISTP Y))
(PLISTP (APPEND Y (LIST V)))),
which simplifies, applying CDR-CONS, and opening up NLISTP, PLISTP, and
APPEND, to:
T.
That finishes the proof of *1.1, which, consequently, also finishes the
proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
PLISTP-REVERSE
(PROVE-LEMMA APPEND-REVERSE
(REWRITE)
(EQUAL (REVERSE (APPEND A B))
(APPEND (REVERSE B) (REVERSE A))))
Call the conjecture *1.
Perhaps we can prove it by induction. Three 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 A) (p (CDR A) B))
(p A B))
(IMPLIES (NOT (LISTP A)) (p A B))).
Linear arithmetic and the lemma CDR-LESSP can be used to prove that the
measure (COUNT A) decreases according to the well-founded relation LESSP in
each induction step of the scheme. The above induction scheme leads to two
new goals:
Case 2. (IMPLIES (AND (LISTP A)
(EQUAL (REVERSE (APPEND (CDR A) B))
(APPEND (REVERSE B)
(REVERSE (CDR A)))))
(EQUAL (REVERSE (APPEND A B))
(APPEND (REVERSE B) (REVERSE A)))),
which simplifies, applying the lemmas CAR-CONS and CDR-CONS, and opening up
the definitions of APPEND and REVERSE, to:
(IMPLIES (AND (LISTP A)
(EQUAL (REVERSE (APPEND (CDR A) B))
(APPEND (REVERSE B)
(REVERSE (CDR A)))))
(EQUAL (APPEND (REVERSE (APPEND (CDR A) B))
(LIST (CAR A)))
(APPEND (REVERSE B)
(APPEND (REVERSE (CDR A))
(LIST (CAR A)))))).
Appealing to the lemma CAR-CDR-ELIM, we now replace A by (CONS Z X) to
eliminate (CDR A) and (CAR A). This generates the goal:
(IMPLIES (EQUAL (REVERSE (APPEND X B))
(APPEND (REVERSE B) (REVERSE X)))
(EQUAL (APPEND (REVERSE (APPEND X B))
(LIST Z))
(APPEND (REVERSE B)
(APPEND (REVERSE X) (LIST Z))))).
We use the above equality hypothesis by substituting:
(APPEND (REVERSE B) (REVERSE X))
for (REVERSE (APPEND X B)) and throwing away the equality. This produces
the new conjecture:
(EQUAL (APPEND (APPEND (REVERSE B) (REVERSE X))
(LIST Z))
(APPEND (REVERSE B)
(APPEND (REVERSE X) (LIST Z)))),
which further simplifies, applying ASSOCIATIVITY-OF-APPEND, to:
T.
Case 1. (IMPLIES (NOT (LISTP A))
(EQUAL (REVERSE (APPEND A B))
(APPEND (REVERSE B) (REVERSE A)))).
This simplifies, applying PLISTP-REVERSE and APPEND-RIGHT-ID, and opening up
APPEND and REVERSE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
APPEND-REVERSE
(PROVE-LEMMA TIMES-ZERO2
(REWRITE)
(IMPLIES (NOT (NUMBERP Y))
(EQUAL (TIMES X Y) 0)))
Call the conjecture *1.
Perhaps we can prove it by induction. There is only one plausible
induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP X) (p X Y))
(IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) Y))
(p X Y))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP 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 two new goals:
Case 2. (IMPLIES (AND (ZEROP X) (NOT (NUMBERP Y)))
(EQUAL (TIMES X Y) 0)),
which simplifies, opening up the definitions of ZEROP, EQUAL, and TIMES, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(EQUAL (TIMES (SUB1 X) Y) 0)
(NOT (NUMBERP Y)))
(EQUAL (TIMES X Y) 0)),
which simplifies, applying PLUS-RIGHT-ID2 and COMMUTATIVITY-OF-PLUS, and
unfolding ZEROP, TIMES, NUMBERP, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
TIMES-ZERO2
(PROVE-LEMMA DISTRIBUTIVITY-OF-TIMES-OVER-PLUS
(REWRITE)
(EQUAL (TIMES X (PLUS Y Z))
(PLUS (TIMES X Y) (TIMES X Z))))
Call the conjecture *1.
We will try to prove it by induction. There are four plausible
inductions. They merge into two likely candidate inductions. However, only
one is unflawed. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP X) (p X Y Z))
(IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) Y Z))
(p X Y Z))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP 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 two new goals:
Case 2. (IMPLIES (ZEROP X)
(EQUAL (TIMES X (PLUS Y Z))
(PLUS (TIMES X Y) (TIMES X Z)))),
which simplifies, opening up the functions ZEROP, EQUAL, TIMES, and PLUS, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(EQUAL (TIMES (SUB1 X) (PLUS Y Z))
(PLUS (TIMES (SUB1 X) Y)
(TIMES (SUB1 X) Z))))
(EQUAL (TIMES X (PLUS Y Z))
(PLUS (TIMES X Y) (TIMES X Z)))),
which simplifies, applying ASSOCIATIVITY-OF-PLUS and COMMUTATIVITY2-OF-PLUS,
and unfolding the functions ZEROP and TIMES, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS
(PROVE-LEMMA TIMES-ADD1
(REWRITE)
(EQUAL (TIMES X (ADD1 Y))
(IF (NUMBERP Y)
(PLUS X (TIMES X Y))
(FIX X))))
This conjecture simplifies, unfolding the definition of FIX, to three new
conjectures:
Case 3. (IMPLIES (AND (NOT (NUMBERP Y)) (NUMBERP X))
(EQUAL (TIMES X (ADD1 Y)) X)),
which again simplifies, rewriting with SUB1-TYPE-RESTRICTION, to the new
formula:
(IMPLIES (AND (NOT (NUMBERP Y)) (NUMBERP X))
(EQUAL (TIMES X 1) X)),
which we will name *1.
Case 2. (IMPLIES (AND (NOT (NUMBERP Y))
(NOT (NUMBERP X)))
(EQUAL (TIMES X (ADD1 Y)) 0)).
However this again simplifies, applying SUB1-TYPE-RESTRICTION, and opening
up the definitions of TIMES and EQUAL, to:
T.
Case 1. (IMPLIES (NUMBERP Y)
(EQUAL (TIMES X (ADD1 Y))
(PLUS X (TIMES X Y)))),
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 (TIMES X (ADD1 Y))
(IF (NUMBERP Y)
(PLUS X (TIMES X Y))
(FIX X))),
which we named *1 above. We will appeal to induction. 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 (ZEROP X) (p X Y))
(IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) Y))
(p X Y))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
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 two new formulas:
Case 2. (IMPLIES (ZEROP X)
(EQUAL (TIMES X (ADD1 Y))
(IF (NUMBERP Y)
(PLUS X (TIMES X Y))
(FIX X)))).
This simplifies, rewriting with PLUS-RIGHT-ID2 and COMMUTATIVITY-OF-PLUS,
and expanding the definitions of ZEROP, EQUAL, TIMES, PLUS, FIX, and NUMBERP,
to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(EQUAL (TIMES (SUB1 X) (ADD1 Y))
(IF (NUMBERP Y)
(PLUS (SUB1 X) (TIMES (SUB1 X) Y))
(FIX (SUB1 X)))))
(EQUAL (TIMES X (ADD1 Y))
(IF (NUMBERP Y)
(PLUS X (TIMES X Y))
(FIX X)))),
which simplifies, applying SUB1-TYPE-RESTRICTION and SUB1-ADD1, and
unfolding the functions ZEROP, FIX, TIMES, and PLUS, to the following two
new formulas:
Case 1.2.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP Y))
(EQUAL (TIMES (SUB1 X) (ADD1 Y))
(SUB1 X)))
(EQUAL (TIMES X 1) X)).
But this further simplifies, rewriting with SUB1-TYPE-RESTRICTION, and
unfolding TIMES, to the new formula:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP Y))
(EQUAL (TIMES (SUB1 X) 1) (SUB1 X)))
(EQUAL (PLUS 1 (SUB1 X)) X)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NUMBERP Y)
(EQUAL (TIMES (SUB1 X) (ADD1 Y))
(PLUS (SUB1 X) (TIMES (SUB1 X) Y))))
(EQUAL (ADD1 (PLUS Y (TIMES (SUB1 X) (ADD1 Y))))
(PLUS X Y (TIMES (SUB1 X) Y)))),
which again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
TIMES-ADD1
(PROVE-LEMMA COMMUTATIVITY-OF-TIMES
(REWRITE)
(EQUAL (TIMES X Y) (TIMES Y X)))
WARNING: the newly proposed lemma, COMMUTATIVITY-OF-TIMES, could be applied
whenever the previously added lemma TIMES-ADD1 could.
WARNING: the newly proposed lemma, COMMUTATIVITY-OF-TIMES, could be applied
whenever the previously added lemma DISTRIBUTIVITY-OF-TIMES-OVER-PLUS could.
WARNING: the newly proposed lemma, COMMUTATIVITY-OF-TIMES, could be applied
whenever the previously added lemma TIMES-ZERO2 could.
Give the conjecture the name *1.
We will appeal to induction. Two inductions are suggested by terms in
the conjecture, both of which are flawed. We limit our consideration to the
two suggested by the largest number of nonprimitive recursive functions in the
conjecture. Since both of these are equally likely, we will choose
arbitrarily. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP X) (p X Y))
(IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) Y))
(p X Y))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP 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 two new conjectures:
Case 2. (IMPLIES (ZEROP X)
(EQUAL (TIMES X Y) (TIMES Y X))).
This simplifies, applying TIMES-ZERO2, and opening up the functions ZEROP,
EQUAL, and TIMES, to:
(IMPLIES (EQUAL X 0)
(EQUAL 0 (TIMES Y 0))).
This again simplifies, obviously, to:
(EQUAL 0 (TIMES Y 0)),
which we will name *1.1.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(EQUAL (TIMES (SUB1 X) Y)
(TIMES Y (SUB1 X))))
(EQUAL (TIMES X Y) (TIMES Y X))).
This simplifies, unfolding the definitions of ZEROP and TIMES, to the new
goal:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL (TIMES (SUB1 X) Y)
(TIMES Y (SUB1 X))))
(EQUAL (PLUS Y (TIMES Y (SUB1 X)))
(TIMES Y X))).
Applying the lemma SUB1-ELIM, replace X by (ADD1 Z) to eliminate (SUB1 X).
We employ the type restriction lemma noted when SUB1 was introduced to
restrict the new variable. This produces the new goal:
(IMPLIES (AND (NUMBERP Z)
(NOT (EQUAL (ADD1 Z) 0))
(EQUAL (TIMES Z Y) (TIMES Y Z)))
(EQUAL (PLUS Y (TIMES Y Z))
(TIMES Y (ADD1 Z)))),
which further simplifies, applying the lemma TIMES-ADD1, to:
T.
So we now return to:
(EQUAL 0 (TIMES Y 0)),
which is formula *1.1 above. We will try to prove it by induction. There is
only one suggested induction. We will induct according to the following
scheme:
(AND (IMPLIES (ZEROP Y) (p Y))
(IMPLIES (AND (NOT (ZEROP Y)) (p (SUB1 Y)))
(p Y))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT Y) decreases according to the well-founded
relation LESSP in each induction step of the scheme. The above induction
scheme produces two new conjectures:
Case 2. (IMPLIES (ZEROP Y)
(EQUAL 0 (TIMES Y 0))),
which simplifies, unfolding ZEROP, TIMES, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP Y))
(EQUAL 0 (TIMES (SUB1 Y) 0)))
(EQUAL 0 (TIMES Y 0))),
which simplifies, unfolding the definitions of ZEROP, TIMES, PLUS, and EQUAL,
to:
T.
That finishes the proof of *1.1, which, in turn, finishes the proof of *1.
Q.E.D.
[ 0.0 0.0 0.0 ]
COMMUTATIVITY-OF-TIMES
(PROVE-LEMMA COMMUTATIVITY2-OF-TIMES
(REWRITE)
(EQUAL (TIMES X (TIMES Y Z))
(TIMES Y (TIMES X Z))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-TIMES, could be applied
whenever the newly proposed COMMUTATIVITY2-OF-TIMES could!
Call the conjecture *1.
Perhaps we can prove it by induction. Four inductions are suggested by
terms in the conjecture. They merge into two likely candidate inductions,
both of which are unflawed. Since both of these are equally likely, we will
choose arbitrarily. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP Y) (p X Y Z))
(IMPLIES (AND (NOT (ZEROP Y)) (p X (SUB1 Y) Z))
(p X Y Z))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be
used to prove that the measure (COUNT Y) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme leads to two new goals:
Case 2. (IMPLIES (ZEROP Y)
(EQUAL (TIMES X Y Z) (TIMES Y X Z))),
which simplifies, applying the lemma COMMUTATIVITY-OF-TIMES, and opening up
the definitions of ZEROP, EQUAL, and TIMES, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP Y))
(EQUAL (TIMES X (SUB1 Y) Z)
(TIMES (SUB1 Y) X Z)))
(EQUAL (TIMES X Y Z) (TIMES Y X Z))),
which simplifies, rewriting with DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and
opening up the functions ZEROP and TIMES, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
COMMUTATIVITY2-OF-TIMES
(PROVE-LEMMA ASSOCIATIVITY-OF-TIMES
(REWRITE)
(EQUAL (TIMES (TIMES X Y) Z)
(TIMES X (TIMES Y Z))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-TIMES, could be applied
whenever the newly proposed ASSOCIATIVITY-OF-TIMES could!
This simplifies, rewriting with COMMUTATIVITY-OF-TIMES and
COMMUTATIVITY2-OF-TIMES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
ASSOCIATIVITY-OF-TIMES
(PROVE-LEMMA EQUAL-TIMES-0
(REWRITE)
(EQUAL (EQUAL (TIMES X Y) 0)
(OR (ZEROP X) (ZEROP Y))))
This simplifies, opening up the functions ZEROP and OR, to five new
conjectures:
Case 5. (IMPLIES (NOT (EQUAL (TIMES X Y) 0))
(NUMBERP Y)),
which again simplifies, applying TIMES-ZERO2, and unfolding the function
EQUAL, to:
T.
Case 4. (IMPLIES (NOT (EQUAL (TIMES X Y) 0))
(NOT (EQUAL Y 0))).
However this again simplifies, applying COMMUTATIVITY-OF-TIMES, and
unfolding the functions EQUAL and TIMES, to:
T.
Case 3. (IMPLIES (NOT (EQUAL (TIMES X Y) 0))
(NUMBERP X)).
This again simplifies, opening up the definitions of TIMES and EQUAL, to:
T.
Case 2. (IMPLIES (NOT (EQUAL (TIMES X Y) 0))
(NOT (EQUAL X 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (EQUAL (TIMES X Y) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))),
which we will name *1.
Perhaps we can prove it by induction. There is only one plausible
induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP X) (p Y X))
(IMPLIES (AND (NOT (ZEROP X)) (p Y (SUB1 X)))
(p Y X))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP 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 produces three new conjectures:
Case 3. (IMPLIES (AND (ZEROP X)
(EQUAL (TIMES X Y) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))),
which simplifies, unfolding the function ZEROP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP X))
(NOT (EQUAL (TIMES (SUB1 X) Y) 0))
(EQUAL (TIMES X Y) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))),
which simplifies, rewriting with the lemma PLUS-EQUAL-0, and expanding the
functions ZEROP and TIMES, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(EQUAL (SUB1 X) 0)
(EQUAL (TIMES X Y) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))),
which simplifies, rewriting with the lemma PLUS-EQUAL-0, and expanding the
definitions of ZEROP and TIMES, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
EQUAL-TIMES-0
(ADD-SHELL PUSH NIL STACKP
((TOP (NONE-OF) ZERO)
(POP (NONE-OF) ZERO)))
[ 0.0 0.0 0.0 ]
PUSH
(CONSTRAIN NUMBERP-CALL
(REWRITE)
(NUMBERP (CALL FN X Y))
((CALL (LAMBDA (FN X Y) 1))
(GETVALUE (LAMBDA (X Y) NIL))))
WARNING: Note that the proposed lemma NUMBERP-CALL is to be stored as one
type prescription rule, zero compound recognizer rules, zero linear rules, and
zero replacement rules.
We will verify the consistency and the conservative nature of this constraint
by attempting to prove (NUMBERP 1).
This simplifies, trivially, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
NUMBERP-CALL
(DEFN EXPRESSIONP
(X)
(IF (LISTP X)
(IF (LISTP (CAR X))
F
(IF (LISTP (CDR X))
(IF (LISTP (CDDR X))
(IF (EXPRESSIONP (CADR X))
(EXPRESSIONP (CADDR X))
F)
F)
F))
T))
Linear arithmetic and the lemmas CAR-LESSP, CDR-LESSEQP, and CDR-LESSP
establish that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, EXPRESSIONP is accepted under
the principle of definition. From the definition we can conclude that:
(OR (FALSEP (EXPRESSIONP X))
(TRUEP (EXPRESSIONP X)))
is a theorem.
[ 0.0 0.0 0.0 ]
EXPRESSIONP
(PROVE-LEMMA CADR-CROCK
(REWRITE)
(IMPLIES (LISTP (CDDR X))
(LESSP (COUNT (CADR X)) (COUNT X))))
WARNING: Note that the proposed lemma CADR-CROCK 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 applying CDR-LESSEQP and
CAR-LESSEQP, to:
(IMPLIES (AND (EQUAL (COUNT (CDR X)) (COUNT X))
(LISTP (CDDR X)))
(LESSP (COUNT (CADR X)) (COUNT X))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS V Z) to eliminate (CDR X)
and (CAR X) and Z by (CONS D W) to eliminate (CDR Z) and (CAR Z). We would
thus like to prove the following three new conjectures:
Case 3. (IMPLIES (AND (NOT (LISTP X))
(EQUAL (COUNT (CDR X)) (COUNT X))
(LISTP (CDDR X)))
(LESSP (COUNT (CADR X)) (COUNT X))).
But this further simplifies, applying the lemma CDR-NLISTP, and opening up
COUNT, CDR, and LISTP, to:
T.
Case 2. (IMPLIES (AND (NOT (LISTP Z))
(EQUAL (COUNT Z) (COUNT (CONS V Z)))
(LISTP (CDR Z)))
(LESSP (COUNT (CAR Z))
(COUNT (CONS V Z)))),
which further simplifies, applying COUNT-CONS and CDR-NLISTP, and expanding
LISTP, to:
T.
Case 1. (IMPLIES (AND (EQUAL (COUNT (CONS D W))
(COUNT (CONS V (CONS D W))))
(LISTP W))
(LESSP (COUNT D)
(COUNT (CONS V (CONS D W))))).
This further simplifies, rewriting with COUNT-CONS, COMMUTATIVITY2-OF-PLUS,
PLUS-ADD1, ADD1-EQUAL, and SUB1-ADD1, and expanding the function LESSP, to
the new formula:
(IMPLIES (AND (EQUAL (PLUS (COUNT D) (COUNT W))
(ADD1 (PLUS (COUNT D) (COUNT V) (COUNT W))))
(LISTP W)
(NOT (EQUAL (COUNT D) 0)))
(LESSP (SUB1 (COUNT D))
(PLUS (COUNT D) (COUNT W)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
CADR-CROCK
(DEFN TERM-EVAL
(FORM ENVRN)
(IF (NUMBERP FORM)
FORM
(IF (LISTP (CDDR FORM))
(CALL (CAR FORM)
(TERM-EVAL (CADR FORM) ENVRN)
(TERM-EVAL (CADDR FORM) ENVRN))
(GETVALUE FORM ENVRN))))
Linear arithmetic and the lemmas CAR-LESSP, CDR-LESSEQP, and CADR-CROCK
inform us that the measure (COUNT FORM) decreases according to the
well-founded relation LESSP in each recursive call. Hence, TERM-EVAL is
accepted under the principle of definition.
[ 0.0 0.0 0.0 ]
TERM-EVAL
(DEFN OPTIMIZE
(FORM)
(IF (LISTP (CDDR FORM))
(IF (NUMBERP (OPTIMIZE (CADR FORM)))
(IF (NUMBERP (OPTIMIZE (CADDR FORM)))
(CALL (CAR FORM)
(OPTIMIZE (CADR FORM))
(OPTIMIZE (CADDR FORM)))
(LIST (CAR FORM)
(OPTIMIZE (CADR FORM))
(OPTIMIZE (CADDR FORM))))
(LIST (CAR FORM)
(OPTIMIZE (CADR FORM))
(OPTIMIZE (CADDR FORM))))
FORM))
Linear arithmetic and the lemmas CADR-CROCK, CAR-LESSP, and CDR-LESSEQP
establish that the measure (COUNT FORM) decreases according to the
well-founded relation LESSP in each recursive call. Hence, OPTIMIZE is
accepted under the principle of definition. Observe that:
(OR (OR (NUMBERP (OPTIMIZE FORM))
(LISTP (OPTIMIZE FORM)))
(EQUAL (OPTIMIZE FORM) FORM))
is a theorem.
[ 0.0 0.0 0.0 ]
OPTIMIZE
(DEFN CODEGEN
(FORM INS)
(IF (NUMBERP FORM)
(CONS (LIST 'PUSHI FORM) INS)
(IF (LISTP (CDDR FORM))
(CONS (CAR FORM)
(CODEGEN (CADDR FORM)
(CODEGEN (CADR FORM) INS)))
(CONS (LIST 'PUSHV FORM) INS))))
Linear arithmetic and the lemmas CAR-LESSP, CDR-LESSEQP, and CADR-CROCK
inform us that the measure (COUNT FORM) decreases according to the
well-founded relation LESSP in each recursive call. Hence, CODEGEN is
accepted under the principle of definition. From the definition we can
conclude that (LISTP (CODEGEN FORM INS)) is a theorem.
[ 0.0 0.0 0.0 ]
CODEGEN
(DEFN COMPILE
(FORM)
(REVERSE (CODEGEN (OPTIMIZE FORM) NIL)))
From the definition we can conclude that:
(OR (LITATOM (COMPILE FORM))
(LISTP (COMPILE FORM)))
is a theorem.
[ 0.0 0.0 0.0 ]
COMPILE
(PROVE-LEMMA FORMP-OPTIMIZE
(REWRITE)
(IMPLIES (EXPRESSIONP X)
(EXPRESSIONP (OPTIMIZE X))))
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 (CAR X)))
(p X))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(p (CADDR X))
(p (CADR X)))
(p X))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(NOT (EXPRESSIONP (CADR X)))
(p (CADR X)))
(p X))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(p X))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(NOT (LISTP (CDR X))))
(p X))
(IMPLIES (NOT (LISTP X)) (p X))).
Linear arithmetic and the lemmas CAR-LESSP, CDR-LESSEQP, and 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 seven new conjectures:
Case 7. (IMPLIES (AND (LISTP X)
(LISTP (CAR X))
(EXPRESSIONP X))
(EXPRESSIONP (OPTIMIZE X))).
This simplifies, expanding the function EXPRESSIONP, to:
T.
Case 6. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(NOT (EXPRESSIONP (CADDR X)))
(EXPRESSIONP (OPTIMIZE (CADR X)))
(EXPRESSIONP X))
(EXPRESSIONP (OPTIMIZE X))).
This simplifies, opening up EXPRESSIONP, to:
T.
Case 5. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EXPRESSIONP (OPTIMIZE (CADDR X)))
(EXPRESSIONP (OPTIMIZE (CADR X)))
(EXPRESSIONP X))
(EXPRESSIONP (OPTIMIZE X))).
This simplifies, unfolding the definitions of EXPRESSIONP and OPTIMIZE, to
the following three new conjectures:
Case 5.3.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EXPRESSIONP (OPTIMIZE (CADDR X)))
(EXPRESSIONP (OPTIMIZE (CADR X)))
(EXPRESSIONP (CADDR X))
(NOT (NUMBERP (OPTIMIZE (CADDR X)))))
(EXPRESSIONP (LIST (CAR X)
(OPTIMIZE (CADR X))
(OPTIMIZE (CADDR X))))).
This again simplifies, rewriting with CDR-CONS and CAR-CONS, and opening
up the function EXPRESSIONP, to:
T.
Case 5.2.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EXPRESSIONP (OPTIMIZE (CADDR X)))
(EXPRESSIONP (OPTIMIZE (CADR X)))
(EXPRESSIONP (CADDR X))
(NOT (NUMBERP (OPTIMIZE (CADR X)))))
(EXPRESSIONP (LIST (CAR X)
(OPTIMIZE (CADR X))
(OPTIMIZE (CADDR X))))).
However this again simplifies, rewriting with CDR-CONS and CAR-CONS, and
opening up EXPRESSIONP, to:
T.
Case 5.1.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EXPRESSIONP (OPTIMIZE (CADDR X)))
(EXPRESSIONP (OPTIMIZE (CADR X)))
(EXPRESSIONP (CADDR X))
(NUMBERP (OPTIMIZE (CADR X)))
(NUMBERP (OPTIMIZE (CADDR X))))
(EXPRESSIONP (CALL (CAR X)
(OPTIMIZE (CADR X))
(OPTIMIZE (CADDR X))))).
This again simplifies, opening up the definition of EXPRESSIONP, to:
T.
Case 4. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(NOT (EXPRESSIONP (CADR X)))
(EXPRESSIONP X))
(EXPRESSIONP (OPTIMIZE X))),
which simplifies, unfolding the function EXPRESSIONP, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(EXPRESSIONP X))
(EXPRESSIONP (OPTIMIZE X))),
which simplifies, expanding the definition of EXPRESSIONP, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(NOT (LISTP (CDR X)))
(EXPRESSIONP X))
(EXPRESSIONP (OPTIMIZE X))),
which simplifies, unfolding EXPRESSIONP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X)) (EXPRESSIONP X))
(EXPRESSIONP (OPTIMIZE X))),
which simplifies, rewriting with CDR-NLISTP, and expanding the functions
EXPRESSIONP, OPTIMIZE, CDR, and LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
FORMP-OPTIMIZE
(PROVE-LEMMA CORRECTNESS-OF-OPTIMIZE
(REWRITE)
(IMPLIES (EXPRESSIONP X)
(EQUAL (TERM-EVAL (OPTIMIZE X) ENVRN)
(TERM-EVAL X ENVRN))))
Name the conjecture *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 X) (LISTP (CAR X)))
(p X ENVRN))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(p (CADR X) ENVRN)
(p (CADDR X) ENVRN))
(p X ENVRN))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(NOT (EXPRESSIONP (CADR X)))
(p (CADR X) ENVRN))
(p X ENVRN))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(p X ENVRN))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(NOT (LISTP (CDR X))))
(p X ENVRN))
(IMPLIES (NOT (LISTP X))
(p X ENVRN))).
Linear arithmetic and the lemmas CAR-LESSP, CDR-LESSEQP, and 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 leads to the following seven new goals:
Case 7. (IMPLIES (AND (LISTP X)
(LISTP (CAR X))
(EXPRESSIONP X))
(EQUAL (TERM-EVAL (OPTIMIZE X) ENVRN)
(TERM-EVAL X ENVRN))).
This simplifies, expanding the definition of EXPRESSIONP, to:
T.
Case 6. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EQUAL (TERM-EVAL (OPTIMIZE (CADR X)) ENVRN)
(TERM-EVAL (CADR X) ENVRN))
(NOT (EXPRESSIONP (CADDR X)))
(EXPRESSIONP X))
(EQUAL (TERM-EVAL (OPTIMIZE X) ENVRN)
(TERM-EVAL X ENVRN))).
This simplifies, unfolding EXPRESSIONP, to:
T.
Case 5. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EQUAL (TERM-EVAL (OPTIMIZE (CADR X)) ENVRN)
(TERM-EVAL (CADR X) ENVRN))
(EQUAL (TERM-EVAL (OPTIMIZE (CADDR X)) ENVRN)
(TERM-EVAL (CADDR X) ENVRN))
(EXPRESSIONP X))
(EQUAL (TERM-EVAL (OPTIMIZE X) ENVRN)
(TERM-EVAL X ENVRN))).
This simplifies, unfolding the definitions of EXPRESSIONP, OPTIMIZE, and
TERM-EVAL, to the following three new goals:
Case 5.3.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EQUAL (TERM-EVAL (OPTIMIZE (CADR X)) ENVRN)
(TERM-EVAL (CADR X) ENVRN))
(EQUAL (TERM-EVAL (OPTIMIZE (CADDR X)) ENVRN)
(TERM-EVAL (CADDR X) ENVRN))
(EXPRESSIONP (CADDR X))
(NOT (NUMBERP (OPTIMIZE (CADDR X)))))
(EQUAL (TERM-EVAL (LIST (CAR X)
(OPTIMIZE (CADR X))
(OPTIMIZE (CADDR X)))
ENVRN)
(CALL (CAR X)
(TERM-EVAL (CADR X) ENVRN)
(TERM-EVAL (CADDR X) ENVRN)))).
This again simplifies, rewriting with CAR-CONS and CDR-CONS, and expanding
the definition of TERM-EVAL, to:
T.
Case 5.2.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EQUAL (TERM-EVAL (OPTIMIZE (CADR X)) ENVRN)
(TERM-EVAL (CADR X) ENVRN))
(EQUAL (TERM-EVAL (OPTIMIZE (CADDR X)) ENVRN)
(TERM-EVAL (CADDR X) ENVRN))
(EXPRESSIONP (CADDR X))
(NOT (NUMBERP (OPTIMIZE (CADR X)))))
(EQUAL (TERM-EVAL (LIST (CAR X)
(OPTIMIZE (CADR X))
(OPTIMIZE (CADDR X)))
ENVRN)
(CALL (CAR X)
(TERM-EVAL (CADR X) ENVRN)
(TERM-EVAL (CADDR X) ENVRN)))).
But this again simplifies, appealing to the lemmas CAR-CONS and CDR-CONS,
and unfolding the function TERM-EVAL, to:
T.
Case 5.1.
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EQUAL (TERM-EVAL (OPTIMIZE (CADR X)) ENVRN)
(TERM-EVAL (CADR X) ENVRN))
(EQUAL (TERM-EVAL (OPTIMIZE (CADDR X)) ENVRN)
(TERM-EVAL (CADDR X) ENVRN))
(EXPRESSIONP (CADDR X))
(NUMBERP (OPTIMIZE (CADR X)))
(NUMBERP (OPTIMIZE (CADDR X))))
(EQUAL (TERM-EVAL (CALL (CAR X)
(OPTIMIZE (CADR X))
(OPTIMIZE (CADDR X)))
ENVRN)
(CALL (CAR X)
(TERM-EVAL (CADR X) ENVRN)
(TERM-EVAL (CADDR X) ENVRN)))),
which again simplifies, unfolding TERM-EVAL, to:
T.
Case 4. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(NOT (EXPRESSIONP (CADR X)))
(EXPRESSIONP X))
(EQUAL (TERM-EVAL (OPTIMIZE X) ENVRN)
(TERM-EVAL X ENVRN))),
which simplifies, expanding the definition of EXPRESSIONP, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(EXPRESSIONP X))
(EQUAL (TERM-EVAL (OPTIMIZE X) ENVRN)
(TERM-EVAL X ENVRN))),
which simplifies, opening up the definition of EXPRESSIONP, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(NOT (LISTP (CDR X)))
(EXPRESSIONP X))
(EQUAL (TERM-EVAL (OPTIMIZE X) ENVRN)
(TERM-EVAL X ENVRN))),
which simplifies, unfolding EXPRESSIONP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X)) (EXPRESSIONP X))
(EQUAL (TERM-EVAL (OPTIMIZE X) ENVRN)
(TERM-EVAL X ENVRN))),
which simplifies, rewriting with CDR-NLISTP, and opening up EXPRESSIONP,
OPTIMIZE, CDR, LISTP, and TERM-EVAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
CORRECTNESS-OF-OPTIMIZE
(DEFN EXEC
(PC PDS ENVRN)
(IF (NLISTP PC)
PDS
(IF (LISTP (CAR PC))
(IF (EQUAL (CAAR PC) 'PUSHI)
(EXEC (CDR PC)
(PUSH (CADAR PC) PDS)
ENVRN)
(EXEC (CDR PC)
(PUSH (GETVALUE (CADAR PC) ENVRN) PDS)
ENVRN))
(EXEC (CDR PC)
(PUSH (CALL (CAR PC)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN))))
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the
definition of NLISTP can be used to establish that the measure (COUNT PC)
decreases according to the well-founded relation LESSP in each recursive call.
Hence, EXEC is accepted under the principle of definition. From the
definition we can conclude that:
(OR (STACKP (EXEC PC PDS ENVRN))
(EQUAL (EXEC PC PDS ENVRN) PDS))
is a theorem.
[ 0.0 0.0 0.0 ]
EXEC
(PROVE-LEMMA SEQUENTIAL-EXECUTION
(REWRITE)
(EQUAL (EXEC (APPEND X Y) PDS ENVRN)
(EXEC Y (EXEC X PDS ENVRN) ENVRN)))
Call the conjecture *1.
We will try to prove it by induction. There are three plausible
inductions. 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)
(p (CDR X)
Y
(PUSH (CALL (CAR X)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN)
(p (CDR X)
Y
(PUSH (GETVALUE (CADAR X) ENVRN) PDS)
ENVRN)
(p (CDR X)
Y
(PUSH (CADAR X) PDS)
ENVRN))
(p X Y PDS ENVRN))
(IMPLIES (NOT (LISTP X))
(p X Y PDS ENVRN))).
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. Note, however, the inductive instances chosen for PDS. The
above induction scheme generates two new goals:
Case 2. (IMPLIES (AND (LISTP X)
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (CALL (CAR X)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (CALL (CAR X)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN)
ENVRN))
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (GETVALUE (CADAR X) ENVRN) PDS)
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (GETVALUE (CADAR X) ENVRN) PDS)
ENVRN)
ENVRN))
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (CADAR X) PDS)
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (CADAR X) PDS)
ENVRN)
ENVRN)))
(EQUAL (EXEC (APPEND X Y) PDS ENVRN)
(EXEC Y (EXEC X PDS ENVRN) ENVRN))),
which simplifies, appealing to the lemmas CDR-CONS and CAR-CONS, and
unfolding APPEND and EXEC, to three new formulas:
Case 2.3.
(IMPLIES
(AND (LISTP X)
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (CALL (CAR X)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (CALL (CAR X)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN)
ENVRN))
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (GETVALUE (CADAR X) ENVRN) PDS)
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (GETVALUE (CADAR X) ENVRN) PDS)
ENVRN)
ENVRN))
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (CADAR X) PDS)
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (CADAR X) PDS)
ENVRN)
ENVRN))
(NOT (LISTP (CAR X))))
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (CALL (CAR X)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (CALL (CAR X)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN)
ENVRN))),
which again simplifies, clearly, to:
T.
Case 2.2.
(IMPLIES
(AND (LISTP X)
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (CALL (CAR X)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (CALL (CAR X)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN)
ENVRN))
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (GETVALUE (CADAR X) ENVRN) PDS)
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (GETVALUE (CADAR X) ENVRN) PDS)
ENVRN)
ENVRN))
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (CADAR X) PDS)
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (CADAR X) PDS)
ENVRN)
ENVRN))
(LISTP (CAR X))
(EQUAL (CAAR X) 'PUSHI))
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (CADAR X) PDS)
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (CADAR X) PDS)
ENVRN)
ENVRN))).
This again simplifies, trivially, to:
T.
Case 2.1.
(IMPLIES
(AND (LISTP X)
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (CALL (CAR X)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (CALL (CAR X)
(TOP (POP PDS))
(TOP PDS))
(POP (POP PDS)))
ENVRN)
ENVRN))
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (GETVALUE (CADAR X) ENVRN) PDS)
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (GETVALUE (CADAR X) ENVRN) PDS)
ENVRN)
ENVRN))
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (CADAR X) PDS)
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (CADAR X) PDS)
ENVRN)
ENVRN))
(LISTP (CAR X))
(NOT (EQUAL (CAAR X) 'PUSHI)))
(EQUAL (EXEC (APPEND (CDR X) Y)
(PUSH (GETVALUE (CADAR X) ENVRN) PDS)
ENVRN)
(EXEC Y
(EXEC (CDR X)
(PUSH (GETVALUE (CADAR X) ENVRN) PDS)
ENVRN)
ENVRN))).
This again simplifies, clearly, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (EXEC (APPEND X Y) PDS ENVRN)
(EXEC Y (EXEC X PDS ENVRN) ENVRN))).
This simplifies, opening up the functions APPEND and EXEC, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SEQUENTIAL-EXECUTION
(PROVE-LEMMA CORRECTNESS-OF-CODEGEN
(REWRITE)
(IMPLIES (EXPRESSIONP X)
(EQUAL (EXEC (REVERSE (CODEGEN X INS))
PDS ENVRN)
(PUSH (TERM-EVAL X ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))))
Call the conjecture *1.
We will appeal to induction. Four 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) (LISTP (CAR X)))
(p X INS PDS ENVRN))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(p (CADR X) INS PDS ENVRN)
(p (CADDR X)
(CODEGEN (CADR X) INS)
PDS ENVRN))
(p X INS PDS ENVRN))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(NOT (EXPRESSIONP (CADR X)))
(p (CADR X) INS PDS ENVRN))
(p X INS PDS ENVRN))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X))))
(p X INS PDS ENVRN))
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(NOT (LISTP (CDR X))))
(p X INS PDS ENVRN))
(IMPLIES (NOT (LISTP X))
(p X INS PDS ENVRN))).
Linear arithmetic and the lemmas CAR-LESSP, CDR-LESSEQP, and CDR-LESSP inform
us that the measure (COUNT X) decreases according to the well-founded relation
LESSP in each induction step of the scheme. Note, however, the inductive
instances chosen for INS. The above induction scheme leads to the following
seven new conjectures:
Case 7. (IMPLIES (AND (LISTP X)
(LISTP (CAR X))
(EXPRESSIONP X))
(EQUAL (EXEC (REVERSE (CODEGEN X INS))
PDS ENVRN)
(PUSH (TERM-EVAL X ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))).
This simplifies, unfolding the function EXPRESSIONP, to:
T.
Case 6. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EQUAL (EXEC (REVERSE (CODEGEN (CADR X) INS))
PDS ENVRN)
(PUSH (TERM-EVAL (CADR X) ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))
(NOT (EXPRESSIONP (CADDR X)))
(EXPRESSIONP X))
(EQUAL (EXEC (REVERSE (CODEGEN X INS))
PDS ENVRN)
(PUSH (TERM-EVAL X ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))).
This simplifies, expanding EXPRESSIONP, to:
T.
Case 5. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EQUAL (EXEC (REVERSE (CODEGEN (CADR X) INS))
PDS ENVRN)
(PUSH (TERM-EVAL (CADR X) ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))
(EQUAL (EXEC (REVERSE (CODEGEN (CADDR X)
(CODEGEN (CADR X) INS)))
PDS ENVRN)
(PUSH (TERM-EVAL (CADDR X) ENVRN)
(EXEC (REVERSE (CODEGEN (CADR X) INS))
PDS ENVRN)))
(EXPRESSIONP X))
(EQUAL (EXEC (REVERSE (CODEGEN X INS))
PDS ENVRN)
(PUSH (TERM-EVAL X ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))).
This simplifies, rewriting with CAR-CONS, CDR-CONS, SEQUENTIAL-EXECUTION,
TOP-PUSH, and PUSH-EQUAL, and opening up the functions EXPRESSIONP, CODEGEN,
REVERSE, EXEC, LISTP, and TERM-EVAL, to two new formulas:
Case 5.2.
(IMPLIES
(AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EQUAL (EXEC (REVERSE (CODEGEN (CADR X) INS))
PDS ENVRN)
(PUSH (TERM-EVAL (CADR X) ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))
(EQUAL (EXEC (REVERSE (CODEGEN (CADDR X)
(CODEGEN (CADR X) INS)))
PDS ENVRN)
(PUSH (TERM-EVAL (CADDR X) ENVRN)
(EXEC (REVERSE (CODEGEN (CADR X) INS))
PDS ENVRN)))
(EXPRESSIONP (CADDR X)))
(EQUAL
(CALL (CAR X)
(TOP (POP (EXEC (REVERSE (CODEGEN (CADDR X)
(CODEGEN (CADR X) INS)))
PDS ENVRN)))
(TOP (EXEC (REVERSE (CODEGEN (CADDR X)
(CODEGEN (CADR X) INS)))
PDS ENVRN)))
(CALL (CAR X)
(TERM-EVAL (CADR X) ENVRN)
(TERM-EVAL (CADDR X) ENVRN)))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS Z V) to eliminate
(CAR X) and (CDR X), V by (CONS D W) to eliminate (CDR V) and (CAR V), and
W by (CONS V C) to eliminate (CAR W) and (CDR W). We thus obtain:
(IMPLIES
(AND (NOT (LISTP Z))
(EXPRESSIONP D)
(EQUAL (EXEC (REVERSE (CODEGEN D INS))
PDS ENVRN)
(PUSH (TERM-EVAL D ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))
(EQUAL (EXEC (REVERSE (CODEGEN V (CODEGEN D INS)))
PDS ENVRN)
(PUSH (TERM-EVAL V ENVRN)
(EXEC (REVERSE (CODEGEN D INS))
PDS ENVRN)))
(EXPRESSIONP V))
(EQUAL (CALL Z
(TOP (POP (EXEC (REVERSE (CODEGEN V (CODEGEN D INS)))
PDS ENVRN)))
(TOP (EXEC (REVERSE (CODEGEN V (CODEGEN D INS)))
PDS ENVRN)))
(CALL Z
(TERM-EVAL D ENVRN)
(TERM-EVAL V ENVRN)))).
We use the first equality hypothesis by substituting:
(PUSH (TERM-EVAL D ENVRN)
(EXEC (REVERSE INS) PDS ENVRN))
for (EXEC (REVERSE (CODEGEN D INS)) PDS ENVRN) and throwing away the
equality. The result is the conjecture:
(IMPLIES
(AND (NOT (LISTP Z))
(EXPRESSIONP D)
(EQUAL (EXEC (REVERSE (CODEGEN V (CODEGEN D INS)))
PDS ENVRN)
(PUSH (TERM-EVAL V ENVRN)
(PUSH (TERM-EVAL D ENVRN)
(EXEC (REVERSE INS) PDS ENVRN))))
(EXPRESSIONP V))
(EQUAL (CALL Z
(TOP (POP (EXEC (REVERSE (CODEGEN V (CODEGEN D INS)))
PDS ENVRN)))
(TOP (EXEC (REVERSE (CODEGEN V (CODEGEN D INS)))
PDS ENVRN)))
(CALL Z
(TERM-EVAL D ENVRN)
(TERM-EVAL V ENVRN)))).
We use the above equality hypothesis by substituting:
(PUSH (TERM-EVAL V ENVRN)
(PUSH (TERM-EVAL D ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))
for (EXEC (REVERSE (CODEGEN V (CODEGEN D INS))) PDS ENVRN) and throwing
away the equality. This produces the new conjecture:
(IMPLIES
(AND (NOT (LISTP Z))
(EXPRESSIONP D)
(EXPRESSIONP V))
(EQUAL
(CALL Z
(TOP (POP (PUSH (TERM-EVAL V ENVRN)
(PUSH (TERM-EVAL D ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))))
(TOP (PUSH (TERM-EVAL V ENVRN)
(PUSH (TERM-EVAL D ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))))
(CALL Z
(TERM-EVAL D ENVRN)
(TERM-EVAL V ENVRN)))),
which further simplifies, applying POP-PUSH and TOP-PUSH, to:
T.
Case 5.1.
(IMPLIES
(AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(EXPRESSIONP (CADR X))
(EQUAL (EXEC (REVERSE (CODEGEN (CADR X) INS))
PDS ENVRN)
(PUSH (TERM-EVAL (CADR X) ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))
(EQUAL (EXEC (REVERSE (CODEGEN (CADDR X)
(CODEGEN (CADR X) INS)))
PDS ENVRN)
(PUSH (TERM-EVAL (CADDR X) ENVRN)
(EXEC (REVERSE (CODEGEN (CADR X) INS))
PDS ENVRN)))
(EXPRESSIONP (CADDR X)))
(EQUAL (POP (POP (EXEC (REVERSE (CODEGEN (CADDR X)
(CODEGEN (CADR X) INS)))
PDS ENVRN)))
(EXEC (REVERSE INS) PDS ENVRN))).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS Z V) to
eliminate (CAR X) and (CDR X), V by (CONS D W) to eliminate (CDR V) and
(CAR V), and W by (CONS V C) to eliminate (CAR W) and (CDR W). The result
is:
(IMPLIES (AND (NOT (LISTP Z))
(EXPRESSIONP D)
(EQUAL (EXEC (REVERSE (CODEGEN D INS))
PDS ENVRN)
(PUSH (TERM-EVAL D ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))
(EQUAL (EXEC (REVERSE (CODEGEN V (CODEGEN D INS)))
PDS ENVRN)
(PUSH (TERM-EVAL V ENVRN)
(EXEC (REVERSE (CODEGEN D INS))
PDS ENVRN)))
(EXPRESSIONP V))
(EQUAL (POP (POP (EXEC (REVERSE (CODEGEN V (CODEGEN D INS)))
PDS ENVRN)))
(EXEC (REVERSE INS) PDS ENVRN))).
We use the first equality hypothesis by substituting:
(PUSH (TERM-EVAL D ENVRN)
(EXEC (REVERSE INS) PDS ENVRN))
for (EXEC (REVERSE (CODEGEN D INS)) PDS ENVRN) and throwing away the
equality. This produces:
(IMPLIES (AND (NOT (LISTP Z))
(EXPRESSIONP D)
(EQUAL (EXEC (REVERSE (CODEGEN V (CODEGEN D INS)))
PDS ENVRN)
(PUSH (TERM-EVAL V ENVRN)
(PUSH (TERM-EVAL D ENVRN)
(EXEC (REVERSE INS) PDS ENVRN))))
(EXPRESSIONP V))
(EQUAL (POP (POP (EXEC (REVERSE (CODEGEN V (CODEGEN D INS)))
PDS ENVRN)))
(EXEC (REVERSE INS) PDS ENVRN))).
We use the above equality hypothesis by substituting:
(PUSH (TERM-EVAL V ENVRN)
(PUSH (TERM-EVAL D ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))
for (EXEC (REVERSE (CODEGEN V (CODEGEN D INS))) PDS ENVRN) and throwing
away the equality. This generates:
(IMPLIES
(AND (NOT (LISTP Z))
(EXPRESSIONP D)
(EXPRESSIONP V))
(EQUAL (POP (POP (PUSH (TERM-EVAL V ENVRN)
(PUSH (TERM-EVAL D ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))))
(EXEC (REVERSE INS) PDS ENVRN))).
This further simplifies, applying POP-PUSH, to:
T.
Case 4. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(LISTP (CDDR X))
(NOT (EXPRESSIONP (CADR X)))
(EXPRESSIONP X))
(EQUAL (EXEC (REVERSE (CODEGEN X INS))
PDS ENVRN)
(PUSH (TERM-EVAL X ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))).
This simplifies, expanding EXPRESSIONP, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(LISTP (CDR X))
(NOT (LISTP (CDDR X)))
(EXPRESSIONP X))
(EQUAL (EXEC (REVERSE (CODEGEN X INS))
PDS ENVRN)
(PUSH (TERM-EVAL X ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))).
This simplifies, expanding EXPRESSIONP, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CAR X)))
(NOT (LISTP (CDR X)))
(EXPRESSIONP X))
(EQUAL (EXEC (REVERSE (CODEGEN X INS))
PDS ENVRN)
(PUSH (TERM-EVAL X ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))).
This simplifies, opening up the definition of EXPRESSIONP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X)) (EXPRESSIONP X))
(EQUAL (EXEC (REVERSE (CODEGEN X INS))
PDS ENVRN)
(PUSH (TERM-EVAL X ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))).
This simplifies, applying CDR-NLISTP, and expanding the functions
EXPRESSIONP, CODEGEN, CDR, LISTP, and TERM-EVAL, to two new goals:
Case 1.2.
(IMPLIES (AND (NOT (LISTP X))
(NOT (NUMBERP X)))
(EQUAL (EXEC (REVERSE (CONS (LIST 'PUSHV X) INS))
PDS ENVRN)
(PUSH (GETVALUE X ENVRN)
(EXEC (REVERSE INS) PDS ENVRN)))),
which again simplifies, rewriting with CAR-CONS, CDR-CONS, and
SEQUENTIAL-EXECUTION, and unfolding the functions REVERSE, EQUAL, EXEC,
and LISTP, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LISTP X)) (NUMBERP X))
(EQUAL (EXEC (REVERSE (CONS (LIST 'PUSHI X) INS))
PDS ENVRN)
(PUSH X
(EXEC (REVERSE INS) PDS ENVRN)))).
However this again simplifies, appealing to the lemmas CAR-CONS, CDR-CONS,
and SEQUENTIAL-EXECUTION, and opening up the definitions of REVERSE, EQUAL,
EXEC, and LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
CORRECTNESS-OF-CODEGEN
(PROVE-LEMMA CORRECTNESS-OF-OPTIMIZING-COMPILER NIL
(IMPLIES (EXPRESSIONP X)
(EQUAL (EXEC (COMPILE X) PDS ENVRN)
(PUSH (TERM-EVAL X ENVRN) PDS))))
This conjecture can be simplified, using the abbreviations IMPLIES and COMPILE,
to:
(IMPLIES (EXPRESSIONP X)
(EQUAL (EXEC (REVERSE (CODEGEN (OPTIMIZE X) NIL))
PDS ENVRN)
(PUSH (TERM-EVAL X ENVRN) PDS))).
This simplifies, applying FORMP-OPTIMIZE, CORRECTNESS-OF-OPTIMIZE, and
CORRECTNESS-OF-CODEGEN, and expanding REVERSE, LISTP, and EXEC, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
CORRECTNESS-OF-OPTIMIZING-COMPILER
(PROVE-LEMMA TRANSITIVITY-OF-LESSP NIL
(IMPLIES (AND (LESSP X Y) (LESSP Y Z))
(LESSP X Z)))
This simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TRANSITIVITY-OF-LESSP
(PROVE-LEMMA LESSP-NOT-REFLEXIVE NIL
(NOT (LESSP X X)))
This conjecture simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LESSP-NOT-REFLEXIVE
(DEFN EQP
(X Y)
(EQUAL (FIX X) (FIX Y)))
Note that (OR (FALSEP (EQP X Y)) (TRUEP (EQP X Y))) is a theorem.
[ 0.0 0.0 0.0 ]
EQP
(PROVE-LEMMA TRICHOTOMY-OF-LESSP NIL
(IMPLIES (AND (NOT (EQP X Y))
(NOT (LESSP Y X)))
(LESSP X Y)))
This conjecture simplifies, using linear arithmetic, to the following three
new conjectures:
Case 3. (IMPLIES (AND (NOT (NUMBERP Y))
(NOT (EQP X Y))
(NOT (LESSP Y X)))
(LESSP X Y)).
However this again simplifies, expanding the definitions of EQP and LESSP,
to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP X))
(NOT (EQP X Y))
(NOT (LESSP Y X)))
(LESSP X Y)),
which again simplifies, unfolding the functions EQP and LESSP, to:
T.
Case 1. (IMPLIES (AND (NUMBERP X)
(NUMBERP Y)
(NOT (EQP X X))
(NOT (LESSP X X)))
(LESSP X X)),
which again simplifies, expanding the function EQP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TRICHOTOMY-OF-LESSP
(PROVE-LEMMA REVERSE-REVERSE
(REWRITE)
(IMPLIES (PLISTP X)
(EQUAL (REVERSE (REVERSE X)) X)))
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 (NLISTP X) (p X))
(IMPLIES (AND (NOT (NLISTP X)) (p (CDR X)))
(p X))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP 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 three new conjectures:
Case 3. (IMPLIES (AND (NLISTP X) (PLISTP X))
(EQUAL (REVERSE (REVERSE X)) X)),
which simplifies, expanding the functions NLISTP, PLISTP, REVERSE, and EQUAL,
to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP X))
(NOT (PLISTP (CDR X)))
(PLISTP X))
(EQUAL (REVERSE (REVERSE X)) X)),
which simplifies, opening up the functions NLISTP and PLISTP, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP X))
(EQUAL (REVERSE (REVERSE (CDR X)))
(CDR X))
(PLISTP X))
(EQUAL (REVERSE (REVERSE X)) X)),
which simplifies, applying the lemmas CAR-CONS, CDR-CONS, CONS-CAR-CDR, and
APPEND-REVERSE, and opening up NLISTP, PLISTP, REVERSE, APPEND, and LISTP,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
REVERSE-REVERSE
(DEFN FLATTEN
(X)
(IF (LISTP X)
(APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(CONS X NIL)))
Linear arithmetic and the lemmas CDR-LESSP and CAR-LESSP inform us that
the measure (COUNT X) decreases according to the well-founded relation LESSP
in each recursive call. Hence, FLATTEN is accepted under the principle of
definition. Note that (LISTP (FLATTEN X)) is a theorem.
[ 0.0 0.0 0.0 ]
FLATTEN
(DEFN MC-FLATTEN
(X Y)
(IF (LISTP X)
(MC-FLATTEN (CAR X)
(MC-FLATTEN (CDR X) Y))
(CONS X Y)))
Linear arithmetic and the lemmas CAR-LESSP and CDR-LESSP can be used to
show that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, MC-FLATTEN is accepted under
the definitional principle. From the definition we can conclude that
(LISTP (MC-FLATTEN X Y)) is a theorem.
[ 0.0 0.0 0.0 ]
MC-FLATTEN
(PROVE-LEMMA FLATTEN-MC-FLATTEN
(REWRITE)
(EQUAL (MC-FLATTEN X Y)
(APPEND (FLATTEN X) Y)))
Name the conjecture *1.
Perhaps we can 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)
(p (CAR X) (MC-FLATTEN (CDR X) Y))
(p (CDR X) Y))
(p X Y))
(IMPLIES (NOT (LISTP X)) (p X Y))).
Linear arithmetic and the lemmas CAR-LESSP and CDR-LESSP establish that the
measure (COUNT X) decreases according to the well-founded relation LESSP in
each induction step of the scheme. Note, however, the inductive instances
chosen for Y. The above induction scheme produces the following two new goals:
Case 2. (IMPLIES (AND (LISTP X)
(EQUAL (MC-FLATTEN (CAR X)
(MC-FLATTEN (CDR X) Y))
(APPEND (FLATTEN (CAR X))
(MC-FLATTEN (CDR X) Y)))
(EQUAL (MC-FLATTEN (CDR X) Y)
(APPEND (FLATTEN (CDR X)) Y)))
(EQUAL (MC-FLATTEN X Y)
(APPEND (FLATTEN X) Y))).
This simplifies, applying ASSOCIATIVITY-OF-APPEND, and unfolding the
definitions of MC-FLATTEN and FLATTEN, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (MC-FLATTEN X Y)
(APPEND (FLATTEN X) Y))),
which simplifies, rewriting with CDR-CONS and CAR-CONS, and expanding the
definitions of MC-FLATTEN, FLATTEN, APPEND, and LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
FLATTEN-MC-FLATTEN
(PROVE-LEMMA MEMBER-APPEND
(REWRITE)
(EQUAL (MEMBER X (APPEND A B))
(OR (MEMBER X A) (MEMBER X B))))
This simplifies, opening up the function OR, to two new conjectures:
Case 2. (IMPLIES (NOT (MEMBER X A))
(EQUAL (MEMBER X (APPEND A B))
(MEMBER X B))),
which we will name *1.
Case 1. (IMPLIES (MEMBER X A)
(EQUAL (MEMBER X (APPEND A B)) T)).
This again simplifies, trivially, to the new formula:
(IMPLIES (MEMBER X A)
(MEMBER X (APPEND A B))),
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 X (APPEND A B))
(OR (MEMBER X A) (MEMBER X B))).
We named this *1. We will try to prove it by induction. There are three
plausible inductions. They merge into two likely candidate inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (AND (LISTP A) (p X (CDR A) B))
(p X A B))
(IMPLIES (NOT (LISTP A)) (p X A B))).
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 generates two new conjectures:
Case 2. (IMPLIES (AND (LISTP A)
(EQUAL (MEMBER X (APPEND (CDR A) B))
(OR (MEMBER X (CDR A)) (MEMBER X B))))
(EQUAL (MEMBER X (APPEND A B))
(OR (MEMBER X A) (MEMBER X B)))),
which simplifies, applying CDR-CONS and CAR-CONS, and unfolding OR, APPEND,
MEMBER, and EQUAL, to:
T.
Case 1. (IMPLIES (NOT (LISTP A))
(EQUAL (MEMBER X (APPEND A B))
(OR (MEMBER X A) (MEMBER X B)))).
This simplifies, expanding the functions APPEND, MEMBER, and OR, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MEMBER-APPEND
(PROVE-LEMMA MEMBER-REVERSE
(REWRITE)
(EQUAL (MEMBER X (REVERSE Y))
(MEMBER X Y)))
Name the conjecture *1.
Perhaps we can 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 Y) (p X (CDR Y)))
(p X Y))
(IMPLIES (NOT (LISTP Y)) (p X Y))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT Y)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces the following two new
goals:
Case 2. (IMPLIES (AND (LISTP Y)
(EQUAL (MEMBER X (REVERSE (CDR Y)))
(MEMBER X (CDR Y))))
(EQUAL (MEMBER X (REVERSE Y))
(MEMBER X Y))).
This simplifies, applying CDR-CONS, CAR-CONS, and MEMBER-APPEND, and
unfolding the definitions of REVERSE, MEMBER, and LISTP, to three new
formulas:
Case 2.3.
(IMPLIES (AND (LISTP Y)
(EQUAL (MEMBER X (REVERSE (CDR Y)))
(MEMBER X (CDR Y)))
(NOT (EQUAL X (CAR Y)))
(NOT (MEMBER X (CDR Y))))
(EQUAL (EQUAL X (CAR Y))
(MEMBER X (CDR Y)))),
which again simplifies, clearly, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP Y)
(EQUAL (MEMBER X (REVERSE (CDR Y)))
(MEMBER X (CDR Y)))
(NOT (EQUAL X (CAR Y)))
(MEMBER X (CDR Y)))
(EQUAL T (MEMBER X (CDR Y)))).
This again simplifies, clearly, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP Y)
(EQUAL (MEMBER X (REVERSE (CDR Y)))
(MEMBER X (CDR Y)))
(EQUAL X (CAR Y))
(NOT (MEMBER X (CDR Y))))
(EQUAL (EQUAL X (CAR Y)) T)).
But this again simplifies, unfolding EQUAL, to:
T.
Case 1. (IMPLIES (NOT (LISTP Y))
(EQUAL (MEMBER X (REVERSE Y))
(MEMBER X Y))),
which simplifies, opening up the functions REVERSE, LISTP, MEMBER, and EQUAL,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MEMBER-REVERSE
(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
(PROVE-LEMMA LENGTH-REVERSE
(REWRITE)
(EQUAL (LENGTH (REVERSE X))
(LENGTH X)))
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) (p (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 two new
conjectures:
Case 2. (IMPLIES (AND (LISTP X)
(EQUAL (LENGTH (REVERSE (CDR X)))
(LENGTH (CDR X))))
(EQUAL (LENGTH (REVERSE X))
(LENGTH X))).
This simplifies, expanding the functions REVERSE and LENGTH, to the new goal:
(IMPLIES (AND (LISTP X)
(EQUAL (LENGTH (REVERSE (CDR X)))
(LENGTH (CDR X))))
(EQUAL (LENGTH (APPEND (REVERSE (CDR X))
(LIST (CAR X))))
(ADD1 (LENGTH (CDR X))))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS V Z) to eliminate
(CDR X) and (CAR X). This produces:
(IMPLIES (EQUAL (LENGTH (REVERSE Z))
(LENGTH Z))
(EQUAL (LENGTH (APPEND (REVERSE Z) (LIST V)))
(ADD1 (LENGTH Z)))).
We use the above equality hypothesis by substituting (LENGTH (REVERSE Z))
for (LENGTH Z) and throwing away the equality. We must thus prove:
(EQUAL (LENGTH (APPEND (REVERSE Z) (LIST V)))
(ADD1 (LENGTH (REVERSE Z)))).
We will try to prove the above formula by generalizing it, replacing
(REVERSE Z) by Y. We restrict the new variable by recalling PLISTP-REVERSE.
This produces the new conjecture:
(IMPLIES (PLISTP Y)
(EQUAL (LENGTH (APPEND Y (LIST V)))
(ADD1 (LENGTH Y)))),
which we will name *1.1.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (LENGTH (REVERSE X))
(LENGTH X))).
This simplifies, opening up REVERSE, LENGTH, and EQUAL, to:
T.
So next consider:
(IMPLIES (PLISTP Y)
(EQUAL (LENGTH (APPEND Y (LIST V)))
(ADD1 (LENGTH Y)))),
which we named *1.1 above. 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 (NLISTP Y) (p Y V))
(IMPLIES (AND (NOT (NLISTP Y)) (p (CDR Y) V))
(p Y V))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP establish that the measure (COUNT Y) 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 formulas:
Case 3. (IMPLIES (AND (NLISTP Y) (PLISTP Y))
(EQUAL (LENGTH (APPEND Y (LIST V)))
(ADD1 (LENGTH Y)))).
This simplifies, applying the lemma CDR-CONS, and expanding the functions
NLISTP, PLISTP, LISTP, APPEND, ADD1, LENGTH, and EQUAL, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP Y))
(NOT (PLISTP (CDR Y)))
(PLISTP Y))
(EQUAL (LENGTH (APPEND Y (LIST V)))
(ADD1 (LENGTH Y)))).
This simplifies, unfolding NLISTP and PLISTP, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP Y))
(EQUAL (LENGTH (APPEND (CDR Y) (LIST V)))
(ADD1 (LENGTH (CDR Y))))
(PLISTP Y))
(EQUAL (LENGTH (APPEND Y (LIST V)))
(ADD1 (LENGTH Y)))).
This simplifies, applying CDR-CONS, and opening up NLISTP, PLISTP, APPEND,
and LENGTH, to:
T.
That finishes the proof of *1.1, which, in turn, finishes the proof of *1.
Q.E.D.
[ 0.0 0.0 0.0 ]
LENGTH-REVERSE
(DEFN INTERSECT
(X Y)
(FOR X1 IN X WHEN
(MEMBER X1 Y)
COLLECT X1))
[ 0.0 0.0 0.0 ]
INTERSECT
(PROVE-LEMMA MEMBER-INTERSECT
(REWRITE)
(IMPLIES (LITATOM V)
(EQUAL (MEMBER A
(FOR V LST P 'COLLECT V ALIST))
(AND (MEMBER A LST)
(EVAL$ T P (CONS (CONS V A) ALIST)))))
((ENABLE EVAL$)))
This conjecture simplifies, opening up the function AND, to three new formulas:
Case 3. (IMPLIES (AND (LITATOM V)
(NOT (EVAL$ T P (CONS (CONS V A) ALIST))))
(EQUAL (MEMBER A
(FOR V LST P 'COLLECT V ALIST))
F)),
which again simplifies, trivially, to the new goal:
(IMPLIES (AND (LITATOM V)
(NOT (EVAL$ T P (CONS (CONS V A) ALIST))))
(NOT (MEMBER A
(FOR V LST P 'COLLECT V ALIST)))),
which we will name *1.
Case 2. (IMPLIES (AND (LITATOM V) (NOT (MEMBER A LST)))
(EQUAL (MEMBER A
(FOR V LST P 'COLLECT V ALIST))
F)).
This again simplifies, trivially, to:
(IMPLIES (AND (LITATOM V) (NOT (MEMBER A LST)))
(NOT (MEMBER A
(FOR V LST P 'COLLECT V ALIST)))),
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 (LITATOM V)
(EQUAL (MEMBER A
(FOR V LST P 'COLLECT V ALIST))
(AND (MEMBER A LST)
(EVAL$ T P
(CONS (CONS V A) ALIST))))).
We named this *1. We will try to prove it by 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 LST)
(p A V LST P ALIST))
(IMPLIES (AND (NOT (NLISTP LST))
(EVAL$ T P
(CONS (CONS V (CAR LST)) ALIST))
(p A V (CDR LST) P ALIST))
(p A V LST P ALIST))
(IMPLIES (AND (NOT (NLISTP LST))
(NOT (EVAL$ T P
(CONS (CONS V (CAR LST)) ALIST)))
(p A V (CDR LST) P ALIST))
(p A V LST P ALIST))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP 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 leads to three new goals:
Case 3. (IMPLIES (AND (NLISTP LST) (LITATOM V))
(EQUAL (MEMBER A
(FOR V LST P 'COLLECT V ALIST))
(AND (MEMBER A LST)
(EVAL$ T P
(CONS (CONS V A) ALIST))))),
which simplifies, opening up the functions NLISTP, FOR,
QUANTIFIER-INITIAL-VALUE, LISTP, MEMBER, AND, and EQUAL, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP LST))
(EVAL$ T P
(CONS (CONS V (CAR LST)) ALIST))
(EQUAL (MEMBER A
(FOR V (CDR LST) P 'COLLECT V ALIST))
(AND (MEMBER A (CDR LST))
(EVAL$ T P (CONS (CONS V A) ALIST))))
(LITATOM V))
(EQUAL (MEMBER A
(FOR V LST P 'COLLECT V ALIST))
(AND (MEMBER A LST)
(EVAL$ T P
(CONS (CONS V A) ALIST))))),
which simplifies, applying CDR-CONS and CAR-CONS, and opening up NLISTP, AND,
FOR, ASSOC, EQUAL, EVAL$, QUANTIFIER-OPERATION, and MEMBER, to the following
two new goals:
Case 2.2.
(IMPLIES (AND (LISTP LST)
(EVAL$ T P
(CONS (CONS V (CAR LST)) ALIST))
(NOT (EVAL$ T P (CONS (CONS V A) ALIST)))
(EQUAL (MEMBER A
(FOR V (CDR LST) P 'COLLECT V ALIST))
F)
(LITATOM V))
(NOT (EQUAL A (CAR LST)))).
This again simplifies, trivially, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP LST)
(EVAL$ T P
(CONS (CONS V (CAR LST)) ALIST))
(NOT (MEMBER A (CDR LST)))
(EQUAL (MEMBER A
(FOR V (CDR LST) P 'COLLECT V ALIST))
F)
(LITATOM V)
(EQUAL A (CAR LST)))
(EVAL$ T P (CONS (CONS V A) ALIST))).
This again simplifies, trivially, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP LST))
(NOT (EVAL$ T P
(CONS (CONS V (CAR LST)) ALIST)))
(EQUAL (MEMBER A
(FOR V (CDR LST) P 'COLLECT V ALIST))
(AND (MEMBER A (CDR LST))
(EVAL$ T P (CONS (CONS V A) ALIST))))
(LITATOM V))
(EQUAL (MEMBER A
(FOR V LST P 'COLLECT V ALIST))
(AND (MEMBER A LST)
(EVAL$ T P
(CONS (CONS V A) ALIST))))).
This simplifies, unfolding NLISTP, AND, FOR, MEMBER, and EQUAL, to the new
conjecture:
(IMPLIES (AND (LISTP LST)
(NOT (EVAL$ T P
(CONS (CONS V (CAR LST)) ALIST)))
(NOT (MEMBER A (CDR LST)))
(EQUAL (MEMBER A
(FOR V (CDR LST) P 'COLLECT V ALIST))
F)
(LITATOM V)
(EQUAL A (CAR LST)))
(NOT (EVAL$ T P (CONS (CONS V A) ALIST)))),
which again simplifies, clearly, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
MEMBER-INTERSECT
(PROVE-LEMMA MEMBER-UNION NIL
(EQUAL (MEMBER A (UNION B C))
(OR (MEMBER A B) (MEMBER A C))))
This simplifies, opening up the function OR, to two new conjectures:
Case 2. (IMPLIES (NOT (MEMBER A B))
(EQUAL (MEMBER A (UNION B C))
(MEMBER A C))),
which we will name *1.
Case 1. (IMPLIES (MEMBER A B)
(EQUAL (MEMBER A (UNION B C)) T)).
This again simplifies, trivially, to the new formula:
(IMPLIES (MEMBER A B)
(MEMBER A (UNION 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 (UNION B C))
(OR (MEMBER A B) (MEMBER A C))).
We named this *1. We will try to prove it by induction. There are three
plausible inductions. They merge into two likely candidate inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (AND (LISTP B)
(MEMBER (CAR B) C)
(p A (CDR B) C))
(p A B C))
(IMPLIES (AND (LISTP B)
(NOT (MEMBER (CAR B) C))
(p A (CDR B) C))
(p A B C))
(IMPLIES (NOT (LISTP B)) (p A B C))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT B)
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 B)
(MEMBER (CAR B) C)
(EQUAL (MEMBER A (UNION (CDR B) C))
(OR (MEMBER A (CDR B)) (MEMBER A C))))
(EQUAL (MEMBER A (UNION B C))
(OR (MEMBER A B) (MEMBER A C)))),
which simplifies, expanding OR, UNION, MEMBER, and EQUAL, to:
(IMPLIES (AND (LISTP B)
(MEMBER (CAR B) C)
(NOT (MEMBER A (CDR B)))
(EQUAL (MEMBER A (UNION (CDR B) C))
(MEMBER A C))
(EQUAL A (CAR B)))
(EQUAL (MEMBER A C) T)).
This again simplifies, trivially, to:
T.
Case 2. (IMPLIES (AND (LISTP B)
(NOT (MEMBER (CAR B) C))
(EQUAL (MEMBER A (UNION (CDR B) C))
(OR (MEMBER A (CDR B)) (MEMBER A C))))
(EQUAL (MEMBER A (UNION B C))
(OR (MEMBER A B) (MEMBER A C)))).
This simplifies, appealing to the lemmas CDR-CONS and CAR-CONS, and
expanding the functions OR, UNION, MEMBER, and EQUAL, to:
T.
Case 1. (IMPLIES (NOT (LISTP B))
(EQUAL (MEMBER A (UNION B C))
(OR (MEMBER A B) (MEMBER A C)))).
This simplifies, opening up the functions UNION, MEMBER, and OR, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MEMBER-UNION
(DEFN SUBSETP
(X Y)
(IF (LISTP X)
(IF (MEMBER (CAR X) Y)
(SUBSETP (CDR X) Y)
F)
T))
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, SUBSETP is accepted under the definitional principle.
Note that (OR (FALSEP (SUBSETP X Y)) (TRUEP (SUBSETP X Y))) is a theorem.
[ 0.0 0.0 0.0 ]
SUBSETP
(PROVE-LEMMA SUBSETP-UNION NIL
(IMPLIES (SUBSETP A B)
(EQUAL (UNION A B) B)))
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 A)
(MEMBER (CAR A) B)
(p (CDR A) B))
(p A B))
(IMPLIES (AND (LISTP A)
(NOT (MEMBER (CAR A) B))
(p (CDR A) B))
(p A B))
(IMPLIES (NOT (LISTP A)) (p A B))).
Linear arithmetic and the lemma CDR-LESSP 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 five new conjectures:
Case 5. (IMPLIES (AND (LISTP A)
(MEMBER (CAR A) B)
(NOT (SUBSETP (CDR A) B))
(SUBSETP A B))
(EQUAL (UNION A B) B)),
which simplifies, expanding the function SUBSETP, to:
T.
Case 4. (IMPLIES (AND (LISTP A)
(MEMBER (CAR A) B)
(EQUAL (UNION (CDR A) B) B)
(SUBSETP A B))
(EQUAL (UNION A B) B)),
which simplifies, opening up the functions SUBSETP and UNION, to:
T.
Case 3. (IMPLIES (AND (LISTP A)
(NOT (MEMBER (CAR A) B))
(NOT (SUBSETP (CDR A) B))
(SUBSETP A B))
(EQUAL (UNION A B) B)),
which simplifies, opening up the definition of SUBSETP, to:
T.
Case 2. (IMPLIES (AND (LISTP A)
(NOT (MEMBER (CAR A) B))
(EQUAL (UNION (CDR A) B) B)
(SUBSETP A B))
(EQUAL (UNION A B) B)),
which simplifies, opening up the function SUBSETP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP A)) (SUBSETP A B))
(EQUAL (UNION A B) B)),
which simplifies, expanding SUBSETP and UNION, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUBSETP-UNION
(PROVE-LEMMA SUBSETP-INTERSECT NIL
(IMPLIES (AND (PLISTP A) (SUBSETP A B))
(EQUAL (INTERSECT A B) A)))
This formula can be simplified, using the abbreviations AND, IMPLIES, and
INTERSECT, to the new conjecture:
(IMPLIES (AND (PLISTP A) (SUBSETP A B))
(EQUAL (FOR 'X1
A
'(MEMBER X1 Y)
'COLLECT
'X1
(LIST (CONS 'Y B)))
A)),
which simplifies, unfolding the function EVAL$, to:
(IMPLIES (AND (PLISTP A) (SUBSETP A B))
(EQUAL (FOR X1 IN A WHEN
(MEMBER X1 B)
COLLECT X1)
A)).
Call the above conjecture *1.
Perhaps we can prove it by induction. 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 (NLISTP A) (p A B))
(IMPLIES (AND (NOT (NLISTP A)) (p (CDR A) B))
(p A B))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP 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 generates the following four new conjectures:
Case 4. (IMPLIES (AND (NLISTP A)
(PLISTP A)
(SUBSETP A B))
(EQUAL (FOR X1 IN A WHEN
(MEMBER X1 B)
COLLECT X1)
A)).
This simplifies, opening up NLISTP, PLISTP, LISTP, SUBSETP, MEMBER, FOR, CDR,
ASSOC, QUANTIFIER-INITIAL-VALUE, and EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP A))
(NOT (PLISTP (CDR A)))
(PLISTP A)
(SUBSETP A B))
(EQUAL (FOR X1 IN A WHEN
(MEMBER X1 B)
COLLECT X1)
A)).
This simplifies, unfolding the functions NLISTP and PLISTP, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP A))
(NOT (SUBSETP (CDR A) B))
(PLISTP A)
(SUBSETP A B))
(EQUAL (FOR X1 IN A WHEN
(MEMBER X1 B)
COLLECT X1)
A)).
This simplifies, opening up NLISTP, PLISTP, and SUBSETP, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP A))
(EQUAL (FOR X1 IN
(CDR A)
WHEN
(MEMBER X1 B)
COLLECT X1)
(CDR A))
(PLISTP A)
(SUBSETP A B))
(EQUAL (FOR X1 IN A WHEN
(MEMBER X1 B)
COLLECT X1)
A)).
This simplifies, appealing to the lemmas REWRITE-EVAL$ and CONS-CAR-CDR, and
unfolding the functions NLISTP, PLISTP, SUBSETP, EVAL$, FOR, EQUAL, and
QUANTIFIER-OPERATION, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUBSETP-INTERSECT
(DEFN NTH
(X N)
(IF (ZEROP N)
X
(NTH (CDR X) (SUB1 N))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
inform us that the measure (COUNT N) decreases according to the well-founded
relation LESSP in each recursive call. Hence, NTH is accepted under the
principle of definition.
[ 0.0 0.0 0.0 ]
NTH
(DEFN GREATEREQP
(X Y)
(NOT (LESSP X Y)))
Note that (OR (FALSEP (GREATEREQP X Y)) (TRUEP (GREATEREQP X Y))) is a
theorem.
[ 0.0 0.0 0.0 ]
GREATEREQP
(PROVE-LEMMA TRANSITIVITY-OF-LEQ NIL
(IMPLIES (AND (LEQ X Y) (LEQ Y Z))
(LEQ X Z)))
This formula simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TRANSITIVITY-OF-LEQ
(DEFN ORDERED
(L)
(IF (LISTP L)
(IF (LISTP (CDR L))
(IF (LESSP (CADR L) (CAR L))
F
(ORDERED (CDR L)))
T)
T))
Linear arithmetic and the lemma CDR-LESSP can be used to prove that the
measure (COUNT L) decreases according to the well-founded relation LESSP in
each recursive call. Hence, ORDERED is accepted under the principle of
definition. Observe that (OR (FALSEP (ORDERED L)) (TRUEP (ORDERED L))) is a
theorem.
[ 0.0 0.0 0.0 ]
ORDERED
(DEFN ADDTOLIST
(X L)
(IF (LISTP L)
(IF (LESSP X (CAR L))
(CONS X L)
(CONS (CAR L) (ADDTOLIST X (CDR L))))
(CONS X NIL)))
Linear arithmetic and the lemma CDR-LESSP can be used to show that the
measure (COUNT L) decreases according to the well-founded relation LESSP in
each recursive call. Hence, ADDTOLIST is accepted under the definitional
principle. Note that (LISTP (ADDTOLIST X L)) is a theorem.
[ 0.0 0.0 0.0 ]
ADDTOLIST
(DEFN SORT
(L)
(IF (LISTP L)
(ADDTOLIST (CAR L) (SORT (CDR L)))
NIL))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT L) decreases according to the well-founded relation LESSP in each
recursive call. Hence, SORT is accepted under the definitional principle.
From the definition we can conclude that:
(OR (LITATOM (SORT L))
(LISTP (SORT L)))
is a theorem.
[ 0.0 0.0 0.0 ]
SORT
(DEFN BOOLEAN
(X)
(OR (EQUAL X T) (EQUAL X F)))
Observe that (OR (FALSEP (BOOLEAN X)) (TRUEP (BOOLEAN X))) is a theorem.
[ 0.0 0.0 0.0 ]
BOOLEAN
(PROVE-LEMMA IFF-EQUAL-EQUAL NIL
(IMPLIES (AND (BOOLEAN P) (BOOLEAN Q))
(EQUAL (IFF P Q) (EQUAL P Q))))
This conjecture simplifies, expanding the definitions of BOOLEAN, IFF, and
EQUAL, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
IFF-EQUAL-EQUAL
(PROVE-LEMMA NTH-0
(REWRITE)
(EQUAL (NTH 0 I) 0))
Call the conjecture *1.
We will try to prove it by induction. There is only one suggested
induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP I) (p I))
(IMPLIES (AND (NOT (ZEROP I)) (p (SUB1 I)))
(p I))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be
used to establish that the measure (COUNT I) 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 (ZEROP I)
(EQUAL (NTH 0 I) 0)).
This simplifies, expanding the definitions of ZEROP, NTH, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP I))
(EQUAL (NTH 0 (SUB1 I)) 0))
(EQUAL (NTH 0 I) 0)).
This simplifies, opening up the functions ZEROP, NTH, CDR, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NTH-0
(PROVE-LEMMA NTH-NIL
(REWRITE)
(EQUAL (NTH NIL I)
(IF (ZEROP I) NIL 0)))
This simplifies, appealing to the lemma NTH-0, and opening up the definitions
of CDR, NTH, and ZEROP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
NTH-NIL
(PROVE-LEMMA NTH-APPEND1
(REWRITE)
(EQUAL (NTH A (PLUS I J))
(NTH (NTH A I) J)))
Call the conjecture *1.
Perhaps we can prove it by induction. Three 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 (ZEROP I) (p A I J))
(IMPLIES (AND (NOT (ZEROP I))
(p (CDR A) (SUB1 I) J))
(p A I J))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definition
of ZEROP can be used to prove that the measure (COUNT I) decreases according
to the well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instance chosen for A. The above induction scheme
leads to two new goals:
Case 2. (IMPLIES (ZEROP I)
(EQUAL (NTH A (PLUS I J))
(NTH (NTH A I) J))),
which simplifies, opening up the definitions of ZEROP, EQUAL, PLUS, and NTH,
to two new conjectures:
Case 2.2.
(IMPLIES (AND (EQUAL I 0) (NOT (NUMBERP J)))
(EQUAL (NTH A 0) (NTH A J))),
which again simplifies, unfolding the functions EQUAL and NTH, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (NUMBERP I))
(NOT (NUMBERP J)))
(EQUAL (NTH A 0) (NTH A J))),
which again simplifies, opening up the functions EQUAL and NTH, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP I))
(EQUAL (NTH (CDR A) (PLUS (SUB1 I) J))
(NTH (NTH (CDR A) (SUB1 I)) J)))
(EQUAL (NTH A (PLUS I J))
(NTH (NTH A I) J))),
which simplifies, applying the lemma SUB1-ADD1, and opening up ZEROP, PLUS,
and NTH, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NTH-APPEND1
(PROVE-LEMMA ASSOCIATIVITY-OF-EQUAL NIL
(IMPLIES (AND (BOOLEAN A)
(AND (BOOLEAN B) (BOOLEAN C)))
(EQUAL (EQUAL (EQUAL A B) C)
(EQUAL A (EQUAL B C)))))
This conjecture simplifies, opening up BOOLEAN and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
ASSOCIATIVITY-OF-EQUAL
(DEFN ODD
(X)
(IF (ZEROP X)
F
(IF (ZEROP (SUB1 X))
T
(ODD (SUB1 (SUB1 X))))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, ODD is accepted under the
principle of definition. From the definition we can conclude that:
(OR (FALSEP (ODD X)) (TRUEP (ODD X)))
is a theorem.
[ 0.0 0.0 0.0 ]
ODD
(DEFN EVEN1
(X)
(IF (ZEROP X) T (ODD (SUB1 X))))
From the definition we can conclude that:
(OR (FALSEP (EVEN1 X))
(TRUEP (EVEN1 X)))
is a theorem.
[ 0.0 0.0 0.0 ]
EVEN1
(DEFN EVEN2
(X)
(IF (ZEROP X)
T
(IF (ZEROP (SUB1 X))
F
(EVEN2 (SUB1 (SUB1 X))))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, EVEN2 is accepted under the
principle of definition. From the definition we can conclude that:
(OR (FALSEP (EVEN2 X))
(TRUEP (EVEN2 X)))
is a theorem.
[ 0.0 0.0 0.0 ]
EVEN2
(DEFN DOUBLE
(I)
(IF (ZEROP I)
0
(ADD1 (ADD1 (DOUBLE (SUB1 I))))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT I) decreases according to the well-founded
relation LESSP in each recursive call. Hence, DOUBLE is accepted under the
principle of definition. Observe that (NUMBERP (DOUBLE I)) is a theorem.
[ 0.0 0.0 0.0 ]
DOUBLE
(PROVE-LEMMA EVEN1-DOUBLE
(REWRITE)
(EVEN1 (DOUBLE I)))
WARNING: Note that the rewrite rule EVEN1-DOUBLE will be stored so as to
apply only to terms with the nonrecursive function symbol EVEN1.
This conjecture can be simplified, using the abbreviation EVEN1, to the goal:
(IMPLIES (AND (NOT (EQUAL (DOUBLE I) 0))
(NUMBERP (DOUBLE I)))
(ODD (SUB1 (DOUBLE I)))).
This simplifies, trivially, to:
(IMPLIES (NOT (EQUAL (DOUBLE I) 0))
(ODD (SUB1 (DOUBLE I)))),
which we will name *1.
Perhaps we can 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 (ZEROP I) (p I))
(IMPLIES (AND (NOT (ZEROP I)) (p (SUB1 I)))
(p I))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform
us that the measure (COUNT I) 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 (ZEROP I)
(NOT (EQUAL (DOUBLE I) 0)))
(ODD (SUB1 (DOUBLE I)))).
This simplifies, expanding the definitions of ZEROP, DOUBLE, and EQUAL, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP I))
(EQUAL (DOUBLE (SUB1 I)) 0)
(NOT (EQUAL (DOUBLE I) 0)))
(ODD (SUB1 (DOUBLE I)))).
This simplifies, opening up the functions ZEROP, DOUBLE, ADD1, EQUAL, SUB1,
and ODD, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP I))
(ODD (SUB1 (DOUBLE (SUB1 I))))
(NOT (EQUAL (DOUBLE I) 0)))
(ODD (SUB1 (DOUBLE I)))).
This simplifies, applying SUB1-ADD1, and unfolding the definitions of ZEROP,
DOUBLE, and ODD, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
EVEN1-DOUBLE
(DEFN HALF
(I)
(IF (ZEROP I)
0
(IF (ZEROP (SUB1 I))
0
(ADD1 (HALF (SUB1 (SUB1 I)))))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
can be used to show that the measure (COUNT I) decreases according to the
well-founded relation LESSP in each recursive call. Hence, HALF is accepted
under the definitional principle. Observe that (NUMBERP (HALF I)) is a
theorem.
[ 0.0 0.0 0.0 ]
HALF
(PROVE-LEMMA HALF-DOUBLE
(REWRITE)
(IMPLIES (NUMBERP I)
(EQUAL (HALF (DOUBLE I)) I)))
Give the conjecture the name *1.
Let us appeal to the induction principle. There is only one suggested
induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP I) (p I))
(IMPLIES (AND (NOT (ZEROP I)) (p (SUB1 I)))
(p I))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT I) decreases according to the well-founded
relation LESSP in each induction step of the scheme. The above induction
scheme generates two new conjectures:
Case 2. (IMPLIES (AND (ZEROP I) (NUMBERP I))
(EQUAL (HALF (DOUBLE I)) I)),
which simplifies, expanding the functions ZEROP, NUMBERP, DOUBLE, HALF, and
EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP I))
(EQUAL (HALF (DOUBLE (SUB1 I)))
(SUB1 I))
(NUMBERP I))
(EQUAL (HALF (DOUBLE I)) I)),
which simplifies, appealing to the lemmas ADD1-SUB1 and SUB1-ADD1, and
expanding ZEROP, DOUBLE, and HALF, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
HALF-DOUBLE
(PROVE-LEMMA DOUBLE-HALF
(REWRITE)
(IMPLIES (AND (NUMBERP I) (EVEN1 I))
(EQUAL (DOUBLE (HALF I)) I)))
This formula simplifies, opening up the functions EVEN1, HALF, DOUBLE, and
EQUAL, to:
(IMPLIES (AND (NUMBERP I) (ODD (SUB1 I)))
(EQUAL (DOUBLE (HALF I)) I)).
Applying the lemma SUB1-ELIM, replace I by (ADD1 X) to eliminate (SUB1 I). We
employ the type restriction lemma noted when SUB1 was introduced to restrict
the new variable. This produces the following two new formulas:
Case 2. (IMPLIES (AND (EQUAL I 0)
(NUMBERP I)
(ODD (SUB1 I)))
(EQUAL (DOUBLE (HALF I)) I)).
However this further simplifies, expanding NUMBERP, SUB1, and ODD, to:
T.
Case 1. (IMPLIES (AND (NUMBERP X)
(NOT (EQUAL (ADD1 X) 0))
(ODD X))
(EQUAL (DOUBLE (HALF (ADD1 X)))
(ADD1 X))),
which further simplifies, clearly, to the new goal:
(IMPLIES (AND (NUMBERP X) (ODD X))
(EQUAL (DOUBLE (HALF (ADD1 X)))
(ADD1 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 (NUMBERP I) (EVEN1 I))
(EQUAL (DOUBLE (HALF I)) I)),
named *1. Let us appeal to the induction principle. There is only one
suggested induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP I) (p I))
(IMPLIES (AND (NOT (ZEROP I)) (ZEROP (SUB1 I)))
(p I))
(IMPLIES (AND (NOT (ZEROP I))
(NOT (ZEROP (SUB1 I)))
(p (SUB1 (SUB1 I))))
(p I))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be
used to prove that the measure (COUNT I) 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 (ZEROP I) (NUMBERP I) (EVEN1 I))
(EQUAL (DOUBLE (HALF I)) I)).
This simplifies, opening up the functions ZEROP, NUMBERP, EVEN1, HALF,
DOUBLE, and EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP I))
(ZEROP (SUB1 I))
(NUMBERP I)
(EVEN1 I))
(EQUAL (DOUBLE (HALF I)) I)).
This simplifies, unfolding the functions ZEROP, ODD, and EVEN1, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP I))
(NOT (ZEROP (SUB1 I)))
(NOT (EVEN1 (SUB1 (SUB1 I))))
(NUMBERP I)
(EVEN1 I))
(EQUAL (DOUBLE (HALF I)) I)).
This simplifies, unfolding the functions ZEROP, EVEN1, and ODD, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP I))
(NOT (ZEROP (SUB1 I)))
(EQUAL (DOUBLE (HALF (SUB1 (SUB1 I))))
(SUB1 (SUB1 I)))
(NUMBERP I)
(EVEN1 I))
(EQUAL (DOUBLE (HALF I)) I)).
This simplifies, applying ADD1-SUB1 and SUB1-ADD1, and unfolding the
definitions of ZEROP, EVEN1, HALF, and DOUBLE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
DOUBLE-HALF
(PROVE-LEMMA DOUBLE-TIMES-2 NIL
(EQUAL (DOUBLE I) (TIMES 2 I)))
Call the conjecture *1.
We will try to prove it by induction. There is only one suggested
induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP I) (p I))
(IMPLIES (AND (NOT (ZEROP I)) (p (SUB1 I)))
(p I))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be
used to establish that the measure (COUNT I) 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 (ZEROP I)
(EQUAL (DOUBLE I) (TIMES 2 I))).
This simplifies, applying TIMES-ZERO2, and expanding the functions ZEROP,
DOUBLE, TIMES, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP I))
(EQUAL (DOUBLE (SUB1 I))
(TIMES 2 (SUB1 I))))
(EQUAL (DOUBLE I) (TIMES 2 I))),
which simplifies, opening up the functions ZEROP and DOUBLE, to:
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(EQUAL (DOUBLE (SUB1 I))
(TIMES 2 (SUB1 I))))
(EQUAL (ADD1 (ADD1 (DOUBLE (SUB1 I))))
(TIMES 2 I))).
Appealing to the lemma SUB1-ELIM, we now replace I by (ADD1 X) to eliminate
(SUB1 I). We employ the type restriction lemma noted when SUB1 was
introduced to constrain the new variable. The result is:
(IMPLIES (AND (NUMBERP X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (DOUBLE X) (TIMES 2 X)))
(EQUAL (ADD1 (ADD1 (DOUBLE X)))
(TIMES 2 (ADD1 X)))).
This further simplifies, appealing to the lemma TIMES-ADD1, to the goal:
(IMPLIES (AND (NUMBERP X)
(EQUAL (DOUBLE X) (TIMES 2 X)))
(EQUAL (ADD1 (ADD1 (DOUBLE X)))
(PLUS 2 (DOUBLE X)))).
But this again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
DOUBLE-TIMES-2
(PROVE-LEMMA SUBSETP-CONS
(REWRITE)
(IMPLIES (SUBSETP X Y)
(SUBSETP X (CONS Z Y))))
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 X)
(MEMBER (CAR X) Y)
(p (CDR X) Z Y))
(p X Z Y))
(IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) Y)))
(p X Z Y))
(IMPLIES (NOT (LISTP X)) (p X Z Y))).
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 generates four new conjectures:
Case 4. (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(NOT (SUBSETP (CDR X) Y))
(SUBSETP X Y))
(SUBSETP X (CONS Z Y))),
which simplifies, expanding the function SUBSETP, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(MEMBER (CAR X) Y)
(SUBSETP (CDR X) (CONS Z Y))
(SUBSETP X Y))
(SUBSETP X (CONS Z Y))),
which simplifies, appealing to the lemmas CDR-CONS and CAR-CONS, and
expanding SUBSETP and MEMBER, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (MEMBER (CAR X) Y))
(SUBSETP X Y))
(SUBSETP X (CONS Z Y))),
which simplifies, opening up SUBSETP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X)) (SUBSETP X Y))
(SUBSETP X (CONS Z Y))),
which simplifies, opening up SUBSETP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUBSETP-CONS
(DEFN LAST
(X)
(IF (LISTP X)
(IF (LISTP (CDR X)) (LAST (CDR X)) X)
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 recursive call. Hence, LAST is accepted under the definitional principle.
Note that (OR (LISTP (LAST X)) (EQUAL (LAST X) X)) is a theorem.
[ 0.0 0.0 0.0 ]
LAST
(PROVE-LEMMA LAST-APPEND
(REWRITE)
(EQUAL (LAST (APPEND A B))
(IF (LISTP B)
(LAST B)
(IF (LISTP A)
(CONS (CAR (LAST A)) B)
B))))
This simplifies, obviously, to three new goals:
Case 3. (IMPLIES (AND (NOT (LISTP B)) (LISTP A))
(EQUAL (LAST (APPEND A B))
(CONS (CAR (LAST A)) B))),
which we will name *1.
Case 2. (IMPLIES (AND (NOT (LISTP B)) (NOT (LISTP A)))
(EQUAL (LAST (APPEND A B)) B)).
This again simplifies, opening up APPEND and LAST, to:
T.
Case 1. (IMPLIES (LISTP B)
(EQUAL (LAST (APPEND A B)) (LAST B))),
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 (LAST (APPEND A B))
(COND ((LISTP B) (LAST B))
((LISTP A) (CONS (CAR (LAST A)) B))
(T B))),
named *1. Let us appeal to the induction principle. There are three
plausible inductions. They merge into two likely candidate inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (AND (LISTP A) (p (CDR A) B))
(p A B))
(IMPLIES (NOT (LISTP A)) (p A B))).
Linear arithmetic and the lemma CDR-LESSP 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 leads to two new goals:
Case 2. (IMPLIES (AND (LISTP A)
(EQUAL (LAST (APPEND (CDR A) B))
(COND ((LISTP B) (LAST B))
((LISTP (CDR A))
(CONS (CAR (LAST (CDR A))) B))
(T B))))
(EQUAL (LAST (APPEND A B))
(COND ((LISTP B) (LAST B))
((LISTP A) (CONS (CAR (LAST A)) B))
(T B)))),
which simplifies, rewriting with CDR-CONS, and opening up the functions
APPEND and LAST, to the following three new conjectures:
Case 2.3.
(IMPLIES (AND (LISTP A)
(NOT (LISTP B))
(LISTP (CDR A))
(EQUAL (LAST (APPEND (CDR A) B))
(CONS (CAR (LAST (CDR A))) B))
(NOT (LISTP (APPEND (CDR A) B))))
(EQUAL (CONS (CAR A) (APPEND (CDR A) B))
(LAST (APPEND (CDR A) B)))).
But this again simplifies, expanding the definition of LAST, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP A)
(NOT (LISTP B))
(NOT (LISTP (CDR A)))
(EQUAL (LAST (APPEND (CDR A) B)) B))
(EQUAL (CONS (CAR A) (APPEND (CDR A) B))
(CONS (CAR A) B))),
which again simplifies, rewriting with CAR-CONS, CDR-CONS, and CONS-EQUAL,
to:
(IMPLIES (AND (LISTP A)
(NOT (LISTP B))
(NOT (LISTP (CDR A)))
(EQUAL (LAST (APPEND (CDR A) B)) B))
(EQUAL (APPEND (CDR A) B) B)),
which further simplifies, expanding the functions APPEND and LAST, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP A)
(NOT (LISTP B))
(NOT (LISTP (CDR A)))
(EQUAL (LAST (APPEND (CDR A) B)) B))
(NOT (LISTP (APPEND (CDR A) B)))),
which again simplifies, clearly, to:
T.
Case 1. (IMPLIES (NOT (LISTP A))
(EQUAL (LAST (APPEND A B))
(COND ((LISTP B) (LAST B))
((LISTP A) (CONS (CAR (LAST A)) B))
(T B)))).
This simplifies, expanding the function APPEND, to the new conjecture:
(IMPLIES (AND (NOT (LISTP A)) (NOT (LISTP B)))
(EQUAL (LAST B) B)),
which again simplifies, expanding the function LAST, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LAST-APPEND
(PROVE-LEMMA LAST-REVERSE NIL
(IMPLIES (LISTP A)
(EQUAL (LAST (REVERSE A))
(CONS (CAR A) NIL))))
.
Applying the lemma CAR-CDR-ELIM, replace A by (CONS X Z) to eliminate (CAR A)
and (CDR A). We would thus like to prove the new conjecture:
(EQUAL (LAST (REVERSE (CONS X Z)))
(LIST X)),
which simplifies, applying CAR-CONS, CDR-CONS, and LAST-APPEND, and opening up
REVERSE, LISTP, and LAST, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LAST-REVERSE
(DEFN EXP
(I J)
(IF (ZEROP J)
1
(TIMES I (EXP I (SUB1 J)))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
inform us that the measure (COUNT J) decreases according to the well-founded
relation LESSP in each recursive call. Hence, EXP is accepted under the
definitional principle. From the definition we can conclude that
(NUMBERP (EXP I J)) is a theorem.
[ 0.0 0.0 0.0 ]
EXP
(PROVE-LEMMA EXP-PLUS
(REWRITE)
(EQUAL (EXP I (PLUS J K))
(TIMES (EXP I J) (EXP I K))))
Call the conjecture *1.
We will try to prove it by induction. There are three plausible
inductions. They merge into two likely candidate inductions. However, only
one is unflawed. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP J) (p I J K))
(IMPLIES (AND (NOT (ZEROP J)) (p I (SUB1 J) K))
(p I J K))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definition
of ZEROP inform us that the measure (COUNT J) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme generates two new goals:
Case 2. (IMPLIES (ZEROP J)
(EQUAL (EXP I (PLUS J K))
(TIMES (EXP I J) (EXP I K)))),
which simplifies, opening up the functions ZEROP, EQUAL, PLUS, and EXP, to
four new formulas:
Case 2.4.
(IMPLIES (AND (EQUAL J 0) (NOT (NUMBERP K)))
(EQUAL (EXP I 0)
(TIMES 1 (EXP I K)))),
which again simplifies, opening up EQUAL, EXP, and TIMES, to:
T.
Case 2.3.
(IMPLIES (AND (EQUAL J 0) (NUMBERP K))
(EQUAL (EXP I K)
(TIMES 1 (EXP I K)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP J))
(NOT (NUMBERP K)))
(EQUAL (EXP I 0)
(TIMES 1 (EXP I K)))),
which again simplifies, opening up the definitions of EQUAL, EXP, and
TIMES, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (NUMBERP J)) (NUMBERP K))
(EQUAL (EXP I K)
(TIMES 1 (EXP I K)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP J))
(EQUAL (EXP I (PLUS (SUB1 J) K))
(TIMES (EXP I (SUB1 J)) (EXP I K))))
(EQUAL (EXP I (PLUS J K))
(TIMES (EXP I J) (EXP I K)))),
which simplifies, rewriting with COMMUTATIVITY-OF-TIMES, SUB1-ADD1, and
ASSOCIATIVITY-OF-TIMES, and opening up the functions ZEROP, PLUS, and EXP,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
EXP-PLUS
(PROVE-LEMMA EVEN1-EVEN2 NIL
(EQUAL (EVEN1 X) (EVEN2 X)))
This simplifies, expanding the function EVEN1, to the following three new
goals:
Case 3. (IMPLIES (AND (NOT (EQUAL X 0)) (NUMBERP X))
(EQUAL (ODD (SUB1 X)) (EVEN2 X))).
Appealing to the lemma SUB1-ELIM, we now replace X by (ADD1 Z) to eliminate
(SUB1 X). We rely upon the type restriction lemma noted when SUB1 was
introduced to constrain the new variable. The result is:
(IMPLIES (AND (NUMBERP Z)
(NOT (EQUAL (ADD1 Z) 0)))
(EQUAL (ODD Z) (EVEN2 (ADD1 Z)))).
This further simplifies, obviously, to:
(IMPLIES (NUMBERP Z)
(EQUAL (ODD Z) (EVEN2 (ADD1 Z)))),
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 (EVEN1 X) (EVEN2 X)),
named *1. Let us appeal to the induction principle. There is only one
suggested induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP X) (p X))
(IMPLIES (AND (NOT (ZEROP X)) (ZEROP (SUB1 X)))
(p X))
(IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP (SUB1 X)))
(p (SUB1 (SUB1 X))))
(p X))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP 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 the following three new formulas:
Case 3. (IMPLIES (ZEROP X)
(EQUAL (EVEN1 X) (EVEN2 X))).
This simplifies, opening up ZEROP, EVEN1, EVEN2, and EQUAL, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP X)) (ZEROP (SUB1 X)))
(EQUAL (EVEN1 X) (EVEN2 X))).
This simplifies, expanding ZEROP, ODD, EVEN1, EVEN2, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP (SUB1 X)))
(EQUAL (EVEN1 (SUB1 (SUB1 X)))
(EVEN2 (SUB1 (SUB1 X)))))
(EQUAL (EVEN1 X) (EVEN2 X))).
This simplifies, opening up ZEROP, EVEN1, ODD, EVEN2, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
EVEN1-EVEN2
(PROVE-LEMMA LEQ-NTH NIL
(LEQ (LENGTH (NTH L I)) (LENGTH L)))
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 L) (p (CDR L) (SUB1 I)))
(p L I))
(IMPLIES (NOT (LISTP L)) (p L I))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT L)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. Note, however, the inductive instance chosen for I. The above
induction scheme generates two new goals:
Case 2. (IMPLIES (AND (LISTP L)
(NOT (LESSP (LENGTH (CDR L))
(LENGTH (NTH (CDR L) (SUB1 I))))))
(NOT (LESSP (LENGTH L)
(LENGTH (NTH L I))))),
which simplifies, appealing to the lemma SUB1-ADD1, and unfolding LENGTH,
NTH, and LESSP, to three new formulas:
Case 2.3.
(IMPLIES (AND (LISTP L)
(NOT (LESSP (LENGTH (CDR L))
(LENGTH (NTH (CDR L) (SUB1 I)))))
(NOT (NUMBERP I))
(NOT (EQUAL (LENGTH L) 0)))
(NOT (LESSP (LENGTH (CDR L))
(SUB1 (LENGTH L))))),
which again simplifies, applying SUB1-ADD1, and opening up the function
LENGTH, to:
(IMPLIES (AND (LISTP L)
(NOT (LESSP (LENGTH (CDR L))
(LENGTH (NTH (CDR L) (SUB1 I)))))
(NOT (NUMBERP I)))
(NOT (LESSP (LENGTH (CDR L))
(LENGTH (CDR L))))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP L)
(NOT (LESSP (LENGTH (CDR L))
(LENGTH (NTH (CDR L) (SUB1 I)))))
(EQUAL I 0)
(NOT (EQUAL (LENGTH L) 0)))
(NOT (LESSP (LENGTH (CDR L))
(SUB1 (LENGTH L))))),
which again simplifies, applying SUB1-ADD1, and unfolding SUB1, EQUAL, NTH,
and LENGTH, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP L)
(NOT (LESSP (LENGTH (CDR L))
(LENGTH (NTH (CDR L) (SUB1 I)))))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL (LENGTH (NTH (CDR L) (SUB1 I)))
0)))
(NOT (LESSP (LENGTH (CDR L))
(SUB1 (LENGTH (NTH (CDR L) (SUB1 I))))))).
But this again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (NOT (LISTP L))
(NOT (LESSP (LENGTH L)
(LENGTH (NTH L I))))),
which simplifies, unfolding the functions LENGTH, NTH, EQUAL, and LESSP, to
three new conjectures:
Case 1.3.
(IMPLIES (AND (NOT (LISTP L))
(NOT (EQUAL I 0))
(NUMBERP I))
(EQUAL (LENGTH (NTH (CDR L) (SUB1 I)))
0)),
which further simplifies, applying CDR-NLISTP and NTH-0, and opening up
the functions LENGTH and EQUAL, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (LISTP L)) (EQUAL I 0))
(EQUAL (LENGTH L) 0)).
But this again simplifies, expanding the definitions of LENGTH and EQUAL,
to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LISTP L))
(NOT (NUMBERP I)))
(EQUAL (LENGTH L) 0)),
which again simplifies, expanding the definitions of LENGTH and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LEQ-NTH
(PROVE-LEMMA MEMBER-SORT NIL
(EQUAL (MEMBER A (SORT B))
(MEMBER A B)))
Name the conjecture *1.
Perhaps we can 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 B) (p A (CDR B)))
(p A B))
(IMPLIES (NOT (LISTP B)) (p A B))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT B)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces the following two new
goals:
Case 2. (IMPLIES (AND (LISTP B)
(EQUAL (MEMBER A (SORT (CDR B)))
(MEMBER A (CDR B))))
(EQUAL (MEMBER A (SORT B))
(MEMBER A B))).
This simplifies, expanding SORT and MEMBER, to the following two new
formulas:
Case 2.2.
(IMPLIES (AND (LISTP B)
(EQUAL (MEMBER A (SORT (CDR B)))
(MEMBER A (CDR B)))
(NOT (EQUAL A (CAR B))))
(EQUAL (MEMBER A
(ADDTOLIST (CAR B) (SORT (CDR B))))
(MEMBER A (CDR B)))).
Appealing to the lemma CAR-CDR-ELIM, we now replace B by (CONS Z X) to
eliminate (CDR B) and (CAR B). The result is:
(IMPLIES (AND (EQUAL (MEMBER A (SORT X))
(MEMBER A X))
(NOT (EQUAL A Z)))
(EQUAL (MEMBER A (ADDTOLIST Z (SORT X)))
(MEMBER A X))).
We use the above equality hypothesis by substituting (MEMBER A (SORT X))
for (MEMBER A X) and throwing away the equality. This produces:
(IMPLIES (NOT (EQUAL A Z))
(EQUAL (MEMBER A (ADDTOLIST Z (SORT X)))
(MEMBER A (SORT X)))),
which we generalize by replacing (SORT X) by Y. We must thus prove the
formula:
(IMPLIES (NOT (EQUAL A Z))
(EQUAL (MEMBER A (ADDTOLIST Z Y))
(MEMBER A Y))).
Name the above subgoal *1.1.
Case 2.1.
(IMPLIES (AND (LISTP B)
(EQUAL (MEMBER A (SORT (CDR B)))
(MEMBER A (CDR B)))
(EQUAL A (CAR B)))
(EQUAL (MEMBER A
(ADDTOLIST (CAR B) (SORT (CDR B))))
T)).
This again simplifies, obviously, to the new goal:
(IMPLIES (AND (LISTP B)
(EQUAL (MEMBER (CAR B) (SORT (CDR B)))
(MEMBER (CAR B) (CDR B))))
(MEMBER (CAR B)
(ADDTOLIST (CAR B) (SORT (CDR B))))).
Applying the lemma CAR-CDR-ELIM, replace B by (CONS X Z) to eliminate
(CAR B) and (CDR B). This produces:
(IMPLIES (EQUAL (MEMBER X (SORT Z))
(MEMBER X Z))
(MEMBER X (ADDTOLIST X (SORT Z)))),
which we generalize by replacing (SORT Z) by Y. This generates:
(IMPLIES (EQUAL (MEMBER X Y) (MEMBER X Z))
(MEMBER X (ADDTOLIST X Y))).
Name the above subgoal *1.2.
Case 1. (IMPLIES (NOT (LISTP B))
(EQUAL (MEMBER A (SORT B))
(MEMBER A B))).
This simplifies, unfolding the definitions of SORT, LISTP, MEMBER, and EQUAL,
to:
T.
So we now return to:
(IMPLIES (EQUAL (MEMBER X Y) (MEMBER X Z))
(MEMBER X (ADDTOLIST X Y))),
which we named *1.2 above. Perhaps we can prove it by induction. Three
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 (NLISTP Y) (p X Y Z))
(IMPLIES (AND (NOT (NLISTP Y))
(EQUAL X (CAR Y)))
(p X Y Z))
(IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(p X (CDR Y) Z))
(p X Y Z))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP establish that the measure (COUNT Y) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme generates the following four new goals:
Case 4. (IMPLIES (AND (NLISTP Y)
(EQUAL (MEMBER X Y) (MEMBER X Z)))
(MEMBER X (ADDTOLIST X Y))).
This simplifies, rewriting with CAR-CONS, and expanding the functions NLISTP,
MEMBER, and ADDTOLIST, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP Y))
(EQUAL X (CAR Y))
(EQUAL (MEMBER X Y) (MEMBER X Z)))
(MEMBER X (ADDTOLIST X Y))),
which simplifies, opening up the functions NLISTP and MEMBER, to the formula:
(IMPLIES (AND (LISTP Y) (MEMBER (CAR Y) Z))
(MEMBER (CAR Y)
(ADDTOLIST (CAR Y) Y))).
Appealing to the lemma CAR-CDR-ELIM, we now replace Y by (CONS V W) to
eliminate (CAR Y) and (CDR Y). The result is the goal:
(IMPLIES (MEMBER V Z)
(MEMBER V (ADDTOLIST V (CONS V W)))).
But this further simplifies, rewriting with CDR-CONS and CAR-CONS, and
unfolding the function ADDTOLIST, to the following two new conjectures:
Case 3.2.
(IMPLIES (AND (MEMBER V Z) (NOT (LESSP V V)))
(MEMBER V (CONS V (ADDTOLIST V W)))).
This again simplifies, applying CAR-CONS, and expanding the function
MEMBER, to:
T.
Case 3.1.
(IMPLIES (AND (MEMBER V Z) (LESSP V V))
(MEMBER V (CONS V (CONS V W)))).
But this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(NOT (EQUAL (MEMBER X (CDR Y))
(MEMBER X Z)))
(EQUAL (MEMBER X Y) (MEMBER X Z)))
(MEMBER X (ADDTOLIST X Y))),
which simplifies, unfolding the functions NLISTP and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP Y))
(NOT (EQUAL X (CAR Y)))
(MEMBER X (ADDTOLIST X (CDR Y)))
(EQUAL (MEMBER X Y) (MEMBER X Z)))
(MEMBER X (ADDTOLIST X Y))),
which simplifies, unfolding the definitions of NLISTP, MEMBER, and ADDTOLIST,
to two new conjectures:
Case 1.2.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(MEMBER X (ADDTOLIST X (CDR Y)))
(EQUAL (MEMBER X (CDR Y))
(MEMBER X Z))
(NOT (LESSP X (CAR Y))))
(MEMBER X
(CONS (CAR Y)
(ADDTOLIST X (CDR Y))))),
which again simplifies, applying CDR-CONS and CAR-CONS, and expanding
MEMBER, to:
T.
Case 1.1.
(IMPLIES (AND (LISTP Y)
(NOT (EQUAL X (CAR Y)))
(MEMBER X (ADDTOLIST X (CDR Y)))
(EQUAL (MEMBER X (CDR Y))
(MEMBER X Z))
(LESSP X (CAR Y)))
(MEMBER X (CONS X Y))).
This again simplifies, applying CAR-CONS, and unfolding MEMBER, to:
T.
That finishes the proof of *1.2.
So we now return to:
(IMPLIES (NOT (EQUAL A Z))
(EQUAL (MEMBER A (ADDTOLIST Z Y))
(MEMBER A Y))),
which we named *1.1 above. Perhaps we can 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 Y) (LESSP Z (CAR Y)))
(p A Z Y))
(IMPLIES (AND (LISTP Y)
(NOT (LESSP Z (CAR Y)))
(p A Z (CDR Y)))
(p A Z Y))
(IMPLIES (NOT (LISTP Y)) (p A Z Y))).
Linear arithmetic and the lemma CDR-LESSP can be used to show that the measure
(COUNT Y) 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 Y)
(LESSP Z (CAR Y))
(NOT (EQUAL A Z)))
(EQUAL (MEMBER A (ADDTOLIST Z Y))
(MEMBER A Y))),
which simplifies, unfolding the functions ADDTOLIST and MEMBER, to two new
conjectures:
Case 3.2.
(IMPLIES (AND (LISTP Y)
(LESSP Z (CAR Y))
(NOT (EQUAL A Z))
(NOT (EQUAL A (CAR Y))))
(EQUAL (MEMBER A (CONS Z Y))
(MEMBER A (CDR Y)))),
which again simplifies, applying the lemmas CDR-CONS and CAR-CONS, and
expanding the function MEMBER, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP Y)
(LESSP Z (CAR Y))
(NOT (EQUAL A Z))
(EQUAL A (CAR Y)))
(EQUAL (MEMBER A (CONS Z Y)) T)),
which again simplifies, rewriting with CDR-CONS and CAR-CONS, and
unfolding the definitions of MEMBER and EQUAL, to:
T.
Case 2. (IMPLIES (AND (LISTP Y)
(NOT (LESSP Z (CAR Y)))
(EQUAL (MEMBER A (ADDTOLIST Z (CDR Y)))
(MEMBER A (CDR Y)))
(NOT (EQUAL A Z)))
(EQUAL (MEMBER A (ADDTOLIST Z Y))
(MEMBER A Y))).
This simplifies, applying the lemmas CDR-CONS and CAR-CONS, and unfolding
the definitions of ADDTOLIST and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP Y))
(NOT (EQUAL A Z)))
(EQUAL (MEMBER A (ADDTOLIST Z Y))
(MEMBER A Y))).
This simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
unfolding ADDTOLIST, MEMBER, LISTP, and EQUAL, to:
T.
That finishes the proof of *1.1, which also finishes the proof of *1.
Q.E.D.
[ 0.0 0.1 0.0 ]
MEMBER-SORT
(PROVE-LEMMA LENGTH-SORT NIL
(EQUAL (LENGTH (SORT A)) (LENGTH A)))
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 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 the following two new
conjectures:
Case 2. (IMPLIES (AND (LISTP A)
(EQUAL (LENGTH (SORT (CDR A)))
(LENGTH (CDR A))))
(EQUAL (LENGTH (SORT A)) (LENGTH A))).
This simplifies, expanding the functions SORT and LENGTH, to the new goal:
(IMPLIES (AND (LISTP A)
(EQUAL (LENGTH (SORT (CDR A)))
(LENGTH (CDR A))))
(EQUAL (LENGTH (ADDTOLIST (CAR A) (SORT (CDR A))))
(ADD1 (LENGTH (CDR A))))).
Applying the lemma CAR-CDR-ELIM, replace A by (CONS Z X) to eliminate
(CDR A) and (CAR A). This produces:
(IMPLIES (EQUAL (LENGTH (SORT X)) (LENGTH X))
(EQUAL (LENGTH (ADDTOLIST Z (SORT X)))
(ADD1 (LENGTH X)))).
We use the above equality hypothesis by substituting (LENGTH (SORT X)) for
(LENGTH X) and throwing away the equality. We must thus prove:
(EQUAL (LENGTH (ADDTOLIST Z (SORT X)))
(ADD1 (LENGTH (SORT X)))).
We will try to prove the above formula by generalizing it, replacing
(SORT X) by Y. This generates:
(EQUAL (LENGTH (ADDTOLIST Z Y))
(ADD1 (LENGTH Y))).
Give the above formula the name *1.1.
Case 1. (IMPLIES (NOT (LISTP A))
(EQUAL (LENGTH (SORT A)) (LENGTH A))).
This simplifies, opening up SORT, LENGTH, and EQUAL, to:
T.
So next consider:
(EQUAL (LENGTH (ADDTOLIST Z Y))
(ADD1 (LENGTH Y))),
which is formula *1.1 above. 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 Y) (LESSP Z (CAR Y)))
(p Z Y))
(IMPLIES (AND (LISTP Y)
(NOT (LESSP Z (CAR Y)))
(p Z (CDR Y)))
(p Z Y))
(IMPLIES (NOT (LISTP Y)) (p Z Y))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT Y)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces the following three new
formulas:
Case 3. (IMPLIES (AND (LISTP Y) (LESSP Z (CAR Y)))
(EQUAL (LENGTH (ADDTOLIST Z Y))
(ADD1 (LENGTH Y)))).
This simplifies, opening up the definitions of ADDTOLIST and LENGTH, to the
new conjecture:
(IMPLIES (AND (LISTP Y) (LESSP Z (CAR Y)))
(EQUAL (LENGTH (CONS Z Y))
(ADD1 (ADD1 (LENGTH (CDR Y)))))),
which again simplifies, rewriting with CDR-CONS, and unfolding LENGTH, to:
T.
Case 2. (IMPLIES (AND (LISTP Y)
(NOT (LESSP Z (CAR Y)))
(EQUAL (LENGTH (ADDTOLIST Z (CDR Y)))
(ADD1 (LENGTH (CDR Y)))))
(EQUAL (LENGTH (ADDTOLIST Z Y))
(ADD1 (LENGTH Y)))).
This simplifies, applying CDR-CONS, and opening up ADDTOLIST and LENGTH, to:
T.
Case 1. (IMPLIES (NOT (LISTP Y))
(EQUAL (LENGTH (ADDTOLIST Z Y))
(ADD1 (LENGTH Y)))),
which simplifies, rewriting with the lemma CDR-CONS, and opening up the
functions ADDTOLIST, ADD1, LENGTH, and EQUAL, to:
T.
That finishes the proof of *1.1, which finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LENGTH-SORT
(DEFN COUNT-LIST
(A L)
(FOR X IN L COUNT (EQUAL A X)))
[ 0.0 0.0 0.0 ]
COUNT-LIST
(PROVE-LEMMA COUNT-LIST-SORT NIL
(EQUAL (COUNT-LIST A (SORT L))
(COUNT-LIST A L)))
This formula can be simplified, using the abbreviation COUNT-LIST, to the new
conjecture:
(EQUAL (FOR X IN (SORT L) COUNT (EQUAL A X))
(FOR X IN L COUNT (EQUAL A X))),
which we will name *1.
Perhaps we can 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 L) (p (CDR L) A))
(p L A))
(IMPLIES (NOT (LISTP L)) (p L A))).
Linear arithmetic and the lemma CDR-LESSP can be used to show that the measure
(COUNT L) decreases according to the well-founded relation LESSP in each
induction step of the scheme. The above induction scheme generates two new
conjectures:
Case 2. (IMPLIES (AND (LISTP L)
(EQUAL (FOR X IN
(SORT (CDR L))
COUNT
(EQUAL A X))
(FOR X IN (CDR L) COUNT (EQUAL A X))))
(EQUAL (FOR X IN (SORT L) COUNT (EQUAL A X))
(FOR X IN L COUNT (EQUAL A X)))),
which simplifies, rewriting with REWRITE-EVAL$, and expanding the
definitions of EVAL$, SORT, FOR, EQUAL, and QUANTIFIER-OPERATION, to the
following two new formulas:
Case 2.2.
(IMPLIES (AND (LISTP L)
(EQUAL (FOR X IN
(SORT (CDR L))
COUNT
(EQUAL A X))
(FOR X IN (CDR L) COUNT (EQUAL A X)))
(NOT (EQUAL A (CAR L))))
(EQUAL (FOR X IN
(ADDTOLIST (CAR L) (SORT (CDR L)))
COUNT
(EQUAL A X))
(FOR X IN
(CDR L)
COUNT
(EQUAL A X)))).
Appealing to the lemma CAR-CDR-ELIM, we now replace L by (CONS Z X) to
eliminate (CDR L) and (CAR L). We must thus prove the formula:
(IMPLIES (AND (EQUAL (FOR X IN (SORT X) COUNT (EQUAL A X))
(FOR X IN X COUNT (EQUAL A X)))
(NOT (EQUAL A Z)))
(EQUAL (FOR X IN
(ADDTOLIST Z (SORT X))
COUNT
(EQUAL A X))
(FOR X IN X COUNT (EQUAL A X)))).
This further simplifies, opening up the function EVAL$, to:
(IMPLIES (AND (EQUAL (FOR Y IN (SORT X) COUNT (EQUAL A Y))
(FOR Y IN X COUNT (EQUAL A Y)))
(NOT (EQUAL A Z)))
(EQUAL (FOR Y IN
(ADDTOLIST Z (SORT X))
COUNT
(EQUAL A Y))
(FOR Y IN X COUNT (EQUAL A Y)))).
We use the above equality hypothesis by substituting:
(FOR Y IN (SORT X) COUNT (EQUAL A Y))
for (FOR Y IN X COUNT (EQUAL A Y)) and throwing away the equality. This
produces the new goal:
(IMPLIES (NOT (EQUAL A Z))
(EQUAL (FOR Y IN
(ADDTOLIST Z (SORT X))
COUNT
(EQUAL A Y))
(FOR Y IN
(SORT X)
COUNT
(EQUAL A Y)))),
which we generalize by replacing (SORT X) by Y. We must thus prove:
(IMPLIES (NOT (EQUAL A Z))
(EQUAL (FOR Y IN
(ADDTOLIST Z Y)
COUNT
(EQUAL A Y))
(FOR Y IN Y COUNT (EQUAL A Y)))).
This further simplifies, expanding the definition of EVAL$, to:
(IMPLIES (NOT (EQUAL A Z))
(EQUAL (FOR X IN
(ADDTOLIST Z Y)
COUNT
(EQUAL A X))
(FOR X IN Y COUNT (EQUAL A X)))).
Finally name the above subgoal *1.1.
Case 2.1.
(IMPLIES (AND (LISTP L)
(EQUAL (FOR X IN
(SORT (CDR L))
COUNT
(EQUAL A X))
(FOR X IN (CDR L) COUNT (EQUAL A X)))
(EQUAL A (CAR L)))
(EQUAL (FOR X IN
(ADDTOLIST (CAR L) (SORT (CDR L)))
COUNT
(EQUAL A X))
(ADD1 (FOR X IN
(CDR L)
COUNT
(EQUAL A X))))).
This again simplifies, expanding the definition of EVAL$, to:
(IMPLIES (AND (LISTP L)
(EQUAL (FOR X IN
(SORT (CDR L))
COUNT
(EQUAL (CAR L) X))
(FOR X IN
(CDR L)
COUNT
(EQUAL (CAR L) X))))
(EQUAL (FOR X IN
(ADDTOLIST (CAR L) (SORT (CDR L)))
COUNT
(EQUAL (CAR L) X))
(ADD1 (FOR X IN
(CDR L)
COUNT
(EQUAL (CAR L) X))))).
Appealing to the lemma CAR-CDR-ELIM, we now replace L by (CONS Z X) to
eliminate (CDR L) and (CAR L). The result is the conjecture:
(IMPLIES (EQUAL (FOR 'X
(SORT X)
(LIST 'QUOTE T)
'COUNT
'(EQUAL (CAR L) X)
(LIST (CONS 'L (CONS Z X))))
(FOR 'X
X
(LIST 'QUOTE T)
'COUNT
'(EQUAL (CAR L) X)
(LIST (CONS 'L (CONS Z X)))))
(EQUAL (FOR 'X
(ADDTOLIST Z (SORT X))
(LIST 'QUOTE T)
'COUNT
'(EQUAL (CAR L) X)
(LIST (CONS 'L (CONS Z X))))
(ADD1 (FOR 'X
X
(LIST 'QUOTE T)
'COUNT
'(EQUAL (CAR L) X)
(LIST (CONS 'L (CONS Z X))))))).
This further simplifies, appealing to the lemma CAR-CONS, and opening up
the function EVAL$, to:
(IMPLIES (EQUAL (FOR Y IN (SORT X) COUNT (EQUAL Z Y))
(FOR Y IN X COUNT (EQUAL Z Y)))
(EQUAL (FOR Y IN
(ADDTOLIST Z (SORT X))
COUNT
(EQUAL Z Y))
(ADD1 (FOR Y IN X COUNT (EQUAL Z Y))))).
We now use the above equality hypothesis by substituting:
(FOR Y IN (SORT X) COUNT (EQUAL Z Y))
for (FOR Y IN X COUNT (EQUAL Z Y)) and throwing away the equality. We
would thus like to prove:
(EQUAL (FOR Y IN
(ADDTOLIST Z (SORT X))
COUNT
(EQUAL Z Y))
(ADD1 (FOR Y IN
(SORT X)
COUNT
(EQUAL Z Y)))),
which we generalize by replacing (SORT X) by Y. This generates the goal:
(EQUAL (FOR Y IN
(ADDTOLIST Z Y)
COUNT
(EQUAL Z Y))
(ADD1 (FOR Y IN Y COUNT (EQUAL Z Y)))).
However this further simplifies, opening up the definition of EVAL$, to:
(EQUAL (FOR X IN
(ADDTOLIST Z Y)
COUNT
(EQUAL Z X))
(ADD1 (FOR X IN Y COUNT (EQUAL Z X)))).
Finally name the above subgoal *1.2.
Case 1. (IMPLIES (NOT (LISTP L))
(EQUAL (FOR X IN (SORT L) COUNT (EQUAL A X))
(FOR X IN L COUNT (EQUAL A X)))).
This simplifies, expanding the functions SORT, MEMBER, LISTP, FOR, CDR,
ASSOC, QUANTIFIER-INITIAL-VALUE, and EQUAL, to:
T.
So next consider:
(EQUAL (FOR X IN
(ADDTOLIST Z Y)
COUNT
(EQUAL Z X))
(ADD1 (FOR X IN Y COUNT (EQUAL Z X)))),
named *1.2 above. Perhaps we can 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 Y) (LESSP Z (CAR Y)))
(p Z Y))
(IMPLIES (AND (LISTP Y)
(NOT (LESSP Z (CAR Y)))
(p Z (CDR Y)))
(p Z Y))
(IMPLIES (NOT (LISTP Y)) (p Z Y))).
Linear arithmetic and the lemma CDR-LESSP can be used to establish that the
measure (COUNT Y) 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 Y) (LESSP Z (CAR Y)))
(EQUAL (FOR X IN
(ADDTOLIST Z Y)
COUNT
(EQUAL Z X))
(ADD1 (FOR X IN Y COUNT (EQUAL Z X))))),
which simplifies, applying the lemmas CAR-CONS, CDR-CONS, and REWRITE-EVAL$,
and unfolding the functions ADDTOLIST, MEMBER, EVAL$, FOR, EQUAL, and
QUANTIFIER-OPERATION, to two new conjectures:
Case 3.2.
(IMPLIES (AND (LISTP Y)
(LESSP Z (CAR Y))
(NOT (EQUAL Z (CAR Y))))
(EQUAL (FOR X IN
(CONS Z Y)
COUNT
(EQUAL Z X))
(ADD1 (FOR X IN
(CDR Y)
COUNT
(EQUAL Z X))))),
which again simplifies, applying CAR-CONS, CDR-CONS, and REWRITE-EVAL$,
and opening up the definitions of MEMBER, EVAL$, QUANTIFIER-OPERATION,
EQUAL, and FOR, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP Y)
(LESSP Z (CAR Y))
(EQUAL Z (CAR Y)))
(EQUAL (FOR X IN
(CONS Z Y)
COUNT
(EQUAL Z X))
(ADD1 (ADD1 (FOR X IN
(CDR Y)
COUNT
(EQUAL Z X)))))).
However this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP Y)
(NOT (LESSP Z (CAR Y)))
(EQUAL (FOR X IN
(ADDTOLIST Z (CDR Y))
COUNT
(EQUAL Z X))
(ADD1 (FOR X IN
(CDR Y)
COUNT
(EQUAL Z X)))))
(EQUAL (FOR X IN
(ADDTOLIST Z Y)
COUNT
(EQUAL Z X))
(ADD1 (FOR X IN Y COUNT (EQUAL Z X))))),
which simplifies, rewriting with the lemmas CAR-CONS, CDR-CONS, and
REWRITE-EVAL$, and expanding the definitions of EVAL$, ADDTOLIST, MEMBER,
QUANTIFIER-OPERATION, EQUAL, and FOR, to:
T.
Case 1. (IMPLIES (NOT (LISTP Y))
(EQUAL (FOR X IN
(ADDTOLIST Z Y)
COUNT
(EQUAL Z X))
(ADD1 (FOR X IN Y COUNT (EQUAL Z X))))),
which simplifies, applying CAR-CONS, CDR-CONS, and REWRITE-EVAL$, and
expanding ADDTOLIST, LISTP, MEMBER, EVAL$, QUANTIFIER-OPERATION, FOR, CDR,
ASSOC, QUANTIFIER-INITIAL-VALUE, ADD1, and EQUAL, to:
T.
That finishes the proof of *1.2.
So next consider:
(IMPLIES (NOT (EQUAL A Z))
(EQUAL (FOR X IN
(ADDTOLIST Z Y)
COUNT
(EQUAL A X))
(FOR X IN Y COUNT (EQUAL A X)))),
which we named *1.1 above. Perhaps we can 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 Y) (LESSP Z (CAR Y)))
(p Z Y A))
(IMPLIES (AND (LISTP Y)
(NOT (LESSP Z (CAR Y)))
(p Z (CDR Y) A))
(p Z Y A))
(IMPLIES (NOT (LISTP Y)) (p Z Y A))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT Y)
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 Y)
(LESSP Z (CAR Y))
(NOT (EQUAL A Z)))
(EQUAL (FOR X IN
(ADDTOLIST Z Y)
COUNT
(EQUAL A X))
(FOR X IN Y COUNT (EQUAL A X)))).
This simplifies, rewriting with the lemmas CAR-CONS, CDR-CONS, and
REWRITE-EVAL$, and unfolding the definitions of ADDTOLIST, MEMBER, EVAL$,
FOR, EQUAL, and QUANTIFIER-OPERATION, to the following two new goals:
Case 3.2.
(IMPLIES (AND (LISTP Y)
(LESSP Z (CAR Y))
(NOT (EQUAL A Z))
(NOT (EQUAL A (CAR Y))))
(EQUAL (FOR X IN
(CONS Z Y)
COUNT
(EQUAL A X))
(FOR X IN
(CDR Y)
COUNT
(EQUAL A X)))).
This again simplifies, applying CAR-CONS, CDR-CONS, and REWRITE-EVAL$, and
expanding the definitions of MEMBER, EVAL$, QUANTIFIER-OPERATION, EQUAL,
and FOR, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP Y)
(LESSP Z (CAR Y))
(NOT (EQUAL A Z))
(EQUAL A (CAR Y)))
(EQUAL (FOR X IN
(CONS Z Y)
COUNT
(EQUAL A X))
(ADD1 (FOR X IN
(CDR Y)
COUNT
(EQUAL A X))))).
However this again simplifies, rewriting with CAR-CONS, CDR-CONS, and
REWRITE-EVAL$, and unfolding MEMBER, EVAL$, QUANTIFIER-OPERATION, EQUAL,
and FOR, to:
(IMPLIES (AND (LISTP Y)
(LESSP Z (CAR Y))
(NOT (EQUAL (CAR Y) Z)))
(EQUAL (FOR X IN Y COUNT (EQUAL (CAR Y) X))
(ADD1 (FOR X IN
(CDR Y)
COUNT
(EQUAL (CAR Y) X))))),
which again simplifies, rewriting with REWRITE-EVAL$, and expanding EVAL$,
QUANTIFIER-OPERATION, EQUAL, and FOR, to:
T.
Case 2. (IMPLIES (AND (LISTP Y)
(NOT (LESSP Z (CAR Y)))
(EQUAL (FOR X IN
(ADDTOLIST Z (CDR Y))
COUNT
(EQUAL A X))
(FOR X IN (CDR Y) COUNT (EQUAL A X)))
(NOT (EQUAL A Z)))
(EQUAL (FOR X IN
(ADDTOLIST Z Y)
COUNT
(EQUAL A X))
(FOR X IN Y COUNT (EQUAL A X)))).
This simplifies, rewriting with the lemmas CAR-CONS, CDR-CONS, and
REWRITE-EVAL$, and expanding EVAL$, ADDTOLIST, MEMBER, QUANTIFIER-OPERATION,
EQUAL, and FOR, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP Y))
(NOT (EQUAL A Z)))
(EQUAL (FOR X IN
(ADDTOLIST Z Y)
COUNT
(EQUAL A X))
(FOR X IN Y COUNT (EQUAL A X)))).
This simplifies, rewriting with CAR-CONS, CDR-CONS, and REWRITE-EVAL$, and
opening up the functions ADDTOLIST, LISTP, MEMBER, EVAL$,
QUANTIFIER-OPERATION, QUANTIFIER-INITIAL-VALUE, ASSOC, CDR, FOR, and EQUAL,
to:
T.
That finishes the proof of *1.1, which, in turn, finishes the proof of *1.
Q.E.D.
[ 0.0 0.2 0.1 ]
COUNT-LIST-SORT
(PROVE-LEMMA ORDERED-APPEND NIL
(IMPLIES (ORDERED (APPEND A B))
(ORDERED 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 (CDR A) B))
(p A B))
(IMPLIES (NOT (LISTP A)) (p A B))).
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 (ORDERED (APPEND (CDR A) B)))
(ORDERED (APPEND A B)))
(ORDERED A)).
This simplifies, applying CAR-CONS and CDR-CONS, and expanding the functions
APPEND and ORDERED, to two new goals:
Case 3.2.
(IMPLIES (AND (LISTP A)
(NOT (ORDERED (APPEND (CDR A) B)))
(NOT (LISTP (APPEND (CDR A) B)))
(LISTP (CDR A)))
(ORDERED (CDR A))),
which again simplifies, unfolding the function ORDERED, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP A)
(NOT (ORDERED (APPEND (CDR A) B)))
(NOT (LISTP (APPEND (CDR A) B)))
(LISTP (CDR A)))
(NOT (LESSP (CADR A) (CAR A)))),
which again simplifies, unfolding the definition of ORDERED, to:
T.
Case 2. (IMPLIES (AND (LISTP A)
(ORDERED (CDR A))
(ORDERED (APPEND A B)))
(ORDERED A)),
which simplifies, applying CAR-CONS and CDR-CONS, and expanding the
functions APPEND and ORDERED, to the following two new goals:
Case 2.2.
(IMPLIES (AND (LISTP A)
(ORDERED (CDR A))
(NOT (LISTP (APPEND (CDR A) B)))
(LISTP (CDR A)))
(NOT (LESSP (CADR A) (CAR A)))).
Appealing to the lemma CAR-CDR-ELIM, we now replace A by (CONS Z X) to
eliminate (CDR A) and (CAR A) and X by (CONS V W) to eliminate (CAR X) and
(CDR X). We must thus prove the conjecture:
(IMPLIES (AND (ORDERED (CONS V W))
(NOT (LISTP (APPEND (CONS V W) B))))
(NOT (LESSP V Z))).
However this further simplifies, applying CAR-CONS and CDR-CONS, and
opening up ORDERED and APPEND, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP A)
(ORDERED (CDR A))
(NOT (LESSP (CAR (APPEND (CDR A) B))
(CAR A)))
(ORDERED (APPEND (CDR A) B))
(LISTP (CDR A)))
(NOT (LESSP (CADR A) (CAR A)))).
Appealing to the lemma CAR-CDR-ELIM, we now replace A by (CONS Z X) to
eliminate (CDR A) and (CAR A) and X by (CONS V W) to eliminate (CAR X) and
(CDR X). This generates the goal:
(IMPLIES (AND (ORDERED (CONS V W))
(NOT (LESSP (CAR (APPEND (CONS V W) B)) Z))
(ORDERED (APPEND (CONS V W) B)))
(NOT (LESSP V Z))).
However this further simplifies, applying CAR-CONS and CDR-CONS, and
opening up ORDERED and APPEND, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP A))
(ORDERED (APPEND A B)))
(ORDERED A)).
This simplifies, expanding the definitions of APPEND and ORDERED, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
ORDERED-APPEND
(PROVE-LEMMA LEQ-HALF NIL
(LEQ (HALF I) I))
Name the conjecture *1.
We will appeal to induction. The recursive terms in the conjecture
suggest two 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 (ZEROP I) (p I))
(IMPLIES (AND (NOT (ZEROP I)) (ZEROP (SUB1 I)))
(p I))
(IMPLIES (AND (NOT (ZEROP I))
(NOT (ZEROP (SUB1 I)))
(p (SUB1 (SUB1 I))))
(p I))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform
us that the measure (COUNT I) decreases according to the well-founded relation
LESSP in each induction step of the scheme. The above induction scheme
produces the following three new formulas:
Case 3. (IMPLIES (ZEROP I)
(NOT (LESSP I (HALF I)))).
This simplifies, expanding the definitions of ZEROP, HALF, LESSP, and EQUAL,
to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP I)) (ZEROP (SUB1 I)))
(NOT (LESSP I (HALF I)))).
This simplifies, expanding the definitions of ZEROP, HALF, EQUAL, and LESSP,
to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP I))
(NOT (ZEROP (SUB1 I)))
(NOT (LESSP (SUB1 (SUB1 I))
(HALF (SUB1 (SUB1 I))))))
(NOT (LESSP I (HALF I)))).
This simplifies, appealing to the lemma SUB1-ADD1, and unfolding the
functions ZEROP, HALF, and LESSP, to the new conjecture:
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL (SUB1 I) 0))
(NOT (LESSP (SUB1 (SUB1 I))
(HALF (SUB1 (SUB1 I))))))
(NOT (LESSP (SUB1 I)
(HALF (SUB1 (SUB1 I)))))),
which again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LEQ-HALF
(DEFN NUMBER-LISTP
(L)
(IF (LISTP L)
(AND (NUMBERP (CAR L))
(NUMBER-LISTP (CDR L)))
(EQUAL L NIL)))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT L) decreases according to the well-founded relation LESSP in each
recursive call. Hence, NUMBER-LISTP is accepted under the principle of
definition. Note that (OR (FALSEP (NUMBER-LISTP L)) (TRUEP (NUMBER-LISTP L)))
is a theorem.
[ 0.0 0.0 0.0 ]
NUMBER-LISTP
(PROVE-LEMMA ORDERED-SORT
(REWRITE)
(ORDERED (SORT X)))
Call the conjecture *1.
Let us appeal to the induction principle. There is only one suggested
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 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 two new goals:
Case 2. (IMPLIES (AND (LISTP X)
(ORDERED (SORT (CDR X))))
(ORDERED (SORT X))),
which simplifies, expanding the definition of SORT, to the conjecture:
(IMPLIES (AND (LISTP X)
(ORDERED (SORT (CDR X))))
(ORDERED (ADDTOLIST (CAR X) (SORT (CDR X))))).
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 (ORDERED (SORT Z))
(ORDERED (ADDTOLIST V (SORT Z)))).
We will try to prove the above formula by generalizing it, replacing
(SORT Z) by Y. The result is:
(IMPLIES (ORDERED Y)
(ORDERED (ADDTOLIST V Y))).
Give the above formula the name *1.1.
Case 1. (IMPLIES (NOT (LISTP X))
(ORDERED (SORT X))).
This simplifies, expanding SORT and ORDERED, to:
T.
So let us turn our attention to:
(IMPLIES (ORDERED Y)
(ORDERED (ADDTOLIST V Y))),
named *1.1 above. Perhaps we can 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 Y)
(LISTP (CDR Y))
(LESSP (CADR Y) (CAR Y)))
(p V Y))
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(p V (CDR Y)))
(p V Y))
(IMPLIES (AND (LISTP Y) (NOT (LISTP (CDR Y))))
(p V Y))
(IMPLIES (NOT (LISTP Y)) (p V Y))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT Y)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme generates the following five new
conjectures:
Case 5. (IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(LESSP (CADR Y) (CAR Y))
(ORDERED Y))
(ORDERED (ADDTOLIST V Y))).
This simplifies, expanding ORDERED, to:
T.
Case 4. (IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(NOT (ORDERED (CDR Y)))
(ORDERED Y))
(ORDERED (ADDTOLIST V Y))).
This simplifies, expanding ORDERED, to:
T.
Case 3. (IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(ORDERED (ADDTOLIST V (CDR Y)))
(ORDERED Y))
(ORDERED (ADDTOLIST V Y))).
This simplifies, opening up the definitions of ORDERED and ADDTOLIST, to the
following two new formulas:
Case 3.2.
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(ORDERED (ADDTOLIST V (CDR Y)))
(ORDERED (CDR Y))
(NOT (LESSP V (CAR Y))))
(ORDERED (CONS (CAR Y)
(ADDTOLIST V (CDR Y))))).
This again simplifies, rewriting with CAR-CONS and CDR-CONS, and opening
up the function ORDERED, to:
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(ORDERED (ADDTOLIST V (CDR Y)))
(ORDERED (CDR Y))
(NOT (LESSP V (CAR Y))))
(NOT (LESSP (CAR (ADDTOLIST V (CDR Y)))
(CAR Y)))).
Applying the lemma CAR-CDR-ELIM, replace Y by (CONS Z X) to eliminate
(CDR Y) and (CAR Y) and X by (CONS W D) to eliminate (CAR X) and (CDR X).
We thus obtain:
(IMPLIES (AND (NOT (LESSP W Z))
(ORDERED (ADDTOLIST V (CONS W D)))
(ORDERED (CONS W D))
(NOT (LESSP V Z)))
(NOT (LESSP (CAR (ADDTOLIST V (CONS W D)))
Z))),
which further simplifies, appealing to the lemmas CDR-CONS and CAR-CONS,
and opening up the definitions of ADDTOLIST and ORDERED, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(ORDERED (ADDTOLIST V (CDR Y)))
(ORDERED (CDR Y))
(LESSP V (CAR Y)))
(ORDERED (CONS V Y))),
which again simplifies, rewriting with the lemmas CAR-CONS and CDR-CONS,
and opening up the function ORDERED, to the conjecture:
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(ORDERED (ADDTOLIST V (CDR Y)))
(ORDERED (CDR Y))
(LESSP V (CAR Y)))
(NOT (LESSP (CAR Y) V))).
This again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(ORDERED Y))
(ORDERED (ADDTOLIST V Y))),
which simplifies, unfolding ORDERED and ADDTOLIST, to two new formulas:
Case 2.2.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NOT (LESSP V (CAR Y))))
(ORDERED (CONS (CAR Y)
(ADDTOLIST V (CDR Y))))),
which again simplifies, applying CAR-CONS and CDR-CONS, and opening up the
function ORDERED, to the following two new goals:
Case 2.2.2.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NOT (LESSP V (CAR Y))))
(NOT (LESSP (CAR (ADDTOLIST V (CDR Y)))
(CAR Y)))).
But this further simplifies, applying CAR-CONS, and unfolding ADDTOLIST,
to:
T.
Case 2.2.1.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NOT (LESSP V (CAR Y))))
(ORDERED (ADDTOLIST V (CDR Y)))).
But this further simplifies, appealing to the lemma CDR-CONS, and
unfolding the functions ADDTOLIST, LISTP, and ORDERED, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(LESSP V (CAR Y)))
(ORDERED (CONS V Y))),
which again simplifies, rewriting with the lemmas CAR-CONS and CDR-CONS,
and expanding the function ORDERED, to the goal:
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(LESSP V (CAR Y)))
(NOT (LESSP (CAR Y) V))).
This again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP Y)) (ORDERED Y))
(ORDERED (ADDTOLIST V Y))),
which simplifies, applying CDR-CONS, and expanding the definitions of
ORDERED, ADDTOLIST, and LISTP, to:
T.
That finishes the proof of *1.1, which also finishes the proof of *1.
Q.E.D.
[ 0.0 0.0 0.0 ]
ORDERED-SORT
(PROVE-LEMMA ADDTOLIST-OF-ORDERED-NUMBER-LIST
(REWRITE)
(IMPLIES (AND (ORDERED X)
(NUMBER-LISTP X)
(NUMBERP I)
(NOT (LESSP (CAR X) I)))
(EQUAL (ADDTOLIST I X) (CONS I X))))
.
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS Z V) to
eliminate (CAR X) and (CDR X). This generates two new goals:
Case 2. (IMPLIES (AND (NOT (LISTP X))
(ORDERED X)
(NUMBER-LISTP X)
(NUMBERP I)
(NOT (LESSP (CAR X) I)))
(EQUAL (ADDTOLIST I X) (CONS I X))),
which simplifies, unfolding the definitions of ORDERED, NUMBER-LISTP, CAR,
EQUAL, LESSP, ADDTOLIST, and CONS, to:
T.
Case 1. (IMPLIES (AND (ORDERED (CONS Z V))
(NUMBER-LISTP (CONS Z V))
(NUMBERP I)
(NOT (LESSP Z I)))
(EQUAL (ADDTOLIST I (CONS Z V))
(CONS I (CONS Z V)))),
which simplifies, rewriting with CAR-CONS and CDR-CONS, and unfolding the
functions ORDERED, NUMBER-LISTP, ADDTOLIST, and LISTP, to the following two
new conjectures:
Case 1.2.
(IMPLIES (AND (NOT (LISTP V))
(NUMBERP Z)
(EQUAL V NIL)
(NUMBERP I)
(NOT (LESSP Z I))
(NOT (LESSP I Z)))
(EQUAL (LIST Z I) (LIST I Z))).
But this again simplifies, using linear arithmetic, to the goal:
(IMPLIES (AND (NOT (LISTP NIL))
(NUMBERP I)
(NUMBERP I)
(NOT (LESSP I I))
(NOT (LESSP I I)))
(EQUAL (LIST I I) (LIST I I))).
This again simplifies, clearly, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LESSP (CAR V) Z))
(ORDERED V)
(NUMBERP Z)
(NUMBER-LISTP V)
(NUMBERP I)
(NOT (LESSP Z I))
(NOT (LESSP I Z)))
(EQUAL (CONS Z (ADDTOLIST I V))
(CONS I (CONS Z V)))).
But this again simplifies, using linear arithmetic, to the formula:
(IMPLIES (AND (NOT (LESSP (CAR V) I))
(ORDERED V)
(NUMBERP I)
(NUMBER-LISTP V)
(NUMBERP I)
(NOT (LESSP I I))
(NOT (LESSP I I)))
(EQUAL (CONS I (ADDTOLIST I V))
(CONS I (CONS I V)))).
However this again simplifies, applying CAR-CONS, CDR-CONS, and CONS-EQUAL,
to:
(IMPLIES (AND (NOT (LESSP (CAR V) I))
(ORDERED V)
(NUMBER-LISTP V)
(NUMBERP I)
(NOT (LESSP I I)))
(EQUAL (ADDTOLIST I V) (CONS I V))),
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 (ORDERED X)
(NUMBER-LISTP X)
(NUMBERP I)
(NOT (LESSP (CAR X) I)))
(EQUAL (ADDTOLIST I X) (CONS I X))).
We named this *1. We will try to prove it by induction. Four 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)
(LISTP (CDR X))
(LESSP (CADR X) (CAR X)))
(p I X))
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (CADR X) (CAR X)))
(p I (CDR X)))
(p I X))
(IMPLIES (AND (LISTP X) (NOT (LISTP (CDR X))))
(p I X))
(IMPLIES (NOT (LISTP X)) (p I 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 generates seven new conjectures:
Case 7. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (CADR X) (CAR X))
(ORDERED X)
(NUMBER-LISTP X)
(NUMBERP I)
(NOT (LESSP (CAR X) I)))
(EQUAL (ADDTOLIST I X) (CONS I X))),
which simplifies, expanding the function ORDERED, to:
T.
Case 6. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (CADR X) (CAR X)))
(NOT (ORDERED (CDR X)))
(ORDERED X)
(NUMBER-LISTP X)
(NUMBERP I)
(NOT (LESSP (CAR X) I)))
(EQUAL (ADDTOLIST I X) (CONS I X))),
which simplifies, unfolding ORDERED, to:
T.
Case 5. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (CADR X) (CAR X)))
(NOT (NUMBER-LISTP (CDR X)))
(ORDERED X)
(NUMBER-LISTP X)
(NUMBERP I)
(NOT (LESSP (CAR X) I)))
(EQUAL (ADDTOLIST I X) (CONS I X))),
which simplifies, opening up the definitions of ORDERED and NUMBER-LISTP, to:
T.
Case 4. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (CADR X) (CAR X)))
(LESSP (CADR X) I)
(ORDERED X)
(NUMBER-LISTP X)
(NUMBERP I)
(NOT (LESSP (CAR X) I)))
(EQUAL (ADDTOLIST I X) (CONS I X))),
which simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (CADR X) (CAR X)))
(EQUAL (ADDTOLIST I (CDR X))
(CONS I (CDR X)))
(ORDERED X)
(NUMBER-LISTP X)
(NUMBERP I)
(NOT (LESSP (CAR X) I)))
(EQUAL (ADDTOLIST I X) (CONS I X))),
which simplifies, rewriting with the lemma CAR-CONS, and unfolding ORDERED,
NUMBER-LISTP, and ADDTOLIST, to:
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (CADR X) (CAR X)))
(EQUAL (ADDTOLIST I (CDR X))
(CONS I (CDR X)))
(ORDERED (CDR X))
(NUMBERP (CAR X))
(NUMBER-LISTP (CDR X))
(NUMBERP I)
(NOT (LESSP (CAR X) I))
(NOT (LESSP I (CAR X))))
(EQUAL (CONS (CAR X) (ADDTOLIST I (CDR X)))
(CONS I X))).
This again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (CADR X) (CAR X)))
(EQUAL (ADDTOLIST (CAR X) (CDR X))
(CONS (CAR X) (CDR X)))
(ORDERED (CDR X))
(NUMBERP (CAR X))
(NUMBER-LISTP (CDR X))
(NUMBERP (CAR X))
(NOT (LESSP (CAR X) (CAR X)))
(NOT (LESSP (CAR X) (CAR X))))
(EQUAL (CONS (CAR X)
(ADDTOLIST (CAR X) (CDR X)))
(CONS (CAR X) X))).
This again simplifies, applying the lemma CONS-CAR-CDR, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(ORDERED X)
(NUMBER-LISTP X)
(NUMBERP I)
(NOT (LESSP (CAR X) I)))
(EQUAL (ADDTOLIST I X) (CONS I X))),
which simplifies, appealing to the lemma CAR-CONS, and opening up ORDERED,
NUMBER-LISTP, and ADDTOLIST, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X))
(NUMBER-LISTP (CDR X))
(NUMBERP I)
(NOT (LESSP (CAR X) I))
(NOT (LESSP I (CAR X))))
(EQUAL (CONS (CAR X) (ADDTOLIST I (CDR X)))
(CONS I X))).
This again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X))
(NUMBER-LISTP (CDR X))
(NUMBERP (CAR X))
(NOT (LESSP (CAR X) (CAR X)))
(NOT (LESSP (CAR X) (CAR X))))
(EQUAL (CONS (CAR X)
(ADDTOLIST (CAR X) (CDR X)))
(CONS (CAR X) X))).
However this again simplifies, appealing to the lemmas CAR-CONS, CDR-CONS,
and CONS-EQUAL, and opening up the definition of ADDTOLIST, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBER-LISTP (CDR X))
(NUMBERP (CAR X))
(NOT (LESSP (CAR X) (CAR X))))
(EQUAL (LIST (CAR X)) X)).
However this further simplifies, applying the lemmas CAR-CONS and CDR-CONS,
and expanding NUMBER-LISTP and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(ORDERED X)
(NUMBER-LISTP X)
(NUMBERP I)
(NOT (LESSP (CAR X) I)))
(EQUAL (ADDTOLIST I X) (CONS I X))),
which simplifies, unfolding the definitions of ORDERED, NUMBER-LISTP, CAR,
EQUAL, LESSP, ADDTOLIST, and CONS, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
ADDTOLIST-OF-ORDERED-NUMBER-LIST
(PROVE-LEMMA SORT-OF-ORDERED-NUMBER-LIST
(REWRITE)
(IMPLIES (AND (ORDERED X) (NUMBER-LISTP X))
(EQUAL (SORT 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))
(LESSP (CADR X) (CAR X)))
(p X))
(IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (CADR X) (CAR 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 six
new goals:
Case 6. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(LESSP (CADR X) (CAR X))
(ORDERED X)
(NUMBER-LISTP X))
(EQUAL (SORT X) X)),
which simplifies, opening up the definition of ORDERED, to:
T.
Case 5. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (CADR X) (CAR X)))
(NOT (ORDERED (CDR X)))
(ORDERED X)
(NUMBER-LISTP X))
(EQUAL (SORT X) X)),
which simplifies, expanding ORDERED, to:
T.
Case 4. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (CADR X) (CAR X)))
(NOT (NUMBER-LISTP (CDR X)))
(ORDERED X)
(NUMBER-LISTP X))
(EQUAL (SORT X) X)),
which simplifies, opening up the definitions of ORDERED and NUMBER-LISTP, to:
T.
Case 3. (IMPLIES (AND (LISTP X)
(LISTP (CDR X))
(NOT (LESSP (CADR X) (CAR X)))
(EQUAL (SORT (CDR X)) (CDR X))
(ORDERED X)
(NUMBER-LISTP X))
(EQUAL (SORT X) X)),
which simplifies, rewriting with CONS-CAR-CDR and
ADDTOLIST-OF-ORDERED-NUMBER-LIST, and opening up the functions ORDERED,
NUMBER-LISTP, and SORT, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(ORDERED X)
(NUMBER-LISTP X))
(EQUAL (SORT X) X)).
This simplifies, unfolding the definitions of ORDERED, NUMBER-LISTP, and
SORT, to the new conjecture:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NUMBERP (CAR X))
(NUMBER-LISTP (CDR X)))
(EQUAL (ADDTOLIST (CAR X) (SORT (CDR X)))
X)),
which further simplifies, applying CAR-CONS and CDR-CONS, and expanding the
functions NUMBER-LISTP, SORT, LISTP, ADDTOLIST, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X))
(ORDERED X)
(NUMBER-LISTP X))
(EQUAL (SORT X) X)).
This simplifies, expanding the definitions of ORDERED, NUMBER-LISTP, SORT,
and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SORT-OF-ORDERED-NUMBER-LIST
(DEFN XOR
(P Q)
(IF Q (IF P F T) (EQUAL P T)))
From the definition we can conclude that:
(OR (FALSEP (XOR P Q))
(TRUEP (XOR P Q)))
is a theorem.
[ 0.0 0.0 0.0 ]
XOR
(PROVE-LEMMA CROCK-DUE-TO-LACK-OF-BOUNCE
(REWRITE)
(IMPLIES (EQUAL X (SORT L))
(ORDERED X)))
WARNING: Note that CROCK-DUE-TO-LACK-OF-BOUNCE contains the free variable L
which will be chosen by instantiating the hypothesis (EQUAL X (SORT L)).
This simplifies, rewriting with ORDERED-SORT, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
CROCK-DUE-TO-LACK-OF-BOUNCE
(PROVE-LEMMA SORT-ORDERED
(REWRITE)
(IMPLIES (NUMBER-LISTP L)
(EQUAL (EQUAL (SORT L) L)
(ORDERED L))))
This simplifies, obviously, to two new formulas:
Case 2. (IMPLIES (AND (NUMBER-LISTP L)
(NOT (EQUAL (SORT L) L)))
(NOT (ORDERED L))),
which again simplifies, applying SORT-OF-ORDERED-NUMBER-LIST, to:
T.
Case 1. (IMPLIES (AND (NUMBER-LISTP L)
(EQUAL (SORT L) L))
(EQUAL (ORDERED L) T)).
But this again simplifies, applying the lemma CROCK-DUE-TO-LACK-OF-BOUNCE,
and opening up the definition of EQUAL, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
SORT-ORDERED
(DEFN SUBST
(X Y Z)
(IF (EQUAL Y Z)
X
(IF (LISTP Z)
(CONS (SUBST X Y (CAR Z))
(SUBST X Y (CDR Z)))
Z)))
Linear arithmetic and the lemmas CDR-LESSP and CAR-LESSP establish that
the measure (COUNT Z) decreases according to the well-founded relation LESSP
in each recursive call. Hence, SUBST is accepted under the principle of
definition. From the definition we can conclude that:
(OR (LISTP (SUBST X Y Z))
(EQUAL (SUBST X Y Z) X)
(EQUAL (SUBST X Y Z) Z))
is a theorem.
[ 0.0 0.0 0.0 ]
SUBST
(PROVE-LEMMA SUBST-A-A NIL
(EQUAL (SUBST A A B) B))
Call the conjecture *1.
Perhaps we can prove it by induction. There is only one plausible
induction. We will induct according to the following scheme:
(AND (IMPLIES (EQUAL A B) (p A B))
(IMPLIES (AND (NOT (EQUAL A B))
(LISTP B)
(p A (CDR B))
(p A (CAR B)))
(p A B))
(IMPLIES (AND (NOT (EQUAL A B))
(NOT (LISTP B)))
(p A B))).
Linear arithmetic and the lemmas CDR-LESSP and CAR-LESSP establish that the
measure (COUNT B) 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 (EQUAL A B)
(EQUAL (SUBST A A B) B)).
This simplifies, expanding the definition of SUBST, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL A B))
(LISTP B)
(EQUAL (SUBST A A (CDR B)) (CDR B))
(EQUAL (SUBST A A (CAR B)) (CAR B)))
(EQUAL (SUBST A A B) B)).
This simplifies, applying CONS-CAR-CDR, and unfolding SUBST, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LISTP B)))
(EQUAL (SUBST A A B) B)),
which simplifies, opening up the function SUBST, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUBST-A-A
(DEFN OCCUR
(X Y)
(IF (EQUAL X Y)
T
(IF (LISTP Y)
(IF (OCCUR X (CAR Y))
T
(OCCUR X (CDR Y)))
F)))
Linear arithmetic and the lemmas CAR-LESSP and CDR-LESSP can be used to
show that the measure (COUNT Y) decreases according to the well-founded
relation LESSP in each recursive call. Hence, OCCUR is accepted under the
definitional principle. Note that:
(OR (FALSEP (OCCUR X Y))
(TRUEP (OCCUR X Y)))
is a theorem.
[ 0.0 0.0 0.0 ]
OCCUR
(PROVE-LEMMA OCCUR-SUBST NIL
(IMPLIES (NOT (OCCUR A B))
(EQUAL (SUBST C A B) B)))
Call the conjecture *1.
Perhaps we can 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 (EQUAL A B) (p C A B))
(IMPLIES (AND (NOT (EQUAL A B))
(LISTP B)
(OCCUR A (CAR B))
(p C A (CAR B)))
(p C A B))
(IMPLIES (AND (NOT (EQUAL A B))
(LISTP B)
(NOT (OCCUR A (CAR B)))
(p C A (CDR B))
(p C A (CAR B)))
(p C A B))
(IMPLIES (AND (NOT (EQUAL A B))
(NOT (LISTP B)))
(p C A B))).
Linear arithmetic and the lemmas CAR-LESSP and CDR-LESSP can be used to prove
that the measure (COUNT B) decreases according to the well-founded relation
LESSP in each induction step of the scheme. The above induction scheme leads
to five new goals:
Case 5. (IMPLIES (AND (EQUAL A B) (NOT (OCCUR A B)))
(EQUAL (SUBST C A B) B)),
which simplifies, opening up the definition of OCCUR, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL A B))
(LISTP B)
(OCCUR A (CAR B))
(NOT (OCCUR A B)))
(EQUAL (SUBST C A B) B)),
which simplifies, expanding OCCUR, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL A B))
(LISTP B)
(NOT (OCCUR A (CAR B)))
(OCCUR A (CDR B))
(EQUAL (SUBST C A (CAR B)) (CAR B))
(NOT (OCCUR A B)))
(EQUAL (SUBST C A B) B)),
which simplifies, opening up the definition of OCCUR, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL A B))
(LISTP B)
(NOT (OCCUR A (CAR B)))
(EQUAL (SUBST C A (CDR B)) (CDR B))
(EQUAL (SUBST C A (CAR B)) (CAR B))
(NOT (OCCUR A B)))
(EQUAL (SUBST C A B) B)),
which simplifies, rewriting with CONS-CAR-CDR, and opening up the functions
OCCUR and SUBST, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LISTP B))
(NOT (OCCUR A B)))
(EQUAL (SUBST C A B) B)).
This simplifies, unfolding the definitions of OCCUR and SUBST, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
OCCUR-SUBST
(DEFN COUNTPS-LOOP
(L PRED ANS)
(IF (LISTP L)
(IF (APPLY$ PRED (LIST (CAR L)))
(COUNTPS-LOOP (CDR L) PRED (ADD1 ANS))
(COUNTPS-LOOP (CDR L) PRED ANS))
ANS))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT L) decreases according to the well-founded relation LESSP in each
recursive call. Hence, COUNTPS-LOOP is accepted under the principle of
definition. Observe that:
(OR (NUMBERP (COUNTPS-LOOP L PRED ANS))
(EQUAL (COUNTPS-LOOP L PRED ANS) ANS))
is a theorem.
[ 0.0 0.0 0.0 ]
COUNTPS-LOOP
(DEFN COUNTPS-
(L PRED)
(COUNTPS-LOOP L PRED 0))
Observe that (NUMBERP (COUNTPS- L PRED)) is a theorem.
[ 0.0 0.0 0.0 ]
COUNTPS-
(PROVE-LEMMA COUNTPS-COUNTPS NIL
(IMPLIES (AND (NUMBERP N)
(LITATOM X)
(NOT (EQUAL PRED 'QUOTE)))
(EQUAL (COUNTPS-LOOP L PRED N)
(PLUS N
(FOR X L
(LIST 'QUOTE T)
'COUNT
(LIST PRED X)
NIL)))))
Give the conjecture the name *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 (AND (LISTP L)
(APPLY$ PRED (LIST (CAR L)))
(p (CDR L) PRED (ADD1 N) X))
(p L PRED N X))
(IMPLIES (AND (LISTP L)
(NOT (APPLY$ PRED (LIST (CAR L))))
(p (CDR L) PRED N X))
(p L PRED N X))
(IMPLIES (NOT (LISTP L))
(p L PRED N X))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT L)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. Note, however, the inductive instances chosen for N. The
above induction scheme produces the following three new goals:
Case 3. (IMPLIES (AND (LISTP L)
(APPLY$ PRED (LIST (CAR L)))
(EQUAL (COUNTPS-LOOP (CDR L) PRED (ADD1 N))
(PLUS (ADD1 N)
(FOR X
(CDR L)
(LIST 'QUOTE T)
'COUNT
(LIST PRED X)
NIL)))
(NUMBERP N)
(LITATOM X)
(NOT (EQUAL PRED 'QUOTE)))
(EQUAL (COUNTPS-LOOP L PRED N)
(PLUS N
(FOR X L
(LIST 'QUOTE T)
'COUNT
(LIST PRED X)
NIL)))).
This simplifies, applying SUB1-ADD1, EVAL$-QUOTE, CDR-CONS, CAR-CONS, and
PLUS-ADD1, and opening up the definitions of PLUS, COUNTPS-LOOP, FOR, CAR,
EQUAL, EVAL$, ASSOC, LISTP, and QUANTIFIER-OPERATION, to:
(IMPLIES (AND (LISTP L)
(APPLY$ PRED (LIST (CAR L)))
(EQUAL (COUNTPS-LOOP (CDR L) PRED (ADD1 N))
(ADD1 (PLUS N
(FOR X
(CDR L)
(LIST 'QUOTE T)
'COUNT
(LIST PRED X)
NIL))))
(NUMBERP N)
(LITATOM X)
(NOT (EQUAL PRED 'QUOTE))
(NOT (NUMBERP (FOR X
(CDR L)
(LIST 'QUOTE T)
'COUNT
(LIST PRED X)
NIL))))
(EQUAL (COUNTPS-LOOP (CDR L) PRED (ADD1 N))
(ADD1 N))).
However this again simplifies, rewriting with PLUS-RIGHT-ID2, to:
T.
Case 2. (IMPLIES (AND (LISTP L)
(NOT (APPLY$ PRED (LIST (CAR L))))
(EQUAL (COUNTPS-LOOP (CDR L) PRED N)
(PLUS N
(FOR X
(CDR L)
(LIST 'QUOTE T)
'COUNT
(LIST PRED X)
NIL)))
(NUMBERP N)
(LITATOM X)
(NOT (EQUAL PRED 'QUOTE)))
(EQUAL (COUNTPS-LOOP L PRED N)
(PLUS N
(FOR X L
(LIST 'QUOTE T)
'COUNT
(LIST PRED X)
NIL)))).
This simplifies, rewriting with EVAL$-QUOTE, CDR-CONS, and CAR-CONS, and
opening up the functions COUNTPS-LOOP, FOR, CAR, EQUAL, EVAL$, ASSOC, LISTP,
and QUANTIFIER-OPERATION, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP L))
(NUMBERP N)
(LITATOM X)
(NOT (EQUAL PRED 'QUOTE)))
(EQUAL (COUNTPS-LOOP L PRED N)
(PLUS N
(FOR X L
(LIST 'QUOTE T)
'COUNT
(LIST PRED X)
NIL)))),
which simplifies, rewriting with COMMUTATIVITY-OF-PLUS, and expanding the
definitions of COUNTPS-LOOP, FOR, QUANTIFIER-INITIAL-VALUE, EQUAL, and PLUS,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
COUNTPS-COUNTPS
(DEFN FACT
(I)
(IF (ZEROP I)
1
(TIMES I (FACT (SUB1 I)))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
can be used to establish that the measure (COUNT I) decreases according to the
well-founded relation LESSP in each recursive call. Hence, FACT is accepted
under the principle of definition. From the definition we can conclude that
(NUMBERP (FACT I)) is a theorem.
[ 0.0 0.0 0.0 ]
FACT
(DEFN FACT-LOOP
(I ANS)
(IF (ZEROP I)
ANS
(FACT-LOOP (SUB1 I) (TIMES I ANS))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
can be used to establish that the measure (COUNT I) decreases according to the
well-founded relation LESSP in each recursive call. Hence, FACT-LOOP is
accepted under the principle of definition. From the definition we can
conclude that (OR (NUMBERP (FACT-LOOP I ANS)) (EQUAL (FACT-LOOP I ANS) ANS))
is a theorem.
[ 0.0 0.0 0.0 ]
FACT-LOOP
(DEFN FACT- (I) (FACT-LOOP I 1))
Observe that (NUMBERP (FACT- I)) is a theorem.
[ 0.0 0.0 0.0 ]
FACT-
(PROVE-LEMMA FACT-LOOP-FACT
(REWRITE)
(IMPLIES (NUMBERP I)
(EQUAL (FACT-LOOP J I)
(TIMES I (FACT J)))))
Name the conjecture *1.
Let us appeal to the induction principle. 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 (ZEROP J) (p J I))
(IMPLIES (AND (NOT (ZEROP J))
(p (SUB1 J) (TIMES J I)))
(p J I))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be
used to show that the measure (COUNT J) decreases according to the
well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instance chosen for I. The above induction scheme
leads to the following two new goals:
Case 2. (IMPLIES (AND (ZEROP J) (NUMBERP I))
(EQUAL (FACT-LOOP J I)
(TIMES I (FACT J)))).
This simplifies, applying COMMUTATIVITY-OF-TIMES, and expanding the
functions ZEROP, EQUAL, FACT-LOOP, and FACT, to two new formulas:
Case 2.2.
(IMPLIES (AND (EQUAL J 0) (NUMBERP I))
(EQUAL I (TIMES 1 I))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (NUMBERP J)) (NUMBERP I))
(EQUAL I (TIMES 1 I))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP J))
(EQUAL (FACT-LOOP (SUB1 J) (TIMES J I))
(TIMES (TIMES J I) (FACT (SUB1 J))))
(NUMBERP I))
(EQUAL (FACT-LOOP J I)
(TIMES I (FACT J)))),
which simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES,
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and ASSOCIATIVITY-OF-TIMES, and expanding
the functions ZEROP, TIMES, FACT-LOOP, and FACT, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
FACT-LOOP-FACT
(PROVE-LEMMA FACT-FACT NIL
(EQUAL (FACT- I) (FACT I)))
This formula can be simplified, using the abbreviation FACT-, to:
(EQUAL (FACT-LOOP I 1) (FACT I)),
which simplifies, applying the lemma FACT-LOOP-FACT, to the goal:
(EQUAL (TIMES 1 (FACT I)) (FACT I)).
This again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
FACT-FACT
(PROVE-LEMMA FACT-FROM-TO NIL
(EQUAL (FACT N)
(FOR I IN (FROM-TO 1 N) MULTIPLY I)))
Call the conjecture *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 (ZEROP N) (p N))
(IMPLIES (AND (NOT (ZEROP N)) (p (SUB1 N)))
(p N))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform
us that the measure (COUNT N) 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 (ZEROP N)
(EQUAL (FACT N)
(FOR I IN (FROM-TO 1 N) MULTIPLY I))).
This simplifies, unfolding the functions ZEROP, FACT, FROM-TO, FOR, EQUAL,
NUMBERP, and LESSP, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(EQUAL (FACT (SUB1 N))
(FOR I IN
(FROM-TO 1 (SUB1 N))
MULTIPLY I)))
(EQUAL (FACT N)
(FOR I IN (FROM-TO 1 N) MULTIPLY I))).
This simplifies, expanding ZEROP, EVAL$, FACT, TIMES, FROM-TO, NUMBERP, and
CONS, to the following three new conjectures:
Case 1.3.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (FACT (SUB1 N))
(FOR I IN
(FROM-TO 1 (SUB1 N))
MULTIPLY I))
(NOT (LESSP N 1))
(EQUAL 1 N))
(EQUAL (PLUS (FACT (SUB1 N))
(TIMES (SUB1 N) (FACT (SUB1 N))))
(FOR I IN '(1) MULTIPLY I))).
But this again simplifies, opening up EQUAL, NUMBERP, SUB1, FACT, FROM-TO,
FOR, LESSP, TIMES, and PLUS, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (FACT (SUB1 N))
(FOR I IN
(FROM-TO 1 (SUB1 N))
MULTIPLY I))
(NOT (LESSP N 1))
(NOT (EQUAL 1 N)))
(EQUAL (PLUS (FACT (SUB1 N))
(TIMES (SUB1 N) (FACT (SUB1 N))))
(FOR I IN
(APPEND (FROM-TO 1 (SUB1 N)) (LIST N))
MULTIPLY I))).
Applying the lemma SUB1-ELIM, replace N by (ADD1 X) to eliminate (SUB1 N).
We use the type restriction lemma noted when SUB1 was introduced to
restrict the new variable. We would thus like to prove:
(IMPLIES (AND (NUMBERP X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (FACT X)
(FOR I IN (FROM-TO 1 X) MULTIPLY I))
(NOT (LESSP (ADD1 X) 1))
(NOT (EQUAL 1 (ADD1 X))))
(EQUAL (PLUS (FACT X) (TIMES X (FACT X)))
(FOR I IN
(APPEND (FROM-TO 1 X) (LIST (ADD1 X)))
MULTIPLY I))),
which further simplifies, applying SUB1-ADD1, ADD1-EQUAL, MEMBER-APPEND,
CAR-CONS, and CDR-CONS, and expanding EVAL$, SUB1, NUMBERP, EQUAL, LESSP,
LISTP, and MEMBER, to the new conjecture:
(IMPLIES (AND (NUMBERP X)
(EQUAL (FACT X)
(FOR I IN (FROM-TO 1 X) MULTIPLY I))
(NOT (EQUAL 0 X)))
(EQUAL (PLUS (FACT X) (TIMES X (FACT X)))
(FOR I IN
(APPEND (FROM-TO 1 X) (LIST (ADD1 X)))
MULTIPLY I))).
We use the above equality hypothesis by substituting:
(FOR I IN (FROM-TO 1 X) MULTIPLY I)
for (FACT X) and throwing away the equality. The result is:
(IMPLIES (AND (NUMBERP X) (NOT (EQUAL 0 X)))
(EQUAL (PLUS (FOR I IN (FROM-TO 1 X) MULTIPLY I)
(TIMES X
(FOR I IN (FROM-TO 1 X) MULTIPLY I)))
(FOR I IN
(APPEND (FROM-TO 1 X) (LIST (ADD1 X)))
MULTIPLY I))).
We will try to prove the above formula by generalizing it, replacing
(FROM-TO 1 X) by Y. The result is:
(IMPLIES (AND (NUMBERP X) (NOT (EQUAL 0 X)))
(EQUAL (PLUS (FOR I IN Y MULTIPLY I)
(TIMES X (FOR I IN Y MULTIPLY I)))
(FOR I IN
(APPEND Y (LIST (ADD1 X)))
MULTIPLY I))).
Finally call the above conjecture *1.1.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (FACT (SUB1 N))
(FOR I IN
(FROM-TO 1 (SUB1 N))
MULTIPLY I))
(LESSP N 1))
(EQUAL (PLUS (FACT (SUB1 N))
(TIMES (SUB1 N) (FACT (SUB1 N))))
(FOR I IN NIL MULTIPLY I))).
But this again simplifies, using linear arithmetic, to:
T.
So we now return to:
(IMPLIES (AND (NUMBERP X) (NOT (EQUAL 0 X)))
(EQUAL (PLUS (FOR I IN Y MULTIPLY I)
(TIMES X (FOR I IN Y MULTIPLY I)))
(FOR I IN
(APPEND Y (LIST (ADD1 X)))
MULTIPLY I))),
which we named *1.1 above. Let us appeal to the induction principle. The
recursive terms in the conjecture suggest four 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 (NLISTP Y) (p Y X))
(IMPLIES (AND (NOT (NLISTP Y))
(EVAL$ T
(LIST 'QUOTE T)
(LIST (CONS 'I (CAR Y))))
(p (CDR Y) X))
(p Y X))
(IMPLIES (AND (NOT (NLISTP Y))
(NOT (EVAL$ T
(LIST 'QUOTE T)
(LIST (CONS 'I (CAR Y)))))
(p (CDR Y) X))
(p Y X))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP establish that the measure (COUNT Y) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme produces three new conjectures:
Case 3. (IMPLIES (AND (NLISTP Y)
(NUMBERP X)
(NOT (EQUAL 0 X)))
(EQUAL (PLUS (FOR I IN Y MULTIPLY I)
(TIMES X (FOR I IN Y MULTIPLY I)))
(FOR I IN
(APPEND Y (LIST (ADD1 X)))
MULTIPLY I))),
which simplifies, applying COMMUTATIVITY-OF-PLUS, COMMUTATIVITY-OF-TIMES,
CAR-CONS, CDR-CONS, TIMES-ADD1, and REWRITE-EVAL$, and expanding NLISTP,
MEMBER, FOR, CDR, ASSOC, QUANTIFIER-INITIAL-VALUE, SUB1, NUMBERP, EQUAL,
TIMES, PLUS, APPEND, LISTP, EVAL$, and QUANTIFIER-OPERATION, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP Y))
(EVAL$ T
(LIST 'QUOTE T)
(LIST (CONS 'I (CAR Y))))
(EQUAL (PLUS (FOR I IN (CDR Y) MULTIPLY I)
(TIMES X
(FOR I IN (CDR Y) MULTIPLY I)))
(FOR I IN
(APPEND (CDR Y) (LIST (ADD1 X)))
MULTIPLY I))
(NUMBERP X)
(NOT (EQUAL 0 X)))
(EQUAL (PLUS (FOR I IN Y MULTIPLY I)
(TIMES X (FOR I IN Y MULTIPLY I)))
(FOR I IN
(APPEND Y (LIST (ADD1 X)))
MULTIPLY I))).
This simplifies, applying the lemmas REWRITE-EVAL$, MEMBER-APPEND, CAR-CONS,
and CDR-CONS, and opening up NLISTP, LISTP, MEMBER, EVAL$, FOR, EQUAL,
QUANTIFIER-OPERATION, and APPEND, to:
(IMPLIES (AND (LISTP Y)
(EQUAL (PLUS (FOR I IN (CDR Y) MULTIPLY I)
(TIMES X
(FOR I IN (CDR Y) MULTIPLY I)))
(FOR I IN
(APPEND (CDR Y) (LIST (ADD1 X)))
MULTIPLY I))
(NUMBERP X)
(NOT (EQUAL 0 X)))
(EQUAL (PLUS (TIMES (CAR Y)
(FOR I IN (CDR Y) MULTIPLY I))
(TIMES X
(CAR Y)
(FOR I IN (CDR Y) MULTIPLY I)))
(TIMES (CAR Y)
(FOR I IN
(APPEND (CDR Y) (LIST (ADD1 X)))
MULTIPLY I)))).
Applying the lemma CAR-CDR-ELIM, replace Y by (CONS V Z) to eliminate
(CDR Y) and (CAR Y). This produces the new formula:
(IMPLIES (AND (EQUAL (PLUS (FOR I IN Z MULTIPLY I)
(TIMES X (FOR I IN Z MULTIPLY I)))
(FOR I IN
(APPEND Z (LIST (ADD1 X)))
MULTIPLY I))
(NUMBERP X)
(NOT (EQUAL 0 X)))
(EQUAL (PLUS (TIMES V (FOR I IN Z MULTIPLY I))
(TIMES X V (FOR I IN Z MULTIPLY I)))
(TIMES V
(FOR I IN
(APPEND Z (LIST (ADD1 X)))
MULTIPLY I)))),
which further simplifies, applying the lemmas MEMBER-APPEND, CAR-CONS,
CDR-CONS, and COMMUTATIVITY2-OF-TIMES, and unfolding the functions EVAL$,
LISTP, and MEMBER, to the goal:
(IMPLIES (AND (EQUAL (PLUS (FOR I IN Z MULTIPLY I)
(TIMES X (FOR I IN Z MULTIPLY I)))
(FOR I IN
(APPEND Z (LIST (ADD1 X)))
MULTIPLY I))
(NUMBERP X)
(NOT (EQUAL 0 X)))
(EQUAL (PLUS (TIMES V (FOR I IN Z MULTIPLY I))
(TIMES V X (FOR I IN Z MULTIPLY I)))
(TIMES V
(FOR I IN
(APPEND Z (LIST (ADD1 X)))
MULTIPLY I)))).
We use the above equality hypothesis by substituting:
(PLUS (FOR I IN Z MULTIPLY I)
(TIMES X (FOR I IN Z MULTIPLY I)))
for (FOR I IN (APPEND Z (LIST (ADD1 X))) MULTIPLY I) and throwing away the
equality. This produces:
(IMPLIES (AND (NUMBERP X) (NOT (EQUAL 0 X)))
(EQUAL (PLUS (TIMES V (FOR I IN Z MULTIPLY I))
(TIMES V X (FOR I IN Z MULTIPLY I)))
(TIMES V
(PLUS (FOR I IN Z MULTIPLY I)
(TIMES X (FOR I IN Z MULTIPLY I)))))),
which further simplifies, appealing to the lemma
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and opening up the definition of EVAL$,
to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP Y))
(NOT (EVAL$ T
(LIST 'QUOTE T)
(LIST (CONS 'I (CAR Y)))))
(EQUAL (PLUS (FOR I IN (CDR Y) MULTIPLY I)
(TIMES X
(FOR I IN (CDR Y) MULTIPLY I)))
(FOR I IN
(APPEND (CDR Y) (LIST (ADD1 X)))
MULTIPLY I))
(NUMBERP X)
(NOT (EQUAL 0 X)))
(EQUAL (PLUS (FOR I IN Y MULTIPLY I)
(TIMES X (FOR I IN Y MULTIPLY I)))
(FOR I IN
(APPEND Y (LIST (ADD1 X)))
MULTIPLY I))),
which simplifies, applying REWRITE-EVAL$, and unfolding the function NLISTP,
to:
T.
That finishes the proof of *1.1, which, in turn, also finishes the proof
of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
FACT-FROM-TO
(DEFN REVERSE-LOOP
(X ANS)
(IF (LISTP X)
(REVERSE-LOOP (CDR X)
(CONS (CAR X) ANS))
ANS))
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, REVERSE-LOOP is accepted under the definitional
principle. From the definition we can conclude that:
(OR (LISTP (REVERSE-LOOP X ANS))
(EQUAL (REVERSE-LOOP X ANS) ANS))
is a theorem.
[ 0.0 0.0 0.0 ]
REVERSE-LOOP
(DEFN REVERSE-
(X)
(REVERSE-LOOP X NIL))
Observe that (OR (LITATOM (REVERSE- X)) (LISTP (REVERSE- X))) is a
theorem.
[ 0.0 0.0 0.0 ]
REVERSE-
(PROVE-LEMMA REVERSE-LOOP-APPEND-REVERSE
(REWRITE)
(EQUAL (REVERSE-LOOP X Y)
(APPEND (REVERSE X) Y)))
Name the conjecture *1.
Perhaps we can 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)
(p (CDR X) (CONS (CAR X) Y)))
(p X Y))
(IMPLIES (NOT (LISTP X)) (p X Y))).
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. Note, however, the inductive instance chosen for Y. The above
induction scheme produces the following two new goals:
Case 2. (IMPLIES (AND (LISTP X)
(EQUAL (REVERSE-LOOP (CDR X)
(CONS (CAR X) Y))
(APPEND (REVERSE (CDR X))
(CONS (CAR X) Y))))
(EQUAL (REVERSE-LOOP X Y)
(APPEND (REVERSE X) Y))).
This simplifies, applying CDR-CONS, CAR-CONS, and ASSOCIATIVITY-OF-APPEND,
and unfolding the definitions of REVERSE-LOOP, REVERSE, APPEND, and LISTP,
to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (REVERSE-LOOP X Y)
(APPEND (REVERSE X) Y))),
which simplifies, unfolding the definitions of REVERSE-LOOP, REVERSE, LISTP,
and APPEND, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
REVERSE-LOOP-APPEND-REVERSE
(PROVE-LEMMA REVERSE-LOOP-REVERSE
(REWRITE)
(EQUAL (REVERSE-LOOP X NIL)
(REVERSE X)))
WARNING: the previously added lemma, REVERSE-LOOP-APPEND-REVERSE, could be
applied whenever the newly proposed REVERSE-LOOP-REVERSE could!
This conjecture can be simplified, using the abbreviation
REVERSE-LOOP-APPEND-REVERSE, to:
(EQUAL (APPEND (REVERSE X) NIL)
(REVERSE X)).
This simplifies, rewriting with PLISTP-REVERSE and APPEND-RIGHT-ID, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
REVERSE-LOOP-REVERSE
(PROVE-LEMMA REVERSE-APPEND NIL
(EQUAL (REVERSE- (APPEND A B))
(APPEND (REVERSE- B) (REVERSE- A))))
This formula can be simplified, using the abbreviations APPEND-REVERSE,
REVERSE-LOOP-REVERSE, and REVERSE-, to:
(EQUAL (APPEND (REVERSE B) (REVERSE A))
(APPEND (REVERSE B) (REVERSE A))),
which simplifies, trivially, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
REVERSE-APPEND
(PROVE-LEMMA REVERSE-REVERSE- NIL
(IMPLIES (PLISTP X)
(EQUAL (REVERSE- (REVERSE- X)) X)))
This conjecture can be simplified, using the abbreviations IMPLIES,
REVERSE-LOOP-REVERSE, and REVERSE-, to the conjecture:
(IMPLIES (PLISTP X)
(EQUAL (REVERSE (REVERSE X)) X)).
This simplifies, applying REVERSE-REVERSE, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
REVERSE-REVERSE-
(DEFN SORT-LP
(X Y)
(IF (LISTP X)
(SORT-LP (CDR X)
(ADDTOLIST (CAR X) Y))
Y))
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, SORT-LP is accepted under the definitional principle.
From the definition we can conclude that:
(OR (LISTP (SORT-LP X Y))
(EQUAL (SORT-LP X Y) Y))
is a theorem.
[ 0.0 0.0 0.0 ]
SORT-LP
(PROVE-LEMMA ORDERED-ADDTOLIST
(REWRITE)
(IMPLIES (ORDERED Y)
(ORDERED (ADDTOLIST X Y))))
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 Y)
(LISTP (CDR Y))
(LESSP (CADR Y) (CAR Y)))
(p X Y))
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(p X (CDR Y)))
(p X Y))
(IMPLIES (AND (LISTP Y) (NOT (LISTP (CDR Y))))
(p X Y))
(IMPLIES (NOT (LISTP Y)) (p X Y))).
Linear arithmetic and the lemma CDR-LESSP can be used to establish that the
measure (COUNT Y) 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 Y)
(LISTP (CDR Y))
(LESSP (CADR Y) (CAR Y))
(ORDERED Y))
(ORDERED (ADDTOLIST X Y))).
This simplifies, expanding the definition of ORDERED, to:
T.
Case 4. (IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(NOT (ORDERED (CDR Y)))
(ORDERED Y))
(ORDERED (ADDTOLIST X Y))).
This simplifies, opening up the function ORDERED, to:
T.
Case 3. (IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(ORDERED (ADDTOLIST X (CDR Y)))
(ORDERED Y))
(ORDERED (ADDTOLIST X Y))).
This simplifies, opening up the definitions of ORDERED and ADDTOLIST, to the
following two new formulas:
Case 3.2.
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(ORDERED (ADDTOLIST X (CDR Y)))
(ORDERED (CDR Y))
(NOT (LESSP X (CAR Y))))
(ORDERED (CONS (CAR Y)
(ADDTOLIST X (CDR Y))))).
This again simplifies, applying CAR-CONS and CDR-CONS, and expanding the
function ORDERED, to the new conjecture:
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(ORDERED (ADDTOLIST X (CDR Y)))
(ORDERED (CDR Y))
(NOT (LESSP X (CAR Y))))
(NOT (LESSP (CAR (ADDTOLIST X (CDR Y)))
(CAR Y)))).
Applying the lemma CAR-CDR-ELIM, replace Y by (CONS V Z) to eliminate
(CDR Y) and (CAR Y) and Z by (CONS W D) to eliminate (CAR Z) and (CDR Z).
We thus obtain:
(IMPLIES (AND (NOT (LESSP W V))
(ORDERED (ADDTOLIST X (CONS W D)))
(ORDERED (CONS W D))
(NOT (LESSP X V)))
(NOT (LESSP (CAR (ADDTOLIST X (CONS W D)))
V))),
which further simplifies, rewriting with CDR-CONS and CAR-CONS, and
opening up the definitions of ADDTOLIST and ORDERED, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(ORDERED (ADDTOLIST X (CDR Y)))
(ORDERED (CDR Y))
(LESSP X (CAR Y)))
(ORDERED (CONS X Y))).
However this again simplifies, appealing to the lemmas CAR-CONS and
CDR-CONS, and opening up ORDERED, to the formula:
(IMPLIES (AND (LISTP Y)
(LISTP (CDR Y))
(NOT (LESSP (CADR Y) (CAR Y)))
(ORDERED (ADDTOLIST X (CDR Y)))
(ORDERED (CDR Y))
(LESSP X (CAR Y)))
(NOT (LESSP (CAR Y) X))).
This again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(ORDERED Y))
(ORDERED (ADDTOLIST X Y))),
which simplifies, expanding the definitions of ORDERED and ADDTOLIST, to two
new formulas:
Case 2.2.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NOT (LESSP X (CAR Y))))
(ORDERED (CONS (CAR Y)
(ADDTOLIST X (CDR Y))))),
which again simplifies, applying CAR-CONS and CDR-CONS, and expanding the
definition of ORDERED, to the following two new conjectures:
Case 2.2.2.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NOT (LESSP X (CAR Y))))
(NOT (LESSP (CAR (ADDTOLIST X (CDR Y)))
(CAR Y)))).
But this further simplifies, applying the lemma CAR-CONS, and opening up
the definition of ADDTOLIST, to:
T.
Case 2.2.1.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(NOT (LESSP X (CAR Y))))
(ORDERED (ADDTOLIST X (CDR Y)))),
which further simplifies, appealing to the lemma CDR-CONS, and unfolding
the functions ADDTOLIST, LISTP, and ORDERED, to:
T.
Case 2.1.
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(LESSP X (CAR Y)))
(ORDERED (CONS X Y))),
which again simplifies, applying CAR-CONS and CDR-CONS, and expanding
ORDERED, to the new formula:
(IMPLIES (AND (LISTP Y)
(NOT (LISTP (CDR Y)))
(LESSP X (CAR Y)))
(NOT (LESSP (CAR Y) X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP Y)) (ORDERED Y))
(ORDERED (ADDTOLIST X Y))),
which simplifies, rewriting with CDR-CONS, and unfolding the definitions of
ORDERED, ADDTOLIST, and LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
ORDERED-ADDTOLIST
(PROVE-LEMMA ORDERED-SORT-LP
(REWRITE)
(IMPLIES (ORDERED Y)
(ORDERED (SORT-LP X Y))))
Call the conjecture *1.
We will try to prove it by induction. The recursive terms in the
conjecture suggest two inductions. However, only one is unflawed. We will
induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(p (CDR X) (ADDTOLIST (CAR X) Y)))
(p X Y))
(IMPLIES (NOT (LISTP X)) (p X Y))).
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. Note, however, the inductive instance
chosen for Y. The above induction scheme generates the following three new
formulas:
Case 3. (IMPLIES (AND (LISTP X)
(NOT (ORDERED (ADDTOLIST (CAR X) Y)))
(ORDERED Y))
(ORDERED (SORT-LP X Y))).
This simplifies, applying ORDERED-ADDTOLIST, to:
T.
Case 2. (IMPLIES (AND (LISTP X)
(ORDERED (SORT-LP (CDR X)
(ADDTOLIST (CAR X) Y)))
(ORDERED Y))
(ORDERED (SORT-LP X Y))),
which simplifies, expanding the function SORT-LP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP X)) (ORDERED Y))
(ORDERED (SORT-LP X Y))),
which simplifies, unfolding the function SORT-LP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
ORDERED-SORT-LP
(PROVE-LEMMA NUMBERP-COUNT
(REWRITE)
(NUMBERP (FOR X L P 'COUNT B A)))
Name the conjecture *1.
Perhaps we can prove it by induction. There is only one plausible
induction. We will induct according to the following scheme:
(AND (IMPLIES (NLISTP L) (p X L P B A))
(IMPLIES (AND (NOT (NLISTP L))
(EVAL$ T P (CONS (CONS X (CAR L)) A))
(p X (CDR L) P B A))
(p X L P B A))
(IMPLIES (AND (NOT (NLISTP L))
(NOT (EVAL$ T P (CONS (CONS X (CAR L)) A)))
(p X (CDR L) P B A))
(p X L P B A))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP establish that the measure (COUNT L) 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 (NLISTP L)
(NUMBERP (FOR X L P 'COUNT B A))).
This simplifies, expanding NLISTP, FOR, QUANTIFIER-INITIAL-VALUE, and
NUMBERP, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP L))
(EVAL$ T P (CONS (CONS X (CAR L)) A))
(NUMBERP (FOR X (CDR L) P 'COUNT B A)))
(NUMBERP (FOR X L P 'COUNT B A))).
This simplifies, unfolding NLISTP, FOR, EQUAL, and QUANTIFIER-OPERATION, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP L))
(NOT (EVAL$ T P (CONS (CONS X (CAR L)) A)))
(NUMBERP (FOR X (CDR L) P 'COUNT B A)))
(NUMBERP (FOR X L P 'COUNT B A))).
This simplifies, opening up NLISTP and FOR, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NUMBERP-COUNT
(PROVE-LEMMA COUNT-SORT-LP
(REWRITE)
(EQUAL (COUNT-LIST Z (SORT-LP X Y))
(PLUS (COUNT-LIST Z X)
(COUNT-LIST Z Y))))
WARNING: Note that the rewrite rule COUNT-SORT-LP will be stored so as to
apply only to terms with the nonrecursive function symbol COUNT-LIST.
This conjecture can be simplified, using the abbreviation COUNT-LIST, to the
goal:
(EQUAL (FOR 'X
(SORT-LP X Y)
(LIST 'QUOTE T)
'COUNT
'(EQUAL A X)
(LIST (CONS 'A Z)))
(PLUS (FOR 'X
X
(LIST 'QUOTE T)
'COUNT
'(EQUAL A X)
(LIST (CONS 'A Z)))
(FOR 'X
Y
(LIST 'QUOTE T)
'COUNT
'(EQUAL A X)
(LIST (CONS 'A Z))))).
This simplifies, opening up the definition of EVAL$, to:
(EQUAL (FOR U IN
(SORT-LP X Y)
COUNT
(EQUAL Z U))
(PLUS (FOR U IN X COUNT (EQUAL Z U))
(FOR U IN Y COUNT (EQUAL Z U)))),
which we will name *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 (AND (LISTP X)
(p (CDR X) (ADDTOLIST (CAR X) Y) Z))
(p X Y Z))
(IMPLIES (NOT (LISTP X)) (p X Y Z))).
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. Note, however, the inductive instance chosen
for Y. The above induction scheme leads to two new formulas:
Case 2. (IMPLIES (AND (LISTP X)
(EQUAL (FOR U IN
(SORT-LP (CDR X)
(ADDTOLIST (CAR X) Y))
COUNT
(EQUAL Z U))
(PLUS (FOR U IN (CDR X) COUNT (EQUAL Z U))
(FOR U IN
(ADDTOLIST (CAR X) Y)
COUNT
(EQUAL Z U)))))
(EQUAL (FOR U IN
(SORT-LP X Y)
COUNT
(EQUAL Z U))
(PLUS (FOR U IN X COUNT (EQUAL Z U))
(FOR U IN Y COUNT (EQUAL Z U))))),
which simplifies, applying the lemmas REWRITE-EVAL$ and
COMMUTATIVITY-OF-PLUS, and opening up the definitions of EVAL$, SORT-LP, FOR,
EQUAL, and QUANTIFIER-OPERATION, to two new conjectures:
Case 2.2.
(IMPLIES (AND (LISTP X)
(EQUAL (FOR U IN
(SORT-LP (CDR X)
(ADDTOLIST (CAR X) Y))
COUNT
(EQUAL Z U))
(PLUS (FOR U IN (CDR X) COUNT (EQUAL Z U))
(FOR U IN
(ADDTOLIST (CAR X) Y)
COUNT
(EQUAL Z U))))
(NOT (EQUAL Z (CAR X))))
(EQUAL (FOR U IN
(SORT-LP (CDR X)
(ADDTOLIST (CAR X) Y))
COUNT
(EQUAL Z U))
(PLUS (FOR U IN Y COUNT (EQUAL Z U))
(FOR U IN
(CDR X)
COUNT
(EQUAL Z U))))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS W V) to eliminate
(CDR X) and (CAR X). This produces the new conjecture:
(IMPLIES (AND (EQUAL (FOR U IN
(SORT-LP V (ADDTOLIST W Y))
COUNT
(EQUAL Z U))
(PLUS (FOR U IN V COUNT (EQUAL Z U))
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL Z U))))
(NOT (EQUAL Z W)))
(EQUAL (FOR U IN
(SORT-LP V (ADDTOLIST W Y))
COUNT
(EQUAL Z U))
(PLUS (FOR U IN Y COUNT (EQUAL Z U))
(FOR U IN V COUNT (EQUAL Z U))))),
which further simplifies, rewriting with COMMUTATIVITY-OF-PLUS, and
opening up the function EVAL$, to:
(IMPLIES (AND (EQUAL (FOR U IN
(SORT-LP V (ADDTOLIST W Y))
COUNT
(EQUAL Z U))
(PLUS (FOR U IN V COUNT (EQUAL Z U))
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL Z U))))
(NOT (EQUAL Z W)))
(EQUAL (FOR U IN
(SORT-LP V (ADDTOLIST W Y))
COUNT
(EQUAL Z U))
(PLUS (FOR U IN V COUNT (EQUAL Z U))
(FOR U IN Y COUNT (EQUAL Z U))))).
We use the above equality hypothesis by substituting:
(PLUS (FOR U IN V COUNT (EQUAL Z U))
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL Z U)))
for (FOR U IN (SORT-LP V (ADDTOLIST W Y)) COUNT (EQUAL Z U)) and throwing
away the equality. We must thus prove:
(IMPLIES (NOT (EQUAL Z W))
(EQUAL (PLUS (FOR U IN V COUNT (EQUAL Z U))
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL Z U)))
(PLUS (FOR U IN V COUNT (EQUAL Z U))
(FOR U IN Y COUNT (EQUAL Z U))))).
But this further simplifies, rewriting with the lemmas
CORRECTNESS-OF-CANCEL and NUMBERP-COUNT, and expanding the definitions of
EVAL$ and FIX, to the conjecture:
(IMPLIES (NOT (EQUAL Z W))
(EQUAL (FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL Z U))
(FOR U IN Y COUNT (EQUAL Z U)))).
Finally name the above subgoal *1.1.
Case 2.1.
(IMPLIES (AND (LISTP X)
(EQUAL (FOR U IN
(SORT-LP (CDR X)
(ADDTOLIST (CAR X) Y))
COUNT
(EQUAL Z U))
(PLUS (FOR U IN (CDR X) COUNT (EQUAL Z U))
(FOR U IN
(ADDTOLIST (CAR X) Y)
COUNT
(EQUAL Z U))))
(EQUAL Z (CAR X)))
(EQUAL (FOR U IN
(SORT-LP (CDR X)
(ADDTOLIST (CAR X) Y))
COUNT
(EQUAL Z U))
(PLUS (FOR U IN Y COUNT (EQUAL Z U))
(ADD1 (FOR U IN
(CDR X)
COUNT
(EQUAL Z U)))))).
This again simplifies, rewriting with NUMBERP-COUNT and PLUS-ADD1, and
expanding EVAL$, to:
(IMPLIES (AND (LISTP X)
(EQUAL (FOR U IN
(SORT-LP (CDR X)
(ADDTOLIST (CAR X) Y))
COUNT
(EQUAL (CAR X) U))
(PLUS (FOR U IN
(CDR X)
COUNT
(EQUAL (CAR X) U))
(FOR U IN
(ADDTOLIST (CAR X) Y)
COUNT
(EQUAL (CAR X) U)))))
(EQUAL (FOR U IN
(SORT-LP (CDR X)
(ADDTOLIST (CAR X) Y))
COUNT
(EQUAL (CAR X) U))
(ADD1 (PLUS (FOR U IN Y COUNT (EQUAL (CAR X) U))
(FOR U IN
(CDR X)
COUNT
(EQUAL (CAR X) U)))))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS W V) to eliminate
(CDR X) and (CAR X). This produces:
(IMPLIES (EQUAL (FOR 'U
(SORT-LP V (ADDTOLIST W Y))
(LIST 'QUOTE T)
'COUNT
'(EQUAL (CAR X) U)
(LIST (CONS 'X (CONS W V))))
(PLUS (FOR 'U
V
(LIST 'QUOTE T)
'COUNT
'(EQUAL (CAR X) U)
(LIST (CONS 'X (CONS W V))))
(FOR 'U
(ADDTOLIST W Y)
(LIST 'QUOTE T)
'COUNT
'(EQUAL (CAR X) U)
(LIST (CONS 'X (CONS W V))))))
(EQUAL (FOR 'U
(SORT-LP V (ADDTOLIST W Y))
(LIST 'QUOTE T)
'COUNT
'(EQUAL (CAR X) U)
(LIST (CONS 'X (CONS W V))))
(ADD1 (PLUS (FOR 'U
Y
(LIST 'QUOTE T)
'COUNT
'(EQUAL (CAR X) U)
(LIST (CONS 'X (CONS W V))))
(FOR 'U
V
(LIST 'QUOTE T)
'COUNT
'(EQUAL (CAR X) U)
(LIST (CONS 'X (CONS W V)))))))),
which further simplifies, appealing to the lemmas CAR-CONS and
COMMUTATIVITY-OF-PLUS, and opening up the definition of EVAL$, to:
(IMPLIES (EQUAL (FOR U IN
(SORT-LP V (ADDTOLIST W Y))
COUNT
(EQUAL W U))
(PLUS (FOR U IN V COUNT (EQUAL W U))
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL W U))))
(EQUAL (FOR U IN
(SORT-LP V (ADDTOLIST W Y))
COUNT
(EQUAL W U))
(ADD1 (PLUS (FOR U IN V COUNT (EQUAL W U))
(FOR U IN Y COUNT (EQUAL W U)))))).
We use the above equality hypothesis by substituting:
(PLUS (FOR U IN V COUNT (EQUAL W U))
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL W U)))
for (FOR U IN (SORT-LP V (ADDTOLIST W Y)) COUNT (EQUAL W U)) and throwing
away the equality. We would thus like to prove:
(EQUAL (PLUS (FOR U IN V COUNT (EQUAL W U))
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL W U)))
(ADD1 (PLUS (FOR U IN V COUNT (EQUAL W U))
(FOR U IN Y COUNT (EQUAL W U))))),
which we generalize by replacing (FOR U IN V COUNT (EQUAL W U)) by A. The
result is the goal:
(EQUAL (PLUS A
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL W U)))
(ADD1 (PLUS A
(FOR U IN Y COUNT (EQUAL W U))))).
Finally name the above subgoal *1.2.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (FOR U IN
(SORT-LP X Y)
COUNT
(EQUAL Z U))
(PLUS (FOR U IN X COUNT (EQUAL Z U))
(FOR U IN Y COUNT (EQUAL Z U))))).
This simplifies, rewriting with NUMBERP-COUNT, and unfolding the functions
SORT-LP, EVAL$, MEMBER, FOR, CDR, ASSOC, QUANTIFIER-INITIAL-VALUE, EQUAL,
and PLUS, to:
T.
So let us turn our attention to:
(EQUAL (PLUS A
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL W U)))
(ADD1 (PLUS A
(FOR U IN Y COUNT (EQUAL W U))))),
which we named *1.2 above. Let us appeal to the induction principle. Four
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 Y) (LESSP W (CAR Y)))
(p A W Y))
(IMPLIES (AND (LISTP Y)
(NOT (LESSP W (CAR Y)))
(p A W (CDR Y)))
(p A W Y))
(IMPLIES (NOT (LISTP Y)) (p A W Y))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT Y)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces three new conjectures:
Case 3. (IMPLIES (AND (LISTP Y) (LESSP W (CAR Y)))
(EQUAL (PLUS A
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL W U)))
(ADD1 (PLUS A
(FOR U IN Y COUNT (EQUAL W U)))))),
which simplifies, applying CAR-CONS, CDR-CONS, and REWRITE-EVAL$, and
unfolding ADDTOLIST, MEMBER, EVAL$, FOR, EQUAL, and QUANTIFIER-OPERATION, to
the following two new formulas:
Case 3.2.
(IMPLIES (AND (LISTP Y)
(LESSP W (CAR Y))
(NOT (EQUAL W (CAR Y))))
(EQUAL (PLUS A
(FOR U IN
(CONS W Y)
COUNT
(EQUAL W U)))
(ADD1 (PLUS A
(FOR U IN
(CDR Y)
COUNT
(EQUAL W U)))))).
This again simplifies, applying CAR-CONS, CDR-CONS, REWRITE-EVAL$,
NUMBERP-COUNT, and PLUS-ADD1, and expanding the definitions of MEMBER,
EVAL$, QUANTIFIER-OPERATION, EQUAL, and FOR, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP Y)
(LESSP W (CAR Y))
(EQUAL W (CAR Y)))
(EQUAL (PLUS A
(FOR U IN
(CONS W Y)
COUNT
(EQUAL W U)))
(ADD1 (PLUS A
(ADD1 (FOR U IN
(CDR Y)
COUNT
(EQUAL W U))))))).
But this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LISTP Y)
(NOT (LESSP W (CAR Y)))
(EQUAL (PLUS A
(FOR U IN
(ADDTOLIST W (CDR Y))
COUNT
(EQUAL W U)))
(ADD1 (PLUS A
(FOR U IN
(CDR Y)
COUNT
(EQUAL W U))))))
(EQUAL (PLUS A
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL W U)))
(ADD1 (PLUS A
(FOR U IN Y COUNT (EQUAL W U)))))),
which simplifies, rewriting with CAR-CONS, CDR-CONS, and REWRITE-EVAL$, and
expanding the definitions of EVAL$, ADDTOLIST, MEMBER, QUANTIFIER-OPERATION,
EQUAL, and FOR, to the new formula:
(IMPLIES (AND (LISTP Y)
(NOT (LESSP W (CAR Y)))
(EQUAL (PLUS A
(FOR U IN
(ADDTOLIST W (CDR Y))
COUNT
(EQUAL W U)))
(ADD1 (PLUS A
(FOR U IN
(CDR Y)
COUNT
(EQUAL W U)))))
(EQUAL W (CAR Y)))
(EQUAL (PLUS A
(ADD1 (FOR U IN
(ADDTOLIST W (CDR Y))
COUNT
(EQUAL W U))))
(ADD1 (PLUS A
(ADD1 (FOR U IN
(CDR Y)
COUNT
(EQUAL W U))))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (NOT (LISTP Y))
(EQUAL (PLUS A
(FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL W U)))
(ADD1 (PLUS A
(FOR U IN Y COUNT (EQUAL W U)))))),
which simplifies, applying CAR-CONS, CDR-CONS, REWRITE-EVAL$, and
COMMUTATIVITY-OF-PLUS, and unfolding the definitions of ADDTOLIST, LISTP,
MEMBER, EVAL$, QUANTIFIER-OPERATION, FOR, CDR, ASSOC,
QUANTIFIER-INITIAL-VALUE, EQUAL, and PLUS, to the following two new
conjectures:
Case 1.2.
(IMPLIES (AND (NOT (LISTP Y))
(NOT (NUMBERP A)))
(EQUAL (PLUS 1 A) 1)).
But this again simplifies, applying PLUS-RIGHT-ID2, and unfolding NUMBERP
and EQUAL, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LISTP Y)) (NUMBERP A))
(EQUAL (PLUS 1 A) (ADD1 A))).
But this again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1.2.
So next consider:
(IMPLIES (NOT (EQUAL Z W))
(EQUAL (FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL Z U))
(FOR U IN Y COUNT (EQUAL Z U)))),
which is formula *1.1 above. 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 Y) (LESSP W (CAR Y)))
(p W Y Z))
(IMPLIES (AND (LISTP Y)
(NOT (LESSP W (CAR Y)))
(p W (CDR Y) Z))
(p W Y Z))
(IMPLIES (NOT (LISTP Y)) (p W Y Z))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT Y)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme generates three new formulas:
Case 3. (IMPLIES (AND (LISTP Y)
(LESSP W (CAR Y))
(NOT (EQUAL Z W)))
(EQUAL (FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL Z U))
(FOR U IN Y COUNT (EQUAL Z U)))),
which simplifies, applying CAR-CONS, CDR-CONS, and REWRITE-EVAL$, and
unfolding the definitions of ADDTOLIST, MEMBER, EVAL$, FOR, EQUAL, and
QUANTIFIER-OPERATION, to the following two new formulas:
Case 3.2.
(IMPLIES (AND (LISTP Y)
(LESSP W (CAR Y))
(NOT (EQUAL Z W))
(NOT (EQUAL Z (CAR Y))))
(EQUAL (FOR U IN
(CONS W Y)
COUNT
(EQUAL Z U))
(FOR U IN
(CDR Y)
COUNT
(EQUAL Z U)))).
But this again simplifies, rewriting with CAR-CONS, CDR-CONS, and
REWRITE-EVAL$, and opening up the functions MEMBER, EVAL$,
QUANTIFIER-OPERATION, EQUAL, and FOR, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP Y)
(LESSP W (CAR Y))
(NOT (EQUAL Z W))
(EQUAL Z (CAR Y)))
(EQUAL (FOR U IN
(CONS W Y)
COUNT
(EQUAL Z U))
(ADD1 (FOR U IN
(CDR Y)
COUNT
(EQUAL Z U))))).
However this again simplifies, rewriting with CAR-CONS, CDR-CONS, and
REWRITE-EVAL$, and expanding MEMBER, EVAL$, QUANTIFIER-OPERATION, EQUAL,
and FOR, to:
(IMPLIES (AND (LISTP Y)
(LESSP W (CAR Y))
(NOT (EQUAL (CAR Y) W)))
(EQUAL (FOR U IN Y COUNT (EQUAL (CAR Y) U))
(ADD1 (FOR U IN
(CDR Y)
COUNT
(EQUAL (CAR Y) U))))),
which again simplifies, rewriting with REWRITE-EVAL$, and unfolding the
functions EVAL$, QUANTIFIER-OPERATION, EQUAL, and FOR, to:
T.
Case 2. (IMPLIES (AND (LISTP Y)
(NOT (LESSP W (CAR Y)))
(EQUAL (FOR U IN
(ADDTOLIST W (CDR Y))
COUNT
(EQUAL Z U))
(FOR U IN (CDR Y) COUNT (EQUAL Z U)))
(NOT (EQUAL Z W)))
(EQUAL (FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL Z U))
(FOR U IN Y COUNT (EQUAL Z U)))).
This simplifies, rewriting with CAR-CONS, CDR-CONS, and REWRITE-EVAL$, and
expanding EVAL$, ADDTOLIST, MEMBER, QUANTIFIER-OPERATION, EQUAL, and FOR, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP Y))
(NOT (EQUAL Z W)))
(EQUAL (FOR U IN
(ADDTOLIST W Y)
COUNT
(EQUAL Z U))
(FOR U IN Y COUNT (EQUAL Z U)))),
which simplifies, rewriting with the lemmas CAR-CONS, CDR-CONS, and
REWRITE-EVAL$, and expanding the functions ADDTOLIST, LISTP, MEMBER, EVAL$,
QUANTIFIER-OPERATION, QUANTIFIER-INITIAL-VALUE, ASSOC, CDR, FOR, and EQUAL,
to:
T.
That finishes the proof of *1.1, which finishes the proof of *1. Q.E.D.
[ 0.0 0.6 0.0 ]
COUNT-SORT-LP
(PROVE-LEMMA APPEND-CANCELLATION
(REWRITE)
(EQUAL (EQUAL (APPEND A B) (APPEND A C))
(EQUAL B C)))
This simplifies, obviously, to two new formulas:
Case 2. (IMPLIES (NOT (EQUAL B C))
(NOT (EQUAL (APPEND A B) (APPEND A C)))),
which we will name *1.
Case 1. (IMPLIES (EQUAL B C)
(EQUAL (EQUAL (APPEND A B) (APPEND A C))
T)).
This again simplifies, opening up the definition of EQUAL, to:
T.
So next consider:
(IMPLIES (NOT (EQUAL B C))
(NOT (EQUAL (APPEND A B) (APPEND A C)))),
which we named *1 above. 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 A) (p (CDR A) B C))
(p A B C))
(IMPLIES (NOT (LISTP A)) (p A B C))).
Linear arithmetic and the lemma CDR-LESSP 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 leads to two new goals:
Case 2. (IMPLIES (AND (LISTP A)
(NOT (EQUAL (APPEND (CDR A) B)
(APPEND (CDR A) C)))
(NOT (EQUAL B C)))
(NOT (EQUAL (APPEND A B) (APPEND A C)))),
which simplifies, appealing to the lemmas CAR-CONS and CDR-CONS, and
unfolding the function APPEND, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP A))
(NOT (EQUAL B C)))
(NOT (EQUAL (APPEND A B) (APPEND A C)))),
which simplifies, opening up APPEND, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
APPEND-CANCELLATION
(PROVE-LEMMA EQUAL-LESSP
(REWRITE)
(EQUAL (EQUAL (LESSP X Y) Z)
(IF (LESSP X Y)
(EQUAL T Z)
(EQUAL F Z))))
This simplifies, clearly, to the following four new formulas:
Case 4. (IMPLIES (AND (EQUAL (LESSP X Y) Z)
(NOT (LESSP X Y)))
(NOT Z)).
This again simplifies, trivially, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL (LESSP X Y) Z))
(NOT (LESSP X Y)))
Z).
This again simplifies, clearly, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL (LESSP X Y) Z))
(LESSP X Y))
(NOT (EQUAL T Z))).
This again simplifies, obviously, to:
T.
Case 1. (IMPLIES (AND (EQUAL (LESSP X Y) Z)
(LESSP X Y))
(EQUAL (EQUAL T Z) T)).
This again simplifies, obviously, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EQUAL-LESSP
(PROVE-LEMMA DIFFERENCE-ELIM
(ELIM)
(IMPLIES (AND (NUMBERP Y) (NOT (LESSP Y X)))
(EQUAL (PLUS X (DIFFERENCE Y X)) Y)))
This conjecture simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIFFERENCE-ELIM
(DEFN POWER-EVAL
(L BASE)
(IF (LISTP L)
(PLUS (CAR L)
(TIMES BASE
(POWER-EVAL (CDR L) BASE)))
0))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT L) decreases according to the well-founded relation LESSP in each
recursive call. Hence, POWER-EVAL is accepted under the principle of
definition. Note that (NUMBERP (POWER-EVAL L BASE)) is a theorem.
[ 0.0 0.0 0.0 ]
POWER-EVAL
(DEFN BIG-PLUS1
(L I BASE)
(IF (LISTP L)
(IF (ZEROP I)
L
(CONS (REMAINDER (PLUS (CAR L) I) BASE)
(BIG-PLUS1 (CDR L)
(QUOTIENT (PLUS (CAR L) I) BASE)
BASE)))
(CONS I NIL)))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT L) decreases according to the well-founded relation LESSP in each
recursive call. Hence, BIG-PLUS1 is accepted under the principle of
definition. From the definition we can conclude that:
(LISTP (BIG-PLUS1 L I BASE))
is a theorem.
[ 0.0 0.0 0.0 ]
BIG-PLUS1
(PROVE-LEMMA REMAINDER-QUOTIENT
(REWRITE)
(EQUAL (PLUS (REMAINDER X Y)
(TIMES Y (QUOTIENT X Y)))
(FIX X)))
WARNING: the previously added lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the newly proposed REMAINDER-QUOTIENT could!
This formula simplifies, opening up the function FIX, to the following two new
goals:
Case 2. (IMPLIES (NOT (NUMBERP X))
(EQUAL (PLUS (REMAINDER X Y)
(TIMES Y (QUOTIENT X Y)))
0)).
However this again simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and
opening up LESSP, REMAINDER, QUOTIENT, EQUAL, TIMES, and PLUS, to:
T.
Case 1. (IMPLIES (NUMBERP X)
(EQUAL (PLUS (REMAINDER X Y)
(TIMES Y (QUOTIENT X Y)))
X)).
Call the above conjecture *1.
We will appeal to induction. Three 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 (ZEROP Y) (p X Y))
(IMPLIES (AND (NOT (ZEROP Y)) (LESSP X Y))
(p X Y))
(IMPLIES (AND (NOT (ZEROP Y))
(NOT (LESSP X Y))
(p (DIFFERENCE X Y) Y))
(p X Y))).
Linear arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the
definition of ZEROP 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 three new goals:
Case 3. (IMPLIES (AND (ZEROP Y) (NUMBERP X))
(EQUAL (PLUS (REMAINDER X Y)
(TIMES Y (QUOTIENT X Y)))
X)),
which simplifies, applying COMMUTATIVITY-OF-PLUS, TIMES-ZERO2, and
COMMUTATIVITY-OF-TIMES, and unfolding the functions ZEROP, EQUAL, REMAINDER,
QUOTIENT, TIMES, and PLUS, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP Y))
(LESSP X Y)
(NUMBERP X))
(EQUAL (PLUS (REMAINDER X Y)
(TIMES Y (QUOTIENT X Y)))
X)).
This simplifies, rewriting with the lemmas COMMUTATIVITY-OF-TIMES and
COMMUTATIVITY-OF-PLUS, and opening up the functions ZEROP, REMAINDER,
QUOTIENT, EQUAL, TIMES, and PLUS, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP Y))
(NOT (LESSP X Y))
(EQUAL (PLUS (REMAINDER (DIFFERENCE X Y) Y)
(TIMES Y
(QUOTIENT (DIFFERENCE X Y) Y)))
(DIFFERENCE X Y))
(NUMBERP X))
(EQUAL (PLUS (REMAINDER X Y)
(TIMES Y (QUOTIENT X Y)))
X)).
This simplifies, rewriting with TIMES-ADD1 and COMMUTATIVITY2-OF-PLUS, and
opening up the functions ZEROP, REMAINDER, and QUOTIENT, to the goal:
(IMPLIES (AND (NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (LESSP X Y))
(EQUAL (PLUS (REMAINDER (DIFFERENCE X Y) Y)
(TIMES Y
(QUOTIENT (DIFFERENCE X Y) Y)))
(DIFFERENCE X Y))
(NUMBERP X))
(EQUAL (PLUS Y (DIFFERENCE X Y)) X)).
But this again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
REMAINDER-QUOTIENT
(PROVE-LEMMA POWER-EVAL-BIG-PLUS1
(REWRITE)
(EQUAL (POWER-EVAL (BIG-PLUS1 L I BASE) BASE)
(PLUS (POWER-EVAL L BASE) I)))
This conjecture simplifies, rewriting with COMMUTATIVITY-OF-PLUS, to:
(EQUAL (POWER-EVAL (BIG-PLUS1 L I BASE) BASE)
(PLUS I (POWER-EVAL L BASE))),
which we will name *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 (AND (LISTP L) (ZEROP I))
(p L I BASE))
(IMPLIES (AND (LISTP L)
(NOT (ZEROP I))
(p (CDR L)
(QUOTIENT (PLUS (CAR L) I) BASE)
BASE))
(p L I BASE))
(IMPLIES (NOT (LISTP L))
(p L I BASE))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT L)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. Note, however, the inductive instance chosen for I. The above
induction scheme produces the following three new goals:
Case 3. (IMPLIES (AND (LISTP L) (ZEROP I))
(EQUAL (POWER-EVAL (BIG-PLUS1 L I BASE) BASE)
(PLUS I (POWER-EVAL L BASE)))).
This simplifies, rewriting with the lemma CORRECTNESS-OF-CANCEL, and
unfolding ZEROP, EQUAL, BIG-PLUS1, POWER-EVAL, and FIX, to:
T.
Case 2. (IMPLIES
(AND (LISTP L)
(NOT (ZEROP I))
(EQUAL (POWER-EVAL (BIG-PLUS1 (CDR L)
(QUOTIENT (PLUS (CAR L) I) BASE)
BASE)
BASE)
(PLUS (QUOTIENT (PLUS (CAR L) I) BASE)
(POWER-EVAL (CDR L) BASE))))
(EQUAL (POWER-EVAL (BIG-PLUS1 L I BASE) BASE)
(PLUS I (POWER-EVAL L BASE)))).
This simplifies, rewriting with COMMUTATIVITY-OF-PLUS,
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, CDR-CONS, CAR-CONS, CORRECTNESS-OF-CANCEL,
and REMAINDER-QUOTIENT, and expanding the definitions of ZEROP, BIG-PLUS1,
and POWER-EVAL, to:
T.
Case 1. (IMPLIES (NOT (LISTP L))
(EQUAL (POWER-EVAL (BIG-PLUS1 L I BASE) BASE)
(PLUS I (POWER-EVAL L BASE)))),
which simplifies, applying CDR-CONS, CAR-CONS, COMMUTATIVITY-OF-TIMES, and
COMMUTATIVITY-OF-PLUS, and opening up BIG-PLUS1, POWER-EVAL, LISTP, EQUAL,
TIMES, and PLUS, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
POWER-EVAL-BIG-PLUS1
(DEFN BIG-PLUS
(X Y I BASE)
(IF (LISTP X)
(IF (LISTP Y)
(CONS (REMAINDER (PLUS I (PLUS (CAR X) (CAR Y)))
BASE)
(BIG-PLUS (CDR X)
(CDR Y)
(QUOTIENT (PLUS I (PLUS (CAR X) (CAR Y)))
BASE)
BASE))
(BIG-PLUS1 X I BASE))
(BIG-PLUS1 Y I BASE)))
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, BIG-PLUS is accepted under the definitional principle.
The definition of BIG-PLUS can be justified in another way. Linear arithmetic
and the lemma CDR-LESSP can be used to establish that the measure (COUNT Y)
decreases according to the well-founded relation LESSP in each recursive call.
Observe that (LISTP (BIG-PLUS X Y I BASE)) is a theorem.
[ 0.0 0.0 0.0 ]
BIG-PLUS
(PROVE-LEMMA POWER-EVAL-BIG-PLUS
(REWRITE)
(EQUAL (POWER-EVAL (BIG-PLUS X Y I BASE)
BASE)
(PLUS I
(PLUS (POWER-EVAL X BASE)
(POWER-EVAL Y BASE)))))
Give the conjecture the name *1.
Perhaps we can prove it by induction. The recursive terms in the
conjecture suggest five inductions. 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)
(LISTP Y)
(p (CDR X)
(CDR Y)
(QUOTIENT (PLUS I (CAR X) (CAR Y))
BASE)
BASE))
(p X Y I BASE))
(IMPLIES (AND (LISTP X) (NOT (LISTP Y)))
(p X Y I BASE))
(IMPLIES (NOT (LISTP X))
(p X Y I BASE))).
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. Note, however, the inductive instances chosen for Y and I.
The above induction scheme leads to the following three new conjectures:
Case 3. (IMPLIES
(AND (LISTP X)
(LISTP Y)
(EQUAL (POWER-EVAL (BIG-PLUS (CDR X)
(CDR Y)
(QUOTIENT (PLUS I (CAR X) (CAR Y))
BASE)
BASE)
BASE)
(PLUS (QUOTIENT (PLUS I (CAR X) (CAR Y))
BASE)
(POWER-EVAL (CDR X) BASE)
(POWER-EVAL (CDR Y) BASE))))
(EQUAL (POWER-EVAL (BIG-PLUS X Y I BASE)
BASE)
(PLUS I
(POWER-EVAL X BASE)
(POWER-EVAL Y BASE)))).
This simplifies, appealing to the lemmas ASSOCIATIVITY-OF-PLUS,
COMMUTATIVITY-OF-PLUS, CDR-CONS, CAR-CONS, and COMMUTATIVITY2-OF-PLUS, and
unfolding BIG-PLUS and POWER-EVAL, to the new conjecture:
(IMPLIES
(AND (LISTP X)
(LISTP Y)
(EQUAL (POWER-EVAL (BIG-PLUS (CDR X)
(CDR Y)
(QUOTIENT (PLUS I (CAR X) (CAR Y))
BASE)
BASE)
BASE)
(PLUS (POWER-EVAL (CDR X) BASE)
(POWER-EVAL (CDR Y) BASE)
(QUOTIENT (PLUS I (CAR X) (CAR Y))
BASE))))
(EQUAL
(PLUS (REMAINDER (PLUS I (CAR X) (CAR Y))
BASE)
(TIMES BASE
(POWER-EVAL (BIG-PLUS (CDR X)
(CDR Y)
(QUOTIENT (PLUS I (CAR X) (CAR Y))
BASE)
BASE)
BASE)))
(PLUS I
(CAR X)
(CAR Y)
(TIMES BASE (POWER-EVAL (CDR X) BASE))
(TIMES BASE
(POWER-EVAL (CDR Y) BASE))))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS V Z) to eliminate
(CDR X) and (CAR X). We thus obtain the new conjecture:
(IMPLIES
(AND (LISTP Y)
(EQUAL (POWER-EVAL (BIG-PLUS Z
(CDR Y)
(QUOTIENT (PLUS I V (CAR Y)) BASE)
BASE)
BASE)
(PLUS (POWER-EVAL Z BASE)
(POWER-EVAL (CDR Y) BASE)
(QUOTIENT (PLUS I V (CAR Y)) BASE))))
(EQUAL
(PLUS (REMAINDER (PLUS I V (CAR Y)) BASE)
(TIMES BASE
(POWER-EVAL (BIG-PLUS Z
(CDR Y)
(QUOTIENT (PLUS I V (CAR Y)) BASE)
BASE)
BASE)))
(PLUS I V
(CAR Y)
(TIMES BASE (POWER-EVAL Z BASE))
(TIMES BASE
(POWER-EVAL (CDR Y) BASE))))).
Applying the lemma CAR-CDR-ELIM, replace Y by (CONS D W) to eliminate
(CDR Y) and (CAR Y). This produces:
(IMPLIES
(EQUAL (POWER-EVAL (BIG-PLUS Z W
(QUOTIENT (PLUS I V D) BASE)
BASE)
BASE)
(PLUS (POWER-EVAL Z BASE)
(POWER-EVAL W BASE)
(QUOTIENT (PLUS I V D) BASE)))
(EQUAL (PLUS (REMAINDER (PLUS I V D) BASE)
(TIMES BASE
(POWER-EVAL (BIG-PLUS Z W
(QUOTIENT (PLUS I V D) BASE)
BASE)
BASE)))
(PLUS I V D
(TIMES BASE (POWER-EVAL Z BASE))
(TIMES BASE (POWER-EVAL W BASE))))),
which further simplifies, applying COMMUTATIVITY-OF-PLUS and
COMMUTATIVITY2-OF-PLUS, to the new conjecture:
(IMPLIES
(EQUAL (POWER-EVAL (BIG-PLUS Z W
(QUOTIENT (PLUS D I V) BASE)
BASE)
BASE)
(PLUS (POWER-EVAL W BASE)
(POWER-EVAL Z BASE)
(QUOTIENT (PLUS D I V) BASE)))
(EQUAL (PLUS (REMAINDER (PLUS D I V) BASE)
(TIMES BASE
(POWER-EVAL (BIG-PLUS Z W
(QUOTIENT (PLUS D I V) BASE)
BASE)
BASE)))
(PLUS D I V
(TIMES BASE (POWER-EVAL W BASE))
(TIMES BASE (POWER-EVAL Z BASE))))).
We use the above equality hypothesis by substituting:
(PLUS (POWER-EVAL W BASE)
(POWER-EVAL Z BASE)
(QUOTIENT (PLUS D I V) BASE))
for (POWER-EVAL (BIG-PLUS Z W (QUOTIENT (PLUS D I V) BASE) BASE) BASE) and
throwing away the equality. The result is:
(EQUAL (PLUS (REMAINDER (PLUS D I V) BASE)
(TIMES BASE
(PLUS (POWER-EVAL W BASE)
(POWER-EVAL Z BASE)
(QUOTIENT (PLUS D I V) BASE))))
(PLUS D I V
(TIMES BASE (POWER-EVAL W BASE))
(TIMES BASE (POWER-EVAL Z BASE)))).
But this finally simplifies, rewriting with
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, REMAINDER-QUOTIENT, ASSOCIATIVITY-OF-PLUS,
COMMUTATIVITY-OF-PLUS, and COMMUTATIVITY2-OF-PLUS, to:
T.
Case 2. (IMPLIES (AND (LISTP X) (NOT (LISTP Y)))
(EQUAL (POWER-EVAL (BIG-PLUS X Y I BASE)
BASE)
(PLUS I
(POWER-EVAL X BASE)
(POWER-EVAL Y BASE)))).
This simplifies, rewriting with COMMUTATIVITY-OF-PLUS,
COMMUTATIVITY2-OF-PLUS, ASSOCIATIVITY-OF-PLUS, and POWER-EVAL-BIG-PLUS1, and
expanding the functions BIG-PLUS, POWER-EVAL, EQUAL, and PLUS, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (POWER-EVAL (BIG-PLUS X Y I BASE)
BASE)
(PLUS I
(POWER-EVAL X BASE)
(POWER-EVAL Y BASE)))),
which simplifies, rewriting with COMMUTATIVITY-OF-PLUS, POWER-EVAL-BIG-PLUS1,
COMMUTATIVITY2-OF-PLUS, and CORRECTNESS-OF-CANCEL, and expanding the
definitions of BIG-PLUS, POWER-EVAL, FIX, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.4 0.0 ]
POWER-EVAL-BIG-PLUS
(PROVE-LEMMA REMAINDER-WRT-1
(REWRITE)
(EQUAL (REMAINDER Y 1) 0))
Call the conjecture *1.
We will try to prove it by induction. There is only one suggested
induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP 1) (p Y))
(IMPLIES (AND (NOT (ZEROP 1)) (LESSP Y 1))
(p Y))
(IMPLIES (AND (NOT (ZEROP 1))
(NOT (LESSP Y 1))
(p (DIFFERENCE Y 1)))
(p Y))).
Linear arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the
definition of ZEROP can be used to establish that the measure (COUNT Y)
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 (ZEROP 1)
(EQUAL (REMAINDER Y 1) 0)).
This simplifies, expanding the definition of ZEROP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP 1)) (LESSP Y 1))
(EQUAL (REMAINDER Y 1) 0)).
This simplifies, opening up the functions ZEROP, REMAINDER, EQUAL, and
NUMBERP, to the new goal:
(IMPLIES (AND (LESSP Y 1) (NUMBERP Y))
(EQUAL Y 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP 1))
(NOT (LESSP Y 1))
(EQUAL (REMAINDER (DIFFERENCE Y 1) 1)
0))
(EQUAL (REMAINDER Y 1) 0)),
which simplifies, expanding ZEROP, REMAINDER, EQUAL, and NUMBERP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
REMAINDER-WRT-1
(PROVE-LEMMA REMAINDER-WRT-12
(REWRITE)
(IMPLIES (NOT (NUMBERP X))
(EQUAL (REMAINDER Y X) (FIX Y))))
This simplifies, unfolding the definitions of REMAINDER and FIX, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
REMAINDER-WRT-12
(PROVE-LEMMA LESSP-REMAINDER2
(REWRITE GENERALIZE)
(EQUAL (LESSP (REMAINDER X Y) Y)
(NOT (ZEROP Y))))
This conjecture simplifies, applying EQUAL-LESSP, and unfolding the functions
ZEROP and NOT, to three new goals:
Case 3. (IMPLIES (AND (NOT (LESSP (REMAINDER X Y) Y))
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))),
which we will name *1.
Case 2. (IMPLIES (LESSP (REMAINDER X Y) Y)
(NUMBERP Y)).
This again simplifies, applying REMAINDER-WRT-12, and unfolding the
definition of LESSP, to:
T.
Case 1. (IMPLIES (LESSP (REMAINDER X Y) Y)
(NOT (EQUAL Y 0))).
This again simplifies, using linear arithmetic, to:
T.
So next consider:
(IMPLIES (AND (NOT (LESSP (REMAINDER X Y) Y))
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))),
named *1 above. Let us appeal to the induction principle. The recursive
terms in the conjecture suggest two inductions. However, only one is unflawed.
We will induct according to the following scheme:
(AND (IMPLIES (ZEROP Y) (p Y X))
(IMPLIES (AND (NOT (ZEROP Y)) (LESSP X Y))
(p Y X))
(IMPLIES (AND (NOT (ZEROP Y))
(NOT (LESSP X Y))
(p Y (DIFFERENCE X Y)))
(p Y X))).
Linear arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the
definition of ZEROP 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 three new conjectures:
Case 3. (IMPLIES (AND (ZEROP Y)
(NOT (LESSP (REMAINDER X Y) Y))
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))),
which simplifies, unfolding the function ZEROP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP Y))
(LESSP X Y)
(NOT (LESSP (REMAINDER X Y) Y))
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))),
which simplifies, unfolding ZEROP and REMAINDER, to:
(IMPLIES (AND (LESSP X Y)
(NOT (NUMBERP X))
(NOT (LESSP 0 Y))
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))).
This again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP Y))
(NOT (LESSP X Y))
(LESSP (REMAINDER (DIFFERENCE X Y) Y)
Y)
(NOT (LESSP (REMAINDER X Y) Y))
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))),
which simplifies, expanding the functions ZEROP and REMAINDER, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LESSP-REMAINDER2
(PROVE-LEMMA REMAINDER-X-X
(REWRITE)
(EQUAL (REMAINDER X X) 0))
This conjecture simplifies, rewriting with DIFFERENCE-0, and expanding the
functions NUMBERP, REMAINDER, LESSP, and EQUAL, to:
(IMPLIES (AND (NOT (EQUAL X 0)) (NUMBERP X))
(NOT (LESSP X X))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
REMAINDER-X-X
(PROVE-LEMMA REMAINDER-QUOTIENT-ELIM
(ELIM)
(IMPLIES (AND (NOT (ZEROP Y)) (NUMBERP X))
(EQUAL (PLUS (REMAINDER X Y)
(TIMES Y (QUOTIENT X Y)))
X)))
This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and
IMPLIES, to:
(IMPLIES (AND (NOT (EQUAL Y 0))
(NUMBERP Y)
(NUMBERP X))
(EQUAL (PLUS (REMAINDER X Y)
(TIMES Y (QUOTIENT X Y)))
X)),
which simplifies, rewriting with REMAINDER-QUOTIENT, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
REMAINDER-QUOTIENT-ELIM
(PROVE-LEMMA LESSP-TIMES-1
(REWRITE)
(IMPLIES (NOT (ZEROP I))
(NOT (LESSP (TIMES I J) J))))
WARNING: Note that the proposed lemma LESSP-TIMES-1 is to be stored as zero
type prescription rules, zero compound recognizer rules, one linear rule, and
zero replacement rules.
This formula can be simplified, using the abbreviations ZEROP, NOT, and
IMPLIES, to:
(IMPLIES (AND (NOT (EQUAL I 0)) (NUMBERP I))
(NOT (LESSP (TIMES I J) J))),
which we will name *1.
We will appeal to induction. There are two plausible inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (ZEROP I) (p I J))
(IMPLIES (AND (NOT (ZEROP I)) (p (SUB1 I) J))
(p I J))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be
used to show that the measure (COUNT I) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme produces three new conjectures:
Case 3. (IMPLIES (AND (ZEROP I)
(NOT (EQUAL I 0))
(NUMBERP I))
(NOT (LESSP (TIMES I J) J))),
which simplifies, opening up the definition of ZEROP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP I))
(EQUAL (SUB1 I) 0)
(NOT (EQUAL I 0))
(NUMBERP I))
(NOT (LESSP (TIMES I J) J))),
which simplifies, unfolding the functions ZEROP and TIMES, to the goal:
(IMPLIES (AND (EQUAL (SUB1 I) 0)
(NOT (EQUAL I 0))
(NUMBERP I))
(NOT (LESSP (PLUS J (TIMES (SUB1 I) J))
J))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP I))
(NOT (LESSP (TIMES (SUB1 I) J) J))
(NOT (EQUAL I 0))
(NUMBERP I))
(NOT (LESSP (TIMES I J) J))),
which simplifies, opening up ZEROP and TIMES, to:
(IMPLIES (AND (NOT (LESSP (TIMES (SUB1 I) J) J))
(NOT (EQUAL I 0))
(NUMBERP I))
(NOT (LESSP (PLUS J (TIMES (SUB1 I) J))
J))).
But this again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LESSP-TIMES-1
(PROVE-LEMMA LESSP-TIMES-2
(REWRITE)
(IMPLIES (NOT (ZEROP I))
(NOT (LESSP (TIMES J I) J))))
WARNING: Note that the proposed lemma LESSP-TIMES-2 is to be stored as zero
type prescription rules, zero compound recognizer rules, one linear rule, and
zero replacement rules.
This formula can be simplified, using the abbreviations ZEROP, NOT, and
IMPLIES, to:
(IMPLIES (AND (NOT (EQUAL I 0)) (NUMBERP I))
(NOT (LESSP (TIMES J I) J))),
which simplifies, rewriting with the lemma COMMUTATIVITY-OF-TIMES, to:
(IMPLIES (AND (NOT (EQUAL I 0)) (NUMBERP I))
(NOT (LESSP (TIMES I J) J))).
But this again simplifies, using linear arithmetic and applying the lemma
LESSP-TIMES-1, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LESSP-TIMES-2
(PROVE-LEMMA LESSP-QUOTIENT1
(REWRITE)
(EQUAL (LESSP (QUOTIENT I J) I)
(AND (NOT (ZEROP I))
(OR (ZEROP J) (NOT (EQUAL J 1))))))
This formula simplifies, rewriting with EQUAL-LESSP, and opening up the
definitions of ZEROP, NOT, OR, and AND, to the following six new formulas:
Case 6. (IMPLIES (AND (NOT (LESSP (QUOTIENT I J) I))
(NOT (EQUAL I 0))
(NUMBERP I))
(NOT (EQUAL J 0))).
But this again simplifies, opening up EQUAL, QUOTIENT, and LESSP, to:
T.
Case 5. (IMPLIES (AND (NOT (LESSP (QUOTIENT I J) I))
(NOT (EQUAL I 0))
(NUMBERP I))
(NUMBERP J)),
which again simplifies, unfolding the definitions of QUOTIENT, EQUAL, and
LESSP, to:
T.
Case 4. (IMPLIES (AND (NOT (LESSP (QUOTIENT I J) I))
(NOT (EQUAL I 0))
(NUMBERP I))
(EQUAL J 1)).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace I by
(PLUS Z (TIMES J X)) to eliminate (QUOTIENT I J) and (REMAINDER I J). We
employ LESSP-REMAINDER2, the type restriction lemma noted when QUOTIENT was
introduced, and the type restriction lemma noted when REMAINDER was
introduced to restrict the new variables. We thus obtain the following
three new formulas:
Case 4.3.
(IMPLIES (AND (EQUAL J 0)
(NOT (LESSP (QUOTIENT I J) I))
(NOT (EQUAL I 0))
(NUMBERP I))
(EQUAL J 1)).
However this further simplifies, opening up the definitions of EQUAL,
QUOTIENT, and LESSP, to:
T.
Case 4.2.
(IMPLIES (AND (NOT (NUMBERP J))
(NOT (LESSP (QUOTIENT I J) I))
(NOT (EQUAL I 0))
(NUMBERP I))
(EQUAL J 1)),
which further simplifies, opening up QUOTIENT, EQUAL, and LESSP, to:
T.
Case 4.1.
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(EQUAL (LESSP Z J) (NOT (ZEROP J)))
(NUMBERP J)
(NOT (EQUAL J 0))
(NOT (LESSP X (PLUS Z (TIMES J X))))
(NOT (EQUAL (PLUS Z (TIMES J X)) 0)))
(EQUAL J 1)),
which further simplifies, rewriting with the lemmas EQUAL-TIMES-0 and
PLUS-EQUAL-0, and expanding the functions ZEROP and NOT, to two new goals:
Case 4.1.2.
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(LESSP Z J)
(NUMBERP J)
(NOT (EQUAL J 0))
(NOT (LESSP X (PLUS Z (TIMES J X))))
(NOT (EQUAL Z 0)))
(EQUAL J 1)),
which again simplifies, using linear arithmetic and applying
LESSP-TIMES-1, to:
T.
Case 4.1.1.
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(LESSP Z J)
(NUMBERP J)
(NOT (EQUAL J 0))
(NOT (LESSP X (PLUS Z (TIMES J X))))
(NOT (EQUAL X 0)))
(EQUAL J 1)),
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 (LESSP (QUOTIENT I J) I)
(AND (NOT (ZEROP I))
(OR (ZEROP J) (NOT (EQUAL J 1))))).
We gave this the name *1 above. Perhaps we can prove it by induction. Two
inductions are suggested by terms in the conjecture, both of which are
unflawed. So we will choose the one suggested by the largest number of
nonprimitive recursive functions. We will induct according to the following
scheme:
(AND (IMPLIES (ZEROP J) (p I J))
(IMPLIES (AND (NOT (ZEROP J)) (LESSP I J))
(p I J))
(IMPLIES (AND (NOT (ZEROP J))
(NOT (LESSP I J))
(p (DIFFERENCE I J) J))
(p I J))).
Linear arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the
definition of ZEROP inform us that the measure (COUNT I) 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 formulas:
Case 3. (IMPLIES (ZEROP J)
(EQUAL (LESSP (QUOTIENT I J) I)
(AND (NOT (ZEROP I))
(OR (ZEROP J) (NOT (EQUAL J 1)))))).
This simplifies, expanding the definitions of ZEROP, EQUAL, QUOTIENT, LESSP,
NOT, OR, and AND, to the following four new goals:
Case 3.4.
(IMPLIES (AND (EQUAL J 0)
(NOT (EQUAL I 0))
(NOT (NUMBERP I)))
(EQUAL (NUMBERP I) F)).
This again simplifies, clearly, to:
T.
Case 3.3.
(IMPLIES (AND (EQUAL J 0)
(NOT (EQUAL I 0))
(NUMBERP I))
(EQUAL (NUMBERP I) T)).
This again simplifies, clearly, to:
T.
Case 3.2.
(IMPLIES (AND (NOT (NUMBERP J))
(NOT (EQUAL I 0))
(NOT (NUMBERP I)))
(EQUAL (NUMBERP I) F)).
This again simplifies, clearly, to:
T.
Case 3.1.
(IMPLIES (AND (NOT (NUMBERP J))
(NOT (EQUAL I 0))
(NUMBERP I))
(EQUAL (NUMBERP I) T)).
This again simplifies, trivially, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP J)) (LESSP I J))
(EQUAL (LESSP (QUOTIENT I J) I)
(AND (NOT (ZEROP I))
(OR (ZEROP J) (NOT (EQUAL J 1)))))).
This simplifies, expanding the definitions of ZEROP, QUOTIENT, EQUAL, LESSP,
NOT, OR, and AND, to the following three new goals:
Case 2.3.
(IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(LESSP I J)
(NOT (EQUAL I 0))
(EQUAL J 1))
(EQUAL (NUMBERP I) F)).
This again simplifies, using linear arithmetic, to:
(IMPLIES (AND (NOT (NUMBERP I))
(NOT (EQUAL 1 0))
(NUMBERP 1)
(LESSP I 1)
(NOT (EQUAL I 0)))
(EQUAL (NUMBERP I) F)).
This again simplifies, clearly, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(LESSP I J)
(NOT (EQUAL I 0))
(NOT (NUMBERP I)))
(EQUAL (NUMBERP I) F)).
This again simplifies, obviously, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(LESSP I J)
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 1)))
(EQUAL (NUMBERP I) T)).
This again simplifies, obviously, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP J))
(NOT (LESSP I J))
(EQUAL (LESSP (QUOTIENT (DIFFERENCE I J) J)
(DIFFERENCE I J))
(AND (NOT (ZEROP (DIFFERENCE I J)))
(OR (ZEROP J) (NOT (EQUAL J 1))))))
(EQUAL (LESSP (QUOTIENT I J) I)
(AND (NOT (ZEROP I))
(OR (ZEROP J) (NOT (EQUAL J 1)))))).
This simplifies, applying EQUAL-DIFFERENCE-0, EQUAL-LESSP, and SUB1-ADD1,
and unfolding the functions ZEROP, NOT, OR, AND, EQUAL, QUOTIENT, and LESSP,
to four new goals:
Case 1.4.
(IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP I J))
(NOT (LESSP (QUOTIENT (DIFFERENCE I J) J)
(DIFFERENCE I J)))
(EQUAL J 1))
(NOT (LESSP (QUOTIENT I 1) I))),
which again simplifies, unfolding EQUAL and NUMBERP, to the goal:
(IMPLIES (AND (NOT (LESSP I 1))
(NOT (LESSP (QUOTIENT (DIFFERENCE I 1) 1)
(DIFFERENCE I 1))))
(NOT (LESSP (QUOTIENT I 1) I))).
However this again simplifies, applying SUB1-ADD1, and opening up the
functions NUMBERP, EQUAL, QUOTIENT, and LESSP, to the new formula:
(IMPLIES (AND (NOT (LESSP I 1))
(NOT (LESSP (QUOTIENT (DIFFERENCE I 1) 1)
(DIFFERENCE I 1)))
(NOT (EQUAL I 0))
(NUMBERP I))
(NOT (LESSP (QUOTIENT (DIFFERENCE I 1) 1)
(SUB1 I)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP I J))
(NOT (LESSP (QUOTIENT (DIFFERENCE I J) J)
(DIFFERENCE I J)))
(NOT (LESSP J I))
(NOT (EQUAL I 0))
(NUMBERP I)
(EQUAL J 1))
(EQUAL (LESSP (QUOTIENT (DIFFERENCE I J) J)
(SUB1 I))
F)),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (NOT (EQUAL 1 0))
(NUMBERP 1)
(NOT (LESSP 1 1))
(NOT (LESSP (QUOTIENT (DIFFERENCE 1 1) 1)
(DIFFERENCE 1 1)))
(NOT (LESSP 1 1))
(NOT (EQUAL 1 0))
(NUMBERP 1))
(EQUAL (LESSP (QUOTIENT (DIFFERENCE 1 1) 1)
(SUB1 1))
F)).
However this again simplifies, unfolding EQUAL, NUMBERP, LESSP, DIFFERENCE,
QUOTIENT, and SUB1, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP I J))
(NOT (LESSP (QUOTIENT (DIFFERENCE I J) J)
(DIFFERENCE I J)))
(NOT (LESSP J I))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 1)))
(EQUAL (LESSP (QUOTIENT (DIFFERENCE I J) J)
(SUB1 I))
T)),
which again simplifies, using linear arithmetic, to the conjecture:
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(NOT (LESSP I I))
(NOT (LESSP (QUOTIENT (DIFFERENCE I I) I)
(DIFFERENCE I I)))
(NOT (LESSP I I))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL I 1)))
(EQUAL (LESSP (QUOTIENT (DIFFERENCE I I) I)
(SUB1 I))
T)).
This again simplifies, applying DIFFERENCE-0, and expanding the
definitions of LESSP, EQUAL, and QUOTIENT, to the new formula:
(IMPLIES (AND (NOT (LESSP I I))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL I 1)))
(NOT (EQUAL (SUB1 I) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP I J))
(LESSP (QUOTIENT (DIFFERENCE I J) J)
(DIFFERENCE I J))
(LESSP J I)
(NOT (EQUAL J 1))
(NOT (EQUAL I 0))
(NUMBERP I))
(EQUAL (LESSP (QUOTIENT (DIFFERENCE I J) J)
(SUB1 I))
T)),
which again simplifies, obviously, to:
(IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP I J))
(LESSP (QUOTIENT (DIFFERENCE I J) J)
(DIFFERENCE I J))
(LESSP J I)
(NOT (EQUAL J 1))
(NOT (EQUAL I 0))
(NUMBERP I))
(LESSP (QUOTIENT (DIFFERENCE I J) J)
(SUB1 I))),
which again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.1 ]
LESSP-QUOTIENT1
(PROVE-LEMMA LESSP-REMAINDER1
(REWRITE)
(EQUAL (LESSP (REMAINDER X Y) X)
(AND (NOT (ZEROP Y))
(NOT (ZEROP X))
(NOT (LESSP X Y)))))
This formula simplifies, rewriting with EQUAL-LESSP, and opening up the
definitions of ZEROP, NOT, and AND, to the following six new formulas:
Case 6. (IMPLIES (AND (NOT (LESSP (REMAINDER X Y) X))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL X 0))
(NUMBERP X))
(LESSP X Y)).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace X by
(PLUS Z (TIMES Y V)) to eliminate (REMAINDER X Y) and (QUOTIENT X Y). We
rely upon LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER
was introduced, and the type restriction lemma noted when QUOTIENT was
introduced to constrain the new variables. We must thus prove:
(IMPLIES (AND (NUMBERP Z)
(EQUAL (LESSP Z Y) (NOT (ZEROP Y)))
(NUMBERP V)
(NOT (LESSP Z (PLUS Z (TIMES Y V))))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL (PLUS Z (TIMES Y V)) 0)))
(LESSP (PLUS Z (TIMES Y V)) Y)).
However this further simplifies, appealing to the lemmas
COMMUTATIVITY-OF-TIMES, EQUAL-TIMES-0, and PLUS-EQUAL-0, and unfolding the
definitions of ZEROP and NOT, to two new conjectures:
Case 6.2.
(IMPLIES (AND (NUMBERP Z)
(LESSP Z Y)
(NUMBERP V)
(NOT (LESSP Z (PLUS Z (TIMES V Y))))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Z 0)))
(LESSP (PLUS Z (TIMES V Y)) Y)),
which again simplifies, using linear arithmetic, to:
T.
Case 6.1.
(IMPLIES (AND (NUMBERP Z)
(LESSP Z Y)
(NUMBERP V)
(NOT (LESSP Z (PLUS Z (TIMES V Y))))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL V 0)))
(LESSP (PLUS Z (TIMES V Y)) Y)),
which again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (LESSP (REMAINDER X Y) X)
(NOT (LESSP X Y))),
which again simplifies, unfolding the functions REMAINDER and LESSP, to two
new formulas:
Case 5.2.
(IMPLIES (AND (NOT (NUMBERP X))
(LESSP 0 X)
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))),
which again simplifies, opening up LESSP, to:
T.
Case 5.1.
(IMPLIES (AND (NUMBERP X) (LESSP X X))
(NOT (LESSP X Y))),
which again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (LESSP (REMAINDER X Y) X)
(NUMBERP X)),
which again simplifies, expanding the functions LESSP and REMAINDER, to:
T.
Case 3. (IMPLIES (LESSP (REMAINDER X Y) X)
(NOT (EQUAL X 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (LESSP (REMAINDER X Y) X)
(NUMBERP Y)),
which again simplifies, rewriting with REMAINDER-WRT-12, to the following
two new conjectures:
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP X)) (LESSP 0 X))
(NUMBERP Y)).
However this again simplifies, unfolding the function LESSP, to:
T.
Case 2.1.
(IMPLIES (AND (NUMBERP X) (LESSP X X))
(NUMBERP Y)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (LESSP (REMAINDER X Y) X)
(NOT (EQUAL Y 0))),
which again simplifies, opening up the definitions of EQUAL and REMAINDER,
to two new formulas:
Case 1.2.
(IMPLIES (NOT (NUMBERP X))
(NOT (LESSP 0 X))),
which again simplifies, unfolding the function LESSP, to:
T.
Case 1.1.
(IMPLIES (NUMBERP X)
(NOT (LESSP X X))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LESSP-REMAINDER1
(DEFN POWER-REP
(I BASE)
(IF (ZEROP I)
NIL
(IF (ZEROP BASE)
(CONS I NIL)
(IF (EQUAL BASE 1)
(CONS I NIL)
(CONS (REMAINDER I BASE)
(POWER-REP (QUOTIENT I BASE)
BASE))))))
The lemmas LESSP-QUOTIENT1 and COUNT-NUMBERP and the definition of ZEROP
establish that the measure (COUNT I) decreases according to the well-founded
relation LESSP in each recursive call. Hence, POWER-REP is accepted under the
principle of definition. Observe that:
(OR (LITATOM (POWER-REP I BASE))
(LISTP (POWER-REP I BASE)))
is a theorem.
[ 0.0 0.0 0.0 ]
POWER-REP
(PROVE-LEMMA POWER-EVAL-POWER-REP
(REWRITE)
(EQUAL (POWER-EVAL (POWER-REP I BASE) BASE)
(FIX I)))
This conjecture simplifies, opening up the function FIX, to the following two
new goals:
Case 2. (IMPLIES (NOT (NUMBERP I))
(EQUAL (POWER-EVAL (POWER-REP I BASE) BASE)
0)).
But this again simplifies, expanding the definitions of POWER-REP, LISTP,
POWER-EVAL, and EQUAL, to:
T.
Case 1. (IMPLIES (NUMBERP I)
(EQUAL (POWER-EVAL (POWER-REP I BASE) BASE)
I)),
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 (ZEROP I) (p I BASE))
(IMPLIES (AND (NOT (ZEROP I)) (ZEROP BASE))
(p I BASE))
(IMPLIES (AND (NOT (ZEROP I))
(NOT (ZEROP BASE))
(EQUAL BASE 1))
(p I BASE))
(IMPLIES (AND (NOT (ZEROP I))
(NOT (ZEROP BASE))
(NOT (EQUAL BASE 1))
(p (QUOTIENT I BASE) BASE))
(p I BASE))).
The lemmas LESSP-QUOTIENT1 and COUNT-NUMBERP and the definition of ZEROP can
be used to establish that the measure (COUNT I) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme generates four new goals:
Case 4. (IMPLIES (AND (ZEROP I) (NUMBERP I))
(EQUAL (POWER-EVAL (POWER-REP I BASE) BASE)
I)),
which simplifies, expanding ZEROP, NUMBERP, EQUAL, POWER-REP, LISTP, and
POWER-EVAL, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP I))
(ZEROP BASE)
(NUMBERP I))
(EQUAL (POWER-EVAL (POWER-REP I BASE) BASE)
I)),
which simplifies, rewriting with COMMUTATIVITY-OF-PLUS, CDR-CONS, and
CAR-CONS, and unfolding the definitions of ZEROP, EQUAL, POWER-REP, PLUS,
TIMES, and POWER-EVAL, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP I))
(NOT (ZEROP BASE))
(EQUAL BASE 1)
(NUMBERP I))
(EQUAL (POWER-EVAL (POWER-REP I BASE) BASE)
I)).
This simplifies, rewriting with the lemmas COMMUTATIVITY-OF-PLUS, CDR-CONS,
and CAR-CONS, and opening up ZEROP, NUMBERP, EQUAL, POWER-REP, PLUS, TIMES,
and POWER-EVAL, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP I))
(NOT (ZEROP BASE))
(NOT (EQUAL BASE 1))
(EQUAL (POWER-EVAL (POWER-REP (QUOTIENT I BASE) BASE)
BASE)
(QUOTIENT I BASE))
(NUMBERP I))
(EQUAL (POWER-EVAL (POWER-REP I BASE) BASE)
I)).
This simplifies, rewriting with the lemmas REMAINDER-QUOTIENT, CDR-CONS, and
CAR-CONS, and unfolding the definitions of ZEROP, POWER-REP, and POWER-EVAL,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
POWER-EVAL-POWER-REP
(PROVE-LEMMA CORRECTNESS-OF-BIG-PLUS
(REWRITE)
(EQUAL (POWER-EVAL (BIG-PLUS (POWER-REP I BASE)
(POWER-REP J BASE)
0 BASE)
BASE)
(PLUS I J)))
WARNING: the previously added lemma, POWER-EVAL-BIG-PLUS, could be applied
whenever the newly proposed CORRECTNESS-OF-BIG-PLUS could!
This conjecture can be simplified, using the abbreviation POWER-EVAL-BIG-PLUS,
to:
(EQUAL (PLUS 0
(POWER-EVAL (POWER-REP I BASE) BASE)
(POWER-EVAL (POWER-REP J BASE) BASE))
(PLUS I J)).
This simplifies, applying POWER-EVAL-POWER-REP, to four new conjectures:
Case 4. (IMPLIES (AND (NOT (NUMBERP J))
(NOT (NUMBERP I)))
(EQUAL (PLUS 0 0 0) (PLUS I J))),
which again simplifies, rewriting with the lemma PLUS-RIGHT-ID2, and
unfolding the functions PLUS and EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (NUMBERP J)) (NUMBERP I))
(EQUAL (PLUS 0 I 0) (PLUS I J))),
which again simplifies, applying COMMUTATIVITY-OF-PLUS and PLUS-RIGHT-ID2,
and opening up the definitions of EQUAL and PLUS, to:
T.
Case 2. (IMPLIES (AND (NUMBERP J) (NOT (NUMBERP I)))
(EQUAL (PLUS 0 0 J) (PLUS I J))).
This again simplifies, expanding EQUAL and PLUS, to:
T.
Case 1. (IMPLIES (AND (NUMBERP J) (NUMBERP I))
(EQUAL (PLUS 0 I J) (PLUS I J))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
CORRECTNESS-OF-BIG-PLUS
(DEFN GCD
(X Y)
(IF (ZEROP X)
(FIX Y)
(IF (ZEROP Y)
X
(IF (LESSP X Y)
(GCD X (DIFFERENCE Y X))
(GCD (DIFFERENCE X Y) Y))))
((ORD-LESSP (CONS (ADD1 (COUNT X)) (COUNT Y)))))
Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1,
COUNT-NUMBERP, DIFFERENCE-CANCELLATION-0, and ADD1-EQUAL, and the definitions
of ORDINALP, LESSP, ORD-LESSP, and ZEROP establish that the measure:
(CONS (ADD1 (COUNT X)) (COUNT Y))
decreases according to the well-founded relation ORD-LESSP in each recursive
call. Hence, GCD is accepted under the principle of definition. Observe that
(NUMBERP (GCD X Y)) is a theorem.
[ 0.0 0.0 0.0 ]
GCD
(PROVE-LEMMA NUMBERP-GCD
(REWRITE)
(NUMBERP (GCD X Y)))
This conjecture simplifies, trivially, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
NUMBERP-GCD
(PROVE-LEMMA GCD-EQUAL-0
(REWRITE)
(EQUAL (EQUAL (GCD X Y) 0)
(AND (ZEROP X) (ZEROP Y))))
This simplifies, opening up the functions ZEROP and AND, to six new
conjectures:
Case 6. (IMPLIES (AND (NOT (EQUAL (GCD X Y) 0))
(NOT (NUMBERP X)))
(NOT (EQUAL Y 0))),
which again simplifies, expanding NUMBERP, GCD, and EQUAL, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL (GCD X Y) 0))
(NOT (NUMBERP X)))
(NUMBERP Y)),
which again simplifies, unfolding GCD and EQUAL, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL (GCD X Y) 0))
(EQUAL X 0))
(NOT (EQUAL Y 0))),
which again simplifies, opening up GCD and EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL (GCD X Y) 0))
(EQUAL X 0))
(NUMBERP Y)),
which again simplifies, opening up the definitions of EQUAL and GCD, to:
T.
Case 2. (IMPLIES (AND (EQUAL (GCD X Y) 0)
(NOT (EQUAL X 0)))
(NOT (NUMBERP X))),
which we will name *1.
Case 1. (IMPLIES (AND (EQUAL (GCD X Y) 0)
(NOT (EQUAL Y 0)))
(NOT (NUMBERP Y))),
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 (EQUAL (GCD X Y) 0)
(AND (ZEROP X) (ZEROP Y))),
which we named *1 above. We will appeal to induction. There is only one
plausible induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP X) (p X Y))
(IMPLIES (AND (NOT (ZEROP X)) (ZEROP Y))
(p X Y))
(IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(LESSP X Y)
(p X (DIFFERENCE Y X)))
(p X Y))
(IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(NOT (LESSP X Y))
(p (DIFFERENCE X Y) Y))
(p X Y))).
Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, COUNT-NUMBERP,
DIFFERENCE-CANCELLATION-0, and ADD1-EQUAL, and the definitions of ORDINALP,
LESSP, ORD-LESSP, and ZEROP inform us that the measure:
(CONS (ADD1 (COUNT X)) (COUNT Y))
decreases according to the well-founded relation ORD-LESSP in each induction
step of the scheme. The above induction scheme produces the following four
new goals:
Case 4. (IMPLIES (ZEROP X)
(EQUAL (EQUAL (GCD X Y) 0)
(AND (ZEROP X) (ZEROP Y)))).
This simplifies, opening up the functions ZEROP, EQUAL, GCD, and AND, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP X)) (ZEROP Y))
(EQUAL (EQUAL (GCD X Y) 0)
(AND (ZEROP X) (ZEROP Y)))).
This simplifies, unfolding the definitions of ZEROP, EQUAL, GCD, and AND, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(LESSP X Y)
(EQUAL (EQUAL (GCD X (DIFFERENCE Y X)) 0)
(AND (ZEROP X)
(ZEROP (DIFFERENCE Y X)))))
(EQUAL (EQUAL (GCD X Y) 0)
(AND (ZEROP X) (ZEROP Y)))).
This simplifies, applying EQUAL-DIFFERENCE-0, and opening up ZEROP, AND, GCD,
and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(NOT (LESSP X Y))
(EQUAL (EQUAL (GCD (DIFFERENCE X Y) Y) 0)
(AND (ZEROP (DIFFERENCE X Y))
(ZEROP Y))))
(EQUAL (EQUAL (GCD X Y) 0)
(AND (ZEROP X) (ZEROP Y)))),
which simplifies, rewriting with the lemma EQUAL-DIFFERENCE-0, and expanding
the definitions of ZEROP, AND, GCD, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
GCD-EQUAL-0
(PROVE-LEMMA GCD-0
(REWRITE)
(EQUAL (GCD 0 Y) (FIX Y)))
This simplifies, unfolding EQUAL, GCD, and FIX, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
GCD-0
(PROVE-LEMMA COMMUTATIVITY-OF-GCD
(REWRITE)
(EQUAL (GCD X Y) (GCD Y X)))
WARNING: the newly proposed lemma, COMMUTATIVITY-OF-GCD, could be applied
whenever the previously added lemma GCD-0 could.
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 (ZEROP X) (p X Y))
(IMPLIES (AND (NOT (ZEROP X)) (ZEROP Y))
(p X Y))
(IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(LESSP X Y)
(p X (DIFFERENCE Y X)))
(p X Y))
(IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(NOT (LESSP X Y))
(p (DIFFERENCE X Y) Y))
(p X Y))).
Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, COUNT-NUMBERP,
DIFFERENCE-CANCELLATION-0, and ADD1-EQUAL, and the definitions of ORDINALP,
LESSP, ORD-LESSP, and ZEROP inform us that the measure:
(CONS (ADD1 (COUNT X)) (COUNT Y))
decreases according to the well-founded relation ORD-LESSP in each induction
step of the scheme. The above induction scheme produces the following four
new conjectures:
Case 4. (IMPLIES (ZEROP X)
(EQUAL (GCD X Y) (GCD Y X))).
This simplifies, applying GCD-0, and opening up the functions ZEROP, EQUAL,
NUMBERP, and GCD, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP X)) (ZEROP Y))
(EQUAL (GCD X Y) (GCD Y X))),
which simplifies, rewriting with GCD-0, and opening up ZEROP, EQUAL, and GCD,
to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(LESSP X Y)
(EQUAL (GCD X (DIFFERENCE Y X))
(GCD (DIFFERENCE Y X) X)))
(EQUAL (GCD X Y) (GCD Y X))).
This simplifies, unfolding the definitions of ZEROP and GCD, to:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(LESSP X Y)
(EQUAL (GCD X (DIFFERENCE Y X))
(GCD (DIFFERENCE Y X) X))
(LESSP Y X))
(EQUAL (GCD X (DIFFERENCE Y X))
(GCD Y (DIFFERENCE X Y)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(NOT (LESSP X Y))
(EQUAL (GCD (DIFFERENCE X Y) Y)
(GCD Y (DIFFERENCE X Y))))
(EQUAL (GCD X Y) (GCD Y X))),
which simplifies, opening up the definitions of ZEROP and GCD, to:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (LESSP X Y))
(EQUAL (GCD (DIFFERENCE X Y) Y)
(GCD Y (DIFFERENCE X Y)))
(NOT (LESSP Y X)))
(EQUAL (GCD Y (DIFFERENCE X Y))
(GCD (DIFFERENCE Y X) X))).
However this again simplifies, using linear arithmetic, to:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP X X))
(EQUAL (GCD (DIFFERENCE X X) X)
(GCD X (DIFFERENCE X X)))
(NOT (LESSP X X)))
(EQUAL (GCD X (DIFFERENCE X X))
(GCD (DIFFERENCE X X) X))).
This again simplifies, trivially, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
COMMUTATIVITY-OF-GCD
(PROVE-LEMMA NTH-APPEND
(REWRITE)
(EQUAL (NTH (APPEND A B) I)
(APPEND (NTH A I)
(NTH B (DIFFERENCE I (LENGTH A))))))
.
Applying the lemma DIFFERENCE-ELIM, replace I by (PLUS (LENGTH A) X) to
eliminate (DIFFERENCE I (LENGTH A)). We employ the type restriction lemma
noted when DIFFERENCE was introduced to restrict the new variable. This
produces the following three new conjectures:
Case 3. (IMPLIES (LESSP I (LENGTH A))
(EQUAL (NTH (APPEND A B) I)
(APPEND (NTH A I)
(NTH B (DIFFERENCE I (LENGTH A)))))).
But this simplifies, using linear arithmetic, rewriting with the lemma
DIFFERENCE-0, and unfolding the functions EQUAL and NTH, to the conjecture:
(IMPLIES (LESSP I (LENGTH A))
(EQUAL (NTH (APPEND A B) I)
(APPEND (NTH A I) B))),
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 (NTH (APPEND A B) I)
(APPEND (NTH A I)
(NTH B (DIFFERENCE I (LENGTH A))))).
We gave this the name *1 above. 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 (ZEROP I) (p A B I))
(IMPLIES (AND (NOT (ZEROP I))
(p (CDR A) B (SUB1 I)))
(p A B I))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform
us that the measure (COUNT I) decreases according to the well-founded relation
LESSP in each induction step of the scheme. Note, however, the inductive
instance chosen for A. The above induction scheme leads to the following two
new conjectures:
Case 2. (IMPLIES (ZEROP I)
(EQUAL (NTH (APPEND A B) I)
(APPEND (NTH A I)
(NTH B (DIFFERENCE I (LENGTH A)))))).
This simplifies, using linear arithmetic, appealing to the lemma
DIFFERENCE-0, and expanding the definitions of ZEROP, APPEND, EQUAL, NTH,
and LENGTH, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP I))
(EQUAL (NTH (APPEND (CDR A) B) (SUB1 I))
(APPEND (NTH (CDR A) (SUB1 I))
(NTH B
(DIFFERENCE (SUB1 I)
(LENGTH (CDR A)))))))
(EQUAL (NTH (APPEND A B) I)
(APPEND (NTH A I)
(NTH B (DIFFERENCE I (LENGTH A)))))).
This simplifies, expanding the functions ZEROP, APPEND, NTH, and LENGTH, to
the following two new formulas:
Case 1.2.
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(EQUAL (NTH (APPEND (CDR A) B) (SUB1 I))
(APPEND (NTH (CDR A) (SUB1 I))
(NTH B
(DIFFERENCE (SUB1 I)
(LENGTH (CDR A))))))
(NOT (LISTP A)))
(EQUAL (NTH B I)
(APPEND (NTH (CDR A) (SUB1 I))
(NTH B (DIFFERENCE I 0))))).
This again simplifies, expanding the functions EQUAL and DIFFERENCE, to:
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(EQUAL (NTH (APPEND (CDR A) B) (SUB1 I))
(APPEND (NTH (CDR A) (SUB1 I))
(NTH B
(DIFFERENCE (SUB1 I)
(LENGTH (CDR A))))))
(NOT (LISTP A)))
(EQUAL (NTH B I)
(APPEND (NTH (CDR A) (SUB1 I))
(NTH B I)))).
However this further simplifies, applying CDR-NLISTP and NTH-0, and
expanding LISTP, APPEND, LENGTH, EQUAL, and DIFFERENCE, to:
T.
Case 1.1.
(IMPLIES
(AND (NOT (EQUAL I 0))
(NUMBERP I)
(EQUAL (NTH (APPEND (CDR A) B) (SUB1 I))
(APPEND (NTH (CDR A) (SUB1 I))
(NTH B
(DIFFERENCE (SUB1 I)
(LENGTH (CDR A))))))
(LISTP A))
(EQUAL (NTH (CONS (CAR A) (APPEND (CDR A) B))
I)
(APPEND (NTH (CDR A) (SUB1 I))
(NTH B
(DIFFERENCE I
(ADD1 (LENGTH (CDR A)))))))).
This again simplifies, applying CDR-CONS and SUB1-ADD1, and opening up NTH
and DIFFERENCE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
NTH-APPEND
(PROVE-LEMMA DIFFERENCE-PLUS1
(REWRITE)
(EQUAL (DIFFERENCE (PLUS X Y) X)
(FIX Y)))
WARNING: the previously added lemma, DIFFERENCE-PLUS, could be applied
whenever the newly proposed DIFFERENCE-PLUS1 could!
This conjecture simplifies, appealing to the lemma DIFFERENCE-PLUS, and
expanding the function FIX, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIFFERENCE-PLUS1
(PROVE-LEMMA DIFFERENCE-PLUS2
(REWRITE)
(EQUAL (DIFFERENCE (PLUS Y X) X)
(FIX Y)))
WARNING: the previously added lemma, DIFFERENCE-PLUS, could be applied
whenever the newly proposed DIFFERENCE-PLUS2 could!
This conjecture simplifies, appealing to the lemmas COMMUTATIVITY-OF-PLUS and
DIFFERENCE-PLUS1, and expanding the function FIX, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIFFERENCE-PLUS2
(PROVE-LEMMA DIFFERENCE-PLUS-CANCELATION
(REWRITE)
(EQUAL (DIFFERENCE (PLUS X Y) (PLUS X Z))
(DIFFERENCE Y Z)))
This simplifies, using linear arithmetic, to the following two new conjectures:
Case 2. (IMPLIES (LESSP (PLUS X Y) (PLUS X Z))
(EQUAL (DIFFERENCE (PLUS X Y) (PLUS X Z))
(DIFFERENCE Y Z))).
But this again simplifies, using linear arithmetic, applying DIFFERENCE-0,
and opening up the function EQUAL, to:
T.
Case 1. (IMPLIES (LESSP Y Z)
(EQUAL (DIFFERENCE (PLUS X Y) (PLUS X Z))
(DIFFERENCE Y Z))).
But this again simplifies, using linear arithmetic, applying the lemma
DIFFERENCE-0, and expanding EQUAL, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIFFERENCE-PLUS-CANCELATION
(PROVE-LEMMA TIMES-DIFFERENCE
(REWRITE)
(EQUAL (TIMES X (DIFFERENCE C W))
(DIFFERENCE (TIMES C X) (TIMES W X))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-TIMES, could be applied
whenever the newly proposed TIMES-DIFFERENCE could!
.
Appealing to the lemma DIFFERENCE-ELIM, we now replace C by (PLUS W Z) to
eliminate (DIFFERENCE C W). We use the type restriction lemma noted when
DIFFERENCE was introduced to constrain the new variable. The result is three
new goals:
Case 3. (IMPLIES (LESSP C W)
(EQUAL (TIMES X (DIFFERENCE C W))
(DIFFERENCE (TIMES C X)
(TIMES W X)))),
which simplifies, using linear arithmetic, appealing to the lemmas
DIFFERENCE-0, COMMUTATIVITY-OF-TIMES, and EQUAL-DIFFERENCE-0, and unfolding
EQUAL and TIMES, to:
(IMPLIES (LESSP C W)
(NOT (LESSP (TIMES W X) (TIMES C 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 (TIMES X (DIFFERENCE C W))
(DIFFERENCE (TIMES C X) (TIMES W X))),
which we named *1 above. We will appeal to induction. There are five
plausible inductions. They merge into two likely candidate inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (ZEROP C) (p X C W))
(IMPLIES (AND (NOT (ZEROP C)) (ZEROP W))
(p X C W))
(IMPLIES (AND (NOT (ZEROP C))
(NOT (ZEROP W))
(p X (SUB1 C) (SUB1 W)))
(p X C W))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT C) decreases according to the well-founded
relation LESSP in each induction step of the scheme. Note, however, the
inductive instance chosen for W. The above induction scheme produces the
following three new goals:
Case 3. (IMPLIES (ZEROP C)
(EQUAL (TIMES X (DIFFERENCE C W))
(DIFFERENCE (TIMES C X)
(TIMES W X)))).
This simplifies, using linear arithmetic, rewriting with DIFFERENCE-0 and
COMMUTATIVITY-OF-TIMES, and unfolding the functions ZEROP, EQUAL, and TIMES,
to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP C)) (ZEROP W))
(EQUAL (TIMES X (DIFFERENCE C W))
(DIFFERENCE (TIMES C X)
(TIMES W X)))),
which simplifies, appealing to the lemmas COMMUTATIVITY-OF-TIMES,
PLUS-EQUAL-0, and EQUAL-TIMES-0, and unfolding the functions ZEROP, EQUAL,
DIFFERENCE, and TIMES, to four new conjectures:
Case 2.4.
(IMPLIES (AND (NOT (EQUAL C 0))
(NUMBERP C)
(EQUAL W 0)
(NOT (NUMBERP X)))
(EQUAL (PLUS X (TIMES (SUB1 C) X))
0)),
which again simplifies, applying EQUAL-TIMES-0, and opening up the
function PLUS, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (EQUAL C 0))
(NUMBERP C)
(EQUAL W 0)
(EQUAL X 0))
(EQUAL (PLUS X (TIMES (SUB1 C) X))
0)).
But this again simplifies, applying COMMUTATIVITY-OF-TIMES, and expanding
the functions EQUAL, TIMES, and PLUS, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (EQUAL C 0))
(NUMBERP C)
(NOT (NUMBERP W))
(NOT (NUMBERP X)))
(EQUAL (PLUS X (TIMES (SUB1 C) X))
0)).
This again simplifies, applying EQUAL-TIMES-0, and unfolding the
definition of PLUS, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL C 0))
(NUMBERP C)
(NOT (NUMBERP W))
(EQUAL X 0))
(EQUAL (PLUS X (TIMES (SUB1 C) X))
0)).
However this again simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and
expanding the definitions of EQUAL, TIMES, and PLUS, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP C))
(NOT (ZEROP W))
(EQUAL (TIMES X
(DIFFERENCE (SUB1 C) (SUB1 W)))
(DIFFERENCE (TIMES (SUB1 C) X)
(TIMES (SUB1 W) X))))
(EQUAL (TIMES X (DIFFERENCE C W))
(DIFFERENCE (TIMES C X)
(TIMES W X)))).
This simplifies, rewriting with DIFFERENCE-PLUS-CANCELATION, and unfolding
the definitions of ZEROP, DIFFERENCE, and TIMES, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
TIMES-DIFFERENCE
(DEFN DIVIDES
(X Y)
(ZEROP (REMAINDER Y X)))
Note that (OR (FALSEP (DIVIDES X Y)) (TRUEP (DIVIDES X Y))) is a theorem.
[ 0.0 0.0 0.0 ]
DIVIDES
(PROVE-LEMMA DIVIDES-TIMES
(REWRITE)
(EQUAL (REMAINDER (TIMES X Z) Z) 0))
Name the conjecture *1.
Perhaps we can prove it by induction. There is only one plausible
induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP X) (p X Z))
(IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) Z))
(p X Z))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
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 goals:
Case 2. (IMPLIES (ZEROP X)
(EQUAL (REMAINDER (TIMES X Z) Z) 0)).
This simplifies, expanding ZEROP, EQUAL, TIMES, LESSP, NUMBERP, and
REMAINDER, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(EQUAL (REMAINDER (TIMES (SUB1 X) Z) Z)
0))
(EQUAL (REMAINDER (TIMES X Z) Z) 0)).
This simplifies, rewriting with DIFFERENCE-PLUS1, and unfolding the
definitions of ZEROP, TIMES, and REMAINDER, to three new goals:
Case 1.3.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL (REMAINDER (TIMES (SUB1 X) Z) Z)
0)
(NOT (NUMBERP Z)))
(EQUAL (PLUS Z (TIMES (SUB1 X) Z))
0)),
which again simplifies, applying REMAINDER-WRT-12 and EQUAL-TIMES-0, and
unfolding the function PLUS, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL (REMAINDER (TIMES (SUB1 X) Z) Z)
0)
(EQUAL Z 0))
(EQUAL (PLUS Z (TIMES (SUB1 X) Z))
0)).
However this again simplifies, applying COMMUTATIVITY-OF-TIMES, and
unfolding the functions EQUAL, TIMES, REMAINDER, and PLUS, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL (REMAINDER (TIMES (SUB1 X) Z) Z)
0)
(LESSP (PLUS Z (TIMES (SUB1 X) Z)) Z))
(EQUAL (PLUS Z (TIMES (SUB1 X) Z))
0)).
However this again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
DIVIDES-TIMES
(PROVE-LEMMA DIFFERENCE-PLUS3
(REWRITE)
(EQUAL (DIFFERENCE (PLUS B (PLUS A C)) A)
(PLUS B C)))
This simplifies, using linear arithmetic, to:
(IMPLIES (LESSP (PLUS B A C) A)
(EQUAL (DIFFERENCE (PLUS B A C) A)
(PLUS B C))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIFFERENCE-PLUS3
(PROVE-LEMMA DIFFERENCE-ADD1-CANCELLATION
(REWRITE)
(EQUAL (DIFFERENCE (ADD1 (PLUS Y Z)) Z)
(ADD1 Y)))
This conjecture simplifies, using linear arithmetic, to:
(IMPLIES (LESSP (ADD1 (PLUS Y Z)) Z)
(EQUAL (DIFFERENCE (ADD1 (PLUS Y Z)) Z)
(ADD1 Y))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIFFERENCE-ADD1-CANCELLATION
(PROVE-LEMMA REMAINDER-ADD1
(REWRITE)
(IMPLIES (AND (NOT (ZEROP Y))
(NOT (EQUAL Y 1)))
(NOT (EQUAL (REMAINDER (ADD1 (TIMES X Y)) Y)
0))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES (AND (NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Y 1)))
(NOT (EQUAL (REMAINDER (ADD1 (TIMES X Y)) Y)
0))).
Name the above subgoal *1.
We will appeal to induction. There is only one plausible induction. We
will induct according to the following scheme:
(AND (IMPLIES (ZEROP X) (p X Y))
(IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) Y))
(p X Y))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP 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 two new formulas:
Case 2. (IMPLIES (AND (ZEROP X)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Y 1)))
(NOT (EQUAL (REMAINDER (ADD1 (TIMES X Y)) Y)
0))).
This simplifies, using linear arithmetic, applying the lemma DIFFERENCE-0,
and opening up the definitions of ZEROP, EQUAL, TIMES, ADD1, NUMBERP,
REMAINDER, and LESSP, to the following two new goals:
Case 2.2.
(IMPLIES (AND (EQUAL X 0)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Y 1)))
(LESSP 1 Y)).
This again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Y 1)))
(LESSP 1 Y)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(NOT (EQUAL (REMAINDER (ADD1 (TIMES (SUB1 X) Y))
Y)
0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Y 1)))
(NOT (EQUAL (REMAINDER (ADD1 (TIMES X Y)) Y)
0))),
which simplifies, expanding the functions ZEROP and TIMES, to:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL (REMAINDER (ADD1 (TIMES (SUB1 X) Y))
Y)
0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Y 1)))
(NOT (EQUAL (REMAINDER (ADD1 (PLUS Y (TIMES (SUB1 X) Y)))
Y)
0))).
But this further simplifies, rewriting with the lemma COMMUTATIVITY-OF-TIMES,
to:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL (REMAINDER (ADD1 (TIMES Y (SUB1 X)))
Y)
0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Y 1)))
(NOT (EQUAL (REMAINDER (ADD1 (PLUS Y (TIMES Y (SUB1 X))))
Y)
0))).
Appealing to the lemma SUB1-ELIM, we now replace X by (ADD1 Z) to eliminate
(SUB1 X). We employ the type restriction lemma noted when SUB1 was
introduced to constrain the new variable. We must thus prove the conjecture:
(IMPLIES (AND (NUMBERP Z)
(NOT (EQUAL (ADD1 Z) 0))
(NOT (EQUAL (REMAINDER (ADD1 (TIMES Y Z)) Y)
0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Y 1)))
(NOT (EQUAL (REMAINDER (ADD1 (PLUS Y (TIMES Y Z)))
Y)
0))).
This further simplifies, trivially, to the new goal:
(IMPLIES (AND (NUMBERP Z)
(NOT (EQUAL (REMAINDER (ADD1 (TIMES Y Z)) Y)
0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Y 1)))
(NOT (EQUAL (REMAINDER (ADD1 (PLUS Y (TIMES Y Z)))
Y)
0))),
which we generalize by replacing (TIMES Y Z) by A. We restrict the new
variable by recalling the type restriction lemma noted when TIMES was
introduced. We would thus like to prove:
(IMPLIES (AND (NUMBERP A)
(NUMBERP Z)
(NOT (EQUAL (REMAINDER (ADD1 A) Y) 0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Y 1)))
(NOT (EQUAL (REMAINDER (ADD1 (PLUS Y A)) Y)
0))),
which further simplifies, appealing to the lemmas COMMUTATIVITY-OF-PLUS,
DIFFERENCE-ADD1-CANCELLATION, and SUB1-ADD1, and unfolding LESSP and
REMAINDER, to:
(IMPLIES (AND (NUMBERP A)
(NUMBERP Z)
(NOT (EQUAL (REMAINDER (ADD1 A) Y) 0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL Y 1))
(LESSP (PLUS A Y) (SUB1 Y)))
(NOT (EQUAL (ADD1 (PLUS A Y)) 0))).
This finally simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
REMAINDER-ADD1
(PROVE-LEMMA DIVIDES-PLUS-REWRITE1
(REWRITE)
(IMPLIES (AND (EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS X Y) Z) 0)))
.
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace X by (PLUS V (TIMES Z W))
to eliminate (REMAINDER X Z) and (QUOTIENT X Z). We employ LESSP-REMAINDER2,
the type restriction lemma noted when REMAINDER was introduced, and the type
restriction lemma noted when QUOTIENT was introduced to restrict the new
variables. We would thus like to prove the following four new conjectures:
Case 4. (IMPLIES (AND (NOT (NUMBERP X))
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS X Y) Z) 0)).
However this simplifies, expanding LESSP, REMAINDER, EQUAL, and PLUS, to the
conjecture:
(IMPLIES (AND (NOT (NUMBERP X))
(EQUAL (REMAINDER Y Z) 0)
(NOT (NUMBERP Y)))
(EQUAL (REMAINDER 0 Z) 0)).
But this again simplifies, expanding the definitions of LESSP, REMAINDER,
EQUAL, and NUMBERP, to:
T.
Case 3. (IMPLIES (AND (EQUAL Z 0)
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS X Y) Z) 0)),
which simplifies, applying PLUS-RIGHT-ID2 and COMMUTATIVITY-OF-PLUS, and
expanding the definitions of EQUAL, REMAINDER, PLUS, and NUMBERP, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP Z))
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS X Y) Z) 0)).
But this simplifies, applying REMAINDER-WRT-12, PLUS-RIGHT-ID2, and
COMMUTATIVITY-OF-PLUS, and opening up the definitions of PLUS, NUMBERP, and
EQUAL, to:
T.
Case 1. (IMPLIES (AND (NUMBERP V)
(EQUAL (LESSP V Z) (NOT (ZEROP Z)))
(NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(EQUAL V 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS (PLUS V (TIMES Z W)) Y)
Z)
0)).
However this simplifies, applying COMMUTATIVITY-OF-TIMES and
COMMUTATIVITY-OF-PLUS, and unfolding the functions NUMBERP, EQUAL, LESSP,
ZEROP, NOT, and PLUS, to the new formula:
(IMPLIES (AND (NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS Y (TIMES W Z)) Z)
0)).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace Y by
(PLUS V (TIMES Z D)) to eliminate (REMAINDER Y Z) and (QUOTIENT Y Z). We
rely upon LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER
was introduced, and the type restriction lemma noted when QUOTIENT was
introduced to restrict the new variables. This produces the following two
new formulas:
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP Y))
(NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS Y (TIMES W Z)) Z)
0)).
However this further simplifies, rewriting with DIVIDES-TIMES, and opening
up LESSP, REMAINDER, EQUAL, and PLUS, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP V)
(EQUAL (LESSP V Z) (NOT (ZEROP Z)))
(NUMBERP D)
(NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(EQUAL V 0))
(EQUAL (REMAINDER (PLUS (PLUS V (TIMES Z D))
(TIMES W Z))
Z)
0)).
However this further simplifies, applying COMMUTATIVITY-OF-TIMES, and
opening up NUMBERP, EQUAL, LESSP, ZEROP, NOT, and PLUS, to:
(IMPLIES (AND (NUMBERP D)
(NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0)))
(EQUAL (REMAINDER (PLUS (TIMES D Z) (TIMES W Z))
Z)
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:
(IMPLIES (AND (EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS X Y) Z) 0)).
We named this *1. We will try to prove it by induction. There are three
plausible inductions, two of which are unflawed. So we will choose the one
suggested by the largest number of nonprimitive recursive functions. We will
induct according to the following scheme:
(AND (IMPLIES (ZEROP Z) (p X Y Z))
(IMPLIES (AND (NOT (ZEROP Z)) (LESSP X Z))
(p X Y Z))
(IMPLIES (AND (NOT (ZEROP Z))
(NOT (LESSP X Z))
(p (DIFFERENCE X Z) Y Z))
(p X Y Z))).
Linear arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the
definition of ZEROP 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 four new goals:
Case 4. (IMPLIES (AND (ZEROP Z)
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS X Y) Z) 0)),
which simplifies, rewriting with the lemmas PLUS-RIGHT-ID2,
COMMUTATIVITY-OF-PLUS, and REMAINDER-WRT-12, and expanding ZEROP, EQUAL,
REMAINDER, PLUS, and NUMBERP, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP Z))
(LESSP X Z)
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS X Y) Z) 0)),
which simplifies, unfolding ZEROP, REMAINDER, EQUAL, and PLUS, to two new
conjectures:
Case 3.2.
(IMPLIES (AND (NOT (EQUAL Z 0))
(NUMBERP Z)
(LESSP X Z)
(EQUAL X 0)
(EQUAL (REMAINDER Y Z) 0)
(NOT (NUMBERP Y)))
(EQUAL (REMAINDER 0 Z) 0)),
which again simplifies, unfolding EQUAL, LESSP, REMAINDER, and NUMBERP, to:
T.
Case 3.1.
(IMPLIES (AND (NOT (EQUAL Z 0))
(NUMBERP Z)
(LESSP X Z)
(NOT (NUMBERP X))
(EQUAL (REMAINDER Y Z) 0)
(NOT (NUMBERP Y)))
(EQUAL (REMAINDER 0 Z) 0)),
which again simplifies, unfolding the functions LESSP, REMAINDER, EQUAL,
and NUMBERP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP Z))
(NOT (LESSP X Z))
(NOT (EQUAL (REMAINDER (DIFFERENCE X Z) Z)
0))
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS X Y) Z) 0)),
which simplifies, unfolding the definitions of ZEROP and REMAINDER, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP Z))
(NOT (LESSP X Z))
(EQUAL (REMAINDER (PLUS (DIFFERENCE X Z) Y)
Z)
0)
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS X Y) Z) 0)),
which simplifies, rewriting with COMMUTATIVITY-OF-PLUS, and opening up ZEROP
and REMAINDER, to:
(IMPLIES (AND (NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (LESSP X Z))
(EQUAL (REMAINDER (PLUS Y (DIFFERENCE X Z))
Z)
0)
(EQUAL (REMAINDER (DIFFERENCE X Z) Z)
0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS X Y) Z) 0)).
Applying the lemmas DIFFERENCE-ELIM and REMAINDER-QUOTIENT-ELIM, replace X
by (PLUS Z V) to eliminate (DIFFERENCE X Z) and V by (PLUS W (TIMES Z D)) to
eliminate (REMAINDER V Z) and (QUOTIENT V Z). We use the type restriction
lemma noted when DIFFERENCE was introduced, LESSP-REMAINDER2, the type
restriction lemma noted when REMAINDER was introduced, and the type
restriction lemma noted when QUOTIENT was introduced to restrict the new
variables. This produces the following two new conjectures:
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (LESSP X Z))
(EQUAL (REMAINDER (PLUS Y (DIFFERENCE X Z))
Z)
0)
(EQUAL (REMAINDER (DIFFERENCE X Z) Z)
0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS X Y) Z) 0)).
This further simplifies, unfolding the function LESSP, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP W)
(EQUAL (LESSP W Z) (NOT (ZEROP Z)))
(NUMBERP D)
(NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (LESSP (PLUS Z W (TIMES Z D)) Z))
(EQUAL (REMAINDER (PLUS Y W (TIMES Z D)) Z)
0)
(EQUAL W 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (REMAINDER (PLUS (PLUS Z W (TIMES Z D)) Y)
Z)
0)),
which further simplifies, rewriting with the lemmas COMMUTATIVITY-OF-TIMES,
COMMUTATIVITY-OF-PLUS, COMMUTATIVITY2-OF-PLUS, ASSOCIATIVITY-OF-PLUS, and
DIFFERENCE-PLUS3, and unfolding the functions NUMBERP, EQUAL, LESSP, ZEROP,
NOT, PLUS, and REMAINDER, to:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (LESSP (PLUS Z (TIMES D Z)) Z))
(EQUAL (REMAINDER (PLUS Y (TIMES D Z)) Z)
0)
(EQUAL (REMAINDER Y Z) 0)
(LESSP (PLUS Y Z (TIMES D Z)) Z))
(EQUAL (PLUS Y Z (TIMES D Z)) 0)).
However this again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
DIVIDES-PLUS-REWRITE1
(PROVE-LEMMA DIVIDES-PLUS-REWRITE2
(REWRITE)
(IMPLIES (AND (EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))))
.
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace X by (PLUS V (TIMES Z W))
to eliminate (REMAINDER X Z) and (QUOTIENT X Z). We use LESSP-REMAINDER2, the
type restriction lemma noted when REMAINDER was introduced, and the type
restriction lemma noted when QUOTIENT was introduced to restrict the new
variables. We would thus like to prove the following four new formulas:
Case 4. (IMPLIES (AND (NOT (NUMBERP X))
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))).
But this simplifies, unfolding the definitions of LESSP, REMAINDER, EQUAL,
and PLUS, to:
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EQUAL (REMAINDER Y Z) 0))
(NOT (NUMBERP Y)))
(NOT (EQUAL (REMAINDER 0 Z) 0))).
This again simplifies, expanding the functions LESSP, REMAINDER, and EQUAL,
to:
T.
Case 3. (IMPLIES (AND (EQUAL Z 0)
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))),
which simplifies, expanding the functions EQUAL, REMAINDER, and PLUS, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP Z))
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))),
which simplifies, rewriting with REMAINDER-WRT-12, and expanding EQUAL and
PLUS, to:
T.
Case 1. (IMPLIES (AND (NUMBERP V)
(EQUAL (LESSP V Z) (NOT (ZEROP Z)))
(NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(EQUAL V 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS (PLUS V (TIMES Z W)) Y)
Z)
0))).
This simplifies, rewriting with COMMUTATIVITY-OF-TIMES and
COMMUTATIVITY-OF-PLUS, and expanding the functions NUMBERP, EQUAL, LESSP,
ZEROP, NOT, and PLUS, to:
(IMPLIES (AND (NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS Y (TIMES W Z)) Z)
0))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace Y by
(PLUS V (TIMES Z D)) to eliminate (REMAINDER Y Z) and (QUOTIENT Y Z). We
rely upon LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER
was introduced, and the type restriction lemma noted when QUOTIENT was
introduced to restrict the new variables. We thus obtain the following two
new conjectures:
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP Y))
(NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS Y (TIMES W Z)) Z)
0))).
This further simplifies, unfolding the definitions of LESSP, REMAINDER,
and EQUAL, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP V)
(EQUAL (LESSP V Z) (NOT (ZEROP Z)))
(NUMBERP D)
(NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(NOT (EQUAL V 0)))
(NOT (EQUAL (REMAINDER (PLUS (PLUS V (TIMES Z D))
(TIMES W Z))
Z)
0))),
which further simplifies, rewriting with COMMUTATIVITY-OF-TIMES and
ASSOCIATIVITY-OF-PLUS, and opening up ZEROP and NOT, to:
(IMPLIES (AND (NUMBERP V)
(LESSP V Z)
(NUMBERP D)
(NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(NOT (EQUAL V 0)))
(NOT (EQUAL (REMAINDER (PLUS V (TIMES D Z) (TIMES W Z))
Z)
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:
(IMPLIES (AND (EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))).
We named this *1. We will try to prove it by induction. Three inductions are
suggested by terms in the conjecture, two of which are unflawed. So we will
choose the one suggested by the largest number of nonprimitive recursive
functions. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP Z) (p X Y Z))
(IMPLIES (AND (NOT (ZEROP Z)) (LESSP X Z))
(p X Y Z))
(IMPLIES (AND (NOT (ZEROP Z))
(NOT (LESSP X Z))
(p (DIFFERENCE X Z) Y Z))
(p X Y Z))).
Linear arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the
definition of ZEROP 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 four new formulas:
Case 4. (IMPLIES (AND (ZEROP Z)
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))),
which simplifies, rewriting with the lemma REMAINDER-WRT-12, and unfolding
the definitions of ZEROP, EQUAL, REMAINDER, and PLUS, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP Z))
(LESSP X Z)
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))),
which simplifies, expanding the functions ZEROP, REMAINDER, EQUAL, and PLUS,
to two new goals:
Case 3.2.
(IMPLIES (AND (NOT (EQUAL Z 0))
(NUMBERP Z)
(LESSP X Z)
(EQUAL X 0)
(NOT (EQUAL (REMAINDER Y Z) 0))
(NOT (NUMBERP Y)))
(NOT (EQUAL (REMAINDER 0 Z) 0))),
which again simplifies, opening up EQUAL, LESSP, and REMAINDER, to:
T.
Case 3.1.
(IMPLIES (AND (NOT (EQUAL Z 0))
(NUMBERP Z)
(LESSP X Z)
(NOT (NUMBERP X))
(NOT (EQUAL (REMAINDER Y Z) 0))
(NOT (NUMBERP Y)))
(NOT (EQUAL (REMAINDER 0 Z) 0))),
which again simplifies, expanding the functions LESSP, REMAINDER, and
EQUAL, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP Z))
(NOT (LESSP X Z))
(NOT (EQUAL (REMAINDER (DIFFERENCE X Z) Z)
0))
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))),
which simplifies, unfolding the functions ZEROP and REMAINDER, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP Z))
(NOT (LESSP X Z))
(NOT (EQUAL (REMAINDER (PLUS (DIFFERENCE X Z) Y)
Z)
0))
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))),
which simplifies, rewriting with the lemma COMMUTATIVITY-OF-PLUS, and
opening up the definitions of ZEROP and REMAINDER, to the goal:
(IMPLIES (AND (NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (LESSP X Z))
(NOT (EQUAL (REMAINDER (PLUS Y (DIFFERENCE X Z))
Z)
0))
(EQUAL (REMAINDER (DIFFERENCE X Z) Z)
0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))).
Appealing to the lemmas DIFFERENCE-ELIM and REMAINDER-QUOTIENT-ELIM, we now
replace X by (PLUS Z V) to eliminate (DIFFERENCE X Z) and V by
(PLUS W (TIMES Z D)) to eliminate (REMAINDER V Z) and (QUOTIENT V Z). We
use the type restriction lemma noted when DIFFERENCE was introduced,
LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was
introduced to constrain the new variables. We must thus prove two new
formulas:
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (LESSP X Z))
(NOT (EQUAL (REMAINDER (PLUS Y (DIFFERENCE X Z))
Z)
0))
(EQUAL (REMAINDER (DIFFERENCE X Z) Z)
0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))),
which further simplifies, opening up LESSP, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP W)
(EQUAL (LESSP W Z) (NOT (ZEROP Z)))
(NUMBERP D)
(NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (LESSP (PLUS Z W (TIMES Z D)) Z))
(NOT (EQUAL (REMAINDER (PLUS Y W (TIMES Z D)) Z)
0))
(EQUAL W 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS (PLUS Z W (TIMES Z D)) Y)
Z)
0))),
which further simplifies, applying COMMUTATIVITY-OF-TIMES,
COMMUTATIVITY-OF-PLUS, COMMUTATIVITY2-OF-PLUS, ASSOCIATIVITY-OF-PLUS, and
DIFFERENCE-PLUS3, and unfolding the definitions of NUMBERP, EQUAL, LESSP,
ZEROP, NOT, PLUS, and REMAINDER, to:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (LESSP (PLUS Z (TIMES D Z)) Z))
(NOT (EQUAL (REMAINDER (PLUS Y (TIMES D Z)) Z)
0))
(NOT (EQUAL (REMAINDER Y Z) 0))
(LESSP (PLUS Y Z (TIMES D Z)) Z))
(NOT (EQUAL (PLUS Y Z (TIMES D Z)) 0))),
which again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
DIVIDES-PLUS-REWRITE2
(PROVE-LEMMA DIVIDES-PLUS-REWRITE
(REWRITE)
(IMPLIES (EQUAL (REMAINDER X Z) 0)
(EQUAL (EQUAL (REMAINDER (PLUS X Y) Z) 0)
(EQUAL (REMAINDER Y Z) 0))))
This conjecture simplifies, clearly, to two new conjectures:
Case 2. (IMPLIES (AND (EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER Y Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X Y) Z) 0))),
which again simplifies, applying DIVIDES-PLUS-REWRITE2, to:
T.
Case 1. (IMPLIES (AND (EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(EQUAL (EQUAL (REMAINDER (PLUS X Y) Z) 0)
T)).
However this again simplifies, applying DIVIDES-PLUS-REWRITE1, and unfolding
the function EQUAL, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIVIDES-PLUS-REWRITE
(PROVE-LEMMA LESSP-PLUS-CANCELATION
(REWRITE)
(EQUAL (LESSP (PLUS X Y) (PLUS X Z))
(LESSP Y Z)))
This simplifies, rewriting with EQUAL-LESSP, to two new formulas:
Case 2. (IMPLIES (NOT (LESSP (PLUS X Y) (PLUS X Z)))
(NOT (LESSP Y Z))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (LESSP (PLUS X Y) (PLUS X Z))
(LESSP Y Z)),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LESSP-PLUS-CANCELATION
(PROVE-LEMMA DIVIDES-PLUS-REWRITE-COMMUTED
(REWRITE)
(IMPLIES (EQUAL (REMAINDER X Z) 0)
(EQUAL (EQUAL (REMAINDER (PLUS Y X) Z) 0)
(EQUAL (REMAINDER Y Z) 0))))
This conjecture simplifies, applying COMMUTATIVITY-OF-PLUS and
DIVIDES-PLUS-REWRITE, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
DIVIDES-PLUS-REWRITE-COMMUTED
(PROVE-LEMMA EUCLID
(REWRITE)
(IMPLIES (EQUAL (REMAINDER X Z) 0)
(EQUAL (EQUAL (REMAINDER (DIFFERENCE Y X) Z)
0)
(IF (LESSP X Y)
(EQUAL (REMAINDER Y Z) 0)
T))))
This formula simplifies, obviously, to the following three new conjectures:
Case 3. (IMPLIES (AND (EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER (DIFFERENCE Y X) Z)
0)))
(LESSP X Y)).
This again simplifies, applying DIFFERENCE-0, and expanding LESSP, EQUAL,
NUMBERP, and REMAINDER, to:
T.
Case 2. (IMPLIES (AND (EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER (DIFFERENCE Y X) Z)
0)))
(NOT (EQUAL (REMAINDER Y Z) 0))).
Appealing to the lemmas DIFFERENCE-ELIM and REMAINDER-QUOTIENT-ELIM, we now
replace Y by (PLUS X V) to eliminate (DIFFERENCE Y X) and V by
(PLUS W (TIMES Z D)) to eliminate (REMAINDER V Z) and (QUOTIENT V Z). We
rely upon the type restriction lemma noted when DIFFERENCE was introduced,
LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was
introduced to constrain the new variables. We must thus prove five new
goals:
Case 2.5.
(IMPLIES (AND (LESSP Y X)
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER (DIFFERENCE Y X) Z)
0)))
(NOT (EQUAL (REMAINDER Y Z) 0))),
which further simplifies, using linear arithmetic, rewriting with
DIFFERENCE-0, and expanding the definitions of LESSP, EQUAL, NUMBERP, and
REMAINDER, to:
T.
Case 2.4.
(IMPLIES (AND (NOT (NUMBERP Y))
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER (DIFFERENCE Y X) Z)
0)))
(NOT (EQUAL (REMAINDER Y Z) 0))).
However this further simplifies, using linear arithmetic, rewriting with
the lemma DIFFERENCE-0, and unfolding LESSP, EQUAL, NUMBERP, and REMAINDER,
to:
T.
Case 2.3.
(IMPLIES (AND (EQUAL Z 0)
(NUMBERP V)
(NOT (LESSP (PLUS X V) X))
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER V Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X V) Z) 0))),
which further simplifies, rewriting with COMMUTATIVITY-OF-PLUS and
PLUS-RIGHT-ID2, and opening up the functions EQUAL, REMAINDER, and PLUS,
to:
T.
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP Z))
(NUMBERP V)
(NOT (LESSP (PLUS X V) X))
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL (REMAINDER V Z) 0)))
(NOT (EQUAL (REMAINDER (PLUS X V) Z) 0))).
But this further simplifies, rewriting with COMMUTATIVITY-OF-PLUS,
REMAINDER-WRT-12, and PLUS-RIGHT-ID2, and expanding the functions EQUAL
and PLUS, to:
T.
Case 2.1.
(IMPLIES (AND (NUMBERP W)
(EQUAL (LESSP W Z) (NOT (ZEROP Z)))
(NUMBERP D)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(NOT (LESSP (PLUS X W (TIMES Z D)) X))
(EQUAL (REMAINDER X Z) 0)
(NOT (EQUAL W 0)))
(NOT (EQUAL (REMAINDER (PLUS X W (TIMES Z D)) Z)
0))).
But this further simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES,
COMMUTATIVITY2-OF-PLUS, DIVIDES-PLUS-REWRITE1, DIVIDES-TIMES, and
DIVIDES-PLUS-REWRITE-COMMUTED, and expanding the functions ZEROP, NOT,
EQUAL, and REMAINDER, to:
T.
Case 1. (IMPLIES (AND (EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER (DIFFERENCE Y X) Z)
0)
(LESSP X Y))
(EQUAL (EQUAL (REMAINDER Y Z) 0) T)),
which again simplifies, trivially, to the new formula:
(IMPLIES (AND (EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER (DIFFERENCE Y X) Z)
0)
(LESSP X Y))
(EQUAL (REMAINDER Y Z) 0)).
Applying the lemmas DIFFERENCE-ELIM and REMAINDER-QUOTIENT-ELIM, replace Y
by (PLUS X V) to eliminate (DIFFERENCE Y X) and V by (PLUS W (TIMES Z D)) to
eliminate (REMAINDER V Z) and (QUOTIENT V Z). We use the type restriction
lemma noted when DIFFERENCE was introduced, LESSP-REMAINDER2, the type
restriction lemma noted when REMAINDER was introduced, and the type
restriction lemma noted when QUOTIENT was introduced to restrict the new
variables. We would thus like to prove the following five new goals:
Case 1.5.
(IMPLIES (AND (LESSP Y X)
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER (DIFFERENCE Y X) Z)
0)
(LESSP X Y))
(EQUAL (REMAINDER Y Z) 0)).
But this further simplifies, using linear arithmetic, to:
T.
Case 1.4.
(IMPLIES (AND (NOT (NUMBERP Y))
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER (DIFFERENCE Y X) Z)
0)
(LESSP X Y))
(EQUAL (REMAINDER Y Z) 0)),
which further simplifies, expanding DIFFERENCE, LESSP, EQUAL, NUMBERP, and
REMAINDER, to:
T.
Case 1.3.
(IMPLIES (AND (EQUAL Z 0)
(NUMBERP V)
(NOT (LESSP (PLUS X V) X))
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER V Z) 0)
(LESSP X (PLUS X V)))
(EQUAL (REMAINDER (PLUS X V) Z) 0)),
which further simplifies, applying the lemmas COMMUTATIVITY-OF-PLUS and
PLUS-RIGHT-ID2, and opening up the functions EQUAL, REMAINDER, PLUS, LESSP,
and NUMBERP, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP Z))
(NUMBERP V)
(NOT (LESSP (PLUS X V) X))
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER V Z) 0)
(LESSP X (PLUS X V)))
(EQUAL (REMAINDER (PLUS X V) Z) 0)),
which further simplifies, applying the lemmas COMMUTATIVITY-OF-PLUS,
REMAINDER-WRT-12, and PLUS-RIGHT-ID2, and opening up PLUS, LESSP, NUMBERP,
and EQUAL, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP W)
(EQUAL (LESSP W Z) (NOT (ZEROP Z)))
(NUMBERP D)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(NOT (LESSP (PLUS X W (TIMES Z D)) X))
(EQUAL (REMAINDER X Z) 0)
(EQUAL W 0)
(LESSP X (PLUS X W (TIMES Z D))))
(EQUAL (REMAINDER (PLUS X W (TIMES Z D)) Z)
0)),
which further simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES,
DIVIDES-TIMES, and DIVIDES-PLUS-REWRITE1, and opening up NUMBERP, EQUAL,
LESSP, ZEROP, NOT, and PLUS, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
EUCLID
(PROVE-LEMMA LESSP-TIMES-CANCELLATION
(REWRITE)
(EQUAL (LESSP (TIMES X Z) (TIMES Y Z))
(AND (NOT (ZEROP Z)) (LESSP X Y))))
This conjecture simplifies, rewriting with EQUAL-LESSP, and expanding the
definitions of ZEROP, NOT, and AND, to the following four new goals:
Case 4. (IMPLIES (AND (NOT (LESSP (TIMES X Z) (TIMES Y Z)))
(NOT (EQUAL Z 0))
(NUMBERP Z))
(NOT (LESSP X Y))).
Call the above conjecture *1.
Case 3. (IMPLIES (LESSP (TIMES X Z) (TIMES Y Z))
(LESSP X Y)),
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 (LESSP (TIMES X Z) (TIMES Y Z))
(AND (NOT (ZEROP Z)) (LESSP X Y))).
We gave this the name *1 above. 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 (ZEROP X) (p X Z Y))
(IMPLIES (AND (NOT (ZEROP X))
(p (SUB1 X) Z (SUB1 Y)))
(p X Z Y))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP 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. Note,
however, the inductive instance chosen for Y. The above induction scheme
produces two new conjectures:
Case 2. (IMPLIES (ZEROP X)
(EQUAL (LESSP (TIMES X Z) (TIMES Y Z))
(AND (NOT (ZEROP Z)) (LESSP X Y)))),
which simplifies, expanding ZEROP, EQUAL, TIMES, LESSP, NOT, and AND, to ten
new conjectures:
Case 2.10.
(IMPLIES (AND (EQUAL X 0)
(EQUAL Z 0)
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL (PLUS Z (TIMES (SUB1 Y) Z))
0)),
which again simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and
expanding the functions EQUAL, TIMES, and PLUS, to:
T.
Case 2.9.
(IMPLIES (AND (EQUAL X 0)
(NOT (NUMBERP Z))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL (PLUS Z (TIMES (SUB1 Y) Z))
0)).
This again simplifies, applying EQUAL-TIMES-0, and opening up the
definition of PLUS, to:
T.
Case 2.8.
(IMPLIES (AND (EQUAL X 0)
(NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (EQUAL Y 0))
(EQUAL (PLUS Z (TIMES (SUB1 Y) Z)) 0))
(EQUAL F (NUMBERP Y))).
But this again simplifies, using linear arithmetic, to:
T.
Case 2.7.
(IMPLIES (AND (EQUAL X 0)
(NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (EQUAL Y 0))
(NOT (NUMBERP Y)))
(EQUAL F (NUMBERP Y))),
which again simplifies, trivially, to:
T.
Case 2.6.
(IMPLIES (AND (EQUAL X 0)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL (PLUS Z (TIMES (SUB1 Y) Z))
0)))
(EQUAL T (NUMBERP Y))).
This again simplifies, obviously, to:
T.
Case 2.5.
(IMPLIES (AND (NOT (NUMBERP X))
(EQUAL Z 0)
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL (PLUS Z (TIMES (SUB1 Y) Z))
0)).
However this again simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and
expanding EQUAL, TIMES, and PLUS, to:
T.
Case 2.4.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (NUMBERP Z))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL (PLUS Z (TIMES (SUB1 Y) Z))
0)).
However this again simplifies, applying the lemma EQUAL-TIMES-0, and
expanding PLUS, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (EQUAL Y 0))
(EQUAL (PLUS Z (TIMES (SUB1 Y) Z)) 0))
(EQUAL F (NUMBERP Y))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EQUAL Z 0))
(NUMBERP Z)
(NOT (EQUAL Y 0))
(NOT (NUMBERP Y)))
(EQUAL F (NUMBERP Y))),
which again simplifies, clearly, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL (PLUS Z (TIMES (SUB1 Y) Z))
0)))
(EQUAL T (NUMBERP Y))).
This again simplifies, clearly, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(EQUAL (LESSP (TIMES (SUB1 X) Z)
(TIMES (SUB1 Y) Z))
(AND (NOT (ZEROP Z))
(LESSP (SUB1 X) (SUB1 Y)))))
(EQUAL (LESSP (TIMES X Z) (TIMES Y Z))
(AND (NOT (ZEROP Z)) (LESSP X Y)))).
This simplifies, applying EQUAL-LESSP, TIMES-ZERO2, and
COMMUTATIVITY-OF-TIMES, and unfolding the definitions of ZEROP, NOT, AND,
TIMES, LESSP, and EQUAL, to six new goals:
Case 1.6.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP (TIMES (SUB1 X) Z)
(TIMES (SUB1 Y) Z)))
(NOT (LESSP (SUB1 X) (SUB1 Y)))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(NOT (LESSP (PLUS Z (TIMES (SUB1 X) Z))
(PLUS Z (TIMES (SUB1 Y) Z))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.5.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP (TIMES (SUB1 X) Z)
(TIMES (SUB1 Y) Z)))
(NOT (LESSP (SUB1 X) (SUB1 Y)))
(EQUAL Y 0))
(NOT (LESSP (PLUS Z (TIMES (SUB1 X) Z))
0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.4.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP (TIMES (SUB1 X) Z)
(TIMES (SUB1 Y) Z)))
(NOT (LESSP (SUB1 X) (SUB1 Y)))
(NOT (NUMBERP Y)))
(NOT (LESSP (PLUS Z (TIMES (SUB1 X) Z))
0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(LESSP (TIMES (SUB1 X) Z)
(TIMES (SUB1 Y) Z))
(NOT (EQUAL Z 0))
(NUMBERP Z)
(LESSP (SUB1 X) (SUB1 Y))
(NOT (NUMBERP Y)))
(NOT (LESSP (PLUS Z (TIMES (SUB1 X) Z))
0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(LESSP (TIMES (SUB1 X) Z)
(TIMES (SUB1 Y) Z))
(NOT (EQUAL Z 0))
(NUMBERP Z)
(LESSP (SUB1 X) (SUB1 Y))
(EQUAL Y 0))
(NOT (LESSP (PLUS Z (TIMES (SUB1 X) Z))
0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(LESSP (TIMES (SUB1 X) Z)
(TIMES (SUB1 Y) Z))
(NOT (EQUAL Z 0))
(NUMBERP Z)
(LESSP (SUB1 X) (SUB1 Y))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(LESSP (PLUS Z (TIMES (SUB1 X) Z))
(PLUS Z (TIMES (SUB1 Y) Z)))),
which again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
LESSP-TIMES-CANCELLATION
(PROVE-LEMMA LESSP-PLUS-CANCELLATION3
(REWRITE)
(EQUAL (LESSP Y (PLUS X Y))
(NOT (ZEROP X))))
This conjecture simplifies, applying EQUAL-LESSP, and unfolding the functions
ZEROP and NOT, to three new goals:
Case 3. (IMPLIES (AND (NOT (LESSP Y (PLUS X Y)))
(NOT (EQUAL X 0)))
(NOT (NUMBERP X))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (LESSP Y (PLUS X Y))
(NUMBERP X)),
which again simplifies, expanding PLUS, to two new conjectures:
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP Y)) (LESSP Y 0))
(NUMBERP X)),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (NUMBERP Y) (LESSP Y Y))
(NUMBERP X)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (LESSP Y (PLUS X Y))
(NOT (EQUAL X 0))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LESSP-PLUS-CANCELLATION3
(PROVE-LEMMA DISTRIBUTIVITY-OF-TIMES-OVER-GCD
(REWRITE)
(EQUAL (GCD (TIMES X Z) (TIMES Y Z))
(TIMES Z (GCD X Y))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-GCD, could be applied
whenever the newly proposed DISTRIBUTIVITY-OF-TIMES-OVER-GCD could!
Call the conjecture *1.
We will try to prove it by induction. There are four plausible
inductions, three of which are unflawed. So we will choose the one suggested
by the largest number of nonprimitive recursive functions. We will induct
according to the following scheme:
(AND (IMPLIES (ZEROP X) (p X Z Y))
(IMPLIES (AND (NOT (ZEROP X)) (ZEROP Y))
(p X Z Y))
(IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(LESSP X Y)
(p X Z (DIFFERENCE Y X)))
(p X Z Y))
(IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(NOT (LESSP X Y))
(p (DIFFERENCE X Y) Z Y))
(p X Z Y))).
Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, COUNT-NUMBERP,
DIFFERENCE-CANCELLATION-0, and ADD1-EQUAL, and the definitions of ORDINALP,
LESSP, ORD-LESSP, and ZEROP inform us that the measure:
(CONS (ADD1 (COUNT X)) (COUNT Y))
decreases according to the well-founded relation ORD-LESSP in each induction
step of the scheme. The above induction scheme generates four new goals:
Case 4. (IMPLIES (ZEROP X)
(EQUAL (GCD (TIMES X Z) (TIMES Y Z))
(TIMES Z (GCD X Y)))),
which simplifies, appealing to the lemma GCD-0, and unfolding ZEROP, EQUAL,
TIMES, and GCD, to four new formulas:
Case 4.4.
(IMPLIES (AND (EQUAL X 0) (NOT (NUMBERP Y)))
(EQUAL (TIMES Y Z) (TIMES Z 0))),
which again simplifies, applying COMMUTATIVITY-OF-TIMES, and opening up
the functions TIMES and EQUAL, to:
T.
Case 4.3.
(IMPLIES (AND (EQUAL X 0) (NUMBERP Y))
(EQUAL (TIMES Y Z) (TIMES Z Y))).
But this again simplifies, applying the lemma COMMUTATIVITY-OF-TIMES, to:
T.
Case 4.2.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (NUMBERP Y)))
(EQUAL (TIMES Y Z) (TIMES Z 0))),
which again simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and opening
up the functions TIMES and EQUAL, to:
T.
Case 4.1.
(IMPLIES (AND (NOT (NUMBERP X)) (NUMBERP Y))
(EQUAL (TIMES Y Z) (TIMES Z Y))).
But this again simplifies, rewriting with COMMUTATIVITY-OF-TIMES, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP X)) (ZEROP Y))
(EQUAL (GCD (TIMES X Z) (TIMES Y Z))
(TIMES Z (GCD X Y)))).
This simplifies, applying GCD-0, COMMUTATIVITY-OF-GCD, and
COMMUTATIVITY-OF-TIMES, and opening up ZEROP, EQUAL, TIMES, and GCD, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(LESSP X Y)
(EQUAL (GCD (TIMES X Z)
(TIMES (DIFFERENCE Y X) Z))
(TIMES Z (GCD X (DIFFERENCE Y X)))))
(EQUAL (GCD (TIMES X Z) (TIMES Y Z))
(TIMES Z (GCD X Y)))),
which simplifies, using linear arithmetic, applying the lemmas
TIMES-DIFFERENCE, COMMUTATIVITY-OF-TIMES, GCD-0, DIFFERENCE-0,
LESSP-TIMES-CANCELLATION, and EQUAL-TIMES-0, and opening up ZEROP and GCD,
to two new conjectures:
Case 2.2.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(LESSP X Y)
(EQUAL (GCD (TIMES X Z)
(DIFFERENCE (TIMES Y Z) (TIMES X Z)))
(TIMES Z (GCD X (DIFFERENCE Y X))))
(NOT (NUMBERP Z)))
(EQUAL (TIMES Y Z)
(TIMES Z (GCD X (DIFFERENCE Y X))))),
which again simplifies, applying TIMES-ZERO2, and expanding the
definitions of DIFFERENCE, GCD, TIMES, and EQUAL, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(LESSP X Y)
(EQUAL (GCD (TIMES X Z)
(DIFFERENCE (TIMES Y Z) (TIMES X Z)))
(TIMES Z (GCD X (DIFFERENCE Y X))))
(EQUAL Z 0))
(EQUAL (TIMES Y Z)
(TIMES Z (GCD X (DIFFERENCE Y X))))).
This again simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and
expanding EQUAL, TIMES, DIFFERENCE, and GCD, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(NOT (LESSP X Y))
(EQUAL (GCD (TIMES (DIFFERENCE X Y) Z)
(TIMES Y Z))
(TIMES Z (GCD (DIFFERENCE X Y) Y))))
(EQUAL (GCD (TIMES X Z) (TIMES Y Z))
(TIMES Z (GCD X Y)))).
This simplifies, rewriting with TIMES-DIFFERENCE, COMMUTATIVITY-OF-TIMES,
and COMMUTATIVITY-OF-GCD, and unfolding ZEROP and GCD, to:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (LESSP X Y))
(EQUAL (GCD (TIMES Y Z)
(DIFFERENCE (TIMES X Z) (TIMES Y Z)))
(TIMES Z (GCD (DIFFERENCE X Y) Y))))
(EQUAL (GCD (TIMES X Z) (TIMES Y Z))
(TIMES Z (GCD (DIFFERENCE X Y) Y)))).
But this further simplifies, applying the lemma COMMUTATIVITY-OF-GCD, to:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (LESSP X Y))
(EQUAL (GCD (TIMES Y Z)
(DIFFERENCE (TIMES X Z) (TIMES Y Z)))
(TIMES Z (GCD Y (DIFFERENCE X Y)))))
(EQUAL (GCD (TIMES X Z) (TIMES Y Z))
(TIMES Z (GCD Y (DIFFERENCE X Y))))).
Appealing to the lemma DIFFERENCE-ELIM, we now replace X by (PLUS Y V) to
eliminate (DIFFERENCE X Y). We employ the type restriction lemma noted when
DIFFERENCE was introduced to constrain the new variable. The result is the
goal:
(IMPLIES (AND (NUMBERP V)
(NOT (EQUAL (PLUS Y V) 0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (LESSP (PLUS Y V) Y))
(EQUAL (GCD (TIMES Y Z)
(DIFFERENCE (TIMES (PLUS Y V) Z)
(TIMES Y Z)))
(TIMES Z (GCD Y V))))
(EQUAL (GCD (TIMES (PLUS Y V) Z) (TIMES Y Z))
(TIMES Z (GCD Y V)))).
This further simplifies, using linear arithmetic, applying
COMMUTATIVITY-OF-PLUS, PLUS-EQUAL-0, COMMUTATIVITY-OF-TIMES,
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, DIFFERENCE-PLUS2, COMMUTATIVITY-OF-GCD,
GCD-0, DIFFERENCE-0, LESSP-PLUS-CANCELLATION3, and EQUAL-TIMES-0, and
unfolding GCD, PLUS, EQUAL, and TIMES, to the following three new
conjectures:
Case 1.3.
(IMPLIES (AND (NUMBERP V)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (LESSP (PLUS V Y) Y))
(EQUAL (GCD (TIMES V Z) (TIMES Y Z))
(TIMES Z (GCD V Y)))
(EQUAL Z 0))
(EQUAL (TIMES Y Z)
(TIMES Z (GCD V Y)))).
But this again simplifies, appealing to the lemma COMMUTATIVITY-OF-TIMES,
and opening up the definitions of EQUAL, TIMES, and GCD, to:
T.
Case 1.2.
(IMPLIES (AND (NUMBERP V)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (LESSP (PLUS V Y) Y))
(EQUAL (GCD (TIMES V Z) (TIMES Y Z))
(TIMES Z (GCD V Y)))
(NOT (NUMBERP Z)))
(EQUAL (TIMES Y Z)
(TIMES Z (GCD V Y)))),
which again simplifies, applying TIMES-ZERO2, and unfolding GCD, TIMES,
and EQUAL, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP V)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (LESSP (PLUS V Y) Y))
(EQUAL (GCD (TIMES V Z) (TIMES Y Z))
(TIMES Z (GCD V Y)))
(EQUAL V 0))
(EQUAL (TIMES Y Z)
(TIMES Z (GCD V Y)))).
However this again simplifies, applying GCD-0 and COMMUTATIVITY-OF-TIMES,
and unfolding the definitions of NUMBERP, EQUAL, PLUS, and TIMES, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
DISTRIBUTIVITY-OF-TIMES-OVER-GCD
(PROVE-LEMMA GCD-DIVIDES-BOTH
(REWRITE)
(AND (EQUAL (REMAINDER X (GCD X Y)) 0)
(EQUAL (REMAINDER Y (GCD X Y)) 0)))
WARNING: Note that the proposed lemma GCD-DIVIDES-BOTH is to be stored as
zero type prescription rules, zero compound recognizer rules, zero linear
rules, and two replacement rules.
This formula can be simplified, using the abbreviation AND, to the following
two new conjectures:
Case 2. (EQUAL (REMAINDER X (GCD X Y)) 0).
Call the above conjecture *1.
Case 1. (EQUAL (REMAINDER Y (GCD X Y)) 0),
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:
(AND (EQUAL (REMAINDER X (GCD X Y)) 0)
(EQUAL (REMAINDER Y (GCD X Y)) 0)),
which we named *1 above. We will appeal to induction. The recursive terms in
the conjecture suggest four inductions. They merge into three likely
candidate inductions, all of which are unflawed. So we will choose the one
suggested by the largest number of nonprimitive recursive functions. We will
induct according to the following scheme:
(AND (IMPLIES (ZEROP X) (p Y X))
(IMPLIES (AND (NOT (ZEROP X)) (ZEROP Y))
(p Y X))
(IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(LESSP X Y)
(p (DIFFERENCE Y X) X))
(p Y X))
(IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(NOT (LESSP X Y))
(p Y (DIFFERENCE X Y)))
(p Y X))).
Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, COUNT-NUMBERP,
DIFFERENCE-CANCELLATION-0, and ADD1-EQUAL, and the definitions of ORDINALP,
LESSP, ORD-LESSP, and ZEROP inform us that the measure:
(CONS (ADD1 (COUNT X)) (COUNT Y))
decreases according to the well-founded relation ORD-LESSP in each induction
step of the scheme. The above induction scheme generates the following eight
new goals:
Case 8. (IMPLIES (ZEROP X)
(EQUAL (REMAINDER X (GCD X Y)) 0)).
This simplifies, rewriting with GCD-0, and expanding ZEROP, LESSP, EQUAL,
NUMBERP, REMAINDER, and GCD, to:
T.
Case 7. (IMPLIES (AND (NOT (ZEROP X)) (ZEROP Y))
(EQUAL (REMAINDER X (GCD X Y)) 0)),
which simplifies, applying GCD-0, COMMUTATIVITY-OF-GCD, and REMAINDER-X-X,
and unfolding ZEROP, EQUAL, and GCD, to:
T.
Case 6. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(LESSP X Y)
(EQUAL (REMAINDER X (GCD X (DIFFERENCE Y X)))
0)
(EQUAL (REMAINDER (DIFFERENCE Y X)
(GCD X (DIFFERENCE Y X)))
0))
(EQUAL (REMAINDER X (GCD X Y)) 0)).
This simplifies, rewriting with EUCLID, and opening up the functions ZEROP,
GCD, and EQUAL, to:
T.
Case 5. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(NOT (LESSP X Y))
(EQUAL (REMAINDER (DIFFERENCE X Y)
(GCD (DIFFERENCE X Y) Y))
0)
(EQUAL (REMAINDER Y (GCD (DIFFERENCE X Y) Y))
0))
(EQUAL (REMAINDER X (GCD X Y)) 0)),
which simplifies, applying EUCLID, and opening up ZEROP, GCD, and EQUAL, to
the new conjecture:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (LESSP X Y))
(NOT (LESSP Y X))
(EQUAL (REMAINDER Y (GCD (DIFFERENCE X Y) Y))
0))
(EQUAL (REMAINDER X (GCD (DIFFERENCE X Y) Y))
0)),
which again simplifies, using linear arithmetic, to the conjecture:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP X X))
(NOT (LESSP X X))
(EQUAL (REMAINDER X (GCD (DIFFERENCE X X) X))
0))
(EQUAL (REMAINDER X (GCD (DIFFERENCE X X) X))
0)).
This again simplifies, obviously, to:
T.
Case 4. (IMPLIES (ZEROP X)
(EQUAL (REMAINDER Y (GCD X Y)) 0)).
This simplifies, applying the lemma GCD-0, and expanding the functions ZEROP
and GCD, to the following four new conjectures:
Case 4.4.
(IMPLIES (AND (EQUAL X 0) (NOT (NUMBERP Y)))
(EQUAL (REMAINDER Y 0) 0)).
However this again simplifies, opening up the definitions of EQUAL and
REMAINDER, to:
T.
Case 4.3.
(IMPLIES (AND (EQUAL X 0) (NUMBERP Y))
(EQUAL (REMAINDER Y Y) 0)),
which again simplifies, rewriting with REMAINDER-X-X, and expanding the
definition of EQUAL, to:
T.
Case 4.2.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (NUMBERP Y)))
(EQUAL (REMAINDER Y 0) 0)).
This again simplifies, expanding the functions EQUAL and REMAINDER, to:
T.
Case 4.1.
(IMPLIES (AND (NOT (NUMBERP X)) (NUMBERP Y))
(EQUAL (REMAINDER Y Y) 0)),
which again simplifies, applying REMAINDER-X-X, and expanding the function
EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP X)) (ZEROP Y))
(EQUAL (REMAINDER Y (GCD X Y)) 0)).
This simplifies, rewriting with GCD-0 and COMMUTATIVITY-OF-GCD, and
unfolding the definitions of ZEROP, NUMBERP, LESSP, EQUAL, REMAINDER, and
GCD, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(LESSP X Y)
(EQUAL (REMAINDER X (GCD X (DIFFERENCE Y X)))
0)
(EQUAL (REMAINDER (DIFFERENCE Y X)
(GCD X (DIFFERENCE Y X)))
0))
(EQUAL (REMAINDER Y (GCD X Y)) 0)),
which simplifies, applying EUCLID, and unfolding ZEROP, GCD, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(NOT (LESSP X Y))
(EQUAL (REMAINDER (DIFFERENCE X Y)
(GCD (DIFFERENCE X Y) Y))
0)
(EQUAL (REMAINDER Y (GCD (DIFFERENCE X Y) Y))
0))
(EQUAL (REMAINDER Y (GCD X Y)) 0)).
This simplifies, rewriting with the lemma EUCLID, and expanding the
definitions of ZEROP, GCD, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
GCD-DIVIDES-BOTH
(PROVE-LEMMA GCD-IS-THE-GREATEST NIL
(IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP Y))
(DIVIDES Z X)
(DIVIDES Z Y))
(LEQ Z (GCD X Y))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
IMPLIES, and DIVIDES, to:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(NOT (LESSP (GCD X Y) Z))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace X by
(PLUS V (TIMES Z W)) to eliminate (REMAINDER X Z) and (QUOTIENT X Z). We
employ LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was introduced
to constrain the new variables. The result is three new formulas:
Case 3. (IMPLIES (AND (EQUAL Z 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(NOT (LESSP (GCD X Y) Z))),
which simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP Z))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL Y 0))
(NUMBERP Y)
(EQUAL (REMAINDER X Z) 0)
(EQUAL (REMAINDER Y Z) 0))
(NOT (LESSP (GCD X Y) Z))),
which simplifies, rewriting with the lemma REMAINDER-WRT-12, to:
T.
Case 1. (IMPLIES (AND (NUMBERP V)
(EQUAL (LESSP V Z) (NOT (ZEROP Z)))
(NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(NOT (EQUAL (PLUS V (TIMES Z W)) 0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(EQUAL V 0)
(EQUAL (REMAINDER Y Z) 0))
(NOT (LESSP (GCD (PLUS V (TIMES Z W)) Y)
Z))),
which simplifies, applying COMMUTATIVITY-OF-TIMES, EQUAL-TIMES-0, and
COMMUTATIVITY-OF-GCD, and unfolding the functions NUMBERP, EQUAL, LESSP,
ZEROP, NOT, and PLUS, to:
(IMPLIES (AND (NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(NOT (EQUAL W 0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(EQUAL (REMAINDER Y Z) 0))
(NOT (LESSP (GCD Y (TIMES W Z)) Z))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace Y by
(PLUS V (TIMES Z D)) to eliminate (REMAINDER Y Z) and (QUOTIENT Y Z). We
use LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was
introduced to restrict the new variables. We would thus like to prove:
(IMPLIES (AND (NUMBERP V)
(EQUAL (LESSP V Z) (NOT (ZEROP Z)))
(NUMBERP D)
(NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(NOT (EQUAL W 0))
(NOT (EQUAL (PLUS V (TIMES Z D)) 0))
(EQUAL V 0))
(NOT (LESSP (GCD (PLUS V (TIMES Z D)) (TIMES W Z))
Z))),
which further simplifies, appealing to the lemmas COMMUTATIVITY-OF-TIMES,
EQUAL-TIMES-0, and DISTRIBUTIVITY-OF-TIMES-OVER-GCD, and opening up the
functions NUMBERP, EQUAL, LESSP, ZEROP, NOT, and PLUS, to:
(IMPLIES (AND (NUMBERP D)
(NUMBERP W)
(NUMBERP Z)
(NOT (EQUAL Z 0))
(NOT (EQUAL W 0))
(NOT (EQUAL D 0)))
(NOT (LESSP (TIMES Z (GCD D W)) Z))).
This again simplifies, using linear arithmetic and applying LESSP-TIMES-2
and GCD-EQUAL-0, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
GCD-IS-THE-GREATEST
(ADD-SHELL CONS-IF NIL IF-EXPRP
((TEST (NONE-OF) ZERO)
(LEFT-BRANCH (NONE-OF) ZERO)
(RIGHT-BRANCH (NONE-OF) ZERO)))
[ 0.0 0.0 0.0 ]
CONS-IF
(DEFN ASSIGNMENT
(VAR ALIST)
(IF (EQUAL VAR T)
T
(IF (EQUAL VAR F)
F
(IF (NLISTP ALIST)
F
(IF (EQUAL VAR (CAAR ALIST))
(CDAR ALIST)
(ASSIGNMENT VAR (CDR ALIST)))))))
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the
definition of NLISTP can be used to prove that the measure (COUNT ALIST)
decreases according to the well-founded relation LESSP in each recursive call.
Hence, ASSIGNMENT is accepted under the principle of definition.
[ 0.0 0.0 0.0 ]
ASSIGNMENT
(DEFN VALUE
(X ALIST)
(IF (IF-EXPRP X)
(IF (VALUE (TEST X) ALIST)
(VALUE (LEFT-BRANCH X) ALIST)
(VALUE (RIGHT-BRANCH X) ALIST))
(ASSIGNMENT X ALIST)))
Linear arithmetic and the lemmas TEST-LESSP, LEFT-BRANCH-LESSP, and
RIGHT-BRANCH-LESSP can be used to establish that the measure (COUNT X)
decreases according to the well-founded relation LESSP in each recursive call.
Hence, VALUE is accepted under the principle of definition.
[ 0.0 0.0 0.0 ]
VALUE
(DEFN IF-DEPTH
(X)
(IF (IF-EXPRP X)
(ADD1 (IF-DEPTH (TEST X)))
0))
Linear arithmetic and the lemma TEST-LESSP inform us that the measure
(COUNT X) decreases according to the well-founded relation LESSP in each
recursive call. Hence, IF-DEPTH is accepted under the principle of definition.
From the definition we can conclude that (NUMBERP (IF-DEPTH X)) is a theorem.
[ 0.0 0.0 0.0 ]
IF-DEPTH
(DEFN IF-COMPLEXITY
(X)
(IF (IF-EXPRP X)
(TIMES (IF-COMPLEXITY (TEST X))
(PLUS (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (RIGHT-BRANCH X))))
1))
Linear arithmetic and the lemmas RIGHT-BRANCH-LESSP, LEFT-BRANCH-LESSP,
and TEST-LESSP can be used to show that the measure (COUNT X) decreases
according to the well-founded relation LESSP in each recursive call. Hence,
IF-COMPLEXITY is accepted under the definitional principle. Observe that:
(NUMBERP (IF-COMPLEXITY X))
is a theorem.
[ 0.0 0.0 0.0 ]
IF-COMPLEXITY
(PROVE-LEMMA IF-COMPLEXITY-NOT-0
(REWRITE)
(NOT (EQUAL (IF-COMPLEXITY X) 0)))
Give the conjecture the name *1.
We will appeal to induction. There is only one plausible induction. We
will induct according to the following scheme:
(AND (IMPLIES (AND (IF-EXPRP X)
(p (RIGHT-BRANCH X))
(p (LEFT-BRANCH X))
(p (TEST X)))
(p X))
(IMPLIES (NOT (IF-EXPRP X)) (p X))).
Linear arithmetic and the lemmas RIGHT-BRANCH-LESSP, LEFT-BRANCH-LESSP, and
TEST-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 two new conjectures:
Case 2. (IMPLIES (AND (IF-EXPRP X)
(NOT (EQUAL (IF-COMPLEXITY (RIGHT-BRANCH X))
0))
(NOT (EQUAL (IF-COMPLEXITY (LEFT-BRANCH X))
0))
(NOT (EQUAL (IF-COMPLEXITY (TEST X)) 0)))
(NOT (EQUAL (IF-COMPLEXITY X) 0))).
This simplifies, applying COMMUTATIVITY-OF-TIMES,
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, EQUAL-TIMES-0, and PLUS-EQUAL-0, and
opening up the function IF-COMPLEXITY, to:
T.
Case 1. (IMPLIES (NOT (IF-EXPRP X))
(NOT (EQUAL (IF-COMPLEXITY X) 0))),
which simplifies, unfolding the functions IF-COMPLEXITY and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
IF-COMPLEXITY-NOT-0
(PROVE-LEMMA IF-COMPLEXITY-GOES-DOWN1
(REWRITE)
(IMPLIES (IF-EXPRP X)
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY X))))
WARNING: Note that the proposed lemma IF-COMPLEXITY-GOES-DOWN1 is to be
stored as zero type prescription rules, zero compound recognizer rules, one
linear rule, and zero replacement rules.
.
Appealing to the lemma TEST-LEFT-BRANCH-RIGHT-BRANCH-ELIM, we now replace X by
(CONS-IF W Z V) to eliminate (LEFT-BRANCH X), (RIGHT-BRANCH X), and (TEST X).
This generates the formula:
(LESSP (IF-COMPLEXITY Z)
(IF-COMPLEXITY (CONS-IF W Z V))).
But this simplifies, applying DISTRIBUTIVITY-OF-TIMES-OVER-PLUS,
COMMUTATIVITY-OF-TIMES, COMMUTATIVITY-OF-PLUS, RIGHT-BRANCH-CONS-IF,
LEFT-BRANCH-CONS-IF, and TEST-CONS-IF, and unfolding the function
IF-COMPLEXITY, to:
(LESSP (IF-COMPLEXITY Z)
(PLUS (TIMES (IF-COMPLEXITY V)
(IF-COMPLEXITY W))
(TIMES (IF-COMPLEXITY W)
(IF-COMPLEXITY Z)))),
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 (IF-EXPRP X)
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY X))).
We named this *1. We will try to prove it by induction. There is only one
suggested induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (IF-EXPRP X)
(p (RIGHT-BRANCH X))
(p (LEFT-BRANCH X))
(p (TEST X)))
(p X))
(IMPLIES (NOT (IF-EXPRP X)) (p X))).
Linear arithmetic and the lemmas RIGHT-BRANCH-LESSP, LEFT-BRANCH-LESSP, and
TEST-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 produces the following eight new formulas:
Case 8. (IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY X))).
This simplifies, appealing to the lemmas COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and opening up the function IF-COMPLEXITY,
to:
(IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))),
which again simplifies, using linear arithmetic and applying the lemmas
LESSP-TIMES-2 and IF-COMPLEXITY-NOT-0, to:
(IMPLIES (AND (EQUAL (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(NOT (IF-EXPRP (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(PLUS (IF-COMPLEXITY (LEFT-BRANCH X))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))).
This further simplifies, unfolding the functions IF-COMPLEXITY, TIMES, EQUAL,
PLUS, and LESSP, to:
T.
Case 7. (IMPLIES (AND (LESSP (IF-COMPLEXITY (LEFT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY X))),
which simplifies, appealing to the lemmas COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and unfolding the function IF-COMPLEXITY,
to:
(IMPLIES (AND (LESSP (IF-COMPLEXITY (LEFT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))).
But this again simplifies, using linear arithmetic and applying the lemmas
LESSP-TIMES-2 and IF-COMPLEXITY-NOT-0, to:
T.
Case 6. (IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY X))),
which simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and opening up the function IF-COMPLEXITY,
to:
(IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))).
This again simplifies, using linear arithmetic and rewriting with the lemmas
LESSP-TIMES-2 and IF-COMPLEXITY-NOT-0, to:
(IMPLIES (AND (EQUAL (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(NOT (IF-EXPRP (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(PLUS (IF-COMPLEXITY (LEFT-BRANCH X))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))).
This further simplifies, rewriting with the lemmas COMMUTATIVITY-OF-TIMES,
COMMUTATIVITY-OF-PLUS, and LESSP-PLUS-CANCELLATION3, and unfolding the
functions IF-COMPLEXITY, TIMES, EQUAL, and NUMBERP, to:
T.
Case 5. (IMPLIES (AND (LESSP (IF-COMPLEXITY (LEFT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY X))),
which simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and expanding the definition of
IF-COMPLEXITY, to:
(IMPLIES (AND (LESSP (IF-COMPLEXITY (LEFT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))).
But this again simplifies, using linear arithmetic and appealing to the
lemmas LESSP-TIMES-2 and IF-COMPLEXITY-NOT-0, to:
T.
Case 4. (IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY X))),
which simplifies, applying COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and unfolding the definition of
IF-COMPLEXITY, to the new goal:
(IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))),
which again simplifies, using linear arithmetic and rewriting with
LESSP-TIMES-1, IF-COMPLEXITY-NOT-0, and LESSP-TIMES-2, to:
T.
Case 3. (IMPLIES (AND (LESSP (IF-COMPLEXITY (LEFT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY X))).
This simplifies, rewriting with COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and opening up the definition of
IF-COMPLEXITY, to:
(IMPLIES (AND (LESSP (IF-COMPLEXITY (LEFT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))).
This again simplifies, using linear arithmetic and applying LESSP-TIMES-2,
to:
T.
Case 2. (IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY X))).
This simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and expanding IF-COMPLEXITY, to the new
formula:
(IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))),
which again simplifies, using linear arithmetic and appealing to the lemmas
LESSP-TIMES-1, IF-COMPLEXITY-NOT-0, and LESSP-TIMES-2, to:
T.
Case 1. (IMPLIES (AND (LESSP (IF-COMPLEXITY (LEFT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY X))),
which simplifies, applying COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and opening up the definition of
IF-COMPLEXITY, to the new conjecture:
(IMPLIES (AND (LESSP (IF-COMPLEXITY (LEFT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (LEFT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))),
which again simplifies, using linear arithmetic and appealing to the lemma
LESSP-TIMES-2, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
IF-COMPLEXITY-GOES-DOWN1
(PROVE-LEMMA IF-COMPLEXITY-GOES-DOWN2
(REWRITE)
(IMPLIES (IF-EXPRP X)
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY X))))
WARNING: Note that the proposed lemma IF-COMPLEXITY-GOES-DOWN2 is to be
stored as zero type prescription rules, zero compound recognizer rules, one
linear rule, and zero replacement rules.
.
Appealing to the lemma TEST-LEFT-BRANCH-RIGHT-BRANCH-ELIM, we now replace X by
(CONS-IF W V Z) to eliminate (RIGHT-BRANCH X), (LEFT-BRANCH X), and (TEST X).
This generates the formula:
(LESSP (IF-COMPLEXITY Z)
(IF-COMPLEXITY (CONS-IF W V Z))).
But this simplifies, applying DISTRIBUTIVITY-OF-TIMES-OVER-PLUS,
COMMUTATIVITY-OF-TIMES, RIGHT-BRANCH-CONS-IF, LEFT-BRANCH-CONS-IF, and
TEST-CONS-IF, and unfolding the function IF-COMPLEXITY, to:
(LESSP (IF-COMPLEXITY Z)
(PLUS (TIMES (IF-COMPLEXITY V)
(IF-COMPLEXITY W))
(TIMES (IF-COMPLEXITY W)
(IF-COMPLEXITY Z)))),
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 (IF-EXPRP X)
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY X))).
We named this *1. We will try to prove it by induction. There is only one
suggested induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (IF-EXPRP X)
(p (RIGHT-BRANCH X))
(p (LEFT-BRANCH X))
(p (TEST X)))
(p X))
(IMPLIES (NOT (IF-EXPRP X)) (p X))).
Linear arithmetic and the lemmas RIGHT-BRANCH-LESSP, LEFT-BRANCH-LESSP, and
TEST-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 produces the following eight new formulas:
Case 8. (IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY X))).
This simplifies, appealing to the lemmas COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and opening up the function IF-COMPLEXITY,
to:
(IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))),
which further simplifies, opening up the definitions of IF-COMPLEXITY, TIMES,
PLUS, and LESSP, to:
T.
Case 7. (IMPLIES (AND (LESSP (IF-COMPLEXITY (RIGHT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY X))),
which simplifies, applying COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and unfolding IF-COMPLEXITY, to the new
conjecture:
(IMPLIES (AND (LESSP (IF-COMPLEXITY (RIGHT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))),
which further simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and opening
up IF-COMPLEXITY and TIMES, to:
(IMPLIES (AND (LESSP (IF-COMPLEXITY (RIGHT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(PLUS 1
(TIMES 1
(IF-COMPLEXITY (RIGHT-BRANCH X)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 6. (IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY X))),
which simplifies, appealing to the lemmas COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and opening up the definition of
IF-COMPLEXITY, to the conjecture:
(IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))).
This again simplifies, using linear arithmetic and rewriting with the lemmas
LESSP-TIMES-2 and IF-COMPLEXITY-NOT-0, to:
T.
Case 5. (IMPLIES (AND (LESSP (IF-COMPLEXITY (RIGHT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY X))),
which simplifies, applying COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and opening up the function IF-COMPLEXITY,
to:
(IMPLIES (AND (LESSP (IF-COMPLEXITY (RIGHT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(NOT (IF-EXPRP (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))),
which again simplifies, using linear arithmetic and rewriting with
LESSP-TIMES-2 and IF-COMPLEXITY-NOT-0, to:
T.
Case 4. (IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY X))).
This simplifies, applying COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and expanding the definition of
IF-COMPLEXITY, to:
(IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))).
But this again simplifies, using linear arithmetic and appealing to the
lemmas LESSP-TIMES-2, LESSP-TIMES-1, and IF-COMPLEXITY-NOT-0, to:
T.
Case 3. (IMPLIES (AND (LESSP (IF-COMPLEXITY (RIGHT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY X))),
which simplifies, applying COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and unfolding the definition of
IF-COMPLEXITY, to the new goal:
(IMPLIES (AND (LESSP (IF-COMPLEXITY (RIGHT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(NOT (IF-EXPRP (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))),
which again simplifies, using linear arithmetic and rewriting with
LESSP-TIMES-2, LESSP-TIMES-1, and IF-COMPLEXITY-NOT-0, to:
T.
Case 2. (IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY X))).
This simplifies, rewriting with COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and opening up the definition of
IF-COMPLEXITY, to:
(IMPLIES (AND (NOT (IF-EXPRP (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))).
This again simplifies, using linear arithmetic and applying LESSP-TIMES-2
and LESSP-TIMES-1, to:
T.
Case 1. (IMPLIES (AND (LESSP (IF-COMPLEXITY (RIGHT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY X))).
This simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and expanding IF-COMPLEXITY, to the new
formula:
(IMPLIES (AND (LESSP (IF-COMPLEXITY (RIGHT-BRANCH (RIGHT-BRANCH X)))
(IF-COMPLEXITY (RIGHT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (LEFT-BRANCH X)))
(IF-COMPLEXITY (LEFT-BRANCH X)))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH (TEST X)))
(IF-COMPLEXITY (TEST X)))
(IF-EXPRP X))
(LESSP (IF-COMPLEXITY (RIGHT-BRANCH X))
(PLUS (TIMES (IF-COMPLEXITY (LEFT-BRANCH X))
(IF-COMPLEXITY (TEST X)))
(TIMES (IF-COMPLEXITY (RIGHT-BRANCH X))
(IF-COMPLEXITY (TEST X)))))),
which again simplifies, using linear arithmetic and appealing to the lemmas
LESSP-TIMES-2 and LESSP-TIMES-1, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
IF-COMPLEXITY-GOES-DOWN2
(DEFN NORMALIZE
(X)
(IF (IF-EXPRP X)
(IF (IF-EXPRP (TEST X))
(NORMALIZE (CONS-IF (TEST (TEST X))
(CONS-IF (LEFT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X))
(CONS-IF (RIGHT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X))))
(CONS-IF (TEST X)
(NORMALIZE (LEFT-BRANCH X))
(NORMALIZE (RIGHT-BRANCH X))))
X)
((ORD-LESSP (CONS (ADD1 (IF-COMPLEXITY X))
(IF-DEPTH X)))))
Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1,
IF-COMPLEXITY-NOT-0, EQUAL-TIMES-0, LESSP-TIMES-CANCELLATION,
LESSP-PLUS-CANCELATION, ASSOCIATIVITY-OF-PLUS, COMMUTATIVITY2-OF-PLUS,
COMMUTATIVITY2-OF-TIMES, COMMUTATIVITY-OF-TIMES, TEST-CONS-IF,
LEFT-BRANCH-CONS-IF, RIGHT-BRANCH-CONS-IF, DISTRIBUTIVITY-OF-TIMES-OVER-PLUS,
ADD1-EQUAL, IF-COMPLEXITY-GOES-DOWN2, and IF-COMPLEXITY-GOES-DOWN1, and the
definitions of ORDINALP, LESSP, ORD-LESSP, IF-DEPTH, IF-COMPLEXITY, LISTP, and
ADD1 establish that the measure (CONS (ADD1 (IF-COMPLEXITY X)) (IF-DEPTH X))
decreases according to the well-founded relation ORD-LESSP in each recursive
call. Hence, NORMALIZE is accepted under the principle of definition. From
the definition we can conclude that:
(OR (IF-EXPRP (NORMALIZE X))
(EQUAL (NORMALIZE X) X))
is a theorem.
[ 0.0 0.2 0.0 ]
NORMALIZE
(DEFN NORMALIZED-IF-EXPRP
(X)
(IF (IF-EXPRP X)
(AND (NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
T))
Linear arithmetic and the lemmas RIGHT-BRANCH-LESSP and LEFT-BRANCH-LESSP
inform us that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, NORMALIZED-IF-EXPRP is accepted
under the principle of definition. Note that:
(OR (FALSEP (NORMALIZED-IF-EXPRP X))
(TRUEP (NORMALIZED-IF-EXPRP X)))
is a theorem.
[ 0.0 0.0 0.0 ]
NORMALIZED-IF-EXPRP
(DEFN ASSIGNEDP
(VAR ALIST)
(IF (EQUAL VAR T)
T
(IF (EQUAL VAR F)
T
(IF (NLISTP ALIST)
F
(IF (EQUAL VAR (CAAR ALIST))
T
(ASSIGNEDP VAR (CDR ALIST)))))))
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the
definition of NLISTP establish that the measure (COUNT ALIST) decreases
according to the well-founded relation LESSP in each recursive call. Hence,
ASSIGNEDP is accepted under the definitional principle. Observe that:
(OR (FALSEP (ASSIGNEDP VAR ALIST))
(TRUEP (ASSIGNEDP VAR ALIST)))
is a theorem.
[ 0.0 0.0 0.0 ]
ASSIGNEDP
(DEFN ASSUME-TRUE
(VAR ALIST)
(CONS (CONS VAR T) ALIST))
From the definition we can conclude that (LISTP (ASSUME-TRUE VAR ALIST))
is a theorem.
[ 0.0 0.0 0.0 ]
ASSUME-TRUE
(DEFN ASSUME-FALSE
(VAR ALIST)
(CONS (CONS VAR F) ALIST))
From the definition we can conclude that (LISTP (ASSUME-FALSE VAR ALIST))
is a theorem.
[ 0.0 0.0 0.0 ]
ASSUME-FALSE
(DEFN TAUTOLOGYP
(X ALIST)
(IF (IF-EXPRP X)
(IF (ASSIGNEDP (TEST X) ALIST)
(IF (ASSIGNMENT (TEST X) ALIST)
(TAUTOLOGYP (LEFT-BRANCH X) ALIST)
(TAUTOLOGYP (RIGHT-BRANCH X) ALIST))
(AND (TAUTOLOGYP (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) ALIST))
(TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) ALIST))))
(ASSIGNMENT X ALIST)))
Linear arithmetic and the lemmas LEFT-BRANCH-LESSP and RIGHT-BRANCH-LESSP
inform us that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, TAUTOLOGYP is accepted under
the definitional principle.
[ 0.0 0.0 0.0 ]
TAUTOLOGYP
(PROVE-LEMMA ASSIGNMENT-APPEND
(REWRITE)
(EQUAL (ASSIGNMENT X (APPEND A B))
(IF (ASSIGNEDP X A)
(ASSIGNMENT X A)
(ASSIGNMENT X B))))
This conjecture simplifies, obviously, to the following two new conjectures:
Case 2. (IMPLIES (NOT (ASSIGNEDP X A))
(EQUAL (ASSIGNMENT X (APPEND A B))
(ASSIGNMENT X B))).
Give the above formula the name *1.
Case 1. (IMPLIES (ASSIGNEDP X A)
(EQUAL (ASSIGNMENT X (APPEND A B))
(ASSIGNMENT X A))),
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 (ASSIGNMENT X (APPEND A B))
(IF (ASSIGNEDP X A)
(ASSIGNMENT X A)
(ASSIGNMENT X B))),
which we named *1 above. We will appeal to induction. The recursive terms in
the conjecture suggest four inductions. They merge into two likely candidate
inductions. However, only one is unflawed. We will induct according to the
following scheme:
(AND (IMPLIES (AND (LISTP A) (p X (CDR A) B))
(p X A B))
(IMPLIES (NOT (LISTP A)) (p X A B))).
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 leads to the following two new
conjectures:
Case 2. (IMPLIES (AND (LISTP A)
(EQUAL (ASSIGNMENT X (APPEND (CDR A) B))
(IF (ASSIGNEDP X (CDR A))
(ASSIGNMENT X (CDR A))
(ASSIGNMENT X B))))
(EQUAL (ASSIGNMENT X (APPEND A B))
(IF (ASSIGNEDP X A)
(ASSIGNMENT X A)
(ASSIGNMENT X B)))).
This simplifies, applying CDR-CONS and CAR-CONS, and expanding the functions
APPEND, ASSIGNMENT, and ASSIGNEDP, to:
T.
Case 1. (IMPLIES (NOT (LISTP A))
(EQUAL (ASSIGNMENT X (APPEND A B))
(IF (ASSIGNEDP X A)
(ASSIGNMENT X A)
(ASSIGNMENT X B)))),
which simplifies, unfolding the definitions of APPEND, ASSIGNEDP, and
ASSIGNMENT, to two new conjectures:
Case 1.2.
(IMPLIES (AND (NOT (LISTP A)) (NOT X))
(EQUAL (ASSIGNMENT X B) (EQUAL X T))),
which again simplifies, opening up EQUAL and ASSIGNMENT, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LISTP A)) (EQUAL X T))
(EQUAL (ASSIGNMENT X B) (EQUAL X T))),
which again simplifies, expanding the functions EQUAL and ASSIGNMENT, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
ASSIGNMENT-APPEND
(PROVE-LEMMA VALUE-CAN-IGNORE-REDUNDANT-ASSIGNMENTS
(REWRITE)
(AND (IMPLIES (AND (IFF VAL (ASSIGNMENT VAR A))
(VALUE X A))
(VALUE X (CONS (CONS VAR VAL) A)))
(IMPLIES (AND (IFF VAL (ASSIGNMENT VAR A))
(NOT (VALUE X A)))
(NOT (VALUE X (CONS (CONS VAR VAL) A))))))
WARNING: Note that the proposed lemma VALUE-CAN-IGNORE-REDUNDANT-ASSIGNMENTS
is to be stored as zero type prescription rules, zero compound recognizer
rules, zero linear rules, and two replacement rules.
This formula can be simplified, using the abbreviations NOT, IMPLIES, and AND,
to the following two new conjectures:
Case 2. (IMPLIES (AND (IFF VAL (ASSIGNMENT VAR A))
(VALUE X A))
(VALUE X (CONS (CONS VAR VAL) A))).
This simplifies, opening up IFF, to the following two new formulas:
Case 2.2.
(IMPLIES (AND (NOT VAL)
(NOT (ASSIGNMENT VAR A))
(VALUE X A))
(VALUE X (CONS (CONS VAR F) A))).
This again simplifies, trivially, to:
(IMPLIES (AND (NOT (ASSIGNMENT VAR A))
(VALUE X A))
(VALUE X (CONS (CONS VAR F) A))),
which we will name *1.
Case 2.1.
(IMPLIES (AND VAL
(ASSIGNMENT VAR A)
(VALUE X A))
(VALUE X (CONS (CONS VAR VAL) A))),
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:
(AND (IMPLIES (AND (IFF VAL (ASSIGNMENT VAR A))
(VALUE X A))
(VALUE X (CONS (CONS VAR VAL) A)))
(IMPLIES (AND (IFF VAL (ASSIGNMENT VAR A))
(NOT (VALUE X A)))
(NOT (VALUE X (CONS (CONS VAR VAL) A))))),
which we named *1 above. We will appeal to induction. There are six
plausible inductions. They merge into two likely candidate inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) A)
(p (TEST X) VAR VAL A)
(p (LEFT-BRANCH X) VAR VAL A))
(p X VAR VAL A))
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) A))
(p (TEST X) VAR VAL A)
(p (RIGHT-BRANCH X) VAR VAL A))
(p X VAR VAL A))
(IMPLIES (NOT (IF-EXPRP X))
(p X VAR VAL A))).
Linear arithmetic and the lemmas TEST-LESSP, LEFT-BRANCH-LESSP, and
RIGHT-BRANCH-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 the following ten new formulas:
Case 10.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X)
(CONS (CONS VAR VAL) A))
(VALUE (LEFT-BRANCH X)
(CONS (CONS VAR VAL) A))
(VALUE (TEST X) A)
(VALUE (LEFT-BRANCH X) A)
(IFF VAL (ASSIGNMENT VAR A))
(VALUE X A))
(VALUE X (CONS (CONS VAR VAL) A))).
This simplifies, unfolding the definitions of IFF and VALUE, to the new goal:
(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X)
(CONS (CONS VAR VAL) A))
(VALUE (LEFT-BRANCH X)
(CONS (CONS VAR VAL) A))
(VALUE (TEST X) A)
(VALUE (LEFT-BRANCH X) A)
(NOT VAL)
(NOT (ASSIGNMENT VAR A)))
(VALUE X (CONS (CONS VAR F) A))),
which again simplifies, expanding the function VALUE, to:
T.
Case 9. (IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X)
(CONS (CONS VAR VAL) A))
(NOT (VALUE (LEFT-BRANCH X) A))
(VALUE (TEST X) A)
(NOT (VALUE (LEFT-BRANCH X)
(CONS (CONS VAR VAL) A)))
(IFF VAL (ASSIGNMENT VAR A))
(VALUE X A))
(VALUE X (CONS (CONS VAR VAL) A))),
which simplifies, opening up the definitions of IFF and VALUE, to:
T.
Case 8. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) A))
(VALUE (RIGHT-BRANCH X)
(CONS (CONS VAR VAL) A))
(NOT (VALUE (TEST X)
(CONS (CONS VAR VAL) A)))
(VALUE (RIGHT-BRANCH X) A)
(IFF VAL (ASSIGNMENT VAR A))
(VALUE X A))
(VALUE X (CONS (CONS VAR VAL) A))),
which simplifies, opening up the functions IFF and VALUE, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) A))
(VALUE (RIGHT-BRANCH X)
(CONS (CONS VAR VAL) A))
(NOT (VALUE (TEST X)
(CONS (CONS VAR VAL) A)))
(VALUE (RIGHT-BRANCH X) A)
(NOT VAL)
(NOT (ASSIGNMENT VAR A)))
(VALUE X (CONS (CONS VAR F) A))).
But this again simplifies, expanding the function VALUE, to:
T.
Case 7. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) A))
(NOT (VALUE (RIGHT-BRANCH X) A))
(NOT (VALUE (TEST X)
(CONS (CONS VAR VAL) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(CONS (CONS VAR VAL) A)))
(IFF VAL (ASSIGNMENT VAR A))
(VALUE X A))
(VALUE X (CONS (CONS VAR VAL) A))),
which simplifies, opening up IFF and VALUE, to:
T.
Case 6. (IMPLIES (AND (NOT (IF-EXPRP X))
(IFF VAL (ASSIGNMENT VAR A))
(VALUE X A))
(VALUE X (CONS (CONS VAR VAL) A))),
which simplifies, appealing to the lemmas CAR-CONS and CDR-CONS, and
unfolding IFF, VALUE, and ASSIGNMENT, to three new formulas:
Case 6.3.
(IMPLIES (AND (NOT (IF-EXPRP X))
(NOT VAL)
(NOT (ASSIGNMENT VAR A))
(ASSIGNMENT X A)
(NOT (EQUAL X T)))
(NOT (EQUAL X VAR))),
which again simplifies, trivially, to:
T.
Case 6.2.
(IMPLIES (AND (NOT (IF-EXPRP X))
(NOT VAL)
(NOT (ASSIGNMENT VAR A))
(ASSIGNMENT X A)
(NOT (EQUAL X T)))
X).
However this again simplifies, unfolding the definitions of IF-EXPRP,
EQUAL, and ASSIGNMENT, to:
T.
Case 6.1.
(IMPLIES (AND (NOT (IF-EXPRP X))
VAL
(ASSIGNMENT VAR A)
(ASSIGNMENT X A)
(NOT (EQUAL X T)))
X),
which again simplifies, opening up IF-EXPRP, EQUAL, and ASSIGNMENT, to:
T.
Case 5. (IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X)
(CONS (CONS VAR VAL) A))
(VALUE (LEFT-BRANCH X)
(CONS (CONS VAR VAL) A))
(VALUE (TEST X) A)
(VALUE (LEFT-BRANCH X) A)
(IFF VAL (ASSIGNMENT VAR A))
(NOT (VALUE X A)))
(NOT (VALUE X (CONS (CONS VAR VAL) A)))),
which simplifies, unfolding the functions IFF and VALUE, to:
T.
Case 4. (IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X)
(CONS (CONS VAR VAL) A))
(NOT (VALUE (LEFT-BRANCH X) A))
(VALUE (TEST X) A)
(NOT (VALUE (LEFT-BRANCH X)
(CONS (CONS VAR VAL) A)))
(IFF VAL (ASSIGNMENT VAR A))
(NOT (VALUE X A)))
(NOT (VALUE X (CONS (CONS VAR VAL) A)))),
which simplifies, opening up IFF and VALUE, to:
(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X)
(CONS (CONS VAR VAL) A))
(NOT (VALUE (LEFT-BRANCH X) A))
(VALUE (TEST X) A)
(NOT (VALUE (LEFT-BRANCH X)
(CONS (CONS VAR VAL) A)))
(NOT VAL)
(NOT (ASSIGNMENT VAR A)))
(NOT (VALUE X (CONS (CONS VAR F) A)))).
But this again simplifies, unfolding VALUE, to:
T.
Case 3. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) A))
(VALUE (RIGHT-BRANCH X)
(CONS (CONS VAR VAL) A))
(NOT (VALUE (TEST X)
(CONS (CONS VAR VAL) A)))
(VALUE (RIGHT-BRANCH X) A)
(IFF VAL (ASSIGNMENT VAR A))
(NOT (VALUE X A)))
(NOT (VALUE X (CONS (CONS VAR VAL) A)))),
which simplifies, unfolding the definitions of IFF and VALUE, to:
T.
Case 2. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) A))
(NOT (VALUE (RIGHT-BRANCH X) A))
(NOT (VALUE (TEST X)
(CONS (CONS VAR VAL) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(CONS (CONS VAR VAL) A)))
(IFF VAL (ASSIGNMENT VAR A))
(NOT (VALUE X A)))
(NOT (VALUE X (CONS (CONS VAR VAL) A)))),
which simplifies, opening up IFF and VALUE, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) A))
(NOT (VALUE (RIGHT-BRANCH X) A))
(NOT (VALUE (TEST X)
(CONS (CONS VAR VAL) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(CONS (CONS VAR VAL) A)))
(NOT VAL)
(NOT (ASSIGNMENT VAR A)))
(NOT (VALUE X (CONS (CONS VAR F) A)))).
However this again simplifies, expanding the definition of VALUE, to:
T.
Case 1. (IMPLIES (AND (NOT (IF-EXPRP X))
(IFF VAL (ASSIGNMENT VAR A))
(NOT (VALUE X A)))
(NOT (VALUE X (CONS (CONS VAR VAL) A)))),
which simplifies, applying CAR-CONS and CDR-CONS, and expanding the
functions IFF, VALUE, and ASSIGNMENT, to the following three new conjectures:
Case 1.3.
(IMPLIES (AND (NOT (IF-EXPRP X))
(NOT VAL)
(NOT (ASSIGNMENT VAR A))
(NOT (ASSIGNMENT X A)))
(NOT (EQUAL X T))).
But this again simplifies, opening up IF-EXPRP, EQUAL, and ASSIGNMENT, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (IF-EXPRP X))
VAL
(ASSIGNMENT VAR A)
(NOT (ASSIGNMENT X A)))
(NOT (EQUAL X T))),
which again simplifies, opening up IF-EXPRP, EQUAL, and ASSIGNMENT, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (IF-EXPRP X))
VAL
(ASSIGNMENT VAR A)
(NOT (ASSIGNMENT X A))
X)
(NOT (EQUAL X VAR))),
which again simplifies, trivially, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
VALUE-CAN-IGNORE-REDUNDANT-ASSIGNMENTS
(PROVE-LEMMA VALUE-SHORT-CUT
(REWRITE)
(IMPLIES (AND (IF-EXPRP X)
(NORMALIZED-IF-EXPRP X))
(EQUAL (VALUE (TEST X) A)
(ASSIGNMENT (TEST X) A))))
.
Applying the lemma TEST-LEFT-BRANCH-RIGHT-BRANCH-ELIM, replace X by
(CONS-IF Z W V) to eliminate (TEST X), (RIGHT-BRANCH X), and (LEFT-BRANCH X).
This produces:
(IMPLIES (NORMALIZED-IF-EXPRP (CONS-IF Z W V))
(EQUAL (VALUE Z A) (ASSIGNMENT Z A))),
which simplifies, applying RIGHT-BRANCH-CONS-IF, LEFT-BRANCH-CONS-IF, and
TEST-CONS-IF, and unfolding the functions NORMALIZED-IF-EXPRP and VALUE, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
VALUE-SHORT-CUT
(PROVE-LEMMA ASSIGNMENT-IMPLIES-ASSIGNED
(REWRITE)
(IMPLIES (ASSIGNMENT X A)
(ASSIGNEDP X A)))
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 (EQUAL X T) (p X A))
(IMPLIES (AND (NOT (EQUAL X T)) (EQUAL X F))
(p X A))
(IMPLIES (AND (NOT (EQUAL X T))
(NOT (EQUAL X F))
(NLISTP A))
(p X A))
(IMPLIES (AND (NOT (EQUAL X T))
(NOT (EQUAL X F))
(NOT (NLISTP A))
(EQUAL X (CAAR A)))
(p X A))
(IMPLIES (AND (NOT (EQUAL X T))
(NOT (EQUAL X F))
(NOT (NLISTP A))
(NOT (EQUAL X (CAAR A)))
(p X (CDR A)))
(p X A))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP 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 the following six new conjectures:
Case 6. (IMPLIES (AND (EQUAL X T) (ASSIGNMENT X A))
(ASSIGNEDP X A)).
This simplifies, expanding the functions EQUAL, ASSIGNMENT, and ASSIGNEDP,
to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL X T))
(EQUAL X F)
(ASSIGNMENT X A))
(ASSIGNEDP X A)).
This simplifies, opening up EQUAL and ASSIGNMENT, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL X T))
(NOT (EQUAL X F))
(NLISTP A)
(ASSIGNMENT X A))
(ASSIGNEDP X A)).
This simplifies, unfolding the definitions of NLISTP and ASSIGNMENT, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL X T))
(NOT (EQUAL X F))
(NOT (NLISTP A))
(EQUAL X (CAAR A))
(ASSIGNMENT X A))
(ASSIGNEDP X A)).
This simplifies, unfolding the definitions of NLISTP, ASSIGNMENT, and
ASSIGNEDP, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL X T))
(NOT (EQUAL X F))
(NOT (NLISTP A))
(NOT (EQUAL X (CAAR A)))
(NOT (ASSIGNMENT X (CDR A)))
(ASSIGNMENT X A))
(ASSIGNEDP X A)).
This simplifies, opening up the functions NLISTP and ASSIGNMENT, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL X T))
(NOT (EQUAL X F))
(NOT (NLISTP A))
(NOT (EQUAL X (CAAR A)))
(ASSIGNEDP X (CDR A))
(ASSIGNMENT X A))
(ASSIGNEDP X A)).
This simplifies, opening up NLISTP, ASSIGNMENT, and ASSIGNEDP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
ASSIGNMENT-IMPLIES-ASSIGNED
(PROVE-LEMMA TAUTOLOGYP-IS-SOUND
(REWRITE)
(IMPLIES (AND (NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))))
Give the conjecture the name *1.
We will appeal to induction. There are four plausible inductions. They
merge into two likely candidate inductions. However, only one is unflawed.
We will induct according to the following scheme:
(AND (IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (APPEND A1 A2))
(p (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A1)
A2)
(p (LEFT-BRANCH X) A1 A2)
(p (TEST X) A1 A2))
(p X A1 A2))
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(p (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)
A2)
(p (RIGHT-BRANCH X) A1 A2)
(p (TEST X) A1 A2))
(p X A1 A2))
(IMPLIES (NOT (IF-EXPRP X))
(p X A1 A2))).
Linear arithmetic and the lemmas TEST-LESSP, LEFT-BRANCH-LESSP, and
RIGHT-BRANCH-LESSP establish that the measure (COUNT X) decreases according to
the well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instances chosen for A1. The above induction scheme
produces the following 16 new formulas:
Case 16.(IMPLIES (AND (IF-EXPRP X)
(NOT (TAUTOLOGYP (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A1)))
(NOT (TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (TEST X) (APPEND A1 A2))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))).
This simplifies, opening up NORMALIZED-IF-EXPRP, TAUTOLOGYP, and VALUE, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (TAUTOLOGYP (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A1)))
(NOT (TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (TEST X) (APPEND A1 A2))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(ASSIGNEDP (TEST X) A1)
(NOT (ASSIGNMENT (TEST X) A1))
(TAUTOLOGYP (RIGHT-BRANCH X) A1))
(VALUE (LEFT-BRANCH X)
(APPEND A1 A2))),
which further simplifies, applying ASSIGNMENT-APPEND and VALUE-SHORT-CUT,
and unfolding the definitions of ASSUME-TRUE and NORMALIZED-IF-EXPRP, to:
T.
Case 15.(IMPLIES (AND (IF-EXPRP X)
(VALUE (LEFT-BRANCH X)
(APPEND (ASSUME-TRUE (TEST X) A1) A2))
(NOT (TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (TEST X) (APPEND A1 A2))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))).
This simplifies, opening up NORMALIZED-IF-EXPRP, TAUTOLOGYP, and VALUE, to
the following two new conjectures:
Case 15.2.
(IMPLIES (AND (IF-EXPRP X)
(VALUE (LEFT-BRANCH X)
(APPEND (ASSUME-TRUE (TEST X) A1) A2))
(NOT (TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (TEST X) (APPEND A1 A2))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(NOT (ASSIGNEDP (TEST X) A1))
(TAUTOLOGYP (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A1))
(TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)))
(VALUE (LEFT-BRANCH X)
(APPEND A1 A2))).
But this further simplifies, applying CDR-CONS, CAR-CONS,
ASSIGNMENT-APPEND, and VALUE-SHORT-CUT, and opening up ASSUME-TRUE, APPEND,
NORMALIZED-IF-EXPRP, and ASSUME-FALSE, to the new goal:
(IMPLIES (AND (IF-EXPRP X)
(VALUE (LEFT-BRANCH X)
(CONS (CONS (TEST X) T)
(APPEND A1 A2)))
(NOT (TAUTOLOGYP (LEFT-BRANCH X) A1))
(ASSIGNMENT (TEST X) A2)
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(NOT (ASSIGNEDP (TEST X) A1))
(TAUTOLOGYP (LEFT-BRANCH X)
(CONS (CONS (TEST X) T) A1))
(TAUTOLOGYP (RIGHT-BRANCH X)
(CONS (CONS (TEST X) F) A1)))
(VALUE (LEFT-BRANCH X)
(APPEND A1 A2))),
which again simplifies, appealing to the lemmas ASSIGNMENT-APPEND and
VALUE-CAN-IGNORE-REDUNDANT-ASSIGNMENTS, and opening up the function IFF,
to:
T.
Case 15.1.
(IMPLIES (AND (IF-EXPRP X)
(VALUE (LEFT-BRANCH X)
(APPEND (ASSUME-TRUE (TEST X) A1) A2))
(NOT (TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (TEST X) (APPEND A1 A2))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(ASSIGNEDP (TEST X) A1)
(NOT (ASSIGNMENT (TEST X) A1))
(TAUTOLOGYP (RIGHT-BRANCH X) A1))
(VALUE (LEFT-BRANCH X)
(APPEND A1 A2))),
which further simplifies, appealing to the lemmas CDR-CONS, CAR-CONS,
ASSIGNMENT-APPEND, and VALUE-SHORT-CUT, and expanding ASSUME-TRUE, APPEND,
and NORMALIZED-IF-EXPRP, to:
T.
Case 14.(IMPLIES (AND (IF-EXPRP X)
(NOT (TAUTOLOGYP (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A1)))
(VALUE (LEFT-BRANCH X) (APPEND A1 A2))
(VALUE (TEST X) (APPEND A1 A2))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))),
which simplifies, opening up the definitions of NORMALIZED-IF-EXPRP,
TAUTOLOGYP, and VALUE, to:
T.
Case 13.(IMPLIES (AND (IF-EXPRP X)
(VALUE (LEFT-BRANCH X)
(APPEND (ASSUME-TRUE (TEST X) A1) A2))
(VALUE (LEFT-BRANCH X) (APPEND A1 A2))
(VALUE (TEST X) (APPEND A1 A2))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))),
which simplifies, opening up the definitions of NORMALIZED-IF-EXPRP,
TAUTOLOGYP, and VALUE, to:
T.
Case 12.(IMPLIES (AND (IF-EXPRP X)
(NOT (NORMALIZED-IF-EXPRP (LEFT-BRANCH X)))
(VALUE (TEST X) (APPEND A1 A2))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))),
which simplifies, expanding NORMALIZED-IF-EXPRP, to:
T.
Case 11.(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))),
which simplifies, expanding NORMALIZED-IF-EXPRP, TAUTOLOGYP, and VALUE, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(ASSIGNEDP (TEST X) A1)
(ASSIGNMENT (TEST X) A1)
(TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))).
But this again simplifies, applying the lemma ASSIGNMENT-IMPLIES-ASSIGNED,
to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(ASSIGNMENT (TEST X) A1)
(TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))).
But this further simplifies, applying ASSIGNMENT-IMPLIES-ASSIGNED,
ASSIGNMENT-APPEND, and VALUE-SHORT-CUT, and opening up the function
NORMALIZED-IF-EXPRP, to:
T.
Case 10.(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(VALUE (RIGHT-BRANCH X)
(APPEND (ASSUME-FALSE (TEST X) A1)
A2))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))).
This simplifies, unfolding the definitions of NORMALIZED-IF-EXPRP,
TAUTOLOGYP, and VALUE, to the following two new conjectures:
Case 10.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(VALUE (RIGHT-BRANCH X)
(APPEND (ASSUME-FALSE (TEST X) A1)
A2))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(NOT (ASSIGNEDP (TEST X) A1))
(TAUTOLOGYP (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A1))
(TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))).
This further simplifies, rewriting with ASSIGNMENT-APPEND, VALUE-SHORT-CUT,
CDR-CONS, CAR-CONS, and VALUE-CAN-IGNORE-REDUNDANT-ASSIGNMENTS, and
unfolding NORMALIZED-IF-EXPRP, ASSUME-FALSE, APPEND, and IFF, to:
T.
Case 10.1.
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(VALUE (RIGHT-BRANCH X)
(APPEND (ASSUME-FALSE (TEST X) A1)
A2))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(ASSIGNEDP (TEST X) A1)
(ASSIGNMENT (TEST X) A1)
(TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))).
But this again simplifies, applying ASSIGNMENT-IMPLIES-ASSIGNED, to the
new goal:
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(VALUE (RIGHT-BRANCH X)
(APPEND (ASSUME-FALSE (TEST X) A1)
A2))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(ASSIGNMENT (TEST X) A1)
(TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))),
which further simplifies, applying the lemmas ASSIGNMENT-IMPLIES-ASSIGNED,
ASSIGNMENT-APPEND, and VALUE-SHORT-CUT, and unfolding the definition of
NORMALIZED-IF-EXPRP, to:
T.
Case 9. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(NOT (NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))),
which simplifies, opening up NORMALIZED-IF-EXPRP, to:
T.
Case 8. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))),
which simplifies, opening up the functions NORMALIZED-IF-EXPRP, TAUTOLOGYP,
and VALUE, to:
T.
Case 7. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(VALUE (RIGHT-BRANCH X)
(APPEND (ASSUME-FALSE (TEST X) A1)
A2))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))),
which simplifies, unfolding NORMALIZED-IF-EXPRP, TAUTOLOGYP, and VALUE, to:
T.
Case 6. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (TAUTOLOGYP (TEST X) A1))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))),
which simplifies, unfolding the functions NORMALIZED-IF-EXPRP, TAUTOLOGYP,
and VALUE, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (TAUTOLOGYP (TEST X) A1))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(ASSIGNEDP (TEST X) A1)
(ASSIGNMENT (TEST X) A1)
(TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))).
This again simplifies, rewriting with the lemma ASSIGNMENT-IMPLIES-ASSIGNED,
to the conjecture:
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (TAUTOLOGYP (TEST X) A1))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(ASSIGNMENT (TEST X) A1)
(TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))).
But this further simplifies, applying ASSIGNMENT-IMPLIES-ASSIGNED,
ASSIGNMENT-APPEND, and VALUE-SHORT-CUT, and unfolding NORMALIZED-IF-EXPRP,
to:
T.
Case 5. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(VALUE (RIGHT-BRANCH X)
(APPEND (ASSUME-FALSE (TEST X) A1)
A2))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (TAUTOLOGYP (TEST X) A1))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))).
This simplifies, unfolding the functions NORMALIZED-IF-EXPRP, TAUTOLOGYP,
and VALUE, to the following two new conjectures:
Case 5.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(VALUE (RIGHT-BRANCH X)
(APPEND (ASSUME-FALSE (TEST X) A1)
A2))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (TAUTOLOGYP (TEST X) A1))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(NOT (ASSIGNEDP (TEST X) A1))
(TAUTOLOGYP (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A1))
(TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))).
This further simplifies, rewriting with ASSIGNMENT-APPEND, VALUE-SHORT-CUT,
CDR-CONS, CAR-CONS, and VALUE-CAN-IGNORE-REDUNDANT-ASSIGNMENTS, and
opening up the functions NORMALIZED-IF-EXPRP, ASSUME-FALSE, APPEND, and
IFF, to:
T.
Case 5.1.
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(VALUE (RIGHT-BRANCH X)
(APPEND (ASSUME-FALSE (TEST X) A1)
A2))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (TAUTOLOGYP (TEST X) A1))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(ASSIGNEDP (TEST X) A1)
(ASSIGNMENT (TEST X) A1)
(TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))).
However this again simplifies, applying the lemma
ASSIGNMENT-IMPLIES-ASSIGNED, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(VALUE (RIGHT-BRANCH X)
(APPEND (ASSUME-FALSE (TEST X) A1)
A2))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X) A1))
(NOT (TAUTOLOGYP (TEST X) A1))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(ASSIGNMENT (TEST X) A1)
(TAUTOLOGYP (LEFT-BRANCH X) A1))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))).
But this further simplifies, rewriting with ASSIGNMENT-IMPLIES-ASSIGNED,
ASSIGNMENT-APPEND, and VALUE-SHORT-CUT, and unfolding NORMALIZED-IF-EXPRP,
to:
T.
Case 4. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(NOT (NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (TAUTOLOGYP (TEST X) A1))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))).
This simplifies, expanding the function NORMALIZED-IF-EXPRP, to:
T.
Case 3. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(NOT (TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A1)))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))
(NOT (TAUTOLOGYP (TEST X) A1))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))).
This simplifies, unfolding NORMALIZED-IF-EXPRP, TAUTOLOGYP, and VALUE, to:
T.
Case 2. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (APPEND A1 A2)))
(VALUE (RIGHT-BRANCH X)
(APPEND (ASSUME-FALSE (TEST X) A1)
A2))
(VALUE (RIGHT-BRANCH X)
(APPEND A1 A2))
(NOT (TAUTOLOGYP (TEST X) A1))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))).
This simplifies, expanding the functions NORMALIZED-IF-EXPRP, TAUTOLOGYP,
and VALUE, to:
T.
Case 1. (IMPLIES (AND (NOT (IF-EXPRP X))
(NORMALIZED-IF-EXPRP X)
(TAUTOLOGYP X A1))
(VALUE X (APPEND A1 A2))).
This simplifies, applying ASSIGNMENT-IMPLIES-ASSIGNED and ASSIGNMENT-APPEND,
and expanding the functions NORMALIZED-IF-EXPRP, TAUTOLOGYP, and VALUE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.3 0.0 ]
TAUTOLOGYP-IS-SOUND
(DEFN TAUTOLOGY-CHECKER
(X)
(TAUTOLOGYP (NORMALIZE X) NIL))
[ 0.0 0.0 0.0 ]
TAUTOLOGY-CHECKER
(DEFN FALSIFY1
(X ALIST)
(IF (IF-EXPRP X)
(IF (ASSIGNEDP (TEST X) ALIST)
(IF (ASSIGNMENT (TEST X) ALIST)
(FALSIFY1 (LEFT-BRANCH X) ALIST)
(FALSIFY1 (RIGHT-BRANCH X) ALIST))
(IF (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) ALIST))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) ALIST))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) ALIST))))
(IF (ASSIGNEDP X ALIST)
(IF (ASSIGNMENT X ALIST) F ALIST)
(CONS (CONS X F) ALIST))))
Linear arithmetic and the lemmas LEFT-BRANCH-LESSP and RIGHT-BRANCH-LESSP
can be used to establish that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each recursive call. Hence, FALSIFY1 is
accepted under the principle of definition. Observe that:
(OR (OR (FALSEP (FALSIFY1 X ALIST))
(LISTP (FALSIFY1 X ALIST)))
(EQUAL (FALSIFY1 X ALIST) ALIST))
is a theorem.
[ 0.0 0.0 0.0 ]
FALSIFY1
(DEFN FALSIFY
(X)
(FALSIFY1 (NORMALIZE X) NIL))
Observe that:
(OR (FALSEP (FALSIFY X))
(LITATOM (FALSIFY X))
(LISTP (FALSIFY X)))
is a theorem.
[ 0.0 0.0 0.0 ]
FALSIFY
(PROVE-LEMMA FALSIFY1-EXTENDS-MODELS
(REWRITE)
(IMPLIES (ASSIGNEDP X A)
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(IF (FALSIFY1 Y A)
(ASSIGNMENT X A)
(EQUAL X T)))))
This conjecture simplifies, trivially, to the following two new formulas:
Case 2. (IMPLIES (AND (ASSIGNEDP X A)
(NOT (FALSIFY1 Y A)))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(EQUAL X T))).
This again simplifies, expanding the functions LISTP and ASSIGNMENT, to:
T.
Case 1. (IMPLIES (AND (ASSIGNEDP X A) (FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))),
which we will name *1.
We will appeal to induction. There are four plausible inductions. They
merge into two likely candidate inductions. However, only one is unflawed.
We will induct according to the following scheme:
(AND (IMPLIES (AND (IF-EXPRP Y)
(ASSIGNEDP (TEST Y) A)
(ASSIGNMENT (TEST Y) A)
(p X (LEFT-BRANCH Y) A))
(p X Y A))
(IMPLIES (AND (IF-EXPRP Y)
(ASSIGNEDP (TEST Y) A)
(NOT (ASSIGNMENT (TEST Y) A))
(p X (RIGHT-BRANCH Y) A))
(p X Y A))
(IMPLIES (AND (IF-EXPRP Y)
(NOT (ASSIGNEDP (TEST Y) A))
(FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A))
(p X
(LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A)))
(p X Y A))
(IMPLIES (AND (IF-EXPRP Y)
(NOT (ASSIGNEDP (TEST Y) A))
(NOT (FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A)))
(p X
(LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A))
(p X
(RIGHT-BRANCH Y)
(ASSUME-FALSE (TEST Y) A)))
(p X Y A))
(IMPLIES (AND (NOT (IF-EXPRP Y))
(ASSIGNEDP Y A)
(ASSIGNMENT Y A))
(p X Y A))
(IMPLIES (AND (NOT (IF-EXPRP Y))
(ASSIGNEDP Y A)
(NOT (ASSIGNMENT Y A)))
(p X Y A))
(IMPLIES (AND (NOT (IF-EXPRP Y))
(NOT (ASSIGNEDP Y A)))
(p X Y A))).
Linear arithmetic and the lemmas LEFT-BRANCH-LESSP and RIGHT-BRANCH-LESSP
establish that the measure (COUNT Y) decreases according to the well-founded
relation LESSP in each induction step of the scheme. Note, however, the
inductive instances chosen for A. The above induction scheme leads to the
following 12 new goals:
Case 12.(IMPLIES (AND (IF-EXPRP Y)
(ASSIGNEDP (TEST Y) A)
(ASSIGNMENT (TEST Y) A)
(NOT (FALSIFY1 (LEFT-BRANCH Y) A))
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))).
This simplifies, rewriting with ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding
the definition of FALSIFY1, to:
T.
Case 11.(IMPLIES (AND (IF-EXPRP Y)
(ASSIGNEDP (TEST Y) A)
(ASSIGNMENT (TEST Y) A)
(EQUAL (ASSIGNMENT X
(FALSIFY1 (LEFT-BRANCH Y) A))
(ASSIGNMENT X A))
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))),
which simplifies, applying ASSIGNMENT-IMPLIES-ASSIGNED, and opening up
FALSIFY1, to:
T.
Case 10.(IMPLIES (AND (IF-EXPRP Y)
(ASSIGNEDP (TEST Y) A)
(NOT (ASSIGNMENT (TEST Y) A))
(NOT (FALSIFY1 (RIGHT-BRANCH Y) A))
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))).
This simplifies, expanding the function FALSIFY1, to:
T.
Case 9. (IMPLIES (AND (IF-EXPRP Y)
(ASSIGNEDP (TEST Y) A)
(NOT (ASSIGNMENT (TEST Y) A))
(EQUAL (ASSIGNMENT X
(FALSIFY1 (RIGHT-BRANCH Y) A))
(ASSIGNMENT X A))
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))).
This simplifies, unfolding the function FALSIFY1, to:
T.
Case 8. (IMPLIES (AND (IF-EXPRP Y)
(NOT (ASSIGNEDP (TEST Y) A))
(FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A))
(NOT (ASSIGNEDP X
(ASSUME-TRUE (TEST Y) A)))
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))).
This simplifies, rewriting with CDR-CONS and CAR-CONS, and expanding the
functions ASSUME-TRUE and ASSIGNEDP, to:
T.
Case 7. (IMPLIES (AND (IF-EXPRP Y)
(NOT (ASSIGNEDP (TEST Y) A))
(FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A))
(EQUAL (ASSIGNMENT X
(FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A)))
(ASSIGNMENT X
(ASSUME-TRUE (TEST Y) A)))
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))),
which simplifies, applying the lemmas CDR-CONS, CAR-CONS, and
ASSIGNMENT-IMPLIES-ASSIGNED, and expanding ASSUME-TRUE, ASSIGNMENT, FALSIFY1,
EQUAL, and ASSIGNEDP, to two new formulas:
Case 7.2.
(IMPLIES (AND (IF-EXPRP Y)
(NOT (ASSIGNEDP (TEST Y) A))
(FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A))
X
(EQUAL X (TEST Y))
(EQUAL (ASSIGNMENT X
(FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A)))
T)
(ASSIGNEDP X A)
(NOT (ASSIGNMENT X A))
(FALSIFY1 (RIGHT-BRANCH Y) A))
(NOT (ASSIGNMENT X
(FALSIFY1 (RIGHT-BRANCH Y) A)))),
which again simplifies, clearly, to:
T.
Case 7.1.
(IMPLIES (AND (IF-EXPRP Y)
(NOT (ASSIGNEDP (TEST Y) A))
(FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A))
X
(EQUAL X (TEST Y))
(EQUAL (ASSIGNMENT X
(FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A)))
T)
(ASSIGNEDP X A)
(ASSIGNMENT X A)
(FALSIFY1 (LEFT-BRANCH Y) A))
(EQUAL (ASSIGNMENT X
(FALSIFY1 (LEFT-BRANCH Y) A))
(ASSIGNMENT X A))).
This again simplifies, clearly, to:
T.
Case 6. (IMPLIES (AND (IF-EXPRP Y)
(NOT (ASSIGNEDP (TEST Y) A))
(NOT (FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A)))
(NOT (ASSIGNEDP X
(ASSUME-FALSE (TEST Y) A)))
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))).
This simplifies, applying the lemmas CDR-CONS and CAR-CONS, and opening up
the functions ASSUME-FALSE and ASSIGNEDP, to:
T.
Case 5. (IMPLIES (AND (IF-EXPRP Y)
(NOT (ASSIGNEDP (TEST Y) A))
(NOT (FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH Y)
(ASSUME-FALSE (TEST Y) A)))
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))).
This simplifies, opening up the definition of FALSIFY1, to:
T.
Case 4. (IMPLIES (AND (IF-EXPRP Y)
(NOT (ASSIGNEDP (TEST Y) A))
(NOT (FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A)))
(EQUAL (ASSIGNMENT X
(FALSIFY1 (RIGHT-BRANCH Y)
(ASSUME-FALSE (TEST Y) A)))
(ASSIGNMENT X
(ASSUME-FALSE (TEST Y) A)))
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))).
This simplifies, applying CDR-CONS, CAR-CONS, and
ASSIGNMENT-IMPLIES-ASSIGNED, and expanding ASSUME-FALSE, ASSIGNMENT,
FALSIFY1, EQUAL, and ASSIGNEDP, to two new conjectures:
Case 4.2.
(IMPLIES
(AND (IF-EXPRP Y)
(NOT (ASSIGNEDP (TEST Y) A))
(NOT (FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A)))
(NOT (EQUAL X T))
(EQUAL X (TEST Y))
(EQUAL (ASSIGNMENT X
(FALSIFY1 (RIGHT-BRANCH Y)
(ASSUME-FALSE (TEST Y) A)))
F)
(ASSIGNEDP X A)
(NOT (ASSIGNMENT X A))
(FALSIFY1 (RIGHT-BRANCH Y) A))
(NOT (ASSIGNMENT X
(FALSIFY1 (RIGHT-BRANCH Y) A)))),
which again simplifies, trivially, to:
T.
Case 4.1.
(IMPLIES
(AND (IF-EXPRP Y)
(NOT (ASSIGNEDP (TEST Y) A))
(NOT (FALSIFY1 (LEFT-BRANCH Y)
(ASSUME-TRUE (TEST Y) A)))
(NOT (EQUAL X T))
(EQUAL X (TEST Y))
(EQUAL (ASSIGNMENT X
(FALSIFY1 (RIGHT-BRANCH Y)
(ASSUME-FALSE (TEST Y) A)))
F)
(ASSIGNEDP X A)
(ASSIGNMENT X A)
(FALSIFY1 (LEFT-BRANCH Y) A))
(EQUAL (ASSIGNMENT X
(FALSIFY1 (LEFT-BRANCH Y) A))
(ASSIGNMENT X A))).
This again simplifies, trivially, to:
T.
Case 3. (IMPLIES (AND (NOT (IF-EXPRP Y))
(ASSIGNEDP Y A)
(ASSIGNMENT Y A)
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))).
This simplifies, applying ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding the
function FALSIFY1, to:
T.
Case 2. (IMPLIES (AND (NOT (IF-EXPRP Y))
(ASSIGNEDP Y A)
(NOT (ASSIGNMENT Y A))
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))),
which simplifies, unfolding the definition of FALSIFY1, to:
T.
Case 1. (IMPLIES (AND (NOT (IF-EXPRP Y))
(NOT (ASSIGNEDP Y A))
(ASSIGNEDP X A)
(FALSIFY1 Y A))
(EQUAL (ASSIGNMENT X (FALSIFY1 Y A))
(ASSIGNMENT X A))),
which simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
opening up FALSIFY1 and ASSIGNMENT, to three new goals:
Case 1.3.
(IMPLIES (AND (NOT (IF-EXPRP Y))
(NOT (ASSIGNEDP Y A))
(ASSIGNEDP X A)
(NOT (EQUAL X T))
(NOT X))
(EQUAL F (ASSIGNMENT X A))),
which again simplifies, rewriting with ASSIGNMENT-IMPLIES-ASSIGNED, and
opening up the definitions of EQUAL and ASSIGNMENT, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (IF-EXPRP Y))
(NOT (ASSIGNEDP Y A))
(ASSIGNEDP X A)
(NOT (EQUAL X T))
(EQUAL X Y))
(EQUAL F (ASSIGNMENT X A))).
This again simplifies, clearly, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (IF-EXPRP Y))
(NOT (ASSIGNEDP Y A))
(ASSIGNEDP X A)
(EQUAL X T))
(EQUAL T (ASSIGNMENT X A))).
This again simplifies, applying ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding
the definitions of ASSIGNMENT and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
FALSIFY1-EXTENDS-MODELS
(PROVE-LEMMA FALSIFY1-FALSIFIES
(REWRITE)
(IMPLIES (AND (NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(EQUAL (VALUE X (FALSIFY1 X A)) F)))
Name the conjecture *1.
We will try to 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 (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(p (TEST X) A)
(p (LEFT-BRANCH X) A)
(p (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(p X A))
(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(p (TEST X) A)
(p (RIGHT-BRANCH X) A)
(p (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(p X A))
(IMPLIES (NOT (IF-EXPRP X)) (p X A))).
Linear arithmetic and the lemmas TEST-LESSP, LEFT-BRANCH-LESSP, and
RIGHT-BRANCH-LESSP establish that the measure (COUNT X) decreases according to
the well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instances chosen for A. The above induction scheme
generates 31 new conjectures:
Case 31.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, rewriting with the lemmas VALUE-SHORT-CUT and
ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding the functions FALSIFY1 and
NORMALIZED-IF-EXPRP, to two new formulas:
Case 31.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))),
which further simplifies, applying CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and expanding the definitions of ASSUME-FALSE,
ASSIGNEDP, ASSIGNMENT, and NORMALIZED-IF-EXPRP, to:
T.
Case 31.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))).
This again simplifies, rewriting with FALSIFY1-EXTENDS-MODELS, to:
T.
Case 30.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, applying VALUE-SHORT-CUT and ASSIGNMENT-IMPLIES-ASSIGNED,
and unfolding the definitions of FALSIFY1 and NORMALIZED-IF-EXPRP, to two
new formulas:
Case 30.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))),
which further simplifies, applying CAR-CONS, CDR-CONS,
FALSIFY1-EXTENDS-MODELS, and ASSIGNMENT-IMPLIES-ASSIGNED, and opening up
the definitions of ASSUME-FALSE, ASSIGNEDP, ASSIGNMENT, EQUAL, IF-EXPRP,
FALSIFY1, CONS, and ASSUME-TRUE, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(EQUAL (TEST X) T)
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS T T) A)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS T F) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS T F) A))))),
which again simplifies, rewriting with ASSIGNMENT-IMPLIES-ASSIGNED, and
expanding the functions ASSIGNMENT and EQUAL, to:
T.
Case 30.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))).
However this again simplifies, rewriting with FALSIFY1-EXTENDS-MODELS, to:
T.
Case 29.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, rewriting with VALUE-SHORT-CUT and
ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding the definitions of FALSIFY1 and
NORMALIZED-IF-EXPRP, to two new goals:
Case 29.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))),
which further simplifies, applying the lemmas CAR-CONS, CDR-CONS,
FALSIFY1-EXTENDS-MODELS, and ASSIGNMENT-IMPLIES-ASSIGNED, and expanding
ASSUME-FALSE, ASSIGNEDP, ASSIGNMENT, EQUAL, IF-EXPRP, FALSIFY1, and VALUE,
to:
T.
Case 29.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))),
which again simplifies, rewriting with FALSIFY1-EXTENDS-MODELS, to:
T.
Case 28.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, appealing to the lemmas VALUE-SHORT-CUT,
ASSIGNMENT-IMPLIES-ASSIGNED, and FALSIFY1-EXTENDS-MODELS, and expanding the
definitions of FALSIFY1, NORMALIZED-IF-EXPRP, and VALUE, to the following
two new formulas:
Case 28.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))).
However this further simplifies, rewriting with CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and opening up the functions ASSUME-FALSE,
ASSIGNEDP, ASSIGNMENT, and NORMALIZED-IF-EXPRP, to:
T.
Case 28.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))).
However this again simplifies, appealing to the lemma
FALSIFY1-EXTENDS-MODELS, to:
T.
Case 27.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, applying VALUE-SHORT-CUT, ASSIGNMENT-IMPLIES-ASSIGNED, and
FALSIFY1-EXTENDS-MODELS, and opening up the functions FALSIFY1,
NORMALIZED-IF-EXPRP, and VALUE, to the following two new formulas:
Case 27.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))).
However this further simplifies, rewriting with the lemmas CAR-CONS,
CDR-CONS, FALSIFY1-EXTENDS-MODELS, and ASSIGNMENT-IMPLIES-ASSIGNED, and
opening up the definitions of ASSUME-FALSE, ASSIGNEDP, ASSIGNMENT, EQUAL,
IF-EXPRP, FALSIFY1, CONS, and ASSUME-TRUE, to the formula:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(EQUAL (TEST X) T)
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS T T) A)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS T F) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS T F) A))))).
This again simplifies, applying ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding
the functions ASSIGNMENT and EQUAL, to:
T.
Case 27.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))).
However this again simplifies, applying FALSIFY1-EXTENDS-MODELS, to:
T.
Case 26.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, rewriting with VALUE-SHORT-CUT, ASSIGNMENT-IMPLIES-ASSIGNED,
and FALSIFY1-EXTENDS-MODELS, and expanding the definitions of FALSIFY1,
NORMALIZED-IF-EXPRP, and VALUE, to two new formulas:
Case 26.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))),
which further simplifies, applying CAR-CONS, CDR-CONS,
FALSIFY1-EXTENDS-MODELS, and ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding
the definitions of ASSUME-FALSE, ASSIGNEDP, ASSIGNMENT, EQUAL, IF-EXPRP,
FALSIFY1, and VALUE, to:
T.
Case 26.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))).
But this again simplifies, rewriting with FALSIFY1-EXTENDS-MODELS, to:
T.
Case 25.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (NORMALIZED-IF-EXPRP (LEFT-BRANCH X)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, applying VALUE-SHORT-CUT, and opening up the functions
FALSIFY1 and NORMALIZED-IF-EXPRP, to:
T.
Case 24.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (FALSIFY1 (TEST X) A))
(NOT (NORMALIZED-IF-EXPRP (LEFT-BRANCH X)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, applying VALUE-SHORT-CUT, and expanding the definitions of
FALSIFY1 and NORMALIZED-IF-EXPRP, to:
T.
Case 23.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (NORMALIZED-IF-EXPRP (LEFT-BRANCH X)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, rewriting with VALUE-SHORT-CUT, and unfolding FALSIFY1 and
NORMALIZED-IF-EXPRP, to:
T.
Case 22.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, appealing to the lemmas VALUE-SHORT-CUT and
ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding the functions FALSIFY1,
NORMALIZED-IF-EXPRP, and VALUE, to two new formulas:
Case 22.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))),
which further simplifies, rewriting with CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and expanding the functions ASSUME-TRUE,
ASSUME-FALSE, ASSIGNEDP, ASSIGNMENT, and NORMALIZED-IF-EXPRP, to:
T.
Case 22.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))).
This again simplifies, applying FALSIFY1-EXTENDS-MODELS, to:
T.
Case 21.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, rewriting with the lemmas VALUE-SHORT-CUT and
ASSIGNMENT-IMPLIES-ASSIGNED, and opening up the functions FALSIFY1,
NORMALIZED-IF-EXPRP, and VALUE, to the following two new conjectures:
Case 21.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))).
But this further simplifies, appealing to the lemmas CAR-CONS, CDR-CONS,
FALSIFY1-EXTENDS-MODELS, and ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding
the definitions of ASSUME-TRUE, ASSUME-FALSE, ASSIGNEDP, ASSIGNMENT, EQUAL,
IF-EXPRP, FALSIFY1, and CONS, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS (TEST X) T) A)))
(EQUAL (TEST X) T)
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS T T) A))))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS T F) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS T F) A))))).
But this again simplifies, applying the lemma ASSIGNMENT-IMPLIES-ASSIGNED,
and expanding ASSIGNMENT and EQUAL, to:
T.
Case 21.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))),
which again simplifies, rewriting with FALSIFY1-EXTENDS-MODELS, to:
T.
Case 20.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, appealing to the lemmas VALUE-SHORT-CUT and
ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding the functions FALSIFY1,
NORMALIZED-IF-EXPRP, and VALUE, to the following two new formulas:
Case 20.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))).
However this further simplifies, rewriting with CAR-CONS, CDR-CONS,
FALSIFY1-EXTENDS-MODELS, and ASSIGNMENT-IMPLIES-ASSIGNED, and expanding
the definitions of ASSUME-TRUE, ASSUME-FALSE, ASSIGNEDP, ASSIGNMENT, EQUAL,
IF-EXPRP, FALSIFY1, and VALUE, to:
T.
Case 20.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))).
However this again simplifies, applying FALSIFY1-EXTENDS-MODELS, to:
T.
Case 19.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, appealing to the lemmas VALUE-SHORT-CUT,
ASSIGNMENT-IMPLIES-ASSIGNED, and FALSIFY1-EXTENDS-MODELS, and unfolding the
functions FALSIFY1, NORMALIZED-IF-EXPRP, and VALUE, to the following two new
conjectures:
Case 19.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))).
This further simplifies, applying the lemmas CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and opening up the definitions of ASSUME-TRUE,
ASSUME-FALSE, ASSIGNEDP, ASSIGNMENT, and NORMALIZED-IF-EXPRP, to:
T.
Case 19.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))),
which again simplifies, applying FALSIFY1-EXTENDS-MODELS, to:
T.
Case 18.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, applying the lemmas VALUE-SHORT-CUT,
ASSIGNMENT-IMPLIES-ASSIGNED, and FALSIFY1-EXTENDS-MODELS, and opening up the
definitions of FALSIFY1, NORMALIZED-IF-EXPRP, and VALUE, to the following
two new conjectures:
Case 18.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))).
This further simplifies, rewriting with CAR-CONS, CDR-CONS,
FALSIFY1-EXTENDS-MODELS, and ASSIGNMENT-IMPLIES-ASSIGNED, and opening up
the definitions of ASSUME-TRUE, ASSUME-FALSE, ASSIGNEDP, ASSIGNMENT, EQUAL,
IF-EXPRP, FALSIFY1, and CONS, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS (TEST X) T) A)))
(EQUAL (TEST X) T)
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS T T) A))))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS T F) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS T F) A))))),
which again simplifies, rewriting with the lemma
ASSIGNMENT-IMPLIES-ASSIGNED, and opening up the definitions of ASSIGNMENT
and EQUAL, to:
T.
Case 18.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))),
which again simplifies, rewriting with FALSIFY1-EXTENDS-MODELS, to:
T.
Case 17.(IMPLIES (AND (IF-EXPRP X)
(VALUE (TEST X) (FALSIFY1 X A))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, applying VALUE-SHORT-CUT, ASSIGNMENT-IMPLIES-ASSIGNED, and
FALSIFY1-EXTENDS-MODELS, and expanding the functions FALSIFY1,
NORMALIZED-IF-EXPRP, and VALUE, to two new conjectures:
Case 17.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))),
which further simplifies, rewriting with CAR-CONS, CDR-CONS,
FALSIFY1-EXTENDS-MODELS, and ASSIGNMENT-IMPLIES-ASSIGNED, and expanding
the functions ASSUME-TRUE, ASSUME-FALSE, ASSIGNEDP, ASSIGNMENT, EQUAL,
IF-EXPRP, FALSIFY1, and VALUE, to:
T.
Case 17.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(ASSIGNMENT (TEST X)
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (LEFT-BRANCH X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (RIGHT-BRANCH X) A)))).
This again simplifies, applying the lemma FALSIFY1-EXTENDS-MODELS, to:
T.
Case 16.(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, applying VALUE-SHORT-CUT and ASSIGNMENT-IMPLIES-ASSIGNED,
and expanding the definitions of FALSIFY1 and NORMALIZED-IF-EXPRP, to the
following two new conjectures:
Case 16.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))).
This further simplifies, rewriting with the lemmas CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and opening up ASSUME-TRUE, ASSIGNEDP, ASSIGNMENT,
and NORMALIZED-IF-EXPRP, to:
T.
Case 16.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))),
which again simplifies, applying the lemmas ASSIGNMENT-IMPLIES-ASSIGNED
and FALSIFY1-EXTENDS-MODELS, to:
T.
Case 15.(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, applying VALUE-SHORT-CUT and ASSIGNMENT-IMPLIES-ASSIGNED,
and opening up the functions FALSIFY1 and NORMALIZED-IF-EXPRP, to the
following two new conjectures:
Case 15.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))).
This further simplifies, rewriting with the lemmas CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and unfolding the functions ASSUME-TRUE,
ASSIGNEDP, ASSIGNMENT, EQUAL, IF-EXPRP, FALSIFY1, and ASSUME-FALSE, to the
conjecture:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (EQUAL (TEST X) T))
(NOT (TEST X))
(NOT A)
(NOT (FALSIFY1 (RIGHT-BRANCH X) F))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS F F) F)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) F)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) F))))).
However this again simplifies, expanding the definition of ASSIGNEDP, to:
T.
Case 15.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))),
which again simplifies, appealing to the lemmas
ASSIGNMENT-IMPLIES-ASSIGNED and FALSIFY1-EXTENDS-MODELS, to:
T.
Case 14.(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, rewriting with the lemmas VALUE-SHORT-CUT and
ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding FALSIFY1 and NORMALIZED-IF-EXPRP,
to two new conjectures:
Case 14.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))),
which further simplifies, rewriting with CAR-CONS, CDR-CONS,
FALSIFY1-EXTENDS-MODELS, and VALUE-SHORT-CUT, and unfolding the functions
ASSUME-TRUE, ASSIGNEDP, ASSIGNMENT, EQUAL, IF-EXPRP, FALSIFY1, VALUE, CONS,
ASSUME-FALSE, and NORMALIZED-IF-EXPRP, to the new formula:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (EQUAL (TEST X) T))
(NOT (TEST X))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS F F) A)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) A)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) A))))),
which again simplifies, expanding the definitions of EQUAL and ASSIGNEDP,
to:
T.
Case 14.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))),
which again simplifies, rewriting with the lemmas
ASSIGNMENT-IMPLIES-ASSIGNED and FALSIFY1-EXTENDS-MODELS, to:
T.
Case 13.(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, appealing to the lemmas VALUE-SHORT-CUT,
ASSIGNMENT-IMPLIES-ASSIGNED, and FALSIFY1-EXTENDS-MODELS, and unfolding the
functions FALSIFY1, NORMALIZED-IF-EXPRP, and VALUE, to two new conjectures:
Case 13.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))),
which further simplifies, rewriting with the lemmas CAR-CONS, CDR-CONS,
and FALSIFY1-EXTENDS-MODELS, and opening up ASSUME-TRUE, ASSIGNEDP,
ASSIGNMENT, and NORMALIZED-IF-EXPRP, to:
T.
Case 13.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))),
which again simplifies, rewriting with ASSIGNMENT-IMPLIES-ASSIGNED and
FALSIFY1-EXTENDS-MODELS, to:
T.
Case 12.(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, rewriting with the lemmas VALUE-SHORT-CUT,
ASSIGNMENT-IMPLIES-ASSIGNED, and FALSIFY1-EXTENDS-MODELS, and expanding the
definitions of FALSIFY1, NORMALIZED-IF-EXPRP, and VALUE, to the following
two new goals:
Case 12.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))).
But this further simplifies, applying the lemmas CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and unfolding ASSUME-TRUE, ASSIGNEDP, ASSIGNMENT,
EQUAL, IF-EXPRP, FALSIFY1, and ASSUME-FALSE, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (EQUAL (TEST X) T))
(NOT (TEST X))
(NOT A)
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) F)))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS F F) F)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) F)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) F))))).
But this again simplifies, opening up the function ASSIGNEDP, to:
T.
Case 12.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))),
which again simplifies, appealing to the lemmas
ASSIGNMENT-IMPLIES-ASSIGNED and FALSIFY1-EXTENDS-MODELS, to:
T.
Case 11.(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, applying VALUE-SHORT-CUT, ASSIGNMENT-IMPLIES-ASSIGNED, and
FALSIFY1-EXTENDS-MODELS, and unfolding FALSIFY1, NORMALIZED-IF-EXPRP, and
VALUE, to the following two new goals:
Case 11.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))).
This further simplifies, applying CAR-CONS, CDR-CONS,
FALSIFY1-EXTENDS-MODELS, and VALUE-SHORT-CUT, and unfolding the functions
ASSUME-TRUE, ASSIGNEDP, ASSIGNMENT, EQUAL, IF-EXPRP, FALSIFY1, VALUE, CONS,
ASSUME-FALSE, and NORMALIZED-IF-EXPRP, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (EQUAL (TEST X) T))
(NOT (TEST X))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS F F) A)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) A)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) A))))),
which again simplifies, unfolding the definitions of EQUAL and ASSIGNEDP,
to:
T.
Case 11.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))),
which again simplifies, rewriting with ASSIGNMENT-IMPLIES-ASSIGNED and
FALSIFY1-EXTENDS-MODELS, to:
T.
Case 10.(IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, applying VALUE-SHORT-CUT, and opening up FALSIFY1 and
NORMALIZED-IF-EXPRP, to:
T.
Case 9. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, appealing to the lemma VALUE-SHORT-CUT, and unfolding the
definitions of FALSIFY1 and NORMALIZED-IF-EXPRP, to:
T.
Case 8. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, rewriting with the lemma VALUE-SHORT-CUT, and unfolding
the definitions of FALSIFY1 and NORMALIZED-IF-EXPRP, to:
T.
Case 7. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, rewriting with VALUE-SHORT-CUT and
ASSIGNMENT-IMPLIES-ASSIGNED, and expanding the definitions of FALSIFY1,
NORMALIZED-IF-EXPRP, and VALUE, to the following two new formulas:
Case 7.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))).
However this further simplifies, applying CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and opening up the functions ASSUME-TRUE,
ASSIGNEDP, ASSIGNMENT, and NORMALIZED-IF-EXPRP, to:
T.
Case 7.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))).
This again simplifies, rewriting with the lemmas
ASSIGNMENT-IMPLIES-ASSIGNED and FALSIFY1-EXTENDS-MODELS, to:
T.
Case 6. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, applying VALUE-SHORT-CUT and ASSIGNMENT-IMPLIES-ASSIGNED,
and unfolding the definitions of FALSIFY1, NORMALIZED-IF-EXPRP, and VALUE,
to the following two new goals:
Case 6.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))).
However this further simplifies, applying CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and unfolding the functions ASSUME-TRUE,
ASSIGNEDP, ASSIGNMENT, EQUAL, IF-EXPRP, FALSIFY1, and ASSUME-FALSE, to the
new formula:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS (TEST X) T) A))
(NOT (EQUAL (TEST X) T))
(NOT (TEST X))
(NOT A)
(NOT (FALSIFY1 (RIGHT-BRANCH X) F))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS F F) F))))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) F))))),
which again simplifies, opening up the definition of ASSIGNEDP, to:
T.
Case 6.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))),
which again simplifies, applying ASSIGNMENT-IMPLIES-ASSIGNED and
FALSIFY1-EXTENDS-MODELS, to:
T.
Case 5. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))).
This simplifies, applying VALUE-SHORT-CUT and ASSIGNMENT-IMPLIES-ASSIGNED,
and opening up the definitions of FALSIFY1, NORMALIZED-IF-EXPRP, and VALUE,
to two new goals:
Case 5.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))),
which further simplifies, rewriting with CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and opening up ASSUME-TRUE, ASSIGNEDP, ASSIGNMENT,
EQUAL, IF-EXPRP, FALSIFY1, VALUE, CONS, and ASSUME-FALSE, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS (TEST X) T) A))
(NOT (EQUAL (TEST X) T))
(NOT (TEST X))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS F F) A))))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) A))))),
which again simplifies, expanding the definitions of EQUAL and ASSIGNEDP,
to:
T.
Case 5.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (FALSIFY1 (RIGHT-BRANCH X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))),
which again simplifies, appealing to the lemmas
ASSIGNMENT-IMPLIES-ASSIGNED and FALSIFY1-EXTENDS-MODELS, to:
T.
Case 4. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, applying the lemmas VALUE-SHORT-CUT,
ASSIGNMENT-IMPLIES-ASSIGNED, and FALSIFY1-EXTENDS-MODELS, and unfolding the
functions FALSIFY1, NORMALIZED-IF-EXPRP, and VALUE, to two new formulas:
Case 4.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))),
which further simplifies, applying CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and expanding ASSUME-TRUE, ASSIGNEDP, ASSIGNMENT,
and NORMALIZED-IF-EXPRP, to:
T.
Case 4.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (NORMALIZED-IF-EXPRP (TEST X)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))).
But this again simplifies, applying the lemmas ASSIGNMENT-IMPLIES-ASSIGNED
and FALSIFY1-EXTENDS-MODELS, to:
T.
Case 3. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, rewriting with VALUE-SHORT-CUT,
ASSIGNMENT-IMPLIES-ASSIGNED, and FALSIFY1-EXTENDS-MODELS, and opening up the
functions FALSIFY1, NORMALIZED-IF-EXPRP, and VALUE, to the following two new
conjectures:
Case 3.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))).
However this further simplifies, rewriting with the lemmas CAR-CONS,
CDR-CONS, and FALSIFY1-EXTENDS-MODELS, and expanding the functions
ASSUME-TRUE, ASSIGNEDP, ASSIGNMENT, EQUAL, IF-EXPRP, FALSIFY1, and
ASSUME-FALSE, to:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS (TEST X) T) A))
(NOT (EQUAL (TEST X) T))
(NOT (TEST X))
(NOT A)
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) F)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS F F) F))))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) F))))).
However this again simplifies, opening up the function ASSIGNEDP, to:
T.
Case 3.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (FALSIFY1 (TEST X) A))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))),
which again simplifies, appealing to the lemmas
ASSIGNMENT-IMPLIES-ASSIGNED and FALSIFY1-EXTENDS-MODELS, to:
T.
Case 2. (IMPLIES (AND (IF-EXPRP X)
(NOT (VALUE (TEST X) (FALSIFY1 X A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, applying VALUE-SHORT-CUT, ASSIGNMENT-IMPLIES-ASSIGNED, and
FALSIFY1-EXTENDS-MODELS, and expanding the functions FALSIFY1,
NORMALIZED-IF-EXPRP, and VALUE, to the following two new formulas:
Case 2.2.
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))))).
This further simplifies, rewriting with CAR-CONS, CDR-CONS, and
FALSIFY1-EXTENDS-MODELS, and unfolding the functions ASSUME-TRUE,
ASSIGNEDP, ASSIGNMENT, EQUAL, IF-EXPRP, FALSIFY1, VALUE, CONS, and
ASSUME-FALSE, to the new formula:
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS (TEST X) T) A))
(NOT (EQUAL (TEST X) T))
(NOT (TEST X))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(CONS (CONS F F) A))))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X)
(CONS (CONS F T) A))))),
which again simplifies, opening up EQUAL and ASSIGNEDP, to:
T.
Case 2.1.
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (ASSIGNMENT (TEST X)
(FALSIFY1 (LEFT-BRANCH X) A)))
(NOT (VALUE (TEST X)
(FALSIFY1 (TEST X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X) A)))
(NOT (VALUE (RIGHT-BRANCH X)
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))))
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (LEFT-BRANCH X))
(NORMALIZED-IF-EXPRP (RIGHT-BRANCH X))
(FALSIFY1 (LEFT-BRANCH X) A))
(NOT (VALUE X
(FALSIFY1 (LEFT-BRANCH X) A)))),
which again simplifies, rewriting with the lemmas
ASSIGNMENT-IMPLIES-ASSIGNED and FALSIFY1-EXTENDS-MODELS, to:
T.
Case 1. (IMPLIES (AND (NOT (IF-EXPRP X))
(NORMALIZED-IF-EXPRP X)
(FALSIFY1 X A))
(NOT (VALUE X (FALSIFY1 X A)))),
which simplifies, applying CAR-CONS and CDR-CONS, and expanding the
functions NORMALIZED-IF-EXPRP, FALSIFY1, VALUE, and ASSIGNMENT, to the
following two new formulas:
Case 1.2.
(IMPLIES (AND (NOT (IF-EXPRP X))
(NOT (ASSIGNMENT X A))
A
(NOT (ASSIGNEDP X A)))
(NOT (ASSIGNMENT X (CONS (CONS X F) A)))).
But this again simplifies, appealing to the lemmas CDR-CONS and CAR-CONS,
and opening up the function ASSIGNMENT, to:
(IMPLIES (AND (NOT (IF-EXPRP X))
(NOT (ASSIGNMENT X A))
A
(NOT (ASSIGNEDP X A)))
(NOT (EQUAL X T))).
This again simplifies, unfolding the definitions of IF-EXPRP, EQUAL, and
ASSIGNMENT, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (IF-EXPRP X))
(NOT (ASSIGNEDP X A)))
(NOT (EQUAL X T))),
which again simplifies, applying ASSIGNMENT-IMPLIES-ASSIGNED, and opening
up the definitions of IF-EXPRP, ASSIGNMENT, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 1.9 0.1 ]
FALSIFY1-FALSIFIES
(PROVE-LEMMA TAUTOLOGYP-FAILS-MEANS-FALSIFY1-WINS
(REWRITE)
(IMPLIES (AND (NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)))
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 (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(p (LEFT-BRANCH X) A))
(p X A))
(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(p (RIGHT-BRANCH X) A))
(p X A))
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(p (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(p X A))
(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(p (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(p (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A)))
(p X A))
(IMPLIES (AND (NOT (IF-EXPRP X))
(ASSIGNEDP X A)
(ASSIGNMENT X A))
(p X A))
(IMPLIES (AND (NOT (IF-EXPRP X))
(ASSIGNEDP X A)
(NOT (ASSIGNMENT X A)))
(p X A))
(IMPLIES (AND (NOT (IF-EXPRP X))
(NOT (ASSIGNEDP X A)))
(p X A))).
Linear arithmetic and the lemmas LEFT-BRANCH-LESSP and RIGHT-BRANCH-LESSP
inform us that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each induction step of the scheme. Note, however, the
inductive instances chosen for A. The above induction scheme leads to the
following 16 new conjectures:
Case 16.(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(NOT (NORMALIZED-IF-EXPRP (LEFT-BRANCH X)))
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)).
This simplifies, rewriting with the lemma ASSIGNMENT-IMPLIES-ASSIGNED, and
opening up the definition of NORMALIZED-IF-EXPRP, to:
T.
Case 15.(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(TAUTOLOGYP (LEFT-BRANCH X) A)
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)).
This simplifies, appealing to the lemma ASSIGNMENT-IMPLIES-ASSIGNED, and
expanding NORMALIZED-IF-EXPRP and TAUTOLOGYP, to:
T.
Case 14.(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(ASSIGNMENT (TEST X) A)
(FALSIFY1 (LEFT-BRANCH X) A)
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)).
This simplifies, applying ASSIGNMENT-IMPLIES-ASSIGNED, and opening up the
definitions of NORMALIZED-IF-EXPRP, TAUTOLOGYP, and FALSIFY1, to:
T.
Case 13.(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(NOT (NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)),
which simplifies, unfolding the definition of NORMALIZED-IF-EXPRP, to:
T.
Case 12.(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(TAUTOLOGYP (RIGHT-BRANCH X) A)
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)),
which simplifies, opening up NORMALIZED-IF-EXPRP and TAUTOLOGYP, to:
T.
Case 11.(IMPLIES (AND (IF-EXPRP X)
(ASSIGNEDP (TEST X) A)
(NOT (ASSIGNMENT (TEST X) A))
(FALSIFY1 (RIGHT-BRANCH X) A)
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)),
which simplifies, opening up NORMALIZED-IF-EXPRP, TAUTOLOGYP, and FALSIFY1,
to:
T.
Case 10.(IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (NORMALIZED-IF-EXPRP (LEFT-BRANCH X)))
(NOT (NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)),
which simplifies, opening up the function NORMALIZED-IF-EXPRP, to:
T.
Case 9. (IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(TAUTOLOGYP (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(NOT (NORMALIZED-IF-EXPRP (RIGHT-BRANCH X)))
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)),
which simplifies, expanding the function NORMALIZED-IF-EXPRP, to:
T.
Case 8. (IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (NORMALIZED-IF-EXPRP (LEFT-BRANCH X)))
(TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)),
which simplifies, opening up NORMALIZED-IF-EXPRP, to:
T.
Case 7. (IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(TAUTOLOGYP (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(TAUTOLOGYP (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)),
which simplifies, unfolding the functions NORMALIZED-IF-EXPRP and TAUTOLOGYP,
to:
T.
Case 6. (IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(NOT (NORMALIZED-IF-EXPRP (LEFT-BRANCH X)))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)),
which simplifies, expanding the definition of NORMALIZED-IF-EXPRP, to:
T.
Case 5. (IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(NOT (FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A)))
(TAUTOLOGYP (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(FALSIFY1 (RIGHT-BRANCH X)
(ASSUME-FALSE (TEST X) A))
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)),
which simplifies, opening up the functions NORMALIZED-IF-EXPRP, TAUTOLOGYP,
and FALSIFY1, to:
T.
Case 4. (IMPLIES (AND (IF-EXPRP X)
(NOT (ASSIGNEDP (TEST X) A))
(FALSIFY1 (LEFT-BRANCH X)
(ASSUME-TRUE (TEST X) A))
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)),
which simplifies, expanding the functions NORMALIZED-IF-EXPRP, TAUTOLOGYP,
and FALSIFY1, to:
T.
Case 3. (IMPLIES (AND (NOT (IF-EXPRP X))
(ASSIGNEDP X A)
(ASSIGNMENT X A)
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)),
which simplifies, rewriting with ASSIGNMENT-IMPLIES-ASSIGNED, and unfolding
the definitions of NORMALIZED-IF-EXPRP and TAUTOLOGYP, to:
T.
Case 2. (IMPLIES (AND (NOT (IF-EXPRP X))
(ASSIGNEDP X A)
(NOT (ASSIGNMENT X A))
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)).
This simplifies, expanding the definitions of NORMALIZED-IF-EXPRP,
TAUTOLOGYP, and FALSIFY1, to:
T.
Case 1. (IMPLIES (AND (NOT (IF-EXPRP X))
(NOT (ASSIGNEDP X A))
(NORMALIZED-IF-EXPRP X)
(NOT (TAUTOLOGYP X A))
A)
(FALSIFY1 X A)).
This simplifies, expanding NORMALIZED-IF-EXPRP, TAUTOLOGYP, and FALSIFY1, to
the new formula:
(IMPLIES (AND (NOT (IF-EXPRP X))
(NOT (ASSIGNEDP X A))
(NOT (ASSIGNMENT X A))
A)
(CONS (CONS X F) A)),
which again simplifies, obviously, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
TAUTOLOGYP-FAILS-MEANS-FALSIFY1-WINS
(PROVE-LEMMA NORMALIZE-IS-SOUND
(REWRITE)
(EQUAL (VALUE (NORMALIZE X) A)
(VALUE X A)))
Name the conjecture *1.
Perhaps we can prove it by induction. There are two plausible inductions,
both of which are unflawed. So we will choose the one suggested by the
largest number of nonprimitive recursive functions. We will induct according
to the following scheme:
(AND (IMPLIES (AND (IF-EXPRP X)
(IF-EXPRP (TEST X))
(p (CONS-IF (TEST (TEST X))
(CONS-IF (LEFT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X))
(CONS-IF (RIGHT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X)))
A))
(p X A))
(IMPLIES (AND (IF-EXPRP X)
(NOT (IF-EXPRP (TEST X)))
(p (RIGHT-BRANCH X) A)
(p (LEFT-BRANCH X) A))
(p X A))
(IMPLIES (NOT (IF-EXPRP X)) (p X A))).
Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1,
IF-COMPLEXITY-NOT-0, EQUAL-TIMES-0, LESSP-TIMES-CANCELLATION,
LESSP-PLUS-CANCELATION, ASSOCIATIVITY-OF-PLUS, COMMUTATIVITY2-OF-PLUS,
COMMUTATIVITY2-OF-TIMES, COMMUTATIVITY-OF-TIMES, TEST-CONS-IF,
LEFT-BRANCH-CONS-IF, RIGHT-BRANCH-CONS-IF, DISTRIBUTIVITY-OF-TIMES-OVER-PLUS,
ADD1-EQUAL, IF-COMPLEXITY-GOES-DOWN2, and IF-COMPLEXITY-GOES-DOWN1, and the
definitions of ORDINALP, LESSP, ORD-LESSP, IF-DEPTH, IF-COMPLEXITY, LISTP, and
ADD1 establish that the measure (CONS (ADD1 (IF-COMPLEXITY X)) (IF-DEPTH X))
decreases according to the well-founded relation ORD-LESSP in each induction
step of the scheme. The above induction scheme produces the following three
new goals:
Case 3. (IMPLIES
(AND
(IF-EXPRP X)
(IF-EXPRP (TEST X))
(EQUAL (VALUE (NORMALIZE (CONS-IF (TEST (TEST X))
(CONS-IF (LEFT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X))
(CONS-IF (RIGHT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X))))
A)
(VALUE (CONS-IF (TEST (TEST X))
(CONS-IF (LEFT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X))
(CONS-IF (RIGHT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X)))
A)))
(EQUAL (VALUE (NORMALIZE X) A)
(VALUE X A))).
This simplifies, applying RIGHT-BRANCH-CONS-IF, LEFT-BRANCH-CONS-IF, and
TEST-CONS-IF, and unfolding the definitions of VALUE and NORMALIZE, to:
T.
Case 2. (IMPLIES (AND (IF-EXPRP X)
(NOT (IF-EXPRP (TEST X)))
(EQUAL (VALUE (NORMALIZE (RIGHT-BRANCH X)) A)
(VALUE (RIGHT-BRANCH X) A))
(EQUAL (VALUE (NORMALIZE (LEFT-BRANCH X)) A)
(VALUE (LEFT-BRANCH X) A)))
(EQUAL (VALUE (NORMALIZE X) A)
(VALUE X A))),
which simplifies, rewriting with RIGHT-BRANCH-CONS-IF, LEFT-BRANCH-CONS-IF,
and TEST-CONS-IF, and expanding the definitions of NORMALIZE and VALUE, to:
T.
Case 1. (IMPLIES (NOT (IF-EXPRP X))
(EQUAL (VALUE (NORMALIZE X) A)
(VALUE X A))).
This simplifies, expanding the definitions of NORMALIZE and VALUE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NORMALIZE-IS-SOUND
(PROVE-LEMMA NORMALIZE-NORMALIZES
(REWRITE)
(NORMALIZED-IF-EXPRP (NORMALIZE X)))
Call the conjecture *1.
Let us appeal to the induction principle. There is only one suggested
induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (IF-EXPRP X)
(IF-EXPRP (TEST X))
(p (CONS-IF (TEST (TEST X))
(CONS-IF (LEFT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X))
(CONS-IF (RIGHT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X)))))
(p X))
(IMPLIES (AND (IF-EXPRP X)
(NOT (IF-EXPRP (TEST X)))
(p (RIGHT-BRANCH X))
(p (LEFT-BRANCH X)))
(p X))
(IMPLIES (NOT (IF-EXPRP X)) (p X))).
Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1,
IF-COMPLEXITY-NOT-0, EQUAL-TIMES-0, LESSP-TIMES-CANCELLATION,
LESSP-PLUS-CANCELATION, ASSOCIATIVITY-OF-PLUS, COMMUTATIVITY2-OF-PLUS,
COMMUTATIVITY2-OF-TIMES, COMMUTATIVITY-OF-TIMES, TEST-CONS-IF,
LEFT-BRANCH-CONS-IF, RIGHT-BRANCH-CONS-IF, DISTRIBUTIVITY-OF-TIMES-OVER-PLUS,
ADD1-EQUAL, IF-COMPLEXITY-GOES-DOWN2, and IF-COMPLEXITY-GOES-DOWN1, and the
definitions of ORDINALP, LESSP, ORD-LESSP, IF-DEPTH, IF-COMPLEXITY, LISTP, and
ADD1 inform us that the measure (CONS (ADD1 (IF-COMPLEXITY X)) (IF-DEPTH X))
decreases according to the well-founded relation ORD-LESSP in each induction
step of the scheme. The above induction scheme leads to three new goals:
Case 3. (IMPLIES
(AND
(IF-EXPRP X)
(IF-EXPRP (TEST X))
(NORMALIZED-IF-EXPRP
(NORMALIZE (CONS-IF (TEST (TEST X))
(CONS-IF (LEFT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X))
(CONS-IF (RIGHT-BRANCH (TEST X))
(LEFT-BRANCH X)
(RIGHT-BRANCH X))))))
(NORMALIZED-IF-EXPRP (NORMALIZE X))),
which simplifies, expanding the definition of NORMALIZE, to:
T.
Case 2. (IMPLIES (AND (IF-EXPRP X)
(NOT (IF-EXPRP (TEST X)))
(NORMALIZED-IF-EXPRP (NORMALIZE (RIGHT-BRANCH X)))
(NORMALIZED-IF-EXPRP (NORMALIZE (LEFT-BRANCH X))))
(NORMALIZED-IF-EXPRP (NORMALIZE X))),
which simplifies, applying RIGHT-BRANCH-CONS-IF, LEFT-BRANCH-CONS-IF, and
TEST-CONS-IF, and expanding NORMALIZE and NORMALIZED-IF-EXPRP, to:
T.
Case 1. (IMPLIES (NOT (IF-EXPRP X))
(NORMALIZED-IF-EXPRP (NORMALIZE X))).
This simplifies, expanding the definitions of NORMALIZE and
NORMALIZED-IF-EXPRP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NORMALIZE-NORMALIZES
(PROVE-LEMMA TAUTOLOGY-CHECKER-COMPLETENESS-BRIDGE
(REWRITE)
(IMPLIES (AND (EQUAL (VALUE Y (FALSIFY1 X A))
(VALUE X (FALSIFY1 X A)))
(FALSIFY1 X A)
(NORMALIZED-IF-EXPRP X))
(EQUAL (VALUE Y (FALSIFY1 X A)) F)))
This simplifies, applying FALSIFY1-FALSIFIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TAUTOLOGY-CHECKER-COMPLETENESS-BRIDGE
(PROVE-LEMMA TAUTOLOGY-CHECKER-IS-COMPLETE NIL
(IMPLIES (NOT (TAUTOLOGY-CHECKER X))
(EQUAL (VALUE X (FALSIFY X)) F)))
This formula can be simplified, using the abbreviations NOT, IMPLIES, FALSIFY,
and TAUTOLOGY-CHECKER, to the new conjecture:
(IMPLIES (NOT (TAUTOLOGYP (NORMALIZE X) NIL))
(EQUAL (VALUE X (FALSIFY1 (NORMALIZE X) NIL))
F)),
which simplifies, rewriting with TAUTOLOGYP-FAILS-MEANS-FALSIFY1-WINS,
NORMALIZE-NORMALIZES, NORMALIZE-IS-SOUND, and
TAUTOLOGY-CHECKER-COMPLETENESS-BRIDGE, and opening up EQUAL, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TAUTOLOGY-CHECKER-IS-COMPLETE
(PROVE-LEMMA TAUTOLOGY-CHECKER-SOUNDNESS-BRIDGE
(REWRITE)
(IMPLIES (AND (TAUTOLOGYP Y A1)
(NORMALIZED-IF-EXPRP Y)
(EQUAL (VALUE X A2)
(VALUE Y (APPEND A1 A2))))
(VALUE X A2)))
WARNING: Note that TAUTOLOGY-CHECKER-SOUNDNESS-BRIDGE contains the free
variables A1 and Y which will be chosen by instantiating the hypothesis
(TAUTOLOGYP Y A1).
This simplifies, rewriting with TAUTOLOGYP-IS-SOUND, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TAUTOLOGY-CHECKER-SOUNDNESS-BRIDGE
(PROVE-LEMMA TAUTOLOGY-CHECKER-IS-SOUND NIL
(IMPLIES (TAUTOLOGY-CHECKER X)
(VALUE X A)))
This conjecture can be simplified, using the abbreviations IMPLIES and
TAUTOLOGY-CHECKER, to:
(IMPLIES (TAUTOLOGYP (NORMALIZE X) NIL)
(VALUE X A)).
This simplifies, rewriting with NORMALIZE-IS-SOUND, NORMALIZE-NORMALIZES, and
TAUTOLOGY-CHECKER-SOUNDNESS-BRIDGE, and expanding the definitions of APPEND
and LISTP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TAUTOLOGY-CHECKER-IS-SOUND
(PROVE-LEMMA FLATTEN-SINGLETON
(REWRITE)
(EQUAL (EQUAL (FLATTEN X) (CONS Y NIL))
(AND (NLISTP X) (EQUAL X Y))))
This simplifies, rewriting with CAR-CONS, and opening up NLISTP and AND, to
three new conjectures:
Case 3. (IMPLIES (EQUAL (FLATTEN X) (LIST Y))
(EQUAL (EQUAL X Y) T)),
which again simplifies, appealing to the lemma CAR-CONS, to:
(IMPLIES (EQUAL (FLATTEN X) (LIST Y))
(EQUAL X Y)).
Give the above formula the name *1.
Case 2. (IMPLIES (AND (NOT (EQUAL (FLATTEN X) (LIST Y)))
(NOT (LISTP X)))
(NOT (EQUAL X Y))).
But this again simplifies, unfolding the definition of FLATTEN, to:
T.
Case 1. (IMPLIES (EQUAL (FLATTEN X) (LIST Y))
(NOT (LISTP 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:
(EQUAL (EQUAL (FLATTEN X) (LIST Y))
(AND (NLISTP X) (EQUAL X Y))),
named *1. Let us appeal to the induction principle. There is only one
suggested induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP X)
(p (CDR X) Y)
(p (CAR X) Y))
(p X Y))
(IMPLIES (NOT (LISTP X)) (p X Y))).
Linear arithmetic and the lemmas CDR-LESSP and CAR-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 generates two
new formulas:
Case 2. (IMPLIES (AND (LISTP X)
(EQUAL (EQUAL (FLATTEN (CDR X)) (LIST Y))
(AND (NLISTP (CDR X))
(EQUAL (CDR X) Y)))
(EQUAL (EQUAL (FLATTEN (CAR X)) (LIST Y))
(AND (NLISTP (CAR X))
(EQUAL (CAR X) Y))))
(EQUAL (EQUAL (FLATTEN X) (LIST Y))
(AND (NLISTP X) (EQUAL X Y)))),
which simplifies, applying the lemma CAR-CONS, and opening up the
definitions of NLISTP, AND, and FLATTEN, to nine new formulas:
Case 2.9.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL (FLATTEN (CDR X)) (LIST Y)))
(LISTP (CDR X))
(NOT (EQUAL (FLATTEN (CAR X)) (LIST Y)))
(LISTP (CAR X)))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(LIST Y)))).
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 (NOT (EQUAL (FLATTEN Z) (LIST Y)))
(LISTP Z)
(NOT (EQUAL (FLATTEN V) (LIST Y)))
(LISTP V))
(NOT (EQUAL (APPEND (FLATTEN V) (FLATTEN Z))
(LIST Y)))),
which we generalize by replacing (FLATTEN V) by A and (FLATTEN Z) by U.
We restrict the new variables by recalling the type restriction lemma
noted when FLATTEN was introduced. We thus obtain the new goal:
(IMPLIES (AND (LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(LISTP Z)
(NOT (EQUAL A (LIST Y)))
(LISTP V))
(NOT (EQUAL (APPEND A U) (LIST Y)))),
which has two irrelevant terms in it. By eliminating these terms we get:
(IMPLIES (AND (LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL A (LIST Y))))
(NOT (EQUAL (APPEND A U) (LIST Y)))),
which we will name *1.1.
Case 2.8.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL (FLATTEN (CDR X)) (LIST Y)))
(LISTP (CDR X))
(NOT (EQUAL (FLATTEN (CAR X)) (LIST Y)))
(NOT (EQUAL (CAR X) Y)))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(LIST Y)))).
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 (NOT (EQUAL (FLATTEN Z) (LIST Y)))
(LISTP Z)
(NOT (EQUAL (FLATTEN V) (LIST Y)))
(NOT (EQUAL V Y)))
(NOT (EQUAL (APPEND (FLATTEN V) (FLATTEN Z))
(LIST Y)))).
We will try to prove the above formula by generalizing it, replacing
(FLATTEN V) by A and (FLATTEN Z) by U. We restrict the new variables by
recalling the type restriction lemma noted when FLATTEN was introduced.
This produces:
(IMPLIES (AND (LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(LISTP Z)
(NOT (EQUAL A (LIST Y)))
(NOT (EQUAL V Y)))
(NOT (EQUAL (APPEND A U) (LIST Y)))),
which has an irrelevant term in it. By eliminating the term we get:
(IMPLIES (AND (LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL A (LIST Y)))
(NOT (EQUAL V Y)))
(NOT (EQUAL (APPEND A U) (LIST Y)))),
which we will name *1.2.
Case 2.7.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL (FLATTEN (CDR X)) (LIST Y)))
(LISTP (CDR X))
(EQUAL (FLATTEN (CAR X)) (LIST Y))
(NOT (LISTP (CAR X)))
(EQUAL (EQUAL (CAR X) Y) T))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CAR X))))).
However this again simplifies, rewriting with CAR-CONS, to:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL (FLATTEN (CDR X))
(FLATTEN (CAR X))))
(LISTP (CDR X))
(EQUAL (FLATTEN (CAR X)) (LIST Y))
(NOT (LISTP (CAR X)))
(EQUAL (CAR X) Y))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CAR X))))),
which again simplifies, rewriting with the lemma CAR-CONS, to:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL (FLATTEN (CDR X))
(FLATTEN (CAR X))))
(LISTP (CDR X))
(EQUAL (FLATTEN (CAR X))
(LIST (CAR X)))
(NOT (LISTP (CAR X))))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CAR X))))).
This further simplifies, appealing to the lemmas CDR-CONS and CAR-CONS,
and unfolding the functions FLATTEN, APPEND, and LISTP, to:
T.
Case 2.6.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL (FLATTEN (CDR X)) (LIST Y)))
(NOT (EQUAL (CDR X) Y))
(NOT (EQUAL (FLATTEN (CAR X)) (LIST Y)))
(LISTP (CAR X)))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(LIST Y)))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS V Z) to eliminate
(CDR X) and (CAR X). This produces:
(IMPLIES (AND (NOT (EQUAL (FLATTEN Z) (LIST Y)))
(NOT (EQUAL Z Y))
(NOT (EQUAL (FLATTEN V) (LIST Y)))
(LISTP V))
(NOT (EQUAL (APPEND (FLATTEN V) (FLATTEN Z))
(LIST Y)))),
which we generalize by replacing (FLATTEN V) by A and (FLATTEN Z) by U.
We restrict the new variables by recalling the type restriction lemma
noted when FLATTEN was introduced. This produces:
(IMPLIES (AND (LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL Z Y))
(NOT (EQUAL A (LIST Y)))
(LISTP V))
(NOT (EQUAL (APPEND A U) (LIST Y)))),
which has an irrelevant term in it. By eliminating the term we get:
(IMPLIES (AND (LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL Z Y))
(NOT (EQUAL A (LIST Y))))
(NOT (EQUAL (APPEND A U) (LIST Y)))),
which we will name *1.3.
Case 2.5.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL (FLATTEN (CDR X)) (LIST Y)))
(NOT (EQUAL (CDR X) Y))
(NOT (EQUAL (FLATTEN (CAR X)) (LIST Y)))
(NOT (EQUAL (CAR X) Y)))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(LIST Y)))).
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 (NOT (EQUAL (FLATTEN Z) (LIST Y)))
(NOT (EQUAL Z Y))
(NOT (EQUAL (FLATTEN V) (LIST Y)))
(NOT (EQUAL V Y)))
(NOT (EQUAL (APPEND (FLATTEN V) (FLATTEN Z))
(LIST Y)))).
We will try to prove the above formula by generalizing it, replacing
(FLATTEN V) by A and (FLATTEN Z) by U. We restrict the new variables by
recalling the type restriction lemma noted when FLATTEN was introduced.
This produces:
(IMPLIES (AND (LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL Z Y))
(NOT (EQUAL A (LIST Y)))
(NOT (EQUAL V Y)))
(NOT (EQUAL (APPEND A U) (LIST Y)))),
which we will name *1.4.
Case 2.4.
(IMPLIES (AND (LISTP X)
(NOT (EQUAL (FLATTEN (CDR X)) (LIST Y)))
(NOT (EQUAL (CDR X) Y))
(EQUAL (FLATTEN (CAR X)) (LIST Y))
(NOT (LISTP (CAR X)))
(EQUAL (EQUAL (CAR X) Y) T))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CAR X))))).
But this again simplifies, rewriting with CAR-CONS, to:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL (FLATTEN (CDR X))
(FLATTEN (CAR X))))
(NOT (EQUAL (CDR X) Y))
(EQUAL (FLATTEN (CAR X)) (LIST Y))
(NOT (LISTP (CAR X)))
(EQUAL (CAR X) Y))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CAR X))))),
which again simplifies, rewriting with CAR-CONS, to:
(IMPLIES (AND (LISTP X)
(NOT (EQUAL (FLATTEN (CDR X))
(FLATTEN (CAR X))))
(NOT (EQUAL (CDR X) (CAR X)))
(EQUAL (FLATTEN (CAR X))
(LIST (CAR X)))
(NOT (LISTP (CAR X))))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CAR X))))),
which further simplifies, applying the lemmas CDR-CONS and CAR-CONS, and
opening up FLATTEN, APPEND, and LISTP, to:
T.
Case 2.3.
(IMPLIES (AND (LISTP X)
(EQUAL (FLATTEN (CDR X)) (LIST Y))
(NOT (LISTP (CDR X)))
(EQUAL (EQUAL (CDR X) Y) T)
(NOT (EQUAL (FLATTEN (CAR X))
(FLATTEN (CDR X))))
(LISTP (CAR X)))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CDR X))))),
which again simplifies, applying CAR-CONS, to:
(IMPLIES (AND (LISTP X)
(EQUAL (FLATTEN (CDR X)) (LIST Y))
(NOT (LISTP (CDR X)))
(EQUAL (CDR X) Y)
(NOT (EQUAL (FLATTEN (CAR X))
(FLATTEN (CDR X))))
(LISTP (CAR X)))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CDR X))))),
which again simplifies, appealing to the lemma CAR-CONS, to the conjecture:
(IMPLIES (AND (LISTP X)
(EQUAL (FLATTEN (CDR X))
(LIST (CDR X)))
(NOT (LISTP (CDR X)))
(NOT (EQUAL (FLATTEN (CAR X))
(FLATTEN (CDR X))))
(LISTP (CAR X)))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CDR X))))).
However this further simplifies, applying CAR-CONS, and expanding the
definition of FLATTEN, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (EQUAL (FLATTEN (CAR X))
(LIST (CDR X))))
(LISTP (CAR X)))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(LIST (CDR X)))
(LIST (CDR X))))).
Applying the lemma CAR-CDR-ELIM, replace X by (CONS V Z) to eliminate
(CDR X) and (CAR X). We would thus like to prove:
(IMPLIES (AND (NOT (LISTP Z))
(NOT (EQUAL (FLATTEN V) (LIST Z)))
(LISTP V))
(NOT (EQUAL (APPEND (FLATTEN V) (LIST Z))
(LIST Z)))),
which we generalize by replacing (FLATTEN V) by A. We restrict the new
variable by recalling the type restriction lemma noted when FLATTEN was
introduced. This produces:
(IMPLIES (AND (LISTP A)
(NOT (LISTP Z))
(NOT (EQUAL A (LIST Z)))
(LISTP V))
(NOT (EQUAL (APPEND A (LIST Z))
(LIST Z)))),
which has an irrelevant term in it. By eliminating the term we get:
(IMPLIES (AND (LISTP A)
(NOT (LISTP Z))
(NOT (EQUAL A (LIST Z))))
(NOT (EQUAL (APPEND A (LIST Z))
(LIST Z)))),
which we will finally name *1.5.
Case 2.2.
(IMPLIES (AND (LISTP X)
(EQUAL (FLATTEN (CDR X)) (LIST Y))
(NOT (LISTP (CDR X)))
(EQUAL (EQUAL (CDR X) Y) T)
(NOT (EQUAL (FLATTEN (CAR X))
(FLATTEN (CDR X))))
(NOT (EQUAL (CAR X) Y)))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CDR X))))).
This again simplifies, applying the lemma CAR-CONS, to:
(IMPLIES (AND (LISTP X)
(EQUAL (FLATTEN (CDR X)) (LIST Y))
(NOT (LISTP (CDR X)))
(EQUAL (CDR X) Y)
(NOT (EQUAL (FLATTEN (CAR X))
(FLATTEN (CDR X))))
(NOT (EQUAL (CAR X) Y)))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CDR X))))).
However this again simplifies, rewriting with CAR-CONS, to:
(IMPLIES (AND (LISTP X)
(EQUAL (FLATTEN (CDR X))
(LIST (CDR X)))
(NOT (LISTP (CDR X)))
(NOT (EQUAL (FLATTEN (CAR X))
(FLATTEN (CDR X))))
(NOT (EQUAL (CAR X) (CDR X))))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(FLATTEN (CDR X))))),
which further simplifies, rewriting with the lemma CAR-CONS, and expanding
the function FLATTEN, to:
(IMPLIES (AND (LISTP X)
(NOT (LISTP (CDR X)))
(NOT (EQUAL (FLATTEN (CAR X))
(LIST (CDR X))))
(NOT (EQUAL (CAR X) (CDR X))))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(LIST (CDR X)))
(LIST (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 (NOT (LISTP Z))
(NOT (EQUAL (FLATTEN V) (LIST Z)))
(NOT (EQUAL V Z)))
(NOT (EQUAL (APPEND (FLATTEN V) (LIST Z))
(LIST Z)))).
We will try to prove the above formula by generalizing it, replacing
(FLATTEN V) by A. We restrict the new variable by recalling the type
restriction lemma noted when FLATTEN was introduced. This produces:
(IMPLIES (AND (LISTP A)
(NOT (LISTP Z))
(NOT (EQUAL A (LIST Z)))
(NOT (EQUAL V Z)))
(NOT (EQUAL (APPEND A (LIST Z))
(LIST Z)))),
which we will finally name *1.6.
Case 2.1.
(IMPLIES (AND (LISTP X)
(EQUAL (FLATTEN (CDR X)) (LIST Y))
(NOT (LISTP (CDR X)))
(EQUAL (EQUAL (CDR X) Y) T)
(EQUAL (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(NOT (LISTP (CAR X)))
(EQUAL (EQUAL (CAR X) Y) T))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CAR X)))
(FLATTEN (CDR X))))).
This again simplifies, applying the lemma CAR-CONS, to:
(IMPLIES (AND (LISTP X)
(EQUAL (FLATTEN (CAR X)) (LIST Y))
(NOT (LISTP (CDR X)))
(EQUAL (CDR X) Y)
(EQUAL (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(NOT (LISTP (CAR X)))
(EQUAL (CAR X) Y))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CAR X)))
(FLATTEN (CAR X))))).
This again simplifies, applying CAR-CONS, to:
(IMPLIES (AND (LISTP X)
(EQUAL (FLATTEN (CAR X))
(LIST (CAR X)))
(EQUAL (FLATTEN (CAR X))
(FLATTEN (CDR X)))
(NOT (LISTP (CAR X)))
(EQUAL (CAR X) (CDR X)))
(NOT (EQUAL (APPEND (FLATTEN (CAR X))
(FLATTEN (CAR X)))
(FLATTEN (CAR X))))),
which further simplifies, applying the lemmas CDR-CONS and CAR-CONS, and
opening up the definitions of FLATTEN, APPEND, and LISTP, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (EQUAL (FLATTEN X) (LIST Y))
(AND (NLISTP X) (EQUAL X Y)))),
which simplifies, rewriting with the lemmas CAR-CONS and CONS-EQUAL, and
expanding the definitions of FLATTEN, EQUAL, NLISTP, and AND, to:
T.
So we now return to:
(IMPLIES (AND (LISTP A)
(NOT (LISTP Z))
(NOT (EQUAL A (LIST Z)))
(NOT (EQUAL V Z)))
(NOT (EQUAL (APPEND A (LIST Z))
(LIST Z)))),
which we named *1.6 above. You probably did not notice, but this conjecture
is subsumed by another subgoal awaiting our attention, namely *1.5 above.
So next consider:
(IMPLIES (AND (LISTP A)
(NOT (LISTP Z))
(NOT (EQUAL A (LIST Z))))
(NOT (EQUAL (APPEND A (LIST Z))
(LIST Z)))),
which is formula *1.5 above. Let us appeal to the induction principle. There
is only one suggested induction. We will induct according to the following
scheme:
(AND (IMPLIES (AND (LISTP A) (p (CDR A) Z))
(p A Z))
(IMPLIES (NOT (LISTP A)) (p A Z))).
Linear arithmetic and the lemma CDR-LESSP can be used to prove 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 goals:
Case 3. (IMPLIES (AND (NOT (LISTP (CDR A)))
(LISTP A)
(NOT (LISTP Z))
(NOT (EQUAL A (LIST Z))))
(NOT (EQUAL (APPEND A (LIST Z))
(LIST Z)))).
This simplifies, applying the lemmas CAR-CONS and CONS-EQUAL, and expanding
APPEND, to:
T.
Case 2. (IMPLIES (AND (EQUAL (CDR A) (LIST Z))
(LISTP A)
(NOT (LISTP Z))
(NOT (EQUAL A (LIST Z))))
(NOT (EQUAL (APPEND A (LIST Z))
(LIST Z)))).
This simplifies, applying CAR-CONS, and unfolding the function APPEND, to:
(IMPLIES (AND (EQUAL (CDR A) (LIST Z))
(LISTP A)
(NOT (LISTP Z))
(NOT (EQUAL A (CDR A))))
(NOT (EQUAL (CONS (CAR A)
(APPEND (CDR A) (CDR A)))
(CDR A)))).
Appealing to the lemma CAR-CDR-ELIM, we now replace A by (CONS V X) to
eliminate (CDR A) and (CAR A). The result is:
(IMPLIES (AND (EQUAL X (LIST Z))
(NOT (LISTP Z))
(NOT (EQUAL (CONS V X) X)))
(NOT (EQUAL (CONS V (APPEND X X)) X))).
But this further simplifies, applying CAR-CONS, CONS-EQUAL, and CDR-CONS,
and unfolding APPEND and LISTP, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL (APPEND (CDR A) (LIST Z))
(LIST Z)))
(LISTP A)
(NOT (LISTP Z))
(NOT (EQUAL A (LIST Z))))
(NOT (EQUAL (APPEND A (LIST Z))
(LIST Z)))).
This simplifies, appealing to the lemmas CAR-CONS and CONS-EQUAL, and
unfolding the definition of APPEND, to:
T.
That finishes the proof of *1.5.
So we now return to:
(IMPLIES (AND (LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL Z Y))
(NOT (EQUAL A (LIST Y)))
(NOT (EQUAL V Y)))
(NOT (EQUAL (APPEND A U) (LIST Y)))),
which is formula *1.4 above. You probably did not notice, but this conjecture
is subsumed by another subgoal awaiting our attention, namely *1.3 above.
So next consider:
(IMPLIES (AND (LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL Z Y))
(NOT (EQUAL A (LIST Y))))
(NOT (EQUAL (APPEND A U) (LIST Y)))),
which we named *1.3 above. But this conjecture is subsumed by formula *1.2
above.
So let us turn our attention to:
(IMPLIES (AND (LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL A (LIST Y)))
(NOT (EQUAL V Y)))
(NOT (EQUAL (APPEND A U) (LIST Y)))),
named *1.2 above. What luck! This conjecture is subsumed by the subgoal we
named *1.1 above.
So next consider:
(IMPLIES (AND (LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL A (LIST Y))))
(NOT (EQUAL (APPEND A U) (LIST Y)))),
which we named *1.1 above. Perhaps we can prove it by induction. There is
only one plausible induction. We will induct according to the following
scheme:
(AND (IMPLIES (AND (LISTP A) (p (CDR A) U Y))
(p A U Y))
(IMPLIES (NOT (LISTP A)) (p A U Y))).
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 the following three new
goals:
Case 3. (IMPLIES (AND (NOT (LISTP (CDR A)))
(LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL A (LIST Y))))
(NOT (EQUAL (APPEND A U) (LIST Y)))).
This simplifies, appealing to the lemmas CAR-CONS and CONS-EQUAL, and
expanding APPEND, to:
T.
Case 2. (IMPLIES (AND (EQUAL (CDR A) (LIST Y))
(LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL A (LIST Y))))
(NOT (EQUAL (APPEND A U) (LIST Y)))).
This simplifies, appealing to the lemma CAR-CONS, and opening up the
definition of APPEND, to:
(IMPLIES (AND (EQUAL (CDR A) (LIST Y))
(LISTP A)
(LISTP U)
(NOT (EQUAL U (CDR A)))
(NOT (EQUAL A (CDR A))))
(NOT (EQUAL (CONS (CAR A) (APPEND (CDR A) U))
(CDR A)))).
Applying the lemma CAR-CDR-ELIM, replace A by (CONS Z X) to eliminate
(CDR A) and (CAR A). We thus obtain:
(IMPLIES (AND (EQUAL X (LIST Y))
(LISTP U)
(NOT (EQUAL U X))
(NOT (EQUAL (CONS Z X) X)))
(NOT (EQUAL (CONS Z (APPEND X U)) X))),
which further simplifies, rewriting with CAR-CONS, CONS-EQUAL, and CDR-CONS,
and expanding APPEND and LISTP, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL (APPEND (CDR A) U) (LIST Y)))
(LISTP A)
(LISTP U)
(NOT (EQUAL U (LIST Y)))
(NOT (EQUAL A (LIST Y))))
(NOT (EQUAL (APPEND A U) (LIST Y)))).
This simplifies, rewriting with CAR-CONS and CONS-EQUAL, and opening up the
definition of APPEND, to:
T.
That finishes the proof of *1.1, which, consequently, finishes the proof
of *1. Q.E.D.
[ 0.0 0.1 0.1 ]
FLATTEN-SINGLETON
(DEFN LEFTCOUNT
(X)
(IF (NLISTP X)
0
(ADD1 (LEFTCOUNT (CAR X)))))
Linear arithmetic, the lemmas CAR-LESSEQP and CAR-LESSP, and the
definition of NLISTP inform us that the measure (COUNT X) decreases according
to the well-founded relation LESSP in each recursive call. Hence, LEFTCOUNT
is accepted under the principle of definition. From the definition we can
conclude that (NUMBERP (LEFTCOUNT X)) is a theorem.
[ 0.0 0.0 0.0 ]
LEFTCOUNT
(DEFN GOPHER
(X)
(IF (OR (NLISTP X) (NLISTP (CAR X)))
X
(GOPHER (CONS (CAAR X)
(CONS (CDAR X) (CDR X)))))
((LESSP (LEFTCOUNT X))))
Linear arithmetic, the lemmas SUB1-ADD1 and CAR-CONS, and the definitions
of LESSP, LEFTCOUNT, OR, and NLISTP inform us that the measure (LEFTCOUNT X)
decreases according to the well-founded relation LESSP in each recursive call.
Hence, GOPHER is accepted under the principle of definition. Observe that:
(OR (LISTP (GOPHER X))
(EQUAL (GOPHER X) X))
is a theorem.
[ 0.0 0.0 0.0 ]
GOPHER
(PROVE-LEMMA GOPHER-PRESERVES-COUNT
(REWRITE)
(NOT (LESSP (COUNT X) (COUNT (GOPHER X)))))
WARNING: Note that the proposed lemma GOPHER-PRESERVES-COUNT 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. There is only one plausible
induction. We will induct according to the following scheme:
(AND (IMPLIES (OR (NLISTP X) (NLISTP (CAR X)))
(p X))
(IMPLIES (AND (NOT (OR (NLISTP X) (NLISTP (CAR X))))
(p (CONS (CAAR X)
(CONS (CDAR X) (CDR X)))))
(p X))).
Linear arithmetic, the lemmas SUB1-ADD1 and CAR-CONS, and the definitions of
LESSP, LEFTCOUNT, OR, and NLISTP establish that the measure (LEFTCOUNT 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
goals:
Case 2. (IMPLIES (OR (NLISTP X) (NLISTP (CAR X)))
(NOT (LESSP (COUNT X)
(COUNT (GOPHER X))))).
This simplifies, expanding NLISTP, OR, and GOPHER, to the following two new
formulas:
Case 2.2.
(IMPLIES (NOT (LISTP X))
(NOT (LESSP (COUNT X) (COUNT X)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (NOT (LISTP (CAR X)))
(NOT (LESSP (COUNT X) (COUNT X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES
(AND (NOT (OR (NLISTP X) (NLISTP (CAR X))))
(NOT (LESSP (COUNT (CONS (CAAR X)
(CONS (CDAR X) (CDR X))))
(COUNT (GOPHER (CONS (CAAR X)
(CONS (CDAR X) (CDR X))))))))
(NOT (LESSP (COUNT X)
(COUNT (GOPHER X))))),
which simplifies, applying COMMUTATIVITY-OF-PLUS, COUNT-CONS,
COMMUTATIVITY2-OF-PLUS, PLUS-ADD1, and SUB1-ADD1, and unfolding the
functions NLISTP, OR, LESSP, GOPHER, and EQUAL, to the following two new
formulas:
Case 1.2.
(IMPLIES
(AND (LISTP X)
(LISTP (CAR X))
(EQUAL (SUB1 (COUNT (GOPHER (CONS (CAAR X)
(CONS (CDAR X) (CDR X))))))
0)
(NOT (EQUAL (COUNT (GOPHER (CONS (CAAR X)
(CONS (CDAR X) (CDR X)))))
0)))
(NOT (EQUAL (COUNT X) 0))).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS Z V) to
eliminate (CAR X) and (CDR X) and Z by (CONS W D) to eliminate (CAR Z) and
(CDR Z). We must thus prove the formula:
(IMPLIES (AND (EQUAL (SUB1 (COUNT (GOPHER (CONS W (CONS D V)))))
0)
(NOT (EQUAL (COUNT (GOPHER (CONS W (CONS D V))))
0)))
(NOT (EQUAL (COUNT (CONS (CONS W D) V))
0))).
However this further simplifies, applying COMMUTATIVITY-OF-PLUS,
COUNT-CONS, COMMUTATIVITY2-OF-PLUS, and PLUS-ADD1, to:
T.
Case 1.1.
(IMPLIES
(AND
(LISTP X)
(LISTP (CAR X))
(NOT
(LESSP
(PLUS (COUNT (CDR X))
(COUNT (CAAR X))
(COUNT (CDAR X)))
(SUB1 (SUB1 (COUNT (GOPHER (CONS (CAAR X)
(CONS (CDAR X) (CDR X))))))))))
(NOT (LESSP (COUNT X)
(COUNT (GOPHER (CONS (CAAR X)
(CONS (CDAR X) (CDR X)))))))).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS Z V) to
eliminate (CAR X) and (CDR X) and Z by (CONS W D) to eliminate (CAR Z) and
(CDR Z). We must thus prove:
(IMPLIES
(NOT (LESSP (PLUS (COUNT V) (COUNT W) (COUNT D))
(SUB1 (SUB1 (COUNT (GOPHER (CONS W (CONS D V))))))))
(NOT (LESSP (COUNT (CONS (CONS W D) V))
(COUNT (GOPHER (CONS W (CONS D V))))))).
This further simplifies, applying COMMUTATIVITY-OF-PLUS,
COMMUTATIVITY2-OF-PLUS, COUNT-CONS, PLUS-ADD1, and SUB1-ADD1, and
expanding LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
GOPHER-PRESERVES-COUNT
(PROVE-LEMMA LISTP-GOPHER
(REWRITE)
(EQUAL (LISTP (GOPHER X)) (LISTP X)))
Give the conjecture the name *1.
We will appeal to induction. There is only one plausible induction. We
will induct according to the following scheme:
(AND (IMPLIES (OR (NLISTP X) (NLISTP (CAR X)))
(p X))
(IMPLIES (AND (NOT (OR (NLISTP X) (NLISTP (CAR X))))
(p (CONS (CAAR X)
(CONS (CDAR X) (CDR X)))))
(p X))).
Linear arithmetic, the lemmas SUB1-ADD1 and CAR-CONS, and the definitions of
LESSP, LEFTCOUNT, OR, and NLISTP inform us that the measure (LEFTCOUNT 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
conjectures:
Case 2. (IMPLIES (OR (NLISTP X) (NLISTP (CAR X)))
(EQUAL (LISTP (GOPHER X)) (LISTP X))).
This simplifies, expanding the functions NLISTP, OR, GOPHER, and EQUAL, to:
T.
Case 1. (IMPLIES (NOT (OR (NLISTP X) (NLISTP (CAR X))))
(EQUAL (LISTP (GOPHER X)) (LISTP X))).
This simplifies, opening up NLISTP, OR, GOPHER, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LISTP-GOPHER
(DEFN SAMEFRINGE
(X Y)
(IF (OR (NLISTP X) (NLISTP Y))
(EQUAL X Y)
(AND (EQUAL (CAR (GOPHER X))
(CAR (GOPHER Y)))
(SAMEFRINGE (CDR (GOPHER X))
(CDR (GOPHER Y))))))
Linear arithmetic, the lemmas CDR-LESSEQP, GOPHER-PRESERVES-COUNT,
LISTP-GOPHER, and CDR-LESSP, and the definitions of OR and NLISTP can be used
to show that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, SAMEFRINGE is accepted under
the definitional principle. The definition of SAMEFRINGE can be justified in
another way. Linear arithmetic, the lemmas CDR-LESSEQP,
GOPHER-PRESERVES-COUNT, LISTP-GOPHER, and CDR-LESSP, and the definitions of OR
and NLISTP can be used to establish that the measure (COUNT Y) decreases
according to the well-founded relation LESSP in each recursive call. Note
that (OR (FALSEP (SAMEFRINGE X Y)) (TRUEP (SAMEFRINGE X Y))) is a theorem.
[ 0.0 0.0 0.0 ]
SAMEFRINGE
(PROVE-LEMMA GOPHER-RETURNS-LEFTMOST-ATOM
(REWRITE)
(EQUAL (CAR (GOPHER X))
(IF (LISTP X) (CAR (FLATTEN X)) 0)))
This conjecture simplifies, clearly, to two new goals:
Case 2. (IMPLIES (NOT (LISTP X))
(EQUAL (CAR (GOPHER X)) 0)),
which again simplifies, applying CAR-NLISTP, and expanding the definitions
of GOPHER and EQUAL, to:
T.
Case 1. (IMPLIES (LISTP X)
(EQUAL (CAR (GOPHER X))
(CAR (FLATTEN X)))).
Call the above conjecture *1.
We will appeal to induction. Two inductions are suggested by terms in
the conjecture, both of which are unflawed. So we will choose the one
suggested by the largest number of nonprimitive recursive functions. We will
induct according to the following scheme:
(AND (IMPLIES (OR (NLISTP X) (NLISTP (CAR X)))
(p X))
(IMPLIES (AND (NOT (OR (NLISTP X) (NLISTP (CAR X))))
(p (CONS (CAAR X)
(CONS (CDAR X) (CDR X)))))
(p X))).
Linear arithmetic, the lemmas SUB1-ADD1 and CAR-CONS, and the definitions of
LESSP, LEFTCOUNT, OR, and NLISTP can be used to show that the measure
(LEFTCOUNT X) decreases according to the well-founded relation LESSP in each
induction step of the scheme. The above induction scheme produces two new
conjectures:
Case 2. (IMPLIES (AND (OR (NLISTP X) (NLISTP (CAR X)))
(LISTP X))
(EQUAL (CAR (GOPHER X))
(CAR (FLATTEN X)))),
which simplifies, unfolding the definitions of NLISTP, OR, and GOPHER, to
the conjecture:
(IMPLIES (AND (NOT (LISTP (CAR X))) (LISTP X))
(EQUAL (CAR X) (CAR (FLATTEN X)))).
Appealing to the lemma CAR-CDR-ELIM, we now replace X by (CONS Z V) to
eliminate (CAR X) and (CDR X). The result is:
(IMPLIES (NOT (LISTP Z))
(EQUAL Z (CAR (FLATTEN (CONS Z V))))).
But this further simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS,
and opening up FLATTEN, APPEND, and LISTP, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (NLISTP X) (NLISTP (CAR X))))
(EQUAL (CAR (GOPHER (CONS (CAAR X)
(CONS (CDAR X) (CDR X)))))
(CAR (FLATTEN (CONS (CAAR X)
(CONS (CDAR X) (CDR X))))))
(LISTP X))
(EQUAL (CAR (GOPHER X))
(CAR (FLATTEN X)))),
which simplifies, appealing to the lemmas CDR-CONS, CAR-CONS, and
ASSOCIATIVITY-OF-APPEND, and expanding NLISTP, OR, FLATTEN, and GOPHER, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
GOPHER-RETURNS-LEFTMOST-ATOM
(PROVE-LEMMA GOPHER-RETURNS-CORRECT-STATE
(REWRITE)
(EQUAL (FLATTEN (CDR (GOPHER X)))
(IF (LISTP X)
(CDR (FLATTEN X))
(CONS 0 NIL))))
This conjecture simplifies, obviously, to the following two new conjectures:
Case 2. (IMPLIES (NOT (LISTP X))
(EQUAL (FLATTEN (CDR (GOPHER X)))
'(0))).
But this again simplifies, rewriting with CDR-NLISTP, and opening up the
functions GOPHER, FLATTEN, and EQUAL, to:
T.
Case 1. (IMPLIES (LISTP X)
(EQUAL (FLATTEN (CDR (GOPHER X)))
(CDR (FLATTEN X)))).
Call the above conjecture *1.
Perhaps we can prove it by induction. The recursive terms in the
conjecture suggest two inductions, both of which are unflawed. So we will
choose the one suggested by the largest number of nonprimitive recursive
functions. We will induct according to the following scheme:
(AND (IMPLIES (OR (NLISTP X) (NLISTP (CAR X)))
(p X))
(IMPLIES (AND (NOT (OR (NLISTP X) (NLISTP (CAR X))))
(p (CONS (CAAR X)
(CONS (CDAR X) (CDR X)))))
(p X))).
Linear arithmetic, the lemmas SUB1-ADD1 and CAR-CONS, and the definitions of
LESSP, LEFTCOUNT, OR, and NLISTP can be used to show that the measure
(LEFTCOUNT X) decreases according to the well-founded relation LESSP in each
induction step of the scheme. The above induction scheme produces two new
conjectures:
Case 2. (IMPLIES (AND (OR (NLISTP X) (NLISTP (CAR X)))
(LISTP X))
(EQUAL (FLATTEN (CDR (GOPHER X)))
(CDR (FLATTEN X)))),
which simplifies, expanding NLISTP, OR, and GOPHER, to:
(IMPLIES (AND (NOT (LISTP (CAR X))) (LISTP X))
(EQUAL (FLATTEN (CDR X))
(CDR (FLATTEN X)))).
However this again simplifies, rewriting with CDR-CONS and CAR-CONS, and
expanding the functions FLATTEN, APPEND, and LISTP, to:
T.
Case 1. (IMPLIES
(AND (NOT (OR (NLISTP X) (NLISTP (CAR X))))
(EQUAL (FLATTEN (CDR (GOPHER (CONS (CAAR X)
(CONS (CDAR X) (CDR X))))))
(CDR (FLATTEN (CONS (CAAR X)
(CONS (CDAR X) (CDR X))))))
(LISTP X))
(EQUAL (FLATTEN (CDR (GOPHER X)))
(CDR (FLATTEN X)))).
This simplifies, applying CDR-CONS, CAR-CONS, and ASSOCIATIVITY-OF-APPEND,
and expanding the functions NLISTP, OR, FLATTEN, and GOPHER, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
GOPHER-RETURNS-CORRECT-STATE
(PROVE-LEMMA CORRECTNESS-OF-SAMEFRINGE
(REWRITE)
(EQUAL (SAMEFRINGE X Y)
(EQUAL (FLATTEN X) (FLATTEN Y))))
This conjecture simplifies, clearly, to two new goals:
Case 2. (IMPLIES (NOT (EQUAL (FLATTEN X) (FLATTEN Y)))
(NOT (SAMEFRINGE X Y))),
which we will name *1.
Case 1. (IMPLIES (EQUAL (FLATTEN X) (FLATTEN Y))
(EQUAL (SAMEFRINGE X Y) T)).
This again simplifies, clearly, to:
(IMPLIES (EQUAL (FLATTEN X) (FLATTEN Y))
(SAMEFRINGE X Y)),
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 (SAMEFRINGE X Y)
(EQUAL (FLATTEN X) (FLATTEN Y))),
named *1. Let us appeal to the induction principle. Four inductions are
suggested by terms in the conjecture. They merge into three likely candidate
inductions, all of which are unflawed. So we will choose the one suggested by
the largest number of nonprimitive recursive functions. We will induct
according to the following scheme:
(AND (IMPLIES (OR (NLISTP X) (NLISTP Y))
(p X Y))
(IMPLIES (AND (NOT (OR (NLISTP X) (NLISTP Y)))
(p (CDR (GOPHER X)) (CDR (GOPHER Y))))
(p X Y))).
Linear arithmetic, the lemmas CDR-LESSEQP, GOPHER-PRESERVES-COUNT,
LISTP-GOPHER, and CDR-LESSP, and the definitions of OR and NLISTP inform us
that the measure (COUNT X) decreases according to the well-founded relation
LESSP in each induction step of the scheme. Note, however, the inductive
instance chosen for Y. The above induction scheme produces two new formulas:
Case 2. (IMPLIES (OR (NLISTP X) (NLISTP Y))
(EQUAL (SAMEFRINGE X Y)
(EQUAL (FLATTEN X) (FLATTEN Y)))),
which simplifies, applying the lemmas CAR-CONS and FLATTEN-SINGLETON, and
opening up NLISTP, OR, SAMEFRINGE, and FLATTEN, to two new goals:
Case 2.2.
(IMPLIES (AND (NOT (LISTP X)) (EQUAL X Y))
(EQUAL (EQUAL X Y) T)),
which again simplifies, unfolding EQUAL, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (LISTP X)) (EQUAL X Y))
(NOT (LISTP Y))),
which again simplifies, clearly, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (NLISTP X) (NLISTP Y)))
(EQUAL (SAMEFRINGE (CDR (GOPHER X))
(CDR (GOPHER Y)))
(EQUAL (FLATTEN (CDR (GOPHER X)))
(FLATTEN (CDR (GOPHER Y))))))
(EQUAL (SAMEFRINGE X Y)
(EQUAL (FLATTEN X) (FLATTEN Y)))).
This simplifies, applying the lemmas GOPHER-RETURNS-CORRECT-STATE and
GOPHER-RETURNS-LEFTMOST-ATOM, and opening up NLISTP, OR, and SAMEFRINGE, to
the following three new conjectures:
Case 1.3.
(IMPLIES (AND (LISTP X)
(LISTP Y)
(NOT (EQUAL (CDR (FLATTEN X))
(CDR (FLATTEN Y))))
(NOT (SAMEFRINGE (CDR (GOPHER X))
(CDR (GOPHER Y)))))
(NOT (EQUAL (FLATTEN X) (FLATTEN Y)))).
This again simplifies, clearly, to:
T.
Case 1.2.
(IMPLIES (AND (LISTP X)
(LISTP Y)
(EQUAL (CDR (FLATTEN X))
(CDR (FLATTEN Y)))
(EQUAL (SAMEFRINGE (CDR (GOPHER X))
(CDR (GOPHER Y)))
T)
(NOT (EQUAL (FLATTEN X) (FLATTEN Y))))
(NOT (EQUAL (CAR (FLATTEN X))
(CAR (FLATTEN Y))))).
This again simplifies, trivially, to:
T.
Case 1.1.
(IMPLIES (AND (LISTP X)
(LISTP Y)
(EQUAL (CDR (FLATTEN X))
(CDR (FLATTEN Y)))
(EQUAL (SAMEFRINGE (CDR (GOPHER X))
(CDR (GOPHER Y)))
T)
(EQUAL (FLATTEN X) (FLATTEN Y)))
(EQUAL (EQUAL (CAR (FLATTEN X))
(CAR (FLATTEN Y)))
T)).
This again simplifies, trivially, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
CORRECTNESS-OF-SAMEFRINGE
(DEFN PRIME1
(X Y)
(IF (ZEROP Y)
F
(IF (EQUAL Y 1)
T
(AND (NOT (DIVIDES Y X))
(PRIME1 X (SUB1 Y))))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
inform us that the measure (COUNT Y) decreases according to the well-founded
relation LESSP in each recursive call. Hence, PRIME1 is accepted under the
definitional principle. Observe that:
(OR (FALSEP (PRIME1 X Y))
(TRUEP (PRIME1 X Y)))
is a theorem.
[ 0.0 0.0 0.0 ]
PRIME1
(DEFN PRIME
(X)
(AND (NOT (ZEROP X))
(NOT (EQUAL X 1))
(PRIME1 X (SUB1 X))))
Note that (OR (FALSEP (PRIME X)) (TRUEP (PRIME X))) is a theorem.
[ 0.0 0.0 0.0 ]
PRIME
(DEFN GREATEST-FACTOR
(X Y)
(IF (OR (ZEROP Y) (EQUAL Y 1))
X
(IF (DIVIDES Y X)
Y
(GREATEST-FACTOR X (SUB1 Y)))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definitions of
DIVIDES, OR, and ZEROP establish that the measure (COUNT Y) decreases
according to the well-founded relation LESSP in each recursive call. Hence,
GREATEST-FACTOR is accepted under the definitional principle. From the
definition we can conclude that:
(OR (NUMBERP (GREATEST-FACTOR X Y))
(EQUAL (GREATEST-FACTOR X Y) X))
is a theorem.
[ 0.0 0.0 0.0 ]
GREATEST-FACTOR
(PROVE-LEMMA GREATEST-FACTOR-LESSP
(REWRITE)
(IMPLIES (AND (LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (ZEROP X))
(NOT (EQUAL (SUB1 X) 0))
(NOT (ZEROP Y)))
(LESSP (GREATEST-FACTOR X Y) X)))
WARNING: Note that the proposed lemma GREATEST-FACTOR-LESSP is to be stored
as zero type prescription rules, zero compound recognizer rules, one linear
rule, and zero replacement rules.
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES (AND (LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL (SUB1 X) 0))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(LESSP (GREATEST-FACTOR X Y) X)).
Appealing to the lemma SUB1-ELIM, we now replace X by (ADD1 Z) to eliminate
(SUB1 X). We employ the type restriction lemma noted when SUB1 was introduced
to constrain the new variable. This generates:
(IMPLIES (AND (NUMBERP Z)
(LESSP Y (ADD1 Z))
(NOT (PRIME1 (ADD1 Z) Y))
(NOT (EQUAL (ADD1 Z) 0))
(NOT (EQUAL Z 0))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(LESSP (GREATEST-FACTOR (ADD1 Z) Y)
(ADD1 Z))).
This simplifies, rewriting with the lemma SUB1-ADD1, and expanding the
definition of LESSP, to:
(IMPLIES (AND (NUMBERP Z)
(LESSP (SUB1 Y) Z)
(NOT (PRIME1 (ADD1 Z) Y))
(NOT (EQUAL Z 0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL (GREATEST-FACTOR (ADD1 Z) Y)
0)))
(LESSP (SUB1 (GREATEST-FACTOR (ADD1 Z) Y))
Z)).
Appealing to the lemma SUB1-ELIM, we now replace Y by (ADD1 V) to eliminate
(SUB1 Y). We employ the type restriction lemma noted when SUB1 was introduced
to constrain the new variable. This generates:
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(LESSP V Z)
(NOT (PRIME1 (ADD1 Z) (ADD1 V)))
(NOT (EQUAL Z 0))
(NOT (EQUAL (ADD1 V) 0))
(NOT (EQUAL (GREATEST-FACTOR (ADD1 Z) (ADD1 V))
0)))
(LESSP (SUB1 (GREATEST-FACTOR (ADD1 Z) (ADD1 V)))
Z)).
But this further simplifies, rewriting with SUB1-ADD1 and ADD1-EQUAL, and
expanding the definitions of DIVIDES, NUMBERP, PRIME1, GREATEST-FACTOR, and
EQUAL, to the new conjecture:
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(LESSP V Z)
(NOT (EQUAL V 0))
(NOT (PRIME1 (ADD1 Z) V))
(NOT (EQUAL Z 0))
(NOT (EQUAL (REMAINDER (ADD1 Z) (ADD1 V))
0))
(NOT (EQUAL (GREATEST-FACTOR (ADD1 Z) V)
0)))
(LESSP (SUB1 (GREATEST-FACTOR (ADD1 Z) V))
Z)),
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 Y X)
(NOT (PRIME1 X Y))
(NOT (ZEROP X))
(NOT (EQUAL (SUB1 X) 0))
(NOT (ZEROP Y)))
(LESSP (GREATEST-FACTOR X Y) X)),
named *1. Let us appeal to the induction principle. There are five plausible
inductions. They merge into two likely candidate inductions. However, only
one is unflawed. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP Y) (p X Y))
(IMPLIES (AND (NOT (ZEROP Y)) (EQUAL Y 1))
(p X Y))
(IMPLIES (AND (NOT (ZEROP Y))
(NOT (EQUAL Y 1))
(p X (SUB1 Y)))
(p X Y))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT Y) decreases according to the well-founded
relation LESSP in each induction step of the scheme. The above induction
scheme produces five new formulas:
Case 5. (IMPLIES (AND (EQUAL Y 1)
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (ZEROP X))
(NOT (EQUAL (SUB1 X) 0))
(NOT (ZEROP Y)))
(LESSP (GREATEST-FACTOR X Y) X)),
which simplifies, opening up the definitions of SUB1, NUMBERP, EQUAL, LESSP,
and PRIME1, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL Y 1))
(NOT (LESSP (SUB1 Y) X))
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (ZEROP X))
(NOT (EQUAL (SUB1 X) 0))
(NOT (ZEROP Y)))
(LESSP (GREATEST-FACTOR X Y) X)),
which simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP Y 1)
(NOT (EQUAL Y 1))
(NOT (LESSP (SUB1 Y) X))
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (ZEROP X))
(NOT (EQUAL (SUB1 X) 0))
(NOT (ZEROP Y)))
(LESSP (GREATEST-FACTOR X Y) X)).
This again simplifies, applying SUB1-NNUMBERP, and opening up SUB1, NUMBERP,
EQUAL, and LESSP, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL Y 1))
(PRIME1 X (SUB1 Y))
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (ZEROP X))
(NOT (EQUAL (SUB1 X) 0))
(NOT (ZEROP Y)))
(LESSP (GREATEST-FACTOR X Y) X)).
This simplifies, unfolding LESSP, EQUAL, PRIME1, ZEROP, DIVIDES, and
GREATEST-FACTOR, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL Y 1))
(ZEROP (SUB1 Y))
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (ZEROP X))
(NOT (EQUAL (SUB1 X) 0))
(NOT (ZEROP Y)))
(LESSP (GREATEST-FACTOR X Y) X)).
This simplifies, opening up the definitions of ZEROP, LESSP, EQUAL, PRIME1,
REMAINDER, DIFFERENCE, DIVIDES, and GREATEST-FACTOR, to the following two
new formulas:
Case 2.2.
(IMPLIES (AND (NOT (EQUAL Y 1))
(EQUAL (SUB1 Y) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (PRIME1 X (SUB1 Y)))
(NOT (EQUAL (SUB1 X) 0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL (REMAINDER (SUB1 X) Y) 0)))
(LESSP (GREATEST-FACTOR X (SUB1 Y))
X)).
This again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL Y 1))
(EQUAL (SUB1 Y) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (PRIME1 X (SUB1 Y)))
(NOT (EQUAL (SUB1 X) 0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(EQUAL (REMAINDER (SUB1 X) Y) 0))
(LESSP Y X)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL Y 1))
(LESSP (GREATEST-FACTOR X (SUB1 Y)) X)
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (ZEROP X))
(NOT (EQUAL (SUB1 X) 0))
(NOT (ZEROP Y)))
(LESSP (GREATEST-FACTOR X Y) X)),
which simplifies, unfolding LESSP, EQUAL, PRIME1, ZEROP, DIVIDES, and
GREATEST-FACTOR, to:
(IMPLIES (AND (NOT (EQUAL Y 1))
(LESSP (GREATEST-FACTOR X (SUB1 Y)) X)
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP (SUB1 Y) (SUB1 X))
(NOT (PRIME1 X (SUB1 Y)))
(NOT (EQUAL (SUB1 X) 0))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(EQUAL (REMAINDER X Y) 0))
(LESSP Y X)).
But this again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
GREATEST-FACTOR-LESSP
(PROVE-LEMMA GREATEST-FACTOR-DIVIDES
(REWRITE)
(IMPLIES (AND (LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (ZEROP X))
(NOT (EQUAL X 1))
(NOT (ZEROP Y)))
(EQUAL (REMAINDER X (GREATEST-FACTOR X Y))
0)))
This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and
IMPLIES, to the new goal:
(IMPLIES (AND (LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X 1))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL (REMAINDER X (GREATEST-FACTOR X Y))
0)),
which we will name *1.
We will appeal to induction. There are five plausible inductions. They
merge into three likely candidate inductions. However, only one is unflawed.
We will induct according to the following scheme:
(AND (IMPLIES (ZEROP Y) (p X Y))
(IMPLIES (AND (NOT (ZEROP Y)) (EQUAL Y 1))
(p X Y))
(IMPLIES (AND (NOT (ZEROP Y))
(NOT (EQUAL Y 1))
(p X (SUB1 Y)))
(p X Y))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform
us that the measure (COUNT Y) decreases according to the well-founded relation
LESSP in each induction step of the scheme. The above induction scheme
generates the following six new formulas:
Case 6. (IMPLIES (AND (ZEROP Y)
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X 1))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL (REMAINDER X (GREATEST-FACTOR X Y))
0)).
This simplifies, expanding ZEROP, to:
T.
Case 5. (IMPLIES (AND (NOT (ZEROP Y))
(EQUAL Y 1)
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X 1))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL (REMAINDER X (GREATEST-FACTOR X Y))
0)).
This simplifies, unfolding the definitions of ZEROP, NUMBERP, EQUAL, and
PRIME1, to:
T.
Case 4. (IMPLIES (AND (NOT (ZEROP Y))
(NOT (EQUAL Y 1))
(NOT (LESSP (SUB1 Y) X))
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X 1))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL (REMAINDER X (GREATEST-FACTOR X Y))
0)).
This simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP Y))
(NOT (EQUAL Y 1))
(PRIME1 X (SUB1 Y))
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X 1))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL (REMAINDER X (GREATEST-FACTOR X Y))
0)).
This simplifies, expanding the definitions of ZEROP, PRIME1, DIVIDES,
GREATEST-FACTOR, and EQUAL, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP Y))
(NOT (EQUAL Y 1))
(EQUAL (SUB1 Y) 0)
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X 1))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL (REMAINDER X (GREATEST-FACTOR X Y))
0)).
This simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP Y))
(NOT (EQUAL Y 1))
(EQUAL (REMAINDER X
(GREATEST-FACTOR X (SUB1 Y)))
0)
(LESSP Y X)
(NOT (PRIME1 X Y))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X 1))
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL (REMAINDER X (GREATEST-FACTOR X Y))
0)).
This simplifies, opening up the functions ZEROP, PRIME1, DIVIDES,
GREATEST-FACTOR, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
GREATEST-FACTOR-DIVIDES
(PROVE-LEMMA GREATEST-FACTOR-0
(REWRITE)
(EQUAL (EQUAL (GREATEST-FACTOR X Y) 0)
(AND (OR (ZEROP Y) (EQUAL Y 1))
(EQUAL X 0))))
This simplifies, unfolding the definitions of ZEROP, OR, and AND, to the
following seven new formulas:
Case 7. (IMPLIES (AND (EQUAL (GREATEST-FACTOR X Y) 0)
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL Y 1)).
Name the above subgoal *1.
Case 6. (IMPLIES (AND (NOT (EQUAL (GREATEST-FACTOR X Y) 0))
(EQUAL Y 0))
(NOT (EQUAL X 0))).
But this again simplifies, opening up the functions GREATEST-FACTOR and
EQUAL, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL (GREATEST-FACTOR X Y) 0))
(NOT (NUMBERP Y)))
(NOT (EQUAL X 0))),
which again simplifies, unfolding the functions GREATEST-FACTOR and EQUAL,
to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL (GREATEST-FACTOR X Y) 0))
(EQUAL Y 1))
(NOT (EQUAL X 0))),
which again simplifies, opening up the functions GREATEST-FACTOR and EQUAL,
to:
T.
Case 3. (IMPLIES (AND (EQUAL (GREATEST-FACTOR X Y) 0)
(EQUAL Y 0))
(EQUAL (EQUAL X 0) T)),
which again simplifies, unfolding the functions EQUAL and GREATEST-FACTOR,
to:
T.
Case 2. (IMPLIES (AND (EQUAL (GREATEST-FACTOR X Y) 0)
(NOT (NUMBERP Y)))
(EQUAL (EQUAL X 0) T)),
which again simplifies, expanding the definition of GREATEST-FACTOR, to:
T.
Case 1. (IMPLIES (AND (EQUAL (GREATEST-FACTOR X Y) 0)
(EQUAL Y 1))
(EQUAL (EQUAL X 0) T)),
which again simplifies, expanding the definitions of NUMBERP, EQUAL, and
GREATEST-FACTOR, to:
T.
So we now return to:
(IMPLIES (AND (EQUAL (GREATEST-FACTOR X Y) 0)
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL Y 1)),
named *1 above. Let us appeal to the induction principle. There is only one
suggested induction. We will induct according to the following scheme:
(AND (IMPLIES (OR (ZEROP Y) (EQUAL Y 1))
(p Y X))
(IMPLIES (AND (NOT (OR (ZEROP Y) (EQUAL Y 1)))
(DIVIDES Y X))
(p Y X))
(IMPLIES (AND (NOT (OR (ZEROP Y) (EQUAL Y 1)))
(NOT (DIVIDES Y X))
(p (SUB1 Y) X))
(p Y X))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definitions of DIVIDES, OR,
and ZEROP establish that the measure (COUNT Y) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme generates five new goals:
Case 5. (IMPLIES (AND (OR (ZEROP Y) (EQUAL Y 1))
(EQUAL (GREATEST-FACTOR X Y) 0)
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL Y 1)),
which simplifies, expanding the definitions of ZEROP and OR, to:
T.
Case 4. (IMPLIES (AND (NOT (OR (ZEROP Y) (EQUAL Y 1)))
(DIVIDES Y X)
(EQUAL (GREATEST-FACTOR X Y) 0)
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL Y 1)),
which simplifies, opening up the functions ZEROP, OR, DIVIDES,
GREATEST-FACTOR, and EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (OR (ZEROP Y) (EQUAL Y 1)))
(NOT (DIVIDES Y X))
(NOT (EQUAL (GREATEST-FACTOR X (SUB1 Y))
0))
(EQUAL (GREATEST-FACTOR X Y) 0)
(NOT (EQUAL Y 0))
(NUMBERP Y))
(EQUAL Y 1)),
which simplifies, expanding ZEROP, OR, DIVIDES, and GREATEST-FACTOR, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (ZEROP Y) (EQUAL Y 1)))
(NOT (DIVIDES Y X))
(EQUAL (SUB1 Y) 0)
(EQUAL (GREATEST-FACTOR