(BOOT-STRAP THM)
[ 0.0 0.0 0.0 ]
GROUND-ZERO
(ADD-SHELL NLAMBDA NIL NLAMBDAP
((NBIND (ONE-OF NUMBERP) ZERO)
(NBODY (NONE-OF) ZERO)))
[ 0.0 0.0 0.0 ]
NLAMBDA
(ADD-SHELL NCOMB NIL NCOMBP
((NLEFT (NONE-OF) ZERO)
(NRIGHT (NONE-OF) ZERO)))
[ 0.0 0.0 0.0 ]
NCOMB
(DEFN NSUBST
(X Y N)
(IF (NLAMBDAP X)
(IF (EQUAL (NBIND X) N)
X
(NLAMBDA (NBIND X)
(NSUBST (NBODY X) Y N)))
(IF (NCOMBP X)
(NCOMB (NSUBST (NLEFT X) Y N)
(NSUBST (NRIGHT X) Y N))
(IF (NUMBERP X)
(IF (EQUAL X N) Y X)
X))))
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and
NLEFT-LESSP can be used to establish that the measure (COUNT X) decreases
according to the well-founded relation LESSP in each recursive call. Hence,
NSUBST is accepted under the definitional principle. Observe that:
(OR (OR (NUMBERP (NSUBST X Y N))
(NLAMBDAP (NSUBST X Y N))
(NCOMBP (NSUBST X Y N)))
(EQUAL (NSUBST X Y N) X)
(EQUAL (NSUBST X Y N) Y))
is a theorem.
[ 0.0 0.0 0.0 ]
NSUBST
(DEFN NOT-FREE-IN
(X Y)
(IF (NLAMBDAP Y)
(IF (EQUAL X (NBIND Y))
T
(NOT-FREE-IN X (NBODY Y)))
(IF (NCOMBP Y)
(AND (NOT-FREE-IN X (NLEFT Y))
(NOT-FREE-IN X (NRIGHT Y)))
(NOT (EQUAL X Y)))))
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and
NLEFT-LESSP inform us that the measure (COUNT Y) decreases according to the
well-founded relation LESSP in each recursive call. Hence, NOT-FREE-IN is
accepted under the definitional principle. From the definition we can
conclude that (OR (FALSEP (NOT-FREE-IN X Y)) (TRUEP (NOT-FREE-IN X Y))) is a
theorem.
[ 0.0 0.0 0.0 ]
NOT-FREE-IN
(DEFN FREE-FOR
(X Y)
(IF (NLAMBDAP X)
(AND (NOT-FREE-IN (NBIND X) Y)
(FREE-FOR (NBODY X) Y))
(IF (NCOMBP X)
(AND (FREE-FOR (NLEFT X) Y)
(FREE-FOR (NRIGHT X) Y))
T)))
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and
NLEFT-LESSP establish that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each recursive call. Hence, FREE-FOR is
accepted under the definitional principle. Note that:
(OR (FALSEP (FREE-FOR X Y))
(TRUEP (FREE-FOR X Y)))
is a theorem.
[ 0.0 0.0 0.0 ]
FREE-FOR
(DEFN INDEX
(N LIST)
(IF (LISTP LIST)
(IF (EQUAL (CAR LIST) N)
1
(ADD1 (INDEX N (CDR LIST))))
(ADD1 N)))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
recursive call. Hence, INDEX is accepted under the definitional principle.
From the definition we can conclude that (NUMBERP (INDEX N LIST)) is a theorem.
[ 0.0 0.0 0.0 ]
INDEX
(DEFN ALPHA-EQUAL
(A B X Y)
(IF (AND (NLAMBDAP A) (NLAMBDAP B))
(ALPHA-EQUAL (NBODY A)
(NBODY B)
(CONS (NBIND A) X)
(CONS (NBIND B) Y))
(IF (AND (NCOMBP A) (NCOMBP B))
(AND (ALPHA-EQUAL (NLEFT A) (NLEFT B) X Y)
(ALPHA-EQUAL (NRIGHT A)
(NRIGHT B)
X Y))
(IF (AND (NUMBERP A) (NUMBERP B))
(EQUAL (INDEX A X) (INDEX B Y))
(EQUAL A B)))))
Linear arithmetic, the lemmas NBODY-LESSEQP, NBODY-LESSP, NRIGHT-LESSEQP,
NRIGHT-LESSP, NLEFT-LESSEQP, and NLEFT-LESSP, and the definition of AND
establish that the measure (COUNT A) decreases according to the well-founded
relation LESSP in each recursive call. Hence, ALPHA-EQUAL is accepted under
the principle of definition. The definition of ALPHA-EQUAL can be justified
in another way. Linear arithmetic, the lemmas NBODY-LESSEQP, NBODY-LESSP,
NRIGHT-LESSEQP, NRIGHT-LESSP, NLEFT-LESSEQP, and NLEFT-LESSP, and the
definition of AND inform us that the measure (COUNT B) decreases according to
the well-founded relation LESSP in each recursive call. Observe that:
(OR (FALSEP (ALPHA-EQUAL A B X Y))
(TRUEP (ALPHA-EQUAL A B X Y)))
is a theorem.
[ 0.0 0.0 0.0 ]
ALPHA-EQUAL
(DEFN NTERMP
(X)
(IF (NLAMBDAP X)
(NTERMP (NBODY X))
(IF (NCOMBP X)
(AND (NTERMP (NLEFT X))
(NTERMP (NRIGHT X)))
(OR (NUMBERP X) (LITATOM X)))))
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and
NLEFT-LESSP can be used to show that the measure (COUNT X) decreases according
to the well-founded relation LESSP in each recursive call. Hence, NTERMP is
accepted under the definitional principle. Note that:
(OR (FALSEP (NTERMP X))
(TRUEP (NTERMP X)))
is a theorem.
[ 0.0 0.0 0.0 ]
NTERMP
(DEFN NBETA-STEP
(A B)
(IF (EQUAL A B)
T
(IF (NLAMBDAP A)
(AND (NLAMBDAP B)
(EQUAL (NBIND A) (NBIND B))
(NBETA-STEP (NBODY A) (NBODY B)))
(IF (NCOMBP A)
(OR (AND (NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(AND (NCOMBP B)
(NBETA-STEP (NLEFT A) (NLEFT B))
(NBETA-STEP (NRIGHT A) (NRIGHT B))))
F))))
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and
NLEFT-LESSP can be used to establish that the measure (COUNT A) decreases
according to the well-founded relation LESSP in each recursive call. Hence,
NBETA-STEP is accepted under the principle of definition. From the definition
we can conclude that (OR (FALSEP (NBETA-STEP A B)) (TRUEP (NBETA-STEP A B)))
is a theorem.
[ 0.0 0.0 0.0 ]
NBETA-STEP
(DEFN NSTEP
(A B)
(OR (ALPHA-EQUAL A B NIL NIL)
(NBETA-STEP A B)))
Observe that (OR (FALSEP (NSTEP A B)) (TRUEP (NSTEP A B))) is a theorem.
[ 0.0 0.0 0.0 ]
NSTEP
(DEFN NREDUCTION
(A B LIST)
(IF (LISTP LIST)
(AND (NSTEP (CAR LIST) B)
(NREDUCTION A (CAR LIST) (CDR LIST)))
(NSTEP A B)))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
recursive call. Hence, NREDUCTION is accepted under the definitional
principle. From the definition we can conclude that:
(OR (FALSEP (NREDUCTION A B LIST))
(TRUEP (NREDUCTION A B LIST)))
is a theorem.
[ 0.0 0.0 0.0 ]
NREDUCTION
(ADD-SHELL LAMBDA NIL LAMBDAP
((BODY (NONE-OF) ZERO)))
[ 0.0 0.0 0.0 ]
LAMBDA
(ADD-SHELL COMB NIL COMBP
((LEFT (NONE-OF) ZERO)
(RIGHT (NONE-OF) ZERO)))
[ 0.0 0.0 0.0 ]
COMB
(DEFN BUMP
(X N)
(IF (LAMBDAP X)
(LAMBDA (BUMP (BODY X) (ADD1 N)))
(IF (COMBP X)
(COMB (BUMP (LEFT X) N)
(BUMP (RIGHT X) N))
(IF (LESSP N X) (ADD1 X) X))))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
establish that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, BUMP is accepted under the
principle of definition. From the definition we can conclude that:
(OR (OR (NUMBERP (BUMP X N))
(LAMBDAP (BUMP X N))
(COMBP (BUMP X N)))
(EQUAL (BUMP X N) X))
is a theorem.
[ 0.0 0.0 0.0 ]
BUMP
(DEFN SUBST
(X Y N)
(IF (LAMBDAP X)
(LAMBDA (SUBST (BODY X) (BUMP Y 0) (ADD1 N)))
(IF (COMBP X)
(COMB (SUBST (LEFT X) Y N)
(SUBST (RIGHT X) Y N))
(IF (NOT (ZEROP X))
(IF (EQUAL X N)
Y
(IF (LESSP N X) (SUB1 X) X))
X))))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
can be used to establish that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each recursive call. Hence, SUBST is accepted
under the definitional principle. Observe that:
(OR (OR (NUMBERP (SUBST X Y N))
(LAMBDAP (SUBST X Y N))
(COMBP (SUBST X Y N)))
(EQUAL (SUBST X Y N) X)
(EQUAL (SUBST X Y N) Y))
is a theorem.
[ 0.0 0.0 0.0 ]
SUBST
(PROVE-LEMMA BUMP-BUMP
(REWRITE)
(IMPLIES (LEQ N M)
(EQUAL (BUMP (BUMP Y N) (ADD1 M))
(BUMP (BUMP Y M) N))))
Give the conjecture the name *1.
Perhaps we can 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 (AND (LAMBDAP Y)
(p (BODY Y) (ADD1 N) (ADD1 M)))
(p Y N M))
(IMPLIES (AND (NOT (LAMBDAP Y))
(COMBP Y)
(p (LEFT Y) N M)
(p (RIGHT Y) N M))
(p Y N M))
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y))
(p Y N M))
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y)))
(p Y N M))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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. Note,
however, the inductive instances chosen for M and N. The above induction
scheme generates five new conjectures:
Case 5. (IMPLIES (AND (LAMBDAP Y)
(LESSP (ADD1 M) (ADD1 N))
(NOT (LESSP M N)))
(EQUAL (BUMP (BUMP Y N) (ADD1 M))
(BUMP (BUMP Y M) N))),
which simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (LAMBDAP Y)
(EQUAL (BUMP (BUMP (BODY Y) (ADD1 N))
(ADD1 (ADD1 M)))
(BUMP (BUMP (BODY Y) (ADD1 M))
(ADD1 N)))
(NOT (LESSP M N)))
(EQUAL (BUMP (BUMP Y N) (ADD1 M))
(BUMP (BUMP Y M) N))),
which simplifies, applying BODY-LAMBDA, and opening up BUMP, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP Y))
(COMBP Y)
(EQUAL (BUMP (BUMP (LEFT Y) N) (ADD1 M))
(BUMP (BUMP (LEFT Y) M) N))
(EQUAL (BUMP (BUMP (RIGHT Y) N) (ADD1 M))
(BUMP (BUMP (RIGHT Y) M) N))
(NOT (LESSP M N)))
(EQUAL (BUMP (BUMP Y N) (ADD1 M))
(BUMP (BUMP Y M) N))).
This simplifies, rewriting with RIGHT-COMB and LEFT-COMB, and opening up
BUMP, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y)
(NOT (LESSP M N)))
(EQUAL (BUMP (BUMP Y N) (ADD1 M))
(BUMP (BUMP Y M) N))),
which simplifies, applying SUB1-ADD1, and unfolding the functions BUMP and
LESSP, to the following ten new formulas:
Case 2.10.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y)
(NOT (LESSP M N))
(NOT (LESSP M Y))
(NOT (NUMBERP Y))
(NOT (NUMBERP M))
(LESSP 0 0))
(EQUAL (ADD1 (ADD1 Y)) (ADD1 Y))).
However this again simplifies, using linear arithmetic, to:
T.
Case 2.9.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y)
(NOT (LESSP M N))
(NOT (LESSP M Y))
(NOT (NUMBERP Y))
(NUMBERP M)
(LESSP M 0))
(EQUAL (ADD1 (ADD1 Y)) (ADD1 Y))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.8.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y)
(NOT (LESSP M N))
(NOT (LESSP M Y))
(NUMBERP Y)
(NOT (NUMBERP M))
(LESSP 0 Y))
(EQUAL (ADD1 (ADD1 Y)) (ADD1 Y))),
which again simplifies, expanding the functions LESSP and NUMBERP, to:
T.
Case 2.7.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y)
(NOT (LESSP M N))
(NOT (LESSP N (ADD1 Y)))
(NOT (NUMBERP Y))
(NOT (NUMBERP M))
(LESSP 0 0))
(EQUAL (ADD1 (ADD1 Y)) (ADD1 Y))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.6.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y)
(NOT (LESSP M N))
(NOT (LESSP N (ADD1 Y)))
(NOT (NUMBERP Y))
(NUMBERP M)
(LESSP M 0))
(EQUAL (ADD1 (ADD1 Y)) (ADD1 Y))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.5.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y)
(NOT (LESSP M N))
(NOT (LESSP N (ADD1 Y)))
(NUMBERP Y)
(NOT (NUMBERP M))
(LESSP 0 Y))
(EQUAL (ADD1 (ADD1 Y)) (ADD1 Y))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.4.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y)
(NOT (LESSP M N))
(LESSP M Y)
(NOT (LESSP N (ADD1 Y)))
(NUMBERP Y)
(NUMBERP M))
(EQUAL (ADD1 (ADD1 Y)) (ADD1 Y))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y)
(NOT (LESSP M N))
(LESSP M Y)
(LESSP N (ADD1 Y))
(NUMBERP Y)
(NOT (NUMBERP M))
(NOT (LESSP 0 Y)))
(EQUAL (ADD1 Y) (ADD1 (ADD1 Y)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y)
(NOT (LESSP M N))
(LESSP M Y)
(LESSP N (ADD1 Y))
(NOT (NUMBERP Y))
(NUMBERP M)
(NOT (LESSP M 0)))
(EQUAL (ADD1 Y) (ADD1 (ADD1 Y)))),
which again simplifies, expanding the function LESSP, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP N Y)
(NOT (LESSP M N))
(LESSP M Y)
(LESSP N (ADD1 Y))
(NOT (NUMBERP Y))
(NOT (NUMBERP M))
(NOT (LESSP 0 0)))
(EQUAL (ADD1 Y) (ADD1 (ADD1 Y)))),
which again simplifies, opening up LESSP, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N)))
(EQUAL (BUMP (BUMP Y N) (ADD1 M))
(BUMP (BUMP Y M) N))),
which simplifies, applying SUB1-ADD1, and unfolding the functions BUMP and
LESSP, to the following 12 new goals:
Case 1.12.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(LESSP M Y)
(NOT (LESSP N (ADD1 Y)))
(EQUAL Y 0))
(EQUAL Y (ADD1 Y))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.11.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(LESSP M Y)
(NOT (LESSP N (ADD1 Y)))
(NOT (NUMBERP Y)))
(EQUAL Y (ADD1 Y))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.10.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(LESSP M Y)
(NOT (LESSP N (ADD1 Y)))
(NUMBERP M)
(NOT (LESSP M (SUB1 Y))))
(EQUAL Y (ADD1 Y))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.9.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(LESSP M Y)
(NOT (LESSP N (ADD1 Y)))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 Y))))
(EQUAL Y (ADD1 Y))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.8.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(LESSP M Y)
(LESSP N (ADD1 Y))
(EQUAL Y 0))
(EQUAL Y (ADD1 (ADD1 Y)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.7.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(LESSP M Y)
(LESSP N (ADD1 Y))
(NOT (NUMBERP Y)))
(EQUAL Y (ADD1 (ADD1 Y)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.6.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(LESSP M Y)
(LESSP N (ADD1 Y))
(NUMBERP M)
(NOT (LESSP M (SUB1 Y))))
(EQUAL Y (ADD1 (ADD1 Y)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.5.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(LESSP M Y)
(LESSP N (ADD1 Y))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 Y))))
(EQUAL Y (ADD1 (ADD1 Y)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.4.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(LESSP M Y)
(LESSP N (ADD1 Y))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NUMBERP M)
(LESSP M (SUB1 Y)))
(EQUAL (ADD1 Y) (ADD1 (ADD1 Y)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(LESSP M Y)
(LESSP N (ADD1 Y))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (NUMBERP M))
(LESSP 0 (SUB1 Y)))
(EQUAL (ADD1 Y) (ADD1 (ADD1 Y)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(NOT (LESSP M Y))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NUMBERP M)
(LESSP M (SUB1 Y)))
(EQUAL (ADD1 Y) Y)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP N Y))
(NOT (LESSP M N))
(NOT (LESSP M Y))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (NUMBERP M))
(LESSP 0 (SUB1 Y)))
(EQUAL (ADD1 Y) Y)),
which again simplifies, unfolding LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
BUMP-BUMP
(DEFN BUMP-SUBST-INDUCT
(X Y N M)
(IF (LAMBDAP X)
(BUMP-SUBST-INDUCT (BODY X)
(BUMP Y 0)
(ADD1 N)
(ADD1 M))
(IF (COMBP X)
(AND (BUMP-SUBST-INDUCT (LEFT X) Y N M)
(BUMP-SUBST-INDUCT (RIGHT X) Y N M))
T)))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
inform us that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, BUMP-SUBST-INDUCT is accepted
under the principle of definition. From the definition we can conclude that:
(TRUEP (BUMP-SUBST-INDUCT X Y N M))
is a theorem.
[ 0.0 0.0 0.0 ]
BUMP-SUBST-INDUCT
(PROVE-LEMMA BUMP-SUBST
(REWRITE)
(IMPLIES (LESSP M N)
(EQUAL (BUMP (SUBST X Y N) M)
(SUBST (BUMP X M)
(BUMP Y M)
(ADD1 N))))
((INDUCT (BUMP-SUBST-INDUCT X Y N M))))
This conjecture can be simplified, using the abbreviations IMPLIES, NOT, OR,
and AND, to three new formulas:
Case 3. (IMPLIES
(AND (LAMBDAP X)
(IMPLIES (LESSP (ADD1 M) (ADD1 N))
(EQUAL (BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
(ADD1 M))
(SUBST (BUMP (BODY X) (ADD1 M))
(BUMP (BUMP Y 0) (ADD1 M))
(ADD1 (ADD1 N)))))
(LESSP M N))
(EQUAL (BUMP (SUBST X Y N) M)
(SUBST (BUMP X M)
(BUMP Y M)
(ADD1 N)))),
which simplifies, using linear arithmetic, appealing to the lemmas SUB1-ADD1,
BUMP-BUMP, SUB1-TYPE-RESTRICTION, and BODY-LAMBDA, and unfolding the
definitions of LESSP, IMPLIES, SUBST, and BUMP, to:
(IMPLIES (AND (LAMBDAP X)
(NUMBERP N)
(NOT (NUMBERP M))
(NOT (LESSP 0 N))
(NOT (EQUAL N 0)))
(EQUAL (LAMBDA (BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
1))
(SUBST (BUMP X M)
(BUMP Y M)
(ADD1 N)))).
This again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(IMPLIES (LESSP M N)
(EQUAL (BUMP (SUBST (RIGHT X) Y N) M)
(SUBST (BUMP (RIGHT X) M)
(BUMP Y M)
(ADD1 N))))
(IMPLIES (LESSP M N)
(EQUAL (BUMP (SUBST (LEFT X) Y N) M)
(SUBST (BUMP (LEFT X) M)
(BUMP Y M)
(ADD1 N))))
(LESSP M N))
(EQUAL (BUMP (SUBST X Y N) M)
(SUBST (BUMP X M)
(BUMP Y M)
(ADD1 N)))),
which simplifies, applying RIGHT-COMB and LEFT-COMB, and opening up the
functions IMPLIES, SUBST, and BUMP, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N))
(EQUAL (BUMP (SUBST X Y N) M)
(SUBST (BUMP X M)
(BUMP Y M)
(ADD1 N)))).
This simplifies, rewriting with SUB1-ADD1, and opening up the definitions of
SUBST, BUMP, and LESSP, to 45 new goals:
Case 1.45.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 (ADD1 X)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (BUMP (SUB1 X) M)
(SUB1 (ADD1 X)))),
which again simplifies, opening up LESSP, to:
T.
Case 1.44.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 (ADD1 X)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (BUMP (SUB1 X) M)
(SUB1 (ADD1 X)))),
which again simplifies, appealing to the lemmas ADD1-EQUAL, SUB1-ADD1, and
ADD1-SUB1, and unfolding BUMP, to:
(IMPLIES (AND (LESSP M N)
(LESSP M X)
(NUMBERP N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(NOT (LESSP M (SUB1 X))))
(EQUAL (SUB1 X) X)).
But this again simplifies, using linear arithmetic, to:
T.
Case 1.43.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 (ADD1 X)))
(NOT (EQUAL X 0))
(NOT (NUMBERP X)))
(EQUAL (BUMP X M) (SUB1 (ADD1 X)))),
which again simplifies, unfolding the function LESSP, to:
T.
Case 1.42.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 (ADD1 X)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (SUB1 (ADD1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.41.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 (ADD1 X)))
(NOT (EQUAL X 0))
(NOT (NUMBERP X)))
(EQUAL (BUMP X M) (SUB1 (ADD1 X)))),
which again simplifies, opening up LESSP, to:
T.
Case 1.40.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 (ADD1 X)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (SUB1 (ADD1 X)))),
which again simplifies, unfolding the function LESSP, to:
T.
Case 1.39.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 (ADD1 X)))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N))
(EQUAL (BUMP Y M) (SUB1 (ADD1 X)))),
which again simplifies, trivially, to:
T.
Case 1.38.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 (ADD1 X)))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N))
(EQUAL (BUMP Y M) (SUB1 (ADD1 X)))).
This again simplifies, trivially, to:
T.
Case 1.37.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 (ADD1 X)))
(EQUAL X 0))
(EQUAL (BUMP 0 M) (SUB1 (ADD1 X)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.36.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 (ADD1 X)))
(EQUAL X 0))
(EQUAL (BUMP 0 M) (SUB1 (ADD1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.35.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(EQUAL (ADD1 X) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (BUMP (SUB1 X) M) (ADD1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.34.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 (ADD1 X))))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (BUMP (SUB1 X) M) (ADD1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.33.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 (ADD1 X))))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (BUMP (SUB1 X) M) (ADD1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.32.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(EQUAL (ADD1 X) 0)
(NOT (EQUAL X 0))
(NOT (NUMBERP X)))
(EQUAL (BUMP X M) (ADD1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.31.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(EQUAL (ADD1 X) 0)
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (ADD1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.30.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 (ADD1 X))))
(NOT (EQUAL X 0))
(NOT (NUMBERP X)))
(EQUAL (BUMP X M) (ADD1 X))),
which again simplifies, unfolding LESSP, to:
T.
Case 1.29.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 (ADD1 X))))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (ADD1 X))),
which again simplifies, rewriting with the lemmas ADD1-EQUAL and SUB1-ADD1,
and expanding the definition of BUMP, to:
T.
Case 1.28.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 (ADD1 X))))
(NOT (EQUAL X 0))
(NOT (NUMBERP X)))
(EQUAL (BUMP X M) (ADD1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.27.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 (ADD1 X))))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (ADD1 X))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 (ADD1 X))))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (ADD1 X))).
But this again simplifies, using linear arithmetic, to:
T.
Case 1.26.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(EQUAL (ADD1 X) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N))
(EQUAL (BUMP Y M) (ADD1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.25.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 (ADD1 X))))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N))
(EQUAL (BUMP Y M) (ADD1 X))),
which again simplifies, obviously, to:
T.
Case 1.24.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 (ADD1 X))))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N))
(EQUAL (BUMP Y M) (ADD1 X))).
This again simplifies, clearly, to:
T.
Case 1.23.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(EQUAL (ADD1 X) 0)
(EQUAL X 0))
(EQUAL (BUMP 0 M) (ADD1 X))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.22.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 (ADD1 X))))
(EQUAL X 0))
(EQUAL (BUMP 0 M) (ADD1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.21.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 (ADD1 X))))
(EQUAL X 0))
(EQUAL (BUMP 0 M) (ADD1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.20.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (ADD1 N))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (BUMP (SUB1 X) M) (BUMP Y M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.19.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X (ADD1 N))
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (BUMP (SUB1 X) M) (BUMP Y M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.18.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X (ADD1 N))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (BUMP Y M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.17.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (ADD1 N))
(NOT (EQUAL X 0))
(NOT (NUMBERP X)))
(EQUAL (BUMP X M) (BUMP Y M))),
which again simplifies, unfolding the function LESSP, to:
T.
Case 1.16.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (ADD1 N))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (BUMP Y M))),
which again simplifies, using linear arithmetic, to three new conjectures:
Case 1.16.3.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (ADD1 N))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (BUMP Y M))),
which again simplifies, expanding the function LESSP, to:
T.
Case 1.16.2.
(IMPLIES (AND (NOT (NUMBERP N))
(NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (ADD1 N))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (BUMP Y M))),
which again simplifies, expanding LESSP, to:
T.
Case 1.16.1.
(IMPLIES (AND (NUMBERP N)
(NUMBERP X)
(NOT (LAMBDAP N))
(NOT (COMBP N))
(LESSP M N)
(LESSP M N)
(NOT (EQUAL (ADD1 N) 0))
(EQUAL (ADD1 N) (ADD1 N))
(NOT (EQUAL N 0))
(NOT (EQUAL N N))
(NOT (LESSP N N)))
(EQUAL (BUMP N M) (BUMP Y M))),
which again simplifies, clearly, to:
T.
Case 1.15.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(LESSP M X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (ADD1 N))
(EQUAL X 0))
(EQUAL (BUMP 0 M) (BUMP Y M))).
But this again simplifies, using linear arithmetic, to:
T.
Case 1.14.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 X))
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (BUMP (SUB1 X) M) (SUB1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.13.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X))
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (BUMP (SUB1 X) M) (SUB1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.12.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 X))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (SUB1 X))),
which again simplifies, unfolding LESSP, to:
T.
Case 1.11.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) (SUB1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.10.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 X))
(EQUAL X N))
(EQUAL (BUMP Y M) (SUB1 X))),
which again simplifies, trivially, to:
T.
Case 1.9.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X))
(EQUAL X N))
(EQUAL (BUMP Y M) (SUB1 X))).
This again simplifies, obviously, to:
T.
Case 1.8.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 X)))
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (BUMP (SUB1 X) M) X)).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.7.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 X)))
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (BUMP (SUB1 X) M) X)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.6.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NOT (NUMBERP X)))
(EQUAL (BUMP X M) X)),
which again simplifies, expanding LESSP and BUMP, to:
T.
Case 1.5.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 X)))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) X)),
which again simplifies, expanding BUMP, to:
T.
Case 1.4.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 X)))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) X)),
which again simplifies, using linear arithmetic, to two new goals:
Case 1.4.2.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 X)))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (BUMP X M) X)),
which again simplifies, expanding the definition of LESSP, to:
T.
Case 1.4.1.
(IMPLIES (AND (NUMBERP X)
(NOT (LAMBDAP 1))
(NOT (COMBP 1))
(LESSP M N)
(NOT (LESSP M 1))
(NOT (EQUAL 1 0))
(NOT (EQUAL 1 (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 1)))
(NOT (EQUAL 1 N))
(NOT (LESSP N 1)))
(EQUAL (BUMP 1 M) 1)),
which again simplifies, opening up the definitions of LAMBDAP, COMBP,
and LESSP, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 X)))
(EQUAL X N))
(EQUAL (BUMP Y M) X)),
which again simplifies, obviously, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 X)))
(EQUAL X N))
(EQUAL (BUMP Y M) X)).
This again simplifies, clearly, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP M N)
(NOT (LESSP M X))
(EQUAL X 0))
(EQUAL (BUMP 0 M) X)).
However this again simplifies, opening up the functions LAMBDAP, COMBP,
EQUAL, LESSP, and BUMP, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
BUMP-SUBST
(DEFN SUBST-INDUCT
(X Y Z M N)
(IF (LAMBDAP X)
(SUBST-INDUCT (BODY X)
(BUMP Y 0)
(BUMP Z 0)
(ADD1 M)
(ADD1 N))
(IF (COMBP X)
(AND (SUBST-INDUCT (LEFT X) Y Z M N)
(SUBST-INDUCT (RIGHT X) Y Z M N))
T)))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
can be used to show that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each recursive call. Hence, SUBST-INDUCT is
accepted under the principle of definition. Note that:
(TRUEP (SUBST-INDUCT X Y Z M N))
is a theorem.
[ 0.0 0.0 0.0 ]
SUBST-INDUCT
(PROVE-LEMMA LAMBDAP-BUMP
(REWRITE)
(IMPLIES (LAMBDAP X)
(LAMBDAP (BUMP X N))))
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 (AND (LAMBDAP X)
(p (BODY X) (ADD1 N)))
(p X N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(p (RIGHT X) N)
(p (LEFT X) N))
(p X N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP N X))
(p X N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X)))
(p X N))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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 instances chosen for N. The above induction scheme
generates the following two new formulas:
Case 2. (IMPLIES (AND (NOT (LAMBDAP (BODY X)))
(LAMBDAP X))
(LAMBDAP (BUMP X N))).
This simplifies, expanding the definition of BUMP, to:
T.
Case 1. (IMPLIES (AND (LAMBDAP (BUMP (BODY X) (ADD1 N)))
(LAMBDAP X))
(LAMBDAP (BUMP X N))).
This simplifies, opening up the function BUMP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LAMBDAP-BUMP
(PROVE-LEMMA LAMBDAP-SUBST
(REWRITE)
(IMPLIES (LAMBDAP X)
(LAMBDAP (SUBST X Y N))))
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 (AND (LAMBDAP X)
(p (BODY X) (BUMP Y 0) (ADD1 N)))
(p X Y N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(p (RIGHT X) Y N)
(p (LEFT X) Y N))
(p X Y N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (ZEROP X))
(EQUAL X N))
(p X Y N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (ZEROP X))
(NOT (EQUAL X N))
(LESSP N X))
(p X Y N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (ZEROP X))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(p X Y N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(ZEROP X))
(p X Y N))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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 N. The above induction scheme produces
the following two new goals:
Case 2. (IMPLIES (AND (NOT (LAMBDAP (BODY X)))
(LAMBDAP X))
(LAMBDAP (SUBST X Y N))).
This simplifies, expanding SUBST, to:
T.
Case 1. (IMPLIES (AND (LAMBDAP (SUBST (BODY X) (BUMP Y 0) (ADD1 N)))
(LAMBDAP X))
(LAMBDAP (SUBST X Y N))).
This simplifies, unfolding SUBST, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LAMBDAP-SUBST
(PROVE-LEMMA ANOTHER-BUMP-SUBST
(REWRITE)
(IMPLIES (LEQ N (ADD1 M))
(EQUAL (SUBST (BUMP X (ADD1 M)) (BUMP Y M) N)
(BUMP (SUBST X Y N) M)))
((INDUCT (BUMP-SUBST-INDUCT X Y N M))))
This conjecture can be simplified, using the abbreviations IMPLIES, NOT, OR,
and AND, to three new formulas:
Case 3. (IMPLIES
(AND (LAMBDAP X)
(IMPLIES (IF (LESSP (ADD1 (ADD1 M)) (ADD1 N))
F T)
(EQUAL (SUBST (BUMP (BODY X) (ADD1 (ADD1 M)))
(BUMP (BUMP Y 0) (ADD1 M))
(ADD1 N))
(BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
(ADD1 M))))
(NOT (LESSP (ADD1 M) N)))
(EQUAL (SUBST (BUMP X (ADD1 M)) (BUMP Y M) N)
(BUMP (SUBST X Y N) M))),
which simplifies, using linear arithmetic, rewriting with SUB1-ADD1,
BUMP-BUMP, SUB1-TYPE-RESTRICTION, and BODY-LAMBDA, and opening up the
definitions of LESSP, IMPLIES, SUB1, NUMBERP, EQUAL, BUMP, ADD1, and SUBST,
to the following three new goals:
Case 3.3.
(IMPLIES (AND (LAMBDAP X)
(EQUAL (SUBST (BUMP (BODY X) (ADD1 (ADD1 M)))
(BUMP (BUMP Y M) 0)
(ADD1 N))
(BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
(ADD1 M)))
(EQUAL N 0))
(EQUAL (LAMBDA (SUBST (BUMP (BODY X) (ADD1 (ADD1 M)))
(BUMP (BUMP Y M) 0)
1))
(BUMP (SUBST X Y 0) M))).
This again simplifies, clearly, to:
(IMPLIES (AND (LAMBDAP X)
(EQUAL (SUBST (BUMP (BODY X) (ADD1 (ADD1 M)))
(BUMP (BUMP Y M) 0)
1)
(BUMP (SUBST (BODY X) (BUMP Y 0) 1)
(ADD1 M))))
(EQUAL (LAMBDA (BUMP (SUBST (BODY X) (BUMP Y 0) 1)
(ADD1 M)))
(BUMP (SUBST X Y 0) M))),
which again simplifies, rewriting with the lemma BODY-LAMBDA, and opening
up the definitions of ADD1, SUBST, and BUMP, to:
T.
Case 3.2.
(IMPLIES (AND (LAMBDAP X)
(EQUAL (SUBST (BUMP (BODY X) (ADD1 (ADD1 M)))
(BUMP (BUMP Y M) 0)
(ADD1 N))
(BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
(ADD1 M)))
(NOT (NUMBERP N)))
(EQUAL (LAMBDA (SUBST (BUMP (BODY X) (ADD1 (ADD1 M)))
(BUMP (BUMP Y M) 0)
1))
(BUMP (SUBST X Y N) M))),
which again simplifies, rewriting with SUB1-TYPE-RESTRICTION, to the new
formula:
(IMPLIES (AND (LAMBDAP X)
(EQUAL (SUBST (BUMP (BODY X) (ADD1 (ADD1 M)))
(BUMP (BUMP Y M) 0)
1)
(BUMP (SUBST (BODY X) (BUMP Y 0) 1)
(ADD1 M)))
(NOT (NUMBERP N)))
(EQUAL (LAMBDA (BUMP (SUBST (BODY X) (BUMP Y 0) 1)
(ADD1 M)))
(BUMP (SUBST X Y N) M))),
which again simplifies, rewriting with SUB1-TYPE-RESTRICTION and
BODY-LAMBDA, and expanding SUBST and BUMP, to:
T.
Case 3.1.
(IMPLIES (AND (LAMBDAP X)
(EQUAL (SUBST (BUMP (BODY X) (ADD1 (ADD1 M)))
(BUMP (BUMP Y M) 0)
(ADD1 N))
(BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
(ADD1 M)))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N))))
(EQUAL (SUBST (BUMP X 1) (BUMP Y M) N)
(LAMBDA (BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
1)))).
But this again simplifies, rewriting with SUB1-TYPE-RESTRICTION, and
expanding ADD1, EQUAL, and LESSP, to the new goal:
(IMPLIES (AND (LAMBDAP X)
(EQUAL (SUBST (BUMP (BODY X) 2)
(BUMP (BUMP Y M) 0)
(ADD1 N))
(BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
1))
(NOT (NUMBERP M))
(EQUAL (SUB1 N) 0))
(EQUAL (SUBST (BUMP X 1) (BUMP Y M) N)
(LAMBDA (BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
1)))),
which again simplifies, using linear arithmetic, appealing to the lemmas
BUMP-BUMP, BUMP-SUBST, and BODY-LAMBDA, and expanding the definitions of
LESSP, ADD1, BUMP, and SUBST, to two new formulas:
Case 3.1.2.
(IMPLIES (AND (LAMBDAP X)
(LESSP N 1)
(EQUAL (SUBST (BUMP (BODY X) 2)
(BUMP (BUMP Y M) 0)
(ADD1 N))
(BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
1))
(NOT (NUMBERP M))
(EQUAL (SUB1 N) 0)
(LESSP N 1))
(EQUAL (SUBST (BUMP X 1) (BUMP Y M) N)
(LAMBDA (BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
1)))),
which again simplifies, rewriting with BODY-LAMBDA,
SUB1-TYPE-RESTRICTION, and SUB1-NNUMBERP, and opening up the definitions
of LESSP, SUB1, NUMBERP, EQUAL, ADD1, BUMP, and SUBST, to:
T.
Case 3.1.1.
(IMPLIES (AND (LAMBDAP X)
(NOT (LESSP N 1))
(EQUAL (SUBST (BUMP (BODY X) 2)
(BUMP (BUMP Y M) 0)
(ADD1 N))
(SUBST (BUMP (BODY X) 1)
(BUMP (BUMP Y 0) 0)
(ADD1 (ADD1 N))))
(NOT (NUMBERP M))
(EQUAL (SUB1 N) 0)
(LESSP N 1))
(EQUAL (SUBST (BUMP X 1) (BUMP Y M) N)
(LAMBDA (BUMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N))
1)))).
This again simplifies, clearly, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(IMPLIES (IF (LESSP (ADD1 M) N) F T)
(EQUAL (SUBST (BUMP (RIGHT X) (ADD1 M))
(BUMP Y M)
N)
(BUMP (SUBST (RIGHT X) Y N) M)))
(IMPLIES (IF (LESSP (ADD1 M) N) F T)
(EQUAL (SUBST (BUMP (LEFT X) (ADD1 M))
(BUMP Y M)
N)
(BUMP (SUBST (LEFT X) Y N) M)))
(NOT (LESSP (ADD1 M) N)))
(EQUAL (SUBST (BUMP X (ADD1 M)) (BUMP Y M) N)
(BUMP (SUBST X Y N) M))).
This simplifies, applying SUB1-ADD1, SUB1-TYPE-RESTRICTION, BUMP-SUBST,
RIGHT-COMB, and LEFT-COMB, and expanding LESSP, IMPLIES, SUB1, NUMBERP,
EQUAL, BUMP, and SUBST, to two new formulas:
Case 2.2.
(IMPLIES (AND (COMBP X)
(EQUAL (SUBST (BUMP (RIGHT X) (ADD1 M))
(BUMP Y M)
N)
(BUMP (SUBST (RIGHT X) Y N) M))
(EQUAL (SUBST (BUMP (LEFT X) (ADD1 M))
(BUMP Y M)
N)
(BUMP (SUBST (LEFT X) Y N) M))
(EQUAL N 0))
(EQUAL (COMB (SUBST (BUMP (LEFT X) (ADD1 M))
(BUMP Y M)
0)
(SUBST (BUMP (RIGHT X) (ADD1 M))
(BUMP Y M)
0))
(BUMP (SUBST X Y 0) M))),
which again simplifies, trivially, to:
(IMPLIES (AND (COMBP X)
(EQUAL (SUBST (BUMP (RIGHT X) (ADD1 M))
(BUMP Y M)
0)
(BUMP (SUBST (RIGHT X) Y 0) M))
(EQUAL (SUBST (BUMP (LEFT X) (ADD1 M))
(BUMP Y M)
0)
(BUMP (SUBST (LEFT X) Y 0) M)))
(EQUAL (COMB (BUMP (SUBST (LEFT X) Y 0) M)
(BUMP (SUBST (RIGHT X) Y 0) M))
(BUMP (SUBST X Y 0) M))),
which again simplifies, rewriting with RIGHT-COMB and LEFT-COMB, and
opening up the functions SUBST and BUMP, to:
T.
Case 2.1.
(IMPLIES (AND (COMBP X)
(EQUAL (SUBST (BUMP (RIGHT X) (ADD1 M))
(BUMP Y M)
N)
(BUMP (SUBST (RIGHT X) Y N) M))
(EQUAL (SUBST (BUMP (LEFT X) (ADD1 M))
(BUMP Y M)
N)
(BUMP (SUBST (LEFT X) Y N) M))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N))))
(EQUAL (SUBST (BUMP X 1) (BUMP Y M) N)
(COMB (BUMP (SUBST (LEFT X) Y N) M)
(BUMP (SUBST (RIGHT X) Y N) M)))).
This again simplifies, rewriting with SUB1-TYPE-RESTRICTION, and expanding
the functions EQUAL and LESSP, to:
(IMPLIES (AND (COMBP X)
(EQUAL (SUBST (BUMP (RIGHT X) 1)
(BUMP Y M)
N)
(BUMP (SUBST (RIGHT X) Y N) M))
(EQUAL (SUBST (BUMP (LEFT X) 1) (BUMP Y M) N)
(BUMP (SUBST (LEFT X) Y N) M))
(NOT (NUMBERP M))
(EQUAL (SUB1 N) 0))
(EQUAL (SUBST (BUMP X 1) (BUMP Y M) N)
(COMB (BUMP (SUBST (LEFT X) Y N) M)
(BUMP (SUBST (RIGHT X) Y N) M)))),
which again simplifies, using linear arithmetic, applying BUMP-SUBST,
RIGHT-COMB, and LEFT-COMB, and unfolding BUMP and SUBST, to the following
two new goals:
Case 2.1.2.
(IMPLIES (AND (COMBP X)
(LESSP N 1)
(EQUAL (SUBST (BUMP (RIGHT X) 1)
(BUMP Y M)
N)
(BUMP (SUBST (RIGHT X) Y N) M))
(LESSP N 1)
(EQUAL (SUBST (BUMP (LEFT X) 1) (BUMP Y M) N)
(BUMP (SUBST (LEFT X) Y N) M))
(NOT (NUMBERP M))
(EQUAL (SUB1 N) 0)
(LESSP N 1))
(EQUAL (SUBST (BUMP X 1) (BUMP Y M) N)
(COMB (BUMP (SUBST (LEFT X) Y N) M)
(BUMP (SUBST (RIGHT X) Y N) M)))).
But this again simplifies, appealing to the lemmas RIGHT-COMB, LEFT-COMB,
and SUB1-NNUMBERP, and opening up the definitions of LESSP, SUB1,
NUMBERP, EQUAL, BUMP, and SUBST, to:
T.
Case 2.1.1.
(IMPLIES (AND (COMBP X)
(NOT (LESSP N 1))
(EQUAL (SUBST (BUMP (RIGHT X) 1)
(BUMP Y M)
N)
(SUBST (BUMP (RIGHT X) M)
(BUMP Y M)
(ADD1 N)))
(NOT F)
(EQUAL (SUBST (BUMP (LEFT X) 1) (BUMP Y M) N)
(SUBST (BUMP (LEFT X) M)
(BUMP Y M)
(ADD1 N)))
(NOT (NUMBERP M))
(EQUAL (SUB1 N) 0)
(LESSP N 1))
(EQUAL (SUBST (BUMP X 1) (BUMP Y M) N)
(COMB (BUMP (SUBST (LEFT X) Y N) M)
(BUMP (SUBST (RIGHT X) Y N) M)))),
which again simplifies, clearly, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP (ADD1 M) N)))
(EQUAL (SUBST (BUMP X (ADD1 M)) (BUMP Y M) N)
(BUMP (SUBST X Y N) M))).
This simplifies, applying the lemmas SUB1-ADD1 and SUB1-TYPE-RESTRICTION,
and expanding the functions LESSP, BUMP, EQUAL, and SUBST, to the following
56 new goals:
Case 1.56.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(EQUAL N 0)
(EQUAL X 0)
(LESSP M 0))
(EQUAL X 1)).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.55.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(EQUAL N 0)
(NOT (EQUAL X 0))
(NOT (NUMBERP X))
(LESSP M X))
(EQUAL X (ADD1 X))),
which again simplifies, unfolding LESSP, to:
T.
Case 1.54.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(EQUAL N 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (SUB1 X)))
(NOT (NUMBERP M))
(LESSP 0 (SUB1 X))
(NOT (EQUAL (ADD1 X) 0)))
(EQUAL (SUB1 (ADD1 X)) (SUB1 X))),
which again simplifies, opening up the definition of LESSP, to:
T.
Case 1.53.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(EQUAL N 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (SUB1 X)))
(NOT (NUMBERP M))
(LESSP 0 (SUB1 X))
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (SUB1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.52.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(EQUAL N 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP M (SUB1 X))
(NUMBERP M)
(NOT (EQUAL (ADD1 X) 0)))
(EQUAL (SUB1 (ADD1 X))
(ADD1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.51.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(EQUAL N 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP M (SUB1 X))
(LESSP 0 (SUB1 X))
(NOT (EQUAL (ADD1 X) 0)))
(EQUAL (SUB1 (ADD1 X))
(ADD1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.50.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(EQUAL N 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP M (SUB1 X))
(NUMBERP M)
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (ADD1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.49.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(EQUAL N 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP M (SUB1 X))
(LESSP 0 (SUB1 X))
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (ADD1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.48.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(EQUAL N 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP M (SUB1 X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 X))))
(EQUAL (SUB1 X) (ADD1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.47.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP N))
(EQUAL X 0)
(LESSP M 0))
(EQUAL X 1)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.46.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP N))
(NOT (EQUAL X 0))
(NOT (NUMBERP X))
(LESSP M X))
(EQUAL X (ADD1 X))),
which again simplifies, expanding the function LESSP, to:
T.
Case 1.45.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP N))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (SUB1 X)))
(NOT (NUMBERP M))
(LESSP 0 (SUB1 X))
(NOT (EQUAL (ADD1 X) 0)))
(EQUAL (SUB1 (ADD1 X)) (SUB1 X))),
which again simplifies, opening up LESSP, to:
T.
Case 1.44.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP N))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (SUB1 X)))
(NOT (NUMBERP M))
(LESSP 0 (SUB1 X))
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (SUB1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.43.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP N))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP M (SUB1 X))
(NUMBERP M)
(NOT (EQUAL (ADD1 X) 0)))
(EQUAL (SUB1 (ADD1 X))
(ADD1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.42.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP N))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP M (SUB1 X))
(LESSP 0 (SUB1 X))
(NOT (EQUAL (ADD1 X) 0)))
(EQUAL (SUB1 (ADD1 X))
(ADD1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.41.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP N))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP M (SUB1 X))
(NUMBERP M)
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (ADD1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.40.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP N))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP M (SUB1 X))
(LESSP 0 (SUB1 X))
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (ADD1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.39.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP N))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP M (SUB1 X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 X))))
(EQUAL (SUB1 X) (ADD1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.38.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) N))
(LESSP N (ADD1 X)))
(EQUAL (SUB1 (ADD1 X))
(BUMP (SUB1 X) M))),
which again simplifies, applying the lemmas SUB1-ADD1 and ADD1-SUB1, and
unfolding the functions EQUAL, LESSP, and BUMP, to:
(IMPLIES (AND (NOT (NUMBERP M))
(EQUAL (SUB1 N) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) N)))
(NOT (EQUAL (SUB1 X) 0))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.37.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(LESSP 1 X)
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (BUMP (SUB1 X) M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.36.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) N))
(NOT (LESSP N (ADD1 X))))
(EQUAL (ADD1 X) (BUMP (SUB1 X) M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.35.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) N))
(EQUAL (BUMP Y M) (BUMP (SUB1 X) M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.34.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(NOT (LESSP 1 X)))
(EQUAL (SUB1 X) (BUMP (SUB1 X) M))),
which again simplifies, using linear arithmetic, to the conjecture:
(IMPLIES (AND (NOT (LAMBDAP 1))
(NOT (COMBP 1))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL 1 0))
(NUMBERP 1)
(NOT (EQUAL 1 N))
(LESSP N 1)
(NOT (LESSP 1 1)))
(EQUAL (SUB1 1) (BUMP (SUB1 1) M))).
But this again simplifies, unfolding the functions LAMBDAP, COMBP, EQUAL,
LESSP, NUMBERP, SUB1, and BUMP, to:
T.
Case 1.33.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (NUMBERP X))
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) N))
(LESSP N (ADD1 X)))
(EQUAL (SUB1 (ADD1 X)) (BUMP X M))),
which again simplifies, opening up EQUAL and LESSP, to:
T.
Case 1.32.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) N))
(LESSP N (ADD1 X)))
(EQUAL (SUB1 (ADD1 X)) (BUMP X M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.31.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (NUMBERP X))
(LESSP 1 X)
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (BUMP X M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.30.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (NUMBERP X))
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) N))
(NOT (LESSP N (ADD1 X))))
(EQUAL (ADD1 X) (BUMP X M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.29.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(LESSP 1 X)
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (BUMP X M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.28.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) N))
(NOT (LESSP N (ADD1 X))))
(EQUAL (ADD1 X) (BUMP X M))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) N))
(NOT (LESSP N (ADD1 X))))
(EQUAL (ADD1 X) (BUMP X M))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.27.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (NUMBERP X))
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) N))
(EQUAL (BUMP Y M) (BUMP X M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.26.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) N))
(EQUAL (BUMP Y M) (BUMP X M))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 (ADD1 X))))
(NOT (EQUAL X 0))
(NOT (EQUAL X (ADD1 X)))
(NOT (LESSP (ADD1 X) X))
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) 0)))
(EQUAL (BUMP Y M) (BUMP X M))).
This again simplifies, using linear arithmetic, to:
T.
Case 1.25.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (NUMBERP X))
(NOT (LESSP 1 X)))
(EQUAL X (BUMP X M))),
which again simplifies, expanding the definitions of EQUAL, LESSP, and
BUMP, to:
T.
Case 1.24.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(NOT (LESSP 1 X)))
(EQUAL X (BUMP X M))),
which again simplifies, using linear arithmetic, to three new conjectures:
Case 1.24.3.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(NOT (LESSP 1 X)))
(EQUAL X (BUMP X M))),
which again simplifies, expanding the functions EQUAL, LESSP, and BUMP,
to:
T.
Case 1.24.2.
(IMPLIES (AND (NOT (NUMBERP N))
(NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(NOT (LESSP 1 X)))
(EQUAL X (BUMP X M))),
which again simplifies, appealing to the lemma SUB1-NNUMBERP, and
expanding the functions LESSP and BUMP, to:
T.
Case 1.24.1.
(IMPLIES (AND (NUMBERP N)
(NUMBERP X)
(NOT (LAMBDAP 1))
(NOT (COMBP 1))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 1)))
(NOT (EQUAL 1 0))
(NOT (EQUAL 1 1))
(NOT (LESSP 1 1))
(NOT (LESSP 1 1)))
(EQUAL 1 (BUMP 1 M))),
which again simplifies, obviously, to:
T.
Case 1.23.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N)
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) N))
(LESSP N (ADD1 X)))
(EQUAL (SUB1 (ADD1 X)) (BUMP Y M))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.22.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N)
(LESSP 1 X)
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (BUMP Y M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.21.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N)
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) N))
(NOT (LESSP N (ADD1 X))))
(EQUAL (ADD1 X) (BUMP Y M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.20.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(EQUAL X 0)
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) N))
(LESSP N (ADD1 X)))
(EQUAL (SUB1 (ADD1 X)) (BUMP 0 M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.19.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(EQUAL X 0)
(LESSP 1 X)
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (BUMP 0 M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.18.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(EQUAL X 0)
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) N))
(NOT (LESSP N (ADD1 X))))
(EQUAL (ADD1 X) (BUMP 0 M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.17.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(EQUAL X 0)
(LESSP 1 X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) N))
(EQUAL (BUMP Y M) (BUMP 0 M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.16.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (NUMBERP M))
(NOT (LESSP 0 (SUB1 N)))
(EQUAL X 0)
(NOT (LESSP 1 X)))
(EQUAL X (BUMP 0 M))),
which again simplifies, opening up the functions LAMBDAP, COMBP, EQUAL,
LESSP, and BUMP, to:
T.
Case 1.15.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(LESSP M (SUB1 X))
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) N))
(LESSP N (ADD1 X)))
(EQUAL (SUB1 (ADD1 X))
(BUMP (SUB1 X) M))),
which again simplifies, applying the lemmas SUB1-ADD1 and ADD1-SUB1, and
unfolding the definitions of LESSP and BUMP, to:
T.
Case 1.14.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(LESSP M (SUB1 X))
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (BUMP (SUB1 X) M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.13.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(LESSP M (SUB1 X))
(NOT (EQUAL (ADD1 X) N))
(NOT (LESSP N (ADD1 X))))
(EQUAL (ADD1 X) (BUMP (SUB1 X) M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.12.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(LESSP M (SUB1 X))
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) N))
(EQUAL (BUMP Y M) (BUMP (SUB1 X) M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.11.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(NOT (LESSP M (SUB1 X))))
(EQUAL (SUB1 X) (BUMP (SUB1 X) M))),
which again simplifies, expanding BUMP, to:
T.
Case 1.10.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(NOT (LESSP N X))
(LESSP M (SUB1 X))
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) N))
(LESSP N (ADD1 X)))
(EQUAL (SUB1 (ADD1 X)) (BUMP X M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.9.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(NOT (LESSP N X))
(LESSP M (SUB1 X))
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (BUMP X M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.8.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(NOT (LESSP N X))
(LESSP M (SUB1 X))
(NOT (EQUAL (ADD1 X) N))
(NOT (LESSP N (ADD1 X))))
(EQUAL (ADD1 X) (BUMP X M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.7.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(NOT (LESSP N X))
(LESSP M (SUB1 X))
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) N))
(EQUAL (BUMP Y M) (BUMP X M))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.6.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (NUMBERP X)))
(EQUAL X (BUMP X M))),
which again simplifies, unfolding the definitions of LESSP and BUMP, to:
T.
Case 1.5.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(NOT (LESSP M (SUB1 X))))
(EQUAL X (BUMP X M))),
which again simplifies, expanding BUMP, to the conjecture:
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(NOT (LESSP M (SUB1 X)))
(LESSP M X))
(EQUAL X (ADD1 X))).
However this again simplifies, using linear arithmetic, to three new goals:
Case 1.5.3.
(IMPLIES (AND (NOT (NUMBERP N))
(NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(NOT (LESSP M (SUB1 X)))
(LESSP M X))
(EQUAL X (ADD1 X))),
which again simplifies, applying the lemma SUB1-NNUMBERP, and unfolding
EQUAL and LESSP, to:
T.
Case 1.5.2.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(NOT (LESSP M (SUB1 X)))
(LESSP M X))
(EQUAL X (ADD1 X))),
which again simplifies, rewriting with SUB1-NNUMBERP, and opening up the
functions LESSP and EQUAL, to:
T.
Case 1.5.1.
(IMPLIES (AND (NUMBERP X)
(NUMBERP N)
(NOT (LAMBDAP (PLUS 1 M)))
(NOT (COMBP (PLUS 1 M)))
(NUMBERP M)
(NOT (LESSP M (SUB1 (PLUS 1 M))))
(NOT (EQUAL (PLUS 1 M) 0))
(NOT (EQUAL (PLUS 1 M) (PLUS 1 M)))
(NOT (LESSP (PLUS 1 M) (PLUS 1 M)))
(NOT (LESSP M (SUB1 (PLUS 1 M))))
(LESSP M (PLUS 1 M)))
(EQUAL (PLUS 1 M) (ADD1 (PLUS 1 M)))).
This again simplifies, clearly, to:
T.
Case 1.4.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N)
(LESSP M (SUB1 X))
(NOT (EQUAL (ADD1 X) 0))
(NOT (EQUAL (ADD1 X) N))
(LESSP N (ADD1 X)))
(EQUAL (SUB1 (ADD1 X)) (BUMP Y M))).
This again simplifies, obviously, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N)
(LESSP M (SUB1 X))
(EQUAL (ADD1 X) 0))
(EQUAL (ADD1 X) (BUMP Y M))).
This again simplifies, clearly, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N)
(LESSP M (SUB1 X))
(NOT (EQUAL (ADD1 X) N))
(NOT (LESSP N (ADD1 X))))
(EQUAL (ADD1 X) (BUMP Y M))).
This again simplifies, obviously, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(NOT (LESSP M (SUB1 N)))
(EQUAL X 0))
(EQUAL X (BUMP 0 M))).
This again simplifies, unfolding LAMBDAP, COMBP, LESSP, EQUAL, and BUMP,
to:
T.
Q.E.D.
[ 0.0 0.1 0.2 ]
ANOTHER-BUMP-SUBST
(PROVE-LEMMA BUMP-LAMBDAP
(REWRITE)
(IMPLIES (LAMBDAP X)
(EQUAL (BODY (BUMP X N))
(BUMP (BODY X) (ADD1 N)))))
This formula simplifies, applying BODY-LAMBDA, and unfolding BUMP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
BUMP-LAMBDAP
(PROVE-LEMMA SUBST-LAMBDA
(REWRITE)
(IMPLIES (LAMBDAP X)
(EQUAL (BODY (SUBST X Y N))
(SUBST (BODY X)
(BUMP Y 0)
(ADD1 N)))))
This conjecture simplifies, applying BODY-LAMBDA, and opening up the
definition of SUBST, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
SUBST-LAMBDA
(DEFN LEFT-INSTRS (X) (CAR X))
[ 0.0 0.0 0.0 ]
LEFT-INSTRS
(DEFN RIGHT-INSTRS (X) (CADR X))
[ 0.0 0.0 0.0 ]
RIGHT-INSTRS
(DEFN COMMAND (X) (CADDR X))
[ 0.0 0.0 0.0 ]
COMMAND
(DEFN WALK
(W M)
(IF (LAMBDAP M)
(LAMBDA (WALK W (BODY M)))
(IF (COMBP M)
(IF (AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M)))
(SUBST (BODY (WALK (LEFT-INSTRS W) (LEFT M)))
(WALK (RIGHT-INSTRS W) (RIGHT M))
1)
(COMB (WALK (LEFT-INSTRS W) (LEFT M))
(WALK (RIGHT-INSTRS W) (RIGHT M))))
M)))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
establish that the measure (COUNT M) decreases according to the well-founded
relation LESSP in each recursive call. Hence, WALK is accepted under the
definitional principle.
[ 0.0 0.0 0.0 ]
WALK
(DEFN BUMP-WALK-IND
(U M N)
(IF (LAMBDAP M)
(BUMP-WALK-IND U (BODY M) (ADD1 N))
(IF (COMBP M)
(IF (AND (EQUAL (COMMAND U) 'REDUCE)
(LAMBDAP (LEFT M)))
(AND (BUMP-WALK-IND (LEFT-INSTRS U)
(LEFT M)
N)
(BUMP-WALK-IND (RIGHT-INSTRS U)
(RIGHT M)
N))
(AND (BUMP-WALK-IND (LEFT-INSTRS U)
(LEFT M)
N)
(BUMP-WALK-IND (RIGHT-INSTRS U)
(RIGHT M)
N)))
T)))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
establish that the measure (COUNT M) decreases according to the well-founded
relation LESSP in each recursive call. Hence, BUMP-WALK-IND is accepted under
the principle of definition. From the definition we can conclude that:
(TRUEP (BUMP-WALK-IND U M N))
is a theorem.
[ 0.0 0.0 0.0 ]
BUMP-WALK-IND
(PROVE-LEMMA LAMBDA-WALK
(REWRITE)
(IMPLIES (LAMBDAP M)
(LAMBDAP (WALK W M))))
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 (AND (LAMBDAP M) (p W (BODY M)))
(p W M))
(IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M)))
(p (RIGHT-INSTRS W) (RIGHT M))
(p (LEFT-INSTRS W) (LEFT M)))
(p W M))
(IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M))))
(p (RIGHT-INSTRS W) (RIGHT M))
(p (LEFT-INSTRS W) (LEFT M)))
(p W M))
(IMPLIES (AND (NOT (LAMBDAP M))
(NOT (COMBP M)))
(p W M))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP can
be used to establish that the measure (COUNT M) decreases according to the
well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instances chosen for W. The above induction scheme
generates the following two new formulas:
Case 2. (IMPLIES (AND (NOT (LAMBDAP (BODY M)))
(LAMBDAP M))
(LAMBDAP (WALK W M))).
This simplifies, expanding the definition of WALK, to:
T.
Case 1. (IMPLIES (AND (LAMBDAP (WALK W (BODY M)))
(LAMBDAP M))
(LAMBDAP (WALK W M))).
This simplifies, opening up the function WALK, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LAMBDA-WALK
(PROVE-LEMMA BUMP-WALK
(REWRITE)
(EQUAL (WALK U (BUMP M N))
(BUMP (WALK U M) N))
((INDUCT (BUMP-WALK-IND U M N))))
This conjecture can be simplified, using the abbreviations NOT, OR, AND,
LEFT-INSTRS, RIGHT-INSTRS, and COMMAND, to four new conjectures:
Case 4. (IMPLIES (AND (LAMBDAP M)
(EQUAL (WALK U (BUMP (BODY M) (ADD1 N)))
(BUMP (WALK U (BODY M)) (ADD1 N))))
(EQUAL (WALK U (BUMP M N))
(BUMP (WALK U M) N))),
which simplifies, applying BODY-LAMBDA, and opening up BUMP and WALK, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(EQUAL (CADDR U) 'REDUCE)
(LAMBDAP (LEFT M))
(EQUAL (WALK (CADR U) (BUMP (RIGHT M) N))
(BUMP (WALK (CADR U) (RIGHT M)) N))
(EQUAL (WALK (CAR U) (BUMP (LEFT M) N))
(BUMP (WALK (CAR U) (LEFT M)) N)))
(EQUAL (WALK U (BUMP M N))
(BUMP (WALK U M) N))).
This simplifies, using linear arithmetic, rewriting with ANOTHER-BUMP-SUBST,
RIGHT-COMB, BUMP-LAMBDAP, LAMBDA-WALK, LAMBDAP-BUMP, and LEFT-COMB, and
expanding BUMP, RIGHT-INSTRS, LEFT-INSTRS, EQUAL, COMMAND, and WALK, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (CADDR U) 'REDUCE)
(LAMBDAP (LEFT M))))
(EQUAL (WALK (CADR U) (BUMP (RIGHT M) N))
(BUMP (WALK (CADR U) (RIGHT M)) N))
(EQUAL (WALK (CAR U) (BUMP (LEFT M) N))
(BUMP (WALK (CAR U) (LEFT M)) N)))
(EQUAL (WALK U (BUMP M N))
(BUMP (WALK U M) N))),
which simplifies, applying RIGHT-COMB and LEFT-COMB, and opening up AND,
BUMP, RIGHT-INSTRS, LEFT-INSTRS, COMMAND, and WALK, to the new conjecture:
(IMPLIES (AND (COMBP M)
(NOT (LAMBDAP (LEFT M)))
(EQUAL (WALK (CADR U) (BUMP (RIGHT M) N))
(BUMP (WALK (CADR U) (RIGHT M)) N))
(EQUAL (WALK (CAR U) (BUMP (LEFT M) N))
(BUMP (WALK (CAR U) (LEFT M)) N))
(EQUAL (CADDR U) 'REDUCE)
(LAMBDAP (BUMP (LEFT M) N)))
(EQUAL (SUBST (BODY (BUMP (WALK (CAR U) (LEFT M)) N))
(BUMP (WALK (CADR U) (RIGHT M)) N)
1)
(COMB (BUMP (WALK (CAR U) (LEFT M)) N)
(BUMP (WALK (CADR U) (RIGHT M)) N)))).
Applying the lemma LEFT-RIGHT-ELIM, replace M by (COMB X Z) to eliminate
(LEFT M) and (RIGHT M). This produces the new goal:
(IMPLIES (AND (NOT (LAMBDAP X))
(EQUAL (WALK (CADR U) (BUMP Z N))
(BUMP (WALK (CADR U) Z) N))
(EQUAL (WALK (CAR U) (BUMP X N))
(BUMP (WALK (CAR U) X) N))
(EQUAL (CADDR U) 'REDUCE)
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (BUMP (WALK (CAR U) X) N))
(BUMP (WALK (CADR U) Z) N)
1)
(COMB (BUMP (WALK (CAR U) X) N)
(BUMP (WALK (CADR U) Z) N)))).
Applying the lemma CAR-CDR-ELIM, replace U by (CONS W V) to eliminate
(CDR U) and (CAR U), V by (CONS D C) to eliminate (CAR V) and (CDR V), and C
by (CONS V X1) to eliminate (CAR C) and (CDR C). We thus obtain the
following four new formulas:
Case 2.4.
(IMPLIES (AND (NOT (LISTP U))
(NOT (LAMBDAP X))
(EQUAL (WALK (CADR U) (BUMP Z N))
(BUMP (WALK (CADR U) Z) N))
(EQUAL (WALK (CAR U) (BUMP X N))
(BUMP (WALK (CAR U) X) N))
(EQUAL (CADDR U) 'REDUCE)
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (BUMP (WALK (CAR U) X) N))
(BUMP (WALK (CADR U) Z) N)
1)
(COMB (BUMP (WALK (CAR U) X) N)
(BUMP (WALK (CADR U) Z) N)))).
However this further simplifies, applying CDR-NLISTP and CAR-NLISTP, and
opening up the definitions of CAR, CDR, and EQUAL, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (LISTP V))
(NOT (LAMBDAP X))
(EQUAL (WALK (CAR V) (BUMP Z N))
(BUMP (WALK (CAR V) Z) N))
(EQUAL (WALK W (BUMP X N))
(BUMP (WALK W X) N))
(EQUAL (CADR V) 'REDUCE)
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (BUMP (WALK W X) N))
(BUMP (WALK (CAR V) Z) N)
1)
(COMB (BUMP (WALK W X) N)
(BUMP (WALK (CAR V) Z) N)))).
But this further simplifies, rewriting with CAR-NLISTP and CDR-NLISTP, and
unfolding CAR and EQUAL, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (LISTP C))
(NOT (LAMBDAP X))
(EQUAL (WALK D (BUMP Z N))
(BUMP (WALK D Z) N))
(EQUAL (WALK W (BUMP X N))
(BUMP (WALK W X) N))
(EQUAL (CAR C) 'REDUCE)
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (BUMP (WALK W X) N))
(BUMP (WALK D Z) N)
1)
(COMB (BUMP (WALK W X) N)
(BUMP (WALK D Z) N)))).
However this further simplifies, rewriting with the lemma CAR-NLISTP, and
opening up the definition of EQUAL, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (LAMBDAP X))
(EQUAL (WALK D (BUMP Z N))
(BUMP (WALK D Z) N))
(EQUAL (WALK W (BUMP X N))
(BUMP (WALK W X) N))
(EQUAL V 'REDUCE)
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (BUMP (WALK W X) N))
(BUMP (WALK D Z) N)
1)
(COMB (BUMP (WALK W X) N)
(BUMP (WALK D Z) N)))),
which further simplifies, trivially, to the new goal:
(IMPLIES (AND (NOT (LAMBDAP X))
(EQUAL (WALK D (BUMP Z N))
(BUMP (WALK D Z) N))
(EQUAL (WALK W (BUMP X N))
(BUMP (WALK W X) N))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (BUMP (WALK W X) N))
(BUMP (WALK D Z) N)
1)
(COMB (BUMP (WALK W X) N)
(BUMP (WALK D Z) N)))).
We use the first equality hypothesis by substituting (WALK D (BUMP Z N))
for (BUMP (WALK D Z) N) and throwing away the equality. We must thus
prove:
(IMPLIES (AND (NOT (LAMBDAP X))
(EQUAL (WALK W (BUMP X N))
(BUMP (WALK W X) N))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (BUMP (WALK W X) N))
(WALK D (BUMP Z N))
1)
(COMB (BUMP (WALK W X) N)
(WALK D (BUMP Z N))))).
We use the above equality hypothesis by substituting (WALK W (BUMP X N))
for (BUMP (WALK W X) N) and throwing away the equality. This produces:
(IMPLIES (AND (NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))),
which we will finally name *1.
Case 1. (IMPLIES (AND (NOT (LAMBDAP M))
(NOT (COMBP M)))
(EQUAL (WALK U (BUMP M N))
(BUMP (WALK U M) N))).
This simplifies, unfolding BUMP and WALK, to:
T.
So we now return to:
(IMPLIES (AND (NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))),
which we named *1 above. We will appeal to induction. Five 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 (LAMBDAP X)
(p W (BODY X) (ADD1 N) D (BODY Z)))
(p W X N D Z))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(p W (RIGHT X) N D (RIGHT Z))
(p W (RIGHT X) N D (LEFT Z))
(p W (LEFT X) N D (RIGHT Z))
(p W (LEFT X) N D (LEFT Z)))
(p W X N D Z))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP N X))
(p W X N D Z))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X)))
(p W X N D Z))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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 Z and N. The above induction scheme produces
the following 11 new conjectures:
Case 11.(IMPLIES (AND (COMBP X)
(LAMBDAP (RIGHT X))
(LAMBDAP (LEFT X))
(NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))).
This simplifies, opening up BUMP, to:
T.
Case 10.(IMPLIES (AND (COMBP X)
(NOT (LAMBDAP (BUMP (RIGHT X) N)))
(LAMBDAP (LEFT X))
(NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))).
This simplifies, unfolding BUMP, to:
T.
Case 9. (IMPLIES (AND (COMBP X)
(EQUAL (SUBST (BODY (WALK W (BUMP (RIGHT X) N)))
(WALK D (BUMP (RIGHT Z) N))
1)
(COMB (WALK W (BUMP (RIGHT X) N))
(WALK D (BUMP (RIGHT Z) N))))
(EQUAL (SUBST (BODY (WALK W (BUMP (RIGHT X) N)))
(WALK D (BUMP (LEFT Z) N))
1)
(COMB (WALK W (BUMP (RIGHT X) N))
(WALK D (BUMP (LEFT Z) N))))
(LAMBDAP (LEFT X))
(NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))).
This simplifies, opening up the definition of BUMP, to:
T.
Case 8. (IMPLIES (AND (COMBP X)
(LAMBDAP (RIGHT X))
(NOT (LAMBDAP (BUMP (LEFT X) N)))
(NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))).
This simplifies, expanding the definition of BUMP, to:
T.
Case 7. (IMPLIES (AND (COMBP X)
(NOT (LAMBDAP (BUMP (RIGHT X) N)))
(NOT (LAMBDAP (BUMP (LEFT X) N)))
(NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))).
This simplifies, unfolding BUMP, to:
T.
Case 6. (IMPLIES (AND (COMBP X)
(EQUAL (SUBST (BODY (WALK W (BUMP (RIGHT X) N)))
(WALK D (BUMP (RIGHT Z) N))
1)
(COMB (WALK W (BUMP (RIGHT X) N))
(WALK D (BUMP (RIGHT Z) N))))
(EQUAL (SUBST (BODY (WALK W (BUMP (RIGHT X) N)))
(WALK D (BUMP (LEFT Z) N))
1)
(COMB (WALK W (BUMP (RIGHT X) N))
(WALK D (BUMP (LEFT Z) N))))
(NOT (LAMBDAP (BUMP (LEFT X) N)))
(NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))).
This simplifies, unfolding BUMP, to:
T.
Case 5. (IMPLIES (AND (COMBP X)
(LAMBDAP (RIGHT X))
(EQUAL (SUBST (BODY (WALK W (BUMP (LEFT X) N)))
(WALK D (BUMP (RIGHT Z) N))
1)
(COMB (WALK W (BUMP (LEFT X) N))
(WALK D (BUMP (RIGHT Z) N))))
(EQUAL (SUBST (BODY (WALK W (BUMP (LEFT X) N)))
(WALK D (BUMP (LEFT Z) N))
1)
(COMB (WALK W (BUMP (LEFT X) N))
(WALK D (BUMP (LEFT Z) N))))
(NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))).
This simplifies, expanding BUMP, to:
T.
Case 4. (IMPLIES (AND (COMBP X)
(NOT (LAMBDAP (BUMP (RIGHT X) N)))
(EQUAL (SUBST (BODY (WALK W (BUMP (LEFT X) N)))
(WALK D (BUMP (RIGHT Z) N))
1)
(COMB (WALK W (BUMP (LEFT X) N))
(WALK D (BUMP (RIGHT Z) N))))
(EQUAL (SUBST (BODY (WALK W (BUMP (LEFT X) N)))
(WALK D (BUMP (LEFT Z) N))
1)
(COMB (WALK W (BUMP (LEFT X) N))
(WALK D (BUMP (LEFT Z) N))))
(NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))).
This simplifies, unfolding BUMP, to:
T.
Case 3. (IMPLIES (AND (COMBP X)
(EQUAL (SUBST (BODY (WALK W (BUMP (RIGHT X) N)))
(WALK D (BUMP (RIGHT Z) N))
1)
(COMB (WALK W (BUMP (RIGHT X) N))
(WALK D (BUMP (RIGHT Z) N))))
(EQUAL (SUBST (BODY (WALK W (BUMP (RIGHT X) N)))
(WALK D (BUMP (LEFT Z) N))
1)
(COMB (WALK W (BUMP (RIGHT X) N))
(WALK D (BUMP (LEFT Z) N))))
(EQUAL (SUBST (BODY (WALK W (BUMP (LEFT X) N)))
(WALK D (BUMP (RIGHT Z) N))
1)
(COMB (WALK W (BUMP (LEFT X) N))
(WALK D (BUMP (RIGHT Z) N))))
(EQUAL (SUBST (BODY (WALK W (BUMP (LEFT X) N)))
(WALK D (BUMP (LEFT Z) N))
1)
(COMB (WALK W (BUMP (LEFT X) N))
(WALK D (BUMP (LEFT Z) N))))
(NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))).
This simplifies, unfolding the definition of BUMP, to:
T.
Case 2. (IMPLIES (AND (NOT (COMBP X))
(LESSP N X)
(NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))).
This simplifies, opening up the definition of BUMP, to:
T.
Case 1. (IMPLIES (AND (NOT (COMBP X))
(NOT (LESSP N X))
(NOT (LAMBDAP X))
(LAMBDAP (BUMP X N)))
(EQUAL (SUBST (BODY (WALK W (BUMP X N)))
(WALK D (BUMP Z N))
1)
(COMB (WALK W (BUMP X N))
(WALK D (BUMP Z N))))).
This simplifies, unfolding the definition of BUMP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.1 ]
BUMP-WALK
(PROVE-LEMMA NLISTP-WALK
(REWRITE)
(IMPLIES (NLISTP W)
(EQUAL (WALK W M) M)))
This formula can be simplified, using the abbreviations NLISTP and IMPLIES, to
the new conjecture:
(IMPLIES (NOT (LISTP W))
(EQUAL (WALK W M) M)),
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 (AND (LAMBDAP M) (p W (BODY M)))
(p W M))
(IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M)))
(p (RIGHT-INSTRS W) (RIGHT M))
(p (LEFT-INSTRS W) (LEFT M)))
(p W M))
(IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M))))
(p (RIGHT-INSTRS W) (RIGHT M))
(p (LEFT-INSTRS W) (LEFT M)))
(p W M))
(IMPLIES (AND (NOT (LAMBDAP M))
(NOT (COMBP M)))
(p W M))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP can
be used to show that the measure (COUNT M) decreases according to the
well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instances chosen for W. The above induction scheme
generates ten new conjectures:
Case 10.(IMPLIES (AND (LAMBDAP M)
(EQUAL (WALK W (BODY M)) (BODY M))
(NOT (LISTP W)))
(EQUAL (WALK W M) M)),
which simplifies, rewriting with LAMBDA-BODY, and expanding the definition
of WALK, to:
T.
Case 9. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M)))
(LISTP (RIGHT-INSTRS W))
(LISTP (LEFT-INSTRS W))
(NOT (LISTP W)))
(EQUAL (WALK W M) M)).
This simplifies, applying CDR-NLISTP, and expanding CAR, CDR, COMMAND, EQUAL,
and AND, to:
T.
Case 8. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M)))
(EQUAL (WALK (RIGHT-INSTRS W) (RIGHT M))
(RIGHT M))
(LISTP (LEFT-INSTRS W))
(NOT (LISTP W)))
(EQUAL (WALK W M) M)),
which simplifies, rewriting with CDR-NLISTP, and unfolding the definitions
of CAR, CDR, COMMAND, EQUAL, and AND, to:
T.
Case 7. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M)))
(LISTP (RIGHT-INSTRS W))
(EQUAL (WALK (LEFT-INSTRS W) (LEFT M))
(LEFT M))
(NOT (LISTP W)))
(EQUAL (WALK W M) M)).
This simplifies, rewriting with the lemma CDR-NLISTP, and opening up CAR,
CDR, COMMAND, EQUAL, and AND, to:
T.
Case 6. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M)))
(EQUAL (WALK (RIGHT-INSTRS W) (RIGHT M))
(RIGHT M))
(EQUAL (WALK (LEFT-INSTRS W) (LEFT M))
(LEFT M))
(NOT (LISTP W)))
(EQUAL (WALK W M) M)).
This simplifies, rewriting with the lemma CDR-NLISTP, and unfolding the
definitions of CAR, CDR, COMMAND, EQUAL, and AND, to:
T.
Case 5. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M))))
(LISTP (RIGHT-INSTRS W))
(LISTP (LEFT-INSTRS W))
(NOT (LISTP W)))
(EQUAL (WALK W M) M)).
This simplifies, rewriting with CDR-NLISTP, and expanding the definitions of
CAR, CDR, COMMAND, EQUAL, AND, RIGHT-INSTRS, and LISTP, to:
T.
Case 4. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M))))
(EQUAL (WALK (RIGHT-INSTRS W) (RIGHT M))
(RIGHT M))
(LISTP (LEFT-INSTRS W))
(NOT (LISTP W)))
(EQUAL (WALK W M) M)),
which simplifies, applying CDR-NLISTP and CAR-NLISTP, and unfolding the
definitions of CAR, CDR, COMMAND, EQUAL, AND, LEFT-INSTRS, and LISTP, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M))))
(LISTP (RIGHT-INSTRS W))
(EQUAL (WALK (LEFT-INSTRS W) (LEFT M))
(LEFT M))
(NOT (LISTP W)))
(EQUAL (WALK W M) M)).
This simplifies, applying CDR-NLISTP, and expanding the functions CAR, CDR,
COMMAND, EQUAL, AND, RIGHT-INSTRS, and LISTP, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M))))
(EQUAL (WALK (RIGHT-INSTRS W) (RIGHT M))
(RIGHT M))
(EQUAL (WALK (LEFT-INSTRS W) (LEFT M))
(LEFT M))
(NOT (LISTP W)))
(EQUAL (WALK W M) M)),
which simplifies, rewriting with the lemmas CDR-NLISTP and COMB-LEFT-RIGHT,
and expanding the functions CAR, CDR, COMMAND, EQUAL, AND, and WALK, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP M))
(NOT (COMBP M))
(NOT (LISTP W)))
(EQUAL (WALK W M) M)),
which simplifies, opening up the function WALK, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NLISTP-WALK
(DEFN SUB-WALK
(W M U N)
(IF (LAMBDAP M)
(SUB-WALK W (BODY M) U (ADD1 N))
(IF (COMBP M)
(IF (AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M)))
(LIST (SUB-WALK (LEFT-INSTRS W)
(LEFT M)
U N)
(SUB-WALK (RIGHT-INSTRS W)
(RIGHT M)
U N)
'REDUCE)
(LIST (SUB-WALK (LEFT-INSTRS W)
(LEFT M)
U N)
(SUB-WALK (RIGHT-INSTRS W)
(RIGHT M)
U N)))
(IF (NOT (ZEROP M))
(IF (EQUAL M N) U W)
W))))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
establish that the measure (COUNT M) decreases according to the well-founded
relation LESSP in each recursive call. Hence, SUB-WALK is accepted under the
principle of definition. Observe that:
(OR (LISTP (SUB-WALK W M U N))
(EQUAL (SUB-WALK W M U N) W)
(EQUAL (SUB-WALK W M U N) U))
is a theorem.
[ 0.0 0.0 0.0 ]
SUB-WALK
(DEFN WALK-SUBST-IND
(W M U X N)
(IF (LAMBDAP M)
(WALK-SUBST-IND W
(BODY M)
U
(BUMP X 0)
(ADD1 N))
(IF (COMBP M)
(IF (AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT M)))
(AND (WALK-SUBST-IND (LEFT-INSTRS W)
(LEFT M)
U X N)
(WALK-SUBST-IND (RIGHT-INSTRS W)
(RIGHT M)
U X N))
(AND (WALK-SUBST-IND (LEFT-INSTRS W)
(LEFT M)
U X N)
(WALK-SUBST-IND (RIGHT-INSTRS W)
(RIGHT M)
U X N)))
T)))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
inform us that the measure (COUNT M) decreases according to the well-founded
relation LESSP in each recursive call. Hence, WALK-SUBST-IND is accepted
under the definitional principle. From the definition we can conclude that:
(TRUEP (WALK-SUBST-IND W M U X N))
is a theorem.
[ 0.0 0.0 0.0 ]
WALK-SUBST-IND
(PROVE-LEMMA SUBST-NOT-FREE-IN
(REWRITE)
(EQUAL (SUBST (BUMP X N) Y (ADD1 N))
X)
((INDUCT (SUBST X Y N))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, OR, and
AND, to six new formulas:
Case 6. (IMPLIES (AND (LAMBDAP X)
(EQUAL (SUBST (BUMP (BODY X) (ADD1 N))
(BUMP Y 0)
(ADD1 (ADD1 N)))
(BODY X)))
(EQUAL (SUBST (BUMP X N) Y (ADD1 N))
X)),
which simplifies, applying LAMBDA-BODY and BODY-LAMBDA, and unfolding BUMP
and SUBST, to:
T.
Case 5. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(EQUAL (SUBST (BUMP (RIGHT X) N) Y (ADD1 N))
(RIGHT X))
(EQUAL (SUBST (BUMP (LEFT X) N) Y (ADD1 N))
(LEFT X)))
(EQUAL (SUBST (BUMP X N) Y (ADD1 N))
X)).
This simplifies, rewriting with COMB-LEFT-RIGHT, RIGHT-COMB, and LEFT-COMB,
and opening up BUMP and SUBST, to:
T.
Case 4. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X N))
(EQUAL (SUBST (BUMP X N) Y (ADD1 N))
X)),
which simplifies, applying SUB1-ADD1, and unfolding the functions BUMP,
LESSP, and SUBST, to the following four new conjectures:
Case 4.4.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP N N)
(NOT (EQUAL (ADD1 N) 0)))
(EQUAL Y N)).
But this again simplifies, using linear arithmetic, to:
T.
Case 4.3.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP N N))
(EQUAL N (ADD1 N)))
(EQUAL Y N)),
which again simplifies, using linear arithmetic, to:
T.
Case 4.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP N N)
(EQUAL (ADD1 N) 0))
(EQUAL (ADD1 N) N)),
which again simplifies, using linear arithmetic, to:
T.
Case 4.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP N N))
(NOT (EQUAL N (ADD1 N)))
(LESSP N (SUB1 N)))
(EQUAL (SUB1 N) N)),
which again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL (SUBST (BUMP X N) Y (ADD1 N))
X)),
which simplifies, applying SUB1-ADD1 and ADD1-EQUAL, and opening up the
definitions of BUMP, LESSP, and SUBST, to:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(NOT (NUMBERP N))
(NOT (LESSP 0 X)))
(EQUAL (ADD1 X) X)),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(EQUAL (SUBST (BUMP X N) Y (ADD1 N))
X)),
which simplifies, rewriting with SUB1-ADD1, and expanding BUMP, LESSP, and
SUBST, to the following three new conjectures:
Case 2.3.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(NOT (LESSP N X))
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 X)))
(EQUAL (SUB1 X) X)).
But this again simplifies, expanding LESSP, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(NOT (LESSP N X))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X)))
(EQUAL (SUB1 X) X)),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(NOT (LESSP N X))
(EQUAL X (ADD1 N)))
(EQUAL Y X)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(ZEROP X))
(EQUAL (SUBST (BUMP X N) Y (ADD1 N))
X)),
which simplifies, opening up the definitions of ZEROP, LESSP, EQUAL, COMBP,
LAMBDAP, BUMP, and SUBST, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
SUBST-NOT-FREE-IN
(PROVE-LEMMA SUBST-SUBST
(REWRITE)
(IMPLIES (AND (NUMBERP M) (LESSP M N))
(EQUAL (SUBST (SUBST X (BUMP Z M) (ADD1 N))
(SUBST Y Z N)
(ADD1 M))
(SUBST (SUBST X Y (ADD1 M)) Z N)))
((INDUCT (SUBST-INDUCT X Y Z M N))))
This formula can be simplified, using the abbreviations IMPLIES, NOT, OR, and
AND, to the following three new conjectures:
Case 3. (IMPLIES
(AND (LAMBDAP X)
(IMPLIES (AND (NUMBERP (ADD1 M))
(LESSP (ADD1 M) (ADD1 N)))
(EQUAL (SUBST (SUBST (BODY X)
(BUMP (BUMP Z 0) (ADD1 M))
(ADD1 (ADD1 N)))
(SUBST (BUMP Y 0) (BUMP Z 0) (ADD1 N))
(ADD1 (ADD1 M)))
(SUBST (SUBST (BODY X)
(BUMP Y 0)
(ADD1 (ADD1 M)))
(BUMP Z 0)
(ADD1 N))))
(NUMBERP M)
(LESSP M N))
(EQUAL (SUBST (SUBST X (BUMP Z M) (ADD1 N))
(SUBST Y Z N)
(ADD1 M))
(SUBST (SUBST X Y (ADD1 M)) Z N))).
This simplifies, using linear arithmetic, applying SUB1-ADD1, BUMP-BUMP,
BUMP-SUBST, SUBST-LAMBDA, LAMBDAP-SUBST, and BODY-LAMBDA, and expanding
LESSP, AND, IMPLIES, and SUBST, to:
T.
Case 2. (IMPLIES
(AND (NOT (LAMBDAP X))
(COMBP X)
(IMPLIES (AND (NUMBERP M) (LESSP M N))
(EQUAL (SUBST (SUBST (RIGHT X) (BUMP Z M) (ADD1 N))
(SUBST Y Z N)
(ADD1 M))
(SUBST (SUBST (RIGHT X) Y (ADD1 M))
Z N)))
(IMPLIES (AND (NUMBERP M) (LESSP M N))
(EQUAL (SUBST (SUBST (LEFT X) (BUMP Z M) (ADD1 N))
(SUBST Y Z N)
(ADD1 M))
(SUBST (SUBST (LEFT X) Y (ADD1 M))
Z N)))
(NUMBERP M)
(LESSP M N))
(EQUAL (SUBST (SUBST X (BUMP Z M) (ADD1 N))
(SUBST Y Z N)
(ADD1 M))
(SUBST (SUBST X Y (ADD1 M)) Z N))),
which simplifies, rewriting with RIGHT-COMB and LEFT-COMB, and opening up
the functions AND, IMPLIES, and SUBST, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N))
(EQUAL (SUBST (SUBST X (BUMP Z M) (ADD1 N))
(SUBST Y Z N)
(ADD1 M))
(SUBST (SUBST X Y (ADD1 M)) Z N))).
This simplifies, applying the lemma SUB1-ADD1, and opening up the
definitions of LESSP and SUBST, to the following 17 new goals:
Case 1.17.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(LESSP M (SUB1 X))
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 X)))
(EQUAL (SUBST (SUB1 X)
(SUBST Y Z N)
(ADD1 M))
(SUBST (SUB1 X) Z N))).
However this again simplifies, unfolding LESSP, to:
T.
Case 1.16.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(LESSP M (SUB1 X))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X)))
(EQUAL (SUBST (SUB1 X)
(SUBST Y Z N)
(ADD1 M))
(SUBST (SUB1 X) Z N))),
which again simplifies, rewriting with SUB1-ADD1, and expanding the
functions LESSP and SUBST, to the following five new conjectures:
Case 1.16.5.
(IMPLIES (AND (NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(LESSP M (SUB1 X))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X))
(NOT (EQUAL (SUB1 X) 0))
(EQUAL (SUB1 X) N)
(EQUAL (SUB1 X) (ADD1 M)))
(EQUAL (SUBST Y Z N) Z)).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.16.4.
(IMPLIES (AND (NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(LESSP M (SUB1 X))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X))
(NOT (EQUAL (SUB1 X) 0))
(EQUAL (SUB1 X) N)
(NOT (EQUAL (SUB1 X) (ADD1 M)))
(NOT (LESSP M (SUB1 (SUB1 X)))))
(EQUAL (SUB1 X) Z)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.16.3.
(IMPLIES (AND (NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(LESSP M (SUB1 X))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X))
(NOT (EQUAL (SUB1 X) 0))
(EQUAL (SUB1 X) N)
(NOT (EQUAL (SUB1 X) (ADD1 M)))
(LESSP M (SUB1 (SUB1 X))))
(EQUAL (SUB1 (SUB1 X)) Z)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.16.2.
(IMPLIES (AND (NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(LESSP M (SUB1 X))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X))
(NOT (EQUAL (SUB1 X) 0))
(NOT (EQUAL (SUB1 X) N))
(EQUAL (SUB1 X) (ADD1 M)))
(EQUAL (SUBST Y Z N)
(SUB1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.16.1.
(IMPLIES (AND (NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(LESSP M (SUB1 X))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X))
(NOT (EQUAL (SUB1 X) 0))
(NOT (EQUAL (SUB1 X) N))
(NOT (EQUAL (SUB1 X) (ADD1 M)))
(NOT (LESSP M (SUB1 (SUB1 X)))))
(EQUAL (SUB1 X) (SUB1 (SUB1 X)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.15.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(LESSP M (SUB1 X))
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 X))))
(EQUAL (SUBST X (SUBST Y Z N) (ADD1 M))
(SUBST (SUB1 X) Z N))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.14.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(LESSP M (SUB1 X))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 X))))
(EQUAL (SUBST X (SUBST Y Z N) (ADD1 M))
(SUBST (SUB1 X) Z N))),
which again simplifies, applying SUB1-ADD1, and unfolding the functions
LESSP and SUBST, to:
(IMPLIES (AND (NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(LESSP M (SUB1 X))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 X)))
(NOT (EQUAL (SUB1 X) 0))
(EQUAL (SUB1 X) N))
(EQUAL (SUB1 X) Z)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.13.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(LESSP M (SUB1 X))
(EQUAL X (ADD1 N)))
(EQUAL (SUBST (BUMP Z M)
(SUBST Y Z N)
(ADD1 M))
(SUBST (SUB1 X) Z N))),
which again simplifies, rewriting with ADD1-EQUAL, SUB1-TYPE-RESTRICTION,
SUB1-ADD1, and SUBST-NOT-FREE-IN, and unfolding the functions SUB1, EQUAL,
LESSP, and SUBST, to the new goal:
(IMPLIES (AND (NUMBERP M)
(LESSP M N)
(NUMBERP N)
(NOT (EQUAL N M))
(EQUAL N 0))
(EQUAL Z 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.12.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(NOT (LESSP M (SUB1 X)))
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 X)))
(EQUAL (SUBST (SUB1 X)
(SUBST Y Z N)
(ADD1 M))
(SUBST X Z N))),
which again simplifies, opening up the definition of LESSP, to:
T.
Case 1.11.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(NOT (LESSP M (SUB1 X)))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X)))
(EQUAL (SUBST (SUB1 X)
(SUBST Y Z N)
(ADD1 M))
(SUBST X Z N))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.10.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NOT (NUMBERP X)))
(EQUAL (SUBST X (SUBST Y Z N) (ADD1 M))
(SUBST X Z N))),
which again simplifies, expanding the definition of SUBST, to:
T.
Case 1.9.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NOT (EQUAL X (ADD1 M)))
(NOT (LESSP M (SUB1 X)))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 X))))
(EQUAL (SUBST X (SUBST Y Z N) (ADD1 M))
(SUBST X Z N))),
which again simplifies, rewriting with SUB1-ADD1, and unfolding LESSP and
SUBST, to the following two new conjectures:
Case 1.9.2.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NOT (EQUAL X (ADD1 M)))
(NOT (LESSP M (SUB1 X)))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 X)))
(NUMBERP X)
(EQUAL X N))
(EQUAL X Z)).
But this again simplifies, using linear arithmetic, to:
T.
Case 1.9.1.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NOT (EQUAL X (ADD1 M)))
(NOT (LESSP M (SUB1 X)))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 X)))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X))
(EQUAL X (SUB1 X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.8.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NOT (EQUAL X (ADD1 M)))
(NOT (LESSP M (SUB1 X)))
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 X))))
(EQUAL (SUBST X (SUBST Y Z N) (ADD1 M))
(SUBST X Z N))),
which again simplifies, using linear arithmetic, to two new conjectures:
Case 1.8.2.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NOT (EQUAL X (ADD1 M)))
(NOT (LESSP M (SUB1 X)))
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 X))))
(EQUAL (SUBST X (SUBST Y Z N) (ADD1 M))
(SUBST X Z N))),
which again simplifies, unfolding the definition of LESSP, to:
T.
Case 1.8.1.
(IMPLIES (AND (NUMBERP X)
(NOT (LAMBDAP 1))
(NOT (COMBP 1))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL 1 0))
(NOT (EQUAL 1 (ADD1 M)))
(NOT (LESSP M (SUB1 1)))
(NOT (EQUAL 1 (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 1))))
(EQUAL (SUBST 1 (SUBST Y Z N) (ADD1 M))
(SUBST 1 Z N))),
which again simplifies, expanding the functions LAMBDAP, COMBP, and
LESSP, to:
T.
Case 1.7.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X (ADD1 M)))
(NOT (LESSP M (SUB1 X)))
(EQUAL X (ADD1 N)))
(EQUAL (SUBST (BUMP Z M)
(SUBST Y Z N)
(ADD1 M))
(SUBST X Z N))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.6.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X (ADD1 M))
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0 (SUB1 X)))
(EQUAL (SUBST (SUB1 X)
(SUBST Y Z N)
(ADD1 M))
(SUBST Y Z N))),
which again simplifies, expanding the definition of LESSP, to:
T.
Case 1.5.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X (ADD1 M))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(LESSP N (SUB1 X)))
(EQUAL (SUBST (SUB1 X)
(SUBST Y Z N)
(ADD1 M))
(SUBST Y Z N))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.4.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X (ADD1 M))
(NOT (EQUAL X (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 X))))
(EQUAL (SUBST X (SUBST Y Z N) (ADD1 M))
(SUBST Y Z N))),
which again simplifies, unfolding the definition of LESSP, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X (ADD1 M))
(NOT (EQUAL X (ADD1 N)))
(NUMBERP N)
(NOT (LESSP N (SUB1 X))))
(EQUAL (SUBST X (SUBST Y Z N) (ADD1 M))
(SUBST Y Z N))),
which again simplifies, applying ADD1-EQUAL and SUB1-ADD1, and unfolding
SUBST, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL X (ADD1 M))
(EQUAL X (ADD1 N)))
(EQUAL (SUBST (BUMP Z M)
(SUBST Y Z N)
(ADD1 M))
(SUBST Y Z N))).
This again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NUMBERP M)
(LESSP M N)
(EQUAL X 0))
(EQUAL (SUBST 0 (SUBST Y Z N) (ADD1 M))
(SUBST 0 Z N))),
which again simplifies, expanding the definitions of LAMBDAP, COMBP, EQUAL,
and SUBST, to:
T.
Q.E.D.
[ 0.0 0.0 0.1 ]
SUBST-SUBST
(PROVE-LEMMA WALK-SUBST
(REWRITE)
(IMPLIES (NOT (ZEROP N))
(EQUAL (WALK (SUB-WALK W M U N)
(SUBST M X N))
(SUBST (WALK W M) (WALK U X) N)))
((INDUCT (WALK-SUBST-IND W M U X N))))
This formula can be simplified, using the abbreviations ZEROP, IMPLIES, NOT,
OR, AND, LEFT-INSTRS, RIGHT-INSTRS, COMMAND, and BUMP-WALK, to the following
four new conjectures:
Case 4. (IMPLIES
(AND (LAMBDAP M)
(IMPLIES (NOT (ZEROP (ADD1 N)))
(EQUAL (WALK (SUB-WALK W (BODY M) U (ADD1 N))
(SUBST (BODY M) (BUMP X 0) (ADD1 N)))
(SUBST (WALK W (BODY M))
(BUMP (WALK U X) 0)
(ADD1 N))))
(NOT (EQUAL N 0))
(NUMBERP N))
(EQUAL (WALK (SUB-WALK W M U N)
(SUBST M X N))
(SUBST (WALK W M) (WALK U X) N))).
This simplifies, appealing to the lemma BODY-LAMBDA, and unfolding ZEROP,
NOT, IMPLIES, SUB-WALK, SUBST, and WALK, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(EQUAL (CADDR W) 'REDUCE)
(LAMBDAP (LEFT M))
(IMPLIES (NOT (ZEROP N))
(EQUAL (WALK (SUB-WALK (CADR W) (RIGHT M) U N)
(SUBST (RIGHT M) X N))
(SUBST (WALK (CADR W) (RIGHT M))
(WALK U X)
N)))
(IMPLIES (NOT (ZEROP N))
(EQUAL (WALK (SUB-WALK (CAR W) (LEFT M) U N)
(SUBST (LEFT M) X N))
(SUBST (WALK (CAR W) (LEFT M))
(WALK U X)
N)))
(NOT (EQUAL N 0))
(NUMBERP N))
(EQUAL (WALK (SUB-WALK W M U N)
(SUBST M X N))
(SUBST (WALK W M) (WALK U X) N))).
This simplifies, using linear arithmetic, rewriting with SUBST-SUBST,
RIGHT-COMB, SUBST-LAMBDA, LAMBDA-WALK, CAR-CONS, LAMBDAP-SUBST, LEFT-COMB,
and CDR-CONS, and expanding the functions ZEROP, NOT, IMPLIES, RIGHT-INSTRS,
LEFT-INSTRS, EQUAL, COMMAND, SUB-WALK, SUBST, ADD1, CAR, and WALK, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (CADDR W) 'REDUCE)
(LAMBDAP (LEFT M))))
(IMPLIES (NOT (ZEROP N))
(EQUAL (WALK (SUB-WALK (CADR W) (RIGHT M) U N)
(SUBST (RIGHT M) X N))
(SUBST (WALK (CADR W) (RIGHT M))
(WALK U X)
N)))
(IMPLIES (NOT (ZEROP N))
(EQUAL (WALK (SUB-WALK (CAR W) (LEFT M) U N)
(SUBST (LEFT M) X N))
(SUBST (WALK (CAR W) (LEFT M))
(WALK U X)
N)))
(NOT (EQUAL N 0))
(NUMBERP N))
(EQUAL (WALK (SUB-WALK W M U N)
(SUBST M X N))
(SUBST (WALK W M) (WALK U X) N))),
which simplifies, rewriting with RIGHT-COMB, LEFT-COMB, CAR-CONS, and
CDR-CONS, and unfolding the functions AND, ZEROP, NOT, IMPLIES, RIGHT-INSTRS,
LEFT-INSTRS, COMMAND, SUB-WALK, SUBST, EQUAL, CAR, and WALK, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP M))
(NOT (COMBP M))
(NOT (EQUAL N 0))
(NUMBERP N))
(EQUAL (WALK (SUB-WALK W M U N)
(SUBST M X N))
(SUBST (WALK W M) (WALK U X) N))).
This simplifies, expanding the definitions of SUB-WALK, SUBST, and WALK, to
the following four new formulas:
Case 1.4.
(IMPLIES (AND (NOT (LAMBDAP M))
(NOT (COMBP M))
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (EQUAL M 0))
(NUMBERP M)
(NOT (EQUAL M N))
(LESSP N M))
(EQUAL (WALK W (SUB1 M)) (SUB1 M))).
However this again simplifies, unfolding the function WALK, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (LAMBDAP M))
(NOT (COMBP M))
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (EQUAL M 0))
(NOT (NUMBERP M)))
(EQUAL (WALK W M) M)),
which again simplifies, opening up the definition of WALK, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (LAMBDAP M))
(NOT (COMBP M))
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (EQUAL M 0))
(NOT (EQUAL M N))
(NOT (LESSP N M)))
(EQUAL (WALK W M) M)),
which again simplifies, opening up the function WALK, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LAMBDAP M))
(NOT (COMBP M))
(NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL M 0))
(EQUAL (WALK W 0) 0)),
which again simplifies, opening up LAMBDAP, COMBP, WALK, and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
WALK-SUBST
(PROVE-LEMMA WALK-LAMBDA
(REWRITE)
(IMPLIES (LAMBDAP X)
(EQUAL (BODY (WALK U X))
(WALK U (BODY X)))))
This simplifies, appealing to the lemma BODY-LAMBDA, and opening up the
definition of WALK, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
WALK-LAMBDA
(DEFN MAKE-WALK
(M U V)
(IF (LAMBDAP M)
(MAKE-WALK (BODY M) U V)
(IF (COMBP M)
(IF (AND (EQUAL (COMMAND U) 'REDUCE)
(LAMBDAP (LEFT M)))
(SUB-WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(BODY (WALK (LEFT-INSTRS U) (LEFT M)))
(MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
1)
(IF (AND (EQUAL (COMMAND V) 'REDUCE)
(LAMBDAP (LEFT M)))
(LIST (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
'REDUCE)
(LIST (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V)))))
U)))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
establish that the measure (COUNT M) decreases according to the well-founded
relation LESSP in each recursive call. Hence, MAKE-WALK is accepted under the
definitional principle.
[ 0.0 0.0 0.0 ]
MAKE-WALK
(PROVE-LEMMA MAIN
(REWRITE)
(EQUAL (WALK (MAKE-WALK M U V) (WALK U M))
(WALK (MAKE-WALK M V U) (WALK V M))))
Give the conjecture the name *1.
Perhaps we can prove it by induction. The recursive terms in the
conjecture suggest four inductions. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (LAMBDAP M) (p (BODY M) U V))
(p M U V))
(IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(AND (EQUAL (COMMAND U) 'REDUCE)
(LAMBDAP (LEFT M)))
(p (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(p (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V)))
(p M U V))
(IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (COMMAND U) 'REDUCE)
(LAMBDAP (LEFT M))))
(AND (EQUAL (COMMAND V) 'REDUCE)
(LAMBDAP (LEFT M)))
(p (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(p (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V)))
(p M U V))
(IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (COMMAND U) 'REDUCE)
(LAMBDAP (LEFT M))))
(NOT (AND (EQUAL (COMMAND V) 'REDUCE)
(LAMBDAP (LEFT M))))
(p (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(p (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V)))
(p M U V))
(IMPLIES (AND (NOT (LAMBDAP M))
(NOT (COMBP M)))
(p M U V))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
establish that the measure (COUNT M) decreases according to the well-founded
relation LESSP in each induction step of the scheme. Note, however, the
inductive instances chosen for U and V. The above induction scheme leads to
the following five new conjectures:
Case 5. (IMPLIES (AND (LAMBDAP M)
(EQUAL (WALK (MAKE-WALK (BODY M) U V)
(WALK U (BODY M)))
(WALK (MAKE-WALK (BODY M) V U)
(WALK V (BODY M)))))
(EQUAL (WALK (MAKE-WALK M U V) (WALK U M))
(WALK (MAKE-WALK M V U) (WALK V M)))).
This simplifies, appealing to the lemma BODY-LAMBDA, and unfolding MAKE-WALK
and WALK, to:
T.
Case 4. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(AND (EQUAL (COMMAND U) 'REDUCE)
(LAMBDAP (LEFT M)))
(EQUAL (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (LEFT-INSTRS U) (LEFT M)))
(WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (LEFT-INSTRS V) (LEFT M))))
(EQUAL (WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS V)
(RIGHT-INSTRS U))
(WALK (RIGHT-INSTRS V) (RIGHT M)))))
(EQUAL (WALK (MAKE-WALK M U V) (WALK U M))
(WALK (MAKE-WALK M V U) (WALK V M)))).
This simplifies, applying WALK-LAMBDA and WALK-SUBST, and expanding the
definitions of COMMAND, AND, MAKE-WALK, EQUAL, and WALK, to two new goals:
Case 4.2.
(IMPLIES (AND (COMBP M)
(EQUAL (CADDR U) 'REDUCE)
(LAMBDAP (LEFT M))
(EQUAL (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (LEFT-INSTRS U) (LEFT M)))
(WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (LEFT-INSTRS V) (LEFT M))))
(EQUAL (WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS V)
(RIGHT-INSTRS U))
(WALK (RIGHT-INSTRS V) (RIGHT M))))
(NOT (EQUAL (CADDR V) 'REDUCE)))
(EQUAL (SUBST (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (LEFT-INSTRS U)
(BODY (LEFT M))))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
1)
(WALK (CONS (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(CONS (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS V)
(RIGHT-INSTRS U))
'(REDUCE)))
(COMB (WALK (LEFT-INSTRS V) (LEFT M))
(WALK (RIGHT-INSTRS V) (RIGHT M)))))),
which again simplifies, rewriting with WALK-LAMBDA, LAMBDA-WALK,
RIGHT-COMB, CAR-CONS, LEFT-COMB, and CDR-CONS, and opening up WALK,
LEFT-INSTRS, RIGHT-INSTRS, EQUAL, COMMAND, and CAR, to:
(IMPLIES (AND (COMBP M)
(EQUAL (CADDR U) 'REDUCE)
(LAMBDAP (LEFT M))
(EQUAL (LAMBDA (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (CAR U) (BODY (LEFT M)))))
(WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (LEFT-INSTRS V) (LEFT M))))
(EQUAL (WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS V)
(RIGHT-INSTRS U))
(WALK (RIGHT-INSTRS V) (RIGHT M))))
(NOT (EQUAL (CADDR V) 'REDUCE)))
(EQUAL (SUBST (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (CAR U) (BODY (LEFT M))))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
1)
(SUBST (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (CAR V) (BODY (LEFT M))))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
1))),
which further simplifies, applying BODY-LAMBDA and LAMBDA-EQUAL, and
opening up the functions LEFT-INSTRS, WALK, and RIGHT-INSTRS, to:
T.
Case 4.1.
(IMPLIES
(AND (COMBP M)
(EQUAL (CADDR U) 'REDUCE)
(LAMBDAP (LEFT M))
(EQUAL (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (LEFT-INSTRS U) (LEFT M)))
(WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (LEFT-INSTRS V) (LEFT M))))
(EQUAL (WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS V)
(RIGHT-INSTRS U))
(WALK (RIGHT-INSTRS V) (RIGHT M))))
(EQUAL (CADDR V) 'REDUCE))
(EQUAL (SUBST (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (LEFT-INSTRS U)
(BODY (LEFT M))))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
1)
(WALK (SUB-WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (LEFT-INSTRS V) (BODY (LEFT M)))
(MAKE-WALK (RIGHT M)
(RIGHT-INSTRS V)
(RIGHT-INSTRS U))
1)
(SUBST (WALK (LEFT-INSTRS V) (BODY (LEFT M)))
(WALK (RIGHT-INSTRS V) (RIGHT M))
1)))).
This again simplifies, rewriting with WALK-LAMBDA, LAMBDA-WALK, and
WALK-SUBST, and expanding the functions WALK, LEFT-INSTRS, and EQUAL, to
the new conjecture:
(IMPLIES (AND (COMBP M)
(EQUAL (CADDR U) 'REDUCE)
(LAMBDAP (LEFT M))
(EQUAL (LAMBDA (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (CAR U) (BODY (LEFT M)))))
(WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (LEFT-INSTRS V) (LEFT M))))
(EQUAL (WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS V)
(RIGHT-INSTRS U))
(WALK (RIGHT-INSTRS V) (RIGHT M))))
(EQUAL (CADDR V) 'REDUCE))
(EQUAL (SUBST (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (CAR U) (BODY (LEFT M))))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
1)
(SUBST (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (CAR V) (BODY (LEFT M))))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
1))),
which further simplifies, applying BODY-LAMBDA and LAMBDA-EQUAL, and
opening up the definitions of LEFT-INSTRS, WALK, and RIGHT-INSTRS, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (COMMAND U) 'REDUCE)
(LAMBDAP (LEFT M))))
(AND (EQUAL (COMMAND V) 'REDUCE)
(LAMBDAP (LEFT M)))
(EQUAL (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (LEFT-INSTRS U) (LEFT M)))
(WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (LEFT-INSTRS V) (LEFT M))))
(EQUAL (WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS V)
(RIGHT-INSTRS U))
(WALK (RIGHT-INSTRS V) (RIGHT M)))))
(EQUAL (WALK (MAKE-WALK M U V) (WALK U M))
(WALK (MAKE-WALK M V U) (WALK V M)))).
This simplifies, applying RIGHT-COMB, WALK-LAMBDA, CAR-CONS, LAMBDA-WALK,
LEFT-COMB, CDR-CONS, and WALK-SUBST, and expanding the definitions of
COMMAND, AND, MAKE-WALK, EQUAL, WALK, RIGHT-INSTRS, LEFT-INSTRS, and CAR, to:
(IMPLIES (AND (COMBP M)
(NOT (EQUAL (CADDR U) 'REDUCE))
(EQUAL (CADDR V) 'REDUCE)
(LAMBDAP (LEFT M))
(EQUAL (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (LEFT-INSTRS U) (LEFT M)))
(WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (LEFT-INSTRS V) (LEFT M))))
(EQUAL (WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS V)
(RIGHT-INSTRS U))
(WALK (RIGHT-INSTRS V) (RIGHT M)))))
(EQUAL (SUBST (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (CAR U) (BODY (LEFT M))))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
1)
(SUBST (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (LEFT-INSTRS V)
(BODY (LEFT M))))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
1))).
This again simplifies, applying WALK-LAMBDA and LAMBDA-WALK, and opening up
WALK and LEFT-INSTRS, to:
(IMPLIES (AND (COMBP M)
(NOT (EQUAL (CADDR U) 'REDUCE))
(EQUAL (CADDR V) 'REDUCE)
(LAMBDAP (LEFT M))
(EQUAL (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (LEFT-INSTRS U) (LEFT M)))
(LAMBDA (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (CAR V) (BODY (LEFT M))))))
(EQUAL (WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS V)
(RIGHT-INSTRS U))
(WALK (RIGHT-INSTRS V) (RIGHT M)))))
(EQUAL (SUBST (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (CAR U) (BODY (LEFT M))))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
1)
(SUBST (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (CAR V) (BODY (LEFT M))))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
1))),
which further simplifies, rewriting with BODY-LAMBDA and LAMBDA-EQUAL, and
opening up the functions LEFT-INSTRS, WALK, and RIGHT-INSTRS, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP M))
(COMBP M)
(NOT (AND (EQUAL (COMMAND U) 'REDUCE)
(LAMBDAP (LEFT M))))
(NOT (AND (EQUAL (COMMAND V) 'REDUCE)
(LAMBDAP (LEFT M))))
(EQUAL (WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS U)
(LEFT-INSTRS V))
(WALK (LEFT-INSTRS U) (LEFT M)))
(WALK (MAKE-WALK (LEFT M)
(LEFT-INSTRS V)
(LEFT-INSTRS U))
(WALK (LEFT-INSTRS V) (LEFT M))))
(EQUAL (WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS U)
(RIGHT-INSTRS V))
(WALK (RIGHT-INSTRS U) (RIGHT M)))
(WALK (MAKE-WALK (RIGHT M)
(RIGHT-INSTRS V)
(RIGHT-INSTRS U))
(WALK (RIGHT-INSTRS V) (RIGHT M)))))
(EQUAL (WALK (MAKE-WALK M U V) (WALK U M))
(WALK (MAKE-WALK M V U) (WALK V M)))).
This simplifies, rewriting with RIGHT-COMB, LEFT-COMB, CAR-CONS, and
CDR-CONS, and opening up the definitions of COMMAND, AND, MAKE-WALK, WALK,
RIGHT-INSTRS, LEFT-INSTRS, EQUAL, and CAR, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP M))
(NOT (COMBP M)))
(EQUAL (WALK (MAKE-WALK M U V) (WALK U M))
(WALK (MAKE-WALK M V U) (WALK V M)))),
which simplifies, opening up the functions MAKE-WALK and WALK, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
MAIN
(DEFN REDUCE
(W M)
(IF (LISTP W)
(REDUCE (CDR W) (WALK (CAR W) M))
M))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT W) decreases according to the well-founded relation LESSP in each
recursive call. Hence, REDUCE is accepted under the definitional principle.
[ 0.0 0.0 0.0 ]
REDUCE
(DEFN MAKE-WALK-REDUCE
(M W V)
(IF (LISTP V)
(MAKE-WALK-REDUCE (WALK (CAR V) M)
(MAKE-WALK M (CAR V) W)
(CDR V))
W))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT V) decreases according to the well-founded relation LESSP in each
recursive call. Hence, MAKE-WALK-REDUCE is accepted under the definitional
principle.
[ 0.0 0.0 0.0 ]
MAKE-WALK-REDUCE
(DEFN MAKE-REDUCE-WALK
(M W V)
(IF (LISTP V)
(CONS (MAKE-WALK M W (CAR V))
(MAKE-REDUCE-WALK (WALK (CAR V) M)
(MAKE-WALK M (CAR V) W)
(CDR V)))
NIL))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT V) decreases according to the well-founded relation LESSP in each
recursive call. Hence, MAKE-REDUCE-WALK is accepted under the principle of
definition. Observe that:
(OR (LITATOM (MAKE-REDUCE-WALK M W V))
(LISTP (MAKE-REDUCE-WALK M W V)))
is a theorem.
[ 0.0 0.0 0.0 ]
MAKE-REDUCE-WALK
(PROVE-LEMMA WALK-REDUCE
(REWRITE)
(EQUAL (REDUCE (MAKE-REDUCE-WALK M W V)
(WALK W M))
(WALK (MAKE-WALK-REDUCE M W V)
(REDUCE V M))))
Give the conjecture the name *1.
Perhaps we can prove it by 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 V)
(p (WALK (CAR V) M)
(MAKE-WALK M (CAR V) W)
(CDR V)))
(p M W V))
(IMPLIES (NOT (LISTP V)) (p M W V))).
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. Note, however, the inductive instances chosen for M and W.
The above induction scheme leads to the following two new conjectures:
Case 2. (IMPLIES (AND (LISTP V)
(EQUAL (REDUCE (MAKE-REDUCE-WALK (WALK (CAR V) M)
(MAKE-WALK M (CAR V) W)
(CDR V))
(WALK (MAKE-WALK M (CAR V) W)
(WALK (CAR V) M)))
(WALK (MAKE-WALK-REDUCE (WALK (CAR V) M)
(MAKE-WALK M (CAR V) W)
(CDR V))
(REDUCE (CDR V) (WALK (CAR V) M)))))
(EQUAL (REDUCE (MAKE-REDUCE-WALK M W V)
(WALK W M))
(WALK (MAKE-WALK-REDUCE M W V)
(REDUCE V M)))).
This simplifies, appealing to the lemmas MAIN, CAR-CONS, and CDR-CONS, and
unfolding MAKE-REDUCE-WALK, REDUCE, and MAKE-WALK-REDUCE, to:
T.
Case 1. (IMPLIES (NOT (LISTP V))
(EQUAL (REDUCE (MAKE-REDUCE-WALK M W V)
(WALK W M))
(WALK (MAKE-WALK-REDUCE M W V)
(REDUCE V M)))).
This simplifies, expanding the definitions of MAKE-REDUCE-WALK, LISTP,
REDUCE, and MAKE-WALK-REDUCE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
WALK-REDUCE
(DEFN MAKE-REDUCE
(M U V)
(IF (LISTP U)
(CONS (MAKE-WALK-REDUCE M (CAR U) V)
(MAKE-REDUCE (WALK (CAR U) M)
(CDR U)
(MAKE-REDUCE-WALK M (CAR U) V)))
U))
Linear arithmetic and the lemma CDR-LESSP can be used to show that the
measure (COUNT U) decreases according to the well-founded relation LESSP in
each recursive call. Hence, MAKE-REDUCE is accepted under the definitional
principle. Note that:
(OR (LISTP (MAKE-REDUCE M U V))
(EQUAL (MAKE-REDUCE M U V) U))
is a theorem.
[ 0.0 0.0 0.0 ]
MAKE-REDUCE
(PROVE-LEMMA LIST-MAKE-REDUCE
(REWRITE)
(IMPLIES (LISTP V)
(EQUAL (REDUCE (MAKE-REDUCE M U V)
(REDUCE V M))
(REDUCE (MAKE-REDUCE (WALK (CAR V) M)
(MAKE-REDUCE-WALK M (CAR V) U)
(CDR V))
(REDUCE V M)))))
This conjecture simplifies, unfolding the function REDUCE, to:
(IMPLIES (LISTP V)
(EQUAL (REDUCE (MAKE-REDUCE M U V)
(REDUCE (CDR V) (WALK (CAR V) M)))
(REDUCE (MAKE-REDUCE (WALK (CAR V) M)
(MAKE-REDUCE-WALK M (CAR V) U)
(CDR V))
(REDUCE (CDR V) (WALK (CAR V) M))))).
Applying the lemma CAR-CDR-ELIM, replace V by (CONS Z X) to eliminate (CDR V)
and (CAR V). This produces:
(EQUAL (REDUCE (MAKE-REDUCE M U (CONS Z X))
(REDUCE X (WALK Z M)))
(REDUCE (MAKE-REDUCE (WALK Z M)
(MAKE-REDUCE-WALK M Z U)
X)
(REDUCE X (WALK Z M)))),
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 (LISTP V)
(EQUAL (REDUCE (MAKE-REDUCE M U V)
(REDUCE V M))
(REDUCE (MAKE-REDUCE (WALK (CAR V) M)
(MAKE-REDUCE-WALK M (CAR V) U)
(CDR V))
(REDUCE V M)))).
We named this *1. We will try to prove it by induction. Five inductions are
suggested by terms in the conjecture. They merge into three likely candidate
inductions. However, only one is unflawed. We will induct according to the
following scheme:
(AND (IMPLIES (AND (LISTP U)
(p (WALK (CAR U) M)
(CDR U)
(MAKE-REDUCE-WALK M (CAR U) V)))
(p M U V))
(IMPLIES (NOT (LISTP U)) (p M U V))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT U)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. Note, however, the inductive instances chosen for M and V.
The above induction scheme generates three new conjectures:
Case 3. (IMPLIES (AND (LISTP U)
(NOT (LISTP (MAKE-REDUCE-WALK M (CAR U) V)))
(LISTP V))
(EQUAL (REDUCE (MAKE-REDUCE M U V)
(REDUCE V M))
(REDUCE (MAKE-REDUCE (WALK (CAR V) M)
(MAKE-REDUCE-WALK M (CAR V) U)
(CDR V))
(REDUCE V M)))),
which simplifies, applying the lemmas CAR-CONS, CDR-CONS, and MAIN, and
opening up the definitions of MAKE-REDUCE, REDUCE, and MAKE-REDUCE-WALK, to:
(IMPLIES
(AND (LISTP U)
(NOT (LISTP (MAKE-REDUCE-WALK M (CAR U) V)))
(LISTP V))
(EQUAL
(REDUCE (MAKE-REDUCE (WALK (CAR U) M)
(CDR U)
(MAKE-REDUCE-WALK M (CAR U) V))
(WALK (MAKE-WALK-REDUCE M (CAR U) V)
(REDUCE (CDR V) (WALK (CAR V) M))))
(REDUCE (MAKE-REDUCE (WALK (MAKE-WALK M (CAR U) (CAR V))
(WALK (CAR U) M))
(MAKE-REDUCE-WALK (WALK (CAR U) M)
(MAKE-WALK M (CAR U) (CAR V))
(CDR U))
(MAKE-REDUCE-WALK (WALK (CAR V) M)
(MAKE-WALK M (CAR V) (CAR U))
(CDR V)))
(WALK (MAKE-WALK-REDUCE (WALK (CAR V) M)
(MAKE-WALK M (CAR V) (CAR U))
(CDR V))
(REDUCE (CDR V) (WALK (CAR V) M)))))).
This again simplifies, expanding the function MAKE-REDUCE-WALK, to:
T.
Case 2. (IMPLIES
(AND
(LISTP U)
(EQUAL
(REDUCE (MAKE-REDUCE (WALK (CAR U) M)
(CDR U)
(MAKE-REDUCE-WALK M (CAR U) V))
(REDUCE (MAKE-REDUCE-WALK M (CAR U) V)
(WALK (CAR U) M)))
(REDUCE
(MAKE-REDUCE (WALK (CAR (MAKE-REDUCE-WALK M (CAR U) V))
(WALK (CAR U) M))
(MAKE-REDUCE-WALK (WALK (CAR U) M)
(CAR (MAKE-REDUCE-WALK M (CAR U) V))
(CDR U))
(CDR (MAKE-REDUCE-WALK M (CAR U) V)))
(REDUCE (MAKE-REDUCE-WALK M (CAR U) V)
(WALK (CAR U) M))))
(LISTP V))
(EQUAL (REDUCE (MAKE-REDUCE M U V)
(REDUCE V M))
(REDUCE (MAKE-REDUCE (WALK (CAR V) M)
(MAKE-REDUCE-WALK M (CAR V) U)
(CDR V))
(REDUCE V M)))),
which simplifies, appealing to the lemmas WALK-REDUCE, CAR-CONS, CDR-CONS,
and MAIN, and opening up the definitions of REDUCE, MAKE-REDUCE, and
MAKE-REDUCE-WALK, to the formula:
(IMPLIES
(AND
(LISTP U)
(EQUAL
(REDUCE (MAKE-REDUCE (WALK (CAR U) M)
(CDR U)
(MAKE-REDUCE-WALK M (CAR U) V))
(WALK (MAKE-WALK-REDUCE M (CAR U) V)
(REDUCE (CDR V) (WALK (CAR V) M))))
(REDUCE
(MAKE-REDUCE (WALK (CAR (MAKE-REDUCE-WALK M (CAR U) V))
(WALK (CAR U) M))
(MAKE-REDUCE-WALK (WALK (CAR U) M)
(CAR (MAKE-REDUCE-WALK M (CAR U) V))
(CDR U))
(CDR (MAKE-REDUCE-WALK M (CAR U) V)))
(WALK (MAKE-WALK-REDUCE M (CAR U) V)
(REDUCE (CDR V) (WALK (CAR V) M)))))
(LISTP V))
(EQUAL
(REDUCE (MAKE-REDUCE (WALK (CAR U) M)
(CDR U)
(MAKE-REDUCE-WALK M (CAR U) V))
(WALK (MAKE-WALK-REDUCE M (CAR U) V)
(REDUCE (CDR V) (WALK (CAR V) M))))
(REDUCE (MAKE-REDUCE (WALK (MAKE-WALK M (CAR U) (CAR V))
(WALK (CAR U) M))
(MAKE-REDUCE-WALK (WALK (CAR U) M)
(MAKE-WALK M (CAR U) (CAR V))
(CDR U))
(MAKE-REDUCE-WALK (WALK (CAR V) M)
(MAKE-WALK M (CAR V) (CAR U))
(CDR V)))
(WALK (MAKE-WALK-REDUCE (WALK (CAR V) M)
(MAKE-WALK M (CAR V) (CAR U))
(CDR V))
(REDUCE (CDR V) (WALK (CAR V) M)))))).
This again simplifies, applying CAR-CONS and CDR-CONS, and opening up
MAKE-WALK-REDUCE and MAKE-REDUCE-WALK, to:
(IMPLIES
(AND
(LISTP U)
(EQUAL
(REDUCE (MAKE-REDUCE (WALK (CAR U) M)
(CDR U)
(MAKE-REDUCE-WALK M (CAR U) V))
(WALK (MAKE-WALK-REDUCE (WALK (CAR V) M)
(MAKE-WALK M (CAR V) (CAR U))
(CDR V))
(REDUCE (CDR V) (WALK (CAR V) M))))
(REDUCE
(MAKE-REDUCE (WALK (MAKE-WALK M (CAR U) (CAR V))
(WALK (CAR U) M))
(MAKE-REDUCE-WALK (WALK (CAR U) M)
(CAR (MAKE-REDUCE-WALK M (CAR U) V))
(CDR U))
(MAKE-REDUCE-WALK (WALK (CAR V) M)
(MAKE-WALK M (CAR V) (CAR U))
(CDR V)))
(WALK (MAKE-WALK-REDUCE (WALK (CAR V) M)
(MAKE-WALK M (CAR V) (CAR U))
(CDR V))
(REDUCE (CDR V) (WALK (CAR V) M)))))
(LISTP V))
(EQUAL
(REDUCE (MAKE-REDUCE (WALK (CAR U) M)
(CDR U)
(MAKE-REDUCE-WALK M (CAR U) V))
(WALK (MAKE-WALK-REDUCE (WALK (CAR V) M)
(MAKE-WALK M (CAR V) (CAR U))
(CDR V))
(REDUCE (CDR V) (WALK (CAR V) M))))
(REDUCE (MAKE-REDUCE (WALK (MAKE-WALK M (CAR U) (CAR V))
(WALK (CAR U) M))
(MAKE-REDUCE-WALK (WALK (CAR U) M)
(MAKE-WALK M (CAR U) (CAR V))
(CDR U))
(MAKE-REDUCE-WALK (WALK (CAR V) M)
(MAKE-WALK M (CAR V) (CAR U))
(CDR V)))
(WALK (MAKE-WALK-REDUCE (WALK (CAR V) M)
(MAKE-WALK M (CAR V) (CAR U))
(CDR V))
(REDUCE (CDR V) (WALK (CAR V) M)))))),
which further simplifies, rewriting with CAR-CONS, and expanding the
function MAKE-REDUCE-WALK, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP U)) (LISTP V))
(EQUAL (REDUCE (MAKE-REDUCE M U V)
(REDUCE V M))
(REDUCE (MAKE-REDUCE (WALK (CAR V) M)
(MAKE-REDUCE-WALK M (CAR V) U)
(CDR V))
(REDUCE V M)))).
This simplifies, opening up MAKE-REDUCE, REDUCE, MAKE-REDUCE-WALK, and LISTP,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
LIST-MAKE-REDUCE
(PROVE-LEMMA LIST-MAKE-REDUCE1
(REWRITE)
(EQUAL (REDUCE (MAKE-REDUCE M U (CONS X Y))
(REDUCE Y (WALK X M)))
(REDUCE (MAKE-REDUCE (WALK X M)
(MAKE-REDUCE-WALK M X U)
Y)
(REDUCE (CONS X Y) M)))
((USE (LIST-MAKE-REDUCE (V (CONS X Y))))))
This formula can be simplified, using the abbreviations CDR-CONS and CAR-CONS,
to the new goal:
(IMPLIES (IMPLIES (LISTP (CONS X Y))
(EQUAL (REDUCE (MAKE-REDUCE M U (CONS X Y))
(REDUCE (CONS X Y) M))
(REDUCE (MAKE-REDUCE (WALK X M)
(MAKE-REDUCE-WALK M X U)
Y)
(REDUCE (CONS X Y) M))))
(EQUAL (REDUCE (MAKE-REDUCE M U (CONS X Y))
(REDUCE Y (WALK X M)))
(REDUCE (MAKE-REDUCE (WALK X M)
(MAKE-REDUCE-WALK M X U)
Y)
(REDUCE (CONS X Y) M)))),
which simplifies, rewriting with CAR-CONS and CDR-CONS, and expanding REDUCE
and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LIST-MAKE-REDUCE1
(PROVE-LEMMA CHURCH-ROSSER
(REWRITE)
(EQUAL (REDUCE (MAKE-REDUCE M U V)
(REDUCE V M))
(REDUCE (MAKE-REDUCE M V U)
(REDUCE U M))))
WARNING: the newly proposed lemma, CHURCH-ROSSER, could be applied whenever
the previously added lemma LIST-MAKE-REDUCE could.
Give the conjecture the name *1.
Perhaps we can prove it by induction. The recursive terms in the
conjecture suggest four inductions. 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 (AND (LISTP V)
(p (WALK (CAR V) M)
(MAKE-REDUCE-WALK M (CAR V) U)
(CDR V)))
(p M U V))
(IMPLIES (NOT (LISTP V)) (p M U V))).
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. Note, however, the inductive instances chosen for M and U.
The above induction scheme leads to the following two new conjectures:
Case 2. (IMPLIES
(AND (LISTP V)
(EQUAL (REDUCE (MAKE-REDUCE (WALK (CAR V) M)
(MAKE-REDUCE-WALK M (CAR V) U)
(CDR V))
(REDUCE (CDR V) (WALK (CAR V) M)))
(REDUCE (MAKE-REDUCE (WALK (CAR V) M)
(CDR V)
(MAKE-REDUCE-WALK M (CAR V) U))
(REDUCE (MAKE-REDUCE-WALK M (CAR V) U)
(WALK (CAR V) M)))))
(EQUAL (REDUCE (MAKE-REDUCE M U V)
(REDUCE V M))
(REDUCE (MAKE-REDUCE M V U)
(REDUCE U M)))).
This simplifies, appealing to the lemmas WALK-REDUCE, CAR-CONS, and CDR-CONS,
and unfolding REDUCE and MAKE-REDUCE, to the new conjecture:
(IMPLIES
(AND (LISTP V)
(EQUAL (REDUCE (MAKE-REDUCE (WALK (CAR V) M)
(MAKE-REDUCE-WALK M (CAR V) U)
(CDR V))
(REDUCE (CDR V) (WALK (CAR V) M)))
(REDUCE (MAKE-REDUCE (WALK (CAR V) M)
(CDR V)
(MAKE-REDUCE-WALK M (CAR V) U))
(WALK (MAKE-WALK-REDUCE M (CAR V) U)
(REDUCE U M)))))
(EQUAL (REDUCE (MAKE-REDUCE M U V)
(REDUCE (CDR V) (WALK (CAR V) M)))
(REDUCE (MAKE-REDUCE (WALK (CAR V) M)
(MAKE-REDUCE-WALK M (CAR V) U)
(CDR V))
(REDUCE (CDR V) (WALK (CAR V) M))))).
Applying the lemma CAR-CDR-ELIM, replace V by (CONS X Z) to eliminate
(CAR V) and (CDR V). We thus obtain the new conjecture:
(IMPLIES (EQUAL (REDUCE (MAKE-REDUCE (WALK X M)
(MAKE-REDUCE-WALK M X U)
Z)
(REDUCE Z (WALK X M)))
(REDUCE (MAKE-REDUCE (WALK X M)
Z
(MAKE-REDUCE-WALK M X U))
(WALK (MAKE-WALK-REDUCE M X U)
(REDUCE U M))))
(EQUAL (REDUCE (MAKE-REDUCE M U (CONS X Z))
(REDUCE Z (WALK X M)))
(REDUCE (MAKE-REDUCE (WALK X M)
(MAKE-REDUCE-WALK M X U)
Z)
(REDUCE Z (WALK X M))))),
which further simplifies, rewriting with CAR-CONS, CDR-CONS, and
LIST-MAKE-REDUCE1, and expanding the definition of REDUCE, to:
T.
Case 1. (IMPLIES (NOT (LISTP V))
(EQUAL (REDUCE (MAKE-REDUCE M U V)
(REDUCE V M))
(REDUCE (MAKE-REDUCE M V U)
(REDUCE U M)))).
This simplifies, opening up the functions REDUCE and MAKE-REDUCE, to:
(IMPLIES (NOT (LISTP V))
(EQUAL (REDUCE (MAKE-REDUCE M U V) M)
(REDUCE U M))),
which we will name *1.1.
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 U)
(p (WALK (CAR U) M)
(CDR U)
(MAKE-REDUCE-WALK M (CAR U) V)))
(p M U V))
(IMPLIES (NOT (LISTP U)) (p M U V))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure (COUNT U)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. Note, however, the inductive instances chosen for M and V.
The above induction scheme produces the following three new formulas:
Case 3. (IMPLIES (AND (LISTP U)
(LISTP (MAKE-REDUCE-WALK M (CAR U) V))
(NOT (LISTP V)))
(EQUAL (REDUCE (MAKE-REDUCE M U V) M)
(REDUCE U M))).
This simplifies, unfolding the definitions of MAKE-REDUCE-WALK and LISTP, to:
T.
Case 2. (IMPLIES
(AND (LISTP U)
(EQUAL (REDUCE (MAKE-REDUCE (WALK (CAR U) M)
(CDR U)
(MAKE-REDUCE-WALK M (CAR U) V))
(WALK (CAR U) M))
(REDUCE (CDR U) (WALK (CAR U) M)))
(NOT (LISTP V)))
(EQUAL (REDUCE (MAKE-REDUCE M U V) M)
(REDUCE U M))).
This simplifies, applying CAR-CONS and CDR-CONS, and unfolding the
definitions of MAKE-REDUCE, MAKE-WALK-REDUCE, and REDUCE, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP U)) (NOT (LISTP V)))
(EQUAL (REDUCE (MAKE-REDUCE M U V) M)
(REDUCE U M))),
which simplifies, unfolding MAKE-REDUCE and REDUCE, to:
T.
That finishes the proof of *1.1, which, consequently, finishes the proof
of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
CHURCH-ROSSER
(DEFN TRANSLATE
(X BOUNDS)
(IF (NLAMBDAP X)
(LAMBDA (TRANSLATE (NBODY X)
(CONS (NBIND X) BOUNDS)))
(IF (NCOMBP X)
(COMB (TRANSLATE (NLEFT X) BOUNDS)
(TRANSLATE (NRIGHT X) BOUNDS))
(IF (NUMBERP X) (INDEX X BOUNDS) X))))
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and
NLEFT-LESSP inform us that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each recursive call. Hence, TRANSLATE is
accepted under the definitional principle. From the definition we can
conclude that:
(OR (OR (NUMBERP (TRANSLATE X BOUNDS))
(LAMBDAP (TRANSLATE X BOUNDS))
(COMBP (TRANSLATE X BOUNDS)))
(EQUAL (TRANSLATE X BOUNDS) X))
is a theorem.
[ 0.0 0.0 0.0 ]
TRANSLATE
(PROVE-LEMMA ALPHA-TRANSLATE
(REWRITE)
(IMPLIES (ALPHA-EQUAL A B X Y)
(EQUAL (TRANSLATE A X)
(TRANSLATE B Y))))
WARNING: Note that ALPHA-TRANSLATE contains the free variables Y and B which
will be chosen by instantiating the hypothesis (ALPHA-EQUAL A B X Y).
Give the conjecture the name *1.
We will appeal to induction. There are four plausible inductions.
However, they merge into one likely candidate induction. We will induct
according to the following scheme:
(AND (IMPLIES (AND (AND (NLAMBDAP A) (NLAMBDAP B))
(p (NBODY A)
(CONS (NBIND A) X)
(NBODY B)
(CONS (NBIND B) Y)))
(p A X B Y))
(IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(p (NRIGHT A) X (NRIGHT B) Y)
(p (NLEFT A) X (NLEFT B) Y))
(p A X B Y))
(IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(AND (NUMBERP A) (NUMBERP B)))
(p A X B Y))
(IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(NOT (AND (NUMBERP A) (NUMBERP B))))
(p A X B Y))).
Linear arithmetic, the lemmas NBODY-LESSEQP, NBODY-LESSP, NRIGHT-LESSEQP,
NRIGHT-LESSP, NLEFT-LESSEQP, and NLEFT-LESSP, and the definition of AND
establish that the measure (COUNT A) decreases according to the well-founded
relation LESSP in each induction step of the scheme. Note, however, the
inductive instances chosen for B, X, and Y. The above induction scheme
produces the following eight new formulas:
Case 8. (IMPLIES (AND (AND (NLAMBDAP A) (NLAMBDAP B))
(NOT (ALPHA-EQUAL (NBODY A)
(NBODY B)
(CONS (NBIND A) X)
(CONS (NBIND B) Y)))
(ALPHA-EQUAL A B X Y))
(EQUAL (TRANSLATE A X)
(TRANSLATE B Y))).
This simplifies, opening up AND and ALPHA-EQUAL, to:
T.
Case 7. (IMPLIES (AND (AND (NLAMBDAP A) (NLAMBDAP B))
(EQUAL (TRANSLATE (NBODY A)
(CONS (NBIND A) X))
(TRANSLATE (NBODY B)
(CONS (NBIND B) Y)))
(ALPHA-EQUAL A B X Y))
(EQUAL (TRANSLATE A X)
(TRANSLATE B Y))).
This simplifies, opening up the definitions of AND, ALPHA-EQUAL, and
TRANSLATE, to:
T.
Case 6. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(NOT (ALPHA-EQUAL (NRIGHT A)
(NRIGHT B)
X Y))
(NOT (ALPHA-EQUAL (NLEFT A) (NLEFT B) X Y))
(ALPHA-EQUAL A B X Y))
(EQUAL (TRANSLATE A X)
(TRANSLATE B Y))).
This simplifies, opening up the definitions of AND and ALPHA-EQUAL, to:
T.
Case 5. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(EQUAL (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) Y))
(NOT (ALPHA-EQUAL (NLEFT A) (NLEFT B) X Y))
(ALPHA-EQUAL A B X Y))
(EQUAL (TRANSLATE A X)
(TRANSLATE B Y))).
This simplifies, opening up the definitions of AND and ALPHA-EQUAL, to:
T.
Case 4. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(NOT (ALPHA-EQUAL (NRIGHT A)
(NRIGHT B)
X Y))
(EQUAL (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) Y))
(ALPHA-EQUAL A B X Y))
(EQUAL (TRANSLATE A X)
(TRANSLATE B Y))).
This simplifies, opening up the definitions of AND and ALPHA-EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(EQUAL (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) Y))
(EQUAL (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) Y))
(ALPHA-EQUAL A B X Y))
(EQUAL (TRANSLATE A X)
(TRANSLATE B Y))).
This simplifies, opening up the functions AND, ALPHA-EQUAL, and TRANSLATE,
to:
T.
Case 2. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(AND (NUMBERP A) (NUMBERP B))
(ALPHA-EQUAL A B X Y))
(EQUAL (TRANSLATE A X)
(TRANSLATE B Y))).
This simplifies, unfolding the functions AND, ALPHA-EQUAL, and TRANSLATE, to:
T.
Case 1. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(NOT (AND (NUMBERP A) (NUMBERP B)))
(ALPHA-EQUAL A B X Y))
(EQUAL (TRANSLATE A X)
(TRANSLATE B Y))).
This simplifies, opening up the functions AND, ALPHA-EQUAL, and TRANSLATE,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
ALPHA-TRANSLATE
(DEFN INSERT
(X BOUNDS N)
(IF (ZEROP N)
(CONS X BOUNDS)
(IF (LISTP BOUNDS)
(CONS (CAR BOUNDS)
(INSERT X (CDR BOUNDS) (SUB1 N)))
(CONS X NIL))))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT BOUNDS) decreases according to the well-founded relation LESSP in each
recursive call. Hence, INSERT is accepted under the definitional principle.
The definition of INSERT can be justified in another way. 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. From the definition we can conclude that:
(LISTP (INSERT X BOUNDS N))
is a theorem.
[ 0.0 0.0 0.0 ]
INSERT
(DEFN NSUBST-IND
(X Y Z BOUNDS N)
(IF (NLAMBDAP X)
(IF (EQUAL (NBIND X) Z)
T
(NSUBST-IND (NBODY X)
Y Z
(CONS (NBIND X) BOUNDS)
(ADD1 N)))
(IF (NCOMBP X)
(AND (NSUBST-IND (NLEFT X) Y Z BOUNDS N)
(NSUBST-IND (NRIGHT X) Y Z BOUNDS N))
T)))
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and
NLEFT-LESSP establish that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each recursive call. Hence, NSUBST-IND is
accepted under the definitional principle. Observe that:
(TRUEP (NSUBST-IND X Y Z BOUNDS N))
is a theorem.
[ 0.0 0.0 0.0 ]
NSUBST-IND
(DEFN TRANS-INSERT-IND
(X Z BOUNDS N)
(IF (NLAMBDAP X)
(TRANS-INSERT-IND (NBODY X)
Z
(CONS (NBIND X) BOUNDS)
(ADD1 N))
(IF (NCOMBP X)
(AND (TRANS-INSERT-IND (NLEFT X)
Z BOUNDS N)
(TRANS-INSERT-IND (NRIGHT X)
Z BOUNDS N))
T)))
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and
NLEFT-LESSP can be used to establish that the measure (COUNT X) decreases
according to the well-founded relation LESSP in each recursive call. Hence,
TRANS-INSERT-IND is accepted under the definitional principle. Note that:
(TRUEP (TRANS-INSERT-IND X Z BOUNDS N))
is a theorem.
[ 0.0 0.0 0.0 ]
TRANS-INSERT-IND
(DEFN PRECEDE
(X BOUNDS N)
(IF (ZEROP N)
F
(IF (LISTP BOUNDS)
(OR (EQUAL (CAR BOUNDS) X)
(PRECEDE X (CDR BOUNDS) (SUB1 N)))
F)))
Linear arithmetic and the lemma CDR-LESSP can be used to show that the
measure (COUNT BOUNDS) decreases according to the well-founded relation LESSP
in each recursive call. Hence, PRECEDE is accepted under the definitional
principle. The definition of PRECEDE can be justified in another way. 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. From the definition we can conclude that:
(OR (FALSEP (PRECEDE X BOUNDS N))
(TRUEP (PRECEDE X BOUNDS N)))
is a theorem.
[ 0.0 0.0 0.0 ]
PRECEDE
(PROVE-LEMMA NPRECEDE-INDEX
(REWRITE)
(IMPLIES (AND (NOT (PRECEDE Z BOUNDS N))
(LEQ N (LENGTH BOUNDS)))
(EQUAL (INDEX Z (INSERT Z BOUNDS N))
(ADD1 N))))
Give the conjecture the name *1.
We will appeal to induction. There are six plausible inductions.
However, they merge into one likely candidate induction. We will induct
according to the following scheme:
(AND (IMPLIES (ZEROP N) (p Z BOUNDS N))
(IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(p Z (CDR BOUNDS) (SUB1 N)))
(p Z BOUNDS N))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS)))
(p Z BOUNDS N))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT BOUNDS) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for N. The above induction scheme generates the following five new formulas:
Case 5. (IMPLIES (AND (ZEROP N)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N)))
(EQUAL (INDEX Z (INSERT Z BOUNDS N))
(ADD1 N))).
This simplifies, rewriting with CAR-CONS and SUB1-TYPE-RESTRICTION, and
unfolding the definitions of ZEROP, EQUAL, PRECEDE, LENGTH, LESSP, INSERT,
INDEX, and ADD1, to:
T.
Case 4. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(PRECEDE Z (CDR BOUNDS) (SUB1 N))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N)))
(EQUAL (INDEX Z (INSERT Z BOUNDS N))
(ADD1 N))),
which simplifies, expanding ZEROP and PRECEDE, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(LESSP (LENGTH (CDR BOUNDS)) (SUB1 N))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N)))
(EQUAL (INDEX Z (INSERT Z BOUNDS N))
(ADD1 N))),
which simplifies, rewriting with the lemma SUB1-ADD1, and expanding the
functions ZEROP, PRECEDE, LENGTH, and LESSP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(EQUAL (INDEX Z
(INSERT Z (CDR BOUNDS) (SUB1 N)))
(ADD1 (SUB1 N)))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N)))
(EQUAL (INDEX Z (INSERT Z BOUNDS N))
(ADD1 N))),
which simplifies, rewriting with ADD1-SUB1, SUB1-ADD1, CDR-CONS, and
CAR-CONS, and expanding ZEROP, PRECEDE, LENGTH, LESSP, INSERT, and INDEX, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N)))
(EQUAL (INDEX Z (INSERT Z BOUNDS N))
(ADD1 N))).
This simplifies, opening up ZEROP, PRECEDE, LENGTH, EQUAL, and LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NPRECEDE-INDEX
(PROVE-LEMMA PRECEDE-INDEX1
(REWRITE)
(IMPLIES (AND (LESSP N (INDEX X BOUNDS))
(LEQ N (LENGTH BOUNDS)))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(IF (EQUAL X Z)
(ADD1 N)
(ADD1 (INDEX X BOUNDS))))))
This simplifies, trivially, to two new goals:
Case 2. (IMPLIES (AND (LESSP N (INDEX X BOUNDS))
(NOT (LESSP (LENGTH BOUNDS) N))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 (INDEX X BOUNDS)))),
which we will name *1.
Case 1. (IMPLIES (AND (LESSP N (INDEX X BOUNDS))
(NOT (LESSP (LENGTH BOUNDS) N))
(EQUAL X Z))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N))).
This again simplifies, clearly, to:
(IMPLIES (AND (LESSP N (INDEX Z BOUNDS))
(NOT (LESSP (LENGTH BOUNDS) N)))
(EQUAL (INDEX Z (INSERT Z BOUNDS N))
(ADD1 N))),
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 N (INDEX X BOUNDS))
(IF (LESSP (LENGTH BOUNDS) N) F T))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(IF (EQUAL X Z)
(ADD1 N)
(ADD1 (INDEX X BOUNDS))))),
named *1. Let us appeal to the induction principle. There are seven
plausible inductions. However, they merge into one likely candidate induction.
We will induct according to the following scheme:
(AND (IMPLIES (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS))))
(p X Z BOUNDS N))
(IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(OR (EQUAL N 0) (NOT (NUMBERP N))))
(p X Z BOUNDS N))
(IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(p X Z (CDR BOUNDS) (SUB1 N)))
(p X Z BOUNDS N))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT establish that the measure (COUNT N) decreases according to the
well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instance chosen for BOUNDS. The above induction scheme
leads to five new conjectures:
Case 5. (IMPLIES (AND (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS))))
(LESSP N (INDEX X BOUNDS))
(IF (LESSP (LENGTH BOUNDS) N) F T))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(IF (EQUAL X Z)
(ADD1 N)
(ADD1 (INDEX X BOUNDS))))),
which simplifies, opening up the definitions of INDEX, NOT, OR, EQUAL, and
LESSP, to:
T.
Case 4. (IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(OR (EQUAL N 0) (NOT (NUMBERP N)))
(LESSP N (INDEX X BOUNDS))
(IF (LESSP (LENGTH BOUNDS) N) F T))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(IF (EQUAL X Z)
(ADD1 N)
(ADD1 (INDEX X BOUNDS))))),
which simplifies, rewriting with SUB1-TYPE-RESTRICTION, CDR-CONS, and
CAR-CONS, and unfolding INDEX, NOT, OR, EQUAL, LESSP, LENGTH, INSERT, ADD1,
and NUMBERP, to the following 14 new goals:
Case 4.14.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(EQUAL N 0)
(NOT (EQUAL X Z))
(EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CONS Z BOUNDS)) 2)).
This again simplifies, rewriting with CDR-CONS and CAR-CONS, and opening
up the functions INDEX, ADD1, and EQUAL, to:
T.
Case 4.13.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(EQUAL N 0)
(NOT (EQUAL X Z))
(NOT (EQUAL (CAR BOUNDS) X)))
(EQUAL (INDEX X (CONS Z BOUNDS))
(ADD1 (ADD1 (INDEX X (CDR BOUNDS)))))).
This again simplifies, rewriting with CDR-CONS and CAR-CONS, and expanding
the function INDEX, to:
T.
Case 4.12.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(EQUAL N 0)
(EQUAL X Z))
(EQUAL (INDEX X (CONS Z BOUNDS)) 1)).
This again simplifies, applying CAR-CONS, and unfolding INDEX and EQUAL,
to:
T.
Case 4.11.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (NUMBERP N))
(NOT (EQUAL X Z))
(EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CONS Z BOUNDS)) 2)).
But this again simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS,
and opening up the functions INDEX, ADD1, and EQUAL, to:
T.
Case 4.10.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (NUMBERP N))
(NOT (EQUAL X Z))
(NOT (EQUAL (CAR BOUNDS) X)))
(EQUAL (INDEX X (CONS Z BOUNDS))
(ADD1 (ADD1 (INDEX X (CDR BOUNDS)))))),
which again simplifies, rewriting with CDR-CONS and CAR-CONS, and opening
up the definition of INDEX, to:
T.
Case 4.9.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (NUMBERP N))
(EQUAL X Z))
(EQUAL (INDEX X (CONS Z BOUNDS)) 1)).
But this again simplifies, applying CAR-CONS, and expanding the functions
INDEX and EQUAL, to:
T.
Case 4.8.
(IMPLIES (AND (NOT (LISTP BOUNDS))
(NOT (EQUAL (ADD1 X) 0))
(EQUAL N 0)
(NOT (EQUAL X Z))
(EQUAL Z X))
(EQUAL 1 (ADD1 (ADD1 X)))).
This again simplifies, obviously, to:
T.
Case 4.7.
(IMPLIES (AND (NOT (LISTP BOUNDS))
(NOT (EQUAL (ADD1 X) 0))
(EQUAL N 0)
(EQUAL X Z)
(NOT (EQUAL Z X)))
(EQUAL (ADD1 (ADD1 X)) 1)).
This again simplifies, obviously, to:
T.
Case 4.6.
(IMPLIES (AND (NOT (LISTP BOUNDS))
(NOT (EQUAL (ADD1 X) 0))
(NOT (NUMBERP N))
(NOT (EQUAL X Z))
(EQUAL Z X))
(EQUAL 1 (ADD1 (ADD1 X)))).
This again simplifies, trivially, to:
T.
Case 4.5.
(IMPLIES (AND (NOT (LISTP BOUNDS))
(NOT (EQUAL (ADD1 X) 0))
(NOT (NUMBERP N))
(EQUAL X Z)
(NOT (EQUAL Z X)))
(EQUAL (ADD1 (ADD1 X)) 1)).
This again simplifies, trivially, to:
T.
Case 4.4.
(IMPLIES (AND (LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X)
(EQUAL N 0)
(NOT (EQUAL X Z)))
(NOT (EQUAL Z X))).
This again simplifies, obviously, to:
T.
Case 4.3.
(IMPLIES (AND (LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X)
(EQUAL N 0)
(EQUAL X Z))
(EQUAL Z X)).
This again simplifies, obviously, to:
T.
Case 4.2.
(IMPLIES (AND (LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X)
(NOT (NUMBERP N))
(NOT (EQUAL X Z)))
(NOT (EQUAL Z X))).
This again simplifies, trivially, to:
T.
Case 4.1.
(IMPLIES (AND (LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X)
(NOT (NUMBERP N))
(EQUAL X Z))
(EQUAL Z X)).
This again simplifies, trivially, to:
T.
Case 3. (IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (LESSP (SUB1 N)
(INDEX X (CDR BOUNDS))))
(LESSP N (INDEX X BOUNDS))
(IF (LESSP (LENGTH BOUNDS) N) F T))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(IF (EQUAL X Z)
(ADD1 N)
(ADD1 (INDEX X BOUNDS))))).
This simplifies, rewriting with SUB1-ADD1, CDR-CONS, and CAR-CONS, and
opening up the definitions of INDEX, NOT, OR, LENGTH, LESSP, INSERT, ADD1,
EQUAL, SUB1, and NUMBERP, to four new conjectures:
Case 3.4.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (SUB1 N)
(INDEX X (CDR BOUNDS))))
(NOT (EQUAL (CAR BOUNDS) X))
(LESSP N
(ADD1 (INDEX X (CDR BOUNDS))))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NOT (EQUAL X Z)))
(EQUAL (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
(ADD1 (ADD1 (INDEX X (CDR BOUNDS)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.3.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (SUB1 N)
(INDEX X (CDR BOUNDS))))
(NOT (EQUAL (CAR BOUNDS) X))
(LESSP N
(ADD1 (INDEX X (CDR BOUNDS))))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(EQUAL X Z))
(EQUAL (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
(ADD1 N))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (SUB1 N)
(INDEX X (CDR BOUNDS))))
(EQUAL (CAR BOUNDS) X)
(LESSP N 1)
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N))))
(EQUAL 1 (ADD1 N))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (SUB1 N)
(INDEX X (CDR BOUNDS))))
(EQUAL (CAR BOUNDS) X)
(LESSP N 1)
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N))))
(EQUAL X Z)),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (IF (LESSP (LENGTH (CDR BOUNDS)) (SUB1 N))
F T))
(LESSP N (INDEX X BOUNDS))
(IF (LESSP (LENGTH BOUNDS) N) F T))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(IF (EQUAL X Z)
(ADD1 N)
(ADD1 (INDEX X BOUNDS))))),
which simplifies, applying the lemma SUB1-ADD1, and unfolding the functions
INDEX, NOT, OR, LENGTH, LESSP, EQUAL, SUB1, and NUMBERP, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
(IF (EQUAL X Z)
(ADD1 (SUB1 N))
(ADD1 (INDEX X (CDR BOUNDS)))))
(LESSP N (INDEX X BOUNDS))
(IF (LESSP (LENGTH BOUNDS) N) F T))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(IF (EQUAL X Z)
(ADD1 N)
(ADD1 (INDEX X BOUNDS))))),
which simplifies, rewriting with ADD1-SUB1, SUB1-ADD1, CDR-CONS, CAR-CONS,
and ADD1-EQUAL, and expanding the functions INDEX, NOT, OR, LENGTH, LESSP,
INSERT, ADD1, EQUAL, NUMBERP, and SUB1, to the following three new
conjectures:
Case 1.3.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (EQUAL X Z))
(EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
(ADD1 (INDEX X (CDR BOUNDS))))
(EQUAL (CAR BOUNDS) X)
(LESSP N 1))
(LESSP (LENGTH (CDR BOUNDS))
(SUB1 N))).
This again simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL X Z)
(EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
N)
(NOT (EQUAL (CAR BOUNDS) X))
(LESSP N
(ADD1 (INDEX X (CDR BOUNDS))))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N))))
(EQUAL (INDEX X
(INSERT X (CDR BOUNDS) (SUB1 N)))
N)),
which again simplifies, trivially, to:
T.
Case 1.1.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL X Z)
(EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
N)
(EQUAL (CAR BOUNDS) X)
(LESSP N 1))
(LESSP (LENGTH (CDR BOUNDS))
(SUB1 N))).
This again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
PRECEDE-INDEX1
(PROVE-LEMMA PRECEDE-INDEX
(REWRITE)
(IMPLIES (PRECEDE Z BOUNDS N)
(LESSP (INDEX Z (INSERT Z BOUNDS N))
(ADD1 N))))
WARNING: Note that the proposed lemma PRECEDE-INDEX is to be stored as zero
type prescription rules, zero compound recognizer rules, one linear rule, and
zero replacement rules.
This conjecture simplifies, applying SUB1-ADD1, and expanding the function
LESSP, to two new conjectures:
Case 2. (IMPLIES (AND (PRECEDE Z BOUNDS N)
(NOT (EQUAL (INDEX Z (INSERT Z BOUNDS N))
0))
(NUMBERP N))
(LESSP (SUB1 (INDEX Z (INSERT Z BOUNDS N)))
N)),
which we will name *1.
Case 1. (IMPLIES (AND (PRECEDE Z BOUNDS N)
(NOT (EQUAL (INDEX Z (INSERT Z BOUNDS N))
0))
(NOT (NUMBERP N)))
(LESSP (SUB1 (INDEX Z (INSERT Z BOUNDS N)))
0)).
This again simplifies, unfolding the function PRECEDE, to:
T.
So let us turn our attention to:
(IMPLIES (AND (PRECEDE Z BOUNDS N)
(NOT (EQUAL (INDEX Z (INSERT Z BOUNDS N))
0))
(NUMBERP N))
(LESSP (SUB1 (INDEX Z (INSERT Z BOUNDS N)))
N)),
which is formula *1 above. We will try to prove it by induction. There are
seven plausible inductions. However, they merge into one likely candidate
induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP N) (p Z BOUNDS N))
(IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(p Z (CDR BOUNDS) (SUB1 N)))
(p Z BOUNDS N))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS)))
(p Z BOUNDS N))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT BOUNDS) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for N. The above induction scheme generates five new formulas:
Case 5. (IMPLIES (AND (ZEROP N)
(PRECEDE Z BOUNDS N)
(NOT (EQUAL (INDEX Z (INSERT Z BOUNDS N))
0))
(NUMBERP N))
(LESSP (SUB1 (INDEX Z (INSERT Z BOUNDS N)))
N)),
which simplifies, opening up the definitions of ZEROP, EQUAL, and PRECEDE,
to:
T.
Case 4. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(PRECEDE Z BOUNDS N)
(NOT (EQUAL (INDEX Z (INSERT Z BOUNDS N))
0))
(NUMBERP N))
(LESSP (SUB1 (INDEX Z (INSERT Z BOUNDS N)))
N)),
which simplifies, rewriting with CAR-CONS, and expanding the definitions of
ZEROP, PRECEDE, INSERT, INDEX, EQUAL, SUB1, and LESSP, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(EQUAL (INDEX Z
(INSERT Z (CDR BOUNDS) (SUB1 N)))
0)
(PRECEDE Z BOUNDS N)
(NOT (EQUAL (INDEX Z (INSERT Z BOUNDS N))
0))
(NUMBERP N))
(LESSP (SUB1 (INDEX Z (INSERT Z BOUNDS N)))
N)).
This simplifies, rewriting with CAR-CONS and CDR-CONS, and opening up ZEROP,
PRECEDE, INSERT, INDEX, EQUAL, SUB1, LESSP, and ADD1, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(LESSP (SUB1 (INDEX Z
(INSERT Z (CDR BOUNDS) (SUB1 N))))
(SUB1 N))
(PRECEDE Z BOUNDS N)
(NOT (EQUAL (INDEX Z (INSERT Z BOUNDS N))
0))
(NUMBERP N))
(LESSP (SUB1 (INDEX Z (INSERT Z BOUNDS N)))
N)),
which simplifies, rewriting with CAR-CONS and CDR-CONS, and expanding the
functions ZEROP, PRECEDE, INSERT, INDEX, EQUAL, SUB1, and LESSP, to the
following two new conjectures:
Case 2.2.
(IMPLIES
(AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(LESSP (SUB1 (INDEX Z
(INSERT Z (CDR BOUNDS) (SUB1 N))))
(SUB1 N))
(PRECEDE Z (CDR BOUNDS) (SUB1 N))
(NOT (EQUAL (ADD1 (INDEX Z
(INSERT Z (CDR BOUNDS) (SUB1 N))))
0))
(NUMBERP N)
(NOT (EQUAL (CAR BOUNDS) Z)))
(LESSP (SUB1 (ADD1 (INDEX Z
(INSERT Z (CDR BOUNDS) (SUB1 N)))))
N)).
This again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES
(AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(LESSP (SUB1 (INDEX Z
(INSERT Z (CDR BOUNDS) (SUB1 N))))
(SUB1 N))
(PRECEDE Z (CDR BOUNDS) (SUB1 N))
(NOT (EQUAL (ADD1 (INDEX Z
(INSERT Z (CDR BOUNDS) (SUB1 N))))
0))
(NUMBERP N)
(EQUAL (CAR BOUNDS) Z))
(LESSP (SUB1 1) N)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS))
(PRECEDE Z BOUNDS N)
(NOT (EQUAL (INDEX Z (INSERT Z BOUNDS N))
0))
(NUMBERP N))
(LESSP (SUB1 (INDEX Z (INSERT Z BOUNDS N)))
N)),
which simplifies, expanding the functions ZEROP and PRECEDE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
PRECEDE-INDEX
(PROVE-LEMMA PRECEDE-INDEX2
(REWRITE)
(IMPLIES (AND (LEQ (INDEX X BOUNDS) N)
(LEQ N (LENGTH BOUNDS)))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(INDEX X BOUNDS))))
Call the conjecture *1.
We will try to prove it by induction. The recursive terms in the
conjecture suggest seven inductions. However, they merge into one likely
candidate induction. We will induct according to the following scheme:
(AND (IMPLIES (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS))))
(p X Z BOUNDS N))
(IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(OR (EQUAL N 0) (NOT (NUMBERP N))))
(p X Z BOUNDS N))
(IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(p X Z (CDR BOUNDS) (SUB1 N)))
(p X Z BOUNDS N))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT can be used to establish that the measure (COUNT N) decreases
according to the well-founded relation LESSP in each induction step of the
scheme. Note, however, the inductive instance chosen for BOUNDS. The above
induction scheme produces the following five new formulas:
Case 5. (IMPLIES (AND (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS))))
(NOT (LESSP N (INDEX X BOUNDS)))
(NOT (LESSP (LENGTH BOUNDS) N)))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(INDEX X BOUNDS))).
This simplifies, rewriting with CDR-CONS, CAR-CONS, and SUB1-ADD1, and
opening up INDEX, NOT, OR, EQUAL, LESSP, LENGTH, INSERT, and ADD1, to seven
new conjectures:
Case 5.7.
(IMPLIES (AND (NOT (LISTP BOUNDS))
(EQUAL (ADD1 X) 0))
(NOT (EQUAL N 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 5.6.
(IMPLIES (AND (NOT (LISTP BOUNDS))
(EQUAL (ADD1 X) 0))
(NUMBERP N)),
which again simplifies, using linear arithmetic, to:
T.
Case 5.5.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (EQUAL N 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 5.4.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NUMBERP N)),
which again simplifies, using linear arithmetic, to:
T.
Case 5.3.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0)
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NOT (EQUAL N 0))
(NUMBERP N))
(EQUAL (INDEX X
(CONS (CAR BOUNDS)
(INSERT Z (CDR BOUNDS) (SUB1 N))))
0)),
which again simplifies, using linear arithmetic, to:
T.
Case 5.2.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0)
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(EQUAL N 0))
(EQUAL (INDEX X (CONS Z BOUNDS)) 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 5.1.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0)
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NOT (NUMBERP N)))
(EQUAL (INDEX X (CONS Z BOUNDS)) 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(OR (EQUAL N 0) (NOT (NUMBERP N)))
(NOT (LESSP N (INDEX X BOUNDS)))
(NOT (LESSP (LENGTH BOUNDS) N)))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(INDEX X BOUNDS))),
which simplifies, opening up the definitions of INDEX, NOT, OR, EQUAL, LESSP,
and NUMBERP, to:
T.
Case 3. (IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(LESSP (SUB1 N)
(INDEX X (CDR BOUNDS)))
(NOT (LESSP N (INDEX X BOUNDS)))
(NOT (LESSP (LENGTH BOUNDS) N)))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(INDEX X BOUNDS))),
which simplifies, applying SUB1-ADD1, CDR-CONS, CAR-CONS, ADD1-SUB1,
PRECEDE-INDEX1, and ADD1-EQUAL, and opening up the definitions of INDEX, NOT,
OR, LENGTH, LESSP, INSERT, EQUAL, SUB1, and NUMBERP, to the following two
new formulas:
Case 3.2.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (SUB1 N)
(INDEX X (CDR BOUNDS)))
(NOT (EQUAL (CAR BOUNDS) X))
(NOT (LESSP N
(ADD1 (INDEX X (CDR BOUNDS)))))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NOT (EQUAL X Z)))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
(INDEX X (CDR BOUNDS)))).
But this again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0))
(NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (SUB1 N)
(INDEX X (CDR BOUNDS)))
(NOT (EQUAL (CAR BOUNDS) X))
(NOT (LESSP N
(ADD1 (INDEX X (CDR BOUNDS)))))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(EQUAL X Z))
(EQUAL N (INDEX X (CDR BOUNDS)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(LESSP (LENGTH (CDR BOUNDS)) (SUB1 N))
(NOT (LESSP N (INDEX X BOUNDS)))
(NOT (LESSP (LENGTH BOUNDS) N)))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(INDEX X BOUNDS))),
which simplifies, rewriting with SUB1-ADD1, and unfolding the definitions of
INDEX, NOT, OR, LENGTH, LESSP, EQUAL, SUB1, and NUMBERP, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL (INDEX X BOUNDS) 0)
(NOT (NUMBERP (INDEX X BOUNDS)))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
(INDEX X (CDR BOUNDS)))
(NOT (LESSP N (INDEX X BOUNDS)))
(NOT (LESSP (LENGTH BOUNDS) N)))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(INDEX X BOUNDS))).
This simplifies, rewriting with the lemmas SUB1-ADD1, CDR-CONS, and CAR-CONS,
and unfolding the definitions of INDEX, NOT, OR, LENGTH, LESSP, INSERT,
EQUAL, SUB1, and NUMBERP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
PRECEDE-INDEX2
(PROVE-LEMMA TRANSLATE-INSERT
(REWRITE)
(IMPLIES (AND (PRECEDE Z BOUNDS N)
(LEQ N (LENGTH BOUNDS))
(NTERMP X))
(EQUAL (TRANSLATE X (INSERT Z BOUNDS N))
(BUMP (TRANSLATE X BOUNDS) N)))
((INDUCT (TRANS-INSERT-IND X Z BOUNDS N))))
This conjecture can be simplified, using the abbreviations IMPLIES, NOT, OR,
and AND, to three new conjectures:
Case 3. (IMPLIES
(AND (NLAMBDAP X)
(IMPLIES (AND (PRECEDE Z
(CONS (NBIND X) BOUNDS)
(ADD1 N))
(IF (LESSP (LENGTH (CONS (NBIND X) BOUNDS))
(ADD1 N))
F T)
(NTERMP (NBODY X)))
(EQUAL (TRANSLATE (NBODY X)
(INSERT Z
(CONS (NBIND X) BOUNDS)
(ADD1 N)))
(BUMP (TRANSLATE (NBODY X)
(CONS (NBIND X) BOUNDS))
(ADD1 N))))
(PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP X))
(EQUAL (TRANSLATE X (INSERT Z BOUNDS N))
(BUMP (TRANSLATE X BOUNDS) N))),
which simplifies, applying SUB1-ADD1, CDR-CONS, CAR-CONS, and BODY-LAMBDA,
and expanding the definitions of PRECEDE, LENGTH, LESSP, AND, INSERT,
IMPLIES, NTERMP, TRANSLATE, and BUMP, to:
T.
Case 2. (IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(IMPLIES (AND (PRECEDE Z BOUNDS N)
(IF (LESSP (LENGTH BOUNDS) N) F T)
(NTERMP (NRIGHT X)))
(EQUAL (TRANSLATE (NRIGHT X)
(INSERT Z BOUNDS N))
(BUMP (TRANSLATE (NRIGHT X) BOUNDS)
N)))
(IMPLIES (AND (PRECEDE Z BOUNDS N)
(IF (LESSP (LENGTH BOUNDS) N) F T)
(NTERMP (NLEFT X)))
(EQUAL (TRANSLATE (NLEFT X)
(INSERT Z BOUNDS N))
(BUMP (TRANSLATE (NLEFT X) BOUNDS)
N)))
(PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP X))
(EQUAL (TRANSLATE X (INSERT Z BOUNDS N))
(BUMP (TRANSLATE X BOUNDS) N))).
This simplifies, rewriting with RIGHT-COMB and LEFT-COMB, and expanding AND,
IMPLIES, NTERMP, TRANSLATE, and BUMP, to:
T.
Case 1. (IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP X))
(EQUAL (TRANSLATE X (INSERT Z BOUNDS N))
(BUMP (TRANSLATE X BOUNDS) N))),
which simplifies, unfolding the definitions of NTERMP, TRANSLATE, BUMP, and
LESSP, to two new conjectures:
Case 1.2.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NOT (LESSP N (INDEX X BOUNDS))))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(INDEX X BOUNDS))),
which again simplifies, applying PRECEDE-INDEX2, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(LESSP N (INDEX X BOUNDS)))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 (INDEX X BOUNDS)))).
But this again simplifies, rewriting with PRECEDE-INDEX1, to:
(IMPLIES (AND (PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(LESSP N (INDEX X BOUNDS))
(EQUAL X Z))
(EQUAL (ADD1 N)
(ADD1 (INDEX X BOUNDS)))),
which again simplifies, rewriting with ADD1-EQUAL, to the following two
new formulas:
Case 1.1.2.
(IMPLIES (AND (PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP Z)
(LESSP N (INDEX Z BOUNDS))
(NOT (NUMBERP N)))
(EQUAL 0 (INDEX Z BOUNDS))).
But this again simplifies, expanding the function PRECEDE, to:
T.
Case 1.1.1.
(IMPLIES (AND (PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP Z)
(LESSP N (INDEX Z BOUNDS))
(NUMBERP N))
(EQUAL N (INDEX Z BOUNDS))),
which we will name *1.
Perhaps we can prove it by induction. There are seven plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (ZEROP N) (p N Z BOUNDS))
(IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(p (SUB1 N) Z (CDR BOUNDS)))
(p N Z BOUNDS))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS)))
(p N Z BOUNDS))).
Linear arithmetic and the lemma CDR-LESSP can be used to establish that the
measure (COUNT BOUNDS) decreases according to the well-founded relation LESSP
in each induction step of the scheme. Note, however, the inductive instance
chosen for N. The above induction scheme generates six new formulas:
Case 6. (IMPLIES (AND (ZEROP N)
(PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP Z)
(LESSP N (INDEX Z BOUNDS))
(NUMBERP N))
(EQUAL N (INDEX Z BOUNDS))),
which simplifies, unfolding the functions ZEROP, EQUAL, and PRECEDE, to:
T.
Case 5. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP Z)
(LESSP N (INDEX Z BOUNDS))
(NUMBERP N))
(EQUAL N (INDEX Z BOUNDS))),
which simplifies, applying the lemma SUB1-ADD1, and unfolding ZEROP, PRECEDE,
LENGTH, LESSP, and INDEX, to:
(IMPLIES (AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(EQUAL (CAR BOUNDS) Z)
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP Z)
(LESSP N 1)
(NUMBERP N))
(EQUAL N 1)).
This again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(LESSP (LENGTH (CDR BOUNDS)) (SUB1 N))
(PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP Z)
(LESSP N (INDEX Z BOUNDS))
(NUMBERP N))
(EQUAL N (INDEX Z BOUNDS))),
which simplifies, applying the lemma SUB1-ADD1, and opening up the
definitions of ZEROP, PRECEDE, LENGTH, and LESSP, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(NOT (LESSP (SUB1 N)
(INDEX Z (CDR BOUNDS))))
(PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP Z)
(LESSP N (INDEX Z BOUNDS))
(NUMBERP N))
(EQUAL N (INDEX Z BOUNDS))),
which simplifies, rewriting with the lemma SUB1-ADD1, and expanding the
definitions of ZEROP, PRECEDE, LENGTH, LESSP, and INDEX, to three new
conjectures:
Case 3.3.
(IMPLIES (AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(NOT (LESSP (SUB1 N)
(INDEX Z (CDR BOUNDS))))
(EQUAL (CAR BOUNDS) Z)
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP Z)
(LESSP N 1)
(NUMBERP N))
(EQUAL N 1)),
which again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(NOT (LESSP (SUB1 N)
(INDEX Z (CDR BOUNDS))))
(PRECEDE Z (CDR BOUNDS) (SUB1 N))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP Z)
(NOT (EQUAL (CAR BOUNDS) Z))
(LESSP N
(ADD1 (INDEX Z (CDR BOUNDS))))
(NUMBERP N))
(EQUAL N
(ADD1 (INDEX Z (CDR BOUNDS))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(NOT (LESSP (SUB1 N)
(INDEX Z (CDR BOUNDS))))
(PRECEDE Z (CDR BOUNDS) (SUB1 N))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP Z)
(EQUAL (CAR BOUNDS) Z)
(LESSP N 1)
(NUMBERP N))
(EQUAL N 1)),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(EQUAL (SUB1 N)
(INDEX Z (CDR BOUNDS)))
(PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP Z)
(LESSP N (INDEX Z BOUNDS))
(NUMBERP N))
(EQUAL N (INDEX Z BOUNDS))),
which simplifies, applying SUB1-ADD1 and ADD1-SUB1, and opening up the
functions ZEROP, PRECEDE, LENGTH, LESSP, and INDEX, to the following two new
goals:
Case 2.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(EQUAL (SUB1 N)
(INDEX Z (CDR BOUNDS)))
(EQUAL (CAR BOUNDS) Z)
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP Z)
(LESSP N 1)
(NUMBERP N))
(EQUAL N 1)).
This again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(EQUAL (SUB1 N)
(INDEX Z (CDR BOUNDS)))
(PRECEDE Z (CDR BOUNDS) (SUB1 N))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP Z)
(EQUAL (CAR BOUNDS) Z)
(LESSP N 1)
(NUMBERP N))
(EQUAL N 1)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS))
(PRECEDE Z BOUNDS N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP Z)
(LESSP N (INDEX Z BOUNDS))
(NUMBERP N))
(EQUAL N (INDEX Z BOUNDS))),
which simplifies, unfolding the functions ZEROP and PRECEDE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
TRANSLATE-INSERT
(PROVE-LEMMA SUBST-NSUBST
(REWRITE)
(IMPLIES (AND (PRECEDE Z BOUNDS N)
(NTERMP X)
(LEQ N (LENGTH BOUNDS)))
(EQUAL (SUBST (TRANSLATE X (INSERT Z BOUNDS N))
Y
(ADD1 N))
(TRANSLATE X BOUNDS))))
This conjecture simplifies, rewriting with TRANSLATE-INSERT and
SUBST-NOT-FREE-IN, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
SUBST-NSUBST
(DEFN NOT-FREE-IND
(Y Z BOUNDS N)
(IF (NLAMBDAP Y)
(NOT-FREE-IND (NBODY Y)
Z
(CONS (NBIND Y) BOUNDS)
(ADD1 N))
(IF (NCOMBP Y)
(AND (NOT-FREE-IND (NLEFT Y) Z BOUNDS N)
(NOT-FREE-IND (NRIGHT Y) Z BOUNDS N))
T)))
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and
NLEFT-LESSP can be used to establish that the measure (COUNT Y) decreases
according to the well-founded relation LESSP in each recursive call. Hence,
NOT-FREE-IND is accepted under the definitional principle. Note that:
(TRUEP (NOT-FREE-IND Y Z BOUNDS N))
is a theorem.
[ 0.0 0.0 0.0 ]
NOT-FREE-IND
(PROVE-LEMMA TRANSLATE-INSERT1
(REWRITE)
(IMPLIES (AND (PRECEDE Z (CONS X BOUNDS) (ADD1 N))
(NTERMP Y)
(LEQ N (LENGTH BOUNDS)))
(EQUAL (TRANSLATE Y
(CONS X (INSERT Z BOUNDS N)))
(BUMP (TRANSLATE Y (CONS X BOUNDS))
(ADD1 N))))
((USE (TRANSLATE-INSERT (BOUNDS (CONS X BOUNDS))
(N (ADD1 N))
(X Y)))))
This simplifies, rewriting with the lemmas SUB1-ADD1, CDR-CONS, CAR-CONS, and
SUB1-TYPE-RESTRICTION, and opening up the functions PRECEDE, LENGTH, LESSP,
AND, INSERT, IMPLIES, SUB1, NUMBERP, and EQUAL, to the following two new
conjectures:
Case 2. (IMPLIES (AND (NOT (NUMBERP N))
(LESSP (LENGTH BOUNDS) 0)
(EQUAL X Z)
(NTERMP Y))
(EQUAL (TRANSLATE Y (CONS X (CONS X BOUNDS)))
(BUMP (TRANSLATE Y (CONS X BOUNDS))
1))).
But this again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (NUMBERP N))
(EQUAL (TRANSLATE Y
(CONS X (INSERT Z BOUNDS 0)))
(BUMP (TRANSLATE Y (CONS X BOUNDS))
(ADD1 N)))
(EQUAL X Z)
(NTERMP Y))
(EQUAL (TRANSLATE Y (CONS X (CONS X BOUNDS)))
(BUMP (TRANSLATE Y (CONS X BOUNDS))
1))),
which again simplifies, applying SUB1-TYPE-RESTRICTION, and opening up the
functions EQUAL and INSERT, to:
T.
Q.E.D.
[ 0.0 0.0 0.2 ]
TRANSLATE-INSERT1
(PROVE-LEMMA NOT-FREE-IN-TRANSLATE
(REWRITE)
(IMPLIES (AND (NOT-FREE-IN Z Y)
(LEQ N (LENGTH BOUNDS))
(NTERMP Y))
(EQUAL (TRANSLATE Y (INSERT Z BOUNDS N))
(BUMP (TRANSLATE Y BOUNDS) N)))
((INDUCT (NOT-FREE-IND Y Z BOUNDS N))))
This formula can be simplified, using the abbreviations IMPLIES, NOT, OR, and
AND, to the following three new conjectures:
Case 3. (IMPLIES
(AND (NLAMBDAP Y)
(IMPLIES (AND (NOT-FREE-IN Z (NBODY Y))
(IF (LESSP (LENGTH (CONS (NBIND Y) BOUNDS))
(ADD1 N))
F T)
(NTERMP (NBODY Y)))
(EQUAL (TRANSLATE (NBODY Y)
(INSERT Z
(CONS (NBIND Y) BOUNDS)
(ADD1 N)))
(BUMP (TRANSLATE (NBODY Y)
(CONS (NBIND Y) BOUNDS))
(ADD1 N))))
(NOT-FREE-IN Z Y)
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP Y))
(EQUAL (TRANSLATE Y (INSERT Z BOUNDS N))
(BUMP (TRANSLATE Y BOUNDS) N))).
This simplifies, applying the lemmas CDR-CONS, SUB1-ADD1, CAR-CONS,
SUB1-TYPE-RESTRICTION, and BODY-LAMBDA, and unfolding the functions LENGTH,
LESSP, AND, INSERT, IMPLIES, NOT-FREE-IN, NTERMP, TRANSLATE, and BUMP, to
the following six new conjectures:
Case 3.6.
(IMPLIES (AND (NLAMBDAP Y)
(NOT (NOT-FREE-IN Z (NBODY Y)))
(EQUAL Z (NBIND Y))
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP (NBODY Y)))
(EQUAL (TRANSLATE Y (INSERT Z BOUNDS N))
(BUMP (TRANSLATE Y BOUNDS) N))).
However this again simplifies, appealing to the lemma BODY-LAMBDA, and
opening up TRANSLATE and BUMP, to the goal:
(IMPLIES (AND (NLAMBDAP Y)
(NOT (NOT-FREE-IN (NBIND Y) (NBODY Y)))
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP (NBODY Y)))
(EQUAL (TRANSLATE Y
(INSERT (NBIND Y) BOUNDS N))
(LAMBDA (BUMP (TRANSLATE (NBODY Y)
(CONS (NBIND Y) BOUNDS))
(ADD1 N))))).
Appealing to the lemma NBIND-NBODY-ELIM, we now replace Y by (NLAMBDA X V)
to eliminate (NBIND Y) and (NBODY Y). We employ the type restriction
lemma noted when NBIND was introduced to constrain the new variables.
This generates:
(IMPLIES (AND (NUMBERP X)
(NOT (NOT-FREE-IN X V))
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP V))
(EQUAL (TRANSLATE (NLAMBDA X V)
(INSERT X BOUNDS N))
(LAMBDA (BUMP (TRANSLATE V (CONS X BOUNDS))
(ADD1 N))))).
But this further simplifies, applying the lemmas NBIND-NLAMBDA,
NBODY-NLAMBDA, CAR-CONS, and TRANSLATE-INSERT1, and unfolding the
definitions of TRANSLATE and PRECEDE, to:
T.
Case 3.5.
(IMPLIES (AND (NLAMBDAP Y)
(NOT (NUMBERP N))
(LESSP (LENGTH BOUNDS) 0)
(EQUAL Z (NBIND Y))
(NTERMP (NBODY Y)))
(EQUAL (TRANSLATE Y (CONS Z BOUNDS))
(BUMP (TRANSLATE Y BOUNDS) N))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.4.
(IMPLIES (AND (NLAMBDAP Y)
(NOT (NUMBERP N))
(LESSP (LENGTH BOUNDS) 0)
(NOT-FREE-IN Z (NBODY Y))
(NTERMP (NBODY Y)))
(EQUAL (TRANSLATE Y (CONS Z BOUNDS))
(LAMBDA (BUMP (TRANSLATE (NBODY Y)
(CONS (NBIND Y) BOUNDS))
1)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.3.
(IMPLIES (AND (NLAMBDAP Y)
(NOT (NUMBERP N))
(EQUAL (TRANSLATE (NBODY Y)
(CONS (NBIND Y) (INSERT Z BOUNDS 0)))
(BUMP (TRANSLATE (NBODY Y)
(CONS (NBIND Y) BOUNDS))
(ADD1 N)))
(EQUAL Z (NBIND Y))
(NTERMP (NBODY Y)))
(EQUAL (TRANSLATE Y (CONS Z BOUNDS))
(BUMP (TRANSLATE Y BOUNDS) N))),
which again simplifies, rewriting with SUB1-TYPE-RESTRICTION and
BODY-LAMBDA, and unfolding the definitions of EQUAL, INSERT, TRANSLATE,
and BUMP, to:
T.
Case 3.2.
(IMPLIES (AND (NLAMBDAP Y)
(NOT (NUMBERP N))
(EQUAL (TRANSLATE (NBODY Y)
(CONS (NBIND Y) (INSERT Z BOUNDS 0)))
(BUMP (TRANSLATE (NBODY Y)
(CONS (NBIND Y) BOUNDS))
(ADD1 N)))
(NOT-FREE-IN Z (NBODY Y))
(NTERMP (NBODY Y)))
(EQUAL (TRANSLATE Y (CONS Z BOUNDS))
(LAMBDA (BUMP (TRANSLATE (NBODY Y)
(CONS (NBIND Y) BOUNDS))
1)))).
However this again simplifies, applying the lemma SUB1-TYPE-RESTRICTION,
and opening up the definitions of EQUAL, INSERT, and TRANSLATE, to:
T.
Case 3.1.
(IMPLIES (AND (NLAMBDAP Y)
(NUMBERP N)
(EQUAL (TRANSLATE (NBODY Y)
(CONS (NBIND Y) (INSERT Z BOUNDS N)))
(BUMP (TRANSLATE (NBODY Y)
(CONS (NBIND Y) BOUNDS))
(ADD1 N)))
(EQUAL Z (NBIND Y))
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP (NBODY Y)))
(EQUAL (TRANSLATE Y (INSERT Z BOUNDS N))
(BUMP (TRANSLATE Y BOUNDS) N))),
which again simplifies, applying the lemmas CAR-CONS, TRANSLATE-INSERT1,
and BODY-LAMBDA, and expanding the functions PRECEDE, TRANSLATE, and BUMP,
to the formula:
(IMPLIES (AND (NLAMBDAP Y)
(NUMBERP N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP (NBODY Y)))
(EQUAL (TRANSLATE Y
(INSERT (NBIND Y) BOUNDS N))
(LAMBDA (BUMP (TRANSLATE (NBODY Y)
(CONS (NBIND Y) BOUNDS))
(ADD1 N))))).
Appealing to the lemma NBIND-NBODY-ELIM, we now replace Y by (NLAMBDA V X)
to eliminate (NBODY Y) and (NBIND Y). We rely upon the type restriction
lemma noted when NBIND was introduced to constrain the new variables. The
result is:
(IMPLIES (AND (NUMBERP V)
(NUMBERP N)
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP X))
(EQUAL (TRANSLATE (NLAMBDA V X)
(INSERT V BOUNDS N))
(LAMBDA (BUMP (TRANSLATE X (CONS V BOUNDS))
(ADD1 N))))).
However this further simplifies, rewriting with NBIND-NLAMBDA,
NBODY-NLAMBDA, CAR-CONS, and TRANSLATE-INSERT1, and opening up the
functions TRANSLATE and PRECEDE, to:
T.
Case 2. (IMPLIES (AND (NOT (NLAMBDAP Y))
(NCOMBP Y)
(IMPLIES (AND (NOT-FREE-IN Z (NRIGHT Y))
(IF (LESSP (LENGTH BOUNDS) N) F T)
(NTERMP (NRIGHT Y)))
(EQUAL (TRANSLATE (NRIGHT Y)
(INSERT Z BOUNDS N))
(BUMP (TRANSLATE (NRIGHT Y) BOUNDS)
N)))
(IMPLIES (AND (NOT-FREE-IN Z (NLEFT Y))
(IF (LESSP (LENGTH BOUNDS) N) F T)
(NTERMP (NLEFT Y)))
(EQUAL (TRANSLATE (NLEFT Y)
(INSERT Z BOUNDS N))
(BUMP (TRANSLATE (NLEFT Y) BOUNDS)
N)))
(NOT-FREE-IN Z Y)
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP Y))
(EQUAL (TRANSLATE Y (INSERT Z BOUNDS N))
(BUMP (TRANSLATE Y BOUNDS) N))).
This simplifies, applying the lemmas RIGHT-COMB and LEFT-COMB, and opening
up the definitions of AND, IMPLIES, NOT-FREE-IN, NTERMP, TRANSLATE, and BUMP,
to:
T.
Case 1. (IMPLIES (AND (NOT (NLAMBDAP Y))
(NOT (NCOMBP Y))
(NOT-FREE-IN Z Y)
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP Y))
(EQUAL (TRANSLATE Y (INSERT Z BOUNDS N))
(BUMP (TRANSLATE Y BOUNDS) N))).
This simplifies, expanding NOT-FREE-IN, NTERMP, TRANSLATE, BUMP, and LESSP,
to the following two new formulas:
Case 1.2.
(IMPLIES (AND (NOT (NLAMBDAP Y))
(NOT (NCOMBP Y))
(NOT (EQUAL Z Y))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP Y)
(NOT (LESSP N (INDEX Y BOUNDS))))
(EQUAL (INDEX Y (INSERT Z BOUNDS N))
(INDEX Y BOUNDS))).
But this again simplifies, rewriting with PRECEDE-INDEX2, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (NLAMBDAP Y))
(NOT (NCOMBP Y))
(NOT (EQUAL Z Y))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP Y)
(LESSP N (INDEX Y BOUNDS)))
(EQUAL (INDEX Y (INSERT Z BOUNDS N))
(ADD1 (INDEX Y BOUNDS)))).
But this again simplifies, applying PRECEDE-INDEX1, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
NOT-FREE-IN-TRANSLATE
(PROVE-LEMMA NOT-FREE-IN-CORR
(REWRITE)
(IMPLIES (AND (NTERMP Y) (NOT-FREE-IN Z Y))
(EQUAL (TRANSLATE Y (CONS Z BOUNDS))
(BUMP (TRANSLATE Y BOUNDS) 0)))
((USE (NOT-FREE-IN-TRANSLATE (N 0)))))
This conjecture simplifies, opening up EQUAL, LESSP, AND, INSERT, and IMPLIES,
to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
NOT-FREE-IN-CORR
(PROVE-LEMMA SUBST-NSUBST2
(REWRITE)
(IMPLIES (AND (PRECEDE Z (CONS W BOUNDS) (ADD1 N))
(NTERMP X)
(LEQ N (LENGTH BOUNDS)))
(EQUAL (SUBST (TRANSLATE X
(CONS W (INSERT Z BOUNDS N)))
Y
(ADD1 (ADD1 N)))
(TRANSLATE X (CONS W BOUNDS))))
((USE (SUBST-NSUBST (BOUNDS (CONS W BOUNDS))
(N (ADD1 N))))))
This conjecture simplifies, rewriting with the lemmas SUB1-ADD1, CDR-CONS,
CAR-CONS, and SUB1-TYPE-RESTRICTION, and unfolding PRECEDE, LENGTH, LESSP, AND,
INSERT, IMPLIES, SUB1, NUMBERP, EQUAL, and ADD1, to the following two new
goals:
Case 2. (IMPLIES (AND (NOT (NUMBERP N))
(LESSP (LENGTH BOUNDS) 0)
(EQUAL W Z)
(NTERMP X))
(EQUAL (SUBST (TRANSLATE X (CONS W (CONS W BOUNDS)))
Y 2)
(TRANSLATE X (CONS W BOUNDS)))).
This again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (NUMBERP N))
(EQUAL (SUBST (TRANSLATE X
(CONS W (INSERT Z BOUNDS 0)))
Y
(ADD1 (ADD1 N)))
(TRANSLATE X (CONS W BOUNDS)))
(EQUAL W Z)
(NTERMP X))
(EQUAL (SUBST (TRANSLATE X (CONS W (CONS W BOUNDS)))
Y 2)
(TRANSLATE X (CONS W BOUNDS)))),
which again simplifies, applying SUB1-TYPE-RESTRICTION, and opening up EQUAL,
INSERT, and ADD1, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
SUBST-NSUBST2
(PROVE-LEMMA SUBST-NSUBST2-CORR
(REWRITE)
(IMPLIES (NTERMP X)
(EQUAL (SUBST (TRANSLATE X (CONS Z (CONS Z BOUNDS)))
Y
(ADD1 (ADD1 0)))
(TRANSLATE X (CONS Z BOUNDS))))
((USE (SUBST-NSUBST2 (W Z) (N 0)))))
This conjecture simplifies, applying CAR-CONS, and unfolding NUMBERP, EQUAL,
PRECEDE, LESSP, AND, INSERT, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
SUBST-NSUBST2-CORR
(PROVE-LEMMA INDEX-INSERT
(REWRITE)
(IMPLIES (AND (NOT (EQUAL X Z))
(LEQ N (LENGTH BOUNDS)))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))))
Name the conjecture *1.
We will try to prove it by induction. There are four plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (OR (EQUAL N 0) (NOT (NUMBERP N)))
(p X Z BOUNDS N))
(IMPLIES (AND (NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(OR (EQUAL (LENGTH BOUNDS) 0)
(NOT (NUMBERP (LENGTH BOUNDS)))))
(p X Z BOUNDS N))
(IMPLIES (AND (NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (OR (EQUAL (LENGTH BOUNDS) 0)
(NOT (NUMBERP (LENGTH BOUNDS)))))
(p X Z (CDR BOUNDS) (SUB1 N)))
(p X Z BOUNDS N))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT establish that the measure (COUNT N) decreases according to the
well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instance chosen for BOUNDS. The above induction scheme
leads to four new formulas:
Case 4. (IMPLIES (AND (OR (EQUAL N 0) (NOT (NUMBERP N)))
(NOT (EQUAL X Z))
(NOT (LESSP (LENGTH BOUNDS) N)))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))),
which simplifies, rewriting with CDR-CONS, CAR-CONS, ADD1-EQUAL, and
SUB1-TYPE-RESTRICTION, and opening up NOT, OR, LENGTH, EQUAL, LESSP, INSERT,
INDEX, ADD1, and NUMBERP, to the following two new conjectures:
Case 4.2.
(IMPLIES (AND (EQUAL N 0) (NOT (EQUAL X Z)))
(NOT (EQUAL (INDEX X BOUNDS) 0))).
This again simplifies, trivially, to:
(IMPLIES (NOT (EQUAL X Z))
(NOT (EQUAL (INDEX X BOUNDS) 0))),
which we will name *1.1.
Case 4.1.
(IMPLIES (AND (NOT (NUMBERP N))
(NOT (EQUAL X Z)))
(NOT (EQUAL (INDEX X BOUNDS) 0))).
Eliminate the irrelevant term. We thus obtain:
(IMPLIES (NOT (EQUAL X Z))
(NOT (EQUAL (INDEX X BOUNDS) 0))),
which we will name *1.2.
Case 3. (IMPLIES (AND (NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(OR (EQUAL (LENGTH BOUNDS) 0)
(NOT (NUMBERP (LENGTH BOUNDS))))
(NOT (EQUAL X Z))
(NOT (LESSP (LENGTH BOUNDS) N)))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))).
This simplifies, opening up NOT, OR, LENGTH, EQUAL, and LESSP, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (OR (EQUAL (LENGTH BOUNDS) 0)
(NOT (NUMBERP (LENGTH BOUNDS)))))
(LESSP (LENGTH (CDR BOUNDS)) (SUB1 N))
(NOT (EQUAL X Z))
(NOT (LESSP (LENGTH BOUNDS) N)))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))).
This simplifies, applying the lemma SUB1-ADD1, and opening up the
definitions of NOT, OR, LENGTH, and LESSP, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (OR (EQUAL (LENGTH BOUNDS) 0)
(NOT (NUMBERP (LENGTH BOUNDS)))))
(NOT (EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
(ADD1 (SUB1 N))))
(NOT (EQUAL X Z))
(NOT (LESSP (LENGTH BOUNDS) N)))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))).
This simplifies, appealing to the lemmas ADD1-SUB1, SUB1-ADD1, CDR-CONS, and
CAR-CONS, and expanding NOT, OR, LENGTH, LESSP, INSERT, and INDEX, to the
following two new goals:
Case 1.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LISTP BOUNDS)
(NOT (EQUAL (ADD1 (LENGTH (CDR BOUNDS)))
0))
(NOT (EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
N))
(NOT (EQUAL X Z))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NOT (EQUAL (CAR BOUNDS) X)))
(NOT (EQUAL (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
(ADD1 N)))).
This again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LISTP BOUNDS)
(NOT (EQUAL (ADD1 (LENGTH (CDR BOUNDS)))
0))
(NOT (EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
N))
(NOT (EQUAL X Z))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(EQUAL (CAR BOUNDS) X))
(NOT (EQUAL 1 (ADD1 N)))),
which again simplifies, using linear arithmetic, to:
T.
So we now return to:
(IMPLIES (NOT (EQUAL X Z))
(NOT (EQUAL (INDEX X BOUNDS) 0))),
which is formula *1.2 above. Ah ha! This conjecture is subsumed by another
subgoal awaiting our attention, namely *1.1 above.
So let us turn our attention to:
(IMPLIES (NOT (EQUAL X Z))
(NOT (EQUAL (INDEX X BOUNDS) 0))),
which we named *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 (AND (LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X))
(p X BOUNDS Z))
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(p X (CDR BOUNDS) Z))
(p X BOUNDS Z))
(IMPLIES (NOT (LISTP BOUNDS))
(p X BOUNDS Z))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT BOUNDS) decreases according to the well-founded relation LESSP in each
induction step of the scheme. The above induction scheme leads to three new
formulas:
Case 3. (IMPLIES (AND (LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X)
(NOT (EQUAL X Z)))
(NOT (EQUAL (INDEX X BOUNDS) 0))),
which simplifies, opening up the definitions of INDEX and EQUAL, to:
T.
Case 2. (IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(NOT (EQUAL (INDEX X (CDR BOUNDS)) 0))
(NOT (EQUAL X Z)))
(NOT (EQUAL (INDEX X BOUNDS) 0))),
which simplifies, expanding the function INDEX, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP BOUNDS))
(NOT (EQUAL X Z)))
(NOT (EQUAL (INDEX X BOUNDS) 0))),
which simplifies, expanding the function INDEX, to:
T.
That finishes the proof of *1.1, which, consequently, finishes the proof
of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
INDEX-INSERT
(PROVE-LEMMA TRANSLATE-PRESERVES-SUBST
(REWRITE)
(IMPLIES (AND (FREE-FOR X Y)
(NOT (PRECEDE Z BOUNDS N))
(LEQ N (LENGTH BOUNDS))
(NTERMP X)
(NTERMP Y))
(EQUAL (TRANSLATE (NSUBST X Y Z) BOUNDS)
(SUBST (TRANSLATE X (INSERT Z BOUNDS N))
(TRANSLATE Y BOUNDS)
(ADD1 N))))
((INDUCT (NSUBST-IND X Y Z BOUNDS N))))
WARNING: Note that TRANSLATE-PRESERVES-SUBST contains the free variable N
which will be chosen by instantiating the hypothesis:
(NOT (PRECEDE Z BOUNDS N)).
This conjecture can be simplified, using the abbreviations IMPLIES, NOT, OR,
and AND, to four new conjectures:
Case 4. (IMPLIES (AND (NLAMBDAP X)
(EQUAL (NBIND X) Z)
(FREE-FOR X Y)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP X)
(NTERMP Y))
(EQUAL (TRANSLATE (NSUBST X Y Z) BOUNDS)
(SUBST (TRANSLATE X (INSERT Z BOUNDS N))
(TRANSLATE Y BOUNDS)
(ADD1 N)))),
which simplifies, applying NOT-FREE-IN-TRANSLATE and SUBST-NOT-FREE-IN, and
expanding NSUBST and NOT-FREE-IN, to:
T.
Case 3. (IMPLIES
(AND (NLAMBDAP X)
(NOT (EQUAL (NBIND X) Z))
(IMPLIES (AND (FREE-FOR (NBODY X) Y)
(NOT (PRECEDE Z
(CONS (NBIND X) BOUNDS)
(ADD1 N)))
(IF (LESSP (LENGTH (CONS (NBIND X) BOUNDS))
(ADD1 N))
F T)
(NTERMP (NBODY X))
(NTERMP Y))
(EQUAL (TRANSLATE (NSUBST (NBODY X) Y Z)
(CONS (NBIND X) BOUNDS))
(SUBST (TRANSLATE (NBODY X)
(INSERT Z
(CONS (NBIND X) BOUNDS)
(ADD1 N)))
(TRANSLATE Y (CONS (NBIND X) BOUNDS))
(ADD1 (ADD1 N)))))
(FREE-FOR X Y)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP X)
(NTERMP Y))
(EQUAL (TRANSLATE (NSUBST X Y Z) BOUNDS)
(SUBST (TRANSLATE X (INSERT Z BOUNDS N))
(TRANSLATE Y BOUNDS)
(ADD1 N)))).
This simplifies, applying SUB1-ADD1, CDR-CONS, CAR-CONS, NBIND-NLAMBDA,
NBODY-NLAMBDA, and SUB1-TYPE-RESTRICTION, and expanding PRECEDE, NOT, LENGTH,
LESSP, AND, INSERT, IMPLIES, FREE-FOR, NTERMP, NSUBST, and TRANSLATE, to
four new conjectures:
Case 3.4.
(IMPLIES (AND (NLAMBDAP X)
(NOT (EQUAL (NBIND X) Z))
(NOT (NUMBERP N))
(PRECEDE Z BOUNDS 0)
(NOT-FREE-IN (NBIND X) Y)
(FREE-FOR (NBODY X) Y)
(NTERMP (NBODY X))
(NTERMP Y))
(EQUAL (LAMBDA (TRANSLATE (NSUBST (NBODY X) Y Z)
(CONS (NBIND X) BOUNDS)))
(SUBST (TRANSLATE X (CONS Z BOUNDS))
(TRANSLATE Y BOUNDS)
1))),
which again simplifies, expanding EQUAL and PRECEDE, to:
T.
Case 3.3.
(IMPLIES (AND (NLAMBDAP X)
(NOT (EQUAL (NBIND X) Z))
(NOT (NUMBERP N))
(LESSP (LENGTH BOUNDS) 0)
(NOT-FREE-IN (NBIND X) Y)
(FREE-FOR (NBODY X) Y)
(NTERMP (NBODY X))
(NTERMP Y))
(EQUAL (LAMBDA (TRANSLATE (NSUBST (NBODY X) Y Z)
(CONS (NBIND X) BOUNDS)))
(SUBST (TRANSLATE X (CONS Z BOUNDS))
(TRANSLATE Y BOUNDS)
1))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES
(AND (NLAMBDAP X)
(NOT (EQUAL (NBIND X) Z))
(NOT (NUMBERP N))
(EQUAL (TRANSLATE (NSUBST (NBODY X) Y Z)
(CONS (NBIND X) BOUNDS))
(SUBST (TRANSLATE (NBODY X)
(CONS (NBIND X) (INSERT Z BOUNDS 0)))
(TRANSLATE Y (CONS (NBIND X) BOUNDS))
(ADD1 (ADD1 N))))
(NOT-FREE-IN (NBIND X) Y)
(FREE-FOR (NBODY X) Y)
(NTERMP (NBODY X))
(NTERMP Y))
(EQUAL (LAMBDA (TRANSLATE (NSUBST (NBODY X) Y Z)
(CONS (NBIND X) BOUNDS)))
(SUBST (TRANSLATE X (CONS Z BOUNDS))
(TRANSLATE Y BOUNDS)
1))),
which again simplifies, rewriting with the lemmas NOT-FREE-IN-CORR and
SUB1-TYPE-RESTRICTION, and opening up the functions EQUAL, INSERT, and
ADD1, to:
(IMPLIES
(AND (NLAMBDAP X)
(NOT (EQUAL (NBIND X) Z))
(NOT (NUMBERP N))
(EQUAL (TRANSLATE (NSUBST (NBODY X) Y Z)
(CONS (NBIND X) BOUNDS))
(SUBST (TRANSLATE (NBODY X)
(CONS (NBIND X) (CONS Z BOUNDS)))
(BUMP (TRANSLATE Y BOUNDS) 0)
2))
(NOT-FREE-IN (NBIND X) Y)
(FREE-FOR (NBODY X) Y)
(NTERMP (NBODY X))
(NTERMP Y))
(EQUAL (LAMBDA (TRANSLATE (NSUBST (NBODY X) Y Z)
(CONS (NBIND X) BOUNDS)))
(SUBST (TRANSLATE X (CONS Z BOUNDS))
(TRANSLATE Y BOUNDS)
1))).
This again simplifies, applying BODY-LAMBDA, and unfolding TRANSLATE, ADD1,
and SUBST, to:
T.
Case 3.1.
(IMPLIES
(AND (NLAMBDAP X)
(NOT (EQUAL (NBIND X) Z))
(NUMBERP N)
(EQUAL (TRANSLATE (NSUBST (NBODY X) Y Z)
(CONS (NBIND X) BOUNDS))
(SUBST (TRANSLATE (NBODY X)
(CONS (NBIND X) (INSERT Z BOUNDS N)))
(TRANSLATE Y (CONS (NBIND X) BOUNDS))
(ADD1 (ADD1 N))))
(NOT-FREE-IN (NBIND X) Y)
(FREE-FOR (NBODY X) Y)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP (NBODY X))
(NTERMP Y))
(EQUAL (LAMBDA (TRANSLATE (NSUBST (NBODY X) Y Z)
(CONS (NBIND X) BOUNDS)))
(SUBST (TRANSLATE X (INSERT Z BOUNDS N))
(TRANSLATE Y BOUNDS)
(ADD1 N)))).
However this again simplifies, rewriting with the lemmas NOT-FREE-IN-CORR
and BODY-LAMBDA, and opening up the definitions of TRANSLATE and SUBST, to:
T.
Case 2. (IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(IMPLIES (AND (FREE-FOR (NRIGHT X) Y)
(NOT (PRECEDE Z BOUNDS N))
(IF (LESSP (LENGTH BOUNDS) N) F T)
(NTERMP (NRIGHT X))
(NTERMP Y))
(EQUAL (TRANSLATE (NSUBST (NRIGHT X) Y Z)
BOUNDS)
(SUBST (TRANSLATE (NRIGHT X)
(INSERT Z BOUNDS N))
(TRANSLATE Y BOUNDS)
(ADD1 N))))
(IMPLIES (AND (FREE-FOR (NLEFT X) Y)
(NOT (PRECEDE Z BOUNDS N))
(IF (LESSP (LENGTH BOUNDS) N) F T)
(NTERMP (NLEFT X))
(NTERMP Y))
(EQUAL (TRANSLATE (NSUBST (NLEFT X) Y Z)
BOUNDS)
(SUBST (TRANSLATE (NLEFT X)
(INSERT Z BOUNDS N))
(TRANSLATE Y BOUNDS)
(ADD1 N))))
(FREE-FOR X Y)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP X)
(NTERMP Y))
(EQUAL (TRANSLATE (NSUBST X Y Z) BOUNDS)
(SUBST (TRANSLATE X (INSERT Z BOUNDS N))
(TRANSLATE Y BOUNDS)
(ADD1 N)))),
which simplifies, rewriting with NRIGHT-NCOMB, NLEFT-NCOMB, RIGHT-COMB, and
LEFT-COMB, and opening up the functions NOT, AND, IMPLIES, FREE-FOR, NTERMP,
NSUBST, TRANSLATE, and SUBST, to:
T.
Case 1. (IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(FREE-FOR X Y)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NTERMP X)
(NTERMP Y))
(EQUAL (TRANSLATE (NSUBST X Y Z) BOUNDS)
(SUBST (TRANSLATE X (INSERT Z BOUNDS N))
(TRANSLATE Y BOUNDS)
(ADD1 N)))).
This simplifies, applying SUB1-ADD1, and opening up the definitions of
FREE-FOR, NTERMP, NSUBST, TRANSLATE, LESSP, and SUBST, to 11 new conjectures:
Case 1.11.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N))
(NOT (EQUAL X Z)))
(EQUAL (TRANSLATE X BOUNDS)
(TRANSLATE Y BOUNDS))),
which again simplifies, rewriting with the lemma INDEX-INSERT, to:
T.
Case 1.10.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))
(NUMBERP N)
(NOT (LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(NOT (EQUAL X Z)))
(EQUAL (TRANSLATE X BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))),
which again simplifies, applying INDEX-INSERT, and expanding TRANSLATE, to:
(IMPLIES (AND (NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(NOT (LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))),
which we will name *1.
Case 1.9.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(NOT (EQUAL X Z)))
(EQUAL (TRANSLATE X BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))).
But this again simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (INDEX X (INSERT Z BOUNDS N))
1)
(NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL 1 0))
(NOT (EQUAL 1 (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 1)))
(NOT (EQUAL X Z)))
(EQUAL (TRANSLATE X BOUNDS) 1)).
This again simplifies, applying CDR-CONS, CAR-CONS, ADD1-EQUAL, and
SUB1-TYPE-RESTRICTION, and opening up the functions INSERT, INDEX, NUMBERP,
PRECEDE, LESSP, and EQUAL, to:
T.
Case 1.8.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))
(NUMBERP N)
(NOT (LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(EQUAL X Z))
(EQUAL (TRANSLATE Y BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))).
This again simplifies, rewriting with NPRECEDE-INDEX, to:
T.
Case 1.7.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(EQUAL X Z))
(EQUAL (TRANSLATE Y BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))).
But this again simplifies, using linear arithmetic, to the formula:
(IMPLIES (AND (EQUAL (INDEX Z (INSERT Z BOUNDS N))
1)
(NOT (NLAMBDAP Z))
(NOT (NCOMBP Z))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP Z)
(NTERMP Y)
(NOT (EQUAL 1 0))
(NOT (EQUAL 1 (ADD1 N)))
(NOT (NUMBERP N))
(NOT (LESSP 0 (SUB1 1))))
(EQUAL (TRANSLATE Y BOUNDS) 1)).
This again simplifies, rewriting with CAR-CONS and SUB1-TYPE-RESTRICTION,
and unfolding the definitions of INSERT, INDEX, EQUAL, PRECEDE, and LESSP,
to:
T.
Case 1.6.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))
(NUMBERP N)
(LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(NOT (EQUAL X Z)))
(EQUAL (TRANSLATE X BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))).
This again simplifies, rewriting with INDEX-INSERT, and expanding
TRANSLATE, to:
(IMPLIES (AND (NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))),
which we will name *2.
Case 1.5.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(NOT (EQUAL X Z)))
(EQUAL (TRANSLATE X BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))).
But this again simplifies, rewriting with CDR-CONS, CAR-CONS,
SUB1-TYPE-RESTRICTION, ADD1-EQUAL, and SUB1-ADD1, and unfolding the
definitions of PRECEDE, LESSP, INSERT, INDEX, NUMBERP, EQUAL, and
TRANSLATE, to:
T.
Case 1.4.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))
(NUMBERP N)
(LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(EQUAL X Z))
(EQUAL (TRANSLATE Y BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))).
However this again simplifies, rewriting with NPRECEDE-INDEX, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
(ADD1 N)))
(NOT (NUMBERP N))
(LESSP 0
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(EQUAL X Z))
(EQUAL (TRANSLATE Y BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))).
This again simplifies, applying CAR-CONS and SUB1-TYPE-RESTRICTION, and
opening up PRECEDE, LESSP, INSERT, INDEX, and EQUAL, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (INSERT Z BOUNDS N))
0)
(NOT (EQUAL X Z)))
(EQUAL (TRANSLATE X BOUNDS) 0)).
This again simplifies, expanding the function TRANSLATE, to:
(IMPLIES (AND (NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (INSERT Z BOUNDS N))
0)
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS) 0)).
Name the above subgoal *3.
Case 1.1.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (INSERT Z BOUNDS N))
0)
(EQUAL X Z))
(EQUAL (TRANSLATE Y BOUNDS) 0)).
This again simplifies, applying the lemma NPRECEDE-INDEX, to:
T.
So we now return to:
(IMPLIES (AND (NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (INSERT Z BOUNDS N))
0)
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS) 0)),
which is formula *3 above. Let us appeal to the induction principle. Eight
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 (ZEROP N) (p X BOUNDS Z N Y))
(IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(p X (CDR BOUNDS) Z (SUB1 N) Y))
(p X BOUNDS Z N Y))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS)))
(p X BOUNDS Z N Y))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT BOUNDS) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for N. The above induction scheme generates six new formulas:
Case 6. (IMPLIES (AND (ZEROP N)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (INSERT Z BOUNDS N))
0)
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS) 0)),
which simplifies, expanding the functions ZEROP, EQUAL, PRECEDE, LENGTH,
LESSP, INSERT, and INDEX, to six new formulas:
Case 6.6.
(IMPLIES (AND (EQUAL N 0)
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (CONS Z BOUNDS)) 0)
(NOT (EQUAL X Z))
(LISTP BOUNDS))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0)),
which again simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS,
and unfolding the definition of INDEX, to:
T.
Case 6.5.
(IMPLIES (AND (EQUAL N 0)
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (CONS Z BOUNDS)) 0)
(NOT (EQUAL X Z))
(NOT (LISTP BOUNDS)))
(EQUAL (ADD1 X) 0)),
which again simplifies, applying CDR-CONS and CAR-CONS, and unfolding the
definition of INDEX, to:
T.
Case 6.4.
(IMPLIES (AND (EQUAL N 0)
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (CONS Z BOUNDS)) 0)
(NOT (EQUAL X Z))
(LISTP BOUNDS))
(NOT (EQUAL (CAR BOUNDS) X))).
However this again simplifies, rewriting with the lemmas CDR-CONS and
CAR-CONS, and expanding the functions INDEX, ADD1, and EQUAL, to:
T.
Case 6.3.
(IMPLIES (AND (NOT (NUMBERP N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (CONS Z BOUNDS)) 0)
(NOT (EQUAL X Z))
(LISTP BOUNDS))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
0)),
which again simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS,
and expanding the definition of INDEX, to:
T.
Case 6.2.
(IMPLIES (AND (NOT (NUMBERP N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (CONS Z BOUNDS)) 0)
(NOT (EQUAL X Z))
(NOT (LISTP BOUNDS)))
(EQUAL (ADD1 X) 0)),
which again simplifies, appealing to the lemmas CDR-CONS and CAR-CONS, and
opening up INDEX, to:
T.
Case 6.1.
(IMPLIES (AND (NOT (NUMBERP N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (CONS Z BOUNDS)) 0)
(NOT (EQUAL X Z))
(LISTP BOUNDS))
(NOT (EQUAL (CAR BOUNDS) X))),
which again simplifies, rewriting with CDR-CONS and CAR-CONS, and opening
up INDEX, ADD1, and EQUAL, to:
T.
Case 5. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(PRECEDE Z (CDR BOUNDS) (SUB1 N))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (INSERT Z BOUNDS N))
0)
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS) 0)).
This simplifies, expanding ZEROP and PRECEDE, to:
T.
Case 4. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(LESSP (LENGTH (CDR BOUNDS)) (SUB1 N))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (INSERT Z BOUNDS N))
0)
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS) 0)).
This simplifies, applying SUB1-ADD1, and opening up the definitions of ZEROP,
PRECEDE, LENGTH, and LESSP, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(NOT (EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
0))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (INSERT Z BOUNDS N))
0)
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS) 0)),
which simplifies, rewriting with the lemmas SUB1-ADD1, CDR-CONS, and
CAR-CONS, and unfolding the functions ZEROP, PRECEDE, LENGTH, LESSP, INSERT,
and INDEX, to:
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LISTP BOUNDS)
(NOT (EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
0))
(NOT (EQUAL (CAR BOUNDS) Z))
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
0))
(EQUAL X Z)).
This again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(EQUAL (INDEX X (CDR BOUNDS)) 0)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (INSERT Z BOUNDS N))
0)
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS) 0)),
which simplifies, applying SUB1-ADD1, CDR-CONS, CAR-CONS, and PRECEDE-INDEX2,
and opening up the definitions of ZEROP, PRECEDE, LENGTH, LESSP, INSERT,
INDEX, EQUAL, and ADD1, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(EQUAL (INDEX X (INSERT Z BOUNDS N))
0)
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS) 0)).
This simplifies, expanding ZEROP, PRECEDE, LENGTH, EQUAL, and LESSP, to:
T.
That finishes the proof of *3.
So let us turn our attention to:
(IMPLIES (AND (NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))),
which is formula *2 above. Perhaps we can prove it by induction. There are
13 plausible 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 (ZEROP N) (p X BOUNDS Z N Y))
(IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(p X (CDR BOUNDS) Z (SUB1 N) Y))
(p X BOUNDS Z N Y))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS)))
(p X BOUNDS Z N Y))).
Linear arithmetic and the lemma CDR-LESSP can be used to show that the measure
(COUNT BOUNDS) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for N. The above induction scheme generates seven new goals:
Case 7. (IMPLIES (AND (ZEROP N)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))),
which simplifies, opening up the definitions of ZEROP, EQUAL, PRECEDE,
LENGTH, LESSP, INSERT, NUMBERP, and INDEX, to three new conjectures:
Case 7.3.
(IMPLIES (AND (EQUAL N 0)
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (CONS Z BOUNDS)) 0))
(NOT (EQUAL (SUB1 (INDEX X (CONS Z BOUNDS)))
0))
(NOT (EQUAL X Z))
(NOT (LISTP BOUNDS)))
(EQUAL (ADD1 X)
(SUB1 (INDEX X (CONS Z BOUNDS))))),
which again simplifies, rewriting with CDR-CONS, CAR-CONS, and SUB1-ADD1,
and unfolding INDEX, to:
T.
Case 7.2.
(IMPLIES (AND (EQUAL N 0)
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (CONS Z BOUNDS)) 0))
(NOT (EQUAL (SUB1 (INDEX X (CONS Z BOUNDS)))
0))
(NOT (EQUAL X Z))
(LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X))
(EQUAL 1
(SUB1 (INDEX X (CONS Z BOUNDS))))).
However this again simplifies, rewriting with CDR-CONS and CAR-CONS, and
expanding INDEX, ADD1, EQUAL, and SUB1, to:
T.
Case 7.1.
(IMPLIES (AND (EQUAL N 0)
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (CONS Z BOUNDS)) 0))
(NOT (EQUAL (SUB1 (INDEX X (CONS Z BOUNDS)))
0))
(NOT (EQUAL X Z))
(LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X)))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
(SUB1 (INDEX X (CONS Z BOUNDS))))).
However this again simplifies, applying the lemmas CDR-CONS, CAR-CONS, and
SUB1-ADD1, and expanding INDEX, to:
T.
Case 6. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(PRECEDE Z (CDR BOUNDS) (SUB1 N))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))),
which simplifies, unfolding the definitions of ZEROP and PRECEDE, to:
T.
Case 5. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(LESSP (LENGTH (CDR BOUNDS)) (SUB1 N))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))),
which simplifies, applying the lemma SUB1-ADD1, and expanding the
definitions of ZEROP, PRECEDE, LENGTH, and LESSP, to:
T.
Case 4. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
0)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))),
which simplifies, rewriting with SUB1-ADD1, CDR-CONS, and CAR-CONS, and
expanding ZEROP, PRECEDE, LENGTH, LESSP, INSERT, ADD1, INDEX, EQUAL, and
SUB1, to:
T.
Case 3. (IMPLIES
(AND (NOT (ZEROP N))
(LISTP BOUNDS)
(NOT (LESSP (SUB1 N)
(SUB1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))).
This simplifies, rewriting with SUB1-ADD1, CDR-CONS, and CAR-CONS, and
unfolding the definitions of ZEROP, PRECEDE, LENGTH, LESSP, INSERT, INDEX,
SUB1, and EQUAL, to two new goals:
Case 3.2.
(IMPLIES
(AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(NOT (LESSP (SUB1 N)
(SUB1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))))
(NOT (EQUAL (CAR BOUNDS) Z))
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
0))
(NUMBERP N)
(NOT (EQUAL (CAR BOUNDS) X))
(LESSP N
(SUB1 (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))))
(NOT (EQUAL X Z)))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
(INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES
(AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(NOT (LESSP (SUB1 N)
(SUB1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))))
(NOT (EQUAL (CAR BOUNDS) Z))
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
0))
(NUMBERP N)
(EQUAL (CAR BOUNDS) X)
(LESSP N (SUB1 1)))
(EQUAL X Z)),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(EQUAL (INDEX X (CDR BOUNDS))
(SUB1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))),
which simplifies, rewriting with SUB1-ADD1, CDR-CONS, and CAR-CONS, and
opening up ZEROP, PRECEDE, LENGTH, LESSP, INSERT, INDEX, SUB1, and EQUAL, to
the following two new goals:
Case 2.2.
(IMPLIES
(AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(EQUAL (INDEX X (CDR BOUNDS))
(SUB1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))))
(NOT (EQUAL (CAR BOUNDS) Z))
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
0))
(NUMBERP N)
(NOT (EQUAL (CAR BOUNDS) X))
(LESSP N
(SUB1 (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))))
(NOT (EQUAL X Z)))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
(INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))).
But this again simplifies, using linear arithmetic, to the formula:
(IMPLIES
(AND (EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
0)
(NOT (EQUAL N 0))
(LISTP BOUNDS)
(EQUAL (INDEX X (CDR BOUNDS))
(SUB1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))))
(NOT (EQUAL (CAR BOUNDS) Z))
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
0))
(NUMBERP N)
(NOT (EQUAL (CAR BOUNDS) X))
(LESSP N
(SUB1 (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))))
(NOT (EQUAL X Z)))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
(INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))).
This again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES
(AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(EQUAL (INDEX X (CDR BOUNDS))
(SUB1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))))
(NOT (EQUAL (CAR BOUNDS) Z))
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
0))
(NUMBERP N)
(EQUAL (CAR BOUNDS) X)
(LESSP N (SUB1 1)))
(EQUAL X Z)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(SUB1 (INDEX X (INSERT Z BOUNDS N))))),
which simplifies, unfolding ZEROP, PRECEDE, LENGTH, EQUAL, and LESSP, to:
T.
That finishes the proof of *2.
So let us turn our attention to:
(IMPLIES (AND (NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(NOT (LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))),
which we named *1 above. We will try to prove it by induction. The recursive
terms in the conjecture suggest 13 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 (ZEROP N) (p X BOUNDS Z N Y))
(IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(p X (CDR BOUNDS) Z (SUB1 N) Y))
(p X BOUNDS Z N Y))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS)))
(p X BOUNDS Z N Y))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT BOUNDS) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for N. The above induction scheme generates seven new formulas:
Case 7. (IMPLIES (AND (ZEROP N)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(NOT (LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))),
which simplifies, expanding ZEROP, EQUAL, PRECEDE, LENGTH, LESSP, INSERT,
NUMBERP, and INDEX, to three new formulas:
Case 7.3.
(IMPLIES (AND (EQUAL N 0)
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (CONS Z BOUNDS)) 0))
(EQUAL (SUB1 (INDEX X (CONS Z BOUNDS)))
0)
(NOT (EQUAL X Z))
(NOT (LISTP BOUNDS)))
(EQUAL (ADD1 X)
(INDEX X (CONS Z BOUNDS)))),
which again simplifies, rewriting with CDR-CONS, CAR-CONS, and SUB1-ADD1,
and opening up INDEX, to:
T.
Case 7.2.
(IMPLIES (AND (EQUAL N 0)
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (CONS Z BOUNDS)) 0))
(EQUAL (SUB1 (INDEX X (CONS Z BOUNDS)))
0)
(NOT (EQUAL X Z))
(LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X))
(EQUAL 1 (INDEX X (CONS Z BOUNDS)))).
But this again simplifies, using linear arithmetic, to:
T.
Case 7.1.
(IMPLIES (AND (EQUAL N 0)
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (CONS Z BOUNDS)) 0))
(EQUAL (SUB1 (INDEX X (CONS Z BOUNDS)))
0)
(NOT (EQUAL X Z))
(LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X)))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
(INDEX X (CONS Z BOUNDS)))),
which again simplifies, applying CDR-CONS, CAR-CONS, and SUB1-ADD1, and
expanding the definition of INDEX, to:
T.
Case 6. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(PRECEDE Z (CDR BOUNDS) (SUB1 N))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(NOT (LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))).
This simplifies, unfolding ZEROP and PRECEDE, to:
T.
Case 5. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(LESSP (LENGTH (CDR BOUNDS)) (SUB1 N))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(NOT (LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))).
This simplifies, applying SUB1-ADD1, and opening up the functions ZEROP,
PRECEDE, LENGTH, and LESSP, to:
T.
Case 4. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
0)
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(NOT (LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))),
which simplifies, rewriting with the lemmas SUB1-ADD1, CDR-CONS, and
CAR-CONS, and opening up the functions ZEROP, PRECEDE, LENGTH, LESSP, INSERT,
ADD1, INDEX, EQUAL, and SUB1, to:
(IMPLIES (AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
0)
(NOT (EQUAL (CAR BOUNDS) Z))
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP X)
(NTERMP Y)
(NUMBERP N)
(NOT (EQUAL X Z))
(NOT (EQUAL (CAR BOUNDS) X)))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
1)).
But this again simplifies, applying ADD1-EQUAL, and expanding the definition
of NUMBERP, to:
(IMPLIES (AND (NOT (EQUAL N 0))
(LISTP BOUNDS)
(EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
0)
(NOT (EQUAL (CAR BOUNDS) Z))
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP X)
(NTERMP Y)
(NUMBERP N)
(NOT (EQUAL X Z))
(NOT (EQUAL (CAR BOUNDS) X)))
(EQUAL (INDEX X (CDR BOUNDS)) 0)).
Applying the lemma CAR-CDR-ELIM, replace BOUNDS by (CONS W V) to eliminate
(CDR BOUNDS) and (CAR BOUNDS). This produces the new goal:
(IMPLIES (AND (NOT (EQUAL N 0))
(EQUAL (INDEX X (INSERT Z V (SUB1 N)))
0)
(NOT (EQUAL W Z))
(NOT (PRECEDE Z V (SUB1 N)))
(NOT (LESSP (LENGTH V) (SUB1 N)))
(NUMBERP X)
(NTERMP Y)
(NUMBERP N)
(NOT (EQUAL X Z))
(NOT (EQUAL W X)))
(EQUAL (INDEX X V) 0)).
Applying the lemma SUB1-ELIM, replace N by (ADD1 D) to eliminate (SUB1 N).
We use the type restriction lemma noted when SUB1 was introduced to restrict
the new variable. We thus obtain the new conjecture:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (ADD1 D) 0))
(EQUAL (INDEX X (INSERT Z V D)) 0)
(NOT (EQUAL W Z))
(NOT (PRECEDE Z V D))
(NOT (LESSP (LENGTH V) D))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL X Z))
(NOT (EQUAL W X)))
(EQUAL (INDEX X V) 0)),
which further simplifies, trivially, to:
(IMPLIES (AND (NUMBERP D)
(EQUAL (INDEX X (INSERT Z V D)) 0)
(NOT (EQUAL W Z))
(NOT (PRECEDE Z V D))
(NOT (LESSP (LENGTH V) D))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL X Z))
(NOT (EQUAL W X)))
(EQUAL (INDEX X V) 0)),
which has an irrelevant term in it. By eliminating the term we get:
(IMPLIES (AND (NUMBERP D)
(EQUAL (INDEX X (INSERT Z V D)) 0)
(NOT (EQUAL W Z))
(NOT (PRECEDE Z V D))
(NOT (LESSP (LENGTH V) D))
(NUMBERP X)
(NOT (EQUAL X Z))
(NOT (EQUAL W X)))
(EQUAL (INDEX X V) 0)),
which we will finally name *1.1.
Case 3. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(LESSP (SUB1 N)
(SUB1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(NOT (LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))).
This simplifies, applying SUB1-ADD1, CDR-CONS, CAR-CONS, and ADD1-EQUAL, and
unfolding ZEROP, PRECEDE, LENGTH, LESSP, INSERT, INDEX, EQUAL, and SUB1, to:
(IMPLIES
(AND
(NOT (EQUAL N 0))
(LISTP BOUNDS)
(LESSP (SUB1 N)
(SUB1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))))
(NOT (EQUAL (CAR BOUNDS) Z))
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
0))
(NUMBERP N)
(NOT (EQUAL (CAR BOUNDS) X))
(NOT (LESSP N
(SUB1 (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X (CDR BOUNDS))
(INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))).
But this again simplifies, using linear arithmetic, to the formula:
(IMPLIES
(AND
(EQUAL (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))
0)
(NOT (EQUAL N 0))
(LISTP BOUNDS)
(LESSP (SUB1 N)
(SUB1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))))
(NOT (EQUAL (CAR BOUNDS) Z))
(NOT (PRECEDE Z (CDR BOUNDS) (SUB1 N)))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(SUB1 N)))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
0))
(NUMBERP N)
(NOT (EQUAL (CAR BOUNDS) X))
(NOT (LESSP N
(SUB1 (ADD1 (INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N)))))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X (CDR BOUNDS))
(INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))).
However this again simplifies, unfolding the definitions of SUB1, EQUAL, and
LESSP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(LISTP BOUNDS)
(EQUAL (INDEX X (CDR BOUNDS))
(INDEX X
(INSERT Z (CDR BOUNDS) (SUB1 N))))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(NOT (LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))),
which simplifies, rewriting with SUB1-ADD1, CDR-CONS, and CAR-CONS, and
opening up the definitions of ZEROP, PRECEDE, LENGTH, LESSP, INSERT, INDEX,
EQUAL, and SUB1, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (LISTP BOUNDS))
(NOT (PRECEDE Z BOUNDS N))
(NOT (LESSP (LENGTH BOUNDS) N))
(NUMBERP X)
(NTERMP Y)
(NOT (EQUAL (INDEX X (INSERT Z BOUNDS N))
0))
(NUMBERP N)
(NOT (LESSP N
(SUB1 (INDEX X (INSERT Z BOUNDS N)))))
(NOT (EQUAL X Z)))
(EQUAL (INDEX X BOUNDS)
(INDEX X (INSERT Z BOUNDS N)))).
This simplifies, opening up the functions ZEROP, PRECEDE, LENGTH, EQUAL, and
LESSP, to:
T.
So we now return to:
(IMPLIES (AND (NUMBERP D)
(EQUAL (INDEX X (INSERT Z V D)) 0)
(NOT (EQUAL W Z))
(NOT (PRECEDE Z V D))
(NOT (LESSP (LENGTH V) D))
(NUMBERP X)
(NOT (EQUAL X Z))
(NOT (EQUAL W X)))
(EQUAL (INDEX X V) 0)),
named *1.1 above. We will appeal to induction. Seven 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 D) (p X V W Z D))
(IMPLIES (AND (NOT (ZEROP D))
(LISTP V)
(p X (CDR V) W Z (SUB1 D)))
(p X V W Z D))
(IMPLIES (AND (NOT (ZEROP D)) (NOT (LISTP V)))
(p X V W Z D))).
Linear arithmetic and the lemma CDR-LESSP can be used to show that the measure
(COUNT V) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for D. The above induction scheme leads to six new conjectures:
Case 6. (IMPLIES (AND (ZEROP D)
(NUMBERP D)
(EQUAL (INDEX X (INSERT Z V D)) 0)
(NOT (EQUAL W Z))
(NOT (PRECEDE Z V D))
(NOT (LESSP (LENGTH V) D))
(NUMBERP X)
(NOT (EQUAL X Z))
(NOT (EQUAL W X)))
(EQUAL (INDEX X V) 0)),
which simplifies, opening up ZEROP, NUMBERP, EQUAL, INSERT, PRECEDE, LENGTH,
LESSP, and INDEX, to three new formulas:
Case 6.3.
(IMPLIES (AND (EQUAL D 0)
(EQUAL (INDEX X (CONS Z V)) 0)
(NOT (EQUAL W Z))
(NUMBERP X)
(NOT (EQUAL X Z))
(NOT (EQUAL W X))
(LISTP V))
(EQUAL (ADD1 (INDEX X (CDR V))) 0)),
which again simplifies, applying CDR-CONS and CAR-CONS, and opening up the
definition of INDEX, to:
T.
Case 6.2.
(IMPLIES (AND (EQUAL D 0)
(EQUAL (INDEX X (CONS Z V)) 0)
(NOT (EQUAL W Z))
(NUMBERP X)
(NOT (EQUAL X Z))
(NOT (EQUAL W X))
(NOT (LISTP V)))
(EQUAL (ADD1 X) 0)).
This again simplifies, applying CDR-CONS and CAR-CONS, and expanding INDEX,
to:
T.
Case 6.1.
(IMPLIES (AND (EQUAL D 0)
(EQUAL (INDEX X (CONS Z V)) 0)
(NOT (EQUAL W Z))
(NUMBERP X)
(NOT (EQUAL X Z))
(NOT (EQUAL W X))
(LISTP V))
(NOT (EQUAL (CAR V) X))).
This again simplifies, applying CDR-CONS and CAR-CONS, and unfolding the
functions INDEX, ADD1, and EQUAL, to:
T.
Case 5. (IMPLIES (AND (NOT (ZEROP D))
(LISTP V)
(NOT (EQUAL (INDEX X (INSERT Z (CDR V) (SUB1 D)))
0))
(NUMBERP D)
(EQUAL (INDEX X (INSERT Z V D)) 0)
(NOT (EQUAL W Z))
(NOT (PRECEDE Z V D))
(NOT (LESSP (LENGTH V) D))
(NUMBERP X)
(NOT (EQUAL X Z))
(NOT (EQUAL W X)))
(EQUAL (INDEX X V) 0)).
This simplifies, applying CDR-CONS, CAR-CONS, and SUB1-ADD1, and unfolding
the definitions of ZEROP, INSERT, INDEX, PRECEDE, LENGTH, and LESSP, to:
(IMPLIES (AND (NOT (EQUAL D 0))
(LISTP V)
(NOT (EQUAL (INDEX X (INSERT Z (CDR V) (SUB1 D)))
0))
(NUMBERP D)
(NOT (EQUAL (CAR V) X))
(EQUAL (ADD1 (INDEX X (INSERT Z (CDR V) (SUB1 D))))
0)
(NOT (EQUAL W Z))
(NOT (EQUAL (CAR V) Z))
(NOT (PRECEDE Z (CDR V) (SUB1 D)))
(NOT (LESSP (LENGTH (CDR V)) (SUB1 D)))
(NUMBERP X)
(NOT (EQUAL X Z)))
(EQUAL W X)).
However this again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (ZEROP D))
(LISTP V)
(PRECEDE Z (CDR V) (SUB1 D))
(NUMBERP D)
(EQUAL (INDEX X (INSERT Z V D)) 0)
(NOT (EQUAL W Z))
(NOT (PRECEDE Z V D))
(NOT (LESSP (LENGTH V) D))
(NUMBERP X)
(NOT (EQUAL X Z))
(NOT (EQUAL W X)))
(EQUAL (INDEX X V) 0)),
which simplifies, rewriting with CDR-CONS and CAR-CONS, and expanding ZEROP,
INSERT, INDEX, and PRECEDE, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP D))
(LISTP V)
(LESSP (LENGTH (CDR V)) (SUB1 D))
(NUMBERP D)
(EQUAL (INDEX X (INSERT Z V D)) 0)
(NOT (EQUAL W Z))
(NOT (PRECEDE Z V D))
(NOT (LESSP (LENGTH V) D))
(NUMBERP X)
(NOT (EQUAL X Z))
(NOT (EQUAL W X)))
(EQUAL (INDEX X V) 0)).
This simplifies, applying CDR-CONS, CAR-CONS, and SUB1-ADD1, and opening up
ZEROP, INSERT, INDEX, PRECEDE, LENGTH, and LESSP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP D))
(LISTP V)
(EQUAL (INDEX X (CDR V)) 0)
(NUMBERP D)
(EQUAL (INDEX X (INSERT Z V D)) 0)
(NOT (EQUAL W Z))
(NOT (PRECEDE Z V D))
(NOT (LESSP (LENGTH V) D))
(NUMBERP X)
(NOT (EQUAL X Z))
(NOT (EQUAL W X)))
(EQUAL (INDEX X V) 0)),
which simplifies, applying the lemmas CDR-CONS, CAR-CONS, and SUB1-ADD1, and
expanding ZEROP, INSERT, INDEX, PRECEDE, LENGTH, LESSP, ADD1, and EQUAL, to:
(IMPLIES (AND (NOT (EQUAL D 0))
(LISTP V)
(EQUAL (INDEX X (CDR V)) 0)
(NUMBERP D)
(NOT (EQUAL (CAR V) X))
(EQUAL (ADD1 (INDEX X (INSERT Z (CDR V) (SUB1 D))))
0)
(NOT (EQUAL W Z))
(NOT (EQUAL (CAR V) Z))
(NOT (PRECEDE Z (CDR V) (SUB1 D)))
(NOT (LESSP (LENGTH (CDR V)) (SUB1 D)))
(NUMBERP X)
(NOT (EQUAL X Z)))
(EQUAL W X)).
This again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP D))
(NOT (LISTP V))
(NUMBERP D)
(EQUAL (INDEX X (INSERT Z V D)) 0)
(NOT (EQUAL W Z))
(NOT (PRECEDE Z V D))
(NOT (LESSP (LENGTH V) D))
(NUMBERP X)
(NOT (EQUAL X Z))
(NOT (EQUAL W X)))
(EQUAL (INDEX X V) 0)),
which simplifies, applying CDR-CONS and CAR-CONS, and expanding the
functions ZEROP, INSERT, INDEX, and LISTP, to:
T.
That finishes the proof of *1.1, which also finishes the proof of *1.
Q.E.D.
[ 0.0 0.3 0.2 ]
TRANSLATE-PRESERVES-SUBST
(PROVE-LEMMA TRANSLATE-PRESERVES-REDUCTION
(REWRITE)
(IMPLIES (AND (NLAMBDAP X)
(FREE-FOR (NBODY X) Y)
(NTERMP X)
(NTERMP Y))
(EQUAL (TRANSLATE (NSUBST (NBODY X) Y (NBIND X))
BOUNDS)
(SUBST (BODY (TRANSLATE X BOUNDS))
(TRANSLATE Y BOUNDS)
1)))
((USE (TRANSLATE-PRESERVES-SUBST (X (NBODY X))
(Z (NBIND X))
(N 0)))))
This conjecture simplifies, unfolding the functions EQUAL, PRECEDE, NOT, LESSP,
AND, INSERT, IMPLIES, and NTERMP, to:
(IMPLIES (AND (EQUAL (TRANSLATE (NSUBST (NBODY X) Y (NBIND X))
BOUNDS)
(SUBST (TRANSLATE (NBODY X)
(CONS (NBIND X) BOUNDS))
(TRANSLATE Y BOUNDS)
1))
(NLAMBDAP X)
(FREE-FOR (NBODY X) Y)
(NTERMP (NBODY X))
(NTERMP Y))
(EQUAL (TRANSLATE (NSUBST (NBODY X) Y (NBIND X))
BOUNDS)
(SUBST (BODY (TRANSLATE X BOUNDS))
(TRANSLATE Y BOUNDS)
1))).
But this again simplifies, rewriting with BODY-LAMBDA, and opening up the
function TRANSLATE, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TRANSLATE-PRESERVES-REDUCTION
(DEFN BETA-STEP
(X Y)
(IF (EQUAL X Y)
T
(IF (LAMBDAP X)
(AND (LAMBDAP Y)
(BETA-STEP (BODY X) (BODY Y)))
(IF (COMBP X)
(OR (AND (LAMBDAP (LEFT X))
(EQUAL Y
(SUBST (BODY (LEFT X)) (RIGHT X) 1)))
(AND (COMBP Y)
(BETA-STEP (LEFT X) (LEFT Y))
(BETA-STEP (RIGHT X) (RIGHT Y))))
F))))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
establish that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, BETA-STEP is accepted under the
definitional principle. Observe that:
(OR (FALSEP (BETA-STEP X Y))
(TRUEP (BETA-STEP X Y)))
is a theorem.
[ 0.0 0.0 0.0 ]
BETA-STEP
(DEFN REDUCTION
(A B LIST)
(IF (LISTP LIST)
(AND (BETA-STEP (CAR LIST) B)
(REDUCTION A (CAR LIST) (CDR LIST)))
(BETA-STEP A B)))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
recursive call. Hence, REDUCTION is accepted under the definitional principle.
From the definition we can conclude that:
(OR (FALSEP (REDUCTION A B LIST))
(TRUEP (REDUCTION A B LIST)))
is a theorem.
[ 0.0 0.0 0.0 ]
REDUCTION
(DEFN MAKE-WALK-STEP
(X Y)
(IF (EQUAL X Y)
NIL
(IF (LAMBDAP X)
(MAKE-WALK-STEP (BODY X) (BODY Y))
(IF (COMBP X)
(IF (AND (LAMBDAP (LEFT X))
(EQUAL Y
(SUBST (BODY (LEFT X)) (RIGHT X) 1)))
'(NIL NIL REDUCE)
(LIST (MAKE-WALK-STEP (LEFT X) (LEFT Y))
(MAKE-WALK-STEP (RIGHT X) (RIGHT Y))))
NIL))))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
can be used to show that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each recursive call. Hence, MAKE-WALK-STEP is
accepted under the definitional principle. Note that:
(OR (LITATOM (MAKE-WALK-STEP X Y))
(LISTP (MAKE-WALK-STEP X Y)))
is a theorem.
[ 0.0 0.0 0.0 ]
MAKE-WALK-STEP
(PROVE-LEMMA MAKE-WALK-STEP-WALKS
(REWRITE)
(IMPLIES (BETA-STEP A B)
(EQUAL (WALK (MAKE-WALK-STEP A B) A)
B)))
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 (EQUAL A B) (p A B))
(IMPLIES (AND (NOT (EQUAL A B))
(LAMBDAP A)
(p (BODY A) (BODY B)))
(p A B))
(IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(AND (LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(p A B))
(IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(NOT (AND (LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(p (RIGHT A) (RIGHT B))
(p (LEFT A) (LEFT B)))
(p A B))
(IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(NOT (COMBP A)))
(p A B))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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. Note,
however, the inductive instances chosen for B. The above induction scheme
leads to nine new goals:
Case 9. (IMPLIES (AND (EQUAL A B) (BETA-STEP A B))
(EQUAL (WALK (MAKE-WALK-STEP A B) A)
B)),
which simplifies, applying the lemma NLISTP-WALK, and opening up the
definitions of BETA-STEP and MAKE-WALK-STEP, to:
T.
Case 8. (IMPLIES (AND (NOT (EQUAL A B))
(LAMBDAP A)
(NOT (BETA-STEP (BODY A) (BODY B)))
(BETA-STEP A B))
(EQUAL (WALK (MAKE-WALK-STEP A B) A)
B)),
which simplifies, unfolding the function BETA-STEP, to:
T.
Case 7. (IMPLIES (AND (NOT (EQUAL A B))
(LAMBDAP A)
(EQUAL (WALK (MAKE-WALK-STEP (BODY A) (BODY B))
(BODY A))
(BODY B))
(BETA-STEP A B))
(EQUAL (WALK (MAKE-WALK-STEP A B) A)
B)),
which simplifies, appealing to the lemma LAMBDA-BODY, and unfolding the
functions BETA-STEP, MAKE-WALK-STEP, and WALK, to:
T.
Case 6. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(AND (LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(BETA-STEP A B))
(EQUAL (WALK (MAKE-WALK-STEP A B) A)
B)),
which simplifies, rewriting with the lemma NLISTP-WALK, and expanding the
functions AND, BETA-STEP, MAKE-WALK-STEP, RIGHT-INSTRS, LEFT-INSTRS, EQUAL,
COMMAND, and WALK, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(NOT (AND (LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(NOT (BETA-STEP (RIGHT A) (RIGHT B)))
(NOT (BETA-STEP (LEFT A) (LEFT B)))
(BETA-STEP A B))
(EQUAL (WALK (MAKE-WALK-STEP A B) A)
B)),
which simplifies, opening up AND and BETA-STEP, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(NOT (AND (LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(EQUAL (WALK (MAKE-WALK-STEP (RIGHT A) (RIGHT B))
(RIGHT A))
(RIGHT B))
(NOT (BETA-STEP (LEFT A) (LEFT B)))
(BETA-STEP A B))
(EQUAL (WALK (MAKE-WALK-STEP A B) A)
B)),
which simplifies, opening up AND and BETA-STEP, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(NOT (AND (LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(NOT (BETA-STEP (RIGHT A) (RIGHT B)))
(EQUAL (WALK (MAKE-WALK-STEP (LEFT A) (LEFT B))
(LEFT A))
(LEFT B))
(BETA-STEP A B))
(EQUAL (WALK (MAKE-WALK-STEP A B) A)
B)),
which simplifies, expanding AND and BETA-STEP, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(NOT (AND (LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(EQUAL (WALK (MAKE-WALK-STEP (RIGHT A) (RIGHT B))
(RIGHT A))
(RIGHT B))
(EQUAL (WALK (MAKE-WALK-STEP (LEFT A) (LEFT B))
(LEFT A))
(LEFT B))
(BETA-STEP A B))
(EQUAL (WALK (MAKE-WALK-STEP A B) A)
B)),
which simplifies, rewriting with COMB-LEFT-RIGHT, CAR-CONS, and CDR-CONS,
and expanding AND, BETA-STEP, MAKE-WALK-STEP, RIGHT-INSTRS, LEFT-INSTRS,
EQUAL, COMMAND, CAR, and WALK, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(NOT (COMBP A))
(BETA-STEP A B))
(EQUAL (WALK (MAKE-WALK-STEP A B) A)
B)).
This simplifies, unfolding BETA-STEP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MAKE-WALK-STEP-WALKS
(DEFN APPEND
(X Y)
(IF (LISTP X)
(CONS (CAR X) (APPEND (CDR 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, APPEND is accepted under the definitional principle.
From the definition we can conclude that:
(OR (LISTP (APPEND X Y))
(EQUAL (APPEND X Y) Y))
is a theorem.
[ 0.0 0.0 0.0 ]
APPEND
(DEFN MAKE-REDUCE-REDUCTION
(A B LIST)
(IF (LISTP LIST)
(APPEND (MAKE-REDUCE-REDUCTION A
(CAR LIST)
(CDR LIST))
(LIST (MAKE-WALK-STEP (CAR LIST) B)
NIL))
(LIST (MAKE-WALK-STEP A B))))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
recursive call. Hence, MAKE-REDUCE-REDUCTION is accepted under the principle
of definition. Note that (LISTP (MAKE-REDUCE-REDUCTION A B LIST)) is a
theorem.
[ 0.0 0.0 0.0 ]
MAKE-REDUCE-REDUCTION
(PROVE-LEMMA REDUCE-APPEND
(REWRITE)
(EQUAL (REDUCE (APPEND X Y) A)
(REDUCE Y (REDUCE X 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 X)
(p (CDR X) Y (WALK (CAR X) A)))
(p X Y A))
(IMPLIES (NOT (LISTP X)) (p X Y A))).
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. Note, however, the inductive instance
chosen for A. The above induction scheme leads to two new goals:
Case 2. (IMPLIES (AND (LISTP X)
(EQUAL (REDUCE (APPEND (CDR X) Y)
(WALK (CAR X) A))
(REDUCE Y
(REDUCE (CDR X) (WALK (CAR X) A)))))
(EQUAL (REDUCE (APPEND X Y) A)
(REDUCE Y (REDUCE X A)))),
which simplifies, applying the lemmas CAR-CONS and CDR-CONS, and opening up
the definitions of APPEND and REDUCE, to:
T.
Case 1. (IMPLIES (NOT (LISTP X))
(EQUAL (REDUCE (APPEND X Y) A)
(REDUCE Y (REDUCE X A)))),
which simplifies, unfolding the functions APPEND and REDUCE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
REDUCE-APPEND
(PROVE-LEMMA MAKE-REDUCE-REDUCTION-REDUCTION
(REWRITE)
(IMPLIES (REDUCTION A B LIST)
(EQUAL (REDUCE (MAKE-REDUCE-REDUCTION A B LIST)
A)
B)))
Give the conjecture the name *1.
We will appeal to induction. There are two plausible inductions.
However, they merge into one likely candidate induction. We will induct
according to the following scheme:
(AND (IMPLIES (AND (LISTP LIST)
(p A (CAR LIST) (CDR LIST)))
(p A B LIST))
(IMPLIES (NOT (LISTP LIST))
(p A B LIST))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for B. The above induction scheme produces the following three new formulas:
Case 3. (IMPLIES (AND (LISTP LIST)
(NOT (REDUCTION A (CAR LIST) (CDR LIST)))
(REDUCTION A B LIST))
(EQUAL (REDUCE (MAKE-REDUCE-REDUCTION A B LIST)
A)
B)).
This simplifies, opening up REDUCTION, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST)
(EQUAL (REDUCE (MAKE-REDUCE-REDUCTION A
(CAR LIST)
(CDR LIST))
A)
(CAR LIST))
(REDUCTION A B LIST))
(EQUAL (REDUCE (MAKE-REDUCE-REDUCTION A B LIST)
A)
B)).
This simplifies, applying the lemmas MAKE-WALK-STEP-WALKS, CAR-CONS,
CDR-CONS, NLISTP-WALK, and REDUCE-APPEND, and unfolding the definitions of
REDUCTION, MAKE-REDUCE-REDUCTION, REDUCE, CAR, CDR, and LISTP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST))
(REDUCTION A B LIST))
(EQUAL (REDUCE (MAKE-REDUCE-REDUCTION A B LIST)
A)
B)).
This simplifies, rewriting with the lemmas MAKE-WALK-STEP-WALKS, CAR-CONS,
and CDR-CONS, and opening up the definitions of REDUCTION,
MAKE-REDUCE-REDUCTION, REDUCE, and LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MAKE-REDUCE-REDUCTION-REDUCTION
(DEFN LIST-LAMBDA
(LIST)
(IF (LISTP LIST)
(CONS (LAMBDA (CAR LIST))
(LIST-LAMBDA (CDR LIST)))
NIL))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
recursive call. Hence, LIST-LAMBDA is accepted under the definitional
principle. Observe that:
(OR (LITATOM (LIST-LAMBDA LIST))
(LISTP (LIST-LAMBDA LIST)))
is a theorem.
[ 0.0 0.0 0.0 ]
LIST-LAMBDA
(PROVE-LEMMA LAMBDA-REDUCTION
(REWRITE)
(IMPLIES (REDUCTION A A1 LIST)
(REDUCTION (LAMBDA A)
(LAMBDA A1)
(LIST-LAMBDA LIST))))
Give the conjecture the name *1.
We will appeal to induction. There are two plausible inductions.
However, they merge into one likely candidate induction. We will induct
according to the following scheme:
(AND (IMPLIES (AND (LISTP LIST)
(p A (CAR LIST) (CDR LIST)))
(p A A1 LIST))
(IMPLIES (NOT (LISTP LIST))
(p A A1 LIST))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for A1. The above induction scheme produces the following three new formulas:
Case 3. (IMPLIES (AND (LISTP LIST)
(NOT (REDUCTION A (CAR LIST) (CDR LIST)))
(REDUCTION A A1 LIST))
(REDUCTION (LAMBDA A)
(LAMBDA A1)
(LIST-LAMBDA LIST))).
This simplifies, opening up REDUCTION, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST)
(REDUCTION (LAMBDA A)
(LAMBDA (CAR LIST))
(LIST-LAMBDA (CDR LIST)))
(REDUCTION A A1 LIST))
(REDUCTION (LAMBDA A)
(LAMBDA A1)
(LIST-LAMBDA LIST))).
This simplifies, applying the lemmas CDR-CONS, BODY-LAMBDA, LAMBDA-EQUAL,
and CAR-CONS, and unfolding the definitions of REDUCTION, LIST-LAMBDA, and
BETA-STEP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST))
(REDUCTION A A1 LIST))
(REDUCTION (LAMBDA A)
(LAMBDA A1)
(LIST-LAMBDA LIST))).
This simplifies, rewriting with the lemmas BODY-LAMBDA and LAMBDA-EQUAL, and
opening up the definitions of REDUCTION, LIST-LAMBDA, BETA-STEP, and LISTP,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LAMBDA-REDUCTION
(DEFN MAP-COMB-LEFT
(A LIST)
(IF (LISTP LIST)
(CONS (COMB A (CAR LIST))
(MAP-COMB-LEFT A (CDR LIST)))
NIL))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
recursive call. Hence, MAP-COMB-LEFT is accepted under the principle of
definition. Note that:
(OR (LITATOM (MAP-COMB-LEFT A LIST))
(LISTP (MAP-COMB-LEFT A LIST)))
is a theorem.
[ 0.0 0.0 0.0 ]
MAP-COMB-LEFT
(DEFN MAP-COMB-RIGHT
(A LIST)
(IF (LISTP LIST)
(CONS (COMB (CAR LIST) A)
(MAP-COMB-RIGHT A (CDR LIST)))
NIL))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
recursive call. Hence, MAP-COMB-RIGHT is accepted under the principle of
definition. Note that:
(OR (LITATOM (MAP-COMB-RIGHT A LIST))
(LISTP (MAP-COMB-RIGHT A LIST)))
is a theorem.
[ 0.0 0.0 0.0 ]
MAP-COMB-RIGHT
(DEFN LIST-COMB
(A B LIST1 LIST2)
(IF (LISTP LIST1)
(IF (LISTP LIST2)
(CONS (COMB (CAR LIST1) (CAR LIST2))
(LIST-COMB A B
(CDR LIST1)
(CDR LIST2)))
(MAP-COMB-RIGHT B LIST1))
(IF (LISTP LIST2)
(MAP-COMB-LEFT A LIST2)
NIL)))
Linear arithmetic and the lemma CDR-LESSP can be used to establish that
the measure (COUNT LIST1) decreases according to the well-founded relation
LESSP in each recursive call. Hence, LIST-COMB is accepted under the
definitional principle. The definition of LIST-COMB can be justified in
another way. Linear arithmetic and the lemma CDR-LESSP inform us that the
measure (COUNT LIST2) decreases according to the well-founded relation LESSP
in each recursive call. Observe that:
(OR (LITATOM (LIST-COMB A B LIST1 LIST2))
(LISTP (LIST-COMB A B LIST1 LIST2)))
is a theorem.
[ 0.0 0.0 0.0 ]
LIST-COMB
(PROVE-LEMMA MAP-COMB-RIGHT-REDUCTION2
(REWRITE)
(IMPLIES (REDUCTION A A1 LIST1)
(REDUCTION (COMB A B1)
(COMB A1 B1)
(MAP-COMB-RIGHT B1 LIST1))))
Give the conjecture the name *1.
Let us appeal to the induction principle. 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 LIST1)
(p A B1 (CAR LIST1) (CDR LIST1)))
(p A B1 A1 LIST1))
(IMPLIES (NOT (LISTP LIST1))
(p A B1 A1 LIST1))).
Linear arithmetic and the lemma CDR-LESSP can be used to show that the measure
(COUNT LIST1) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for A1. The above induction scheme generates the following three new
conjectures:
Case 3. (IMPLIES (AND (LISTP LIST1)
(NOT (REDUCTION A (CAR LIST1) (CDR LIST1)))
(REDUCTION A A1 LIST1))
(REDUCTION (COMB A B1)
(COMB A1 B1)
(MAP-COMB-RIGHT B1 LIST1))).
This simplifies, opening up the function REDUCTION, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST1)
(REDUCTION (COMB A B1)
(COMB (CAR LIST1) B1)
(MAP-COMB-RIGHT B1 (CDR LIST1)))
(REDUCTION A A1 LIST1))
(REDUCTION (COMB A B1)
(COMB A1 B1)
(MAP-COMB-RIGHT B1 LIST1))).
This simplifies, rewriting with CDR-CONS, LEFT-COMB, COMB-EQUAL, RIGHT-COMB,
and CAR-CONS, and opening up the definitions of REDUCTION, MAP-COMB-RIGHT,
and BETA-STEP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST1))
(REDUCTION A A1 LIST1))
(REDUCTION (COMB A B1)
(COMB A1 B1)
(MAP-COMB-RIGHT B1 LIST1))),
which simplifies, rewriting with LEFT-COMB, COMB-EQUAL, and RIGHT-COMB, and
opening up the definitions of REDUCTION, MAP-COMB-RIGHT, BETA-STEP, and
LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MAP-COMB-RIGHT-REDUCTION2
(PROVE-LEMMA MAP-COMB-RIGHT-REDUCTION
(REWRITE)
(IMPLIES (AND (BETA-STEP B B1)
(REDUCTION A A1 LIST1))
(REDUCTION (COMB A B)
(COMB A1 B1)
(MAP-COMB-RIGHT B LIST1))))
Call the conjecture *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 (AND (LISTP LIST1)
(p A B (CAR LIST1) B1 (CDR LIST1)))
(p A B A1 B1 LIST1))
(IMPLIES (NOT (LISTP LIST1))
(p A B A1 B1 LIST1))).
Linear arithmetic and the lemma CDR-LESSP can be used to prove that the
measure (COUNT LIST1) decreases according to the well-founded relation LESSP
in each induction step of the scheme. Note, however, the inductive instance
chosen for A1. The above induction scheme leads to the following three new
goals:
Case 3. (IMPLIES (AND (LISTP LIST1)
(NOT (REDUCTION A (CAR LIST1) (CDR LIST1)))
(BETA-STEP B B1)
(REDUCTION A A1 LIST1))
(REDUCTION (COMB A B)
(COMB A1 B1)
(MAP-COMB-RIGHT B LIST1))).
This simplifies, opening up the definition of REDUCTION, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST1)
(REDUCTION (COMB A B)
(COMB (CAR LIST1) B1)
(MAP-COMB-RIGHT B (CDR LIST1)))
(BETA-STEP B B1)
(REDUCTION A A1 LIST1))
(REDUCTION (COMB A B)
(COMB A1 B1)
(MAP-COMB-RIGHT B LIST1))).
This simplifies, applying MAP-COMB-RIGHT-REDUCTION2, CDR-CONS, LEFT-COMB,
COMB-EQUAL, RIGHT-COMB, and CAR-CONS, and unfolding the definitions of
REDUCTION, MAP-COMB-RIGHT, and BETA-STEP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST1))
(BETA-STEP B B1)
(REDUCTION A A1 LIST1))
(REDUCTION (COMB A B)
(COMB A1 B1)
(MAP-COMB-RIGHT B LIST1))),
which simplifies, rewriting with LEFT-COMB, COMB-EQUAL, and RIGHT-COMB, and
unfolding REDUCTION, MAP-COMB-RIGHT, BETA-STEP, and LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MAP-COMB-RIGHT-REDUCTION
(PROVE-LEMMA MAP-COMB-LEFT-REDUCTION2
(REWRITE)
(IMPLIES (REDUCTION B B1 LIST2)
(REDUCTION (COMB A1 B)
(COMB A1 B1)
(MAP-COMB-LEFT A1 LIST2))))
Give the conjecture the name *1.
Let us appeal to the induction principle. 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 LIST2)
(p A1 B (CAR LIST2) (CDR LIST2)))
(p A1 B B1 LIST2))
(IMPLIES (NOT (LISTP LIST2))
(p A1 B B1 LIST2))).
Linear arithmetic and the lemma CDR-LESSP can be used to show that the measure
(COUNT LIST2) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for B1. The above induction scheme generates the following three new
conjectures:
Case 3. (IMPLIES (AND (LISTP LIST2)
(NOT (REDUCTION B (CAR LIST2) (CDR LIST2)))
(REDUCTION B B1 LIST2))
(REDUCTION (COMB A1 B)
(COMB A1 B1)
(MAP-COMB-LEFT A1 LIST2))).
This simplifies, opening up the function REDUCTION, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST2)
(REDUCTION (COMB A1 B)
(COMB A1 (CAR LIST2))
(MAP-COMB-LEFT A1 (CDR LIST2)))
(REDUCTION B B1 LIST2))
(REDUCTION (COMB A1 B)
(COMB A1 B1)
(MAP-COMB-LEFT A1 LIST2))).
This simplifies, rewriting with CDR-CONS, LEFT-COMB, RIGHT-COMB, COMB-EQUAL,
and CAR-CONS, and opening up the definitions of REDUCTION, MAP-COMB-LEFT,
and BETA-STEP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST2))
(REDUCTION B B1 LIST2))
(REDUCTION (COMB A1 B)
(COMB A1 B1)
(MAP-COMB-LEFT A1 LIST2))),
which simplifies, rewriting with LEFT-COMB, RIGHT-COMB, and COMB-EQUAL, and
opening up the definitions of REDUCTION, MAP-COMB-LEFT, BETA-STEP, and LISTP,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MAP-COMB-LEFT-REDUCTION2
(PROVE-LEMMA MAP-COMB-LEFT-REDUCTION
(REWRITE)
(IMPLIES (AND (REDUCTION B B1 LIST2)
(BETA-STEP A A1))
(REDUCTION (COMB A B)
(COMB A1 B1)
(MAP-COMB-LEFT A LIST2))))
Call the conjecture *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 (AND (LISTP LIST2)
(p A B A1 (CAR LIST2) (CDR LIST2)))
(p A B A1 B1 LIST2))
(IMPLIES (NOT (LISTP LIST2))
(p A B A1 B1 LIST2))).
Linear arithmetic and the lemma CDR-LESSP can be used to prove that the
measure (COUNT LIST2) decreases according to the well-founded relation LESSP
in each induction step of the scheme. Note, however, the inductive instance
chosen for B1. The above induction scheme leads to the following three new
goals:
Case 3. (IMPLIES (AND (LISTP LIST2)
(NOT (REDUCTION B (CAR LIST2) (CDR LIST2)))
(REDUCTION B B1 LIST2)
(BETA-STEP A A1))
(REDUCTION (COMB A B)
(COMB A1 B1)
(MAP-COMB-LEFT A LIST2))).
This simplifies, opening up the definition of REDUCTION, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST2)
(REDUCTION (COMB A B)
(COMB A1 (CAR LIST2))
(MAP-COMB-LEFT A (CDR LIST2)))
(REDUCTION B B1 LIST2)
(BETA-STEP A A1))
(REDUCTION (COMB A B)
(COMB A1 B1)
(MAP-COMB-LEFT A LIST2))).
This simplifies, applying MAP-COMB-LEFT-REDUCTION2, CDR-CONS, LEFT-COMB,
COMB-EQUAL, RIGHT-COMB, and CAR-CONS, and unfolding the definitions of
REDUCTION, MAP-COMB-LEFT, and BETA-STEP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST2))
(REDUCTION B B1 LIST2)
(BETA-STEP A A1))
(REDUCTION (COMB A B)
(COMB A1 B1)
(MAP-COMB-LEFT A LIST2))),
which simplifies, rewriting with LEFT-COMB, COMB-EQUAL, and RIGHT-COMB, and
unfolding REDUCTION, MAP-COMB-LEFT, BETA-STEP, and LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MAP-COMB-LEFT-REDUCTION
(PROVE-LEMMA LIST-COMB-REDUCTION
(REWRITE)
(IMPLIES (AND (REDUCTION A A1 LIST1)
(REDUCTION B B1 LIST2))
(REDUCTION (COMB A B)
(COMB A1 B1)
(LIST-COMB A B LIST1 LIST2))))
Call the conjecture *1.
We will appeal to induction. Four inductions are suggested by terms in
the conjecture. However, they merge into one likely candidate induction. We
will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP LIST1)
(p A B
(CAR LIST1)
(CAR LIST2)
(CDR LIST1)
(CDR LIST2)))
(p A B A1 B1 LIST1 LIST2))
(IMPLIES (NOT (LISTP LIST1))
(p A B A1 B1 LIST1 LIST2))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LIST1) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instances chosen
for B1, LIST2, and A1. The above induction scheme leads to the following four
new conjectures:
Case 4. (IMPLIES (AND (LISTP LIST1)
(NOT (REDUCTION A (CAR LIST1) (CDR LIST1)))
(REDUCTION A A1 LIST1)
(REDUCTION B B1 LIST2))
(REDUCTION (COMB A B)
(COMB A1 B1)
(LIST-COMB A B LIST1 LIST2))).
This simplifies, unfolding the function REDUCTION, to:
T.
Case 3. (IMPLIES (AND (LISTP LIST1)
(NOT (REDUCTION B (CAR LIST2) (CDR LIST2)))
(REDUCTION A A1 LIST1)
(REDUCTION B B1 LIST2))
(REDUCTION (COMB A B)
(COMB A1 B1)
(LIST-COMB A B LIST1 LIST2))).
This simplifies, applying MAP-COMB-RIGHT-REDUCTION, and unfolding the
functions REDUCTION and LIST-COMB, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST1)
(REDUCTION (COMB A B)
(COMB (CAR LIST1) (CAR LIST2))
(LIST-COMB A B
(CDR LIST1)
(CDR LIST2)))
(REDUCTION A A1 LIST1)
(REDUCTION B B1 LIST2))
(REDUCTION (COMB A B)
(COMB A1 B1)
(LIST-COMB A B LIST1 LIST2))),
which simplifies, appealing to the lemmas MAP-COMB-RIGHT-REDUCTION, CDR-CONS,
LEFT-COMB, COMB-EQUAL, RIGHT-COMB, and CAR-CONS, and opening up REDUCTION,
LIST-COMB, MAP-COMB-RIGHT, and BETA-STEP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST1))
(REDUCTION A A1 LIST1)
(REDUCTION B B1 LIST2))
(REDUCTION (COMB A B)
(COMB A1 B1)
(LIST-COMB A B LIST1 LIST2))),
which simplifies, applying the lemmas LEFT-COMB, COMB-EQUAL, RIGHT-COMB, and
MAP-COMB-LEFT-REDUCTION, and expanding the definitions of REDUCTION,
LIST-COMB, BETA-STEP, and LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
LIST-COMB-REDUCTION
(PROVE-LEMMA BETA-SUBST
(REWRITE)
(BETA-STEP (COMB (LAMBDA A) B)
(SUBST A B 1)))
This formula simplifies, applying RIGHT-COMB, BODY-LAMBDA, and LEFT-COMB, and
opening up the function BETA-STEP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
BETA-SUBST
(DEFN MAKE-REDUCTION-WALK
(W A)
(IF (EQUAL (WALK W A) A)
NIL
(IF (LAMBDAP A)
(LIST-LAMBDA (MAKE-REDUCTION-WALK W (BODY A)))
(IF (COMBP A)
(IF (AND (LAMBDAP (LEFT A))
(EQUAL (COMMAND W) 'REDUCE))
(CONS (SUBST (BODY (WALK (LEFT-INSTRS W) (LEFT A)))
(WALK (RIGHT-INSTRS W) (RIGHT A))
1)
(CONS (COMB (WALK (LEFT-INSTRS W) (LEFT A))
(WALK (RIGHT-INSTRS W) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A)))))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A))))
NIL))))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
can be used to show that the measure (COUNT A) decreases according to the
well-founded relation LESSP in each recursive call. Hence,
MAKE-REDUCTION-WALK is accepted under the principle of definition. From the
definition we can conclude that:
(OR (LITATOM (MAKE-REDUCTION-WALK W A))
(LISTP (MAKE-REDUCTION-WALK W A)))
is a theorem.
[ 0.0 0.0 0.0 ]
MAKE-REDUCTION-WALK
(PROVE-LEMMA MAKE-REDUCTION-WALK-STEPS
(REWRITE)
(REDUCTION A
(WALK W A)
(MAKE-REDUCTION-WALK W 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 (LAMBDAP A) (p (BODY A) W))
(p A W))
(IMPLIES (AND (NOT (LAMBDAP A))
(COMBP A)
(AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT A)))
(p (LEFT A) (LEFT-INSTRS W))
(p (RIGHT A) (RIGHT-INSTRS W)))
(p A W))
(IMPLIES (AND (NOT (LAMBDAP A))
(COMBP A)
(NOT (AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT A))))
(p (LEFT A) (LEFT-INSTRS W))
(p (RIGHT A) (RIGHT-INSTRS W)))
(p A W))
(IMPLIES (AND (NOT (LAMBDAP A))
(NOT (COMBP A)))
(p A W))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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. Note,
however, the inductive instances chosen for W. The above induction scheme
generates the following four new formulas:
Case 4. (IMPLIES (AND (LAMBDAP A)
(REDUCTION (BODY A)
(WALK W (BODY A))
(MAKE-REDUCTION-WALK W (BODY A))))
(REDUCTION A
(WALK W A)
(MAKE-REDUCTION-WALK W A))).
This simplifies, applying BODY-LAMBDA, and expanding the functions WALK and
MAKE-REDUCTION-WALK, to two new goals:
Case 4.2.
(IMPLIES (AND (LAMBDAP A)
(REDUCTION (BODY A)
(WALK W (BODY A))
(MAKE-REDUCTION-WALK W (BODY A)))
(NOT (EQUAL (LAMBDA (WALK W (BODY A))) A)))
(REDUCTION A
(LAMBDA (WALK W (BODY A)))
(LIST-LAMBDA (MAKE-REDUCTION-WALK W (BODY A))))).
Applying the lemma BODY-ELIM, replace A by (LAMBDA X) to eliminate
(BODY A). This produces the new formula:
(IMPLIES (AND (REDUCTION X
(WALK W X)
(MAKE-REDUCTION-WALK W X))
(NOT (EQUAL (LAMBDA (WALK W X))
(LAMBDA X))))
(REDUCTION (LAMBDA X)
(LAMBDA (WALK W X))
(LIST-LAMBDA (MAKE-REDUCTION-WALK W X)))),
which further simplifies, applying BODY-LAMBDA, LAMBDA-EQUAL, and
LAMBDA-REDUCTION, to:
T.
Case 4.1.
(IMPLIES (AND (LAMBDAP A)
(REDUCTION (BODY A)
(WALK W (BODY A))
(MAKE-REDUCTION-WALK W (BODY A)))
(EQUAL (LAMBDA (WALK W (BODY A))) A))
(REDUCTION A
(LAMBDA (WALK W (BODY A)))
NIL)).
This again simplifies, opening up the functions BETA-STEP, LISTP, and
REDUCTION, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP A))
(COMBP A)
(AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT A)))
(REDUCTION (LEFT A)
(WALK (LEFT-INSTRS W) (LEFT A))
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (RIGHT-INSTRS W) (RIGHT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A))))
(REDUCTION A
(WALK W A)
(MAKE-REDUCTION-WALK W A))),
which simplifies, rewriting with the lemma WALK-LAMBDA, and opening up the
definitions of COMMAND, AND, WALK, EQUAL, and MAKE-REDUCTION-WALK, to two
new conjectures:
Case 3.2.
(IMPLIES
(AND (COMBP A)
(EQUAL (CADDR W) 'REDUCE)
(LAMBDAP (LEFT A))
(REDUCTION (LEFT A)
(WALK (LEFT-INSTRS W) (LEFT A))
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (RIGHT-INSTRS W) (RIGHT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A)))
(NOT (EQUAL (SUBST (WALK (LEFT-INSTRS W) (BODY (LEFT A)))
(WALK (RIGHT-INSTRS W) (RIGHT A))
1)
A)))
(REDUCTION A
(SUBST (WALK (LEFT-INSTRS W) (BODY (LEFT A)))
(WALK (RIGHT-INSTRS W) (RIGHT A))
1)
(CONS (SUBST (WALK (LEFT-INSTRS W) (BODY (LEFT A)))
(WALK (RIGHT-INSTRS W) (RIGHT A))
1)
(CONS (COMB (WALK (LEFT-INSTRS W) (LEFT A))
(WALK (RIGHT-INSTRS W) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A))))))),
which again simplifies, applying CDR-CONS, CAR-CONS, LEFT-COMB,
LAMBDA-WALK, WALK-LAMBDA, and RIGHT-COMB, and opening up LEFT-INSTRS,
BETA-STEP, and REDUCTION, to:
(IMPLIES (AND (COMBP A)
(EQUAL (CADDR W) 'REDUCE)
(LAMBDAP (LEFT A))
(REDUCTION (LEFT A)
(WALK (LEFT-INSTRS W) (LEFT A))
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (RIGHT-INSTRS W) (RIGHT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A)))
(NOT (EQUAL (SUBST (WALK (CAR W) (BODY (LEFT A)))
(WALK (RIGHT-INSTRS W) (RIGHT A))
1)
A)))
(REDUCTION A
(COMB (WALK (LEFT-INSTRS W) (LEFT A))
(WALK (RIGHT-INSTRS W) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A))))),
which further simplifies, opening up LEFT-INSTRS, WALK, and RIGHT-INSTRS,
to the formula:
(IMPLIES (AND (COMBP A)
(EQUAL (CADDR W) 'REDUCE)
(LAMBDAP (LEFT A))
(REDUCTION (LEFT A)
(LAMBDA (WALK (CAR W) (BODY (LEFT A))))
(MAKE-REDUCTION-WALK (CAR W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (CADR W) (RIGHT A))
(MAKE-REDUCTION-WALK (CADR W)
(RIGHT A)))
(NOT (EQUAL (SUBST (WALK (CAR W) (BODY (LEFT A)))
(WALK (CADR W) (RIGHT A))
1)
A)))
(REDUCTION A
(COMB (LAMBDA (WALK (CAR W) (BODY (LEFT A))))
(WALK (CADR W) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK (CAR W) (LEFT A))
(MAKE-REDUCTION-WALK (CADR W)
(RIGHT A))))).
Appealing to the lemma CAR-CDR-ELIM, we now replace W by (CONS Z X) to
eliminate (CDR W) and (CAR W), X by (CONS D V) to eliminate (CDR X) and
(CAR X), and V by (CONS X C) to eliminate (CAR V) and (CDR V). This
generates four new goals:
Case 3.2.4.
(IMPLIES
(AND (NOT (LISTP W))
(COMBP A)
(EQUAL (CADDR W) 'REDUCE)
(LAMBDAP (LEFT A))
(REDUCTION (LEFT A)
(LAMBDA (WALK (CAR W) (BODY (LEFT A))))
(MAKE-REDUCTION-WALK (CAR W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (CADR W) (RIGHT A))
(MAKE-REDUCTION-WALK (CADR W)
(RIGHT A)))
(NOT (EQUAL (SUBST (WALK (CAR W) (BODY (LEFT A)))
(WALK (CADR W) (RIGHT A))
1)
A)))
(REDUCTION A
(COMB (LAMBDA (WALK (CAR W) (BODY (LEFT A))))
(WALK (CADR W) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK (CAR W) (LEFT A))
(MAKE-REDUCTION-WALK (CADR W)
(RIGHT A))))),
which further simplifies, applying CDR-NLISTP, and unfolding the
definitions of CDR, CAR, and EQUAL, to:
T.
Case 3.2.3.
(IMPLIES (AND (NOT (LISTP X))
(COMBP A)
(EQUAL (CADR X) 'REDUCE)
(LAMBDAP (LEFT A))
(REDUCTION (LEFT A)
(LAMBDA (WALK Z (BODY (LEFT A))))
(MAKE-REDUCTION-WALK Z (LEFT A)))
(REDUCTION (RIGHT A)
(WALK (CAR X) (RIGHT A))
(MAKE-REDUCTION-WALK (CAR X)
(RIGHT A)))
(NOT (EQUAL (SUBST (WALK Z (BODY (LEFT A)))
(WALK (CAR X) (RIGHT A))
1)
A)))
(REDUCTION A
(COMB (LAMBDA (WALK Z (BODY (LEFT A))))
(WALK (CAR X) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK Z (LEFT A))
(MAKE-REDUCTION-WALK (CAR X)
(RIGHT A))))).
This further simplifies, applying CDR-NLISTP, and unfolding the
definitions of CAR and EQUAL, to:
T.
Case 3.2.2.
(IMPLIES
(AND (NOT (LISTP V))
(COMBP A)
(EQUAL (CAR V) 'REDUCE)
(LAMBDAP (LEFT A))
(REDUCTION (LEFT A)
(LAMBDA (WALK Z (BODY (LEFT A))))
(MAKE-REDUCTION-WALK Z (LEFT A)))
(REDUCTION (RIGHT A)
(WALK D (RIGHT A))
(MAKE-REDUCTION-WALK D (RIGHT A)))
(NOT (EQUAL (SUBST (WALK Z (BODY (LEFT A)))
(WALK D (RIGHT A))
1)
A)))
(REDUCTION A
(COMB (LAMBDA (WALK Z (BODY (LEFT A))))
(WALK D (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK Z (LEFT A))
(MAKE-REDUCTION-WALK D (RIGHT A))))).
But this further simplifies, applying the lemma CAR-NLISTP, and opening
up the definition of EQUAL, to:
T.
Case 3.2.1.
(IMPLIES
(AND (COMBP A)
(EQUAL X 'REDUCE)
(LAMBDAP (LEFT A))
(REDUCTION (LEFT A)
(LAMBDA (WALK Z (BODY (LEFT A))))
(MAKE-REDUCTION-WALK Z (LEFT A)))
(REDUCTION (RIGHT A)
(WALK D (RIGHT A))
(MAKE-REDUCTION-WALK D (RIGHT A)))
(NOT (EQUAL (SUBST (WALK Z (BODY (LEFT A)))
(WALK D (RIGHT A))
1)
A)))
(REDUCTION A
(COMB (LAMBDA (WALK Z (BODY (LEFT A))))
(WALK D (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK Z (LEFT A))
(MAKE-REDUCTION-WALK D (RIGHT A))))),
which further simplifies, trivially, to the new goal:
(IMPLIES
(AND (COMBP A)
(LAMBDAP (LEFT A))
(REDUCTION (LEFT A)
(LAMBDA (WALK Z (BODY (LEFT A))))
(MAKE-REDUCTION-WALK Z (LEFT A)))
(REDUCTION (RIGHT A)
(WALK D (RIGHT A))
(MAKE-REDUCTION-WALK D (RIGHT A)))
(NOT (EQUAL (SUBST (WALK Z (BODY (LEFT A)))
(WALK D (RIGHT A))
1)
A)))
(REDUCTION A
(COMB (LAMBDA (WALK Z (BODY (LEFT A))))
(WALK D (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK Z (LEFT A))
(MAKE-REDUCTION-WALK D (RIGHT A))))).
Applying the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, replace A by
(COMB X V) to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA C) to
eliminate (BODY X). We would thus like to prove:
(IMPLIES (AND (REDUCTION (LAMBDA C)
(LAMBDA (WALK Z C))
(MAKE-REDUCTION-WALK Z (LAMBDA C)))
(REDUCTION V
(WALK D V)
(MAKE-REDUCTION-WALK D V))
(NOT (EQUAL (SUBST (WALK Z C) (WALK D V) 1)
(COMB (LAMBDA C) V))))
(REDUCTION (COMB (LAMBDA C) V)
(COMB (LAMBDA (WALK Z C)) (WALK D V))
(LIST-COMB (LAMBDA C)
V
(MAKE-REDUCTION-WALK Z (LAMBDA C))
(MAKE-REDUCTION-WALK D V)))),
which further simplifies, rewriting with LAMBDA-EQUAL, BODY-LAMBDA, and
LIST-COMB-REDUCTION, and unfolding WALK, MAKE-REDUCTION-WALK, LISTP, and
LIST-COMB, to the following two new formulas:
Case 3.2.1.2.
(IMPLIES (AND (EQUAL (WALK Z C) C)
(REDUCTION (LAMBDA C)
(LAMBDA (WALK Z C))
NIL)
(REDUCTION V
(WALK D V)
(MAKE-REDUCTION-WALK D V))
(NOT (EQUAL (SUBST C (WALK D V) 1)
(COMB (LAMBDA C) V)))
(NOT (LISTP (MAKE-REDUCTION-WALK D V))))
(REDUCTION (COMB (LAMBDA C) V)
(COMB (LAMBDA C) (WALK D V))
NIL)).
However this finally simplifies, applying LEFT-COMB, RIGHT-COMB,
COMB-EQUAL, and BODY-LAMBDA, and expanding the functions BETA-STEP,
LISTP, and REDUCTION, to:
T.
Case 3.2.1.1.
(IMPLIES (AND (EQUAL (WALK Z C) C)
(REDUCTION (LAMBDA C)
(LAMBDA (WALK Z C))
NIL)
(REDUCTION V
(WALK D V)
(MAKE-REDUCTION-WALK D V))
(NOT (EQUAL (SUBST C (WALK D V) 1)
(COMB (LAMBDA C) V)))
(LISTP (MAKE-REDUCTION-WALK D V)))
(REDUCTION (COMB (LAMBDA C) V)
(COMB (LAMBDA C) (WALK D V))
(MAP-COMB-LEFT (LAMBDA C)
(MAKE-REDUCTION-WALK D V)))).
However this finally simplifies, applying MAP-COMB-LEFT-REDUCTION, and
unfolding the definitions of BETA-STEP, LISTP, and REDUCTION, to:
T.
Case 3.1.
(IMPLIES (AND (COMBP A)
(EQUAL (CADDR W) 'REDUCE)
(LAMBDAP (LEFT A))
(REDUCTION (LEFT A)
(WALK (LEFT-INSTRS W) (LEFT A))
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (RIGHT-INSTRS W) (RIGHT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A)))
(EQUAL (SUBST (WALK (LEFT-INSTRS W) (BODY (LEFT A)))
(WALK (RIGHT-INSTRS W) (RIGHT A))
1)
A))
(REDUCTION A
(SUBST (WALK (LEFT-INSTRS W) (BODY (LEFT A)))
(WALK (RIGHT-INSTRS W) (RIGHT A))
1)
NIL)).
However this again simplifies, opening up the functions LEFT-INSTRS,
BETA-STEP, LISTP, and REDUCTION, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP A))
(COMBP A)
(NOT (AND (EQUAL (COMMAND W) 'REDUCE)
(LAMBDAP (LEFT A))))
(REDUCTION (LEFT A)
(WALK (LEFT-INSTRS W) (LEFT A))
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (RIGHT-INSTRS W) (RIGHT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A))))
(REDUCTION A
(WALK W A)
(MAKE-REDUCTION-WALK W A))),
which simplifies, applying LEFT-COMB, and unfolding the functions COMMAND,
AND, WALK, and MAKE-REDUCTION-WALK, to the following four new conjectures:
Case 2.4.
(IMPLIES (AND (COMBP A)
(NOT (EQUAL (CADDR W) 'REDUCE))
(REDUCTION (LEFT A)
(WALK (LEFT-INSTRS W) (LEFT A))
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (RIGHT-INSTRS W) (RIGHT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A)))
(NOT (EQUAL (COMB (WALK (LEFT-INSTRS W) (LEFT A))
(WALK (RIGHT-INSTRS W) (RIGHT A)))
A)))
(REDUCTION A
(COMB (WALK (LEFT-INSTRS W) (LEFT A))
(WALK (RIGHT-INSTRS W) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A))))).
However this further simplifies, applying LEFT-COMB, and unfolding the
functions LEFT-INSTRS and RIGHT-INSTRS, to the new conjecture:
(IMPLIES (AND (COMBP A)
(NOT (EQUAL (CADDR W) 'REDUCE))
(REDUCTION (LEFT A)
(WALK (CAR W) (LEFT A))
(MAKE-REDUCTION-WALK (CAR W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (CADR W) (RIGHT A))
(MAKE-REDUCTION-WALK (CADR W)
(RIGHT A)))
(NOT (EQUAL (COMB (WALK (CAR W) (LEFT A))
(WALK (CADR W) (RIGHT A)))
A)))
(REDUCTION A
(COMB (WALK (CAR W) (LEFT A))
(WALK (CADR W) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK (CAR W) (LEFT A))
(MAKE-REDUCTION-WALK (CADR W)
(RIGHT A))))).
Applying the lemma CAR-CDR-ELIM, replace W by (CONS Z X) to eliminate
(CDR W) and (CAR W), X by (CONS D V) to eliminate (CDR X) and (CAR X), and
V by (CONS X C) to eliminate (CAR V) and (CDR V). This produces the
following four new conjectures:
Case 2.4.4.
(IMPLIES
(AND (NOT (LISTP W))
(COMBP A)
(NOT (EQUAL (CADDR W) 'REDUCE))
(REDUCTION (LEFT A)
(WALK (CAR W) (LEFT A))
(MAKE-REDUCTION-WALK (CAR W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (CADR W) (RIGHT A))
(MAKE-REDUCTION-WALK (CADR W)
(RIGHT A)))
(NOT (EQUAL (COMB (WALK (CAR W) (LEFT A))
(WALK (CADR W) (RIGHT A)))
A)))
(REDUCTION A
(COMB (WALK (CAR W) (LEFT A))
(WALK (CADR W) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK (CAR W) (LEFT A))
(MAKE-REDUCTION-WALK (CADR W)
(RIGHT A))))).
But this further simplifies, applying the lemmas CDR-NLISTP, CAR-NLISTP,
NLISTP-WALK, and COMB-LEFT-RIGHT, and unfolding CDR, CAR, EQUAL,
MAKE-REDUCTION-WALK, BETA-STEP, LISTP, and REDUCTION, to:
T.
Case 2.4.3.
(IMPLIES (AND (NOT (LISTP X))
(COMBP A)
(NOT (EQUAL (CADR X) 'REDUCE))
(REDUCTION (LEFT A)
(WALK Z (LEFT A))
(MAKE-REDUCTION-WALK Z (LEFT A)))
(REDUCTION (RIGHT A)
(WALK (CAR X) (RIGHT A))
(MAKE-REDUCTION-WALK (CAR X)
(RIGHT A)))
(NOT (EQUAL (COMB (WALK Z (LEFT A))
(WALK (CAR X) (RIGHT A)))
A)))
(REDUCTION A
(COMB (WALK Z (LEFT A))
(WALK (CAR X) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK Z (LEFT A))
(MAKE-REDUCTION-WALK (CAR X)
(RIGHT A))))),
which further simplifies, applying CDR-NLISTP, CAR-NLISTP, NLISTP-WALK,
and LEFT-COMB, and opening up CAR, EQUAL, MAKE-REDUCTION-WALK, BETA-STEP,
LISTP, REDUCTION, and LIST-COMB, to the following two new goals:
Case 2.4.3.2.
(IMPLIES (AND (NOT (LISTP X))
(COMBP A)
(REDUCTION (LEFT A)
(WALK Z (LEFT A))
(MAKE-REDUCTION-WALK Z (LEFT A)))
(NOT (EQUAL (COMB (WALK Z (LEFT A)) (RIGHT A))
A))
(NOT (LISTP (MAKE-REDUCTION-WALK Z (LEFT A)))))
(REDUCTION A
(COMB (WALK Z (LEFT A)) (RIGHT A))
NIL)).
But this again simplifies, applying the lemmas LEFT-COMB and
RIGHT-COMB, and unfolding REDUCTION, BETA-STEP, and LISTP, to:
T.
Case 2.4.3.1.
(IMPLIES
(AND (NOT (LISTP X))
(COMBP A)
(REDUCTION (LEFT A)
(WALK Z (LEFT A))
(MAKE-REDUCTION-WALK Z (LEFT A)))
(NOT (EQUAL (COMB (WALK Z (LEFT A)) (RIGHT A))
A))
(LISTP (MAKE-REDUCTION-WALK Z (LEFT A))))
(REDUCTION A
(COMB (WALK Z (LEFT A)) (RIGHT A))
(MAP-COMB-RIGHT (RIGHT A)
(MAKE-REDUCTION-WALK Z (LEFT A))))).
Applying the lemma LEFT-RIGHT-ELIM, replace A by (COMB V D) to
eliminate (LEFT A) and (RIGHT A). We would thus like to prove the new
formula:
(IMPLIES (AND (NOT (LISTP X))
(REDUCTION V
(WALK Z V)
(MAKE-REDUCTION-WALK Z V))
(NOT (EQUAL (COMB (WALK Z V) D)
(COMB V D)))
(LISTP (MAKE-REDUCTION-WALK Z V)))
(REDUCTION (COMB V D)
(COMB (WALK Z V) D)
(MAP-COMB-RIGHT D
(MAKE-REDUCTION-WALK Z V)))),
which finally simplifies, rewriting with LEFT-COMB, COMB-EQUAL, and
MAP-COMB-RIGHT-REDUCTION, and expanding the function BETA-STEP, to:
T.
Case 2.4.2.
(IMPLIES
(AND (NOT (LISTP V))
(COMBP A)
(NOT (EQUAL (CAR V) 'REDUCE))
(REDUCTION (LEFT A)
(WALK Z (LEFT A))
(MAKE-REDUCTION-WALK Z (LEFT A)))
(REDUCTION (RIGHT A)
(WALK D (RIGHT A))
(MAKE-REDUCTION-WALK D (RIGHT A)))
(NOT (EQUAL (COMB (WALK Z (LEFT A))
(WALK D (RIGHT A)))
A)))
(REDUCTION A
(COMB (WALK Z (LEFT A))
(WALK D (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK Z (LEFT A))
(MAKE-REDUCTION-WALK D (RIGHT A))))).
This further simplifies, rewriting with CAR-NLISTP and LEFT-COMB, and
opening up the definition of EQUAL, to the new conjecture:
(IMPLIES
(AND (NOT (LISTP V))
(COMBP A)
(REDUCTION (LEFT A)
(WALK Z (LEFT A))
(MAKE-REDUCTION-WALK Z (LEFT A)))
(REDUCTION (RIGHT A)
(WALK D (RIGHT A))
(MAKE-REDUCTION-WALK D (RIGHT A)))
(NOT (EQUAL (COMB (WALK Z (LEFT A))
(WALK D (RIGHT A)))
A)))
(REDUCTION A
(COMB (WALK Z (LEFT A))
(WALK D (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK Z (LEFT A))
(MAKE-REDUCTION-WALK D (RIGHT A))))).
Applying the lemma LEFT-RIGHT-ELIM, replace A by (COMB X C) to eliminate
(LEFT A) and (RIGHT A). This produces:
(IMPLIES (AND (NOT (LISTP V))
(REDUCTION X
(WALK Z X)
(MAKE-REDUCTION-WALK Z X))
(REDUCTION C
(WALK D C)
(MAKE-REDUCTION-WALK D C))
(NOT (EQUAL (COMB (WALK Z X) (WALK D C))
(COMB X C))))
(REDUCTION (COMB X C)
(COMB (WALK Z X) (WALK D C))
(LIST-COMB X C
(MAKE-REDUCTION-WALK Z X)
(MAKE-REDUCTION-WALK D C)))),
which finally simplifies, rewriting with the lemmas LEFT-COMB,
COMB-EQUAL, and LIST-COMB-REDUCTION, to:
T.
Case 2.4.1.
(IMPLIES
(AND (COMBP A)
(NOT (EQUAL X 'REDUCE))
(REDUCTION (LEFT A)
(WALK Z (LEFT A))
(MAKE-REDUCTION-WALK Z (LEFT A)))
(REDUCTION (RIGHT A)
(WALK D (RIGHT A))
(MAKE-REDUCTION-WALK D (RIGHT A)))
(NOT (EQUAL (COMB (WALK Z (LEFT A))
(WALK D (RIGHT A)))
A)))
(REDUCTION A
(COMB (WALK Z (LEFT A))
(WALK D (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK Z (LEFT A))
(MAKE-REDUCTION-WALK D (RIGHT A))))).
Applying the lemma LEFT-RIGHT-ELIM, replace A by (COMB V C) to eliminate
(LEFT A) and (RIGHT A). We thus obtain:
(IMPLIES (AND (NOT (EQUAL X 'REDUCE))
(REDUCTION V
(WALK Z V)
(MAKE-REDUCTION-WALK Z V))
(REDUCTION C
(WALK D C)
(MAKE-REDUCTION-WALK D C))
(NOT (EQUAL (COMB (WALK Z V) (WALK D C))
(COMB V C))))
(REDUCTION (COMB V C)
(COMB (WALK Z V) (WALK D C))
(LIST-COMB V C
(MAKE-REDUCTION-WALK Z V)
(MAKE-REDUCTION-WALK D C)))),
which further simplifies, applying LEFT-COMB, COMB-EQUAL, and
LIST-COMB-REDUCTION, to:
T.
Case 2.3.
(IMPLIES (AND (COMBP A)
(NOT (EQUAL (CADDR W) 'REDUCE))
(REDUCTION (LEFT A)
(WALK (LEFT-INSTRS W) (LEFT A))
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (RIGHT-INSTRS W) (RIGHT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A)))
(EQUAL (COMB (WALK (LEFT-INSTRS W) (LEFT A))
(WALK (RIGHT-INSTRS W) (RIGHT A)))
A))
(REDUCTION A
(COMB (WALK (LEFT-INSTRS W) (LEFT A))
(WALK (RIGHT-INSTRS W) (RIGHT A)))
NIL)).
However this again simplifies, unfolding the functions BETA-STEP, LISTP,
and REDUCTION, to:
T.
Case 2.2.
(IMPLIES (AND (COMBP A)
(NOT (LAMBDAP (LEFT A)))
(REDUCTION (LEFT A)
(WALK (LEFT-INSTRS W) (LEFT A))
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (RIGHT-INSTRS W) (RIGHT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A)))
(NOT (EQUAL (COMB (WALK (LEFT-INSTRS W) (LEFT A))
(WALK (RIGHT-INSTRS W) (RIGHT A)))
A)))
(REDUCTION A
(COMB (WALK (LEFT-INSTRS W) (LEFT A))
(WALK (RIGHT-INSTRS W) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A))))),
which further simplifies, applying LEFT-COMB, and opening up LEFT-INSTRS
and RIGHT-INSTRS, to:
(IMPLIES (AND (COMBP A)
(NOT (LAMBDAP (LEFT A)))
(REDUCTION (LEFT A)
(WALK (CAR W) (LEFT A))
(MAKE-REDUCTION-WALK (CAR W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (CADR W) (RIGHT A))
(MAKE-REDUCTION-WALK (CADR W)
(RIGHT A)))
(NOT (EQUAL (COMB (WALK (CAR W) (LEFT A))
(WALK (CADR W) (RIGHT A)))
A)))
(REDUCTION A
(COMB (WALK (CAR W) (LEFT A))
(WALK (CADR W) (RIGHT A)))
(LIST-COMB (LEFT A)
(RIGHT A)
(MAKE-REDUCTION-WALK (CAR W) (LEFT A))
(MAKE-REDUCTION-WALK (CADR W)
(RIGHT A))))).
Applying the lemma LEFT-RIGHT-ELIM, replace A by (COMB X Z) to eliminate
(LEFT A) and (RIGHT A). This produces:
(IMPLIES (AND (NOT (LAMBDAP X))
(REDUCTION X
(WALK (CAR W) X)
(MAKE-REDUCTION-WALK (CAR W) X))
(REDUCTION Z
(WALK (CADR W) Z)
(MAKE-REDUCTION-WALK (CADR W) Z))
(NOT (EQUAL (COMB (WALK (CAR W) X)
(WALK (CADR W) Z))
(COMB X Z))))
(REDUCTION (COMB X Z)
(COMB (WALK (CAR W) X)
(WALK (CADR W) Z))
(LIST-COMB X Z
(MAKE-REDUCTION-WALK (CAR W) X)
(MAKE-REDUCTION-WALK (CADR W) Z)))),
which further simplifies, rewriting with LEFT-COMB, COMB-EQUAL, and
LIST-COMB-REDUCTION, to:
T.
Case 2.1.
(IMPLIES (AND (COMBP A)
(NOT (LAMBDAP (LEFT A)))
(REDUCTION (LEFT A)
(WALK (LEFT-INSTRS W) (LEFT A))
(MAKE-REDUCTION-WALK (LEFT-INSTRS W)
(LEFT A)))
(REDUCTION (RIGHT A)
(WALK (RIGHT-INSTRS W) (RIGHT A))
(MAKE-REDUCTION-WALK (RIGHT-INSTRS W)
(RIGHT A)))
(EQUAL (COMB (WALK (LEFT-INSTRS W) (LEFT A))
(WALK (RIGHT-INSTRS W) (RIGHT A)))
A))
(REDUCTION A
(COMB (WALK (LEFT-INSTRS W) (LEFT A))
(WALK (RIGHT-INSTRS W) (RIGHT A)))
NIL)).
This again simplifies, expanding the functions BETA-STEP, LISTP, and
REDUCTION, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP A))
(NOT (COMBP A)))
(REDUCTION A
(WALK W A)
(MAKE-REDUCTION-WALK W A))),
which simplifies, unfolding WALK, MAKE-REDUCTION-WALK, BETA-STEP, LISTP, and
REDUCTION, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.4 0.1 ]
MAKE-REDUCTION-WALK-STEPS
(PROVE-LEMMA REDUCTION-APPEND
(REWRITE)
(IMPLIES (AND (REDUCTION A B X)
(REDUCTION B C Y))
(REDUCTION A C
(APPEND Y (CONS B X)))))
Call the conjecture *1.
Let us appeal to the induction principle. There are three plausible
inductions. They merge into two likely candidate inductions, both of which
are unflawed. However, one of these is more likely than the other. We will
induct according to the following scheme:
(AND (IMPLIES (AND (LISTP Y)
(p A (CAR Y) (CDR Y) B X))
(p A C Y B X))
(IMPLIES (NOT (LISTP Y))
(p A C Y B 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 induction step
of the scheme. Note, however, the inductive instance chosen for C. The above
induction scheme produces three new formulas:
Case 3. (IMPLIES (AND (LISTP Y)
(NOT (REDUCTION B (CAR Y) (CDR Y)))
(REDUCTION A B X)
(REDUCTION B C Y))
(REDUCTION A C
(APPEND Y (CONS B X)))),
which simplifies, opening up the definition of REDUCTION, to:
T.
Case 2. (IMPLIES (AND (LISTP Y)
(REDUCTION A
(CAR Y)
(APPEND (CDR Y) (CONS B X)))
(REDUCTION A B X)
(REDUCTION B C Y))
(REDUCTION A C
(APPEND Y (CONS B X)))),
which simplifies, applying CDR-CONS and CAR-CONS, and expanding the
definitions of REDUCTION and APPEND, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP Y))
(REDUCTION A B X)
(REDUCTION B C Y))
(REDUCTION A C
(APPEND Y (CONS B X)))).
This simplifies, rewriting with CDR-CONS and CAR-CONS, and opening up
REDUCTION and APPEND, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
REDUCTION-APPEND
(DEFN MAKE-REDUCE-STEPS
(W A)
(IF (LISTP W)
(APPEND (MAKE-REDUCE-STEPS (CDR W)
(WALK (CAR W) A))
(CONS (WALK (CAR W) A)
(MAKE-REDUCTION-WALK (CAR W) A)))
NIL))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT W) decreases according to the well-founded relation LESSP in each
recursive call. Hence, MAKE-REDUCE-STEPS is accepted under the definitional
principle. Note that:
(OR (LITATOM (MAKE-REDUCE-STEPS W A))
(LISTP (MAKE-REDUCE-STEPS W A)))
is a theorem.
[ 0.0 0.0 0.0 ]
MAKE-REDUCE-STEPS
(PROVE-LEMMA MAKE-REDUCE-STEPS-STEPS
(REWRITE)
(REDUCTION A
(REDUCE W A)
(MAKE-REDUCE-STEPS W 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 W)
(p (WALK (CAR W) A) (CDR W)))
(p A W))
(IMPLIES (NOT (LISTP W)) (p A W))).
Linear arithmetic and the lemma CDR-LESSP can be used to establish that the
measure (COUNT W) 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 generates the following two new
formulas:
Case 2. (IMPLIES (AND (LISTP W)
(REDUCTION (WALK (CAR W) A)
(REDUCE (CDR W) (WALK (CAR W) A))
(MAKE-REDUCE-STEPS (CDR W)
(WALK (CAR W) A))))
(REDUCTION A
(REDUCE W A)
(MAKE-REDUCE-STEPS W A))).
This simplifies, applying MAKE-REDUCTION-WALK-STEPS and REDUCTION-APPEND,
and expanding the functions REDUCE and MAKE-REDUCE-STEPS, to:
T.
Case 1. (IMPLIES (NOT (LISTP W))
(REDUCTION A
(REDUCE W A)
(MAKE-REDUCE-STEPS W A))),
which simplifies, opening up the functions REDUCE, MAKE-REDUCE-STEPS,
BETA-STEP, LISTP, and REDUCTION, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
MAKE-REDUCE-STEPS-STEPS
(DEFN MAKE-W
(X Y Z LIST1 LIST2)
(REDUCE (MAKE-REDUCE X
(MAKE-REDUCE-REDUCTION X Y LIST1)
(MAKE-REDUCE-REDUCTION X Z LIST2))
(REDUCE (MAKE-REDUCE-REDUCTION X Z LIST2)
X)))
[ 0.0 0.0 0.0 ]
MAKE-W
(DEFN MAKE-REDUCTION
(X Y Z LIST1 LIST2)
(MAKE-REDUCE-STEPS (MAKE-REDUCE X
(MAKE-REDUCE-REDUCTION X Z LIST2)
(MAKE-REDUCE-REDUCTION X Y LIST1))
Y))
Note that:
(OR (LITATOM (MAKE-REDUCTION X Y Z LIST1 LIST2))
(LISTP (MAKE-REDUCTION X Y Z LIST1 LIST2)))
is a theorem.
[ 0.0 0.0 0.0 ]
MAKE-REDUCTION
(PROVE-LEMMA THE-REAL-CHURCH-ROSSER
(REWRITE)
(IMPLIES (AND (REDUCTION X Y LIST1)
(REDUCTION X Z LIST2))
(AND (REDUCTION Y
(MAKE-W X Z Y LIST2 LIST1)
(MAKE-REDUCTION X Y Z LIST1 LIST2))
(REDUCTION Z
(MAKE-W X Y Z LIST1 LIST2)
(MAKE-REDUCTION X Z Y LIST2 LIST1)))))
WARNING: Note that the proposed lemma THE-REAL-CHURCH-ROSSER is to be stored
as zero type prescription rules, zero compound recognizer rules, zero linear
rules, and two replacement rules.
This simplifies, applying the lemmas MAKE-REDUCE-REDUCTION-REDUCTION and
MAKE-REDUCE-STEPS-STEPS, and opening up the functions MAKE-W, MAKE-REDUCTION,
and AND, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
THE-REAL-CHURCH-ROSSER
(PROVE-LEMMA BOTH-MAKE-W-ARE-SAME
(REWRITE)
(IMPLIES (AND (REDUCTION X Y LIST1)
(REDUCTION X Z LIST2))
(EQUAL (MAKE-W X Y Z LIST1 LIST2)
(MAKE-W X Z Y LIST2 LIST1)))
((USE (CHURCH-ROSSER (M X)
(U (MAKE-REDUCE-REDUCTION X Y LIST1))
(V (MAKE-REDUCE-REDUCTION X Z LIST2))))))
WARNING: Note that the rewrite rule BOTH-MAKE-W-ARE-SAME will be stored so as
to apply only to terms with the nonrecursive function symbol MAKE-W.
This simplifies, applying the lemma MAKE-REDUCE-REDUCTION-REDUCTION, and
unfolding MAKE-W, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
BOTH-MAKE-W-ARE-SAME
(PROVE-LEMMA NBETA-STEP-TRANSLATES
(REWRITE)
(IMPLIES (AND (NTERMP A) (NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))))
Give the conjecture the name *1.
Let us appeal to the induction principle. 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 (EQUAL A B) (p A X B))
(IMPLIES (AND (NOT (EQUAL A B))
(NLAMBDAP A)
(p (NBODY A)
(CONS (NBIND A) X)
(NBODY B)))
(p A X B))
(IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NCOMBP A)
(p (NLEFT A) X (NLEFT B))
(p (NRIGHT A) X (NRIGHT B)))
(p A X B))
(IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NOT (NCOMBP A)))
(p A X B))).
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and NLEFT-LESSP
can be used to show that the measure (COUNT A) decreases according to the
well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instances chosen for X and B. The above induction
scheme generates the following 14 new conjectures:
Case 14.(IMPLIES (AND (EQUAL A B)
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, opening up the functions NBETA-STEP and BETA-STEP, to:
T.
Case 13.(IMPLIES (AND (NOT (EQUAL A B))
(NLAMBDAP A)
(NOT (NTERMP (NBODY A)))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, unfolding the function NTERMP, to:
T.
Case 12.(IMPLIES (AND (NOT (EQUAL A B))
(NLAMBDAP A)
(NOT (NBETA-STEP (NBODY A) (NBODY B)))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, expanding NTERMP and NBETA-STEP, to:
T.
Case 11.(IMPLIES (AND (NOT (EQUAL A B))
(NLAMBDAP A)
(BETA-STEP (TRANSLATE (NBODY A)
(CONS (NBIND A) X))
(TRANSLATE (NBODY B)
(CONS (NBIND A) X)))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, rewriting with the lemmas LAMBDA-EQUAL and BODY-LAMBDA, and
expanding the functions NTERMP, NBETA-STEP, TRANSLATE, and BETA-STEP, to:
T.
Case 10.(IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (NTERMP (NLEFT A)))
(NOT (NTERMP (NRIGHT A)))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, unfolding the function NTERMP, to:
T.
Case 9. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(NOT (NTERMP (NRIGHT A)))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, opening up the definition of NTERMP, to:
T.
Case 8. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(NOT (NTERMP (NRIGHT A)))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, opening up the definition of NTERMP, to:
T.
Case 7. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (NTERMP (NLEFT A)))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, unfolding the definition of NTERMP, to:
T.
Case 6. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, applying RIGHT-COMB and LEFT-COMB, and expanding NTERMP,
NBETA-STEP, TRANSLATE, and BETA-STEP, to six new goals:
Case 6.6.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(RIGHT (TRANSLATE B X)))),
which again simplifies, applying the lemmas BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and opening up the definitions of EQUAL,
COMBP, LAMBDAP, SUBST, RIGHT, and BETA-STEP, to four new conjectures:
Case 6.6.4.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NRIGHT A) X)))
(RIGHT (TRANSLATE (NRIGHT A) X))
1))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables. We
thus obtain the new conjecture:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE V X)))
(RIGHT (TRANSLATE V X))
1))),
which further simplifies, rewriting with NBODY-NLAMBDA and NBIND-NLAMBDA,
and unfolding NBETA-STEP, NTERMP, and TRANSLATE, to:
T.
Case 6.6.3.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(LAMBDAP (LEFT (TRANSLATE (NRIGHT A) X)))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We use the type
restriction lemma noted when NBIND was introduced to constrain the new
variables. We must thus prove:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(LAMBDAP (LEFT (TRANSLATE V X)))).
But this further simplifies, rewriting with NBODY-NLAMBDA and
NBIND-NLAMBDA, and unfolding the definitions of NBETA-STEP, NTERMP, and
TRANSLATE, to:
T.
Case 6.6.2.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(COMBP (TRANSLATE (NRIGHT A) X))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We employ the type
restriction lemma noted when NBIND was introduced to constrain the new
variables. We must thus prove the formula:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(COMBP (TRANSLATE V X))).
This further simplifies, rewriting with the lemmas NBODY-NLAMBDA and
NBIND-NLAMBDA, and expanding the definitions of NBETA-STEP, NTERMP, and
TRANSLATE, to:
T.
Case 6.6.1.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(NOT (LAMBDAP (TRANSLATE (NRIGHT A) X)))),
which again simplifies, clearly, to:
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(NOT (LAMBDAP (TRANSLATE (NRIGHT A) X)))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables. We
thus obtain:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X))))
(NOT (LAMBDAP (TRANSLATE V X)))),
which further simplifies, applying NBODY-NLAMBDA and NBIND-NLAMBDA, and
opening up the functions NBETA-STEP, NTERMP, and TRANSLATE, to:
T.
Case 6.5.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(RIGHT (TRANSLATE B X)))).
But this again simplifies, rewriting with TRANSLATE-PRESERVES-REDUCTION,
to:
T.
Case 6.4.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(BETA-STEP (TRANSLATE (NLEFT A) X)
(LEFT (TRANSLATE B X)))).
This again simplifies, applying BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and opening up EQUAL, COMBP, LAMBDAP, SUBST,
LEFT, and BETA-STEP, to the following three new goals:
Case 6.4.3.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NLEFT A) X)))
(RIGHT (TRANSLATE (NLEFT A) X))
1))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We rely upon the
type restriction lemma noted when NBIND was introduced to constrain the
new variables. The result is:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NLAMBDA D W) X)))
(RIGHT (TRANSLATE (NLAMBDA D W) X))
1))).
This further simplifies, applying NBODY-NLAMBDA and NBIND-NLAMBDA, and
opening up NBETA-STEP, NTERMP, and TRANSLATE, to:
T.
Case 6.4.2.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(LAMBDAP (LEFT (TRANSLATE (NLEFT A) X)))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We employ the type
restriction lemma noted when NBIND was introduced to constrain the new
variables. The result is the conjecture:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(LAMBDAP (LEFT (TRANSLATE (NLAMBDA D W) X)))).
However this further simplifies, applying NBODY-NLAMBDA and
NBIND-NLAMBDA, and opening up the functions NBETA-STEP, NTERMP, and
TRANSLATE, to:
T.
Case 6.4.1.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(COMBP (TRANSLATE (NLEFT A) X))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We use the type
restriction lemma noted when NBIND was introduced to constrain the new
variables. We must thus prove:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(COMBP (TRANSLATE (NLAMBDA D W) X))).
But this further simplifies, rewriting with NBODY-NLAMBDA and
NBIND-NLAMBDA, and unfolding the functions NBETA-STEP, NTERMP, and
TRANSLATE, to:
T.
Case 6.3.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(BETA-STEP (TRANSLATE (NLEFT A) X)
(LEFT (TRANSLATE B X)))).
This again simplifies, applying TRANSLATE-PRESERVES-REDUCTION, to:
T.
Case 6.2.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(COMBP (TRANSLATE B X))).
However this again simplifies, rewriting with BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and opening up the functions EQUAL, COMBP,
LAMBDAP, and SUBST, to:
(IMPLIES (AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A)))
(LAMBDAP (TRANSLATE (NLEFT A) X))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables. We
would thus like to prove:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V))
(LAMBDAP (TRANSLATE (NLAMBDA D W) X))),
which further simplifies, rewriting with the lemmas NBODY-NLAMBDA and
NBIND-NLAMBDA, and unfolding NBETA-STEP, NTERMP, and TRANSLATE, to:
T.
Case 6.1.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(COMBP (TRANSLATE B X))),
which again simplifies, applying TRANSLATE-PRESERVES-REDUCTION, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, applying RIGHT-COMB and LEFT-COMB, and unfolding NTERMP,
NBETA-STEP, TRANSLATE, and BETA-STEP, to six new goals:
Case 5.6.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(RIGHT (TRANSLATE B X)))),
which again simplifies, rewriting with BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and unfolding EQUAL, COMBP, LAMBDAP, SUBST,
RIGHT, and BETA-STEP, to the following four new goals:
Case 5.6.4.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NRIGHT A) X)))
(RIGHT (TRANSLATE (NRIGHT A) X))
1))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We rely upon the
type restriction lemma noted when NBIND was introduced to constrain the
new variables. This generates the goal:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE V X)))
(RIGHT (TRANSLATE V X))
1))).
But this further simplifies, rewriting with NBIND-NLAMBDA, NBODY-NLAMBDA,
and BODY-LAMBDA, and opening up the functions TRANSLATE, BETA-STEP, and
NTERMP, to:
T.
Case 5.6.3.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(LAMBDAP (LEFT (TRANSLATE (NRIGHT A) X)))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We employ the type
restriction lemma noted when NBIND was introduced to constrain the new
variables. We must thus prove the conjecture:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(LAMBDAP (LEFT (TRANSLATE V X)))).
But this further simplifies, rewriting with the lemmas NBIND-NLAMBDA,
NBODY-NLAMBDA, and BODY-LAMBDA, and opening up the definitions of
TRANSLATE, BETA-STEP, and NTERMP, to:
T.
Case 5.6.2.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(COMBP (TRANSLATE (NRIGHT A) X))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables. We
would thus like to prove:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(COMBP (TRANSLATE V X))),
which further simplifies, appealing to the lemmas NBIND-NLAMBDA,
NBODY-NLAMBDA, and BODY-LAMBDA, and unfolding the functions TRANSLATE,
BETA-STEP, and NTERMP, to:
T.
Case 5.6.1.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(NOT (LAMBDAP (TRANSLATE (NRIGHT A) X)))),
which again simplifies, clearly, to the new formula:
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(NOT (LAMBDAP (TRANSLATE (NRIGHT A) X)))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables. We
thus obtain:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X))))
(NOT (LAMBDAP (TRANSLATE V X)))),
which further simplifies, applying NBIND-NLAMBDA, NBODY-NLAMBDA, and
BODY-LAMBDA, and expanding the functions TRANSLATE, BETA-STEP, and
NTERMP, to:
T.
Case 5.5.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(RIGHT (TRANSLATE B X)))).
But this again simplifies, rewriting with TRANSLATE-PRESERVES-REDUCTION,
to:
T.
Case 5.4.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(BETA-STEP (TRANSLATE (NLEFT A) X)
(LEFT (TRANSLATE B X)))).
But this again simplifies, applying BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and expanding EQUAL, COMBP, LAMBDAP, SUBST,
LEFT, and BETA-STEP, to the following three new conjectures:
Case 5.4.3.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NLEFT A) X)))
(RIGHT (TRANSLATE (NLEFT A) X))
1))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We employ the type
restriction lemma noted when NBIND was introduced to constrain the new
variables. This generates the goal:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NLAMBDA D W) X)))
(RIGHT (TRANSLATE (NLAMBDA D W) X))
1))).
But this further simplifies, applying NBIND-NLAMBDA, NBODY-NLAMBDA, and
BODY-LAMBDA, and unfolding the functions TRANSLATE, BETA-STEP, and
NTERMP, to:
T.
Case 5.4.2.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(LAMBDAP (LEFT (TRANSLATE (NLEFT A) X)))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We use the type
restriction lemma noted when NBIND was introduced to constrain the new
variables. We must thus prove the conjecture:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(LAMBDAP (LEFT (TRANSLATE (NLAMBDA D W) X)))).
However this further simplifies, applying NBIND-NLAMBDA, NBODY-NLAMBDA,
and BODY-LAMBDA, and opening up TRANSLATE, BETA-STEP, and NTERMP, to:
T.
Case 5.4.1.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(COMBP (TRANSLATE (NLEFT A) X))).
This again simplifies, unfolding the function BETA-STEP, to:
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(EQUAL (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(COMBP (TRANSLATE (NLEFT A) X))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We rely upon the
type restriction lemma noted when NBIND was introduced to constrain the
new variables. We must thus prove:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(EQUAL (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(COMBP (TRANSLATE (NLAMBDA D W) X))).
However this further simplifies, applying the lemmas NBIND-NLAMBDA and
NBODY-NLAMBDA, and opening up TRANSLATE and NTERMP, to:
T.
Case 5.3.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(BETA-STEP (TRANSLATE (NLEFT A) X)
(LEFT (TRANSLATE B X)))),
which again simplifies, applying TRANSLATE-PRESERVES-REDUCTION, to:
T.
Case 5.2.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(COMBP (TRANSLATE B X))).
But this again simplifies, rewriting with BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and opening up EQUAL, COMBP, LAMBDAP, and
SUBST, to the new conjecture:
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A)))
(LAMBDAP (TRANSLATE (NLEFT A) X))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables. We
thus obtain:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(NOT (NBETA-STEP V
(NRIGHT (NSUBST W V D))))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V))
(LAMBDAP (TRANSLATE (NLAMBDA D W) X))),
which further simplifies, rewriting with NBIND-NLAMBDA, NBODY-NLAMBDA, and
BODY-LAMBDA, and unfolding TRANSLATE, BETA-STEP, and NTERMP, to:
T.
Case 5.1.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(COMBP (TRANSLATE B X))).
This again simplifies, rewriting with TRANSLATE-PRESERVES-REDUCTION, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (NTERMP (NLEFT A)))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, unfolding the function NTERMP, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, applying RIGHT-COMB and LEFT-COMB, and expanding the
functions NTERMP, NBETA-STEP, TRANSLATE, and BETA-STEP, to six new formulas:
Case 3.6.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(RIGHT (TRANSLATE B X)))),
which again simplifies, applying the lemmas BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and opening up EQUAL, COMBP, LAMBDAP, SUBST,
RIGHT, and BETA-STEP, to four new conjectures:
Case 3.6.4.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NRIGHT A) X)))
(RIGHT (TRANSLATE (NRIGHT A) X))
1))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We rely upon the type restriction
lemma noted when NBIND was introduced to restrict the new variables. We
thus obtain the new goal:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE V X)))
(RIGHT (TRANSLATE V X))
1))),
which further simplifies, rewriting with NBODY-NLAMBDA and NBIND-NLAMBDA,
and opening up the definitions of NBETA-STEP, NTERMP, and TRANSLATE, to:
T.
Case 3.6.3.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(LAMBDAP (LEFT (TRANSLATE (NRIGHT A) X)))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We rely upon the
type restriction lemma noted when NBIND was introduced to constrain the
new variables. We must thus prove:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(LAMBDAP (LEFT (TRANSLATE V X)))).
However this further simplifies, rewriting with NBODY-NLAMBDA and
NBIND-NLAMBDA, and expanding the functions NBETA-STEP, NTERMP, and
TRANSLATE, to:
T.
Case 3.6.2.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(COMBP (TRANSLATE (NRIGHT A) X))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We use the type
restriction lemma noted when NBIND was introduced to constrain the new
variables. The result is the formula:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(COMBP (TRANSLATE V X))).
However this further simplifies, rewriting with NBODY-NLAMBDA and
NBIND-NLAMBDA, and unfolding NBETA-STEP, NTERMP, and TRANSLATE, to:
T.
Case 3.6.1.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(NOT (LAMBDAP (TRANSLATE (NRIGHT A) X)))).
This again simplifies, clearly, to the new conjecture:
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(NOT (LAMBDAP (TRANSLATE (NRIGHT A) X)))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables. We
thus obtain:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X))))
(NOT (LAMBDAP (TRANSLATE V X)))),
which further simplifies, rewriting with NBODY-NLAMBDA and NBIND-NLAMBDA,
and opening up the definitions of NBETA-STEP, NTERMP, and TRANSLATE, to:
T.
Case 3.5.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(RIGHT (TRANSLATE B X)))).
But this again simplifies, rewriting with TRANSLATE-PRESERVES-REDUCTION,
to:
T.
Case 3.4.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(BETA-STEP (TRANSLATE (NLEFT A) X)
(LEFT (TRANSLATE B X)))).
This again simplifies, applying BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and unfolding the functions EQUAL, COMBP,
LAMBDAP, SUBST, LEFT, and BETA-STEP, to the following three new goals:
Case 3.4.3.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NLEFT A) X)))
(RIGHT (TRANSLATE (NLEFT A) X))
1))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We rely upon the
type restriction lemma noted when NBIND was introduced to constrain the
new variables. This generates the conjecture:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NLAMBDA D W) X)))
(RIGHT (TRANSLATE (NLAMBDA D W) X))
1))).
However this further simplifies, rewriting with NBODY-NLAMBDA and
NBIND-NLAMBDA, and opening up the functions NBETA-STEP, NTERMP, and
TRANSLATE, to:
T.
Case 3.4.2.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(LAMBDAP (LEFT (TRANSLATE (NLEFT A) X)))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We rely upon the
type restriction lemma noted when NBIND was introduced to constrain the
new variables. This generates:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(LAMBDAP (LEFT (TRANSLATE (NLAMBDA D W) X)))).
But this further simplifies, appealing to the lemmas NBODY-NLAMBDA and
NBIND-NLAMBDA, and expanding the definitions of NBETA-STEP, NTERMP, and
TRANSLATE, to:
T.
Case 3.4.1.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(COMBP (TRANSLATE (NLEFT A) X))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We use the type restriction lemma
noted when NBIND was introduced to restrict the new variables. This
produces the new formula:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(COMBP (TRANSLATE (NLAMBDA D W) X))),
which further simplifies, applying NBODY-NLAMBDA and NBIND-NLAMBDA, and
unfolding the functions NBETA-STEP, NTERMP, and TRANSLATE, to:
T.
Case 3.3.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(BETA-STEP (TRANSLATE (NLEFT A) X)
(LEFT (TRANSLATE B X)))).
This again simplifies, rewriting with TRANSLATE-PRESERVES-REDUCTION, to:
T.
Case 3.2.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(COMBP (TRANSLATE B X))).
However this again simplifies, rewriting with the lemmas BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and expanding EQUAL, COMBP, LAMBDAP, and
SUBST, to:
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A)))
(LAMBDAP (TRANSLATE (NLEFT A) X))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We use the type
restriction lemma noted when NBIND was introduced to constrain the new
variables. We must thus prove:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(NOT (NBETA-STEP (NLAMBDA D W)
(NLEFT (NSUBST W V D))))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V))
(LAMBDAP (TRANSLATE (NLAMBDA D W) X))).
But this further simplifies, applying NBODY-NLAMBDA and NBIND-NLAMBDA, and
opening up the definitions of NBETA-STEP, NTERMP, and TRANSLATE, to:
T.
Case 3.1.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(COMBP (TRANSLATE B X))).
However this again simplifies, rewriting with the lemma
TRANSLATE-PRESERVES-REDUCTION, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))),
which simplifies, appealing to the lemmas RIGHT-COMB, COMB-EQUAL, and
LEFT-COMB, and opening up the definitions of NTERMP, NBETA-STEP, TRANSLATE,
and BETA-STEP, to six new goals:
Case 2.6.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(RIGHT (TRANSLATE B X)))),
which again simplifies, appealing to the lemmas BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and expanding the definitions of EQUAL,
COMBP, LAMBDAP, SUBST, RIGHT, and BETA-STEP, to four new formulas:
Case 2.6.4.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NRIGHT A) X)))
(RIGHT (TRANSLATE (NRIGHT A) X))
1))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables.
This produces:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE V X)))
(RIGHT (TRANSLATE V X))
1))),
which further simplifies, rewriting with NBIND-NLAMBDA, NBODY-NLAMBDA,
and BODY-LAMBDA, and unfolding the functions TRANSLATE, BETA-STEP, and
NTERMP, to:
T.
Case 2.6.3.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(LAMBDAP (LEFT (TRANSLATE (NRIGHT A) X)))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We use the type
restriction lemma noted when NBIND was introduced to constrain the new
variables. This generates:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(LAMBDAP (LEFT (TRANSLATE V X)))).
However this further simplifies, rewriting with NBIND-NLAMBDA,
NBODY-NLAMBDA, and BODY-LAMBDA, and unfolding TRANSLATE, BETA-STEP, and
NTERMP, to:
T.
Case 2.6.2.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(COMBP (TRANSLATE (NRIGHT A) X))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We rely upon the
type restriction lemma noted when NBIND was introduced to constrain the
new variables. This generates:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE V X) 0)))
(COMBP (TRANSLATE V X))).
But this further simplifies, rewriting with the lemmas NBIND-NLAMBDA,
NBODY-NLAMBDA, and BODY-LAMBDA, and opening up the definitions of
TRANSLATE, BETA-STEP, and NTERMP, to:
T.
Case 2.6.1.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NRIGHT A) X) 0)))
(NOT (LAMBDAP (TRANSLATE (NRIGHT A) X)))),
which again simplifies, trivially, to:
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(NOT (LAMBDAP (TRANSLATE (NRIGHT A) X)))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables.
This produces:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X))))
(NOT (LAMBDAP (TRANSLATE V X)))),
which further simplifies, applying the lemmas NBIND-NLAMBDA,
NBODY-NLAMBDA, and BODY-LAMBDA, and unfolding the functions TRANSLATE,
BETA-STEP, and NTERMP, to:
T.
Case 2.5.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(RIGHT (TRANSLATE B X)))),
which again simplifies, rewriting with TRANSLATE-PRESERVES-REDUCTION, to:
T.
Case 2.4.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(BETA-STEP (TRANSLATE (NLEFT A) X)
(LEFT (TRANSLATE B X)))).
But this again simplifies, applying BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and expanding the definitions of EQUAL,
COMBP, LAMBDAP, SUBST, LEFT, and BETA-STEP, to the following three new
conjectures:
Case 2.4.3.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NLEFT A) X)))
(RIGHT (TRANSLATE (NLEFT A) X))
1))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We rely upon the
type restriction lemma noted when NBIND was introduced to constrain the
new variables. This generates the formula:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(EQUAL 0
(SUBST (BODY (LEFT (TRANSLATE (NLAMBDA D W) X)))
(RIGHT (TRANSLATE (NLAMBDA D W) X))
1))).
This further simplifies, rewriting with the lemmas NBIND-NLAMBDA,
NBODY-NLAMBDA, and BODY-LAMBDA, and opening up TRANSLATE, BETA-STEP, and
NTERMP, to:
T.
Case 2.4.2.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(LAMBDAP (LEFT (TRANSLATE (NLEFT A) X)))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables. We
would thus like to prove the new formula:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(LAMBDAP (LEFT (TRANSLATE (NLAMBDA D W) X)))),
which further simplifies, rewriting with NBIND-NLAMBDA, NBODY-NLAMBDA,
and BODY-LAMBDA, and expanding the definitions of TRANSLATE, BETA-STEP,
and NTERMP, to:
T.
Case 2.4.1.
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(COMBP (TRANSLATE (NLEFT A) X))).
But this again simplifies, unfolding the definition of BETA-STEP, to:
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(EQUAL (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X)))
(NOT (EQUAL (TRANSLATE (NLEFT A) X) 0)))
(COMBP (TRANSLATE (NLEFT A) X))).
Appealing to the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, we now
replace A by (NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by
(NLAMBDA D W) to eliminate (NBODY Z) and (NBIND Z). We rely upon the
type restriction lemma noted when NBIND was introduced to constrain the
new variables. The result is the formula:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(EQUAL (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V)
(NOT (LAMBDAP (TRANSLATE (NLAMBDA D W) X)))
(NOT (EQUAL (TRANSLATE (NLAMBDA D W) X)
0)))
(COMBP (TRANSLATE (NLAMBDA D W) X))).
However this further simplifies, applying NBIND-NLAMBDA and
NBODY-NLAMBDA, and opening up the functions TRANSLATE and NTERMP, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(BETA-STEP (TRANSLATE (NLEFT A) X)
(LEFT (TRANSLATE B X)))).
But this again simplifies, applying TRANSLATE-PRESERVES-REDUCTION, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (LAMBDAP (TRANSLATE (NLEFT A) X))))
(COMBP (TRANSLATE B X))).
However this again simplifies, rewriting with BODY-NLAMBDAP and
TRANSLATE-PRESERVES-REDUCTION, and expanding EQUAL, COMBP, LAMBDAP, and
SUBST, to:
(IMPLIES
(AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A)))
(LAMBDAP (TRANSLATE (NLEFT A) X))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB Z V) to eliminate (NLEFT A) and (NRIGHT A) and Z by (NLAMBDA D W)
to eliminate (NBODY Z) and (NBIND Z). We use the type restriction lemma
noted when NBIND was introduced to restrict the new variables. This
produces the new goal:
(IMPLIES (AND (NUMBERP D)
(NOT (EQUAL (NCOMB (NLAMBDA D W) V)
(NSUBST W V D)))
(BETA-STEP (TRANSLATE (NLAMBDA D W) X)
(TRANSLATE (NLEFT (NSUBST W V D)) X))
(BETA-STEP (TRANSLATE V X)
(TRANSLATE (NRIGHT (NSUBST W V D)) X))
(NTERMP (NLAMBDA D W))
(NTERMP V)
(FREE-FOR W V))
(LAMBDAP (TRANSLATE (NLAMBDA D W) X))),
which further simplifies, applying NBIND-NLAMBDA, NBODY-NLAMBDA, and
BODY-LAMBDA, and expanding TRANSLATE, BETA-STEP, and NTERMP, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(BETA-STEP (TRANSLATE (NLEFT A) X)
(TRANSLATE (NLEFT B) X))
(BETA-STEP (TRANSLATE (NRIGHT A) X)
(TRANSLATE (NRIGHT B) X))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) X)
(TRANSLATE (NRIGHT A) X))
(TRANSLATE B X)))
(NOT (EQUAL (TRANSLATE B X)
(SUBST (BODY (TRANSLATE (NLEFT A) X))
(TRANSLATE (NRIGHT A) X)
1))))
(COMBP (TRANSLATE B X))).
But this again simplifies, applying TRANSLATE-PRESERVES-REDUCTION, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NTERMP A)
(NBETA-STEP A B))
(BETA-STEP (TRANSLATE A X)
(TRANSLATE B X))).
This simplifies, expanding NTERMP and NBETA-STEP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 1.4 0.3 ]
NBETA-STEP-TRANSLATES
(DEFN TRANS-LIST
(X)
(IF (LISTP X)
(CONS (TRANSLATE (CAR X) NIL)
(TRANS-LIST (CDR X)))
NIL))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT X) decreases according to the well-founded relation LESSP in each
recursive call. Hence, TRANS-LIST is accepted under the principle of
definition. Note that (OR (LITATOM (TRANS-LIST X)) (LISTP (TRANS-LIST X))) is
a theorem.
[ 0.0 0.0 0.0 ]
TRANS-LIST
(PROVE-LEMMA NTERMP-SUBST
(REWRITE)
(IMPLIES (AND (NTERMP X) (NTERMP Y))
(NTERMP (NSUBST X Y N))))
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 (AND (NLAMBDAP X) (EQUAL (NBIND X) N))
(p X Y N))
(IMPLIES (AND (NLAMBDAP X)
(NOT (EQUAL (NBIND X) N))
(p (NBODY X) Y N))
(p X Y N))
(IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(p (NRIGHT X) Y N)
(p (NLEFT X) Y N))
(p X Y N))
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NUMBERP X)
(EQUAL X N))
(p X Y N))
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NUMBERP X)
(NOT (EQUAL X N)))
(p X Y N))
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (NUMBERP X)))
(p X Y N))).
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and NLEFT-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 ten new goals:
Case 10.(IMPLIES (AND (NLAMBDAP X)
(EQUAL (NBIND X) N)
(NTERMP X)
(NTERMP Y))
(NTERMP (NSUBST X Y N))).
This simplifies, expanding the definitions of NTERMP and NSUBST, to:
T.
Case 9. (IMPLIES (AND (NLAMBDAP X)
(NOT (EQUAL (NBIND X) N))
(NOT (NTERMP (NBODY X)))
(NTERMP X)
(NTERMP Y))
(NTERMP (NSUBST X Y N))).
This simplifies, unfolding NTERMP, to:
T.
Case 8. (IMPLIES (AND (NLAMBDAP X)
(NOT (EQUAL (NBIND X) N))
(NTERMP (NSUBST (NBODY X) Y N))
(NTERMP X)
(NTERMP Y))
(NTERMP (NSUBST X Y N))).
This simplifies, rewriting with NBODY-NLAMBDA, and expanding the definitions
of NTERMP and NSUBST, to:
T.
Case 7. (IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(NOT (NTERMP (NRIGHT X)))
(NOT (NTERMP (NLEFT X)))
(NTERMP X)
(NTERMP Y))
(NTERMP (NSUBST X Y N))),
which simplifies, expanding the function NTERMP, to:
T.
Case 6. (IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(NTERMP (NSUBST (NRIGHT X) Y N))
(NOT (NTERMP (NLEFT X)))
(NTERMP X)
(NTERMP Y))
(NTERMP (NSUBST X Y N))),
which simplifies, expanding NTERMP, to:
T.
Case 5. (IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(NOT (NTERMP (NRIGHT X)))
(NTERMP (NSUBST (NLEFT X) Y N))
(NTERMP X)
(NTERMP Y))
(NTERMP (NSUBST X Y N))),
which simplifies, opening up the function NTERMP, to:
T.
Case 4. (IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(NTERMP (NSUBST (NRIGHT X) Y N))
(NTERMP (NSUBST (NLEFT X) Y N))
(NTERMP X)
(NTERMP Y))
(NTERMP (NSUBST X Y N))),
which simplifies, applying NRIGHT-NCOMB and NLEFT-NCOMB, and unfolding
NTERMP and NSUBST, to:
T.
Case 3. (IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NUMBERP X)
(EQUAL X N)
(NTERMP X)
(NTERMP Y))
(NTERMP (NSUBST X Y N))).
This simplifies, unfolding the definitions of NTERMP and NSUBST, to:
T.
Case 2. (IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NUMBERP X)
(NOT (EQUAL X N))
(NTERMP X)
(NTERMP Y))
(NTERMP (NSUBST X Y N))).
This simplifies, expanding the functions NTERMP and NSUBST, to:
T.
Case 1. (IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (NUMBERP X))
(NTERMP X)
(NTERMP Y))
(NTERMP (NSUBST X Y N))).
This simplifies, opening up NTERMP and NSUBST, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NTERMP-SUBST
(PROVE-LEMMA NTERMP-BSTEP
(REWRITE)
(IMPLIES (AND (NBETA-STEP A B) (NTERMP A))
(NTERMP B))
((INDUCT (NBETA-STEP A B))))
WARNING: Note that NTERMP-BSTEP contains the free variable A which will be
chosen by instantiating the hypothesis (NBETA-STEP A B).
This conjecture can be simplified, using the abbreviations IMPLIES, NOT, OR,
and AND, to four new formulas:
Case 4. (IMPLIES (AND (EQUAL A B)
(NBETA-STEP A B)
(NTERMP A))
(NTERMP B)),
which simplifies, obviously, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL A B))
(NLAMBDAP A)
(IMPLIES (AND (NBETA-STEP (NBODY A) (NBODY B))
(NTERMP (NBODY A)))
(NTERMP (NBODY B)))
(NBETA-STEP A B)
(NTERMP A))
(NTERMP B)).
This simplifies, expanding the functions AND, IMPLIES, NBETA-STEP, and
NTERMP, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NCOMBP A)
(IMPLIES (AND (NBETA-STEP (NRIGHT A) (NRIGHT B))
(NTERMP (NRIGHT A)))
(NTERMP (NRIGHT B)))
(IMPLIES (AND (NBETA-STEP (NLEFT A) (NLEFT B))
(NTERMP (NLEFT A)))
(NTERMP (NLEFT B)))
(NBETA-STEP A B)
(NTERMP A))
(NTERMP B)).
This simplifies, unfolding AND, IMPLIES, NBETA-STEP, and NTERMP, to the
following four new conjectures:
Case 2.4.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A)))
(NTERMP B)).
This again simplifies, obviously, to the new formula:
(IMPLIES (AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A)))
(NTERMP (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB X Z) to eliminate (NLEFT A) and (NRIGHT A) and X by (NLAMBDA W V)
to eliminate (NBODY X) and (NBIND X). We use the type restriction lemma
noted when NBIND was introduced to restrict the new variables. This
produces the new formula:
(IMPLIES (AND (NUMBERP W)
(NOT (EQUAL (NCOMB (NLAMBDA W V) Z)
(NSUBST V Z W)))
(NOT (NBETA-STEP Z
(NRIGHT (NSUBST V Z W))))
(NOT (NBETA-STEP (NLAMBDA W V)
(NLEFT (NSUBST V Z W))))
(FREE-FOR V Z)
(NTERMP (NLAMBDA W V))
(NTERMP Z))
(NTERMP (NSUBST V Z W))),
which further simplifies, applying NBODY-NLAMBDA, NBIND-NLAMBDA, and
NTERMP-SUBST, and expanding the definitions of NBETA-STEP and NTERMP, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NOT (NBETA-STEP (NRIGHT A) (NRIGHT B)))
(NTERMP (NLEFT B))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A)))
(NTERMP B)).
This again simplifies, obviously, to:
(IMPLIES (AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NOT (NBETA-STEP (NRIGHT A)
(NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NTERMP (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A)))
(NTERMP (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB X Z) to eliminate (NLEFT A) and (NRIGHT A) and X by (NLAMBDA W V)
to eliminate (NBODY X) and (NBIND X). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables. We
thus obtain:
(IMPLIES (AND (NUMBERP W)
(NOT (EQUAL (NCOMB (NLAMBDA W V) Z)
(NSUBST V Z W)))
(NOT (NBETA-STEP Z
(NRIGHT (NSUBST V Z W))))
(NTERMP (NLEFT (NSUBST V Z W)))
(FREE-FOR V Z)
(NTERMP (NLAMBDA W V))
(NTERMP Z))
(NTERMP (NSUBST V Z W))),
which further simplifies, applying the lemmas NBODY-NLAMBDA and
NTERMP-SUBST, and expanding the function NTERMP, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NTERMP (NRIGHT B))
(NOT (NBETA-STEP (NLEFT A) (NLEFT B)))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A)))
(NTERMP B)),
which again simplifies, trivially, to:
(IMPLIES (AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NTERMP (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NOT (NBETA-STEP (NLEFT A)
(NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A)))
(NTERMP (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB X Z) to eliminate (NLEFT A) and (NRIGHT A) and X by (NLAMBDA W V)
to eliminate (NBODY X) and (NBIND X). We employ the type restriction
lemma noted when NBIND was introduced to restrict the new variables. We
would thus like to prove:
(IMPLIES (AND (NUMBERP W)
(NOT (EQUAL (NCOMB (NLAMBDA W V) Z)
(NSUBST V Z W)))
(NTERMP (NRIGHT (NSUBST V Z W)))
(NOT (NBETA-STEP (NLAMBDA W V)
(NLEFT (NSUBST V Z W))))
(FREE-FOR V Z)
(NTERMP (NLAMBDA W V))
(NTERMP Z))
(NTERMP (NSUBST V Z W))),
which further simplifies, rewriting with NBODY-NLAMBDA, NBIND-NLAMBDA, and
NTERMP-SUBST, and unfolding NBETA-STEP and NTERMP, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL A B))
(NCOMBP A)
(NTERMP (NRIGHT B))
(NTERMP (NLEFT B))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(EQUAL B
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A)))
(NTERMP B)).
This again simplifies, clearly, to:
(IMPLIES (AND (NOT (EQUAL A
(NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NCOMBP A)
(NTERMP (NRIGHT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NTERMP (NLEFT (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A)))))
(NLAMBDAP (NLEFT A))
(FREE-FOR (NBODY (NLEFT A))
(NRIGHT A))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A)))
(NTERMP (NSUBST (NBODY (NLEFT A))
(NRIGHT A)
(NBIND (NLEFT A))))).
Applying the lemmas NLEFT-NRIGHT-ELIM and NBIND-NBODY-ELIM, replace A by
(NCOMB X Z) to eliminate (NLEFT A) and (NRIGHT A) and X by (NLAMBDA W V)
to eliminate (NBODY X) and (NBIND X). We rely upon the type restriction
lemma noted when NBIND was introduced to restrict the new variables. This
produces:
(IMPLIES (AND (NUMBERP W)
(NOT (EQUAL (NCOMB (NLAMBDA W V) Z)
(NSUBST V Z W)))
(NTERMP (NRIGHT (NSUBST V Z W)))
(NTERMP (NLEFT (NSUBST V Z W)))
(FREE-FOR V Z)
(NTERMP (NLAMBDA W V))
(NTERMP Z))
(NTERMP (NSUBST V Z W))),
which further simplifies, applying NBODY-NLAMBDA and NTERMP-SUBST, and
opening up the definition of NTERMP, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NBETA-STEP A B)
(NTERMP A))
(NTERMP B)).
This simplifies, unfolding the function NBETA-STEP, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
NTERMP-BSTEP
(PROVE-LEMMA NTERMP-ASTEP
(REWRITE)
(IMPLIES (AND (ALPHA-EQUAL A B X Y) (NTERMP A))
(NTERMP B)))
WARNING: Note that NTERMP-ASTEP contains the free variables Y, X, and A which
will be chosen by instantiating the hypothesis (ALPHA-EQUAL A B X Y).
Call the conjecture *1.
Perhaps we can prove it by induction. Four inductions are suggested by
terms in the conjecture. However, they merge into one likely candidate
induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (AND (NLAMBDAP A) (NLAMBDAP B))
(p (NBODY B)
(NBODY A)
(CONS (NBIND A) X)
(CONS (NBIND B) Y)))
(p B A X Y))
(IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(p (NRIGHT B) (NRIGHT A) X Y)
(p (NLEFT B) (NLEFT A) X Y))
(p B A X Y))
(IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(AND (NUMBERP A) (NUMBERP B)))
(p B A X Y))
(IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(NOT (AND (NUMBERP A) (NUMBERP B))))
(p B A X Y))).
Linear arithmetic, the lemmas NBODY-LESSEQP, NBODY-LESSP, NRIGHT-LESSEQP,
NRIGHT-LESSP, NLEFT-LESSEQP, and NLEFT-LESSP, and the definition of AND 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. Note,
however, the inductive instances chosen for B, X, and Y. The above induction
scheme leads to 14 new goals:
Case 14.(IMPLIES (AND (AND (NLAMBDAP A) (NLAMBDAP B))
(NOT (ALPHA-EQUAL (NBODY A)
(NBODY B)
(CONS (NBIND A) X)
(CONS (NBIND B) Y)))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, opening up the definitions of AND and ALPHA-EQUAL, to:
T.
Case 13.(IMPLIES (AND (AND (NLAMBDAP A) (NLAMBDAP B))
(NOT (NTERMP (NBODY A)))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, expanding AND, ALPHA-EQUAL, and NTERMP, to:
T.
Case 12.(IMPLIES (AND (AND (NLAMBDAP A) (NLAMBDAP B))
(NTERMP (NBODY B))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, opening up the definitions of AND, ALPHA-EQUAL, and NTERMP,
to:
T.
Case 11.(IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(NOT (ALPHA-EQUAL (NRIGHT A)
(NRIGHT B)
X Y))
(NOT (ALPHA-EQUAL (NLEFT A) (NLEFT B) X Y))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, unfolding the functions AND and ALPHA-EQUAL, to:
T.
Case 10.(IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(NOT (NTERMP (NRIGHT A)))
(NOT (ALPHA-EQUAL (NLEFT A) (NLEFT B) X Y))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, opening up AND and ALPHA-EQUAL, to:
T.
Case 9. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(NTERMP (NRIGHT B))
(NOT (ALPHA-EQUAL (NLEFT A) (NLEFT B) X Y))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, opening up the definitions of AND and ALPHA-EQUAL, to:
T.
Case 8. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(NOT (ALPHA-EQUAL (NRIGHT A)
(NRIGHT B)
X Y))
(NOT (NTERMP (NLEFT A)))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, expanding the definitions of AND and ALPHA-EQUAL, to:
T.
Case 7. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(NOT (NTERMP (NRIGHT A)))
(NOT (NTERMP (NLEFT A)))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, expanding the definitions of AND, ALPHA-EQUAL, and NTERMP,
to:
T.
Case 6. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(NTERMP (NRIGHT B))
(NOT (NTERMP (NLEFT A)))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, expanding the definitions of AND, ALPHA-EQUAL, and NTERMP,
to:
T.
Case 5. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(NOT (ALPHA-EQUAL (NRIGHT A)
(NRIGHT B)
X Y))
(NTERMP (NLEFT B))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, unfolding the definitions of AND and ALPHA-EQUAL, to:
T.
Case 4. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(NOT (NTERMP (NRIGHT A)))
(NTERMP (NLEFT B))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, unfolding AND, ALPHA-EQUAL, and NTERMP, to:
T.
Case 3. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(NTERMP (NRIGHT B))
(NTERMP (NLEFT B))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, opening up the functions AND, ALPHA-EQUAL, and NTERMP, to:
T.
Case 2. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(AND (NUMBERP A) (NUMBERP B))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, unfolding the functions AND, ALPHA-EQUAL, and NTERMP, to:
T.
Case 1. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(NOT (AND (NUMBERP A) (NUMBERP B)))
(ALPHA-EQUAL A B X Y)
(NTERMP A))
(NTERMP B)),
which simplifies, unfolding the definitions of AND, ALPHA-EQUAL, and NTERMP,
to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NTERMP-ASTEP
(PROVE-LEMMA NTERMP-LIST
(REWRITE)
(IMPLIES (AND (NREDUCTION A B LIST) (NTERMP A))
(NTERMP B)))
WARNING: Note that NTERMP-LIST contains the free variables LIST and A which
will be chosen by instantiating the hypothesis (NREDUCTION A B LIST).
Give the conjecture the name *1.
We will try to prove it by induction. There are three plausible
inductions. However, only one is unflawed. We will induct according to the
following scheme:
(AND (IMPLIES (AND (LISTP LIST)
(p (CAR LIST) A (CDR LIST)))
(p B A LIST))
(IMPLIES (NOT (LISTP LIST))
(p B A LIST))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for B. The above induction scheme generates three new goals:
Case 3. (IMPLIES (AND (LISTP LIST)
(NOT (NREDUCTION A (CAR LIST) (CDR LIST)))
(NREDUCTION A B LIST)
(NTERMP A))
(NTERMP B)),
which simplifies, expanding NREDUCTION and NSTEP, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST)
(NTERMP (CAR LIST))
(NREDUCTION A B LIST)
(NTERMP A))
(NTERMP B)),
which simplifies, appealing to the lemmas NTERMP-BSTEP and NTERMP-ASTEP, and
unfolding the definitions of NREDUCTION and NSTEP, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST))
(NREDUCTION A B LIST)
(NTERMP A))
(NTERMP B)),
which simplifies, rewriting with NTERMP-ASTEP and NTERMP-BSTEP, and
expanding the functions NREDUCTION and NSTEP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NTERMP-LIST
(PROVE-LEMMA REDUCTION-TRANSLATES
(REWRITE)
(IMPLIES (AND (NTERMP A) (NREDUCTION A B LIST))
(REDUCTION (TRANSLATE A NIL)
(TRANSLATE B NIL)
(TRANS-LIST LIST))))
Give the conjecture the name *1.
Let us appeal to the induction principle. 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 (AND (LISTP LIST)
(p A (CAR LIST) (CDR LIST)))
(p A B LIST))
(IMPLIES (NOT (LISTP LIST))
(p A B LIST))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for B. The above induction scheme produces three new goals:
Case 3. (IMPLIES (AND (LISTP LIST)
(NOT (NREDUCTION A (CAR LIST) (CDR LIST)))
(NTERMP A)
(NREDUCTION A B LIST))
(REDUCTION (TRANSLATE A NIL)
(TRANSLATE B NIL)
(TRANS-LIST LIST))),
which simplifies, opening up NREDUCTION and NSTEP, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST)
(REDUCTION (TRANSLATE A NIL)
(TRANSLATE (CAR LIST) NIL)
(TRANS-LIST (CDR LIST)))
(NTERMP A)
(NREDUCTION A B LIST))
(REDUCTION (TRANSLATE A NIL)
(TRANSLATE B NIL)
(TRANS-LIST LIST))),
which simplifies, rewriting with CDR-CONS, NBETA-STEP-TRANSLATES,
NTERMP-LIST, CAR-CONS, ALPHA-TRANSLATE, and NTERMP-ASTEP, and expanding the
functions NREDUCTION, NSTEP, TRANS-LIST, REDUCTION, and NBETA-STEP, to the
new conjecture:
(IMPLIES (AND (LISTP LIST)
(REDUCTION (TRANSLATE A NIL)
(TRANSLATE (CAR LIST) NIL)
(TRANS-LIST (CDR LIST)))
(NTERMP A)
(ALPHA-EQUAL (CAR LIST) B NIL NIL)
(NREDUCTION A (CAR LIST) (CDR LIST)))
(REDUCTION (TRANSLATE A NIL)
(TRANSLATE B NIL)
(TRANS-LIST (CDR LIST)))),
which again simplifies, rewriting with ALPHA-TRANSLATE, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST))
(NTERMP A)
(NREDUCTION A B LIST))
(REDUCTION (TRANSLATE A NIL)
(TRANSLATE B NIL)
(TRANS-LIST LIST))).
This simplifies, appealing to the lemmas ALPHA-TRANSLATE,
NBETA-STEP-TRANSLATES, and NTERMP-ASTEP, and expanding NREDUCTION, NSTEP,
TRANS-LIST, NBETA-STEP, LISTP, and REDUCTION, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
REDUCTION-TRANSLATES
(DEFN FIND-M
(X N)
(IF (LAMBDAP X)
(FIND-M (BODY X) (ADD1 N))
(IF (COMBP X)
(IF (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(FIND-M (RIGHT X) N)
(FIND-M (LEFT X) N))
(DIFFERENCE X N))))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
inform us that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, FIND-M is accepted under the
principle of definition. From the definition we can conclude that
(NUMBERP (FIND-M X N)) is a theorem.
[ 0.0 0.0 0.0 ]
FIND-M
(DEFN UNTRANS
(X M N)
(IF (LAMBDAP X)
(NLAMBDA (PLUS M (ADD1 N))
(UNTRANS (BODY X) M (ADD1 N)))
(IF (COMBP X)
(NCOMB (UNTRANS (LEFT X) M N)
(UNTRANS (RIGHT X) M N))
(IF (LESSP N X)
(DIFFERENCE X (ADD1 N))
(IF (NOT (ZEROP X))
(ADD1 (PLUS M (DIFFERENCE N X)))
X)))))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
can be used to establish that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each recursive call. Hence, UNTRANS is
accepted under the principle of definition. Observe that:
(OR (OR (NUMBERP (UNTRANS X M N))
(NLAMBDAP (UNTRANS X M N))
(NCOMBP (UNTRANS X M N)))
(EQUAL (UNTRANS X M N) X))
is a theorem.
[ 0.0 0.0 0.0 ]
UNTRANS
(DEFN TERMP
(X)
(IF (LAMBDAP X)
(TERMP (BODY X))
(IF (COMBP X)
(AND (TERMP (LEFT X))
(TERMP (RIGHT X)))
(OR (NOT (ZEROP X)) (LITATOM X)))))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
inform us that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, TERMP is accepted under the
principle of definition. Observe that:
(OR (FALSEP (TERMP X))
(TRUEP (TERMP X)))
is a theorem.
[ 0.0 0.0 0.0 ]
TERMP
(PROVE-LEMMA NOT-FREE-IN-UNTRANS
(REWRITE)
(IMPLIES (AND (TERMP X)
(LEQ (FIND-M X N) M)
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))))
Name the conjecture *1.
We will try to prove it by induction. There are six plausible inductions.
They merge into three likely candidate 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 (AND (LAMBDAP X)
(p Y (BODY X) M (ADD1 N)))
(p Y X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(p Y (RIGHT X) M N)
(p Y (LEFT X) M N))
(p Y X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(p Y (LEFT X) M N)
(p Y (RIGHT X) M N))
(p Y X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X)))
(p Y X M N))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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 N. The above induction scheme leads to 23 new
formulas:
Case 23.(IMPLIES (AND (LAMBDAP X)
(NOT (TERMP (BODY X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))),
which simplifies, unfolding the function TERMP, to:
T.
Case 22.(IMPLIES (AND (LAMBDAP X)
(LESSP M (FIND-M (BODY X) (ADD1 N)))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))),
which simplifies, expanding TERMP and FIND-M, to:
T.
Case 21.(IMPLIES (AND (LAMBDAP X)
(NOT (LESSP (PLUS M (ADD1 N)) Y))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))),
which simplifies, using linear arithmetic, to two new formulas:
Case 21.2.
(IMPLIES (AND (NOT (NUMBERP Y))
(LAMBDAP X)
(NOT (LESSP (PLUS M (ADD1 N)) Y))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))),
which again simplifies, opening up LESSP, TERMP, and FIND-M, to:
T.
Case 21.1.
(IMPLIES (AND (NUMBERP Y)
(LAMBDAP X)
(NOT (LESSP (PLUS M (ADD1 N))
(PLUS 1 N M)))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) (PLUS 1 N M)))
(NOT-FREE-IN (PLUS 1 N M)
(UNTRANS X M N))),
which again simplifies, rewriting with NBODY-NLAMBDA and NBIND-NLAMBDA,
and opening up TERMP, FIND-M, UNTRANS, and NOT-FREE-IN, to:
(IMPLIES (AND (NUMBERP Y)
(LAMBDAP X)
(NOT (LESSP (PLUS M (ADD1 N))
(PLUS 1 N M)))
(TERMP (BODY X))
(NOT (LESSP M (FIND-M (BODY X) (ADD1 N))))
(LESSP (PLUS M N) (PLUS 1 N M))
(NOT (EQUAL (PLUS 1 N M)
(PLUS M (ADD1 N)))))
(NOT-FREE-IN (PLUS 1 N M)
(UNTRANS (BODY X) M (ADD1 N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 20.(IMPLIES (AND (LAMBDAP X)
(NOT-FREE-IN Y
(UNTRANS (BODY X) M (ADD1 N)))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))),
which simplifies, applying NBODY-NLAMBDA and NBIND-NLAMBDA, and opening up
TERMP, FIND-M, UNTRANS, and NOT-FREE-IN, to:
T.
Case 19.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT (TERMP (RIGHT X)))
(NOT (TERMP (LEFT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, expanding TERMP, to:
T.
Case 18.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (RIGHT X) N))
(NOT (TERMP (LEFT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, expanding the definition of TERMP, to:
T.
Case 17.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT-FREE-IN Y
(UNTRANS (RIGHT X) M N))
(NOT (TERMP (LEFT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, unfolding TERMP, to:
T.
Case 16.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT (TERMP (RIGHT X)))
(LESSP M (FIND-M (LEFT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, opening up the definition of TERMP, to:
T.
Case 15.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (RIGHT X) N))
(LESSP M (FIND-M (LEFT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, unfolding the definitions of TERMP and FIND-M, to:
T.
Case 14.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT-FREE-IN Y
(UNTRANS (RIGHT X) M N))
(LESSP M (FIND-M (LEFT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, rewriting with NRIGHT-NCOMB and NLEFT-NCOMB, and opening up
the definitions of TERMP, FIND-M, UNTRANS, and NOT-FREE-IN, to the formula:
(IMPLIES (AND (COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT-FREE-IN Y
(UNTRANS (RIGHT X) M N))
(LESSP M (FIND-M (LEFT X) N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (RIGHT X) N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y
(UNTRANS (LEFT X) M N))).
This again simplifies, using linear arithmetic, to:
T.
Case 13.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT (TERMP (RIGHT X)))
(NOT-FREE-IN Y (UNTRANS (LEFT X) M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))),
which simplifies, expanding the function TERMP, to:
T.
Case 12.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (RIGHT X) N))
(NOT-FREE-IN Y (UNTRANS (LEFT X) M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))),
which simplifies, expanding the definitions of TERMP and FIND-M, to:
T.
Case 11.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT-FREE-IN Y
(UNTRANS (RIGHT X) M N))
(NOT-FREE-IN Y (UNTRANS (LEFT X) M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))),
which simplifies, applying NRIGHT-NCOMB and NLEFT-NCOMB, and unfolding TERMP,
FIND-M, UNTRANS, and NOT-FREE-IN, to:
T.
Case 10.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT (TERMP (LEFT X)))
(NOT (TERMP (RIGHT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, unfolding the definition of TERMP, to:
T.
Case 9. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (LEFT X) N))
(NOT (TERMP (RIGHT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, unfolding the definition of TERMP, to:
T.
Case 8. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT-FREE-IN Y (UNTRANS (LEFT X) M N))
(NOT (TERMP (RIGHT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, expanding the definition of TERMP, to:
T.
Case 7. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT (TERMP (LEFT X)))
(LESSP M (FIND-M (RIGHT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, unfolding the function TERMP, to:
T.
Case 6. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (LEFT X) N))
(LESSP M (FIND-M (RIGHT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, expanding TERMP and FIND-M, to:
T.
Case 5. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT-FREE-IN Y (UNTRANS (LEFT X) M N))
(LESSP M (FIND-M (RIGHT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, rewriting with NRIGHT-NCOMB and NLEFT-NCOMB, and opening up
the functions TERMP, FIND-M, UNTRANS, and NOT-FREE-IN, to the formula:
(IMPLIES (AND (COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT-FREE-IN Y (UNTRANS (LEFT X) M N))
(LESSP M (FIND-M (RIGHT X) N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (LEFT X) N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y
(UNTRANS (RIGHT X) M N))).
But this again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT (TERMP (LEFT X)))
(NOT-FREE-IN Y
(UNTRANS (RIGHT X) M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))),
which simplifies, opening up the function TERMP, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (LEFT X) N))
(NOT-FREE-IN Y
(UNTRANS (RIGHT X) M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))),
which simplifies, unfolding the functions TERMP and FIND-M, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT-FREE-IN Y (UNTRANS (LEFT X) M N))
(NOT-FREE-IN Y
(UNTRANS (RIGHT X) M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))),
which simplifies, applying NRIGHT-NCOMB and NLEFT-NCOMB, and expanding the
definitions of TERMP, FIND-M, UNTRANS, and NOT-FREE-IN, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(TERMP X)
(NOT (LESSP M (FIND-M X N)))
(LESSP (PLUS M N) Y))
(NOT-FREE-IN Y (UNTRANS X M N))).
This simplifies, applying SUB1-ADD1, and expanding the definitions of TERMP,
LITATOM, FIND-M, DIFFERENCE, EQUAL, LESSP, UNTRANS, and NOT-FREE-IN, to four
new conjectures:
Case 1.4.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(LITATOM X)
(LESSP (PLUS M N) Y))
(NOT (EQUAL Y X))),
which again simplifies, unfolding the definition of LESSP, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(LESSP (PLUS M N) Y)
(NOT (LESSP N X)))
(NOT (EQUAL Y
(ADD1 (PLUS M (DIFFERENCE N X)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(LESSP (PLUS M N) Y)
(LESSP N X)
(NUMBERP N))
(NOT (EQUAL Y (DIFFERENCE (SUB1 X) N)))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (SUB1 X) N)
(NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(LESSP (PLUS M N)
(DIFFERENCE (SUB1 X) N))
(LESSP N X))
(NOT (NUMBERP N))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(LESSP (PLUS M N) Y)
(LESSP N X)
(NOT (NUMBERP N)))
(NOT (EQUAL Y (DIFFERENCE (SUB1 X) 0)))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (SUB1 X) 0)
(NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(LESSP (PLUS M N)
(DIFFERENCE (SUB1 X) 0))
(LESSP N X))
(NUMBERP N)).
This again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.1 ]
NOT-FREE-IN-UNTRANS
(PROVE-LEMMA FREE-FOR-UNTRANS
(REWRITE)
(IMPLIES (AND (TERMP X)
(TERMP Y)
(LEQ N2 N1)
(LEQ (FIND-M Y N2) M))
(FREE-FOR (UNTRANS X M N1)
(UNTRANS Y M N2)))
((INDUCT (UNTRANS X M N1))))
This conjecture can be simplified, using the abbreviations ZEROP, IMPLIES, NOT,
OR, and AND, to five new conjectures:
Case 5. (IMPLIES (AND (LAMBDAP X)
(IMPLIES (AND (TERMP (BODY X))
(TERMP Y)
(IF (LESSP (ADD1 N1) N2) F T)
(IF (LESSP M (FIND-M Y N2)) F T))
(FREE-FOR (UNTRANS (BODY X) M (ADD1 N1))
(UNTRANS Y M N2)))
(TERMP X)
(TERMP Y)
(NOT (LESSP N1 N2))
(NOT (LESSP M (FIND-M Y N2))))
(FREE-FOR (UNTRANS X M N1)
(UNTRANS Y M N2))),
which simplifies, using linear arithmetic, appealing to the lemmas SUB1-ADD1,
NBODY-NLAMBDA, NOT-FREE-IN-UNTRANS, and NBIND-NLAMBDA, and unfolding the
definitions of LESSP, AND, IMPLIES, TERMP, UNTRANS, and FREE-FOR, to:
(IMPLIES (AND (LAMBDAP X)
(NOT (EQUAL N2 0))
(NUMBERP N2)
(NUMBERP N1)
(LESSP N1 (SUB1 N2))
(TERMP (BODY X))
(TERMP Y)
(NOT (LESSP N1 N2))
(NOT (LESSP M (FIND-M Y N2))))
(FREE-FOR (UNTRANS (BODY X) M (ADD1 N1))
(UNTRANS Y M N2))).
This again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(IMPLIES (AND (TERMP (RIGHT X))
(TERMP Y)
(IF (LESSP N1 N2) F T)
(IF (LESSP M (FIND-M Y N2)) F T))
(FREE-FOR (UNTRANS (RIGHT X) M N1)
(UNTRANS Y M N2)))
(IMPLIES (AND (TERMP (LEFT X))
(TERMP Y)
(IF (LESSP N1 N2) F T)
(IF (LESSP M (FIND-M Y N2)) F T))
(FREE-FOR (UNTRANS (LEFT X) M N1)
(UNTRANS Y M N2)))
(TERMP X)
(TERMP Y)
(NOT (LESSP N1 N2))
(NOT (LESSP M (FIND-M Y N2))))
(FREE-FOR (UNTRANS X M N1)
(UNTRANS Y M N2))),
which simplifies, rewriting with NRIGHT-NCOMB and NLEFT-NCOMB, and expanding
the definitions of AND, IMPLIES, TERMP, UNTRANS, and FREE-FOR, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP N1 X)
(TERMP X)
(TERMP Y)
(NOT (LESSP N1 N2))
(NOT (LESSP M (FIND-M Y N2))))
(FREE-FOR (UNTRANS X M N1)
(UNTRANS Y M N2))).
This simplifies, rewriting with SUB1-ADD1, and expanding the functions
LITATOM, TERMP, LESSP, UNTRANS, FREE-FOR, and DIFFERENCE, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N1 X))
(NOT (EQUAL X 0))
(NUMBERP X)
(TERMP X)
(TERMP Y)
(NOT (LESSP N1 N2))
(NOT (LESSP M (FIND-M Y N2))))
(FREE-FOR (UNTRANS X M N1)
(UNTRANS Y M N2))),
which simplifies, unfolding the definitions of TERMP, UNTRANS, and FREE-FOR,
to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N1 X))
(ZEROP X)
(TERMP X)
(TERMP Y)
(NOT (LESSP N1 N2))
(NOT (LESSP M (FIND-M Y N2))))
(FREE-FOR (UNTRANS X M N1)
(UNTRANS Y M N2))),
which simplifies, unfolding the functions ZEROP, TERMP, LESSP, UNTRANS, and
FREE-FOR, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
FREE-FOR-UNTRANS
(DEFN TRANS-UNTRANS-IND
(X BOUNDS M N)
(IF (NLAMBDAP X)
(TRANS-UNTRANS-IND (NBODY X)
(CONS (NBIND X) BOUNDS)
M
(ADD1 N))
(IF (NCOMBP X)
(AND (TRANS-UNTRANS-IND (NLEFT X)
BOUNDS M N)
(TRANS-UNTRANS-IND (NRIGHT X)
BOUNDS M N))
T)))
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and
NLEFT-LESSP can be used to establish that the measure (COUNT X) decreases
according to the well-founded relation LESSP in each recursive call. Hence,
TRANS-UNTRANS-IND is accepted under the definitional principle. Note that:
(TRUEP (TRANS-UNTRANS-IND X BOUNDS M N))
is a theorem.
[ 0.0 0.0 0.0 ]
TRANS-UNTRANS-IND
(DEFN BINDINGS
(M N)
(IF (ZEROP N)
NIL
(CONS (PLUS M N)
(BINDINGS M (SUB1 N)))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
can be used to show that the measure (COUNT N) decreases according to the
well-founded relation LESSP in each recursive call. Hence, BINDINGS is
accepted under the definitional principle. From the definition we can
conclude that (OR (LITATOM (BINDINGS M N)) (LISTP (BINDINGS M N))) is a
theorem.
[ 0.0 0.0 0.0 ]
BINDINGS
(PROVE-LEMMA TRANS-UNTRANS
(REWRITE)
(IMPLIES (AND (EQUAL (LENGTH BOUNDS) N)
(NTERMP X)
(LEQ (FIND-M (TRANSLATE X BOUNDS) N)
M))
(ALPHA-EQUAL X
(UNTRANS (TRANSLATE X BOUNDS) M N)
BOUNDS
(BINDINGS M N)))
((DISABLE ALPHA-TRANSLATE)
(INDUCT (TRANS-UNTRANS-IND X BOUNDS M N))))
This conjecture can be simplified, using the abbreviations IMPLIES, NOT, OR,
and AND, to three new conjectures:
Case 3. (IMPLIES
(AND
(NLAMBDAP X)
(IMPLIES (AND (EQUAL (LENGTH (CONS (NBIND X) BOUNDS))
(ADD1 N))
(NTERMP (NBODY X))
(IF (LESSP M
(FIND-M (TRANSLATE (NBODY X)
(CONS (NBIND X) BOUNDS))
(ADD1 N)))
F T))
(ALPHA-EQUAL (NBODY X)
(UNTRANS (TRANSLATE (NBODY X)
(CONS (NBIND X) BOUNDS))
M
(ADD1 N))
(CONS (NBIND X) BOUNDS)
(BINDINGS M (ADD1 N))))
(EQUAL (LENGTH BOUNDS) N)
(NTERMP X)
(NOT (LESSP M
(FIND-M (TRANSLATE X BOUNDS) N))))
(ALPHA-EQUAL X
(UNTRANS (TRANSLATE X BOUNDS) M N)
BOUNDS
(BINDINGS M N))),
which simplifies, rewriting with CDR-CONS, SUB1-ADD1, BODY-LAMBDA,
NBIND-NLAMBDA, and NBODY-NLAMBDA, and opening up the functions LENGTH, AND,
BINDINGS, IMPLIES, NTERMP, TRANSLATE, FIND-M, UNTRANS, and ALPHA-EQUAL, to:
T.
Case 2. (IMPLIES
(AND (NOT (NLAMBDAP X))
(NCOMBP X)
(IMPLIES (AND (EQUAL (LENGTH BOUNDS) N)
(NTERMP (NRIGHT X))
(IF (LESSP M
(FIND-M (TRANSLATE (NRIGHT X) BOUNDS)
N))
F T))
(ALPHA-EQUAL (NRIGHT X)
(UNTRANS (TRANSLATE (NRIGHT X) BOUNDS)
M N)
BOUNDS
(BINDINGS M N)))
(IMPLIES (AND (EQUAL (LENGTH BOUNDS) N)
(NTERMP (NLEFT X))
(IF (LESSP M
(FIND-M (TRANSLATE (NLEFT X) BOUNDS)
N))
F T))
(ALPHA-EQUAL (NLEFT X)
(UNTRANS (TRANSLATE (NLEFT X) BOUNDS)
M N)
BOUNDS
(BINDINGS M N)))
(EQUAL (LENGTH BOUNDS) N)
(NTERMP X)
(NOT (LESSP M
(FIND-M (TRANSLATE X BOUNDS) N))))
(ALPHA-EQUAL X
(UNTRANS (TRANSLATE X BOUNDS) M N)
BOUNDS
(BINDINGS M N))).
This simplifies, appealing to the lemmas RIGHT-COMB, LEFT-COMB, NRIGHT-NCOMB,
and NLEFT-NCOMB, and expanding the definitions of AND, IMPLIES, NTERMP,
TRANSLATE, FIND-M, UNTRANS, and ALPHA-EQUAL, to the following two new
formulas:
Case 2.2.
(IMPLIES (AND (NCOMBP X)
(LESSP M
(FIND-M (TRANSLATE (NRIGHT X) BOUNDS)
(LENGTH BOUNDS)))
(ALPHA-EQUAL (NLEFT X)
(UNTRANS (TRANSLATE (NLEFT X) BOUNDS)
M
(LENGTH BOUNDS))
BOUNDS
(BINDINGS M (LENGTH BOUNDS)))
(NTERMP (NLEFT X))
(NTERMP (NRIGHT X))
(NOT (LESSP (FIND-M (TRANSLATE (NLEFT X) BOUNDS)
(LENGTH BOUNDS))
(FIND-M (TRANSLATE (NRIGHT X) BOUNDS)
(LENGTH BOUNDS))))
(NOT (LESSP M
(FIND-M (TRANSLATE (NLEFT X) BOUNDS)
(LENGTH BOUNDS)))))
(ALPHA-EQUAL (NRIGHT X)
(UNTRANS (TRANSLATE (NRIGHT X) BOUNDS)
M
(LENGTH BOUNDS))
BOUNDS
(BINDINGS M (LENGTH BOUNDS)))).
This again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (NCOMBP X)
(ALPHA-EQUAL (NRIGHT X)
(UNTRANS (TRANSLATE (NRIGHT X) BOUNDS)
M
(LENGTH BOUNDS))
BOUNDS
(BINDINGS M (LENGTH BOUNDS)))
(LESSP M
(FIND-M (TRANSLATE (NLEFT X) BOUNDS)
(LENGTH BOUNDS)))
(NTERMP (NLEFT X))
(NTERMP (NRIGHT X))
(LESSP (FIND-M (TRANSLATE (NLEFT X) BOUNDS)
(LENGTH BOUNDS))
(FIND-M (TRANSLATE (NRIGHT X) BOUNDS)
(LENGTH BOUNDS)))
(NOT (LESSP M
(FIND-M (TRANSLATE (NRIGHT X) BOUNDS)
(LENGTH BOUNDS)))))
(ALPHA-EQUAL (NLEFT X)
(UNTRANS (TRANSLATE (NLEFT X) BOUNDS)
M
(LENGTH BOUNDS))
BOUNDS
(BINDINGS M (LENGTH BOUNDS)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(EQUAL (LENGTH BOUNDS) N)
(NTERMP X)
(NOT (LESSP M
(FIND-M (TRANSLATE X BOUNDS) N))))
(ALPHA-EQUAL X
(UNTRANS (TRANSLATE X BOUNDS) M N)
BOUNDS
(BINDINGS M N))),
which simplifies, rewriting with SUB1-ADD1, and expanding NTERMP, TRANSLATE,
FIND-M, DIFFERENCE, UNTRANS, ALPHA-EQUAL, EQUAL, and LESSP, to the following
three new formulas:
Case 1.3.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(EQUAL (INDEX X BOUNDS) 0))
(EQUAL (INDEX X BOUNDS)
(INDEX 0
(BINDINGS M (LENGTH BOUNDS))))).
This again simplifies, expanding EQUAL, DIFFERENCE, and LESSP, to the
conjecture:
(IMPLIES (AND (NUMBERP X)
(EQUAL (INDEX X BOUNDS) 0))
(EQUAL 0
(INDEX 0
(BINDINGS M (LENGTH BOUNDS))))).
Give the above formula the name *1.
Case 1.2.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(NOT (LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS)))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (ADD1 (PLUS M
(DIFFERENCE (LENGTH BOUNDS)
(INDEX X BOUNDS))))
(BINDINGS M (LENGTH BOUNDS))))).
This again simplifies, obviously, to:
(IMPLIES (AND (NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(NOT (LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS)))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (ADD1 (PLUS M
(DIFFERENCE (LENGTH BOUNDS)
(INDEX X BOUNDS))))
(BINDINGS M (LENGTH BOUNDS))))),
which we will name *2.
Case 1.1.
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (DIFFERENCE (SUB1 (INDEX X BOUNDS))
(LENGTH BOUNDS))
(BINDINGS M (LENGTH BOUNDS))))).
This again simplifies, obviously, to:
(IMPLIES (AND (NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (DIFFERENCE (SUB1 (INDEX X BOUNDS))
(LENGTH BOUNDS))
(BINDINGS M (LENGTH BOUNDS))))),
which we will name *3.
We will appeal to induction. The recursive terms in the conjecture
suggest ten inductions. They merge into two likely candidate inductions, both
of which are unflawed. However, one of these is more likely than the other.
We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X))
(p X BOUNDS M))
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(p X (CDR BOUNDS) M))
(p X BOUNDS M))
(IMPLIES (NOT (LISTP BOUNDS))
(p X BOUNDS M))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT BOUNDS) decreases according to the well-founded relation LESSP in each
induction step of the scheme. The above induction scheme leads to the
following six new goals:
Case 6. (IMPLIES (AND (LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X)
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (DIFFERENCE (SUB1 (INDEX X BOUNDS))
(LENGTH BOUNDS))
(BINDINGS M (LENGTH BOUNDS))))).
This simplifies, applying SUB1-ADD1, and opening up the functions INDEX,
LENGTH, SUB1, NUMBERP, EQUAL, DIFFERENCE, and LESSP, to:
T.
Case 5. (IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(LESSP M
(DIFFERENCE (INDEX X (CDR BOUNDS))
(LENGTH (CDR BOUNDS))))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (DIFFERENCE (SUB1 (INDEX X BOUNDS))
(LENGTH BOUNDS))
(BINDINGS M (LENGTH BOUNDS))))),
which simplifies, appealing to the lemma SUB1-ADD1, and expanding the
definitions of INDEX, LENGTH, and DIFFERENCE, to:
T.
Case 4. (IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(INDEX X (CDR BOUNDS))))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (DIFFERENCE (SUB1 (INDEX X BOUNDS))
(LENGTH BOUNDS))
(BINDINGS M (LENGTH BOUNDS))))),
which simplifies, applying SUB1-ADD1, and expanding the definitions of INDEX,
LENGTH, DIFFERENCE, and LESSP, to:
T.
Case 3. (IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS)) 0)
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (DIFFERENCE (SUB1 (INDEX X BOUNDS))
(LENGTH BOUNDS))
(BINDINGS M (LENGTH BOUNDS))))).
This simplifies, applying SUB1-ADD1, and expanding the functions INDEX, ADD1,
LENGTH, SUB1, NUMBERP, EQUAL, DIFFERENCE, and LESSP, to:
T.
Case 2. (IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS))
(INDEX (DIFFERENCE (SUB1 (INDEX X (CDR BOUNDS)))
(LENGTH (CDR BOUNDS)))
(BINDINGS M (LENGTH (CDR BOUNDS)))))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (DIFFERENCE (SUB1 (INDEX X BOUNDS))
(LENGTH BOUNDS))
(BINDINGS M (LENGTH BOUNDS))))),
which simplifies, applying SUB1-ADD1, CDR-CONS, and CAR-CONS, and unfolding
INDEX, LENGTH, DIFFERENCE, LESSP, and BINDINGS, to the following four new
formulas:
Case 2.4.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS))
(INDEX (DIFFERENCE (SUB1 (INDEX X (CDR BOUNDS)))
(LENGTH (CDR BOUNDS)))
(BINDINGS M (LENGTH (CDR BOUNDS)))))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X (CDR BOUNDS))
(LENGTH (CDR BOUNDS)))))
(LESSP (LENGTH (CDR BOUNDS))
(INDEX X (CDR BOUNDS)))
(EQUAL (INDEX X (CDR BOUNDS)) 0)
(NOT (EQUAL (PLUS M (ADD1 (LENGTH (CDR BOUNDS))))
0)))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
(ADD1 (INDEX 0
(BINDINGS M
(LENGTH (CDR BOUNDS))))))).
This again simplifies, using linear arithmetic, to:
T.
Case 2.3.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS))
(INDEX (DIFFERENCE (SUB1 (INDEX X (CDR BOUNDS)))
(LENGTH (CDR BOUNDS)))
(BINDINGS M (LENGTH (CDR BOUNDS)))))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X (CDR BOUNDS))
(LENGTH (CDR BOUNDS)))))
(LESSP (LENGTH (CDR BOUNDS))
(INDEX X (CDR BOUNDS)))
(EQUAL (INDEX X (CDR BOUNDS)) 0)
(EQUAL (PLUS M (ADD1 (LENGTH (CDR BOUNDS))))
0))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
1)),
which again simplifies, obviously, to:
T.
Case 2.2.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS))
(INDEX (DIFFERENCE (SUB1 (INDEX X (CDR BOUNDS)))
(LENGTH (CDR BOUNDS)))
(BINDINGS M (LENGTH (CDR BOUNDS)))))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X (CDR BOUNDS))
(LENGTH (CDR BOUNDS)))))
(LESSP (LENGTH (CDR BOUNDS))
(INDEX X (CDR BOUNDS)))
(NOT (EQUAL (INDEX X (CDR BOUNDS)) 0))
(EQUAL (PLUS M (ADD1 (LENGTH (CDR BOUNDS))))
(DIFFERENCE (SUB1 (INDEX X (CDR BOUNDS)))
(LENGTH (CDR BOUNDS)))))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
1)).
But this again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (SUB1 (INDEX X (CDR BOUNDS)))
(LENGTH (CDR BOUNDS)))
(LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS))
(INDEX (DIFFERENCE (SUB1 (INDEX X (CDR BOUNDS)))
(LENGTH (CDR BOUNDS)))
(BINDINGS M (LENGTH (CDR BOUNDS)))))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X (CDR BOUNDS))
(LENGTH (CDR BOUNDS)))))
(LESSP (LENGTH (CDR BOUNDS))
(INDEX X (CDR BOUNDS)))
(NOT (EQUAL (INDEX X (CDR BOUNDS)) 0))
(EQUAL (PLUS M (ADD1 (LENGTH (CDR BOUNDS))))
(DIFFERENCE (SUB1 (INDEX X (CDR BOUNDS)))
(LENGTH (CDR BOUNDS)))))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
1)).
This again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES
(AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS))
(INDEX (DIFFERENCE (SUB1 (INDEX X (CDR BOUNDS)))
(LENGTH (CDR BOUNDS)))
(BINDINGS M (LENGTH (CDR BOUNDS)))))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X (CDR BOUNDS))
(LENGTH (CDR BOUNDS)))))
(LESSP (LENGTH (CDR BOUNDS))
(INDEX X (CDR BOUNDS)))
(NOT (EQUAL (INDEX X (CDR BOUNDS)) 0))
(NOT (EQUAL (PLUS M (ADD1 (LENGTH (CDR BOUNDS))))
(DIFFERENCE (SUB1 (INDEX X (CDR BOUNDS)))
(LENGTH (CDR BOUNDS))))))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
(ADD1 (INDEX (DIFFERENCE (SUB1 (INDEX X (CDR BOUNDS)))
(LENGTH (CDR BOUNDS)))
(BINDINGS M
(LENGTH (CDR BOUNDS))))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP BOUNDS))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (DIFFERENCE (SUB1 (INDEX X BOUNDS))
(LENGTH BOUNDS))
(BINDINGS M (LENGTH BOUNDS))))),
which simplifies, rewriting with SUB1-ADD1 and ADD1-EQUAL, and opening up
the functions INDEX, LENGTH, EQUAL, DIFFERENCE, LESSP, BINDINGS, and LISTP,
to:
T.
That finishes the proof of *3.
So let us turn our attention to:
(IMPLIES (AND (NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(NOT (LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS)))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (ADD1 (PLUS M
(DIFFERENCE (LENGTH BOUNDS)
(INDEX X BOUNDS))))
(BINDINGS M (LENGTH BOUNDS))))),
which we named *2 above. We will appeal to induction. There are 11 plausible
inductions. They merge into two likely candidate inductions, both of which
are unflawed. However, one of these is more likely than the other. We will
induct according to the following scheme:
(AND (IMPLIES (AND (LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X))
(p X BOUNDS M))
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(p X (CDR BOUNDS) M))
(p X BOUNDS M))
(IMPLIES (NOT (LISTP BOUNDS))
(p X BOUNDS M))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT BOUNDS) 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 (LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X)
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(NOT (LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS)))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (ADD1 (PLUS M
(DIFFERENCE (LENGTH BOUNDS)
(INDEX X BOUNDS))))
(BINDINGS M (LENGTH BOUNDS))))).
This simplifies, rewriting with SUB1-ADD1, CDR-CONS, and CAR-CONS, and
expanding the definitions of INDEX, LENGTH, SUB1, NUMBERP, EQUAL, DIFFERENCE,
LESSP, and BINDINGS, to two new formulas:
Case 6.2.
(IMPLIES (AND (LISTP BOUNDS)
(NUMBERP (CAR BOUNDS))
(EQUAL (LENGTH (CDR BOUNDS)) 0)
(NOT (EQUAL (PLUS M (ADD1 (LENGTH (CDR BOUNDS))))
(ADD1 (PLUS M 0)))))
(EQUAL 1
(ADD1 (INDEX (ADD1 (PLUS M 0))
(BINDINGS M
(LENGTH (CDR BOUNDS))))))),
which again simplifies, using linear arithmetic, to:
T.
Case 6.1.
(IMPLIES (AND (LISTP BOUNDS)
(NUMBERP (CAR BOUNDS))
(NOT (EQUAL (LENGTH (CDR BOUNDS)) 0))
(NOT (EQUAL (PLUS M (ADD1 (LENGTH (CDR BOUNDS))))
(ADD1 (PLUS M (LENGTH (CDR BOUNDS)))))))
(EQUAL 1
(ADD1 (INDEX (ADD1 (PLUS M (LENGTH (CDR BOUNDS))))
(BINDINGS M
(LENGTH (CDR BOUNDS))))))),
which again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(LESSP M
(DIFFERENCE (INDEX X (CDR BOUNDS))
(LENGTH (CDR BOUNDS))))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(NOT (LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS)))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (ADD1 (PLUS M
(DIFFERENCE (LENGTH BOUNDS)
(INDEX X BOUNDS))))
(BINDINGS M (LENGTH BOUNDS))))),
which simplifies, applying SUB1-ADD1, and unfolding INDEX, LENGTH, and
DIFFERENCE, to:
T.
Case 4. (IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(LESSP (LENGTH (CDR BOUNDS))
(INDEX X (CDR BOUNDS)))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(NOT (LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS)))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (ADD1 (PLUS M
(DIFFERENCE (LENGTH BOUNDS)
(INDEX X BOUNDS))))
(BINDINGS M (LENGTH BOUNDS))))).
This simplifies, applying SUB1-ADD1, and opening up INDEX, LENGTH,
DIFFERENCE, and LESSP, to:
T.
Case 3. (IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS)) 0)
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(NOT (LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS)))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (ADD1 (PLUS M
(DIFFERENCE (LENGTH BOUNDS)
(INDEX X BOUNDS))))
(BINDINGS M (LENGTH BOUNDS))))),
which simplifies, rewriting with SUB1-ADD1, CDR-CONS, and CAR-CONS, and
opening up INDEX, ADD1, LENGTH, SUB1, NUMBERP, EQUAL, DIFFERENCE, LESSP, and
BINDINGS, to the following two new goals:
Case 3.2.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS)) 0)
(NUMBERP X)
(EQUAL (LENGTH (CDR BOUNDS)) 0)
(NOT (EQUAL (PLUS M (ADD1 (LENGTH (CDR BOUNDS))))
(ADD1 (PLUS M 0)))))
(EQUAL 1
(ADD1 (INDEX (ADD1 (PLUS M 0))
(BINDINGS M
(LENGTH (CDR BOUNDS))))))).
This again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS)) 0)
(NUMBERP X)
(NOT (EQUAL (LENGTH (CDR BOUNDS)) 0))
(NOT (EQUAL (PLUS M (ADD1 (LENGTH (CDR BOUNDS))))
(ADD1 (PLUS M (LENGTH (CDR BOUNDS)))))))
(EQUAL 1
(ADD1 (INDEX (ADD1 (PLUS M (LENGTH (CDR BOUNDS))))
(BINDINGS M
(LENGTH (CDR BOUNDS))))))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES
(AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS))
(INDEX (ADD1 (PLUS M
(DIFFERENCE (LENGTH (CDR BOUNDS))
(INDEX X (CDR BOUNDS)))))
(BINDINGS M (LENGTH (CDR BOUNDS)))))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(NOT (LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS)))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (ADD1 (PLUS M
(DIFFERENCE (LENGTH BOUNDS)
(INDEX X BOUNDS))))
(BINDINGS M (LENGTH BOUNDS))))),
which simplifies, applying SUB1-ADD1, CDR-CONS, and CAR-CONS, and opening up
the functions INDEX, LENGTH, DIFFERENCE, LESSP, and BINDINGS, to:
(IMPLIES
(AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL (INDEX X (CDR BOUNDS))
(INDEX (ADD1 (PLUS M
(DIFFERENCE (LENGTH (CDR BOUNDS))
(INDEX X (CDR BOUNDS)))))
(BINDINGS M (LENGTH (CDR BOUNDS)))))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X (CDR BOUNDS))
(LENGTH (CDR BOUNDS)))))
(NOT (LESSP (LENGTH (CDR BOUNDS))
(INDEX X (CDR BOUNDS))))
(EQUAL (PLUS M (ADD1 (LENGTH (CDR BOUNDS))))
(ADD1 (PLUS M
(DIFFERENCE (LENGTH (CDR BOUNDS))
(INDEX X (CDR BOUNDS)))))))
(EQUAL (ADD1 (INDEX X (CDR BOUNDS)))
1)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP BOUNDS))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (INDEX X BOUNDS)
(LENGTH BOUNDS))))
(NOT (LESSP (LENGTH BOUNDS)
(INDEX X BOUNDS)))
(NOT (EQUAL (INDEX X BOUNDS) 0)))
(EQUAL (INDEX X BOUNDS)
(INDEX (ADD1 (PLUS M
(DIFFERENCE (LENGTH BOUNDS)
(INDEX X BOUNDS))))
(BINDINGS M (LENGTH BOUNDS))))),
which simplifies, rewriting with SUB1-ADD1, and unfolding INDEX, LENGTH,
EQUAL, DIFFERENCE, and LESSP, to:
T.
That finishes the proof of *2.
So next consider:
(IMPLIES (AND (NUMBERP X)
(EQUAL (INDEX X BOUNDS) 0))
(EQUAL 0
(INDEX 0
(BINDINGS M (LENGTH BOUNDS))))),
named *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 BOUNDS)
(EQUAL (CAR BOUNDS) X))
(p M BOUNDS X))
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(p M (CDR BOUNDS) X))
(p M BOUNDS X))
(IMPLIES (NOT (LISTP BOUNDS))
(p M BOUNDS X))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT BOUNDS) decreases according to the well-founded relation LESSP in each
induction step of the scheme. The above induction scheme generates the
following four new conjectures:
Case 4. (IMPLIES (AND (LISTP BOUNDS)
(EQUAL (CAR BOUNDS) X)
(NUMBERP X)
(EQUAL (INDEX X BOUNDS) 0))
(EQUAL 0
(INDEX 0
(BINDINGS M (LENGTH BOUNDS))))).
This simplifies, unfolding the definitions of INDEX and EQUAL, to:
T.
Case 3. (IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(NOT (EQUAL (INDEX X (CDR BOUNDS)) 0))
(NUMBERP X)
(EQUAL (INDEX X BOUNDS) 0))
(EQUAL 0
(INDEX 0
(BINDINGS M (LENGTH BOUNDS))))).
This simplifies, opening up the function INDEX, to:
T.
Case 2. (IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(EQUAL 0
(INDEX 0
(BINDINGS M (LENGTH (CDR BOUNDS)))))
(NUMBERP X)
(EQUAL (INDEX X BOUNDS) 0))
(EQUAL 0
(INDEX 0
(BINDINGS M (LENGTH BOUNDS))))).
This simplifies, expanding INDEX, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP BOUNDS))
(NUMBERP X)
(EQUAL (INDEX X BOUNDS) 0))
(EQUAL 0
(INDEX 0
(BINDINGS M (LENGTH BOUNDS))))).
This simplifies, unfolding INDEX, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
TRANS-UNTRANS
(PROVE-LEMMA TERMP-NTERMP
(REWRITE)
(IMPLIES (NTERMP X)
(TERMP (TRANSLATE X BOUNDS))))
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 (NLAMBDAP X)
(p (NBODY X) (CONS (NBIND X) BOUNDS)))
(p X BOUNDS))
(IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(p (NRIGHT X) BOUNDS)
(p (NLEFT X) BOUNDS))
(p X BOUNDS))
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NUMBERP X))
(p X BOUNDS))
(IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (NUMBERP X)))
(p X BOUNDS))).
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and NLEFT-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 instances chosen for BOUNDS. The above induction
scheme generates the following eight new formulas:
Case 8. (IMPLIES (AND (NLAMBDAP X)
(NOT (NTERMP (NBODY X)))
(NTERMP X))
(TERMP (TRANSLATE X BOUNDS))).
This simplifies, expanding the definition of NTERMP, to:
T.
Case 7. (IMPLIES (AND (NLAMBDAP X)
(TERMP (TRANSLATE (NBODY X)
(CONS (NBIND X) BOUNDS)))
(NTERMP X))
(TERMP (TRANSLATE X BOUNDS))).
This simplifies, appealing to the lemma BODY-LAMBDA, and opening up NTERMP,
TRANSLATE, and TERMP, to:
T.
Case 6. (IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(NOT (NTERMP (NRIGHT X)))
(NOT (NTERMP (NLEFT X)))
(NTERMP X))
(TERMP (TRANSLATE X BOUNDS))).
This simplifies, unfolding NTERMP, to:
T.
Case 5. (IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(TERMP (TRANSLATE (NRIGHT X) BOUNDS))
(NOT (NTERMP (NLEFT X)))
(NTERMP X))
(TERMP (TRANSLATE X BOUNDS))).
This simplifies, unfolding the definition of NTERMP, to:
T.
Case 4. (IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(NOT (NTERMP (NRIGHT X)))
(TERMP (TRANSLATE (NLEFT X) BOUNDS))
(NTERMP X))
(TERMP (TRANSLATE X BOUNDS))).
This simplifies, opening up the function NTERMP, to:
T.
Case 3. (IMPLIES (AND (NOT (NLAMBDAP X))
(NCOMBP X)
(TERMP (TRANSLATE (NRIGHT X) BOUNDS))
(TERMP (TRANSLATE (NLEFT X) BOUNDS))
(NTERMP X))
(TERMP (TRANSLATE X BOUNDS))).
This simplifies, rewriting with RIGHT-COMB and LEFT-COMB, and opening up the
definitions of NTERMP, TRANSLATE, and TERMP, to:
T.
Case 2. (IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NUMBERP X)
(NTERMP X))
(TERMP (TRANSLATE X BOUNDS))),
which simplifies, unfolding the functions NTERMP, TRANSLATE, LITATOM, and
TERMP, to:
(IMPLIES (NUMBERP X)
(NOT (EQUAL (INDEX X BOUNDS) 0))).
Call the above conjecture *1.1.
Case 1. (IMPLIES (AND (NOT (NLAMBDAP X))
(NOT (NCOMBP X))
(NOT (NUMBERP X))
(NTERMP X))
(TERMP (TRANSLATE X BOUNDS))).
This simplifies, opening up the functions NTERMP, TRANSLATE, and TERMP, to:
T.
So we now return to:
(IMPLIES (NUMBERP X)
(NOT (EQUAL (INDEX X BOUNDS) 0))),
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 BOUNDS)
(EQUAL (CAR BOUNDS) X))
(p X BOUNDS))
(IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(p X (CDR BOUNDS)))
(p X BOUNDS))
(IMPLIES (NOT (LISTP BOUNDS))
(p X BOUNDS))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT BOUNDS) 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 BOUNDS)
(EQUAL (CAR BOUNDS) X)
(NUMBERP X))
(NOT (EQUAL (INDEX X BOUNDS) 0))).
This simplifies, expanding the definitions of INDEX and EQUAL, to:
T.
Case 2. (IMPLIES (AND (LISTP BOUNDS)
(NOT (EQUAL (CAR BOUNDS) X))
(NOT (EQUAL (INDEX X (CDR BOUNDS)) 0))
(NUMBERP X))
(NOT (EQUAL (INDEX X BOUNDS) 0))).
This simplifies, expanding the definition of INDEX, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP BOUNDS)) (NUMBERP X))
(NOT (EQUAL (INDEX X BOUNDS) 0))).
This simplifies, unfolding the definition of INDEX, to:
T.
That finishes the proof of *1.1, which, in turn, also finishes the proof
of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
TERMP-NTERMP
(PROVE-LEMMA NTERMP-TERMP
(REWRITE)
(IMPLIES (TERMP X)
(NTERMP (UNTRANS X M N))))
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 (LAMBDAP X)
(p (BODY X) M (ADD1 N)))
(p X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(p (RIGHT X) M N)
(p (LEFT X) M N))
(p X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP N X))
(p X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X))
(NOT (ZEROP X)))
(p X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X))
(ZEROP X))
(p X M N))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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 N. The above induction scheme produces the
following nine new goals:
Case 9. (IMPLIES (AND (LAMBDAP X)
(NOT (TERMP (BODY X)))
(TERMP X))
(NTERMP (UNTRANS X M N))).
This simplifies, expanding TERMP, to:
T.
Case 8. (IMPLIES (AND (LAMBDAP X)
(NTERMP (UNTRANS (BODY X) M (ADD1 N)))
(TERMP X))
(NTERMP (UNTRANS X M N))).
This simplifies, rewriting with NBODY-NLAMBDA, and unfolding the definitions
of TERMP, UNTRANS, and NTERMP, to:
T.
Case 7. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (TERMP (RIGHT X)))
(NOT (TERMP (LEFT X)))
(TERMP X))
(NTERMP (UNTRANS X M N))),
which simplifies, unfolding the definition of TERMP, to:
T.
Case 6. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NTERMP (UNTRANS (RIGHT X) M N))
(NOT (TERMP (LEFT X)))
(TERMP X))
(NTERMP (UNTRANS X M N))),
which simplifies, opening up TERMP, to:
T.
Case 5. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (TERMP (RIGHT X)))
(NTERMP (UNTRANS (LEFT X) M N))
(TERMP X))
(NTERMP (UNTRANS X M N))),
which simplifies, expanding TERMP, to:
T.
Case 4. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NTERMP (UNTRANS (RIGHT X) M N))
(NTERMP (UNTRANS (LEFT X) M N))
(TERMP X))
(NTERMP (UNTRANS X M N))),
which simplifies, rewriting with NRIGHT-NCOMB and NLEFT-NCOMB, and opening
up TERMP, UNTRANS, and NTERMP, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP N X)
(TERMP X))
(NTERMP (UNTRANS X M N))).
This simplifies, rewriting with the lemma SUB1-ADD1, and unfolding the
definitions of TERMP, LITATOM, UNTRANS, LESSP, NTERMP, and DIFFERENCE, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X))
(NOT (ZEROP X))
(TERMP X))
(NTERMP (UNTRANS X M N))).
This simplifies, unfolding the definitions of ZEROP, TERMP, UNTRANS, and
NTERMP, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X))
(ZEROP X)
(TERMP X))
(NTERMP (UNTRANS X M N))).
This simplifies, unfolding the definitions of ZEROP, TERMP, UNTRANS, LESSP,
and NTERMP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NTERMP-TERMP
(PROVE-LEMMA INDEX-FREEVAR
(REWRITE)
(IMPLIES (AND (LESSP N X)
(LEQ (DIFFERENCE X N) M))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) N)
(BINDINGS M N))
X)))
.
Applying the lemma SUB1-ELIM, replace X by (ADD1 Z) to eliminate (SUB1 X). We
use the type restriction lemma noted when SUB1 was introduced to restrict the
new variable. We would thus like to prove the following three new formulas:
Case 3. (IMPLIES (AND (EQUAL X 0)
(LESSP N X)
(NOT (LESSP M (DIFFERENCE X N))))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) N)
(BINDINGS M N))
X)).
But this simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP X))
(LESSP N X)
(NOT (LESSP M (DIFFERENCE X N))))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) N)
(BINDINGS M N))
X)),
which simplifies, expanding the function LESSP, to:
T.
Case 1. (IMPLIES (AND (NUMBERP Z)
(NOT (EQUAL (ADD1 Z) 0))
(LESSP N (ADD1 Z))
(NOT (LESSP M (DIFFERENCE (ADD1 Z) N))))
(EQUAL (INDEX (DIFFERENCE Z N)
(BINDINGS M N))
(ADD1 Z))),
which simplifies, applying SUB1-ADD1 and ADD1-EQUAL, and opening up the
functions LESSP, EQUAL, DIFFERENCE, BINDINGS, LISTP, and INDEX, to the
following five new conjectures:
Case 1.5.
(IMPLIES (AND (NUMBERP Z)
(EQUAL N 0)
(NOT (EQUAL M 0))
(NUMBERP M)
(NOT (LESSP (SUB1 M) Z))
(EQUAL Z 0))
(EQUAL 0 Z)).
This again simplifies, obviously, to:
T.
Case 1.4.
(IMPLIES (AND (NUMBERP Z)
(NOT (NUMBERP N))
(NOT (EQUAL M 0))
(NUMBERP M)
(NOT (LESSP (SUB1 M) Z))
(EQUAL Z 0))
(EQUAL 0 Z)).
This again simplifies, clearly, to:
T.
Case 1.3.
(IMPLIES (AND (NUMBERP Z)
(LESSP (SUB1 N) Z)
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP M (DIFFERENCE Z (SUB1 N)))))
(EQUAL (INDEX (DIFFERENCE Z N)
(BINDINGS M N))
(ADD1 Z))).
Appealing to the lemma SUB1-ELIM, we now replace N by (ADD1 V) to
eliminate (SUB1 N). We rely upon the type restriction lemma noted when
SUB1 was introduced to constrain the new variable. The result is:
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(LESSP V Z)
(NOT (EQUAL (ADD1 V) 0))
(NOT (LESSP M (DIFFERENCE Z V))))
(EQUAL (INDEX (DIFFERENCE Z (ADD1 V))
(BINDINGS M (ADD1 V)))
(ADD1 Z))).
This further simplifies, appealing to the lemmas SUB1-ADD1, CDR-CONS, and
CAR-CONS, and expanding the definitions of DIFFERENCE, BINDINGS, and INDEX,
to four new goals:
Case 1.3.4.
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(LESSP V Z)
(NOT (LESSP M (DIFFERENCE Z V)))
(EQUAL Z 0)
(NOT (EQUAL (PLUS M (ADD1 V)) 0)))
(EQUAL (ADD1 (INDEX 0 (BINDINGS M V)))
(ADD1 Z))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.3.3.
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(LESSP V Z)
(NOT (LESSP M (DIFFERENCE Z V)))
(EQUAL Z 0)
(EQUAL (PLUS M (ADD1 V)) 0))
(EQUAL 1 (ADD1 Z))),
which again simplifies, obviously, to:
T.
Case 1.3.2.
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(LESSP V Z)
(NOT (LESSP M (DIFFERENCE Z V)))
(NOT (EQUAL Z 0))
(EQUAL (PLUS M (ADD1 V))
(DIFFERENCE (SUB1 Z) V)))
(EQUAL 1 (ADD1 Z))).
However this again simplifies, using linear arithmetic, to the formula:
(IMPLIES (AND (LESSP (SUB1 Z) V)
(NUMBERP V)
(NUMBERP Z)
(LESSP V Z)
(NOT (LESSP M (DIFFERENCE Z V)))
(NOT (EQUAL Z 0))
(EQUAL (PLUS M (ADD1 V))
(DIFFERENCE (SUB1 Z) V)))
(EQUAL 1 (ADD1 Z))).
This finally simplifies, using linear arithmetic, to:
T.
Case 1.3.1.
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(LESSP V Z)
(NOT (LESSP M (DIFFERENCE Z V)))
(NOT (EQUAL Z 0))
(NOT (EQUAL (PLUS M (ADD1 V))
(DIFFERENCE (SUB1 Z) V))))
(EQUAL (ADD1 (INDEX (DIFFERENCE (SUB1 Z) V)
(BINDINGS M V)))
(ADD1 Z))),
which again simplifies, applying ADD1-EQUAL, to:
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(LESSP V Z)
(NOT (LESSP M (DIFFERENCE Z V)))
(NOT (EQUAL Z 0))
(NOT (EQUAL (PLUS M (ADD1 V))
(DIFFERENCE (SUB1 Z) V))))
(EQUAL (INDEX (DIFFERENCE (SUB1 Z) V)
(BINDINGS M 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 N X)
(IF (LESSP M (DIFFERENCE X N)) F T))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) N)
(BINDINGS M N))
X)),
named *1. Let us appeal to the induction principle. Seven 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 (OR (EQUAL X 0) (NOT (NUMBERP X)))
(p X N M))
(IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(OR (EQUAL N 0) (NOT (NUMBERP N))))
(p X N M))
(IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(p (SUB1 X) (SUB1 N) M))
(p X N M))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT can be used to establish that the measure (COUNT N) 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 generates the following five new formulas:
Case 5. (IMPLIES (AND (OR (EQUAL X 0) (NOT (NUMBERP X)))
(LESSP N X)
(IF (LESSP M (DIFFERENCE X N)) F T))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) N)
(BINDINGS M N))
X)).
This simplifies, unfolding the functions NOT, OR, EQUAL, and LESSP, to:
T.
Case 4. (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(OR (EQUAL N 0) (NOT (NUMBERP N)))
(LESSP N X)
(IF (LESSP M (DIFFERENCE X N)) F T))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) N)
(BINDINGS M N))
X)).
This simplifies, expanding the definitions of NOT, OR, EQUAL, LESSP,
DIFFERENCE, BINDINGS, LISTP, and INDEX, to the following four new formulas:
Case 4.4.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL N 0)
(NOT (LESSP M X))
(NOT (EQUAL (SUB1 X) 0)))
(EQUAL (ADD1 (SUB1 X)) X)).
However this again simplifies, using linear arithmetic, to:
T.
Case 4.3.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(EQUAL N 0)
(NOT (LESSP M X))
(EQUAL (SUB1 X) 0))
(EQUAL 1 X)),
which again simplifies, using linear arithmetic, to:
T.
Case 4.2.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP N))
(NOT (LESSP M X))
(NOT (EQUAL (SUB1 X) 0)))
(EQUAL (ADD1 (SUB1 X)) X)),
which again simplifies, using linear arithmetic, to:
T.
Case 4.1.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP N))
(NOT (LESSP M X))
(EQUAL (SUB1 X) 0))
(EQUAL 1 X)),
which again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (LESSP (SUB1 N) (SUB1 X)))
(LESSP N X)
(IF (LESSP M (DIFFERENCE X N)) F T))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) N)
(BINDINGS M N))
X)),
which simplifies, using linear arithmetic, to the goal:
(IMPLIES (AND (LESSP N 1)
(NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (LESSP (SUB1 N) (SUB1 X)))
(LESSP N X)
(IF (LESSP M (DIFFERENCE X N)) F T))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) N)
(BINDINGS M N))
X)).
But this again simplifies, unfolding SUB1, NUMBERP, EQUAL, LESSP, NOT, and
OR, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (IF (LESSP M
(DIFFERENCE (SUB1 X) (SUB1 N)))
F T))
(LESSP N X)
(IF (LESSP M (DIFFERENCE X N)) F T))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) N)
(BINDINGS M N))
X)),
which simplifies, opening up NOT, OR, LESSP, and DIFFERENCE, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(EQUAL (INDEX (DIFFERENCE (SUB1 (SUB1 X)) (SUB1 N))
(BINDINGS M (SUB1 N)))
(SUB1 X))
(LESSP N X)
(IF (LESSP M (DIFFERENCE X N)) F T))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) N)
(BINDINGS M N))
X)),
which simplifies, applying CDR-CONS and CAR-CONS, and unfolding the
definitions of NOT, OR, LESSP, DIFFERENCE, BINDINGS, and INDEX, to the
following four new goals:
Case 1.4.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (INDEX (DIFFERENCE (SUB1 (SUB1 X)) (SUB1 N))
(BINDINGS M (SUB1 N)))
(SUB1 X))
(LESSP (SUB1 N) (SUB1 X))
(NOT (LESSP M
(DIFFERENCE (SUB1 X) (SUB1 N))))
(EQUAL (SUB1 X) 0)
(NOT (EQUAL (PLUS M N) 0)))
(EQUAL (ADD1 (INDEX 0 (BINDINGS M (SUB1 N))))
X)).
This again simplifies, using linear arithmetic, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (INDEX (DIFFERENCE (SUB1 (SUB1 X)) (SUB1 N))
(BINDINGS M (SUB1 N)))
(SUB1 X))
(LESSP (SUB1 N) (SUB1 X))
(NOT (LESSP M
(DIFFERENCE (SUB1 X) (SUB1 N))))
(EQUAL (SUB1 X) 0)
(EQUAL (PLUS M N) 0))
(EQUAL 1 X)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (INDEX (DIFFERENCE (SUB1 (SUB1 X)) (SUB1 N))
(BINDINGS M (SUB1 N)))
(SUB1 X))
(LESSP (SUB1 N) (SUB1 X))
(NOT (LESSP M
(DIFFERENCE (SUB1 X) (SUB1 N))))
(NOT (EQUAL (SUB1 X) 0))
(EQUAL (PLUS M N)
(DIFFERENCE (SUB1 (SUB1 X))
(SUB1 N))))
(EQUAL 1 X)),
which again simplifies, using linear arithmetic, to the goal:
(IMPLIES (AND (LESSP (SUB1 (SUB1 X)) (SUB1 N))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (INDEX (DIFFERENCE (SUB1 (SUB1 X)) (SUB1 N))
(BINDINGS M (SUB1 N)))
(SUB1 X))
(LESSP (SUB1 N) (SUB1 X))
(NOT (LESSP M
(DIFFERENCE (SUB1 X) (SUB1 N))))
(NOT (EQUAL (SUB1 X) 0))
(EQUAL (PLUS M N)
(DIFFERENCE (SUB1 (SUB1 X))
(SUB1 N))))
(EQUAL 1 X)).
But this again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (INDEX (DIFFERENCE (SUB1 (SUB1 X)) (SUB1 N))
(BINDINGS M (SUB1 N)))
(SUB1 X))
(LESSP (SUB1 N) (SUB1 X))
(NOT (LESSP M
(DIFFERENCE (SUB1 X) (SUB1 N))))
(NOT (EQUAL (SUB1 X) 0))
(NOT (EQUAL (PLUS M N)
(DIFFERENCE (SUB1 (SUB1 X))
(SUB1 N)))))
(EQUAL (ADD1 (INDEX (DIFFERENCE (SUB1 (SUB1 X)) (SUB1 N))
(BINDINGS M (SUB1 N))))
X)),
which again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.1 ]
INDEX-FREEVAR
(PROVE-LEMMA UNTRANS-TRANS
(REWRITE)
(IMPLIES (AND (TERMP X) (LEQ (FIND-M X N) M))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)))
Call the conjecture *1.
Perhaps we can prove it by induction. Five inductions are suggested by
terms in the conjecture. They merge into three likely candidate inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (AND (LAMBDAP X)
(p (BODY X) M (ADD1 N)))
(p X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(p (RIGHT X) M N)
(p (LEFT X) M N))
(p X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(p (LEFT X) M N)
(p (RIGHT X) M N))
(p X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X)))
(p X M N))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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 N. The above induction scheme generates the
following 22 new goals:
Case 22.(IMPLIES (AND (LAMBDAP X)
(NOT (TERMP (BODY X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)).
This simplifies, unfolding the function TERMP, to:
T.
Case 21.(IMPLIES (AND (LAMBDAP X)
(LESSP M (FIND-M (BODY X) (ADD1 N)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)).
This simplifies, expanding the definitions of TERMP and FIND-M, to:
T.
Case 20.(IMPLIES (AND (LAMBDAP X)
(EQUAL (TRANSLATE (UNTRANS (BODY X) M (ADD1 N))
(BINDINGS M (ADD1 N)))
(BODY X))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)).
This simplifies, rewriting with the lemmas SUB1-ADD1, SUB1-TYPE-RESTRICTION,
NBIND-NLAMBDA, NBODY-NLAMBDA, BODY-LAMBDA, and LAMBDA-BODY, and opening up
the definitions of BINDINGS, TERMP, FIND-M, UNTRANS, and TRANSLATE, to the
new conjecture:
(IMPLIES (AND (LAMBDAP X)
(NOT (NUMBERP N))
(EQUAL (TRANSLATE (UNTRANS (BODY X) M (ADD1 N))
(CONS (PLUS M (ADD1 N))
(BINDINGS M 0)))
(BODY X))
(TERMP (BODY X))
(NOT (LESSP M (FIND-M (BODY X) (ADD1 N)))))
(EQUAL (LAMBDA (TRANSLATE (UNTRANS (BODY X) M (ADD1 N))
(LIST (PLUS M 1))))
X)),
which again simplifies, applying SUB1-TYPE-RESTRICTION and LAMBDA-BODY, and
unfolding EQUAL and BINDINGS, to:
T.
Case 19.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT (TERMP (RIGHT X)))
(NOT (TERMP (LEFT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)).
This simplifies, unfolding TERMP, to:
T.
Case 18.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (RIGHT X) N))
(NOT (TERMP (LEFT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)).
This simplifies, expanding TERMP, to:
T.
Case 17.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(EQUAL (TRANSLATE (UNTRANS (RIGHT X) M N)
(BINDINGS M N))
(RIGHT X))
(NOT (TERMP (LEFT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)).
This simplifies, unfolding TERMP, to:
T.
Case 16.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT (TERMP (RIGHT X)))
(LESSP M (FIND-M (LEFT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)).
This simplifies, unfolding the definition of TERMP, to:
T.
Case 15.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (RIGHT X) N))
(LESSP M (FIND-M (LEFT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)).
This simplifies, opening up the definitions of TERMP and FIND-M, to:
T.
Case 14.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(EQUAL (TRANSLATE (UNTRANS (RIGHT X) M N)
(BINDINGS M N))
(RIGHT X))
(LESSP M (FIND-M (LEFT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)).
This simplifies, rewriting with NRIGHT-NCOMB, NLEFT-NCOMB, and LEFT-COMB,
and expanding the functions TERMP, FIND-M, UNTRANS, and TRANSLATE, to:
(IMPLIES (AND (COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(EQUAL (TRANSLATE (UNTRANS (RIGHT X) M N)
(BINDINGS M N))
(RIGHT X))
(LESSP M (FIND-M (LEFT X) N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (RIGHT X) N))))
(EQUAL (COMB (TRANSLATE (UNTRANS (LEFT X) M N)
(BINDINGS M N))
(RIGHT X))
X)).
This again simplifies, using linear arithmetic, to:
T.
Case 13.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT (TERMP (RIGHT X)))
(EQUAL (TRANSLATE (UNTRANS (LEFT X) M N)
(BINDINGS M N))
(LEFT X))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, opening up the definition of TERMP, to:
T.
Case 12.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (RIGHT X) N))
(EQUAL (TRANSLATE (UNTRANS (LEFT X) M N)
(BINDINGS M N))
(LEFT X))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, opening up the definitions of TERMP and FIND-M, to:
T.
Case 11.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(EQUAL (TRANSLATE (UNTRANS (RIGHT X) M N)
(BINDINGS M N))
(RIGHT X))
(EQUAL (TRANSLATE (UNTRANS (LEFT X) M N)
(BINDINGS M N))
(LEFT X))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, rewriting with the lemmas COMB-LEFT-RIGHT, NRIGHT-NCOMB,
and NLEFT-NCOMB, and expanding TERMP, FIND-M, UNTRANS, and TRANSLATE, to:
T.
Case 10.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT (TERMP (LEFT X)))
(NOT (TERMP (RIGHT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, expanding the definition of TERMP, to:
T.
Case 9. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (LEFT X) N))
(NOT (TERMP (RIGHT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, expanding the function TERMP, to:
T.
Case 8. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(EQUAL (TRANSLATE (UNTRANS (LEFT X) M N)
(BINDINGS M N))
(LEFT X))
(NOT (TERMP (RIGHT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, unfolding TERMP, to:
T.
Case 7. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT (TERMP (LEFT X)))
(LESSP M (FIND-M (RIGHT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, expanding the definition of TERMP, to:
T.
Case 6. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (LEFT X) N))
(LESSP M (FIND-M (RIGHT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, opening up the functions TERMP and FIND-M, to:
T.
Case 5. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(EQUAL (TRANSLATE (UNTRANS (LEFT X) M N)
(BINDINGS M N))
(LEFT X))
(LESSP M (FIND-M (RIGHT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, applying NRIGHT-NCOMB, NLEFT-NCOMB, LEFT-COMB, and
RIGHT-COMB, and opening up the definitions of TERMP, FIND-M, UNTRANS, and
TRANSLATE, to the new goal:
(IMPLIES (AND (COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(EQUAL (TRANSLATE (UNTRANS (LEFT X) M N)
(BINDINGS M N))
(LEFT X))
(LESSP M (FIND-M (RIGHT X) N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (LEFT X) N))))
(EQUAL (COMB (LEFT X)
(TRANSLATE (UNTRANS (RIGHT X) M N)
(BINDINGS M N)))
X)),
which again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT (TERMP (LEFT X)))
(EQUAL (TRANSLATE (UNTRANS (RIGHT X) M N)
(BINDINGS M N))
(RIGHT X))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, unfolding the function TERMP, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (LEFT X) N))
(EQUAL (TRANSLATE (UNTRANS (RIGHT X) M N)
(BINDINGS M N))
(RIGHT X))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, expanding the definitions of TERMP and FIND-M, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(EQUAL (TRANSLATE (UNTRANS (LEFT X) M N)
(BINDINGS M N))
(LEFT X))
(EQUAL (TRANSLATE (UNTRANS (RIGHT X) M N)
(BINDINGS M N))
(RIGHT X))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)),
which simplifies, rewriting with COMB-LEFT-RIGHT, NRIGHT-NCOMB, and
NLEFT-NCOMB, and opening up the definitions of TERMP, FIND-M, UNTRANS, and
TRANSLATE, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (UNTRANS X M N)
(BINDINGS M N))
X)).
This simplifies, appealing to the lemma SUB1-ADD1, and unfolding the
definitions of TERMP, LITATOM, FIND-M, DIFFERENCE, EQUAL, LESSP, UNTRANS,
and TRANSLATE, to the following three new formulas:
Case 1.3.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(NOT (LESSP N X)))
(EQUAL (INDEX (ADD1 (PLUS M (DIFFERENCE N X)))
(BINDINGS M N))
X)).
This again simplifies, clearly, to the new goal:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(NOT (LESSP N X)))
(EQUAL (INDEX (ADD1 (PLUS M (DIFFERENCE N X)))
(BINDINGS M N))
X)),
which we will name *1.1.
Case 1.2.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(LESSP N X)
(NUMBERP N))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) N)
(BINDINGS M N))
X)).
However this again simplifies, rewriting with INDEX-FREEVAR, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(LESSP N X)
(NOT (NUMBERP N)))
(EQUAL (INDEX (DIFFERENCE (SUB1 X) 0)
(BINDINGS M N))
X)).
This again simplifies, opening up the definitions of DIFFERENCE, LESSP,
EQUAL, BINDINGS, LISTP, and INDEX, to two new goals:
Case 1.1.2.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M X))
(NOT (NUMBERP N))
(NOT (EQUAL (SUB1 X) 0)))
(EQUAL (ADD1 (SUB1 X)) X)),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.1.
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M X))
(NOT (NUMBERP N))
(EQUAL (SUB1 X) 0))
(EQUAL 1 X)),
which again simplifies, using linear arithmetic, to:
T.
So we now return to:
(IMPLIES (AND (NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(NOT (LESSP N X)))
(EQUAL (INDEX (ADD1 (PLUS M (DIFFERENCE N X)))
(BINDINGS M N))
X)),
which we named *1.1 above. Let us appeal to the induction principle. The
recursive terms in the conjecture suggest nine 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 M N X))
(IMPLIES (AND (NOT (ZEROP X)) (ZEROP N))
(p M N X))
(IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP N))
(p M (SUB1 N) (SUB1 X)))
(p M N 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. Note,
however, the inductive instance chosen for N. The above induction scheme
generates the following six new formulas:
Case 6. (IMPLIES (AND (ZEROP X)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(NOT (LESSP N X)))
(EQUAL (INDEX (ADD1 (PLUS M (DIFFERENCE N X)))
(BINDINGS M N))
X)).
This simplifies, unfolding the function ZEROP, to:
T.
Case 5. (IMPLIES (AND (NOT (ZEROP X))
(ZEROP N)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(NOT (LESSP N X)))
(EQUAL (INDEX (ADD1 (PLUS M (DIFFERENCE N X)))
(BINDINGS M N))
X)).
This simplifies, unfolding the definitions of ZEROP, EQUAL, DIFFERENCE, and
LESSP, to:
T.
Case 4. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP N))
(EQUAL (SUB1 X) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(NOT (LESSP N X)))
(EQUAL (INDEX (ADD1 (PLUS M (DIFFERENCE N X)))
(BINDINGS M N))
X)).
This simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
opening up ZEROP, DIFFERENCE, LESSP, BINDINGS, and INDEX, to the following
two new conjectures:
Case 4.2.
(IMPLIES
(AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (SUB1 X) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (SUB1 X) (SUB1 N))))
(NOT (LESSP (SUB1 N) (SUB1 X)))
(NOT (EQUAL (PLUS M N)
(ADD1 (PLUS M
(DIFFERENCE (SUB1 N) (SUB1 X)))))))
(EQUAL (ADD1 (INDEX (ADD1 (PLUS M
(DIFFERENCE (SUB1 N) (SUB1 X))))
(BINDINGS M (SUB1 N))))
X)).
However this again simplifies, using linear arithmetic, to:
T.
Case 4.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (SUB1 X) 0)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (SUB1 X) (SUB1 N))))
(NOT (LESSP (SUB1 N) (SUB1 X)))
(EQUAL (PLUS M N)
(ADD1 (PLUS M
(DIFFERENCE (SUB1 N) (SUB1 X))))))
(EQUAL 1 X)),
which again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP N))
(LESSP M
(DIFFERENCE (SUB1 X) (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(NOT (LESSP N X)))
(EQUAL (INDEX (ADD1 (PLUS M (DIFFERENCE N X)))
(BINDINGS M N))
X)),
which simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (SUB1 X) (SUB1 N))
(NOT (ZEROP X))
(NOT (ZEROP N))
(LESSP M
(DIFFERENCE (SUB1 X) (SUB1 N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(NOT (LESSP N X)))
(EQUAL (INDEX (ADD1 (PLUS M (DIFFERENCE N X)))
(BINDINGS M N))
X)).
However this again simplifies, expanding ZEROP and DIFFERENCE, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP X))
(NOT (ZEROP N))
(LESSP (SUB1 N) (SUB1 X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(NOT (LESSP N X)))
(EQUAL (INDEX (ADD1 (PLUS M (DIFFERENCE N X)))
(BINDINGS M N))
X)),
which simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES
(AND (NOT (ZEROP X))
(NOT (ZEROP N))
(EQUAL (INDEX (ADD1 (PLUS M
(DIFFERENCE (SUB1 N) (SUB1 X))))
(BINDINGS M (SUB1 N)))
(SUB1 X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M (DIFFERENCE X N)))
(NOT (LESSP N X)))
(EQUAL (INDEX (ADD1 (PLUS M (DIFFERENCE N X)))
(BINDINGS M N))
X)),
which simplifies, applying ADD1-SUB1, CDR-CONS, and CAR-CONS, and opening up
the functions ZEROP, DIFFERENCE, LESSP, BINDINGS, and INDEX, to:
(IMPLIES
(AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (INDEX (ADD1 (PLUS M
(DIFFERENCE (SUB1 N) (SUB1 X))))
(BINDINGS M (SUB1 N)))
(SUB1 X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (LESSP M
(DIFFERENCE (SUB1 X) (SUB1 N))))
(NOT (LESSP (SUB1 N) (SUB1 X)))
(EQUAL (PLUS M N)
(ADD1 (PLUS M
(DIFFERENCE (SUB1 N) (SUB1 X))))))
(EQUAL 1 X)),
which again simplifies, using linear arithmetic, 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 ]
UNTRANS-TRANS
(PROVE-LEMMA UNTRANS-SUBST
(REWRITE)
(IMPLIES (AND (TERMP X)
(TERMP Y)
(LAMBDAP X)
(LEQ (FIND-M Y N) M)
(LEQ (FIND-M X N) M))
(EQUAL (TRANSLATE (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))
(BINDINGS M N))
(SUBST (BODY X) Y 1)))
((USE (TRANSLATE-PRESERVES-REDUCTION (X (UNTRANS X M N))
(Y (UNTRANS Y M N))
(BOUNDS (BINDINGS M N))))))
This conjecture simplifies, applying the lemmas NTERMP-TERMP, UNTRANS-TRANS,
NBODY-NNLAMBDAP, and NBIND-NNLAMBDAP, and expanding AND, IMPLIES, TERMP, EQUAL,
NUMBERP, NCOMBP, NLAMBDAP, and NSUBST, to two new goals:
Case 2. (IMPLIES (AND (NOT (NLAMBDAP (UNTRANS X M N)))
(TERMP (BODY X))
(TERMP Y)
(LAMBDAP X)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X N))))
(EQUAL Y (SUBST (BODY X) Y 1))).
Applying the lemma BODY-ELIM, replace X by (LAMBDA Z) to eliminate (BODY X).
We thus obtain the new goal:
(IMPLIES (AND (NOT (NLAMBDAP (UNTRANS (LAMBDA Z) M N)))
(TERMP Z)
(TERMP Y)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M (LAMBDA Z) N))))
(EQUAL Y (SUBST Z Y 1))),
which further simplifies, rewriting with the lemma BODY-LAMBDA, and
expanding the function UNTRANS, to:
T.
Case 1. (IMPLIES (AND (NOT (FREE-FOR (NBODY (UNTRANS X M N))
(UNTRANS Y M N)))
(TERMP (BODY X))
(TERMP Y)
(LAMBDAP X)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X N))))
(EQUAL (TRANSLATE (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))
(BINDINGS M N))
(SUBST (BODY X) Y 1))).
Applying the lemma BODY-ELIM, replace X by (LAMBDA Z) to eliminate (BODY X).
We thus obtain:
(IMPLIES (AND (NOT (FREE-FOR (NBODY (UNTRANS (LAMBDA Z) M N))
(UNTRANS Y M N)))
(TERMP Z)
(TERMP Y)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M (LAMBDA Z) N))))
(EQUAL (TRANSLATE (NSUBST (NBODY (UNTRANS (LAMBDA Z) M N))
(UNTRANS Y M N)
(NBIND (UNTRANS (LAMBDA Z) M N)))
(BINDINGS M N))
(SUBST Z Y 1))),
which further simplifies, using linear arithmetic, rewriting with the lemmas
BODY-LAMBDA, NBODY-NLAMBDA, and FREE-FOR-UNTRANS, and expanding the
definition of UNTRANS, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
UNTRANS-SUBST
(PROVE-LEMMA LITATOM-TRANSLATE
(REWRITE)
(IMPLIES (LITATOM (TRANSLATE A BOUNDS))
(EQUAL (TRANSLATE A BOUNDS) A)))
WARNING: Note that the proposed lemma LITATOM-TRANSLATE is to be stored as
one type prescription rule, zero compound recognizer rules, zero linear rules,
and zero replacement rules.
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 (AND (NLAMBDAP A)
(p (NBODY A) (CONS (NBIND A) BOUNDS)))
(p A BOUNDS))
(IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(p (NRIGHT A) BOUNDS)
(p (NLEFT A) BOUNDS))
(p A BOUNDS))
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NUMBERP A))
(p A BOUNDS))
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP A)))
(p A BOUNDS))).
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and NLEFT-LESSP
inform us that the measure (COUNT A) decreases according to the well-founded
relation LESSP in each induction step of the scheme. Note, however, the
inductive instances chosen for BOUNDS. The above induction scheme generates
eight new goals:
Case 8. (IMPLIES (AND (NLAMBDAP A)
(NOT (LITATOM (TRANSLATE (NBODY A)
(CONS (NBIND A) BOUNDS))))
(LITATOM (TRANSLATE A BOUNDS)))
(EQUAL (TRANSLATE A BOUNDS) A)),
which simplifies, clearly, to:
T.
Case 7. (IMPLIES (AND (NLAMBDAP A)
(EQUAL (TRANSLATE (NBODY A)
(CONS (NBIND A) BOUNDS))
(NBODY A))
(LITATOM (TRANSLATE A BOUNDS)))
(EQUAL (TRANSLATE A BOUNDS) A)).
This simplifies, trivially, to:
T.
Case 6. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (LITATOM (TRANSLATE (NRIGHT A) BOUNDS)))
(NOT (LITATOM (TRANSLATE (NLEFT A) BOUNDS)))
(LITATOM (TRANSLATE A BOUNDS)))
(EQUAL (TRANSLATE A BOUNDS) A)).
This simplifies, trivially, to:
T.
Case 5. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(EQUAL (TRANSLATE (NRIGHT A) BOUNDS)
(NRIGHT A))
(NOT (LITATOM (TRANSLATE (NLEFT A) BOUNDS)))
(LITATOM (TRANSLATE A BOUNDS)))
(EQUAL (TRANSLATE A BOUNDS) A)).
This simplifies, trivially, to:
T.
Case 4. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (LITATOM (TRANSLATE (NRIGHT A) BOUNDS)))
(EQUAL (TRANSLATE (NLEFT A) BOUNDS)
(NLEFT A))
(LITATOM (TRANSLATE A BOUNDS)))
(EQUAL (TRANSLATE A BOUNDS) A)).
This simplifies, trivially, to:
T.
Case 3. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(EQUAL (TRANSLATE (NRIGHT A) BOUNDS)
(NRIGHT A))
(EQUAL (TRANSLATE (NLEFT A) BOUNDS)
(NLEFT A))
(LITATOM (TRANSLATE A BOUNDS)))
(EQUAL (TRANSLATE A BOUNDS) A)).
This simplifies, trivially, to:
T.
Case 2. (IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NUMBERP A)
(LITATOM (TRANSLATE A BOUNDS)))
(EQUAL (TRANSLATE A BOUNDS) A)).
This simplifies, trivially, to:
T.
Case 1. (IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(LITATOM (TRANSLATE A BOUNDS)))
(EQUAL (TRANSLATE A BOUNDS) A)).
This simplifies, unfolding the definition of TRANSLATE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LITATOM-TRANSLATE
(PROVE-LEMMA TRANSLATE-ALPHA
(REWRITE)
(IMPLIES (AND (NTERMP A)
(NTERMP B)
(EQUAL (TRANSLATE A BOUNDS)
(TRANSLATE B BOUNDS2)))
(ALPHA-EQUAL A B BOUNDS BOUNDS2))
((INDUCT (ALPHA-EQUAL A B BOUNDS BOUNDS2))
(USE (LITATOM-TRANSLATE)
(LITATOM-TRANSLATE (A B)
(BOUNDS BOUNDS2)))))
This simplifies, unfolding the functions TRANSLATE, IMPLIES, AND, NOT, NTERMP,
ALPHA-EQUAL, and OR, to 11 new goals:
Case 11.(IMPLIES (AND (NLAMBDAP A)
(NLAMBDAP B)
(NTERMP (NBODY A))
(NTERMP (NBODY B))
(NOT (EQUAL (TRANSLATE (NBODY A)
(CONS (NBIND A) BOUNDS))
(TRANSLATE (NBODY B)
(CONS (NBIND B) BOUNDS2))))
(EQUAL (LAMBDA (TRANSLATE (NBODY A)
(CONS (NBIND A) BOUNDS)))
(LAMBDA (TRANSLATE (NBODY B)
(CONS (NBIND B) BOUNDS2)))))
(ALPHA-EQUAL (NBODY A)
(NBODY B)
(CONS (NBIND A) BOUNDS)
(CONS (NBIND B) BOUNDS2))),
which again simplifies, applying BODY-LAMBDA, to:
T.
Case 10.(IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NCOMBP B)
(NTERMP (NRIGHT A))
(NTERMP (NRIGHT B))
(NOT (EQUAL (TRANSLATE (NRIGHT A) BOUNDS)
(TRANSLATE (NRIGHT B) BOUNDS2)))
(NTERMP (NLEFT A))
(NTERMP (NLEFT B))
(ALPHA-EQUAL (NLEFT A)
(NLEFT B)
BOUNDS BOUNDS2)
(NOT (NLAMBDAP B))
(EQUAL (COMB (TRANSLATE (NLEFT A) BOUNDS)
(TRANSLATE (NRIGHT A) BOUNDS))
(COMB (TRANSLATE (NLEFT B) BOUNDS2)
(TRANSLATE (NRIGHT B) BOUNDS2))))
(ALPHA-EQUAL (NRIGHT A)
(NRIGHT B)
BOUNDS BOUNDS2)).
However this again simplifies, applying NTERMP-ASTEP, ALPHA-TRANSLATE,
LEFT-COMB, and RIGHT-COMB, to:
T.
Case 9. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NCOMBP B)
(NTERMP (NRIGHT A))
(NTERMP (NRIGHT B))
(NOT (EQUAL (TRANSLATE (NRIGHT A) BOUNDS)
(TRANSLATE (NRIGHT B) BOUNDS2)))
(NTERMP (NLEFT A))
(NTERMP (NLEFT B))
(NOT (EQUAL (TRANSLATE (NLEFT A) BOUNDS)
(TRANSLATE (NLEFT B) BOUNDS2)))
(NOT (NLAMBDAP B))
(EQUAL (COMB (TRANSLATE (NLEFT A) BOUNDS)
(TRANSLATE (NRIGHT A) BOUNDS))
(COMB (TRANSLATE (NLEFT B) BOUNDS2)
(TRANSLATE (NRIGHT B) BOUNDS2))))
(ALPHA-EQUAL (NLEFT A)
(NLEFT B)
BOUNDS BOUNDS2)).
This again simplifies, rewriting with the lemma LEFT-COMB, to:
T.
Case 8. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NCOMBP B)
(NTERMP (NRIGHT A))
(NTERMP (NRIGHT B))
(NOT (EQUAL (TRANSLATE (NRIGHT A) BOUNDS)
(TRANSLATE (NRIGHT B) BOUNDS2)))
(NTERMP (NLEFT A))
(NTERMP (NLEFT B))
(NOT (EQUAL (TRANSLATE (NLEFT A) BOUNDS)
(TRANSLATE (NLEFT B) BOUNDS2)))
(NOT (NLAMBDAP B))
(EQUAL (COMB (TRANSLATE (NLEFT A) BOUNDS)
(TRANSLATE (NRIGHT A) BOUNDS))
(COMB (TRANSLATE (NLEFT B) BOUNDS2)
(TRANSLATE (NRIGHT B) BOUNDS2))))
(ALPHA-EQUAL (NRIGHT A)
(NRIGHT B)
BOUNDS BOUNDS2)),
which again simplifies, applying LEFT-COMB, to:
T.
Case 7. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NCOMBP B)
(NTERMP (NRIGHT A))
(NTERMP (NRIGHT B))
(ALPHA-EQUAL (NRIGHT A)
(NRIGHT B)
BOUNDS BOUNDS2)
(NTERMP (NLEFT A))
(NTERMP (NLEFT B))
(NOT (EQUAL (TRANSLATE (NLEFT A) BOUNDS)
(TRANSLATE (NLEFT B) BOUNDS2)))
(NOT (NLAMBDAP B))
(EQUAL (COMB (TRANSLATE (NLEFT A) BOUNDS)
(TRANSLATE (NRIGHT A) BOUNDS))
(COMB (TRANSLATE (NLEFT B) BOUNDS2)
(TRANSLATE (NRIGHT B) BOUNDS2))))
(ALPHA-EQUAL (NLEFT A)
(NLEFT B)
BOUNDS BOUNDS2)).
This again simplifies, applying the lemmas NTERMP-ASTEP, ALPHA-TRANSLATE,
and LEFT-COMB, to:
T.
Case 6. (IMPLIES (AND (NLAMBDAP A)
(NOT (NLAMBDAP B))
(NTERMP (NBODY A))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(LITATOM B))
(NOT (EQUAL (LAMBDA (TRANSLATE (NBODY A)
(CONS (NBIND A) BOUNDS)))
B))),
which again simplifies, trivially, to:
T.
Case 5. (IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NUMBERP A)
(NOT (NUMBERP B))
(NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(LITATOM B))
(NOT (EQUAL (INDEX A BOUNDS) B))).
This again simplifies, trivially, to:
T.
Case 4. (IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(LITATOM A)
(NOT (NLAMBDAP B))
(NCOMBP B)
(NTERMP (NLEFT B))
(NTERMP (NRIGHT B))
(EQUAL A
(COMB (TRANSLATE (NLEFT B) BOUNDS2)
(TRANSLATE (NRIGHT B) BOUNDS2))))
(EQUAL A B)).
This again simplifies, clearly, to:
T.
Case 3. (IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(LITATOM A)
(NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NUMBERP B)
(EQUAL A (INDEX B BOUNDS2)))
(EQUAL A B)).
This again simplifies, clearly, to:
T.
Case 2. (IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(LITATOM A)
(NLAMBDAP B)
(NTERMP (NBODY B))
(EQUAL A
(LAMBDA (TRANSLATE (NBODY B)
(CONS (NBIND B) BOUNDS2)))))
(EQUAL A B)).
This again simplifies, clearly, to:
T.
Case 1. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (NCOMBP B))
(NTERMP (NLEFT A))
(NTERMP (NRIGHT A))
(NOT (NLAMBDAP B))
(NOT (NUMBERP B))
(LITATOM B))
(NOT (EQUAL (COMB (TRANSLATE (NLEFT A) BOUNDS)
(TRANSLATE (NRIGHT A) BOUNDS))
B))).
This again simplifies, trivially, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
TRANSLATE-ALPHA
(PROVE-LEMMA TERMP-BUMP
(REWRITE)
(IMPLIES (TERMP X)
(TERMP (BUMP X N))))
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 (LAMBDAP X)
(p (BODY X) (ADD1 N)))
(p X N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(p (RIGHT X) N)
(p (LEFT X) N))
(p X N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP N X))
(p X N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X)))
(p X N))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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 instances chosen for N. The above induction scheme
generates the following eight new formulas:
Case 8. (IMPLIES (AND (LAMBDAP X)
(NOT (TERMP (BODY X)))
(TERMP X))
(TERMP (BUMP X N))).
This simplifies, expanding the definition of TERMP, to:
T.
Case 7. (IMPLIES (AND (LAMBDAP X)
(TERMP (BUMP (BODY X) (ADD1 N)))
(TERMP X))
(TERMP (BUMP X N))).
This simplifies, appealing to the lemma BODY-LAMBDA, and opening up TERMP
and BUMP, to:
T.
Case 6. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (TERMP (RIGHT X)))
(NOT (TERMP (LEFT X)))
(TERMP X))
(TERMP (BUMP X N))).
This simplifies, unfolding TERMP, to:
T.
Case 5. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(TERMP (BUMP (RIGHT X) N))
(NOT (TERMP (LEFT X)))
(TERMP X))
(TERMP (BUMP X N))).
This simplifies, unfolding the definition of TERMP, to:
T.
Case 4. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (TERMP (RIGHT X)))
(TERMP (BUMP (LEFT X) N))
(TERMP X))
(TERMP (BUMP X N))).
This simplifies, opening up the function TERMP, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(TERMP (BUMP (RIGHT X) N))
(TERMP (BUMP (LEFT X) N))
(TERMP X))
(TERMP (BUMP X N))).
This simplifies, rewriting with RIGHT-COMB and LEFT-COMB, and opening up the
definitions of TERMP and BUMP, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP N X)
(TERMP X))
(TERMP (BUMP X N))),
which simplifies, unfolding the functions TERMP, LITATOM, BUMP, and LESSP,
to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X))
(TERMP X))
(TERMP (BUMP X N))),
which simplifies, unfolding the definitions of TERMP, LITATOM, BUMP, and
LESSP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
TERMP-BUMP
(PROVE-LEMMA TERMP-SUBST
(REWRITE)
(IMPLIES (AND (TERMP X)
(TERMP Y)
(NOT (ZEROP N)))
(TERMP (SUBST X Y N))))
This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and
IMPLIES, to the new conjecture:
(IMPLIES (AND (TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))),
which we will name *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 (LAMBDAP X)
(p (BODY X) (BUMP Y 0) (ADD1 N)))
(p X Y N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(p (RIGHT X) Y N)
(p (LEFT X) Y N))
(p X Y N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (ZEROP X))
(EQUAL X N))
(p X Y N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (ZEROP X))
(NOT (EQUAL X N))
(LESSP N X))
(p X Y N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (ZEROP X))
(NOT (EQUAL X N))
(NOT (LESSP N X)))
(p X Y N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(ZEROP X))
(p X Y N))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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. Note,
however, the inductive instances chosen for Y and N. The above induction
scheme produces 12 new formulas:
Case 12.(IMPLIES (AND (LAMBDAP X)
(NOT (TERMP (BODY X)))
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))),
which simplifies, opening up the definition of TERMP, to:
T.
Case 11.(IMPLIES (AND (LAMBDAP X)
(NOT (TERMP (BUMP Y 0)))
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))),
which simplifies, appealing to the lemma TERMP-BUMP, to:
T.
Case 10.(IMPLIES (AND (LAMBDAP X)
(EQUAL (ADD1 N) 0)
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))),
which simplifies, using linear arithmetic, to:
T.
Case 9. (IMPLIES (AND (LAMBDAP X)
(TERMP (SUBST (BODY X) (BUMP Y 0) (ADD1 N)))
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))),
which simplifies, rewriting with BODY-LAMBDA, and expanding the definitions
of TERMP and SUBST, to:
T.
Case 8. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (TERMP (RIGHT X)))
(NOT (TERMP (LEFT X)))
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))).
This simplifies, opening up the function TERMP, to:
T.
Case 7. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(TERMP (SUBST (RIGHT X) Y N))
(NOT (TERMP (LEFT X)))
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))).
This simplifies, expanding TERMP, to:
T.
Case 6. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (TERMP (RIGHT X)))
(TERMP (SUBST (LEFT X) Y N))
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))).
This simplifies, opening up TERMP, to:
T.
Case 5. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(TERMP (SUBST (RIGHT X) Y N))
(TERMP (SUBST (LEFT X) Y N))
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))).
This simplifies, rewriting with RIGHT-COMB and LEFT-COMB, and expanding the
functions TERMP and SUBST, to:
T.
Case 4. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (ZEROP X))
(EQUAL X N)
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))),
which simplifies, unfolding the definitions of ZEROP, TERMP, and SUBST, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (ZEROP X))
(NOT (EQUAL X N))
(LESSP N X)
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))),
which simplifies, unfolding ZEROP, TERMP, SUBST, and LITATOM, to:
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL X N))
(LESSP N X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(NOT (EQUAL (SUB1 X) 0))).
This again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (ZEROP X))
(NOT (EQUAL X N))
(NOT (LESSP N X))
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))),
which simplifies, expanding the functions ZEROP, TERMP, and SUBST, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(ZEROP X)
(TERMP X)
(TERMP Y)
(NOT (EQUAL N 0))
(NUMBERP N))
(TERMP (SUBST X Y N))),
which simplifies, opening up ZEROP, TERMP, and SUBST, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
TERMP-SUBST
(DEFN MAKE-BSTEP
(A B)
(IF (EQUAL A B)
NIL
(IF (AND (LAMBDAP A) (LAMBDAP B))
(MAKE-BSTEP (BODY A) (BODY B))
(IF (COMBP A)
(IF (AND (LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(LIST NIL NIL 'REDUCE)
(LIST (MAKE-BSTEP (LEFT A) (LEFT B))
(MAKE-BSTEP (RIGHT A) (RIGHT B))))
NIL))))
Linear arithmetic, the lemmas BODY-LESSEQP, BODY-LESSP, RIGHT-LESSP, and
LEFT-LESSP, and the definition of AND inform us that the measure (COUNT A)
decreases according to the well-founded relation LESSP in each recursive call.
Hence, MAKE-BSTEP is accepted under the definitional principle. Observe that:
(OR (LITATOM (MAKE-BSTEP A B))
(LISTP (MAKE-BSTEP A B)))
is a theorem.
[ 0.0 0.0 0.0 ]
MAKE-BSTEP
(DEFN BSTEP
(W X)
(IF (LAMBDAP X)
(LAMBDA (BSTEP W (BODY X)))
(IF (COMBP X)
(IF (AND (LAMBDAP (LEFT X))
(EQUAL (COMMAND W) 'REDUCE))
(SUBST (BODY (LEFT X)) (RIGHT X) 1)
(COMB (BSTEP (LEFT-INSTRS W) (LEFT X))
(BSTEP (RIGHT-INSTRS W) (RIGHT X))))
X)))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
inform us that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, BSTEP is accepted under the
definitional principle.
[ 0.0 0.0 0.0 ]
BSTEP
(PROVE-LEMMA MAKE-BSTEP-BETA-STEP
(REWRITE)
(IMPLIES (BETA-STEP A B)
(EQUAL (BSTEP (MAKE-BSTEP A B) A) B)))
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 (EQUAL A B) (p A B))
(IMPLIES (AND (NOT (EQUAL A B))
(LAMBDAP A)
(p (BODY A) (BODY B)))
(p A B))
(IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(p (RIGHT A) (RIGHT B))
(p (LEFT A) (LEFT B)))
(p A B))
(IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(NOT (COMBP A)))
(p A B))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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. Note,
however, the inductive instances chosen for B. The above induction scheme
leads to eight new goals:
Case 8. (IMPLIES (AND (EQUAL A B) (BETA-STEP A B))
(EQUAL (BSTEP (MAKE-BSTEP A B) A) B)),
which simplifies, opening up the definitions of BETA-STEP and MAKE-BSTEP, to
the conjecture:
(EQUAL (BSTEP NIL B) B).
Call the above conjecture *1.1.
Case 7. (IMPLIES (AND (NOT (EQUAL A B))
(LAMBDAP A)
(NOT (BETA-STEP (BODY A) (BODY B)))
(BETA-STEP A B))
(EQUAL (BSTEP (MAKE-BSTEP A B) A) B)).
This simplifies, expanding the function BETA-STEP, to:
T.
Case 6. (IMPLIES (AND (NOT (EQUAL A B))
(LAMBDAP A)
(EQUAL (BSTEP (MAKE-BSTEP (BODY A) (BODY B))
(BODY A))
(BODY B))
(BETA-STEP A B))
(EQUAL (BSTEP (MAKE-BSTEP A B) A) B)).
This simplifies, appealing to the lemma LAMBDA-BODY, and expanding the
functions BETA-STEP, MAKE-BSTEP, and BSTEP, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(NOT (BETA-STEP (RIGHT A) (RIGHT B)))
(NOT (BETA-STEP (LEFT A) (LEFT B)))
(BETA-STEP A B))
(EQUAL (BSTEP (MAKE-BSTEP A B) A) B)).
This simplifies, opening up the functions BETA-STEP, MAKE-BSTEP, EQUAL,
COMMAND, and BSTEP, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(EQUAL (BSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(RIGHT A))
(RIGHT B))
(NOT (BETA-STEP (LEFT A) (LEFT B)))
(BETA-STEP A B))
(EQUAL (BSTEP (MAKE-BSTEP A B) A) B)).
This simplifies, unfolding the definitions of BETA-STEP, MAKE-BSTEP, EQUAL,
COMMAND, and BSTEP, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(NOT (BETA-STEP (RIGHT A) (RIGHT B)))
(EQUAL (BSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(LEFT A))
(LEFT B))
(BETA-STEP A B))
(EQUAL (BSTEP (MAKE-BSTEP A B) A) B)).
This simplifies, unfolding the definitions of BETA-STEP, MAKE-BSTEP, EQUAL,
COMMAND, and BSTEP, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(EQUAL (BSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(RIGHT A))
(RIGHT B))
(EQUAL (BSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(LEFT A))
(LEFT B))
(BETA-STEP A B))
(EQUAL (BSTEP (MAKE-BSTEP A B) A) B)).
This simplifies, unfolding the definitions of BETA-STEP, MAKE-BSTEP, EQUAL,
COMMAND, and BSTEP, to the following three new formulas:
Case 2.3.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(EQUAL (BSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(RIGHT A))
(RIGHT B))
(EQUAL (BSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(LEFT A))
(LEFT B))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(EQUAL (BSTEP (LIST (MAKE-BSTEP (LEFT A) (LEFT B))
(MAKE-BSTEP (RIGHT A) (RIGHT B)))
A)
B)).
However this again simplifies, applying COMB-LEFT-RIGHT, CAR-CONS, and
CDR-CONS, and unfolding RIGHT-INSTRS, LEFT-INSTRS, EQUAL, COMMAND, CAR,
and BSTEP, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(EQUAL (BSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(RIGHT A))
(RIGHT B))
(EQUAL (BSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(LEFT A))
(LEFT B))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(NOT (LAMBDAP (LEFT A))))
(EQUAL (BSTEP (LIST (MAKE-BSTEP (LEFT A) (LEFT B))
(MAKE-BSTEP (RIGHT A) (RIGHT B)))
A)
B)).
However this again simplifies, appealing to the lemmas COMB-LEFT-RIGHT,
CDR-CONS, and CAR-CONS, and opening up the definitions of RIGHT-INSTRS,
LEFT-INSTRS, and BSTEP, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(EQUAL (BSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(RIGHT A))
(RIGHT B))
(EQUAL (BSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(LEFT A))
(LEFT B))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(EQUAL (BSTEP '(NIL NIL REDUCE) A)
B)),
which again simplifies, expanding EQUAL, COMMAND, and BSTEP, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(NOT (COMBP A))
(BETA-STEP A B))
(EQUAL (BSTEP (MAKE-BSTEP A B) A) B)),
which simplifies, opening up the function BETA-STEP, to:
T.
So next consider:
(EQUAL (BSTEP NIL B) B),
which we named *1.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 (AND (LAMBDAP B) (p (BODY B)))
(p B))
(IMPLIES (AND (NOT (LAMBDAP B))
(COMBP B)
(AND (LAMBDAP (LEFT B))
(EQUAL (COMMAND NIL) 'REDUCE)))
(p B))
(IMPLIES (AND (NOT (LAMBDAP B))
(COMBP B)
(NOT (AND (LAMBDAP (LEFT B))
(EQUAL (COMMAND NIL) 'REDUCE)))
(p (RIGHT B))
(p (LEFT B)))
(p B))
(IMPLIES (AND (NOT (LAMBDAP B))
(NOT (COMBP B)))
(p B))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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 leads to four new goals:
Case 4. (IMPLIES (AND (LAMBDAP B)
(EQUAL (BSTEP NIL (BODY B)) (BODY B)))
(EQUAL (BSTEP NIL B) B)),
which simplifies, applying the lemma LAMBDA-BODY, and opening up the
function BSTEP, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP B))
(COMBP B)
(AND (LAMBDAP (LEFT B))
(EQUAL (COMMAND NIL) 'REDUCE)))
(EQUAL (BSTEP NIL B) B)),
which simplifies, opening up the functions COMMAND, EQUAL, and AND, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP B))
(COMBP B)
(NOT (AND (LAMBDAP (LEFT B))
(EQUAL (COMMAND NIL) 'REDUCE)))
(EQUAL (BSTEP NIL (RIGHT B))
(RIGHT B))
(EQUAL (BSTEP NIL (LEFT B)) (LEFT B)))
(EQUAL (BSTEP NIL B) B)),
which simplifies, rewriting with LEFT-COMB, and unfolding COMMAND, EQUAL,
AND, BSTEP, LEFT-INSTRS, and RIGHT-INSTRS, to the new formula:
(IMPLIES (AND (COMBP B)
(EQUAL (BSTEP NIL (RIGHT B))
(RIGHT B))
(EQUAL (BSTEP NIL (LEFT B)) (LEFT B)))
(EQUAL (COMB (BSTEP 0 (LEFT B))
(BSTEP 0 (RIGHT B)))
B)).
Applying the lemma LEFT-RIGHT-ELIM, replace B by (COMB Z X) to eliminate
(RIGHT B) and (LEFT B). We would thus like to prove:
(IMPLIES (AND (EQUAL (BSTEP NIL X) X)
(EQUAL (BSTEP NIL Z) Z))
(EQUAL (COMB (BSTEP 0 Z) (BSTEP 0 X))
(COMB Z X))),
which further simplifies, appealing to the lemmas LEFT-COMB and COMB-EQUAL,
to two new conjectures:
Case 2.2.
(IMPLIES (AND (EQUAL (BSTEP NIL X) X)
(EQUAL (BSTEP NIL Z) Z))
(EQUAL (BSTEP 0 Z) Z)).
We use the second equality hypothesis by cross-fertilizing (BSTEP NIL Z)
for Z and throwing away the equality. This generates the formula:
(IMPLIES (EQUAL (BSTEP NIL X) X)
(EQUAL (BSTEP 0 Z) (BSTEP NIL Z))).
Call the above conjecture *1.1.1.
Case 2.1.
(IMPLIES (AND (EQUAL (BSTEP NIL X) X)
(EQUAL (BSTEP NIL Z) Z))
(EQUAL (BSTEP 0 X) X)).
We use the first equality hypothesis by cross-fertilizing (BSTEP NIL X)
for X and throwing away the equality. We would thus like to prove:
(IMPLIES (EQUAL (BSTEP NIL Z) Z)
(EQUAL (BSTEP 0 X) (BSTEP NIL X))),
which we will name *1.1.2.
Case 1. (IMPLIES (AND (NOT (LAMBDAP B))
(NOT (COMBP B)))
(EQUAL (BSTEP NIL B) B)).
This simplifies, expanding the function BSTEP, to:
T.
So next consider:
(IMPLIES (EQUAL (BSTEP NIL Z) Z)
(EQUAL (BSTEP 0 X) (BSTEP NIL X))),
which we named *1.1.2 above. But this conjecture is subsumed by formula
*1.1.1 above.
So next consider:
(IMPLIES (EQUAL (BSTEP NIL X) X)
(EQUAL (BSTEP 0 Z) (BSTEP NIL Z))),
named *1.1.1 above. We will appeal to induction. There are three plausible
inductions. 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 (AND (LAMBDAP Z) (p (BODY Z) X))
(p Z X))
(IMPLIES (AND (NOT (LAMBDAP Z))
(COMBP Z)
(AND (LAMBDAP (LEFT Z))
(EQUAL (COMMAND 0) 'REDUCE)))
(p Z X))
(IMPLIES (AND (NOT (LAMBDAP Z))
(COMBP Z)
(NOT (AND (LAMBDAP (LEFT Z))
(EQUAL (COMMAND 0) 'REDUCE)))
(p (LEFT Z) X)
(p (RIGHT Z) X))
(p Z X))
(IMPLIES (AND (NOT (LAMBDAP Z))
(NOT (COMBP Z)))
(p Z X))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP can
be used to show 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 four new conjectures:
Case 4. (IMPLIES (AND (LAMBDAP Z)
(EQUAL (BSTEP 0 (BODY Z))
(BSTEP NIL (BODY Z)))
(EQUAL (BSTEP NIL X) X))
(EQUAL (BSTEP 0 Z) (BSTEP NIL Z))),
which simplifies, unfolding the function BSTEP, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP Z))
(COMBP Z)
(AND (LAMBDAP (LEFT Z))
(EQUAL (COMMAND 0) 'REDUCE))
(EQUAL (BSTEP NIL X) X))
(EQUAL (BSTEP 0 Z) (BSTEP NIL Z))),
which simplifies, expanding the functions COMMAND, EQUAL, and AND, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP Z))
(COMBP Z)
(NOT (AND (LAMBDAP (LEFT Z))
(EQUAL (COMMAND 0) 'REDUCE)))
(EQUAL (BSTEP 0 (LEFT Z))
(BSTEP NIL (LEFT Z)))
(EQUAL (BSTEP 0 (RIGHT Z))
(BSTEP NIL (RIGHT Z)))
(EQUAL (BSTEP NIL X) X))
(EQUAL (BSTEP 0 Z) (BSTEP NIL Z))),
which simplifies, opening up the definitions of COMMAND, EQUAL, AND, BSTEP,
LEFT-INSTRS, and RIGHT-INSTRS, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP Z))
(NOT (COMBP Z))
(EQUAL (BSTEP NIL X) X))
(EQUAL (BSTEP 0 Z) (BSTEP NIL Z))),
which simplifies, opening up the function BSTEP, to:
T.
That finishes the proof of *1.1.1, which finishes the proof of *1.1,
which finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.1 ]
MAKE-BSTEP-BETA-STEP
(DEFN NBSTEP
(W X)
(IF (NLAMBDAP X)
(NLAMBDA (NBIND X)
(NBSTEP W (NBODY X)))
(IF (NCOMBP X)
(IF (AND (NLAMBDAP (NLEFT X))
(EQUAL (COMMAND W) 'REDUCE))
(NSUBST (NBODY (NLEFT X))
(NRIGHT X)
(NBIND (NLEFT X)))
(NCOMB (NBSTEP (LEFT-INSTRS W) (NLEFT X))
(NBSTEP (RIGHT-INSTRS W) (NRIGHT X))))
X)))
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and
NLEFT-LESSP inform us that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each recursive call. Hence, NBSTEP is accepted
under the principle of definition.
[ 0.0 0.0 0.0 ]
NBSTEP
(PROVE-LEMMA LAMBDAP-UNTRANS
(REWRITE)
(IMPLIES (TERMP X)
(EQUAL (NLAMBDAP (UNTRANS X M N))
(LAMBDAP X))))
Name the conjecture *1.
Let us appeal to the induction principle. 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 (LAMBDAP X)
(p (BODY X) M (ADD1 N)))
(p X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(p (RIGHT X) M N)
(p (LEFT X) M N))
(p X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP N X))
(p X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X))
(NOT (ZEROP X)))
(p X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X))
(ZEROP X))
(p X M N))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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 instances chosen for N. The above induction scheme
leads to the following nine new goals:
Case 9. (IMPLIES (AND (LAMBDAP X)
(NOT (TERMP (BODY X)))
(TERMP X))
(EQUAL (NLAMBDAP (UNTRANS X M N))
(LAMBDAP X))).
This simplifies, expanding the definition of TERMP, to:
T.
Case 8. (IMPLIES (AND (LAMBDAP X)
(EQUAL (NLAMBDAP (UNTRANS (BODY X) M (ADD1 N)))
(LAMBDAP (BODY X)))
(TERMP X))
(EQUAL (NLAMBDAP (UNTRANS X M N))
(LAMBDAP X))).
This simplifies, unfolding TERMP, UNTRANS, and EQUAL, to:
T.
Case 7. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (TERMP (RIGHT X)))
(NOT (TERMP (LEFT X)))
(TERMP X))
(EQUAL (NLAMBDAP (UNTRANS X M N))
(LAMBDAP X))).
This simplifies, unfolding the definition of TERMP, to:
T.
Case 6. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(EQUAL (NLAMBDAP (UNTRANS (RIGHT X) M N))
(LAMBDAP (RIGHT X)))
(NOT (TERMP (LEFT X)))
(TERMP X))
(EQUAL (NLAMBDAP (UNTRANS X M N))
(LAMBDAP X))).
This simplifies, expanding the definition of TERMP, to:
T.
Case 5. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (TERMP (RIGHT X)))
(EQUAL (NLAMBDAP (UNTRANS (LEFT X) M N))
(LAMBDAP (LEFT X)))
(TERMP X))
(EQUAL (NLAMBDAP (UNTRANS X M N))
(LAMBDAP X))).
This simplifies, expanding the definition of TERMP, to:
T.
Case 4. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(EQUAL (NLAMBDAP (UNTRANS (RIGHT X) M N))
(LAMBDAP (RIGHT X)))
(EQUAL (NLAMBDAP (UNTRANS (LEFT X) M N))
(LAMBDAP (LEFT X)))
(TERMP X))
(EQUAL (NLAMBDAP (UNTRANS X M N))
(LAMBDAP X))).
This simplifies, expanding the functions TERMP, UNTRANS, and EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(LESSP N X)
(TERMP X))
(EQUAL (NLAMBDAP (UNTRANS X M N))
(LAMBDAP X))).
This simplifies, applying the lemma SUB1-ADD1, and unfolding TERMP, LITATOM,
UNTRANS, LESSP, EQUAL, and DIFFERENCE, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X))
(NOT (ZEROP X))
(TERMP X))
(EQUAL (NLAMBDAP (UNTRANS X M N))
(LAMBDAP X))).
This simplifies, unfolding the definitions of ZEROP, TERMP, UNTRANS, and
EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP N X))
(ZEROP X)
(TERMP X))
(EQUAL (NLAMBDAP (UNTRANS X M N))
(LAMBDAP X))).
This simplifies, expanding the functions ZEROP, TERMP, UNTRANS, LESSP, and
EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.2 ]
LAMBDAP-UNTRANS
(DEFN FIND-M-SUBST-IND
(X Y M N IND)
(IF (LAMBDAP X)
(FIND-M-SUBST-IND (BODY X)
(BUMP Y 0)
M
(ADD1 N)
(ADD1 IND))
(IF (COMBP X)
(AND (FIND-M-SUBST-IND (LEFT X) Y M N IND)
(FIND-M-SUBST-IND (RIGHT X)
Y M N IND))
T)))
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-LESSP
can be used to establish that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each recursive call. Hence, FIND-M-SUBST-IND
is accepted under the definitional principle. Note that:
(TRUEP (FIND-M-SUBST-IND X Y M N IND))
is a theorem.
[ 0.0 0.0 0.0 ]
FIND-M-SUBST-IND
(PROVE-LEMMA FIND-M-BUMP
(REWRITE)
(NOT (LESSP (FIND-M Y N)
(FIND-M (BUMP Y COUNT) (ADD1 N)))))
WARNING: Note that the proposed lemma FIND-M-BUMP is to be stored as zero
type prescription rules, zero compound recognizer rules, one linear rule, and
zero replacement rules.
Name the conjecture *1.
Let us appeal to the induction principle. 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 (LAMBDAP Y)
(p (BODY Y) (ADD1 N) (ADD1 COUNT)))
(p Y N COUNT))
(IMPLIES (AND (NOT (LAMBDAP Y))
(COMBP Y)
(LESSP (FIND-M (LEFT Y) N)
(FIND-M (RIGHT Y) N))
(p (RIGHT Y) N COUNT)
(p (LEFT Y) N COUNT))
(p Y N COUNT))
(IMPLIES (AND (NOT (LAMBDAP Y))
(COMBP Y)
(NOT (LESSP (FIND-M (LEFT Y) N)
(FIND-M (RIGHT Y) N)))
(p (LEFT Y) N COUNT)
(p (RIGHT Y) N COUNT))
(p Y N COUNT))
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y)))
(p Y N COUNT))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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. Note,
however, the inductive instances chosen for COUNT and N. The above induction
scheme leads to the following four new goals:
Case 4. (IMPLIES (AND (LAMBDAP Y)
(NOT (LESSP (FIND-M (BODY Y) (ADD1 N))
(FIND-M (BUMP (BODY Y) (ADD1 COUNT))
(ADD1 (ADD1 N))))))
(NOT (LESSP (FIND-M Y N)
(FIND-M (BUMP Y COUNT) (ADD1 N))))).
This simplifies, applying BODY-LAMBDA, and expanding the functions FIND-M
and BUMP, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP Y))
(COMBP Y)
(LESSP (FIND-M (LEFT Y) N)
(FIND-M (RIGHT Y) N))
(NOT (LESSP (FIND-M (RIGHT Y) N)
(FIND-M (BUMP (RIGHT Y) COUNT)
(ADD1 N))))
(NOT (LESSP (FIND-M (LEFT Y) N)
(FIND-M (BUMP (LEFT Y) COUNT)
(ADD1 N)))))
(NOT (LESSP (FIND-M Y N)
(FIND-M (BUMP Y COUNT) (ADD1 N))))),
which simplifies, rewriting with RIGHT-COMB and LEFT-COMB, and opening up
the functions FIND-M and BUMP, to:
(IMPLIES (AND (COMBP Y)
(LESSP (FIND-M (LEFT Y) N)
(FIND-M (RIGHT Y) N))
(NOT (LESSP (FIND-M (RIGHT Y) N)
(FIND-M (BUMP (RIGHT Y) COUNT)
(ADD1 N))))
(NOT (LESSP (FIND-M (LEFT Y) N)
(FIND-M (BUMP (LEFT Y) COUNT)
(ADD1 N))))
(NOT (LESSP (FIND-M (BUMP (LEFT Y) COUNT)
(ADD1 N))
(FIND-M (BUMP (RIGHT Y) COUNT)
(ADD1 N)))))
(NOT (LESSP (FIND-M (RIGHT Y) N)
(FIND-M (BUMP (LEFT Y) COUNT)
(ADD1 N))))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP Y))
(COMBP Y)
(NOT (LESSP (FIND-M (LEFT Y) N)
(FIND-M (RIGHT Y) N)))
(NOT (LESSP (FIND-M (LEFT Y) N)
(FIND-M (BUMP (LEFT Y) COUNT)
(ADD1 N))))
(NOT (LESSP (FIND-M (RIGHT Y) N)
(FIND-M (BUMP (RIGHT Y) COUNT)
(ADD1 N)))))
(NOT (LESSP (FIND-M Y N)
(FIND-M (BUMP Y COUNT) (ADD1 N))))),
which simplifies, applying RIGHT-COMB and LEFT-COMB, and opening up FIND-M
and BUMP, to:
(IMPLIES (AND (COMBP Y)
(NOT (LESSP (FIND-M (LEFT Y) N)
(FIND-M (RIGHT Y) N)))
(NOT (LESSP (FIND-M (LEFT Y) N)
(FIND-M (BUMP (LEFT Y) COUNT)
(ADD1 N))))
(NOT (LESSP (FIND-M (RIGHT Y) N)
(FIND-M (BUMP (RIGHT Y) COUNT)
(ADD1 N))))
(LESSP (FIND-M (BUMP (LEFT Y) COUNT)
(ADD1 N))
(FIND-M (BUMP (RIGHT Y) COUNT)
(ADD1 N))))
(NOT (LESSP (FIND-M (LEFT Y) N)
(FIND-M (BUMP (RIGHT Y) COUNT)
(ADD1 N))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y)))
(NOT (LESSP (FIND-M Y N)
(FIND-M (BUMP Y COUNT) (ADD1 N))))),
which simplifies, appealing to the lemma SUB1-ADD1, and unfolding the
functions FIND-M, BUMP, and DIFFERENCE, to seven new formulas:
Case 1.7.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y)
(NOT (EQUAL (ADD1 Y) 0))
(NOT (NUMBERP N)))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE (SUB1 (ADD1 Y)) 0)))),
which again simplifies, rewriting with the lemma SUB1-ADD1, and expanding
the definitions of DIFFERENCE and EQUAL, to three new conjectures:
Case 1.7.3.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y)
(NOT (NUMBERP N))
(NUMBERP Y)
(NOT (EQUAL Y 0)))
(NOT (LESSP Y Y))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.7.2.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y)
(NOT (NUMBERP N))
(EQUAL Y 0))
(NOT (LESSP 0 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.7.1.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y)
(NOT (NUMBERP N))
(NOT (NUMBERP Y)))
(NOT (LESSP 0 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.6.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y)
(NOT (EQUAL (ADD1 Y) 0))
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE (SUB1 (ADD1 Y)) N)))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (SUB1 (ADD1 Y)) N)
(NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y)
(NOT (EQUAL (ADD1 Y) 0))
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE (SUB1 (ADD1 Y)) N)))).
However this again simplifies, applying SUB1-ADD1, and unfolding LESSP, to:
(IMPLIES (AND (NUMBERP Y)
(LESSP Y N)
(LESSP COUNT Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE Y N)))),
which we will name *1.1.
Case 1.5.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP COUNT Y))
(EQUAL Y 0))
(NOT (LESSP (DIFFERENCE Y N) 0))).
However this again simplifies, unfolding LAMBDAP, COMBP, EQUAL, LESSP, and
DIFFERENCE, to:
T.
Case 1.4.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP COUNT Y))
(NOT (NUMBERP Y)))
(NOT (LESSP (DIFFERENCE Y N) 0))),
which again simplifies, unfolding the functions LESSP and DIFFERENCE, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y)
(EQUAL (ADD1 Y) 0))
(NOT (LESSP (DIFFERENCE Y N) 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP COUNT Y))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (NUMBERP N)))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE (SUB1 Y) 0)))),
which again simplifies, expanding DIFFERENCE and EQUAL, to two new
formulas:
Case 1.2.2.
(IMPLIES (AND (NOT (LESSP COUNT Y))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (NUMBERP N))
(NOT (EQUAL (SUB1 Y) 0)))
(NOT (LESSP Y (SUB1 Y)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.2.1.
(IMPLIES (AND (NOT (LESSP COUNT Y))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (NUMBERP N))
(EQUAL (SUB1 Y) 0))
(NOT (LESSP Y 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP COUNT Y))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE (SUB1 Y) N)))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (SUB1 Y) N)
(NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP COUNT Y))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE (SUB1 Y) N)))).
This again simplifies, trivially, to the new conjecture:
(IMPLIES (AND (LESSP (SUB1 Y) N)
(NOT (LESSP COUNT Y))
(NOT (EQUAL Y 0))
(NUMBERP Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE (SUB1 Y) N)))).
Applying the lemma SUB1-ELIM, replace Y by (ADD1 X) to eliminate (SUB1 Y).
We rely upon the type restriction lemma noted when SUB1 was introduced to
restrict the new variable. This produces:
(IMPLIES (AND (NUMBERP X)
(LESSP X N)
(NOT (LESSP COUNT (ADD1 X)))
(NOT (EQUAL (ADD1 X) 0))
(NUMBERP N))
(NOT (LESSP (DIFFERENCE (ADD1 X) N)
(DIFFERENCE X N)))),
which further simplifies, appealing to the lemma SUB1-ADD1, and unfolding
the functions LESSP and DIFFERENCE, to two new goals:
Case 1.1.2.
(IMPLIES (AND (NUMBERP X)
(LESSP X N)
(NOT (EQUAL COUNT 0))
(NUMBERP COUNT)
(NOT (LESSP (SUB1 COUNT) X))
(NUMBERP N)
(NOT (EQUAL N 0)))
(NOT (LESSP (DIFFERENCE X (SUB1 N))
(DIFFERENCE X N)))).
Applying the lemma SUB1-ELIM, replace COUNT by (ADD1 Z) to eliminate
(SUB1 COUNT). We employ the type restriction lemma noted when SUB1 was
introduced to restrict the new variable. We would thus like to prove
the new goal:
(IMPLIES (AND (NUMBERP Z)
(NUMBERP X)
(LESSP X N)
(NOT (EQUAL (ADD1 Z) 0))
(NOT (LESSP Z X))
(NUMBERP N)
(NOT (EQUAL N 0)))
(NOT (LESSP (DIFFERENCE X (SUB1 N))
(DIFFERENCE X N)))),
which further simplifies, trivially, to:
(IMPLIES (AND (NUMBERP Z)
(NUMBERP X)
(LESSP X N)
(NOT (LESSP Z X))
(NUMBERP N)
(NOT (EQUAL N 0)))
(NOT (LESSP (DIFFERENCE X (SUB1 N))
(DIFFERENCE X N)))).
Applying the lemma SUB1-ELIM, replace N by (ADD1 V) to eliminate
(SUB1 N). We employ the type restriction lemma noted when SUB1 was
introduced to restrict the new variable. We thus obtain the new
conjecture:
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(NUMBERP X)
(LESSP X (ADD1 V))
(NOT (LESSP Z X))
(NOT (EQUAL (ADD1 V) 0)))
(NOT (LESSP (DIFFERENCE X V)
(DIFFERENCE X (ADD1 V))))),
which further simplifies, rewriting with SUB1-ADD1, and opening up LESSP,
EQUAL, and DIFFERENCE, to the following two new goals:
Case 1.1.2.2.
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(NUMBERP X)
(LESSP (SUB1 X) V)
(NOT (LESSP Z X))
(NOT (EQUAL X 0)))
(NOT (LESSP (DIFFERENCE X V)
(DIFFERENCE (SUB1 X) V)))).
Finally call the above conjecture *1.2.
Case 1.1.2.1.
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(NUMBERP X)
(LESSP (SUB1 X) V)
(NOT (LESSP Z X))
(EQUAL X 0))
(NOT (LESSP (DIFFERENCE X V) 0))).
But this finally simplifies, unfolding the definitions of NUMBERP,
SUB1, EQUAL, LESSP, and DIFFERENCE, to:
T.
Case 1.1.1.
(IMPLIES (AND (NUMBERP X)
(LESSP X N)
(NOT (EQUAL COUNT 0))
(NUMBERP COUNT)
(NOT (LESSP (SUB1 COUNT) X))
(NUMBERP N)
(EQUAL N 0))
(NOT (LESSP (ADD1 X) (DIFFERENCE X N)))),
which finally simplifies, using linear arithmetic, to:
T.
So let us turn our attention to:
(IMPLIES (AND (NUMBERP V)
(NUMBERP Z)
(NUMBERP X)
(LESSP (SUB1 X) V)
(NOT (LESSP Z X))
(NOT (EQUAL X 0)))
(NOT (LESSP (DIFFERENCE X V)
(DIFFERENCE (SUB1 X) V)))),
named *1.2 above. Let us appeal to the induction principle. There are six
plausible inductions. However, they merge into one likely candidate induction.
We will induct according to the following scheme:
(AND (IMPLIES (OR (EQUAL V 0) (NOT (NUMBERP V)))
(p X V Z))
(IMPLIES (AND (NOT (OR (EQUAL V 0) (NOT (NUMBERP V))))
(OR (EQUAL (SUB1 X) 0)
(NOT (NUMBERP (SUB1 X)))))
(p X V Z))
(IMPLIES (AND (NOT (OR (EQUAL V 0) (NOT (NUMBERP V))))
(NOT (OR (EQUAL (SUB1 X) 0)
(NOT (NUMBERP (SUB1 X)))))
(p (SUB1 X) (SUB1 V) (SUB1 Z)))
(p X V Z))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT establish that the measure (COUNT V) decreases according to the
well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instances chosen for Z and X. The above induction
scheme produces six new conjectures:
Case 6. (IMPLIES (AND (OR (EQUAL V 0) (NOT (NUMBERP V)))
(NUMBERP V)
(NUMBERP Z)
(NUMBERP X)
(LESSP (SUB1 X) V)
(NOT (LESSP Z X))
(NOT (EQUAL X 0)))
(NOT (LESSP (DIFFERENCE X V)
(DIFFERENCE (SUB1 X) V)))),
which simplifies, unfolding NOT, OR, NUMBERP, EQUAL, and LESSP, to:
T.
Case 5. (IMPLIES (AND (NOT (OR (EQUAL V 0) (NOT (NUMBERP V))))
(OR (EQUAL (SUB1 X) 0)
(NOT (NUMBERP (SUB1 X))))
(NUMBERP V)
(NUMBERP Z)
(NUMBERP X)
(LESSP (SUB1 X) V)
(NOT (LESSP Z X))
(NOT (EQUAL X 0)))
(NOT (LESSP (DIFFERENCE X V)
(DIFFERENCE (SUB1 X) V)))),
which simplifies, unfolding the definitions of NOT, OR, EQUAL, LESSP, and
DIFFERENCE, to:
T.
Case 4. (IMPLIES (AND (NOT (OR (EQUAL V 0) (NOT (NUMBERP V))))
(NOT (OR (EQUAL (SUB1 X) 0)
(NOT (NUMBERP (SUB1 X)))))
(NOT (LESSP (SUB1 (SUB1 X)) (SUB1 V)))
(NUMBERP V)
(NUMBERP Z)
(NUMBERP X)
(LESSP (SUB1 X) V)
(NOT (LESSP Z X))
(NOT (EQUAL X 0)))
(NOT (LESSP (DIFFERENCE X V)
(DIFFERENCE (SUB1 X) V)))),
which simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (SUB1 X) 0)
(NOT (OR (EQUAL V 0) (NOT (NUMBERP V))))
(NOT (OR (EQUAL (SUB1 X) 0)
(NOT (NUMBERP (SUB1 X)))))
(NOT (LESSP (SUB1 (SUB1 X)) (SUB1 V)))
(NUMBERP V)
(NUMBERP Z)
(NUMBERP X)
(LESSP (SUB1 X) V)
(NOT (LESSP Z X))
(NOT (EQUAL X 0)))
(NOT (LESSP (DIFFERENCE X V)
(DIFFERENCE (SUB1 X) V)))).
This again simplifies, opening up the definitions of NOT, OR, EQUAL, and
NUMBERP, to:
T.
Case 3. (IMPLIES (AND (NOT (OR (EQUAL V 0) (NOT (NUMBERP V))))
(NOT (OR (EQUAL (SUB1 X) 0)
(NOT (NUMBERP (SUB1 X)))))
(LESSP (SUB1 Z) (SUB1 X))
(NUMBERP V)
(NUMBERP Z)
(NUMBERP X)
(LESSP (SUB1 X) V)
(NOT (LESSP Z X))
(NOT (EQUAL X 0)))
(NOT (LESSP (DIFFERENCE X V)
(DIFFERENCE (SUB1 X) V)))),
which simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL V 0) (NOT (NUMBERP V))))
(NOT (OR (EQUAL (SUB1 X) 0)
(NOT (NUMBERP (SUB1 X)))))
(EQUAL (SUB1 X) 0)
(NUMBERP V)
(NUMBERP Z)
(NUMBERP X)
(LESSP (SUB1 X) V)
(NOT (LESSP Z X))
(NOT (EQUAL X 0)))
(NOT (LESSP (DIFFERENCE X V)
(DIFFERENCE (SUB1 X) V)))),
which simplifies, unfolding the functions NOT, OR, EQUAL, and NUMBERP, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL V 0) (NOT (NUMBERP V))))
(NOT (OR (EQUAL (SUB1 X) 0)
(NOT (NUMBERP (SUB1 X)))))
(NOT (LESSP (DIFFERENCE (SUB1 X) (SUB1 V))
(DIFFERENCE (SUB1 (SUB1 X))
(SUB1 V))))
(NUMBERP V)
(NUMBERP Z)
(NUMBERP X)
(LESSP (SUB1 X) V)
(NOT (LESSP Z X))
(NOT (EQUAL X 0)))
(NOT (LESSP (DIFFERENCE X V)
(DIFFERENCE (SUB1 X) V)))),
which simplifies, unfolding the functions NOT, OR, LESSP, and DIFFERENCE, to:
T.
That finishes the proof of *1.2.
So let us turn our attention to:
(IMPLIES (AND (NUMBERP Y)
(LESSP Y N)
(LESSP COUNT Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE Y N)))),
named *1.1 above. We will try to prove it by induction. Eight 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 (OR (EQUAL N 0) (NOT (NUMBERP N)))
(p Y N COUNT))
(IMPLIES (AND (NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(p Y N COUNT))
(IMPLIES (AND (NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(p (SUB1 Y) (SUB1 N) (SUB1 COUNT)))
(p Y N COUNT))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT inform us 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 COUNT and N. The above induction
scheme produces five new conjectures:
Case 5. (IMPLIES (AND (OR (EQUAL N 0) (NOT (NUMBERP N)))
(NUMBERP Y)
(LESSP Y N)
(LESSP COUNT Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE Y N)))),
which simplifies, opening up the functions NOT, OR, EQUAL, and LESSP, to:
T.
Case 4. (IMPLIES (AND (NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(OR (EQUAL Y 0) (NOT (NUMBERP Y)))
(NUMBERP Y)
(LESSP Y N)
(LESSP COUNT Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE Y N)))),
which simplifies, expanding the definitions of NOT, OR, NUMBERP, EQUAL, and
LESSP, to:
T.
Case 3. (IMPLIES (AND (NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(NOT (LESSP (SUB1 Y) (SUB1 N)))
(NUMBERP Y)
(LESSP Y N)
(LESSP COUNT Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE Y N)))),
which simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL Y 0)
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(NOT (LESSP (SUB1 Y) (SUB1 N)))
(NUMBERP Y)
(LESSP Y N)
(LESSP COUNT Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE Y N)))).
This again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(NOT (LESSP (SUB1 COUNT) (SUB1 Y)))
(NUMBERP Y)
(LESSP Y N)
(LESSP COUNT Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE Y N)))),
which simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP COUNT 1)
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(NOT (LESSP (SUB1 COUNT) (SUB1 Y)))
(NUMBERP Y)
(LESSP Y N)
(LESSP COUNT Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE Y N)))).
However this again simplifies, unfolding the definitions of SUB1, NUMBERP,
EQUAL, LESSP, NOT, OR, and DIFFERENCE, to two new goals:
Case 2.2.
(IMPLIES (AND (EQUAL COUNT 0)
(NOT (EQUAL N 0))
(NOT (EQUAL Y 0))
(NOT (LESSP (SUB1 COUNT) (SUB1 Y)))
(NUMBERP Y)
(LESSP (SUB1 Y) (SUB1 N))
(NUMBERP N))
(NOT (LESSP (DIFFERENCE (SUB1 Y) (SUB1 N))
(DIFFERENCE (SUB1 Y) (SUB1 N))))),
which again simplifies, opening up the functions SUB1, EQUAL, and LESSP,
to:
(IMPLIES (AND (NOT (EQUAL N 0))
(NOT (EQUAL Y 0))
(EQUAL (SUB1 Y) 0)
(NUMBERP Y)
(LESSP (SUB1 Y) (SUB1 N))
(NUMBERP N))
(NOT (LESSP (DIFFERENCE (SUB1 Y) (SUB1 N))
(DIFFERENCE (SUB1 Y) (SUB1 N))))).
But this again simplifies, opening up the definitions of EQUAL, LESSP, and
DIFFERENCE, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (NUMBERP COUNT))
(NOT (EQUAL N 0))
(NOT (EQUAL Y 0))
(NOT (LESSP (SUB1 COUNT) (SUB1 Y)))
(NUMBERP Y)
(LESSP (SUB1 Y) (SUB1 N))
(NUMBERP N))
(NOT (LESSP (DIFFERENCE (SUB1 Y) (SUB1 N))
(DIFFERENCE (SUB1 Y) (SUB1 N))))),
which further simplifies, applying SUB1-NNUMBERP, and opening up the
functions EQUAL, LESSP, and DIFFERENCE, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(NOT (LESSP (DIFFERENCE (SUB1 Y) (SUB1 N))
(DIFFERENCE (SUB1 Y) (SUB1 N))))
(NUMBERP Y)
(LESSP Y N)
(LESSP COUNT Y)
(NUMBERP N))
(NOT (LESSP (DIFFERENCE Y N)
(DIFFERENCE Y N)))).
This simplifies, unfolding the functions NOT, OR, LESSP, and DIFFERENCE, to:
T.
That finishes the proof of *1.1, which, consequently, also finishes the
proof of *1. Q.E.D.
[ 0.0 0.1 0.1 ]
FIND-M-BUMP
(PROVE-LEMMA DIFF-ZERO
(REWRITE)
(IMPLIES (LEQ M N)
(EQUAL (DIFFERENCE M N) 0)))
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 (OR (EQUAL M 0) (NOT (NUMBERP M)))
(p M N))
(IMPLIES (AND (NOT (OR (EQUAL M 0) (NOT (NUMBERP M))))
(OR (EQUAL N 0) (NOT (NUMBERP N))))
(p M N))
(IMPLIES (AND (NOT (OR (EQUAL M 0) (NOT (NUMBERP M))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(p (SUB1 M) (SUB1 N)))
(p M N))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT establish that the measure (COUNT N) decreases according to the
well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instance chosen for M. The above induction scheme
generates four new conjectures:
Case 4. (IMPLIES (AND (OR (EQUAL M 0) (NOT (NUMBERP M)))
(NOT (LESSP N M)))
(EQUAL (DIFFERENCE M N) 0)),
which simplifies, opening up NOT, OR, EQUAL, LESSP, and DIFFERENCE, to:
T.
Case 3. (IMPLIES (AND (NOT (OR (EQUAL M 0) (NOT (NUMBERP M))))
(OR (EQUAL N 0) (NOT (NUMBERP N)))
(NOT (LESSP N M)))
(EQUAL (DIFFERENCE M N) 0)),
which simplifies, unfolding NOT, OR, EQUAL, and LESSP, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL M 0) (NOT (NUMBERP M))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(LESSP (SUB1 N) (SUB1 M))
(NOT (LESSP N M)))
(EQUAL (DIFFERENCE M N) 0)),
which simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP M 1)
(NOT (OR (EQUAL M 0) (NOT (NUMBERP M))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(LESSP (SUB1 N) (SUB1 M))
(NOT (LESSP N M)))
(EQUAL (DIFFERENCE M N) 0)).
This again simplifies, expanding SUB1, NUMBERP, EQUAL, LESSP, NOT, and OR,
to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL M 0) (NOT (NUMBERP M))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(EQUAL (DIFFERENCE (SUB1 M) (SUB1 N))
0)
(NOT (LESSP N M)))
(EQUAL (DIFFERENCE M N) 0)),
which simplifies, using linear arithmetic, to three new conjectures:
Case 1.3.
(IMPLIES (AND (LESSP M N)
(NOT (OR (EQUAL M 0) (NOT (NUMBERP M))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(EQUAL (DIFFERENCE (SUB1 M) (SUB1 N))
0)
(NOT (LESSP N M)))
(EQUAL (DIFFERENCE M N) 0)),
which again simplifies, using linear arithmetic, to two new formulas:
Case 1.3.2.
(IMPLIES (AND (LESSP (SUB1 M) (SUB1 N))
(LESSP M N)
(NOT (OR (EQUAL M 0) (NOT (NUMBERP M))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(EQUAL (DIFFERENCE (SUB1 M) (SUB1 N))
0)
(NOT (LESSP N M)))
(EQUAL (DIFFERENCE M N) 0)),
which again simplifies, expanding the functions LESSP, NOT, OR,
DIFFERENCE, and EQUAL, to:
T.
Case 1.3.1.
(IMPLIES (AND (LESSP M 1)
(LESSP M N)
(NOT (OR (EQUAL M 0) (NOT (NUMBERP M))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(EQUAL (DIFFERENCE (SUB1 M) (SUB1 N))
0)
(NOT (LESSP N M)))
(EQUAL (DIFFERENCE M N) 0)),
which again simplifies, opening up the definitions of SUB1, NUMBERP,
EQUAL, LESSP, NOT, and OR, to:
T.
Case 1.2.
(IMPLIES (AND (LESSP (SUB1 M) (SUB1 N))
(NOT (OR (EQUAL M 0) (NOT (NUMBERP M))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(EQUAL (DIFFERENCE (SUB1 M) (SUB1 N))
0)
(NOT (LESSP N M)))
(EQUAL (DIFFERENCE M N) 0)),
which again simplifies, opening up the definitions of NOT, OR, LESSP,
DIFFERENCE, and EQUAL, to:
T.
Case 1.1.
(IMPLIES (AND (LESSP M 1)
(NOT (OR (EQUAL M 0) (NOT (NUMBERP M))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(EQUAL (DIFFERENCE (SUB1 M) (SUB1 N))
0)
(NOT (LESSP N M)))
(EQUAL (DIFFERENCE M N) 0)),
which again simplifies, unfolding the functions SUB1, NUMBERP, EQUAL,
LESSP, NOT, and OR, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
DIFF-ZERO
(DEFN UNTRANS-BSTEP-IND
(A B M N)
(IF (EQUAL A B)
T
(IF (AND (LAMBDAP A) (LAMBDAP B))
(UNTRANS-BSTEP-IND (BODY A)
(BODY B)
M
(ADD1 N))
(IF (COMBP A)
(IF (AND (LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
T
(AND (UNTRANS-BSTEP-IND (LEFT A)
(LEFT B)
M N)
(UNTRANS-BSTEP-IND (RIGHT A)
(RIGHT B)
M N)))
T))))
Linear arithmetic, the lemmas BODY-LESSEQP, BODY-LESSP, RIGHT-LESSP, and
LEFT-LESSP, and the definition of AND establish that the measure (COUNT A)
decreases according to the well-founded relation LESSP in each recursive call.
Hence, UNTRANS-BSTEP-IND is accepted under the definitional principle. From
the definition we can conclude that (TRUEP (UNTRANS-BSTEP-IND A B M N)) is a
theorem.
[ 0.0 0.0 0.0 ]
UNTRANS-BSTEP-IND
(PROVE-LEMMA NBSTEP-NIL
(REWRITE)
(IMPLIES (NLISTP W)
(EQUAL (NBSTEP W A) A)))
This formula can be simplified, using the abbreviations NLISTP and IMPLIES, to
the new conjecture:
(IMPLIES (NOT (LISTP W))
(EQUAL (NBSTEP W A) A)),
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 (AND (NLAMBDAP A) (p W (NBODY A)))
(p W A))
(IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(AND (NLAMBDAP (NLEFT A))
(EQUAL (COMMAND W) 'REDUCE)))
(p W A))
(IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (AND (NLAMBDAP (NLEFT A))
(EQUAL (COMMAND W) 'REDUCE)))
(p (RIGHT-INSTRS W) (NRIGHT A))
(p (LEFT-INSTRS W) (NLEFT A)))
(p W A))
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A)))
(p W A))).
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and NLEFT-LESSP
can be used to show that the measure (COUNT A) decreases according to the
well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instances chosen for W. The above induction scheme
generates seven new conjectures:
Case 7. (IMPLIES (AND (NLAMBDAP A)
(EQUAL (NBSTEP W (NBODY A)) (NBODY A))
(NOT (LISTP W)))
(EQUAL (NBSTEP W A) A)),
which simplifies, rewriting with NLAMBDA-NBIND-NBODY, and expanding the
definition of NBSTEP, to:
T.
Case 6. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(AND (NLAMBDAP (NLEFT A))
(EQUAL (COMMAND W) 'REDUCE))
(NOT (LISTP W)))
(EQUAL (NBSTEP W A) A)).
This simplifies, applying CDR-NLISTP, and expanding CAR, CDR, COMMAND, EQUAL,
and AND, to:
T.
Case 5. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (AND (NLAMBDAP (NLEFT A))
(EQUAL (COMMAND W) 'REDUCE)))
(LISTP (RIGHT-INSTRS W))
(LISTP (LEFT-INSTRS W))
(NOT (LISTP W)))
(EQUAL (NBSTEP W A) A)),
which simplifies, rewriting with CDR-NLISTP, and unfolding the definitions
of CAR, CDR, COMMAND, EQUAL, AND, RIGHT-INSTRS, and LISTP, to:
T.
Case 4. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (AND (NLAMBDAP (NLEFT A))
(EQUAL (COMMAND W) 'REDUCE)))
(EQUAL (NBSTEP (RIGHT-INSTRS W) (NRIGHT A))
(NRIGHT A))
(LISTP (LEFT-INSTRS W))
(NOT (LISTP W)))
(EQUAL (NBSTEP W A) A)).
This simplifies, rewriting with the lemmas CDR-NLISTP and CAR-NLISTP, and
opening up CAR, CDR, COMMAND, EQUAL, AND, LEFT-INSTRS, and LISTP, to:
T.
Case 3. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (AND (NLAMBDAP (NLEFT A))
(EQUAL (COMMAND W) 'REDUCE)))
(LISTP (RIGHT-INSTRS W))
(EQUAL (NBSTEP (LEFT-INSTRS W) (NLEFT A))
(NLEFT A))
(NOT (LISTP W)))
(EQUAL (NBSTEP W A) A)).
This simplifies, rewriting with the lemma CDR-NLISTP, and unfolding the
definitions of CAR, CDR, COMMAND, EQUAL, AND, RIGHT-INSTRS, and LISTP, to:
T.
Case 2. (IMPLIES (AND (NOT (NLAMBDAP A))
(NCOMBP A)
(NOT (AND (NLAMBDAP (NLEFT A))
(EQUAL (COMMAND W) 'REDUCE)))
(EQUAL (NBSTEP (RIGHT-INSTRS W) (NRIGHT A))
(NRIGHT A))
(EQUAL (NBSTEP (LEFT-INSTRS W) (NLEFT A))
(NLEFT A))
(NOT (LISTP W)))
(EQUAL (NBSTEP W A) A)).
This simplifies, rewriting with CDR-NLISTP and NCOMB-NLEFT-NRIGHT, and
expanding the definitions of CAR, CDR, COMMAND, EQUAL, AND, and NBSTEP, to:
T.
Case 1. (IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (LISTP W)))
(EQUAL (NBSTEP W A) A)),
which simplifies, expanding NBSTEP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NBSTEP-NIL
(PROVE-LEMMA UNTRANS-BETA-STEP
(REWRITE)
(IMPLIES (AND (BETA-STEP A B)
(TERMP A)
(LEQ (FIND-M A N) M))
(NBETA-STEP (UNTRANS A M N)
(NBSTEP (MAKE-BSTEP A B)
(UNTRANS A M N))))
((INDUCT (UNTRANS-BSTEP-IND A B M N))))
This conjecture can be simplified, using the abbreviations IMPLIES, NOT, OR,
and AND, to five new goals:
Case 5. (IMPLIES (AND (EQUAL A B)
(BETA-STEP A B)
(TERMP A)
(NOT (LESSP M (FIND-M A N))))
(NBETA-STEP (UNTRANS A M N)
(NBSTEP (MAKE-BSTEP A B)
(UNTRANS A M N)))),
which simplifies, applying the lemma NBSTEP-NIL, and opening up the
definitions of BETA-STEP, MAKE-BSTEP, and NBETA-STEP, to:
T.
Case 4. (IMPLIES
(AND (NOT (EQUAL A B))
(LAMBDAP A)
(LAMBDAP B)
(IMPLIES (AND (BETA-STEP (BODY A) (BODY B))
(TERMP (BODY A))
(IF (LESSP M (FIND-M (BODY A) (ADD1 N)))
F T))
(NBETA-STEP (UNTRANS (BODY A) M (ADD1 N))
(NBSTEP (MAKE-BSTEP (BODY A) (BODY B))
(UNTRANS (BODY A) M (ADD1 N)))))
(BETA-STEP A B)
(TERMP A)
(NOT (LESSP M (FIND-M A N))))
(NBETA-STEP (UNTRANS A M N)
(NBSTEP (MAKE-BSTEP A B)
(UNTRANS A M N)))),
which simplifies, appealing to the lemmas NBODY-NLAMBDA, NBIND-NLAMBDA, and
NLAMBDA-EQUAL, and unfolding the functions AND, IMPLIES, BETA-STEP, TERMP,
FIND-M, UNTRANS, MAKE-BSTEP, NBSTEP, and NBETA-STEP, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (AND (LAMBDAP A) (LAMBDAP B)))
(COMBP A)
(LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))
(BETA-STEP A B)
(TERMP A)
(NOT (LESSP M (FIND-M A N))))
(NBETA-STEP (UNTRANS A M N)
(NBSTEP (MAKE-BSTEP A B)
(UNTRANS A M N)))),
which simplifies, applying NRIGHT-NCOMB, LAMBDAP-UNTRANS, and NLEFT-NCOMB,
and expanding AND, BETA-STEP, TERMP, FIND-M, UNTRANS, MAKE-BSTEP, EQUAL,
COMMAND, NBSTEP, and NBETA-STEP, to the following six new formulas:
Case 3.6.
(IMPLIES (AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(LAMBDAP (LEFT A))
(TERMP (BODY (LEFT A)))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (EQUAL (NCOMB (UNTRANS (LEFT A) M N)
(UNTRANS (RIGHT A) M N))
(NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N)))))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NCOMBP (NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N))))).
This again simplifies, obviously, to the new formula:
(IMPLIES (AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(LAMBDAP (LEFT A))
(TERMP (BODY (LEFT A)))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NCOMBP (NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N))))).
Applying the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, replace A by (COMB X Z)
to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to eliminate
(BODY X). We thus obtain:
(IMPLIES (AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(TERMP V)
(TERMP Z)
(NOT (LESSP (FIND-M (LAMBDA V) N)
(FIND-M Z N)))
(NOT (LESSP M (FIND-M (LAMBDA V) N)))
(NOT (FREE-FOR (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N))))
(NCOMBP (NSUBST (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N)
(NBIND (UNTRANS (LAMBDA V) M N))))),
which further simplifies, using linear arithmetic, applying BODY-LAMBDA,
NBODY-NLAMBDA, and FREE-FOR-UNTRANS, and unfolding the definitions of
FIND-M and UNTRANS, to:
T.
Case 3.5.
(IMPLIES
(AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(LAMBDAP (LEFT A))
(TERMP (BODY (LEFT A)))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (EQUAL (NCOMB (UNTRANS (LEFT A) M N)
(UNTRANS (RIGHT A) M N))
(NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N)))))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NLEFT (NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N)))))).
Appealing to the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, we now replace A by
(COMB X Z) to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to
eliminate (BODY X). We must thus prove the formula:
(IMPLIES
(AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(TERMP V)
(TERMP Z)
(NOT (LESSP (FIND-M (LAMBDA V) N)
(FIND-M Z N)))
(NOT (LESSP M (FIND-M (LAMBDA V) N)))
(NOT (EQUAL (NCOMB (UNTRANS (LAMBDA V) M N)
(UNTRANS Z M N))
(NSUBST (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N)
(NBIND (UNTRANS (LAMBDA V) M N)))))
(NOT (FREE-FOR (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N))))
(NBETA-STEP (UNTRANS (LAMBDA V) M N)
(NLEFT (NSUBST (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N)
(NBIND (UNTRANS (LAMBDA V) M N)))))).
This further simplifies, using linear arithmetic, rewriting with the
lemmas BODY-LAMBDA, NBODY-NLAMBDA, NBIND-NLAMBDA, and FREE-FOR-UNTRANS,
and expanding the definitions of FIND-M and UNTRANS, to:
T.
Case 3.4.
(IMPLIES
(AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(LAMBDAP (LEFT A))
(TERMP (BODY (LEFT A)))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (EQUAL (NCOMB (UNTRANS (LEFT A) M N)
(UNTRANS (RIGHT A) M N))
(NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N)))))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NRIGHT (NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N)))))).
Applying the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, replace A by (COMB X Z)
to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to eliminate
(BODY X). We would thus like to prove:
(IMPLIES
(AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(TERMP V)
(TERMP Z)
(NOT (LESSP (FIND-M (LAMBDA V) N)
(FIND-M Z N)))
(NOT (LESSP M (FIND-M (LAMBDA V) N)))
(NOT (EQUAL (NCOMB (UNTRANS (LAMBDA V) M N)
(UNTRANS Z M N))
(NSUBST (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N)
(NBIND (UNTRANS (LAMBDA V) M N)))))
(NOT (FREE-FOR (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N))))
(NBETA-STEP (UNTRANS Z M N)
(NRIGHT (NSUBST (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N)
(NBIND (UNTRANS (LAMBDA V) M N)))))),
which further simplifies, using linear arithmetic, rewriting with
BODY-LAMBDA, NBODY-NLAMBDA, NBIND-NLAMBDA, and FREE-FOR-UNTRANS, and
expanding the functions FIND-M and UNTRANS, to:
T.
Case 3.3.
(IMPLIES (AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(LAMBDAP (LEFT A))
(TERMP (BODY (LEFT A)))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (EQUAL (NCOMB (UNTRANS (LEFT A) M N)
(UNTRANS (RIGHT A) M N))
(NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N)))))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NCOMBP (NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N))))).
This again simplifies, clearly, to the new conjecture:
(IMPLIES (AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(LAMBDAP (LEFT A))
(TERMP (BODY (LEFT A)))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NCOMBP (NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N))))).
Applying the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, replace A by (COMB X Z)
to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to eliminate
(BODY X). This produces:
(IMPLIES (AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(TERMP V)
(TERMP Z)
(LESSP (FIND-M (LAMBDA V) N)
(FIND-M Z N))
(NOT (LESSP M (FIND-M Z N)))
(NOT (FREE-FOR (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N))))
(NCOMBP (NSUBST (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N)
(NBIND (UNTRANS (LAMBDA V) M N))))),
which further simplifies, using linear arithmetic, applying BODY-LAMBDA,
NBODY-NLAMBDA, and FREE-FOR-UNTRANS, and opening up FIND-M and UNTRANS, to:
T.
Case 3.2.
(IMPLIES
(AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(LAMBDAP (LEFT A))
(TERMP (BODY (LEFT A)))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (EQUAL (NCOMB (UNTRANS (LEFT A) M N)
(UNTRANS (RIGHT A) M N))
(NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N)))))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NLEFT (NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N)))))).
Appealing to the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, we now replace A by
(COMB X Z) to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to
eliminate (BODY X). This generates the goal:
(IMPLIES
(AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(TERMP V)
(TERMP Z)
(LESSP (FIND-M (LAMBDA V) N)
(FIND-M Z N))
(NOT (LESSP M (FIND-M Z N)))
(NOT (EQUAL (NCOMB (UNTRANS (LAMBDA V) M N)
(UNTRANS Z M N))
(NSUBST (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N)
(NBIND (UNTRANS (LAMBDA V) M N)))))
(NOT (FREE-FOR (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N))))
(NBETA-STEP (UNTRANS (LAMBDA V) M N)
(NLEFT (NSUBST (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N)
(NBIND (UNTRANS (LAMBDA V) M N)))))).
However this further simplifies, using linear arithmetic, applying
BODY-LAMBDA, NBODY-NLAMBDA, NBIND-NLAMBDA, and FREE-FOR-UNTRANS, and
expanding the definitions of FIND-M and UNTRANS, to:
T.
Case 3.1.
(IMPLIES
(AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(LAMBDAP (LEFT A))
(TERMP (BODY (LEFT A)))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (EQUAL (NCOMB (UNTRANS (LEFT A) M N)
(UNTRANS (RIGHT A) M N))
(NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N)))))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NRIGHT (NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N)))))).
Appealing to the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, we now replace A by
(COMB X Z) to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to
eliminate (BODY X). We must thus prove:
(IMPLIES
(AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(TERMP V)
(TERMP Z)
(LESSP (FIND-M (LAMBDA V) N)
(FIND-M Z N))
(NOT (LESSP M (FIND-M Z N)))
(NOT (EQUAL (NCOMB (UNTRANS (LAMBDA V) M N)
(UNTRANS Z M N))
(NSUBST (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N)
(NBIND (UNTRANS (LAMBDA V) M N)))))
(NOT (FREE-FOR (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N))))
(NBETA-STEP (UNTRANS Z M N)
(NRIGHT (NSUBST (NBODY (UNTRANS (LAMBDA V) M N))
(UNTRANS Z M N)
(NBIND (UNTRANS (LAMBDA V) M N)))))).
However this further simplifies, using linear arithmetic, appealing to the
lemmas BODY-LAMBDA, NBODY-NLAMBDA, NBIND-NLAMBDA, and FREE-FOR-UNTRANS,
and expanding the functions FIND-M and UNTRANS, to:
T.
Case 2. (IMPLIES
(AND (NOT (EQUAL A B))
(NOT (AND (LAMBDAP A) (LAMBDAP B)))
(COMBP A)
(NOT (AND (LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(IMPLIES (AND (BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (RIGHT A))
(IF (LESSP M (FIND-M (RIGHT A) N))
F T))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N))))
(IMPLIES (AND (BETA-STEP (LEFT A) (LEFT B))
(TERMP (LEFT A))
(IF (LESSP M (FIND-M (LEFT A) N))
F T))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N))))
(BETA-STEP A B)
(TERMP A)
(NOT (LESSP M (FIND-M A N))))
(NBETA-STEP (UNTRANS A M N)
(NBSTEP (MAKE-BSTEP A B)
(UNTRANS A M N)))),
which simplifies, applying NRIGHT-NCOMB, CDR-CONS, CAR-CONS, LAMBDAP-UNTRANS,
NLEFT-NCOMB, and NCOMB-EQUAL, and opening up the functions AND, IMPLIES,
BETA-STEP, TERMP, FIND-M, UNTRANS, MAKE-BSTEP, RIGHT-INSTRS, LEFT-INSTRS,
NBSTEP, NBETA-STEP, EQUAL, COMMAND, and CAR, to the following 16 new goals:
Case 2.16.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (LAMBDAP (LEFT A)))
(LESSP M (FIND-M (RIGHT A) N))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (EQUAL (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 2.15.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (LAMBDAP (LEFT A)))
(LESSP M (FIND-M (RIGHT A) N))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (EQUAL (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.14.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (LAMBDAP (LEFT A)))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(LESSP M (FIND-M (LEFT A) N))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (EQUAL (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.13.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (LAMBDAP (LEFT A)))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(LESSP M (FIND-M (LEFT A) N))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (EQUAL (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.12.
(IMPLIES
(AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(LESSP M (FIND-M (RIGHT A) N))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (EQUAL (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N))))
(NOT (EQUAL (NCOMB (NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N))
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N))))))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.11.
(IMPLIES
(AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(LESSP M (FIND-M (RIGHT A) N))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (EQUAL (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N))))
(NOT (EQUAL (NCOMB (NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N))
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N))))))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.10.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(LESSP M (FIND-M (RIGHT A) N))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (EQUAL (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N))))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.9.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(LESSP M (FIND-M (RIGHT A) N))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (EQUAL (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N))))
(NOT (LAMBDAP (LEFT A))))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.8.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(LESSP M (FIND-M (RIGHT A) N))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (EQUAL (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N))))
(NOT (LAMBDAP (LEFT A))))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.7.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(LESSP M (FIND-M (RIGHT A) N))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(NOT (EQUAL (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N))))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.6.
(IMPLIES
(AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(LESSP M (FIND-M (LEFT A) N))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (EQUAL (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N))))
(NOT (EQUAL (NCOMB (NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N))
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N))))))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.5.
(IMPLIES
(AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(LESSP M (FIND-M (LEFT A) N))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (EQUAL (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N))))
(NOT (EQUAL (NCOMB (NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N))
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(NSUBST (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N)
(NBIND (UNTRANS (LEFT A) M N))))))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.4.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(LESSP M (FIND-M (LEFT A) N))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (EQUAL (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N))))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(LESSP M (FIND-M (LEFT A) N))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (EQUAL (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N))))
(NOT (LAMBDAP (LEFT A))))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(LESSP M (FIND-M (LEFT A) N))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (EQUAL (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N))))
(NOT (LAMBDAP (LEFT A))))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(NBETA-STEP (UNTRANS (RIGHT A) M N)
(NBSTEP (MAKE-BSTEP (RIGHT A) (RIGHT B))
(UNTRANS (RIGHT A) M N)))
(LESSP M (FIND-M (LEFT A) N))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (LEFT A))
(TERMP (RIGHT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (EQUAL (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N))))
(NOT (FREE-FOR (NBODY (UNTRANS (LEFT A) M N))
(UNTRANS (RIGHT A) M N))))
(NBETA-STEP (UNTRANS (LEFT A) M N)
(NBSTEP (MAKE-BSTEP (LEFT A) (LEFT B))
(UNTRANS (LEFT A) M N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (AND (LAMBDAP A) (LAMBDAP B)))
(NOT (COMBP A))
(BETA-STEP A B)
(TERMP A)
(NOT (LESSP M (FIND-M A N))))
(NBETA-STEP (UNTRANS A M N)
(NBSTEP (MAKE-BSTEP A B)
(UNTRANS A M N)))),
which simplifies, expanding the functions AND and BETA-STEP, to:
T.
Q.E.D.
[ 0.0 0.5 0.1 ]
UNTRANS-BETA-STEP
(PROVE-LEMMA FIND-M-BUMP2
(REWRITE)
(IMPLIES (LEQ COUNT N)
(EQUAL (FIND-M (BUMP Y COUNT) (ADD1 N))
(FIND-M Y N))))
Give the conjecture the name *1.
Let us appeal to the induction principle. 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 (LAMBDAP Y)
(p (BODY Y) (ADD1 COUNT) (ADD1 N)))
(p Y COUNT N))
(IMPLIES (AND (NOT (LAMBDAP Y))
(COMBP Y)
(p (LEFT Y) COUNT N)
(p (RIGHT Y) COUNT N))
(p Y COUNT N))
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y))
(p Y COUNT N))
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP COUNT Y)))
(p Y COUNT N))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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 N and COUNT. The above induction scheme
produces five new goals:
Case 5. (IMPLIES (AND (LAMBDAP Y)
(LESSP (ADD1 N) (ADD1 COUNT))
(NOT (LESSP N COUNT)))
(EQUAL (FIND-M (BUMP Y COUNT) (ADD1 N))
(FIND-M Y N))),
which simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (LAMBDAP Y)
(EQUAL (FIND-M (BUMP (BODY Y) (ADD1 COUNT))
(ADD1 (ADD1 N)))
(FIND-M (BODY Y) (ADD1 N)))
(NOT (LESSP N COUNT)))
(EQUAL (FIND-M (BUMP Y COUNT) (ADD1 N))
(FIND-M Y N))),
which simplifies, rewriting with BODY-LAMBDA, and opening up BUMP and FIND-M,
to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP Y))
(COMBP Y)
(EQUAL (FIND-M (BUMP (LEFT Y) COUNT)
(ADD1 N))
(FIND-M (LEFT Y) N))
(EQUAL (FIND-M (BUMP (RIGHT Y) COUNT)
(ADD1 N))
(FIND-M (RIGHT Y) N))
(NOT (LESSP N COUNT)))
(EQUAL (FIND-M (BUMP Y COUNT) (ADD1 N))
(FIND-M Y N))).
This simplifies, rewriting with the lemmas RIGHT-COMB and LEFT-COMB, and
expanding the functions BUMP and FIND-M, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y)
(NOT (LESSP N COUNT)))
(EQUAL (FIND-M (BUMP Y COUNT) (ADD1 N))
(FIND-M Y N))).
This simplifies, rewriting with the lemma SUB1-ADD1, and opening up the
functions BUMP, DIFFERENCE, and FIND-M, to the following three new formulas:
Case 2.3.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y)
(NOT (LESSP N COUNT))
(NOT (NUMBERP N))
(NOT (NUMBERP Y)))
(EQUAL (DIFFERENCE 0 0)
(DIFFERENCE Y N))).
But this again simplifies, unfolding the definition of LESSP, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y)
(NOT (LESSP N COUNT))
(NOT (NUMBERP N))
(NUMBERP Y))
(EQUAL (DIFFERENCE Y 0)
(DIFFERENCE Y N))),
which again simplifies, expanding the functions LESSP, EQUAL, and
DIFFERENCE, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(LESSP COUNT Y)
(NOT (LESSP N COUNT))
(NUMBERP N)
(NOT (NUMBERP Y)))
(EQUAL (DIFFERENCE 0 N)
(DIFFERENCE Y N))),
which again simplifies, expanding the function LESSP, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP Y))
(NOT (COMBP Y))
(NOT (LESSP COUNT Y))
(NOT (LESSP N COUNT)))
(EQUAL (FIND-M (BUMP Y COUNT) (ADD1 N))
(FIND-M Y N))),
which simplifies, using linear arithmetic, appealing to the lemma DIFF-ZERO,
and unfolding BUMP, FIND-M, and EQUAL, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
FIND-M-BUMP2
(PROVE-LEMMA TERMP-BETA-STEP
(REWRITE)
(IMPLIES (AND (BETA-STEP A B) (TERMP A))
(TERMP B))
((INDUCT (BETA-STEP A B))))
WARNING: Note that TERMP-BETA-STEP contains the free variable A which will be
chosen by instantiating the hypothesis (BETA-STEP A B).
This conjecture can be simplified, using the abbreviations IMPLIES, NOT, OR,
and AND, to four new formulas:
Case 4. (IMPLIES (AND (EQUAL A B)
(BETA-STEP A B)
(TERMP A))
(TERMP B)),
which simplifies, obviously, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL A B))
(LAMBDAP A)
(IMPLIES (AND (BETA-STEP (BODY A) (BODY B))
(TERMP (BODY A)))
(TERMP (BODY B)))
(BETA-STEP A B)
(TERMP A))
(TERMP B)).
This simplifies, expanding the functions AND, IMPLIES, BETA-STEP, and TERMP,
to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(COMBP A)
(IMPLIES (AND (BETA-STEP (RIGHT A) (RIGHT B))
(TERMP (RIGHT A)))
(TERMP (RIGHT B)))
(IMPLIES (AND (BETA-STEP (LEFT A) (LEFT B))
(TERMP (LEFT A)))
(TERMP (LEFT B)))
(BETA-STEP A B)
(TERMP A))
(TERMP B)).
This simplifies, unfolding AND, IMPLIES, BETA-STEP, and TERMP, to the
following four new conjectures:
Case 2.4.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (BETA-STEP (RIGHT A) (RIGHT B)))
(NOT (BETA-STEP (LEFT A) (LEFT B)))
(LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))
(TERMP (LEFT A))
(TERMP (RIGHT A)))
(TERMP B)).
This again simplifies, obviously, to the new formula:
(IMPLIES
(AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(NOT (BETA-STEP (RIGHT A)
(RIGHT (SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(NOT (BETA-STEP (LEFT A)
(LEFT (SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(LAMBDAP (LEFT A))
(TERMP (LEFT A))
(TERMP (RIGHT A)))
(TERMP (SUBST (BODY (LEFT A)) (RIGHT A) 1))).
Applying the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, replace A by (COMB X Z)
to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to eliminate
(BODY X). We thus obtain the new goal:
(IMPLIES (AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(NOT (BETA-STEP Z (RIGHT (SUBST V Z 1))))
(NOT (BETA-STEP (LAMBDA V)
(LEFT (SUBST V Z 1))))
(TERMP (LAMBDA V))
(TERMP Z))
(TERMP (SUBST V Z 1))),
which further simplifies, applying the lemmas BODY-LAMBDA and TERMP-SUBST,
and expanding the definitions of BETA-STEP, TERMP, and EQUAL, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (BETA-STEP (RIGHT A) (RIGHT B)))
(TERMP (LEFT B))
(LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))
(TERMP (LEFT A))
(TERMP (RIGHT A)))
(TERMP B)),
which again simplifies, obviously, to:
(IMPLIES
(AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(NOT (BETA-STEP (RIGHT A)
(RIGHT (SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(TERMP (LEFT (SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(LAMBDAP (LEFT A))
(TERMP (LEFT A))
(TERMP (RIGHT A)))
(TERMP (SUBST (BODY (LEFT A)) (RIGHT A) 1))).
Applying the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, replace A by (COMB X Z)
to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to eliminate
(BODY X). We thus obtain:
(IMPLIES (AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(NOT (BETA-STEP Z (RIGHT (SUBST V Z 1))))
(TERMP (LEFT (SUBST V Z 1)))
(TERMP (LAMBDA V))
(TERMP Z))
(TERMP (SUBST V Z 1))),
which further simplifies, applying the lemmas BODY-LAMBDA and TERMP-SUBST,
and opening up TERMP and EQUAL, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(TERMP (RIGHT B))
(NOT (BETA-STEP (LEFT A) (LEFT B)))
(LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))
(TERMP (LEFT A))
(TERMP (RIGHT A)))
(TERMP B)),
which again simplifies, clearly, to the new goal:
(IMPLIES
(AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(TERMP (RIGHT (SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(NOT (BETA-STEP (LEFT A)
(LEFT (SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(LAMBDAP (LEFT A))
(TERMP (LEFT A))
(TERMP (RIGHT A)))
(TERMP (SUBST (BODY (LEFT A)) (RIGHT A) 1))).
Applying the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, replace A by (COMB X Z)
to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to eliminate
(BODY X). This produces the new goal:
(IMPLIES (AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(TERMP (RIGHT (SUBST V Z 1)))
(NOT (BETA-STEP (LAMBDA V)
(LEFT (SUBST V Z 1))))
(TERMP (LAMBDA V))
(TERMP Z))
(TERMP (SUBST V Z 1))),
which further simplifies, applying BODY-LAMBDA and TERMP-SUBST, and
opening up BETA-STEP, TERMP, and EQUAL, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(TERMP (RIGHT B))
(TERMP (LEFT B))
(LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))
(TERMP (LEFT A))
(TERMP (RIGHT A)))
(TERMP B)).
This again simplifies, obviously, to:
(IMPLIES (AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(TERMP (RIGHT (SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(TERMP (LEFT (SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(LAMBDAP (LEFT A))
(TERMP (LEFT A))
(TERMP (RIGHT A)))
(TERMP (SUBST (BODY (LEFT A)) (RIGHT A) 1))).
Applying the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, replace A by (COMB X Z)
to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to eliminate
(BODY X). We would thus like to prove the new goal:
(IMPLIES (AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(TERMP (RIGHT (SUBST V Z 1)))
(TERMP (LEFT (SUBST V Z 1)))
(TERMP (LAMBDA V))
(TERMP Z))
(TERMP (SUBST V Z 1))),
which further simplifies, rewriting with BODY-LAMBDA and TERMP-SUBST, and
opening up the definitions of TERMP and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (LAMBDAP A))
(NOT (COMBP A))
(BETA-STEP A B)
(TERMP A))
(TERMP B)).
This simplifies, opening up the definition of BETA-STEP, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
TERMP-BETA-STEP
(PROVE-LEMMA TERMP-REDUCTION
(REWRITE)
(IMPLIES (AND (REDUCTION A B LIST) (TERMP A))
(TERMP B)))
WARNING: Note that TERMP-REDUCTION contains the free variables LIST and A
which will be chosen by instantiating the hypothesis (REDUCTION A B LIST).
Give the conjecture the name *1.
We will try to prove it by induction. There are three plausible
inductions. However, only one is unflawed. We will induct according to the
following scheme:
(AND (IMPLIES (AND (LISTP LIST)
(p (CAR LIST) A (CDR LIST)))
(p B A LIST))
(IMPLIES (NOT (LISTP LIST))
(p B A LIST))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for B. The above induction scheme generates three new goals:
Case 3. (IMPLIES (AND (LISTP LIST)
(NOT (REDUCTION A (CAR LIST) (CDR LIST)))
(REDUCTION A B LIST)
(TERMP A))
(TERMP B)),
which simplifies, expanding REDUCTION, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST)
(TERMP (CAR LIST))
(REDUCTION A B LIST)
(TERMP A))
(TERMP B)),
which simplifies, appealing to the lemma TERMP-BETA-STEP, and unfolding the
definition of REDUCTION, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST))
(REDUCTION A B LIST)
(TERMP A))
(TERMP B)),
which simplifies, rewriting with TERMP-BETA-STEP, and expanding the function
REDUCTION, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
TERMP-REDUCTION
(PROVE-LEMMA FIND-M-SUBST
(REWRITE)
(IMPLIES (AND (LEQ (FIND-M X (ADD1 N)) M)
(LEQ (FIND-M Y N) M)
(LEQ IND N))
(NOT (LESSP M
(FIND-M (SUBST X Y (ADD1 IND)) N))))
((INDUCT (FIND-M-SUBST-IND X Y M N IND))))
WARNING: When the linear lemma FIND-M-SUBST is stored under:
(FIND-M (SUBST X Y (ADD1 IND)) N)
it contains the free variable M which will be chosen by instantiating the
hypothesis (NOT (LESSP M (FIND-M X (ADD1 N)))).
WARNING: Note that the proposed lemma FIND-M-SUBST 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 IMPLIES, NOT, OR,
and AND, to three new formulas:
Case 3. (IMPLIES
(AND (LAMBDAP X)
(IMPLIES (AND (IF (LESSP M
(FIND-M (BODY X) (ADD1 (ADD1 N))))
F T)
(IF (LESSP M (FIND-M (BUMP Y 0) (ADD1 N)))
F T)
(IF (LESSP (ADD1 N) (ADD1 IND)) F T))
(NOT (LESSP M
(FIND-M (SUBST (BODY X)
(BUMP Y 0)
(ADD1 (ADD1 IND)))
(ADD1 N)))))
(NOT (LESSP M (FIND-M X (ADD1 N))))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP N IND)))
(NOT (LESSP M
(FIND-M (SUBST X Y (ADD1 IND)) N)))),
which simplifies, using linear arithmetic, rewriting with FIND-M-BUMP2,
SUB1-ADD1, SUB1-TYPE-RESTRICTION, and BODY-LAMBDA, and expanding the
definitions of LESSP, AND, NOT, IMPLIES, FIND-M, ADD1, and SUBST, to the
following three new conjectures:
Case 3.3.
(IMPLIES (AND (LAMBDAP X)
(NOT (NUMBERP IND))
(NOT (NUMBERP N))
(LESSP 0 0)
(NOT (LESSP M (FIND-M X 1)))
(NOT (LESSP M (FIND-M Y N))))
(NOT (LESSP M (FIND-M (SUBST X Y 1) N)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LAMBDAP X)
(NOT (NUMBERP IND))
(NUMBERP N)
(LESSP N 0)
(NOT (LESSP M
(FIND-M (BODY X) (ADD1 (ADD1 N)))))
(NOT (LESSP M (FIND-M Y N))))
(NOT (LESSP M (FIND-M (SUBST X Y 1) N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LAMBDAP X)
(NUMBERP IND)
(NOT (NUMBERP N))
(LESSP 0 IND)
(NOT (LESSP M (FIND-M X 1)))
(NOT (LESSP M (FIND-M Y N)))
(EQUAL IND 0))
(NOT (LESSP M (FIND-M (SUBST X Y 1) N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES
(AND (NOT (LAMBDAP X))
(COMBP X)
(IMPLIES (AND (IF (LESSP M (FIND-M (RIGHT X) (ADD1 N)))
F T)
(IF (LESSP M (FIND-M Y N)) F T)
(IF (LESSP N IND) F T))
(NOT (LESSP M
(FIND-M (SUBST (RIGHT X) Y (ADD1 IND))
N))))
(IMPLIES (AND (IF (LESSP M (FIND-M (LEFT X) (ADD1 N)))
F T)
(IF (LESSP M (FIND-M Y N)) F T)
(IF (LESSP N IND) F T))
(NOT (LESSP M
(FIND-M (SUBST (LEFT X) Y (ADD1 IND))
N))))
(NOT (LESSP M (FIND-M X (ADD1 N))))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP N IND)))
(NOT (LESSP M
(FIND-M (SUBST X Y (ADD1 IND)) N)))),
which simplifies, rewriting with RIGHT-COMB and LEFT-COMB, and opening up
AND, NOT, IMPLIES, FIND-M, and SUBST, to the following two new formulas:
Case 2.2.
(IMPLIES (AND (COMBP X)
(LESSP M (FIND-M (RIGHT X) (ADD1 N)))
(NOT (LESSP M
(FIND-M (SUBST (LEFT X) Y (ADD1 IND))
N)))
(NOT (LESSP (FIND-M (LEFT X) (ADD1 N))
(FIND-M (RIGHT X) (ADD1 N))))
(NOT (LESSP M (FIND-M (LEFT X) (ADD1 N))))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP N IND))
(LESSP (FIND-M (SUBST (LEFT X) Y (ADD1 IND))
N)
(FIND-M (SUBST (RIGHT X) Y (ADD1 IND))
N)))
(NOT (LESSP M
(FIND-M (SUBST (RIGHT X) Y (ADD1 IND))
N)))).
This again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (COMBP X)
(NOT (LESSP M
(FIND-M (SUBST (RIGHT X) Y (ADD1 IND))
N)))
(LESSP M (FIND-M (LEFT X) (ADD1 N)))
(LESSP (FIND-M (LEFT X) (ADD1 N))
(FIND-M (RIGHT X) (ADD1 N)))
(NOT (LESSP M (FIND-M (RIGHT X) (ADD1 N))))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP N IND))
(NOT (LESSP (FIND-M (SUBST (LEFT X) Y (ADD1 IND))
N)
(FIND-M (SUBST (RIGHT X) Y (ADD1 IND))
N))))
(NOT (LESSP M
(FIND-M (SUBST (LEFT X) Y (ADD1 IND))
N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP M (FIND-M X (ADD1 N))))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP N IND)))
(NOT (LESSP M
(FIND-M (SUBST X Y (ADD1 IND)) N)))),
which simplifies, using linear arithmetic, applying the lemmas SUB1-ADD1,
SUB1-TYPE-RESTRICTION, and DIFF-ZERO, and opening up the functions
DIFFERENCE, FIND-M, LESSP, ADD1, SUBST, EQUAL, COMBP, and LAMBDAP, to eight
new goals:
Case 1.8.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP N))
(NOT (LESSP M (DIFFERENCE (SUB1 X) 0)))
(NOT (LESSP M (FIND-M Y N)))
(EQUAL IND 0)
(NOT (EQUAL X 1))
(LESSP 1 X))
(NOT (LESSP M (FIND-M (SUB1 X) N)))),
which again simplifies, expanding the definitions of EQUAL, DIFFERENCE,
FIND-M, LESSP, SUB1, and NUMBERP, to:
T.
Case 1.7.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP N))
(NOT (LESSP M (DIFFERENCE (SUB1 X) 0)))
(NOT (LESSP M (FIND-M Y N)))
(EQUAL IND 0)
(NOT (EQUAL X 1))
(NOT (LESSP 1 X)))
(NOT (LESSP M (FIND-M X N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.6.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP N))
(NOT (LESSP M (DIFFERENCE (SUB1 X) 0)))
(NOT (LESSP M (FIND-M Y N)))
(NOT (NUMBERP IND))
(NOT (EQUAL X 1))
(LESSP 1 X))
(NOT (LESSP M (FIND-M (SUB1 X) N)))),
which again simplifies, expanding the functions EQUAL, DIFFERENCE, FIND-M,
LESSP, SUB1, and NUMBERP, to:
T.
Case 1.5.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP N))
(NOT (LESSP M (DIFFERENCE (SUB1 X) 0)))
(NOT (LESSP M (FIND-M Y N)))
(NOT (NUMBERP IND))
(NOT (EQUAL X 1))
(NOT (LESSP 1 X)))
(NOT (LESSP M (FIND-M X N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.4.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NUMBERP N)
(NOT (LESSP M (DIFFERENCE (SUB1 X) N)))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP N IND))
(NOT (EQUAL X (ADD1 IND)))
(NOT (NUMBERP IND))
(LESSP 0 (SUB1 X)))
(NOT (LESSP M (FIND-M (SUB1 X) N)))),
which again simplifies, appealing to the lemma SUB1-TYPE-RESTRICTION, and
expanding the functions LESSP, EQUAL, and FIND-M, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NUMBERP N)
(NOT (LESSP M (DIFFERENCE (SUB1 X) N)))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP N IND))
(NOT (EQUAL X (ADD1 IND)))
(NUMBERP IND)
(LESSP IND (SUB1 X)))
(NOT (LESSP M (FIND-M (SUB1 X) N)))),
which again simplifies, opening up the definition of FIND-M, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NUMBERP N)
(NOT (LESSP M (DIFFERENCE (SUB1 X) N)))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP N IND))
(NOT (EQUAL X (ADD1 IND)))
(NOT (NUMBERP IND))
(NOT (LESSP 0 (SUB1 X))))
(NOT (LESSP M (FIND-M X N)))),
which again simplifies, using linear arithmetic, to the formula:
(IMPLIES (AND (NOT (LAMBDAP 1))
(NOT (COMBP 1))
(NOT (EQUAL 1 0))
(NUMBERP 1)
(NUMBERP N)
(NOT (LESSP M (DIFFERENCE (SUB1 1) N)))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP N IND))
(NOT (EQUAL 1 (ADD1 IND)))
(NOT (NUMBERP IND))
(NOT (LESSP 0 (SUB1 1))))
(NOT (LESSP M (FIND-M 1 N)))).
This again simplifies, using linear arithmetic, rewriting with DIFF-ZERO
and SUB1-TYPE-RESTRICTION, and unfolding the functions LAMBDAP, COMBP,
EQUAL, NUMBERP, SUB1, and LESSP, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (EQUAL X 0))
(NUMBERP X)
(NUMBERP N)
(NOT (LESSP M (DIFFERENCE (SUB1 X) N)))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP N IND))
(NOT (EQUAL X (ADD1 IND)))
(NUMBERP IND)
(NOT (LESSP IND (SUB1 X))))
(NOT (LESSP M (FIND-M X N)))).
This again simplifies, using linear arithmetic, applying the lemma
DIFF-ZERO, and opening up EQUAL, LESSP, and FIND-M, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
FIND-M-SUBST
(PROVE-LEMMA UNTRANS-SUBST-NSUBST
(REWRITE)
(IMPLIES (AND (TERMP X)
(TERMP Y)
(LAMBDAP X)
(LEQ (FIND-M Y N) M)
(LEQ (FIND-M X N) M))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))
(UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N)
(BINDINGS M N)))
((USE (TRANSLATE-ALPHA (A (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N))))
(B (UNTRANS (SUBST (BODY X) Y 1) M N))
(BOUNDS (BINDINGS M N))
(BOUNDS2 (BINDINGS M N)))
(UNTRANS-TRANS (X (SUBST (BODY X) Y 1))))))
This conjecture simplifies, applying UNTRANS-SUBST, and expanding AND, IMPLIES,
and TERMP, to eight new formulas:
Case 8. (IMPLIES (AND (NOT (NTERMP (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))))
(NOT (TERMP (SUBST (BODY X) Y 1)))
(TERMP (BODY X))
(TERMP Y)
(LAMBDAP X)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))
(UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))),
which again simplifies, rewriting with TERMP-SUBST, and expanding EQUAL, to:
T.
Case 7. (IMPLIES (AND (NOT (NTERMP (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))))
(LESSP M
(FIND-M (SUBST (BODY X) Y 1) N))
(TERMP (BODY X))
(TERMP Y)
(LAMBDAP X)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))
(UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))).
Appealing to the lemma BODY-ELIM, we now replace X by (LAMBDA Z) to
eliminate (BODY X). The result is:
(IMPLIES (AND (NOT (NTERMP (NSUBST (NBODY (UNTRANS (LAMBDA Z) M N))
(UNTRANS Y M N)
(NBIND (UNTRANS (LAMBDA Z) M N)))))
(LESSP M (FIND-M (SUBST Z Y 1) N))
(TERMP Z)
(TERMP Y)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M (LAMBDA Z) N))))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS (LAMBDA Z) M N))
(UNTRANS Y M N)
(NBIND (UNTRANS (LAMBDA Z) M N)))
(UNTRANS (SUBST Z Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))).
However this further simplifies, rewriting with BODY-LAMBDA, NBODY-NLAMBDA,
NBIND-NLAMBDA, NTERMP-TERMP, and NTERMP-SUBST, and opening up UNTRANS, to:
T.
Case 6. (IMPLIES (AND (NOT (NTERMP (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))))
(EQUAL (TRANSLATE (UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N))
(SUBST (BODY X) Y 1))
(TERMP (BODY X))
(TERMP Y)
(LAMBDAP X)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))
(UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))).
Appealing to the lemma BODY-ELIM, we now replace X by (LAMBDA Z) to
eliminate (BODY X). We must thus prove:
(IMPLIES (AND (NOT (NTERMP (NSUBST (NBODY (UNTRANS (LAMBDA Z) M N))
(UNTRANS Y M N)
(NBIND (UNTRANS (LAMBDA Z) M N)))))
(EQUAL (TRANSLATE (UNTRANS (SUBST Z Y 1) M N)
(BINDINGS M N))
(SUBST Z Y 1))
(TERMP Z)
(TERMP Y)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M (LAMBDA Z) N))))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS (LAMBDA Z) M N))
(UNTRANS Y M N)
(NBIND (UNTRANS (LAMBDA Z) M N)))
(UNTRANS (SUBST Z Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))).
But this further simplifies, applying BODY-LAMBDA, NBODY-NLAMBDA,
NBIND-NLAMBDA, NTERMP-TERMP, and NTERMP-SUBST, and unfolding the definition
of UNTRANS, to:
T.
Case 5. (IMPLIES (AND (NOT (NTERMP (UNTRANS (SUBST (BODY X) Y 1) M N)))
(NOT (TERMP (SUBST (BODY X) Y 1)))
(TERMP (BODY X))
(TERMP Y)
(LAMBDAP X)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))
(UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))).
This again simplifies, applying TERMP-SUBST, and unfolding the definition of
EQUAL, to:
T.
Case 4. (IMPLIES (AND (NOT (NTERMP (UNTRANS (SUBST (BODY X) Y 1) M N)))
(LESSP M
(FIND-M (SUBST (BODY X) Y 1) N))
(TERMP (BODY X))
(TERMP Y)
(LAMBDAP X)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))
(UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))).
But this again simplifies, rewriting with the lemmas TERMP-SUBST and
NTERMP-TERMP, and unfolding EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (NTERMP (UNTRANS (SUBST (BODY X) Y 1) M N)))
(EQUAL (TRANSLATE (UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N))
(SUBST (BODY X) Y 1))
(TERMP (BODY X))
(TERMP Y)
(LAMBDAP X)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))
(UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))),
which again simplifies, rewriting with TERMP-SUBST and NTERMP-TERMP, and
unfolding the definition of EQUAL, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL (SUBST (BODY X) Y 1)
(TRANSLATE (UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N))))
(NOT (TERMP (SUBST (BODY X) Y 1)))
(TERMP (BODY X))
(TERMP Y)
(LAMBDAP X)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))
(UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))).
But this again simplifies, applying TERMP-SUBST, and unfolding the
definition of EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL (SUBST (BODY X) Y 1)
(TRANSLATE (UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N))))
(LESSP M
(FIND-M (SUBST (BODY X) Y 1) N))
(TERMP (BODY X))
(TERMP Y)
(LAMBDAP X)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS X M N))
(UNTRANS Y M N)
(NBIND (UNTRANS X M N)))
(UNTRANS (SUBST (BODY X) Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))).
Appealing to the lemma BODY-ELIM, we now replace X by (LAMBDA Z) to
eliminate (BODY X). We must thus prove:
(IMPLIES (AND (NOT (EQUAL (SUBST Z Y 1)
(TRANSLATE (UNTRANS (SUBST Z Y 1) M N)
(BINDINGS M N))))
(LESSP M (FIND-M (SUBST Z Y 1) N))
(TERMP Z)
(TERMP Y)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M (LAMBDA Z) N))))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS (LAMBDA Z) M N))
(UNTRANS Y M N)
(NBIND (UNTRANS (LAMBDA Z) M N)))
(UNTRANS (SUBST Z Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))).
But this further simplifies, applying BODY-LAMBDA, NBODY-NLAMBDA, and
NBIND-NLAMBDA, and expanding FIND-M and UNTRANS, to:
(IMPLIES (AND (NOT (EQUAL (SUBST Z Y 1)
(TRANSLATE (UNTRANS (SUBST Z Y 1) M N)
(BINDINGS M N))))
(LESSP M (FIND-M (SUBST Z Y 1) N))
(TERMP Z)
(TERMP Y)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M Z (ADD1 N)))))
(ALPHA-EQUAL (NSUBST (UNTRANS Z M (ADD1 N))
(UNTRANS Y M N)
(PLUS M (ADD1 N)))
(UNTRANS (SUBST Z Y 1) M N)
(BINDINGS M N)
(BINDINGS M N))),
which again simplifies, using linear arithmetic, rewriting with FIND-M-SUBST,
and expanding the function ADD1, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
UNTRANS-SUBST-NSUBST
(PROVE-LEMMA UNTRANS-NBSTEP
(REWRITE)
(IMPLIES (AND (TERMP X) (LEQ (FIND-M X N) M))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))))
Name the conjecture *1.
Perhaps we can prove it by induction. There are seven plausible
inductions. They merge into three likely candidate inductions. However, only
one is unflawed. We will induct according to the following scheme:
(AND (IMPLIES (AND (LAMBDAP X)
(p W (BODY X) M (ADD1 N)))
(p W X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(p (LEFT-INSTRS W) (LEFT X) M N)
(p (RIGHT-INSTRS W) (RIGHT X) M N))
(p W X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(p (RIGHT-INSTRS W) (RIGHT X) M N)
(p (LEFT-INSTRS W) (LEFT X) M N))
(p W X M N))
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X)))
(p W X M N))).
Linear arithmetic and the lemmas BODY-LESSP, RIGHT-LESSP, and LEFT-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. Note,
however, the inductive instances chosen for W and N. The above induction
scheme leads to 22 new goals:
Case 22.(IMPLIES (AND (LAMBDAP X)
(NOT (TERMP (BODY X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, opening up the definition of TERMP, to:
T.
Case 21.(IMPLIES (AND (LAMBDAP X)
(LESSP M (FIND-M (BODY X) (ADD1 N)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, unfolding TERMP and FIND-M, to:
T.
Case 20.(IMPLIES (AND (LAMBDAP X)
(ALPHA-EQUAL (NBSTEP W
(UNTRANS (BODY X) M (ADD1 N)))
(UNTRANS (BSTEP W (BODY X))
M
(ADD1 N))
(BINDINGS M (ADD1 N))
(BINDINGS M (ADD1 N)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, applying SUB1-ADD1, SUB1-TYPE-RESTRICTION, NBODY-NLAMBDA,
NBIND-NLAMBDA, and BODY-LAMBDA, and unfolding BINDINGS, TERMP, FIND-M,
UNTRANS, NBSTEP, BSTEP, and ALPHA-EQUAL, to:
(IMPLIES (AND (LAMBDAP X)
(NOT (NUMBERP N))
(ALPHA-EQUAL (NBSTEP W
(UNTRANS (BODY X) M (ADD1 N)))
(UNTRANS (BSTEP W (BODY X))
M
(ADD1 N))
(CONS (PLUS M (ADD1 N))
(BINDINGS M 0))
(CONS (PLUS M (ADD1 N))
(BINDINGS M 0)))
(TERMP (BODY X))
(NOT (LESSP M (FIND-M (BODY X) (ADD1 N)))))
(ALPHA-EQUAL (NBSTEP W
(UNTRANS (BODY X) M (ADD1 N)))
(UNTRANS (BSTEP W (BODY X)) M 1)
(LIST (PLUS M 1))
(LIST (PLUS M 1)))),
which again simplifies, applying SUB1-TYPE-RESTRICTION, and opening up the
definitions of EQUAL and BINDINGS, to:
T.
Case 19.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT (TERMP (LEFT X)))
(NOT (TERMP (RIGHT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))).
This simplifies, opening up TERMP, to:
T.
Case 18.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (LEFT X) N))
(NOT (TERMP (RIGHT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))).
This simplifies, unfolding TERMP, to:
T.
Case 17.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(ALPHA-EQUAL (NBSTEP (LEFT-INSTRS W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(NOT (TERMP (RIGHT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))).
This simplifies, unfolding the definitions of LEFT-INSTRS and TERMP, to:
T.
Case 16.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT (TERMP (LEFT X)))
(LESSP M (FIND-M (RIGHT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))).
This simplifies, opening up the function TERMP, to:
T.
Case 15.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (LEFT X) N))
(LESSP M (FIND-M (RIGHT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))).
This simplifies, unfolding the functions TERMP and FIND-M, to:
T.
Case 14.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(ALPHA-EQUAL (NBSTEP (LEFT-INSTRS W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(LESSP M (FIND-M (RIGHT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))).
This simplifies, expanding LEFT-INSTRS, TERMP, and FIND-M, to:
T.
Case 13.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(NOT (TERMP (LEFT X)))
(ALPHA-EQUAL (NBSTEP (RIGHT-INSTRS W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))).
This simplifies, opening up RIGHT-INSTRS and TERMP, to:
T.
Case 12.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (LEFT X) N))
(ALPHA-EQUAL (NBSTEP (RIGHT-INSTRS W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))).
This simplifies, appealing to the lemmas NRIGHT-NCOMB, LAMBDAP-UNTRANS, and
NLEFT-NCOMB, and unfolding the functions RIGHT-INSTRS, TERMP, FIND-M,
UNTRANS, LEFT-INSTRS, COMMAND, NBSTEP, and BSTEP, to the following three new
formulas:
Case 12.3.
(IMPLIES
(AND (COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (LEFT X) N))
(ALPHA-EQUAL (NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (RIGHT X) N)))
(NOT (EQUAL (CADDR W) 'REDUCE)))
(ALPHA-EQUAL (NCOMB (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N)))
(UNTRANS (COMB (BSTEP (LEFT-INSTRS W) (LEFT X))
(BSTEP (RIGHT-INSTRS W) (RIGHT X)))
M N)
(BINDINGS M N)
(BINDINGS M N))).
This again simplifies, using linear arithmetic, to:
T.
Case 12.2.
(IMPLIES
(AND (COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (LEFT X) N))
(ALPHA-EQUAL (NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (RIGHT X) N)))
(NOT (LAMBDAP (LEFT X))))
(ALPHA-EQUAL (NCOMB (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N)))
(UNTRANS (COMB (BSTEP (LEFT-INSTRS W) (LEFT X))
(BSTEP (RIGHT-INSTRS W) (RIGHT X)))
M N)
(BINDINGS M N)
(BINDINGS M N))),
which again simplifies, using linear arithmetic, to:
T.
Case 12.1.
(IMPLIES
(AND (COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(LESSP M (FIND-M (LEFT X) N))
(ALPHA-EQUAL (NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (RIGHT X) N)))
(LAMBDAP (LEFT X))
(EQUAL (CADDR W) 'REDUCE))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS (LEFT X) M N))
(UNTRANS (RIGHT X) M N)
(NBIND (UNTRANS (LEFT X) M N)))
(UNTRANS (SUBST (BODY (LEFT X)) (RIGHT X) 1)
M N)
(BINDINGS M N)
(BINDINGS M N))),
which again simplifies, using linear arithmetic, to:
T.
Case 11.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(ALPHA-EQUAL (NBSTEP (LEFT-INSTRS W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(ALPHA-EQUAL (NBSTEP (RIGHT-INSTRS W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, applying NRIGHT-NCOMB, LAMBDAP-UNTRANS, and NLEFT-NCOMB,
and expanding the definitions of LEFT-INSTRS, RIGHT-INSTRS, TERMP, FIND-M,
UNTRANS, COMMAND, NBSTEP, and BSTEP, to the following three new conjectures:
Case 11.3.
(IMPLIES
(AND (COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(ALPHA-EQUAL (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(ALPHA-EQUAL (NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (RIGHT X) N)))
(NOT (EQUAL (CADDR W) 'REDUCE)))
(ALPHA-EQUAL (NCOMB (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N)))
(UNTRANS (COMB (BSTEP (LEFT-INSTRS W) (LEFT X))
(BSTEP (RIGHT-INSTRS W) (RIGHT X)))
M N)
(BINDINGS M N)
(BINDINGS M N))).
This again simplifies, appealing to the lemmas RIGHT-COMB, LEFT-COMB,
NRIGHT-NCOMB, and NLEFT-NCOMB, and opening up the definitions of UNTRANS
and ALPHA-EQUAL, to:
T.
Case 11.2.
(IMPLIES
(AND (COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(ALPHA-EQUAL (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(ALPHA-EQUAL (NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (RIGHT X) N)))
(NOT (LAMBDAP (LEFT X))))
(ALPHA-EQUAL (NCOMB (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N)))
(UNTRANS (COMB (BSTEP (LEFT-INSTRS W) (LEFT X))
(BSTEP (RIGHT-INSTRS W) (RIGHT X)))
M N)
(BINDINGS M N)
(BINDINGS M N))),
which again simplifies, applying RIGHT-COMB, LEFT-COMB, NRIGHT-NCOMB, and
NLEFT-NCOMB, and expanding the functions UNTRANS and ALPHA-EQUAL, to:
T.
Case 11.1.
(IMPLIES
(AND (COMBP X)
(LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N))
(ALPHA-EQUAL (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(ALPHA-EQUAL (NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (RIGHT X) N)))
(LAMBDAP (LEFT X))
(EQUAL (CADDR W) 'REDUCE))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS (LEFT X) M N))
(UNTRANS (RIGHT X) M N)
(NBIND (UNTRANS (LEFT X) M N)))
(UNTRANS (SUBST (BODY (LEFT X)) (RIGHT X) 1)
M N)
(BINDINGS M N)
(BINDINGS M N))).
However this again simplifies, using linear arithmetic and appealing to
the lemma UNTRANS-SUBST-NSUBST, to:
T.
Case 10.(IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT (TERMP (RIGHT X)))
(NOT (TERMP (LEFT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, unfolding the function TERMP, to:
T.
Case 9. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (RIGHT X) N))
(NOT (TERMP (LEFT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, unfolding the definition of TERMP, to:
T.
Case 8. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(ALPHA-EQUAL (NBSTEP (RIGHT-INSTRS W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(NOT (TERMP (LEFT X)))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, unfolding RIGHT-INSTRS and TERMP, to:
T.
Case 7. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT (TERMP (RIGHT X)))
(LESSP M (FIND-M (LEFT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, opening up TERMP, to:
T.
Case 6. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (RIGHT X) N))
(LESSP M (FIND-M (LEFT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, expanding TERMP and FIND-M, to:
T.
Case 5. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(ALPHA-EQUAL (NBSTEP (RIGHT-INSTRS W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(LESSP M (FIND-M (LEFT X) N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, unfolding RIGHT-INSTRS, TERMP, and FIND-M, to:
T.
Case 4. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(NOT (TERMP (RIGHT X)))
(ALPHA-EQUAL (NBSTEP (LEFT-INSTRS W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, unfolding LEFT-INSTRS and TERMP, to:
T.
Case 3. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (RIGHT X) N))
(ALPHA-EQUAL (NBSTEP (LEFT-INSTRS W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, rewriting with the lemmas NRIGHT-NCOMB, LAMBDAP-UNTRANS,
and NLEFT-NCOMB, and expanding the definitions of LEFT-INSTRS, TERMP, FIND-M,
UNTRANS, RIGHT-INSTRS, COMMAND, NBSTEP, and BSTEP, to three new conjectures:
Case 3.3.
(IMPLIES
(AND (COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (RIGHT X) N))
(ALPHA-EQUAL (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (LEFT X) N)))
(NOT (EQUAL (CADDR W) 'REDUCE)))
(ALPHA-EQUAL (NCOMB (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N)))
(UNTRANS (COMB (BSTEP (LEFT-INSTRS W) (LEFT X))
(BSTEP (RIGHT-INSTRS W) (RIGHT X)))
M N)
(BINDINGS M N)
(BINDINGS M N))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES
(AND (COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (RIGHT X) N))
(ALPHA-EQUAL (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (LEFT X) N)))
(NOT (LAMBDAP (LEFT X))))
(ALPHA-EQUAL (NCOMB (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N)))
(UNTRANS (COMB (BSTEP (LEFT-INSTRS W) (LEFT X))
(BSTEP (RIGHT-INSTRS W) (RIGHT X)))
M N)
(BINDINGS M N)
(BINDINGS M N))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(LESSP M (FIND-M (RIGHT X) N))
(ALPHA-EQUAL (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (LEFT X) N)))
(LAMBDAP (LEFT X))
(EQUAL (CADDR W) 'REDUCE))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS (LEFT X) M N))
(UNTRANS (RIGHT X) M N)
(NBIND (UNTRANS (LEFT X) M N)))
(UNTRANS (SUBST (BODY (LEFT X)) (RIGHT X) 1)
M N)
(BINDINGS M N)
(BINDINGS M N))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (LAMBDAP X))
(COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(ALPHA-EQUAL (NBSTEP (RIGHT-INSTRS W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(ALPHA-EQUAL (NBSTEP (LEFT-INSTRS W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, rewriting with NRIGHT-NCOMB, LAMBDAP-UNTRANS, and
NLEFT-NCOMB, and expanding the definitions of RIGHT-INSTRS, LEFT-INSTRS,
TERMP, FIND-M, UNTRANS, COMMAND, NBSTEP, and BSTEP, to the following three
new goals:
Case 2.3.
(IMPLIES
(AND (COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(ALPHA-EQUAL (NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(ALPHA-EQUAL (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (LEFT X) N)))
(NOT (EQUAL (CADDR W) 'REDUCE)))
(ALPHA-EQUAL (NCOMB (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N)))
(UNTRANS (COMB (BSTEP (LEFT-INSTRS W) (LEFT X))
(BSTEP (RIGHT-INSTRS W) (RIGHT X)))
M N)
(BINDINGS M N)
(BINDINGS M N))).
But this again simplifies, rewriting with RIGHT-COMB, LEFT-COMB,
NRIGHT-NCOMB, and NLEFT-NCOMB, and unfolding the definitions of UNTRANS
and ALPHA-EQUAL, to:
T.
Case 2.2.
(IMPLIES
(AND (COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(ALPHA-EQUAL (NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(ALPHA-EQUAL (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (LEFT X) N)))
(NOT (LAMBDAP (LEFT X))))
(ALPHA-EQUAL (NCOMB (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N)))
(UNTRANS (COMB (BSTEP (LEFT-INSTRS W) (LEFT X))
(BSTEP (RIGHT-INSTRS W) (RIGHT X)))
M N)
(BINDINGS M N)
(BINDINGS M N))).
This again simplifies, rewriting with RIGHT-COMB, LEFT-COMB, NRIGHT-NCOMB,
and NLEFT-NCOMB, and unfolding the functions UNTRANS and ALPHA-EQUAL, to:
T.
Case 2.1.
(IMPLIES
(AND (COMBP X)
(NOT (LESSP (FIND-M (LEFT X) N)
(FIND-M (RIGHT X) N)))
(ALPHA-EQUAL (NBSTEP (CADR W)
(UNTRANS (RIGHT X) M N))
(UNTRANS (BSTEP (RIGHT-INSTRS W) (RIGHT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(ALPHA-EQUAL (NBSTEP (CAR W)
(UNTRANS (LEFT X) M N))
(UNTRANS (BSTEP (LEFT-INSTRS W) (LEFT X))
M N)
(BINDINGS M N)
(BINDINGS M N))
(TERMP (LEFT X))
(TERMP (RIGHT X))
(NOT (LESSP M (FIND-M (LEFT X) N)))
(LAMBDAP (LEFT X))
(EQUAL (CADDR W) 'REDUCE))
(ALPHA-EQUAL (NSUBST (NBODY (UNTRANS (LEFT X) M N))
(UNTRANS (RIGHT X) M N)
(NBIND (UNTRANS (LEFT X) M N)))
(UNTRANS (SUBST (BODY (LEFT X)) (RIGHT X) 1)
M N)
(BINDINGS M N)
(BINDINGS M N))).
But this again simplifies, using linear arithmetic and applying the lemma
UNTRANS-SUBST-NSUBST, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(TERMP X)
(NOT (LESSP M (FIND-M X N))))
(ALPHA-EQUAL (NBSTEP W (UNTRANS X M N))
(UNTRANS (BSTEP W X) M N)
(BINDINGS M N)
(BINDINGS M N))),
which simplifies, using linear arithmetic, applying DIFF-ZERO,
TRANSLATE-ALPHA, and SUB1-ADD1, and expanding the definitions of TERMP,
LITATOM, FIND-M, EQUAL, LESSP, UNTRANS, NBSTEP, BSTEP, TRANSLATE, NTERMP,
and DIFFERENCE, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.1 ]
UNTRANS-NBSTEP
(PROVE-LEMMA ANOTHER-FIND-M-SUBST
(REWRITE)
(IMPLIES (AND (LEQ (FIND-M Y N) M)
(LEQ (FIND-M X (ADD1 N)) M)
(LEQ IND N))
(NOT (LESSP M
(FIND-M (SUBST X Y (ADD1 IND)) N))))
((INDUCT (FIND-M-SUBST-IND X Y M N IND))))
WARNING: When the linear lemma ANOTHER-FIND-M-SUBST is stored under:
(FIND-M (SUBST X Y (ADD1 IND)) N)
it contains the free variable M which will be chosen by instantiating the
hypothesis (NOT (LESSP M (FIND-M Y N))).
WARNING: Note that the proposed lemma ANOTHER-FIND-M-SUBST 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 IMPLIES, NOT, OR,
and AND, to three new formulas:
Case 3. (IMPLIES
(AND (LAMBDAP X)
(IMPLIES (AND (IF (LESSP M (FIND-M (BUMP Y 0) (ADD1 N)))
F T)
(IF (LESSP M
(FIND-M (BODY X) (ADD1 (ADD1 N))))
F T)
(IF (LESSP (ADD1 N) (ADD1 IND)) F T))
(NOT (LESSP M
(FIND-M (SUBST (BODY X)
(BUMP Y 0)
(ADD1 (ADD1 IND)))
(ADD1 N)))))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X (ADD1 N))))
(NOT (LESSP N IND)))
(NOT (LESSP M
(FIND-M (SUBST X Y (ADD1 IND)) N)))),
which simplifies, using linear arithmetic, rewriting with FIND-M-BUMP2,
SUB1-ADD1, SUB1-TYPE-RESTRICTION, and BODY-LAMBDA, and expanding the
definitions of LESSP, AND, NOT, IMPLIES, FIND-M, ADD1, and SUBST, to the
following three new conjectures:
Case 3.3.
(IMPLIES (AND (LAMBDAP X)
(NOT (NUMBERP IND))
(NOT (NUMBERP N))
(LESSP 0 0)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X 1))))
(NOT (LESSP M (FIND-M (SUBST X Y 1) N)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES (AND (LAMBDAP X)
(NOT (NUMBERP IND))
(NUMBERP N)
(LESSP N 0)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M
(FIND-M (BODY X) (ADD1 (ADD1 N))))))
(NOT (LESSP M (FIND-M (SUBST X Y 1) N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (LAMBDAP X)
(NUMBERP IND)
(NOT (NUMBERP N))
(LESSP 0 IND)
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X 1)))
(EQUAL IND 0))
(NOT (LESSP M (FIND-M (SUBST X Y 1) N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES
(AND (NOT (LAMBDAP X))
(COMBP X)
(IMPLIES (AND (IF (LESSP M (FIND-M Y N)) F T)
(IF (LESSP M (FIND-M (RIGHT X) (ADD1 N)))
F T)
(IF (LESSP N IND) F T))
(NOT (LESSP M
(FIND-M (SUBST (RIGHT X) Y (ADD1 IND))
N))))
(IMPLIES (AND (IF (LESSP M (FIND-M Y N)) F T)
(IF (LESSP M (FIND-M (LEFT X) (ADD1 N)))
F T)
(IF (LESSP N IND) F T))
(NOT (LESSP M
(FIND-M (SUBST (LEFT X) Y (ADD1 IND))
N))))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X (ADD1 N))))
(NOT (LESSP N IND)))
(NOT (LESSP M
(FIND-M (SUBST X Y (ADD1 IND)) N)))),
which simplifies, rewriting with RIGHT-COMB and LEFT-COMB, and opening up
AND, NOT, IMPLIES, FIND-M, and SUBST, to the following two new formulas:
Case 2.2.
(IMPLIES (AND (COMBP X)
(LESSP M (FIND-M (RIGHT X) (ADD1 N)))
(NOT (LESSP M
(FIND-M (SUBST (LEFT X) Y (ADD1 IND))
N)))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP (FIND-M (LEFT X) (ADD1 N))
(FIND-M (RIGHT X) (ADD1 N))))
(NOT (LESSP M (FIND-M (LEFT X) (ADD1 N))))
(NOT (LESSP N IND))
(LESSP (FIND-M (SUBST (LEFT X) Y (ADD1 IND))
N)
(FIND-M (SUBST (RIGHT X) Y (ADD1 IND))
N)))
(NOT (LESSP M
(FIND-M (SUBST (RIGHT X) Y (ADD1 IND))
N)))).
This again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (COMBP X)
(NOT (LESSP M
(FIND-M (SUBST (RIGHT X) Y (ADD1 IND))
N)))
(LESSP M (FIND-M (LEFT X) (ADD1 N)))
(NOT (LESSP M (FIND-M Y N)))
(LESSP (FIND-M (LEFT X) (ADD1 N))
(FIND-M (RIGHT X) (ADD1 N)))
(NOT (LESSP M (FIND-M (RIGHT X) (ADD1 N))))
(NOT (LESSP N IND))
(NOT (LESSP (FIND-M (SUBST (LEFT X) Y (ADD1 IND))
N)
(FIND-M (SUBST (RIGHT X) Y (ADD1 IND))
N))))
(NOT (LESSP M
(FIND-M (SUBST (LEFT X) Y (ADD1 IND))
N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP M (FIND-M Y N)))
(NOT (LESSP M (FIND-M X (ADD1 N))))
(NOT (LESSP N IND)))
(NOT (LESSP M
(FIND-M (SUBST X Y (ADD1 IND)) N)))),
which simplifies, using linear arithmetic, applying the lemmas SUB1-ADD1,
SUB1-TYPE-RESTRICTION, and DIFF-ZERO, and opening up the functions
DIFFERENCE, FIND-M, LESSP, ADD1, SUBST, EQUAL, COMBP, and LAMBDAP, to eight
new goals:
Case 1.8.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP M (FIND-M Y N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP N))
(NOT (LESSP M (DIFFERENCE (SUB1 X) 0)))
(EQUAL IND 0)
(NOT (EQUAL X 1))
(LESSP 1 X))
(NOT (LESSP M (FIND-M (SUB1 X) N)))),
which again simplifies, expanding the definitions of EQUAL, DIFFERENCE,
FIND-M, LESSP, SUB1, and NUMBERP, to:
T.
Case 1.7.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP M (FIND-M Y N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP N))
(NOT (LESSP M (DIFFERENCE (SUB1 X) 0)))
(EQUAL IND 0)
(NOT (EQUAL X 1))
(NOT (LESSP 1 X)))
(NOT (LESSP M (FIND-M X N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.6.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP M (FIND-M Y N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP N))
(NOT (LESSP M (DIFFERENCE (SUB1 X) 0)))
(NOT (NUMBERP IND))
(NOT (EQUAL X 1))
(LESSP 1 X))
(NOT (LESSP M (FIND-M (SUB1 X) N)))),
which again simplifies, expanding the functions EQUAL, DIFFERENCE, FIND-M,
LESSP, SUB1, and NUMBERP, to:
T.
Case 1.5.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP M (FIND-M Y N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (NUMBERP N))
(NOT (LESSP M (DIFFERENCE (SUB1 X) 0)))
(NOT (NUMBERP IND))
(NOT (EQUAL X 1))
(NOT (LESSP 1 X)))
(NOT (LESSP M (FIND-M X N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.4.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP M (FIND-M Y N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NUMBERP N)
(NOT (LESSP M (DIFFERENCE (SUB1 X) N)))
(NOT (LESSP N IND))
(NOT (EQUAL X (ADD1 IND)))
(NOT (NUMBERP IND))
(LESSP 0 (SUB1 X)))
(NOT (LESSP M (FIND-M (SUB1 X) N)))),
which again simplifies, appealing to the lemma SUB1-TYPE-RESTRICTION, and
expanding the functions LESSP, EQUAL, and FIND-M, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP M (FIND-M Y N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NUMBERP N)
(NOT (LESSP M (DIFFERENCE (SUB1 X) N)))
(NOT (LESSP N IND))
(NOT (EQUAL X (ADD1 IND)))
(NUMBERP IND)
(LESSP IND (SUB1 X)))
(NOT (LESSP M (FIND-M (SUB1 X) N)))),
which again simplifies, opening up the definition of FIND-M, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP M (FIND-M Y N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NUMBERP N)
(NOT (LESSP M (DIFFERENCE (SUB1 X) N)))
(NOT (LESSP N IND))
(NOT (EQUAL X (ADD1 IND)))
(NOT (NUMBERP IND))
(NOT (LESSP 0 (SUB1 X))))
(NOT (LESSP M (FIND-M X N)))),
which again simplifies, using linear arithmetic, to the formula:
(IMPLIES (AND (NOT (LAMBDAP 1))
(NOT (COMBP 1))
(NOT (LESSP M (FIND-M Y N)))
(NOT (EQUAL 1 0))
(NUMBERP 1)
(NUMBERP N)
(NOT (LESSP M (DIFFERENCE (SUB1 1) N)))
(NOT (LESSP N IND))
(NOT (EQUAL 1 (ADD1 IND)))
(NOT (NUMBERP IND))
(NOT (LESSP 0 (SUB1 1))))
(NOT (LESSP M (FIND-M 1 N)))).
This again simplifies, using linear arithmetic, rewriting with DIFF-ZERO
and SUB1-TYPE-RESTRICTION, and unfolding the functions LAMBDAP, COMBP,
EQUAL, NUMBERP, SUB1, and LESSP, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (LAMBDAP X))
(NOT (COMBP X))
(NOT (LESSP M (FIND-M Y N)))
(NOT (EQUAL X 0))
(NUMBERP X)
(NUMBERP N)
(NOT (LESSP M (DIFFERENCE (SUB1 X) N)))
(NOT (LESSP N IND))
(NOT (EQUAL X (ADD1 IND)))
(NUMBERP IND)
(NOT (LESSP IND (SUB1 X))))
(NOT (LESSP M (FIND-M X N)))).
This again simplifies, using linear arithmetic, applying the lemma
DIFF-ZERO, and opening up EQUAL, LESSP, and FIND-M, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
ANOTHER-FIND-M-SUBST
(PROVE-LEMMA UNTRANS-NBSTEP-ZERO
(REWRITE)
(IMPLIES (AND (BETA-STEP X Y)
(TERMP X)
(LEQ (FIND-M X 0) M))
(ALPHA-EQUAL (NBSTEP (MAKE-BSTEP X Y)
(UNTRANS X M 0))
(UNTRANS Y M 0)
NIL NIL))
((USE (UNTRANS-NBSTEP (W (MAKE-BSTEP X Y))
(N 0)))))
This formula simplifies, applying the lemma MAKE-BSTEP-BETA-STEP, and
expanding the definitions of AND, EQUAL, BINDINGS, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
UNTRANS-NBSTEP-ZERO
(PROVE-LEMMA BETA-STEP-FIND-M
(REWRITE)
(IMPLIES (AND (BETA-STEP A B)
(LEQ (FIND-M A N) M))
(NOT (LESSP M (FIND-M B N))))
((INDUCT (UNTRANS-BSTEP-IND A B M N))))
WARNING: When the linear lemma BETA-STEP-FIND-M is stored under (FIND-M B N)
it contains the free variables M and A which will be chosen by instantiating
the hypotheses (BETA-STEP A B) and (NOT (LESSP M (FIND-M A N))).
WARNING: Note that the proposed lemma BETA-STEP-FIND-M 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 IMPLIES, NOT, OR,
and AND, to five new formulas:
Case 5. (IMPLIES (AND (EQUAL A B)
(BETA-STEP A B)
(NOT (LESSP M (FIND-M A N))))
(NOT (LESSP M (FIND-M B N)))),
which simplifies, clearly, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL A B))
(LAMBDAP A)
(LAMBDAP B)
(IMPLIES (AND (BETA-STEP (BODY A) (BODY B))
(IF (LESSP M (FIND-M (BODY A) (ADD1 N)))
F T))
(NOT (LESSP M (FIND-M (BODY B) (ADD1 N)))))
(BETA-STEP A B)
(NOT (LESSP M (FIND-M A N))))
(NOT (LESSP M (FIND-M B N)))).
This simplifies, unfolding AND, NOT, IMPLIES, BETA-STEP, and FIND-M, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (AND (LAMBDAP A) (LAMBDAP B)))
(COMBP A)
(LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))
(BETA-STEP A B)
(NOT (LESSP M (FIND-M A N))))
(NOT (LESSP M (FIND-M B N)))).
This simplifies, opening up AND, BETA-STEP, and FIND-M, to the following two
new conjectures:
Case 3.2.
(IMPLIES (AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(LAMBDAP (LEFT A))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N))))
(NOT (LESSP M
(FIND-M (SUBST (BODY (LEFT A)) (RIGHT A) 1)
N)))).
Appealing to the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, we now replace A by
(COMB X Z) to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to
eliminate (BODY X). We must thus prove:
(IMPLIES (AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(NOT (LESSP (FIND-M (LAMBDA V) N)
(FIND-M Z N)))
(NOT (LESSP M (FIND-M (LAMBDA V) N))))
(NOT (LESSP M (FIND-M (SUBST V Z 1) N)))).
However this further simplifies, applying BODY-LAMBDA, and unfolding the
function FIND-M, to the new conjecture:
(IMPLIES (AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(NOT (LESSP (FIND-M V (ADD1 N))
(FIND-M Z N)))
(NOT (LESSP M (FIND-M V (ADD1 N)))))
(NOT (LESSP M (FIND-M (SUBST V Z 1) N)))),
which again simplifies, using linear arithmetic, rewriting with
ANOTHER-FIND-M-SUBST, and expanding the definition of ADD1, to:
T.
Case 3.1.
(IMPLIES (AND (NOT (EQUAL A
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(COMBP A)
(LAMBDAP (LEFT A))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N))))
(NOT (LESSP M
(FIND-M (SUBST (BODY (LEFT A)) (RIGHT A) 1)
N)))).
Appealing to the lemmas LEFT-RIGHT-ELIM and BODY-ELIM, we now replace A by
(COMB X Z) to eliminate (LEFT A) and (RIGHT A) and X by (LAMBDA V) to
eliminate (BODY X). The result is the formula:
(IMPLIES (AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(LESSP (FIND-M (LAMBDA V) N)
(FIND-M Z N))
(NOT (LESSP M (FIND-M Z N))))
(NOT (LESSP M (FIND-M (SUBST V Z 1) N)))).
This further simplifies, applying BODY-LAMBDA, and opening up FIND-M, to:
(IMPLIES (AND (NOT (EQUAL (COMB (LAMBDA V) Z)
(SUBST V Z 1)))
(LESSP (FIND-M V (ADD1 N))
(FIND-M Z N))
(NOT (LESSP M (FIND-M Z N))))
(NOT (LESSP M (FIND-M (SUBST V Z 1) N)))),
which again simplifies, using linear arithmetic, applying the lemma
ANOTHER-FIND-M-SUBST, and opening up the definition of ADD1, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (AND (LAMBDAP A) (LAMBDAP B)))
(COMBP A)
(NOT (AND (LAMBDAP (LEFT A))
(EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1))))
(IMPLIES (AND (BETA-STEP (RIGHT A) (RIGHT B))
(IF (LESSP M (FIND-M (RIGHT A) N))
F T))
(NOT (LESSP M (FIND-M (RIGHT B) N))))
(IMPLIES (AND (BETA-STEP (LEFT A) (LEFT B))
(IF (LESSP M (FIND-M (LEFT A) N))
F T))
(NOT (LESSP M (FIND-M (LEFT B) N))))
(BETA-STEP A B)
(NOT (LESSP M (FIND-M A N))))
(NOT (LESSP M (FIND-M B N)))),
which simplifies, expanding the definitions of AND, NOT, IMPLIES, BETA-STEP,
and FIND-M, to four new goals:
Case 2.4.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (LAMBDAP (LEFT A)))
(LESSP M (FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (LEFT B) N)))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(LESSP (FIND-M (LEFT B) N)
(FIND-M (RIGHT B) N)))
(NOT (LESSP M (FIND-M (RIGHT B) N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (LAMBDAP (LEFT A)))
(NOT (LESSP M (FIND-M (RIGHT B) N)))
(LESSP M (FIND-M (LEFT A) N))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (LESSP (FIND-M (LEFT B) N)
(FIND-M (RIGHT B) N))))
(NOT (LESSP M (FIND-M (LEFT B) N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(LESSP M (FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (LEFT B) N)))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(NOT (LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N)))
(NOT (LESSP M (FIND-M (LEFT A) N)))
(LESSP (FIND-M (LEFT B) N)
(FIND-M (RIGHT B) N)))
(NOT (LESSP M (FIND-M (RIGHT B) N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL A B))
(COMBP A)
(NOT (EQUAL B
(SUBST (BODY (LEFT A)) (RIGHT A) 1)))
(NOT (LESSP M (FIND-M (RIGHT B) N)))
(LESSP M (FIND-M (LEFT A) N))
(COMBP B)
(BETA-STEP (LEFT A) (LEFT B))
(BETA-STEP (RIGHT A) (RIGHT B))
(LESSP (FIND-M (LEFT A) N)
(FIND-M (RIGHT A) N))
(NOT (LESSP M (FIND-M (RIGHT A) N)))
(NOT (LESSP (FIND-M (LEFT B) N)
(FIND-M (RIGHT B) N))))
(NOT (LESSP M (FIND-M (LEFT B) N)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL A B))
(NOT (AND (LAMBDAP A) (LAMBDAP B)))
(NOT (COMBP A))
(BETA-STEP A B)
(NOT (LESSP M (FIND-M A N))))
(NOT (LESSP M (FIND-M B N)))),
which simplifies, unfolding the functions AND and BETA-STEP, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
BETA-STEP-FIND-M
(PROVE-LEMMA ANOTHER-BETA-STEP-FIND-M
(REWRITE)
(IMPLIES (BETA-STEP A B)
(NOT (LESSP (FIND-M A N) (FIND-M B N))))
((USE (BETA-STEP-FIND-M (M (FIND-M A N))))))
WARNING: When the linear lemma ANOTHER-BETA-STEP-FIND-M is stored under
(FIND-M B N) it contains the free variable A which will be chosen by
instantiating the hypothesis (BETA-STEP A B).
WARNING: When the linear lemma ANOTHER-BETA-STEP-FIND-M is stored under
(FIND-M A N) it contains the free variable B which will be chosen by
instantiating the hypothesis (BETA-STEP A B).
WARNING: Note that the proposed lemma ANOTHER-BETA-STEP-FIND-M is to be
stored as zero type prescription rules, zero compound recognizer rules, two
linear rules, and zero replacement rules.
This simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
ANOTHER-BETA-STEP-FIND-M
(PROVE-LEMMA REDUCTION-FIND-M
(REWRITE)
(IMPLIES (REDUCTION A B LIST)
(NOT (LESSP (FIND-M A N) (FIND-M B N)))))
WARNING: When the linear lemma REDUCTION-FIND-M is stored under (FIND-M B N)
it contains the free variables LIST and A which will be chosen by
instantiating the hypothesis (REDUCTION A B LIST).
WARNING: When the linear lemma REDUCTION-FIND-M is stored under (FIND-M A N)
it contains the free variables LIST and B which will be chosen by
instantiating the hypothesis (REDUCTION A B LIST).
WARNING: Note that the proposed lemma REDUCTION-FIND-M is to be stored as
zero type prescription rules, zero compound recognizer rules, two linear rules,
and zero replacement rules.
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 LIST)
(p A N (CAR LIST) (CDR LIST)))
(p A N B LIST))
(IMPLIES (NOT (LISTP LIST))
(p A N B LIST))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for B. The above induction scheme generates three new goals:
Case 3. (IMPLIES (AND (LISTP LIST)
(NOT (REDUCTION A (CAR LIST) (CDR LIST)))
(REDUCTION A B LIST))
(NOT (LESSP (FIND-M A N) (FIND-M B N)))),
which simplifies, opening up the function REDUCTION, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST)
(NOT (LESSP (FIND-M A N)
(FIND-M (CAR LIST) N)))
(REDUCTION A B LIST))
(NOT (LESSP (FIND-M A N) (FIND-M B N)))),
which simplifies, expanding REDUCTION, to the conjecture:
(IMPLIES (AND (LISTP LIST)
(NOT (LESSP (FIND-M A N)
(FIND-M (CAR LIST) N)))
(BETA-STEP (CAR LIST) B)
(REDUCTION A (CAR LIST) (CDR LIST)))
(NOT (LESSP (FIND-M A N) (FIND-M B N)))).
But this again simplifies, using linear arithmetic and applying the lemma
ANOTHER-BETA-STEP-FIND-M, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST))
(REDUCTION A B LIST))
(NOT (LESSP (FIND-M A N) (FIND-M B N)))),
which simplifies, expanding REDUCTION, to:
(IMPLIES (AND (NOT (LISTP LIST))
(BETA-STEP A B))
(NOT (LESSP (FIND-M A N) (FIND-M B N)))).
But this again simplifies, using linear arithmetic and appealing to the
lemma ANOTHER-BETA-STEP-FIND-M, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
REDUCTION-FIND-M
(TOGGLE G0350 MAKE-W T)
[ 0.0 0.0 0.0 ]
G0350
(TOGGLE G0351 MAKE-REDUCTION T)
[ 0.0 0.0 0.0 ]
G0351
(DEFN MAKE-N-W
(X Y Z LIST1 LIST2)
(UNTRANS (MAKE-W (TRANSLATE X NIL)
(TRANSLATE Y NIL)
(TRANSLATE Z NIL)
(TRANS-LIST LIST1)
(TRANS-LIST LIST2))
(FIND-M (TRANSLATE X NIL) 0)
0))
[ 0.0 0.0 0.0 ]
MAKE-N-W
(PROVE-LEMMA ALPHA-EQUAL-COMMUTES
(REWRITE)
(EQUAL (ALPHA-EQUAL A B X Y)
(ALPHA-EQUAL B A Y X)))
Name the conjecture *1.
We will appeal to induction. The recursive terms in the conjecture
suggest four inductions. However, they merge into one likely candidate
induction. We will induct according to the following scheme:
(AND (IMPLIES (AND (AND (NLAMBDAP A) (NLAMBDAP B))
(p (NBODY A)
(NBODY B)
(CONS (NBIND A) X)
(CONS (NBIND B) Y)))
(p A B X Y))
(IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(p (NRIGHT A) (NRIGHT B) X Y)
(p (NLEFT A) (NLEFT B) X Y))
(p A B X Y))
(IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(AND (NUMBERP A) (NUMBERP B)))
(p A B X Y))
(IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(NOT (AND (NUMBERP A) (NUMBERP B))))
(p A B X Y))).
Linear arithmetic, the lemmas NBODY-LESSEQP, NBODY-LESSP, NRIGHT-LESSEQP,
NRIGHT-LESSP, NLEFT-LESSEQP, and NLEFT-LESSP, and the definition of AND inform
us that the measure (COUNT A) decreases according to the well-founded relation
LESSP in each induction step of the scheme. Note, however, the inductive
instances chosen for B, X, and Y. The above induction scheme produces the
following four new formulas:
Case 4. (IMPLIES (AND (AND (NLAMBDAP A) (NLAMBDAP B))
(EQUAL (ALPHA-EQUAL (NBODY A)
(NBODY B)
(CONS (NBIND A) X)
(CONS (NBIND B) Y))
(ALPHA-EQUAL (NBODY B)
(NBODY A)
(CONS (NBIND B) Y)
(CONS (NBIND A) X))))
(EQUAL (ALPHA-EQUAL A B X Y)
(ALPHA-EQUAL B A Y X))).
This simplifies, expanding the definitions of AND and ALPHA-EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(AND (NCOMBP A) (NCOMBP B))
(EQUAL (ALPHA-EQUAL (NRIGHT A)
(NRIGHT B)
X Y)
(ALPHA-EQUAL (NRIGHT B)
(NRIGHT A)
Y X))
(EQUAL (ALPHA-EQUAL (NLEFT A) (NLEFT B) X Y)
(ALPHA-EQUAL (NLEFT B)
(NLEFT A)
Y X)))
(EQUAL (ALPHA-EQUAL A B X Y)
(ALPHA-EQUAL B A Y X))).
This simplifies, expanding the definitions of AND and ALPHA-EQUAL, to:
T.
Case 2. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(AND (NUMBERP A) (NUMBERP B)))
(EQUAL (ALPHA-EQUAL A B X Y)
(ALPHA-EQUAL B A Y X))).
This simplifies, opening up the functions AND and ALPHA-EQUAL, to the
following eight new goals:
Case 2.8.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NUMBERP A)
(NUMBERP B)
(NOT (EQUAL (INDEX B Y) (INDEX A X))))
(NOT (EQUAL (INDEX A X) (INDEX B Y)))).
This again simplifies, trivially, to:
T.
Case 2.7.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NUMBERP A)
(NUMBERP B)
(EQUAL (INDEX B Y) (INDEX A X)))
(EQUAL (EQUAL (INDEX A X) (INDEX B Y))
T)).
However this again simplifies, unfolding the function EQUAL, to:
T.
Case 2.6.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NUMBERP A)
(NUMBERP B)
(NOT (EQUAL (INDEX B Y) (INDEX A X))))
(NOT (EQUAL (INDEX A X) (INDEX B Y)))),
which again simplifies, obviously, to:
T.
Case 2.5.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NUMBERP A)
(NUMBERP B)
(EQUAL (INDEX B Y) (INDEX A X)))
(EQUAL (EQUAL (INDEX A X) (INDEX B Y))
T)).
This again simplifies, expanding the function EQUAL, to:
T.
Case 2.4.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NUMBERP A)
(NUMBERP B)
(NOT (EQUAL (INDEX B Y) (INDEX A X))))
(NOT (EQUAL (INDEX A X) (INDEX B Y)))),
which again simplifies, obviously, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NUMBERP A)
(NUMBERP B)
(EQUAL (INDEX B Y) (INDEX A X)))
(EQUAL (EQUAL (INDEX A X) (INDEX B Y))
T)).
This again simplifies, opening up the function EQUAL, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NUMBERP A)
(NUMBERP B)
(NOT (EQUAL (INDEX B Y) (INDEX A X))))
(NOT (EQUAL (INDEX A X) (INDEX B Y)))),
which again simplifies, obviously, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NUMBERP A)
(NUMBERP B)
(EQUAL (INDEX B Y) (INDEX A X)))
(EQUAL (EQUAL (INDEX A X) (INDEX B Y))
T)).
But this again simplifies, opening up EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (AND (NLAMBDAP A) (NLAMBDAP B)))
(NOT (AND (NCOMBP A) (NCOMBP B)))
(NOT (AND (NUMBERP A) (NUMBERP B))))
(EQUAL (ALPHA-EQUAL A B X Y)
(ALPHA-EQUAL B A Y X))),
which simplifies, opening up the functions AND and ALPHA-EQUAL, to 34 new
formulas:
Case 1.34.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(EQUAL A B))
(EQUAL (EQUAL B A) T)),
which again simplifies, expanding EQUAL, to:
T.
Case 1.33.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(NOT (EQUAL A B))
(NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP B)))
(NOT (EQUAL B A))),
which again simplifies, trivially, to:
T.
Case 1.32.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(EQUAL A B))
(NOT (NLAMBDAP B))).
This again simplifies, trivially, to:
T.
Case 1.31.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(EQUAL A B))
(NOT (NUMBERP B))).
This again simplifies, clearly, to:
T.
Case 1.30.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(EQUAL A B))
(NOT (NCOMBP B))).
This again simplifies, clearly, to:
T.
Case 1.29.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NLAMBDAP B)
(NOT (NUMBERP A)))
(EQUAL (EQUAL A B) F)).
This again simplifies, trivially, to:
T.
Case 1.28.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NCOMBP B)
(NOT (NUMBERP A)))
(EQUAL (EQUAL A B) F)).
This again simplifies, clearly, to:
T.
Case 1.27.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP A)))
(EQUAL (EQUAL A B) (EQUAL B A))).
This again simplifies, clearly, to the following two new goals:
Case 1.27.2.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NOT (EQUAL B A)))
(NOT (EQUAL A B))).
This again simplifies, clearly, to:
T.
Case 1.27.1.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(EQUAL B A))
(EQUAL (EQUAL A B) T)).
This again simplifies, expanding EQUAL, to:
T.
Case 1.26.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NUMBERP A))
(EQUAL F (EQUAL B A))),
which again simplifies, obviously, to:
T.
Case 1.25.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NLAMBDAP B)
(NOT (NCOMBP A)))
(EQUAL (EQUAL A B) F)).
This again simplifies, clearly, to:
T.
Case 1.24.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NUMBERP B)
(NOT (NCOMBP A)))
(EQUAL (EQUAL A B) F)).
This again simplifies, clearly, to:
T.
Case 1.23.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NOT (NLAMBDAP B))
(NOT (NUMBERP B))
(NOT (NCOMBP A)))
(EQUAL (EQUAL A B) (EQUAL B A))).
This again simplifies, obviously, to the following two new formulas:
Case 1.23.2.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NOT (NLAMBDAP B))
(NOT (NUMBERP B))
(NOT (NCOMBP A))
(NOT (EQUAL B A)))
(NOT (EQUAL A B))).
This again simplifies, obviously, to:
T.
Case 1.23.1.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NOT (NLAMBDAP B))
(NOT (NUMBERP B))
(NOT (NCOMBP A))
(EQUAL B A))
(EQUAL (EQUAL A B) T)).
But this again simplifies, expanding EQUAL, to:
T.
Case 1.22.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NOT (NLAMBDAP B))
(NOT (NUMBERP B))
(NCOMBP A))
(EQUAL F (EQUAL B A))),
which again simplifies, trivially, to:
T.
Case 1.21.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(NOT (NLAMBDAP B))
(NCOMBP A))
(EQUAL F (EQUAL B A))).
This again simplifies, obviously, to:
T.
Case 1.20.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(NOT (NLAMBDAP B))
(NUMBERP A))
(EQUAL F (EQUAL B A))).
This again simplifies, trivially, to:
T.
Case 1.19.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP A)))
(EQUAL (EQUAL A B) (EQUAL B A))).
This again simplifies, clearly, to the following two new goals:
Case 1.19.2.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(NOT (EQUAL B A)))
(NOT (EQUAL A B))).
This again simplifies, obviously, to:
T.
Case 1.19.1.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(EQUAL B A))
(EQUAL (EQUAL A B) T)).
However this again simplifies, opening up the function EQUAL, to:
T.
Case 1.18.
(IMPLIES (AND (NOT (NLAMBDAP A))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(NLAMBDAP B)
(NOT (NCOMBP A))
(NOT (NUMBERP A)))
(EQUAL (EQUAL A B) F)),
which again simplifies, clearly, to:
T.
Case 1.17.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(NCOMBP B)
(NOT (NLAMBDAP A)))
(EQUAL (EQUAL A B) F)).
This again simplifies, trivially, to:
T.
Case 1.16.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(NUMBERP B)
(NOT (NLAMBDAP A)))
(EQUAL (EQUAL A B) F)).
This again simplifies, trivially, to:
T.
Case 1.15.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(NOT (NLAMBDAP A)))
(EQUAL (EQUAL A B) (EQUAL B A))).
This again simplifies, trivially, to the following two new formulas:
Case 1.15.2.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(NOT (NLAMBDAP A))
(NOT (EQUAL B A)))
(NOT (EQUAL A B))).
This again simplifies, clearly, to:
T.
Case 1.15.1.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(NOT (NLAMBDAP A))
(EQUAL B A))
(EQUAL (EQUAL A B) T)).
But this again simplifies, expanding EQUAL, to:
T.
Case 1.14.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP A))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(NLAMBDAP A))
(EQUAL F (EQUAL B A))),
which again simplifies, trivially, to:
T.
Case 1.13.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NOT (NCOMBP B))
(NLAMBDAP A))
(EQUAL F (EQUAL B A))).
This again simplifies, obviously, to:
T.
Case 1.12.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NOT (NCOMBP B))
(NUMBERP A))
(EQUAL F (EQUAL B A))).
This again simplifies, clearly, to:
T.
Case 1.11.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NOT (NCOMBP B))
(NOT (NLAMBDAP A))
(NOT (NUMBERP A)))
(EQUAL (EQUAL A B) (EQUAL B A))).
This again simplifies, clearly, to the following two new conjectures:
Case 1.11.2.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NOT (NCOMBP B))
(NOT (NLAMBDAP A))
(NOT (NUMBERP A))
(NOT (EQUAL B A)))
(NOT (EQUAL A B))).
This again simplifies, clearly, to:
T.
Case 1.11.1.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NOT (NCOMBP B))
(NOT (NLAMBDAP A))
(NOT (NUMBERP A))
(EQUAL B A))
(EQUAL (EQUAL A B) T)).
However this again simplifies, expanding EQUAL, to:
T.
Case 1.10.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP A))
(NOT (NUMBERP B))
(NCOMBP B)
(NOT (NLAMBDAP A))
(NOT (NUMBERP A)))
(EQUAL (EQUAL A B) F)),
which again simplifies, obviously, to:
T.
Case 1.9.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NOT (NUMBERP B))
(NLAMBDAP A))
(EQUAL F (EQUAL B A))).
This again simplifies, obviously, to:
T.
Case 1.8.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NOT (NUMBERP B))
(NCOMBP A))
(EQUAL F (EQUAL B A))).
This again simplifies, trivially, to:
T.
Case 1.7.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NOT (NUMBERP B))
(NOT (NLAMBDAP A))
(NOT (NCOMBP A)))
(EQUAL (EQUAL A B) (EQUAL B A))).
This again simplifies, obviously, to the following two new formulas:
Case 1.7.2.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NOT (NUMBERP B))
(NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (EQUAL B A)))
(NOT (EQUAL A B))).
This again simplifies, trivially, to:
T.
Case 1.7.1.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NOT (NUMBERP B))
(NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(EQUAL B A))
(EQUAL (EQUAL A B) T)).
But this again simplifies, unfolding the function EQUAL, to:
T.
Case 1.6.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP A))
(NUMBERP B)
(NOT (NLAMBDAP A))
(NOT (NCOMBP A)))
(EQUAL (EQUAL A B) F)),
which again simplifies, clearly, to:
T.
Case 1.5.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(EQUAL B A))
(EQUAL (EQUAL A B) T)).
But this again simplifies, expanding the definition of EQUAL, to:
T.
Case 1.4.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(NOT (EQUAL B A))
(NOT (NLAMBDAP A))
(NOT (NCOMBP A))
(NOT (NUMBERP A)))
(NOT (EQUAL A B))),
which again simplifies, obviously, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(EQUAL B A))
(NOT (NLAMBDAP A))).
This again simplifies, clearly, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(EQUAL B A))
(NOT (NUMBERP A))).
This again simplifies, clearly, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (NLAMBDAP B))
(NOT (NCOMBP B))
(NOT (NUMBERP B))
(EQUAL B A))
(NOT (NCOMBP A))).
This again simplifies, trivially, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.1 ]
ALPHA-EQUAL-COMMUTES
(DEFN END-CONS
(X Y)
(IF (LISTP Y)
(CONS (CAR Y) (END-CONS X (CDR Y)))
(CONS X NIL)))
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, END-CONS is accepted under the principle of definition.
Note that (LISTP (END-CONS X Y)) is a theorem.
[ 0.0 0.0 0.0 ]
END-CONS
(PROVE-LEMMA END-CONS-NREDUCTION
(REWRITE)
(IMPLIES (AND (NREDUCTION A B LIST)
(NSTEP A1 A))
(NREDUCTION A1 B (END-CONS A LIST))))
This formula simplifies, expanding NSTEP, to two new conjectures:
Case 2. (IMPLIES (AND (NREDUCTION A B LIST)
(ALPHA-EQUAL A1 A NIL NIL))
(NREDUCTION A1 B (END-CONS A LIST))),
which we will name *1.
Case 1. (IMPLIES (AND (NREDUCTION A B LIST)
(NBETA-STEP A1 A))
(NREDUCTION A1 B (END-CONS A LIST))),
which we would usually push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us consider:
(IMPLIES (AND (NREDUCTION A B LIST)
(NSTEP A1 A))
(NREDUCTION A1 B (END-CONS A LIST))).
We gave this the name *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 LIST)
(p A1 (CAR LIST) A (CDR LIST)))
(p A1 B A LIST))
(IMPLIES (NOT (LISTP LIST))
(p A1 B A LIST))).
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for B. The above induction scheme produces the following three new goals:
Case 3. (IMPLIES (AND (LISTP LIST)
(NOT (NREDUCTION A (CAR LIST) (CDR LIST)))
(NREDUCTION A B LIST)
(NSTEP A1 A))
(NREDUCTION A1 B (END-CONS A LIST))).
This simplifies, expanding NREDUCTION and NSTEP, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST)
(NREDUCTION A1
(CAR LIST)
(END-CONS A (CDR LIST)))
(NREDUCTION A B LIST)
(NSTEP A1 A))
(NREDUCTION A1 B (END-CONS A LIST))).
This simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
expanding the functions NREDUCTION, NSTEP, and END-CONS, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST))
(NREDUCTION A B LIST)
(NSTEP A1 A))
(NREDUCTION A1 B (END-CONS A LIST))).
This simplifies, rewriting with CDR-CONS and CAR-CONS, and opening up
NREDUCTION, NSTEP, END-CONS, and LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
END-CONS-NREDUCTION
(DEFN MAKE-NREDUCTION
(A B W M)
(IF (LISTP W)
(CONS (NBSTEP (MAKE-BSTEP (CAR W) B)
(UNTRANS (CAR W) M 0))
(CONS (UNTRANS (CAR W) M 0)
(MAKE-NREDUCTION A
(CAR W)
(CDR W)
M)))
(CONS (UNTRANS B M 0)
(CONS (NBSTEP (MAKE-BSTEP A B)
(UNTRANS A M 0))
NIL))))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT W) decreases according to the well-founded relation LESSP in each
recursive call. Hence, MAKE-NREDUCTION is accepted under the principle of
definition. From the definition we can conclude that:
(LISTP (MAKE-NREDUCTION A B W M))
is a theorem.
[ 0.0 0.0 0.0 ]
MAKE-NREDUCTION
(PROVE-LEMMA REDUCTION-MAKE-NREDUCTION
(REWRITE)
(IMPLIES (AND (REDUCTION A B LIST)
(TERMP A)
(LEQ (FIND-M A 0) M))
(NREDUCTION (UNTRANS A M 0)
(UNTRANS B M 0)
(MAKE-NREDUCTION A B LIST M))))
Name the conjecture *1.
Let us appeal to the induction principle. Seven inductions are suggested
by terms in the conjecture. They merge into four likely candidate inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (AND (LISTP LIST)
(p A M (CAR LIST) (CDR LIST)))
(p A M B LIST))
(IMPLIES (NOT (LISTP LIST))
(p A M B LIST))).
Linear arithmetic and the lemma CDR-LESSP can be used to show that the measure
(COUNT LIST) decreases according to the well-founded relation LESSP in each
induction step of the scheme. Note, however, the inductive instance chosen
for B. The above induction scheme generates the following three new
conjectures:
Case 3. (IMPLIES (AND (LISTP LIST)
(NOT (REDUCTION A (CAR LIST) (CDR LIST)))
(REDUCTION A B LIST)
(TERMP A)
(NOT (LESSP M (FIND-M A 0))))
(NREDUCTION (UNTRANS A M 0)
(UNTRANS B M 0)
(MAKE-NREDUCTION A B LIST M))).
This simplifies, unfolding the definition of REDUCTION, to:
T.
Case 2. (IMPLIES (AND (LISTP LIST)
(NREDUCTION (UNTRANS A M 0)
(UNTRANS (CAR LIST) M 0)
(MAKE-NREDUCTION A
(CAR LIST)
(CDR LIST)
M))
(REDUCTION A B LIST)
(TERMP A)
(NOT (LESSP M (FIND-M A 0))))
(NREDUCTION (UNTRANS A M 0)
(UNTRANS B M 0)
(MAKE-NREDUCTION A B LIST M))).
This simplifies, using linear arithmetic, applying the lemmas CDR-CONS,
REDUCTION-FIND-M, TERMP-REDUCTION, UNTRANS-NBSTEP-ZERO, CAR-CONS, and
UNTRANS-BETA-STEP, and expanding REDUCTION, MAKE-NREDUCTION, NSTEP, and
NREDUCTION, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP LIST))
(REDUCTION A B LIST)
(TERMP A)
(NOT (LESSP M (FIND-M A 0))))
(NREDUCTION (UNTRANS A M 0)
(UNTRANS B M 0)
(MAKE-NREDUCTION A B LIST M))).
This simplifies, rewriting with CDR-CONS, NTERMP-TERMP, TERMP-BETA-STEP,
TRANSLATE-ALPHA, CAR-CONS, UNTRANS-NBSTEP-ZERO, and UNTRANS-BETA-STEP, and
opening up REDUCTION, MAKE-NREDUCTION, NSTEP, NREDUCTION, and LISTP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
REDUCTION-MAKE-NREDUCTION
(DEFN NMAKE-REDUCTION
(X Y Z LIST1 LIST2)
(END-CONS (UNTRANS (TRANSLATE Y NIL)
(FIND-M (TRANSLATE X NIL) 0)
0)
(MAKE-NREDUCTION (TRANSLATE Y NIL)
(MAKE-W (TRANSLATE X NIL)
(TRANSLATE Z NIL)
(TRANSLATE Y NIL)
(TRANS-LIST LIST2)
(TRANS-LIST LIST1))
(MAKE-REDUCTION (TRANSLATE X NIL)
(TRANSLATE Y NIL)
(TRANSLATE Z NIL)
(TRANS-LIST LIST1)
(TRANS-LIST LIST2))
(FIND-M (TRANSLATE X NIL) 0))))
From the definition we can conclude that:
(LISTP (NMAKE-REDUCTION X Y Z LIST1 LIST2))
is a theorem.
[ 0.0 0.0 0.0 ]
NMAKE-REDUCTION
(PROVE-LEMMA TRANS-UNTRANS-NIL
(REWRITE)
(IMPLIES (AND (NTERMP X)
(LEQ (FIND-M (TRANSLATE X NIL) 0) M))
(ALPHA-EQUAL X
(UNTRANS (TRANSLATE X NIL) M 0)
NIL NIL))
((USE (TRANS-UNTRANS (BOUNDS NIL) (N 0)))))
This conjecture simplifies, unfolding the definitions of LENGTH, EQUAL, AND,
BINDINGS, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TRANS-UNTRANS-NIL
(PROVE-LEMMA STANDARD-CHURCH-ROSSER
(REWRITE)
(IMPLIES (AND (NREDUCTION X Y LIST1)
(NREDUCTION X Z LIST2)
(NTERMP X))
(NREDUCTION Y
(MAKE-N-W X Z Y LIST2 LIST1)
(NMAKE-REDUCTION X Y Z LIST1 LIST2)))
((DISABLE BOTH-MAKE-W-ARE-SAME)
(USE (REDUCTION-FIND-M (A (TRANSLATE X NIL))
(B (TRANSLATE Y NIL))
(N 0)
(LIST (TRANS-LIST LIST1))))))
This simplifies, applying REDUCTION-TRANSLATES, TRANS-UNTRANS-NIL,
REDUCTION-MAKE-NREDUCTION, THE-REAL-CHURCH-ROSSER, NTERMP-LIST, TERMP-NTERMP,
and END-CONS-NREDUCTION, and expanding the functions NOT, IMPLIES, MAKE-N-W,
NMAKE-REDUCTION, and NSTEP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
STANDARD-CHURCH-ROSSER
(PROVE-LEMMA BOTH-MAKE-N-W-ARE-SAME
(REWRITE)
(IMPLIES (AND (NTERMP X)
(NREDUCTION X Y LIST1)
(NREDUCTION X Z LIST2))
(EQUAL (MAKE-N-W X Y Z LIST1 LIST2)
(MAKE-N-W X Z Y LIST2 LIST1))))
WARNING: Note that the rewrite rule BOTH-MAKE-N-W-ARE-SAME will be stored so
as to apply only to terms with the nonrecursive function symbol MAKE-N-W.
This formula simplifies, rewriting with BOTH-MAKE-W-ARE-SAME and
REDUCTION-TRANSLATES, and opening up the function MAKE-N-W, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
BOTH-MAKE-N-W-ARE-SAME
(PROVE-LEMMA FINALLY-CHURCH-ROSSER
(REWRITE)
(IMPLIES (AND (NTERMP X)
(NREDUCTION X Y LIST1)
(NREDUCTION X Z LIST2))
(AND (NREDUCTION Y
(MAKE-N-W X Z Y LIST2 LIST1)
(NMAKE-REDUCTION X Y Z LIST1 LIST2))
(NREDUCTION Z
(MAKE-N-W X Z Y LIST2 LIST1)
(NMAKE-REDUCTION X Z Y LIST2 LIST1))))
((DISABLE MAKE-N-W NMAKE-REDUCTION)
(USE (STANDARD-CHURCH-ROSSER))))
WARNING: the previously added lemma, STANDARD-CHURCH-ROSSER, could be applied
whenever the newly proposed FINALLY-CHURCH-ROSSER could!
WARNING: Note that the proposed lemma FINALLY-CHURCH-ROSSER is to be stored
as zero type prescription rules, zero compound recognizer rules, zero linear
rules, and two replacement rules.
This formula simplifies, applying the lemmas BOTH-MAKE-N-W-ARE-SAME and
STANDARD-CHURCH-ROSSER, and expanding AND and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
FINALLY-CHURCH-ROSSER
(PROVE-LEMMA FREE-FOR-NSUBST
(REWRITE)
(IMPLIES (AND (FREE-FOR EXP X) (FREE-FOR Y X))
(FREE-FOR (NSUBST EXP Y Z) X)))
Name 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 (NLAMBDAP EXP)
(p (NBODY EXP) Y Z X))
(p EXP Y Z X))
(IMPLIES (AND (NOT (NLAMBDAP EXP))
(NCOMBP EXP)
(p (NLEFT EXP) Y Z X)
(p (NRIGHT EXP) Y Z X))
(p EXP Y Z X))
(IMPLIES (AND (NOT (NLAMBDAP EXP))
(NOT (NCOMBP EXP)))
(p EXP Y Z X))).
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and NLEFT-LESSP
inform us that the measure (COUNT EXP) 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 conjectures:
Case 7. (IMPLIES (AND (NLAMBDAP EXP)
(NOT (FREE-FOR (NBODY EXP) X))
(FREE-FOR EXP X)
(FREE-FOR Y X))
(FREE-FOR (NSUBST EXP Y Z) X)).
This simplifies, opening up FREE-FOR, to:
T.
Case 6. (IMPLIES (AND (NLAMBDAP EXP)
(FREE-FOR (NSUBST (NBODY EXP) Y Z) X)
(FREE-FOR EXP X)
(FREE-FOR Y X))
(FREE-FOR (NSUBST EXP Y Z) X)).
This simplifies, unfolding the definitions of FREE-FOR and NSUBST, to the
following two new goals:
Case 6.2.
(IMPLIES (AND (NLAMBDAP EXP)
(FREE-FOR (NSUBST (NBODY EXP) Y Z) X)
(NOT-FREE-IN (NBIND EXP) X)
(FREE-FOR (NBODY EXP) X)
(FREE-FOR Y X)
(NOT (EQUAL (NBIND EXP) Z)))
(FREE-FOR (NLAMBDA (NBIND EXP)
(NSUBST (NBODY EXP) Y Z))
X)).
However this again simplifies, rewriting with NBODY-NLAMBDA and
NBIND-NLAMBDA, and expanding the function FREE-FOR, to:
T.
Case 6.1.
(IMPLIES (AND (NLAMBDAP EXP)
(FREE-FOR (NSUBST (NBODY EXP) Y Z) X)
(NOT-FREE-IN (NBIND EXP) X)
(FREE-FOR (NBODY EXP) X)
(FREE-FOR Y X)
(EQUAL (NBIND EXP) Z))
(FREE-FOR EXP X)).
This again simplifies, unfolding the definition of FREE-FOR, to:
T.
Case 5. (IMPLIES (AND (NOT (NLAMBDAP EXP))
(NCOMBP EXP)
(NOT (FREE-FOR (NLEFT EXP) X))
(NOT (FREE-FOR (NRIGHT EXP) X))
(FREE-FOR EXP X)
(FREE-FOR Y X))
(FREE-FOR (NSUBST EXP Y Z) X)),
which simplifies, opening up FREE-FOR, to:
T.
Case 4. (IMPLIES (AND (NOT (NLAMBDAP EXP))
(NCOMBP EXP)
(FREE-FOR (NSUBST (NLEFT EXP) Y Z) X)
(NOT (FREE-FOR (NRIGHT EXP) X))
(FREE-FOR EXP X)
(FREE-FOR Y X))
(FREE-FOR (NSUBST EXP Y Z) X)),
which simplifies, opening up FREE-FOR, to:
T.
Case 3. (IMPLIES (AND (NOT (NLAMBDAP EXP))
(NCOMBP EXP)
(NOT (FREE-FOR (NLEFT EXP) X))
(FREE-FOR (NSUBST (NRIGHT EXP) Y Z) X)
(FREE-FOR EXP X)
(FREE-FOR Y X))
(FREE-FOR (NSUBST EXP Y Z) X)),
which simplifies, opening up the function FREE-FOR, to:
T.
Case 2. (IMPLIES (AND (NOT (NLAMBDAP EXP))
(NCOMBP EXP)
(FREE-FOR (NSUBST (NLEFT EXP) Y Z) X)
(FREE-FOR (NSUBST (NRIGHT EXP) Y Z) X)
(FREE-FOR EXP X)
(FREE-FOR Y X))
(FREE-FOR (NSUBST EXP Y Z) X)),
which simplifies, applying NRIGHT-NCOMB and NLEFT-NCOMB, and opening up
FREE-FOR and NSUBST, to:
T.
Case 1. (IMPLIES (AND (NOT (NLAMBDAP EXP))
(NOT (NCOMBP EXP))
(FREE-FOR EXP X)
(FREE-FOR Y X))
(FREE-FOR (NSUBST EXP Y Z) X)).
This simplifies, unfolding the definitions of FREE-FOR and NSUBST, to the
following two new formulas:
Case 1.2.
(IMPLIES (AND (NOT (NLAMBDAP EXP))
(NOT (NCOMBP EXP))
(FREE-FOR Y X)
(NOT (EQUAL EXP Z)))
(FREE-FOR EXP X)).
But this again simplifies, expanding the definition of FREE-FOR, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (NLAMBDAP EXP))
(NOT (NCOMBP EXP))
(FREE-FOR Y X)
(NOT (NUMBERP EXP)))
(FREE-FOR EXP X)),
which again simplifies, opening up the function FREE-FOR, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
FREE-FOR-NSUBST
(PROVE-LEMMA NOT-FREE-IN-NSUBST
(REWRITE)
(IMPLIES (AND (NOT-FREE-IN X EXP)
(NOT-FREE-IN X Y))
(NOT-FREE-IN X (NSUBST EXP Y Z))))
Name 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 (NLAMBDAP EXP)
(EQUAL X (NBIND EXP)))
(p X EXP Y Z))
(IMPLIES (AND (NLAMBDAP EXP)
(NOT (EQUAL X (NBIND EXP)))
(p X (NBODY EXP) Y Z))
(p X EXP Y Z))
(IMPLIES (AND (NOT (NLAMBDAP EXP))
(NCOMBP EXP)
(p X (NLEFT EXP) Y Z)
(p X (NRIGHT EXP) Y Z))
(p X EXP Y Z))
(IMPLIES (AND (NOT (NLAMBDAP EXP))
(NOT (NCOMBP EXP)))
(p X EXP Y Z))).
Linear arithmetic and the lemmas NBODY-LESSP, NRIGHT-LESSP, and NLEFT-LESSP
inform us that the measure (COUNT EXP) decreases according to the well-founded
relation LESSP in each induction step of the scheme. The above induction
scheme leads to the following eight new conjectures:
Case 8. (IMPLIES (AND (NLAMBDAP EXP)
(EQUAL X (NBIND EXP))
(NOT-FREE-IN X EXP)
(NOT-FREE-IN X Y))
(NOT-FREE-IN X (NSUBST EXP Y Z))).
This simplifies, opening up NOT-FREE-IN and NSUBST, to the following two new
conjectures:
Case 8.2.
(IMPLIES (AND (NLAMBDAP EXP)
(NOT-FREE-IN (NBIND EXP) Y)
(NOT (EQUAL (NBIND EXP) Z)))
(NOT-FREE-IN (NBIND EXP)
(NLAMBDA (NBIND EXP)
(NSUBST (NBODY EXP) Y Z)))).
This again simplifies, applying the lemma NBIND-NLAMBDA, and unfolding
NOT-FREE-IN, to:
T.
Case 8.1.
(IMPLIES (AND (NLAMBDAP EXP)
(NOT-FREE-IN (NBIND EXP) Y)
(EQUAL (NBIND EXP) Z))
(NOT-FREE-IN (NBIND EXP) EXP)),
which again simplifies, opening up the definition of NOT-FREE-IN, to:
T.
Case 7. (IMPLIES (AND (NLAMBDAP EXP)
(NOT (EQUAL X (NBIND EXP)))
(NOT (NOT-FREE-IN X (NBODY EXP)))
(NOT-FREE-IN X EXP)
(NOT-FREE-IN X Y))
(NOT-FREE-IN X (NSUBST EXP Y Z))),
which simplifies, unfolding the definition of NOT-FREE-IN, to:
T.
Case 6. (IMPLIES (AND (NLAMBDAP EXP)
(NOT (EQUAL X (NBIND EXP)))
(NOT-FREE-IN X
(NSUBST (NBODY EXP) Y Z))
(NOT-FREE-IN X EXP)
(NOT-FREE-IN X Y))
(NOT-FREE-IN X (NSUBST EXP Y Z))),
which simplifies, opening up NOT-FREE-IN and NSUBST, to two new formulas:
Case 6.2.
(IMPLIES (AND (NLAMBDAP EXP)
(NOT (EQUAL X (NBIND EXP)))
(NOT-FREE-IN X
(NSUBST (NBODY EXP) Y Z))
(NOT-FREE-IN X (NBODY EXP))
(NOT-FREE-IN X Y)
(NOT (EQUAL (NBIND EXP) Z)))
(NOT-FREE-IN X
(NLAMBDA (NBIND EXP)
(NSUBST (NBODY EXP) Y Z)))),
which again simplifies, rewriting with NBODY-NLAMBDA and NBIND-NLAMBDA,
and expanding the function NOT-FREE-IN, to:
T.
Case 6.1.
(IMPLIES (AND (NLAMBDAP EXP)
(NOT (EQUAL X (NBIND EXP)))
(NOT-FREE-IN X
(NSUBST (NBODY EXP) Y Z))
(NOT-FREE-IN X (NBODY EXP))
(NOT-FREE-IN X Y)
(EQUAL (NBIND EXP) Z))
(NOT-FREE-IN X EXP)).
This again simplifies, expanding the function NOT-FREE-IN, to:
T.
Case 5. (IMPLIES (AND (NOT (NLAMBDAP EXP))
(NCOMBP EXP)
(NOT (NOT-FREE-IN X (NLEFT EXP)))
(NOT (NOT-FREE-IN X (NRIGHT EXP)))
(NOT-FREE-IN X EXP)
(NOT-FREE-IN X Y))
(NOT-FREE-IN X (NSUBST EXP Y Z))),
which simplifies, opening up NOT-FREE-IN, to:
T.
Case 4. (IMPLIES (AND (NOT (NLAMBDAP EXP))
(NCOMBP EXP)
(NOT-FREE-IN X
(NSUBST (NLEFT EXP) Y Z))
(NOT (NOT-FREE-IN X (NRIGHT EXP)))
(NOT-FREE-IN X EXP)
(NOT-FREE-IN X Y))
(NOT-FREE-IN X (NSUBST EXP Y Z))),
which simplifies, unfolding the function NOT-FREE-IN, to:
T.
Case 3. (IMPLIES (AND (NOT (NLAMBDAP EXP))
(NCOMBP EXP)
(NOT (NOT-FREE-IN X (NLEFT EXP)))
(NOT-FREE-IN X
(NSUBST (NRIGHT EXP) Y Z))
(NOT-FREE-IN X EXP)
(NOT-FREE-IN X Y))
(NOT-FREE-IN X (NSUBST EXP Y Z))),
which simplifies, expanding the definition of NOT-FREE-IN, to:
T.
Case 2. (IMPLIES (AND (NOT (NLAMBDAP EXP))
(NCOMBP EXP)
(NOT-FREE-IN X
(NSUBST (NLEFT EXP) Y Z))
(NOT-FREE-IN X
(NSUBST (NRIGHT EXP) Y Z))
(NOT-FREE-IN X EXP)
(NOT-FREE-IN X Y))
(NOT-FREE-IN X (NSUBST EXP Y Z))),
which simplifies, appealing to the lemmas NRIGHT-NCOMB and NLEFT-NCOMB, and
opening up NOT-FREE-IN and NSUBST, to:
T.
Case 1. (IMPLIES (AND (NOT (NLAMBDAP EXP))
(NOT (NCOMBP EXP))
(NOT-FREE-IN X EXP)
(NOT-FREE-IN X Y))
(NOT-FREE-IN X (NSUBST EXP Y Z))),
which simplifies, unfolding the functions NOT-FREE-IN and NSUBST, to two new
formulas:
Case 1.2.
(IMPLIES (AND (NOT (NLAMBDAP EXP))
(NOT (NCOMBP EXP))
(NOT (EQUAL X EXP))
(NOT-FREE-IN X Y)
(NOT (EQUAL EXP Z)))
(NOT-FREE-IN X EXP)),
which again simplifies, unfolding the definition of NOT-FREE-IN, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (NLAMBDAP EXP))
(NOT (NCOMBP EXP))
(NOT (EQUAL X EXP))
(NOT-FREE-IN X Y)
(NOT (NUMBERP EXP)))
(NOT-FREE-IN X EXP)),
which again simplifies, opening up the definition of NOT-FREE-IN, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
NOT-FREE-IN-NSUBST
(PROVE-LEMMA NOT-FREE-IN-NSUBST1
(REWRITE)
(IMPLIES (AND (NOT-FREE-IN X Y) (NUMBERP X))
(NOT-FREE-IN X (NSUBST EXP Y X))))
Call the conjecture *1.
We will try to prove it by induction. There are two plausible inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (AND (NLAMBDAP EXP)
(EQUAL (NBIND EXP) X))
(p X EXP Y))
(IMPLIES (AND (NLAMBDAP EXP)
(NOT (EQUAL (NB