(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)
(DEFN SQUARES
(N P)
(IF (ZEROP N)
(CONS 0 NIL)
(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)
(MEMBER (REMAINDER A P)
(SQUARES P P)))
Observe 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.3 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.1 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.1 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))
(NOT (DIVIDES P A))
(RESIDUE A P))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1))
((DISABLE PRIME)))
This formula can be simplified, using the abbreviations NOT, AND, IMPLIES, and
DIVIDES, to:
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER P 2) 0))
(NOT (EQUAL (REMAINDER A P) 0))
(RESIDUE A P))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)),
which simplifies, using linear arithmetic, appealing to the lemma
LESSP-REMAINDER-DIVISOR, and unfolding EQUAL, to the conjecture:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(PRIME P)
(NOT (EQUAL 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(RESIDUE A P))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)).
But this again simplifies, using linear arithmetic, rewriting with the lemmas
B-I-LEMMA2 and EULER-1-7, and opening up the definitions of EQUAL, RESIDUE,
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
(DISABLE INVERSE)
[ 0.0 0.0 0.0 ]
INVERSE-OFF
(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.9 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
(DISABLE COMPLEMENT)
[ 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.4 0.0 ]
COMPLEMENT-IS-UNIQUE
(DISABLE SQUARES)
[ 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, RESIDUE, TIMES, and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.7 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 COMPLEMENTS
(I A P)
(IF (ZEROP I)
NIL
(IF (MEMBER I (COMPLEMENTS (SUB1 I) A P))
(COMPLEMENTS (SUB1 I) A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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, COMPLEMENTS is
accepted under the principle of definition. From the definition we can
conclude that (OR (LITATOM (COMPLEMENTS I A P)) (LISTP (COMPLEMENTS I A P)))
is a theorem.
[ 0.0 0.0 0.0 ]
COMPLEMENTS
(PROVE-LEMMA ALL-NON-ZEROP-COMPLEMENTS
(REWRITE)
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (DIVIDES P A)))
(ALL-NON-ZEROP (COMPLEMENTS I A P)))
((USE (NON-ZEROP-COMPLEMENT (J I)))
(INDUCT (COMPLEMENTS 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 (COMPLEMENTS I A P))))
(OR (ZEROP I)
(NOT (MEMBER I (COMPLEMENTS (SUB1 I) A P)))
(NOT (IMPLIES (AND (PRIME P)
(LESSP (SUB1 I) P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (COMPLEMENTS (SUB1 I) A P))))
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (COMPLEMENTS I A P))))
(OR (ZEROP I)
(MEMBER I (COMPLEMENTS (SUB1 I) A P))
(NOT (IMPLIES (AND (PRIME P)
(LESSP (SUB1 I) P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (COMPLEMENTS (SUB1 I) A P))))
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0)))
(ALL-NON-ZEROP (COMPLEMENTS 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, COMPLEMENTS, 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 (COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (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)
(COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P))
(LESSP I P))
(ALL-NON-ZEROP (CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (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)
(COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P))
(LESSP I P))
(ALL-NON-ZEROP (CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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.5 0.0 ]
ALL-NON-ZEROP-COMPLEMENTS
(PROVE-LEMMA BOUNDED-COMPLEMENTS
(REWRITE)
(IMPLIES (LESSP I P)
(ALL-LESSEQP (COMPLEMENTS I A P)
(SUB1 P)))
((USE (BOUNDED-COMPLEMENT (J I)))
(INDUCT (COMPLEMENTS I A P))))
This formula simplifies, applying SUB1-NNUMBERP, and expanding the definitions
of ZEROP, NOT, IMPLIES, EQUAL, LESSP, SUB1, OR, AND, and COMPLEMENTS, 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 (COMPLEMENTS (SUB1 I) A P))
(NOT (LESSP (SUB1 I) P))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (SUB1 I) (SUB1 P)))
(ALL-LESSEQP (COMPLEMENTS (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 (COMPLEMENTS (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)
(COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(ALL-LESSEQP (COMPLEMENTS (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)
(COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(ALL-LESSEQP (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(ALL-LESSEQP (COMPLEMENTS (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.3 0.0 ]
BOUNDED-COMPLEMENTS
(PROVE-LEMMA SUBSETP-POSITIVES-COMPLEMENTS
(REWRITE)
(SUBSETP (POSITIVES N)
(COMPLEMENTS 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 (COMPLEMENTS (SUB1 N) A P))
(p (SUB1 N) A P))
(p N A P))
(IMPLIES (AND (NOT (ZEROP N))
(NOT (MEMBER N (COMPLEMENTS (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)
(COMPLEMENTS N A P))).
This simplifies, expanding the functions ZEROP, POSITIVES, EQUAL,
COMPLEMENTS, and SUBSETP, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(MEMBER N (COMPLEMENTS (SUB1 N) A P))
(SUBSETP (POSITIVES (SUB1 N))
(COMPLEMENTS (SUB1 N) A P)))
(SUBSETP (POSITIVES N)
(COMPLEMENTS N A P))).
This simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
opening up ZEROP, POSITIVES, COMPLEMENTS, and SUBSETP, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (MEMBER N (COMPLEMENTS (SUB1 N) A P)))
(SUBSETP (POSITIVES (SUB1 N))
(COMPLEMENTS (SUB1 N) A P)))
(SUBSETP (POSITIVES N)
(COMPLEMENTS N A P))).
This simplifies, rewriting with SUBSETP-CONS, CDR-CONS, and CAR-CONS, and
expanding ZEROP, POSITIVES, COMPLEMENTS, MEMBER, and SUBSETP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
SUBSETP-POSITIVES-COMPLEMENTS
(PROVE-LEMMA COMPLEMENTS-CLOSED-1 NIL
(IMPLIES (AND (PRIME P)
(NOT (ZEROP I))
(LESSP I P)
(NOT (DIVIDES P A))
(MEMBER J (COMPLEMENTS I A P)))
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS I A P)))
((USE (COMPLEMENT-OF-COMPLEMENT (J I)))
(INDUCT (COMPLEMENTS 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 (COMPLEMENTS I A P)))
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS I A P))))
(OR (ZEROP I)
(NOT (MEMBER I (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS (SUB1 I) A P))))
(IMPLIES (AND (PRIME P)
(NOT (ZEROP I))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMPLEMENTS I A P)))
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS I A P))))
(OR (ZEROP I)
(MEMBER I (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS (SUB1 I) A P))))
(IMPLIES (AND (PRIME P)
(NOT (ZEROP I))
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(MEMBER J (COMPLEMENTS I A P)))
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS 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, COMPLEMENTS, 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 (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P))
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS (SUB1 I) A P)))),
which again simplifies, expanding REMAINDER, to:
T.
Case 16.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(MEMBER I (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 15.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(MEMBER I (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS (SUB1 I) A P)))),
which again simplifies, expanding REMAINDER, to:
T.
Case 14.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (MEMBER I (COMPLEMENTS (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)
(COMPLEMENTS (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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 (COMPLEMENTS (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)
(COMPLEMENTS (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (SUB1 I) A P)))))),
which again simplifies, using linear arithmetic, to:
T.
Case 12.(IMPLIES (AND (EQUAL (REMAINDER I P) 0)
(NOT (MEMBER I (COMPLEMENTS (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)
(COMPLEMENTS (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P))
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(OR F
(MEMBER (COMPLEMENT J A P)
(COMPLEMENTS (SUB1 I) A P)))),
which again simplifies, opening up the functions REMAINDER, EQUAL,
COMPLEMENTS, LISTP, and MEMBER, to:
T.
Case 4. (IMPLIES (AND (EQUAL (COMPLEMENT (COMPLEMENT I A P) A P)
(REMAINDER I P))
(NOT (MEMBER I (COMPLEMENTS (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)
(COMPLEMENTS (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (SUB1 I) A P)))))),
which again simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS, and
unfolding the functions REMAINDER, EQUAL, COMPLEMENTS, 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 (COMPLEMENTS (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)
(COMPLEMENTS (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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 (COMPLEMENTS (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)
(COMPLEMENTS (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(MEMBER J
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (SUB1 I) A P)))))
(OR F
(MEMBER (COMPLEMENT J A P)
(CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (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)
(COMPLEMENTS (SUB1 I) A P))).
This again simplifies, obviously, to:
T.
Q.E.D.
[ 0.0 4.5 0.0 ]
COMPLEMENTS-CLOSED-1
(PROVE-LEMMA COMPLEMENTS-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)
(COMPLEMENTS I A P)))
(MEMBER J (COMPLEMENTS I A P)))
((USE (COMPLEMENT-OF-COMPLEMENT)
(COMPLEMENTS-CLOSED-1 (J (COMPLEMENT J A P))))
(DISABLE COMPLEMENT-OF-COMPLEMENT COMPLEMENTS)))
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)
(COMPLEMENTS I A P)))
(MEMBER (COMPLEMENT (COMPLEMENT J A P) A P)
(COMPLEMENTS 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)
(COMPLEMENTS I A P)))
(MEMBER J (COMPLEMENTS 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 ]
COMPLEMENTS-CLOSED-2
(PROVE-LEMMA ALL-DISTINCT-COMPLEMENTS-1 NIL
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (DIVIDES P A))
(NOT (RESIDUE A P))
(ALL-DISTINCT (COMPLEMENTS (SUB1 I) A P)))
(ALL-DISTINCT (COMPLEMENTS I A P)))
((USE (COMPLEMENTS-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)
(COMPLEMENTS (SUB1 I) A P)))
(MEMBER I (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(ALL-DISTINCT (COMPLEMENTS I A P))),
which simplifies, rewriting with SUB1-NNUMBERP and REMAINDER-0-CROCK, and
opening up the functions ZEROP, NOT, AND, IMPLIES, REMAINDER, RESIDUE, EQUAL,
COMPLEMENTS, 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 (COMPLEMENTS (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I
(COMPLEMENTS (SUB1 I) A P))))
(ALL-DISTINCT (CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (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)
(COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I
(COMPLEMENTS (SUB1 I) A P))))
(ALL-DISTINCT (CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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)
(COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P))
(EQUAL I 0))
(ALL-DISTINCT NIL)),
which again simplifies, expanding the functions SUB1, EQUAL, COMPLEMENTS,
LISTP, MEMBER, LESSP, and ALL-DISTINCT, to:
T.
Case 3. (IMPLIES (AND (NOT (MEMBER (COMPLEMENT I A P)
(COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P))
(NOT (NUMBERP I)))
(ALL-DISTINCT NIL)),
which again simplifies, rewriting with SUB1-NNUMBERP, and expanding the
definitions of EQUAL, COMPLEMENTS, LISTP, MEMBER, LESSP, and ALL-DISTINCT,
to:
T.
Case 2. (IMPLIES (AND (MEMBER I (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P))
(NOT (NUMBERP I)))
(ALL-DISTINCT NIL)).
However this again simplifies, applying SUB1-NNUMBERP, and expanding the
definitions of EQUAL, COMPLEMENTS, LISTP, and MEMBER, to:
T.
Case 1. (IMPLIES (AND (MEMBER I (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P))
(EQUAL I 0))
(ALL-DISTINCT NIL)).
But this again simplifies, expanding the definitions of SUB1, EQUAL,
COMPLEMENTS, and MEMBER, to:
T.
Q.E.D.
[ 0.0 0.7 0.0 ]
ALL-DISTINCT-COMPLEMENTS-1
(PROVE-LEMMA ALL-DISTINCT-COMPLEMENTS
(REWRITE)
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (DIVIDES P A))
(NOT (RESIDUE A P)))
(ALL-DISTINCT (COMPLEMENTS I A P)))
((USE (ALL-DISTINCT-COMPLEMENTS-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 (COMPLEMENTS (SUB1 I) A P)))
(ALL-DISTINCT (COMPLEMENTS 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 (COMPLEMENTS 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 (COMPLEMENTS (SUB1 I) A P))))
(IMPLIES (AND (PRIME P)
(LESSP I P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(ALL-DISTINCT (COMPLEMENTS I A P)))))),
which simplifies, rewriting with SUB1-NNUMBERP, and expanding the functions
NOT, RESIDUE, AND, COMPLEMENTS, 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)
(COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
(ALL-DISTINCT (COMPLEMENTS (SUB1 I) A P))).
This again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(MEMBER I (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P))),
which again simplifies, using linear arithmetic, to:
T.
Case 4. (IMPLIES (AND (NOT (ALL-DISTINCT (COMPLEMENTS (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)
(COMPLEMENTS (SUB1 I) A P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (NOT (ALL-DISTINCT (COMPLEMENTS (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
(COMPLEMENTS (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (ALL-DISTINCT (COMPLEMENTS (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,
COMPLEMENTS, and ALL-DISTINCT, to:
T.
Case 1. (IMPLIES (AND (NOT (ALL-DISTINCT (COMPLEMENTS (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, COMPLEMENTS, and ALL-DISTINCT, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
ALL-DISTINCT-COMPLEMENTS
(PROVE-LEMMA PERM-POSITIVES-COMPLEMENTS
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(NOT (RESIDUE A P)))
(PERM (POSITIVES (SUB1 P))
(COMPLEMENTS (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))
(COMPLEMENTS (SUB1 P) A P))).
This simplifies, using linear arithmetic, appealing to the lemmas
SUBSETP-POSITIVES-COMPLEMENTS, BOUNDED-COMPLEMENTS, ALL-NON-ZEROP-COMPLEMENTS,
ALL-DISTINCT-COMPLEMENTS, and PIGEONHOLE2, and unfolding RESIDUE, PRIME, and
DIVIDES, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
PERM-POSITIVES-COMPLEMENTS
(PROVE-LEMMA COMPLEMENTS-FACT
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(NOT (RESIDUE A P)))
(EQUAL (TIMES-LIST (COMPLEMENTS (SUB1 P) A P))
(FACT (SUB1 P))))
((USE (TIMES-LIST-EQUAL-FACT (N (SUB1 P))
(L (COMPLEMENTS (SUB1 P) A P))))
(DISABLE TIMES-LIST-EQUAL-FACT COMPLEMENTS)))
This formula can be simplified, using the abbreviations NOT, PRIME, AND,
IMPLIES, and DIVIDES, to:
(IMPLIES (AND (IMPLIES (PERM (POSITIVES (SUB1 P))
(COMPLEMENTS (SUB1 P) A P))
(EQUAL (TIMES-LIST (COMPLEMENTS (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 (COMPLEMENTS (SUB1 P) A P))
(FACT (SUB1 P)))),
which simplifies, using linear arithmetic, applying PERM-POSITIVES-COMPLEMENTS,
and expanding the functions DIVIDES, PRIME, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
COMPLEMENTS-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-COMPLEMENTS-1 NIL
(IMPLIES
(AND (EQUAL (REMAINDER (TIMES I (COMPLEMENT I A P))
P)
(REMAINDER A P))
(AND (NOT (ZEROP I))
(NOT (MEMBER I
(COMPLEMENTS (SUB1 I) A P)))))
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS I A P))
P)
(REMAINDER (TIMES A
(REMAINDER (TIMES-LIST (COMPLEMENTS (SUB1 I) A P))
P))
P)))
((USE (TIMES-MOD-4 (J (COMPLEMENT I A P))
(K (TIMES-LIST (COMPLEMENTS (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 (COMPLEMENTS (SUB1 I) A P)))
P)
(REMAINDER (TIMES A
(TIMES-LIST (COMPLEMENTS (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
(COMPLEMENTS (SUB1 I) A P))))
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS I A P))
P)
(REMAINDER (TIMES A
(TIMES-LIST (COMPLEMENTS (SUB1 I) A P)))
P))),
which simplifies, rewriting with CDR-CONS and CAR-CONS, and opening up IMPLIES,
COMPLEMENTS, and TIMES-LIST, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
TIMES-COMPLEMENTS-1
(PROVE-LEMMA TIMES-COMPLEMENTS-2 NIL
(IMPLIES
(AND (PRIME P)
(NOT (DIVIDES P I))
(NOT (MEMBER I
(COMPLEMENTS (SUB1 I) A P))))
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS I A P))
P)
(REMAINDER (TIMES A
(REMAINDER (TIMES-LIST (COMPLEMENTS (SUB1 I) A P))
P))
P)))
((USE (TIMES-COMPLEMENTS-1)
(COMPLEMENT-WORKS (J I)))
(DISABLE COMPLEMENT-WORKS COMPLEMENTS 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
(COMPLEMENTS (SUB1 I) A P))))
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS I A P))
P)
(REMAINDER (TIMES A
(TIMES-LIST (COMPLEMENTS (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
(COMPLEMENTS (SUB1 I) A P))))
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS I A P))
P)
(REMAINDER (TIMES A
(TIMES-LIST (COMPLEMENTS (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.3 0.0 ]
TIMES-COMPLEMENTS-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-COMPLEMENTS-3 NIL
(IMPLIES (AND (NOT (ZEROP I))
(NOT (MEMBER I
(COMPLEMENTS (SUB1 I) A P))))
(EQUAL (QUOTIENT (LENGTH (COMPLEMENTS I A P))
2)
(ADD1 (QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2))))
((USE (QUOTIENT-PLUS-1 (X (LENGTH (COMPLEMENTS (SUB1 I) A P)))
(Y (LENGTH (COMPLEMENTS 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 (COMPLEMENTS (SUB1 I) A P)))
(EQUAL (LENGTH (COMPLEMENTS I A P))
(PLUS (LENGTH (COMPLEMENTS (SUB1 I) A P))
2)))
(EQUAL (QUOTIENT (LENGTH (COMPLEMENTS I A P))
2)
(ADD1 (QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2))))
(NOT (EQUAL I 0))
(NUMBERP I)
(NOT (MEMBER I
(COMPLEMENTS (SUB1 I) A P))))
(EQUAL (QUOTIENT (LENGTH (COMPLEMENTS I A P))
2)
(ADD1 (QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2)))).
This simplifies, applying CDR-CONS, COMMUTATIVITY-OF-PLUS, DIFFERENCE-2, and
SUB1-ADD1, and opening up ZEROP, NOT, COMPLEMENTS, LENGTH, AND, LESSP, SUB1,
NUMBERP, EQUAL, QUOTIENT, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
TIMES-COMPLEMENTS-3
(PROVE-LEMMA TIMES-COMPLEMENTS-4 NIL
(IMPLIES
(AND (PRIME P)
(NOT (ZEROP I))
(LESSP I P)
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2))
P)))
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS I A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS I A P))
2))
P)))
((USE (TIMES-COMPLEMENTS-2)
(TIMES-COMPLEMENTS-3)
(TIMES-MOD-1 (X A)
(Y (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS (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
(COMPLEMENTS (SUB1 I) A P))))
(EQUAL
(REMAINDER (TIMES-LIST (COMPLEMENTS I A P))
P)
(REMAINDER (TIMES A
(REMAINDER (TIMES-LIST (COMPLEMENTS (SUB1 I) A P))
P))
P)))
(IMPLIES (AND (NOT (ZEROP I))
(NOT (MEMBER I
(COMPLEMENTS (SUB1 I) A P))))
(EQUAL (QUOTIENT (LENGTH (COMPLEMENTS I A P))
2)
(ADD1 (QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2))))
(EQUAL
(REMAINDER
(TIMES A
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2))
P))
P)
(REMAINDER (TIMES A
(EXP A
(QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2)))
P))
(PRIME P)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2))
P)))
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS I A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS 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, COMPLEMENTS, 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)
(COMPLEMENTS (SUB1 I) A P))))
P)
(REMAINDER (TIMES A
(REMAINDER (TIMES-LIST (COMPLEMENTS (SUB1 I) A P))
P))
P))
(EQUAL (QUOTIENT (LENGTH (CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (SUB1 I) A P))))
2)
(ADD1 (QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2)))
(PRIME P)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2))
P))
(NOT (MEMBER I
(COMPLEMENTS (SUB1 I) A P))))
(EQUAL
(REMAINDER (TIMES-LIST (CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (SUB1 I) A P))))
P)
(REMAINDER
(EXP A
(QUOTIENT (LENGTH (CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (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)
(COMPLEMENTS (SUB1 I) A P))))
P)
(REMAINDER (TIMES A
(REMAINDER (TIMES-LIST (COMPLEMENTS (SUB1 I) A P))
P))
P))
(EQUAL (QUOTIENT (LENGTH (CONS I
(CONS (COMPLEMENT I A P)
(COMPLEMENTS (SUB1 I) A P))))
2)
(ADD1 (QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2)))
(PRIME P)
(NOT (EQUAL I 0))
(NUMBERP I)
(LESSP I P)
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2))
P))
(MEMBER I (COMPLEMENTS (SUB1 I) A P)))
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS (SUB1 I) A P))
2))
P))).
This again simplifies, trivially, to:
T.
Q.E.D.
[ 0.0 2.3 0.0 ]
TIMES-COMPLEMENTS-4
(PROVE-LEMMA TIMES-COMPLEMENTS-5 NIL
(IMPLIES (ZEROP I)
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS I A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS I A P))
2))
P))))
This formula simplifies, rewriting with REMAINDER-OF-1 and EXP-BY-0, and
opening up the functions ZEROP, EQUAL, COMPLEMENTS, TIMES-LIST, LENGTH, and
QUOTIENT, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
TIMES-COMPLEMENTS-5
(PROVE-LEMMA TIMES-COMPLEMENTS
(REWRITE)
(IMPLIES (AND (PRIME P) (LESSP I P))
(EQUAL (REMAINDER (TIMES-LIST (COMPLEMENTS I A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS I A P))
2))
P)))
((USE (TIMES-COMPLEMENTS-4)
(TIMES-COMPLEMENTS-5))
(INDUCT (POSITIVES I))
(DISABLE PRIME REMAINDER TIMES-LIST COMPLEMENTS 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 (COMPLEMENTS (SUB1 I) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS (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 (COMPLEMENTS I A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS I A P))
2))
P))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
TIMES-COMPLEMENTS
(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 (COMPLEMENTS (SUB1 P) A P))
2))
P)
(SUB1 P)))
((USE (TIMES-COMPLEMENTS (I (SUB1 P)))
(COMPLEMENTS-FACT)
(WILSON-THM))
(DISABLE TIMES-COMPLEMENTS COMPLEMENTS-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 (COMPLEMENTS (SUB1 P) A P))
P)
(REMAINDER (EXP A
(QUOTIENT (LENGTH (COMPLEMENTS (SUB1 P) A P))
2))
P)))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(EQUAL (TIMES-LIST (COMPLEMENTS (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 (COMPLEMENTS (SUB1 P) A P))
2))
P)
(SUB1 P))).
This simplifies, unfolding the functions PRIME, AND, IMPLIES, NOT, and RESIDUE,
to:
(IMPLIES
(AND (NOT (LESSP (SUB1 P) P))
(EQUAL (TIMES-LIST (COMPLEMENTS (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 (COMPLEMENTS (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 (COMPLEMENTS (SUB1 P) A P))
(SUB1 P)))
((USE (EQUAL-LENGTH-PERM (A (POSITIVES (SUB1 P)))
(B (COMPLEMENTS (SUB1 P) A P)))
(PERM-POSITIVES-COMPLEMENTS))
(DISABLE EQUAL-LENGTH-PERM PERM-POSITIVES-COMPLEMENTS)))
This conjecture can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, and DIVIDES, to:
(IMPLIES (AND (IMPLIES (PERM (POSITIVES (SUB1 P))
(COMPLEMENTS (SUB1 P) A P))
(EQUAL (LENGTH (POSITIVES (SUB1 P)))
(LENGTH (COMPLEMENTS (SUB1 P) A P))))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(PERM (POSITIVES (SUB1 P))
(COMPLEMENTS (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 (COMPLEMENTS (SUB1 P) A P))
(SUB1 P))).
This simplifies, using linear arithmetic, rewriting with
SUBSETP-POSITIVES-COMPLEMENTS, BOUNDED-COMPLEMENTS, ALL-NON-ZEROP-COMPLEMENTS,
ALL-DISTINCT-COMPLEMENTS, 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.2 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
COMPLEMENTS)))
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 EVENP
(X)
(IF (ZEROP X)
T
(NOT (EVENP (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, EVENP is accepted under the
principle of definition. From the definition we can conclude that:
(OR (FALSEP (EVENP X))
(TRUEP (EVENP X)))
is a theorem.
[ 0.0 0.0 0.0 ]
EVENP
(PROVE-LEMMA EVENP-PLUS
(REWRITE)
(EQUAL (EVENP (PLUS A B))
(EQUAL (EVENP A) (EVENP B))))
This simplifies, obviously, to two new formulas:
Case 2. (IMPLIES (NOT (EQUAL (EVENP A) (EVENP B)))
(NOT (EVENP (PLUS A B)))),
which we will name *1.
Case 1. (IMPLIES (EQUAL (EVENP A) (EVENP B))
(EQUAL (EVENP (PLUS A B)) T)).
This again simplifies, trivially, to:
(IMPLIES (EQUAL (EVENP A) (EVENP B))
(EVENP (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 (EVENP (PLUS A B))
(EQUAL (EVENP A) (EVENP 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 (EVENP (PLUS A B))
(EQUAL (EVENP A) (EVENP B)))).
This simplifies, opening up the functions ZEROP, EQUAL, PLUS, and EVENP, to
the following two new goals:
Case 2.2.
(IMPLIES (AND (EQUAL A 0) (NOT (NUMBERP B)))
(EQUAL (EVENP 0) (EVENP B))).
This again simplifies, opening up the definitions of EVENP and EQUAL, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (NUMBERP A))
(NOT (NUMBERP B)))
(EQUAL (EVENP 0) (EVENP B))),
which again simplifies, expanding the definitions of EVENP and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP A))
(EQUAL (EVENP (PLUS (SUB1 A) B))
(EQUAL (EVENP (SUB1 A)) (EVENP B))))
(EQUAL (EVENP (PLUS A B))
(EQUAL (EVENP A) (EVENP B)))),
which simplifies, applying SUB1-ADD1, and expanding the definitions of ZEROP,
PLUS, and EVENP, to the following four new conjectures:
Case 1.4.
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(NOT (EQUAL (EVENP (SUB1 A)) (EVENP B)))
(NOT (EVENP (PLUS (SUB1 A) B)))
(NOT (EVENP (SUB1 A))))
(EQUAL T (EVENP 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 (EVENP (SUB1 A)) (EVENP B)))
(NOT (EVENP (PLUS (SUB1 A) B)))
(EVENP (SUB1 A)))
(EQUAL F (EVENP B))),
which again simplifies, unfolding EQUAL, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(EQUAL (EVENP (SUB1 A)) (EVENP B))
(EQUAL (EVENP (PLUS (SUB1 A) B)) T)
(EVENP B))
(NOT (EQUAL F (EVENP B)))),
which again simplifies, trivially, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(EQUAL (EVENP (SUB1 A)) (EVENP B))
(EQUAL (EVENP (PLUS (SUB1 A) B)) T)
(NOT (EVENP B)))
(NOT (EQUAL T (EVENP B)))).
This again simplifies, obviously, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
EVENP-PLUS
(PROVE-LEMMA EVENP-DIFF
(REWRITE)
(EQUAL (EVENP (DIFFERENCE P X))
(OR (LESSP P X)
(EQUAL (EVENP P) (EVENP X)))))
This simplifies, unfolding the function OR, to the following two new formulas:
Case 2. (IMPLIES (NOT (LESSP P X))
(EQUAL (EVENP (DIFFERENCE P X))
(EQUAL (EVENP P) (EVENP X)))).
This again simplifies, trivially, to the following two new conjectures:
Case 2.2.
(IMPLIES (AND (NOT (LESSP P X))
(NOT (EQUAL (EVENP P) (EVENP X))))
(NOT (EVENP (DIFFERENCE P X)))).
Appealing to the lemma DIFFERENCE-ELIM, we now replace P by (PLUS X Z) to
eliminate (DIFFERENCE P X). We rely upon the type restriction lemma noted
when DIFFERENCE was introduced to constrain the new variable. The result
is two new conjectures:
Case 2.2.2.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (LESSP P X))
(NOT (EQUAL (EVENP P) (EVENP X))))
(NOT (EVENP (DIFFERENCE P X)))),
which further simplifies, expanding the definitions of LESSP, EVENP, and
EQUAL, to:
T.
Case 2.2.1.
(IMPLIES (AND (NUMBERP Z)
(NOT (LESSP (PLUS X Z) X))
(NOT (EQUAL (EVENP (PLUS X Z)) (EVENP X))))
(NOT (EVENP Z))),
which further simplifies, applying EVENP-PLUS, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (LESSP P X))
(EQUAL (EVENP P) (EVENP X)))
(EQUAL (EVENP (DIFFERENCE P X)) T)).
This again simplifies, trivially, to the new conjecture:
(IMPLIES (AND (NOT (LESSP P X))
(EQUAL (EVENP P) (EVENP X)))
(EVENP (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 goals:
Case 2.1.2.
(IMPLIES (AND (NOT (NUMBERP P))
(NOT (LESSP P X))
(EQUAL (EVENP P) (EVENP X)))
(EVENP (DIFFERENCE P X))).
But this further simplifies, using linear arithmetic, applying
DIFFERENCE-0, and unfolding the functions LESSP, EVENP, and EQUAL, to:
T.
Case 2.1.1.
(IMPLIES (AND (NUMBERP Z)
(NOT (LESSP (PLUS X Z) X))
(EQUAL (EVENP (PLUS X Z)) (EVENP X)))
(EVENP Z)).
This further simplifies, rewriting with EVENP-PLUS, to:
T.
Case 1. (IMPLIES (LESSP P X)
(EQUAL (EVENP (DIFFERENCE P X)) T)).
This again simplifies, using linear arithmetic, rewriting with DIFFERENCE-0,
and expanding the definitions of EVENP and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EVENP-DIFF
(PROVE-LEMMA EVENP-TIMES
(REWRITE)
(EQUAL (EVENP (TIMES A B))
(OR (EVENP A) (EVENP B))))
This simplifies, unfolding the definition of OR, to the following two new
goals:
Case 2. (IMPLIES (NOT (EVENP A))
(EQUAL (EVENP (TIMES A B))
(EVENP B))).
Name the above subgoal *1.
Case 1. (IMPLIES (EVENP A)
(EQUAL (EVENP (TIMES A B)) T)).
This again simplifies, trivially, to:
(IMPLIES (EVENP A)
(EVENP (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 (EVENP (TIMES A B))
(OR (EVENP A) (EVENP 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 (EVENP (TIMES A B))
(OR (EVENP A) (EVENP B)))),
which simplifies, applying the lemmas TIMES-IDENTITY and EQUAL-TIMES-0, and
opening up ZEROP, EQUAL, EVENP, and OR, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP A))
(EQUAL (EVENP (TIMES (SUB1 A) B))
(OR (EVENP (SUB1 A)) (EVENP B))))
(EQUAL (EVENP (TIMES A B))
(OR (EVENP A) (EVENP B)))),
which simplifies, applying the lemma COMMUTATIVITY-OF-TIMES, and opening up
ZEROP, OR, and EVENP, to two new conjectures:
Case 1.2.
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(NOT (EVENP (SUB1 A)))
(EQUAL (EVENP (TIMES B (SUB1 A)))
(EVENP B)))
(EVENP (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 (EVENP X))
(EQUAL (EVENP (TIMES B X)) (EVENP B)))
(EVENP (TIMES (ADD1 X) B))),
which further simplifies, rewriting with TIMES-ADD1,
COMMUTATIVITY-OF-TIMES, and EVENP-PLUS, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(EVENP (SUB1 A))
(EQUAL (EVENP (TIMES B (SUB1 A))) T))
(EQUAL (EVENP (TIMES A B))
(EVENP B))).
This again simplifies, clearly, to:
(IMPLIES (AND (NOT (EQUAL A 0))
(NUMBERP A)
(EVENP (SUB1 A))
(EVENP (TIMES B (SUB1 A))))
(EQUAL (EVENP (TIMES A B))
(EVENP 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))
(EVENP X)
(EVENP (TIMES B X)))
(EQUAL (EVENP (TIMES (ADD1 X) B))
(EVENP B))),
which further simplifies, applying TIMES-ADD1, COMMUTATIVITY-OF-TIMES, and
EVENP-PLUS, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
EVENP-TIMES
(PROVE-LEMMA EVENP-EVEN
(REWRITE)
(EQUAL (EVEN P) (EVENP P)))
WARNING: Note that the rewrite rule EVENP-EVEN will be stored so as to apply
only to terms with the nonrecursive function symbol EVEN.
This formula can be simplified, using the abbreviation EVEN, to:
(EQUAL (EQUAL 0 (REMAINDER P 2))
(EVENP P)),
which simplifies, trivially, to the following two new goals:
Case 2. (IMPLIES (NOT (EQUAL 0 (REMAINDER P 2)))
(NOT (EVENP P))).
But this again simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, and unfolding EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL 0 1)))
(NOT (EVENP P))),
which again simplifies, opening up EQUAL, to the conjecture:
(IMPLIES (EQUAL (REMAINDER P 2) 1)
(NOT (EVENP 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
rely upon LESSP-REMAINDER2, the type restriction lemma noted when REMAINDER
was introduced, and the type restriction lemma noted when QUOTIENT was
introduced to constrain the new variables. The result is four new goals:
Case 2.4.
(IMPLIES (AND (NOT (NUMBERP P))
(EQUAL (REMAINDER P 2) 1))
(NOT (EVENP P))),
which further simplifies, unfolding the definitions of LESSP, NUMBERP,
EQUAL, and REMAINDER, to:
T.
Case 2.3.
(IMPLIES (AND (EQUAL 2 0)
(EQUAL (REMAINDER P 2) 1))
(NOT (EVENP P))),
which further simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP 2))
(EQUAL (REMAINDER P 2) 1))
(NOT (EVENP P))),
which further simplifies, trivially, 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 (EVENP (PLUS X (TIMES 2 Z))))).
However this further simplifies, rewriting with the lemmas TIMES-2 and
EVENP-PLUS, and expanding the definitions of NUMBERP, LESSP, ZEROP, NOT,
EQUAL, and EVENP, to:
T.
Case 1. (IMPLIES (EQUAL 0 (REMAINDER P 2))
(EQUAL (EVENP P) T)),
which again simplifies, obviously, to:
(IMPLIES (EQUAL 0 (REMAINDER P 2))
(EVENP 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. We thus obtain the following four
new goals:
Case 1.4.
(IMPLIES (AND (NOT (NUMBERP P))
(EQUAL 0 (REMAINDER P 2)))
(EVENP P)).
But this further simplifies, expanding the definitions of LESSP, NUMBERP,
EQUAL, REMAINDER, and EVENP, to:
T.
Case 1.3.
(IMPLIES (AND (EQUAL 2 0)
(EQUAL 0 (REMAINDER P 2)))
(EVENP P)),
which further simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP 2))
(EQUAL 0 (REMAINDER P 2)))
(EVENP 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 0 X))
(EVENP (PLUS X (TIMES 2 Z)))).
This further simplifies, rewriting with the lemmas TIMES-2 and EVENP-PLUS,
and expanding NUMBERP, LESSP, ZEROP, NOT, EQUAL, and EVENP, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
EVENP-EVEN
(PROVE-LEMMA EVEN-PLUS
(REWRITE)
(EQUAL (EVEN (PLUS A B))
(EQUAL (EVEN A) (EVEN B)))
((DISABLE EVEN)))
WARNING: Note that the rewrite rule EVEN-PLUS will be stored so as to apply
only to terms with the nonrecursive function symbol EVEN.
WARNING: the previously added lemma, EVENP-EVEN, could be applied whenever
the newly proposed EVEN-PLUS could!
This formula can be simplified, using the abbreviations EVENP-PLUS and
EVENP-EVEN, to:
(EQUAL (EQUAL (EVENP A) (EVENP B))
(EQUAL (EVENP A) (EVENP B))),
which simplifies, trivially, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EVEN-PLUS
(PROVE-LEMMA EVEN-DIFF
(REWRITE)
(EQUAL (EVEN (DIFFERENCE P X))
(OR (LESSP P X)
(EQUAL (EVEN P) (EVEN X))))
((DISABLE EVEN)))
WARNING: Note that the rewrite rule EVEN-DIFF will be stored so as to apply
only to terms with the nonrecursive function symbol EVEN.
WARNING: the previously added lemma, EVENP-EVEN, could be applied whenever
the newly proposed EVEN-DIFF could!
This formula can be simplified, using the abbreviation EVENP-EVEN, to:
(EQUAL (EVENP (DIFFERENCE P X))
(OR (LESSP P X)
(EQUAL (EVENP P) (EVENP X)))),
which simplifies, rewriting with EVENP-DIFF, and expanding the function OR, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EVEN-DIFF
(PROVE-LEMMA EVEN-TIMES
(REWRITE)
(EQUAL (EVEN (TIMES A B))
(OR (EVEN A) (EVEN B)))
((DISABLE EVEN)))
WARNING: Note that the rewrite rule EVEN-TIMES will be stored so as to apply
only to terms with the nonrecursive function symbol EVEN.
WARNING: the previously added lemma, EVENP-EVEN, could be applied whenever
the newly proposed EVEN-TIMES could!
This formula can be simplified, using the abbreviation EVENP-EVEN, to:
(EQUAL (EVENP (TIMES A B))
(OR (EVENP A) (EVENP B))),
which simplifies, rewriting with the lemma EVENP-TIMES, and expanding the
function OR, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EVEN-TIMES
(PROVE-LEMMA EVEN-REM
(REWRITE)
(IMPLIES (NOT (EVEN P))
(EQUAL (EVEN (DIFFERENCE P (REMAINDER X P)))
(NOT (EVEN (REMAINDER X P)))))
((DISABLE EVEN)))
WARNING: Note that the rewrite rule EVEN-REM will be stored so as to apply
only to terms with the nonrecursive function symbol EVEN.
WARNING: the previously added lemma, EVEN-DIFF, could be applied whenever the
newly proposed EVEN-REM could!
WARNING: the previously added lemma, EVENP-EVEN, could be applied whenever
the newly proposed EVEN-REM could!
This formula can be simplified, using the abbreviations NOT, IMPLIES, and
EVENP-EVEN, to the new formula:
(IMPLIES (NOT (EVENP P))
(EQUAL (EVENP (DIFFERENCE P (REMAINDER X P)))
(NOT (EVENP (REMAINDER X P))))),
which simplifies, appealing to the lemma EVENP-DIFF, and unfolding the
function NOT, to:
(IMPLIES (AND (NOT (EVENP P))
(EVENP (REMAINDER X P)))
(NOT (LESSP P (REMAINDER X P)))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now 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 constrain the new variables. We must thus prove four new formulas:
Case 4. (IMPLIES (AND (NOT (NUMBERP X))
(NOT (EVENP P))
(EVENP (REMAINDER X P)))
(NOT (LESSP P (REMAINDER X P)))),
which further simplifies, opening up LESSP, REMAINDER, EVENP, and EQUAL, to:
T.
Case 3. (IMPLIES (AND (EQUAL P 0)
(NOT (EVENP P))
(EVENP (REMAINDER X P)))
(NOT (LESSP P (REMAINDER X P)))),
which further simplifies, unfolding the function EVENP, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP P))
(NOT (EVENP P))
(EVENP (REMAINDER X P)))
(NOT (LESSP P (REMAINDER X P)))),
which further simplifies, opening up the function EVENP, to:
T.
Case 1. (IMPLIES (AND (NUMBERP Z)
(EQUAL (LESSP Z P) (NOT (ZEROP P)))
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EVENP P))
(EVENP Z))
(NOT (LESSP P Z))),
which further simplifies, expanding the functions ZEROP and NOT, to:
(IMPLIES (AND (NUMBERP Z)
(LESSP Z P)
(NUMBERP V)
(NUMBERP P)
(NOT (EQUAL P 0))
(NOT (EVENP P))
(EVENP Z))
(NOT (LESSP P Z))).
But this again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
EVEN-REM
(PROVE-LEMMA EVEN-ADD1
(REWRITE)
(EQUAL (EVEN (ADD1 X)) (NOT (EVEN X)))
((DISABLE EVEN)))
WARNING: Note that the rewrite rule EVEN-ADD1 will be stored so as to apply
only to terms with the nonrecursive function symbol EVEN.
WARNING: the previously added lemma, EVENP-EVEN, could be applied whenever
the newly proposed EVEN-ADD1 could!
This formula can be simplified, using the abbreviation EVENP-EVEN, to the new
conjecture:
(EQUAL (EVENP (ADD1 X))
(NOT (EVENP X))),
which simplifies, rewriting with the lemma SUB1-ADD1, and expanding the
definitions of EVENP and NOT, to two new conjectures:
Case 2. (IMPLIES (AND (NOT (EVENP X))
(NOT (NUMBERP X)))
(NOT (EVENP 0))),
which again simplifies, unfolding the definition of EVENP, to:
T.
Case 1. (IMPLIES (AND (EVENP X) (NOT (NUMBERP X)))
(EVENP 0)),
which again simplifies, unfolding the definition of EVENP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
EVEN-ADD1
(DISABLE EVENP-EVEN)
[ 0.0 0.0 0.0 ]
EVENP-EVEN-OFF
(PROVE-LEMMA EVEN-PRIME-2
(REWRITE)
(IMPLIES (AND (PRIME P) (NOT (EQUAL P 2)))
(NOT (EVEN P))))
WARNING: Note that the rewrite rule EVEN-PRIME-2 will be stored so as to
apply only to terms with the nonrecursive function symbol EVEN.
This formula can be simplified, using the abbreviations NOT, PRIME, AND,
IMPLIES, and EVEN, to:
(IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL P 2)))
(NOT (EQUAL 0 (REMAINDER P 2)))),
which simplifies, rewriting with LITTLE-STEP, and expanding the definitions of
EQUAL and PRIME, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
EVEN-PRIME-2
(PROVE-LEMMA EVEN-PRIME
(REWRITE)
(IMPLIES (AND (PRIME P) (NOT (EQUAL P 2)))
(NOT (EQUAL (REMAINDER P 2) 0)))
((DISABLE PRIME1)))
This formula can be simplified, using the abbreviations NOT, PRIME, AND, and
IMPLIES, to:
(IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL P 2)))
(NOT (EQUAL (REMAINDER P 2) 0))),
which simplifies, rewriting with LITTLE-STEP, and unfolding EQUAL and PRIME,
to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
EVEN-PRIME
(PROVE-LEMMA EULER-CRITERION NIL
(IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(NOT (DIVIDES P A)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
(IF (RESIDUE A P) 1 (SUB1 P))))
((DISABLE PRIME RESIDUE)))
This conjecture can be simplified, using the abbreviations NOT, AND, IMPLIES,
and DIVIDES, to:
(IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(NOT (EQUAL (REMAINDER A P) 0)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
(IF (RESIDUE A P) 1 (SUB1 P)))).
This simplifies, obviously, to the following two new goals:
Case 2. (IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (RESIDUE A P)))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
(SUB1 P))).
This again simplifies, using linear arithmetic, applying EVEN-PRIME and
EULER-2, and expanding the function DIVIDES, to:
T.
Case 1. (IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(NOT (EQUAL (REMAINDER A P) 0))
(RESIDUE A P))
(EQUAL (REMAINDER (EXP A (QUOTIENT P 2)) P)
1)).
But this again simplifies, using linear arithmetic, rewriting with
EVEN-PRIME and EULER-1, and unfolding DIVIDES and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
EULER-CRITERION
(DISABLE EULER-1)
[ 0.0 0.0 0.0 ]
EULER-1-OFF
(DISABLE EULER-2)
[ 0.0 0.0 0.0 ]
EULER-2-OFF
(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 REFLECTIONS
(N A P)
(IF (ZEROP N)
NIL
(IF (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(CONS (DIFFERENCE P
(REMAINDER (TIMES A N) P))
(REFLECTIONS (SUB1 N) A P))
(CONS (REMAINDER (TIMES A N) P)
(REFLECTIONS (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, REFLECTIONS is accepted under
the definitional principle. From the definition we can conclude that:
(OR (LITATOM (REFLECTIONS N A P))
(LISTP (REFLECTIONS N A P)))
is a theorem.
[ 0.0 0.0 0.0 ]
REFLECTIONS
(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.3 0.0 ]
DIFF-MOD-1
(PROVE-LEMMA REM-DIFF-TIMES
(REWRITE)
(IMPLIES (AND (LESSP X P)
(AND (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 (DIFFERENCE P Y) X)
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES Y X) 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 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 opening up
IMPLIES, ZEROP, NOT, AND, EQUAL, LESSP, DIFFERENCE, REMAINDER, and TIMES, to
50 new formulas:
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))),
which 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, appealing to the lemma TIMES-ZERO2, and expanding
the functions 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))),
which 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, applying TIMES-IDENTITY and EQUAL-TIMES-0,
and expanding 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, applying 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))).
However 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 conjectures:
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, appealing to the lemma TIMES-ZERO2, and unfolding
the function 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))),
which again simplifies, rewriting with TIMES-ZERO2 and
COMMUTATIVITY-OF-TIMES, and expanding 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))).
However this again simplifies, rewriting with the lemmas TIMES-ZERO2 and
EQUAL-TIMES-0, and expanding the definition of 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))),
which again simplifies, rewriting with TIMES-ZERO2 and EQUAL-TIMES-0, and
opening up the definition of 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))).
However this again simplifies, using linear arithmetic, to three new
formulas:
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 expanding the
definitions of 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))).
However this again simplifies, using linear arithmetic, rewriting with
EQUAL-TIMES-0, REMAINDER-WRT-12, DIFFERENCE-0, and REMAINDER-0-CROCK, and
unfolding the functions 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))).
But this again simplifies, applying the lemma 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)),
which 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, applying TIMES-ZERO2, and expanding 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, applying
LESSP-REMAINDER-DIVISOR, REMAINDER-TIMES, and COMMUTATIVITY-OF-TIMES, and
unfolding 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))).
However this again simplifies, applying the lemmas TIMES-ZERO2 and
EQUAL-TIMES-0, and opening up 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))),
which again simplifies, applying the lemmas TIMES-ZERO2 and EQUAL-TIMES-0,
and unfolding the definition of 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))),
which again simplifies, rewriting with TIMES-ZERO2 and EQUAL-TIMES-0, and
unfolding 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))).
But this 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 formulas:
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, applying the lemmas EQUAL-TIMES-0 and TIMES-ZERO2,
and opening up the definitions of 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))),
which again simplifies, using linear arithmetic, rewriting with the lemmas
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 the definitions of 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))),
which again simplifies, using linear arithmetic, rewriting with DIFFERENCE-0,
TIMES-IDENTITY, EQUAL-TIMES-0, and TIMES-ZERO2, and opening up the functions
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))).
However this again simplifies, rewriting with EQUAL-TIMES-0, DIFFERENCE-0,
REMAINDER-0-CROCK, REMAINDER-WRT-12, TIMES-ZERO2, and TIMES-IDENTITY, and
opening up the definitions of 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))).
But this again simplifies, using linear arithmetic, to two new goals:
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 unfolding the functions 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))).
However 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 definitions of 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, applying the lemmas
REMAINDER-TIMES and DIFFERENCE-0, and expanding 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))),
which again simplifies, using linear arithmetic, rewriting with 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 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))).
This again simplifies, using linear arithmetic, to two new goals:
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, applying TIMES-ZERO2 and REMAINDER-0-CROCK, and
unfolding 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))).
But this again simplifies, applying TIMES-ZERO2, COMMUTATIVITY-OF-TIMES,
REMAINDER-0-CROCK, and REMAINDER-X-X, and opening up the definitions of
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))).
However this again simplifies, using linear arithmetic, rewriting with the
lemmas TIMES-ZERO2 and DIFFERENCE-0, and opening up 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 the lemmas
TIMES-ZERO2, REMAINDER-WRT-12, DIFFERENCE-0, and REMAINDER-0-CROCK, and
unfolding 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))),
which again simplifies, using linear arithmetic, appealing to the lemmas
TIMES-ZERO2, EQUAL-TIMES-0, DIFFERENCE-0, REMAINDER-0-CROCK, and
REMAINDER-X-X, and expanding 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, applying the lemmas
TIMES-ZERO2 and DIFFERENCE-0, and unfolding the functions 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))),
which again simplifies, using linear arithmetic, rewriting with TIMES-ZERO2,
REMAINDER-WRT-12, DIFFERENCE-0, and REMAINDER-0-CROCK, and unfolding 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))).
But this again simplifies, using linear arithmetic, applying
COMMUTATIVITY-OF-TIMES, TIMES-IDENTITY, DIFFERENCE-0, REMAINDER-0-CROCK, and
REMAINDER-X-X, and opening up the functions 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))).
This again simplifies, using linear arithmetic, rewriting with
REMAINDER-TIMES and DIFFERENCE-0, and opening up 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))).
However this again simplifies, using linear arithmetic, applying TIMES-ZERO2,
COMMUTATIVITY-OF-TIMES, REMAINDER-WRT-12, DIFFERENCE-0, and
REMAINDER-0-CROCK, and expanding 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))).
This again simplifies, rewriting with the lemmas EQUAL-TIMES-0,
REMAINDER-TIMES, and REMAINDER-X-X, and opening up 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 the lemmas EQUAL-TIMES-0,
DIFFERENCE-0, and REMAINDER-0-CROCK, and opening up the functions 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))),
which again simplifies, using linear arithmetic, rewriting with DIFFERENCE-0,
COMMUTATIVITY-OF-TIMES, TIMES-DIFFERENCE, and REMAINDER-0-CROCK, and
expanding 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)).
But this again simplifies, rewriting with REMAINDER-WRT-12, EQUAL-TIMES-0,
and REMAINDER-0-CROCK, and opening up the definitions of 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)).
However 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.9 0.0 ]
REFLECT-COMMUTES-WITH-TIMES-1
(PROVE-LEMMA REFLECT-COMMUTES-WITH-TIMES-2
(REWRITE)
(IMPLIES (LEQ Y P)
(EQUAL (REMAINDER (TIMES X (DIFFERENCE P Y))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
P)))
((USE (REFLECT-COMMUTES-WITH-TIMES-1))
(DISABLE REFLECT-COMMUTES-WITH-TIMES-1)))
This simplifies, using linear arithmetic, applying the lemmas
COMMUTATIVITY-OF-TIMES, TIMES-DIFFERENCE, REMAINDER-0-CROCK, DIFFERENCE-0,
REMAINDER-WRT-12, TIMES-IDENTITY, TIMES-ZERO2, and REMAINDER-TIMES, and
unfolding REMAINDER, EQUAL, IMPLIES, LESSP, and DIFFERENCE, to:
(IMPLIES
(AND (LESSP P (REMAINDER (TIMES X Y) P))
(IMPLIES (IF (LESSP P Y) F T)
(EQUAL (REMAINDER (TIMES (DIFFERENCE P Y) X)
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES Y X) P))
P)))
(NOT (LESSP P Y)))
(EQUAL (REMAINDER (DIFFERENCE (TIMES P X) (TIMES X Y))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES X Y) P))
P))).
But this again simplifies, using linear arithmetic, rewriting with
COMMUTATIVITY-OF-TIMES, TIMES-DIFFERENCE, DIFFERENCE-0, and REMAINDER-0-CROCK,
and unfolding the functions IMPLIES and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.5 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-REFLECTIONS-1
(REWRITE)
(IMPLIES (AND (NOT (ZEROP P))
(NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS 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 (REFLECTIONS (SUB1 N) A P)))
(Z (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N))))))
(HANDS-OFF TIMES DIFFERENCE QUOTIENT EXP FACT)
(DISABLE REMAINDER-EXP-LEMMA)))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to the conjecture:
(IMPLIES
(AND
(IMPLIES
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(EQUAL (REMAINDER (TIMES (TIMES A N)
(TIMES-LIST (REFLECTIONS (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 (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS 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, REFLECTIONS, and TIMES-LIST, to:
T.
Q.E.D.
[ 0.0 0.5 0.0 ]
REM-REFLECTIONS-1
(PROVE-LEMMA REM-REFLECTIONS-2
(REWRITE)
(IMPLIES (AND (NOT (ZEROP P))
(NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))
((USE (REMAINDER-EXP-LEMMA (A P)
(X (TIMES A N))
(Y (TIMES-LIST (REFLECTIONS (SUB1 N) A P)))
(Z (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N))))))
(HANDS-OFF TIMES DIFFERENCE QUOTIENT EXP FACT)
(DISABLE REMAINDER-EXP-LEMMA)))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES
(AND
(IMPLIES
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(EQUAL (REMAINDER (TIMES (TIMES A N)
(TIMES-LIST (REFLECTIONS (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 (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
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, REFLECTIONS, and
TIMES-LIST, to:
T.
Q.E.D.
[ 0.0 0.5 0.0 ]
REM-REFLECTIONS-2
(PROVE-LEMMA REM-REFLECTIONS-3
(REWRITE)
(IMPLIES (AND (NOT (ZEROP P))
(NOT (ZEROP N))
(LEQ (REMAINDER (TIMES A N) P)
(QUOTIENT P 2))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))
((USE (REMAINDER-EXP-LEMMA (A P)
(X (TIMES A N))
(Y (TIMES-LIST (REFLECTIONS (SUB1 N) A P)))
(Z (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))))
(HANDS-OFF TIMES DIFFERENCE QUOTIENT EXP FACT)
(DISABLE REMAINDER-EXP-LEMMA)))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES
(AND
(IMPLIES
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P))
(EQUAL
(EQUAL
(REMAINDER (TIMES (TIMES A N)
(TIMES-LIST (REFLECTIONS (SUB1 N) A P)))
P)
(REMAINDER (TIMES (TIMES A N)
(DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
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 (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
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 unfolding the functions IMPLIES, REFLECTIONS, and
TIMES-LIST, to:
T.
Q.E.D.
[ 0.0 0.7 0.0 ]
REM-REFLECTIONS-3
(PROVE-LEMMA DOUBLE-REFLECT
(REWRITE)
(IMPLIES (LEQ A P)
(EQUAL (REMAINDER (DIFFERENCE P
(REMAINDER (DIFFERENCE P A) P))
P)
(REMAINDER A P))))
This simplifies, using linear arithmetic, applying REMAINDER-0-CROCK and
DIFFERENCE-0, and expanding the definition of REMAINDER, to the following 13
new conjectures:
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))).
However this again simplifies, using linear arithmetic, rewriting with
DIFFERENCE-0, REMAINDER-0-CROCK, and REMAINDER-WRT-12, and opening up the
definitions of REMAINDER, DIFFERENCE, and EQUAL, to the following 14 new
conjectures:
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 the formula:
(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 the conjecture:
(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-REFLECTIONS-4
(REWRITE)
(IMPLIES (AND (NOT (ZEROP P))
(NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS 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 (REFLECTIONS (SUB1 N) A P)))
(Z (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))))
(HANDS-OFF TIMES DIFFERENCE QUOTIENT EXP FACT)
(DISABLE REMAINDER-EXP-LEMMA)))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES
(AND
(IMPLIES
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P))
(EQUAL
(EQUAL
(REMAINDER (TIMES (TIMES A N)
(TIMES-LIST (REFLECTIONS (SUB1 N) A P)))
P)
(REMAINDER (TIMES (TIMES A N)
(DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
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 (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS 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, REFLECTIONS, TIMES-LIST, and REMAINDER, to:
T.
Q.E.D.
[ 0.0 0.7 0.0 ]
REM-REFLECTIONS-4
(PROVE-LEMMA REM-REFLECTIONS-BASE-CASE
(REWRITE)
(IMPLIES (ZEROP N)
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS 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, REFLECTIONS, TIMES-LIST, FACT,
TIMES, and EXP, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
REM-REFLECTIONS-BASE-CASE
(PROVE-LEMMA REM-REFLECTIONS NIL
(IMPLIES
(NOT (ZEROP P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P))))
((HANDS-OFF TIMES-LIST REFLECTIONS QUOTIENT EXP FACT TIMES)))
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 (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))),
which simplifies, using linear arithmetic, rewriting with REMAINDER-0-CROCK
and DIFFERENCE-0, and opening up REMAINDER, to the following four new formulas:
Case 4. (IMPLIES
(AND (NOT (EQUAL P 0))
(NUMBERP P)
(LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))).
However this again simplifies, using linear arithmetic and applying the
lemma LESSP-REMAINDER-DIVISOR, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(NOT (RES1 N A P))
(LESSP (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))),
which we will name *1.
Case 2. (IMPLIES
(AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(NOT (RES1 N A P))
(NOT (LESSP (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
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:
(IMPLIES
(NOT (ZEROP P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))),
which we named *1 above. We will appeal to induction. There are seven
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 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 (ZEROP P)))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))).
This simplifies, rewriting with REM-REFLECTIONS-BASE-CASE, and expanding the
functions 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 (REFLECTIONS (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(NOT (ZEROP P)))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))),
which simplifies, using linear arithmetic, rewriting with REMAINDER-0-CROCK,
DIFFERENCE-0, REMAINDER-WRT-12, REM-REFLECTIONS-4, LESSP-REMAINDER2, and
REM-REFLECTIONS-2, and expanding the definitions of ZEROP, REMAINDER, EQUAL,
and RES1, to the following five new conjectures:
Case 2.5.
(IMPLIES
(AND
(NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(LESSP P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))).
But this again simplifies, using linear arithmetic and applying
LESSP-REMAINDER-DIVISOR, to:
T.
Case 2.4.
(IMPLIES
(AND
(NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(LESSP P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(NOT (RES1 (SUB1 N) A P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P))).
But this again simplifies, using linear arithmetic and rewriting with
LESSP-REMAINDER-DIVISOR, to:
T.
Case 2.3.
(IMPLIES
(AND
(NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(LESSP P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(RES1 (SUB1 N) A P)
(LESSP (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))).
But this again simplifies, using linear arithmetic and applying
LESSP-REMAINDER-DIVISOR, to:
T.
Case 2.2.
(IMPLIES
(AND
(NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(LESSP P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(RES1 (SUB1 N) A P)
(NOT (LESSP (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
0)).
But this again simplifies, using linear arithmetic and rewriting with the
lemma LESSP-REMAINDER-DIVISOR, to:
T.
Case 2.1.
(IMPLIES
(AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(NOT (LESSP P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(RES1 (SUB1 N) A P)
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))),
which again simplifies, using linear arithmetic and appealing to the lemma
LESSP-REMAINDER-DIVISOR, to:
T.
Case 1. (IMPLIES
(AND
(NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(NOT (ZEROP P)))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))),
which simplifies, using linear arithmetic, rewriting with REMAINDER-0-CROCK,
DIFFERENCE-0, REMAINDER-WRT-12, REM-REFLECTIONS-3, LESSP-REMAINDER2, and
REM-REFLECTIONS-1, and unfolding the functions ZEROP, REMAINDER, EQUAL, and
RES1, to the following six new goals:
Case 1.6.
(IMPLIES
(AND
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(LESSP P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))).
However this again simplifies, using linear arithmetic and rewriting with
LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.5.
(IMPLIES
(AND
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(LESSP P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(NOT (RES1 (SUB1 N) A P))
(LESSP (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))).
This again simplifies, using linear arithmetic and rewriting with the
lemma LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.4.
(IMPLIES
(AND
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(LESSP P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(NOT (RES1 (SUB1 N) A P))
(NOT (LESSP (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
0)),
which again simplifies, using linear arithmetic and rewriting with
LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.3.
(IMPLIES
(AND
(NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(LESSP P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(IF (RES1 (SUB1 N) A P)
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(RES1 (SUB1 N) A P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P))).
However this again simplifies, using linear arithmetic and rewriting with
the lemma LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.2.
(IMPLIES
(AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(NOT (LESSP P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(NOT (RES1 (SUB1 N) A P))
(NOT (LESSP (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P))
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
0)
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))),
which again simplifies, using linear arithmetic and appealing to the lemma
LESSP-REMAINDER-DIVISOR, to:
T.
Case 1.1.
(IMPLIES
(AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(NOT (LESSP P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(NOT (RES1 (SUB1 N) A P))
(NOT (EQUAL P 0))
(NUMBERP P)
(LESSP (DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P))
P)
(EQUAL (REMAINDER (TIMES-LIST (REFLECTIONS (SUB1 N) A P))
P)
(DIFFERENCE P
(REMAINDER (TIMES (EXP A (SUB1 N))
(FACT (SUB1 N)))
P)))
(LESSP P
(REMAINDER (TIMES (EXP A N) (FACT N))
P)))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS N A P))
P)
(IF (RES1 N A P)
(REMAINDER (TIMES (EXP A N) (FACT N))
P)
(REMAINDER (DIFFERENCE P
(REMAINDER (TIMES (EXP A N) (FACT N))
P))
P)))),
which again simplifies, using linear arithmetic and applying the lemma
LESSP-REMAINDER-DIVISOR, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 3.6 0.0 ]
REM-REFLECTIONS
(PROVE-LEMMA LENGTH-REFLECTIONS
(REWRITE)
(EQUAL (LENGTH (REFLECTIONS 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 (REFLECTIONS N A P))
(FIX N))).
This simplifies, opening up the definitions of ZEROP, EQUAL, REFLECTIONS,
LENGTH, and FIX, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (LENGTH (REFLECTIONS (SUB1 N) A P))
(FIX (SUB1 N))))
(EQUAL (LENGTH (REFLECTIONS N A P))
(FIX N))).
This simplifies, opening up the definitions of FIX and REFLECTIONS, to the
following two new formulas:
Case 1.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (LENGTH (REFLECTIONS (SUB1 N) A P))
(SUB1 N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))))
(EQUAL (LENGTH (CONS (REMAINDER (TIMES A N) P)
(REFLECTIONS (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 (REFLECTIONS (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))
(REFLECTIONS (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-REFLECTIONS
(PROVE-LEMMA ALL-LESSEQP-REFLECTIONS-1
(REWRITE)
(IMPLIES (LESSP (QUOTIENT P 2) X)
(NOT (LESSP (QUOTIENT P 2)
(DIFFERENCE P X)))))
WARNING: When the linear lemma ALL-LESSEQP-REFLECTIONS-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-REFLECTIONS-1 is to be
stored as zero type prescription rules, zero compound recognizer rules, one
linear rule, and zero replacement rules.
.
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 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. This generates four new formulas:
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 the lemma DIFFERENCE-0,
and opening up 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)))),
which 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)))).
But this simplifies, applying TIMES-2, and expanding the definitions of
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 goal:
(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 unfolding the functions EQUAL and LESSP, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
ALL-LESSEQP-REFLECTIONS-1
(PROVE-LEMMA ALL-LESSEQP-REFLECTIONS
(REWRITE)
(ALL-LESSEQP (REFLECTIONS N A P)
(QUOTIENT P 2)))
.
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 (REFLECTIONS N A P)
(QUOTIENT P 2))),
which simplifies, expanding the functions LESSP, NUMBERP, EQUAL, and
QUOTIENT, to:
(IMPLIES (NOT (NUMBERP P))
(ALL-LESSEQP (REFLECTIONS 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 (REFLECTIONS 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 (REFLECTIONS N A P)
(QUOTIENT P 2))).
This simplifies, rewriting with PIGEON-HOLE-PRINCIPLE-LEMMA-2, and expanding
ZEROP, EQUAL, REFLECTIONS, 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 (REFLECTIONS (SUB1 N) A P)
(QUOTIENT P 2)))
(ALL-LESSEQP (REFLECTIONS N A P)
(QUOTIENT P 2))),
which simplifies, applying the lemmas CDR-CONS and CAR-CONS, and unfolding
ZEROP, REFLECTIONS, 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 (REFLECTIONS (SUB1 N) A P)
(QUOTIENT P 2)))
(NOT (LESSP (QUOTIENT P 2)
(DIFFERENCE P
(REMAINDER (TIMES A N) P))))).
But this again simplifies, using linear arithmetic and applying
ALL-LESSEQP-REFLECTIONS-1, to:
(IMPLIES (AND (LESSP P (REMAINDER (TIMES A N) P))
(NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(ALL-LESSEQP (REFLECTIONS (SUB1 N) A P)
(QUOTIENT P 2)))
(NOT (LESSP (QUOTIENT P 2)
(DIFFERENCE P
(REMAINDER (TIMES A N) P))))),
which again simplifies, using linear arithmetic, rewriting with DIFFERENCE-0,
and expanding the definitions of EQUAL and LESSP, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(ALL-LESSEQP (REFLECTIONS (SUB1 N) A P)
(QUOTIENT P 2)))
(ALL-LESSEQP (REFLECTIONS N A P)
(QUOTIENT P 2))).
This simplifies, applying the lemmas CDR-CONS and CAR-CONS, and unfolding
the definitions of ZEROP, REFLECTIONS, and ALL-LESSEQP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.3 0.0 ]
ALL-LESSEQP-REFLECTIONS
(PROVE-LEMMA ALL-NON-ZEROP-REFLECTIONS
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(LESSP B P))
(ALL-NON-ZEROP (REFLECTIONS B A P)))
((INDUCT (REFLECTIONS 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 (REFLECTIONS B A P))),
which simplifies, unfolding the functions ZEROP, EQUAL, LESSP, REFLECTIONS,
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 (REFLECTIONS (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 (REFLECTIONS 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, REFLECTIONS, 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 (REFLECTIONS (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 (REFLECTIONS (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 (REFLECTIONS B A P))),
which simplifies, rewriting with CDR-CONS, PRIME-KEY-REWRITE, and CAR-CONS,
and expanding the functions PRIME, NOT, AND, IMPLIES, LESSP, REFLECTIONS,
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 (REFLECTIONS (SUB1 B) A P))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 2.8 0.0 ]
ALL-NON-ZEROP-REFLECTIONS
(PROVE-LEMMA ALL-DISTINCT-REFLECTIONS-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-REFLECTIONS-1
(PROVE-LEMMA ALL-DISTINCT-REFLECTIONS-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-REFLECTIONS-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-REFLECTIONS-3
(REWRITE)
(IMPLIES (AND (PRIME P)
(LESSP J I)
(LESSP I P)
(NOT (DIVIDES P A)))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P)))))
((USE (ALL-DISTINCT-REFLECTIONS-1))
(HANDS-OFF DIFFERENCE REMAINDER TIMES)
(DISABLE ALL-DISTINCT-REFLECTIONS-1 PRIME)))
This conjecture can be simplified, using the abbreviations NOT, AND, IMPLIES,
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-REFLECTIONS-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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P)))))
T).
We gave this the name *1 above. Perhaps we can prove it by induction. The
recursive terms in the conjecture suggest ten 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P)))))
T)).
This simplifies, unfolding NOT, OR, EQUAL, LESSP, DIVIDES, AND, and IMPLIES,
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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P)))))
T)).
This simplifies, opening up the definitions of NOT, OR, EQUAL, LESSP,
DIVIDES, AND, and IMPLIES, 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 (DIFFERENCE (SUB1 P)
(REMAINDER (TIMES A (SUB1 I))
(SUB1 P)))
(DIFFERENCE (SUB1 P)
(REMAINDER (TIMES A (SUB1 J))
(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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE P
(REMAINDER (TIMES A J) P)))))
T)).
This simplifies, opening up the definitions of NOT, OR, DIVIDES, AND,
IMPLIES, 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.2 0.0 ]
ALL-DISTINCT-REFLECTIONS-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.3 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-REFLECTIONS-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-REFLECTIONS-4
(PROVE-LEMMA ALL-DISTINCT-REFLECTIONS-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-REFLECTIONS-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-REFLECTIONS-5
(PROVE-LEMMA ALL-DISTINCT-REFLECTIONS-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-REFLECTIONS-6
(PROVE-LEMMA ALL-DISTINCT-REFLECTIONS-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)
(DIFFERENCE P
(REMAINDER (TIMES A J) P)))))
((USE (ALL-DISTINCT-REFLECTIONS-5)
(ALL-DISTINCT-REFLECTIONS-6))
(HANDS-OFF DIFFERENCE TIMES PLUS)
(DISABLE PRIME1)))
This conjecture can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, 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.6 0.0 ]
ALL-DISTINCT-REFLECTIONS-7
(PROVE-LEMMA ALL-DISTINCT-REFLECTIONS-8
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P A))
(LEQ I (QUOTIENT P 2))
(LESSP J I))
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REMAINDER (TIMES A J) P))))
((USE (ALL-DISTINCT-REFLECTIONS-5 (J I)
(I J))
(ALL-DISTINCT-REFLECTIONS-6))
(HANDS-OFF TIMES DIFFERENCE)
(DISABLE PRIME1)))
This conjecture can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, 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.6 0.0 ]
ALL-DISTINCT-REFLECTIONS-8
(PROVE-LEMMA ALL-DISTINCT-REFLECTIONS-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)
(REFLECTIONS J A P))))
((USE (ALL-DISTINCT-REFLECTIONS-1))
(INDUCT (REFLECTIONS J A P))
(HANDS-OFF QUOTIENT REMAINDER TIMES)
(DISABLE PRIME1 ALL-DISTINCT-REFLECTIONS-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)
(REFLECTIONS 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)
(REFLECTIONS (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)
(REFLECTIONS 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)
(REFLECTIONS (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)
(REFLECTIONS J A P))))))).
This simplifies, using linear arithmetic, applying the lemma DIFFERENCE-0, and
expanding PRIME, NOT, AND, IMPLIES, ZEROP, REMAINDER, EQUAL, QUOTIENT, LESSP,
REFLECTIONS, and OR, to the following 12 new goals:
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))).
This again simplifies, using linear arithmetic, applying the lemma
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))).
However this again simplifies, expanding the definitions of 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, rewriting with the lemma
LESSP-REMAINDER-DIVISOR, and opening up the definition of EQUAL, to the
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))).
But this again simplifies, expanding the definitions of 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 (DIFFERENCE P
(REMAINDER (TIMES A J) P))
(REFLECTIONS (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)
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (DIFFERENCE P
(REMAINDER (TIMES A J) P))
(REFLECTIONS (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)
(REFLECTIONS (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)
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECTIONS (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, appealing to the lemma
LESSP-REMAINDER-DIVISOR, and expanding the function EQUAL, to the 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)
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECTIONS (SUB1 J) A P))))).
This again simplifies, applying the lemmas CDR-CONS,
THM-55-SPECIALIZED-TO-PRIMES, and CAR-CONS, and unfolding the definitions of
EQUAL, PRIME, and MEMBER, 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 (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (EQUAL (REMAINDER I P)
(REMAINDER J 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. This generates three new
formulas:
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)
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (EQUAL (REMAINDER I P)
(REMAINDER J P)))),
which 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)
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (EQUAL (REMAINDER I P)
(REMAINDER J P)))),
which further simplifies, trivially, 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)))
(REFLECTIONS (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, applying
LESSP-REMAINDER-DIVISOR, and expanding the function 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))),
which again simplifies, applying the lemma THM-55-SPECIALIZED-TO-PRIMES, and
opening up the functions 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, applying
LESSP-REMAINDER-DIVISOR, and expanding the definition of 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))),
which again simplifies, applying THM-55-SPECIALIZED-TO-PRIMES, and unfolding
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 (DIFFERENCE P
(REMAINDER (TIMES A J) P))
(REFLECTIONS (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)
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (DIFFERENCE P
(REMAINDER (TIMES A J) P))
(REFLECTIONS (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, and opening up the definition of 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)
(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)
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (DIFFERENCE P
(REMAINDER (TIMES A J) P))
(REFLECTIONS (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, rewriting with the lemmas
THM-55-SPECIALIZED-TO-PRIMES, CDR-CONS, ALL-DISTINCT-REFLECTIONS-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)
(REFLECTIONS (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)
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECTIONS (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)
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (REMAINDER (TIMES A I) P)
(CONS (REMAINDER (TIMES A J) P)
(REFLECTIONS (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.1 0.9 0.1 ]
ALL-DISTINCT-REFLECTIONS-9
(PROVE-LEMMA ALL-DISTINCT-REFLECTIONS-10
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(LEQ I (QUOTIENT P 2))
(LESSP J I))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS J A P))))
((USE (ALL-DISTINCT-REFLECTIONS-3))
(INDUCT (REFLECTIONS J A P))
(HANDS-OFF QUOTIENT REMAINDER TIMES)
(DISABLE PRIME1 ALL-DISTINCT-REFLECTIONS-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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS J A P))))))),
which simplifies, using linear arithmetic, applying DIFFERENCE-0, and
unfolding PRIME, NOT, AND, IMPLIES, ZEROP, REMAINDER, EQUAL, QUOTIENT, LESSP,
REFLECTIONS, OR, SUB1, NUMBERP, and DIFFERENCE, to the following 12 new goals:
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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
NIL))).
However this again simplifies, using linear arithmetic, rewriting with
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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
NIL))),
which again simplifies, opening up the definitions of 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
NIL))),
which again simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, and unfolding 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 (DIFFERENCE P
(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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(CONS (DIFFERENCE P
(REMAINDER (TIMES A J) P))
(REFLECTIONS (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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(CONS (DIFFERENCE P
(REMAINDER (TIMES A J) P))
(REFLECTIONS (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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(CONS (REMAINDER (TIMES A J) P)
(REFLECTIONS (SUB1 J) A P))))).
But 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(CONS (REMAINDER (TIMES A J) P)
(REFLECTIONS (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, and expanding the definition of EQUAL, 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 1 0))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP (QUOTIENT P 2) I))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(CONS (REMAINDER (TIMES A J) P)
(REFLECTIONS (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, appealing to the lemmas
CDR-CONS, ALL-DISTINCT-REFLECTIONS-8, and CAR-CONS, and unfolding the
functions EQUAL, PRIME, DIVIDES, and MEMBER, to:
T.
Case 6. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
NIL))),
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 (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
NIL))),
which again simplifies, using linear arithmetic, applying the lemmas
LESSP-REMAINDER-DIVISOR, THM-55-SPECIALIZED-TO-PRIMES, and
ALL-DISTINCT-REFLECTIONS-2, and opening up PRIME, EQUAL, LESSP, LISTP, and
MEMBER, to:
T.
Case 5. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
NIL))),
which again simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, and expanding the function EQUAL, to the new
conjecture:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
NIL))),
which again simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, THM-55-SPECIALIZED-TO-PRIMES, and
ALL-DISTINCT-REFLECTIONS-2, and opening up PRIME, EQUAL, LESSP, LISTP, and
MEMBER, to:
T.
Case 4. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(CONS (DIFFERENCE P
(REMAINDER (TIMES A J) P))
(REFLECTIONS (SUB1 J) A P))))).
But this again simplifies, using linear arithmetic, to:
T.
Case 3. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(CONS (DIFFERENCE P
(REMAINDER (TIMES A J) P))
(REFLECTIONS (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, rewriting with the lemma
LESSP-REMAINDER-DIVISOR, and unfolding the definition of EQUAL, to the
conjecture:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(CONS (DIFFERENCE P
(REMAINDER (TIMES A J) P))
(REFLECTIONS (SUB1 J) A P))))).
But this again simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, ALL-DISTINCT-REFLECTIONS-1,
ALL-DISTINCT-REFLECTIONS-2, CDR-CONS, and CAR-CONS, and opening up the
definitions of DIVIDES, PRIME, EQUAL, and MEMBER, to:
T.
Case 2. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(CONS (REMAINDER (TIMES A J) P)
(REFLECTIONS (SUB1 J) A P))))).
But this again simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(CONS (REMAINDER (TIMES A J) P)
(REFLECTIONS (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, applying
LESSP-REMAINDER-DIVISOR, and opening up EQUAL, to:
(IMPLIES (AND (EQUAL (REMAINDER P 2) 1)
(NOT (EQUAL (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(DIFFERENCE 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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (SUB1 J) A P)))
(LESSP J I))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(CONS (REMAINDER (TIMES A J) P)
(REFLECTIONS (SUB1 J) A P))))),
which again simplifies, using linear arithmetic, rewriting with
LESSP-REMAINDER-DIVISOR, THM-55-SPECIALIZED-TO-PRIMES,
ALL-DISTINCT-REFLECTIONS-2, CDR-CONS, ALL-DISTINCT-REFLECTIONS-8, and
CAR-CONS, and expanding the definitions of PRIME, EQUAL, DIVIDES, and MEMBER,
to:
T.
Q.E.D.
[ 0.0 1.2 0.0 ]
ALL-DISTINCT-REFLECTIONS-10
(PROVE-LEMMA ALL-DISTINCT-REFLECTIONS
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A))
(LEQ I (QUOTIENT P 2)))
(ALL-DISTINCT (REFLECTIONS I A P)))
((USE (ALL-DISTINCT-REFLECTIONS-9 (J (SUB1 I)))
(ALL-DISTINCT-REFLECTIONS-10 (J (SUB1 I))))
(INDUCT (REFLECTIONS I A P))
(HANDS-OFF QUOTIENT REMAINDER TIMES)
(DISABLE ALL-DISTINCT-REFLECTIONS-9 ALL-DISTINCT-REFLECTIONS-10
PRIME DIVIDES)))
This formula simplifies, expanding the definitions of NOT, AND, IMPLIES, ZEROP,
REFLECTIONS, 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)
(REFLECTIONS (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 (REFLECTIONS (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REMAINDER (TIMES A I) P)
(REFLECTIONS (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 (REFLECTIONS (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (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)
(REFLECTIONS (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)
(REFLECTIONS (SUB1 I) A P)))).
However this again simplifies, using linear arithmetic, to:
T.
Case 11.(IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECTIONS (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 (REFLECTIONS (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REMAINDER (TIMES A I) P)
(REFLECTIONS (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 10.(IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECTIONS (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 (REFLECTIONS (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 9. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECTIONS (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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 8. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECTIONS (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, REFLECTIONS,
LISTP, MEMBER, LESSP, and ALL-DISTINCT, to:
T.
Case 7. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECTIONS (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)
(REFLECTIONS (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, REFLECTIONS, LISTP,
MEMBER, and ALL-DISTINCT, to:
T.
Case 6. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECTIONS (SUB1 I) A P)))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (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)
(REFLECTIONS (SUB1 I) A P)))),
which again simplifies, using linear arithmetic, to:
T.
Case 5. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECTIONS (SUB1 I) A P)))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (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 (REFLECTIONS (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (REMAINDER (TIMES A I) P)
(REFLECTIONS (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)
(REFLECTIONS (SUB1 I) A P)))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (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 (REFLECTIONS (SUB1 I) A P))
(NOT (LESSP (QUOTIENT P 2) I)))
(ALL-DISTINCT (CONS (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (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)
(REFLECTIONS (SUB1 I) A P)))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (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 (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (SUB1 I) A P)))).
But this again simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECTIONS (SUB1 I) A P)))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (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, REFLECTIONS, LISTP, MEMBER,
LESSP, and ALL-DISTINCT, to:
T.
Case 1. (IMPLIES (AND (NOT (MEMBER (REMAINDER (TIMES A I) P)
(REFLECTIONS (SUB1 I) A P)))
(NOT (MEMBER (DIFFERENCE P
(REMAINDER (TIMES A I) P))
(REFLECTIONS (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, REFLECTIONS, LISTP, MEMBER, LESSP, and ALL-DISTINCT, to:
T.
Q.E.D.
[ 0.0 0.8 0.0 ]
ALL-DISTINCT-REFLECTIONS
(PROVE-LEMMA TIMES-REFLECTIONS
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES 2 P))
(NOT (DIVIDES P A)))
(EQUAL (TIMES-LIST (REFLECTIONS (QUOTIENT P 2) A P))
(FACT (QUOTIENT P 2))))
((USE (PIGEON-HOLE-PRINCIPLE (L (REFLECTIONS (QUOTIENT P 2) A P))))
(HANDS-OFF QUOTIENT REMAINDER)
(DISABLE PRIME1 REFLECTIONS 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 (REFLECTIONS (QUOTIENT P 2) A P))
(ALL-DISTINCT (REFLECTIONS (QUOTIENT P 2) A P))
(ALL-LESSEQP (REFLECTIONS (QUOTIENT P 2) A P)
(LENGTH (REFLECTIONS (QUOTIENT P 2) A P))))
(PERM (POSITIVES (LENGTH (REFLECTIONS (QUOTIENT P 2) A P)))
(REFLECTIONS (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 (REFLECTIONS (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 (REFLECTIONS (QUOTIENT P 2) A P))
(ALL-DISTINCT (REFLECTIONS (QUOTIENT P 2) A P))
(ALL-LESSEQP (REFLECTIONS (QUOTIENT P 2) A P)
(LENGTH (REFLECTIONS (QUOTIENT P 2) A P))))
(PERM (POSITIVES (LENGTH (REFLECTIONS (QUOTIENT P 2) A P)))
(REFLECTIONS (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 (REFLECTIONS (QUOTIENT P 2) A P))
(FACT (QUOTIENT P 2)))),
which again simplifies, using linear arithmetic, rewriting with
LESSP-QUOTIENT1, ALL-NON-ZEROP-REFLECTIONS, ALL-DISTINCT-REFLECTIONS,
LENGTH-REFLECTIONS, ALL-LESSEQP-REFLECTIONS, 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-REFLECTIONS
(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 1.1 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.2 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-REFLECTIONS (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, and DIVIDES, to the formula:
(IMPLIES
(AND
(IMPLIES
(NOT (ZEROP P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS (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-REFLECTIONS,
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.7 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-REFLECTIONS (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 REFLECTIONS)
(DISABLE LESSP-REMAINDER-DIVISOR PRIME1 DIFFERENCE COROLLARY-55
REMAINDER-EXP-LEMMA)))
This formula can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, and DIVIDES, to:
(IMPLIES
(AND
(IMPLIES
(NOT (ZEROP P))
(EQUAL
(REMAINDER (TIMES-LIST (REFLECTIONS (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-REFLECTIONS,
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.1 ]
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.1 0.0 ]
TWO-EVEN
(PROVE-LEMMA PERM-REFLECTIONS NIL
(IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(NOT (DIVIDES P A)))
(PERM (POSITIVES (QUOTIENT P 2))
(REFLECTIONS (QUOTIENT P 2) A P)))
((USE (PIGEON-HOLE-PRINCIPLE (L (REFLECTIONS (QUOTIENT P 2) A P))))
(HANDS-OFF QUOTIENT REMAINDER)
(DISABLE PRIME1 REFLECTIONS)))
This formula can be simplified, using the abbreviations NOT, PRIME, AND,
IMPLIES, and DIVIDES, to the new goal:
(IMPLIES
(AND
(IMPLIES (AND (ALL-NON-ZEROP (REFLECTIONS (QUOTIENT P 2) A P))
(ALL-DISTINCT (REFLECTIONS (QUOTIENT P 2) A P))
(ALL-LESSEQP (REFLECTIONS (QUOTIENT P 2) A P)
(LENGTH (REFLECTIONS (QUOTIENT P 2) A P))))
(PERM (POSITIVES (LENGTH (REFLECTIONS (QUOTIENT P 2) A P)))
(REFLECTIONS (QUOTIENT P 2) A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL P 2))
(NOT (EQUAL (REMAINDER A P) 0)))
(PERM (POSITIVES (QUOTIENT P 2))
(REFLECTIONS (QUOTIENT P 2) A P))),
which simplifies, using linear arithmetic, applying LESSP-QUOTIENT1,
ALL-NON-ZEROP-REFLECTIONS, EVEN-PRIME, ALL-DISTINCT-REFLECTIONS,
LENGTH-REFLECTIONS, and ALL-LESSEQP-REFLECTIONS, and expanding the functions
NUMBERP, EQUAL, DIVIDES, PRIME, AND, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
PERM-REFLECTIONS
(PROVE-LEMMA GAUSS-LEMMA-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-CRITERION)
(RES1-REM-1)
(RES1-REM-2)
(TWO-EVEN))
(DISABLE QUOTIENT EXP RESIDUE RES1 PRIME DIVIDES)))
This formula simplifies, expanding the definitions of NOT, AND, IMPLIES, PRIME,
DIVIDES, QUOTIENT, SUB1, and EQUAL, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
GAUSS-LEMMA-LEMMA
(DEFN MU
(N A P)
(IF (ZEROP N)
T
(IF (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(ADD1 (MU (SUB1 N) A P))
(MU (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, MU is accepted under the
principle of definition. Note that:
(OR (TRUEP (MU N A P))
(NUMBERP (MU N A P)))
is a theorem.
[ 0.0 0.0 0.0 ]
MU
(DEFN GAUSS
(A P)
(EVEN (MU (QUOTIENT P 2) A P)))
From the definition we can conclude that:
(OR (FALSEP (GAUSS A P))
(TRUEP (GAUSS A P)))
is a theorem.
[ 0.0 0.0 0.0 ]
GAUSS
(PROVE-LEMMA RES1-GAUSS
(REWRITE)
(EQUAL (RES1 N A P) (EVEN (MU N A P)))
((DISABLE EVEN)))
Name the conjecture *1.
We will appeal to induction. The recursive terms in the conjecture
suggest two inductions. However, they merge into one likely candidate
induction. We will induct according to the following scheme:
(AND (IMPLIES (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 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 formulas:
Case 3. (IMPLIES (ZEROP N)
(EQUAL (RES1 N A P)
(EVEN (MU N A P)))).
This simplifies, expanding the definitions of ZEROP, EQUAL, RES1, MU, and
EVEN, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EQUAL (RES1 (SUB1 N) A P)
(EVEN (MU (SUB1 N) A P))))
(EQUAL (RES1 N A P)
(EVEN (MU N A P)))).
This simplifies, applying EVEN-ADD1, and expanding the definitions of ZEROP,
RES1, and MU, 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)
(EVEN (MU (SUB1 N) A P))))
(EQUAL (RES1 N A P)
(EVEN (MU N A P)))),
which simplifies, opening up ZEROP, RES1, and MU, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.2 0.0 ]
RES1-GAUSS
(PROVE-LEMMA GAUSS-LEMMA NIL
(IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(NOT (DIVIDES P A)))
(EQUAL (GAUSS A P) (RESIDUE A P)))
((USE (GAUSS-LEMMA-LEMMA))
(DISABLE PRIME QUOTIENT RESIDUE EVEN)))
This conjecture can be simplified, using the abbreviations NOT, AND, IMPLIES,
RES1-GAUSS, and DIVIDES, to the goal:
(IMPLIES (AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EQUAL (REMAINDER P 2) 0)))
(EQUAL (EVEN (MU (QUOTIENT P 2) A P))
(RESIDUE A P)))
(PRIME P)
(NOT (EQUAL P 2))
(NOT (EQUAL (REMAINDER A P) 0)))
(EQUAL (GAUSS A P) (RESIDUE A P))).
This simplifies, rewriting with EVEN-PRIME, and unfolding the functions NOT,
AND, IMPLIES, and GAUSS, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
GAUSS-LEMMA
(DEFN SUM
(L)
(IF (LISTP L)
(PLUS (CAR L) (SUM (CDR L)))
0))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT L) decreases according to the well-founded relation LESSP in each
recursive call. Hence, SUM is accepted under the definitional principle.
From the definition we can conclude that (NUMBERP (SUM L)) is a theorem.
[ 0.0 0.0 0.0 ]
SUM
(DEFN QUOTIENTS
(N A P)
(IF (ZEROP N)
NIL
(CONS (QUOTIENT (TIMES A N) P)
(QUOTIENTS (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, QUOTIENTS is accepted under the
definitional principle. Note that:
(OR (LITATOM (QUOTIENTS N A P))
(LISTP (QUOTIENTS N A P)))
is a theorem.
[ 0.0 0.0 0.0 ]
QUOTIENTS
(DEFN REMAINDERS
(N A P)
(IF (ZEROP N)
NIL
(CONS (REMAINDER (TIMES A N) P)
(REMAINDERS (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, REMAINDERS is accepted under
the definitional principle. Note that:
(OR (LITATOM (REMAINDERS N A P))
(LISTP (REMAINDERS N A P)))
is a theorem.
[ 0.0 0.0 0.0 ]
REMAINDERS
(PROVE-LEMMA QUOTIENT-REMAINDER-SUM NIL
(EQUAL (TIMES A (SUM (POSITIVES N)))
(PLUS (TIMES P (SUM (QUOTIENTS N A P)))
(SUM (REMAINDERS N A P)))))
This formula simplifies, rewriting with COMMUTATIVITY-OF-PLUS, to the new goal:
(EQUAL (TIMES A (SUM (POSITIVES N)))
(PLUS (SUM (REMAINDERS N A P))
(TIMES P (SUM (QUOTIENTS 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 (SUM (POSITIVES N)))
(PLUS (SUM (REMAINDERS N A P))
(TIMES P (SUM (QUOTIENTS N A P)))))).
This simplifies, applying COMMUTATIVITY-OF-TIMES, and opening up the
functions ZEROP, POSITIVES, SUM, EQUAL, REMAINDERS, QUOTIENTS, 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 (SUM (POSITIVES (SUB1 N))))
(PLUS (SUM (REMAINDERS (SUB1 N) A P))
(TIMES P
(SUM (QUOTIENTS (SUB1 N) A P))))))
(EQUAL (TIMES A (SUM (POSITIVES N)))
(PLUS (SUM (REMAINDERS N A P))
(TIMES P (SUM (QUOTIENTS 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, SUM, REMAINDERS, and
QUOTIENTS, to the formula:
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (TIMES A (SUM (POSITIVES (SUB1 N))))
(PLUS (SUM (REMAINDERS (SUB1 N) A P))
(TIMES P
(SUM (QUOTIENTS (SUB1 N) A P))))))
(EQUAL (PLUS A
(TIMES A (SUB1 N))
(TIMES A (SUM (POSITIVES (SUB1 N)))))
(PLUS (REMAINDER (TIMES A N) P)
(SUM (REMAINDERS (SUB1 N) A P))
(TIMES P (QUOTIENT (TIMES A N) P))
(TIMES P
(SUM (QUOTIENTS (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 (SUM (POSITIVES X)))
(PLUS (SUM (REMAINDERS X A P))
(TIMES P (SUM (QUOTIENTS X A P))))))
(EQUAL (PLUS A
(TIMES A X)
(TIMES A (SUM (POSITIVES X))))
(PLUS (REMAINDER (TIMES A (ADD1 X)) P)
(SUM (REMAINDERS X A P))
(TIMES P
(QUOTIENT (TIMES A (ADD1 X)) P))
(TIMES P (SUM (QUOTIENTS 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 (SUM (POSITIVES X)))
(PLUS (SUM (REMAINDERS X A P))
(TIMES P (SUM (QUOTIENTS X A P))))))
(EQUAL (PLUS A
(TIMES A X)
(TIMES A (SUM (POSITIVES X))))
(PLUS (SUM (REMAINDERS X A P))
(REMAINDER (PLUS A (TIMES A X)) P)
(TIMES P (SUM (QUOTIENTS X A P)))
(TIMES P
(QUOTIENT (PLUS A (TIMES A X)) P))))).
We now use the above equality hypothesis by substituting:
(PLUS (SUM (REMAINDERS X A P))
(TIMES P (SUM (QUOTIENTS X A P))))
for (TIMES A (SUM (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)
(SUM (REMAINDERS X A P))
(TIMES P (SUM (QUOTIENTS X A P))))
(PLUS (SUM (REMAINDERS X A P))
(REMAINDER (PLUS A (TIMES A X)) P)
(TIMES P (SUM (QUOTIENTS 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 ]
QUOTIENT-REMAINDER-SUM
(PROVE-LEMMA QUOTIENT-REMAINDER-SUM-PARITY NIL
(EQUAL (EVEN (TIMES A (SUM (POSITIVES N))))
(EVEN (PLUS (TIMES P (SUM (QUOTIENTS N A P)))
(SUM (REMAINDERS N A P)))))
((USE (QUOTIENT-REMAINDER-SUM))))
This conjecture can be simplified, using the abbreviation EVEN, to:
(IMPLIES (EQUAL (TIMES A (SUM (POSITIVES N)))
(PLUS (TIMES P (SUM (QUOTIENTS N A P)))
(SUM (REMAINDERS N A P))))
(EQUAL (EQUAL 0
(REMAINDER (TIMES A (SUM (POSITIVES N)))
2))
(EQUAL 0
(REMAINDER (PLUS (TIMES P (SUM (QUOTIENTS N A P)))
(SUM (REMAINDERS N A P)))
2)))).
This simplifies, appealing to the lemmas COMMUTATIVITY-OF-PLUS and
PRIME-KEY-REWRITE, and opening up PRIME, to:
T.
Q.E.D.
[ 0.0 0.3 0.0 ]
QUOTIENT-REMAINDER-SUM-PARITY
(PROVE-LEMMA EVEN-MU
(REWRITE)
(IMPLIES (NOT (EVEN P))
(EQUAL (EVEN (MU N A P))
(IFF (EVEN (SUM (REMAINDERS N A P)))
(EVEN (SUM (REFLECTIONS N A P))))))
((DISABLE EVEN)))
WARNING: Note that the rewrite rule EVEN-MU will be stored so as to apply
only to terms with the nonrecursive function symbol EVEN.
This simplifies, unfolding the definition of IFF, to the following three new
conjectures:
Case 3. (IMPLIES (AND (NOT (EVEN P))
(NOT (EVEN (SUM (REMAINDERS N A P))))
(EVEN (SUM (REFLECTIONS N A P))))
(EQUAL (EVEN (MU N A P)) F)).
This again simplifies, clearly, to:
(IMPLIES (AND (NOT (EVEN P))
(NOT (EVEN (SUM (REMAINDERS N A P))))
(EVEN (SUM (REFLECTIONS N A P))))
(NOT (EVEN (MU N A P)))),
which we will name *1.
Case 2. (IMPLIES (AND (NOT (EVEN P))
(NOT (EVEN (SUM (REMAINDERS N A P))))
(NOT (EVEN (SUM (REFLECTIONS N A P)))))
(EQUAL (EVEN (MU N A P)) T)).
This again simplifies, clearly, to:
(IMPLIES (AND (NOT (EVEN P))
(NOT (EVEN (SUM (REMAINDERS N A P))))
(NOT (EVEN (SUM (REFLECTIONS N A P)))))
(EVEN (MU 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 (EVEN P))
(EQUAL (EVEN (MU N A P))
(IFF (EVEN (SUM (REMAINDERS N A P)))
(EVEN (SUM (REFLECTIONS N A P)))))),
named *1. Let us appeal to the induction principle. 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 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 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 three new formulas:
Case 3. (IMPLIES (AND (ZEROP N) (NOT (EVEN P)))
(EQUAL (EVEN (MU N A P))
(IFF (EVEN (SUM (REMAINDERS N A P)))
(EVEN (SUM (REFLECTIONS N A P)))))),
which simplifies, unfolding the functions ZEROP, EQUAL, MU, EVEN, REMAINDERS,
SUM, REFLECTIONS, and IFF, to:
T.
Case 2. (IMPLIES (AND (NOT (ZEROP N))
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EQUAL (EVEN (MU (SUB1 N) A P))
(IFF (EVEN (SUM (REMAINDERS (SUB1 N) A P)))
(EVEN (SUM (REFLECTIONS (SUB1 N) A P)))))
(NOT (EVEN P)))
(EQUAL (EVEN (MU N A P))
(IFF (EVEN (SUM (REMAINDERS N A P)))
(EVEN (SUM (REFLECTIONS N A P)))))),
which simplifies, rewriting with EVEN-ADD1, CDR-CONS, CAR-CONS, EVEN-PLUS,
COMMUTATIVITY-OF-PLUS, and EVEN-REM, and unfolding the definitions of ZEROP,
IFF, MU, REMAINDERS, SUM, REFLECTIONS, and EQUAL, to the following four new
formulas:
Case 2.4.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P))
(EVEN (SUM (REMAINDERS (SUB1 N) A P)))
(EQUAL (EVEN (MU (SUB1 N) A P))
(EVEN (SUM (REFLECTIONS (SUB1 N) A P))))
(NOT (EVEN P))
(NOT (EVEN (REMAINDER (TIMES A N) P)))
(NOT (EVEN (MU (SUB1 N) A P))))
(EQUAL T
(IFF (EVEN (REMAINDER (TIMES A N) P))
(EQUAL (EVEN (MU (SUB1 N) A P)) T)))).
But this again simplifies, unfolding 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))
(EVEN (SUM (REMAINDERS (SUB1 N) A P)))
(EQUAL (EVEN (MU (SUB1 N) A P))
(EVEN (SUM (REFLECTIONS (SUB1 N) A P))))
(NOT (EVEN P))
(NOT (EVEN (REMAINDER (TIMES A N) P)))
(EVEN (MU (SUB1 N) A P)))
(EQUAL F
(IFF (EVEN (REMAINDER (TIMES A N) P))
(EQUAL (EVEN (MU (SUB1 N) A P)) T)))),
which again simplifies, expanding the functions 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))
(EVEN (SUM (REMAINDERS (SUB1 N) A P)))
(EQUAL (EVEN (MU (SUB1 N) A P))
(EVEN (SUM (REFLECTIONS (SUB1 N) A P))))
(NOT (EVEN P))
(EVEN (REMAINDER (TIMES A N) P))
(NOT (EVEN (MU (SUB1 N) A P))))
(EQUAL T
(IFF (EVEN (REMAINDER (TIMES A N) P))
(EQUAL (EVEN (MU (SUB1 N) A P)) F)))),
which again simplifies, expanding the definitions of 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))
(EVEN (SUM (REMAINDERS (SUB1 N) A P)))
(EQUAL (EVEN (MU (SUB1 N) A P))
(EVEN (SUM (REFLECTIONS (SUB1 N) A P))))
(NOT (EVEN P))
(EVEN (REMAINDER (TIMES A N) P))
(EVEN (MU (SUB1 N) A P)))
(EQUAL F
(IFF (EVEN (REMAINDER (TIMES A N) P))
(EQUAL (EVEN (MU (SUB1 N) A P)) F)))),
which again simplifies, expanding the functions EQUAL and IFF, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EQUAL (EVEN (MU (SUB1 N) A P))
(IFF (EVEN (SUM (REMAINDERS (SUB1 N) A P)))
(EVEN (SUM (REFLECTIONS (SUB1 N) A P)))))
(NOT (EVEN P)))
(EQUAL (EVEN (MU N A P))
(IFF (EVEN (SUM (REMAINDERS N A P)))
(EVEN (SUM (REFLECTIONS N A P)))))),
which simplifies, applying CDR-CONS, CAR-CONS, and EVEN-PLUS, and expanding
the definitions of ZEROP, IFF, MU, REMAINDERS, SUM, REFLECTIONS, and EQUAL,
to the following three new goals:
Case 1.3.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EVEN (SUM (REMAINDERS (SUB1 N) A P)))
(EQUAL (EVEN (MU (SUB1 N) A P))
(EVEN (SUM (REFLECTIONS (SUB1 N) A P))))
(NOT (EVEN P))
(NOT (EVEN (REMAINDER (TIMES A N) P)))
(EQUAL (EVEN (REMAINDER (TIMES A N) P))
(EVEN (MU (SUB1 N) A P))))
(EQUAL (EVEN (MU (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)))
(EVEN (SUM (REMAINDERS (SUB1 N) A P)))
(EQUAL (EVEN (MU (SUB1 N) A P))
(EVEN (SUM (REFLECTIONS (SUB1 N) A P))))
(NOT (EVEN P))
(NOT (EVEN (REMAINDER (TIMES A N) P)))
(NOT (EQUAL (EVEN (REMAINDER (TIMES A N) P))
(EVEN (MU (SUB1 N) A P)))))
(EQUAL (EVEN (MU (SUB1 N) A P)) T)).
This again simplifies, trivially, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (QUOTIENT P 2)
(REMAINDER (TIMES A N) P)))
(EVEN (SUM (REMAINDERS (SUB1 N) A P)))
(EQUAL (EVEN (MU (SUB1 N) A P))
(EVEN (SUM (REFLECTIONS (SUB1 N) A P))))
(NOT (EVEN P))
(EVEN (REMAINDER (TIMES A N) P)))
(EQUAL (EVEN (MU (SUB1 N) A P))
(EQUAL (EVEN (REMAINDER (TIMES A N) P))
(EVEN (MU (SUB1 N) A P))))).
This again simplifies, clearly, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 2.6 0.0 ]
EVEN-MU
(PROVE-LEMMA PERM-SUM-LEMMA
(REWRITE)
(IMPLIES (MEMBER X M)
(EQUAL (PLUS X (SUM (DELETE X M)))
(SUM M))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the newly proposed PERM-SUM-LEMMA 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 (SUM (DELETE X M)))
(SUM 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 (SUM (DELETE X M)))
(SUM M))).
This simplifies, unfolding the definitions of NLISTP, MEMBER, DELETE, and
SUM, 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 (SUM (DELETE X M)))
(SUM M))).
This simplifies, expanding NLISTP and MEMBER, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP M))
(NOT (EQUAL X (CAR M)))
(EQUAL (PLUS X (SUM (DELETE X (CDR M))))
(SUM (CDR M)))
(MEMBER X M))
(EQUAL (PLUS X (SUM (DELETE X M)))
(SUM M))).
This simplifies, applying CDR-CONS, CAR-CONS, and CORRECTNESS-OF-CANCEL, and
opening up the definitions of NLISTP, MEMBER, DELETE, SUM, and FIX, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
PERM-SUM-LEMMA
(PROVE-LEMMA PERM-SUM NIL
(IMPLIES (PERM L M)
(EQUAL (SUM L) (SUM 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 (SUM L) (SUM M))).
This simplifies, expanding the definitions of NLISTP, PERM, SUM, 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 (SUM L) (SUM 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 (SUM (CDR L))
(SUM (DELETE (CAR L) M)))
(PERM L M))
(EQUAL (SUM L) (SUM M))),
which simplifies, rewriting with the lemma PERM-MEMBER, and opening up the
functions NLISTP, MEMBER, PERM, and SUM, to the goal:
(IMPLIES (AND (LISTP L)
(EQUAL (SUM (CDR L))
(SUM (DELETE (CAR L) M)))
(MEMBER (CAR L) M)
(PERM (CDR L) (DELETE (CAR L) M)))
(EQUAL (PLUS (CAR L) (SUM (CDR L)))
(SUM 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 (SUM X) (SUM (DELETE Z M)))
(MEMBER Z M)
(PERM X (DELETE Z M)))
(EQUAL (PLUS Z (SUM X)) (SUM M))).
We use the above equality hypothesis by substituting (SUM (DELETE Z M)) for
(SUM X) and throwing away the equality. This produces:
(IMPLIES (AND (MEMBER Z M)
(PERM X (DELETE Z M)))
(EQUAL (PLUS Z (SUM (DELETE Z M)))
(SUM M))),
which further simplifies, applying PERM-SUM-LEMMA, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP L))
(NOT (MEMBER (CAR L) M))
(PERM L M))
(EQUAL (SUM L) (SUM 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.1 0.0 ]
PERM-SUM
(PROVE-LEMMA SUM-REFLECTIONS
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(NOT (DIVIDES P A)))
(EQUAL (SUM (REFLECTIONS (QUOTIENT P 2) A P))
(SUM (POSITIVES (QUOTIENT P 2)))))
((USE (PERM-SUM (M (REFLECTIONS (QUOTIENT P 2) A P))
(L (POSITIVES (QUOTIENT P 2))))
(PERM-REFLECTIONS))
(DISABLE PRIME)))
This conjecture can be simplified, using the abbreviations NOT, IMPLIES, AND,
and DIVIDES, to:
(IMPLIES (AND (IMPLIES (PERM (POSITIVES (QUOTIENT P 2))
(REFLECTIONS (QUOTIENT P 2) A P))
(EQUAL (SUM (POSITIVES (QUOTIENT P 2)))
(SUM (REFLECTIONS (QUOTIENT P 2) A P))))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(NOT (EQUAL (REMAINDER A P) 0)))
(PERM (POSITIVES (QUOTIENT P 2))
(REFLECTIONS (QUOTIENT P 2) A P)))
(PRIME P)
(NOT (EQUAL P 2))
(NOT (EQUAL (REMAINDER A P) 0)))
(EQUAL (SUM (REFLECTIONS (QUOTIENT P 2) A P))
(SUM (POSITIVES (QUOTIENT P 2))))).
This simplifies, opening up the definitions of IMPLIES, NOT, and AND, to:
T.
Q.E.D.
[ 0.0 1.6 0.0 ]
SUM-REFLECTIONS
(PROVE-LEMMA GAUSS-QUOTIENTS NIL
(IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(NOT (EVEN A))
(NOT (DIVIDES P A)))
(EQUAL (GAUSS A P)
(EVEN (SUM (QUOTIENTS (QUOTIENT P 2) A P)))))
((USE (QUOTIENT-REMAINDER-SUM-PARITY (N (QUOTIENT P 2))))
(DISABLE PRIME EVEN)))
This conjecture can be simplified, using the abbreviations NOT, AND, IMPLIES,
DIVIDES, and EVEN-PLUS, to the goal:
(IMPLIES
(AND (EQUAL (EVEN (TIMES A
(SUM (POSITIVES (QUOTIENT P 2)))))
(EQUAL (EVEN (TIMES P
(SUM (QUOTIENTS (QUOTIENT P 2) A P))))
(EVEN (SUM (REMAINDERS (QUOTIENT P 2) A P)))))
(PRIME P)
(NOT (EQUAL P 2))
(NOT (EVEN A))
(NOT (EQUAL (REMAINDER A P) 0)))
(EQUAL (GAUSS A P)
(EVEN (SUM (QUOTIENTS (QUOTIENT P 2) A P))))).
This simplifies, using linear arithmetic, applying EVEN-TIMES, EVEN-PRIME-2,
EVEN-MU, and SUM-REFLECTIONS, and opening up the definitions of DIVIDES and
GAUSS, to two new formulas:
Case 2. (IMPLIES
(AND (NOT (EQUAL (EVEN (SUM (QUOTIENTS (QUOTIENT P 2) A P)))
(EVEN (SUM (REMAINDERS (QUOTIENT P 2) A P)))))
(NOT (EVEN (SUM (POSITIVES (QUOTIENT P 2)))))
(PRIME P)
(NOT (EQUAL P 2))
(NOT (EVEN A))
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (EVEN (SUM (REMAINDERS (QUOTIENT P 2) A P)))))
(EQUAL T
(EVEN (SUM (QUOTIENTS (QUOTIENT P 2) A P))))),
which again simplifies, opening up EQUAL, to:
T.
Case 1. (IMPLIES
(AND (NOT (EQUAL (EVEN (SUM (QUOTIENTS (QUOTIENT P 2) A P)))
(EVEN (SUM (REMAINDERS (QUOTIENT P 2) A P)))))
(NOT (EVEN (SUM (POSITIVES (QUOTIENT P 2)))))
(PRIME P)
(NOT (EQUAL P 2))
(NOT (EVEN A))
(NOT (EQUAL (REMAINDER A P) 0))
(EVEN (SUM (REMAINDERS (QUOTIENT P 2) A P))))
(EQUAL F
(EVEN (SUM (QUOTIENTS (QUOTIENT P 2) A P))))),
which again simplifies, opening up EQUAL, to:
T.
Q.E.D.
[ 0.0 3.1 0.0 ]
GAUSS-QUOTIENTS
(PROVE-LEMMA EQUAL-RESIDUE-EVEN-PLUS
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(PRIME Q)
(NOT (EQUAL Q 2))
(NOT (EQUAL P Q)))
(EQUAL (EQUAL (RESIDUE Q P) (RESIDUE P Q))
(EVEN (PLUS (SUM (QUOTIENTS (QUOTIENT P 2) Q P))
(SUM (QUOTIENTS (QUOTIENT Q 2) P Q))))))
((USE (GAUSS-LEMMA (A Q))
(GAUSS-LEMMA (A P) (P Q))
(GAUSS-QUOTIENTS (A Q))
(GAUSS-QUOTIENTS (A P) (P Q)))
(DISABLE PRIME1 EVEN GAUSS RESIDUE)))
This conjecture can be simplified, using the abbreviations NOT, PRIME, IMPLIES,
AND, EVEN-PLUS, and DIVIDES, to:
(IMPLIES
(AND (IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(NOT (EQUAL (REMAINDER Q P) 0)))
(EQUAL (GAUSS Q P) (RESIDUE Q P)))
(IMPLIES (AND (PRIME Q)
(NOT (EQUAL Q 2))
(NOT (EQUAL (REMAINDER P Q) 0)))
(EQUAL (GAUSS P Q) (RESIDUE P Q)))
(IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(NOT (EVEN Q))
(NOT (EQUAL (REMAINDER Q P) 0)))
(EQUAL (GAUSS Q P)
(EVEN (SUM (QUOTIENTS (QUOTIENT P 2) Q P)))))
(IMPLIES (AND (PRIME Q)
(NOT (EQUAL Q 2))
(NOT (EVEN P))
(NOT (EQUAL (REMAINDER P Q) 0)))
(EQUAL (GAUSS P Q)
(EVEN (SUM (QUOTIENTS (QUOTIENT Q 2) P Q)))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL P 2))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL Q 2))
(NOT (EQUAL P Q)))
(EQUAL (EQUAL (RESIDUE Q P) (RESIDUE P Q))
(EQUAL (EVEN (SUM (QUOTIENTS (QUOTIENT P 2) Q P)))
(EVEN (SUM (QUOTIENTS (QUOTIENT Q 2) P Q)))))).
This simplifies, appealing to the lemmas LITTLE-STEP and EVEN-PRIME-2, and
opening up PRIME, NOT, AND, and IMPLIES, to:
T.
Q.E.D.
[ 0.0 3.0 0.0 ]
EQUAL-RESIDUE-EVEN-PLUS
(DEFN W
(X L)
(IF (LISTP L)
(IF (LESSP (CAR L) X)
(ADD1 (W X (CDR L)))
(W X (CDR L)))
0))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT L) decreases according to the well-founded relation LESSP in each
recursive call. Hence, W is accepted under the principle of definition. From
the definition we can conclude that (NUMBERP (W X L)) is a theorem.
[ 0.0 0.0 0.0 ]
W
(DEFN WINS
(K L)
(IF (LISTP K)
(PLUS (W (CAR K) L) (WINS (CDR K) L))
0))
Linear arithmetic and the lemma CDR-LESSP 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 ALL-NUMBERP
(L)
(IF (LISTP L)
(AND (NUMBERP (CAR L))
(ALL-NUMBERP (CDR L)))
T))
Linear arithmetic and the lemma CDR-LESSP inform us that the measure
(COUNT L) decreases according to the well-founded relation LESSP in each
recursive call. Hence, ALL-NUMBERP is accepted under the definitional
principle. Observe that (OR (FALSEP (ALL-NUMBERP L)) (TRUEP (ALL-NUMBERP L)))
is a theorem.
[ 0.0 0.0 0.0 ]
ALL-NUMBERP
(DEFN L
(X L)
(IF (LISTP L)
(IF (LESSP X (CAR L))
(ADD1 (L X (CDR L)))
(L X (CDR L)))
0))
Linear arithmetic and the lemma CDR-LESSP establish that the measure
(COUNT L) decreases according to the well-founded relation LESSP in each
recursive call. Hence, L is accepted under the principle of definition. From
the definition we can conclude that (NUMBERP (L X L)) is a theorem.
[ 0.0 0.0 0.0 ]
L
(DEFN LOSSES
(K L)
(IF (LISTP K)
(PLUS (L (CAR K) L)
(LOSSES (CDR K) L))
0))
Linear arithmetic and the lemma CDR-LESSP 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 PLUS-L-W
(REWRITE)
(IMPLIES (AND (NOT (MEMBER X L))
(NUMBERP X)
(ALL-NUMBERP L))
(EQUAL (PLUS (L X L) (W X L))
(LENGTH L))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the newly proposed PLUS-L-W could!
Call the conjecture *1.
Let us appeal to the induction principle. Five inductions are suggested
by terms in the conjecture. However, they merge into one likely candidate
induction. We will induct according to the following scheme:
(AND (IMPLIES (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 produces five new goals:
Case 5. (IMPLIES (AND (NLISTP L)
(NOT (MEMBER X L))
(NUMBERP X)
(ALL-NUMBERP L))
(EQUAL (PLUS (L X L) (W X L))
(LENGTH L))),
which simplifies, unfolding the functions NLISTP, MEMBER, ALL-NUMBERP, L, W,
PLUS, LENGTH, and EQUAL, to:
T.
Case 4. (IMPLIES (AND (NOT (NLISTP L))
(EQUAL X (CAR L))
(NOT (MEMBER X L))
(NUMBERP X)
(ALL-NUMBERP L))
(EQUAL (PLUS (L X L) (W X L))
(LENGTH L))),
which simplifies, expanding the functions 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))
(NUMBERP X)
(ALL-NUMBERP L))
(EQUAL (PLUS (L X L) (W X L))
(LENGTH L))),
which simplifies, opening up NLISTP and MEMBER, to:
T.
Case 2. (IMPLIES (AND (NOT (NLISTP L))
(NOT (EQUAL X (CAR L)))
(NOT (ALL-NUMBERP (CDR L)))
(NOT (MEMBER X L))
(NUMBERP X)
(ALL-NUMBERP L))
(EQUAL (PLUS (L X L) (W X L))
(LENGTH L))),
which simplifies, opening up the definitions of NLISTP, MEMBER, and
ALL-NUMBERP, to:
T.
Case 1. (IMPLIES (AND (NOT (NLISTP L))
(NOT (EQUAL X (CAR L)))
(EQUAL (PLUS (L X (CDR L)) (W X (CDR L)))
(LENGTH (CDR L)))
(NOT (MEMBER X L))
(NUMBERP X)
(ALL-NUMBERP L))
(EQUAL (PLUS (L X L) (W X L))
(LENGTH L))),
which simplifies, expanding the functions NLISTP, MEMBER, ALL-NUMBERP, L, W,
and LENGTH, to four new goals:
Case 1.4.
(IMPLIES (AND (LISTP L)
(NOT (EQUAL X (CAR L)))
(EQUAL (PLUS (L X (CDR L)) (W X (CDR L)))
(LENGTH (CDR L)))
(NOT (MEMBER X (CDR L)))
(NUMBERP X)
(NUMBERP (CAR L))
(ALL-NUMBERP (CDR L))
(NOT (LESSP (CAR L) X))
(NOT (LESSP X (CAR L))))
(EQUAL (PLUS (L X (CDR L)) (W X (CDR L)))
(ADD1 (LENGTH (CDR L))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.3.
(IMPLIES (AND (LISTP L)
(NOT (EQUAL X (CAR L)))
(EQUAL (PLUS (L X (CDR L)) (W X (CDR L)))
(LENGTH (CDR L)))
(NOT (MEMBER X (CDR L)))
(NUMBERP X)
(NUMBERP (CAR L))
(ALL-NUMBERP (CDR L))
(NOT (LESSP (CAR L) X))
(LESSP X (CAR L)))
(EQUAL (PLUS (ADD1 (L X (CDR L)))
(W 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 (L X (CDR L)) (W X (CDR L)))
(LENGTH (CDR L)))
(NOT (MEMBER X (CDR L)))
(NUMBERP X)
(NUMBERP (CAR L))
(ALL-NUMBERP (CDR L))
(LESSP (CAR L) X)
(NOT (LESSP X (CAR L))))
(EQUAL (PLUS (L X (CDR L))
(ADD1 (W 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 (L X (CDR L)) (W X (CDR L)))
(LENGTH (CDR L)))
(NOT (MEMBER X (CDR L)))
(NUMBERP X)
(NUMBERP (CAR L))
(ALL-NUMBERP (CDR L))
(LESSP (CAR L) X)
(LESSP X (CAR L)))
(EQUAL (PLUS (ADD1 (L X (CDR L)))
(ADD1 (W 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 ]
PLUS-L-W
(PROVE-LEMMA PLUS-WINS-LOSSES
(REWRITE)
(IMPLIES (AND (NLISTP (INTERSECT L M))
(ALL-NUMBERP L)
(ALL-NUMBERP 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 PLUS-WINS-LOSSES 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-NUMBERP L)
(ALL-NUMBERP 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-NUMBERP L)
(ALL-NUMBERP 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-NUMBERP L)
(ALL-NUMBERP 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-NUMBERP, 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-NUMBERP L)
(ALL-NUMBERP 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-NUMBERP (CDR L)))
(NOT (LISTP (FOR X1 IN L WHEN
(MEMBER X1 M)
COLLECT X1)))
(ALL-NUMBERP L)
(ALL-NUMBERP 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-NUMBERP L)
(ALL-NUMBERP 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-NUMBERP L)
(ALL-NUMBERP 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-NUMBERP (CDR L)))
(NOT (LISTP (FOR X1 IN L WHEN
(MEMBER X1 M)
COLLECT X1)))
(ALL-NUMBERP L)
(ALL-NUMBERP 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-NUMBERP, 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-NUMBERP L)
(ALL-NUMBERP 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, ASSOCIATIVITY-OF-PLUS, and TIMES-ADD1, and unfolding
the definitions of NLISTP, EVAL$, FOR, ALL-NUMBERP, 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)))
(NUMBERP (CAR L))
(ALL-NUMBERP (CDR L))
(ALL-NUMBERP M))
(EQUAL (PLUS (L (CAR L) M)
(LOSSES (CDR L) M)
(W (CAR L) M)
(WINS (CDR 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)))
(NUMBERP X)
(ALL-NUMBERP Z)
(ALL-NUMBERP M))
(EQUAL (PLUS (L X M)
(LOSSES Z M)
(W X M)
(WINS Z 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)))
(NUMBERP X)
(ALL-NUMBERP Z)
(ALL-NUMBERP M))
(EQUAL (PLUS (L X M)
(LOSSES Z M)
(W X M)
(WINS Z M))
(PLUS (LENGTH M)
(LOSSES Z M)
(WINS Z M)))),
which further simplifies, rewriting with CORRECTNESS-OF-CANCEL and PLUS-L-W,
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 ]
PLUS-WINS-LOSSES
(PROVE-LEMMA EQUAL-WINS-LOSSES NIL
(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 (AND (LISTP L) (p (CDR L) M))
(p L M))
(IMPLIES (NOT (LISTP L)) (p L M))).
Linear arithmetic and the lemma CDR-LESSP inform us that the measure (COUNT L)
decreases according to the well-founded relation LESSP in each induction step
of the scheme. The above induction scheme produces the following two new
conjectures:
Case 2. (IMPLIES (AND (LISTP L)
(EQUAL (LOSSES (CDR L) M)
(WINS M (CDR L))))
(EQUAL (LOSSES L M) (WINS M L))).
This simplifies, expanding the function LOSSES, to the new goal:
(IMPLIES (AND (LISTP L)
(EQUAL (LOSSES (CDR L) M)
(WINS M (CDR L))))
(EQUAL (PLUS (L (CAR L) M)
(LOSSES (CDR L) M))
(WINS M L))).
Applying the lemma CAR-CDR-ELIM, replace L by (CONS Z X) to eliminate
(CDR L) and (CAR L). This produces:
(IMPLIES (EQUAL (LOSSES X M) (WINS M X))
(EQUAL (PLUS (L Z M) (LOSSES X 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 must thus prove:
(EQUAL (PLUS (L Z M) (WINS M X))
(WINS M (CONS Z X))).
Name the above subgoal *1.1.
Case 1. (IMPLIES (NOT (LISTP L))
(EQUAL (LOSSES L M) (WINS M L))).
This simplifies, opening up the function LOSSES, to:
(IMPLIES (NOT (LISTP L))
(EQUAL 0 (WINS M L))),
which we will name *1.2.
We will appeal to induction. There is only one plausible induction. We
will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP M) (p (CDR M) L))
(p M L))
(IMPLIES (NOT (LISTP M)) (p M L))).
Linear arithmetic and the lemma CDR-LESSP 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 two new
conjectures:
Case 2. (IMPLIES (AND (LISTP M)
(EQUAL 0 (WINS (CDR M) L))
(NOT (LISTP L)))
(EQUAL 0 (WINS M L))).
This simplifies, expanding WINS, W, PLUS, and EQUAL, to:
T.
Case 1. (IMPLIES (AND (NOT (LISTP M)) (NOT (LISTP L)))
(EQUAL 0 (WINS M L))).
This simplifies, opening up the definitions of WINS and EQUAL, to:
T.
That finishes the proof of *1.2.
So next consider:
(EQUAL (PLUS (L Z M) (WINS M X))
(WINS M (CONS Z X))),
which we named *1.1 above. We will appeal to induction. There are three
plausible inductions. However, they merge into one likely candidate induction.
We will induct according to the following scheme:
(AND (IMPLIES (AND (LISTP M)
(LESSP Z (CAR M))
(p Z (CDR M) X))
(p Z M X))
(IMPLIES (AND (LISTP M)
(NOT (LESSP Z (CAR M)))
(p Z (CDR M) X))
(p Z M X))
(IMPLIES (NOT (LISTP M)) (p Z M X))).
Linear arithmetic and the lemma CDR-LESSP 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 (AND (LISTP M)
(LESSP Z (CAR M))
(EQUAL (PLUS (L Z (CDR M)) (WINS (CDR M) X))
(WINS (CDR M) (CONS Z X))))
(EQUAL (PLUS (L 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, and SUB1-ADD1, and opening up L,
WINS, W, and PLUS, to:
T.
Case 2. (IMPLIES (AND (LISTP M)
(NOT (LESSP Z (CAR M)))
(EQUAL (PLUS (L Z (CDR M)) (WINS (CDR M) X))
(WINS (CDR M) (CONS Z X))))
(EQUAL (PLUS (L Z M) (WINS M X))
(WINS M (CONS Z X)))),
which simplifies, rewriting with the lemmas CDR-CONS, CAR-CONS, and
CORRECTNESS-OF-CANCEL, and opening up the functions L, WINS, W, and FIX, to:
T.
Case 1. (IMPLIES (NOT (LISTP M))
(EQUAL (PLUS (L Z M) (WINS M X))
(WINS M (CONS Z X)))),
which simplifies, expanding L, WINS, PLUS, and EQUAL, to:
T.
That finishes the proof of *1.1, which, consequently, finishes the proof
of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
EQUAL-WINS-LOSSES
(PROVE-LEMMA PLUS-WINS-WINS
(REWRITE)
(IMPLIES (AND (NLISTP (INTERSECT L M))
(ALL-NUMBERP L)
(ALL-NUMBERP M))
(EQUAL (PLUS (WINS L M) (WINS M L))
(TIMES (LENGTH L) (LENGTH M))))
((USE (EQUAL-WINS-LOSSES))))
WARNING: the previously added lemma, COMMUTATIVITY-OF-PLUS, could be applied
whenever the newly proposed PLUS-WINS-WINS could!
This conjecture can be simplified, using the abbreviations NLISTP, AND,
IMPLIES, and INTERSECT, to:
(IMPLIES (AND (EQUAL (LOSSES L M) (WINS M L))
(NOT (LISTP (FOR 'X1
L
'(MEMBER X1 Y)
'COLLECT
'X1
(LIST (CONS 'Y M)))))
(ALL-NUMBERP L)
(ALL-NUMBERP M))
(EQUAL (PLUS (WINS L M) (WINS M L))
(TIMES (LENGTH L) (LENGTH M)))).
This simplifies, applying PLUS-WINS-LOSSES, and expanding EVAL$ and INTERSECT,
to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
PLUS-WINS-WINS
(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 ALL-NUMBERP-MULTS
(REWRITE)
(IMPLIES (NOT (ZEROP P))
(ALL-NUMBERP (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-NUMBERP (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-NUMBERP (MULTS N P))).
This simplifies, opening up the definitions of ZEROP, EQUAL, MULTS, and
ALL-NUMBERP, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(ALL-NUMBERP (MULTS (SUB1 N) P))
(NOT (EQUAL P 0))
(NUMBERP P))
(ALL-NUMBERP (MULTS N P))).
This simplifies, applying CDR-CONS and CAR-CONS, and opening up ZEROP, MULTS,
and ALL-NUMBERP, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
ALL-NUMBERP-MULTS
(PROVE-LEMMA EMPTY-INTERSECT-MULTS-LEMMA
(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-LEMMA
(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)))))
((DISABLE PRIME1 QUOTIENT)
(INDUCT (MULTS I P))))
This conjecture can be simplified, using the abbreviations ZEROP, PRIME,
IMPLIES, NOT, OR, AND, and INTERSECT, to two new formulas:
Case 2. (IMPLIES (AND (ZEROP 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
(MULTS I P)
'(MEMBER X1 Y)
'COLLECT
'X1
(LIST (CONS 'Y
(MULTS (QUOTIENT P 2) Q))))))),
which simplifies, expanding the functions ZEROP, EQUAL, LESSP, MULTS, MEMBER,
LISTP, FOR, CDR, ASSOC, and QUANTIFIER-INITIAL-VALUE, to:
T.
Case 1. (IMPLIES
(AND
(NOT (EQUAL I 0))
(NUMBERP I)
(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)))))))
(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
(MULTS I P)
'(MEMBER X1 Y)
'COLLECT
'X1
(LIST (CONS 'Y
(MULTS (QUOTIENT P 2) Q))))))),
which simplifies, using linear arithmetic, rewriting with the lemmas
CAR-CONS, CDR-CONS, EMPTY-INTERSECT-MULTS-LEMMA, LESSP-QUOTIENT1, and
REWRITE-EVAL$, and unfolding the definitions of PRIME, NOT, AND, EVAL$,
IMPLIES, LESSP, MULTS, MEMBER, EQUAL, NUMBERP, and FOR, to the goal:
(IMPLIES (AND (NOT (EQUAL I 0))
(NUMBERP I)
(NOT (LESSP (SUB1 I) 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 (SUB1 I) (SUB1 Q)))
(NOT (LISTP (FOR X1 IN
(MULTS (SUB1 I) P)
WHEN
(MEMBER X1 (MULTS (QUOTIENT P 2) Q))
COLLECT X1)))).
This again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 4.4 0.0 ]
EMPTY-INTERSECT-MULTS
(PROVE-LEMMA LENGTH-MULTS
(REWRITE)
(IMPLIES (NUMBERP N)
(EQUAL (LENGTH (MULTS N P)) N)))
Name the conjecture *1.
We will appeal to induction. There is only one plausible induction. We
will induct according to the following scheme:
(AND (IMPLIES (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
produces the following two new formulas:
Case 2. (IMPLIES (AND (ZEROP N) (NUMBERP N))
(EQUAL (LENGTH (MULTS N P)) N)).
This simplifies, expanding 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 the
definitions of 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 LESSP-A NIL
(IMPLIES (NOT (ZEROP P))
(LESSP A
(TIMES (ADD1 (QUOTIENT A P)) P))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, and
IMPLIES, to the goal:
(IMPLIES (AND (NOT (EQUAL P 0)) (NUMBERP P))
(LESSP A
(TIMES (ADD1 (QUOTIENT A P)) P))).
This simplifies, applying the lemmas TIMES-ADD1 and COMMUTATIVITY-OF-TIMES, to:
(IMPLIES (AND (NOT (EQUAL P 0)) (NUMBERP P))
(LESSP A
(PLUS P (TIMES P (QUOTIENT A P))))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace A by (PLUS Z (TIMES P X))
to eliminate (QUOTIENT A P) and (REMAINDER A P). 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 two new goals:
Case 2. (IMPLIES (AND (NOT (NUMBERP A))
(NOT (EQUAL P 0))
(NUMBERP P))
(LESSP A
(PLUS P (TIMES P (QUOTIENT A P))))).
This further simplifies, applying the lemmas COMMUTATIVITY-OF-TIMES and
PLUS-EQUAL-0, and opening up the definitions of LESSP and QUOTIENT, to:
T.
Case 1. (IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(EQUAL (LESSP Z P) (NOT (ZEROP P)))
(NOT (EQUAL P 0))
(NUMBERP P))
(LESSP (PLUS Z (TIMES P X))
(PLUS P (TIMES P X)))),
which further simplifies, expanding ZEROP and NOT, to:
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(LESSP Z P)
(NOT (EQUAL P 0))
(NUMBERP P))
(LESSP (PLUS Z (TIMES P X))
(PLUS P (TIMES P X)))).
But this again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
LESSP-A
(PROVE-LEMMA LEQ-W-N
(REWRITE)
(NOT (LESSP N (W A (MULTS N P)))))
WARNING: Note that the proposed lemma LEQ-W-N is to be stored as zero type
prescription rules, zero compound recognizer rules, one linear rule, and zero
replacement rules.
Name the conjecture *1.
Perhaps we can prove it by induction. There are two plausible inductions.
However, they merge into one likely candidate induction. We will induct
according to the following scheme:
(AND (IMPLIES (OR (EQUAL (W A (MULTS N P)) 0)
(NOT (NUMBERP (W A (MULTS N P)))))
(p N A P))
(IMPLIES (AND (NOT (OR (EQUAL (W A (MULTS N P)) 0)
(NOT (NUMBERP (W A (MULTS N P))))))
(OR (EQUAL N 0) (NOT (NUMBERP N))))
(p N A P))
(IMPLIES (AND (NOT (OR (EQUAL (W A (MULTS N P)) 0)
(NOT (NUMBERP (W 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 goals:
Case 3. (IMPLIES (OR (EQUAL (W A (MULTS N P)) 0)
(NOT (NUMBERP (W A (MULTS N P)))))
(NOT (LESSP N (W A (MULTS N P))))).
This simplifies, applying CDR-CONS and CAR-CONS, and unfolding the
definitions of MULTS, NOT, OR, W, EQUAL, LISTP, and LESSP, to two new
formulas:
Case 3.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (W A
(CONS (TIMES N P) (MULTS (SUB1 N) P)))
0)
(NOT (LESSP (TIMES N P) A)))
(NOT (LESSP N (W A (MULTS (SUB1 N) P))))),
which again simplifies, applying CDR-CONS and CAR-CONS, and opening up W,
EQUAL, and LESSP, to:
T.
Case 3.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(EQUAL (W A
(CONS (TIMES N P) (MULTS (SUB1 N) P)))
0)
(LESSP (TIMES N P) A))
(NOT (LESSP N
(ADD1 (W A (MULTS (SUB1 N) P)))))).
This again simplifies, rewriting with the lemmas CDR-CONS and CAR-CONS,
and unfolding W, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL (W A (MULTS N P)) 0)
(NOT (NUMBERP (W A (MULTS N P))))))
(OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (LESSP N (W A (MULTS N P))))),
which simplifies, opening up the functions MULTS, NOT, OR, EQUAL, NUMBERP,
LISTP, W, and LESSP, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL (W A (MULTS N P)) 0)
(NOT (NUMBERP (W A (MULTS N P))))))
(NOT (OR (EQUAL N 0) (NOT (NUMBERP N))))
(NOT (LESSP (SUB1 N)
(W A (MULTS (SUB1 N) P)))))
(NOT (LESSP N (W A (MULTS N P))))),
which simplifies, rewriting with CDR-CONS and CAR-CONS, and opening up the
definitions of MULTS, NOT, OR, W, EQUAL, and NUMBERP, to the following two
new formulas:
Case 1.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (EQUAL (W A
(CONS (TIMES N P) (MULTS (SUB1 N) P)))
0))
(NOT (LESSP (SUB1 N)
(W A (MULTS (SUB1 N) P))))
(NOT (LESSP (TIMES N P) A)))
(NOT (LESSP N (W A (MULTS (SUB1 N) P))))).
This again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (EQUAL (W A
(CONS (TIMES N P) (MULTS (SUB1 N) P)))
0))
(NOT (LESSP (SUB1 N)
(W A (MULTS (SUB1 N) P))))
(LESSP (TIMES N P) A))
(NOT (LESSP N
(ADD1 (W 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.0 0.0 ]
LEQ-W-N
(PROVE-LEMMA LESSP-REWRITE
(REWRITE)
(IMPLIES (AND (LESSP A (TIMES M P)) (LEQ M N))
(LESSP A (TIMES N P))))
WARNING: When the linear lemma LESSP-REWRITE is stored under (TIMES N P) it
contains the free variables M and A which will be chosen by instantiating the
hypothesis (LESSP A (TIMES M P)).
WARNING: Note that the proposed lemma LESSP-REWRITE is to be stored as zero
type prescription rules, zero compound recognizer rules, one linear rule, and
zero replacement rules.
Call the conjecture *1.
We will 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 (OR (EQUAL (TIMES M P) 0)
(NOT (NUMBERP (TIMES M P))))
(p A N P M))
(IMPLIES (AND (NOT (OR (EQUAL (TIMES M P) 0)
(NOT (NUMBERP (TIMES M P)))))
(OR (EQUAL A 0) (NOT (NUMBERP A))))
(p A N P M))
(IMPLIES (AND (NOT (OR (EQUAL (TIMES M P) 0)
(NOT (NUMBERP (TIMES M P)))))
(NOT (OR (EQUAL A 0) (NOT (NUMBERP A))))
(p (SUB1 A) N P M))
(p A N P M))).
Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions
of OR and NOT inform us that the measure (COUNT A) decreases according to the
well-founded relation LESSP in each induction step of the scheme. The above
induction scheme leads to the following four new conjectures:
Case 4. (IMPLIES (AND (OR (EQUAL (TIMES M P) 0)
(NOT (NUMBERP (TIMES M P))))
(LESSP A (TIMES M P))
(NOT (LESSP N M)))
(LESSP A (TIMES N P))).
This simplifies, rewriting with EQUAL-TIMES-0, TIMES-IDENTITY,
COMMUTATIVITY-OF-TIMES, and TIMES-ZERO2, and opening up the functions NOT,
OR, EQUAL, and LESSP, to:
T.
Case 3. (IMPLIES (AND (NOT (OR (EQUAL (TIMES M P) 0)
(NOT (NUMBERP (TIMES M P)))))
(OR (EQUAL A 0) (NOT (NUMBERP A)))
(LESSP A (TIMES M P))
(NOT (LESSP N M)))
(LESSP A (TIMES N P))),
which simplifies, rewriting with EQUAL-TIMES-0, and opening up the
definitions of NOT, OR, EQUAL, and LESSP, to the following four new goals:
Case 3.4.
(IMPLIES (AND (NOT (EQUAL M 0))
(NUMBERP M)
(NOT (EQUAL P 0))
(NUMBERP P)
(EQUAL A 0)
(NOT (LESSP N M)))
(NOT (EQUAL N 0))).
But this again simplifies, using linear arithmetic, to:
T.
Case 3.3.
(IMPLIES (AND (NOT (EQUAL M 0))
(NUMBERP M)
(NOT (EQUAL P 0))
(NUMBERP P)
(EQUAL A 0)
(NOT (LESSP N M)))
(NUMBERP N)),
which again simplifies, opening up the definition of LESSP, to:
T.
Case 3.2.
(IMPLIES (AND (NOT (EQUAL M 0))
(NUMBERP M)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (NUMBERP A))
(NOT (LESSP N M)))
(NOT (EQUAL N 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 3.1.
(IMPLIES (AND (NOT (EQUAL M 0))
(NUMBERP M)
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (NUMBERP A))
(NOT (LESSP N M)))
(NUMBERP N)),
which again simplifies, expanding the definition of LESSP, to:
T.
Case 2. (IMPLIES (AND (NOT (OR (EQUAL (TIMES M P) 0)
(NOT (NUMBERP (TIMES M P)))))
(NOT (OR (EQUAL A 0) (NOT (NUMBERP A))))
(NOT (LESSP (SUB1 A) (TIMES M P)))
(LESSP A (TIMES M P))
(NOT (LESSP N M)))
(LESSP A (TIMES N P))),
which simplifies, using linear arithmetic, to:
(IMPLIES (AND (LESSP A 1)
(NOT (OR (EQUAL (TIMES M P) 0)
(NOT (NUMBERP (TIMES M P)))))
(NOT (OR (EQUAL A 0) (NOT (NUMBERP A))))
(NOT (LESSP (SUB1 A) (TIMES M P)))
(LESSP A (TIMES M P))
(NOT (LESSP N M)))
(LESSP A (TIMES N P))).
This again simplifies, applying EQUAL-TIMES-0, and opening up the functions
SUB1, NUMBERP, EQUAL, LESSP, NOT, and OR, to:
T.
Case 1. (IMPLIES (AND (NOT (OR (EQUAL (TIMES M P) 0)
(NOT (NUMBERP (TIMES M P)))))
(NOT (OR (EQUAL A 0) (NOT (NUMBERP A))))
(LESSP (SUB1 A) (TIMES N P))
(LESSP A (TIMES M P))
(NOT (LESSP N M)))
(LESSP A (TIMES N P))).
This simplifies, using linear arithmetic, to the following two new formulas:
Case 1.2.
(IMPLIES (AND (NOT (NUMBERP A))
(NOT (OR (EQUAL (TIMES M P) 0)
(NOT (NUMBERP (TIMES M P)))))
(NOT (OR (EQUAL A 0) (NOT (NUMBERP A))))
(LESSP (SUB1 A) (TIMES N P))
(LESSP A (TIMES M P))
(NOT (LESSP N M)))
(LESSP A (TIMES N P))).
But this again simplifies, rewriting with EQUAL-TIMES-0, and expanding the
definitions of NOT and OR, to:
T.
Case 1.1.
(IMPLIES (AND (NUMBERP A)
(NOT (OR (EQUAL (TIMES M P) 0)
(NOT (NUMBERP (TIMES M P)))))
(NOT (OR (EQUAL (TIMES N P) 0)
(NOT (NUMBERP (TIMES N P)))))
(LESSP (SUB1 (TIMES N P)) (TIMES N P))
(LESSP (TIMES N P) (TIMES M P))
(NOT (LESSP N M)))
(LESSP (TIMES N P) (TIMES N P))).
This again simplifies, applying EQUAL-TIMES-0 and LESSP-TIMES-CANCELLATION,
and expanding NOT and OR, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LESSP-REWRITE
(PROVE-LEMMA LESSP-W-M NIL
(IMPLIES (LESSP A (TIMES M P))
(LESSP (W A (MULTS N P)) M)))
Call the conjecture *1.
We will try to prove it by induction. There are two plausible inductions,
both of which are unflawed. However, one of these is more likely than the
other. We will induct according to the following scheme:
(AND (IMPLIES (ZEROP N) (p A N P M))
(IMPLIES (AND (NOT (ZEROP N))
(p A (SUB1 N) P M))
(p A N P M))).
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 two new goals:
Case 2. (IMPLIES (AND (ZEROP N) (LESSP A (TIMES M P)))
(LESSP (W A (MULTS N P)) M)),
which simplifies, opening up the functions ZEROP, EQUAL, MULTS, LISTP, W,
and LESSP, to four new formulas:
Case 2.4.
(IMPLIES (AND (EQUAL N 0)
(LESSP A (TIMES M P)))
(NOT (EQUAL M 0))),
which again simplifies, using linear arithmetic, to:
T.
Case 2.3.
(IMPLIES (AND (EQUAL N 0)
(LESSP A (TIMES M P)))
(NUMBERP M)),
which again simplifies, applying EQUAL-TIMES-0, and opening up the
function LESSP, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP N))
(LESSP A (TIMES M P)))
(NOT (EQUAL M 0))).
But this again simplifies, using linear arithmetic, to:
T.
Case 2.1.
(IMPLIES (AND (NOT (NUMBERP N))
(LESSP A (TIMES M P)))
(NUMBERP M)),
which again simplifies, applying EQUAL-TIMES-0, and unfolding LESSP, to:
T.
Case 1. (IMPLIES (AND (NOT (ZEROP N))
(LESSP (W A (MULTS (SUB1 N) P)) M)
(LESSP A (TIMES M P)))
(LESSP (W A (MULTS N P)) M)).
This simplifies, applying CDR-CONS and CAR-CONS, and opening up the
functions ZEROP, MULTS, and W, to:
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (W A (MULTS (SUB1 N) P)) M)
(LESSP A (TIMES M P))
(LESSP (TIMES N P) A))
(LESSP (ADD1 (W A (MULTS (SUB1 N) P)))
M)).
But this again simplifies, using linear arithmetic and rewriting with the
lemmas LESSP-REWRITE and LEQ-W-N, to:
T.
That finishes the proof of *1. Q.E.D.
[ 0.0 0.0 0.0 ]
LESSP-W-M
(PROVE-LEMMA LEQ-W-QUOTIENT NIL
(IMPLIES (NOT (ZEROP P))
(LEQ (W A (MULTS N P))
(QUOTIENT A P)))
((USE (LESSP-A)
(LESSP-W-M (M (ADD1 (QUOTIENT A P)))))))
This conjecture can be simplified, using the abbreviations ZEROP, NOT, IMPLIES,
and AND, to the formula:
(IMPLIES (AND (IMPLIES (NOT (ZEROP P))
(LESSP A
(TIMES (ADD1 (QUOTIENT A P)) P)))
(IMPLIES (LESSP A
(TIMES (ADD1 (QUOTIENT A P)) P))
(LESSP (W A (MULTS N P))
(ADD1 (QUOTIENT A P))))
(NOT (EQUAL P 0))
(NUMBERP P))
(NOT (LESSP (QUOTIENT A P)
(W A (MULTS N P))))).
This simplifies, applying TIMES-ADD1, COMMUTATIVITY-OF-TIMES, and SUB1-ADD1,
and opening up the functions ZEROP, NOT, IMPLIES, LESSP, and EQUAL, to:
(IMPLIES (AND (LESSP A
(PLUS P (TIMES P (QUOTIENT A P))))
(LESSP (SUB1 (W A (MULTS N P)))
(QUOTIENT A P))
(NOT (EQUAL P 0))
(NUMBERP P))
(NOT (LESSP (QUOTIENT A P)
(W A (MULTS N P))))).
But this again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
LEQ-W-QUOTIENT
(PROVE-LEMMA MONOTONE-W NIL
(IMPLIES (LEQ M N)
(LEQ (W A (MULTS M P))
(W A (MULTS N P))))
((INDUCT (MULTS N 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 N) (NOT (LESSP N M)))
(NOT (LESSP (W A (MULTS N P))
(W A (MULTS M P))))).
This simplifies, opening up ZEROP, EQUAL, LESSP, MULTS, LISTP, and W, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(IMPLIES (IF (LESSP (SUB1 N) M) F T)
(IF (LESSP (W A (MULTS (SUB1 N) P))
(W A (MULTS M P)))
F T))
(NOT (LESSP N M)))
(NOT (LESSP (W A (MULTS N P))
(W A (MULTS M P))))).
This simplifies, applying CDR-CONS and CAR-CONS, and unfolding the functions
IMPLIES, MULTS, and W, to three new formulas:
Case 1.3.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (SUB1 N) M)
(NOT (LESSP N M))
(NOT (LESSP (TIMES N P) A)))
(NOT (LESSP (W A (MULTS (SUB1 N) P))
(W A (MULTS M P))))),
which again simplifies, using linear arithmetic, to two new formulas:
Case 1.3.2.
(IMPLIES (AND (NOT (NUMBERP M))
(NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (SUB1 N) M)
(NOT (LESSP N M))
(NOT (LESSP (TIMES N P) A)))
(NOT (LESSP (W A (MULTS (SUB1 N) P))
(W A (MULTS M P))))),
which again simplifies, opening up the function LESSP, to:
T.
Case 1.3.1.
(IMPLIES (AND (NUMBERP M)
(NOT (EQUAL M 0))
(LESSP (SUB1 M) M)
(NOT (LESSP M M))
(NOT (LESSP (TIMES M P) A)))
(NOT (LESSP (W A (MULTS (SUB1 M) P))
(W A (MULTS M P))))),
which again simplifies, applying CDR-CONS and CAR-CONS, and expanding
the functions MULTS and W, to the new formula:
(IMPLIES (AND (NUMBERP M)
(NOT (EQUAL M 0))
(LESSP (SUB1 M) M)
(NOT (LESSP M M))
(NOT (LESSP (TIMES M P) A)))
(NOT (LESSP (W A (MULTS (SUB1 M) P))
(W A (MULTS (SUB1 M) P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.2.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (SUB1 N) M)
(NOT (LESSP N M))
(LESSP (TIMES N P) A))
(NOT (LESSP (ADD1 (W A (MULTS (SUB1 N) P)))
(W A (MULTS M P))))),
which again simplifies, using linear arithmetic, to two new goals:
Case 1.2.2.
(IMPLIES (AND (NOT (NUMBERP M))
(NOT (EQUAL N 0))
(NUMBERP N)
(LESSP (SUB1 N) M)
(NOT (LESSP N M))
(LESSP (TIMES N P) A))
(NOT (LESSP (ADD1 (W A (MULTS (SUB1 N) P)))
(W A (MULTS M P))))),
which again simplifies, expanding the function LESSP, to:
T.
Case 1.2.1.
(IMPLIES (AND (NUMBERP M)
(NOT (EQUAL M 0))
(LESSP (SUB1 M) M)
(NOT (LESSP M M))
(LESSP (TIMES M P) A))
(NOT (LESSP (ADD1 (W A (MULTS (SUB1 M) P)))
(W A (MULTS M P))))),
which again simplifies, rewriting with CDR-CONS, CAR-CONS, and SUB1-ADD1,
and unfolding the definitions of MULTS, W, and LESSP, to:
(IMPLIES (AND (NUMBERP M)
(NOT (EQUAL M 0))
(LESSP (SUB1 M) M)
(NOT (LESSP M M))
(LESSP (TIMES M P) A))
(NOT (LESSP (W A (MULTS (SUB1 M) P))
(W A (MULTS (SUB1 M) P))))),
which again simplifies, using linear arithmetic, to:
T.
Case 1.1.
(IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(NOT (LESSP (W A (MULTS (SUB1 N) P))
(W A (MULTS M P))))
(NOT (LESSP N M))
(LESSP (TIMES N P) A))
(NOT (LESSP (ADD1 (W A (MULTS (SUB1 N) P)))
(W A (MULTS M P))))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
MONOTONE-W
(PROVE-LEMMA LEQ-N-W NIL
(IMPLIES (LESSP (TIMES N P) A)
(LEQ N (W 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 (W 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 W, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL N 0))
(NUMBERP N)
(IMPLIES (LESSP (TIMES (SUB1 N) P) A)
(IF (LESSP (W A (MULTS (SUB1 N) P))
(SUB1 N))
F T))
(LESSP (TIMES N P) A))
(NOT (LESSP (W 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, W, 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 (W 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 (W 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 (W A (MULTS X P)) X))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
LEQ-N-W
(PROVE-LEMMA LEQ-QUOTIENT-W NIL
(IMPLIES (AND (NOT (ZEROP P))
(NOT (DIVIDES P A))
(LEQ (QUOTIENT A P) N))
(LEQ (QUOTIENT A P)
(W A (MULTS N P))))
((USE (MONOTONE-W (M (QUOTIENT A P)))
(LEQ-N-W (N (QUOTIENT A P))))))
This formula can be simplified, using the abbreviations ZEROP, NOT, IMPLIES,
AND, and DIVIDES, to the new formula:
(IMPLIES (AND (IMPLIES (IF (LESSP N (QUOTIENT A P)) F T)
(IF (LESSP (W A (MULTS N P))
(W A (MULTS (QUOTIENT A P) P)))
F T))
(IMPLIES (LESSP (TIMES (QUOTIENT A P) P) A)
(IF (LESSP (W A (MULTS (QUOTIENT A P) P))
(QUOTIENT A P))
F T))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP N (QUOTIENT A P))))
(NOT (LESSP (W A (MULTS N P))
(QUOTIENT A P)))),
which simplifies, rewriting with COMMUTATIVITY-OF-TIMES, and expanding IMPLIES,
to the following two new goals:
Case 2. (IMPLIES (AND (NOT (LESSP (W A (MULTS N P))
(W A (MULTS (QUOTIENT A P) P))))
(NOT (LESSP (TIMES P (QUOTIENT A P)) A))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP N (QUOTIENT A P))))
(NOT (LESSP (W A (MULTS N P))
(QUOTIENT A P)))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace A by
(PLUS Z (TIMES P X)) to eliminate (QUOTIENT A P) and (REMAINDER A P). 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. This generates two new formulas:
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP A))
(NOT (LESSP (W A (MULTS N P))
(W A (MULTS (QUOTIENT A P) P))))
(NOT (LESSP (TIMES P (QUOTIENT A P)) A))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP N (QUOTIENT A P))))
(NOT (LESSP (W A (MULTS N P))
(QUOTIENT A P)))),
which further simplifies, using linear arithmetic, rewriting with
LESSP-TIMES-2, DISTRIBUTIVITY-OF-DIVIDES, EQUAL-TIMES-0, and
COMMUTATIVITY-OF-TIMES, and expanding the functions QUOTIENT, EQUAL,
REMAINDER, LESSP, and DIVIDES, to:
T.
Case 2.1.
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(EQUAL (LESSP Z P) (NOT (ZEROP P)))
(NOT (LESSP (W (PLUS Z (TIMES P X)) (MULTS N P))
(W (PLUS Z (TIMES P X)) (MULTS X P))))
(NOT (LESSP (TIMES P X)
(PLUS Z (TIMES P X))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL Z 0))
(NOT (LESSP N X)))
(NOT (LESSP (W (PLUS Z (TIMES P X)) (MULTS N P))
X))).
However this further simplifies, using linear arithmetic, to:
T.
Case 1. (IMPLIES (AND (NOT (LESSP (W A (MULTS N P))
(W A (MULTS (QUOTIENT A P) P))))
(NOT (LESSP (W A (MULTS (QUOTIENT A P) P))
(QUOTIENT A P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL (REMAINDER A P) 0))
(NOT (LESSP N (QUOTIENT A P))))
(NOT (LESSP (W A (MULTS N P))
(QUOTIENT A P)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.2 0.0 ]
LEQ-QUOTIENT-W
(DEFN LQQ-INDUCT
(A B C D)
(IF (ZEROP B)
T
(IF (ZEROP D)
T
(IF (LESSP A D)
T
(IF (LESSP C B)
T
(LQQ-INDUCT (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, LQQ-INDUCT is accepted under the definitional principle. The
definition of LQQ-INDUCT 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 (LQQ-INDUCT A B C D))
is a theorem.
[ 0.0 0.0 0.0 ]
LQQ-INDUCT
(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 (LQQ-INDUCT 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.1 ]
LEQ-TIMES-QUOT
(PROVE-LEMMA LEQ-J-A NIL
(IMPLIES (LEQ J A)
(LEQ (TIMES J Q) (TIMES A Q))))
This formula can be simplified, using the abbreviations
LESSP-TIMES-CANCELLATION and IMPLIES, to the new formula:
T,
which simplifies, obviously, to:
T.
Q.E.D.
[ 0.0 0.0 0.0 ]
LEQ-J-A
(PROVE-LEMMA LEQ-QUOT-TIMES NIL
(IMPLIES (LEQ J (QUOTIENT P 2))
(LEQ (QUOTIENT (TIMES J Q) P)
(QUOTIENT Q 2)))
((USE (LEQ-TIMES-QUOT (A (TIMES J Q))
(B 2)
(C Q)
(D P))
(LEQ-J-A (A (QUOTIENT P 2))))))
This formula can be simplified, using the abbreviations IMPLIES, AND, and
ASSOCIATIVITY-OF-TIMES, to the new goal:
(IMPLIES (AND (IMPLIES (AND (NOT (ZEROP 2))
(IF (LESSP (TIMES Q P) (TIMES J Q 2))
F T))
(IF (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P))
F T))
(IMPLIES (IF (LESSP (QUOTIENT P 2) J) F T)
(IF (LESSP (TIMES (QUOTIENT P 2) Q)
(TIMES J Q))
F T))
(NOT (LESSP (QUOTIENT P 2) J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))),
which simplifies, appealing to the lemmas COMMUTATIVITY-OF-TIMES, TIMES-2, and
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and expanding the functions ZEROP, NOT, AND,
and IMPLIES, to:
(IMPLIES (AND (LESSP (TIMES P Q)
(PLUS (TIMES J Q) (TIMES J Q)))
(NOT (LESSP (TIMES Q (QUOTIENT P 2))
(TIMES J Q)))
(NOT (LESSP (QUOTIENT P 2) J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) 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 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 goals:
Case 4. (IMPLIES (AND (NOT (NUMBERP P))
(LESSP (TIMES P Q)
(PLUS (TIMES J Q) (TIMES J Q)))
(NOT (LESSP (TIMES Q (QUOTIENT P 2))
(TIMES J Q)))
(NOT (LESSP (QUOTIENT P 2) J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))),
which further simplifies, rewriting with the lemmas PLUS-EQUAL-0,
EQUAL-TIMES-0, COMMUTATIVITY-OF-TIMES, and LESSP-TIMES-CANCELLATION, and
opening up the functions LESSP, NUMBERP, EQUAL, and QUOTIENT, to:
T.
Case 3. (IMPLIES (AND (EQUAL 2 0)
(LESSP (TIMES P Q)
(PLUS (TIMES J Q) (TIMES J Q)))
(NOT (LESSP (TIMES Q (QUOTIENT P 2))
(TIMES J Q)))
(NOT (LESSP (QUOTIENT P 2) J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P)))),
which further simplifies, using linear arithmetic, to:
T.
Case 2. (IMPLIES (AND (NOT (NUMBERP 2))
(LESSP (TIMES P Q)
(PLUS (TIMES J Q) (TIMES J Q)))
(NOT (LESSP (TIMES Q (QUOTIENT P 2))
(TIMES J Q)))
(NOT (LESSP (QUOTIENT P 2) J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) 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 J Q) (TIMES J Q)))
(NOT (LESSP (TIMES Q X) (TIMES J Q)))
(NOT (LESSP X J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q)
(PLUS Z (TIMES 2 X)))))).
However this further simplifies, applying the lemmas TIMES-2,
COMMUTATIVITY-OF-PLUS, COMMUTATIVITY2-OF-PLUS,
DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and COMMUTATIVITY-OF-TIMES, and expanding
the functions ZEROP, NOT, and EQUAL, to:
(IMPLIES (AND (NUMBERP X)
(NUMBERP Z)
(LESSP Z 2)
(LESSP (PLUS (TIMES Q X)
(TIMES Q X)
(TIMES Q Z))
(PLUS (TIMES J Q) (TIMES J Q)))
(NOT (LESSP (TIMES Q X) (TIMES J Q)))
(NOT (LESSP X J)))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q)
(PLUS X X Z))))).
However this again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.1 0.0 ]
LEQ-QUOT-TIMES
(PROVE-LEMMA EQUAL-QUOT-W
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P Q))
(NOT (ZEROP J))
(LEQ J (QUOTIENT P 2)))
(EQUAL (W (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P)))
((USE (LEQ-QUOTIENT-W (A (TIMES J Q))
(N (QUOTIENT Q 2)))
(LEQ-W-QUOTIENT (A (TIMES J Q))
(N (QUOTIENT Q 2)))
(LEQ-QUOT-TIMES))))
This formula can be simplified, using the abbreviations ZEROP, NOT, PRIME,
IMPLIES, AND, and DIVIDES, to:
(IMPLIES (AND (IMPLIES (AND (NOT (ZEROP P))
(NOT (EQUAL (REMAINDER (TIMES J Q) P) 0))
(IF (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P))
F T))
(IF (LESSP (W (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)
(W (TIMES J Q)
(MULTS (QUOTIENT Q 2) P)))
F T))
(IMPLIES (IF (LESSP (QUOTIENT P 2) J) F T)
(IF (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES J Q) P))
F T))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (EQUAL J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2) J)))
(EQUAL (W (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P))),
which simplifies, rewriting with the lemma PRIME-KEY-REWRITE, and opening up
the definitions of ZEROP, NOT, PRIME, AND, and IMPLIES, to two new goals:
Case 2. (IMPLIES (AND (EQUAL (REMAINDER J P) 0)
(NOT (LESSP (QUOTIENT (TIMES J Q) P)
(W (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES 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 J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2) J)))
(EQUAL (W (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P))).
Applying the lemma REMAINDER-QUOTIENT-ELIM, replace J by
(PLUS X (TIMES P Z)) to eliminate (REMAINDER J P) and (QUOTIENT J 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:
(IMPLIES (AND (NUMBERP X)
(EQUAL (LESSP X P) (NOT (ZEROP P)))
(NUMBERP Z)
(EQUAL X 0)
(NOT (LESSP (QUOTIENT (TIMES (PLUS X (TIMES P Z)) Q)
P)
(W (TIMES (PLUS X (TIMES P Z)) Q)
(MULTS (QUOTIENT Q 2) P))))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES (PLUS X (TIMES P Z)) Q)
P)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (EQUAL (PLUS X (TIMES P Z)) 0))
(NOT (LESSP (QUOTIENT P 2)
(PLUS X (TIMES P Z)))))
(EQUAL (W (TIMES (PLUS X (TIMES P Z)) Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES (PLUS X (TIMES P Z)) Q)
P))),
which further simplifies, rewriting with the lemmas COMMUTATIVITY-OF-TIMES,
ASSOCIATIVITY-OF-TIMES, QUOTIENT-TIMES, and EQUAL-TIMES-0, and expanding
NUMBERP, EQUAL, LESSP, ZEROP, NOT, and PLUS, to the goal:
(IMPLIES (AND (NUMBERP Z)
(NOT (LESSP (TIMES Q Z)
(W (TIMES P Q Z)
(MULTS (QUOTIENT Q 2) P))))
(NOT (LESSP (QUOTIENT Q 2) (TIMES Q Z)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (EQUAL Z 0))
(NOT (LESSP (QUOTIENT P 2) (TIMES P Z))))
(EQUAL (W (TIMES P Q Z)
(MULTS (QUOTIENT Q 2) P))
(TIMES Q Z))).
Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace Q by
(PLUS V (TIMES 2 X)) to eliminate (QUOTIENT Q 2) and (REMAINDER Q 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. This generates four new formulas:
Case 2.4.
(IMPLIES (AND (NOT (NUMBERP Q))
(NUMBERP Z)
(NOT (LESSP (TIMES Q Z)
(W (TIMES P Q Z)
(MULTS (QUOTIENT Q 2) P))))
(NOT (LESSP (QUOTIENT Q 2) (TIMES Q Z)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (EQUAL Z 0))
(NOT (LESSP (QUOTIENT P 2) (TIMES P Z))))
(EQUAL (W (TIMES P Q Z)
(MULTS (QUOTIENT Q 2) P))
(TIMES Q Z))),
which further simplifies, rewriting with EQUAL-TIMES-0, and opening up
LESSP, NUMBERP, EQUAL, QUOTIENT, MULTS, LISTP, W, and REMAINDER, to:
T.
Case 2.3.
(IMPLIES (AND (EQUAL 2 0)
(NUMBERP Z)
(NOT (LESSP (TIMES Q Z)
(W (TIMES P Q Z)
(MULTS (QUOTIENT Q 2) P))))
(NOT (LESSP (QUOTIENT Q 2) (TIMES Q Z)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (EQUAL Z 0))
(NOT (LESSP (QUOTIENT P 2) (TIMES P Z))))
(EQUAL (W (TIMES P Q Z)
(MULTS (QUOTIENT Q 2) P))
(TIMES Q Z))).
This further simplifies, using linear arithmetic, to:
T.
Case 2.2.
(IMPLIES (AND (NOT (NUMBERP 2))
(NUMBERP Z)
(NOT (LESSP (TIMES Q Z)
(W (TIMES P Q Z)
(MULTS (QUOTIENT Q 2) P))))
(NOT (LESSP (QUOTIENT Q 2) (TIMES Q Z)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER Q P) 0))
(NOT (EQUAL Z 0))
(NOT (LESSP (QUOTIENT P 2) (TIMES P Z))))
(EQUAL (W (TIMES P Q Z)
(MULTS (QUOTIENT Q 2) P))
(TIMES Q Z))),
which further simplifies, trivially, to:
T.
Case 2.1.
(IMPLIES (AND (NUMBERP X)
(NUMBERP V)
(EQUAL (LESSP V 2) (NOT (ZEROP 2)))
(NOT (EQUAL 2 0))
(NUMBERP Z)
(NOT (LESSP (TIMES (PLUS V (TIMES 2 X)) Z)
(W (TIMES P (PLUS V (TIMES 2 X)) Z)
(MULTS X P))))
(NOT (LESSP X
(TIMES (PLUS V (TIMES 2 X)) Z)))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER (PLUS V (TIMES 2 X)) P)
0))
(NOT (EQUAL Z 0))
(NOT (LESSP (QUOTIENT P 2) (TIMES P Z))))
(EQUAL (W (TIMES P (PLUS V (TIMES 2 X)) Z)
(MULTS X P))
(TIMES (PLUS V (TIMES 2 X)) Z))).
However this further simplifies, applying TIMES-2, COMMUTATIVITY-OF-TIMES,
and DISTRIBUTIVITY-OF-TIMES-OVER-PLUS, and unfolding the definitions of
ZEROP, NOT, and EQUAL, to the new formula:
(IMPLIES (AND (NUMBERP X)
(NUMBERP V)
(LESSP V 2)
(NUMBERP Z)
(NOT (LESSP (PLUS (TIMES V Z)
(TIMES X Z)
(TIMES X Z))
(W (PLUS (TIMES P V Z)
(TIMES P X Z)
(TIMES P X Z))
(MULTS X P))))
(NOT (LESSP X
(PLUS (TIMES V Z)
(TIMES X Z)
(TIMES X Z))))
(NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL (REMAINDER (PLUS V X X) P) 0))
(NOT (EQUAL Z 0))
(NOT (LESSP (QUOTIENT P 2) (TIMES P Z))))
(EQUAL (W (PLUS (TIMES P V Z)
(TIMES P X Z)
(TIMES P X Z))
(MULTS X P))
(PLUS (TIMES V Z)
(TIMES X Z)
(TIMES X Z)))),
which finally simplifies, using linear arithmetic and rewriting with
LESSP-TIMES-2, to:
T.
Case 1. (IMPLIES (AND (NOT (LESSP (W (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P)))
(NOT (LESSP (QUOTIENT (TIMES J Q) P)
(W (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))))
(NOT (LESSP (QUOTIENT Q 2)
(QUOTIENT (TIMES 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 J 0))
(NUMBERP J)
(NOT (LESSP (QUOTIENT P 2) J)))
(EQUAL (W (TIMES J Q)
(MULTS (QUOTIENT Q 2) P))
(QUOTIENT (TIMES J Q) P))).
But this again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 2.5 0.0 ]
EQUAL-QUOT-W
(PROVE-LEMMA EQUAL-WINS-SUM-QUOTIENTS
(REWRITE)
(IMPLIES (AND (PRIME P)
(NOT (DIVIDES P Q))
(LEQ J (QUOTIENT P 2)))
(EQUAL (SUM (QUOTIENTS J Q P))
(WINS (MULTS J Q)
(MULTS (QUOTIENT Q 2) 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 (LESSP (QUOTIENT P 2) J)))
(EQUAL (SUM (QUOTIENTS J Q P))
(WINS (MULTS J Q)
(MULTS (QUOTIENT Q 2) P)))).
This simplifies, unfolding ZEROP, EQUAL, LESSP, QUOTIENTS, SUM, MULTS, LISTP,
and WINS, to:
T.
Case 1. (IMPLIES (AND (NOT (EQUAL J 0))
(NUMBERP J)
(IMPLIES (AND (PRIME P)
(NOT (EQUAL (REMAINDER Q P) 0))
(IF (LESSP (QUOTIENT P 2) (SUB1 J))
F T))
(EQUAL (SUM (QUOTIENTS (SUB1 J) Q P))
(WINS (MULTS (SUB1 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)))
(EQUAL (SUM (QUOTIENTS J Q P))
(WINS (MULTS J Q)
(MULTS (QUOTIENT Q 2) P)))).
This simplifies, using linear arithmetic, rewriting with the lemmas
COMMUTATIVITY-OF-TIMES, CDR-CONS, CAR-CONS, EQUAL-QUOT-W, and
CORRECTNESS-OF-CANCEL, and expanding the definitions of PRIME, NOT, AND,
IMPLIES, QUOTIENTS, SUM, MULTS, DIVIDES, WINS, 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 (LESSP (QUOTIENT P 2) J)))
(EQUAL (SUM (QUOTIENTS (SUB1 J) Q P))
(WINS (MULTS (SUB1 J) Q)
(MULTS (QUOTIENT Q 2) P)))),
which again simplifies, using linear arithmetic, to:
T.
Q.E.D.
[ 0.0 0.6 0.0 ]
EQUAL-WINS-SUM-QUOTIENTS
(PROVE-LEMMA LAW-OF-QUADRATIC-RECIPROCITY NIL
(IMPLIES (AND (PRIME P)
(NOT (EQUAL P 2))
(PRIME Q)
(NOT (EQUAL Q 2))
(NOT (EQUAL P Q)))
(EQUAL (EQUAL (RESIDUE Q P) (RESIDUE P Q))
(EVEN (TIMES (QUOTIENT P 2)
(QUOTIENT Q 2)))))
((DISABLE RESIDUE INTERSECT)))
This formula can be simplified, using the abbreviations NOT, PRIME, AND,
IMPLIES, and EVEN, to:
(IMPLIES (AND (NOT (EQUAL P 0))
(NUMBERP P)
(NOT (EQUAL P 1))
(PRIME1 P (SUB1 P))
(NOT (EQUAL P 2))
(NOT (EQUAL Q 0))
(NUMBERP Q)
(NOT (EQUAL Q 1))
(PRIME1 Q (SUB1 Q))
(NOT (EQUAL Q 2))
(NOT (EQUAL P Q)))
(EQUAL (EQUAL (RESIDUE Q P) (RESIDUE P Q))
(EQUAL 0
(REMAINDER (TIMES (QUOTIENT P 2) (QUOTIENT Q 2))
2)))),
which simplifies, using linear arithmetic, rewriting with LITTLE-STEP,
EQUAL-WINS-SUM-QUOTIENTS, ALL-NUMBERP-MULTS, EMPTY-INTERSECT-MULTS,
LESSP-QUOTIENT1, LENGTH-MULTS, PLUS-WINS-WINS, EVEN-TIMES,
EQUAL-RESIDUE-EVEN-PLUS, and PRIME-KEY-REWRITE, and expanding PRIME, DIVIDES,
EQUAL, NUMBERP, and EVEN, to:
T.
Q.E.D.
[ 0.0 3.7 0.0 ]
LAW-OF-QUADRATIC-RECIPROCITY