(NOTE-LIB "wilson" T)
Loading ./basic/wilson.lib
Finished loading ./basic/wilson.lib
Loading ./basic/wilson.o
Finished loading ./basic/wilson.o
(#./basic/wilson.lib #./basic/wilson)
(COMPILE-UNCOMPILED-DEFNS "tmp")
Loading ./basic/tmp.o
Finished loading ./basic/tmp.o
/v/hank/v28/boyer/nqthm-2nd/nqthm-1992/examples/basic/tmp.lisp
(DEFN SQUARES
(N P)
(IF (ZEROP N)
(LIST 0)
(CONS (REMAINDER (TIMES N N) P)
(SQUARES (SUB1 N) P))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT N) decreases according to the well-founded
relation LESSP in each recursive call. Hence, SQUARES is accepted under the
principle of definition. From the definition we can conclude that
(LISTP (SQUARES N P)) is a theorem.
[ 0.0 0.0 0.0 ]
SQUARES
(DEFN RESIDUE
(A P)
(AND (NOT (DIVIDES P A))
(MEMBER (REMAINDER A P)
(SQUARES P P))))
From the definition we can conclude that:
(OR (FALSEP (RESIDUE A P))
(TRUEP (RESIDUE A P)))
is a theorem.
[ 0.0 0.0 0.0 ]
RESIDUE
(PROVE-LEMMA ALL-SQUARES-1 NIL
(IMPLIES (AND (NOT (ZEROP P)) (LEQ M N))
(MEMBER (REMAINDER (TIMES M M) P)
(SQUARES N P))))
This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and
IMPLIES, to:
(IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP N M)))
(MEMBER (REMAINDER (TIMES M M) P)
(SQUARES N P))),
which we will name *1.
Perhaps we can prove it by induction. There is only one plausible
induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP N) (p M P N))
(IMPLIES (AND (NOT (ZEROP N)) (p M P (SUB1 N)))
(p M P N))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform
us that the measure (COUNT N) decreases according to the well-founded relation
LESSP in each induction step of the scheme. The above induction scheme
generates the following three new formulas:
Case 3. (IMPLIES (AND (ZEROP N)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP N M)))
(MEMBER (REMAINDER (TIMES M M) P)
(SQUARES N P))).
This simplifies, rewriting with REMAINDER-0-CROCK and TIMES-ZERO2, and
opening up ZEROP, EQUAL, LESSP, TIMES, SQUARES, and MEMBER, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(LESSP (SUB1 N) M)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP N M)))
(MEMBER (REMAINDER (TIMES M M) P)
(SQUARES N P))),
which simplifies, using linear arithmetic, to three new goals:
Case 2.3.
(IMPLIES (AND (NOT (NUMBERP N))
(NOT (ZEROP N))
(LESSP (SUB1 N) M)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP N M)))
(MEMBER (REMAINDER (TIMES M M) P)
(SQUARES N P))),
which again simplifies, unfolding the function ZEROP, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP M))
(NOT (ZEROP N))
(LESSP (SUB1 N) M)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP N M)))
(MEMBER (REMAINDER (TIMES M M) P)
(SQUARES N P))),
which again simplifies, expanding the functions ZEROP and LESSP, to:
T.
Case 2.1.
(IMPLIES (AND (NUMBERP M)
(NUMBERP N)
(NOT (ZEROP M))
(LESSP (SUB1 M) M)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP M M)))
(MEMBER (REMAINDER (TIMES M M) P)
(SQUARES M P))),
which again simplifies, expanding the function ZEROP, to:
(IMPLIES (AND (NUMBERP M)
(NUMBERP N)
(NOT (EQUAL M 0))
(LESSP (SUB1 M) M)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP M M)))
(MEMBER (REMAINDER (TIMES M M) P)
(SQUARES M P))).
Appealing to the lemma SUB1-ELIM, we now replace M by (ADD1 X) to
eliminate (SUB1 M). We employ the type restriction lemma noted when SUB1
was introduced to constrain the new variable. We must thus prove the
conjecture:
(IMPLIES (AND (NUMBERP X)
(NUMBERP N)
(NOT (EQUAL (ADD1 X) 0))
(LESSP X (ADD1 X))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP (ADD1 X) (ADD1 X))))
(MEMBER (REMAINDER (TIMES (ADD1 X) (ADD1 X))
P)
(SQUARES (ADD1 X) P))).
This further simplifies, applying SUB1-ADD1, REMAINDER-OF-1, CAR-CONS,
TIMES-ADD1, COMMUTATIVITY-OF-TIMES, PLUS-ADD1, and COMMUTATIVITY2-OF-PLUS,
and opening up LESSP, ADD1, TIMES, SUB1, NUMBERP, EQUAL, SQUARES, MEMBER,
and PLUS, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(MEMBER (REMAINDER (TIMES M M) P)
(SQUARES (SUB1 N) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP N M)))
(MEMBER (REMAINDER (TIMES M M) P)
(SQUARES N P))).
This simplifies, rewriting with CDR-CONS and CAR-CONS, and unfolding ZEROP,
SQUARES, and MEMBER, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
ALL-SQUARES-1
(PROVE-LEMMA ALL-SQUARES-2 NIL
(EQUAL (REMAINDER (TIMES Y Y) P)
(REMAINDER (TIMES (REMAINDER Y P)
(REMAINDER Y P))
P))
((USE (TIMES-MOD-1 (X Y) (N P))
(TIMES-MOD-3 (B (REMAINDER Y P))
(A Y)
(N P)))
(DISABLE TIMES-MOD-1 TIMES-MOD-3)))
This conjecture simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
ALL-SQUARES-2
(PROVE-LEMMA ALL-SQUARES
(REWRITE)
(IMPLIES (AND (NOT (ZEROP P))
(NOT (MEMBER X (SQUARES P P))))
(NOT (EQUAL X (REMAINDER (TIMES Y Y) P))))
((USE (ALL-SQUARES-1 (N P)
(M (REMAINDER Y P)))
(ALL-SQUARES-2))
(DISABLE TIMES-MOD-1 TIMES-MOD-3)))
This formula can be simplified, using the abbreviations ZEROP, NOT, IMPLIES,
and AND, to the new goal:
(IMPLIES (AND (IMPLIES (AND (NOT (ZEROP P))
(IF (LESSP P (REMAINDER Y P)) F T))
(MEMBER (REMAINDER (TIMES (REMAINDER Y P)
(REMAINDER Y P))
P)
(SQUARES P P)))
(EQUAL (REMAINDER (TIMES Y Y) P)
(REMAINDER (TIMES (REMAINDER Y P)
(REMAINDER Y P))
P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (MEMBER X (SQUARES P P))))
(NOT (EQUAL X (REMAINDER (TIMES Y Y) P)))),
which simplifies, opening up ZEROP, NOT, AND, and IMPLIES, to:
(IMPLIES (AND (LESSP P (REMAINDER Y P))
(EQUAL (REMAINDER (TIMES Y Y) P)
(REMAINDER (TIMES (REMAINDER Y P)
(REMAINDER Y P))
P))
(NOT (EQUAL P 0))
(NUMBERP P))
(MEMBER (REMAINDER (TIMES Y Y) P)
(SQUARES P P))).
This again simplifies, using linear arithmetic and rewriting with the lemma
LESSP-REMAINDER-DIVISOR, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
ALL-SQUARES
(PROVE-LEMMA EULER-1-1 NIL
(IMPLIES (NOT (DIVIDES 2 P))
(EQUAL (TIMES 2 (QUOTIENT P 2))
(SUB1 P))))
This formula can be simplified, using the abbreviations NOT, IMPLIES, and
DIVIDES, to the new formula:
(IMPLIES (NOT (EQUAL (REMAINDER P 2) 0))
(EQUAL (TIMES 2 (QUOTIENT P 2))
(SUB1 P))),
which simplifies, using linear arithmetic, appealing to the lemma
LESSP-REMAINDER-DIVISOR, and unfolding the function EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL 1 0)))
(EQUAL (TIMES 2 (QUOTIENT P 2))
(SUB1 P))).
This again simplifies, rewriting with the lemma TIMES-2, and opening up EQUAL,
to:
(IMPLIES (EQUAL (REMAINDER P 2) 1)
(EQUAL (PLUS (QUOTIENT P 2) (QUOTIENT P 2))
(SUB1 P))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace P by
(PLUS X (TIMES 2 Z)) to eliminate (REMAINDER P 2) and (QUOTIENT P 2). We
employ LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was introduced
to constrain the new variables. We must thus prove four new goals:
Case 4. (IMPLIES (AND (NOT (NUMBERP P))
(EQUAL (REMAINDER P 2) 1))
(EQUAL (PLUS (QUOTIENT P 2) (QUOTIENT P 2))
(SUB1 P))),
which further simplifies, opening up the functions LESSP, NUMBERP, EQUAL,
and REMAINDER, to:
T.
Case 3. (IMPLIES (AND (EQUAL 2 0)
(EQUAL (REMAINDER P 2) 1))
(EQUAL (PLUS (QUOTIENT P 2) (QUOTIENT P 2))
(SUB1 P))),
which further simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP 2))
(EQUAL (REMAINDER P 2) 1))
(EQUAL (PLUS (QUOTIENT P 2) (QUOTIENT P 2))
(SUB1 P))),
which further simplifies, obviously, to:
T.
Case 1. (IMPLIES (AND (NUMBERP X)
(EQUAL (LESSP X 2) (NOT (ZEROP 2)))
(NUMBERP Z)
(NOT (EQUAL 2 0))
(EQUAL X 1))
(EQUAL (PLUS Z Z)
(SUB1 (PLUS X (TIMES 2 Z))))).
But this further simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (PLUS 1 (TIMES 2 Z)) 0)
(NUMBERP 1)
(EQUAL (LESSP 1 2) (NOT (ZEROP 2)))
(NUMBERP Z)
(NOT (EQUAL 2 0)))
(EQUAL (PLUS Z Z)
(SUB1 (PLUS 1 (TIMES 2 Z))))).
But this again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
EULER-1-1
(PROVE-LEMMA EULER-1-2 NIL
(IMPLIES (NOT (DIVIDES 2 P))
(EQUAL (EXP (TIMES I I) (QUOTIENT P 2))
(EXP I (SUB1 P))))
((USE (EXP-EXP (J 2) (K (QUOTIENT P 2)))
(EULER-1-1))
(DISABLE EXP-EXP)))
This conjecture can be simplified, using the abbreviations NOT, IMPLIES, AND,
and DIVIDES, to:
(IMPLIES (AND (EQUAL (EXP (EXP I 2) (QUOTIENT P 2))
(EXP I (TIMES 2 (QUOTIENT P 2))))
(IMPLIES (NOT (EQUAL (REMAINDER P 2) 0))
(EQUAL (TIMES 2 (QUOTIENT P 2))
(SUB1 P)))
(NOT (EQUAL (REMAINDER P 2) 0)))
(EQUAL (EXP (TIMES I I) (QUOTIENT P 2))
(EXP I (SUB1 P)))).
This simplifies, using linear arithmetic, applying LESSP-REMAINDER-DIVISOR,
and unfolding the definition of EQUAL, to the conjecture:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(EQUAL (EXP (EXP I 2) (QUOTIENT P 2))
(EXP I (TIMES 2 (QUOTIENT P 2))))
(IMPLIES (NOT (EQUAL 1 0))
(EQUAL (TIMES 2 (QUOTIENT P 2))
(SUB1 P)))
(NOT (EQUAL 1 0)))
(EQUAL (EXP (TIMES I I) (QUOTIENT P 2))
(EXP I (SUB1 P)))).
However this again simplifies, rewriting with TIMES-2, EXP-PLUS, and EXP-TIMES,
and opening up the definitions of EQUAL, NOT, and IMPLIES, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(EQUAL (EXP (EXP I 2) (QUOTIENT P 2))
(TIMES (EXP I (QUOTIENT P 2))
(EXP I (QUOTIENT P 2))))
(EQUAL (PLUS (QUOTIENT P 2) (QUOTIENT P 2))
(SUB1 P)))
(EQUAL (EXP (EXP I 2) (QUOTIENT P 2))
(EXP I (SUB1 P)))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace P by (PLUS X (TIMES 2 Z))
to eliminate (REMAINDER P 2) and (QUOTIENT P 2). We employ LESSP-REMAINDER2,
the type restriction lemma noted when REMAINDER was introduced, and the type
restriction lemma noted when QUOTIENT was introduced to restrict the new
variables. We thus obtain the following four new formulas:
Case 4. (IMPLIES (AND (NOT (NUMBERP P))
(EQUAL (REMAINDER P 2) 1)
(EQUAL (EXP (EXP I 2) (QUOTIENT P 2))
(TIMES (EXP I (QUOTIENT P 2))
(EXP I (QUOTIENT P 2))))
(EQUAL (PLUS (QUOTIENT P 2) (QUOTIENT P 2))
(SUB1 P)))
(EQUAL (EXP (EXP I 2) (QUOTIENT P 2))
(EXP I (SUB1 P)))).
This further simplifies, unfolding LESSP, NUMBERP, EQUAL, and REMAINDER, to:
T.
Case 3. (IMPLIES (AND (EQUAL 2 0)
(EQUAL (REMAINDER P 2) 1)
(EQUAL (EXP (EXP I 2) (QUOTIENT P 2))
(TIMES (EXP I (QUOTIENT P 2))
(EXP I (QUOTIENT P 2))))
(EQUAL (PLUS (QUOTIENT P 2) (QUOTIENT P 2))
(SUB1 P)))
(EQUAL (EXP (EXP I 2) (QUOTIENT P 2))
(EXP I (SUB1 P)))),
which further simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP 2))
(EQUAL (REMAINDER P 2) 1)
(EQUAL (EXP (EXP I 2) (QUOTIENT P 2))
(TIMES (EXP I (QUOTIENT P 2))
(EXP I (QUOTIENT P 2))))
(EQUAL (PLUS (QUOTIENT P 2) (QUOTIENT P 2))
(SUB1 P)))
(EQUAL (EXP (EXP I 2) (QUOTIENT P 2))
(EXP I (SUB1 P)))),
which further simplifies, trivially, to:
T.
Case 1. (IMPLIES (AND (NUMBERP X)
(EQUAL (LESSP X 2) (NOT (ZEROP 2)))
(NUMBERP Z)
(NOT (EQUAL 2 0))
(EQUAL X 1)
(EQUAL (EXP (EXP I 2) Z)
(TIMES (EXP I Z) (EXP I Z)))
(EQUAL (PLUS Z Z)
(SUB1 (PLUS X (TIMES 2 Z)))))
(EQUAL (EXP (EXP I 2) Z)
(EXP I (SUB1 (PLUS X (TIMES 2 Z)))))).
But this further simplifies, applying TIMES-2 and EXP-PLUS, and expanding
the definitions of NUMBERP, LESSP, ZEROP, NOT, and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
EULER-1-2
(PROVE-LEMMA EULER-1-3 NIL
(IMPLIES (EQUAL (REMAINDER A P)
(REMAINDER B P))
(EQUAL (REMAINDER (EXP A C) P)
(REMAINDER (EXP B C) P)))
((USE (REMAINDER-EXP (I C) (N P))
(REMAINDER-EXP (A B) (I C) (N P)))
(DISABLE REMAINDER-EXP)))
This conjecture simplifies, clearly, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
EULER-1-3
(PROVE-LEMMA EULER-1-4 NIL
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P I)))
(EQUAL (REMAINDER (EXP (TIMES I I) (QUOTIENT P 2))
P)
1))
((USE (EULER-1-2))
(DISABLE LESSP-REMAINDER-DIVISOR PRIME)))
This formula can be simplified, using the abbreviations NOT, AND, IMPLIES, and
DIVIDES, to:
(IMPLIES (AND (IMPLIES (NOT (EQUAL (REMAINDER P 2) 0))
(EQUAL (EXP (TIMES I I) (QUOTIENT P 2))
(EXP I (SUB1 P))))
(PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER I P) 0)))
(EQUAL (REMAINDER (EXP (TIMES I I) (QUOTIENT P 2))
P)
1)),
which simplifies, applying EXP-TIMES and FERMAT-THM, and opening up the
functions NOT, IMPLIES, and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
EULER-1-4
(PROVE-LEMMA EULER-1-5 NIL
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(EQUAL (REMAINDER A P)
(REMAINDER (TIMES I I) P)))
(NOT (DIVIDES P I)))
((USE (PRIME-KEY-REWRITE (A I) (B I)))
(DISABLE PRIME-KEY-REWRITE PRIME)))
This formula can be simplified, using the abbreviations NOT, AND, IMPLIES, and
DIVIDES, to:
(IMPLIES (AND (IMPLIES (PRIME P)
(EQUAL (EQUAL (REMAINDER (TIMES I I) P) 0)
(OR (EQUAL (REMAINDER I P) 0)
(EQUAL (REMAINDER I P) 0))))
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER A P)
(REMAINDER (TIMES I I) P)))
(NOT (EQUAL (REMAINDER I P) 0))),
which simplifies, expanding the functions EQUAL, OR, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
EULER-1-5
(PROVE-LEMMA EULER-1-6 NIL
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(EQUAL (REMAINDER A P)
(REMAINDER (TIMES I I) P)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))
((USE (EULER-1-4)
(EULER-1-5)
(EULER-1-3 (B (TIMES I I))
(C (QUOTIENT P 2))))
(DISABLE PRIME LESSP-REMAINDER-DIVISOR B-I-LEMMA2 LESSP
SUB1-NNUMBERP REMAINDER-0-CROCK REMAINDER)))
This conjecture can be simplified, using the abbreviations NOT, IMPLIES, AND,
and DIVIDES, to the goal:
(IMPLIES (AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER I P) 0)))
(EQUAL (REMAINDER (EXP (TIMES I I) (QUOTIENT P 2))
P)
1))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER A P)
(REMAINDER (TIMES I I) P)))
(NOT (EQUAL (REMAINDER I P) 0)))
(IMPLIES (EQUAL (REMAINDER A P)
(REMAINDER (TIMES I I) P))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
(REMAINDER (EXP (TIMES I I) (QUOTIENT P 2))
P)))
(PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER A P)
(REMAINDER (TIMES I I) P)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)).
This simplifies, rewriting with EXP-TIMES, and expanding NOT, AND, IMPLIES,
and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EULER-1-6
(PROVE-LEMMA EULER-1-7
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(MEMBER (REMAINDER A P)
(SQUARES I P)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))
((USE (EULER-1-6))
(INDUCT (SQUARES I P))
(DISABLE PRIME REMAINDER LESSP-REMAINDER-DIVISOR)))
WARNING: Note that EULER-1-7 contains the free variable I which will be
chosen by instantiating the hypothesis (MEMBER (REMAINDER A P) (SQUARES I P)).
This formula can be simplified, using the abbreviation DIVIDES, to:
(IMPLIES
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER A P)
(REMAINDER (TIMES I I) P)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))
(AND (OR (NOT (ZEROP I))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (REMAINDER A P)
(SQUARES I P)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)))
(OR (ZEROP I)
(NOT (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (REMAINDER A P)
(SQUARES (SUB1 I) P)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (REMAINDER A P)
(SQUARES I P)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))))),
which simplifies, opening up NOT, AND, IMPLIES, ZEROP, SQUARES, OR, and EQUAL,
to three new goals:
Case 3. (IMPLIES (AND (NOT (EQUAL (REMAINDER A P)
(REMAINDER (TIMES I I) P)))
(NOT (NUMBERP I))
(PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (REMAINDER A P) '(0)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)),
which again simplifies, rewriting with TIMES-ZERO2 and REMAINDER-0-CROCK,
and unfolding the definitions of CDR, CAR, LISTP, and MEMBER, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL (REMAINDER A P)
(REMAINDER (TIMES I I) P)))
(EQUAL I 0)
(PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (REMAINDER A P) '(0)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)).
However this again simplifies, applying REMAINDER-0-CROCK, and expanding the
functions TIMES, CDR, CAR, LISTP, and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL (REMAINDER A P)
(REMAINDER (TIMES I I) P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES (SUB1 I) P)))
(MEMBER (REMAINDER A P)
(CONS (REMAINDER (TIMES I I) P)
(SQUARES (SUB1 I) P))))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)).
However this again simplifies, rewriting with the lemmas CDR-CONS and
CAR-CONS, and unfolding the function MEMBER, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
EULER-1-7
(PROVE-LEMMA EULER-1
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(RESIDUE A P))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))
((DISABLE PRIME)))
This formula can be simplified, using the abbreviations RESIDUE, NOT, AND,
IMPLIES, and DIVIDES, to the new conjecture:
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (REMAINDER A P)
(SQUARES P P)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)),
which simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, and opening up the function EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(PRIME P)
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (REMAINDER A P)
(SQUARES P P)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)),
which again simplifies, using linear arithmetic, applying B-I-LEMMA2 and
EULER-1-7, and opening up the definitions of EQUAL, DIVIDES, SUB1, INVERSE,
and PRIME, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
EULER-1
(DEFN COMPLEMENT
(J A P)
(REMAINDER (TIMES (INVERSE J P) A) P))
Note that (NUMBERP (COMPLEMENT J A P)) is a theorem.
[ 0.0 0.0 0.0 ]
COMPLEMENT
(TOGGLE G0219 INVERSE T)
[ 0.0 0.0 0.0 ]
G0219
(PROVE-LEMMA COMPLEMENT-WORKS
(REWRITE)
(IMPLIES (AND (PRIME P) (NOT (DIVIDES P J)))
(EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P)))
((USE (INVERSE-INVERTS)
(TIMES-MOD-3 (A (TIMES J (INVERSE J P)))
(B A)
(N P)))
(DISABLE INVERSE-INVERTS TIMES-MOD-3 PRIME)))
This conjecture can be simplified, using the abbreviations NOT, IMPLIES, AND,
DIVIDES, and ASSOCIATIVITY-OF-TIMES, to:
(IMPLIES
(AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER J P) 0)))
(EQUAL (REMAINDER (TIMES (INVERSE J P) J) P)
1))
(EQUAL (REMAINDER (TIMES (REMAINDER (TIMES J (INVERSE J P)) P)
A)
P)
(REMAINDER (TIMES J (INVERSE J P) A)
P))
(PRIME P)
(NOT (EQUAL (REMAINDER J P) 0)))
(EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P))).
This simplifies, appealing to the lemmas COMMUTATIVITY-OF-TIMES,
INVERSE-IS-UNIQUE, TIMES-MOD-1, TIMES-1, COMMUTATIVITY2-OF-TIMES, TIMES-MOD-2,
and EQUAL-TIMES-0, and unfolding NOT, AND, IMPLIES, REMAINDER, LESSP, and
COMPLEMENT, to:
T.
Q.E.D.
[ 0.0 0.8 0.0 ]
COMPLEMENT-WORKS
(PROVE-LEMMA BOUNDED-COMPLEMENT
(REWRITE)
(IMPLIES (NOT (ZEROP P))
(LESSP (COMPLEMENT J A P) P)))
WARNING: Note that the linear lemma BOUNDED-COMPLEMENT is being stored under
the term (COMPLEMENT J A P), which is unusual because COMPLEMENT is a
nonrecursive function symbol.
WARNING: Note that the proposed lemma BOUNDED-COMPLEMENT is to be stored as
zero type prescription rules, zero compound recognizer rules, one linear rule,
and zero replacement rules.
This conjecture can be simplified, using the abbreviations ZEROP, NOT, and
IMPLIES, to:
(IMPLIES (AND (NOT (EQUAL P 0)) (NUMBERP P))
(LESSP (COMPLEMENT J A P) P)).
This simplifies, applying COMMUTATIVITY-OF-TIMES and LESSP-REMAINDER2, and
unfolding the function COMPLEMENT, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
BOUNDED-COMPLEMENT
(TOGGLE COMPLEMENT-OFF COMPLEMENT T)
[ 0.0 0.0 0.0 ]
COMPLEMENT-OFF
(PROVE-LEMMA NON-ZEROP-COMPLEMENT
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P J))
(NOT (DIVIDES P A)))
(NOT (ZEROP (COMPLEMENT J A P))))
((USE (COMPLEMENT-WORKS))
(DISABLE COMPLEMENT-WORKS PRIME)))
WARNING: Note that the rewrite rule NON-ZEROP-COMPLEMENT will be stored so as
to apply only to terms with the nonrecursive function symbol ZEROP.
This conjecture can be simplified, using the abbreviations NOT, AND, IMPLIES,
and DIVIDES, to:
(IMPLIES (AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER J P) 0)))
(EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P)))
(PRIME P)
(NOT (EQUAL (REMAINDER J P) 0))
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (ZEROP (COMPLEMENT J A P)))).
This simplifies, opening up the definitions of NOT, AND, IMPLIES, and ZEROP,
to:
(IMPLIES (AND (EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P))
(PRIME P)
(NOT (EQUAL (REMAINDER J P) 0))
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (COMPLEMENT J A P) 0))),
which again simplifies, rewriting with the lemmas COMMUTATIVITY-OF-TIMES and
TIMES-IDENTITY, and expanding LESSP, EQUAL, and REMAINDER, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
NON-ZEROP-COMPLEMENT
(PROVE-LEMMA COMPLEMENT-IS-UNIQUE
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P)))
((USE (COMPLEMENT-WORKS)
(THM-55-SPECIALIZED-TO-PRIMES (M J)
(Y (COMPLEMENT J A P))))
(DISABLE COMPLEMENT-WORKS THM-55-SPECIALIZED-TO-PRIMES PRIME)))
WARNING: Note that COMPLEMENT-IS-UNIQUE contains the free variable X which
will be chosen by instantiating the hypothesis:
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)).
This formula can be simplified, using the abbreviations NOT, IMPLIES, AND, and
DIVIDES, to:
(IMPLIES
(AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER J P) 0)))
(EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P)))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER J P) 0)))
(EQUAL (EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER (TIMES J (COMPLEMENT J A P))
P))
(EQUAL (REMAINDER X P)
(REMAINDER (COMPLEMENT J A P) P))))
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))),
which simplifies, using linear arithmetic, rewriting with REMAINDER-0-CROCK,
DIFFERENCE-0, and BOUNDED-COMPLEMENT, and expanding the functions NOT, AND,
IMPLIES, EQUAL, and REMAINDER, to the following three new formulas:
Case 3. (IMPLIES (AND (EQUAL (REMAINDER J P) 0)
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace J by
(PLUS Z (TIMES P V)) to eliminate (REMAINDER J P) and (QUOTIENT J P). We
employ LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was
introduced to constrain the new variables. We must thus prove four new
goals:
Case 3.4.
(IMPLIES (AND (NOT (NUMBERP J))
(EQUAL (REMAINDER J P) 0)
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))),
which further simplifies, rewriting with EQUAL-TIMES-0, and opening up the
definitions of LESSP, REMAINDER, and EQUAL, to:
(IMPLIES (AND (NOT (NUMBERP J))
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (TIMES J X) (REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace A by
(PLUS Z (TIMES P V)) to eliminate (REMAINDER A P) and (QUOTIENT A P). We
use LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was
introduced to restrict the new variables. We thus obtain the following
four new goals:
Case 3.4.4.
(IMPLIES (AND (NOT (NUMBERP A))
(NOT (NUMBERP J))
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (TIMES J X) (REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))).
This further simplifies, expanding LESSP, REMAINDER, and EQUAL, to:
T.
Case 3.4.3.
(IMPLIES (AND (EQUAL P 0)
(NOT (NUMBERP J))
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (TIMES J X) (REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))),
which further simplifies, expanding the definition of PRIME, to:
T.
Case 3.4.2.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (NUMBERP J))
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (TIMES J X) (REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))),
which further simplifies, applying REMAINDER-WRT-12, to the following
two new formulas:
Case 3.4.2.2.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (NUMBERP J))
(PRIME P)
(NUMBERP A)
(NOT (EQUAL A 0))
(EQUAL (TIMES J X) A)
(NOT (NUMBERP X)))
(EQUAL (COMPLEMENT J A P) 0)).
But this finally simplifies, appealing to the lemma TIMES-ZERO2, and
unfolding the functions NUMBERP and EQUAL, to:
T.
Case 3.4.2.1.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (NUMBERP J))
(PRIME P)
(NUMBERP A)
(NOT (EQUAL A 0))
(EQUAL (TIMES J X) A)
(NUMBERP X))
(EQUAL (COMPLEMENT J A P) X)),
which finally simplifies, applying EQUAL-TIMES-0, to:
T.
Case 3.4.1.
(IMPLIES (AND (NUMBERP Z)
(EQUAL (LESSP Z P) (NOT (ZEROP P)))
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (NUMBERP J))
(PRIME P)
(NOT (EQUAL Z 0))
(EQUAL (TIMES J X) Z))
(EQUAL (COMPLEMENT J (PLUS Z (TIMES P V)) P)
(REMAINDER X P))).
However this further simplifies, applying EQUAL-TIMES-0, and opening up
LESSP, ZEROP, NOT, and EQUAL, to:
T.
Case 3.3.
(IMPLIES (AND (EQUAL P 0)
(EQUAL (REMAINDER J P) 0)
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))).
But this further simplifies, opening up EQUAL, REMAINDER, and PRIME, to:
T.
Case 3.2.
(IMPLIES (AND (NOT (NUMBERP P))
(EQUAL (REMAINDER J P) 0)
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))),
which further simplifies, rewriting with REMAINDER-WRT-12, to the
following four new goals:
Case 3.2.4.
(IMPLIES (AND (NOT (NUMBERP P))
(EQUAL J 0)
(PRIME P)
(NUMBERP A)
(NOT (EQUAL A 0))
(EQUAL (TIMES 0 X) A)
(NOT (NUMBERP X)))
(EQUAL (COMPLEMENT 0 A P) 0)).
However this again simplifies, using linear arithmetic, to:
T.
Case 3.2.3.
(IMPLIES (AND (NOT (NUMBERP P))
(EQUAL J 0)
(PRIME P)
(NUMBERP A)
(NOT (EQUAL A 0))
(EQUAL (TIMES 0 X) A)
(NUMBERP X))
(EQUAL (COMPLEMENT 0 A P) X)),
which again simplifies, using linear arithmetic, to:
T.
Case 3.2.2.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (NUMBERP J))
(PRIME P)
(NUMBERP A)
(NOT (EQUAL A 0))
(EQUAL (TIMES J X) A)
(NOT (NUMBERP X)))
(EQUAL (COMPLEMENT J A P) 0)),
which again simplifies, rewriting with TIMES-ZERO2, and opening up the
functions NUMBERP and EQUAL, to:
T.
Case 3.2.1.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (NUMBERP J))
(PRIME P)
(NUMBERP A)
(NOT (EQUAL A 0))
(EQUAL (TIMES J X) A)
(NUMBERP X))
(EQUAL (COMPLEMENT J A P) X)).
However this again simplifies, rewriting with the lemma EQUAL-TIMES-0,
to:
T.
Case 3.1.
(IMPLIES (AND (NUMBERP Z)
(EQUAL (LESSP Z P) (NOT (ZEROP P)))
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(EQUAL Z 0)
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES (PLUS Z (TIMES P V)) X)
P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT (PLUS Z (TIMES P V)) A P)
(REMAINDER X P))),
which further simplifies, rewriting with the lemmas ASSOCIATIVITY-OF-TIMES
and REMAINDER-TIMES, and expanding the functions NUMBERP, EQUAL, LESSP,
ZEROP, NOT, and PLUS, to:
T.
Case 2. (IMPLIES (AND (EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P))
(EQUAL (REMAINDER J P) 0)
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace A by
(PLUS Z (TIMES P V)) to eliminate (REMAINDER A P) and (QUOTIENT A P). We
rely upon LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER
was introduced, and the type restriction lemma noted when QUOTIENT was
introduced to restrict the new variables. We would thus like to prove the
following four new goals:
Case 2.4.
(IMPLIES (AND (NOT (NUMBERP A))
(EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P))
(EQUAL (REMAINDER J P) 0)
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))).
However this further simplifies, applying PRIME-KEY-REWRITE, and opening
up LESSP, REMAINDER, and EQUAL, to:
T.
Case 2.3.
(IMPLIES (AND (EQUAL P 0)
(EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P))
(EQUAL (REMAINDER J P) 0)
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))).
However this further simplifies, unfolding the definitions of EQUAL,
REMAINDER, and PRIME, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP P))
(EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P))
(EQUAL (REMAINDER J P) 0)
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT J A P)
(REMAINDER X P))),
which further simplifies, applying the lemma REMAINDER-WRT-12, and
unfolding EQUAL, to four new formulas:
Case 2.2.4.
(IMPLIES (AND (NOT (NUMBERP P))
(NUMBERP A)
(EQUAL (TIMES J (COMPLEMENT J A P)) A)
(EQUAL J 0)
(PRIME P)
(NOT (EQUAL A 0))
(EQUAL (TIMES 0 X) A)
(NOT (NUMBERP X)))
(EQUAL (COMPLEMENT 0 A P) 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 2.2.3.
(IMPLIES (AND (NOT (NUMBERP P))
(NUMBERP A)
(EQUAL (TIMES J (COMPLEMENT J A P)) A)
(EQUAL J 0)
(PRIME P)
(NOT (EQUAL A 0))
(EQUAL (TIMES 0 X) A)
(NUMBERP X))
(EQUAL (COMPLEMENT 0 A P) X)),
which again simplifies, using linear arithmetic, to:
T.
Case 2.2.2.
(IMPLIES (AND (NOT (NUMBERP P))
(NUMBERP A)
(EQUAL (TIMES J (COMPLEMENT J A P)) A)
(NOT (NUMBERP J))
(PRIME P)
(NOT (EQUAL A 0))
(EQUAL (TIMES J X) A)
(NOT (NUMBERP X)))
(EQUAL (COMPLEMENT J A P) 0)),
which again simplifies, applying TIMES-ZERO2 and EQUAL-TIMES-0, and
opening up NUMBERP and EQUAL, to:
T.
Case 2.2.1.
(IMPLIES (AND (NOT (NUMBERP P))
(NUMBERP A)
(EQUAL (TIMES J (COMPLEMENT J A P)) A)
(NOT (NUMBERP J))
(PRIME P)
(NOT (EQUAL A 0))
(EQUAL (TIMES J X) A)
(NUMBERP X))
(EQUAL (COMPLEMENT J A P) X)).
But this again simplifies, applying EQUAL-TIMES-0, to:
T.
Case 2.1.
(IMPLIES
(AND (NUMBERP Z)
(EQUAL (LESSP Z P) (NOT (ZEROP P)))
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(EQUAL (REMAINDER (TIMES J
(COMPLEMENT J (PLUS Z (TIMES P V)) P))
P)
Z)
(EQUAL (REMAINDER J P) 0)
(PRIME P)
(NOT (EQUAL Z 0))
(EQUAL (REMAINDER (TIMES J X) P) Z))
(EQUAL (COMPLEMENT J (PLUS Z (TIMES P V)) P)
(REMAINDER X P))).
This further simplifies, appealing to the lemmas LESSP-REMAINDER2,
COMMUTATIVITY-OF-PLUS, and PRIME-KEY-REWRITE, and expanding the functions
ZEROP, NOT, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP (COMPLEMENT J A P) P))
(EQUAL (REMAINDER X P) 0)
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES J X) P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT J A P) 0)),
which again simplifies, using linear arithmetic and rewriting with
BOUNDED-COMPLEMENT, to:
T.
Q.E.D.
[ 0.0 1.3 0.0 ]
COMPLEMENT-IS-UNIQUE
(TOGGLE SQUARES-OFF SQUARES T)
[ 0.0 0.0 0.0 ]
SQUARES-OFF
(PROVE-LEMMA NO-SELF-COMPLEMENT
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P J))
(NOT (DIVIDES P A))
(NOT (RESIDUE A P)))
(NOT (EQUAL J (COMPLEMENT J A P))))
((USE (COMPLEMENT-WORKS)
(ALL-SQUARES (X (REMAINDER A P))
(Y J)))
(DISABLE COMPLEMENT-WORKS ALL-SQUARES PRIME1)))
This formula can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, and DIVIDES, to:
(IMPLIES (AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER J P) 0)))
(EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P)))
(IMPLIES (AND (NOT (ZEROP P))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P))))
(NOT (EQUAL (REMAINDER A P)
(REMAINDER (TIMES J J) P))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER J P) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(NOT (EQUAL J (COMPLEMENT J A P)))),
which simplifies, using linear arithmetic, applying REMAINDER-0-CROCK,
DIFFERENCE-0, and BOUNDED-COMPLEMENT, and opening up PRIME, REMAINDER, NOT,
AND, IMPLIES, ZEROP, DIVIDES, RESIDUE, TIMES, and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.6 0.0 ]
NO-SELF-COMPLEMENT
(PROVE-LEMMA COMPLEMENT-OF-COMPLEMENT
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P J))
(NOT (DIVIDES P A)))
(EQUAL (COMPLEMENT (COMPLEMENT J A P) A P)
(REMAINDER J P)))
((USE (COMPLEMENT-WORKS)
(COMPLEMENT-IS-UNIQUE (J (COMPLEMENT J A P))
(X J)))
(DISABLE COMPLEMENT-WORKS COMPLEMENT-IS-UNIQUE)))
This formula can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, and DIVIDES, to:
(IMPLIES
(AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER J P) 0)))
(EQUAL (REMAINDER (TIMES J (COMPLEMENT J A P))
P)
(REMAINDER A P)))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL (REMAINDER (TIMES (COMPLEMENT J A P) J)
P)
(REMAINDER A P)))
(EQUAL (COMPLEMENT (COMPLEMENT J A P) A P)
(REMAINDER J P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER J P) 0))
(NOT (EQUAL (REMAINDER A P) 0)))
(EQUAL (COMPLEMENT (COMPLEMENT J A P) A P)
(REMAINDER J P))),
which simplifies, applying the lemma COMMUTATIVITY-OF-TIMES, and opening up
the definitions of PRIME, NOT, AND, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 1.0 0.0 ]
COMPLEMENT-OF-COMPLEMENT
(DEFN COMP-LIST
(I A P)
(IF (ZEROP I)
NIL
(IF (MEMBER I (COMP-LIST (SUB1 I) A P))
(COMP-LIST (SUB1 I) A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
can be used to show that the measure (COUNT I) decreases according to the
well-founded relation LESSP in each recursive call. Hence, COMP-LIST is
accepted under the principle of definition. From the definition we can
conclude that (OR (LITATOM (COMP-LIST I A P)) (LISTP (COMP-LIST I A P))) is a
theorem.
[ 0.0 0.0 0.0 ]
COMP-LIST
(PROVE-LEMMA ALL-NON-ZEROP-COMP-LIST
(REWRITE)
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (DIVIDES P A)))
(ALL-NON-ZEROP (COMP-LIST I A P)))
((USE (NON-ZEROP-COMPLEMENT (J I)))
(INDUCT (COMP-LIST I A P))))
This formula can be simplified, using the abbreviation DIVIDES, to:
(IMPLIES
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER I P) 0))
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (ZEROP (COMPLEMENT I A P))))
(AND (OR (NOT (ZEROP I))
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (COMP-LIST I A P))))
(OR (ZEROP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (IMPLIES (AND (PRIME P)
(LESSP (SUB1 I) P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (COMP-LIST (SUB1 I) A P))))
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (COMP-LIST I A P))))
(OR (ZEROP I)
(MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (IMPLIES (AND (PRIME P)
(LESSP (SUB1 I) P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (COMP-LIST (SUB1 I) A P))))
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (COMP-LIST I A P)))))),
which simplifies, rewriting with the lemmas REMAINDER-WRT-12 and
REMAINDER-WRT-1, and opening up the definitions of PRIME, NOT, AND, ZEROP,
IMPLIES, EQUAL, LESSP, REMAINDER, COMP-LIST, OR, SUB1, and NUMBERP, to ten new
goals:
Case 10.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (EQUAL I 0))
(NUMBERP I)
(MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (LESSP (SUB1 I) P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (COMP-LIST (SUB1 I) A P))),
which again simplifies, using linear arithmetic, to:
T.
Case 9. (IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (NUMBERP I))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP NIL)),
which again simplifies, opening up LESSP, REMAINDER, EQUAL, and
ALL-NON-ZEROP, to:
T.
Case 8. (IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(EQUAL I 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP NIL)),
which again simplifies, rewriting with the lemma REMAINDER-0-CROCK, and
expanding EQUAL, LESSP, and ALL-NON-ZEROP, to:
T.
Case 7. (IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (LESSP (SUB1 I) P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 6. (IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(ALL-NON-ZEROP (COMP-LIST (SUB1 I) A P))
(LESSP I P))
(ALL-NON-ZEROP (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))),
which again simplifies, expanding the function REMAINDER, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL (COMPLEMENT I A P) 0))
(NOT (EQUAL I 0))
(NUMBERP I)
(MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (LESSP (SUB1 I) P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (COMP-LIST (SUB1 I) A P))),
which again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL (COMPLEMENT I A P) 0))
(NOT (NUMBERP I))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP NIL)),
which again simplifies, opening up the definitions of LESSP and
ALL-NON-ZEROP, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL (COMPLEMENT I A P) 0))
(EQUAL I 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP NIL)),
which again simplifies, unfolding the functions EQUAL, LESSP, and
ALL-NON-ZEROP, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL (COMPLEMENT I A P) 0))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (LESSP (SUB1 I) P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL (COMPLEMENT I A P) 0))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(ALL-NON-ZEROP (COMP-LIST (SUB1 I) A P))
(LESSP I P))
(ALL-NON-ZEROP (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))),
which again simplifies, appealing to the lemmas CDR-CONS and CAR-CONS, and
unfolding the function ALL-NON-ZEROP, to:
T.
Q.E.D.
[ 0.0 1.4 0.0 ]
ALL-NON-ZEROP-COMP-LIST
(PROVE-LEMMA BOUNDED-COMP-LIST
(REWRITE)
(IMPLIES (LESSP I P)
(ALL-LESSEQP (COMP-LIST I A P)
(SUB1 P)))
((USE (BOUNDED-COMPLEMENT (J I)))
(INDUCT (COMP-LIST I A P))))
This formula simplifies, applying SUB1-NNUMBERP, and expanding the definitions
of ZEROP, NOT, IMPLIES, EQUAL, LESSP, SUB1, OR, AND, and COMP-LIST, to the
following five new conjectures:
Case 5. (IMPLIES (AND (LESSP (COMPLEMENT I A P) P)
(NOT (NUMBERP I))
(NOT (EQUAL P 0))
(NUMBERP P))
(ALL-LESSEQP NIL (SUB1 P))).
This again simplifies, rewriting with PIGEON-HOLE-PRINCIPLE-LEMMA-2 and
ADD1-SUB1, and opening up the functions ALL-LESSEQP, MEMBER, and LISTP, to:
T.
Case 4. (IMPLIES (AND (LESSP (COMPLEMENT I A P) P)
(EQUAL I 0)
(NOT (EQUAL P 0))
(NUMBERP P))
(ALL-LESSEQP NIL (SUB1 P))).
This again simplifies, applying the lemmas PIGEON-HOLE-PRINCIPLE-LEMMA-2 and
ADD1-SUB1, and opening up the definitions of ALL-LESSEQP, MEMBER, and LISTP,
to:
T.
Case 3. (IMPLIES (AND (LESSP (COMPLEMENT I A P) P)
(NOT (EQUAL I 0))
(NUMBERP I)
(MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (LESSP (SUB1 I) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P)))
(ALL-LESSEQP (COMP-LIST (SUB1 I) A P)
(SUB1 P))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (LESSP (COMPLEMENT I A P) P)
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (LESSP (SUB1 I) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P)))
(ALL-LESSEQP (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))
(SUB1 P))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (LESSP (COMPLEMENT I A P) P)
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(ALL-LESSEQP (COMP-LIST (SUB1 I) A P)
(SUB1 P))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P)))
(ALL-LESSEQP (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))
(SUB1 P))),
which again simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
opening up the function ALL-LESSEQP, to two new formulas:
Case 1.2.
(IMPLIES (AND (LESSP (COMPLEMENT I A P) P)
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(ALL-LESSEQP (COMP-LIST (SUB1 I) A P)
(SUB1 P))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P)))
(NOT (LESSP (SUB1 P) I))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (LESSP (COMPLEMENT I A P) P)
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(ALL-LESSEQP (COMP-LIST (SUB1 I) A P)
(SUB1 P))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P)))
(NOT (LESSP (SUB1 P) (COMPLEMENT I A P)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
BOUNDED-COMP-LIST
(PROVE-LEMMA SUBSETP-POSITIVES-COMP-LIST
(REWRITE)
(SUBSETP (POSITIVES N)
(COMP-LIST N A P)))
Give the conjecture the name *1.
We will appeal to induction. Two inductions are suggested by terms in
the conjecture. However, they merge into one likely candidate induction. We
will induct according to the following scheme:
(AND (IMPLIES (ZEROP N) (p N A P))
(IMPLIES (AND (NOT (ZEROP N))
(MEMBER N (COMP-LIST (SUB1 N) A P))
(p (SUB1 N) A P))
(p N A P))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (MEMBER N (COMP-LIST (SUB1 N) A P)))
(p (SUB1 N) A P))
(p N A P))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform
us that the measure (COUNT N) decreases according to the well-founded relation
LESSP in each induction step of the scheme. The above induction scheme
produces the following three new conjectures:
Case 3. (IMPLIES (ZEROP N)
(SUBSETP (POSITIVES N)
(COMP-LIST N A P))).
This simplifies, expanding the functions ZEROP, POSITIVES, EQUAL, COMP-LIST,
and SUBSETP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(MEMBER N (COMP-LIST (SUB1 N) A P))
(SUBSETP (POSITIVES (SUB1 N))
(COMP-LIST (SUB1 N) A P)))
(SUBSETP (POSITIVES N)
(COMP-LIST N A P))).
This simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
opening up ZEROP, POSITIVES, COMP-LIST, and SUBSETP, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (MEMBER N (COMP-LIST (SUB1 N) A P)))
(SUBSETP (POSITIVES (SUB1 N))
(COMP-LIST (SUB1 N) A P)))
(SUBSETP (POSITIVES N)
(COMP-LIST N A P))).
This simplifies, rewriting with SUBSETP-CONS, CDR-CONS, and CAR-CONS, and
expanding ZEROP, POSITIVES, COMP-LIST, MEMBER, and SUBSETP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUBSETP-POSITIVES-COMP-LIST
(PROVE-LEMMA COMP-LIST-CLOSED-1 NIL
(IMPLIES (AND (PRIME P)
(NOT (ZEROP I))
(LESSP I P)
(NOT (DIVIDES P A))
(MEMBER J (COMP-LIST I A P)))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST I A P)))
((USE (COMPLEMENT-OF-COMPLEMENT (J I)))
(INDUCT (COMP-LIST I A P))
(DISABLE COMPLEMENT-OF-COMPLEMENT)))
This formula can be simplified, using the abbreviation DIVIDES, to the new
formula:
(IMPLIES (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER I P) 0))
(NOT (EQUAL (REMAINDER A P) 0)))
(EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P)))
(AND (OR (NOT (ZEROP I))
(IMPLIES (AND (PRIME P)
(NOT (ZEROP I))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMP-LIST I A P)))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST I A P))))
(OR (ZEROP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (IMPLIES (AND (PRIME P)
(NOT (ZEROP (SUB1 I)))
(LESSP (SUB1 I) P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMP-LIST (SUB1 I) A P)))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P))))
(IMPLIES (AND (PRIME P)
(NOT (ZEROP I))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMP-LIST I A P)))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST I A P))))
(OR (ZEROP I)
(MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (IMPLIES (AND (PRIME P)
(NOT (ZEROP (SUB1 I)))
(LESSP (SUB1 I) P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMP-LIST (SUB1 I) A P)))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P))))
(IMPLIES (AND (PRIME P)
(NOT (ZEROP I))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMP-LIST I A P)))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST I A P)))))),
which simplifies, rewriting with REMAINDER-WRT-12 and REMAINDER-WRT-1, and
unfolding the definitions of PRIME, NOT, AND, IMPLIES, ZEROP, EQUAL, LESSP,
REMAINDER, COMP-LIST, OR, SUB1, and NUMBERP, to the following 20 new formulas:
Case 20.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (EQUAL I 0))
(NUMBERP I))
(OR F T)).
But this again simplifies, opening up OR, to:
T.
Case 19.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(EQUAL I 0))
(OR T T)),
which again simplifies, rewriting with the lemma REMAINDER-0-CROCK, and
opening up EQUAL and OR, to:
T.
Case 18.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (NUMBERP I)))
(OR T T)),
which again simplifies, unfolding the definitions of LESSP, REMAINDER, EQUAL,
and OR, to:
T.
Case 17.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMP-LIST (SUB1 I) A P))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P)))),
which again simplifies, expanding REMAINDER, to:
T.
Case 16.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (LESSP (SUB1 I) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMP-LIST (SUB1 I) A P)))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 15.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(EQUAL (SUB1 I) 0)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMP-LIST (SUB1 I) A P)))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P)))),
which again simplifies, expanding REMAINDER, to:
T.
Case 14.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(EQUAL (SUB1 I) 0)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))),
which again simplifies, expanding the definition of REMAINDER, to:
T.
Case 13.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (LESSP (SUB1 I) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 12.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))),
which again simplifies, opening up the function REMAINDER, to:
T.
Case 11.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER J (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))),
which again simplifies, expanding REMAINDER, to:
T.
Case 10.(IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P))
(NOT (EQUAL I 0))
(NUMBERP I))
(OR F T)),
which again simplifies, expanding OR, to:
T.
Case 9. (IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P))
(EQUAL I 0))
(OR T T)),
which again simplifies, appealing to the lemma REMAINDER-0-CROCK, and
opening up the definition of OR, to:
T.
Case 8. (IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P))
(NOT (NUMBERP I)))
(OR T T)),
which again simplifies, opening up the definitions of LESSP, REMAINDER, and
OR, to:
T.
Case 7. (IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P))
(MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMP-LIST (SUB1 I) A P))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P)))),
which again simplifies, unfolding the functions REMAINDER and OR, to:
T.
Case 6. (IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P))
(MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (LESSP (SUB1 I) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMP-LIST (SUB1 I) A P)))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P))
(MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(EQUAL (SUB1 I) 0)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMP-LIST (SUB1 I) A P)))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P)))),
which again simplifies, opening up the functions REMAINDER, EQUAL, COMP-LIST,
LISTP, and MEMBER, to:
T.
Case 4. (IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(EQUAL (SUB1 I) 0)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))),
which again simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
unfolding the functions REMAINDER, EQUAL, COMP-LIST, LISTP, MEMBER, and OR,
to:
(IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
I)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(EQUAL (SUB1 I) 0)
(NOT (EQUAL I 0))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL J (COMPLEMENT I A P))
(NOT (EQUAL (COMPLEMENT J A P) I)))
(EQUAL (COMPLEMENT J A P) J)).
This again simplifies, clearly, to:
T.
Case 3. (IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (LESSP (SUB1 I) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))).
This again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))),
which again simplifies, applying CDR-CONS and CAR-CONS, and expanding the
definitions of REMAINDER, MEMBER, and OR, to:
T.
Case 1. (IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER J (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))))).
This again simplifies, appealing to the lemmas CDR-CONS and CAR-CONS, and
opening up the definitions of REMAINDER, MEMBER, and OR, to the conjecture:
(IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER J (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL I 0))
(LESSP I P)
(EQUAL J (COMPLEMENT I A P))
(NOT (EQUAL (COMPLEMENT J A P) I))
(NOT (EQUAL (COMPLEMENT J A P) J)))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST (SUB1 I) A P))).
This again simplifies, obviously, to:
T.
Q.E.D.
[ 0.0 4.3 0.1 ]
COMP-LIST-CLOSED-1
(PROVE-LEMMA COMP-LIST-CLOSED-2 NIL
(IMPLIES (AND (PRIME P)
(NOT (ZEROP I))
(NOT (ZEROP J))
(LESSP I P)
(LESSP J P)
(NOT (DIVIDES P A))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST I A P)))
(MEMBER J (COMP-LIST I A P)))
((USE (COMPLEMENT-OF-COMPLEMENT)
(COMP-LIST-CLOSED-1 (J (COMPLEMENT J A P))))
(DISABLE COMPLEMENT-OF-COMPLEMENT COMP-LIST)))
This formula can be simplified, using the abbreviations ZEROP, NOT, PRIME,
IMPLIES, AND, and DIVIDES, to the new formula:
(IMPLIES (AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER J P) 0))
(NOT (EQUAL (REMAINDER A P) 0)))
(EQUAL (COMPLEMENT (COMPLEMENT J A P) A P)
(REMAINDER J P)))
(IMPLIES (AND (PRIME P)
(NOT (ZEROP I))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST I A P)))
(MEMBER (COMPLEMENT (COMPLEMENT J A P) A P)
(COMP-LIST I A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP I P)
(LESSP J P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (COMPLEMENT J A P)
(COMP-LIST I A P)))
(MEMBER J (COMP-LIST I A P))),
which simplifies, unfolding the functions PRIME, REMAINDER, NOT, AND, IMPLIES,
and ZEROP, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
COMP-LIST-CLOSED-2
(PROVE-LEMMA ALL-DISTINCT-COMP-LIST-1 NIL
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (DIVIDES P A))
(NOT (RESIDUE A P))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P)))
(ALL-DISTINCT (COMP-LIST I A P)))
((USE (COMP-LIST-CLOSED-2 (J I)
(I (SUB1 I)))
(NO-SELF-COMPLEMENT (J I)))
(DISABLE PRIME)))
This formula can be simplified, using the abbreviations NOT, IMPLIES, AND, and
DIVIDES, to the new formula:
(IMPLIES (AND (IMPLIES (AND (PRIME P)
(NOT (ZEROP (SUB1 I)))
(NOT (ZEROP I))
(LESSP (SUB1 I) P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))
(MEMBER I (COMP-LIST (SUB1 I) A P)))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER I P) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(NOT (EQUAL I (COMPLEMENT I A P))))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P)))
(ALL-DISTINCT (COMP-LIST I A P))),
which simplifies, rewriting with SUB1-NNUMBERP and REMAINDER-0-CROCK, and
opening up the functions ZEROP, NOT, AND, IMPLIES, REMAINDER, DIVIDES, RESIDUE,
EQUAL, COMP-LIST, ALL-DISTINCT, LISTP, MEMBER, LESSP, and SUB1, to the
following 11 new goals:
Case 11.(IMPLIES (AND (EQUAL (SUB1 I) 0)
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(NOT (EQUAL I 0))
(NUMBERP I))
(ALL-DISTINCT (LIST I (COMPLEMENT I A P)))).
But this again simplifies, using linear arithmetic, applying
NO-SELF-COMPLEMENT, CDR-CONS, and CAR-CONS, and opening up the definitions
of RESIDUE, DIVIDES, REMAINDER, LISTP, MEMBER, and ALL-DISTINCT, to:
T.
Case 10.(IMPLIES (AND (EQUAL (SUB1 I) 0)
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(EQUAL I 0))
(ALL-DISTINCT NIL)).
This again simplifies, expanding the definitions of SUB1, EQUAL, LESSP, and
ALL-DISTINCT, to:
T.
Case 9. (IMPLIES (AND (EQUAL (SUB1 I) 0)
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(NOT (NUMBERP I)))
(ALL-DISTINCT NIL)),
which again simplifies, appealing to the lemma SUB1-NNUMBERP, and opening up
the functions EQUAL, LESSP, and ALL-DISTINCT, to:
T.
Case 8. (IMPLIES (AND (NOT (LESSP (SUB1 I) P))
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(ALL-DISTINCT (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 7. (IMPLIES (AND (NOT (LESSP (SUB1 I) P))
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))
(EQUAL I 0))
(ALL-DISTINCT NIL)),
which again simplifies, unfolding SUB1, EQUAL, LESSP, and PRIME, to:
T.
Case 6. (IMPLIES (AND (NOT (LESSP (SUB1 I) P))
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))
(NOT (NUMBERP I)))
(ALL-DISTINCT NIL)),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP I 1)
(NOT (LESSP (SUB1 I) P))
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))
(NOT (NUMBERP I)))
(ALL-DISTINCT NIL)).
But this again simplifies, rewriting with SUB1-NNUMBERP, and unfolding
NUMBERP, EQUAL, LESSP, and PRIME, to:
T.
Case 5. (IMPLIES (AND (NOT (MEMBER (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(ALL-DISTINCT (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))).
However this again simplifies, using linear arithmetic, appealing to the
lemmas NO-SELF-COMPLEMENT, CDR-CONS, and CAR-CONS, and expanding the
functions RESIDUE, DIVIDES, REMAINDER, MEMBER, and ALL-DISTINCT, to:
T.
Case 4. (IMPLIES (AND (NOT (MEMBER (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))
(EQUAL I 0))
(ALL-DISTINCT NIL)),
which again simplifies, expanding the functions SUB1, EQUAL, COMP-LIST,
LISTP, MEMBER, LESSP, and ALL-DISTINCT, to:
T.
Case 3. (IMPLIES (AND (NOT (MEMBER (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))
(NOT (NUMBERP I)))
(ALL-DISTINCT NIL)),
which again simplifies, rewriting with SUB1-NNUMBERP, and expanding the
definitions of EQUAL, COMP-LIST, LISTP, MEMBER, LESSP, and ALL-DISTINCT, to:
T.
Case 2. (IMPLIES (AND (MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))
(NOT (NUMBERP I)))
(ALL-DISTINCT NIL)).
However this again simplifies, applying SUB1-NNUMBERP, and expanding the
definitions of EQUAL, COMP-LIST, LISTP, and MEMBER, to:
T.
Case 1. (IMPLIES (AND (MEMBER I (COMP-LIST (SUB1 I) A P))
(NOT (EQUAL I (COMPLEMENT I A P)))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))
(EQUAL I 0))
(ALL-DISTINCT NIL)).
But this again simplifies, expanding the definitions of SUB1, EQUAL,
COMP-LIST, and MEMBER, to:
T.
Q.E.D.
[ 0.0 0.8 0.0 ]
ALL-DISTINCT-COMP-LIST-1
(PROVE-LEMMA ALL-DISTINCT-COMP-LIST
(REWRITE)
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (DIVIDES P A))
(NOT (RESIDUE A P)))
(ALL-DISTINCT (COMP-LIST I A P)))
((USE (ALL-DISTINCT-COMP-LIST-1))
(INDUCT (POSITIVES I))
(DISABLE PRIME)))
This formula can be simplified, using the abbreviation DIVIDES, to the new
goal:
(IMPLIES (IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P)))
(ALL-DISTINCT (COMP-LIST I A P)))
(AND (OR (NOT (ZEROP I))
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(ALL-DISTINCT (COMP-LIST I A P))))
(OR (ZEROP I)
(NOT (IMPLIES (AND (PRIME P)
(LESSP (SUB1 I) P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))))
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(ALL-DISTINCT (COMP-LIST I A P)))))),
which simplifies, rewriting with SUB1-NNUMBERP, and expanding the functions
NOT, DIVIDES, RESIDUE, AND, COMP-LIST, IMPLIES, ZEROP, LESSP, ALL-DISTINCT, OR,
EQUAL, and SUB1, to the following six new formulas:
Case 6. (IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(ALL-DISTINCT (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))
(PRIME P)
(NOT (LESSP (SUB1 I) P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P)))
(MEMBER I (COMP-LIST (SUB1 I) A P)))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))).
This again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(MEMBER I (COMP-LIST (SUB1 I) A P))
(PRIME P)
(NOT (LESSP (SUB1 I) P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P))))
(ALL-DISTINCT (COMP-LIST (SUB1 I) A P))),
which again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (ALL-DISTINCT (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(PRIME P)
(NOT (LESSP (SUB1 I) P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P))))
(ALL-DISTINCT (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (NOT (ALL-DISTINCT (COMP-LIST (SUB1 I) A P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(PRIME P)
(NOT (LESSP (SUB1 I) P))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P))))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (ALL-DISTINCT (COMP-LIST (SUB1 I) A P)))
(EQUAL I 0)
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P))))
(ALL-DISTINCT NIL)),
which again simplifies, expanding the definitions of SUB1, EQUAL, COMP-LIST,
and ALL-DISTINCT, to:
T.
Case 1. (IMPLIES (AND (NOT (ALL-DISTINCT (COMP-LIST (SUB1 I) A P)))
(NOT (NUMBERP I))
(PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P))))
(ALL-DISTINCT NIL)),
which again simplifies, applying SUB1-NNUMBERP, and opening up the functions
EQUAL, COMP-LIST, and ALL-DISTINCT, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
ALL-DISTINCT-COMP-LIST
(PROVE-LEMMA PERM-POSITIVES-COMP-LIST
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(NOT (RESIDUE A P)))
(PERM (POSITIVES (SUB1 P))
(COMP-LIST (SUB1 P) A P))))
This conjecture can be simplified, using the abbreviations NOT, PRIME, AND,
IMPLIES, and DIVIDES, to:
(IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(PERM (POSITIVES (SUB1 P))
(COMP-LIST (SUB1 P) A P))).
This simplifies, using linear arithmetic, appealing to the lemmas
SUBSETP-POSITIVES-COMP-LIST, BOUNDED-COMP-LIST, ALL-NON-ZEROP-COMP-LIST,
ALL-DISTINCT-COMP-LIST, and PIGEONHOLE2, and unfolding DIVIDES, RESIDUE, and
PRIME, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
PERM-POSITIVES-COMP-LIST
(PROVE-LEMMA COMP-LIST-FACT
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(NOT (RESIDUE A P)))
(EQUAL (TIMES-LIST (COMP-LIST (SUB1 P) A P))
(FACT (SUB1 P))))
((USE (TIMES-LIST-EQUAL-FACT (N (SUB1 P))
(L (COMP-LIST (SUB1 P) A P))))
(DISABLE TIMES-LIST-EQUAL-FACT COMP-LIST)))
This formula can be simplified, using the abbreviations NOT, PRIME, AND,
IMPLIES, and DIVIDES, to:
(IMPLIES (AND (IMPLIES (PERM (POSITIVES (SUB1 P))
(COMP-LIST (SUB1 P) A P))
(EQUAL (TIMES-LIST (COMP-LIST (SUB1 P) A P))
(FACT (SUB1 P))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(EQUAL (TIMES-LIST (COMP-LIST (SUB1 P) A P))
(FACT (SUB1 P)))),
which simplifies, using linear arithmetic, applying PERM-POSITIVES-COMP-LIST,
and expanding the functions DIVIDES, PRIME, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
COMP-LIST-FACT
(PROVE-LEMMA TIMES-MOD-4 NIL
(IMPLIES (EQUAL (REMAINDER (TIMES I J) P)
(REMAINDER A P))
(EQUAL (REMAINDER (TIMES I (TIMES J K)) P)
(REMAINDER (TIMES A (REMAINDER K P))
P)))
((USE (TIMES-MOD-3 (A (TIMES I J))
(B K)
(N P)))
(DISABLE TIMES-MOD-3)))
This conjecture can be simplified, using the abbreviations IMPLIES,
TIMES-MOD-1, and ASSOCIATIVITY-OF-TIMES, to:
(IMPLIES (AND (EQUAL (REMAINDER (TIMES (REMAINDER (TIMES I J) P) K)
P)
(REMAINDER (TIMES I J K) P))
(EQUAL (REMAINDER (TIMES I J) P)
(REMAINDER A P)))
(EQUAL (REMAINDER (TIMES I J K) P)
(REMAINDER (TIMES A K) P))).
This simplifies, appealing to the lemmas COMMUTATIVITY-OF-TIMES and
TIMES-MOD-1, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
TIMES-MOD-4
(PROVE-LEMMA TIMES-COMP-LIST-1 NIL
(IMPLIES
(AND (EQUAL (REMAINDER (TIMES I (COMPLEMENT I A P))
P)
(REMAINDER A P))
(NOT (ZEROP I))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST I A P))
P)
(REMAINDER (TIMES A
(REMAINDER (TIMES-LIST (COMP-LIST (SUB1 I) A P))
P))
P)))
((USE (TIMES-MOD-4 (J (COMPLEMENT I A P))
(K (TIMES-LIST (COMP-LIST (SUB1 I) A P)))))
(DISABLE COMPLEMENT-WORKS)))
This formula can be simplified, using the abbreviations ZEROP, NOT, AND,
IMPLIES, and TIMES-MOD-1, to:
(IMPLIES
(AND
(IMPLIES
(EQUAL (REMAINDER (TIMES I (COMPLEMENT I A P))
P)
(REMAINDER A P))
(EQUAL (REMAINDER (TIMES I
(COMPLEMENT I A P)
(TIMES-LIST (COMP-LIST (SUB1 I) A P)))
P)
(REMAINDER (TIMES A
(TIMES-LIST (COMP-LIST (SUB1 I) A P)))
P)))
(EQUAL (REMAINDER (TIMES I (COMPLEMENT I A P))
P)
(REMAINDER A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST I A P))
P)
(REMAINDER (TIMES A
(TIMES-LIST (COMP-LIST (SUB1 I) A P)))
P))),
which simplifies, rewriting with CDR-CONS and CAR-CONS, and opening up IMPLIES,
COMP-LIST, and TIMES-LIST, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
TIMES-COMP-LIST-1
(PROVE-LEMMA TIMES-COMP-LIST-2 NIL
(IMPLIES
(AND (PRIME P)
(NOT (DIVIDES P I))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST I A P))
P)
(REMAINDER (TIMES A
(REMAINDER (TIMES-LIST (COMP-LIST (SUB1 I) A P))
P))
P)))
((USE (TIMES-COMP-LIST-1)
(COMPLEMENT-WORKS (J I)))
(DISABLE COMPLEMENT-WORKS COMP-LIST TIMES-LIST PRIME)))
This formula can be simplified, using the abbreviations NOT, IMPLIES, AND,
DIVIDES, and TIMES-MOD-1, to:
(IMPLIES
(AND
(IMPLIES
(AND (EQUAL (REMAINDER (TIMES I (COMPLEMENT I A P))
P)
(REMAINDER A P))
(NOT (ZEROP I))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST I A P))
P)
(REMAINDER (TIMES A
(TIMES-LIST (COMP-LIST (SUB1 I) A P)))
P)))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER I P) 0)))
(EQUAL (REMAINDER (TIMES I (COMPLEMENT I A P))
P)
(REMAINDER A P)))
(PRIME P)
(NOT (EQUAL (REMAINDER I P) 0))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST I A P))
P)
(REMAINDER (TIMES A
(TIMES-LIST (COMP-LIST (SUB1 I) A P)))
P))),
which simplifies, applying the lemmas REMAINDER-0-CROCK, TIMES-IDENTITY, and
EQUAL-TIMES-0, and unfolding the definitions of ZEROP, NOT, AND, IMPLIES,
EQUAL, LESSP, and REMAINDER, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
TIMES-COMP-LIST-2
(PROVE-LEMMA QUOTIENT-PLUS-1 NIL
(IMPLIES (AND (NOT (ZEROP N))
(NUMBERP X)
(EQUAL Y (PLUS X N)))
(EQUAL (QUOTIENT Y N)
(ADD1 (QUOTIENT X N)))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NUMBERP X)
(EQUAL Y (PLUS X N)))
(EQUAL (QUOTIENT Y N)
(ADD1 (QUOTIENT X N)))).
This simplifies, applying the lemmas COMMUTATIVITY-OF-PLUS and
DIFFERENCE-PLUS1, and opening up QUOTIENT, to:
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NUMBERP X)
(LESSP (PLUS N X) N))
(EQUAL 0 (ADD1 (QUOTIENT X N)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
QUOTIENT-PLUS-1
(PROVE-LEMMA TIMES-COMP-LIST-3 NIL
(IMPLIES (AND (NOT (ZEROP I))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(EQUAL (QUOTIENT (LENGTH (COMP-LIST I A P))
2)
(ADD1 (QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2))))
((USE (QUOTIENT-PLUS-1 (X (LENGTH (COMP-LIST (SUB1 I) A P)))
(Y (LENGTH (COMP-LIST I A P)))
(N 2)))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES
(AND (IMPLIES (AND (NOT (ZEROP 2))
(NUMBERP (LENGTH (COMP-LIST (SUB1 I) A P)))
(EQUAL (LENGTH (COMP-LIST I A P))
(PLUS (LENGTH (COMP-LIST (SUB1 I) A P))
2)))
(EQUAL (QUOTIENT (LENGTH (COMP-LIST I A P))
2)
(ADD1 (QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2))))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(EQUAL (QUOTIENT (LENGTH (COMP-LIST I A P))
2)
(ADD1 (QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2)))).
This simplifies, applying CDR-CONS, COMMUTATIVITY-OF-PLUS, DIFFERENCE-2, and
SUB1-ADD1, and opening up ZEROP, NOT, COMP-LIST, LENGTH, AND, LESSP, SUB1,
NUMBERP, EQUAL, QUOTIENT, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
TIMES-COMP-LIST-3
(PROVE-LEMMA TIMES-COMP-LIST-4 NIL
(IMPLIES
(AND (PRIME P)
(NOT (ZEROP I))
(LESSP I P)
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2))
P)))
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST I A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST I A P))
2))
P)))
((USE (TIMES-COMP-LIST-2)
(TIMES-COMP-LIST-3)
(TIMES-MOD-1 (X A)
(Y (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2)))
(N P)))
(DISABLE PRIME TIMES-MOD-1 TIMES-LIST)))
This formula can be simplified, using the abbreviations ZEROP, NOT, IMPLIES,
AND, and DIVIDES, to:
(IMPLIES
(AND
(IMPLIES
(AND (PRIME P)
(NOT (EQUAL (REMAINDER I P) 0))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(EQUAL
(REMAINDER (TIMES-LIST (COMP-LIST I A P))
P)
(REMAINDER (TIMES A
(REMAINDER (TIMES-LIST (COMP-LIST (SUB1 I) A P))
P))
P)))
(IMPLIES (AND (NOT (ZEROP I))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(EQUAL (QUOTIENT (LENGTH (COMP-LIST I A P))
2)
(ADD1 (QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2))))
(EQUAL
(REMAINDER
(TIMES A
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2))
P))
P)
(REMAINDER (TIMES A
(EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2)))
P))
(PRIME P)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2))
P)))
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST I A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST I A P))
2))
P))),
which simplifies, rewriting with EQUAL-MODS-TRICK-2, LESSP-REMAINDER2,
REMAINDER-EXP-LEMMA, and EQUAL-MODS-TRICK-1, and expanding the functions
REMAINDER, NOT, AND, COMP-LIST, IMPLIES, ZEROP, and EQUAL, to the following
two new formulas:
Case 2. (IMPLIES
(AND
(EQUAL
(REMAINDER (TIMES-LIST (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))
P)
(REMAINDER (TIMES A
(REMAINDER (TIMES-LIST (COMP-LIST (SUB1 I) A P))
P))
P))
(EQUAL (QUOTIENT (LENGTH (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))
2)
(ADD1 (QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2)))
(PRIME P)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2))
P))
(NOT (MEMBER I (COMP-LIST (SUB1 I) A P))))
(EQUAL
(REMAINDER (TIMES-LIST (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))
P)
(REMAINDER
(EXP A
(QUOTIENT (LENGTH (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))
2))
P))).
But this again simplifies, rewriting with CDR-CONS, DIFFERENCE-2, SUB1-ADD1,
EQUAL-MODS-TRICK-2, LESSP-REMAINDER2, REMAINDER-EXP-LEMMA, and
EQUAL-MODS-TRICK-1, and opening up the functions LENGTH, LESSP, SUB1,
NUMBERP, EQUAL, QUOTIENT, EXP, and REMAINDER, to:
T.
Case 1. (IMPLIES
(AND
(EQUAL
(REMAINDER (TIMES-LIST (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))
P)
(REMAINDER (TIMES A
(REMAINDER (TIMES-LIST (COMP-LIST (SUB1 I) A P))
P))
P))
(EQUAL (QUOTIENT (LENGTH (CONS I
(CONS (COMPLEMENT I A P)
(COMP-LIST (SUB1 I) A P))))
2)
(ADD1 (QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2)))
(PRIME P)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2))
P))
(MEMBER I (COMP-LIST (SUB1 I) A P)))
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2))
P))).
This again simplifies, trivially, to:
T.
Q.E.D.
[ 0.0 2.2 0.0 ]
TIMES-COMP-LIST-4
(PROVE-LEMMA TIMES-COMP-LIST-5 NIL
(IMPLIES (ZEROP I)
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST I A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST I A P))
2))
P))))
This formula simplifies, rewriting with REMAINDER-OF-1 and EXP-BY-0, and
opening up the functions ZEROP, EQUAL, COMP-LIST, TIMES-LIST, LENGTH, and
QUOTIENT, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TIMES-COMP-LIST-5
(PROVE-LEMMA TIMES-COMP-LIST
(REWRITE)
(IMPLIES (AND (PRIME P) (LESSP I P))
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST I A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST I A P))
2))
P)))
((USE (TIMES-COMP-LIST-4)
(TIMES-COMP-LIST-5))
(INDUCT (POSITIVES I))
(DISABLE PRIME REMAINDER TIMES-LIST COMP-LIST QUOTIENT LENGTH)))
This conjecture simplifies, rewriting with SUB1-NNUMBERP, and opening up the
functions ZEROP, NOT, AND, IMPLIES, OR, EQUAL, LESSP, and SUB1, to:
(IMPLIES
(AND
(NOT (EQUAL (REMAINDER (TIMES-LIST (COMP-LIST (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 I) A P))
2))
P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(PRIME P)
(NOT (LESSP (SUB1 I) P))
(LESSP I P))
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST I A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST I A P))
2))
P))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
TIMES-COMP-LIST
(PROVE-LEMMA SUB1-LENGTH-DELETE
(REWRITE)
(IMPLIES (MEMBER X B)
(EQUAL (LENGTH (DELETE X B))
(SUB1 (LENGTH B)))))
WARNING: the previously added lemma, LENGTH-DELETE, could be applied whenever
the newly proposed SUB1-LENGTH-DELETE could!
This simplifies, appealing to the lemma LENGTH-DELETE, to the conjecture:
(IMPLIES (MEMBER X B)
(EQUAL (LENGTH (CDR B))
(SUB1 (LENGTH B)))).
This again simplifies, opening up the function LENGTH, to two new formulas:
Case 2. (IMPLIES (AND (MEMBER X B) (NOT (LISTP B)))
(EQUAL (LENGTH (CDR B)) (SUB1 0))),
which again simplifies, opening up MEMBER, to:
T.
Case 1. (IMPLIES (AND (MEMBER X B) (LISTP B))
(EQUAL (LENGTH (CDR B))
(SUB1 (ADD1 (LENGTH (CDR B)))))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
SUB1-LENGTH-DELETE
(PROVE-LEMMA EQUAL-LENGTH-PERM NIL
(IMPLIES (PERM A B)
(EQUAL (LENGTH A) (LENGTH B)))
((INDUCT (PERM A B))))
This conjecture can be simplified, using the abbreviations IMPLIES, NLISTP,
NOT, OR, and AND, to three new conjectures:
Case 3. (IMPLIES (AND (NOT (LISTP A)) (PERM A B))
(EQUAL (LENGTH A) (LENGTH B))),
which simplifies, opening up the functions PERM, LENGTH, and EQUAL, to:
T.
Case 2. (IMPLIES (AND (LISTP A)
(MEMBER (CAR A) B)
(IMPLIES (PERM (CDR A) (DELETE (CAR A) B))
(EQUAL (LENGTH (CDR A))
(LENGTH (DELETE (CAR A) B))))
(PERM A B))
(EQUAL (LENGTH A) (LENGTH B))),
which simplifies, rewriting with PERM-MEMBER and SUB1-LENGTH-DELETE, and
opening up the definitions of MEMBER, IMPLIES, PERM, and LENGTH, to the new
goal:
(IMPLIES (AND (LISTP A)
(EQUAL (LENGTH (CDR A))
(SUB1 (LENGTH B)))
(MEMBER (CAR A) B)
(PERM (CDR A) (DELETE (CAR A) B)))
(EQUAL (ADD1 (LENGTH (CDR A)))
(LENGTH B))),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL (LENGTH B) 0)
(LISTP A)
(EQUAL (LENGTH (CDR A))
(SUB1 (LENGTH B)))
(MEMBER (CAR A) B)
(PERM (CDR A) (DELETE (CAR A) B)))
(EQUAL (ADD1 (LENGTH (CDR A)))
(LENGTH B))).
But this again simplifies, rewriting with the lemma EQUAL-LENGTH-0, and
unfolding the functions SUB1 and MEMBER, to:
T.
Case 1. (IMPLIES (AND (LISTP A)
(NOT (MEMBER (CAR A) B))
(PERM A B))
(EQUAL (LENGTH A) (LENGTH B))),
which simplifies, appealing to the lemma PERM-MEMBER, and unfolding the
definition of MEMBER, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EQUAL-LENGTH-PERM
(PROVE-LEMMA LENGTH-POSITIVES
(REWRITE)
(EQUAL (LENGTH (POSITIVES N)) (FIX N))
((INDUCT (POSITIVES N))))
This formula can be simplified, using the abbreviations ZEROP, NOT, OR, and
AND, to the following two new goals:
Case 2. (IMPLIES (ZEROP N)
(EQUAL (LENGTH (POSITIVES N))
(FIX N))).
This simplifies, expanding ZEROP, POSITIVES, LENGTH, FIX, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (LENGTH (POSITIVES (SUB1 N)))
(FIX (SUB1 N))))
(EQUAL (LENGTH (POSITIVES N))
(FIX N))).
This simplifies, applying ADD1-SUB1 and CDR-CONS, and expanding the
functions FIX, POSITIVES, and LENGTH, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LENGTH-POSITIVES
(PROVE-LEMMA EULER-2-1 NIL
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(NOT (RESIDUE A P)))
(EQUAL (REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 P) A P))
2))
P)
(SUB1 P)))
((USE (TIMES-COMP-LIST (I (SUB1 P)))
(COMP-LIST-FACT)
(WILSON-THM))
(DISABLE TIMES-COMP-LIST COMP-LIST-FACT)))
This conjecture can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, and DIVIDES, to:
(IMPLIES
(AND
(IMPLIES
(AND (PRIME P) (LESSP (SUB1 P) P))
(EQUAL (REMAINDER (TIMES-LIST (COMP-LIST (SUB1 P) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 P) A P))
2))
P)))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(EQUAL (TIMES-LIST (COMP-LIST (SUB1 P) A P))
(FACT (SUB1 P))))
(IMPLIES (PRIME P)
(EQUAL (REMAINDER (FACT (SUB1 P)) P)
(SUB1 P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(EQUAL (REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 P) A P))
2))
P)
(SUB1 P))).
This simplifies, unfolding the functions PRIME, AND, IMPLIES, NOT, DIVIDES,
and RESIDUE, to:
(IMPLIES
(AND (NOT (LESSP (SUB1 P) P))
(EQUAL (TIMES-LIST (COMP-LIST (SUB1 P) A P))
(FACT (SUB1 P)))
(EQUAL (REMAINDER (FACT (SUB1 P)) P)
(SUB1 P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (MEMBER (REMAINDER A P)
(SQUARES P P))))
(EQUAL (REMAINDER (EXP A
(QUOTIENT (LENGTH (COMP-LIST (SUB1 P) A P))
2))
P)
(SUB1 P))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 1.4 0.0 ]
EULER-2-1
(PROVE-LEMMA EULER-2-2
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(NOT (RESIDUE A P)))
(EQUAL (LENGTH (COMP-LIST (SUB1 P) A P))
(SUB1 P)))
((USE (EQUAL-LENGTH-PERM (A (POSITIVES (SUB1 P)))
(B (COMP-LIST (SUB1 P) A P)))
(PERM-POSITIVES-COMP-LIST))
(DISABLE EQUAL-LENGTH-PERM PERM-POSITIVES-COMP-LIST)))
This conjecture can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, and DIVIDES, to:
(IMPLIES (AND (IMPLIES (PERM (POSITIVES (SUB1 P))
(COMP-LIST (SUB1 P) A P))
(EQUAL (LENGTH (POSITIVES (SUB1 P)))
(LENGTH (COMP-LIST (SUB1 P) A P))))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(PERM (POSITIVES (SUB1 P))
(COMP-LIST (SUB1 P) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(EQUAL (LENGTH (COMP-LIST (SUB1 P) A P))
(SUB1 P))).
This simplifies, using linear arithmetic, rewriting with
SUBSETP-POSITIVES-COMP-LIST, BOUNDED-COMP-LIST, ALL-NON-ZEROP-COMP-LIST,
ALL-DISTINCT-COMP-LIST, PIGEONHOLE2, and LENGTH-POSITIVES, and opening up the
definitions of PRIME, DIVIDES, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
EULER-2-2
(PROVE-LEMMA EULER-2-3 NIL
(IMPLIES (NOT (ZEROP P))
(EQUAL (DIVIDES 2 P)
(NOT (DIVIDES 2 (SUB1 P)))))
((INDUCT (ODD P))))
This conjecture can be simplified, using the abbreviations ZEROP, IMPLIES, NOT,
OR, AND, and DIVIDES, to three new conjectures:
Case 3. (IMPLIES (AND (ZEROP P)
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL (EQUAL (REMAINDER P 2) 0)
(NOT (EQUAL (REMAINDER (SUB1 P) 2) 0)))),
which simplifies, expanding ZEROP, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(ZEROP (SUB1 P)))
(EQUAL (EQUAL (REMAINDER P 2) 0)
(NOT (EQUAL (REMAINDER (SUB1 P) 2) 0)))),
which simplifies, opening up the definitions of ZEROP, SUB1, LESSP, NUMBERP,
EQUAL, REMAINDER, and NOT, to:
T.
Case 1. (IMPLIES
(AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL (SUB1 P) 0))
(NUMBERP (SUB1 P))
(IMPLIES (NOT (ZEROP (SUB1 (SUB1 P))))
(EQUAL (EQUAL (REMAINDER (SUB1 (SUB1 P)) 2)
0)
(NOT (EQUAL (REMAINDER (SUB1 (SUB1 (SUB1 P))) 2)
0)))))
(EQUAL (EQUAL (REMAINDER P 2) 0)
(NOT (EQUAL (REMAINDER (SUB1 P) 2) 0)))),
which simplifies, rewriting with DIFFERENCE-1, and expanding the functions
ZEROP, NOT, IMPLIES, DIFFERENCE, SUB1, NUMBERP, EQUAL, REMAINDER, and LESSP,
to the following three new conjectures:
Case 1.3.
(IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL (SUB1 P) 0))
(EQUAL (REMAINDER (SUB1 (SUB1 P)) 2)
0)
(NOT (EQUAL (REMAINDER (SUB1 (SUB1 (SUB1 P))) 2)
0)))
(NOT (LESSP P 2))).
But this again simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL (SUB1 P) 0))
(NOT (EQUAL (REMAINDER (SUB1 (SUB1 P)) 2)
0))
(EQUAL (REMAINDER (SUB1 (SUB1 (SUB1 P))) 2)
0))
(NOT (LESSP (SUB1 P) 2))),
which again simplifies, using linear arithmetic, to the conjecture:
(IMPLIES (AND (NOT (EQUAL 2 0))
(NUMBERP 2)
(NOT (EQUAL (SUB1 2) 0))
(NOT (EQUAL (REMAINDER (SUB1 (SUB1 2)) 2)
0))
(EQUAL (REMAINDER (SUB1 (SUB1 (SUB1 2))) 2)
0))
(NOT (LESSP (SUB1 2) 2))).
But this again simplifies, expanding the definitions of EQUAL, NUMBERP,
SUB1, and REMAINDER, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL (SUB1 P) 0))
(EQUAL (SUB1 (SUB1 P)) 0))
(NOT (LESSP P 2))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.6 0.0 ]
EULER-2-3
(PROVE-LEMMA EULER-2-4
(REWRITE)
(IMPLIES (NOT (DIVIDES 2 P))
(EQUAL (QUOTIENT (SUB1 P) 2)
(QUOTIENT P 2)))
((USE (EULER-2-3)
(REMAINDER-QUOTIENT (X P) (Y 2))
(REMAINDER-QUOTIENT (X (SUB1 P))
(Y 2)))
(DISABLE REMAINDER-QUOTIENT)))
This formula can be simplified, using the abbreviations NOT, IMPLIES, AND, and
DIVIDES, to:
(IMPLIES (AND (IMPLIES (NOT (ZEROP P))
(EQUAL (EQUAL (REMAINDER P 2) 0)
(NOT (EQUAL (REMAINDER (SUB1 P) 2) 0))))
(EQUAL (PLUS (REMAINDER P 2)
(TIMES 2 (QUOTIENT P 2)))
(FIX P))
(EQUAL (PLUS (REMAINDER (SUB1 P) 2)
(TIMES 2 (QUOTIENT (SUB1 P) 2)))
(FIX (SUB1 P)))
(NOT (EQUAL (REMAINDER P 2) 0)))
(EQUAL (QUOTIENT (SUB1 P) 2)
(QUOTIENT P 2))),
which simplifies, using linear arithmetic, applying LESSP-REMAINDER-DIVISOR,
and opening up the definition of EQUAL, to the new formula:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(EQUAL (FIX P)
(PLUS 1 (TIMES 2 (QUOTIENT P 2))))
(IMPLIES (NOT (ZEROP P))
(EQUAL (EQUAL 1 0)
(NOT (EQUAL (REMAINDER (SUB1 P) 2) 0))))
(EQUAL (PLUS 1 (TIMES 2 (QUOTIENT P 2)))
(PLUS 1 (TIMES 2 (QUOTIENT P 2))))
(EQUAL (PLUS (REMAINDER (SUB1 P) 2)
(TIMES 2 (QUOTIENT (SUB1 P) 2)))
(FIX (SUB1 P)))
(NOT (EQUAL 1 0)))
(EQUAL (QUOTIENT (SUB1 P) 2)
(QUOTIENT P 2))),
which again simplifies, appealing to the lemmas TIMES-2 and SUB1-NNUMBERP, and
unfolding the definitions of FIX, ZEROP, NOT, EQUAL, REMAINDER, IMPLIES, LESSP,
NUMBERP, QUOTIENT, TIMES, PLUS, and SUB1, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NUMBERP P)
(EQUAL P
(PLUS 1
(QUOTIENT P 2)
(QUOTIENT P 2)))
(EQUAL (REMAINDER (SUB1 P) 2) 0)
(EQUAL (PLUS (QUOTIENT (SUB1 P) 2)
(QUOTIENT (SUB1 P) 2))
(SUB1 P)))
(EQUAL (QUOTIENT (SUB1 P) 2)
(QUOTIENT P 2))).
However this again simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL P 0)
(EQUAL (REMAINDER P 2) 1)
(NUMBERP P)
(EQUAL P
(PLUS 1
(QUOTIENT P 2)
(QUOTIENT P 2)))
(EQUAL (REMAINDER (SUB1 P) 2) 0)
(EQUAL (PLUS (QUOTIENT (SUB1 P) 2)
(QUOTIENT (SUB1 P) 2))
(SUB1 P)))
(EQUAL (QUOTIENT (SUB1 P) 2)
(QUOTIENT P 2))).
This again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
EULER-2-4
(PROVE-LEMMA EULER-2
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(NOT (RESIDUE A P)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
(SUB1 P)))
((USE (EULER-2-1))
(DISABLE EULER-2-1 PRIME DIVIDES RESIDUE EXP QUOTIENT LENGTH
COMP-LIST)))
This formula simplifies, applying EULER-2-2 and EULER-2-4, and opening up NOT,
AND, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EULER-2
(DEFN RES1
(N A P)
(IF (ZEROP N)
T
(IF (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(NOT (RES1 (SUB1 N) A P))
(RES1 (SUB1 N) A P))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
inform us that the measure (COUNT N) decreases according to the well-founded
relation LESSP in each recursive call. Hence, RES1 is accepted under the
principle of definition. Note that:
(OR (FALSEP (RES1 N A P))
(TRUEP (RES1 N A P)))
is a theorem.
[ 0.0 0.0 0.0 ]
RES1
(DEFN REFLECT (X P) (DIFFERENCE P X))
From the definition we can conclude that (NUMBERP (REFLECT X P)) is a
theorem.
[ 0.0 0.0 0.0 ]
REFLECT
(DEFN REFLECT-LIST
(N A P)
(IF (ZEROP N)
NIL
(IF (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(CONS (REFLECT (REMAINDER (TIMES A N) P) P)
(REFLECT-LIST (SUB1 N) A P))
(CONS (REMAINDER (TIMES A N) P)
(REFLECT-LIST (SUB1 N) A P)))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
inform us that the measure (COUNT N) decreases according to the well-founded
relation LESSP in each recursive call. Hence, REFLECT-LIST is accepted under
the definitional principle. From the definition we can conclude that:
(OR (LITATOM (REFLECT-LIST N A P))
(LISTP (REFLECT-LIST N A P)))
is a theorem.
[ 0.0 0.0 0.0 ]
REFLECT-LIST
(PROVE-LEMMA DIFF-MOD-1
(REWRITE)
(IMPLIES (LEQ B A)
(EQUAL (REMAINDER (DIFFERENCE A (REMAINDER B P))
P)
(REMAINDER (DIFFERENCE A B) P)))
((USE (REMAINDER-QUOTIENT (X B) (Y P))
(REMAINDER-PLUS-TIMES-1 (X (DIFFERENCE A B))
(I (QUOTIENT B P))
(J P)))
(DISABLE REMAINDER-QUOTIENT REMAINDER-PLUS-TIMES-1
REMAINDER-PLUS-TIMES-2)))
This simplifies, applying the lemmas TIMES-IDENTITY, COMMUTATIVITY-OF-PLUS,
and COMMUTATIVITY-OF-TIMES, and unfolding FIX, DIFFERENCE, LESSP, QUOTIENT,
EQUAL, PLUS, and REMAINDER, to:
(IMPLIES (AND (NUMBERP B)
(EQUAL (PLUS (REMAINDER B P)
(TIMES P (QUOTIENT B P)))
B)
(EQUAL (REMAINDER (PLUS (DIFFERENCE A B)
(TIMES P (QUOTIENT B P)))
P)
(REMAINDER (DIFFERENCE A B) P))
(NOT (LESSP A B)))
(EQUAL (REMAINDER (DIFFERENCE A (REMAINDER B P))
P)
(REMAINDER (DIFFERENCE A B) P))).
This again simplifies, obviously, to:
(IMPLIES (AND (EQUAL (PLUS (REMAINDER B P)
(TIMES P (QUOTIENT B P)))
B)
(EQUAL (REMAINDER (PLUS (DIFFERENCE A B)
(TIMES P (QUOTIENT B P)))
P)
(REMAINDER (DIFFERENCE A B) P))
(NOT (LESSP A B)))
(EQUAL (REMAINDER (DIFFERENCE A (REMAINDER B P))
P)
(REMAINDER (DIFFERENCE A B) P))).
Applying the lemmas DIFFERENCE-ELIM and REMAINDER-QUOTIENT-ELIM, replace A by
(PLUS B X) to eliminate (DIFFERENCE A B) and X by (PLUS Z (TIMES P V)) to
eliminate (REMAINDER X P) and (QUOTIENT X P). We use the type restriction
lemma noted when DIFFERENCE was introduced, LESSP-REMAINDER2, the type
restriction lemma noted when REMAINDER was introduced, and the type
restriction lemma noted when QUOTIENT was introduced to restrict the new
variables. We would thus like to prove the following four new goals:
Case 4. (IMPLIES (AND (NOT (NUMBERP A))
(EQUAL (PLUS (REMAINDER B P)
(TIMES P (QUOTIENT B P)))
B)
(EQUAL (REMAINDER (PLUS (DIFFERENCE A B)
(TIMES P (QUOTIENT B P)))
P)
(REMAINDER (DIFFERENCE A B) P))
(NOT (LESSP A B)))
(EQUAL (REMAINDER (DIFFERENCE A (REMAINDER B P))
P)
(REMAINDER (DIFFERENCE A B) P))).
However this further simplifies, using linear arithmetic, applying
DIFFERENCE-0, REMAINDER-TIMES, and REMAINDER-0-CROCK, and unfolding the
functions EQUAL, PLUS, and LESSP, to:
T.
Case 3. (IMPLIES (AND (EQUAL P 0)
(NUMBERP X)
(EQUAL (PLUS (REMAINDER B P)
(TIMES P (QUOTIENT B P)))
B)
(EQUAL (REMAINDER (PLUS X (TIMES P (QUOTIENT B P)))
P)
(REMAINDER X P))
(NOT (LESSP (PLUS B X) B)))
(EQUAL (REMAINDER (DIFFERENCE (PLUS B X)
(REMAINDER B P))
P)
(REMAINDER X P))).
However this further simplifies, rewriting with COMMUTATIVITY-OF-PLUS and
DIFFERENCE-PLUS1, and unfolding EQUAL, REMAINDER, QUOTIENT, TIMES, PLUS,
LESSP, and DIFFERENCE, to:
(IMPLIES (AND (NUMBERP X)
(EQUAL 0 B)
(EQUAL X 0))
(EQUAL 0 X)),
which again simplifies, obviously, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP P))
(NUMBERP X)
(EQUAL (PLUS (REMAINDER B P)
(TIMES P (QUOTIENT B P)))
B)
(EQUAL (REMAINDER (PLUS X (TIMES P (QUOTIENT B P)))
P)
(REMAINDER X P))
(NOT (LESSP (PLUS B X) B)))
(EQUAL (REMAINDER (DIFFERENCE (PLUS B X)
(REMAINDER B P))
P)
(REMAINDER X P))).
However this further simplifies, applying REMAINDER-WRT-12, TIMES-ZERO2,
COMMUTATIVITY-OF-TIMES, COMMUTATIVITY-OF-PLUS, REMAINDER-0-CROCK, and
DIFFERENCE-PLUS1, and opening up the functions QUOTIENT, EQUAL, PLUS, LESSP,
and DIFFERENCE, to:
(IMPLIES (AND (NOT (NUMBERP P))
(NUMBERP X)
(EQUAL 0 B)
(EQUAL X 0))
(EQUAL 0 X)),
which again simplifies, trivially, to:
T.
Case 1. (IMPLIES (AND (NUMBERP Z)
(EQUAL (LESSP Z P) (NOT (ZEROP P)))
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(EQUAL (PLUS (REMAINDER B P)
(TIMES P (QUOTIENT B P)))
B)
(EQUAL (REMAINDER (PLUS (PLUS Z (TIMES P V))
(TIMES P (QUOTIENT B P)))
P)
Z)
(NOT (LESSP (PLUS B Z (TIMES P V)) B)))
(EQUAL (REMAINDER (DIFFERENCE (PLUS B Z (TIMES P V))
(REMAINDER B P))
P)
Z)).
But this further simplifies, applying ASSOCIATIVITY-OF-PLUS, and unfolding
the definitions of ZEROP and NOT, to:
(IMPLIES (AND (LESSP Z P)
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(EQUAL (PLUS (REMAINDER B P)
(TIMES P (QUOTIENT B P)))
B)
(EQUAL (REMAINDER (PLUS Z
(TIMES P V)
(TIMES P (QUOTIENT B P)))
P)
Z)
(NOT (LESSP (PLUS B Z (TIMES P V)) B)))
(EQUAL (REMAINDER (DIFFERENCE (PLUS B Z (TIMES P V))
(REMAINDER B P))
P)
Z)).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace B by
(PLUS X (TIMES P W)) to eliminate (REMAINDER B P) and (QUOTIENT B P). We
employ LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was
introduced to restrict the new variables. We would thus like to prove the
following two new goals:
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP B))
(LESSP Z P)
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(EQUAL (PLUS (REMAINDER B P)
(TIMES P (QUOTIENT B P)))
B)
(EQUAL (REMAINDER (PLUS Z
(TIMES P V)
(TIMES P (QUOTIENT B P)))
P)
Z)
(NOT (LESSP (PLUS B Z (TIMES P V)) B)))
(EQUAL (REMAINDER (DIFFERENCE (PLUS B Z (TIMES P V))
(REMAINDER B P))
P)
Z)).
This finally simplifies, clearly, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP X)
(EQUAL (LESSP X P) (NOT (ZEROP P)))
(NUMBERP W)
(LESSP Z P)
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(EQUAL (PLUS X (TIMES P W))
(PLUS X (TIMES P W)))
(EQUAL (REMAINDER (PLUS Z (TIMES P V) (TIMES P W))
P)
Z)
(NOT (LESSP (PLUS (PLUS X (TIMES P W))
Z
(TIMES P V))
(PLUS X (TIMES P W)))))
(EQUAL (REMAINDER (DIFFERENCE (PLUS (PLUS X (TIMES P W))
Z
(TIMES P V))
X)
P)
Z)).
But this finally simplifies, appealing to the lemmas COMMUTATIVITY-OF-PLUS,
COMMUTATIVITY2-OF-PLUS, ASSOCIATIVITY-OF-PLUS, LESSP-PLUS-CANCELATION, and
DIFFERENCE-PLUS1, and expanding the definitions of ZEROP and NOT, to:
T.
Q.E.D.
[ 0.0 1.1 0.0 ]
DIFF-MOD-1
(PROVE-LEMMA REM-DIFF-TIMES
(REWRITE)
(IMPLIES (AND (LESSP X P)
(NOT (ZEROP X))
(NOT (ZEROP B)))
(EQUAL (REMAINDER (DIFFERENCE (TIMES B P) X)
P)
(DIFFERENCE P X)))
((USE (REMAINDER-PLUS-TIMES-1 (X (DIFFERENCE P X))
(I (SUB1 B))
(J P)))
(DISABLE REMAINDER-PLUS-TIMES-1 REMAINDER-PLUS-TIMES-2)))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES (AND (EQUAL (REMAINDER (PLUS (DIFFERENCE P X)
(TIMES (SUB1 B) P))
P)
(REMAINDER (DIFFERENCE P X) P))
(LESSP X P)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL B 0))
(NUMBERP B))
(EQUAL (REMAINDER (DIFFERENCE (TIMES B P) X)
P)
(DIFFERENCE P X))).
This simplifies, using linear arithmetic, applying the lemmas
COMMUTATIVITY-OF-TIMES, REMAINDER-0-CROCK, and DIFFERENCE-0, and expanding the
definitions of REMAINDER, LESSP, and EQUAL, to the following three new goals:
Case 3. (IMPLIES (AND (LESSP P X)
(EQUAL (REMAINDER (PLUS (DIFFERENCE P X)
(TIMES (SUB1 B) P))
P)
(REMAINDER (DIFFERENCE P X) P))
(LESSP X P)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL B 0))
(NUMBERP B))
(EQUAL (REMAINDER (DIFFERENCE (TIMES B P) X)
P)
(DIFFERENCE P X))).
This again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (LESSP P X))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP (DIFFERENCE P X) P))
(EQUAL (REMAINDER (PLUS (DIFFERENCE P X)
(TIMES P (SUB1 B)))
P)
0)
(LESSP X P)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL B 0))
(NUMBERP B))
(EQUAL (REMAINDER (DIFFERENCE (TIMES B P) X)
P)
(DIFFERENCE P X))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LESSP P X))
(LESSP (DIFFERENCE P X) P)
(EQUAL (REMAINDER (PLUS (DIFFERENCE P X)
(TIMES P (SUB1 B)))
P)
(DIFFERENCE P X))
(LESSP X P)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL B 0))
(NUMBERP B))
(EQUAL (REMAINDER (DIFFERENCE (TIMES B P) X)
P)
(DIFFERENCE P X))).
Applying the lemma DIFFERENCE-ELIM, replace P by (PLUS X Z) to eliminate
(DIFFERENCE P X). We rely upon the type restriction lemma noted when
DIFFERENCE was introduced to restrict the new variable. This produces the
following two new conjectures:
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (LESSP P X))
(LESSP (DIFFERENCE P X) P)
(EQUAL (REMAINDER (PLUS (DIFFERENCE P X)
(TIMES P (SUB1 B)))
P)
(DIFFERENCE P X))
(LESSP X P)
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL B 0))
(NUMBERP B))
(EQUAL (REMAINDER (DIFFERENCE (TIMES B P) X)
P)
(DIFFERENCE P X))).
However this further simplifies, expanding the definition of LESSP, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP Z)
(NOT (LESSP (PLUS X Z) X))
(LESSP Z (PLUS X Z))
(EQUAL (REMAINDER (PLUS Z (TIMES (PLUS X Z) (SUB1 B)))
(PLUS X Z))
Z)
(LESSP X (PLUS X Z))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL B 0))
(NUMBERP B))
(EQUAL (REMAINDER (DIFFERENCE (TIMES B (PLUS X Z)) X)
(PLUS X Z))
Z)),
which further simplifies, appealing to the lemmas LESSP-PLUS-CANCELLATION3,
COMMUTATIVITY-OF-TIMES, and DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, to:
(IMPLIES (AND (NOT (LESSP (PLUS X Z) X))
(EQUAL (REMAINDER (PLUS Z
(TIMES X (SUB1 B))
(TIMES Z (SUB1 B)))
(PLUS X Z))
Z)
(LESSP X (PLUS X Z))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL B 0))
(NUMBERP B))
(EQUAL (REMAINDER (DIFFERENCE (PLUS (TIMES B X) (TIMES B Z))
X)
(PLUS X Z))
Z)).
Appealing to the lemma SUB1-ELIM, we now replace B by (ADD1 V) to
eliminate (SUB1 B). We use the type restriction lemma noted when SUB1 was
introduced to constrain the new variable. We must thus prove the goal:
(IMPLIES (AND (NUMBERP V)
(NOT (LESSP (PLUS X Z) X))
(EQUAL (REMAINDER (PLUS Z (TIMES X V) (TIMES Z V))
(PLUS X Z))
Z)
(LESSP X (PLUS X Z))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL (ADD1 V) 0)))
(EQUAL (REMAINDER (DIFFERENCE (PLUS (TIMES (ADD1 V) X)
(TIMES (ADD1 V) Z))
X)
(PLUS X Z))
Z)).
However this further simplifies, applying the lemmas
COMMUTATIVITY-OF-TIMES, TIMES-ADD1, COMMUTATIVITY2-OF-PLUS,
ASSOCIATIVITY-OF-PLUS, and DIFFERENCE-PLUS1, to:
T.
Q.E.D.
[ 0.0 0.6 0.0 ]
REM-DIFF-TIMES
(PROVE-LEMMA REFLECT-COMMUTES-WITH-TIMES-1
(REWRITE)
(IMPLIES (LEQ Y P)
(EQUAL (REMAINDER (TIMES (REFLECT Y P) X) P)
(REMAINDER (REFLECT (REMAINDER (TIMES Y X) P) P)
P)))
((USE (DIFF-MOD-1 (A (TIMES P X))
(B (TIMES Y X)))
(LESSP-TIMES-CANCELLATION (Z X)
(X Y)
(Y P))
(REM-DIFF-TIMES (B X)
(X (REMAINDER (TIMES Y X) P))))
(DISABLE LESSP-TIMES-CANCELLATION REM-DIFF-TIMES DIFF-MOD-1)))
This formula can be simplified, using the abbreviations IMPLIES, AND, and
REFLECT, to:
(IMPLIES
(AND (IMPLIES (IF (LESSP (TIMES P X) (TIMES Y X))
F T)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES Y X) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES Y X))
P)))
(EQUAL (LESSP (TIMES Y X) (TIMES P X))
(AND (NOT (ZEROP X)) (LESSP Y P)))
(IMPLIES (AND (LESSP (REMAINDER (TIMES Y X) P) P)
(NOT (ZEROP (REMAINDER (TIMES Y X) P)))
(NOT (ZEROP X)))
(EQUAL (REMAINDER (DIFFERENCE (TIMES X P)
(REMAINDER (TIMES Y X) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES Y X) P))))
(NOT (LESSP P Y)))
(EQUAL (REMAINDER (TIMES (DIFFERENCE P Y) X)
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES Y X) P))
P))),
which simplifies, using linear arithmetic, applying COMMUTATIVITY-OF-TIMES,
EQUAL-LESSP, LESSP-REMAINDER2, REMAINDER-TIMES, DIFFERENCE-0, TIMES-ZERO2,
REMAINDER-WRT-12, REMAINDER-0-CROCK, TIMES-IDENTITY, EQUAL-TIMES-0,
TIMES-DIFFERENCE, and EQUAL-DIFFERENCE-0, and unfolding the functions IMPLIES,
ZEROP, NOT, AND, EQUAL, LESSP, DIFFERENCE, REMAINDER, and TIMES, to the
following 50 new goals:
Case 50.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL (TIMES 0 X) (REMAINDER P P))).
This again simplifies, using linear arithmetic, to two new goals:
Case 50.2.
(IMPLIES (AND (NOT (NUMBERP Y))
(LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL (TIMES 0 X) (REMAINDER P P))),
which again simplifies, rewriting with TIMES-ZERO2, and unfolding the
definitions of EQUAL and LESSP, to:
T.
Case 50.1.
(IMPLIES (AND (NUMBERP Y)
(LESSP (TIMES P X) (TIMES X P))
(NOT (LESSP (TIMES X P) (TIMES P X)))
(NOT (LESSP P P))
(EQUAL (REMAINDER (TIMES X P) P) 0)
(NOT (LESSP P P))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL (TIMES 0 X) (REMAINDER P P))).
However this again simplifies, applying COMMUTATIVITY-OF-TIMES, to:
T.
Case 49.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL (TIMES 0 X) (REMAINDER 0 P))).
However this again simplifies, rewriting with TIMES-IDENTITY and
EQUAL-TIMES-0, and expanding the definitions of EQUAL, LESSP, and REMAINDER,
to:
T.
Case 48.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL (TIMES 0 X) (REMAINDER 0 P))).
However this again simplifies, rewriting with EQUAL-TIMES-0 and
REMAINDER-WRT-12, and expanding LESSP, to:
T.
Case 47.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL X 0)
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))).
But this again simplifies, using linear arithmetic, to:
T.
Case 46.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL X 0)
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL 0 (REMAINDER 0 P))),
which again simplifies, using linear arithmetic, to:
T.
Case 45.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL X 0)
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL 0 (REMAINDER 0 P))),
which again simplifies, using linear arithmetic, to:
T.
Case 44.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))),
which again simplifies, using linear arithmetic, to two new goals:
Case 44.2.
(IMPLIES (AND (NOT (NUMBERP Y))
(LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))),
which again simplifies, rewriting with TIMES-ZERO2, and opening up LESSP,
to:
T.
Case 44.1.
(IMPLIES (AND (NUMBERP Y)
(LESSP (TIMES P X) (TIMES X P))
(NOT (LESSP (TIMES X P) (TIMES P X)))
(NOT (LESSP P P))
(NOT (NUMBERP X))
(NOT (LESSP P P))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))).
However this again simplifies, rewriting with TIMES-ZERO2 and
COMMUTATIVITY-OF-TIMES, and expanding the function LESSP, to:
T.
Case 43.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL 0 (REMAINDER 0 P))).
This again simplifies, rewriting with TIMES-ZERO2 and EQUAL-TIMES-0, and
unfolding LESSP, to:
T.
Case 42.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL 0 (REMAINDER 0 P))).
This again simplifies, rewriting with TIMES-ZERO2 and EQUAL-TIMES-0, and
expanding LESSP, to:
T.
Case 41.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(LESSP P (REMAINDER (TIMES X Y) P)))
(EQUAL (REMAINDER (TIMES (DIFFERENCE P Y) X)
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES Y X) P))
P))).
But this again simplifies, using linear arithmetic, to three new conjectures:
Case 41.3.
(IMPLIES
(AND (NOT (NUMBERP Y))
(LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(LESSP P (REMAINDER (TIMES X Y) P)))
(EQUAL (REMAINDER (TIMES (DIFFERENCE P Y) X)
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES Y X) P))
P))),
which again simplifies, rewriting with TIMES-ZERO2, and unfolding EQUAL
and LESSP, to:
T.
Case 41.2.
(IMPLIES
(AND (NOT (NUMBERP P))
(LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(LESSP P (REMAINDER (TIMES X Y) P)))
(EQUAL (REMAINDER (TIMES (DIFFERENCE P Y) X)
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES Y X) P))
P))).
But this again simplifies, using linear arithmetic, rewriting with the
lemmas EQUAL-TIMES-0, REMAINDER-WRT-12, DIFFERENCE-0, and
REMAINDER-0-CROCK, and opening up the definitions of LESSP and EQUAL, to:
T.
Case 41.1.
(IMPLIES
(AND (NUMBERP P)
(NUMBERP Y)
(LESSP (TIMES P X) (TIMES X P))
(NOT (LESSP (TIMES X P) (TIMES P X)))
(NOT (LESSP P P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X P) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X P) P)))
(NOT (LESSP P P))
(LESSP P (REMAINDER (TIMES X P) P)))
(EQUAL (REMAINDER (TIMES (DIFFERENCE P P) X)
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES P X) P))
P))),
which again simplifies, applying COMMUTATIVITY-OF-TIMES, to:
T.
Case 40.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(NOT (LESSP (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
P)))
(EQUAL (TIMES 0 X) 0)).
But this again simplifies, using linear arithmetic, to:
T.
Case 39.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(NOT (NUMBERP P)))
(EQUAL (TIMES 0 X) 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 38.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(EQUAL P 0))
(EQUAL (TIMES 0 X) 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 37.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
P))
(EQUAL (TIMES 0 X)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))),
which again simplifies, using linear arithmetic, to two new conjectures:
Case 37.2.
(IMPLIES
(AND (NOT (NUMBERP Y))
(LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
P))
(EQUAL (TIMES 0 X)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))),
which again simplifies, rewriting with TIMES-ZERO2, and unfolding the
definitions of EQUAL and LESSP, to:
T.
Case 37.1.
(IMPLIES
(AND (NUMBERP Y)
(LESSP (TIMES P X) (TIMES X P))
(NOT (LESSP (TIMES X P) (TIMES P X)))
(NOT (LESSP P P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X P) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X P) P)))
(NOT (LESSP P P))
(NOT (LESSP P (REMAINDER (TIMES X P) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (DIFFERENCE P
(REMAINDER (TIMES X P) P))
P))
(EQUAL (TIMES 0 X)
(DIFFERENCE P
(REMAINDER (TIMES X P) P)))).
However this again simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, REMAINDER-TIMES, and COMMUTATIVITY-OF-TIMES, and
expanding the functions DIFFERENCE and EQUAL, to:
T.
Case 36.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))).
But this again simplifies, applying TIMES-ZERO2 and EQUAL-TIMES-0, and
expanding the function LESSP, to:
T.
Case 35.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL 0 (REMAINDER 0 P))).
However this again simplifies, rewriting with TIMES-ZERO2 and EQUAL-TIMES-0,
and opening up LESSP, to:
T.
Case 34.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL 0 (REMAINDER 0 P))).
However this again simplifies, rewriting with the lemmas TIMES-ZERO2 and
EQUAL-TIMES-0, and expanding the function LESSP, to:
T.
Case 33.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(EQUAL X 0)
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))),
which again simplifies, using linear arithmetic, to:
T.
Case 32.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(EQUAL X 0)
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL 0 (REMAINDER 0 P))),
which again simplifies, using linear arithmetic, to:
T.
Case 31.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(EQUAL X 0)
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL 0 (REMAINDER 0 P))),
which again simplifies, using linear arithmetic, to:
T.
Case 30.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(REMAINDER P P))),
which again simplifies, using linear arithmetic, to:
T.
Case 29.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(REMAINDER 0 P))),
which again simplifies, using linear arithmetic, to:
T.
Case 28.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(REMAINDER 0 P))),
which again simplifies, using linear arithmetic, to:
T.
Case 27.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(LESSP P (REMAINDER (TIMES X Y) P)))
(EQUAL (REMAINDER (TIMES (DIFFERENCE P Y) X)
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES Y X) P))
P))),
which again simplifies, using linear arithmetic, to:
T.
Case 26.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(NOT (LESSP (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
P)))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
0)),
which again simplifies, using linear arithmetic, to:
T.
Case 25.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(NOT (NUMBERP P)))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
0)),
which again simplifies, using linear arithmetic, to:
T.
Case 24.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(EQUAL P 0))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
0)),
which again simplifies, using linear arithmetic, to:
T.
Case 23.(IMPLIES (AND (LESSP (TIMES P X) (TIMES X Y))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 22.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL (TIMES 0 X) (REMAINDER P P))),
which again simplifies, using linear arithmetic, to two new conjectures:
Case 22.2.
(IMPLIES (AND (NOT (NUMBERP Y))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) 0)
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL (TIMES 0 X) (REMAINDER P P))),
which again simplifies, rewriting with EQUAL-TIMES-0 and TIMES-ZERO2, and
opening up the functions EQUAL, DIFFERENCE, and LESSP, to:
T.
Case 22.1.
(IMPLIES (AND (NUMBERP Y)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) 0)
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X P))
P))
(NOT (LESSP (TIMES X P) (TIMES P X)))
(NOT (LESSP P P))
(EQUAL (REMAINDER (TIMES X P) P) 0)
(NOT (LESSP P P))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL (TIMES 0 X) (REMAINDER P P))).
This again simplifies, using linear arithmetic, rewriting with
EQUAL-TIMES-0, COMMUTATIVITY-OF-TIMES, DIFFERENCE-0, REMAINDER-0-CROCK,
TIMES-ZERO2, REMAINDER-X-X, TIMES-IDENTITY, DIVIDES-TIMES, and
REMAINDER-TIMES, and expanding EQUAL, DIFFERENCE, LESSP, and TIMES, to:
T.
Case 21.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL (TIMES 0 X) (REMAINDER 0 P))).
But this again simplifies, using linear arithmetic, rewriting with
DIFFERENCE-0, TIMES-IDENTITY, EQUAL-TIMES-0, and TIMES-ZERO2, and expanding
REMAINDER, EQUAL, LESSP, and TIMES, to:
T.
Case 20.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL (TIMES 0 X) (REMAINDER 0 P))).
This again simplifies, rewriting with the lemmas EQUAL-TIMES-0, DIFFERENCE-0,
REMAINDER-0-CROCK, REMAINDER-WRT-12, TIMES-ZERO2, and TIMES-IDENTITY, and
opening up the functions LESSP, EQUAL, and TIMES, to:
T.
Case 19.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL X 0)
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))),
which again simplifies, using linear arithmetic, to two new formulas:
Case 19.2.
(IMPLIES
(AND (NOT (NUMBERP Y))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P 0)
(REMAINDER (TIMES 0 Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P 0) (TIMES 0 Y))
P))
(NOT (LESSP (TIMES 0 Y) (TIMES P 0)))
(NOT (LESSP Y P))
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))),
which again simplifies, using linear arithmetic, rewriting with
COMMUTATIVITY-OF-TIMES, TIMES-ZERO2, REMAINDER-0-CROCK, DIFFERENCE-0, and
TIMES-IDENTITY, and opening up the definitions of EQUAL and LESSP, to:
T.
Case 19.1.
(IMPLIES
(AND (NUMBERP Y)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P 0)
(REMAINDER (TIMES 0 P) P))
P)
(REMAINDER (DIFFERENCE (TIMES P 0) (TIMES 0 P))
P))
(NOT (LESSP (TIMES 0 P) (TIMES P 0)))
(NOT (LESSP P P))
(NOT (LESSP P P))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))).
This again simplifies, using linear arithmetic, applying
COMMUTATIVITY-OF-TIMES, DIVIDES-TIMES, DIFFERENCE-0, REMAINDER-0-CROCK,
TIMES-IDENTITY, and REMAINDER-X-X, and unfolding the functions EQUAL and
LESSP, to:
T.
Case 18.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL X 0)
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL 0 (REMAINDER 0 P))).
This again simplifies, using linear arithmetic, rewriting with
REMAINDER-TIMES and DIFFERENCE-0, and unfolding TIMES, DIFFERENCE, REMAINDER,
EQUAL, and LESSP, to:
T.
Case 17.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(EQUAL X 0)
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL 0 (REMAINDER 0 P))).
But this again simplifies, using linear arithmetic, applying TIMES-ZERO2,
COMMUTATIVITY-OF-TIMES, REMAINDER-WRT-12, DIFFERENCE-0, and
REMAINDER-0-CROCK, and unfolding EQUAL and LESSP, to:
T.
Case 16.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))).
But this again simplifies, using linear arithmetic, to two new formulas:
Case 16.2.
(IMPLIES
(AND (NOT (NUMBERP Y))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))),
which again simplifies, rewriting with the lemmas TIMES-ZERO2 and
REMAINDER-0-CROCK, and expanding the functions DIFFERENCE, EQUAL, and
LESSP, to:
T.
Case 16.1.
(IMPLIES
(AND (NUMBERP Y)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X P) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X P))
P))
(NOT (LESSP (TIMES X P) (TIMES P X)))
(NOT (LESSP P P))
(NOT (NUMBERP X))
(NOT (LESSP P P))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))),
which again simplifies, rewriting with TIMES-ZERO2, COMMUTATIVITY-OF-TIMES,
REMAINDER-0-CROCK, and REMAINDER-X-X, and opening up the functions
DIFFERENCE, EQUAL, and LESSP, to:
T.
Case 15.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL 0 (REMAINDER 0 P))).
But this again simplifies, using linear arithmetic, appealing to the lemmas
TIMES-ZERO2 and DIFFERENCE-0, and opening up the definitions of EQUAL,
REMAINDER, and LESSP, to:
T.
Case 14.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (LESSP Y P))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL 0 (REMAINDER 0 P))),
which again simplifies, using linear arithmetic, applying TIMES-ZERO2,
REMAINDER-WRT-12, DIFFERENCE-0, and REMAINDER-0-CROCK, and opening up the
functions EQUAL and LESSP, to:
T.
Case 13.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))).
This again simplifies, using linear arithmetic, rewriting with the lemmas
TIMES-ZERO2, EQUAL-TIMES-0, DIFFERENCE-0, REMAINDER-0-CROCK, and
REMAINDER-X-X, and opening up the definitions of LESSP, REMAINDER, and EQUAL,
to:
T.
Case 12.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL 0 (REMAINDER 0 P))),
which again simplifies, using linear arithmetic, rewriting with TIMES-ZERO2
and DIFFERENCE-0, and expanding EQUAL, REMAINDER, and LESSP, to:
T.
Case 11.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(NOT (NUMBERP X))
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL 0 (REMAINDER 0 P))).
However this again simplifies, using linear arithmetic, applying the lemmas
TIMES-ZERO2, REMAINDER-WRT-12, DIFFERENCE-0, and REMAINDER-0-CROCK, and
expanding the functions EQUAL and LESSP, to:
T.
Case 10.(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(EQUAL X 0)
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL 0 (REMAINDER P P))),
which again simplifies, using linear arithmetic, applying
COMMUTATIVITY-OF-TIMES, TIMES-IDENTITY, DIFFERENCE-0, REMAINDER-0-CROCK, and
REMAINDER-X-X, and expanding LESSP, EQUAL, and REMAINDER, to:
T.
Case 9. (IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(EQUAL X 0)
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL 0 (REMAINDER 0 P))).
However this again simplifies, using linear arithmetic, rewriting with
REMAINDER-TIMES and DIFFERENCE-0, and unfolding the definitions of TIMES,
DIFFERENCE, REMAINDER, EQUAL, and LESSP, to:
T.
Case 8. (IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(NOT (LESSP (TIMES X Y) (TIMES P X)))
(EQUAL X 0)
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL 0 (REMAINDER 0 P))).
But this again simplifies, using linear arithmetic, applying TIMES-ZERO2,
COMMUTATIVITY-OF-TIMES, REMAINDER-WRT-12, DIFFERENCE-0, and
REMAINDER-0-CROCK, and opening up the functions EQUAL and LESSP, to:
T.
Case 7. (IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(REMAINDER P P))).
But this again simplifies, applying the lemmas EQUAL-TIMES-0,
REMAINDER-TIMES, and REMAINDER-X-X, and opening up the definitions of EQUAL
and DIFFERENCE, to:
T.
Case 6. (IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(REMAINDER 0 P))),
which again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (TIMES X Y) P) 0)
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(REMAINDER 0 P))),
which again simplifies, rewriting with EQUAL-TIMES-0, DIFFERENCE-0, and
REMAINDER-0-CROCK, and opening up LESSP, DIFFERENCE, and EQUAL, to:
T.
Case 4. (IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(LESSP P (REMAINDER (TIMES X Y) P)))
(EQUAL (REMAINDER (TIMES (DIFFERENCE P Y) X)
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES Y X) P))
P))).
However this again simplifies, using linear arithmetic, applying the lemmas
DIFFERENCE-0, COMMUTATIVITY-OF-TIMES, TIMES-DIFFERENCE, and
REMAINDER-0-CROCK, and unfolding the function EQUAL, to:
T.
Case 3. (IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(NOT (NUMBERP P)))
(EQUAL (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
0)),
which again simplifies, rewriting with REMAINDER-WRT-12, EQUAL-TIMES-0, and
REMAINDER-0-CROCK, and expanding the functions DIFFERENCE, EQUAL, and LESSP,
to:
T.
Case 2. (IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(EQUAL P 0))
(EQUAL (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
0)).
This again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(NOT (LESSP (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
P)))
(EQUAL (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
0)),
which again simplifies, applying LESSP-REMAINDER2 and EQUAL-DIFFERENCE-0, to:
(IMPLIES (AND (EQUAL (REMAINDER (DIFFERENCE (TIMES P X)
(REMAINDER (TIMES X Y) P))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(LESSP (TIMES X Y) (TIMES P X))
(NOT (EQUAL X 0))
(NUMBERP X)
(LESSP Y P)
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(DIFFERENCE P
(REMAINDER (TIMES X Y) P)))
(NOT (LESSP P Y))
(NOT (LESSP P (REMAINDER (TIMES X Y) P)))
(NOT (LESSP (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
P))
(NOT (EQUAL P 0)))
(NOT (NUMBERP P))),
which again simplifies, using linear arithmetic and applying
LESSP-REMAINDER-DIVISOR, to:
T.
Q.E.D.
[ 0.0 2.7 0.1 ]
REFLECT-COMMUTES-WITH-TIMES-1
(PROVE-LEMMA REFLECT-COMMUTES-WITH-TIMES-2
(REWRITE)
(IMPLIES (LEQ Y P)
(EQUAL (REMAINDER (TIMES X (REFLECT Y P)) P)
(REMAINDER (REFLECT (REMAINDER (TIMES X Y) P) P)
P)))
((USE (REFLECT-COMMUTES-WITH-TIMES-1))
(DISABLE REFLECT-COMMUTES-WITH-TIMES-1 REFLECT)))
This simplifies, applying the lemma COMMUTATIVITY-OF-TIMES, and unfolding
IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
REFLECT-COMMUTES-WITH-TIMES-2
(PROVE-LEMMA TIMES-EXP-FACT
(REWRITE)
(IMPLIES (NOT (ZEROP N))
(EQUAL (REMAINDER (TIMES (TIMES A N)
(TIMES (EXP A (SUB1 N))
(FACT (SUB1 N))))
P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, IMPLIES,
and ASSOCIATIVITY-OF-TIMES, to:
(IMPLIES (AND (NOT (EQUAL N 0)) (NUMBERP N))
(EQUAL (REMAINDER (TIMES A N
(EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P))).
This simplifies, rewriting with COMMUTATIVITY-OF-TIMES,
COMMUTATIVITY2-OF-TIMES, and ASSOCIATIVITY-OF-TIMES, and expanding the
functions EXP and FACT, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
TIMES-EXP-FACT
(PROVE-LEMMA REM-REFLECT-LIST-1
(REWRITE)
(IMPLIES (AND (NOT (ZEROP P))
(NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
((USE (REMAINDER-EXP-LEMMA (A P)
(X (TIMES A N))
(Y (TIMES-LIST (REFLECT-LIST (SUB1 N) A P)))
(Z (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N))))))
(HANDS-OFF TIMES DIFFERENCE QUOTIENT EXP FACT)
(DISABLE REMAINDER-EXP-LEMMA REFLECT)))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to the conjecture:
(IMPLIES
(AND
(IMPLIES
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(EQUAL (REMAINDER (TIMES (TIMES A N)
(TIMES-LIST (REFLECT-LIST (SUB1 N) A P)))
P)
(REMAINDER (TIMES (TIMES A N)
(EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
T))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P))).
This simplifies, applying TIMES-EXP-FACT, CDR-CONS, CAR-CONS, and TIMES-MOD-3,
and expanding the functions IMPLIES, REFLECT-LIST, and TIMES-LIST, to:
T.
Q.E.D.
[ 0.0 0.4 0.0 ]
REM-REFLECT-LIST-1
(PROVE-LEMMA REM-REFLECT-LIST-2
(REWRITE)
(IMPLIES (AND (NOT (ZEROP P))
(NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A N) (FACT N))
P)
P)
P)))
((USE (REMAINDER-EXP-LEMMA (A P)
(X (TIMES A N))
(Y (TIMES-LIST (REFLECT-LIST (SUB1 N) A P)))
(Z (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N))))))
(HANDS-OFF TIMES DIFFERENCE QUOTIENT EXP FACT)
(DISABLE REMAINDER-EXP-LEMMA REFLECT)))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES
(AND
(IMPLIES
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(EQUAL (REMAINDER (TIMES (TIMES A N)
(TIMES-LIST (REFLECT-LIST (SUB1 N) A P)))
P)
(REMAINDER (TIMES (TIMES A N)
(EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
T))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A N) (FACT N))
P)
P)
P))).
This simplifies, using linear arithmetic, appealing to the lemmas
TIMES-EXP-FACT, CDR-CONS, CAR-CONS, LESSP-REMAINDER-DIVISOR, TIMES-MOD-3, and
REFLECT-COMMUTES-WITH-TIMES-1, and expanding IMPLIES, REFLECT-LIST, and
TIMES-LIST, to:
T.
Q.E.D.
[ 0.0 0.5 0.0 ]
REM-REFLECT-LIST-2
(PROVE-LEMMA REM-REFLECT-LIST-3
(REWRITE)
(IMPLIES (AND (NOT (ZEROP P))
(NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P)
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A N) (FACT N))
P)
P)
P)))
((USE (REMAINDER-EXP-LEMMA (A P)
(X (TIMES A N))
(Y (TIMES-LIST (REFLECT-LIST (SUB1 N) A P)))
(Z (REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P))))
(HANDS-OFF TIMES DIFFERENCE QUOTIENT EXP FACT)
(DISABLE REMAINDER-EXP-LEMMA REFLECT)))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES
(AND
(IMPLIES
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P)
P))
(EQUAL
(EQUAL (REMAINDER (TIMES (TIMES A N)
(TIMES-LIST (REFLECT-LIST (SUB1 N) A P)))
P)
(REMAINDER (TIMES (TIMES A N)
(REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P))
P))
T))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P)
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A N) (FACT N))
P)
P)
P))).
This simplifies, using linear arithmetic, applying LESSP-REMAINDER-DIVISOR,
TIMES-EXP-FACT, TIMES-MOD-1, REFLECT-COMMUTES-WITH-TIMES-2, CDR-CONS, CAR-CONS,
and TIMES-MOD-3, and expanding the definitions of IMPLIES, REFLECT-LIST, and
TIMES-LIST, to:
T.
Q.E.D.
[ 0.0 0.6 0.0 ]
REM-REFLECT-LIST-3
(PROVE-LEMMA DOUBLE-REFLECT
(REWRITE)
(IMPLIES (LEQ A P)
(EQUAL (REMAINDER (REFLECT (REMAINDER (REFLECT A P) P)
P)
P)
(REMAINDER A P))))
This conjecture can be simplified, using the abbreviations IMPLIES and REFLECT,
to:
(IMPLIES (NOT (LESSP P A))
(EQUAL (REMAINDER (DIFFERENCE P
(REMAINDER (DIFFERENCE P A) P))
P)
(REMAINDER A P))).
This simplifies, using linear arithmetic, applying the lemmas
REMAINDER-0-CROCK and DIFFERENCE-0, and opening up REMAINDER, to the following
13 new formulas:
Case 13.(IMPLIES (AND (NOT (LESSP P A))
(LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(EQUAL (REMAINDER (DIFFERENCE P
(REMAINDER (DIFFERENCE P A) P))
P)
(REMAINDER A P))).
This again simplifies, using linear arithmetic, applying DIFFERENCE-0,
REMAINDER-0-CROCK, and REMAINDER-WRT-12, and opening up the definitions of
REMAINDER, DIFFERENCE, and EQUAL, to the following 14 new goals:
Case 13.14.
(IMPLIES
(AND (NOT (LESSP P A))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP P 0)
(LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P) 0)
(T (DIFFERENCE P A)))))
(EQUAL (REMAINDER (DIFFERENCE P
(REMAINDER (DIFFERENCE P A) P))
P)
(REMAINDER A P))).
This again simplifies, using linear arithmetic, to:
T.
Case 13.13.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP P 0)
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P) 0)
(T (DIFFERENCE P A)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (NUMBERP A))
(LESSP (DIFFERENCE P 0) P))
(EQUAL (DIFFERENCE P 0) 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 13.12.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP P 0)
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P) 0)
(T (DIFFERENCE P A)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP A P))
(LESSP (DIFFERENCE P 0) P))
(EQUAL (DIFFERENCE P 0) 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 13.11.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP P 0)
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P) 0)
(T (DIFFERENCE P A)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP A P)
(NUMBERP A)
(NOT (LESSP (DIFFERENCE P 0) P)))
(EQUAL 0 A)),
which again simplifies, using linear arithmetic, to:
T.
Case 13.10.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP P 0)
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P) 0)
(T (DIFFERENCE P A)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP A P)
(NUMBERP A)
(LESSP (DIFFERENCE P 0) P))
(EQUAL (DIFFERENCE P 0) A)),
which again simplifies, using linear arithmetic, to:
T.
Case 13.9.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP P 0)
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P) 0)
(T (DIFFERENCE P A)))))
(EQUAL P 0)
(NOT (NUMBERP A)))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
0)),
which again simplifies, using linear arithmetic, to:
T.
Case 13.8.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP P 0)
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P) 0)
(T (DIFFERENCE P A)))))
(NOT (NUMBERP P))
(NOT (NUMBERP A)))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
0)),
which again simplifies, using linear arithmetic, to:
T.
Case 13.7.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP P 0)
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P) 0)
(T (DIFFERENCE P A)))))
(EQUAL P 0)
(NUMBERP A))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
A)),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP 0 (DIFFERENCE 0 A))
(NOT (LESSP 0 A))
(NOT (LESSP (DIFFERENCE 0 A) 0))
(LESSP 0 0)
(NOT (LESSP 0
(COND ((EQUAL 0 0) (DIFFERENCE 0 A))
((NUMBERP 0) 0)
(T (DIFFERENCE 0 A)))))
(NUMBERP A))
(EQUAL (DIFFERENCE 0 (DIFFERENCE 0 A))
A)).
However this again simplifies, using linear arithmetic, to:
T.
Case 13.6.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP P 0)
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P) 0)
(T (DIFFERENCE P A)))))
(NOT (NUMBERP P))
(NUMBERP A))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
A)),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP P (DIFFERENCE P A))
(NOT (LESSP P A))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP P 0)
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P) 0)
(T (DIFFERENCE P A)))))
(NOT (NUMBERP P))
(NUMBERP A))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
A)).
But this again simplifies, using linear arithmetic, to:
T.
Case 13.5.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (NUMBERP P))
(LESSP P 0)
(NUMBERP A))
(EQUAL 0 A)),
which again simplifies, using linear arithmetic, to:
T.
Case 13.4.
(IMPLIES (AND (NOT (LESSP P A))
(EQUAL P 0)
(LESSP P 0)
(NUMBERP A))
(EQUAL 0 A)),
which again simplifies, using linear arithmetic, to:
T.
Case 13.3.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (DIFFERENCE P A) P)
(LESSP P (DIFFERENCE P A))
(NOT (NUMBERP A)))
(EQUAL (REMAINDER (DIFFERENCE P (DIFFERENCE P A))
P)
0)),
which again simplifies, using linear arithmetic, to:
T.
Case 13.2.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (DIFFERENCE P A) P)
(LESSP P (DIFFERENCE P A))
(NOT (LESSP A P)))
(EQUAL (REMAINDER (DIFFERENCE P (DIFFERENCE P A))
P)
0)),
which again simplifies, using linear arithmetic, to:
T.
Case 13.1.
(IMPLIES (AND (NOT (LESSP P A))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (DIFFERENCE P A) P)
(LESSP P (DIFFERENCE P A))
(LESSP A P)
(NUMBERP A))
(EQUAL (REMAINDER (DIFFERENCE P (DIFFERENCE P A))
P)
A)),
which again simplifies, using linear arithmetic, to:
T.
Case 12.(IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP A P))
(LESSP (DIFFERENCE P A) P)
(LESSP (DIFFERENCE P (DIFFERENCE P A))
P))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
0)),
which again simplifies, using linear arithmetic, to:
T.
Case 11.(IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(LESSP A P)
(NOT (NUMBERP A))
(LESSP (DIFFERENCE P A) P)
(LESSP (DIFFERENCE P (DIFFERENCE P A))
P))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
0)),
which again simplifies, using linear arithmetic, rewriting with DIFFERENCE-0,
and expanding the definitions of LESSP, DIFFERENCE, and EQUAL, to:
T.
Case 10.(IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(NOT (NUMBERP P))
(NOT (NUMBERP A)))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
0)).
But this again simplifies, using linear arithmetic, applying DIFFERENCE-0,
and expanding the functions LESSP and EQUAL, to:
T.
Case 9. (IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(EQUAL P 0)
(NOT (NUMBERP A)))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
0)).
This again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP 0 (DIFFERENCE 0 A))
(NOT (LESSP 0 A))
(NOT (LESSP 0
(COND ((EQUAL 0 0) (DIFFERENCE 0 A))
((NUMBERP 0)
(IF (LESSP (DIFFERENCE 0 A) 0)
(DIFFERENCE 0 A)
0))
(T (DIFFERENCE 0 A)))))
(NOT (NUMBERP A)))
(EQUAL (DIFFERENCE 0 (DIFFERENCE 0 A))
0)).
This again simplifies, using linear arithmetic, to:
T.
Case 8. (IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (NUMBERP A))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP (DIFFERENCE P 0) P))
(EQUAL (DIFFERENCE P 0) 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 7. (IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP A P))
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP (DIFFERENCE P 0) P))
(EQUAL (DIFFERENCE P 0) 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 6. (IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP A P)
(NUMBERP A)
(LESSP (DIFFERENCE P A) P)
(NOT (LESSP (DIFFERENCE P (DIFFERENCE P A))
P)))
(EQUAL 0 A)),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP P (DIFFERENCE P A))
(NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP A P)
(NUMBERP A)
(LESSP (DIFFERENCE P A) P)
(NOT (LESSP (DIFFERENCE P (DIFFERENCE P A))
P)))
(EQUAL 0 A)).
But this again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP A P)
(NUMBERP A)
(NOT (LESSP (DIFFERENCE P A) P))
(NOT (LESSP (DIFFERENCE P 0) P)))
(EQUAL 0 A)),
which again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(LESSP A P)
(NUMBERP A)
(LESSP (DIFFERENCE P A) P)
(LESSP (DIFFERENCE P (DIFFERENCE P A))
P))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
A)),
which again simplifies, using linear arithmetic, to the formula:
(IMPLIES (AND (LESSP P (DIFFERENCE P A))
(NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(LESSP A P)
(NUMBERP A)
(LESSP (DIFFERENCE P A) P)
(LESSP (DIFFERENCE P (DIFFERENCE P A))
P))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
A)).
However this again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(NOT (NUMBERP P))
(NUMBERP A))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
A)),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP P (DIFFERENCE P A))
(NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(NOT (NUMBERP P))
(NUMBERP A))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
A)).
This again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(EQUAL P 0)
(NUMBERP A))
(EQUAL (DIFFERENCE P (DIFFERENCE P A))
A)),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP 0 (DIFFERENCE 0 A))
(NOT (LESSP 0 A))
(NOT (LESSP 0
(COND ((EQUAL 0 0) (DIFFERENCE 0 A))
((NUMBERP 0)
(IF (LESSP (DIFFERENCE 0 A) 0)
(DIFFERENCE 0 A)
0))
(T (DIFFERENCE 0 A)))))
(NUMBERP A))
(EQUAL (DIFFERENCE 0 (DIFFERENCE 0 A))
A)).
But this again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LESSP P A))
(NOT (LESSP P
(COND ((EQUAL P 0) (DIFFERENCE P A))
((NUMBERP P)
(IF (LESSP (DIFFERENCE P A) P)
(DIFFERENCE P A)
0))
(T (DIFFERENCE P A)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP A P)
(NUMBERP A)
(NOT (LESSP (DIFFERENCE P A) P))
(LESSP (DIFFERENCE P 0) P))
(EQUAL (DIFFERENCE P 0) A)),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
DOUBLE-REFLECT
(PROVE-LEMMA REM-REFLECT-LIST-4
(REWRITE)
(IMPLIES (AND (NOT (ZEROP P))
(NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P)
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
((USE (REMAINDER-EXP-LEMMA (A P)
(X (TIMES A N))
(Y (TIMES-LIST (REFLECT-LIST (SUB1 N) A P)))
(Z (REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P))))
(HANDS-OFF TIMES DIFFERENCE QUOTIENT EXP FACT)
(DISABLE REMAINDER-EXP-LEMMA REFLECT)))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES
(AND
(IMPLIES
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P)
P))
(EQUAL
(EQUAL (REMAINDER (TIMES (TIMES A N)
(TIMES-LIST (REFLECT-LIST (SUB1 N) A P)))
P)
(REMAINDER (TIMES (TIMES A N)
(REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P))
P))
T))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P)
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P))).
This simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, TIMES-EXP-FACT, TIMES-MOD-1,
REFLECT-COMMUTES-WITH-TIMES-2, CDR-CONS, CAR-CONS, TIMES-MOD-3,
LESSP-REMAINDER2, DOUBLE-REFLECT, and REFLECT-COMMUTES-WITH-TIMES-1, and
opening up the functions IMPLIES, REFLECT-LIST, TIMES-LIST, and REMAINDER, to:
T.
Q.E.D.
[ 0.0 0.6 0.0 ]
REM-REFLECT-LIST-4
(PROVE-LEMMA REM-REFLECT-LIST-BASE-CASE
(REWRITE)
(IMPLIES (ZEROP N)
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P))))
This formula simplifies, rewriting with REMAINDER-OF-1 and EXP-BY-0, and
opening up the definitions of ZEROP, EQUAL, REFLECT-LIST, TIMES-LIST, FACT,
TIMES, and EXP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
REM-REFLECT-LIST-BASE-CASE
(PROVE-LEMMA REM-REFLECT-LIST NIL
(IMPLIES (NOT (ZEROP P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A N) (FACT N))
P)
P)
P))))
((HANDS-OFF TIMES-LIST REFLECT-LIST QUOTIENT EXP FACT TIMES)
(DISABLE REFLECT)))
This formula can be simplified, using the abbreviations ZEROP, NOT, and
IMPLIES, to:
(IMPLIES
(AND (NOT (EQUAL P 0)) (NUMBERP P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A N) (FACT N))
P)
P)
P)))),
which simplifies, obviously, to the following two new formulas:
Case 2. (IMPLIES
(AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (RES1 N A P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A N) (FACT N))
P)
P)
P))).
Call the above conjecture *1.
Case 1. (IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(RES1 N A P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P))),
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 (NOT (ZEROP P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A N) (FACT N))
P)
P)
P)))).
We gave this the name *1 above. Perhaps we can prove it by induction. Six
inductions are suggested by terms in the conjecture. However, they merge into
one likely candidate induction. We will induct according to the following
scheme:
(AND (IMPLIES (ZEROP N) (p N A P))
(IMPLIES (AND (NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(p (SUB1 N) A P))
(p N A P))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(p (SUB1 N) A P))
(p N A P))).
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 induction step of the scheme. The above
induction scheme produces three new conjectures:
Case 3. (IMPLIES
(AND (ZEROP N) (NOT (ZEROP P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A N) (FACT N))
P)
P)
P)))),
which simplifies, applying REM-REFLECT-LIST-BASE-CASE, and expanding ZEROP,
FACT, EQUAL, and RES1, to:
T.
Case 2. (IMPLIES
(AND (NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P)
P)))
(NOT (ZEROP P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A N) (FACT N))
P)
P)
P)))).
This simplifies, rewriting with REM-REFLECT-LIST-4 and REM-REFLECT-LIST-2,
and expanding the functions ZEROP and RES1, to:
T.
Case 1. (IMPLIES
(AND (NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
P)
P)))
(NOT (ZEROP P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECT-LIST N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (REFLECT (REMAINDER (TIMES (EXP A N) (FACT N))
P)
P)
P)))),
which simplifies, rewriting with REM-REFLECT-LIST-3 and REM-REFLECT-LIST-1,
and expanding the definitions of ZEROP and RES1, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 1.0 0.0 ]
REM-REFLECT-LIST
(PROVE-LEMMA LENGTH-REFLECT-LIST
(REWRITE)
(EQUAL (LENGTH (REFLECT-LIST N A P))
(FIX N))
((INDUCT (POSITIVES N))))
This formula can be simplified, using the abbreviations ZEROP, NOT, OR, and
AND, to the following two new formulas:
Case 2. (IMPLIES (ZEROP N)
(EQUAL (LENGTH (REFLECT-LIST N A P))
(FIX N))).
This simplifies, opening up the definitions of ZEROP, EQUAL, REFLECT-LIST,
LENGTH, and FIX, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (LENGTH (REFLECT-LIST (SUB1 N) A P))
(FIX (SUB1 N))))
(EQUAL (LENGTH (REFLECT-LIST N A P))
(FIX N))).
This simplifies, opening up the definitions of FIX, REFLECT, and
REFLECT-LIST, to the following two new formulas:
Case 1.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (LENGTH (REFLECT-LIST (SUB1 N) A P))
(SUB1 N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))))
(EQUAL (LENGTH (CONS (REMAINDER (TIMES A N) P)
(REFLECT-LIST (SUB1 N) A P)))
N)).
This again simplifies, appealing to the lemmas ADD1-SUB1 and CDR-CONS, and
expanding the function LENGTH, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (LENGTH (REFLECT-LIST (SUB1 N) A P))
(SUB1 N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EQUAL (LENGTH (CONS (DIFFERENCE P
(REMAINDER (TIMES A N) P))
(REFLECT-LIST (SUB1 N) A P)))
N)),
which again simplifies, appealing to the lemmas ADD1-SUB1 and CDR-CONS,
and opening up LENGTH, to:
T.
Q.E.D.
[ 0.0 0.5 0.0 ]
LENGTH-REFLECT-LIST
(PROVE-LEMMA ALL-LESSEQP-REFLECT-LIST-1
(REWRITE)
(IMPLIES (LESSP (QUOTIENT P 2) X)
(NOT (LESSP (QUOTIENT P 2)
(REFLECT X P)))))
WARNING: Note that the linear lemma ALL-LESSEQP-REFLECT-LIST-1 is being
stored under the term (REFLECT X P), which is unusual because REFLECT is a
nonrecursive function symbol.
WARNING: When the linear lemma ALL-LESSEQP-REFLECT-LIST-1 is stored under
(QUOTIENT P 2) it contains the free variable X which will be chosen by
instantiating the hypothesis (LESSP (QUOTIENT P 2) X).
WARNING: Note that the proposed lemma ALL-LESSEQP-REFLECT-LIST-1 is to be
stored as zero type prescription rules, zero compound recognizer rules, two
linear rules, and zero replacement rules.
This conjecture can be simplified, using the abbreviations NOT, IMPLIES, and
REFLECT, to the goal:
(IMPLIES (LESSP (QUOTIENT P 2) X)
(NOT (LESSP (QUOTIENT P 2)
(DIFFERENCE P X)))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace P by
(PLUS V (TIMES 2 Z)) to eliminate (QUOTIENT P 2) and (REMAINDER P 2). We
employ LESSP-REMAINDER2, the type restriction lemma noted when QUOTIENT was
introduced, and the type restriction lemma noted when REMAINDER was introduced
to constrain the new variables. We must thus prove four new conjectures:
Case 4. (IMPLIES (AND (NOT (NUMBERP P))
(LESSP (QUOTIENT P 2) X))
(NOT (LESSP (QUOTIENT P 2)
(DIFFERENCE P X)))),
which simplifies, using linear arithmetic, applying DIFFERENCE-0, and
expanding the definitions of LESSP, NUMBERP, EQUAL, and QUOTIENT, to:
T.
Case 3. (IMPLIES (AND (EQUAL 2 0)
(LESSP (QUOTIENT P 2) X))
(NOT (LESSP (QUOTIENT P 2)
(DIFFERENCE P X)))).
This simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP 2))
(LESSP (QUOTIENT P 2) X))
(NOT (LESSP (QUOTIENT P 2)
(DIFFERENCE P X)))),
which simplifies, clearly, to:
T.
Case 1. (IMPLIES (AND (NUMBERP Z)
(NUMBERP V)
(EQUAL (LESSP V 2) (NOT (ZEROP 2)))
(NOT (EQUAL 2 0))
(LESSP Z X))
(NOT (LESSP Z
(DIFFERENCE (PLUS V (TIMES 2 Z))
X)))).
This simplifies, rewriting with TIMES-2, and unfolding the functions ZEROP,
NOT, and EQUAL, to:
(IMPLIES (AND (NUMBERP Z)
(NUMBERP V)
(LESSP V 2)
(LESSP Z X))
(NOT (LESSP Z
(DIFFERENCE (PLUS V Z Z) X)))),
which again simplifies, using linear arithmetic, to the conjecture:
(IMPLIES (AND (LESSP (PLUS V Z Z) X)
(NUMBERP Z)
(NUMBERP V)
(LESSP V 2)
(LESSP Z X))
(NOT (LESSP Z
(DIFFERENCE (PLUS V Z Z) X)))).
But this again simplifies, using linear arithmetic, applying DIFFERENCE-0,
and expanding the functions EQUAL and LESSP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
ALL-LESSEQP-REFLECT-LIST-1
(PROVE-LEMMA ALL-LESSEQP-REFLECT-LIST
(REWRITE)
(ALL-LESSEQP (REFLECT-LIST N A P)
(QUOTIENT P 2))
((DISABLE REFLECT)))
.
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace P by
(PLUS Z (TIMES 2 X)) to eliminate (QUOTIENT P 2) and (REMAINDER P 2). We rely
upon LESSP-REMAINDER2, the type restriction lemma noted when QUOTIENT was
introduced, and the type restriction lemma noted when REMAINDER was introduced
to constrain the new variables. The result is four new conjectures:
Case 4. (IMPLIES (NOT (NUMBERP P))
(ALL-LESSEQP (REFLECT-LIST N A P)
(QUOTIENT P 2))),
which simplifies, expanding the functions LESSP, NUMBERP, EQUAL, and
QUOTIENT, to:
(IMPLIES (NOT (NUMBERP P))
(ALL-LESSEQP (REFLECT-LIST N A P) 0)),
which we would usually push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us consider:
(ALL-LESSEQP (REFLECT-LIST N A P)
(QUOTIENT P 2)),
which we named *1 above. We will appeal to induction. There are two
plausible inductions. However, only one is unflawed. We will induct
according to the following scheme:
(AND (IMPLIES (ZEROP N) (p N A P))
(IMPLIES (AND (NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(p (SUB1 N) A P))
(p N A P))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(p (SUB1 N) A P))
(p N A P))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT N) decreases according to the well-founded
relation LESSP in each induction step of the scheme. The above induction
scheme produces the following three new goals:
Case 3. (IMPLIES (ZEROP N)
(ALL-LESSEQP (REFLECT-LIST N A P)
(QUOTIENT P 2))).
This simplifies, rewriting with PIGEON-HOLE-PRINCIPLE-LEMMA-2, and expanding
ZEROP, EQUAL, REFLECT-LIST, ALL-LESSEQP, MEMBER, and LISTP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(ALL-LESSEQP (REFLECT-LIST (SUB1 N) A P)
(QUOTIENT P 2)))
(ALL-LESSEQP (REFLECT-LIST N A P)
(QUOTIENT P 2))),
which simplifies, applying the lemmas CDR-CONS and CAR-CONS, and unfolding
ZEROP, REFLECT-LIST, and ALL-LESSEQP, to the goal:
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(ALL-LESSEQP (REFLECT-LIST (SUB1 N) A P)
(QUOTIENT P 2)))
(NOT (LESSP (QUOTIENT P 2)
(REFLECT (REMAINDER (TIMES A N) P)
P)))).
But this again simplifies, using linear arithmetic and applying
ALL-LESSEQP-REFLECT-LIST-1, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(ALL-LESSEQP (REFLECT-LIST (SUB1 N) A P)
(QUOTIENT P 2)))
(ALL-LESSEQP (REFLECT-LIST N A P)
(QUOTIENT P 2))).
This simplifies, applying CDR-CONS and CAR-CONS, and unfolding the
definitions of ZEROP, REFLECT-LIST, and ALL-LESSEQP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
ALL-LESSEQP-REFLECT-LIST
(PROVE-LEMMA ALL-NON-ZEROP-REFLECT-LIST
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(LESSP B P))
(ALL-NON-ZEROP (REFLECT-LIST B A P)))
((INDUCT (REFLECT-LIST B A P))
(DISABLE PRIME1)))
This conjecture can be simplified, using the abbreviations ZEROP, PRIME,
IMPLIES, NOT, OR, AND, and DIVIDES, to three new conjectures:
Case 3. (IMPLIES (AND (ZEROP B)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(LESSP B P))
(ALL-NON-ZEROP (REFLECT-LIST B A P))),
which simplifies, unfolding the functions ZEROP, EQUAL, LESSP, REFLECT-LIST,
and ALL-NON-ZEROP, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL B 0))
(NUMBERP B)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A B) P))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(LESSP (SUB1 B) P))
(ALL-NON-ZEROP (REFLECT-LIST (SUB1 B) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(LESSP B P))
(ALL-NON-ZEROP (REFLECT-LIST B A P))),
which simplifies, rewriting with CDR-CONS, EQUAL-DIFFERENCE-0,
LESSP-REMAINDER2, and CAR-CONS, and expanding the definitions of PRIME, NOT,
AND, IMPLIES, LESSP, REFLECT, REFLECT-LIST, and ALL-NON-ZEROP, to:
(IMPLIES (AND (NOT (EQUAL B 0))
(NUMBERP B)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A B) P))
(NOT (LESSP (SUB1 B) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(LESSP (SUB1 B) (SUB1 P)))
(ALL-NON-ZEROP (REFLECT-LIST (SUB1 B) A P))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL B 0))
(NUMBERP B)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A B) P)))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(LESSP (SUB1 B) P))
(ALL-NON-ZEROP (REFLECT-LIST (SUB1 B) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(LESSP B P))
(ALL-NON-ZEROP (REFLECT-LIST B A P))),
which simplifies, rewriting with CDR-CONS, PRIME-KEY-REWRITE, and CAR-CONS,
and expanding the functions PRIME, NOT, AND, IMPLIES, LESSP, REFLECT-LIST,
REMAINDER, and ALL-NON-ZEROP, to:
(IMPLIES (AND (NOT (EQUAL B 0))
(NUMBERP B)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A B) P)))
(NOT (LESSP (SUB1 B) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(LESSP (SUB1 B) (SUB1 P)))
(ALL-NON-ZEROP (REFLECT-LIST (SUB1 B) A P))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 2.5 0.0 ]
ALL-NON-ZEROP-REFLECT-LIST
(PROVE-LEMMA ALL-DISTINCT-REFLECT-LIST-1
(REWRITE)
(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (DIVIDES P A)))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
((DISABLE PRIME)))
This conjecture can be simplified, using the abbreviations NOT, AND, IMPLIES,
and DIVIDES, to:
(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P)))).
This simplifies, using linear arithmetic, rewriting with REMAINDER-0-CROCK,
DIFFERENCE-0, and THM-55-SPECIALIZED-TO-PRIMES, and expanding the function
REMAINDER, to 12 new conjectures:
Case 12.(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL P 0)
(NUMBERP J)
(NUMBERP I))
(NOT (EQUAL I J))),
which again simplifies, using linear arithmetic, to:
T.
Case 11.(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (NUMBERP P))
(NUMBERP J)
(NUMBERP I))
(NOT (EQUAL I J))),
which again simplifies, using linear arithmetic, to:
T.
Case 10.(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(LESSP J P)
(NUMBERP J)
(NUMBERP I))
(NOT (EQUAL I J))),
which again simplifies, using linear arithmetic, to:
T.
Case 9. (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL P 0)
(NOT (NUMBERP I)))
(NOT (EQUAL 0 J))),
which again simplifies, using linear arithmetic, to:
T.
Case 8. (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (NUMBERP P))
(NOT (NUMBERP I)))
(NOT (EQUAL 0 J))),
which again simplifies, unfolding the definition of LESSP, to:
T.
Case 7. (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(LESSP J P)
(NOT (NUMBERP I)))
(NOT (EQUAL 0 J))),
which again simplifies, unfolding the function LESSP, to:
T.
Case 6. (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(EQUAL P 0)
(NOT (NUMBERP J)))
(NOT (EQUAL I 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (NUMBERP P))
(NOT (NUMBERP J)))
(NOT (EQUAL I 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(LESSP J P)
(NOT (NUMBERP J)))
(NOT (EQUAL I 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP J P)))
(NOT (EQUAL I 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (NUMBERP J)))
(NUMBERP I)),
which again simplifies, opening up the definition of LESSP, to:
T.
Case 1. (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP J P)))
(NUMBERP I)),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
ALL-DISTINCT-REFLECT-LIST-1
(PROVE-LEMMA ALL-DISTINCT-REFLECT-LIST-2
(REWRITE)
(IMPLIES (AND (NUMBERP X)
(NUMBERP Y)
(LESSP X P)
(LESSP Y P))
(EQUAL (EQUAL (DIFFERENCE P X)
(DIFFERENCE P Y))
(EQUAL X Y))))
This formula simplifies, trivially, to two new conjectures:
Case 2. (IMPLIES (AND (NUMBERP X)
(NUMBERP Y)
(LESSP X P)
(LESSP Y P)
(NOT (EQUAL X Y)))
(NOT (EQUAL (DIFFERENCE P X)
(DIFFERENCE P Y)))),
which again simplifies, using linear arithmetic, to two new goals:
Case 2.2.
(IMPLIES (AND (LESSP P X)
(NUMBERP X)
(NUMBERP Y)
(LESSP X P)
(LESSP Y P)
(NOT (EQUAL X Y)))
(NOT (EQUAL (DIFFERENCE P X)
(DIFFERENCE P Y)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (LESSP P Y)
(NUMBERP X)
(NUMBERP Y)
(LESSP X P)
(LESSP Y P)
(NOT (EQUAL X Y)))
(NOT (EQUAL (DIFFERENCE P X)
(DIFFERENCE P Y)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NUMBERP X)
(NUMBERP Y)
(LESSP X P)
(LESSP Y P)
(EQUAL X Y))
(EQUAL (EQUAL (DIFFERENCE P X)
(DIFFERENCE P Y))
T)),
which again simplifies, expanding EQUAL, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
ALL-DISTINCT-REFLECT-LIST-2
(PROVE-LEMMA NUMBERP-REMAINDER
(REWRITE)
(NUMBERP (REMAINDER A P)))
This conjecture simplifies, trivially, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
NUMBERP-REMAINDER
(PROVE-LEMMA ALL-DISTINCT-REFLECT-LIST-3
(REWRITE)
(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (DIVIDES P A)))
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P))))
((USE (ALL-DISTINCT-REFLECT-LIST-1))
(HANDS-OFF DIFFERENCE REMAINDER TIMES)
(DISABLE ALL-DISTINCT-REFLECT-LIST-1 PRIME)))
This conjecture can be simplified, using the abbreviations NOT, AND, IMPLIES,
REFLECT, and DIVIDES, to:
(IMPLIES (AND (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
This simplifies, applying THM-55-SPECIALIZED-TO-PRIMES, and expanding the
definitions of NOT, AND, and IMPLIES, to:
(IMPLIES (AND (NOT (EQUAL (REMAINDER I P)
(REMAINDER J P)))
(PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace I by
(PLUS X (TIMES P Z)) to eliminate (REMAINDER I P) and (QUOTIENT I P). We
employ LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was introduced
to constrain the new variables. This generates four new goals:
Case 4. (IMPLIES (AND (NOT (NUMBERP I))
(NOT (EQUAL (REMAINDER I P)
(REMAINDER J P)))
(PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))),
which further simplifies, unfolding the function LESSP, to:
T.
Case 3. (IMPLIES (AND (EQUAL P 0)
(NOT (EQUAL (REMAINDER I P)
(REMAINDER J P)))
(PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))),
which further simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP P))
(NOT (EQUAL (REMAINDER I P)
(REMAINDER J P)))
(PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))),
which further simplifies, opening up LESSP, to:
T.
Case 1. (IMPLIES
(AND (NUMBERP X)
(EQUAL (LESSP X P) (NOT (ZEROP P)))
(NUMBERP Z)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EQUAL X (REMAINDER J P)))
(PRIME P)
(LESSP J (PLUS X (TIMES P Z)))
(LESSP (PLUS X (TIMES P Z)) P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A (PLUS X (TIMES P Z)))
P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))),
which further simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER2, LESSP-REMAINDER-DIVISOR, THM-55-SPECIALIZED-TO-PRIMES, and
ALL-DISTINCT-REFLECT-LIST-2, and unfolding ZEROP and NOT, to:
(IMPLIES (AND (NUMBERP X)
(LESSP X P)
(NUMBERP Z)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EQUAL X (REMAINDER J P)))
(PRIME P)
(LESSP J (PLUS X (TIMES P Z)))
(LESSP (PLUS X (TIMES P Z)) P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (REMAINDER (PLUS X (TIMES P Z)) P)
(REMAINDER J P)))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace J by
(PLUS V (TIMES P W)) to eliminate (REMAINDER J P) and (QUOTIENT J P). We
employ LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was
introduced to restrict the new variables. We would thus like to prove the
following two new goals:
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP J))
(NUMBERP X)
(LESSP X P)
(NUMBERP Z)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EQUAL X (REMAINDER J P)))
(PRIME P)
(LESSP J (PLUS X (TIMES P Z)))
(LESSP (PLUS X (TIMES P Z)) P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (REMAINDER (PLUS X (TIMES P Z)) P)
(REMAINDER J P)))).
However this further simplifies, appealing to the lemmas PLUS-EQUAL-0 and
EQUAL-TIMES-0, and opening up LESSP, to two new goals:
Case 1.2.2.
(IMPLIES (AND (NOT (NUMBERP J))
(NUMBERP X)
(LESSP X P)
(NUMBERP Z)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EQUAL X (REMAINDER J P)))
(PRIME P)
(NOT (EQUAL X 0))
(LESSP (PLUS X (TIMES P Z)) P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (REMAINDER (PLUS X (TIMES P Z)) P)
(REMAINDER J P)))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace A by
(PLUS V (TIMES P W)) to eliminate (REMAINDER A P) and (QUOTIENT A P).
We employ LESSP-REMAINDER2, the type restriction lemma noted when
REMAINDER was introduced, and the type restriction lemma noted when
QUOTIENT was introduced to restrict the new variables. This produces
the following two new goals:
Case 1.2.2.2.
(IMPLIES (AND (NOT (NUMBERP A))
(NOT (NUMBERP J))
(NUMBERP X)
(LESSP X P)
(NUMBERP Z)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EQUAL X (REMAINDER J P)))
(PRIME P)
(NOT (EQUAL X 0))
(LESSP (PLUS X (TIMES P Z)) P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (REMAINDER (PLUS X (TIMES P Z)) P)
(REMAINDER J P)))),
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:
(IF (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (DIVIDES P A)))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (DIVIDES P A)))
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P))))
T).
We gave this the name *1 above. Perhaps we can prove it by induction. The
recursive terms in the conjecture suggest eight inductions. However, they
merge into one likely candidate induction. We will induct according to the
following scheme:
(AND (IMPLIES (OR (EQUAL I 0) (NOT (NUMBERP I)))
(p P J I A))
(IMPLIES (AND (NOT (OR (EQUAL I 0) (NOT (NUMBERP I))))
(OR (EQUAL J 0) (NOT (NUMBERP J))))
(p P J I A))
(IMPLIES (AND (NOT (OR (EQUAL I 0) (NOT (NUMBERP I))))
(NOT (OR (EQUAL J 0) (NOT (NUMBERP J))))
(p (SUB1 P) (SUB1 J) (SUB1 I) A))
(p P J I A))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT inform us that the measure (COUNT J) decreases according to the
well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instances chosen for P and I. The above induction
scheme produces the following three new conjectures:
Case 3. (IMPLIES (OR (EQUAL I 0) (NOT (NUMBERP I)))
(IF (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (DIVIDES P A)))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (DIVIDES P A)))
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P))))
T)).
This simplifies, unfolding NOT, OR, EQUAL, LESSP, DIVIDES, AND, IMPLIES, and
REFLECT, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL I 0) (NOT (NUMBERP I))))
(OR (EQUAL J 0) (NOT (NUMBERP J))))
(IF (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (DIVIDES P A)))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (DIVIDES P A)))
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P))))
T)).
This simplifies, opening up the definitions of NOT, OR, EQUAL, LESSP,
DIVIDES, AND, IMPLIES, and REFLECT, to the following two new formulas:
Case 2.2.
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(EQUAL J 0)
(PRIME P)
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A 0) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A 0) P))))).
However this again simplifies, using linear arithmetic, to two new
formulas:
Case 2.2.2.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A I) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(PRIME P)
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A 0) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A 0) P))))),
which again simplifies, using linear arithmetic and rewriting with
LESSP-REMAINDER-DIVISOR, to:
T.
Case 2.2.1.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A 0) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(PRIME P)
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A 0) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A 0) P))))).
However this again simplifies, using linear arithmetic and applying
LESSP-REMAINDER-DIVISOR, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(NOT (NUMBERP J))
(PRIME P)
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
However this again simplifies, using linear arithmetic, to two new
conjectures:
Case 2.1.2.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A I) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (NUMBERP J))
(PRIME P)
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))),
which again simplifies, using linear arithmetic and applying
LESSP-REMAINDER-DIVISOR, to:
T.
Case 2.1.1.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A J) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (NUMBERP J))
(PRIME P)
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
However this again simplifies, using linear arithmetic and rewriting
with LESSP-REMAINDER-DIVISOR, to:
T.
Case 1. (IMPLIES
(AND (NOT (OR (EQUAL I 0) (NOT (NUMBERP I))))
(NOT (OR (EQUAL J 0) (NOT (NUMBERP J))))
(IF (IMPLIES (AND (PRIME (SUB1 P))
(LESSP (SUB1 J) (SUB1 I))
(LESSP (SUB1 I) (SUB1 P))
(NOT (DIVIDES (SUB1 P) A)))
(NOT (EQUAL (REMAINDER (TIMES A (SUB1 I))
(SUB1 P))
(REMAINDER (TIMES A (SUB1 J))
(SUB1 P)))))
(IMPLIES (AND (PRIME (SUB1 P))
(LESSP (SUB1 J) (SUB1 I))
(LESSP (SUB1 I) (SUB1 P))
(NOT (DIVIDES (SUB1 P) A)))
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A (SUB1 I))
(SUB1 P))
(SUB1 P))
(REFLECT (REMAINDER (TIMES A (SUB1 J))
(SUB1 P))
(SUB1 P)))))
T))
(IF (IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (DIVIDES P A)))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (DIVIDES P A)))
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P))))
T)).
This simplifies, opening up the definitions of NOT, OR, DIVIDES, AND,
IMPLIES, REFLECT, and LESSP, to the following four new formulas:
Case 1.4.
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(EQUAL (REMAINDER A (SUB1 P)) 0)
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
This again simplifies, using linear arithmetic, to two new formulas:
Case 1.4.2.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A I) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(EQUAL (REMAINDER A (SUB1 P)) 0)
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))),
which again simplifies, using linear arithmetic and rewriting with
LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.4.1.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A J) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(EQUAL (REMAINDER A (SUB1 P)) 0)
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
However this again simplifies, using linear arithmetic and applying
LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (PRIME (SUB1 P)))
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
This again simplifies, using linear arithmetic, to two new goals:
Case 1.3.2.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A I) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (PRIME (SUB1 P)))
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))),
which again simplifies, using linear arithmetic and rewriting with
LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.3.1.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A J) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (PRIME (SUB1 P)))
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
However this again simplifies, using linear arithmetic and rewriting
with LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(EQUAL (REMAINDER (TIMES A (SUB1 I))
(SUB1 P))
(REMAINDER (TIMES A (SUB1 J))
(SUB1 P)))
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
But this again simplifies, using linear arithmetic, to two new formulas:
Case 1.2.2.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A I) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(EQUAL (REMAINDER (TIMES A (SUB1 I))
(SUB1 P))
(REMAINDER (TIMES A (SUB1 J))
(SUB1 P)))
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))),
which again simplifies, using linear arithmetic and applying the lemma
LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.2.1.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A J) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(EQUAL (REMAINDER (TIMES A (SUB1 I))
(SUB1 P))
(REMAINDER (TIMES A (SUB1 J))
(SUB1 P)))
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))),
which again simplifies, using linear arithmetic and rewriting with
LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL (DIFFERENCE (SUB1 P)
(REMAINDER (TIMES A (SUB1 I))
(SUB1 P)))
(DIFFERENCE (SUB1 P)
(REMAINDER (TIMES A (SUB1 J))
(SUB1 P)))))
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
This again simplifies, using linear arithmetic, to two new formulas:
Case 1.1.2.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A I) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL (DIFFERENCE (SUB1 P)
(REMAINDER (TIMES A (SUB1 I))
(SUB1 P)))
(DIFFERENCE (SUB1 P)
(REMAINDER (TIMES A (SUB1 J))
(SUB1 P)))))
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))),
which again simplifies, using linear arithmetic and applying
LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.1.1.
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A J) P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL (DIFFERENCE (SUB1 P)
(REMAINDER (TIMES A (SUB1 I))
(SUB1 P)))
(DIFFERENCE (SUB1 P)
(REMAINDER (TIMES A (SUB1 J))
(SUB1 P)))))
(PRIME P)
(LESSP (SUB1 J) (SUB1 I))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
This again simplifies, using linear arithmetic and rewriting with
LESSP-REMAINDER-DIVISOR, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
ALL-DISTINCT-REFLECT-LIST-3
(PROVE-LEMMA PLUS-MOD-1
(REWRITE)
(EQUAL (REMAINDER (PLUS (REMAINDER X P) Y) P)
(REMAINDER (PLUS X Y) P))
((USE (REMAINDER-QUOTIENT (Y P))
(REMAINDER-PLUS-TIMES-1 (J P)
(X (PLUS (REMAINDER X P) Y))
(I (QUOTIENT X P))))
(DISABLE REMAINDER-QUOTIENT REMAINDER-QUOTIENT-ELIM
REMAINDER-PLUS-TIMES-1)))
This conjecture can be simplified, using the abbreviations AND and
ASSOCIATIVITY-OF-PLUS, to:
(IMPLIES (AND (EQUAL (PLUS (REMAINDER X P)
(TIMES P (QUOTIENT X P)))
(FIX X))
(EQUAL (REMAINDER (PLUS (REMAINDER X P)
Y
(TIMES (QUOTIENT X P) P))
P)
(REMAINDER (PLUS (REMAINDER X P) Y)
P)))
(EQUAL (REMAINDER (PLUS (REMAINDER X P) Y) P)
(REMAINDER (PLUS X Y) P))).
This simplifies, rewriting with PLUS-RIGHT-ID2, REMAINDER-0-CROCK,
COMMUTATIVITY-OF-TIMES, COMMUTATIVITY-OF-PLUS, and COMMUTATIVITY2-OF-PLUS, and
expanding the functions FIX, LESSP, REMAINDER, QUOTIENT, EQUAL, PLUS, and
NUMBERP, to:
T.
Q.E.D.
[ 0.0 0.4 0.0 ]
PLUS-MOD-1
(PROVE-LEMMA PLUS-MOD-2
(REWRITE)
(EQUAL (REMAINDER (PLUS Y (REMAINDER X P)) P)
(REMAINDER (PLUS X Y) P))
((USE (PLUS-MOD-1))
(DISABLE PLUS-MOD-1)))
This formula simplifies, rewriting with COMMUTATIVITY-OF-PLUS, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
PLUS-MOD-2
(PROVE-LEMMA ALL-DISTINCT-REFLECT-LIST-4 NIL
(IMPLIES (AND (EQUAL X (DIFFERENCE P Y))
(LESSP Y P))
(EQUAL (REMAINDER (PLUS X Y) P) 0)))
This simplifies, using linear arithmetic, applying COMMUTATIVITY-OF-PLUS,
REMAINDER-0-CROCK, and DIFFERENCE-0, and unfolding REMAINDER, to the following
four new formulas:
Case 4. (IMPLIES (AND (LESSP Y P) (LESSP P Y))
(EQUAL (REMAINDER (PLUS (DIFFERENCE P Y) Y)
P)
0)).
But this again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (LESSP Y P)
(NOT (LESSP P Y))
(NOT (NUMBERP P)))
(EQUAL (PLUS Y (DIFFERENCE P Y)) 0)),
which again simplifies, expanding the definition of LESSP, to:
T.
Case 2. (IMPLIES (AND (LESSP Y P)
(NOT (LESSP P Y))
(EQUAL P 0))
(EQUAL (PLUS Y (DIFFERENCE P Y)) 0)),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (LESSP Y P)
(NOT (LESSP P Y))
(LESSP (PLUS Y (DIFFERENCE P Y)) P))
(EQUAL (PLUS Y (DIFFERENCE P Y)) 0)),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
ALL-DISTINCT-REFLECT-LIST-4
(PROVE-LEMMA ALL-DISTINCT-REFLECT-LIST-5 NIL
(IMPLIES (AND (EQUAL (REMAINDER (TIMES A I) P)
(DIFFERENCE P
(REMAINDER (TIMES A J) P)))
(NOT (ZEROP P)))
(EQUAL (REMAINDER (TIMES A (PLUS I J)) P)
0))
((USE (ALL-DISTINCT-REFLECT-LIST-4 (X (REMAINDER (TIMES A I) P))
(Y (REMAINDER (TIMES A J) P))))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
IMPLIES, and PLUS-MOD-2, to:
(IMPLIES
(AND (IMPLIES (AND (EQUAL (REMAINDER (TIMES A I) P)
(DIFFERENCE P
(REMAINDER (TIMES A J) P)))
(LESSP (REMAINDER (TIMES A J) P) P))
(EQUAL (REMAINDER (PLUS (TIMES A I) (TIMES A J))
P)
0))
(EQUAL (REMAINDER (TIMES A I) P)
(DIFFERENCE P
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P))
(EQUAL (REMAINDER (TIMES A (PLUS I J)) P)
0)).
This simplifies, rewriting with the lemmas LESSP-REMAINDER2 and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and unfolding the functions AND, IMPLIES,
and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
ALL-DISTINCT-REFLECT-LIST-5
(PROVE-LEMMA ALL-DISTINCT-REFLECT-LIST-6 NIL
(IMPLIES (AND (LEQ I (QUOTIENT P 2))
(LESSP J I))
(AND (NOT (ZEROP (PLUS I J)))
(LESSP (PLUS I J) P))))
This conjecture simplifies, rewriting with PLUS-EQUAL-0, and opening up ZEROP,
NOT, and AND, to five new conjectures:
Case 5. (IMPLIES (AND (NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I)
(EQUAL I 0))
(NOT (EQUAL J 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I)
(NOT (NUMBERP I)))
(NOT (EQUAL J 0))),
which again simplifies, opening up the function LESSP, to:
T.
Case 3. (IMPLIES (AND (NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I)
(EQUAL I 0))
(NUMBERP J)),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I)
(NOT (NUMBERP I)))
(NUMBERP J)),
which again simplifies, unfolding the definition of LESSP, to:
T.
Case 1. (IMPLIES (AND (NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(LESSP (PLUS I J) P)).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace P by
(PLUS Z (TIMES 2 X)) to eliminate (QUOTIENT P 2) and (REMAINDER P 2). We
use LESSP-REMAINDER2, the type restriction lemma noted when QUOTIENT was
introduced, and the type restriction lemma noted when REMAINDER was
introduced to restrict the new variables. We thus obtain the following four
new formulas:
Case 1.4.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(LESSP (PLUS I J) P)).
This further simplifies, expanding the functions LESSP, NUMBERP, EQUAL,
and QUOTIENT, to:
T.
Case 1.3.
(IMPLIES (AND (EQUAL 2 0)
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(LESSP (PLUS I J) P)),
which further simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP 2))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(LESSP (PLUS I J) P)),
which further simplifies, trivially, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(EQUAL (LESSP Z 2) (NOT (ZEROP 2)))
(NOT (EQUAL 2 0))
(NOT (LESSP X I))
(LESSP J I))
(LESSP (PLUS I J)
(PLUS Z (TIMES 2 X)))).
But this further simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
ALL-DISTINCT-REFLECT-LIST-6
(PROVE-LEMMA ALL-DISTINCT-REFLECT-LIST-7
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(LEQ I (QUOTIENT P 2))
(LESSP J I))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REFLECT (REMAINDER (TIMES A J) P)
P))))
((USE (ALL-DISTINCT-REFLECT-LIST-5)
(ALL-DISTINCT-REFLECT-LIST-6))
(HANDS-OFF DIFFERENCE TIMES PLUS)
(DISABLE PRIME1)))
This conjecture can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, REFLECT, and DIVIDES, to:
(IMPLIES
(AND (IMPLIES (AND (EQUAL (REMAINDER (TIMES A I) P)
(DIFFERENCE P
(REMAINDER (TIMES A J) P)))
(NOT (ZEROP P)))
(EQUAL (REMAINDER (TIMES A (PLUS I J)) P)
0))
(IMPLIES (AND (IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP J I))
(AND (NOT (ZEROP (PLUS I J)))
(LESSP (PLUS I J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
This simplifies, rewriting with PRIME-KEY-REWRITE and PLUS-EQUAL-0, and
expanding the functions ZEROP, NOT, AND, PRIME, IMPLIES, LESSP, and EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER (PLUS I J) P) 0)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP (PLUS I J) P)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(DIFFERENCE P
(REMAINDER (TIMES A J) P))))).
But this again simplifies, rewriting with PLUS-EQUAL-0, and expanding the
function REMAINDER, to:
T.
Q.E.D.
[ 0.0 0.5 0.0 ]
ALL-DISTINCT-REFLECT-LIST-7
(PROVE-LEMMA ALL-DISTINCT-REFLECT-LIST-8
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(LEQ I (QUOTIENT P 2))
(LESSP J I))
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REMAINDER (TIMES A J) P))))
((USE (ALL-DISTINCT-REFLECT-LIST-5 (J I)
(I J))
(ALL-DISTINCT-REFLECT-LIST-6))
(HANDS-OFF TIMES DIFFERENCE)
(DISABLE PRIME1)))
This conjecture can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, REFLECT, and DIVIDES, to:
(IMPLIES
(AND (IMPLIES (AND (EQUAL (REMAINDER (TIMES A J) P)
(DIFFERENCE P
(REMAINDER (TIMES A I) P)))
(NOT (ZEROP P)))
(EQUAL (REMAINDER (TIMES A (PLUS J I)) P)
0))
(IMPLIES (AND (IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP J I))
(AND (NOT (ZEROP (PLUS I J)))
(LESSP (PLUS I J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REMAINDER (TIMES A J) P)))).
This simplifies, rewriting with COMMUTATIVITY-OF-PLUS, PRIME-KEY-REWRITE, and
PLUS-EQUAL-0, and expanding the functions ZEROP, NOT, AND, PRIME, IMPLIES,
LESSP, and EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER (PLUS I J) P) 0)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP (PLUS I J) P)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REMAINDER (TIMES A J) P)))).
But this again simplifies, rewriting with PLUS-EQUAL-0, and expanding the
function REMAINDER, to:
T.
Q.E.D.
[ 0.0 0.5 0.0 ]
ALL-DISTINCT-REFLECT-LIST-8
(PROVE-LEMMA ALL-DISTINCT-REFLECT-LIST-9
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(LEQ I (QUOTIENT P 2))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST J A P))))
((USE (ALL-DISTINCT-REFLECT-LIST-1))
(INDUCT (REFLECT-LIST J A P))
(HANDS-OFF QUOTIENT REMAINDER TIMES)
(DISABLE PRIME1 REFLECT ALL-DISTINCT-REFLECT-LIST-1)))
This conjecture can be simplified, using the abbreviation DIVIDES, to:
(IMPLIES
(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P))))
(AND (OR (NOT (ZEROP J))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST J A P)))))
(OR (ZEROP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP (SUB1 J) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST J A P)))))
(OR (ZEROP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP (SUB1 J) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST J A P))))))).
This simplifies, opening up the definitions of PRIME, NOT, AND, IMPLIES, ZEROP,
REMAINDER, EQUAL, QUOTIENT, LESSP, REFLECT-LIST, and OR, to the following 12
new formulas:
Case 12.(IMPLIES (AND (NOT (LESSP I P))
(NOT (NUMBERP J))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
NIL))).
But this again simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, and unfolding the function EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (LESSP I P))
(NOT (NUMBERP J))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
NIL))),
which again simplifies, unfolding EQUAL, LESSP, LISTP, and MEMBER, to:
T.
Case 11.(IMPLIES (AND (NOT (LESSP I P))
(EQUAL J 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
NIL))),
which again simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, and expanding EQUAL, to the new formula:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (LESSP I P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP 0 I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
NIL))),
which again simplifies, opening up the functions EQUAL, LESSP, LISTP, and
MEMBER, to:
T.
Case 10.(IMPLIES (AND (NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (LESSP (SUB1 J) I))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REFLECT (REMAINDER (TIMES A J) P) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 9. (IMPLIES (AND (NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REFLECT (REMAINDER (TIMES A J) P) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic and applying
LESSP-REMAINDER-DIVISOR, to:
T.
Case 8. (IMPLIES (AND (NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (LESSP (SUB1 J) I))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))).
However this again simplifies, using linear arithmetic, to:
T.
Case 7. (IMPLIES (AND (NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, and opening up EQUAL, to the new goal:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, applying CDR-CONS, THM-55-SPECIALIZED-TO-PRIMES, and
CAR-CONS, and opening up the functions EQUAL, PRIME, and MEMBER, to the new
conjecture:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (EQUAL (REMAINDER I P)
(REMAINDER J P)))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace P by
(PLUS X (TIMES 2 Z)) to eliminate (REMAINDER P 2) and (QUOTIENT P 2). We
use LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was
introduced to restrict the new variables. This produces the following three
new conjectures:
Case 7.3.
(IMPLIES (AND (EQUAL 2 0)
(EQUAL (REMAINDER P 2) 1)
(NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (EQUAL (REMAINDER I P)
(REMAINDER J P)))).
However this further simplifies, using linear arithmetic, to:
T.
Case 7.2.
(IMPLIES (AND (NOT (NUMBERP 2))
(EQUAL (REMAINDER P 2) 1)
(NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (EQUAL (REMAINDER I P)
(REMAINDER J P)))),
which further simplifies, clearly, to:
T.
Case 7.1.
(IMPLIES (AND (NUMBERP X)
(EQUAL (LESSP X 2) (NOT (ZEROP 2)))
(NUMBERP Z)
(NOT (EQUAL 2 0))
(EQUAL X 1)
(NOT (LESSP I (PLUS X (TIMES 2 Z))))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP Z
(REMAINDER (TIMES A J)
(PLUS X (TIMES 2 Z)))))
(NOT (EQUAL (PLUS X (TIMES 2 Z)) 0))
(NOT (EQUAL (PLUS X (TIMES 2 Z)) 1))
(PRIME1 (PLUS X (TIMES 2 Z))
(SUB1 (PLUS X (TIMES 2 Z))))
(NOT (EQUAL (REMAINDER A (PLUS X (TIMES 2 Z)))
0))
(NOT (LESSP Z I))
(NOT (MEMBER (REMAINDER (TIMES A I)
(PLUS X (TIMES 2 Z)))
(REFLECT-LIST (SUB1 J)
A
(PLUS X (TIMES 2 Z)))))
(LESSP J I))
(NOT (EQUAL (REMAINDER I (PLUS X (TIMES 2 Z)))
(REMAINDER J (PLUS X (TIMES 2 Z)))))).
But this further simplifies, using linear arithmetic, to:
T.
Case 6. (IMPLIES (AND (NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P)))
(NOT (NUMBERP J))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
NIL))),
which again simplifies, using linear arithmetic, appealing to the lemma
LESSP-REMAINDER-DIVISOR, and opening up EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P)))
(NOT (NUMBERP J))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
NIL))).
This again simplifies, applying the lemma THM-55-SPECIALIZED-TO-PRIMES, and
unfolding PRIME, EQUAL, LESSP, LISTP, and MEMBER, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P)))
(EQUAL J 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
NIL))),
which again simplifies, using linear arithmetic, appealing to the lemma
LESSP-REMAINDER-DIVISOR, and opening up the function EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A 0) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP 0 I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
NIL))).
This again simplifies, rewriting with THM-55-SPECIALIZED-TO-PRIMES, and
expanding the definitions of PRIME, EQUAL, LESSP, LISTP, and MEMBER, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (LESSP (SUB1 J) I))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REFLECT (REMAINDER (TIMES A J) P) P)
(REFLECT-LIST (SUB1 J) A P))))).
This again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REFLECT (REMAINDER (TIMES A J) P) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, and unfolding the definition of EQUAL, to the new
conjecture:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REFLECT (REMAINDER (TIMES A J) P) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, rewriting with the lemmas
THM-55-SPECIALIZED-TO-PRIMES, CDR-CONS, ALL-DISTINCT-REFLECT-LIST-7, and
CAR-CONS, and opening up PRIME, EQUAL, DIVIDES, and MEMBER, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (LESSP (SUB1 J) I))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, and unfolding the function EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL (REMAINDER (TIMES A I) P)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, applying THM-55-SPECIALIZED-TO-PRIMES, CDR-CONS, and
CAR-CONS, and unfolding the definitions of PRIME, EQUAL, and MEMBER, to:
T.
Q.E.D.
[ 0.0 0.6 0.1 ]
ALL-DISTINCT-REFLECT-LIST-9
(PROVE-LEMMA ALL-DISTINCT-REFLECT-LIST-10
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(LEQ I (QUOTIENT P 2))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST J A P))))
((USE (ALL-DISTINCT-REFLECT-LIST-3))
(INDUCT (REFLECT-LIST J A P))
(HANDS-OFF QUOTIENT REMAINDER TIMES)
(DISABLE PRIME1 REFLECT ALL-DISTINCT-REFLECT-LIST-3)))
This formula can be simplified, using the abbreviation DIVIDES, to the new
goal:
(IMPLIES
(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P))))
(AND
(OR (NOT (ZEROP J))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST J A P)))))
(OR (ZEROP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP (SUB1 J) I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 J) A P)))))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST J A P)))))
(OR (ZEROP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP (SUB1 J) I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 J) A P)))))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(IF (LESSP (QUOTIENT P 2) I) F T)
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST J A P))))))),
which simplifies, expanding PRIME, NOT, AND, IMPLIES, ZEROP, REMAINDER, EQUAL,
QUOTIENT, LESSP, REFLECT-LIST, and OR, to 12 new conjectures:
Case 12.(IMPLIES (AND (NOT (LESSP I P))
(NOT (NUMBERP J))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
NIL))),
which again simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, and expanding EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (LESSP I P))
(NOT (NUMBERP J))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
NIL))),
which again simplifies, unfolding the functions EQUAL, LESSP, LISTP, and
MEMBER, to:
T.
Case 11.(IMPLIES (AND (NOT (LESSP I P))
(EQUAL J 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
NIL))),
which again simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, and opening up the definition of EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (LESSP I P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP 0 I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
NIL))),
which again simplifies, opening up the functions EQUAL, LESSP, LISTP, and
MEMBER, to:
T.
Case 10.(IMPLIES (AND (NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (LESSP (SUB1 J) I))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(CONS (REFLECT (REMAINDER (TIMES A J) P) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 9. (IMPLIES (AND (NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(CONS (REFLECT (REMAINDER (TIMES A J) P) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic and applying
LESSP-REMAINDER-DIVISOR, to:
T.
Case 8. (IMPLIES (AND (NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (LESSP (SUB1 J) I))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))).
This again simplifies, using linear arithmetic, to:
T.
Case 7. (IMPLIES (AND (NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, and expanding EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (LESSP I P))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, rewriting with CDR-CONS,
ALL-DISTINCT-REFLECT-LIST-8, and CAR-CONS, and expanding the functions EQUAL,
PRIME, DIVIDES, and MEMBER, to:
T.
Case 6. (IMPLIES (AND (NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P)))
(NOT (NUMBERP J))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
NIL))).
But this again simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, and opening up EQUAL, to the new goal:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P)))
(NOT (NUMBERP J))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
NIL))),
which again simplifies, expanding the functions EQUAL, LESSP, LISTP, and
MEMBER, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P)))
(EQUAL J 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
NIL))),
which again simplifies, using linear arithmetic, applying the lemma
LESSP-REMAINDER-DIVISOR, and opening up EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A 0) P)
P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(LESSP 0 I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
NIL))).
However this again simplifies, opening up the functions EQUAL, LESSP, LISTP,
and MEMBER, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (LESSP (SUB1 J) I))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(CONS (REFLECT (REMAINDER (TIMES A J) P) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(CONS (REFLECT (REMAINDER (TIMES A J) P) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, and opening up EQUAL, to the new conjecture:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(CONS (REFLECT (REMAINDER (TIMES A J) P) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
unfolding the definitions of EQUAL and MEMBER, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (LESSP (SUB1 J) I))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, appealing to the lemma
LESSP-REMAINDER-DIVISOR, and expanding the function EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT (REMAINDER (TIMES A J) P)
P)))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A J) P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECT-LIST (SUB1 J) A P))))).
But this again simplifies, using linear arithmetic, rewriting with CDR-CONS,
ALL-DISTINCT-REFLECT-LIST-8, and CAR-CONS, and unfolding the definitions of
EQUAL, PRIME, DIVIDES, and MEMBER, to:
T.
Q.E.D.
[ 0.0 0.7 0.0 ]
ALL-DISTINCT-REFLECT-LIST-10
(PROVE-LEMMA ALL-DISTINCT-REFLECT-LIST
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(LEQ I (QUOTIENT P 2)))
(ALL-DISTINCT (REFLECT-LIST I A P)))
((USE (ALL-DISTINCT-REFLECT-LIST-9 (J (SUB1 I)))
(ALL-DISTINCT-REFLECT-LIST-10 (J (SUB1 I))))
(INDUCT (REFLECT-LIST I A P))
(HANDS-OFF QUOTIENT REMAINDER TIMES)
(DISABLE ALL-DISTINCT-REFLECT-LIST-9
ALL-DISTINCT-REFLECT-LIST-10 PRIME DIVIDES REFLECT)))
This formula simplifies, expanding the definitions of NOT, AND, IMPLIES, ZEROP,
REFLECT-LIST, and OR, to the following 18 new formulas:
Case 18.(IMPLIES (AND (NOT (LESSP (SUB1 I) I))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P)))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(LESSP (QUOTIENT P 2) (SUB1 I))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))).
But this again simplifies, using linear arithmetic, to:
T.
Case 17.(IMPLIES (AND (NOT (LESSP (SUB1 I) I))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P)))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(ALL-DISTINCT (REFLECT-LIST (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 16.(IMPLIES (AND (NOT (LESSP (SUB1 I) I))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(ALL-DISTINCT (REFLECT-LIST (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 15.(IMPLIES (AND (NOT (LESSP (SUB1 I) I))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(LESSP (QUOTIENT P 2) (SUB1 I))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 14.(IMPLIES (AND (NOT (LESSP (SUB1 I) I))
(EQUAL I 0)
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT NIL)),
which again simplifies, unfolding SUB1, LESSP, EQUAL, and ALL-DISTINCT, to:
T.
Case 13.(IMPLIES (AND (NOT (LESSP (SUB1 I) I))
(NOT (NUMBERP I))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT NIL)),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP I 1)
(NOT (LESSP (SUB1 I) I))
(NOT (NUMBERP I))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT NIL)).
This again simplifies, rewriting with SUB1-NNUMBERP, and expanding NUMBERP,
EQUAL, LESSP, and ALL-DISTINCT, to:
T.
Case 12.(IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (LESSP (SUB1 I) I))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P)))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(LESSP (QUOTIENT P 2) (SUB1 I))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 11.(IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (LESSP (SUB1 I) I))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P)))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(ALL-DISTINCT (REFLECT-LIST (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 10.(IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (LESSP (SUB1 I) I))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(ALL-DISTINCT (REFLECT-LIST (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 9. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (LESSP (SUB1 I) I))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(LESSP (QUOTIENT P 2) (SUB1 I))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 8. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (LESSP (SUB1 I) I))
(EQUAL I 0)
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT NIL)),
which again simplifies, opening up the functions SUB1, EQUAL, REFLECT-LIST,
LISTP, MEMBER, LESSP, and ALL-DISTINCT, to:
T.
Case 7. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (LESSP (SUB1 I) I))
(NOT (NUMBERP I))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT NIL)),
which again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP I 1)
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (LESSP (SUB1 I) I))
(NOT (NUMBERP I))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT NIL)).
But this again simplifies, rewriting with the lemma SUB1-NNUMBERP, and
expanding the definitions of NUMBERP, EQUAL, LESSP, REFLECT-LIST, LISTP,
MEMBER, and ALL-DISTINCT, to:
T.
Case 6. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P)))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(LESSP (QUOTIENT P 2) (SUB1 I))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P)))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(ALL-DISTINCT (REFLECT-LIST (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))),
which again simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
expanding the definition of ALL-DISTINCT, to:
T.
Case 4. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(ALL-DISTINCT (REFLECT-LIST (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))),
which again simplifies, rewriting with CDR-CONS and CAR-CONS, and unfolding
the function ALL-DISTINCT, to:
T.
Case 3. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A I) P))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(LESSP (QUOTIENT P 2) (SUB1 I))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))).
But this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))
(EQUAL I 0)
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT NIL)),
which again simplifies, expanding SUB1, EQUAL, REFLECT-LIST, LISTP, MEMBER,
LESSP, and ALL-DISTINCT, to:
T.
Case 1. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (MEMBER (REFLECT (REMAINDER (TIMES A I) P) P)
(REFLECT-LIST (SUB1 I) A P)))
(NOT (NUMBERP I))
(PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT NIL)),
which again simplifies, applying SUB1-NNUMBERP, and expanding the functions
EQUAL, REFLECT-LIST, LISTP, MEMBER, LESSP, and ALL-DISTINCT, to:
T.
Q.E.D.
[ 0.0 0.5 0.0 ]
ALL-DISTINCT-REFLECT-LIST
(PROVE-LEMMA TIMES-REFLECT-LIST
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A)))
(EQUAL (TIMES-LIST (REFLECT-LIST (QUOTIENT P 2) A P))
(FACT (QUOTIENT P 2))))
((USE (PIGEON-HOLE-PRINCIPLE (L (REFLECT-LIST (QUOTIENT P 2) A P))))
(HANDS-OFF QUOTIENT REMAINDER)
(DISABLE PRIME1 REFLECT-LIST TIMES-LIST FACT)))
This formula can be simplified, using the abbreviations NOT, PRIME, AND,
IMPLIES, and DIVIDES, to:
(IMPLIES
(AND
(IMPLIES (AND (ALL-NON-ZEROP (REFLECT-LIST (QUOTIENT P 2) A P))
(ALL-DISTINCT (REFLECT-LIST (QUOTIENT P 2) A P))
(ALL-LESSEQP (REFLECT-LIST (QUOTIENT P 2) A P)
(LENGTH (REFLECT-LIST (QUOTIENT P 2) A P))))
(PERM (POSITIVES (LENGTH (REFLECT-LIST (QUOTIENT P 2) A P)))
(REFLECT-LIST (QUOTIENT P 2) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0)))
(EQUAL (TIMES-LIST (REFLECT-LIST (QUOTIENT P 2) A P))
(FACT (QUOTIENT P 2)))),
which simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, and expanding the function EQUAL, to:
(IMPLIES
(AND
(EQUAL (REMAINDER P 2) 1)
(IMPLIES (AND (ALL-NON-ZEROP (REFLECT-LIST (QUOTIENT P 2) A P))
(ALL-DISTINCT (REFLECT-LIST (QUOTIENT P 2) A P))
(ALL-LESSEQP (REFLECT-LIST (QUOTIENT P 2) A P)
(LENGTH (REFLECT-LIST (QUOTIENT P 2) A P))))
(PERM (POSITIVES (LENGTH (REFLECT-LIST (QUOTIENT P 2) A P)))
(REFLECT-LIST (QUOTIENT P 2) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0)))
(EQUAL (TIMES-LIST (REFLECT-LIST (QUOTIENT P 2) A P))
(FACT (QUOTIENT P 2)))),
which again simplifies, using linear arithmetic, rewriting with
LESSP-QUOTIENT1, ALL-NON-ZEROP-REFLECT-LIST, ALL-DISTINCT-REFLECT-LIST,
LENGTH-REFLECT-LIST, ALL-LESSEQP-REFLECT-LIST, and TIMES-LIST-EQUAL-FACT, and
unfolding the functions NUMBERP, EQUAL, DIVIDES, PRIME, AND, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TIMES-REFLECT-LIST
(PROVE-LEMMA PLUS-X-X-EVEN
(REWRITE)
(EQUAL (REMAINDER (PLUS X X) 2) 0))
This conjecture simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, and unfolding the function EQUAL, to the formula:
(IMPLIES (EQUAL (REMAINDER (PLUS X X) 2) 1)
(EQUAL 1 0)).
This again simplifies, expanding EQUAL, to:
(NOT (EQUAL (REMAINDER (PLUS X X) 2) 1)).
Name the above subgoal *1.
Perhaps we can prove it by induction. There is only one plausible
induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP X) (p X))
(IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X)))
(p X))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definition
of ZEROP inform us that the measure (COUNT X) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme produces the following two new goals:
Case 2. (IMPLIES (ZEROP X)
(NOT (EQUAL (REMAINDER (PLUS X X) 2) 1))).
This simplifies, applying PLUS-RIGHT-ID2, and opening up ZEROP, PLUS,
REMAINDER, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP X))
(NOT (EQUAL (REMAINDER (PLUS (SUB1 X) (SUB1 X)) 2)
1)))
(NOT (EQUAL (REMAINDER (PLUS X X) 2) 1))),
which simplifies, rewriting with COMMUTATIVITY-OF-PLUS, DIFFERENCE-2, and
SUB1-ADD1, and opening up ZEROP, PLUS, LESSP, SUB1, NUMBERP, EQUAL, and
REMAINDER, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.7 0.0 ]
PLUS-X-X-EVEN
(PROVE-LEMMA RES1-REM-1-1 NIL
(IMPLIES (AND (NOT (ZEROP X))
(NOT (DIVIDES 2 P)))
(NOT (EQUAL (REMAINDER (DIFFERENCE P X) P)
X)))
((USE (DIFFERENCE-ELIM (Y P)))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
IMPLIES, and DIVIDES, to the formula:
(IMPLIES (AND (IMPLIES (AND (NUMBERP P) (NOT (LESSP P X)))
(EQUAL (PLUS X (DIFFERENCE P X)) P))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL (REMAINDER P 2) 0)))
(NOT (EQUAL (REMAINDER (DIFFERENCE P X) P)
X))).
This simplifies, using linear arithmetic, rewriting with the lemma
LESSP-REMAINDER-DIVISOR, and unfolding the definition of EQUAL, to the new
goal:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(IMPLIES (AND (NUMBERP P) (NOT (LESSP P X)))
(EQUAL (PLUS X (DIFFERENCE P X)) P))
(NOT (EQUAL X 0))
(NUMBERP X)
(NOT (EQUAL 1 0)))
(NOT (EQUAL (REMAINDER (DIFFERENCE P X) P)
X))),
which again simplifies, using linear arithmetic, rewriting with DIFFERENCE-0
and REMAINDER-0-CROCK, and unfolding the functions NOT, AND, IMPLIES, EQUAL,
and REMAINDER, to the following four new goals:
Case 4. (IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(LESSP P X)
(NOT (EQUAL X 0)))
(NOT (EQUAL (REMAINDER (DIFFERENCE P X) P)
X))).
But this again simplifies, using linear arithmetic and rewriting with
DIFFERENCE-0 and REMAINDER-0-CROCK, to:
T.
Case 3. (IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(EQUAL (PLUS X (DIFFERENCE P X)) P)
(NOT (EQUAL X 0))
(LESSP P X))
(NOT (EQUAL (REMAINDER (DIFFERENCE P X) P)
X))).
This again simplifies, using linear arithmetic, applying DIFFERENCE-0,
COMMUTATIVITY-OF-PLUS, DIFFERENCE-X-X, and REMAINDER-0-CROCK, and unfolding
the functions EQUAL and PLUS, to:
T.
Case 2. (IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(EQUAL (PLUS X (DIFFERENCE P X)) P)
(NOT (EQUAL X 0))
(NOT (LESSP P X))
(LESSP (DIFFERENCE P X) P))
(NOT (EQUAL (DIFFERENCE P X) X))).
This again simplifies, clearly, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(EQUAL (PLUS X X) P)
(NOT (EQUAL X 0))
(NOT (LESSP P X))
(LESSP X P))
(NOT (EQUAL (DIFFERENCE P X) X))),
which again simplifies, applying PLUS-X-X-EVEN, and expanding the function
EQUAL, to:
T.
Case 1. (IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(EQUAL (PLUS X (DIFFERENCE P X)) P)
(NOT (EQUAL X 0))
(NOT (LESSP P X))
(EQUAL P 0))
(NOT (EQUAL (DIFFERENCE P X) X))).
However this again simplifies, using linear arithmetic, to:
(IMPLIES (AND (NOT (NUMBERP X))
(EQUAL (REMAINDER 0 2) 1)
(EQUAL (PLUS X (DIFFERENCE 0 X)) 0)
(NOT (EQUAL X 0))
(NOT (LESSP 0 X)))
(NOT (EQUAL (DIFFERENCE 0 X) X))).
This again simplifies, trivially, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
RES1-REM-1-1
(PROVE-LEMMA RES1-REM-1 NIL
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(RES1 (QUOTIENT P 2) A P))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))
((USE (REM-REFLECT-LIST (N (QUOTIENT P 2)))
(PRIME-KEY-TRICK (M (FACT (QUOTIENT P 2)))
(A (EXP A (QUOTIENT P 2)))
(B 1)))
(DISABLE PRIME-KEY-TRICK LESSP-REMAINDER-DIVISOR PRIME1)))
This conjecture can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, DIVIDES, and REFLECT, to the formula:
(IMPLIES
(AND
(IMPLIES
(NOT (ZEROP P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECT-LIST (QUOTIENT P 2) A P))
P)
(IF (RES1 (QUOTIENT P 2) A P)
(REMAINDER (TIMES (EXP A (QUOTIENT P 2))
(FACT (QUOTIENT P 2)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (QUOTIENT P 2))
(FACT (QUOTIENT P 2)))
P))
P))))
(IMPLIES (AND (EQUAL (REMAINDER (TIMES (FACT (QUOTIENT P 2))
(EXP A (QUOTIENT P 2)))
P)
(REMAINDER (TIMES (FACT (QUOTIENT P 2)) 1)
P))
(NOT (EQUAL (REMAINDER (FACT (QUOTIENT P 2)) P)
0))
(PRIME P))
(EQUAL (EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
(REMAINDER 1 P))
T))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(RES1 (QUOTIENT P 2) A P))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)).
This simplifies, using linear arithmetic, rewriting with TIMES-REFLECT-LIST,
COMMUTATIVITY-OF-TIMES, LESSP-QUOTIENT1, PRIME-FACT, and COROLLARY-55, and
opening up ZEROP, NOT, DIVIDES, PRIME, NUMBERP, EQUAL, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.9 0.0 ]
RES1-REM-1
(PROVE-LEMMA REMAINDER-LESSP NIL
(IMPLIES (LESSP A P)
(EQUAL (REMAINDER A P) (FIX A))))
This formula simplifies, expanding the functions REMAINDER and FIX, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
REMAINDER-LESSP
(PROVE-LEMMA RES1-REM-2 NIL
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(NOT (RES1 (QUOTIENT P 2) A P)))
(NOT (EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)))
((USE (REM-REFLECT-LIST (N (QUOTIENT P 2)))
(REMAINDER-EXP-LEMMA (A P)
(Y (EXP A (QUOTIENT P 2)))
(Z 1)
(X (FACT (QUOTIENT P 2))))
(RES1-REM-1-1 (X (REMAINDER (FACT (QUOTIENT P 2)) P)))
(REMAINDER-LESSP (A 1)))
(HANDS-OFF FACT EXP QUOTIENT REMAINDER REFLECT-LIST)
(DISABLE LESSP-REMAINDER-DIVISOR PRIME1 DIFFERENCE COROLLARY-55
REMAINDER-EXP-LEMMA)))
This formula can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, DIVIDES, and REFLECT, to:
(IMPLIES
(AND
(IMPLIES
(NOT (ZEROP P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECT-LIST (QUOTIENT P 2) A P))
P)
(IF (RES1 (QUOTIENT P 2) A P)
(REMAINDER (TIMES (EXP A (QUOTIENT P 2))
(FACT (QUOTIENT P 2)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (QUOTIENT P 2))
(FACT (QUOTIENT P 2)))
P))
P))))
(IMPLIES (EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
(REMAINDER 1 P))
(EQUAL (EQUAL (REMAINDER (TIMES (FACT (QUOTIENT P 2))
(EXP A (QUOTIENT P 2)))
P)
(REMAINDER (TIMES (FACT (QUOTIENT P 2)) 1)
P))
T))
(IMPLIES
(AND (NOT (ZEROP (REMAINDER (FACT (QUOTIENT P 2)) P)))
(NOT (EQUAL (REMAINDER P 2) 0)))
(NOT
(EQUAL (REMAINDER (DIFFERENCE P
(REMAINDER (FACT (QUOTIENT P 2)) P))
P)
(REMAINDER (FACT (QUOTIENT P 2)) P))))
(IMPLIES (LESSP 1 P)
(EQUAL (REMAINDER 1 P) (FIX 1)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RES1 (QUOTIENT P 2) A P)))
(NOT (EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))),
which simplifies, using linear arithmetic, applying TIMES-REFLECT-LIST,
COMMUTATIVITY-OF-TIMES, TIMES-1, PRIME-FACT, and LESSP-QUOTIENT1, and opening
up ZEROP, NOT, DIVIDES, PRIME, IMPLIES, EQUAL, NUMBERP, AND, SUB1, LESSP, and
FIX, to the following three new conjectures:
Case 3. (IMPLIES
(AND
(EQUAL
(REMAINDER (FACT (QUOTIENT P 2)) P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (FACT (QUOTIENT P 2))
(EXP A (QUOTIENT P 2)))
P))
P))
(NOT (EQUAL 1 (REMAINDER 1 P)))
(NOT
(EQUAL (REMAINDER (DIFFERENCE P
(REMAINDER (FACT (QUOTIENT P 2)) P))
P)
(REMAINDER (FACT (QUOTIENT P 2)) P)))
(EQUAL (SUB1 P) 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P 0)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RES1 (QUOTIENT P 2) A P)))
(NOT (EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))).
This again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES
(AND
(EQUAL
(REMAINDER (FACT (QUOTIENT P 2)) P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (FACT (QUOTIENT P 2))
(EXP A (QUOTIENT P 2)))
P))
P))
(EQUAL (REMAINDER (TIMES (FACT (QUOTIENT P 2))
(EXP A (QUOTIENT P 2)))
P)
(REMAINDER (FACT (QUOTIENT P 2)) P))
(NOT
(EQUAL (REMAINDER (DIFFERENCE P
(REMAINDER (FACT (QUOTIENT P 2)) P))
P)
(REMAINDER (FACT (QUOTIENT P 2)) P)))
(EQUAL (SUB1 P) 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P 0)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RES1 (QUOTIENT P 2) A P)))
(NOT (EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES
(AND
(EQUAL
(REMAINDER (FACT (QUOTIENT P 2)) P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (FACT (QUOTIENT P 2))
(EXP A (QUOTIENT P 2)))
P))
P))
(EQUAL (REMAINDER (TIMES (FACT (QUOTIENT P 2))
(EXP A (QUOTIENT P 2)))
P)
(REMAINDER (FACT (QUOTIENT P 2)) P))
(NOT
(EQUAL (REMAINDER (DIFFERENCE P
(REMAINDER (FACT (QUOTIENT P 2)) P))
P)
(REMAINDER (FACT (QUOTIENT P 2)) P)))
(EQUAL (REMAINDER 1 P) 1)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RES1 (QUOTIENT P 2) A P)))
(NOT (EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace P by
(PLUS Z (TIMES 2 X)) to eliminate (QUOTIENT P 2) and (REMAINDER P 2). We
rely upon LESSP-REMAINDER2, the type restriction lemma noted when QUOTIENT
was introduced, and the type restriction lemma noted when REMAINDER was
introduced to restrict the new variables. We would thus like to prove the
following three new goals:
Case 1.3.
(IMPLIES
(AND
(EQUAL 2 0)
(EQUAL
(REMAINDER (FACT (QUOTIENT P 2)) P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (FACT (QUOTIENT P 2))
(EXP A (QUOTIENT P 2)))
P))
P))
(EQUAL (REMAINDER (TIMES (FACT (QUOTIENT P 2))
(EXP A (QUOTIENT P 2)))
P)
(REMAINDER (FACT (QUOTIENT P 2)) P))
(NOT
(EQUAL (REMAINDER (DIFFERENCE P
(REMAINDER (FACT (QUOTIENT P 2)) P))
P)
(REMAINDER (FACT (QUOTIENT P 2)) P)))
(EQUAL (REMAINDER 1 P) 1)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RES1 (QUOTIENT P 2) A P)))
(NOT (EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))).
This further simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES
(AND
(NOT (NUMBERP 2))
(EQUAL
(REMAINDER (FACT (QUOTIENT P 2)) P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (FACT (QUOTIENT P 2))
(EXP A (QUOTIENT P 2)))
P))
P))
(EQUAL (REMAINDER (TIMES (FACT (QUOTIENT P 2))
(EXP A (QUOTIENT P 2)))
P)
(REMAINDER (FACT (QUOTIENT P 2)) P))
(NOT
(EQUAL (REMAINDER (DIFFERENCE P
(REMAINDER (FACT (QUOTIENT P 2)) P))
P)
(REMAINDER (FACT (QUOTIENT P 2)) P)))
(EQUAL (REMAINDER 1 P) 1)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RES1 (QUOTIENT P 2) A P)))
(NOT (EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))),
which further simplifies, clearly, to:
T.
Case 1.1.
(IMPLIES
(AND
(NUMBERP X)
(NUMBERP Z)
(EQUAL (LESSP Z 2) (NOT (ZEROP 2)))
(NOT (EQUAL 2 0))
(EQUAL (REMAINDER (FACT X)
(PLUS Z (TIMES 2 X)))
(REMAINDER (DIFFERENCE (PLUS Z (TIMES 2 X))
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS Z (TIMES 2 X))))
(PLUS Z (TIMES 2 X))))
(EQUAL (REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS Z (TIMES 2 X)))
(REMAINDER (FACT X)
(PLUS Z (TIMES 2 X))))
(NOT
(EQUAL (REMAINDER (DIFFERENCE (PLUS Z (TIMES 2 X))
(REMAINDER (FACT X)
(PLUS Z (TIMES 2 X))))
(PLUS Z (TIMES 2 X)))
(REMAINDER (FACT X)
(PLUS Z (TIMES 2 X)))))
(EQUAL (REMAINDER 1 (PLUS Z (TIMES 2 X)))
1)
(NOT (EQUAL (PLUS Z (TIMES 2 X)) 0))
(NOT (EQUAL (PLUS Z (TIMES 2 X)) 1))
(PRIME1 (PLUS Z (TIMES 2 X))
(SUB1 (PLUS Z (TIMES 2 X))))
(NOT (EQUAL Z 0))
(NOT (EQUAL (REMAINDER A (PLUS Z (TIMES 2 X)))
0))
(NOT (RES1 X A (PLUS Z (TIMES 2 X)))))
(NOT (EQUAL (REMAINDER (EXP A X)
(PLUS Z (TIMES 2 X)))
1))).
But this further simplifies, applying TIMES-2, COMMUTATIVITY-OF-PLUS,
COMMUTATIVITY2-OF-PLUS, and PLUS-EQUAL-0, and unfolding the definitions of
ZEROP, NOT, and EQUAL, to:
(IMPLIES
(AND
(NUMBERP X)
(NUMBERP Z)
(LESSP Z 2)
(EQUAL (REMAINDER (FACT X) (PLUS X X Z))
(REMAINDER (DIFFERENCE (PLUS X X Z)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS X X Z)))
(PLUS X X Z)))
(EQUAL (REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS X X Z))
(REMAINDER (FACT X) (PLUS X X Z)))
(NOT
(EQUAL (REMAINDER (DIFFERENCE (PLUS X X Z)
(REMAINDER (FACT X) (PLUS X X Z)))
(PLUS X X Z))
(REMAINDER (FACT X) (PLUS X X Z))))
(EQUAL (REMAINDER 1 (PLUS X X Z)) 1)
(NOT (EQUAL (PLUS X X Z) 1))
(PRIME1 (PLUS X X Z)
(SUB1 (PLUS X X Z)))
(NOT (EQUAL Z 0))
(NOT (EQUAL (REMAINDER A (PLUS X X Z)) 0))
(NOT (RES1 X A (PLUS X X Z))))
(NOT (EQUAL (REMAINDER (EXP A X) (PLUS X X Z))
1))),
which again simplifies, using linear arithmetic, to:
(IMPLIES
(AND
(NUMBERP X)
(NUMBERP 1)
(LESSP 1 2)
(EQUAL (REMAINDER (FACT X) (PLUS X X 1))
(REMAINDER (DIFFERENCE (PLUS X X 1)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS X X 1)))
(PLUS X X 1)))
(EQUAL (REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS X X 1))
(REMAINDER (FACT X) (PLUS X X 1)))
(NOT
(EQUAL (REMAINDER (DIFFERENCE (PLUS X X 1)
(REMAINDER (FACT X) (PLUS X X 1)))
(PLUS X X 1))
(REMAINDER (FACT X) (PLUS X X 1))))
(EQUAL (REMAINDER 1 (PLUS X X 1)) 1)
(NOT (EQUAL (PLUS X X 1) 1))
(PRIME1 (PLUS X X 1)
(SUB1 (PLUS X X 1)))
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A (PLUS X X 1)) 0))
(NOT (RES1 X A (PLUS X X 1))))
(NOT (EQUAL (REMAINDER (EXP A X) (PLUS X X 1))
1))).
This again simplifies, rewriting with the lemmas COMMUTATIVITY-OF-PLUS,
COMMUTATIVITY2-OF-PLUS, CORRECTNESS-OF-CANCEL, and PLUS-EQUAL-0, and
unfolding NUMBERP, LESSP, and EQUAL, to the conjecture:
(IMPLIES
(AND
(NUMBERP X)
(EQUAL (REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL (REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NOT
(EQUAL (REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL (REMAINDER A (PLUS 1 X X)) 0))
(NOT (RES1 X A (PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP A X) (PLUS 1 X X))
1))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace A by:
(PLUS Z (TIMES (PLUS 1 X X) V))
to eliminate (REMAINDER A (PLUS 1 X X)) and (QUOTIENT A (PLUS 1 X X)). We
employ LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER
was introduced, and the type restriction lemma noted when QUOTIENT was
introduced to constrain the new variables. This generates four new
conjectures:
Case 1.1.4.
(IMPLIES
(AND
(NOT (NUMBERP A))
(NUMBERP X)
(EQUAL
(REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL (REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NOT
(EQUAL (REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL (REMAINDER A (PLUS 1 X X)) 0))
(NOT (RES1 X A (PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP A X) (PLUS 1 X X))
1))).
We use the first equality hypothesis by substituting:
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X))
for (REMAINDER (FACT X) (PLUS 1 X X)) and keeping the equality
hypothesis. This generates:
(IMPLIES
(AND
(NOT (NUMBERP A))
(NUMBERP X)
(EQUAL
(REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(NOT
(EQUAL
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL (REMAINDER A (PLUS 1 X X)) 0))
(NOT (RES1 X A (PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP A X) (PLUS 1 X X))
1))).
This further simplifies, using linear arithmetic, to:
(IMPLIES
(AND
(EQUAL (REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NOT (NUMBERP A))
(NUMBERP X)
(EQUAL (REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL (REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X)))
(NOT
(EQUAL
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL (REMAINDER A (PLUS 1 X X)) 0))
(NOT (RES1 X A (PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP A X) (PLUS 1 X X))
1))).
We use the first equality hypothesis by substituting:
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
for (REMAINDER (FACT X) (PLUS 1 X X)) and keeping the equality
hypothesis. We would thus like to prove:
(IMPLIES
(AND
(EQUAL (REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NOT (NUMBERP A))
(NUMBERP X)
(EQUAL
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(NOT
(EQUAL
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL (REMAINDER A (PLUS 1 X X)) 0))
(NOT (RES1 X A (PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP A X) (PLUS 1 X X))
1))).
We now use the second equality hypothesis by substituting:
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
for:
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X))
and keeping the equality hypothesis. This generates:
(IMPLIES
(AND
(EQUAL (REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NOT (NUMBERP A))
(NUMBERP X)
(EQUAL
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL (REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(NOT
(EQUAL
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL (REMAINDER A (PLUS 1 X X)) 0))
(NOT (RES1 X A (PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP A X) (PLUS 1 X X))
1))).
This finally simplifies, obviously, to:
T.
Case 1.1.3.
(IMPLIES
(AND
(EQUAL (PLUS 1 X X) 0)
(NUMBERP X)
(EQUAL
(REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL (REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NOT
(EQUAL (REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL (REMAINDER A (PLUS 1 X X)) 0))
(NOT (RES1 X A (PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP A X) (PLUS 1 X X))
1))).
However this finally simplifies, using linear arithmetic, to:
T.
Case 1.1.2.
(IMPLIES
(AND
(NOT (NUMBERP (PLUS 1 X X)))
(NUMBERP X)
(EQUAL
(REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL (REMAINDER (TIMES (FACT X) (EXP A X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NOT
(EQUAL (REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL (REMAINDER A (PLUS 1 X X)) 0))
(NOT (RES1 X A (PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP A X) (PLUS 1 X X))
1))),
which finally simplifies, trivially, to:
T.
Case 1.1.1.
(IMPLIES
(AND
(NUMBERP Z)
(EQUAL (LESSP Z (PLUS 1 X X))
(NOT (ZEROP (PLUS 1 X X))))
(NUMBERP V)
(NOT (EQUAL (PLUS 1 X X) 0))
(NUMBERP X)
(EQUAL
(REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS Z (TIMES (PLUS 1 X X) V))
X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL (REMAINDER (TIMES (FACT X)
(EXP (PLUS Z (TIMES (PLUS 1 X X) V))
X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NOT
(EQUAL (REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL Z 0))
(NOT (RES1 X
(PLUS Z (TIMES (PLUS 1 X X) V))
(PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP (PLUS Z (TIMES (PLUS 1 X X) V))
X)
(PLUS 1 X X))
1))).
But this further simplifies, applying PLUS-EQUAL-0, TIMES-1,
COMMUTATIVITY-OF-TIMES, DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and
COMMUTATIVITY2-OF-PLUS, and expanding NUMBERP, EQUAL, ZEROP, and NOT, to
the new formula:
(IMPLIES
(AND
(NUMBERP Z)
(LESSP Z (PLUS 1 X X))
(NUMBERP V)
(NUMBERP X)
(EQUAL
(REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL (REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NOT
(EQUAL (REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL Z 0))
(NOT (RES1 X
(PLUS V Z (TIMES V X) (TIMES V X))
(PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP (PLUS V Z (TIMES V X) (TIMES V X))
X)
(PLUS 1 X X))
1))).
We use the first equality hypothesis by substituting:
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X))
for (REMAINDER (FACT X) (PLUS 1 X X)) and keeping the equality
hypothesis. This generates:
(IMPLIES
(AND
(NUMBERP Z)
(LESSP Z (PLUS 1 X X))
(NUMBERP V)
(NUMBERP X)
(EQUAL
(REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(NOT
(EQUAL
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL Z 0))
(NOT (RES1 X
(PLUS V Z (TIMES V X) (TIMES V X))
(PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP (PLUS V Z (TIMES V X) (TIMES V X))
X)
(PLUS 1 X X))
1))).
This further simplifies, using linear arithmetic, to:
(IMPLIES
(AND
(EQUAL (REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NUMBERP Z)
(LESSP Z (PLUS 1 X X))
(NUMBERP V)
(NUMBERP X)
(EQUAL (REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL (REMAINDER (FACT X) (PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X)))
(NOT
(EQUAL
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (DIFFERENCE (PLUS 1 X X)
(REMAINDER (FACT X) (PLUS 1 X X)))
(PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL Z 0))
(NOT (RES1 X
(PLUS V Z (TIMES V X) (TIMES V X))
(PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP (PLUS V Z (TIMES V X) (TIMES V X))
X)
(PLUS 1 X X))
1))).
We now use the first equality hypothesis by substituting:
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))
for (REMAINDER (FACT X) (PLUS 1 X X)) and keeping the equality
hypothesis. This produces:
(IMPLIES
(AND
(EQUAL (REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NUMBERP Z)
(LESSP Z (PLUS 1 X X))
(NUMBERP V)
(NUMBERP X)
(EQUAL
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(NOT
(EQUAL
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL Z 0))
(NOT (RES1 X
(PLUS V Z (TIMES V X) (TIMES V X))
(PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP (PLUS V Z (TIMES V X) (TIMES V X))
X)
(PLUS 1 X X))
1))).
We use the second equality hypothesis by substituting:
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))
for:
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X))
and keeping the equality hypothesis. This generates the goal:
(IMPLIES
(AND
(EQUAL (REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))
(REMAINDER (FACT X) (PLUS 1 X X)))
(NUMBERP Z)
(LESSP Z (PLUS 1 X X))
(NUMBERP V)
(NUMBERP X)
(EQUAL
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X)))
(EQUAL (REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(NOT
(EQUAL
(REMAINDER
(DIFFERENCE
(PLUS 1 X X)
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X)))
(PLUS 1 X X))
(REMAINDER (TIMES (FACT X)
(EXP (PLUS V Z (TIMES V X) (TIMES V X))
X))
(PLUS 1 X X))))
(EQUAL (REMAINDER 1 (PLUS 1 X X)) 1)
(NOT (EQUAL X 0))
(PRIME1 (PLUS 1 X X)
(SUB1 (PLUS 1 X X)))
(NOT (EQUAL Z 0))
(NOT (RES1 X
(PLUS V Z (TIMES V X) (TIMES V X))
(PLUS 1 X X))))
(NOT (EQUAL (REMAINDER (EXP (PLUS V Z (TIMES V X) (TIMES V X))
X)
(PLUS 1 X X))
1))).
This finally simplifies, clearly, to:
T.
Q.E.D.
[ 0.0 0.5 0.0 ]
RES1-REM-2
(PROVE-LEMMA TWO-EVEN NIL
(IMPLIES (NOT (DIVIDES 2 P))
(NOT (EQUAL (SUB1 P) 1)))
((INDUCT (ODD P))))
This conjecture can be simplified, using the abbreviations ZEROP, IMPLIES, NOT,
OR, AND, and DIVIDES, to three new goals:
Case 3. (IMPLIES (AND (ZEROP P)
(NOT (EQUAL (REMAINDER P 2) 0)))
(NOT (EQUAL (SUB1 P) 1))),
which simplifies, expanding ZEROP, REMAINDER, EQUAL, LESSP, and NUMBERP, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(ZEROP (SUB1 P))
(NOT (EQUAL (REMAINDER P 2) 0)))
(NOT (EQUAL (SUB1 P) 1))),
which simplifies, expanding the definition of ZEROP, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL (SUB1 P) 0))
(NUMBERP (SUB1 P))
(IMPLIES (NOT (EQUAL (REMAINDER (SUB1 (SUB1 P)) 2)
0))
(NOT (EQUAL (SUB1 (SUB1 (SUB1 P))) 1)))
(NOT (EQUAL (REMAINDER P 2) 0)))
(NOT (EQUAL (SUB1 P) 1))),
which simplifies, using linear arithmetic, applying DIFFERENCE-0, and
expanding EQUAL, NUMBERP, SUB1, REMAINDER, NOT, IMPLIES, and LESSP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TWO-EVEN
(PROVE-LEMMA GAUSS-LEMMA NIL
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(NOT (DIVIDES 2 P)))
(EQUAL (RES1 (QUOTIENT P 2) A P)
(RESIDUE A P)))
((USE (EULER-1)
(EULER-2)
(RES1-REM-1)
(RES1-REM-2)
(TWO-EVEN))
(DISABLE EULER-1 EULER-2 QUOTIENT EXP RESIDUE RES1 PRIME
DIVIDES)))
This formula simplifies, expanding the functions NOT, AND, IMPLIES, and EQUAL,
to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
GAUSS-LEMMA
(DEFN PLUS-LIST
(L)
(IF (NLISTP L)
0
(PLUS (CAR L) (PLUS-LIST (CDR L)))))
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the
definition of NLISTP inform us that the measure (COUNT L) decreases according
to the well-founded relation LESSP in each recursive call. Hence, PLUS-LIST
is accepted under the definitional principle. From the definition we can
conclude that (NUMBERP (PLUS-LIST L)) is a theorem.
[ 0.0 0.0 0.0 ]
PLUS-LIST
(DEFN QUOT-LIST
(N A P)
(IF (ZEROP N)
NIL
(CONS (QUOTIENT (TIMES A N) P)
(QUOT-LIST (SUB1 N) A P))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
inform us that the measure (COUNT N) decreases according to the well-founded
relation LESSP in each recursive call. Hence, QUOT-LIST is accepted under the
definitional principle. Note that:
(OR (LITATOM (QUOT-LIST N A P))
(LISTP (QUOT-LIST N A P)))
is a theorem.
[ 0.0 0.0 0.0 ]
QUOT-LIST
(DEFN REM-LIST
(N A P)
(IF (ZEROP N)
NIL
(CONS (REMAINDER (TIMES A N) P)
(REM-LIST (SUB1 N) A P))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
inform us that the measure (COUNT N) decreases according to the well-founded
relation LESSP in each recursive call. Hence, REM-LIST is accepted under the
definitional principle. Note that:
(OR (LITATOM (REM-LIST N A P))
(LISTP (REM-LIST N A P)))
is a theorem.
[ 0.0 0.0 0.0 ]
REM-LIST
(PROVE-LEMMA REM-QUOT-LIST NIL
(EQUAL (TIMES A (PLUS-LIST (POSITIVES N)))
(PLUS (TIMES P
(PLUS-LIST (QUOT-LIST N A P)))
(PLUS-LIST (REM-LIST N A P)))))
This formula simplifies, rewriting with COMMUTATIVITY-OF-PLUS, to the new goal:
(EQUAL (TIMES A (PLUS-LIST (POSITIVES N)))
(PLUS (PLUS-LIST (REM-LIST N A P))
(TIMES P
(PLUS-LIST (QUOT-LIST N A P))))),
which we will name *1.
Perhaps we can prove it by induction. There are three plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (ZEROP N) (p A N P))
(IMPLIES (AND (NOT (ZEROP N)) (p A (SUB1 N) P))
(p A N P))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT N) decreases according to the well-founded
relation LESSP in each induction step of the scheme. The above induction
scheme produces the following two new formulas:
Case 2. (IMPLIES (ZEROP N)
(EQUAL (TIMES A (PLUS-LIST (POSITIVES N)))
(PLUS (PLUS-LIST (REM-LIST N A P))
(TIMES P
(PLUS-LIST (QUOT-LIST N A P)))))).
This simplifies, applying COMMUTATIVITY-OF-TIMES, and opening up the
functions ZEROP, POSITIVES, PLUS-LIST, EQUAL, REM-LIST, QUOT-LIST, and PLUS,
to two new conjectures:
Case 2.2.
(IMPLIES (EQUAL N 0)
(EQUAL (TIMES 0 A) (TIMES 0 P))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (NOT (NUMBERP N))
(EQUAL (TIMES 0 A) (TIMES 0 P))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES
(AND (NOT (ZEROP N))
(EQUAL (TIMES A
(PLUS-LIST (POSITIVES (SUB1 N))))
(PLUS (PLUS-LIST (REM-LIST (SUB1 N) A P))
(TIMES P
(PLUS-LIST (QUOT-LIST (SUB1 N) A P))))))
(EQUAL (TIMES A (PLUS-LIST (POSITIVES N)))
(PLUS (PLUS-LIST (REM-LIST N A P))
(TIMES P
(PLUS-LIST (QUOT-LIST N A P)))))),
which simplifies, applying the lemmas CDR-CONS, CAR-CONS,
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, TIMES-ADD1, and ASSOCIATIVITY-OF-PLUS,
and unfolding the functions ZEROP, POSITIVES, PLUS, PLUS-LIST, REM-LIST, and
QUOT-LIST, to the formula:
(IMPLIES
(AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (TIMES A
(PLUS-LIST (POSITIVES (SUB1 N))))
(PLUS (PLUS-LIST (REM-LIST (SUB1 N) A P))
(TIMES P
(PLUS-LIST (QUOT-LIST (SUB1 N) A P))))))
(EQUAL (PLUS A
(TIMES A (SUB1 N))
(TIMES A
(PLUS-LIST (POSITIVES (SUB1 N)))))
(PLUS (REMAINDER (TIMES A N) P)
(PLUS-LIST (REM-LIST (SUB1 N) A P))
(TIMES P (QUOTIENT (TIMES A N) P))
(TIMES P
(PLUS-LIST (QUOT-LIST (SUB1 N) A P)))))).
Appealing to the lemma SUB1-ELIM, we now replace N by (ADD1 X) to eliminate
(SUB1 N). We employ the type restriction lemma noted when SUB1 was
introduced to constrain the new variable. This generates the conjecture:
(IMPLIES (AND (NUMBERP X)
(NOT (EQUAL (ADD1 X) 0))
(EQUAL (TIMES A (PLUS-LIST (POSITIVES X)))
(PLUS (PLUS-LIST (REM-LIST X A P))
(TIMES P
(PLUS-LIST (QUOT-LIST X A P))))))
(EQUAL (PLUS A
(TIMES A X)
(TIMES A (PLUS-LIST (POSITIVES X))))
(PLUS (REMAINDER (TIMES A (ADD1 X)) P)
(PLUS-LIST (REM-LIST X A P))
(TIMES P
(QUOTIENT (TIMES A (ADD1 X)) P))
(TIMES P
(PLUS-LIST (QUOT-LIST X A P)))))).
This further simplifies, appealing to the lemmas TIMES-ADD1,
COMMUTATIVITY-OF-PLUS, and COMMUTATIVITY2-OF-PLUS, to:
(IMPLIES (AND (NUMBERP X)
(EQUAL (TIMES A (PLUS-LIST (POSITIVES X)))
(PLUS (PLUS-LIST (REM-LIST X A P))
(TIMES P
(PLUS-LIST (QUOT-LIST X A P))))))
(EQUAL (PLUS A
(TIMES A X)
(TIMES A (PLUS-LIST (POSITIVES X))))
(PLUS (PLUS-LIST (REM-LIST X A P))
(REMAINDER (PLUS A (TIMES A X)) P)
(TIMES P
(PLUS-LIST (QUOT-LIST X A P)))
(TIMES P
(QUOTIENT (PLUS A (TIMES A X)) P))))).
We now use the above equality hypothesis by substituting:
(PLUS (PLUS-LIST (REM-LIST X A P))
(TIMES P
(PLUS-LIST (QUOT-LIST X A P))))
for (TIMES A (PLUS-LIST (POSITIVES X))) and throwing away the equality. We
would thus like to prove the new conjecture:
(IMPLIES (NUMBERP X)
(EQUAL (PLUS A
(TIMES A X)
(PLUS-LIST (REM-LIST X A P))
(TIMES P
(PLUS-LIST (QUOT-LIST X A P))))
(PLUS (PLUS-LIST (REM-LIST X A P))
(REMAINDER (PLUS A (TIMES A X)) P)
(TIMES P
(PLUS-LIST (QUOT-LIST X A P)))
(TIMES P
(QUOTIENT (PLUS A (TIMES A X)) P))))),
which further simplifies, rewriting with CORRECTNESS-OF-CANCEL and
REMAINDER-QUOTIENT, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.6 0.0 ]
REM-QUOT-LIST
(DEFN EVEN3
(X)
(IF (ZEROP X)
T
(NOT (EVEN3 (SUB1 X)))))
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
inform us that the measure (COUNT X) decreases according to the well-founded
relation LESSP in each recursive call. Hence, EVEN3 is accepted under the
principle of definition. From the definition we can conclude that:
(OR (FALSEP (EVEN3 X))
(TRUEP (EVEN3 X)))
is a theorem.
[ 0.0 0.0 0.0 ]
EVEN3
(PROVE-LEMMA EVEN3-PLUS
(REWRITE)
(EQUAL (EVEN3 (PLUS A B))
(EQUAL (EVEN3 A) (EVEN3 B))))
This simplifies, obviously, to two new formulas:
Case 2. (IMPLIES (NOT (EQUAL (EVEN3 A) (EVEN3 B)))
(NOT (EVEN3 (PLUS A B)))),
which we will name *1.
Case 1. (IMPLIES (EQUAL (EVEN3 A) (EVEN3 B))
(EQUAL (EVEN3 (PLUS A B)) T)).
This again simplifies, trivially, to:
(IMPLIES (EQUAL (EVEN3 A) (EVEN3 B))
(EVEN3 (PLUS A B))),
which we would normally push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us return to:
(EQUAL (EVEN3 (PLUS A B))
(EQUAL (EVEN3 A) (EVEN3 B))).
We named this *1. We will try to prove it by induction. The recursive terms
in the conjecture suggest three inductions. They merge into two likely
candidate inductions. However, only one is unflawed. We will induct
according to the following scheme:
(AND (IMPLIES (ZEROP A) (p A B))
(IMPLIES (AND (NOT (ZEROP A)) (p (SUB1 A) B))
(p A B))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definition
of ZEROP can be used to prove that the measure (COUNT A) decreases according
to the well-founded relation LESSP in each induction step of the scheme. The
above induction scheme produces the following two new goals:
Case 2. (IMPLIES (ZEROP A)
(EQUAL (EVEN3 (PLUS A B))
(EQUAL (EVEN3 A) (EVEN3 B)))).
This simplifies, opening up the functions ZEROP, EQUAL, PLUS, and EVEN3, to
the following two new goals:
Case 2.2.
(IMPLIES (AND (EQUAL A 0) (NOT (NUMBERP B)))
(EQUAL (EVEN3 0) (EVEN3 B))).
This again simplifies, opening up the definitions of EVEN3 and EQUAL, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (NUMBERP A))
(NOT (NUMBERP B)))
(EQUAL (EVEN3 0) (EVEN3 B))),
which again simplifies, expanding the definitions of EVEN3 and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP A))
(EQUAL (EVEN3 (PLUS (SUB1 A) B))
(EQUAL (EVEN3 (SUB1 A)) (EVEN3 B))))
(EQUAL (EVEN3 (PLUS A B))
(EQUAL (EVEN3 A) (EVEN3 B)))),
which simplifies, applying SUB1-ADD1, and expanding the definitions of ZEROP,
PLUS, and EVEN3, to the following four new conjectures:
Case 1.4.
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(NOT (EQUAL (EVEN3 (SUB1 A)) (EVEN3 B)))
(NOT (EVEN3 (PLUS (SUB1 A) B)))
(NOT (EVEN3 (SUB1 A))))
(EQUAL T (EVEN3 B))).
However this again simplifies, unfolding the definition of EQUAL, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(NOT (EQUAL (EVEN3 (SUB1 A)) (EVEN3 B)))
(NOT (EVEN3 (PLUS (SUB1 A) B)))
(EVEN3 (SUB1 A)))
(EQUAL F (EVEN3 B))),
which again simplifies, unfolding EQUAL, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(EQUAL (EVEN3 (SUB1 A)) (EVEN3 B))
(EQUAL (EVEN3 (PLUS (SUB1 A) B)) T)
(EVEN3 B))
(NOT (EQUAL F (EVEN3 B)))),
which again simplifies, trivially, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(EQUAL (EVEN3 (SUB1 A)) (EVEN3 B))
(EQUAL (EVEN3 (PLUS (SUB1 A) B)) T)
(NOT (EVEN3 B)))
(NOT (EQUAL T (EVEN3 B)))).
This again simplifies, obviously, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
EVEN3-PLUS
(PROVE-LEMMA EVEN3-DIFF
(REWRITE)
(IMPLIES (LEQ X P)
(EQUAL (EVEN3 (DIFFERENCE P X))
(EQUAL (EVEN3 P) (EVEN3 X)))))
This simplifies, obviously, to two new goals:
Case 2. (IMPLIES (AND (NOT (LESSP P X))
(NOT (EQUAL (EVEN3 P) (EVEN3 X))))
(NOT (EVEN3 (DIFFERENCE P X)))).
Applying the lemma DIFFERENCE-ELIM, replace P by (PLUS X Z) to eliminate
(DIFFERENCE P X). We rely upon the type restriction lemma noted when
DIFFERENCE was introduced to restrict the new variable. We thus obtain the
following two new goals:
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (LESSP P X))
(NOT (EQUAL (EVEN3 P) (EVEN3 X))))
(NOT (EVEN3 (DIFFERENCE P X)))).
However this further simplifies, unfolding the functions LESSP, EVEN3, and
EQUAL, to:
T.
Case 2.1.
(IMPLIES (AND (NUMBERP Z)
(NOT (LESSP (PLUS X Z) X))
(NOT (EQUAL (EVEN3 (PLUS X Z)) (EVEN3 X))))
(NOT (EVEN3 Z))),
which further simplifies, appealing to the lemma EVEN3-PLUS, to:
T.
Case 1. (IMPLIES (AND (NOT (LESSP P X))
(EQUAL (EVEN3 P) (EVEN3 X)))
(EQUAL (EVEN3 (DIFFERENCE P X)) T)),
which again simplifies, obviously, to the new conjecture:
(IMPLIES (AND (NOT (LESSP P X))
(EQUAL (EVEN3 P) (EVEN3 X)))
(EVEN3 (DIFFERENCE P X))).
Applying the lemma DIFFERENCE-ELIM, replace P by (PLUS X Z) to eliminate
(DIFFERENCE P X). We use the type restriction lemma noted when DIFFERENCE
was introduced to restrict the new variable. We would thus like to prove
the following two new formulas:
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (LESSP P X))
(EQUAL (EVEN3 P) (EVEN3 X)))
(EVEN3 (DIFFERENCE P X))).
However this further simplifies, using linear arithmetic, applying
DIFFERENCE-0, and expanding the definitions of LESSP, EVEN3, and EQUAL, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP Z)
(NOT (LESSP (PLUS X Z) X))
(EQUAL (EVEN3 (PLUS X Z)) (EVEN3 X)))
(EVEN3 Z)).
But this further simplifies, applying EVEN3-PLUS, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EVEN3-DIFF
(PROVE-LEMMA EVEN3-TIMES
(REWRITE)
(EQUAL (EVEN3 (TIMES A B))
(OR (EVEN3 A) (EVEN3 B))))
This simplifies, unfolding the definition of OR, to the following two new
goals:
Case 2. (IMPLIES (NOT (EVEN3 A))
(EQUAL (EVEN3 (TIMES A B))
(EVEN3 B))).
Name the above subgoal *1.
Case 1. (IMPLIES (EVEN3 A)
(EQUAL (EVEN3 (TIMES A B)) T)).
This again simplifies, trivially, to:
(IMPLIES (EVEN3 A)
(EVEN3 (TIMES A B))),
which we would normally push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us return to:
(EQUAL (EVEN3 (TIMES A B))
(OR (EVEN3 A) (EVEN3 B))),
named *1. Let us appeal to the induction principle. There are two plausible
inductions, both of which are unflawed. Since both of these are equally
likely, we will choose arbitrarily. We will induct according to the following
scheme:
(AND (IMPLIES (ZEROP A) (p A B))
(IMPLIES (AND (NOT (ZEROP A)) (p (SUB1 A) B))
(p A B))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform
us that the measure (COUNT A) decreases according to the well-founded relation
LESSP in each induction step of the scheme. The above induction scheme
generates two new goals:
Case 2. (IMPLIES (ZEROP A)
(EQUAL (EVEN3 (TIMES A B))
(OR (EVEN3 A) (EVEN3 B)))),
which simplifies, applying the lemmas TIMES-IDENTITY and EQUAL-TIMES-0, and
opening up ZEROP, EQUAL, EVEN3, and OR, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP A))
(EQUAL (EVEN3 (TIMES (SUB1 A) B))
(OR (EVEN3 (SUB1 A)) (EVEN3 B))))
(EQUAL (EVEN3 (TIMES A B))
(OR (EVEN3 A) (EVEN3 B)))),
which simplifies, applying the lemma COMMUTATIVITY-OF-TIMES, and opening up
ZEROP, OR, and EVEN3, to two new conjectures:
Case 1.2.
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(NOT (EVEN3 (SUB1 A)))
(EQUAL (EVEN3 (TIMES B (SUB1 A)))
(EVEN3 B)))
(EVEN3 (TIMES A B))).
Applying the lemma SUB1-ELIM, replace A by (ADD1 X) to eliminate (SUB1 A).
We rely upon the type restriction lemma noted when SUB1 was introduced to
restrict the new variable. We would thus like to prove:
(IMPLIES (AND (NUMBERP X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (EVEN3 X))
(EQUAL (EVEN3 (TIMES B X)) (EVEN3 B)))
(EVEN3 (TIMES (ADD1 X) B))),
which further simplifies, rewriting with TIMES-ADD1,
COMMUTATIVITY-OF-TIMES, and EVEN3-PLUS, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(EVEN3 (SUB1 A))
(EQUAL (EVEN3 (TIMES B (SUB1 A))) T))
(EQUAL (EVEN3 (TIMES A B))
(EVEN3 B))).
This again simplifies, clearly, to:
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(EVEN3 (SUB1 A))
(EVEN3 (TIMES B (SUB1 A))))
(EQUAL (EVEN3 (TIMES A B))
(EVEN3 B))).
Applying the lemma SUB1-ELIM, replace A by (ADD1 X) to eliminate (SUB1 A).
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 X)
(NOT (EQUAL (ADD1 X) 0))
(EVEN3 X)
(EVEN3 (TIMES B X)))
(EQUAL (EVEN3 (TIMES (ADD1 X) B))
(EVEN3 B))),
which further simplifies, applying TIMES-ADD1, COMMUTATIVITY-OF-TIMES, and
EVEN3-PLUS, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
EVEN3-TIMES
(PROVE-LEMMA EVEN3-REM
(REWRITE)
(IMPLIES (NOT (EVEN3 P))
(EQUAL (EVEN3 (DIFFERENCE P (REMAINDER X P)))
(NOT (EVEN3 (REMAINDER X P))))))
This formula simplifies, opening up the definition of NOT, to the following
two new formulas:
Case 2. (IMPLIES (AND (NOT (EVEN3 P))
(NOT (EVEN3 (REMAINDER X P))))
(EQUAL (EVEN3 (DIFFERENCE P (REMAINDER X P)))
T)).
This again simplifies, obviously, to the new goal:
(IMPLIES (AND (NOT (EVEN3 P))
(NOT (EVEN3 (REMAINDER X P))))
(EVEN3 (DIFFERENCE P (REMAINDER X P)))).
Applying the lemmas REMAINDER-QUOTIENT-ELIM and DIFFERENCE-ELIM, replace X
by (PLUS Z (TIMES P V)) to eliminate (REMAINDER X P) and (QUOTIENT X P) and
P by (PLUS Z W) to eliminate (DIFFERENCE P Z). We use LESSP-REMAINDER2, the
type restriction lemma noted when REMAINDER was introduced, the type
restriction lemma noted when QUOTIENT was introduced, and the type
restriction lemma noted when DIFFERENCE was introduced to restrict the new
variables. We thus obtain the following five new conjectures:
Case 2.5.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EVEN3 P))
(NOT (EVEN3 (REMAINDER X P))))
(EVEN3 (DIFFERENCE P (REMAINDER X P)))).
But this further simplifies, expanding LESSP, REMAINDER, and EVEN3, to:
T.
Case 2.4.
(IMPLIES (AND (EQUAL P 0)
(NOT (EVEN3 P))
(NOT (EVEN3 (REMAINDER X P))))
(EVEN3 (DIFFERENCE P (REMAINDER X P)))),
which further simplifies, unfolding EVEN3, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (EVEN3 P))
(NOT (EVEN3 (REMAINDER X P))))
(EVEN3 (DIFFERENCE P (REMAINDER X P)))),
which further simplifies, expanding the function EVEN3, to:
T.
Case 2.2.
(IMPLIES (AND (LESSP P Z)
(NUMBERP Z)
(EQUAL (LESSP Z P) (NOT (ZEROP P)))
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EVEN3 P))
(NOT (EVEN3 Z)))
(EVEN3 (DIFFERENCE P Z))),
which further simplifies, using linear arithmetic, rewriting with
DIFFERENCE-0, and opening up the functions ZEROP, NOT, and DIFFERENCE, to
the following two new formulas:
Case 2.2.2.
(IMPLIES (AND (LESSP P Z)
(NUMBERP Z)
(LESSP Z P)
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EVEN3 P))
(NOT (EVEN3 Z)))
(EVEN3 0)).
But this again simplifies, using linear arithmetic, to:
T.
Case 2.2.1.
(IMPLIES (AND (LESSP P Z)
(NUMBERP Z)
(LESSP Z P)
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EVEN3 P))
(NOT (EVEN3 Z)))
(NOT (EQUAL Z 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (NUMBERP W)
(NOT (LESSP (PLUS Z W) Z))
(NUMBERP Z)
(EQUAL (LESSP Z (PLUS Z W))
(NOT (ZEROP (PLUS Z W))))
(NUMBERP V)
(NOT (EQUAL (PLUS Z W) 0))
(NOT (EVEN3 (PLUS Z W)))
(NOT (EVEN3 Z)))
(EVEN3 W)),
which further simplifies, rewriting with COMMUTATIVITY-OF-PLUS,
LESSP-PLUS-CANCELLATION3, PLUS-EQUAL-0, and EVEN3-PLUS, and unfolding
ZEROP, NOT, EQUAL, PLUS, and EVEN3, to:
T.
Case 1. (IMPLIES (AND (NOT (EVEN3 P))
(EVEN3 (REMAINDER X P)))
(EQUAL (EVEN3 (DIFFERENCE P (REMAINDER X P)))
F)).
This again simplifies, trivially, to:
(IMPLIES (AND (NOT (EVEN3 P))
(EVEN3 (REMAINDER X P)))
(NOT (EVEN3 (DIFFERENCE P (REMAINDER X P))))).
Applying the lemmas REMAINDER-QUOTIENT-ELIM and DIFFERENCE-ELIM, replace X
by (PLUS Z (TIMES P V)) to eliminate (REMAINDER X P) and (QUOTIENT X P) and
P by (PLUS Z W) to eliminate (DIFFERENCE P Z). We employ LESSP-REMAINDER2,
the type restriction lemma noted when REMAINDER was introduced, the type
restriction lemma noted when QUOTIENT was introduced, and the type
restriction lemma noted when DIFFERENCE was introduced to restrict the new
variables. We thus obtain the following five new goals:
Case 1.5.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EVEN3 P))
(EVEN3 (REMAINDER X P)))
(NOT (EVEN3 (DIFFERENCE P (REMAINDER X P))))).
However this further simplifies, expanding the functions LESSP, REMAINDER,
EVEN3, EQUAL, and DIFFERENCE, to two new goals:
Case 1.5.2.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EVEN3 P))
(NOT (NUMBERP P)))
(NOT (EVEN3 0))),
which again simplifies, expanding the definition of EVEN3, to:
T.
Case 1.5.1.
(IMPLIES (AND (NOT (NUMBERP X))
(NOT (EVEN3 P))
(EQUAL P 0))
(NOT (EVEN3 0))),
which again simplifies, trivially, to:
T.
Case 1.4.
(IMPLIES (AND (EQUAL P 0)
(NOT (EVEN3 P))
(EVEN3 (REMAINDER X P)))
(NOT (EVEN3 (DIFFERENCE P (REMAINDER X P))))).
This further simplifies, unfolding the definition of EVEN3, to:
T.
Case 1.3.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (EVEN3 P))
(EVEN3 (REMAINDER X P)))
(NOT (EVEN3 (DIFFERENCE P (REMAINDER X P))))),
which further simplifies, expanding EVEN3, to:
T.
Case 1.2.
(IMPLIES (AND (LESSP P Z)
(NUMBERP Z)
(EQUAL (LESSP Z P) (NOT (ZEROP P)))
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EVEN3 P))
(EVEN3 Z))
(NOT (EVEN3 (DIFFERENCE P Z)))),
which further simplifies, using linear arithmetic, applying DIFFERENCE-0,
and opening up ZEROP, NOT, and DIFFERENCE, to:
(IMPLIES (AND (LESSP P Z)
(NUMBERP Z)
(LESSP Z P)
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EVEN3 P))
(EVEN3 Z)
(NOT (EQUAL Z 0)))
(NOT (EVEN3 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP W)
(NOT (LESSP (PLUS Z W) Z))
(NUMBERP Z)
(EQUAL (LESSP Z (PLUS Z W))
(NOT (ZEROP (PLUS Z W))))
(NUMBERP V)
(NOT (EQUAL (PLUS Z W) 0))
(NOT (EVEN3 (PLUS Z W)))
(EVEN3 Z))
(NOT (EVEN3 W))),
which further simplifies, appealing to the lemmas COMMUTATIVITY-OF-PLUS,
LESSP-PLUS-CANCELLATION3, PLUS-EQUAL-0, and EVEN3-PLUS, and unfolding the
definitions of ZEROP, NOT, EQUAL, and PLUS, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
EVEN3-REM
(PROVE-LEMMA EVEN3-REM-REFLECT
(REWRITE)
(IMPLIES (NOT (EVEN3 P))
(EQUAL (RES1 N A P)
(IFF (EVEN3 (PLUS-LIST (REM-LIST N A P)))
(EVEN3 (PLUS-LIST (REFLECT-LIST N A P)))))))
This conjecture simplifies, expanding IFF, to the following three new
conjectures:
Case 3. (IMPLIES (AND (NOT (EVEN3 P))
(NOT (EVEN3 (PLUS-LIST (REM-LIST N A P))))
(EVEN3 (PLUS-LIST (REFLECT-LIST N A P))))
(EQUAL (RES1 N A P) F)).
This again simplifies, obviously, to:
(IMPLIES (AND (NOT (EVEN3 P))
(NOT (EVEN3 (PLUS-LIST (REM-LIST N A P))))
(EVEN3 (PLUS-LIST (REFLECT-LIST N A P))))
(NOT (RES1 N A P))),
which we will name *1.
Case 2. (IMPLIES (AND (NOT (EVEN3 P))
(NOT (EVEN3 (PLUS-LIST (REM-LIST N A P))))
(NOT (EVEN3 (PLUS-LIST (REFLECT-LIST N A P)))))
(EQUAL (RES1 N A P) T)).
This again simplifies, clearly, to:
(IMPLIES (AND (NOT (EVEN3 P))
(NOT (EVEN3 (PLUS-LIST (REM-LIST N A P))))
(NOT (EVEN3 (PLUS-LIST (REFLECT-LIST N A P)))))
(RES1 N A P)),
which we would normally push and work on later by induction. But if we must
use induction to prove the input conjecture, we prefer to induct on the
original formulation of the problem. Thus we will disregard all that we
have previously done, give the name *1 to the original input, and work on it.
So now let us return to:
(IMPLIES (NOT (EVEN3 P))
(EQUAL (RES1 N A P)
(IFF (EVEN3 (PLUS-LIST (REM-LIST N A P)))
(EVEN3 (PLUS-LIST (REFLECT-LIST N A P)))))).
We named this *1. We will try to prove it by induction. There are four
plausible inductions. They merge into two likely candidate inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (ZEROP N) (p N A P))
(IMPLIES (AND (NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(p (SUB1 N) A P))
(p N A P))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(p (SUB1 N) A P))
(p N A P))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT N) decreases according to the well-founded
relation LESSP in each induction step of the scheme. The above induction
scheme generates three new goals:
Case 3. (IMPLIES (AND (ZEROP N) (NOT (EVEN3 P)))
(EQUAL (RES1 N A P)
(IFF (EVEN3 (PLUS-LIST (REM-LIST N A P)))
(EVEN3 (PLUS-LIST (REFLECT-LIST N A P)))))),
which simplifies, expanding the functions ZEROP, EQUAL, RES1, REM-LIST,
PLUS-LIST, EVEN3, REFLECT-LIST, and IFF, to:
T.
Case 2. (IMPLIES
(AND (NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EQUAL (RES1 (SUB1 N) A P)
(IFF (EVEN3 (PLUS-LIST (REM-LIST (SUB1 N) A P)))
(EVEN3 (PLUS-LIST (REFLECT-LIST (SUB1 N) A P)))))
(NOT (EVEN3 P)))
(EQUAL (RES1 N A P)
(IFF (EVEN3 (PLUS-LIST (REM-LIST N A P)))
(EVEN3 (PLUS-LIST (REFLECT-LIST N A P)))))),
which simplifies, rewriting with CDR-CONS, CAR-CONS, EVEN3-PLUS,
COMMUTATIVITY-OF-PLUS, and EVEN3-REM, and unfolding the definitions of ZEROP,
IFF, RES1, REM-LIST, PLUS-LIST, REFLECT-LIST, REFLECT, and EQUAL, to the
following four new goals:
Case 2.4.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EVEN3 (PLUS-LIST (REM-LIST (SUB1 N) A P)))
(EQUAL (RES1 (SUB1 N) A P)
(EVEN3 (PLUS-LIST (REFLECT-LIST (SUB1 N) A P))))
(NOT (EVEN3 P))
(NOT (EVEN3 (REMAINDER (TIMES A N) P)))
(NOT (RES1 (SUB1 N) A P)))
(EQUAL T
(IFF (EVEN3 (REMAINDER (TIMES A N) P))
(EQUAL (RES1 (SUB1 N) A P) T)))).
This again simplifies, expanding the definitions of EQUAL and IFF, to:
T.
Case 2.3.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EVEN3 (PLUS-LIST (REM-LIST (SUB1 N) A P)))
(EQUAL (RES1 (SUB1 N) A P)
(EVEN3 (PLUS-LIST (REFLECT-LIST (SUB1 N) A P))))
(NOT (EVEN3 P))
(NOT (EVEN3 (REMAINDER (TIMES A N) P)))
(RES1 (SUB1 N) A P))
(EQUAL F
(IFF (EVEN3 (REMAINDER (TIMES A N) P))
(EQUAL (RES1 (SUB1 N) A P) T)))),
which again simplifies, unfolding EQUAL and IFF, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EVEN3 (PLUS-LIST (REM-LIST (SUB1 N) A P)))
(EQUAL (RES1 (SUB1 N) A P)
(EVEN3 (PLUS-LIST (REFLECT-LIST (SUB1 N) A P))))
(NOT (EVEN3 P))
(EVEN3 (REMAINDER (TIMES A N) P))
(NOT (RES1 (SUB1 N) A P)))
(EQUAL T
(IFF (EVEN3 (REMAINDER (TIMES A N) P))
(EQUAL (RES1 (SUB1 N) A P) F)))),
which again simplifies, unfolding EQUAL and IFF, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EVEN3 (PLUS-LIST (REM-LIST (SUB1 N) A P)))
(EQUAL (RES1 (SUB1 N) A P)
(EVEN3 (PLUS-LIST (REFLECT-LIST (SUB1 N) A P))))
(NOT (EVEN3 P))
(EVEN3 (REMAINDER (TIMES A N) P))
(RES1 (SUB1 N) A P))
(EQUAL F
(IFF (EVEN3 (REMAINDER (TIMES A N) P))
(EQUAL (RES1 (SUB1 N) A P) F)))),
which again simplifies, unfolding the definitions of EQUAL and IFF, to:
T.
Case 1. (IMPLIES
(AND (NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EQUAL (RES1 (SUB1 N) A P)
(IFF (EVEN3 (PLUS-LIST (REM-LIST (SUB1 N) A P)))
(EVEN3 (PLUS-LIST (REFLECT-LIST (SUB1 N) A P)))))
(NOT (EVEN3 P)))
(EQUAL (RES1 N A P)
(IFF (EVEN3 (PLUS-LIST (REM-LIST N A P)))
(EVEN3 (PLUS-LIST (REFLECT-LIST N A P)))))),
which simplifies, applying CDR-CONS, CAR-CONS, and EVEN3-PLUS, and opening
up ZEROP, IFF, RES1, REM-LIST, PLUS-LIST, REFLECT-LIST, and EQUAL, to the
following three new formulas:
Case 1.3.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EVEN3 (PLUS-LIST (REM-LIST (SUB1 N) A P)))
(EQUAL (RES1 (SUB1 N) A P)
(EVEN3 (PLUS-LIST (REFLECT-LIST (SUB1 N) A P))))
(NOT (EVEN3 P))
(NOT (EVEN3 (REMAINDER (TIMES A N) P)))
(EQUAL (EVEN3 (REMAINDER (TIMES A N) P))
(RES1 (SUB1 N) A P)))
(EQUAL (RES1 (SUB1 N) A P) F)).
This again simplifies, trivially, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EVEN3 (PLUS-LIST (REM-LIST (SUB1 N) A P)))
(EQUAL (RES1 (SUB1 N) A P)
(EVEN3 (PLUS-LIST (REFLECT-LIST (SUB1 N) A P))))
(NOT (EVEN3 P))
(NOT (EVEN3 (REMAINDER (TIMES A N) P)))
(NOT (EQUAL (EVEN3 (REMAINDER (TIMES A N) P))
(RES1 (SUB1 N) A P))))
(EQUAL (RES1 (SUB1 N) A P) T)).
This again simplifies, clearly, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EVEN3 (PLUS-LIST (REM-LIST (SUB1 N) A P)))
(EQUAL (RES1 (SUB1 N) A P)
(EVEN3 (PLUS-LIST (REFLECT-LIST (SUB1 N) A P))))
(NOT (EVEN3 P))
(EVEN3 (REMAINDER (TIMES A N) P)))
(EQUAL (RES1 (SUB1 N) A P)
(EQUAL (EVEN3 (REMAINDER (TIMES A N) P))
(RES1 (SUB1 N) A P)))).
This again simplifies, trivially, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 1.7 0.0 ]
EVEN3-REM-REFLECT
(PROVE-LEMMA PERM-PLUS-LIST-1
(REWRITE)
(IMPLIES (MEMBER X M)
(EQUAL (PLUS X (PLUS-LIST (DELETE X M)))
(PLUS-LIST M))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the newly proposed PERM-PLUS-LIST-1 could!
Name the conjecture *1.
Perhaps we can prove it by induction. Four inductions are suggested by
terms in the conjecture. They merge into two likely candidate inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (NLISTP M) (p X M))
(IMPLIES (AND (NOT (NLISTP M))
(EQUAL X (CAR M)))
(p X M))
(IMPLIES (AND (NOT (NLISTP M))
(NOT (EQUAL X (CAR M)))
(p X (CDR M)))
(p X M))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP inform us that the measure (COUNT M) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme leads to the following four new conjectures:
Case 4. (IMPLIES (AND (NLISTP M) (MEMBER X M))
(EQUAL (PLUS X (PLUS-LIST (DELETE X M)))
(PLUS-LIST M))).
This simplifies, opening up NLISTP and MEMBER, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP M))
(EQUAL X (CAR M))
(MEMBER X M))
(EQUAL (PLUS X (PLUS-LIST (DELETE X M)))
(PLUS-LIST M))).
This simplifies, unfolding the definitions of NLISTP, MEMBER, DELETE, and
PLUS-LIST, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP M))
(NOT (EQUAL X (CAR M)))
(NOT (MEMBER X (CDR M)))
(MEMBER X M))
(EQUAL (PLUS X (PLUS-LIST (DELETE X M)))
(PLUS-LIST M))).
This simplifies, expanding NLISTP and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP M))
(NOT (EQUAL X (CAR M)))
(EQUAL (PLUS X
(PLUS-LIST (DELETE X (CDR M))))
(PLUS-LIST (CDR M)))
(MEMBER X M))
(EQUAL (PLUS X (PLUS-LIST (DELETE X M)))
(PLUS-LIST M))).
This simplifies, applying CDR-CONS, CAR-CONS, and CORRECTNESS-OF-CANCEL, and
opening up the definitions of NLISTP, MEMBER, DELETE, PLUS-LIST, and FIX, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
PERM-PLUS-LIST-1
(PROVE-LEMMA PERM-PLUS-LIST NIL
(IMPLIES (PERM L M)
(EQUAL (PLUS-LIST L) (PLUS-LIST M))))
Name the conjecture *1.
We will appeal to induction. The recursive terms in the conjecture
suggest four 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 (NLISTP L) (p L M))
(IMPLIES (AND (NOT (NLISTP L))
(MEMBER (CAR L) M)
(p (CDR L) (DELETE (CAR L) M)))
(p L M))
(IMPLIES (AND (NOT (NLISTP L))
(NOT (MEMBER (CAR L) M)))
(p L M))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP inform us that the measure (COUNT L) decreases according to the
well-founded relation LESSP in each induction step of the scheme. Note,
however, the inductive instance chosen for M. The above induction scheme
produces the following four new formulas:
Case 4. (IMPLIES (AND (NLISTP L) (PERM L M))
(EQUAL (PLUS-LIST L) (PLUS-LIST M))).
This simplifies, expanding the definitions of NLISTP, PERM, PLUS-LIST, and
EQUAL, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP L))
(MEMBER (CAR L) M)
(NOT (PERM (CDR L) (DELETE (CAR L) M)))
(PERM L M))
(EQUAL (PLUS-LIST L) (PLUS-LIST M))).
This simplifies, applying PERM-MEMBER, and expanding the definitions of
NLISTP, MEMBER, and PERM, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP L))
(MEMBER (CAR L) M)
(EQUAL (PLUS-LIST (CDR L))
(PLUS-LIST (DELETE (CAR L) M)))
(PERM L M))
(EQUAL (PLUS-LIST L) (PLUS-LIST M))),
which simplifies, rewriting with the lemma PERM-MEMBER, and opening up the
functions NLISTP, MEMBER, PERM, and PLUS-LIST, to the goal:
(IMPLIES (AND (LISTP L)
(EQUAL (PLUS-LIST (CDR L))
(PLUS-LIST (DELETE (CAR L) M)))
(MEMBER (CAR L) M)
(PERM (CDR L) (DELETE (CAR L) M)))
(EQUAL (PLUS (CAR L) (PLUS-LIST (CDR L)))
(PLUS-LIST M))).
Appealing to the lemma CAR-CDR-ELIM, we now replace L by (CONS Z X) to
eliminate (CDR L) and (CAR L). This generates:
(IMPLIES (AND (EQUAL (PLUS-LIST X)
(PLUS-LIST (DELETE Z M)))
(MEMBER Z M)
(PERM X (DELETE Z M)))
(EQUAL (PLUS Z (PLUS-LIST X))
(PLUS-LIST M))).
We use the above equality hypothesis by substituting
(PLUS-LIST (DELETE Z M)) for (PLUS-LIST X) and throwing away the equality.
This produces:
(IMPLIES (AND (MEMBER Z M)
(PERM X (DELETE Z M)))
(EQUAL (PLUS Z (PLUS-LIST (DELETE Z M)))
(PLUS-LIST M))),
which further simplifies, applying PERM-PLUS-LIST-1, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP L))
(NOT (MEMBER (CAR L) M))
(PERM L M))
(EQUAL (PLUS-LIST L) (PLUS-LIST M))).
This simplifies, applying the lemma PERM-MEMBER, and opening up NLISTP and
MEMBER, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
PERM-PLUS-LIST
(PROVE-LEMMA EVEN3-EVEN NIL
(EQUAL (DIVIDES 2 P) (EVEN3 P)))
This conjecture can be simplified, using the abbreviation DIVIDES, to:
(EQUAL (EQUAL (REMAINDER P 2) 0)
(EVEN3 P)).
This simplifies, clearly, to the following two new formulas:
Case 2. (IMPLIES (NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EVEN3 P))).
This again simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, and opening up the definition of EQUAL, to the new
goal:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL 1 0)))
(NOT (EVEN3 P))),
which again simplifies, expanding EQUAL, to:
(IMPLIES (EQUAL (REMAINDER P 2) 1)
(NOT (EVEN3 P))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace P by
(PLUS X (TIMES 2 Z)) to eliminate (REMAINDER P 2) and (QUOTIENT P 2). We
employ LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER was
introduced, and the type restriction lemma noted when QUOTIENT was
introduced to constrain the new variables. The result is four new goals:
Case 2.4.
(IMPLIES (AND (NOT (NUMBERP P))
(EQUAL (REMAINDER P 2) 1))
(NOT (EVEN3 P))),
which further simplifies, opening up LESSP, NUMBERP, EQUAL, and REMAINDER,
to:
T.
Case 2.3.
(IMPLIES (AND (EQUAL 2 0)
(EQUAL (REMAINDER P 2) 1))
(NOT (EVEN3 P))),
which further simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP 2))
(EQUAL (REMAINDER P 2) 1))
(NOT (EVEN3 P))),
which further simplifies, obviously, to:
T.
Case 2.1.
(IMPLIES (AND (NUMBERP X)
(EQUAL (LESSP X 2) (NOT (ZEROP 2)))
(NUMBERP Z)
(NOT (EQUAL 2 0))
(EQUAL X 1))
(NOT (EVEN3 (PLUS X (TIMES 2 Z))))).
This further simplifies, rewriting with TIMES-2 and EVEN3-PLUS, and
expanding the functions NUMBERP, LESSP, ZEROP, NOT, EQUAL, and EVEN3, to:
T.
Case 1. (IMPLIES (EQUAL (REMAINDER P 2) 0)
(EQUAL (EVEN3 P) T)).
This again simplifies, trivially, to:
(IMPLIES (EQUAL (REMAINDER P 2) 0)
(EVEN3 P)).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace P by
(PLUS X (TIMES 2 Z)) to eliminate (REMAINDER P 2) and (QUOTIENT P 2). We
rely upon LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER
was introduced, and the type restriction lemma noted when QUOTIENT was
introduced to restrict the new variables. This produces the following four
new conjectures:
Case 1.4.
(IMPLIES (AND (NOT (NUMBERP P))
(EQUAL (REMAINDER P 2) 0))
(EVEN3 P)).
This further simplifies, expanding the definitions of LESSP, NUMBERP,
EQUAL, REMAINDER, and EVEN3, to:
T.
Case 1.3.
(IMPLIES (AND (EQUAL 2 0)
(EQUAL (REMAINDER P 2) 0))
(EVEN3 P)),
which further simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP 2))
(EQUAL (REMAINDER P 2) 0))
(EVEN3 P)),
which further simplifies, clearly, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP X)
(EQUAL (LESSP X 2) (NOT (ZEROP 2)))
(NUMBERP Z)
(NOT (EQUAL 2 0))
(EQUAL X 0))
(EVEN3 (PLUS X (TIMES 2 Z)))).
But this further simplifies, applying the lemmas TIMES-2 and EVEN3-PLUS,
and opening up the definitions of NUMBERP, LESSP, ZEROP, NOT, EQUAL, and
EVEN3, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
EVEN3-EVEN
(PROVE-LEMMA PLUS-REFLECT-LIST
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(NOT (EVEN3 P)))
(EQUAL (PLUS-LIST (REFLECT-LIST (QUOTIENT P 2) A P))
(PLUS-LIST (POSITIVES (QUOTIENT P 2)))))
((USE (PERM-PLUS-LIST (M (REFLECT-LIST (QUOTIENT P 2) A P))
(L (POSITIVES (QUOTIENT P 2))))
(PIGEON-HOLE-PRINCIPLE (L (REFLECT-LIST (QUOTIENT P 2) A P)))
(EVEN3-EVEN)
(ALL-NON-ZEROP-REFLECT-LIST (B (QUOTIENT P 2))))
(DISABLE PRIME)))
This formula can be simplified, using the abbreviations NOT, IMPLIES, AND, and
DIVIDES, to:
(IMPLIES
(AND
(IMPLIES (PERM (POSITIVES (QUOTIENT P 2))
(REFLECT-LIST (QUOTIENT P 2) A P))
(EQUAL (PLUS-LIST (POSITIVES (QUOTIENT P 2)))
(PLUS-LIST (REFLECT-LIST (QUOTIENT P 2) A P))))
(IMPLIES (AND (ALL-NON-ZEROP (REFLECT-LIST (QUOTIENT P 2) A P))
(ALL-DISTINCT (REFLECT-LIST (QUOTIENT P 2) A P))
(ALL-LESSEQP (REFLECT-LIST (QUOTIENT P 2) A P)
(LENGTH (REFLECT-LIST (QUOTIENT P 2) A P))))
(PERM (POSITIVES (LENGTH (REFLECT-LIST (QUOTIENT P 2) A P)))
(REFLECT-LIST (QUOTIENT P 2) A P)))
(EQUAL (EQUAL (REMAINDER P 2) 0)
(EVEN3 P))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(LESSP (QUOTIENT P 2) P))
(ALL-NON-ZEROP (REFLECT-LIST (QUOTIENT P 2) A P)))
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EVEN3 P)))
(EQUAL (PLUS-LIST (REFLECT-LIST (QUOTIENT P 2) A P))
(PLUS-LIST (POSITIVES (QUOTIENT P 2))))),
which simplifies, rewriting with the lemmas LENGTH-REFLECT-LIST,
ALL-LESSEQP-REFLECT-LIST, LESSP-QUOTIENT1, and REMAINDER-WRT-12, and opening
up the definitions of IMPLIES, AND, NOT, EQUAL, NUMBERP, PRIME, and EVEN3, to
the goal:
(IMPLIES (AND (NOT (PERM (POSITIVES (QUOTIENT P 2))
(REFLECT-LIST (QUOTIENT P 2) A P)))
(NOT (ALL-DISTINCT (REFLECT-LIST (QUOTIENT P 2) A P)))
(NOT (EQUAL (REMAINDER P 2) 0))
(ALL-NON-ZEROP (REFLECT-LIST (QUOTIENT P 2) A P))
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EVEN3 P)))
(EQUAL (PLUS-LIST (REFLECT-LIST (QUOTIENT P 2) A P))
(PLUS-LIST (POSITIVES (QUOTIENT P 2))))).
But this again simplifies, using linear arithmetic, rewriting with the lemma
LESSP-REMAINDER-DIVISOR, and unfolding the function EQUAL, to the conjecture:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (PERM (POSITIVES (QUOTIENT P 2))
(REFLECT-LIST (QUOTIENT P 2) A P)))
(NOT (ALL-DISTINCT (REFLECT-LIST (QUOTIENT P 2) A P)))
(NOT (EQUAL 1 0))
(ALL-NON-ZEROP (REFLECT-LIST (QUOTIENT P 2) A P))
(PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EVEN3 P)))
(EQUAL (PLUS-LIST (REFLECT-LIST (QUOTIENT P 2) A P))
(PLUS-LIST (POSITIVES (QUOTIENT P 2))))).
But this again simplifies, using linear arithmetic, appealing to the lemma
ALL-DISTINCT-REFLECT-LIST, and expanding the functions DIVIDES and EQUAL, to:
T.
Q.E.D.
[ 0.0 4.3 0.0 ]
PLUS-REFLECT-LIST
(PROVE-LEMMA EQUALS-HAVE-SAME-PARITY NIL
(IMPLIES (EQUAL X Y)
(EQUAL (EVEN3 X) (EVEN3 Y))))
This conjecture simplifies, clearly, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EQUALS-HAVE-SAME-PARITY
(PROVE-LEMMA RES1-QUOT-LIST NIL
(IMPLIES (AND (PRIME P)
(NOT (EVEN3 P))
(NOT (EVEN3 A))
(NOT (DIVIDES P A)))
(EQUAL (RES1 (QUOTIENT P 2) A P)
(EVEN3 (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P)))))
((USE
(REM-QUOT-LIST (N (QUOTIENT P 2)))
(EQUALS-HAVE-SAME-PARITY
(X (TIMES A
(PLUS-LIST (POSITIVES (QUOTIENT P 2)))))
(Y (PLUS (TIMES P
(PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P)))
(PLUS-LIST (REM-LIST (QUOTIENT P 2) A P))))))
(DISABLE PRIME)))
This formula can be simplified, using the abbreviations NOT, IMPLIES, AND,
DIVIDES, and EVEN3-PLUS, to the new conjecture:
(IMPLIES
(AND
(EQUAL (TIMES A
(PLUS-LIST (POSITIVES (QUOTIENT P 2))))
(PLUS (TIMES P
(PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P)))
(PLUS-LIST (REM-LIST (QUOTIENT P 2) A P))))
(IMPLIES
(EQUAL (TIMES A
(PLUS-LIST (POSITIVES (QUOTIENT P 2))))
(PLUS (TIMES P
(PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P)))
(PLUS-LIST (REM-LIST (QUOTIENT P 2) A P))))
(EQUAL
(EVEN3 (TIMES A
(PLUS-LIST (POSITIVES (QUOTIENT P 2)))))
(EQUAL (EVEN3 (TIMES P
(PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P))))
(EVEN3 (PLUS-LIST (REM-LIST (QUOTIENT P 2) A P))))))
(PRIME P)
(NOT (EVEN3 P))
(NOT (EVEN3 A))
(NOT (EQUAL (REMAINDER A P) 0)))
(EQUAL (RES1 (QUOTIENT P 2) A P)
(EVEN3 (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P))))),
which simplifies, using linear arithmetic, applying COMMUTATIVITY-OF-PLUS,
EVEN3-TIMES, PLUS-REFLECT-LIST, and EVEN3-REM-REFLECT, and unfolding IMPLIES
and DIVIDES, to the following two new formulas:
Case 2. (IMPLIES
(AND (EQUAL (TIMES A
(PLUS-LIST (POSITIVES (QUOTIENT P 2))))
(PLUS (PLUS-LIST (REM-LIST (QUOTIENT P 2) A P))
(TIMES P
(PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P)))))
(NOT (EQUAL (EVEN3 (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P)))
(EVEN3 (PLUS-LIST (REM-LIST (QUOTIENT P 2) A P)))))
(NOT (EVEN3 (PLUS-LIST (POSITIVES (QUOTIENT P 2)))))
(PRIME P)
(NOT (EVEN3 P))
(NOT (EVEN3 A))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EVEN3 (PLUS-LIST (REM-LIST (QUOTIENT P 2) A P)))))
(EQUAL T
(EVEN3 (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P))))).
This again simplifies, unfolding EQUAL, to:
T.
Case 1. (IMPLIES
(AND (EQUAL (TIMES A
(PLUS-LIST (POSITIVES (QUOTIENT P 2))))
(PLUS (PLUS-LIST (REM-LIST (QUOTIENT P 2) A P))
(TIMES P
(PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P)))))
(NOT (EQUAL (EVEN3 (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P)))
(EVEN3 (PLUS-LIST (REM-LIST (QUOTIENT P 2) A P)))))
(NOT (EVEN3 (PLUS-LIST (POSITIVES (QUOTIENT P 2)))))
(PRIME P)
(NOT (EVEN3 P))
(NOT (EVEN3 A))
(NOT (EQUAL (REMAINDER A P) 0))
(EVEN3 (PLUS-LIST (REM-LIST (QUOTIENT P 2) A P))))
(EQUAL F
(EVEN3 (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) A P))))),
which again simplifies, expanding the function EQUAL, to:
T.
Q.E.D.
[ 0.0 2.8 0.0 ]
RES1-QUOT-LIST
(DEFN WINS1
(X L)
(IF (NLISTP L)
0
(IF (LESSP (CAR L) X)
(ADD1 (WINS1 X (CDR L)))
(WINS1 X (CDR L)))))
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the
definition of NLISTP establish that the measure (COUNT L) decreases according
to the well-founded relation LESSP in each recursive call. Hence, WINS1 is
accepted under the principle of definition. From the definition we can
conclude that (NUMBERP (WINS1 X L)) is a theorem.
[ 0.0 0.0 0.0 ]
WINS1
(DEFN WINS
(K L)
(IF (NLISTP K)
0
(PLUS (WINS1 (CAR K) L)
(WINS (CDR K) L))))
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the
definition of NLISTP inform us that the measure (COUNT K) decreases according
to the well-founded relation LESSP in each recursive call. Hence, WINS is
accepted under the principle of definition. Note that (NUMBERP (WINS K L)) is
a theorem.
[ 0.0 0.0 0.0 ]
WINS
(DEFN LOSSES1
(X L)
(IF (NLISTP L)
0
(IF (LESSP X (CAR L))
(ADD1 (LOSSES1 X (CDR L)))
(LOSSES1 X (CDR L)))))
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the
definition of NLISTP establish that the measure (COUNT L) decreases according
to the well-founded relation LESSP in each recursive call. Hence, LOSSES1 is
accepted under the principle of definition. From the definition we can
conclude that (NUMBERP (LOSSES1 X L)) is a theorem.
[ 0.0 0.0 0.0 ]
LOSSES1
(DEFN LOSSES
(K L)
(IF (NLISTP K)
0
(PLUS (LOSSES1 (CAR K) L)
(LOSSES (CDR K) L))))
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the
definition of NLISTP inform us that the measure (COUNT K) decreases according
to the well-founded relation LESSP in each recursive call. Hence, LOSSES is
accepted under the principle of definition. Note that (NUMBERP (LOSSES K L))
is a theorem.
[ 0.0 0.0 0.0 ]
LOSSES
(PROVE-LEMMA WIN-SOME-LOSE-SOME-1
(REWRITE)
(IMPLIES (AND (NOT (MEMBER X L))
(ALL-NON-ZEROP L))
(EQUAL (PLUS (LOSSES1 X L) (WINS1 X L))
(LENGTH L))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the newly proposed WIN-SOME-LOSE-SOME-1 could!
Name the conjecture *1.
Perhaps we can prove it by induction. There are five plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (NLISTP L) (p X L))
(IMPLIES (AND (NOT (NLISTP L))
(EQUAL X (CAR L)))
(p X L))
(IMPLIES (AND (NOT (NLISTP L))
(NOT (EQUAL X (CAR L)))
(p X (CDR L)))
(p X L))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP establish that the measure (COUNT L) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme leads to the following five new formulas:
Case 5. (IMPLIES (AND (NLISTP L)
(NOT (MEMBER X L))
(ALL-NON-ZEROP L))
(EQUAL (PLUS (LOSSES1 X L) (WINS1 X L))
(LENGTH L))).
This simplifies, opening up the definitions of NLISTP, MEMBER, ALL-NON-ZEROP,
LOSSES1, WINS1, PLUS, LENGTH, and EQUAL, to:
T.
Case 4. (IMPLIES (AND (NOT (NLISTP L))
(EQUAL X (CAR L))
(NOT (MEMBER X L))
(ALL-NON-ZEROP L))
(EQUAL (PLUS (LOSSES1 X L) (WINS1 X L))
(LENGTH L))).
This simplifies, expanding NLISTP and MEMBER, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP L))
(NOT (EQUAL X (CAR L)))
(MEMBER X (CDR L))
(NOT (MEMBER X L))
(ALL-NON-ZEROP L))
(EQUAL (PLUS (LOSSES1 X L) (WINS1 X L))
(LENGTH L))).
This simplifies, unfolding NLISTP and MEMBER, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP L))
(NOT (EQUAL X (CAR L)))
(NOT (ALL-NON-ZEROP (CDR L)))
(NOT (MEMBER X L))
(ALL-NON-ZEROP L))
(EQUAL (PLUS (LOSSES1 X L) (WINS1 X L))
(LENGTH L))).
This simplifies, unfolding the functions NLISTP, MEMBER, and ALL-NON-ZEROP,
to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP L))
(NOT (EQUAL X (CAR L)))
(EQUAL (PLUS (LOSSES1 X (CDR L))
(WINS1 X (CDR L)))
(LENGTH (CDR L)))
(NOT (MEMBER X L))
(ALL-NON-ZEROP L))
(EQUAL (PLUS (LOSSES1 X L) (WINS1 X L))
(LENGTH L))).
This simplifies, unfolding the functions NLISTP, MEMBER, ALL-NON-ZEROP,
LOSSES1, WINS1, and LENGTH, to the following four new formulas:
Case 1.4.
(IMPLIES (AND (LISTP L)
(NOT (EQUAL X (CAR L)))
(EQUAL (PLUS (LOSSES1 X (CDR L))
(WINS1 X (CDR L)))
(LENGTH (CDR L)))
(NOT (MEMBER X (CDR L)))
(NOT (EQUAL (CAR L) 0))
(NUMBERP (CAR L))
(ALL-NON-ZEROP (CDR L))
(NOT (LESSP (CAR L) X))
(NOT (LESSP X (CAR L))))
(EQUAL (PLUS (LOSSES1 X (CDR L))
(WINS1 X (CDR L)))
(ADD1 (LENGTH (CDR L))))).
This again simplifies, using linear arithmetic, to:
(IMPLIES (AND (NOT (NUMBERP X))
(LISTP L)
(NOT (EQUAL X (CAR L)))
(EQUAL (PLUS (LOSSES1 X (CDR L))
(WINS1 X (CDR L)))
(LENGTH (CDR L)))
(NOT (MEMBER X (CDR L)))
(NOT (EQUAL (CAR L) 0))
(NUMBERP (CAR L))
(ALL-NON-ZEROP (CDR L))
(NOT (LESSP (CAR L) X))
(NOT (LESSP X (CAR L))))
(EQUAL (PLUS (LOSSES1 X (CDR L))
(WINS1 X (CDR L)))
(ADD1 (LENGTH (CDR L))))).
However this again simplifies, unfolding LESSP, to:
T.
Case 1.3.
(IMPLIES (AND (LISTP L)
(NOT (EQUAL X (CAR L)))
(EQUAL (PLUS (LOSSES1 X (CDR L))
(WINS1 X (CDR L)))
(LENGTH (CDR L)))
(NOT (MEMBER X (CDR L)))
(NOT (EQUAL (CAR L) 0))
(NUMBERP (CAR L))
(ALL-NON-ZEROP (CDR L))
(NOT (LESSP (CAR L) X))
(LESSP X (CAR L)))
(EQUAL (PLUS (ADD1 (LOSSES1 X (CDR L)))
(WINS1 X (CDR L)))
(ADD1 (LENGTH (CDR L))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (LISTP L)
(NOT (EQUAL X (CAR L)))
(EQUAL (PLUS (LOSSES1 X (CDR L))
(WINS1 X (CDR L)))
(LENGTH (CDR L)))
(NOT (MEMBER X (CDR L)))
(NOT (EQUAL (CAR L) 0))
(NUMBERP (CAR L))
(ALL-NON-ZEROP (CDR L))
(LESSP (CAR L) X)
(NOT (LESSP X (CAR L))))
(EQUAL (PLUS (LOSSES1 X (CDR L))
(ADD1 (WINS1 X (CDR L))))
(ADD1 (LENGTH (CDR L))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (LISTP L)
(NOT (EQUAL X (CAR L)))
(EQUAL (PLUS (LOSSES1 X (CDR L))
(WINS1 X (CDR L)))
(LENGTH (CDR L)))
(NOT (MEMBER X (CDR L)))
(NOT (EQUAL (CAR L) 0))
(NUMBERP (CAR L))
(ALL-NON-ZEROP (CDR L))
(LESSP (CAR L) X)
(LESSP X (CAR L)))
(EQUAL (PLUS (ADD1 (LOSSES1 X (CDR L)))
(ADD1 (WINS1 X (CDR L))))
(ADD1 (LENGTH (CDR L))))),
which again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
WIN-SOME-LOSE-SOME-1
(PROVE-LEMMA WIN-SOME-LOSE-SOME-2
(REWRITE)
(IMPLIES (AND (NLISTP (INTERSECT L M))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (WINS L M) (LOSSES L M))
(TIMES (LENGTH L) (LENGTH M)))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the newly proposed WIN-SOME-LOSE-SOME-2 could!
This formula can be simplified, using the abbreviations NLISTP, AND, IMPLIES,
and INTERSECT, to the new conjecture:
(IMPLIES (AND (NOT (LISTP (FOR 'X1
L
'(MEMBER X1 Y)
'COLLECT
'X1
(LIST (CONS 'Y M)))))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (WINS L M) (LOSSES L M))
(TIMES (LENGTH L) (LENGTH M)))),
which simplifies, rewriting with COMMUTATIVITY-OF-PLUS, and opening up the
function EVAL$, to:
(IMPLIES (AND (NOT (LISTP (FOR X1 IN L WHEN
(MEMBER X1 M)
COLLECT X1)))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (LOSSES L M) (WINS L M))
(TIMES (LENGTH L) (LENGTH M)))),
which we will name *1.
Perhaps we can prove it by induction. 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 (NLISTP L) (p L M))
(IMPLIES (AND (NOT (NLISTP L))
(EVAL$ T
'(MEMBER X1 M)
(LIST (CONS 'X1 (CAR L))
(CONS 'M M)))
(p (CDR L) M))
(p L M))
(IMPLIES (AND (NOT (NLISTP L))
(NOT (EVAL$ T
'(MEMBER X1 M)
(LIST (CONS 'X1 (CAR L))
(CONS 'M M))))
(p (CDR L) M))
(p L M))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP inform us that the measure (COUNT L) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme generates the following seven new conjectures:
Case 7. (IMPLIES (AND (NLISTP L)
(NOT (LISTP (FOR X1 IN L WHEN
(MEMBER X1 M)
COLLECT X1)))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (LOSSES L M) (WINS L M))
(TIMES (LENGTH L) (LENGTH M)))).
This simplifies, rewriting with TIMES-IDENTITY, and expanding the functions
NLISTP, MEMBER, FOR, CDR, ASSOC, QUANTIFIER-INITIAL-VALUE, LISTP,
ALL-NON-ZEROP, LOSSES, WINS, PLUS, LENGTH, and EQUAL, to:
T.
Case 6. (IMPLIES (AND (NOT (NLISTP L))
(EVAL$ T
'(MEMBER X1 M)
(LIST (CONS 'X1 (CAR L))
(CONS 'M M)))
(LISTP (FOR X1 IN
(CDR L)
WHEN
(MEMBER X1 M)
COLLECT X1))
(NOT (LISTP (FOR X1 IN L WHEN
(MEMBER X1 M)
COLLECT X1)))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (LOSSES L M) (WINS L M))
(TIMES (LENGTH L) (LENGTH M)))),
which simplifies, rewriting with REWRITE-EVAL$, and expanding NLISTP, EVAL$,
FOR, EQUAL, and QUANTIFIER-OPERATION, to:
T.
Case 5. (IMPLIES (AND (NOT (NLISTP L))
(EVAL$ T
'(MEMBER X1 M)
(LIST (CONS 'X1 (CAR L))
(CONS 'M M)))
(NOT (ALL-NON-ZEROP (CDR L)))
(NOT (LISTP (FOR X1 IN L WHEN
(MEMBER X1 M)
COLLECT X1)))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (LOSSES L M) (WINS L M))
(TIMES (LENGTH L) (LENGTH M)))).
This simplifies, rewriting with the lemma REWRITE-EVAL$, and expanding the
functions NLISTP, EVAL$, FOR, EQUAL, and QUANTIFIER-OPERATION, to:
T.
Case 4. (IMPLIES (AND (NOT (NLISTP L))
(EVAL$ T
'(MEMBER X1 M)
(LIST (CONS 'X1 (CAR L))
(CONS 'M M)))
(EQUAL (PLUS (LOSSES (CDR L) M)
(WINS (CDR L) M))
(TIMES (LENGTH (CDR L)) (LENGTH M)))
(NOT (LISTP (FOR X1 IN L WHEN
(MEMBER X1 M)
COLLECT X1)))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (LOSSES L M) (WINS L M))
(TIMES (LENGTH L) (LENGTH M)))).
This simplifies, applying the lemmas REWRITE-EVAL$ and
COMMUTATIVITY-OF-TIMES, and unfolding the functions NLISTP, EVAL$, FOR,
EQUAL, and QUANTIFIER-OPERATION, to:
T.
Case 3. (IMPLIES (AND (NOT (NLISTP L))
(NOT (EVAL$ T
'(MEMBER X1 M)
(LIST (CONS 'X1 (CAR L))
(CONS 'M M))))
(LISTP (FOR X1 IN
(CDR L)
WHEN
(MEMBER X1 M)
COLLECT X1))
(NOT (LISTP (FOR X1 IN L WHEN
(MEMBER X1 M)
COLLECT X1)))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (LOSSES L M) (WINS L M))
(TIMES (LENGTH L) (LENGTH M)))).
This simplifies, applying REWRITE-EVAL$, and expanding the functions NLISTP,
EVAL$, and FOR, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP L))
(NOT (EVAL$ T
'(MEMBER X1 M)
(LIST (CONS 'X1 (CAR L))
(CONS 'M M))))
(NOT (ALL-NON-ZEROP (CDR L)))
(NOT (LISTP (FOR X1 IN L WHEN
(MEMBER X1 M)
COLLECT X1)))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (LOSSES L M) (WINS L M))
(TIMES (LENGTH L) (LENGTH M)))),
which simplifies, appealing to the lemma REWRITE-EVAL$, and unfolding the
functions NLISTP, EVAL$, FOR, and ALL-NON-ZEROP, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP L))
(NOT (EVAL$ T
'(MEMBER X1 M)
(LIST (CONS 'X1 (CAR L))
(CONS 'M M))))
(EQUAL (PLUS (LOSSES (CDR L) M)
(WINS (CDR L) M))
(TIMES (LENGTH (CDR L)) (LENGTH M)))
(NOT (LISTP (FOR X1 IN L WHEN
(MEMBER X1 M)
COLLECT X1)))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (LOSSES L M) (WINS L M))
(TIMES (LENGTH L) (LENGTH M)))),
which simplifies, rewriting with the lemmas REWRITE-EVAL$,
COMMUTATIVITY-OF-TIMES, COMMUTATIVITY-OF-PLUS, ASSOCIATIVITY-OF-PLUS, and
TIMES-ADD1, and unfolding the definitions of NLISTP, EVAL$, FOR,
ALL-NON-ZEROP, LOSSES, WINS, and LENGTH, to:
(IMPLIES (AND (LISTP L)
(NOT (MEMBER (CAR L) M))
(EQUAL (PLUS (LOSSES (CDR L) M)
(WINS (CDR L) M))
(TIMES (LENGTH M) (LENGTH (CDR L))))
(NOT (LISTP (FOR X1 IN
(CDR L)
WHEN
(MEMBER X1 M)
COLLECT X1)))
(NOT (EQUAL (CAR L) 0))
(NUMBERP (CAR L))
(ALL-NON-ZEROP (CDR L))
(ALL-NON-ZEROP M))
(EQUAL (PLUS (LOSSES (CDR L) M)
(LOSSES1 (CAR L) M)
(WINS (CDR L) M)
(WINS1 (CAR L) M))
(PLUS (LENGTH M)
(TIMES (LENGTH M)
(LENGTH (CDR L)))))).
Appealing to the lemma CAR-CDR-ELIM, we now replace L by (CONS X Z) to
eliminate (CAR L) and (CDR L). The result is:
(IMPLIES (AND (NOT (MEMBER X M))
(EQUAL (PLUS (LOSSES Z M) (WINS Z M))
(TIMES (LENGTH M) (LENGTH Z)))
(NOT (LISTP (FOR X1 IN Z WHEN
(MEMBER X1 M)
COLLECT X1)))
(NOT (EQUAL X 0))
(NUMBERP X)
(ALL-NON-ZEROP Z)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (LOSSES Z M)
(LOSSES1 X M)
(WINS Z M)
(WINS1 X M))
(PLUS (LENGTH M)
(TIMES (LENGTH M) (LENGTH Z))))).
We now use the above equality hypothesis by substituting:
(PLUS (LOSSES Z M) (WINS Z M))
for (TIMES (LENGTH M) (LENGTH Z)) and throwing away the equality. This
produces the new formula:
(IMPLIES (AND (NOT (MEMBER X M))
(NOT (LISTP (FOR X1 IN Z WHEN
(MEMBER X1 M)
COLLECT X1)))
(NOT (EQUAL X 0))
(NUMBERP X)
(ALL-NON-ZEROP Z)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (LOSSES Z M)
(LOSSES1 X M)
(WINS Z M)
(WINS1 X M))
(PLUS (LENGTH M)
(LOSSES Z M)
(WINS Z M)))),
which further simplifies, rewriting with CORRECTNESS-OF-CANCEL and
WIN-SOME-LOSE-SOME-1, and unfolding the definitions of EVAL$ and FIX, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
WIN-SOME-LOSE-SOME-2
(PROVE-LEMMA EQUAL-LOSSES-WINS
(REWRITE)
(EQUAL (LOSSES L M) (WINS M L)))
Give the conjecture the name *1.
We will appeal to induction. Two inductions are suggested by terms in
the conjecture, both of which are flawed. We limit our consideration to the
two suggested by the largest number of nonprimitive recursive functions in the
conjecture. Since both of these are equally likely, we will choose
arbitrarily. We will induct according to the following scheme:
(AND (IMPLIES (NLISTP L) (p L M))
(IMPLIES (AND (NOT (NLISTP L)) (p (CDR L) M))
(p L M))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP inform us that the measure (COUNT L) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme produces the following two new conjectures:
Case 2. (IMPLIES (NLISTP L)
(EQUAL (LOSSES L M) (WINS M L))).
This simplifies, expanding the functions NLISTP and LOSSES, to the new goal:
(IMPLIES (NOT (LISTP L))
(EQUAL 0 (WINS M L))),
which we will name *1.1.
Case 1. (IMPLIES (AND (NOT (NLISTP L))
(EQUAL (LOSSES (CDR L) M)
(WINS M (CDR L))))
(EQUAL (LOSSES L M) (WINS M L))).
This simplifies, rewriting with COMMUTATIVITY-OF-PLUS, and expanding NLISTP
and LOSSES, to:
(IMPLIES (AND (LISTP L)
(EQUAL (LOSSES (CDR L) M)
(WINS M (CDR L))))
(EQUAL (PLUS (LOSSES (CDR L) M)
(LOSSES1 (CAR L) M))
(WINS M L))).
Appealing to the lemma CAR-CDR-ELIM, we now replace L by (CONS Z X) to
eliminate (CDR L) and (CAR L). This generates:
(IMPLIES (EQUAL (LOSSES X M) (WINS M X))
(EQUAL (PLUS (LOSSES X M) (LOSSES1 Z M))
(WINS M (CONS Z X)))).
We use the above equality hypothesis by substituting (WINS M X) for
(LOSSES X M) and throwing away the equality. We thus obtain:
(EQUAL (PLUS (WINS M X) (LOSSES1 Z M))
(WINS M (CONS Z X))),
which further simplifies, rewriting with COMMUTATIVITY-OF-PLUS, to the new
goal:
(EQUAL (PLUS (LOSSES1 Z M) (WINS M X))
(WINS M (CONS Z X))),
which we will name *1.2.
Perhaps we can prove it by induction. There are three plausible
inductions. However, they merge into one likely candidate induction. We will
induct according to the following scheme:
(AND (IMPLIES (NLISTP M) (p Z M X))
(IMPLIES (AND (NOT (NLISTP M))
(LESSP Z (CAR M))
(p Z (CDR M) X))
(p Z M X))
(IMPLIES (AND (NOT (NLISTP M))
(NOT (LESSP Z (CAR M)))
(p Z (CDR M) X))
(p Z M X))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP establish that the measure (COUNT M) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme leads to the following three new formulas:
Case 3. (IMPLIES (NLISTP M)
(EQUAL (PLUS (LOSSES1 Z M) (WINS M X))
(WINS M (CONS Z X)))).
This simplifies, opening up the definitions of NLISTP, LOSSES1, WINS, PLUS,
and EQUAL, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP M))
(LESSP Z (CAR M))
(EQUAL (PLUS (LOSSES1 Z (CDR M))
(WINS (CDR M) X))
(WINS (CDR M) (CONS Z X))))
(EQUAL (PLUS (LOSSES1 Z M) (WINS M X))
(WINS M (CONS Z X)))).
This simplifies, applying COMMUTATIVITY-OF-PLUS, PLUS-ADD1,
COMMUTATIVITY2-OF-PLUS, CDR-CONS, CAR-CONS, SUB1-ADD1, CORRECTNESS-OF-CANCEL,
and ADD1-EQUAL, and unfolding NLISTP, LOSSES1, WINS, WINS1, PLUS, and FIX,
to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP M))
(NOT (LESSP Z (CAR M)))
(EQUAL (PLUS (LOSSES1 Z (CDR M))
(WINS (CDR M) X))
(WINS (CDR M) (CONS Z X))))
(EQUAL (PLUS (LOSSES1 Z M) (WINS M X))
(WINS M (CONS Z X)))),
which simplifies, rewriting with COMMUTATIVITY-OF-PLUS, CDR-CONS, CAR-CONS,
and CORRECTNESS-OF-CANCEL, and expanding the functions NLISTP, LOSSES1, WINS,
WINS1, and FIX, to:
T.
That finishes the proof of *1.2.
So we now return to:
(IMPLIES (NOT (LISTP L))
(EQUAL 0 (WINS M L))),
named *1.1 above. We will appeal to induction. There is only one plausible
induction. We will induct according to the following scheme:
(AND (IMPLIES (NLISTP M) (p M L))
(IMPLIES (AND (NOT (NLISTP M)) (p (CDR M) L))
(p M L))).
Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of
NLISTP can be used to prove that the measure (COUNT M) decreases according to
the well-founded relation LESSP in each induction step of the scheme. The
above induction scheme produces two new goals:
Case 2. (IMPLIES (AND (NLISTP M) (NOT (LISTP L)))
(EQUAL 0 (WINS M L))),
which simplifies, expanding the functions NLISTP, WINS, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP M))
(EQUAL 0 (WINS (CDR M) L))
(NOT (LISTP L)))
(EQUAL 0 (WINS M L))),
which simplifies, unfolding NLISTP, WINS, WINS1, PLUS, and EQUAL, to:
T.
That finishes the proof of *1.1, which finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
EQUAL-LOSSES-WINS
(PROVE-LEMMA A-WINNER-EVERY-TIME
(REWRITE)
(IMPLIES (AND (NLISTP (INTERSECT L M))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (WINS L M) (WINS M L))
(TIMES (LENGTH L) (LENGTH M))))
((USE (WIN-SOME-LOSE-SOME-2))
(DISABLE WIN-SOME-LOSE-SOME-2)))
WARNING: the previously added lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the newly proposed A-WINNER-EVERY-TIME could!
This conjecture can be simplified, using the abbreviations NLISTP, AND,
IMPLIES, EQUAL-LOSSES-WINS, and INTERSECT, to:
(IMPLIES (AND (IMPLIES (AND (NLISTP (FOR 'X1
L
'(MEMBER X1 Y)
'COLLECT
'X1
(LIST (CONS 'Y M))))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (WINS L M) (WINS M L))
(TIMES (LENGTH L) (LENGTH M))))
(NOT (LISTP (FOR 'X1
L
'(MEMBER X1 Y)
'COLLECT
'X1
(LIST (CONS 'Y M)))))
(ALL-NON-ZEROP L)
(ALL-NON-ZEROP M))
(EQUAL (PLUS (WINS L M) (WINS M L))
(TIMES (LENGTH L) (LENGTH M)))).
This simplifies, unfolding EVAL$, NLISTP, AND, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
A-WINNER-EVERY-TIME
(DEFN MULTS
(N P)
(IF (ZEROP N)
NIL
(CONS (TIMES N P)
(MULTS (SUB1 N) P))))
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, MULTS is accepted
under the definitional principle. From the definition we can conclude that:
(OR (LITATOM (MULTS N P))
(LISTP (MULTS N P)))
is a theorem.
[ 0.0 0.0 0.0 ]
MULTS
(PROVE-LEMMA LENGTH-MULTS
(REWRITE)
(EQUAL (LENGTH (MULTS N P)) (FIX N)))
This simplifies, unfolding FIX, to two new formulas:
Case 2. (IMPLIES (NOT (NUMBERP N))
(EQUAL (LENGTH (MULTS N P)) 0)),
which again simplifies, unfolding MULTS, LENGTH, and EQUAL, to:
T.
Case 1. (IMPLIES (NUMBERP N)
(EQUAL (LENGTH (MULTS N P)) N)),
which we will name *1.
We will appeal to induction. There is only one plausible induction. We
will induct according to the following scheme:
(AND (IMPLIES (ZEROP N) (p N P))
(IMPLIES (AND (NOT (ZEROP N)) (p (SUB1 N) P))
(p N P))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform
us that the measure (COUNT N) decreases according to the well-founded relation
LESSP in each induction step of the scheme. The above induction scheme
generates the following two new goals:
Case 2. (IMPLIES (AND (ZEROP N) (NUMBERP N))
(EQUAL (LENGTH (MULTS N P)) N)).
This simplifies, opening up the definitions of ZEROP, NUMBERP, EQUAL, MULTS,
and LENGTH, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(EQUAL (LENGTH (MULTS (SUB1 N) P))
(SUB1 N))
(NUMBERP N))
(EQUAL (LENGTH (MULTS N P)) N)).
This simplifies, applying ADD1-SUB1 and CDR-CONS, and expanding ZEROP, MULTS,
and LENGTH, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LENGTH-MULTS
(PROVE-LEMMA LEQ-N-WINS1 NIL
(IMPLIES (LESSP (TIMES N P) A)
(LEQ N (WINS1 A (MULTS N P))))
((INDUCT (MULTS N P))))
This conjecture can be simplified, using the abbreviations ZEROP, IMPLIES, NOT,
OR, and AND, to two new goals:
Case 2. (IMPLIES (AND (ZEROP N) (LESSP (TIMES N P) A))
(NOT (LESSP (WINS1 A (MULTS N P)) N))),
which simplifies, rewriting with TIMES-IDENTITY and EQUAL-TIMES-0, and
unfolding the functions ZEROP, EQUAL, LESSP, MULTS, LISTP, and WINS1, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(IMPLIES (LESSP (TIMES (SUB1 N) P) A)
(IF (LESSP (WINS1 A (MULTS (SUB1 N) P))
(SUB1 N))
F T))
(LESSP (TIMES N P) A))
(NOT (LESSP (WINS1 A (MULTS N P)) N))).
This simplifies, applying COMMUTATIVITY-OF-TIMES, CDR-CONS, CAR-CONS, and
SUB1-ADD1, and opening up the definitions of IMPLIES, MULTS, WINS1, and
LESSP, to:
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (TIMES P (SUB1 N)) A))
(LESSP (TIMES N P) A))
(NOT (LESSP (WINS1 A (MULTS (SUB1 N) P))
(SUB1 N)))).
Appealing to the lemma SUB1-ELIM, we now replace N by (ADD1 X) to eliminate
(SUB1 N). We rely upon the type restriction lemma noted when SUB1 was
introduced to constrain the new variable. This generates:
(IMPLIES (AND (NUMBERP X)
(NOT (EQUAL (ADD1 X) 0))
(NOT (LESSP (TIMES P X) A))
(LESSP (TIMES (ADD1 X) P) A))
(NOT (LESSP (WINS1 A (MULTS X P)) X))).
This further simplifies, rewriting with TIMES-ADD1 and
COMMUTATIVITY-OF-TIMES, to:
(IMPLIES (AND (NUMBERP X)
(NOT (LESSP (TIMES P X) A))
(LESSP (PLUS P (TIMES P X)) A))
(NOT (LESSP (WINS1 A (MULTS X P)) X))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LEQ-N-WINS1
(PROVE-LEMMA MONOTONE-WINS1 NIL
(IMPLIES (LEQ N M)
(LEQ (WINS1 A (MULTS N P))
(WINS1 A (MULTS M P))))
((INDUCT (MULTS M P))))
This formula can be simplified, using the abbreviations ZEROP, IMPLIES, NOT,
OR, and AND, to the following two new goals:
Case 2. (IMPLIES (AND (ZEROP M) (NOT (LESSP M N)))
(NOT (LESSP (WINS1 A (MULTS M P))
(WINS1 A (MULTS N P))))).
This simplifies, opening up ZEROP, EQUAL, LESSP, MULTS, LISTP, and WINS1, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL M 0))
(NUMBERP M)
(IMPLIES (IF (LESSP (SUB1 M) N) F T)
(IF (LESSP (WINS1 A (MULTS (SUB1 M) P))
(WINS1 A (MULTS N P)))
F T))
(NOT (LESSP M N)))
(NOT (LESSP (WINS1 A (MULTS M P))
(WINS1 A (MULTS N P))))).
This simplifies, applying CDR-CONS and CAR-CONS, and unfolding the functions
IMPLIES, MULTS, and WINS1, to three new formulas:
Case 1.3.
(IMPLIES (AND (NOT (EQUAL M 0))
(NUMBERP M)
(LESSP (SUB1 M) N)
(NOT (LESSP M N))
(NOT (LESSP (TIMES M P) A)))
(NOT (LESSP (WINS1 A (MULTS (SUB1 M) P))
(WINS1 A (MULTS N P))))),
which again simplifies, using linear arithmetic, to two new formulas:
Case 1.3.2.
(IMPLIES (AND (NOT (NUMBERP N))
(NOT (EQUAL M 0))
(NUMBERP M)
(LESSP (SUB1 M) N)
(NOT (LESSP M N))
(NOT (LESSP (TIMES M P) A)))
(NOT (LESSP (WINS1 A (MULTS (SUB1 M) P))
(WINS1 A (MULTS N P))))),
which again simplifies, opening up the function LESSP, to:
T.
Case 1.3.1.
(IMPLIES (AND (NUMBERP N)
(NOT (EQUAL M 0))
(NUMBERP M)
(LESSP (SUB1 M) M)
(NOT (LESSP M M))
(NOT (LESSP (TIMES M P) A)))
(NOT (LESSP (WINS1 A (MULTS (SUB1 M) P))
(WINS1 A (MULTS M P))))),
which again simplifies, applying CDR-CONS and CAR-CONS, and expanding
the functions LESSP, MULTS, and WINS1, to the new formula:
(IMPLIES (AND (NUMBERP N)
(NOT (EQUAL M 0))
(NUMBERP M)
(LESSP (SUB1 M) M)
(NOT (LESSP (SUB1 M) (SUB1 M)))
(NOT (LESSP (TIMES M P) A)))
(NOT (LESSP (WINS1 A (MULTS (SUB1 M) P))
(WINS1 A (MULTS (SUB1 M) P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL M 0))
(NUMBERP M)
(LESSP (SUB1 M) N)
(NOT (LESSP M N))
(LESSP (TIMES M P) A))
(NOT (LESSP (ADD1 (WINS1 A (MULTS (SUB1 M) P)))
(WINS1 A (MULTS N P))))),
which again simplifies, using linear arithmetic, to two new goals:
Case 1.2.2.
(IMPLIES (AND (NOT (NUMBERP N))
(NOT (EQUAL M 0))
(NUMBERP M)
(LESSP (SUB1 M) N)
(NOT (LESSP M N))
(LESSP (TIMES M P) A))
(NOT (LESSP (ADD1 (WINS1 A (MULTS (SUB1 M) P)))
(WINS1 A (MULTS N P))))),
which again simplifies, expanding the function LESSP, to:
T.
Case 1.2.1.
(IMPLIES (AND (NUMBERP N)
(NOT (EQUAL M 0))
(NUMBERP M)
(LESSP (SUB1 M) M)
(NOT (LESSP M M))
(LESSP (TIMES M P) A))
(NOT (LESSP (ADD1 (WINS1 A (MULTS (SUB1 M) P)))
(WINS1 A (MULTS M P))))),
which again simplifies, rewriting with CDR-CONS, CAR-CONS, and SUB1-ADD1,
and unfolding the definitions of LESSP, MULTS, and WINS1, to:
(IMPLIES (AND (NUMBERP N)
(NOT (EQUAL M 0))
(NUMBERP M)
(LESSP (SUB1 M) M)
(NOT (LESSP (SUB1 M) (SUB1 M)))
(LESSP (TIMES M P) A))
(NOT (LESSP (WINS1 A (MULTS (SUB1 M) P))
(WINS1 A (MULTS (SUB1 M) P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL M 0))
(NUMBERP M)
(NOT (LESSP (WINS1 A (MULTS (SUB1 M) P))
(WINS1 A (MULTS N P))))
(NOT (LESSP M N))
(LESSP (TIMES M P) A))
(NOT (LESSP (ADD1 (WINS1 A (MULTS (SUB1 M) P)))
(WINS1 A (MULTS N P))))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
MONOTONE-WINS1
(DEFN QUOT-QUOT-INDUCTION
(A B C D)
(IF (ZEROP B)
T
(IF (ZEROP D)
T
(IF (LESSP A D)
T
(IF (LESSP C B)
T
(QUOT-QUOT-INDUCTION (DIFFERENCE A D)
B
(DIFFERENCE C B)
D))))))
Linear arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the
definition of ZEROP can be used to establish that the measure (COUNT A)
decreases according to the well-founded relation LESSP in each recursive call.
Hence, QUOT-QUOT-INDUCTION is accepted under the definitional principle. The
definition of QUOT-QUOT-INDUCTION can be justified in another way. Linear
arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the definition
of ZEROP inform us that the measure (COUNT C) decreases according to the
well-founded relation LESSP in each recursive call. Observe that:
(TRUEP (QUOT-QUOT-INDUCTION A B C D))
is a theorem.
[ 0.0 0.0 0.0 ]
QUOT-QUOT-INDUCTION
(PROVE-LEMMA LEQ-TIMES-QUOT NIL
(IMPLIES (AND (NOT (ZEROP B))
(LEQ (TIMES A B) (TIMES C D)))
(LEQ (QUOTIENT A D) (QUOTIENT C B)))
((INDUCT (QUOT-QUOT-INDUCTION A B C D))))
This conjecture can be simplified, using the abbreviations ZEROP, IMPLIES, NOT,
OR, and AND, to five new conjectures:
Case 5. (IMPLIES (AND (ZEROP B)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (LESSP (TIMES C D) (TIMES A B))))
(NOT (LESSP (QUOTIENT C B)
(QUOTIENT A D)))),
which simplifies, opening up the function ZEROP, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL B 0))
(NUMBERP B)
(ZEROP D)
(NOT (LESSP (TIMES C D) (TIMES A B))))
(NOT (LESSP (QUOTIENT C B)
(QUOTIENT A D)))),
which simplifies, applying COMMUTATIVITY-OF-TIMES, TIMES-IDENTITY,
EQUAL-TIMES-0, and TIMES-ZERO2, and expanding the definitions of ZEROP,
EQUAL, LESSP, and QUOTIENT, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(LESSP A D)
(NOT (LESSP (TIMES C D) (TIMES A B))))
(NOT (LESSP (QUOTIENT C B)
(QUOTIENT A D)))).
This simplifies, expanding the definitions of QUOTIENT, EQUAL, and LESSP, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP A D))
(LESSP C B)
(NOT (LESSP (TIMES C D) (TIMES A B))))
(NOT (LESSP (QUOTIENT C B)
(QUOTIENT A D)))).
This simplifies, unfolding the functions QUOTIENT, EQUAL, and LESSP, to:
(IMPLIES (AND (NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP A D))
(LESSP C B)
(NOT (LESSP (TIMES C D) (TIMES A B))))
(EQUAL (QUOTIENT A D) 0)).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace A by
(PLUS Z (TIMES D X)) to eliminate (QUOTIENT A D) and (REMAINDER A D). We
employ LESSP-REMAINDER2, the type restriction lemma noted when QUOTIENT was
introduced, and the type restriction lemma noted when REMAINDER was
introduced to restrict the new variables. This produces the following two
new goals:
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP A))
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP A D))
(LESSP C B)
(NOT (LESSP (TIMES C D) (TIMES A B))))
(EQUAL (QUOTIENT A D) 0)).
This further simplifies, expanding the function LESSP, to:
T.
Case 2.1.
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(EQUAL (LESSP Z D) (NOT (ZEROP D)))
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS Z (TIMES D X)) D))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(TIMES (PLUS Z (TIMES D X)) B))))
(EQUAL X 0)),
which further simplifies, rewriting with DISTRIBUTIVITY-OF-TIMES-OVER-PLUS
and COMMUTATIVITY-OF-TIMES, and opening up the definitions of ZEROP and
NOT, to:
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(LESSP Z D)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS Z (TIMES D X)) D))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)),
which we will name *1.
Case 1. (IMPLIES (AND (NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP A D))
(NOT (LESSP C B))
(IMPLIES (AND (NOT (ZEROP B))
(IF (LESSP (TIMES (DIFFERENCE C B) D)
(TIMES (DIFFERENCE A D) B))
F T))
(IF (LESSP (QUOTIENT (DIFFERENCE C B) B)
(QUOTIENT (DIFFERENCE A D) D))
F T))
(NOT (LESSP (TIMES C D) (TIMES A B))))
(NOT (LESSP (QUOTIENT C B)
(QUOTIENT A D)))).
This simplifies, applying TIMES-DIFFERENCE, COMMUTATIVITY-OF-TIMES, and
SUB1-ADD1, and unfolding the definitions of ZEROP, NOT, AND, IMPLIES,
QUOTIENT, and LESSP, to the formula:
(IMPLIES (AND (NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP A D))
(NOT (LESSP C B))
(LESSP (DIFFERENCE (TIMES C D) (TIMES B D))
(DIFFERENCE (TIMES A B) (TIMES B D)))
(NOT (LESSP (TIMES C D) (TIMES A B))))
(NOT (LESSP (QUOTIENT (DIFFERENCE C B) B)
(QUOTIENT (DIFFERENCE A D) D)))).
This again simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP (TIMES A B) (TIMES B D))
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP A D))
(NOT (LESSP C B))
(LESSP (DIFFERENCE (TIMES C D) (TIMES B D))
(DIFFERENCE (TIMES A B) (TIMES B D)))
(NOT (LESSP (TIMES C D) (TIMES A B))))
(NOT (LESSP (QUOTIENT (DIFFERENCE C B) B)
(QUOTIENT (DIFFERENCE A D) D)))).
But this again simplifies, using linear arithmetic, applying DIFFERENCE-0,
and opening up EQUAL and LESSP, to:
T.
So we now return to:
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(LESSP Z D)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS Z (TIMES D X)) D))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)),
which is formula *1 above. We will appeal to induction. The recursive terms
in the conjecture suggest six inductions. They merge into two likely
candidate inductions, both of which are unflawed. However, one of these is
more likely than the other. We will induct according to the following scheme:
(AND (IMPLIES (OR (EQUAL D 0) (NOT (NUMBERP D)))
(p X C D B Z))
(IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(OR (EQUAL Z 0) (NOT (NUMBERP Z))))
(p X C D B Z))
(IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(NOT (OR (EQUAL Z 0) (NOT (NUMBERP Z))))
(p X C (SUB1 D) B (SUB1 Z)))
(p X C D B Z))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT establish that the measure (COUNT Z) 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
generates the following six new conjectures:
Case 6. (IMPLIES (AND (OR (EQUAL D 0) (NOT (NUMBERP D)))
(NUMBERP X)
(NUMBERP Z)
(LESSP Z D)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS Z (TIMES D X)) D))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)).
This simplifies, expanding NOT and OR, to:
T.
Case 5. (IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(OR (EQUAL Z 0) (NOT (NUMBERP Z)))
(NUMBERP X)
(NUMBERP Z)
(LESSP Z D)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS Z (TIMES D X)) D))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)).
This simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES and
TIMES-IDENTITY, and expanding the functions NOT, OR, NUMBERP, EQUAL, LESSP,
and PLUS, to the new formula:
(IMPLIES (AND (EQUAL Z 0)
(NUMBERP X)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (TIMES D X) D))
(LESSP C B)
(NOT (LESSP (TIMES C D) (TIMES B D X))))
(EQUAL X 0)),
which again simplifies, clearly, to the new conjecture:
(IMPLIES (AND (NUMBERP X)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (TIMES D X) D))
(LESSP C B)
(NOT (LESSP (TIMES C D) (TIMES B D X))))
(EQUAL X 0)),
which we generalize by replacing (TIMES D X) by Y. We restrict the new
variable by recalling the type restriction lemma noted when TIMES was
introduced. We thus obtain:
(IMPLIES (AND (NUMBERP Y)
(NUMBERP X)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP Y D))
(LESSP C B)
(NOT (LESSP (TIMES C D) (TIMES B Y))))
(EQUAL X 0)),
which has two irrelevant terms in it. By eliminating these terms we get:
(IMPLIES (AND (NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP Y D))
(LESSP C B))
(LESSP (TIMES C D) (TIMES B Y))),
which we will name *1.1.
Case 4. (IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(NOT (OR (EQUAL Z 0) (NOT (NUMBERP Z))))
(NOT (LESSP (SUB1 Z) (SUB1 D)))
(NUMBERP X)
(NUMBERP Z)
(LESSP Z D)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS Z (TIMES D X)) D))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)).
This simplifies, using linear arithmetic, to:
(IMPLIES (AND (EQUAL Z 0)
(NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(NOT (OR (EQUAL Z 0) (NOT (NUMBERP Z))))
(NOT (LESSP (SUB1 Z) (SUB1 D)))
(NUMBERP X)
(NUMBERP Z)
(LESSP Z D)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS Z (TIMES D X)) D))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)),
which again simplifies, expanding NOT, OR, EQUAL, and NUMBERP, to:
T.
Case 3. (IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(NOT (OR (EQUAL Z 0) (NOT (NUMBERP Z))))
(EQUAL (SUB1 D) 0)
(NUMBERP X)
(NUMBERP Z)
(LESSP Z D)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS Z (TIMES D X)) D))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)),
which simplifies, applying the lemma SUB1-ADD1, and expanding the functions
NOT, OR, LESSP, PLUS, and EQUAL, to the conjecture:
(IMPLIES (AND (NOT (EQUAL Z 0))
(EQUAL (SUB1 D) 0)
(NUMBERP X)
(NUMBERP Z)
(LESSP (SUB1 Z) (SUB1 D))
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)).
But this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(NOT (OR (EQUAL Z 0) (NOT (NUMBERP Z))))
(LESSP (PLUS (SUB1 Z) (TIMES (SUB1 D) X))
(SUB1 D))
(NUMBERP X)
(NUMBERP Z)
(LESSP Z D)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS Z (TIMES D X)) D))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)),
which simplifies, applying the lemma SUB1-ADD1, and unfolding the
definitions of NOT, OR, LESSP, and PLUS, to:
(IMPLIES (AND (NOT (EQUAL Z 0))
(LESSP (PLUS (SUB1 Z) (TIMES (SUB1 D) X))
(SUB1 D))
(NUMBERP X)
(NUMBERP Z)
(LESSP (SUB1 Z) (SUB1 D))
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS (SUB1 Z) (TIMES D X))
(SUB1 D)))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)).
However this further simplifies, applying COMMUTATIVITY-OF-TIMES, to the new
goal:
(IMPLIES (AND (NOT (EQUAL Z 0))
(LESSP (PLUS (SUB1 Z) (TIMES X (SUB1 D)))
(SUB1 D))
(NUMBERP X)
(NUMBERP Z)
(LESSP (SUB1 Z) (SUB1 D))
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS (SUB1 Z) (TIMES D X))
(SUB1 D)))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)),
which again simplifies, using linear arithmetic and appealing to the lemma
LESSP-TIMES-1, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(NOT (OR (EQUAL Z 0) (NOT (NUMBERP Z))))
(LESSP (TIMES C (SUB1 D))
(PLUS (TIMES B (SUB1 Z))
(TIMES B (SUB1 D) X)))
(NUMBERP X)
(NUMBERP Z)
(LESSP Z D)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS Z (TIMES D X)) D))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)),
which simplifies, rewriting with COMMUTATIVITY-OF-TIMES and SUB1-ADD1, and
opening up the definitions of NOT, OR, LESSP, and PLUS, to:
(IMPLIES (AND (NOT (EQUAL Z 0))
(LESSP (TIMES C (SUB1 D))
(PLUS (TIMES B (SUB1 Z))
(TIMES B X (SUB1 D))))
(NUMBERP X)
(NUMBERP Z)
(LESSP (SUB1 Z) (SUB1 D))
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (PLUS (SUB1 Z) (TIMES D X))
(SUB1 D)))
(LESSP C B)
(NOT (LESSP (TIMES C D)
(PLUS (TIMES B Z) (TIMES B D X)))))
(EQUAL X 0)).
Applying the lemma SUB1-ELIM, replace D by (ADD1 V) to eliminate (SUB1 D).
We rely upon the type restriction lemma noted when SUB1 was introduced to
restrict the new variable. We would thus like to prove:
(IMPLIES (AND (NUMBERP V)
(NOT (EQUAL Z 0))
(LESSP (TIMES C V)
(PLUS (TIMES B (SUB1 Z))
(TIMES B X V)))
(NUMBERP X)
(NUMBERP Z)
(LESSP (SUB1 Z) V)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL (ADD1 V) 0))
(NOT (LESSP (PLUS (SUB1 Z) (TIMES (ADD1 V) X))
V))
(LESSP C B)
(NOT (LESSP (TIMES C (ADD1 V))
(PLUS (TIMES B Z)
(TIMES B (ADD1 V) X)))))
(EQUAL X 0)),
which further simplifies, appealing to the lemmas COMMUTATIVITY-OF-TIMES,
TIMES-ADD1, COMMUTATIVITY2-OF-PLUS, and DISTRIBUTIVITY-OF-TIMES-OVER-PLUS,
to:
(IMPLIES (AND (NUMBERP V)
(NOT (EQUAL Z 0))
(LESSP (TIMES C V)
(PLUS (TIMES B (SUB1 Z))
(TIMES B V X)))
(NUMBERP X)
(NUMBERP Z)
(LESSP (SUB1 Z) V)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (LESSP (PLUS X (SUB1 Z) (TIMES V X))
V))
(LESSP C B)
(NOT (LESSP (PLUS C (TIMES C V))
(PLUS (TIMES B X)
(TIMES B Z)
(TIMES B V X)))))
(EQUAL X 0)).
Appealing to the lemma SUB1-ELIM, we now replace Z by (ADD1 W) to eliminate
(SUB1 Z). We rely upon the type restriction lemma noted when SUB1 was
introduced to constrain the new variable. We must thus prove:
(IMPLIES (AND (NUMBERP W)
(NUMBERP V)
(NOT (EQUAL (ADD1 W) 0))
(LESSP (TIMES C V)
(PLUS (TIMES B W) (TIMES B V X)))
(NUMBERP X)
(LESSP W V)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (LESSP (PLUS X W (TIMES V X)) V))
(LESSP C B)
(NOT (LESSP (PLUS C (TIMES C V))
(PLUS (TIMES B X)
(TIMES B (ADD1 W))
(TIMES B V X)))))
(EQUAL X 0)).
This further simplifies, appealing to the lemmas COMMUTATIVITY2-OF-PLUS,
TIMES-ADD1, and ASSOCIATIVITY-OF-PLUS, to the goal:
(IMPLIES (AND (NUMBERP W)
(NUMBERP V)
(LESSP (TIMES C V)
(PLUS (TIMES B W) (TIMES B V X)))
(NUMBERP X)
(LESSP W V)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (LESSP (PLUS W X (TIMES V X)) V))
(LESSP C B)
(NOT (LESSP (PLUS C (TIMES C V))
(PLUS B
(TIMES B W)
(TIMES B X)
(TIMES B V X)))))
(EQUAL X 0)).
But this finally simplifies, using linear arithmetic, to:
T.
So next consider:
(IMPLIES (AND (NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP Y D))
(LESSP C B))
(LESSP (TIMES C D) (TIMES B Y))),
which is formula *1.1 above. Let us appeal to the induction principle. There
are four plausible 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 (OR (EQUAL D 0) (NOT (NUMBERP D)))
(p C D B Y))
(IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(p C D B Y))
(IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(p C (SUB1 D) B (SUB1 Y)))
(p C D B Y))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT can be used to prove that the measure (COUNT Y) decreases
according to the well-founded relation LESSP in each induction step of the
scheme. Note, however, the inductive instance chosen for D. The above
induction scheme leads to the following five new formulas:
Case 5. (IMPLIES (AND (OR (EQUAL D 0) (NOT (NUMBERP D)))
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP Y D))
(LESSP C B))
(LESSP (TIMES C D) (TIMES B Y))).
This simplifies, unfolding the definitions of NOT and OR, to:
T.
Case 4. (IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(OR (EQUAL Y 0) (NOT (NUMBERP Y)))
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP Y D))
(LESSP C B))
(LESSP (TIMES C D) (TIMES B Y))).
This simplifies, opening up NOT, OR, NUMBERP, EQUAL, and LESSP, to:
T.
Case 3. (IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(EQUAL (SUB1 D) 0)
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP Y D))
(LESSP C B))
(LESSP (TIMES C D) (TIMES B Y))).
This simplifies, unfolding the functions NOT, OR, and LESSP, to the new goal:
(IMPLIES (AND (NOT (EQUAL Y 0))
(EQUAL (SUB1 D) 0)
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (SUB1 Y) (SUB1 D)))
(LESSP C B))
(LESSP (TIMES C D) (TIMES B Y))),
which again simplifies, opening up the functions EQUAL and LESSP, to the
goal:
(IMPLIES (AND (NOT (EQUAL Y 0))
(EQUAL (SUB1 D) 0)
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(LESSP C B))
(LESSP (TIMES C D) (TIMES B Y))).
Appealing to the lemma SUB1-ELIM, we now replace D by (ADD1 X) to eliminate
(SUB1 D). We use the type restriction lemma noted when SUB1 was introduced
to constrain the new variable. We must thus prove the conjecture:
(IMPLIES (AND (NUMBERP X)
(NOT (EQUAL Y 0))
(EQUAL X 0)
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL (ADD1 X) 0))
(LESSP C B))
(LESSP (TIMES C (ADD1 X))
(TIMES B Y))).
But this further simplifies, applying the lemmas TIMES-1 and
COMMUTATIVITY-OF-TIMES, and unfolding the definitions of NUMBERP and EQUAL,
to two new conjectures:
Case 3.2.
(IMPLIES (AND (NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(LESSP C B)
(NOT (NUMBERP C)))
(LESSP 0 (TIMES B Y))),
which again simplifies, using linear arithmetic and applying LESSP-TIMES-2,
to:
T.
Case 3.1.
(IMPLIES (AND (NOT (EQUAL Y 0))
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(LESSP C B)
(NUMBERP C))
(LESSP C (TIMES B Y))).
However this again simplifies, using linear arithmetic and applying
LESSP-TIMES-2, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(LESSP (SUB1 Y) (SUB1 D))
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP Y D))
(LESSP C B))
(LESSP (TIMES C D) (TIMES B Y))).
This simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL D 0) (NOT (NUMBERP D))))
(NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y))))
(LESSP (TIMES C (SUB1 D))
(TIMES B (SUB1 Y)))
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP Y D))
(LESSP C B))
(LESSP (TIMES C D) (TIMES B Y))).
This simplifies, expanding the functions NOT, OR, and LESSP, to:
(IMPLIES (AND (NOT (EQUAL Y 0))
(LESSP (TIMES C (SUB1 D))
(TIMES B (SUB1 Y)))
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL D 0))
(NUMBERP D)
(NOT (LESSP (SUB1 Y) (SUB1 D)))
(LESSP C B))
(LESSP (TIMES C D) (TIMES B Y))).
Applying the lemma SUB1-ELIM, replace D by (ADD1 X) to eliminate (SUB1 D).
We use 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 X)
(NOT (EQUAL Y 0))
(LESSP (TIMES C X) (TIMES B (SUB1 Y)))
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (EQUAL (ADD1 X) 0))
(NOT (LESSP (SUB1 Y) X))
(LESSP C B))
(LESSP (TIMES C (ADD1 X))
(TIMES B Y))),
which further simplifies, applying TIMES-ADD1, to:
(IMPLIES (AND (NUMBERP X)
(NOT (EQUAL Y 0))
(LESSP (TIMES C X) (TIMES B (SUB1 Y)))
(NUMBERP Y)
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (LESSP (SUB1 Y) X))
(LESSP C B))
(LESSP (PLUS C (TIMES C X))
(TIMES B Y))).
Applying the lemma SUB1-ELIM, replace Y by (ADD1 Z) 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 Z)
(NUMBERP X)
(NOT (EQUAL (ADD1 Z) 0))
(LESSP (TIMES C X) (TIMES B Z))
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (LESSP Z X))
(LESSP C B))
(LESSP (PLUS C (TIMES C X))
(TIMES B (ADD1 Z)))),
which further simplifies, rewriting with the lemma TIMES-ADD1, to:
(IMPLIES (AND (NUMBERP Z)
(NUMBERP X)
(LESSP (TIMES C X) (TIMES B Z))
(NOT (EQUAL B 0))
(NUMBERP B)
(NOT (LESSP Z X))
(LESSP C B))
(LESSP (PLUS C (TIMES C X))
(PLUS B (TIMES B Z)))).
This finally 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.4 0.0 ]
LEQ-TIMES-QUOT
(PROVE-LEMMA LEQ-QUOT-TIMES NIL
(LEQ (QUOTIENT (TIMES (QUOTIENT P 2) Q) P)
(QUOTIENT Q 2))
((USE (LEQ-TIMES-QUOT (A (TIMES (QUOTIENT P 2) Q))
(D P)
(C Q)
(B 2)))))
This formula can be simplified, using the abbreviation ASSOCIATIVITY-OF-TIMES,
to:
(IMPLIES (IMPLIES (AND (NOT (ZEROP 2))
(IF (LESSP (TIMES Q P)
(TIMES (QUOTIENT P 2) Q 2))
F T))
(IF (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES (QUOTIENT P 2) Q) P))
F T))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES (QUOTIENT P 2) Q)
P)))),
which simplifies, rewriting with COMMUTATIVITY-OF-TIMES, TIMES-2, and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and opening up the definitions of ZEROP,
NOT, AND, and IMPLIES, to:
(IMPLIES (LESSP (TIMES P Q)
(PLUS (TIMES Q (QUOTIENT P 2))
(TIMES Q (QUOTIENT P 2))))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q (QUOTIENT P 2))
P)))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace P by (PLUS Z (TIMES 2 X))
to eliminate (QUOTIENT P 2) and (REMAINDER P 2). We employ LESSP-REMAINDER2,
the type restriction lemma noted when QUOTIENT was introduced, and the type
restriction lemma noted when REMAINDER was introduced to restrict the new
variables. We would thus like to prove the following four new conjectures:
Case 4. (IMPLIES (AND (NOT (NUMBERP P))
(LESSP (TIMES P Q)
(PLUS (TIMES Q (QUOTIENT P 2))
(TIMES Q (QUOTIENT P 2)))))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q (QUOTIENT P 2))
P)))).
However this further simplifies, rewriting with COMMUTATIVITY-OF-TIMES,
TIMES-IDENTITY, and LESSP-TIMES-CANCELLATION, and expanding LESSP, NUMBERP,
EQUAL, QUOTIENT, and PLUS, to:
T.
Case 3. (IMPLIES (AND (EQUAL 2 0)
(LESSP (TIMES P Q)
(PLUS (TIMES Q (QUOTIENT P 2))
(TIMES Q (QUOTIENT P 2)))))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q (QUOTIENT P 2))
P)))).
This further simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP 2))
(LESSP (TIMES P Q)
(PLUS (TIMES Q (QUOTIENT P 2))
(TIMES Q (QUOTIENT P 2)))))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q (QUOTIENT P 2))
P)))),
which further simplifies, trivially, to:
T.
Case 1. (IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(EQUAL (LESSP Z 2) (NOT (ZEROP 2)))
(NOT (EQUAL 2 0))
(LESSP (TIMES (PLUS Z (TIMES 2 X)) Q)
(PLUS (TIMES Q X) (TIMES Q X))))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q X)
(PLUS Z (TIMES 2 X)))))).
However this further simplifies, applying TIMES-2, COMMUTATIVITY-OF-PLUS,
COMMUTATIVITY2-OF-PLUS, DISTRIBUTIVITY-OF-TIMES-OVER-PLUS,
COMMUTATIVITY-OF-TIMES, and LESSP-PLUS-CANCELATION, and opening up ZEROP,
NOT, and EQUAL, to:
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(LESSP Z 2)
(LESSP (PLUS (TIMES Q X) (TIMES Q Z))
(TIMES Q X)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q X)
(PLUS X X Z))))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
LEQ-QUOT-TIMES
(DEFN MONOTONE-QUOT-INDUCTION
(I J P)
(IF (ZEROP P)
T
(IF (LESSP I P)
T
(IF (LESSP J P)
T
(MONOTONE-QUOT-INDUCTION (DIFFERENCE I P)
(DIFFERENCE J P)
P)))))
Linear arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the
definition of ZEROP establish that the measure (COUNT I) decreases according
to the well-founded relation LESSP in each recursive call. Hence,
MONOTONE-QUOT-INDUCTION is accepted under the principle of definition. The
definition of MONOTONE-QUOT-INDUCTION can be justified in another way. Linear
arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the definition
of ZEROP inform us that the measure (COUNT J) decreases according to the
well-founded relation LESSP in each recursive call. Note that:
(TRUEP (MONOTONE-QUOT-INDUCTION I J P))
is a theorem.
[ 0.0 0.0 0.0 ]
MONOTONE-QUOT-INDUCTION
(PROVE-LEMMA MONOTONE-QUOT NIL
(IMPLIES (LEQ J I)
(LEQ (QUOTIENT J P) (QUOTIENT I P)))
((INDUCT (MONOTONE-QUOT-INDUCTION I J P))))
This formula can be simplified, using the abbreviations ZEROP, IMPLIES, NOT,
OR, and AND, to the following four new formulas:
Case 4. (IMPLIES (AND (ZEROP P) (NOT (LESSP I J)))
(NOT (LESSP (QUOTIENT I P)
(QUOTIENT J P)))).
This simplifies, unfolding the functions ZEROP, EQUAL, QUOTIENT, and LESSP,
to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(LESSP I P)
(NOT (LESSP I J)))
(NOT (LESSP (QUOTIENT I P)
(QUOTIENT J P)))).
This simplifies, using linear arithmetic, rewriting with DIFFERENCE-0, and
expanding the functions QUOTIENT, LESSP, EQUAL, and ADD1, to the formula:
(IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(LESSP I P)
(NOT (LESSP I J)))
(LESSP J P)).
But this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP I P))
(LESSP J P)
(NOT (LESSP I J)))
(NOT (LESSP (QUOTIENT I P)
(QUOTIENT J P)))),
which simplifies, expanding the functions QUOTIENT, EQUAL, and LESSP, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP I P))
(NOT (LESSP J P))
(IMPLIES (IF (LESSP (DIFFERENCE I P)
(DIFFERENCE J P))
F T)
(IF (LESSP (QUOTIENT (DIFFERENCE I P) P)
(QUOTIENT (DIFFERENCE J P) P))
F T))
(NOT (LESSP I J)))
(NOT (LESSP (QUOTIENT I P)
(QUOTIENT J P)))),
which simplifies, rewriting with SUB1-ADD1, and unfolding the functions
IMPLIES, QUOTIENT, and LESSP, to the new goal:
(IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP I P))
(NOT (LESSP J P))
(LESSP (DIFFERENCE I P)
(DIFFERENCE J P))
(NOT (LESSP I J)))
(NOT (LESSP (QUOTIENT (DIFFERENCE I P) P)
(QUOTIENT (DIFFERENCE J P) P)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
MONOTONE-QUOT
(PROVE-LEMMA LEQ-QUOT-TIMES-2 NIL
(IMPLIES (LEQ J (QUOTIENT P 2))
(LEQ (QUOTIENT (TIMES J Q) P)
(QUOTIENT Q 2)))
((USE (LEQ-QUOT-TIMES)
(MONOTONE-QUOT (J (TIMES J Q))
(I (TIMES (QUOTIENT P 2) Q)))
(LESSP-TIMES-CANCELLATION (X J)
(Y (QUOTIENT P 2))
(Z Q)))
(DISABLE LESSP-TIMES-CANCELLATION)))
This formula simplifies, appealing to the lemmas COMMUTATIVITY-OF-TIMES,
EQUAL-LESSP, TIMES-ZERO2, and TIMES-IDENTITY, and unfolding the functions
IMPLIES, ZEROP, NOT, AND, LESSP, NUMBERP, EQUAL, and QUOTIENT, to the
following four new conjectures:
Case 4. (IMPLIES (AND (NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q (QUOTIENT P 2))
P)))
(LESSP (TIMES Q (QUOTIENT P 2))
(TIMES J Q))
(NOT (LESSP (TIMES J Q)
(TIMES Q (QUOTIENT P 2))))
(NOT (LESSP J (QUOTIENT P 2)))
(NOT (LESSP (QUOTIENT P 2) J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))).
But this again simplifies, using linear arithmetic, to two new conjectures:
Case 4.2.
(IMPLIES (AND (NOT (NUMBERP J))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q (QUOTIENT P 2))
P)))
(LESSP (TIMES Q (QUOTIENT P 2))
(TIMES J Q))
(NOT (LESSP (TIMES J Q)
(TIMES Q (QUOTIENT P 2))))
(NOT (LESSP J (QUOTIENT P 2)))
(NOT (LESSP (QUOTIENT P 2) J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))),
which again simplifies, applying the lemma EQUAL-TIMES-0, and expanding
the function LESSP, to:
T.
Case 4.1.
(IMPLIES (AND (NUMBERP J)
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q (QUOTIENT P 2))
P)))
(LESSP (TIMES Q (QUOTIENT P 2))
(TIMES (QUOTIENT P 2) Q))
(NOT (LESSP (TIMES (QUOTIENT P 2) Q)
(TIMES Q (QUOTIENT P 2))))
(NOT (LESSP (QUOTIENT P 2) (QUOTIENT P 2)))
(NOT (LESSP (QUOTIENT P 2)
(QUOTIENT P 2))))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES (QUOTIENT P 2) Q)
P)))),
which again simplifies, rewriting with COMMUTATIVITY-OF-TIMES, to:
T.
Case 3. (IMPLIES (AND (NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q (QUOTIENT P 2))
P)))
(LESSP (TIMES Q (QUOTIENT P 2))
(TIMES J Q))
(LESSP (TIMES J Q)
(TIMES Q (QUOTIENT P 2)))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(LESSP J (QUOTIENT P 2))
(NOT (LESSP (QUOTIENT P 2) J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))).
This again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q (QUOTIENT P 2))
P)))
(NOT (LESSP (QUOTIENT (TIMES Q (QUOTIENT P 2)) P)
(QUOTIENT (TIMES J Q) P)))
(NOT (LESSP (TIMES J Q)
(TIMES Q (QUOTIENT P 2))))
(NOT (LESSP J (QUOTIENT P 2)))
(NOT (LESSP (QUOTIENT P 2) J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES Q (QUOTIENT P 2))
P)))
(NOT (LESSP (QUOTIENT (TIMES Q (QUOTIENT P 2)) P)
(QUOTIENT (TIMES J Q) P)))
(LESSP (TIMES J Q)
(TIMES Q (QUOTIENT P 2)))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(LESSP J (QUOTIENT P 2))
(NOT (LESSP (QUOTIENT P 2) J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
LEQ-QUOT-TIMES-2
(PROVE-LEMMA LEQ-QUOT-WINS1-1 NIL
(IMPLIES (NOT (DIVIDES P X))
(LESSP (TIMES (QUOTIENT X P) P) X)))
This formula can be simplified, using the abbreviations NOT, IMPLIES, and
DIVIDES, to the new conjecture:
(IMPLIES (NOT (EQUAL (REMAINDER X P) 0))
(LESSP (TIMES (QUOTIENT X P) P) X)),
which simplifies, rewriting with COMMUTATIVITY-OF-TIMES, to the new goal:
(IMPLIES (NOT (EQUAL (REMAINDER X P) 0))
(LESSP (TIMES P (QUOTIENT X P)) X)).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace X by (PLUS Z (TIMES P V))
to eliminate (REMAINDER X P) and (QUOTIENT X P). We employ LESSP-REMAINDER2,
the type restriction lemma noted when REMAINDER was introduced, and the type
restriction lemma noted when QUOTIENT was introduced to restrict the new
variables. We would thus like to prove the following four new conjectures:
Case 4. (IMPLIES (AND (NOT (NUMBERP X))
(NOT (EQUAL (REMAINDER X P) 0)))
(LESSP (TIMES P (QUOTIENT X P)) X)).
This further simplifies, unfolding the functions LESSP, REMAINDER, and EQUAL,
to:
T.
Case 3. (IMPLIES (AND (EQUAL P 0)
(NOT (EQUAL (REMAINDER X P) 0)))
(LESSP (TIMES P (QUOTIENT X P)) X)),
which further simplifies, opening up the functions EQUAL, REMAINDER,
QUOTIENT, TIMES, and LESSP, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP P))
(NOT (EQUAL (REMAINDER X P) 0)))
(LESSP (TIMES P (QUOTIENT X P)) X)),
which further simplifies, rewriting with REMAINDER-WRT-12, TIMES-ZERO2, and
COMMUTATIVITY-OF-TIMES, and opening up the functions QUOTIENT, EQUAL, and
LESSP, to:
T.
Case 1. (IMPLIES (AND (NUMBERP Z)
(EQUAL (LESSP Z P) (NOT (ZEROP P)))
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EQUAL Z 0)))
(LESSP (TIMES P V)
(PLUS Z (TIMES P V)))).
But this further simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
LEQ-QUOT-WINS1-1
(PROVE-LEMMA LEQ-QUOT-WINS1-2 NIL
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P Q))
(NOT (ZEROP Q))
(NOT (ZEROP J))
(LESSP J P))
(LESSP (TIMES (QUOTIENT (TIMES J Q) P) P)
(TIMES J Q)))
((USE (LEQ-QUOT-WINS1-1 (X (TIMES J Q))))
(DISABLE PRIME QUOTIENT TIMES)))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
IMPLIES, and DIVIDES, to:
(IMPLIES (AND (IMPLIES (NOT (EQUAL (REMAINDER (TIMES J Q) P) 0))
(LESSP (TIMES (QUOTIENT (TIMES J Q) P) P)
(TIMES J Q)))
(PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL J 0))
(NUMBERP J)
(LESSP J P))
(LESSP (TIMES (QUOTIENT (TIMES J Q) P) P)
(TIMES J Q))).
This simplifies, rewriting with PRIME-KEY-REWRITE and COMMUTATIVITY-OF-TIMES,
and unfolding the functions REMAINDER, NOT, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LEQ-QUOT-WINS1-2
(PROVE-LEMMA LEQ-QUOT-WINS1 NIL
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P Q))
(LEQ J (QUOTIENT P 2))
(NOT (ZEROP J))
(NOT (ZEROP Q)))
(LEQ (QUOTIENT (TIMES J Q) P)
(WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))))
((USE (LEQ-QUOT-TIMES-2)
(MONOTONE-WINS1 (A (TIMES J Q))
(N (QUOTIENT (TIMES J Q) P))
(M (QUOTIENT Q 2)))
(LEQ-N-WINS1 (A (TIMES J Q))
(N (QUOTIENT (TIMES J Q) P)))
(LEQ-QUOT-WINS1-2))
(DISABLE PRIME)))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, IMPLIES,
AND, and DIVIDES, to:
(IMPLIES
(AND (IMPLIES (IF (LESSP (QUOTIENT P 2) J) F T)
(IF (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P))
F T))
(IMPLIES (IF (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P))
F T)
(IF (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(WINS1 (TIMES J Q)
(MULTS (QUOTIENT (TIMES J Q) P) P)))
F T))
(IMPLIES (LESSP (TIMES (QUOTIENT (TIMES J Q) P) P)
(TIMES J Q))
(IF (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT (TIMES J Q) P) P))
(QUOTIENT (TIMES J Q) P))
F T))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (ZEROP Q))
(NOT (ZEROP J))
(LESSP J P))
(LESSP (TIMES (QUOTIENT (TIMES J Q) P) P)
(TIMES J Q)))
(PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL Q 0))
(NUMBERP Q))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P)))).
This simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and expanding the
functions IMPLIES, NOT, ZEROP, and AND, to three new formulas:
Case 3. (IMPLIES (AND (NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(WINS1 (TIMES J Q)
(MULTS (QUOTIENT (TIMES J Q) P) P))))
(NOT (LESSP (TIMES P (QUOTIENT (TIMES J Q) P))
(TIMES J Q)))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL Q 0))
(NUMBERP Q))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P)))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace Q by
(PLUS Z (TIMES 2 X)) to eliminate (QUOTIENT Q 2) and (REMAINDER Q 2). We
rely upon LESSP-REMAINDER2, the type restriction lemma noted when QUOTIENT
was introduced, and the type restriction lemma noted when REMAINDER was
introduced to restrict the new variables. We thus obtain the following
three new conjectures:
Case 3.3.
(IMPLIES
(AND (EQUAL 2 0)
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(WINS1 (TIMES J Q)
(MULTS (QUOTIENT (TIMES J Q) P) P))))
(NOT (LESSP (TIMES P (QUOTIENT (TIMES J Q) P))
(TIMES J Q)))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL Q 0))
(NUMBERP Q))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P)))).
But this further simplifies, using linear arithmetic, to:
T.
Case 3.2.
(IMPLIES
(AND (NOT (NUMBERP 2))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(WINS1 (TIMES J Q)
(MULTS (QUOTIENT (TIMES J Q) P) P))))
(NOT (LESSP (TIMES P (QUOTIENT (TIMES J Q) P))
(TIMES J Q)))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL Q 0))
(NUMBERP Q))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P)))),
which further simplifies, trivially, to:
T.
Case 3.1.
(IMPLIES
(AND
(NUMBERP X)
(NUMBERP Z)
(EQUAL (LESSP Z 2) (NOT (ZEROP 2)))
(NOT (EQUAL 2 0))
(NOT (LESSP X
(QUOTIENT (TIMES J (PLUS Z (TIMES 2 X)))
P)))
(NOT (LESSP (WINS1 (TIMES J (PLUS Z (TIMES 2 X)))
(MULTS X P))
(WINS1 (TIMES J (PLUS Z (TIMES 2 X)))
(MULTS (QUOTIENT (TIMES J (PLUS Z (TIMES 2 X)))
P)
P))))
(NOT (LESSP (TIMES P
(QUOTIENT (TIMES J (PLUS Z (TIMES 2 X)))
P))
(TIMES J (PLUS Z (TIMES 2 X)))))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER (PLUS Z (TIMES 2 X)) P)
0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL (PLUS Z (TIMES 2 X)) 0)))
(NOT (LESSP (WINS1 (TIMES J (PLUS Z (TIMES 2 X)))
(MULTS X P))
(QUOTIENT (TIMES J (PLUS Z (TIMES 2 X)))
P)))).
This further simplifies, applying TIMES-2, COMMUTATIVITY-OF-PLUS,
COMMUTATIVITY2-OF-PLUS, DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and
PLUS-EQUAL-0, and unfolding the definitions of ZEROP, NOT, and EQUAL, to
the following two new formulas:
Case 3.1.2.
(IMPLIES
(AND (NUMBERP X)
(NUMBERP Z)
(LESSP Z 2)
(NOT (LESSP X
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X P))
(WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS (QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)
P))))
(NOT (LESSP (TIMES P
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P))
(PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER (PLUS X X Z) P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL X 0)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X P))
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace P by
(PLUS W (TIMES 2 V)) to eliminate (QUOTIENT P 2) and (REMAINDER P 2).
We use LESSP-REMAINDER2, the type restriction lemma noted when QUOTIENT
was introduced, and the type restriction lemma noted when REMAINDER was
introduced to constrain the new variables. We must thus prove four new
formulas:
Case 3.1.2.4.
(IMPLIES
(AND (NOT (NUMBERP P))
(NUMBERP X)
(NUMBERP Z)
(LESSP Z 2)
(NOT (LESSP X
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X P))
(WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS (QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)
P))))
(NOT (LESSP (TIMES P
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P))
(PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER (PLUS X X Z) P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL X 0)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X P))
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)))),
which further simplifies, applying TIMES-ZERO2, COMMUTATIVITY-OF-TIMES,
PLUS-EQUAL-0, and EQUAL-TIMES-0, and expanding the definitions of
QUOTIENT, EQUAL, LESSP, MULTS, LISTP, and WINS1, to:
T.
Case 3.1.2.3.
(IMPLIES
(AND (EQUAL 2 0)
(NUMBERP X)
(NUMBERP Z)
(LESSP Z 2)
(NOT (LESSP X
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X P))
(WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS (QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)
P))))
(NOT (LESSP (TIMES P
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P))
(PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER (PLUS X X Z) P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL X 0)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X P))
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)))).
But this further simplifies, using linear arithmetic, to:
T.
Case 3.1.2.2.
(IMPLIES
(AND (NOT (NUMBERP 2))
(NUMBERP X)
(NUMBERP Z)
(LESSP Z 2)
(NOT (LESSP X
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X P))
(WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS (QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)
P))))
(NOT (LESSP (TIMES P
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P))
(PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER (PLUS X X Z) P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL X 0)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X P))
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)))),
which further simplifies, clearly, to:
T.
Case 3.1.2.1.
(IMPLIES
(AND (NUMBERP V)
(NUMBERP W)
(EQUAL (LESSP W 2) (NOT (ZEROP 2)))
(NOT (EQUAL 2 0))
(NUMBERP X)
(NUMBERP Z)
(LESSP Z 2)
(NOT (LESSP X
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(PLUS W (TIMES 2 V)))))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X (PLUS W (TIMES 2 V))))
(WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS (QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(PLUS W (TIMES 2 V)))
(PLUS W (TIMES 2 V))))))
(NOT (LESSP (TIMES (PLUS W (TIMES 2 V))
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(PLUS W (TIMES 2 V))))
(PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))))
(NOT (LESSP J (PLUS W (TIMES 2 V))))
(PRIME (PLUS W (TIMES 2 V)))
(NOT (EQUAL (REMAINDER (PLUS X X Z)
(PLUS W (TIMES 2 V)))
0))
(NOT (LESSP V J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL X 0)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X (PLUS W (TIMES 2 V))))
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(PLUS W (TIMES 2 V)))))).
This further simplifies, using linear arithmetic, to:
T.
Case 3.1.1.
(IMPLIES
(AND (NUMBERP X)
(NUMBERP Z)
(LESSP Z 2)
(NOT (LESSP X
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X P))
(WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS (QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)
P))))
(NOT (LESSP (TIMES P
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P))
(PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER (PLUS X X Z) P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL Z 0)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
(MULTS X P))
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J Z))
P)))),
which again simplifies, using linear arithmetic, to:
(IMPLIES
(AND (NUMBERP X)
(NUMBERP 1)
(LESSP 1 2)
(NOT (LESSP X
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J 1))
P)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J 1))
(MULTS X P))
(WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J 1))
(MULTS (QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J 1))
P)
P))))
(NOT (LESSP (TIMES P
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J 1))
P))
(PLUS (TIMES J X)
(TIMES J X)
(TIMES J 1))))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER (PLUS X X 1) P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL 1 0)))
(NOT (LESSP (WINS1 (PLUS (TIMES J X)
(TIMES J X)
(TIMES J 1))
(MULTS X P))
(QUOTIENT (PLUS (TIMES J X)
(TIMES J X)
(TIMES J 1))
P)))).
This again simplifies, rewriting with TIMES-1, COMMUTATIVITY-OF-TIMES,
COMMUTATIVITY-OF-PLUS, and COMMUTATIVITY2-OF-PLUS, and opening up
NUMBERP, LESSP, and EQUAL, to the new conjecture:
(IMPLIES
(AND
(NUMBERP X)
(NOT (LESSP X
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)))
(NOT
(LESSP (WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS X P))
(WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS (QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)
P))))
(NOT (LESSP (TIMES P
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P))
(PLUS J (TIMES J X) (TIMES J X))))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER (PLUS 1 X X) P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J))
(NOT (LESSP (WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS X P))
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace P by
(PLUS V (TIMES 2 Z)) to eliminate (QUOTIENT P 2) and (REMAINDER P 2).
We employ LESSP-REMAINDER2, the type restriction lemma noted when
QUOTIENT was introduced, and the type restriction lemma noted when
REMAINDER was introduced to restrict the new variables. We would thus
like to prove the following four new goals:
Case 3.1.1.4.
(IMPLIES
(AND
(NOT (NUMBERP P))
(NUMBERP X)
(NOT (LESSP X
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)))
(NOT
(LESSP
(WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS X P))
(WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS (QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)
P))))
(NOT (LESSP (TIMES P
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P))
(PLUS J (TIMES J X) (TIMES J X))))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER (PLUS 1 X X) P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J))
(NOT (LESSP (WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS X P))
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)))).
But this finally simplifies, applying TIMES-ZERO2,
COMMUTATIVITY-OF-TIMES, and PLUS-EQUAL-0, and expanding QUOTIENT,
EQUAL, LESSP, MULTS, LISTP, and WINS1, to:
T.
Case 3.1.1.3.
(IMPLIES
(AND
(EQUAL 2 0)
(NUMBERP X)
(NOT (LESSP X
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)))
(NOT
(LESSP
(WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS X P))
(WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS (QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)
P))))
(NOT (LESSP (TIMES P
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P))
(PLUS J (TIMES J X) (TIMES J X))))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER (PLUS 1 X X) P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J))
(NOT (LESSP (WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS X P))
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)))).
But this finally simplifies, using linear arithmetic, to:
T.
Case 3.1.1.2.
(IMPLIES
(AND
(NOT (NUMBERP 2))
(NUMBERP X)
(NOT (LESSP X
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)))
(NOT
(LESSP
(WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS X P))
(WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS (QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)
P))))
(NOT (LESSP (TIMES P
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P))
(PLUS J (TIMES J X) (TIMES J X))))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER (PLUS 1 X X) P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J))
(NOT (LESSP (WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS X P))
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
P)))),
which finally simplifies, clearly, to:
T.
Case 3.1.1.1.
(IMPLIES
(AND
(NUMBERP Z)
(NUMBERP V)
(EQUAL (LESSP V 2) (NOT (ZEROP 2)))
(NOT (EQUAL 2 0))
(NUMBERP X)
(NOT (LESSP X
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
(PLUS V (TIMES 2 Z)))))
(NOT
(LESSP
(WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS X (PLUS V (TIMES 2 Z))))
(WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS (QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
(PLUS V (TIMES 2 Z)))
(PLUS V (TIMES 2 Z))))))
(NOT (LESSP (TIMES (PLUS V (TIMES 2 Z))
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
(PLUS V (TIMES 2 Z))))
(PLUS J (TIMES J X) (TIMES J X))))
(NOT (LESSP J (PLUS V (TIMES 2 Z))))
(PRIME (PLUS V (TIMES 2 Z)))
(NOT (EQUAL (REMAINDER (PLUS 1 X X)
(PLUS V (TIMES 2 Z)))
0))
(NOT (LESSP Z J))
(NOT (EQUAL J 0))
(NUMBERP J))
(NOT (LESSP (WINS1 (PLUS J (TIMES J X) (TIMES J X))
(MULTS X (PLUS V (TIMES 2 Z))))
(QUOTIENT (PLUS J (TIMES J X) (TIMES J X))
(PLUS V (TIMES 2 Z)))))).
This finally simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(WINS1 (TIMES J Q)
(MULTS (QUOTIENT (TIMES J Q) P) P))))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT (TIMES J Q) P) P))
(QUOTIENT (TIMES J Q) P)))
(NOT (LESSP J P))
(PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL Q 0))
(NUMBERP Q))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(WINS1 (TIMES J Q)
(MULTS (QUOTIENT (TIMES J Q) P) P))))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT (TIMES J Q) P) P))
(QUOTIENT (TIMES J Q) P)))
(LESSP (TIMES P (QUOTIENT (TIMES J Q) P))
(TIMES J Q))
(PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL Q 0))
(NUMBERP Q))
(NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.7 0.1 ]
LEQ-QUOT-WINS1
(DEFN WINS2
(A N P)
(IF (ZEROP N)
0
(IF (LESSP (TIMES N P) A)
N
(WINS2 A (SUB1 N) P))))
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, WINS2 is accepted
under the definitional principle. Observe that (NUMBERP (WINS2 A N P)) is a
theorem.
[ 0.0 0.0 0.0 ]
WINS2
(PROVE-LEMMA LEQ-WINS2 NIL
(LEQ (TIMES (WINS2 A N P) P) A))
This simplifies, appealing to the lemma COMMUTATIVITY-OF-TIMES, to the
conjecture:
(NOT (LESSP A (TIMES P (WINS2 A N P)))).
Name the above subgoal *1.
Perhaps we can prove it by induction. There are two plausible inductions.
However, only one is unflawed. We will induct according to the following
scheme:
(AND (IMPLIES (ZEROP N) (p A P N))
(IMPLIES (AND (NOT (ZEROP N))
(LESSP (TIMES N P) A))
(p A P N))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (LESSP (TIMES N P) A))
(p A P (SUB1 N)))
(p A P N))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform
us that the measure (COUNT N) decreases according to the well-founded relation
LESSP in each induction step of the scheme. The above induction scheme leads
to the following three new conjectures:
Case 3. (IMPLIES (ZEROP N)
(NOT (LESSP A (TIMES P (WINS2 A N P))))).
This simplifies, rewriting with COMMUTATIVITY-OF-TIMES and TIMES-IDENTITY,
and expanding the functions ZEROP, EQUAL, WINS2, and LESSP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(LESSP (TIMES N P) A))
(NOT (LESSP A (TIMES P (WINS2 A N P))))),
which simplifies, applying the lemma COMMUTATIVITY-OF-TIMES, and opening up
the definitions of ZEROP and WINS2, to:
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (TIMES N P) A))
(NOT (LESSP A (TIMES N P)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (LESSP (TIMES N P) A))
(NOT (LESSP A
(TIMES P (WINS2 A (SUB1 N) P)))))
(NOT (LESSP A (TIMES P (WINS2 A N P))))),
which simplifies, opening up the functions ZEROP and WINS2, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LEQ-WINS2
(PROVE-LEMMA LEQ-WINS1-N NIL
(LEQ (WINS1 A (MULTS N P)) N))
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 (OR (EQUAL (WINS1 A (MULTS N P)) 0)
(NOT (NUMBERP (WINS1 A (MULTS N P)))))
(p N A P))
(IMPLIES (AND (NOT (OR (EQUAL (WINS1 A (MULTS N P)) 0)
(NOT (NUMBERP (WINS1 A (MULTS N P))))))
(OR (EQUAL N 0) (NOT (NUMBERP N))))
(p N A P))
(IMPLIES (AND (NOT (OR (EQUAL (WINS1 A (MULTS N P)) 0)
(NOT (NUMBERP (WINS1 A (MULTS N P))))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(p (SUB1 N) A P))
(p N A P))).
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. The above
induction scheme produces the following three new formulas:
Case 3. (IMPLIES (OR (EQUAL (WINS1 A (MULTS N P)) 0)
(NOT (NUMBERP (WINS1 A (MULTS N P)))))
(NOT (LESSP N (WINS1 A (MULTS N P))))).
This simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
unfolding MULTS, NOT, OR, WINS1, EQUAL, LISTP, and LESSP, to the following
two new conjectures:
Case 3.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (WINS1 A
(CONS (TIMES N P) (MULTS (SUB1 N) P)))
0)
(NOT (LESSP (TIMES N P) A)))
(NOT (LESSP N
(WINS1 A (MULTS (SUB1 N) P))))).
This again simplifies, applying CDR-CONS and CAR-CONS, and opening up
WINS1, EQUAL, and LESSP, to:
T.
Case 3.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (WINS1 A
(CONS (TIMES N P) (MULTS (SUB1 N) P)))
0)
(LESSP (TIMES N P) A))
(NOT (LESSP N
(ADD1 (WINS1 A (MULTS (SUB1 N) P)))))).
This again simplifies, appealing to the lemmas CDR-CONS and CAR-CONS, and
expanding the function WINS1, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL (WINS1 A (MULTS N P)) 0)
(NOT (NUMBERP (WINS1 A (MULTS N P))))))
(OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (LESSP N (WINS1 A (MULTS N P))))),
which simplifies, opening up the functions MULTS, NOT, OR, EQUAL, NUMBERP,
LISTP, WINS1, and LESSP, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL (WINS1 A (MULTS N P)) 0)
(NOT (NUMBERP (WINS1 A (MULTS N P))))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (LESSP (SUB1 N)
(WINS1 A (MULTS (SUB1 N) P)))))
(NOT (LESSP N (WINS1 A (MULTS N P))))),
which simplifies, appealing to the lemmas CDR-CONS and CAR-CONS, and opening
up the functions MULTS, NOT, OR, WINS1, EQUAL, and NUMBERP, to two new
formulas:
Case 1.2.
(IMPLIES
(AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (EQUAL (WINS1 A
(CONS (TIMES N P) (MULTS (SUB1 N) P)))
0))
(NOT (LESSP (SUB1 N)
(WINS1 A (MULTS (SUB1 N) P))))
(NOT (LESSP (TIMES N P) A)))
(NOT (LESSP N
(WINS1 A (MULTS (SUB1 N) P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES
(AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (EQUAL (WINS1 A
(CONS (TIMES N P) (MULTS (SUB1 N) P)))
0))
(NOT (LESSP (SUB1 N)
(WINS1 A (MULTS (SUB1 N) P))))
(LESSP (TIMES N P) A))
(NOT (LESSP N
(ADD1 (WINS1 A (MULTS (SUB1 N) P)))))),
which again simplifies, using linear arithmetic, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.1 0.0 ]
LEQ-WINS1-N
(PROVE-LEMMA LEQ-WINS1-WINS2 NIL
(LEQ (WINS1 A (MULTS N P))
(WINS2 A N P))
((USE (LEQ-WINS1-N))
(INDUCT (WINS2 A N P))))
This formula simplifies, applying the lemmas CDR-CONS, CAR-CONS,
TIMES-IDENTITY, EQUAL-TIMES-0, and SUB1-NNUMBERP, and unfolding the functions
MULTS, ZEROP, NOT, WINS2, WINS1, OR, AND, EQUAL, LISTP, LESSP, and SUB1, to:
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP N
(WINS1 A
(CONS (TIMES N P)
(MULTS (SUB1 N) P)))))
(LESSP (TIMES N P) A))
(NOT (LESSP N
(ADD1 (WINS1 A (MULTS (SUB1 N) P)))))),
which again simplifies, rewriting with the lemmas CDR-CONS, CAR-CONS, and
SUB1-ADD1, and opening up the definitions of WINS1 and LESSP, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
LEQ-WINS1-WINS2
(PROVE-LEMMA LEQ-WINS1 NIL
(LEQ (TIMES (WINS1 A (MULTS N P)) P)
A)
((USE (LEQ-WINS2)
(LEQ-WINS1-WINS2)
(LESSP-TIMES-CANCELLATION (X (WINS1 A (MULTS N P)))
(Y (WINS2 A N P))
(Z P)))
(DISABLE LESSP-TIMES-CANCELLATION)))
This simplifies, rewriting with COMMUTATIVITY-OF-TIMES, EQUAL-LESSP,
EQUAL-TIMES-0, and TIMES-IDENTITY, and unfolding ZEROP, NOT, AND, LESSP, and
EQUAL, to two new goals:
Case 2. (IMPLIES (AND (NOT (LESSP A (TIMES P (WINS2 A N P))))
(NOT (LESSP (WINS2 A N P)
(WINS1 A (MULTS N P))))
(NOT (LESSP (TIMES P (WINS1 A (MULTS N P)))
(TIMES P (WINS2 A N P))))
(NOT (LESSP (WINS1 A (MULTS N P))
(WINS2 A N P))))
(NOT (LESSP A
(TIMES P (WINS1 A (MULTS N P)))))),
which again simplifies, using linear arithmetic, to the conjecture:
(IMPLIES (AND (EQUAL (WINS1 A (MULTS N P))
(WINS2 A N P))
(NOT (LESSP A (TIMES P (WINS2 A N P))))
(NOT (LESSP (WINS2 A N P) (WINS2 A N P)))
(NOT (LESSP (TIMES P (WINS2 A N P))
(TIMES P (WINS2 A N P))))
(NOT (LESSP (WINS2 A N P) (WINS2 A N P))))
(NOT (LESSP A (TIMES P (WINS2 A N P))))).
This again simplifies, obviously, to:
T.
Case 1. (IMPLIES (AND (NOT (LESSP A (TIMES P (WINS2 A N P))))
(NOT (LESSP (WINS2 A N P)
(WINS1 A (MULTS N P))))
(LESSP (TIMES P (WINS1 A (MULTS N P)))
(TIMES P (WINS2 A N P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (WINS1 A (MULTS N P))
(WINS2 A N P)))
(NOT (LESSP A
(TIMES P (WINS1 A (MULTS N P)))))).
This again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LEQ-WINS1
(PROVE-LEMMA LEQ-WINS1-QUOT NIL
(IMPLIES (NOT (ZEROP P))
(LEQ (WINS1 A (MULTS N P))
(QUOTIENT A P)))
((USE (MONOTONE-QUOT (I A)
(J (TIMES (WINS1 A (MULTS N P)) P)))
(LEQ-WINS1))))
This formula can be simplified, using the abbreviations ZEROP, NOT, IMPLIES,
and AND, to:
(IMPLIES
(AND (IMPLIES (IF (LESSP A
(TIMES (WINS1 A (MULTS N P)) P))
F T)
(IF (LESSP (QUOTIENT A P)
(QUOTIENT (TIMES (WINS1 A (MULTS N P)) P)
P))
F T))
(NOT (LESSP A
(TIMES (WINS1 A (MULTS N P)) P)))
(NOT (EQUAL P 0))
(NUMBERP P))
(NOT (LESSP (QUOTIENT A P)
(WINS1 A (MULTS N P))))),
which simplifies, applying COMMUTATIVITY-OF-TIMES and QUOTIENT-TIMES, and
unfolding the function IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LEQ-WINS1-QUOT
(PROVE-LEMMA EQUAL-QUOT-WINS1
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P Q))
(LEQ J (QUOTIENT P 2))
(NOT (ZEROP J))
(NOT (ZEROP Q)))
(EQUAL (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P)))
((USE (LEQ-QUOT-WINS1)
(LEQ-WINS1-QUOT (A (TIMES J Q))
(N (QUOTIENT Q 2))))))
This formula can be simplified, using the abbreviations ZEROP, NOT, PRIME,
IMPLIES, AND, and DIVIDES, to:
(IMPLIES (AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(IF (LESSP (QUOTIENT P 2) J) F T)
(NOT (ZEROP J))
(NOT (ZEROP Q)))
(IF (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P))
F T))
(IMPLIES (NOT (ZEROP P))
(IF (LESSP (QUOTIENT (TIMES J Q) P)
(WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P)))
F T))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL Q 0))
(NUMBERP Q))
(EQUAL (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P))),
which simplifies, opening up PRIME, NOT, ZEROP, AND, and IMPLIES, to:
(IMPLIES (AND (NOT (LESSP (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P)))
(NOT (LESSP (QUOTIENT (TIMES J Q) P)
(WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (LESSP (QUOTIENT P 2) J))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (EQUAL Q 0))
(NUMBERP Q))
(EQUAL (WINS1 (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P))).
This again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
EQUAL-QUOT-WINS1
(PROVE-LEMMA EQUAL-WINS-PLUS-QUOT-LIST
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P Q))
(NOT (ZEROP Q))
(NOT (ZEROP J))
(LEQ J (QUOTIENT P 2)))
(EQUAL (WINS (MULTS J Q)
(MULTS (QUOTIENT Q 2) P))
(PLUS-LIST (QUOT-LIST J Q P))))
((INDUCT (MULTS J Q))))
This formula can be simplified, using the abbreviations ZEROP, PRIME, IMPLIES,
NOT, OR, AND, and DIVIDES, to the following two new goals:
Case 2. (IMPLIES (AND (ZEROP J)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2) J)))
(EQUAL (WINS (MULTS J Q)
(MULTS (QUOTIENT Q 2) P))
(PLUS-LIST (QUOT-LIST J Q P)))).
This simplifies, unfolding the definition of ZEROP, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (ZEROP Q))
(NOT (ZEROP (SUB1 J)))
(IF (LESSP (QUOTIENT P 2) (SUB1 J))
F T))
(EQUAL (WINS (MULTS (SUB1 J) Q)
(MULTS (QUOTIENT Q 2) P))
(PLUS-LIST (QUOT-LIST (SUB1 J) Q P))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (LESSP (QUOTIENT P 2) J)))
(EQUAL (WINS (MULTS J Q)
(MULTS (QUOTIENT Q 2) P))
(PLUS-LIST (QUOT-LIST J Q P)))).
This simplifies, using linear arithmetic, rewriting with the lemmas
COMMUTATIVITY-OF-PLUS, CDR-CONS, EQUAL-QUOT-WINS1, CAR-CONS,
COMMUTATIVITY-OF-TIMES, and CORRECTNESS-OF-CANCEL, and unfolding the
definitions of PRIME, NOT, ZEROP, AND, IMPLIES, MULTS, EQUAL, DIVIDES, WINS,
LISTP, PLUS, QUOT-LIST, PLUS-LIST, and FIX, to:
(IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(LESSP (QUOTIENT P 2) (SUB1 J))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (LESSP (QUOTIENT P 2) J)))
(EQUAL (WINS (MULTS (SUB1 J) Q)
(MULTS (QUOTIENT Q 2) P))
(PLUS-LIST (QUOT-LIST (SUB1 J) Q P)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.6 0.0 ]
EQUAL-WINS-PLUS-QUOT-LIST
(PROVE-LEMMA GAUSS-COROLLARY
(REWRITE)
(IMPLIES (AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P 2))
(NOT (EQUAL Q 2))
(NOT (EQUAL P Q)))
(EQUAL (RES1 (QUOTIENT P 2) Q P)
(RESIDUE Q P)))
((USE (GAUSS-LEMMA (A Q)))
(DISABLE RES1 RESIDUE QUOTIENT PRIME1 REMAINDER)))
This formula can be simplified, using the abbreviations NOT, PRIME, AND,
IMPLIES, and DIVIDES, to:
(IMPLIES (AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (EQUAL (REMAINDER P 2) 0)))
(EQUAL (RES1 (QUOTIENT P 2) Q P)
(RESIDUE Q P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P 2))
(NOT (EQUAL Q 2))
(NOT (EQUAL P Q)))
(EQUAL (RES1 (QUOTIENT P 2) Q P)
(RESIDUE Q P))),
which simplifies, rewriting with LITTLE-STEP, and expanding PRIME, NOT, EQUAL,
AND, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
GAUSS-COROLLARY
(PROVE-LEMMA RESIDUE-QUOT-LIST NIL
(IMPLIES (AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P Q))
(NOT (EQUAL P 2))
(NOT (EQUAL Q 2)))
(EQUAL (EQUAL (RESIDUE Q P) (RESIDUE P Q))
(EVEN3 (PLUS (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) Q P))
(PLUS-LIST (QUOT-LIST (QUOTIENT Q 2) P Q))))))
((USE (RES1-QUOT-LIST (A Q))
(RES1-QUOT-LIST (A P) (P Q))
(EVEN3-EVEN)
(EVEN3-EVEN (P Q)))
(DISABLE RESIDUE RES1 QUOTIENT QUOT-LIST PLUS-LIST
LESSP-REMAINDER-DIVISOR DIFFERENCE LESSP)))
This conjecture can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, EVEN3-PLUS, and DIVIDES, to the formula:
(IMPLIES
(AND
(IMPLIES (AND (PRIME P)
(NOT (EVEN3 P))
(NOT (EVEN3 Q))
(NOT (EQUAL (REMAINDER Q P) 0)))
(EQUAL (RES1 (QUOTIENT P 2) Q P)
(EVEN3 (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) Q P)))))
(IMPLIES (AND (PRIME Q)
(NOT (EVEN3 Q))
(NOT (EVEN3 P))
(NOT (EQUAL (REMAINDER P Q) 0)))
(EQUAL (RES1 (QUOTIENT Q 2) P Q)
(EVEN3 (PLUS-LIST (QUOT-LIST (QUOTIENT Q 2) P Q)))))
(EQUAL (EQUAL (REMAINDER P 2) 0)
(EVEN3 P))
(EQUAL (EQUAL (REMAINDER Q 2) 0)
(EVEN3 Q))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q))
(NOT (EQUAL P 2))
(NOT (EQUAL Q 2)))
(EQUAL (EQUAL (RESIDUE Q P) (RESIDUE P Q))
(EQUAL (EVEN3 (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) Q P)))
(EVEN3 (PLUS-LIST (QUOT-LIST (QUOTIENT Q 2) P Q)))))).
This simplifies, applying the lemmas LITTLE-STEP and GAUSS-COROLLARY, and
expanding the definitions of PRIME, EVEN3, NOT, AND, IMPLIES, and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
RESIDUE-QUOT-LIST
(PROVE-LEMMA ALL-NON-ZEROP-MULTS
(REWRITE)
(IMPLIES (NOT (ZEROP P))
(ALL-NON-ZEROP (MULTS N P))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, and
IMPLIES, to the conjecture:
(IMPLIES (AND (NOT (EQUAL P 0)) (NUMBERP P))
(ALL-NON-ZEROP (MULTS N P))).
Give the above formula the name *1.
Perhaps we can prove it by induction. There is only one plausible
induction. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP N) (p N P))
(IMPLIES (AND (NOT (ZEROP N)) (p (SUB1 N) P))
(p N P))).
Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP
establish that the measure (COUNT N) decreases according to the well-founded
relation LESSP in each induction step of the scheme. The above induction
scheme generates the following two new formulas:
Case 2. (IMPLIES (AND (ZEROP N)
(NOT (EQUAL P 0))
(NUMBERP P))
(ALL-NON-ZEROP (MULTS N P))).
This simplifies, opening up the definitions of ZEROP, EQUAL, MULTS, and
ALL-NON-ZEROP, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(ALL-NON-ZEROP (MULTS (SUB1 N) P))
(NOT (EQUAL P 0))
(NUMBERP P))
(ALL-NON-ZEROP (MULTS N P))).
This simplifies, applying CDR-CONS, EQUAL-TIMES-0, and CAR-CONS, and opening
up ZEROP, MULTS, and ALL-NON-ZEROP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
ALL-NON-ZEROP-MULTS
(PROVE-LEMMA EMPTY-INTERSECT-MULTS-1
(REWRITE)
(IMPLIES (AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P Q))
(LESSP I Q)
(LESSP J P))
(NOT (MEMBER (TIMES I P) (MULTS J Q))))
((INDUCT (MULTS J Q))))
This formula can be simplified, using the abbreviations ZEROP, PRIME, IMPLIES,
NOT, OR, and AND, to the following two new formulas:
Case 2. (IMPLIES (AND (ZEROP J)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q))
(LESSP I Q)
(LESSP J P))
(NOT (MEMBER (TIMES I P) (MULTS J Q)))).
This simplifies, unfolding the functions ZEROP, EQUAL, LESSP, MULTS, LISTP,
and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(IMPLIES (AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P Q))
(LESSP I Q)
(LESSP (SUB1 J) P))
(NOT (MEMBER (TIMES I P)
(MULTS (SUB1 J) Q))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q))
(LESSP I Q)
(LESSP J P))
(NOT (MEMBER (TIMES I P) (MULTS J Q)))).
This simplifies, using linear arithmetic, rewriting with the lemmas CDR-CONS,
HACK1, LITTLE-STEP, COMMUTATIVITY-OF-GCD, DISTRIBUTIVITY-OF-TIMES-OVER-GCD,
PRIME-GCD, TIMES-IDENTITY, and CAR-CONS, and opening up the functions PRIME,
NOT, AND, IMPLIES, LESSP, MULTS, DIVIDES, REMAINDER, and MEMBER, to the new
formula:
(IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (SUB1 J) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q))
(LESSP I Q)
(LESSP (SUB1 J) (SUB1 P)))
(NOT (MEMBER (TIMES I P)
(MULTS (SUB1 J) Q)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.5 0.0 ]
EMPTY-INTERSECT-MULTS-1
(PROVE-LEMMA EMPTY-INTERSECT-MULTS
(REWRITE)
(IMPLIES (AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P Q))
(LESSP I Q))
(NOT (LISTP (INTERSECT (MULTS I P)
(MULTS (QUOTIENT P 2) Q)))))
((USE (EMPTY-INTERSECT-MULTS-1 (J (QUOTIENT P 2))))
(INDUCT (MULTS I P))
(DISABLE PRIME1 QUOTIENT EMPTY-INTERSECT-MULTS-1
LESSP-REMAINDER-DIVISOR)))
This formula can be simplified, using the abbreviation INTERSECT, to:
(IMPLIES
(IMPLIES (AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P Q))
(LESSP I Q)
(LESSP (QUOTIENT P 2) P))
(NOT (MEMBER (TIMES I P)
(MULTS (QUOTIENT P 2) Q))))
(AND
(OR
(NOT (ZEROP I))
(IMPLIES (AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P Q))
(LESSP I Q))
(NOT (LISTP (FOR 'X1
(MULTS I P)
'(MEMBER X1 Y)
'COLLECT
'X1
(LIST (CONS 'Y
(MULTS (QUOTIENT P 2) Q))))))))
(OR
(ZEROP I)
(NOT
(IMPLIES (AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P Q))
(LESSP (SUB1 I) Q))
(NOT (LISTP (FOR 'X1
(MULTS (SUB1 I) P)
'(MEMBER X1 Y)
'COLLECT
'X1
(LIST (CONS 'Y
(MULTS (QUOTIENT P 2) Q))))))))
(IMPLIES
(AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P Q))
(LESSP I Q))
(NOT (LISTP (FOR 'X1
(MULTS I P)
'(MEMBER X1 Y)
'COLLECT
'X1
(LIST (CONS 'Y
(MULTS (QUOTIENT P 2) Q)))))))))),
which simplifies, rewriting with LESSP-QUOTIENT1 and TIMES-ZERO2, and
expanding the definitions of PRIME, NOT, EQUAL, NUMBERP, AND, IMPLIES, ZEROP,
QUOTIENT, MULTS, CONS, MEMBER, LISTP, FOR, CDR, ASSOC,
QUANTIFIER-INITIAL-VALUE, OR, EVAL$, and LESSP, to the following four new
conjectures:
Case 4. (IMPLIES (AND (NOT (MEMBER (TIMES I P)
(MULTS (QUOTIENT P 2) Q)))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q))
(NOT (LISTP (FOR X1 IN
(MULTS (SUB1 I) P)
WHEN
(MEMBER X1 (MULTS (QUOTIENT P 2) Q))
COLLECT X1)))
(LESSP I Q))
(NOT (LISTP (FOR X1 IN
(CONS (TIMES I P) (MULTS (SUB1 I) P))
WHEN
(MEMBER X1 (MULTS (QUOTIENT P 2) Q))
COLLECT X1)))).
But this again simplifies, applying CAR-CONS, CDR-CONS, and REWRITE-EVAL$,
and expanding the functions EVAL$, MEMBER, and FOR, to:
T.
Case 3. (IMPLIES (AND (NOT (MEMBER (TIMES I P)
(MULTS (QUOTIENT P 2) Q)))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q))
(NOT (LESSP (SUB1 I) Q))
(LESSP I Q))
(NOT (LISTP (FOR X1 IN
(CONS (TIMES I P) (MULTS (SUB1 I) P))
WHEN
(MEMBER X1 (MULTS (QUOTIENT P 2) Q))
COLLECT X1)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (MEMBER (TIMES I P)
(MULTS (QUOTIENT P 2) Q)))
(EQUAL I 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q))
(LESSP I Q))
(NOT (LISTP (FOR X1 IN NIL WHEN
(MEMBER X1 (MULTS (QUOTIENT P 2) Q))
COLLECT X1)))),
which again simplifies, unfolding EQUAL, LESSP, MEMBER, LISTP, FOR, CDR,
ASSOC, and QUANTIFIER-INITIAL-VALUE, to:
T.
Case 1. (IMPLIES (AND (NOT (MEMBER (TIMES I P)
(MULTS (QUOTIENT P 2) Q)))
(NOT (NUMBERP I))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q))
(LESSP I Q))
(NOT (LISTP (FOR X1 IN NIL WHEN
(MEMBER X1 (MULTS (QUOTIENT P 2) Q))
COLLECT X1)))),
which again simplifies, unfolding LESSP, MEMBER, LISTP, FOR, CDR, ASSOC, and
QUANTIFIER-INITIAL-VALUE, to:
T.
Q.E.D.
[ 0.0 1.0 0.0 ]
EMPTY-INTERSECT-MULTS
(PROVE-LEMMA EQUAL-PLUS-QUOT-LIST-WINS
(REWRITE)
(IMPLIES (AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P Q)))
(EQUAL (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) Q P))
(WINS (MULTS (QUOTIENT P 2) Q)
(MULTS (QUOTIENT Q 2) P))))
((USE (EQUAL-WINS-PLUS-QUOT-LIST (J (QUOTIENT P 2))))
(DISABLE EQUAL-WINS-PLUS-QUOT-LIST MULTS QUOT-LIST WINS
PLUS-LIST PRIME1)))
This conjecture can be simplified, using the abbreviations NOT, PRIME, AND,
IMPLIES, and DIVIDES, to the conjecture:
(IMPLIES
(AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (ZEROP Q))
(NOT (ZEROP (QUOTIENT P 2)))
(IF (LESSP (QUOTIENT P 2) (QUOTIENT P 2))
F T))
(EQUAL (WINS (MULTS (QUOTIENT P 2) Q)
(MULTS (QUOTIENT Q 2) P))
(PLUS-LIST (QUOT-LIST (QUOTIENT P 2) Q P))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q)))
(EQUAL (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) Q P))
(WINS (MULTS (QUOTIENT P 2) Q)
(MULTS (QUOTIENT Q 2) P)))).
This simplifies, appealing to the lemma LITTLE-STEP, and unfolding the
functions PRIME, NOT, ZEROP, AND, and IMPLIES, to the following two new goals:
Case 2. (IMPLIES (AND (EQUAL (QUOTIENT P 2) 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q)))
(EQUAL (PLUS-LIST (QUOT-LIST 0 Q P))
(WINS (MULTS 0 Q)
(MULTS (QUOTIENT Q 2) P)))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace P by
(PLUS Z (TIMES 2 X)) to eliminate (QUOTIENT P 2) and (REMAINDER P 2). We
employ LESSP-REMAINDER2, the type restriction lemma noted when QUOTIENT was
introduced, and the type restriction lemma noted when REMAINDER was
introduced to constrain the new variables. We must thus prove three new
conjectures:
Case 2.3.
(IMPLIES (AND (EQUAL 2 0)
(EQUAL (QUOTIENT P 2) 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q)))
(EQUAL (PLUS-LIST (QUOT-LIST 0 Q P))
(WINS (MULTS 0 Q)
(MULTS (QUOTIENT Q 2) P)))),
which further simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP 2))
(EQUAL (QUOTIENT P 2) 0)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q)))
(EQUAL (PLUS-LIST (QUOT-LIST 0 Q P))
(WINS (MULTS 0 Q)
(MULTS (QUOTIENT Q 2) P)))),
which further simplifies, obviously, to:
T.
Case 2.1.
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(EQUAL (LESSP Z 2) (NOT (ZEROP 2)))
(NOT (EQUAL 2 0))
(EQUAL X 0)
(NOT (EQUAL (PLUS Z (TIMES 2 X)) 0))
(NOT (EQUAL (PLUS Z (TIMES 2 X)) 1))
(PRIME1 (PLUS Z (TIMES 2 X))
(SUB1 (PLUS Z (TIMES 2 X))))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL (PLUS Z (TIMES 2 X)) Q)))
(EQUAL (PLUS-LIST (QUOT-LIST 0 Q (PLUS Z (TIMES 2 X))))
(WINS (MULTS 0 Q)
(MULTS (QUOTIENT Q 2)
(PLUS Z (TIMES 2 X)))))).
This further simplifies, rewriting with the lemma COMMUTATIVITY-OF-PLUS,
and unfolding the definitions of NUMBERP, ZEROP, NOT, EQUAL, TIMES, and
PLUS, to:
(IMPLIES (AND (NUMBERP Z)
(LESSP Z 2)
(NOT (EQUAL Z 0))
(NOT (EQUAL Z 1))
(PRIME1 Z (SUB1 Z))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL Z Q)))
(EQUAL (PLUS-LIST (QUOT-LIST 0 Q Z))
(WINS (MULTS 0 Q)
(MULTS (QUOTIENT Q 2) Z)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (LESSP (QUOTIENT P 2) (QUOTIENT P 2))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q)))
(EQUAL (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) Q P))
(WINS (MULTS (QUOTIENT P 2) Q)
(MULTS (QUOTIENT Q 2) P)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
EQUAL-PLUS-QUOT-LIST-WINS
(PROVE-LEMMA LAW-OF-QUADRATIC-RECIPROCITY NIL
(IMPLIES (AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P Q))
(NOT (EQUAL P 2))
(NOT (EQUAL Q 2)))
(EQUAL (EQUAL (RESIDUE Q P) (RESIDUE P Q))
(EVEN (TIMES (QUOTIENT P 2)
(QUOTIENT Q 2)))))
((USE (RESIDUE-QUOT-LIST)
(EVEN3-EVEN (P (TIMES (QUOTIENT P 2)
(QUOTIENT Q 2)))))
(HANDS-OFF QUOTIENT QUOT-LIST EVEN3 RESIDUE TIMES)
(DISABLE RESIDUE PRIME1 QUOT-LIST PLUS-LIST EVEN3-PLUS
LESSP-REMAINDER-DIVISOR INTERSECT)))
This formula can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, EVEN, and DIVIDES, to:
(IMPLIES
(AND
(IMPLIES
(AND (PRIME P)
(PRIME Q)
(NOT (EQUAL P Q))
(NOT (EQUAL P 2))
(NOT (EQUAL Q 2)))
(EQUAL (EQUAL (RESIDUE Q P) (RESIDUE P Q))
(EVEN3 (PLUS (PLUS-LIST (QUOT-LIST (QUOTIENT P 2) Q P))
(PLUS-LIST (QUOT-LIST (QUOTIENT Q 2) P Q))))))
(EQUAL (EQUAL (REMAINDER (TIMES (QUOTIENT P 2) (QUOTIENT Q 2))
2)
0)
(EVEN3 (TIMES (QUOTIENT P 2)
(QUOTIENT Q 2))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q))
(NOT (EQUAL P 2))
(NOT (EQUAL Q 2)))
(EQUAL (EQUAL (RESIDUE Q P) (RESIDUE P Q))
(EQUAL 0
(REMAINDER (TIMES (QUOTIENT P 2) (QUOTIENT Q 2))
2)))),
which simplifies, applying EQUAL-PLUS-QUOT-LIST-WINS, ALL-NON-ZEROP-MULTS,
EMPTY-INTERSECT-MULTS, LESSP-QUOTIENT1, LENGTH-MULTS, A-WINNER-EVERY-TIME, and
PRIME-KEY-REWRITE, and opening up PRIME, NOT, AND, EQUAL, NUMBERP, and IMPLIES,
to the following two new goals:
Case 2. (IMPLIES (AND (NOT (EQUAL (RESIDUE Q P) (RESIDUE P Q)))
(NOT (EVEN3 (TIMES (QUOTIENT P 2)
(QUOTIENT Q 2))))
(NOT (EQUAL (REMAINDER (QUOTIENT P 2) 2)
0))
(EQUAL (EQUAL (REMAINDER (QUOTIENT Q 2) 2) 0)
(EVEN3 (TIMES (QUOTIENT P 2)
(QUOTIENT Q 2))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q))
(NOT (EQUAL P 2))
(NOT (EQUAL Q 2)))
(NOT (EQUAL 0
(REMAINDER (QUOTIENT Q 2) 2)))).
This again simplifies, opening up the definition of EQUAL, to:
T.
Case 1. (IMPLIES (AND (EQUAL (RESIDUE Q P) (RESIDUE P Q))
(EQUAL (EVEN3 (TIMES (QUOTIENT P 2) (QUOTIENT Q 2)))
T)
(NOT (EQUAL (REMAINDER (QUOTIENT P 2) 2)
0))
(EQUAL (EQUAL (REMAINDER (QUOTIENT Q 2) 2) 0)
(EVEN3 (TIMES (QUOTIENT P 2)
(QUOTIENT Q 2))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL P Q))
(NOT (EQUAL P 2))
(NOT (EQUAL Q 2)))
(EQUAL 0
(REMAINDER (QUOTIENT Q 2) 2))),
which again simplifies, opening up the function EQUAL, to:
T.
Q.E.D.
[ 0.0 0.6 0.0 ]
LAW-OF-QUADRATIC-RECIPROCITY