(BOOT-STRAP NQTHM) [ 0.0 0.1 0.0 ] GROUND-ZERO (DEFN RATE-PROXIMITY (W R) (AND (NOT (LESSP (TIMES 18 W) (TIMES 17 R))) (NOT (LESSP (TIMES 19 R) (TIMES 18 W))))) From the definition we can conclude that: (OR (FALSEP (RATE-PROXIMITY W R)) (TRUEP (RATE-PROXIMITY W R))) is a theorem. [ 0.0 0.0 0.0 ] RATE-PROXIMITY (PROVE-LEMMA PLUS-ADD1 (REWRITE) (EQUAL (PLUS X (ADD1 Y)) (ADD1 (PLUS X Y)))) This conjecture simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] PLUS-ADD1 (PROVE-LEMMA PLUS-COMMUTES1 (REWRITE) (EQUAL (PLUS X Y) (PLUS Y X))) WARNING: the newly proposed lemma, PLUS-COMMUTES1, could be applied whenever the previously added lemma PLUS-ADD1 could. This formula simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] PLUS-COMMUTES1 (PROVE-LEMMA PLUS-COMMUTES2 (REWRITE) (EQUAL (PLUS X Y Z) (PLUS Y X Z))) WARNING: the previously added lemma, PLUS-COMMUTES1, could be applied whenever the newly proposed PLUS-COMMUTES2 could! This simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] PLUS-COMMUTES2 (PROVE-LEMMA PLUS-ASSOCIATES (REWRITE) (EQUAL (PLUS (PLUS X Y) Z) (PLUS X Y Z))) WARNING: the previously added lemma, PLUS-COMMUTES1, could be applied whenever the newly proposed PLUS-ASSOCIATES could! This simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] PLUS-ASSOCIATES (PROVE-LEMMA TIMES-0 (REWRITE) (EQUAL (TIMES X 0) 0)) Call the conjecture *1. We will try to prove it by induction. There is only one suggested induction. We will induct according to the following scheme: (AND (IMPLIES (ZEROP X) (p X)) (IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X))) (p X))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be used to establish that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme generates the following two new formulas: Case 2. (IMPLIES (ZEROP X) (EQUAL (TIMES X 0) 0)). This simplifies, expanding the definitions of ZEROP, TIMES, and EQUAL, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP X)) (EQUAL (TIMES (SUB1 X) 0) 0)) (EQUAL (TIMES X 0) 0)). This simplifies, opening up the functions ZEROP, TIMES, PLUS, and EQUAL, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] TIMES-0 (PROVE-LEMMA TIMES-NON-NUMBERP (REWRITE) (IMPLIES (NOT (NUMBERP Z)) (EQUAL (TIMES X Z) 0))) Call the conjecture *1. Perhaps we can prove it by induction. There is only one plausible induction. We will induct according to the following scheme: (AND (IMPLIES (ZEROP X) (p X Z)) (IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) Z)) (p X Z))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be used to prove that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to two new goals: Case 2. (IMPLIES (AND (ZEROP X) (NOT (NUMBERP Z))) (EQUAL (TIMES X Z) 0)), which simplifies, opening up the definitions of ZEROP, EQUAL, and TIMES, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP X)) (EQUAL (TIMES (SUB1 X) Z) 0) (NOT (NUMBERP Z))) (EQUAL (TIMES X Z) 0)), which simplifies, applying PLUS-COMMUTES1, and unfolding ZEROP, TIMES, EQUAL, and PLUS, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] TIMES-NON-NUMBERP (PROVE-LEMMA TIMES-ADD1 (REWRITE) (EQUAL (TIMES X (ADD1 Y)) (PLUS X (TIMES X Y)))) Give the conjecture the name *1. We will try to prove it by induction. There are three plausible inductions. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (ZEROP X) (p X Y)) (IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) Y)) (p X Y))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform us that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme generates two new goals: Case 2. (IMPLIES (ZEROP X) (EQUAL (TIMES X (ADD1 Y)) (PLUS X (TIMES X Y)))), which simplifies, applying PLUS-COMMUTES1, and unfolding the functions ZEROP, EQUAL, TIMES, and PLUS, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP X)) (EQUAL (TIMES (SUB1 X) (ADD1 Y)) (PLUS (SUB1 X) (TIMES (SUB1 X) Y)))) (EQUAL (TIMES X (ADD1 Y)) (PLUS X (TIMES X Y)))). This simplifies, rewriting with the lemma SUB1-ADD1, and expanding the functions ZEROP, TIMES, and PLUS, to the following two new formulas: Case 1.2. (IMPLIES (AND (NOT (EQUAL X 0)) (NUMBERP X) (EQUAL (TIMES (SUB1 X) (ADD1 Y)) (PLUS (SUB1 X) (TIMES (SUB1 X) Y))) (NOT (NUMBERP Y))) (EQUAL (ADD1 (PLUS 0 (TIMES (SUB1 X) (ADD1 Y)))) (PLUS X Y (TIMES (SUB1 X) Y)))). But this again simplifies, unfolding the functions EQUAL and PLUS, to: T. Case 1.1. (IMPLIES (AND (NOT (EQUAL X 0)) (NUMBERP X) (EQUAL (TIMES (SUB1 X) (ADD1 Y)) (PLUS (SUB1 X) (TIMES (SUB1 X) Y))) (NUMBERP Y)) (EQUAL (ADD1 (PLUS Y (TIMES (SUB1 X) (ADD1 Y)))) (PLUS X Y (TIMES (SUB1 X) Y)))), which again simplifies, using linear arithmetic, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] TIMES-ADD1 (PROVE-LEMMA TIMES-DISTRIBUTES1 (REWRITE) (EQUAL (TIMES X (PLUS Y Z)) (PLUS (TIMES X Y) (TIMES X Z)))) Call the conjecture *1. We will try to prove it by induction. There are four plausible inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP X) (p X Y Z)) (IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) Y Z)) (p X Y Z))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform us that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme generates two new goals: Case 2. (IMPLIES (ZEROP X) (EQUAL (TIMES X (PLUS Y Z)) (PLUS (TIMES X Y) (TIMES X Z)))), which simplifies, opening up the functions ZEROP, EQUAL, TIMES, and PLUS, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP X)) (EQUAL (TIMES (SUB1 X) (PLUS Y Z)) (PLUS (TIMES (SUB1 X) Y) (TIMES (SUB1 X) Z)))) (EQUAL (TIMES X (PLUS Y Z)) (PLUS (TIMES X Y) (TIMES X Z)))), which simplifies, applying PLUS-ASSOCIATES and PLUS-COMMUTES2, and unfolding the functions ZEROP and TIMES, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] TIMES-DISTRIBUTES1 (PROVE-LEMMA TIMES-COMMUTES1 (REWRITE) (EQUAL (TIMES X Y) (TIMES Y X))) WARNING: the newly proposed lemma, TIMES-COMMUTES1, could be applied whenever the previously added lemma TIMES-DISTRIBUTES1 could. WARNING: the newly proposed lemma, TIMES-COMMUTES1, could be applied whenever the previously added lemma TIMES-ADD1 could. WARNING: the newly proposed lemma, TIMES-COMMUTES1, could be applied whenever the previously added lemma TIMES-NON-NUMBERP could. WARNING: the newly proposed lemma, TIMES-COMMUTES1, could be applied whenever the previously added lemma TIMES-0 could. Give the conjecture the name *1. We will appeal to induction. Two inductions are suggested by terms in the conjecture, both of which are flawed. We limit our consideration to the two suggested by the largest number of nonprimitive recursive functions in the conjecture. Since both of these are equally likely, we will choose arbitrarily. We will induct according to the following scheme: (AND (IMPLIES (ZEROP X) (p X Y)) (IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) Y)) (p X Y))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform us that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme produces the following two new conjectures: Case 2. (IMPLIES (ZEROP X) (EQUAL (TIMES X Y) (TIMES Y X))). This simplifies, applying TIMES-0 and TIMES-NON-NUMBERP, and opening up the functions ZEROP, EQUAL, and TIMES, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP X)) (EQUAL (TIMES (SUB1 X) Y) (TIMES Y (SUB1 X)))) (EQUAL (TIMES X Y) (TIMES Y X))), which simplifies, unfolding the functions ZEROP and TIMES, to: (IMPLIES (AND (NOT (EQUAL X 0)) (NUMBERP X) (EQUAL (TIMES (SUB1 X) Y) (TIMES Y (SUB1 X)))) (EQUAL (PLUS Y (TIMES Y (SUB1 X))) (TIMES Y X))). Appealing to the lemma SUB1-ELIM, we now replace X by (ADD1 Z) to eliminate (SUB1 X). We employ the type restriction lemma noted when SUB1 was introduced to constrain the new variable. We must thus prove: (IMPLIES (AND (NUMBERP Z) (NOT (EQUAL (ADD1 Z) 0)) (EQUAL (TIMES Z Y) (TIMES Y Z))) (EQUAL (PLUS Y (TIMES Y Z)) (TIMES Y (ADD1 Z)))). However this further simplifies, applying the lemma TIMES-ADD1, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] TIMES-COMMUTES1 (PROVE-LEMMA TIMES-COMMUTES2 (REWRITE) (EQUAL (TIMES X Y Z) (TIMES Y X Z))) WARNING: the previously added lemma, TIMES-COMMUTES1, could be applied whenever the newly proposed TIMES-COMMUTES2 could! Call the conjecture *1. Perhaps we can prove it by induction. Four inductions are suggested by terms in the conjecture. They merge into two likely candidate inductions, both of which are unflawed. Since both of these are equally likely, we will choose arbitrarily. We will induct according to the following scheme: (AND (IMPLIES (ZEROP Y) (p X Y Z)) (IMPLIES (AND (NOT (ZEROP Y)) (p X (SUB1 Y) Z)) (p X Y Z))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be used to prove that the measure (COUNT Y) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to two new goals: Case 2. (IMPLIES (ZEROP Y) (EQUAL (TIMES X Y Z) (TIMES Y X Z))), which simplifies, applying the lemma TIMES-COMMUTES1, and opening up the definitions of ZEROP, EQUAL, and TIMES, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP Y)) (EQUAL (TIMES X (SUB1 Y) Z) (TIMES (SUB1 Y) X Z))) (EQUAL (TIMES X Y Z) (TIMES Y X Z))), which simplifies, rewriting with TIMES-DISTRIBUTES1, and opening up the functions ZEROP and TIMES, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] TIMES-COMMUTES2 (PROVE-LEMMA TIMES-ASSOCIATES (REWRITE) (EQUAL (TIMES (TIMES X Y) Z) (TIMES X Y Z))) WARNING: the previously added lemma, TIMES-COMMUTES1, could be applied whenever the newly proposed TIMES-ASSOCIATES could! This simplifies, rewriting with TIMES-COMMUTES1 and TIMES-COMMUTES2, to: T. Q.E.D. [ 0.0 0.0 0.0 ] TIMES-ASSOCIATES (PROVE-LEMMA TIMES-DISTRIBUTES2 (REWRITE) (EQUAL (TIMES (PLUS X Y) Z) (PLUS (TIMES X Z) (TIMES Y Z)))) WARNING: the previously added lemma, TIMES-COMMUTES1, could be applied whenever the newly proposed TIMES-DISTRIBUTES2 could! This simplifies, appealing to the lemmas TIMES-COMMUTES1 and TIMES-DISTRIBUTES1, to: T. Q.E.D. [ 0.0 0.0 0.0 ] TIMES-DISTRIBUTES2 (PROVE-LEMMA DIFFERENCE-IS-0 (REWRITE) (IMPLIES (NOT (LESSP Y X)) (EQUAL (DIFFERENCE X Y) 0))) Name the conjecture *1. Let us appeal to the induction principle. The recursive terms in the conjecture suggest four inductions. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (OR (EQUAL X 0) (NOT (NUMBERP X))) (p X Y)) (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X)))) (OR (EQUAL Y 0) (NOT (NUMBERP Y)))) (p X Y)) (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X)))) (NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y)))) (p (SUB1 X) (SUB1 Y))) (p X Y))). Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions of OR and NOT can be used to show that the measure (COUNT Y) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for X. The above induction scheme leads to the following four new goals: Case 4. (IMPLIES (AND (OR (EQUAL X 0) (NOT (NUMBERP X))) (NOT (LESSP Y X))) (EQUAL (DIFFERENCE X Y) 0)). This simplifies, expanding the definitions of NOT, OR, EQUAL, LESSP, and DIFFERENCE, to: T. Case 3. (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X)))) (OR (EQUAL Y 0) (NOT (NUMBERP Y))) (NOT (LESSP Y X))) (EQUAL (DIFFERENCE X Y) 0)). This simplifies, unfolding NOT, OR, EQUAL, and LESSP, to: T. Case 2. (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X)))) (NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y)))) (LESSP (SUB1 Y) (SUB1 X)) (NOT (LESSP Y X))) (EQUAL (DIFFERENCE X Y) 0)). This simplifies, using linear arithmetic, to: (IMPLIES (AND (LESSP X 1) (NOT (OR (EQUAL X 0) (NOT (NUMBERP X)))) (NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y)))) (LESSP (SUB1 Y) (SUB1 X)) (NOT (LESSP Y X))) (EQUAL (DIFFERENCE X Y) 0)), which again simplifies, opening up the definitions of SUB1, NUMBERP, EQUAL, LESSP, NOT, and OR, to: T. Case 1. (IMPLIES (AND (NOT (OR (EQUAL X 0) (NOT (NUMBERP X)))) (NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y)))) (EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y)) 0) (NOT (LESSP Y X))) (EQUAL (DIFFERENCE X Y) 0)), which simplifies, using linear arithmetic, to three new conjectures: Case 1.3. (IMPLIES (AND (LESSP X Y) (NOT (OR (EQUAL X 0) (NOT (NUMBERP X)))) (NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y)))) (EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y)) 0) (NOT (LESSP Y X))) (EQUAL (DIFFERENCE X Y) 0)), which again simplifies, using linear arithmetic, to two new conjectures: Case 1.3.2. (IMPLIES (AND (LESSP (SUB1 X) (SUB1 Y)) (LESSP X Y) (NOT (OR (EQUAL X 0) (NOT (NUMBERP X)))) (NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y)))) (EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y)) 0) (NOT (LESSP Y X))) (EQUAL (DIFFERENCE X Y) 0)), which again simplifies, unfolding the functions LESSP, NOT, OR, DIFFERENCE, and EQUAL, to: T. Case 1.3.1. (IMPLIES (AND (LESSP X 1) (LESSP X Y) (NOT (OR (EQUAL X 0) (NOT (NUMBERP X)))) (NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y)))) (EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y)) 0) (NOT (LESSP Y X))) (EQUAL (DIFFERENCE X Y) 0)), which again simplifies, unfolding SUB1, NUMBERP, EQUAL, LESSP, NOT, and OR, to: T. Case 1.2. (IMPLIES (AND (LESSP (SUB1 X) (SUB1 Y)) (NOT (OR (EQUAL X 0) (NOT (NUMBERP X)))) (NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y)))) (EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y)) 0) (NOT (LESSP Y X))) (EQUAL (DIFFERENCE X Y) 0)), which again simplifies, expanding the definitions of NOT, OR, LESSP, DIFFERENCE, and EQUAL, to: T. Case 1.1. (IMPLIES (AND (LESSP X 1) (NOT (OR (EQUAL X 0) (NOT (NUMBERP X)))) (NOT (OR (EQUAL Y 0) (NOT (NUMBERP Y)))) (EQUAL (DIFFERENCE (SUB1 X) (SUB1 Y)) 0) (NOT (LESSP Y X))) (EQUAL (DIFFERENCE X Y) 0)), which again simplifies, opening up the definitions of SUB1, NUMBERP, EQUAL, LESSP, NOT, and OR, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.1 0.0 ] DIFFERENCE-IS-0 (PROVE-LEMMA DIFFERENCE-PLUS-CANCELLATION1 (REWRITE) (EQUAL (DIFFERENCE (PLUS I X) I) (FIX X))) This conjecture simplifies, opening up the function FIX, to the following two new goals: Case 2. (IMPLIES (NOT (NUMBERP X)) (EQUAL (DIFFERENCE (PLUS I X) I) 0)). But this again simplifies, using linear arithmetic, applying DIFFERENCE-IS-0, and expanding EQUAL, to: T. Case 1. (IMPLIES (NUMBERP X) (EQUAL (DIFFERENCE (PLUS I X) I) X)). However this again simplifies, using linear arithmetic, to: (IMPLIES (AND (LESSP (PLUS I X) I) (NUMBERP X)) (EQUAL (DIFFERENCE (PLUS I X) I) X)). This again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] DIFFERENCE-PLUS-CANCELLATION1 (PROVE-LEMMA DIFFERENCE-PLUS-CANCELLATION2 (REWRITE) (EQUAL (DIFFERENCE (PLUS I X) (PLUS I Y)) (DIFFERENCE X Y))) This simplifies, using linear arithmetic, to the following two new conjectures: Case 2. (IMPLIES (LESSP (PLUS I X) (PLUS I Y)) (EQUAL (DIFFERENCE (PLUS I X) (PLUS I Y)) (DIFFERENCE X Y))). But this again simplifies, using linear arithmetic, applying DIFFERENCE-IS-0, and opening up the function EQUAL, to: T. Case 1. (IMPLIES (LESSP X Y) (EQUAL (DIFFERENCE (PLUS I X) (PLUS I Y)) (DIFFERENCE X Y))). But this again simplifies, using linear arithmetic, applying the lemma DIFFERENCE-IS-0, and expanding EQUAL, to: T. Q.E.D. [ 0.0 0.0 0.0 ] DIFFERENCE-PLUS-CANCELLATION2 (PROVE-LEMMA DIFFERENCE-PLUS-CANCELLATION3 (REWRITE) (EQUAL (DIFFERENCE (PLUS I J X) J) (PLUS I X))) This simplifies, using linear arithmetic, to: (IMPLIES (LESSP (PLUS I J X) J) (EQUAL (DIFFERENCE (PLUS I J X) J) (PLUS I X))), which again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] DIFFERENCE-PLUS-CANCELLATION3 (PROVE-LEMMA LESSP-REMAINDER (GENERALIZE) (EQUAL (LESSP (REMAINDER X Y) Y) (NOT (ZEROP Y)))) This conjecture simplifies, expanding ZEROP and NOT, to the following three new goals: Case 3. (IMPLIES (NOT (NUMBERP Y)) (EQUAL (LESSP (REMAINDER X Y) Y) F)). However this again simplifies, expanding the definitions of REMAINDER, LESSP, and EQUAL, to: T. Case 2. (IMPLIES (EQUAL Y 0) (EQUAL (LESSP (REMAINDER X Y) Y) F)), which again simplifies, expanding the definitions of EQUAL, REMAINDER, and LESSP, to: T. Case 1. (IMPLIES (AND (NOT (EQUAL Y 0)) (NUMBERP Y)) (EQUAL (LESSP (REMAINDER X Y) Y) T)), which again simplifies, trivially, to the new formula: (IMPLIES (AND (NOT (EQUAL Y 0)) (NUMBERP Y)) (LESSP (REMAINDER X Y) Y)), which we will name *1. We will appeal to induction. There are two plausible inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP Y) (p X Y)) (IMPLIES (AND (NOT (ZEROP Y)) (LESSP X Y)) (p X Y)) (IMPLIES (AND (NOT (ZEROP Y)) (NOT (LESSP X Y)) (p (DIFFERENCE X Y) Y)) (p X Y))). Linear arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the definition of ZEROP establish that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme produces the following three new formulas: Case 3. (IMPLIES (AND (ZEROP Y) (NOT (EQUAL Y 0)) (NUMBERP Y)) (LESSP (REMAINDER X Y) Y)). This simplifies, opening up ZEROP, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP Y)) (LESSP X Y) (NOT (EQUAL Y 0)) (NUMBERP Y)) (LESSP (REMAINDER X Y) Y)). This simplifies, opening up the definitions of ZEROP and REMAINDER, to: (IMPLIES (AND (LESSP X Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NOT (NUMBERP X))) (LESSP 0 Y)), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP Y)) (NOT (LESSP X Y)) (LESSP (REMAINDER (DIFFERENCE X Y) Y) Y) (NOT (EQUAL Y 0)) (NUMBERP Y)) (LESSP (REMAINDER X Y) Y)), which simplifies, unfolding the functions ZEROP and REMAINDER, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LESSP-REMAINDER (PROVE-LEMMA REMAINDER-QUOTIENT-ELIM (ELIM REWRITE) (IMPLIES (NUMBERP X) (EQUAL (PLUS (REMAINDER X Y) (TIMES Y (QUOTIENT X Y))) X))) WARNING: the previously added lemma, PLUS-COMMUTES1, could be applied whenever the newly proposed REMAINDER-QUOTIENT-ELIM could! Give the conjecture the name *1. Let us appeal to the induction principle. The recursive terms in the conjecture suggest three inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP Y) (p X Y)) (IMPLIES (AND (NOT (ZEROP Y)) (LESSP X Y)) (p X Y)) (IMPLIES (AND (NOT (ZEROP Y)) (NOT (LESSP X Y)) (p (DIFFERENCE X Y) Y)) (p X Y))). Linear arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the definition of ZEROP can be used to show that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme generates the following three new conjectures: Case 3. (IMPLIES (AND (ZEROP Y) (NUMBERP X)) (EQUAL (PLUS (REMAINDER X Y) (TIMES Y (QUOTIENT X Y))) X)). This simplifies, appealing to the lemmas PLUS-COMMUTES1, TIMES-NON-NUMBERP, and TIMES-COMMUTES1, and expanding the functions ZEROP, EQUAL, REMAINDER, QUOTIENT, TIMES, and PLUS, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP Y)) (LESSP X Y) (NUMBERP X)) (EQUAL (PLUS (REMAINDER X Y) (TIMES Y (QUOTIENT X Y))) X)). This simplifies, applying TIMES-COMMUTES1 and PLUS-COMMUTES1, and expanding the definitions of ZEROP, REMAINDER, QUOTIENT, EQUAL, TIMES, and PLUS, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP Y)) (NOT (LESSP X Y)) (EQUAL (PLUS (REMAINDER (DIFFERENCE X Y) Y) (TIMES Y (QUOTIENT (DIFFERENCE X Y) Y))) (DIFFERENCE X Y)) (NUMBERP X)) (EQUAL (PLUS (REMAINDER X Y) (TIMES Y (QUOTIENT X Y))) X)), which simplifies, applying TIMES-ADD1 and PLUS-COMMUTES2, and opening up ZEROP, REMAINDER, and QUOTIENT, to: (IMPLIES (AND (NOT (EQUAL Y 0)) (NUMBERP Y) (NOT (LESSP X Y)) (EQUAL (PLUS (REMAINDER (DIFFERENCE X Y) Y) (TIMES Y (QUOTIENT (DIFFERENCE X Y) Y))) (DIFFERENCE X Y)) (NUMBERP X)) (EQUAL (PLUS Y (DIFFERENCE X Y)) X)), which again simplifies, using linear arithmetic, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] REMAINDER-QUOTIENT-ELIM (PROVE-LEMMA QUOTIENT-PLUS-TIMES (REWRITE) (IMPLIES (NOT (ZEROP W)) (EQUAL (QUOTIENT (PLUS V (TIMES W I)) W) (PLUS I (QUOTIENT V W)))) ((INDUCT (TIMES I W)))) This formula can be simplified, using the abbreviations ZEROP, IMPLIES, NOT, OR, and AND, to the following two new conjectures: Case 2. (IMPLIES (AND (ZEROP I) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (QUOTIENT (PLUS V (TIMES W I)) W) (PLUS I (QUOTIENT V W)))). This simplifies, applying the lemmas TIMES-COMMUTES1 and PLUS-COMMUTES1, and unfolding ZEROP, EQUAL, TIMES, and PLUS, to the following two new formulas: Case 2.2. (IMPLIES (AND (EQUAL I 0) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (NUMBERP V))) (EQUAL (QUOTIENT 0 W) (QUOTIENT V W))). This again simplifies, expanding the functions LESSP, EQUAL, and QUOTIENT, to: T. Case 2.1. (IMPLIES (AND (NOT (NUMBERP I)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (NUMBERP V))) (EQUAL (QUOTIENT 0 W) (QUOTIENT V W))), which again simplifies, unfolding the definitions of LESSP, EQUAL, and QUOTIENT, to: T. Case 1. (IMPLIES (AND (NOT (EQUAL I 0)) (NUMBERP I) (IMPLIES (NOT (ZEROP W)) (EQUAL (QUOTIENT (PLUS V (TIMES W (SUB1 I))) W) (PLUS (SUB1 I) (QUOTIENT V W)))) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (QUOTIENT (PLUS V (TIMES W I)) W) (PLUS I (QUOTIENT V W)))), which simplifies, applying TIMES-COMMUTES1 and DIFFERENCE-PLUS-CANCELLATION3, and opening up the functions ZEROP, NOT, IMPLIES, TIMES, QUOTIENT, and PLUS, to the new formula: (IMPLIES (AND (NOT (EQUAL I 0)) (NUMBERP I) (EQUAL (QUOTIENT (PLUS V (TIMES W (SUB1 I))) W) (PLUS (SUB1 I) (QUOTIENT V W))) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP (PLUS V W (TIMES W (SUB1 I))) W)) (EQUAL 0 (ADD1 (PLUS (SUB1 I) (QUOTIENT V W))))), which again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] QUOTIENT-PLUS-TIMES (DEFN LEN (X) (IF (NLISTP X) 0 (ADD1 (LEN (CDR X))))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT X) decreases according to the well-founded relation LESSP in each recursive call. Hence, LEN is accepted under the principle of definition. From the definition we can conclude that (NUMBERP (LEN X)) is a theorem. [ 0.0 0.0 0.0 ] LEN (PROVE-LEMMA EQUAL-LEN-0 (REWRITE) (EQUAL (EQUAL (LEN X) 0) (NLISTP X))) This formula simplifies, opening up the definition of NLISTP, to two new conjectures: Case 2. (IMPLIES (NOT (EQUAL (LEN X) 0)) (LISTP X)), which again simplifies, unfolding the definitions of LEN and EQUAL, to: T. Case 1. (IMPLIES (EQUAL (LEN X) 0) (NOT (LISTP X))), 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 (NLISTP X) (p X)) (IMPLIES (AND (NOT (NLISTP X)) (p (CDR X))) (p X))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to prove that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme produces three new formulas: Case 3. (IMPLIES (AND (NLISTP X) (EQUAL (LEN X) 0)) (NOT (LISTP X))), which simplifies, opening up NLISTP, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP X)) (NOT (EQUAL (LEN (CDR X)) 0)) (EQUAL (LEN X) 0)) (NOT (LISTP X))), which simplifies, opening up NLISTP and LEN, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP X)) (NOT (LISTP (CDR X))) (EQUAL (LEN X) 0)) (NOT (LISTP X))), which simplifies, expanding the definitions of NLISTP and LEN, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] EQUAL-LEN-0 (DEFN APP (X Y) (IF (NLISTP X) Y (CONS (CAR X) (APP (CDR X) Y)))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT X) decreases according to the well-founded relation LESSP in each recursive call. Hence, APP is accepted under the definitional principle. From the definition we can conclude that (OR (LISTP (APP X Y)) (EQUAL (APP X Y) Y)) is a theorem. [ 0.0 0.0 0.0 ] APP (PROVE-LEMMA APP-CANCELLATION (REWRITE) (EQUAL (EQUAL (APP A B) (APP A C)) (EQUAL B C))) This simplifies, obviously, to two new formulas: Case 2. (IMPLIES (NOT (EQUAL B C)) (NOT (EQUAL (APP A B) (APP A C)))), which we will name *1. Case 1. (IMPLIES (EQUAL B C) (EQUAL (EQUAL (APP A B) (APP A C)) T)). This again simplifies, opening up the definition of EQUAL, to: T. So next consider: (IMPLIES (NOT (EQUAL B C)) (NOT (EQUAL (APP A B) (APP A C)))), which we named *1 above. Let us appeal to the induction principle. Two inductions are suggested by terms in the conjecture. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (NLISTP A) (p A B C)) (IMPLIES (AND (NOT (NLISTP A)) (p (CDR A) B C)) (p A B C))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP establish that the measure (COUNT A) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to two new goals: Case 2. (IMPLIES (AND (NLISTP A) (NOT (EQUAL B C))) (NOT (EQUAL (APP A B) (APP A C)))), which simplifies, opening up the functions NLISTP and APP, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP A)) (NOT (EQUAL (APP (CDR A) B) (APP (CDR A) C))) (NOT (EQUAL B C))) (NOT (EQUAL (APP A B) (APP A C)))), which simplifies, applying the lemmas CAR-CONS and CDR-CONS, and opening up NLISTP and APP, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] APP-CANCELLATION (PROVE-LEMMA APP-ASSOC (REWRITE) (EQUAL (APP (APP A B) C) (APP A (APP B C)))) Call the conjecture *1. Perhaps we can prove it by induction. Three inductions are suggested by terms in the conjecture. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (NLISTP A) (p A B C)) (IMPLIES (AND (NOT (NLISTP A)) (p (CDR A) B C)) (p A B C))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to prove that the measure (COUNT A) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to two new goals: Case 2. (IMPLIES (NLISTP A) (EQUAL (APP (APP A B) C) (APP A (APP B C)))), which simplifies, opening up the definitions of NLISTP and APP, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP A)) (EQUAL (APP (APP (CDR A) B) C) (APP (CDR A) (APP B C)))) (EQUAL (APP (APP A B) C) (APP A (APP B C)))), which simplifies, applying CDR-CONS and CAR-CONS, and unfolding NLISTP and APP, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] APP-ASSOC (PROVE-LEMMA LEN-APP (REWRITE) (EQUAL (LEN (APP A B)) (PLUS (LEN A) (LEN B)))) Call the conjecture *1. Perhaps we can prove it by induction. Three inductions are suggested by terms in the conjecture. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (NLISTP A) (p A B)) (IMPLIES (AND (NOT (NLISTP A)) (p (CDR A) B)) (p A B))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to prove that the measure (COUNT A) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to two new goals: Case 2. (IMPLIES (NLISTP A) (EQUAL (LEN (APP A B)) (PLUS (LEN A) (LEN B)))), which simplifies, opening up the definitions of NLISTP, APP, LEN, EQUAL, and PLUS, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP A)) (EQUAL (LEN (APP (CDR A) B)) (PLUS (LEN (CDR A)) (LEN B)))) (EQUAL (LEN (APP A B)) (PLUS (LEN A) (LEN B)))), which simplifies, applying PLUS-COMMUTES1, CDR-CONS, and PLUS-ADD1, and unfolding NLISTP, APP, and LEN, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LEN-APP (PROVE-LEMMA QUOTIENT-X-X (REWRITE) (IMPLIES (NOT (ZEROP X)) (EQUAL (QUOTIENT X X) 1))) This formula can be simplified, using the abbreviations ZEROP, NOT, and IMPLIES, to: (IMPLIES (AND (NOT (EQUAL X 0)) (NUMBERP X)) (EQUAL (QUOTIENT X X) 1)), which simplifies, rewriting with the lemma DIFFERENCE-IS-0, and expanding the functions QUOTIENT, LESSP, EQUAL, and ADD1, to the goal: (IMPLIES (AND (NOT (EQUAL X 0)) (NUMBERP X)) (NOT (LESSP X X))). But this again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] QUOTIENT-X-X (PROVE-LEMMA NOT-LESSP-TIMES-QUOTIENT (REWRITE) (NOT (LESSP N (TIMES W (QUOTIENT N W))))) WARNING: Note that the proposed lemma NOT-LESSP-TIMES-QUOTIENT is to be stored as zero type prescription rules, zero compound recognizer rules, one linear rule, and zero replacement rules. . Applying the lemma REMAINDER-QUOTIENT-ELIM, replace N by (PLUS Z (TIMES W X)) to eliminate (QUOTIENT N W) and (REMAINDER N W). We use LESSP-REMAINDER, 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 two new goals: Case 2. (IMPLIES (NOT (NUMBERP N)) (NOT (LESSP N (TIMES W (QUOTIENT N W))))). This simplifies, rewriting with TIMES-COMMUTES1, and expanding LESSP, QUOTIENT, EQUAL, and TIMES, to: T. Case 1. (IMPLIES (AND (NUMBERP X) (NUMBERP Z) (EQUAL (LESSP Z W) (NOT (ZEROP W)))) (NOT (LESSP (PLUS Z (TIMES W X)) (TIMES W X)))). However this simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] NOT-LESSP-TIMES-QUOTIENT (PROVE-LEMMA TIMES-MONOTONIC (REWRITE) (IMPLIES (AND (NOT (ZEROP W)) (LESSP A B)) (LESSP (TIMES W A) (TIMES W B)))) WARNING: When the linear lemma TIMES-MONOTONIC is stored under (TIMES W B) it contains the free variable A which will be chosen by instantiating the hypothesis (LESSP A B). WARNING: When the linear lemma TIMES-MONOTONIC is stored under (TIMES W A) it contains the free variable B which will be chosen by instantiating the hypothesis (LESSP A B). WARNING: Note that the proposed lemma TIMES-MONOTONIC is to be stored as zero type prescription rules, zero compound recognizer rules, two linear rules, and zero replacement rules. This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NOT (EQUAL W 0)) (NUMBERP W) (LESSP A B)) (LESSP (TIMES W A) (TIMES W B))). This simplifies, applying TIMES-COMMUTES1, to the formula: (IMPLIES (AND (NOT (EQUAL W 0)) (NUMBERP W) (LESSP A B)) (LESSP (TIMES A W) (TIMES B W))). Give the above formula the name *1. We will appeal to induction. The recursive terms in the conjecture suggest four inductions. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (OR (EQUAL B 0) (NOT (NUMBERP B))) (p A W B)) (IMPLIES (AND (NOT (OR (EQUAL B 0) (NOT (NUMBERP B)))) (OR (EQUAL A 0) (NOT (NUMBERP A)))) (p A W B)) (IMPLIES (AND (NOT (OR (EQUAL B 0) (NOT (NUMBERP B)))) (NOT (OR (EQUAL A 0) (NOT (NUMBERP A)))) (p (SUB1 A) W (SUB1 B))) (p A W B))). 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. Note, however, the inductive instance chosen for B. The above induction scheme leads to the following four new conjectures: Case 4. (IMPLIES (AND (OR (EQUAL B 0) (NOT (NUMBERP B))) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP A B)) (LESSP (TIMES A W) (TIMES B W))). This simplifies, expanding the definitions of NOT, OR, EQUAL, and LESSP, to: T. Case 3. (IMPLIES (AND (NOT (OR (EQUAL B 0) (NOT (NUMBERP B)))) (OR (EQUAL A 0) (NOT (NUMBERP A))) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP A B)) (LESSP (TIMES A W) (TIMES B W))). This simplifies, unfolding NOT, OR, EQUAL, LESSP, and TIMES, to the following two new formulas: Case 3.2. (IMPLIES (AND (NOT (EQUAL B 0)) (NUMBERP B) (EQUAL A 0) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (EQUAL (PLUS W (TIMES (SUB1 B) W)) 0))). However this again simplifies, using linear arithmetic, to: T. Case 3.1. (IMPLIES (AND (NOT (EQUAL B 0)) (NUMBERP B) (NOT (NUMBERP A)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (EQUAL (PLUS W (TIMES (SUB1 B) W)) 0))), which again simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (OR (EQUAL B 0) (NOT (NUMBERP B)))) (NOT (OR (EQUAL A 0) (NOT (NUMBERP A)))) (NOT (LESSP (SUB1 A) (SUB1 B))) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP A B)) (LESSP (TIMES A W) (TIMES B W))), which simplifies, using linear arithmetic, to: (IMPLIES (AND (LESSP A 1) (NOT (OR (EQUAL B 0) (NOT (NUMBERP B)))) (NOT (OR (EQUAL A 0) (NOT (NUMBERP A)))) (NOT (LESSP (SUB1 A) (SUB1 B))) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP A B)) (LESSP (TIMES A W) (TIMES B W))). This again simplifies, opening up the definitions of SUB1, NUMBERP, EQUAL, LESSP, NOT, and OR, to: T. Case 1. (IMPLIES (AND (NOT (OR (EQUAL B 0) (NOT (NUMBERP B)))) (NOT (OR (EQUAL A 0) (NOT (NUMBERP A)))) (LESSP (TIMES (SUB1 A) W) (TIMES (SUB1 B) W)) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP A B)) (LESSP (TIMES A W) (TIMES B W))), which simplifies, opening up the definitions of NOT, OR, LESSP, and TIMES, to: (IMPLIES (AND (NOT (EQUAL B 0)) (NUMBERP B) (NOT (EQUAL A 0)) (NUMBERP A) (LESSP (TIMES (SUB1 A) W) (TIMES (SUB1 B) W)) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP (SUB1 A) (SUB1 B))) (LESSP (PLUS W (TIMES (SUB1 A) W)) (PLUS W (TIMES (SUB1 B) W)))). However this again simplifies, using linear arithmetic, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] TIMES-MONOTONIC (PROVE-LEMMA DIFFERENCE-PLUS (REWRITE) (EQUAL (DIFFERENCE (PLUS X Y) Y) (FIX X))) This conjecture simplifies, opening up the function FIX, to the following two new goals: Case 2. (IMPLIES (NOT (NUMBERP X)) (EQUAL (DIFFERENCE (PLUS X Y) Y) 0)). But this again simplifies, expanding the definition of PLUS, to two new conjectures: Case 2.2. (IMPLIES (AND (NOT (NUMBERP X)) (NOT (NUMBERP Y))) (EQUAL (DIFFERENCE 0 Y) 0)), which again simplifies, using linear arithmetic, rewriting with DIFFERENCE-IS-0, and expanding the definition of EQUAL, to: T. Case 2.1. (IMPLIES (AND (NOT (NUMBERP X)) (NUMBERP Y)) (EQUAL (DIFFERENCE Y Y) 0)). However this again simplifies, using linear arithmetic, to: (IMPLIES (AND (LESSP Y Y) (NOT (NUMBERP X)) (NUMBERP Y)) (EQUAL (DIFFERENCE Y Y) 0)). But this again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (NUMBERP X) (EQUAL (DIFFERENCE (PLUS X Y) Y) X)), which again simplifies, using linear arithmetic, to: (IMPLIES (AND (LESSP (PLUS X Y) Y) (NUMBERP X)) (EQUAL (DIFFERENCE (PLUS X Y) Y) X)). But this again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] DIFFERENCE-PLUS (PROVE-LEMMA NSIG*-ALG-LEMMA-HACK1 (REWRITE) (IMPLIES (AND (LESSP N (QUOTIENT (PLUS R X) W)) (NUMBERP W) (NOT (EQUAL W 0))) (EQUAL (LESSP (PLUS TS (TIMES N W)) (PLUS R TS X)) T)) ((DISABLE TIMES-MONOTONIC) (USE (TIMES-MONOTONIC (A N) (B (QUOTIENT (PLUS R X) W)))))) This formula simplifies, rewriting with TIMES-COMMUTES1, and unfolding ZEROP, NOT, AND, and IMPLIES, to the goal: (IMPLIES (AND (LESSP (TIMES N W) (TIMES W (QUOTIENT (PLUS R X) W))) (LESSP N (QUOTIENT (PLUS R X) W)) (NUMBERP W) (NOT (EQUAL W 0))) (LESSP (PLUS TS (TIMES N W)) (PLUS R TS X))). This again simplifies, using linear arithmetic and applying NOT-LESSP-TIMES-QUOTIENT, to: T. Q.E.D. [ 0.0 0.0 0.0 ] NSIG*-ALG-LEMMA-HACK1 (PROVE-LEMMA DIFFERENCE-PLUS-CANCELLATION-4 (REWRITE) (EQUAL (DIFFERENCE (PLUS R TS X) (PLUS TS Y)) (DIFFERENCE (PLUS R X) Y))) This simplifies, using linear arithmetic, to the following two new goals: Case 2. (IMPLIES (LESSP (PLUS R TS X) (PLUS TS Y)) (EQUAL (DIFFERENCE (PLUS R TS X) (PLUS TS Y)) (DIFFERENCE (PLUS R X) Y))). However this again simplifies, using linear arithmetic, rewriting with the lemma DIFFERENCE-IS-0, and opening up the function EQUAL, to: T. Case 1. (IMPLIES (LESSP (PLUS R X) Y) (EQUAL (DIFFERENCE (PLUS R TS X) (PLUS TS Y)) (DIFFERENCE (PLUS R X) Y))), which again simplifies, using linear arithmetic, applying the lemma DIFFERENCE-IS-0, and opening up the definition of EQUAL, to: T. Q.E.D. [ 0.0 0.0 0.0 ] DIFFERENCE-PLUS-CANCELLATION-4 (PROVE-LEMMA NTS*-ALG-LEMMA2-HACK1 (REWRITE) (IMPLIES (AND (LESSP N (QUOTIENT (PLUS R X) W)) (NUMBERP X) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (TIMES N W) (PLUS R X))) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP X W)) (EQUAL (EQUAL (QUOTIENT (PLUS R X) W) (QUOTIENT (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) W)) T)) ((DISABLE TIMES-MONOTONIC) (USE (TIMES-MONOTONIC (A N) (B (QUOTIENT (PLUS R X) W)) (W W))))) This conjecture simplifies, rewriting with TIMES-COMMUTES1, and opening up ZEROP, NOT, AND, and IMPLIES, to the new conjecture: (IMPLIES (AND (LESSP (TIMES N W) (TIMES W (QUOTIENT (PLUS R X) W))) (LESSP N (QUOTIENT (PLUS R X) W)) (NUMBERP X) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (TIMES N W) (PLUS R X))) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP X W)) (EQUAL (QUOTIENT (PLUS R X) W) (QUOTIENT (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) W))), which again simplifies, using linear arithmetic and rewriting with the lemma NOT-LESSP-TIMES-QUOTIENT, to: T. Q.E.D. [ 0.0 0.0 0.0 ] NTS*-ALG-LEMMA2-HACK1 (PROVE-LEMMA TIMES-CANCELLATION1 (REWRITE) (IMPLIES (NOT (ZEROP I)) (EQUAL (EQUAL (TIMES I J) (TIMES I K)) (EQUAL (FIX J) (FIX K)))) ((INDUCT (LESSP J K)))) This conjecture can be simplified, using the abbreviations ZEROP, IMPLIES, NOT, OR, and AND, to three new conjectures: Case 3. (IMPLIES (AND (OR (EQUAL K 0) (NOT (NUMBERP K))) (NOT (EQUAL I 0)) (NUMBERP I)) (EQUAL (EQUAL (TIMES I J) (TIMES I K)) (EQUAL (FIX J) (FIX K)))), which simplifies, rewriting with TIMES-COMMUTES1 and TIMES-NON-NUMBERP, and opening up the functions NOT, OR, EQUAL, TIMES, and FIX, to the following six new formulas: Case 3.6. (IMPLIES (AND (EQUAL K 0) (NOT (EQUAL I 0)) (NUMBERP I) (NUMBERP J) (NOT (EQUAL J 0))) (NOT (EQUAL (TIMES I J) 0))). This again simplifies, obviously, to: (IMPLIES (AND (NOT (EQUAL I 0)) (NUMBERP I) (NUMBERP J) (NOT (EQUAL J 0))) (NOT (EQUAL (TIMES I J) 0))), which we will name *1. Case 3.5. (IMPLIES (AND (EQUAL K 0) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (NUMBERP J))) (EQUAL (EQUAL (TIMES I J) 0) T)). However this again simplifies, rewriting with the lemma TIMES-NON-NUMBERP, and expanding the definition of EQUAL, to: T. Case 3.4. (IMPLIES (AND (EQUAL K 0) (NOT (EQUAL I 0)) (NUMBERP I) (EQUAL J 0)) (EQUAL (EQUAL (TIMES I J) 0) T)), which again simplifies, rewriting with TIMES-COMMUTES1, and expanding the definitions of EQUAL and TIMES, to: T. Case 3.3. (IMPLIES (AND (NOT (NUMBERP K)) (NOT (EQUAL I 0)) (NUMBERP I) (NUMBERP J) (NOT (EQUAL J 0))) (NOT (EQUAL (TIMES I J) 0))). Name the above subgoal *2. Case 3.2. (IMPLIES (AND (NOT (NUMBERP K)) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (NUMBERP J))) (EQUAL (EQUAL (TIMES I J) 0) T)). But this again simplifies, rewriting with the lemma TIMES-NON-NUMBERP, and opening up the function EQUAL, to: T. Case 3.1. (IMPLIES (AND (NOT (NUMBERP K)) (NOT (EQUAL I 0)) (NUMBERP I) (EQUAL J 0)) (EQUAL (EQUAL (TIMES I J) 0) T)), which again simplifies, rewriting with TIMES-COMMUTES1, and expanding the definitions of EQUAL and TIMES, to: T. Case 2. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (OR (EQUAL J 0) (NOT (NUMBERP J))) (NOT (EQUAL I 0)) (NUMBERP I)) (EQUAL (EQUAL (TIMES I J) (TIMES I K)) (EQUAL (FIX J) (FIX K)))). This simplifies, applying TIMES-COMMUTES1 and TIMES-NON-NUMBERP, and expanding the definitions of NOT, OR, EQUAL, TIMES, and FIX, to two new formulas: Case 2.2. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (EQUAL J 0) (NOT (EQUAL I 0)) (NUMBERP I)) (NOT (EQUAL 0 (TIMES I K)))), which again simplifies, clearly, to: (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (NOT (EQUAL I 0)) (NUMBERP I)) (NOT (EQUAL 0 (TIMES I K)))), which we will name *3. Case 2.1. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (NOT (NUMBERP J)) (NOT (EQUAL I 0)) (NUMBERP I)) (NOT (EQUAL 0 (TIMES I K)))). Give the above formula the name *4. Case 1. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (NOT (EQUAL J 0)) (NUMBERP J) (IMPLIES (NOT (ZEROP I)) (EQUAL (EQUAL (TIMES I (SUB1 J)) (TIMES I (SUB1 K))) (EQUAL (FIX (SUB1 J)) (FIX (SUB1 K))))) (NOT (EQUAL I 0)) (NUMBERP I)) (EQUAL (EQUAL (TIMES I J) (TIMES I K)) (EQUAL (FIX J) (FIX K)))). This simplifies, unfolding ZEROP, NOT, FIX, and IMPLIES, to the following four new conjectures: Case 1.4. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (NOT (EQUAL J 0)) (NUMBERP J) (NOT (EQUAL (SUB1 J) (SUB1 K))) (NOT (EQUAL (TIMES I (SUB1 J)) (TIMES I (SUB1 K)))) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (EQUAL J K))) (NOT (EQUAL (TIMES I J) (TIMES I K)))). Appealing to the lemma SUB1-ELIM, we now replace J by (ADD1 X) to eliminate (SUB1 J). We employ the type restriction lemma noted when SUB1 was introduced to constrain the new variable. The result is: (IMPLIES (AND (NUMBERP X) (NOT (EQUAL K 0)) (NUMBERP K) (NOT (EQUAL (ADD1 X) 0)) (NOT (EQUAL X (SUB1 K))) (NOT (EQUAL (TIMES I X) (TIMES I (SUB1 K)))) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (EQUAL (ADD1 X) K))) (NOT (EQUAL (TIMES I (ADD1 X)) (TIMES I K)))). However this further simplifies, applying TIMES-ADD1, to: (IMPLIES (AND (NUMBERP X) (NOT (EQUAL K 0)) (NUMBERP K) (NOT (EQUAL X (SUB1 K))) (NOT (EQUAL (TIMES I X) (TIMES I (SUB1 K)))) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (EQUAL (ADD1 X) K))) (NOT (EQUAL (PLUS I (TIMES I X)) (TIMES I K)))). Applying the lemma SUB1-ELIM, replace K by (ADD1 Z) to eliminate (SUB1 K). We rely upon the type restriction lemma noted when SUB1 was introduced to restrict the new variable. We thus obtain: (IMPLIES (AND (NUMBERP Z) (NUMBERP X) (NOT (EQUAL (ADD1 Z) 0)) (NOT (EQUAL X Z)) (NOT (EQUAL (TIMES I X) (TIMES I Z))) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (EQUAL (ADD1 X) (ADD1 Z)))) (NOT (EQUAL (PLUS I (TIMES I X)) (TIMES I (ADD1 Z))))), which further simplifies, applying ADD1-EQUAL and TIMES-ADD1, to: (IMPLIES (AND (NUMBERP Z) (NUMBERP X) (NOT (EQUAL X Z)) (NOT (EQUAL (TIMES I X) (TIMES I Z))) (NOT (EQUAL I 0)) (NUMBERP I)) (NOT (EQUAL (PLUS I (TIMES I X)) (PLUS I (TIMES I Z))))), which finally simplifies, using linear arithmetic, to: T. Case 1.3. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (NOT (EQUAL J 0)) (NUMBERP J) (NOT (EQUAL (SUB1 J) (SUB1 K))) (NOT (EQUAL (TIMES I (SUB1 J)) (TIMES I (SUB1 K)))) (NOT (EQUAL I 0)) (NUMBERP I) (EQUAL J K)) (EQUAL (EQUAL (TIMES I J) (TIMES I K)) T)), which again simplifies, clearly, to: T. Case 1.2. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (NOT (EQUAL J 0)) (NUMBERP J) (EQUAL (SUB1 J) (SUB1 K)) (EQUAL (EQUAL (TIMES I (SUB1 J)) (TIMES I (SUB1 K))) T) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (EQUAL J K))) (NOT (EQUAL (TIMES I J) (TIMES I K)))). But this again simplifies, using linear arithmetic, to: T. Case 1.1. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (NOT (EQUAL J 0)) (NUMBERP J) (EQUAL (SUB1 J) (SUB1 K)) (EQUAL (EQUAL (TIMES I (SUB1 J)) (TIMES I (SUB1 K))) T) (NOT (EQUAL I 0)) (NUMBERP I) (EQUAL J K)) (EQUAL (EQUAL (TIMES I J) (TIMES I K)) T)), which again simplifies, unfolding the function EQUAL, to: T. So next consider: (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (NOT (NUMBERP J)) (NOT (EQUAL I 0)) (NUMBERP I)) (NOT (EQUAL 0 (TIMES I K)))), which is formula *4 above. Ah ha! This conjecture is subsumed by another subgoal awaiting our attention, namely *3 above. So let us turn our attention to: (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (NOT (EQUAL I 0)) (NUMBERP I)) (NOT (EQUAL 0 (TIMES I K)))), which we named *3 above. Ah ha! This conjecture is subsumed by formula *1 above. So let us turn our attention to: (IMPLIES (AND (NOT (NUMBERP K)) (NOT (EQUAL I 0)) (NUMBERP I) (NUMBERP J) (NOT (EQUAL J 0))) (NOT (EQUAL (TIMES I J) 0))), named *2 above. Ah ha! This conjecture is subsumed by another subgoal awaiting our attention, namely *1 above. So next consider: (IMPLIES (AND (NOT (EQUAL I 0)) (NUMBERP I) (NUMBERP J) (NOT (EQUAL J 0))) (NOT (EQUAL (TIMES I J) 0))), named *1 above. We will try to prove it by induction. There is only one suggested induction. We will induct according to the following scheme: (AND (IMPLIES (ZEROP I) (p I J)) (IMPLIES (AND (NOT (ZEROP I)) (p (SUB1 I) J)) (p I J))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform us that the measure (COUNT I) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to three new formulas: Case 3. (IMPLIES (AND (ZEROP I) (NOT (EQUAL I 0)) (NUMBERP I) (NUMBERP J) (NOT (EQUAL J 0))) (NOT (EQUAL (TIMES I J) 0))), which simplifies, opening up ZEROP, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP I)) (EQUAL (SUB1 I) 0) (NOT (EQUAL I 0)) (NUMBERP I) (NUMBERP J) (NOT (EQUAL J 0))) (NOT (EQUAL (TIMES I J) 0))), which simplifies, opening up the definitions of ZEROP and TIMES, to: (IMPLIES (AND (EQUAL (SUB1 I) 0) (NOT (EQUAL I 0)) (NUMBERP I) (NUMBERP J) (NOT (EQUAL J 0))) (NOT (EQUAL (PLUS J (TIMES (SUB1 I) J)) 0))). However this again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP I)) (NOT (EQUAL (TIMES (SUB1 I) J) 0)) (NOT (EQUAL I 0)) (NUMBERP I) (NUMBERP J) (NOT (EQUAL J 0))) (NOT (EQUAL (TIMES I J) 0))), which simplifies, unfolding ZEROP and TIMES, to: (IMPLIES (AND (NOT (EQUAL (TIMES (SUB1 I) J) 0)) (NOT (EQUAL I 0)) (NUMBERP I) (NUMBERP J) (NOT (EQUAL J 0))) (NOT (EQUAL (PLUS J (TIMES (SUB1 I) J)) 0))). This again simplifies, using linear arithmetic, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] TIMES-CANCELLATION1 (PROVE-LEMMA TIMES-CANCELLATION2 (REWRITE) (IMPLIES (NOT (ZEROP W)) (EQUAL (EQUAL (PLUS (TIMES W X) (TIMES W Y)) (TIMES W Z)) (EQUAL (PLUS X Y) (FIX Z)))) ((DISABLE TIMES-CANCELLATION1) (USE (TIMES-CANCELLATION1 (I W) (J (PLUS X Y)) (K Z))))) This formula can be simplified, using the abbreviations ZEROP, NOT, and IMPLIES, to: (IMPLIES (AND (IMPLIES (NOT (ZEROP W)) (EQUAL (EQUAL (TIMES W (PLUS X Y)) (TIMES W Z)) (EQUAL (FIX (PLUS X Y)) (FIX Z)))) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (EQUAL (PLUS (TIMES W X) (TIMES W Y)) (TIMES W Z)) (EQUAL (PLUS X Y) (FIX Z)))), which simplifies, applying TIMES-DISTRIBUTES1 and TIMES-NON-NUMBERP, and unfolding the definitions of ZEROP, NOT, FIX, IMPLIES, and EQUAL, to the following two new formulas: Case 2. (IMPLIES (AND (NOT (NUMBERP Z)) (NOT (EQUAL (PLUS X Y) 0)) (NOT (EQUAL (PLUS (TIMES W X) (TIMES W Y)) (TIMES W Z))) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (EQUAL (PLUS (TIMES W X) (TIMES W Y)) 0))). But this again simplifies, applying TIMES-NON-NUMBERP, and opening up EQUAL, to: T. Case 1. (IMPLIES (AND (NOT (NUMBERP Z)) (EQUAL (PLUS X Y) 0) (EQUAL (EQUAL (PLUS (TIMES W X) (TIMES W Y)) (TIMES W Z)) T) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (PLUS (TIMES W X) (TIMES W Y)) 0)). But this again simplifies, applying TIMES-NON-NUMBERP, and expanding EQUAL, to: T. Q.E.D. [ 0.0 0.0 0.0 ] TIMES-CANCELLATION2 (PROVE-LEMMA DIFFERENCE-DIFFERENCE (REWRITE) (IMPLIES (NOT (LESSP B C)) (EQUAL (DIFFERENCE A (DIFFERENCE B C)) (DIFFERENCE (PLUS A C) B)))) This formula simplifies, using linear arithmetic, to the following two new formulas: Case 2. (IMPLIES (AND (LESSP A (DIFFERENCE B C)) (NOT (LESSP B C))) (EQUAL (DIFFERENCE A (DIFFERENCE B C)) (DIFFERENCE (PLUS A C) B))). However this again simplifies, using linear arithmetic, applying DIFFERENCE-IS-0, and unfolding the function EQUAL, to: T. Case 1. (IMPLIES (AND (LESSP (PLUS A C) B) (NOT (LESSP B C))) (EQUAL (DIFFERENCE A (DIFFERENCE B C)) (DIFFERENCE (PLUS A C) B))). But this again simplifies, using linear arithmetic, rewriting with DIFFERENCE-IS-0, and opening up the function EQUAL, to: T. Q.E.D. [ 0.0 0.0 0.0 ] DIFFERENCE-DIFFERENCE (PROVE-LEMMA DIFFERENCE-DIFFERENCE-OTHER (REWRITE) (EQUAL (DIFFERENCE (DIFFERENCE A B) C) (DIFFERENCE A (PLUS B C)))) This simplifies, using linear arithmetic, to the following three new conjectures: Case 3. (IMPLIES (LESSP (DIFFERENCE A B) C) (EQUAL (DIFFERENCE (DIFFERENCE A B) C) (DIFFERENCE A (PLUS B C)))). But this again simplifies, using linear arithmetic, applying DIFFERENCE-IS-0, and opening up the function EQUAL, to: (IMPLIES (AND (LESSP (DIFFERENCE A B) C) (LESSP A B)) (EQUAL (DIFFERENCE (DIFFERENCE A B) C) (DIFFERENCE A (PLUS B C)))), which again simplifies, using linear arithmetic, applying the lemma DIFFERENCE-IS-0, and expanding EQUAL and LESSP, to: T. Case 2. (IMPLIES (LESSP A B) (EQUAL (DIFFERENCE (DIFFERENCE A B) C) (DIFFERENCE A (PLUS B C)))), which again simplifies, using linear arithmetic, applying the lemma DIFFERENCE-IS-0, and opening up the function EQUAL, to: T. Case 1. (IMPLIES (LESSP A (PLUS B C)) (EQUAL (DIFFERENCE (DIFFERENCE A B) C) (DIFFERENCE A (PLUS B C)))), which again simplifies, using linear arithmetic, applying the lemma DIFFERENCE-IS-0, and opening up EQUAL, to: (IMPLIES (AND (LESSP A (PLUS B C)) (LESSP A B)) (EQUAL (DIFFERENCE (DIFFERENCE A B) C) (DIFFERENCE A (PLUS B C)))). But this again simplifies, using linear arithmetic, rewriting with the lemma DIFFERENCE-IS-0, and expanding the definition of EQUAL, to: T. Q.E.D. [ 0.0 0.0 0.0 ] DIFFERENCE-DIFFERENCE-OTHER (PROVE-LEMMA QUOTIENT-PLUS-TIMES2 (REWRITE) (IMPLIES (NOT (ZEROP W)) (EQUAL (QUOTIENT (PLUS V (TIMES I W) (TIMES W J)) W) (PLUS I J (QUOTIENT V W)))) ((DISABLE QUOTIENT-PLUS-TIMES) (USE (QUOTIENT-PLUS-TIMES (I (PLUS I J)))))) This formula can be simplified, using the abbreviations ZEROP, NOT, IMPLIES, and PLUS-ASSOCIATES, to: (IMPLIES (AND (IMPLIES (NOT (ZEROP W)) (EQUAL (QUOTIENT (PLUS V (TIMES W (PLUS I J))) W) (PLUS I J (QUOTIENT V W)))) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (QUOTIENT (PLUS V (TIMES I W) (TIMES W J)) W) (PLUS I J (QUOTIENT V W)))), which simplifies, applying TIMES-COMMUTES1 and TIMES-DISTRIBUTES1, and unfolding the definitions of ZEROP, NOT, and IMPLIES, to: T. Q.E.D. [ 0.0 0.0 0.0 ] QUOTIENT-PLUS-TIMES2 (PROVE-LEMMA DIFFERENCE-ELIM (ELIM) (IMPLIES (AND (NUMBERP I) (NOT (LESSP I J))) (EQUAL (PLUS J (DIFFERENCE I J)) I))) This conjecture simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] DIFFERENCE-ELIM (PROVE-LEMMA QUOTIENT-DIFFERENCE (REWRITE) (IMPLIES (AND (NOT (ZEROP W)) (NOT (LESSP A (TIMES W B)))) (EQUAL (QUOTIENT (DIFFERENCE A (TIMES W B)) W) (DIFFERENCE (QUOTIENT A W) B)))) This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to the formula: (IMPLIES (AND (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP A (TIMES W B)))) (EQUAL (QUOTIENT (DIFFERENCE A (TIMES W B)) W) (DIFFERENCE (QUOTIENT A W) B))). This simplifies, applying TIMES-COMMUTES1, to the formula: (IMPLIES (AND (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP A (TIMES B W)))) (EQUAL (QUOTIENT (DIFFERENCE A (TIMES B W)) W) (DIFFERENCE (QUOTIENT A W) B))). Appealing to the lemmas DIFFERENCE-ELIM and REMAINDER-QUOTIENT-ELIM, we now replace A by (PLUS (TIMES B W) X) to eliminate (DIFFERENCE A (TIMES B W)) and X by (PLUS V (TIMES W Z)) to eliminate (QUOTIENT X W) and (REMAINDER X W). We rely upon the type restriction lemma noted when DIFFERENCE was introduced, LESSP-REMAINDER, 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 goals: Case 2. (IMPLIES (AND (NOT (NUMBERP A)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP A (TIMES B W)))) (EQUAL (QUOTIENT (DIFFERENCE A (TIMES B W)) W) (DIFFERENCE (QUOTIENT A W) B))), which further simplifies, using linear arithmetic, rewriting with DIFFERENCE-IS-0, and opening up the functions LESSP, EQUAL, and QUOTIENT, to: T. Case 1. (IMPLIES (AND (NUMBERP Z) (NUMBERP V) (EQUAL (LESSP V W) (NOT (ZEROP W))) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS (TIMES B W) V (TIMES W Z)) (TIMES B W)))) (EQUAL Z (DIFFERENCE (QUOTIENT (PLUS (TIMES B W) V (TIMES W Z)) W) B))). However this further simplifies, rewriting with the lemmas PLUS-COMMUTES2, PLUS-COMMUTES1, QUOTIENT-PLUS-TIMES2, and DIFFERENCE-PLUS-CANCELLATION1, and expanding the functions ZEROP, NOT, QUOTIENT, EQUAL, and PLUS, to: T. Q.E.D. [ 0.0 0.0 0.0 ] QUOTIENT-DIFFERENCE (PROVE-LEMMA QUOTIENT-MONOTONIC-LEMMA (REWRITE) (IMPLIES (AND (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (LESSP X V)) (EQUAL (LESSP (PLUS Z1 (TIMES Y X)) (PLUS Z2 (TIMES V Y))) T)) ((INDUCT (LESSP X V)))) This conjecture can be simplified, using the abbreviations IMPLIES, NOT, OR, and AND, to three new conjectures: Case 3. (IMPLIES (AND (OR (EQUAL V 0) (NOT (NUMBERP V))) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (LESSP X V)) (EQUAL (LESSP (PLUS Z1 (TIMES Y X)) (PLUS Z2 (TIMES V Y))) T)), which simplifies, opening up the functions NOT, OR, EQUAL, and LESSP, to: T. Case 2. (IMPLIES (AND (NOT (EQUAL V 0)) (NUMBERP V) (OR (EQUAL X 0) (NOT (NUMBERP X))) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (LESSP X V)) (EQUAL (LESSP (PLUS Z1 (TIMES Y X)) (PLUS Z2 (TIMES V Y))) T)), which simplifies, appealing to the lemmas TIMES-COMMUTES1 and PLUS-COMMUTES1, and opening up the definitions of NOT, OR, EQUAL, LESSP, TIMES, and PLUS, to four new formulas: Case 2.4. (IMPLIES (AND (NOT (EQUAL V 0)) (NUMBERP V) (EQUAL X 0) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NOT (NUMBERP Z1))) (LESSP 0 (PLUS Z2 (TIMES V Y)))), which again simplifies, using linear arithmetic and rewriting with TIMES-MONOTONIC and TIMES-NON-NUMBERP, to: T. Case 2.3. (IMPLIES (AND (NOT (EQUAL V 0)) (NUMBERP V) (EQUAL X 0) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NUMBERP Z1)) (LESSP Z1 (PLUS Z2 (TIMES V Y)))). This again simplifies, obviously, to the new formula: (IMPLIES (AND (NOT (EQUAL V 0)) (NUMBERP V) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NUMBERP Z1)) (LESSP Z1 (PLUS Z2 (TIMES V Y)))), which we will name *1. Case 2.2. (IMPLIES (AND (NOT (EQUAL V 0)) (NUMBERP V) (NOT (NUMBERP X)) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NOT (NUMBERP Z1))) (LESSP 0 (PLUS Z2 (TIMES V Y)))). This again simplifies, using linear arithmetic and rewriting with TIMES-MONOTONIC and TIMES-NON-NUMBERP, to: T. Case 2.1. (IMPLIES (AND (NOT (EQUAL V 0)) (NUMBERP V) (NOT (NUMBERP X)) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NUMBERP Z1)) (LESSP Z1 (PLUS Z2 (TIMES V Y)))). Name the above subgoal *2. Case 1. (IMPLIES (AND (NOT (EQUAL V 0)) (NUMBERP V) (NOT (EQUAL X 0)) (NUMBERP X) (IMPLIES (AND (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (LESSP (SUB1 X) (SUB1 V))) (EQUAL (LESSP (PLUS Z1 (TIMES Y (SUB1 X))) (PLUS Z2 (TIMES (SUB1 V) Y))) T)) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (LESSP X V)) (EQUAL (LESSP (PLUS Z1 (TIMES Y X)) (PLUS Z2 (TIMES V Y))) T)). This simplifies, applying the lemmas TIMES-COMMUTES1 and PLUS-COMMUTES2, and opening up NOT, AND, IMPLIES, LESSP, and TIMES, to the new goal: (IMPLIES (AND (NOT (EQUAL V 0)) (NUMBERP V) (NOT (EQUAL X 0)) (NUMBERP X) (LESSP (PLUS Z1 (TIMES Y (SUB1 X))) (PLUS Z2 (TIMES Y (SUB1 V)))) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (LESSP (SUB1 X) (SUB1 V))) (LESSP (PLUS Y Z1 (TIMES Y (SUB1 X))) (PLUS Y Z2 (TIMES Y (SUB1 V))))), which again simplifies, using linear arithmetic, to: T. So next consider: (IMPLIES (AND (NOT (EQUAL V 0)) (NUMBERP V) (NOT (NUMBERP X)) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NUMBERP Z1)) (LESSP Z1 (PLUS Z2 (TIMES V Y)))), named *2 above. Ah ha! This conjecture is subsumed by another subgoal awaiting our attention, namely *1 above. So next consider: (IMPLIES (AND (NOT (EQUAL V 0)) (NUMBERP V) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NUMBERP Z1)) (LESSP Z1 (PLUS Z2 (TIMES V Y)))), which is formula *1 above. We will try to prove it by 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 V) (p Z1 Z2 V Y)) (IMPLIES (AND (NOT (ZEROP V)) (p Z1 Z2 (SUB1 V) Y)) (p Z1 Z2 V Y))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP establish that the measure (COUNT V) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to three new formulas: Case 3. (IMPLIES (AND (ZEROP V) (NOT (EQUAL V 0)) (NUMBERP V) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NUMBERP Z1)) (LESSP Z1 (PLUS Z2 (TIMES V Y)))), which simplifies, unfolding the definition of ZEROP, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP V)) (EQUAL (SUB1 V) 0) (NOT (EQUAL V 0)) (NUMBERP V) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NUMBERP Z1)) (LESSP Z1 (PLUS Z2 (TIMES V Y)))), which simplifies, applying PLUS-COMMUTES2, and opening up the definitions of ZEROP and TIMES, to: (IMPLIES (AND (EQUAL (SUB1 V) 0) (NOT (EQUAL V 0)) (NUMBERP V) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NUMBERP Z1)) (LESSP Z1 (PLUS Y Z2 (TIMES (SUB1 V) Y)))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP V)) (LESSP Z1 (PLUS Z2 (TIMES (SUB1 V) Y))) (NOT (EQUAL V 0)) (NUMBERP V) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NUMBERP Z1)) (LESSP Z1 (PLUS Z2 (TIMES V Y)))), which simplifies, rewriting with PLUS-COMMUTES2, and expanding the functions ZEROP and TIMES, to: (IMPLIES (AND (LESSP Z1 (PLUS Z2 (TIMES (SUB1 V) Y))) (NOT (EQUAL V 0)) (NUMBERP V) (LESSP Z1 Y) (LESSP Z2 Y) (NOT (EQUAL Y 0)) (NUMBERP Y) (NUMBERP Z1)) (LESSP Z1 (PLUS Y Z2 (TIMES (SUB1 V) Y)))), which again simplifies, using linear arithmetic, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] QUOTIENT-MONOTONIC-LEMMA (PROVE-LEMMA NTR*-ALG-LEMMA2-HACK1 (REWRITE) (IMPLIES (AND (LESSP N (QUOTIENT (PLUS R X) W)) (NUMBERP X) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS TS (TIMES N W)) (PLUS R TS X))) (NUMBERP N) (NUMBERP TS) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS TS X) TS)) (LESSP (PLUS TS X) (PLUS TS W))) (EQUAL (EQUAL (PLUS R TS X) (PLUS TS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R)))) T)) ((DISABLE TIMES-MONOTONIC) (USE (TIMES-MONOTONIC (A N) (B (QUOTIENT (PLUS R X) W)) (W W))))) This conjecture simplifies, applying the lemmas TIMES-COMMUTES1 and NSIG*-ALG-LEMMA-HACK1, and expanding the functions ZEROP, NOT, AND, and IMPLIES, to: T. Q.E.D. [ 0.0 0.0 0.0 ] NTR*-ALG-LEMMA2-HACK1 (PROVE-LEMMA NOT-LESSP-TIMES-QUOTIENT-OTHER (REWRITE) (IMPLIES (NOT (LESSP X R)) (NOT (LESSP (TIMES R (QUOTIENT X R)) R)))) WARNING: Note that the proposed lemma NOT-LESSP-TIMES-QUOTIENT-OTHER is to be stored as zero type prescription rules, zero compound recognizer rules, one linear rule, and zero replacement rules. . Applying the lemma REMAINDER-QUOTIENT-ELIM, replace X by (PLUS V (TIMES R Z)) to eliminate (QUOTIENT X R) and (REMAINDER X R). We rely upon LESSP-REMAINDER, 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 conjectures: Case 2. (IMPLIES (AND (NOT (NUMBERP X)) (NOT (LESSP X R))) (NOT (LESSP (TIMES R (QUOTIENT X R)) R))). This simplifies, rewriting with TIMES-NON-NUMBERP and TIMES-COMMUTES1, and opening up the definitions of LESSP, EQUAL, QUOTIENT, and TIMES, to: T. Case 1. (IMPLIES (AND (NUMBERP Z) (NUMBERP V) (EQUAL (LESSP V R) (NOT (ZEROP R))) (NOT (LESSP (PLUS V (TIMES R Z)) R))) (NOT (LESSP (TIMES R Z) R))). This simplifies, applying the lemma PLUS-COMMUTES1, and unfolding ZEROP, NOT, TIMES, EQUAL, PLUS, and LESSP, to: (IMPLIES (AND (NUMBERP Z) (NUMBERP V) (NOT (EQUAL R 0)) (NUMBERP R) (EQUAL (LESSP V R) T) (NOT (LESSP (PLUS V (TIMES R Z)) R))) (NOT (LESSP (TIMES R Z) R))). This again simplifies, clearly, to: (IMPLIES (AND (NUMBERP Z) (NUMBERP V) (NOT (EQUAL R 0)) (NUMBERP R) (LESSP V R) (NOT (LESSP (PLUS V (TIMES R Z)) R))) (NOT (LESSP (TIMES R Z) R))), 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 (LESSP X R)) (NOT (LESSP (TIMES R (QUOTIENT X R)) R))). We named this *1. We will try to prove it by induction. The recursive terms in the conjecture suggest five inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP R) (p R X)) (IMPLIES (AND (NOT (ZEROP R)) (LESSP X R)) (p R X)) (IMPLIES (AND (NOT (ZEROP R)) (NOT (LESSP X R)) (p R (DIFFERENCE X R))) (p R X))). Linear arithmetic, the lemmas COUNT-NUMBERP and COUNT-NOT-LESSP, and the definition of ZEROP inform us that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to three new formulas: Case 3. (IMPLIES (AND (ZEROP R) (NOT (LESSP X R))) (NOT (LESSP (TIMES R (QUOTIENT X R)) R))), which simplifies, appealing to the lemmas TIMES-NON-NUMBERP and TIMES-COMMUTES1, and expanding ZEROP, EQUAL, LESSP, QUOTIENT, and TIMES, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP R)) (LESSP (DIFFERENCE X R) R) (NOT (LESSP X R))) (NOT (LESSP (TIMES R (QUOTIENT X R)) R))), which simplifies, rewriting with TIMES-ADD1, and unfolding the functions ZEROP and QUOTIENT, to: (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (LESSP (DIFFERENCE X R) R) (NOT (LESSP X R))) (NOT (LESSP (PLUS R (TIMES R (QUOTIENT (DIFFERENCE X R) R))) R))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP R)) (NOT (LESSP (TIMES R (QUOTIENT (DIFFERENCE X R) R)) R)) (NOT (LESSP X R))) (NOT (LESSP (TIMES R (QUOTIENT X R)) R))), which simplifies, rewriting with the lemma TIMES-ADD1, and expanding the definitions of ZEROP and QUOTIENT, to: (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (TIMES R (QUOTIENT (DIFFERENCE X R) R)) R)) (NOT (LESSP X R))) (NOT (LESSP (PLUS R (TIMES R (QUOTIENT (DIFFERENCE X R) R))) R))). But this again simplifies, using linear arithmetic, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] NOT-LESSP-TIMES-QUOTIENT-OTHER (PROVE-LEMMA QUOTIENT-MONOTONIC (REWRITE) (IMPLIES (AND (NOT (ZEROP W)) (NOT (LESSP A B))) (EQUAL (LESSP (QUOTIENT A W) (QUOTIENT B W)) F))) This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP A B))) (EQUAL (LESSP (QUOTIENT A W) (QUOTIENT B W)) F)), which simplifies, obviously, to: (IMPLIES (AND (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP A B))) (NOT (LESSP (QUOTIENT A W) (QUOTIENT B W)))). Applying the lemma REMAINDER-QUOTIENT-ELIM, replace A by (PLUS Z (TIMES W X)) to eliminate (QUOTIENT A W) and (REMAINDER A W). We use LESSP-REMAINDER, 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 two new formulas: Case 2. (IMPLIES (AND (NOT (NUMBERP A)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP A B))) (NOT (LESSP (QUOTIENT A W) (QUOTIENT B W)))). However this further simplifies, expanding LESSP, QUOTIENT, and EQUAL, to: T. Case 1. (IMPLIES (AND (NUMBERP X) (NUMBERP Z) (EQUAL (LESSP Z W) (NOT (ZEROP W))) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS Z (TIMES W X)) B))) (NOT (LESSP X (QUOTIENT B W)))), which further simplifies, opening up ZEROP and NOT, to: (IMPLIES (AND (NUMBERP X) (NUMBERP Z) (LESSP Z W) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS Z (TIMES W X)) B))) (NOT (LESSP X (QUOTIENT B W)))). Appealing to the lemma REMAINDER-QUOTIENT-ELIM, we now replace B by (PLUS D (TIMES W V)) to eliminate (QUOTIENT B W) and (REMAINDER B W). We rely upon LESSP-REMAINDER, 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 two new goals: Case 1.2. (IMPLIES (AND (NOT (NUMBERP B)) (NUMBERP X) (NUMBERP Z) (LESSP Z W) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS Z (TIMES W X)) B))) (NOT (LESSP X (QUOTIENT B W)))), which further simplifies, unfolding the functions LESSP, QUOTIENT, and EQUAL, to: T. Case 1.1. (IMPLIES (AND (NUMBERP V) (NUMBERP D) (EQUAL (LESSP D W) (NOT (ZEROP W))) (NUMBERP X) (NUMBERP Z) (LESSP Z W) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS Z (TIMES W X)) (PLUS D (TIMES W V))))) (NOT (LESSP X V))), which further simplifies, applying TIMES-COMMUTES1 and QUOTIENT-MONOTONIC-LEMMA, and expanding the definitions of ZEROP and NOT, to: T. Q.E.D. [ 0.0 0.1 0.0 ] QUOTIENT-MONOTONIC (PROVE-LEMMA NLST*-ALG-LEMMA2-HACK1 (REWRITE) (IMPLIES (AND (NUMBERP X) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS TS (TIMES N W)) (PLUS R TS X))) (NUMBERP N) (NUMBERP TS) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS TS X) TS)) (LESSP (PLUS TS X) (PLUS TS W))) (EQUAL (PLUS (QUOTIENT (PLUS R X) W) (QUOTIENT (DIFFERENCE (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) (TIMES W (QUOTIENT (PLUS R X) W))) W)) (QUOTIENT (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) W))) ((DISABLE QUOTIENT-DIFFERENCE) (USE (QUOTIENT-DIFFERENCE (W W) (A (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R)))) (B (QUOTIENT (PLUS R X) W)))))) WARNING: Note that NLST*-ALG-LEMMA2-HACK1 contains the free variable TS which will be chosen by instantiating the hypothesis: (NOT (LESSP (PLUS TS (TIMES N W)) (PLUS R TS X))). WARNING: the previously added lemma, PLUS-COMMUTES1, could be applied whenever the newly proposed NLST*-ALG-LEMMA2-HACK1 could! This conjecture simplifies, unfolding the definitions of ZEROP, NOT, AND, and IMPLIES, to the following two new conjectures: Case 2. (IMPLIES (AND (LESSP (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) (TIMES W (QUOTIENT (PLUS R X) W))) (NUMBERP X) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS TS (TIMES N W)) (PLUS R TS X))) (NUMBERP N) (NUMBERP TS) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS TS X) TS)) (LESSP (PLUS TS X) (PLUS TS W))) (EQUAL (PLUS (QUOTIENT (PLUS R X) W) (QUOTIENT (DIFFERENCE (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) (TIMES W (QUOTIENT (PLUS R X) W))) W)) (QUOTIENT (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) W))). However this again simplifies, using linear arithmetic and applying NOT-LESSP-TIMES-QUOTIENT-OTHER and NOT-LESSP-TIMES-QUOTIENT, to: T. Case 1. (IMPLIES (AND (EQUAL (QUOTIENT (DIFFERENCE (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) (TIMES W (QUOTIENT (PLUS R X) W))) W) (DIFFERENCE (QUOTIENT (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) W) (QUOTIENT (PLUS R X) W))) (NUMBERP X) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS TS (TIMES N W)) (PLUS R TS X))) (NUMBERP N) (NUMBERP TS) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS TS X) TS)) (LESSP (PLUS TS X) (PLUS TS W))) (EQUAL (PLUS (QUOTIENT (PLUS R X) W) (DIFFERENCE (QUOTIENT (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) W) (QUOTIENT (PLUS R X) W))) (QUOTIENT (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) W))). However this again simplifies, using linear arithmetic, to: (IMPLIES (AND (LESSP (QUOTIENT (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) W) (QUOTIENT (PLUS R X) W)) (EQUAL (QUOTIENT (DIFFERENCE (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) (TIMES W (QUOTIENT (PLUS R X) W))) W) (DIFFERENCE (QUOTIENT (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) W) (QUOTIENT (PLUS R X) W))) (NUMBERP X) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS TS (TIMES N W)) (PLUS R TS X))) (NUMBERP N) (NUMBERP TS) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS TS X) TS)) (LESSP (PLUS TS X) (PLUS TS W))) (EQUAL (PLUS (QUOTIENT (PLUS R X) W) (DIFFERENCE (QUOTIENT (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) W) (QUOTIENT (PLUS R X) W))) (QUOTIENT (PLUS X (TIMES R (QUOTIENT (DIFFERENCE (TIMES N W) X) R))) W))). However this again simplifies, using linear arithmetic and rewriting with NOT-LESSP-TIMES-QUOTIENT-OTHER and QUOTIENT-MONOTONIC, to: T. Q.E.D. [ 0.0 0.3 0.0 ] NLST*-ALG-LEMMA2-HACK1 (PROVE-LEMMA NSIG*-UPPER-BOUND-LEMMA1 (REWRITE) (IMPLIES (NOT (ZEROP R)) (NOT (LESSP (QUOTIENT (TIMES N W) R) (QUOTIENT (DIFFERENCE (TIMES N W) (DIFFERENCE TR TS)) R))))) WARNING: Note that the proposed lemma NSIG*-UPPER-BOUND-LEMMA1 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 the formula: (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R)) (NOT (LESSP (QUOTIENT (TIMES N W) R) (QUOTIENT (DIFFERENCE (TIMES N W) (DIFFERENCE TR TS)) R)))). Appealing to the lemma DIFFERENCE-ELIM, we now replace TR by (PLUS TS X) to eliminate (DIFFERENCE TR TS). We employ the type restriction lemma noted when DIFFERENCE was introduced to constrain the new variable. This generates three new conjectures: Case 3. (IMPLIES (AND (LESSP TR TS) (NOT (EQUAL R 0)) (NUMBERP R)) (NOT (LESSP (QUOTIENT (TIMES N W) R) (QUOTIENT (DIFFERENCE (TIMES N W) (DIFFERENCE TR TS)) R)))), which simplifies, using linear arithmetic, rewriting with DIFFERENCE-IS-0, and opening up the functions EQUAL and DIFFERENCE, to the following two new formulas: Case 3.2. (IMPLIES (AND (LESSP TR TS) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL (TIMES N W) 0))) (NOT (LESSP (QUOTIENT (TIMES N W) R) (QUOTIENT (TIMES N W) R)))). However this again simplifies, using linear arithmetic, to: T. Case 3.1. (IMPLIES (AND (LESSP TR TS) (NOT (EQUAL R 0)) (NUMBERP R) (EQUAL (TIMES N W) 0)) (NOT (LESSP (QUOTIENT (TIMES N W) R) (QUOTIENT 0 R)))), which again simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (NUMBERP TR)) (NOT (EQUAL R 0)) (NUMBERP R)) (NOT (LESSP (QUOTIENT (TIMES N W) R) (QUOTIENT (DIFFERENCE (TIMES N W) (DIFFERENCE TR TS)) R)))), which simplifies, using linear arithmetic, rewriting with DIFFERENCE-IS-0, and unfolding the functions EQUAL and DIFFERENCE, to the following two new goals: Case 2.2. (IMPLIES (AND (NOT (NUMBERP TR)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL (TIMES N W) 0))) (NOT (LESSP (QUOTIENT (TIMES N W) R) (QUOTIENT (TIMES N W) R)))). This again simplifies, using linear arithmetic, to: T. Case 2.1. (IMPLIES (AND (NOT (NUMBERP TR)) (NOT (EQUAL R 0)) (NUMBERP R) (EQUAL (TIMES N W) 0)) (NOT (LESSP (QUOTIENT (TIMES N W) R) (QUOTIENT 0 R)))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NUMBERP X) (NOT (LESSP (PLUS TS X) TS)) (NOT (EQUAL R 0)) (NUMBERP R)) (NOT (LESSP (QUOTIENT (TIMES N W) R) (QUOTIENT (DIFFERENCE (TIMES N W) X) R)))), which simplifies, using linear arithmetic and applying QUOTIENT-MONOTONIC, to the new conjecture: (IMPLIES (AND (NUMBERP X) (NOT (LESSP (PLUS TS X) TS)) (NOT (EQUAL R 0)) (NUMBERP R) (LESSP (TIMES N W) X)) (NOT (LESSP (QUOTIENT (TIMES N W) R) (QUOTIENT (DIFFERENCE (TIMES N W) X) R)))), which again simplifies, using linear arithmetic, applying DIFFERENCE-IS-0, and unfolding LESSP, EQUAL, and QUOTIENT, to: T. Q.E.D. [ 0.0 0.0 0.0 ] NSIG*-UPPER-BOUND-LEMMA1 (PROVE-LEMMA QUOTIENT-TIMES (REWRITE) (IMPLIES (NOT (ZEROP R)) (EQUAL (QUOTIENT (TIMES N R) R) (FIX N))) ((DISABLE QUOTIENT-PLUS-TIMES) (USE (QUOTIENT-PLUS-TIMES (W R) (V 0) (I N))))) This formula can be simplified, using the abbreviations ZEROP, NOT, and IMPLIES, to: (IMPLIES (AND (IMPLIES (NOT (ZEROP R)) (EQUAL (QUOTIENT (PLUS 0 (TIMES R N)) R) (PLUS N (QUOTIENT 0 R)))) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (QUOTIENT (TIMES N R) R) (FIX N))), which simplifies, applying the lemmas TIMES-COMMUTES1 and PLUS-COMMUTES1, and opening up the definitions of ZEROP, NOT, EQUAL, PLUS, LESSP, QUOTIENT, IMPLIES, TIMES, and FIX, to: T. Q.E.D. [ 0.0 0.0 0.0 ] QUOTIENT-TIMES (PROVE-LEMMA MULTIPLY-BOTH-SIDES-OF-LESSP (REWRITE) (IMPLIES (NOT (ZEROP R)) (EQUAL (LESSP (TIMES A R) (TIMES B R)) (LESSP A B)))) This conjecture can be simplified, using the abbreviations ZEROP, NOT, and IMPLIES, to: (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (TIMES A R) (TIMES B R)) (LESSP A B))). Name the above subgoal *1. Perhaps we can prove it by induction. There are four plausible inductions. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (ZEROP A) (p A R B)) (IMPLIES (AND (NOT (ZEROP A)) (p (SUB1 A) R (SUB1 B))) (p A R B))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP establish that the measure (COUNT A) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for B. The above induction scheme leads to the following two new goals: Case 2. (IMPLIES (AND (ZEROP A) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (TIMES A R) (TIMES B R)) (LESSP A B))). This simplifies, opening up ZEROP, EQUAL, TIMES, and LESSP, to the following six new conjectures: Case 2.6. (IMPLIES (AND (EQUAL A 0) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL B 0)) (EQUAL (PLUS R (TIMES (SUB1 B) R)) 0)) (EQUAL F (NUMBERP B))). This again simplifies, using linear arithmetic, to: T. Case 2.5. (IMPLIES (AND (EQUAL A 0) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL B 0)) (NOT (NUMBERP B))) (EQUAL F (NUMBERP B))), which again simplifies, clearly, to: T. Case 2.4. (IMPLIES (AND (EQUAL A 0) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL B 0)) (NUMBERP B) (NOT (EQUAL (PLUS R (TIMES (SUB1 B) R)) 0))) (EQUAL T (NUMBERP B))). This again simplifies, obviously, to: T. Case 2.3. (IMPLIES (AND (NOT (NUMBERP A)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL B 0)) (EQUAL (PLUS R (TIMES (SUB1 B) R)) 0)) (EQUAL F (NUMBERP B))). However this again simplifies, using linear arithmetic, to: T. Case 2.2. (IMPLIES (AND (NOT (NUMBERP A)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL B 0)) (NOT (NUMBERP B))) (EQUAL F (NUMBERP B))), which again simplifies, clearly, to: T. Case 2.1. (IMPLIES (AND (NOT (NUMBERP A)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL B 0)) (NUMBERP B) (NOT (EQUAL (PLUS R (TIMES (SUB1 B) R)) 0))) (EQUAL T (NUMBERP B))). This again simplifies, clearly, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP A)) (EQUAL (LESSP (TIMES (SUB1 A) R) (TIMES (SUB1 B) R)) (LESSP (SUB1 A) (SUB1 B))) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (TIMES A R) (TIMES B R)) (LESSP A B))). This simplifies, expanding ZEROP, TIMES, and LESSP, to the following three new goals: Case 1.3. (IMPLIES (AND (NOT (EQUAL A 0)) (NUMBERP A) (EQUAL (LESSP (TIMES (SUB1 A) R) (TIMES (SUB1 B) R)) (LESSP (SUB1 A) (SUB1 B))) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL B 0)) (NUMBERP B)) (EQUAL (LESSP (PLUS R (TIMES (SUB1 A) R)) (PLUS R (TIMES (SUB1 B) R))) (LESSP (SUB1 A) (SUB1 B)))). However this further simplifies, rewriting with TIMES-COMMUTES1, to the new formula: (IMPLIES (AND (NOT (EQUAL A 0)) (NUMBERP A) (EQUAL (LESSP (TIMES R (SUB1 A)) (TIMES R (SUB1 B))) (LESSP (SUB1 A) (SUB1 B))) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL B 0)) (NUMBERP B)) (EQUAL (LESSP (PLUS R (TIMES R (SUB1 A))) (PLUS R (TIMES R (SUB1 B)))) (LESSP (SUB1 A) (SUB1 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. This produces: (IMPLIES (AND (NUMBERP X) (NOT (EQUAL (ADD1 X) 0)) (EQUAL (LESSP (TIMES R X) (TIMES R (SUB1 B))) (LESSP X (SUB1 B))) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL B 0)) (NUMBERP B)) (EQUAL (LESSP (PLUS R (TIMES R X)) (PLUS R (TIMES R (SUB1 B)))) (LESSP X (SUB1 B)))), which further simplifies, clearly, to: (IMPLIES (AND (NUMBERP X) (EQUAL (LESSP (TIMES R X) (TIMES R (SUB1 B))) (LESSP X (SUB1 B))) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL B 0)) (NUMBERP B)) (EQUAL (LESSP (PLUS R (TIMES R X)) (PLUS R (TIMES R (SUB1 B)))) (LESSP X (SUB1 B)))). Applying the lemma SUB1-ELIM, replace B by (ADD1 Z) to eliminate (SUB1 B). We employ the type restriction lemma noted when SUB1 was introduced to restrict the new variable. We would thus like to prove the new conjecture: (IMPLIES (AND (NUMBERP Z) (NUMBERP X) (EQUAL (LESSP (TIMES R X) (TIMES R Z)) (LESSP X Z)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL (ADD1 Z) 0))) (EQUAL (LESSP (PLUS R (TIMES R X)) (PLUS R (TIMES R Z))) (LESSP X Z))), which further simplifies, obviously, to: (IMPLIES (AND (NUMBERP Z) (NUMBERP X) (EQUAL (LESSP (TIMES R X) (TIMES R Z)) (LESSP X Z)) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (PLUS R (TIMES R X)) (PLUS R (TIMES R Z))) (LESSP X Z))). We now use the above equality hypothesis by substituting: (LESSP (TIMES R X) (TIMES R Z)) for (LESSP X Z) and throwing away the equality. The result is: (IMPLIES (AND (NUMBERP Z) (NUMBERP X) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (PLUS R (TIMES R X)) (PLUS R (TIMES R Z))) (LESSP (TIMES R X) (TIMES R Z)))). We will try to prove the above formula by generalizing it, replacing (TIMES R Z) by Y and (TIMES R X) by U. We restrict the new variables by recalling the type restriction lemma noted when TIMES was introduced. This produces: (IMPLIES (AND (NUMBERP Y) (NUMBERP U) (NUMBERP Z) (NUMBERP X) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (PLUS R U) (PLUS R Y)) (LESSP U Y))), which has two irrelevant terms in it. By eliminating these terms we get the new formula: (IMPLIES (AND (NUMBERP Y) (NUMBERP U) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (PLUS R U) (PLUS R Y)) (LESSP U Y))), which we will finally name *1.1. Case 1.2. (IMPLIES (AND (NOT (EQUAL A 0)) (NUMBERP A) (EQUAL (LESSP (TIMES (SUB1 A) R) (TIMES (SUB1 B) R)) (LESSP (SUB1 A) (SUB1 B))) (NOT (EQUAL R 0)) (NUMBERP R) (EQUAL B 0)) (EQUAL (LESSP (PLUS R (TIMES (SUB1 A) R)) 0) F)). But this again simplifies, unfolding the functions SUB1, EQUAL, TIMES, and LESSP, to: T. Case 1.1. (IMPLIES (AND (NOT (EQUAL A 0)) (NUMBERP A) (EQUAL (LESSP (TIMES (SUB1 A) R) (TIMES (SUB1 B) R)) (LESSP (SUB1 A) (SUB1 B))) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NUMBERP B))) (EQUAL (LESSP (PLUS R (TIMES (SUB1 A) R)) 0) F)), which again simplifies, opening up EQUAL and LESSP, to: T. So next consider: (IMPLIES (AND (NUMBERP Y) (NUMBERP U) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (PLUS R U) (PLUS R Y)) (LESSP U Y))), which we named *1.1 above. Let us appeal to the induction principle. There are four plausible inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP R) (p R U Y)) (IMPLIES (AND (NOT (ZEROP R)) (p (SUB1 R) U Y)) (p R U Y))). Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definition of ZEROP can be used to prove that the measure (COUNT R) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme generates the following three new conjectures: Case 3. (IMPLIES (AND (ZEROP R) (NUMBERP Y) (NUMBERP U) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (PLUS R U) (PLUS R Y)) (LESSP U Y))). This simplifies, unfolding ZEROP, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP R)) (EQUAL (SUB1 R) 0) (NUMBERP Y) (NUMBERP U) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (PLUS R U) (PLUS R Y)) (LESSP U Y))). This simplifies, applying SUB1-ADD1, and unfolding ZEROP, PLUS, and LESSP, to: (IMPLIES (AND (EQUAL (SUB1 R) 0) (NUMBERP Y) (NUMBERP U) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (PLUS (SUB1 R) U) (PLUS (SUB1 R) Y)) (LESSP U Y))). But this again simplifies, unfolding the functions EQUAL and PLUS, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP R)) (EQUAL (LESSP (PLUS (SUB1 R) U) (PLUS (SUB1 R) Y)) (LESSP U Y)) (NUMBERP Y) (NUMBERP U) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (PLUS R U) (PLUS R Y)) (LESSP U Y))), which simplifies, applying SUB1-ADD1, and unfolding the functions ZEROP, PLUS, and LESSP, to: T. That finishes the proof of *1.1, which, in turn, also finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] MULTIPLY-BOTH-SIDES-OF-LESSP (PROVE-LEMMA LESSP-QUOTIENT-TO-LESSP-TIMES-LEMMA1 NIL (IMPLIES (AND (NOT (ZEROP R)) (NOT (LESSP (QUOTIENT X R) N))) (NOT (LESSP X (TIMES N R)))) ((DISABLE MULTIPLY-BOTH-SIDES-OF-LESSP) (USE (MULTIPLY-BOTH-SIDES-OF-LESSP (A (QUOTIENT X R)) (B N))))) This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (IMPLIES (NOT (ZEROP R)) (EQUAL (LESSP (TIMES (QUOTIENT X R) R) (TIMES N R)) (LESSP (QUOTIENT X R) N))) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (QUOTIENT X R) N))) (NOT (LESSP X (TIMES N R)))). This simplifies, applying TIMES-COMMUTES1, and unfolding the functions ZEROP, NOT, and IMPLIES, to the goal: (IMPLIES (AND (NOT (LESSP (TIMES R (QUOTIENT X R)) (TIMES N R))) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (QUOTIENT X R) N))) (NOT (LESSP X (TIMES N R)))). However this again simplifies, using linear arithmetic and rewriting with the lemma NOT-LESSP-TIMES-QUOTIENT, to: T. Q.E.D. [ 0.0 0.0 0.0 ] LESSP-QUOTIENT-TO-LESSP-TIMES-LEMMA1 (PROVE-LEMMA LESSP-QUOTIENT-TO-LESSP-TIMES-LEMMA2 NIL (IMPLIES (AND (NOT (ZEROP R)) (NOT (LESSP X (TIMES N R)))) (NOT (LESSP (QUOTIENT X R) N))) ((DISABLE QUOTIENT-MONOTONIC) (USE (QUOTIENT-MONOTONIC (A X) (B (TIMES N R)) (W R))))) This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (IMPLIES (AND (NOT (ZEROP R)) (NOT (LESSP X (TIMES N R)))) (EQUAL (LESSP (QUOTIENT X R) (QUOTIENT (TIMES N R) R)) F)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP X (TIMES N R)))) (NOT (LESSP (QUOTIENT X R) N))), which simplifies, applying QUOTIENT-TIMES, and opening up the functions ZEROP, NOT, AND, IMPLIES, TIMES, EQUAL, and LESSP, to: T. Q.E.D. [ 0.0 0.0 0.0 ] LESSP-QUOTIENT-TO-LESSP-TIMES-LEMMA2 (PROVE-LEMMA LESSP-QUOTIENT-TO-LESSP-TIMES (REWRITE) (IMPLIES (NOT (ZEROP R)) (EQUAL (LESSP (QUOTIENT X R) N) (LESSP X (TIMES N R)))) ((USE (LESSP-QUOTIENT-TO-LESSP-TIMES-LEMMA1) (LESSP-QUOTIENT-TO-LESSP-TIMES-LEMMA2)))) WARNING: the newly proposed lemma, LESSP-QUOTIENT-TO-LESSP-TIMES, could be applied whenever the previously added lemma QUOTIENT-MONOTONIC could. This formula can be simplified, using the abbreviations ZEROP, NOT, IMPLIES, and AND, to the new formula: (IMPLIES (AND (IMPLIES (AND (NOT (ZEROP R)) (NOT (LESSP (QUOTIENT X R) N))) (NOT (LESSP X (TIMES N R)))) (IMPLIES (AND (NOT (ZEROP R)) (NOT (LESSP X (TIMES N R)))) (NOT (LESSP (QUOTIENT X R) N))) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (LESSP (QUOTIENT X R) N) (LESSP X (TIMES N R)))), which simplifies, unfolding the definitions of ZEROP, NOT, AND, and IMPLIES, to: T. Q.E.D. [ 0.0 0.0 0.0 ] LESSP-QUOTIENT-TO-LESSP-TIMES (PROVE-LEMMA QUOTIENT-PLUS-TIMES1 (REWRITE) (IMPLIES (NOT (ZEROP R)) (EQUAL (QUOTIENT (PLUS (TIMES N R) Z) R) (PLUS N (QUOTIENT Z R)))) ((DISABLE QUOTIENT-PLUS-TIMES) (USE (QUOTIENT-PLUS-TIMES (V Z) (I N) (W R))))) This conjecture can be simplified, using the abbreviations ZEROP, NOT, and IMPLIES, to the formula: (IMPLIES (AND (IMPLIES (NOT (ZEROP R)) (EQUAL (QUOTIENT (PLUS Z (TIMES R N)) R) (PLUS N (QUOTIENT Z R)))) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (QUOTIENT (PLUS (TIMES N R) Z) R) (PLUS N (QUOTIENT Z R)))). This simplifies, rewriting with the lemmas TIMES-COMMUTES1 and PLUS-COMMUTES1, and unfolding the definitions of ZEROP, NOT, and IMPLIES, to: T. Q.E.D. [ 0.0 0.0 0.0 ] QUOTIENT-PLUS-TIMES1 (PROVE-LEMMA EQUAL-TIMES-0 (REWRITE) (EQUAL (EQUAL (TIMES I J) 0) (OR (ZEROP I) (ZEROP J)))) This simplifies, opening up the functions ZEROP and OR, to five new conjectures: Case 5. (IMPLIES (NOT (EQUAL (TIMES I J) 0)) (NUMBERP J)), which again simplifies, applying TIMES-NON-NUMBERP, and unfolding the function EQUAL, to: T. Case 4. (IMPLIES (NOT (EQUAL (TIMES I J) 0)) (NOT (EQUAL J 0))). However this again simplifies, applying TIMES-COMMUTES1, and unfolding the functions EQUAL and TIMES, to: T. Case 3. (IMPLIES (NOT (EQUAL (TIMES I J) 0)) (NUMBERP I)). This again simplifies, opening up the definitions of TIMES and EQUAL, to: T. Case 2. (IMPLIES (NOT (EQUAL (TIMES I J) 0)) (NOT (EQUAL I 0))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (EQUAL (TIMES I J) 0) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (EQUAL J 0))) (NOT (NUMBERP J))), 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 I) (p J I)) (IMPLIES (AND (NOT (ZEROP I)) (p J (SUB1 I))) (p J I))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be used to establish that the measure (COUNT I) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme produces three new conjectures: Case 3. (IMPLIES (AND (ZEROP I) (EQUAL (TIMES I J) 0) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (EQUAL J 0))) (NOT (NUMBERP J))), which simplifies, unfolding the function ZEROP, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP I)) (NOT (EQUAL (TIMES (SUB1 I) J) 0)) (EQUAL (TIMES I J) 0) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (EQUAL J 0))) (NOT (NUMBERP J))), which simplifies, opening up ZEROP and TIMES, to: (IMPLIES (AND (NOT (EQUAL (TIMES (SUB1 I) J) 0)) (EQUAL (PLUS J (TIMES (SUB1 I) J)) 0) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (EQUAL J 0))) (NOT (NUMBERP J))). But this again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP I)) (EQUAL (SUB1 I) 0) (EQUAL (TIMES I J) 0) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (EQUAL J 0))) (NOT (NUMBERP J))), which simplifies, expanding the definitions of ZEROP and TIMES, to the conjecture: (IMPLIES (AND (EQUAL (SUB1 I) 0) (EQUAL (PLUS J (TIMES (SUB1 I) J)) 0) (NOT (EQUAL I 0)) (NUMBERP I) (NOT (EQUAL J 0))) (NOT (NUMBERP J))). This again simplifies, using linear arithmetic, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] EQUAL-TIMES-0 (PROVE-LEMMA NSIG*-UPPER-BOUND-HACK1 (REWRITE) (IMPLIES (AND (NOT (ZEROP R)) (NOT (LESSP R (TIMES 18 DELTA))) (LESSP N 18)) (EQUAL (LESSP (TIMES N DELTA) R) T))) This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP R (TIMES 18 DELTA))) (LESSP N 18)) (EQUAL (LESSP (TIMES N DELTA) R) T)), which simplifies, applying TIMES-COMMUTES1, to: (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP R (TIMES 18 DELTA))) (LESSP N 18)) (LESSP (TIMES DELTA N) R)), which we will name *1. We will appeal to induction. The recursive terms in the conjecture suggest four inductions. They merge into three likely candidate inductions, two 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 (TIMES 18 DELTA) 0) (NOT (NUMBERP (TIMES 18 DELTA)))) (p DELTA N R)) (IMPLIES (AND (NOT (OR (EQUAL (TIMES 18 DELTA) 0) (NOT (NUMBERP (TIMES 18 DELTA))))) (OR (EQUAL R 0) (NOT (NUMBERP R)))) (p DELTA N R)) (IMPLIES (AND (NOT (OR (EQUAL (TIMES 18 DELTA) 0) (NOT (NUMBERP (TIMES 18 DELTA))))) (NOT (OR (EQUAL R 0) (NOT (NUMBERP R)))) (p DELTA N (SUB1 R))) (p DELTA N R))). Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions of OR and NOT can be used to show that the measure (COUNT R) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to five new formulas: Case 5. (IMPLIES (AND (OR (EQUAL (TIMES 18 DELTA) 0) (NOT (NUMBERP (TIMES 18 DELTA)))) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP R (TIMES 18 DELTA))) (LESSP N 18)) (LESSP (TIMES DELTA N) R)), which simplifies, applying the lemmas EQUAL-TIMES-0 and TIMES-NON-NUMBERP, and opening up the definitions of EQUAL, NUMBERP, NOT, OR, TIMES, and LESSP, to: T. Case 4. (IMPLIES (AND (NOT (OR (EQUAL (TIMES 18 DELTA) 0) (NOT (NUMBERP (TIMES 18 DELTA))))) (OR (EQUAL R 0) (NOT (NUMBERP R))) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP R (TIMES 18 DELTA))) (LESSP N 18)) (LESSP (TIMES DELTA N) R)), which simplifies, applying EQUAL-TIMES-0, and unfolding EQUAL, NUMBERP, NOT, and OR, to: T. Case 3. (IMPLIES (AND (NOT (OR (EQUAL (TIMES 18 DELTA) 0) (NOT (NUMBERP (TIMES 18 DELTA))))) (NOT (OR (EQUAL R 0) (NOT (NUMBERP R)))) (EQUAL (SUB1 R) 0) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP R (TIMES 18 DELTA))) (LESSP N 18)) (LESSP (TIMES DELTA N) R)). This simplifies, applying EQUAL-TIMES-0, and opening up the functions EQUAL, NUMBERP, NOT, OR, and LESSP, to: (IMPLIES (AND (NOT (EQUAL DELTA 0)) (NUMBERP DELTA) (EQUAL (SUB1 R) 0) (NOT (EQUAL R 0)) (NUMBERP R) (EQUAL (SUB1 (TIMES 18 DELTA)) 0) (LESSP N 18) (NOT (EQUAL N 0))) (NOT (NUMBERP N))). But this again simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (OR (EQUAL (TIMES 18 DELTA) 0) (NOT (NUMBERP (TIMES 18 DELTA))))) (NOT (OR (EQUAL R 0) (NOT (NUMBERP R)))) (LESSP (SUB1 R) (TIMES 18 DELTA)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP R (TIMES 18 DELTA))) (LESSP N 18)) (LESSP (TIMES DELTA N) R)), which simplifies, using linear arithmetic, to: (IMPLIES (AND (NOT (OR (EQUAL (TIMES 18 DELTA) 0) (NOT (NUMBERP (TIMES 18 DELTA))))) (NOT (OR (EQUAL (TIMES 18 DELTA) 0) (NOT (NUMBERP (TIMES 18 DELTA))))) (LESSP (SUB1 (TIMES 18 DELTA)) (TIMES 18 DELTA)) (NOT (EQUAL (TIMES 18 DELTA) 0)) (NUMBERP (TIMES 18 DELTA)) (NOT (LESSP (TIMES 18 DELTA) (TIMES 18 DELTA))) (LESSP N 18)) (LESSP (TIMES DELTA N) (TIMES 18 DELTA))). But this again simplifies, rewriting with the lemmas EQUAL-TIMES-0 and MULTIPLY-BOTH-SIDES-OF-LESSP, and expanding the definitions of EQUAL, NUMBERP, NOT, OR, and LESSP, to the conjecture: (IMPLIES (AND (NOT (EQUAL DELTA 0)) (NUMBERP DELTA) (LESSP (SUB1 (TIMES 18 DELTA)) (TIMES 18 DELTA)) (LESSP N 18)) (LESSP (TIMES DELTA N) (TIMES 18 DELTA))). This again simplifies, using linear arithmetic and applying TIMES-MONOTONIC and TIMES-COMMUTES1, to: T. Case 1. (IMPLIES (AND (NOT (OR (EQUAL (TIMES 18 DELTA) 0) (NOT (NUMBERP (TIMES 18 DELTA))))) (NOT (OR (EQUAL R 0) (NOT (NUMBERP R)))) (LESSP (TIMES DELTA N) (SUB1 R)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP R (TIMES 18 DELTA))) (LESSP N 18)) (LESSP (TIMES DELTA N) R)). This simplifies, using linear arithmetic, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] NSIG*-UPPER-BOUND-HACK1 (PROVE-LEMMA NSIG*-UPPER-BOUND-HACK2 (REWRITE) (IMPLIES (AND (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (ZEROP W)) (NOT (ZEROP R)) (NOT (ZEROP N)) (LESSP N 18) (LESSP W R)) (EQUAL (PLUS W (TIMES W (SUB1 N))) (PLUS (TIMES (SUB1 N) (DIFFERENCE R W)) (DIFFERENCE W (TIMES (SUB1 N) (DIFFERENCE R W))) (TIMES W (SUB1 N)))))) WARNING: Note that NSIG*-UPPER-BOUND-HACK2 contains the free variable R which will be chosen by instantiating the hypothesis: (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))). WARNING: the previously added lemma, PLUS-COMMUTES1, could be applied whenever the newly proposed NSIG*-UPPER-BOUND-HACK2 could! This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL N 0)) (NUMBERP N) (LESSP N 18) (LESSP W R)) (EQUAL (PLUS W (TIMES W (SUB1 N))) (PLUS (TIMES (SUB1 N) (DIFFERENCE R W)) (DIFFERENCE W (TIMES (SUB1 N) (DIFFERENCE R W))) (TIMES W (SUB1 N))))). This simplifies, using linear arithmetic, to: (IMPLIES (AND (LESSP W (TIMES (SUB1 N) (DIFFERENCE R W))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL N 0)) (NUMBERP N) (LESSP N 18) (LESSP W R)) (EQUAL (PLUS W (TIMES W (SUB1 N))) (PLUS (TIMES (SUB1 N) (DIFFERENCE R W)) (DIFFERENCE W (TIMES (SUB1 N) (DIFFERENCE R W))) (TIMES W (SUB1 N))))), which again simplifies, using linear arithmetic, applying the lemmas DIFFERENCE-IS-0 and PLUS-COMMUTES1, and unfolding the functions SUB1, NUMBERP, EQUAL, LESSP, and PLUS, to: (IMPLIES (AND (LESSP W (TIMES (SUB1 N) (DIFFERENCE R W))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL N 0)) (NUMBERP N) (LESSP (SUB1 N) 17) (LESSP W R)) (EQUAL (PLUS W (TIMES W (SUB1 N))) (PLUS (TIMES W (SUB1 N)) (TIMES (SUB1 N) (DIFFERENCE R W))))). Appealing to the lemma DIFFERENCE-ELIM, we now replace R by (PLUS W X) to eliminate (DIFFERENCE R W). We employ the type restriction lemma noted when DIFFERENCE was introduced to constrain the new variable. The result is two new conjectures: Case 2. (IMPLIES (AND (LESSP R W) (LESSP W (TIMES (SUB1 N) (DIFFERENCE R W))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL N 0)) (NUMBERP N) (LESSP (SUB1 N) 17) (LESSP W R)) (EQUAL (PLUS W (TIMES W (SUB1 N))) (PLUS (TIMES W (SUB1 N)) (TIMES (SUB1 N) (DIFFERENCE R W))))), which further simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NUMBERP X) (NOT (LESSP (PLUS W X) W)) (LESSP W (TIMES (SUB1 N) X)) (NOT (LESSP (PLUS (PLUS W X) (PLUS W X) (TIMES 17 (PLUS W X))) (PLUS W (TIMES 17 W)))) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 (PLUS W X)))) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL (PLUS W X) 0)) (NOT (EQUAL N 0)) (NUMBERP N) (LESSP (SUB1 N) 17) (LESSP W (PLUS W X))) (EQUAL (PLUS W (TIMES W (SUB1 N))) (PLUS (TIMES W (SUB1 N)) (TIMES (SUB1 N) X)))), which further simplifies, rewriting with the lemmas TIMES-COMMUTES1, TIMES-DISTRIBUTES1, PLUS-ASSOCIATES, and PLUS-COMMUTES2, to: (IMPLIES (AND (NUMBERP X) (NOT (LESSP (PLUS W X) W)) (LESSP W (TIMES X (SUB1 N))) (NOT (LESSP (PLUS W W X X (TIMES 17 W) (TIMES 17 X)) (PLUS W (TIMES 17 W)))) (NOT (LESSP (PLUS W (TIMES 17 W)) (PLUS (TIMES 17 W) (TIMES 17 X)))) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL (PLUS W X) 0)) (NOT (EQUAL N 0)) (NUMBERP N) (LESSP (SUB1 N) 17) (LESSP W (PLUS W X))) (EQUAL (PLUS W (TIMES W (SUB1 N))) (PLUS (TIMES W (SUB1 N)) (TIMES X (SUB1 N))))). This again simplifies, using linear arithmetic and rewriting with TIMES-MONOTONIC and TIMES-COMMUTES1, to: T. Q.E.D. [ 0.0 0.1 0.0 ] NSIG*-UPPER-BOUND-HACK2 (PROVE-LEMMA QUOTIENT-PLUS-TIMES3 (REWRITE) (IMPLIES (NOT (ZEROP (PLUS X Z (TIMES X N)))) (EQUAL (QUOTIENT (PLUS Z (TIMES X N) (TIMES Z N) (TIMES X N N)) (PLUS X Z (TIMES X N))) (PLUS N (QUOTIENT Z (PLUS X Z (TIMES N X)))))) ((DISABLE QUOTIENT-PLUS-TIMES) (USE (QUOTIENT-PLUS-TIMES (V Z) (W (PLUS X Z (TIMES X N))) (I N))))) This conjecture can be simplified, using the abbreviations ZEROP, NOT, and IMPLIES, to the formula: (IMPLIES (AND (IMPLIES (NOT (ZEROP (PLUS X Z (TIMES X N)))) (EQUAL (QUOTIENT (PLUS Z (TIMES (PLUS X Z (TIMES X N)) N)) (PLUS X Z (TIMES X N))) (PLUS N (QUOTIENT Z (PLUS X Z (TIMES X N)))))) (NOT (EQUAL (PLUS X Z (TIMES X N)) 0)) (NUMBERP (PLUS X Z (TIMES X N)))) (EQUAL (QUOTIENT (PLUS Z (TIMES X N) (TIMES Z N) (TIMES X N N)) (PLUS X Z (TIMES X N))) (PLUS N (QUOTIENT Z (PLUS X Z (TIMES N X)))))). This simplifies, using linear arithmetic, applying TIMES-COMMUTES1, TIMES-ASSOCIATES, TIMES-DISTRIBUTES2, DIFFERENCE-IS-0, TIMES-COMMUTES2, and PLUS-COMMUTES1, and unfolding the functions ZEROP, NOT, QUOTIENT, LESSP, EQUAL, ADD1, IMPLIES, SUB1, NUMBERP, and PLUS, to four new conjectures: Case 4. (IMPLIES (AND (NOT (LESSP Z (PLUS X Z (TIMES N X)))) (EQUAL (QUOTIENT (PLUS Z (TIMES N X) (TIMES N Z) (TIMES N N X)) (PLUS X Z (TIMES N X))) (PLUS N 1)) (NOT (EQUAL (PLUS X Z (TIMES N X)) 0)) (NOT (NUMBERP N))) (EQUAL (PLUS N 1) 1)), which again simplifies, applying PLUS-COMMUTES1, TIMES-NON-NUMBERP, and TIMES-COMMUTES1, and opening up the definitions of TIMES, EQUAL, PLUS, LESSP, QUOTIENT, SUB1, NUMBERP, and ADD1, to: T. Case 3. (IMPLIES (AND (NOT (LESSP Z (PLUS X Z (TIMES N X)))) (EQUAL (QUOTIENT (PLUS Z (TIMES N X) (TIMES N Z) (TIMES N N X)) (PLUS X Z (TIMES N X))) (PLUS N 1)) (NOT (EQUAL (PLUS X Z (TIMES N X)) 0)) (NUMBERP N)) (EQUAL (PLUS N 1) (ADD1 N))). However this again simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (LESSP Z (PLUS X Z (TIMES N X))) (EQUAL (QUOTIENT (PLUS Z (TIMES N X) (TIMES N Z) (TIMES N N X)) (PLUS X Z (TIMES N X))) (PLUS N 0)) (NOT (EQUAL (PLUS X Z (TIMES N X)) 0)) (NOT (NUMBERP N))) (EQUAL (PLUS N 0) 0)), which again simplifies, rewriting with the lemmas PLUS-COMMUTES1, TIMES-NON-NUMBERP, and TIMES-COMMUTES1, and expanding the definitions of TIMES, EQUAL, PLUS, LESSP, and QUOTIENT, to: T. Case 1. (IMPLIES (AND (LESSP Z (PLUS X Z (TIMES N X))) (EQUAL (QUOTIENT (PLUS Z (TIMES N X) (TIMES N Z) (TIMES N N X)) (PLUS X Z (TIMES N X))) (PLUS N 0)) (NOT (EQUAL (PLUS X Z (TIMES N X)) 0)) (NUMBERP N)) (EQUAL (PLUS N 0) N)), which again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] QUOTIENT-PLUS-TIMES3 (PROVE-LEMMA NSIG*-UPPER-BOUND-HACK3 (REWRITE) (IMPLIES (LESSP (PLUS Z (TIMES X (SUB1 N))) (PLUS X Z (TIMES X (SUB1 N)))) (EQUAL (LESSP Z (PLUS X Z (TIMES X (SUB1 N)))) T))) This conjecture simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] NSIG*-UPPER-BOUND-HACK3 (PROVE-LEMMA INTRO-DELTA NIL (IMPLIES (AND (NUMBERP W) (NOT (LESSP W R))) (EQUAL W (PLUS R (DIFFERENCE W R))))) This conjecture simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] INTRO-DELTA (PROVE-LEMMA NSIG*-UPPER-BOUND-LEMMA2-1 NIL (IMPLIES (AND (NUMBERP N) (NOT (ZEROP W)) (NOT (ZEROP R)) (RATE-PROXIMITY W R) (LESSP N 18) (NOT (LESSP W R))) (EQUAL (QUOTIENT (TIMES N W) R) N)) ((USE (INTRO-DELTA)))) This conjecture can be simplified, using the abbreviations RATE-PROXIMITY, ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (IMPLIES (AND (NUMBERP W) (NOT (LESSP W R))) (EQUAL W (PLUS R (DIFFERENCE W R)))) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (TIMES 18 W) (TIMES 17 R))) (NOT (LESSP (TIMES 19 R) (TIMES 18 W))) (LESSP N 18) (NOT (LESSP W R))) (EQUAL (QUOTIENT (TIMES N W) R) N)). This simplifies, unfolding the functions NOT, AND, IMPLIES, SUB1, NUMBERP, EQUAL, and TIMES, to: (IMPLIES (AND (EQUAL W (PLUS R (DIFFERENCE W R))) (NUMBERP N) (NOT (EQUAL W 0)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (LESSP N 18) (NOT (LESSP W R))) (EQUAL (QUOTIENT (TIMES N W) R) N)). Applying the lemma DIFFERENCE-ELIM, replace W by (PLUS R X) to eliminate (DIFFERENCE W R). We employ the type restriction lemma noted when DIFFERENCE was introduced to restrict the new variable. We thus obtain the following two new formulas: Case 2. (IMPLIES (AND (NOT (NUMBERP W)) (EQUAL W (PLUS R (DIFFERENCE W R))) (NUMBERP N) (NOT (EQUAL W 0)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (LESSP N 18) (NOT (LESSP W R))) (EQUAL (QUOTIENT (TIMES N W) R) N)). This further simplifies, trivially, to: T. Case 1. (IMPLIES (AND (NUMBERP X) (EQUAL (PLUS R X) (PLUS R X)) (NUMBERP N) (NOT (EQUAL (PLUS R X) 0)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS (PLUS R X) (TIMES 17 (PLUS R X))) (TIMES 17 R))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS (PLUS R X) (TIMES 17 (PLUS R X))))) (LESSP N 18) (NOT (LESSP (PLUS R X) R))) (EQUAL (QUOTIENT (TIMES N (PLUS R X)) R) N)). This further simplifies, appealing to the lemmas TIMES-DISTRIBUTES1, PLUS-ASSOCIATES, and QUOTIENT-PLUS-TIMES1, to: (IMPLIES (AND (NUMBERP X) (NUMBERP N) (NOT (EQUAL (PLUS R X) 0)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS R X (TIMES 17 R) (TIMES 17 X)) (TIMES 17 R))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS R X (TIMES 17 R) (TIMES 17 X)))) (LESSP N 18) (NOT (LESSP (PLUS R X) R))) (EQUAL (PLUS N (QUOTIENT (TIMES N X) R)) N)). This again simplifies, using linear arithmetic, rewriting with the lemmas NSIG*-UPPER-BOUND-HACK1 and PLUS-COMMUTES1, and unfolding the definitions of SUB1, NUMBERP, EQUAL, TIMES, QUOTIENT, and PLUS, to: T. Q.E.D. [ 0.0 0.1 0.0 ] NSIG*-UPPER-BOUND-LEMMA2-1 (PROVE-LEMMA NSIG*-UPPER-BOUND-LEMMA2-2 NIL (IMPLIES (AND (NUMBERP N) (NOT (ZEROP W)) (NOT (ZEROP R)) (RATE-PROXIMITY W R) (LESSP N 18) (LESSP W R)) (EQUAL (QUOTIENT (TIMES N W) R) (SUB1 N))) ((EXPAND (TIMES N W)))) This conjecture can be simplified, using the abbreviations RATE-PROXIMITY, ZEROP, NOT, AND, and IMPLIES, to the goal: (IMPLIES (AND (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (TIMES 18 W) (TIMES 17 R))) (NOT (LESSP (TIMES 19 R) (TIMES 18 W))) (LESSP N 18) (LESSP W R)) (EQUAL (QUOTIENT (TIMES N W) R) (SUB1 N))). This simplifies, using linear arithmetic, applying TIMES-COMMUTES1, PLUS-COMMUTES1, PLUS-COMMUTES2, and NSIG*-UPPER-BOUND-HACK2, and expanding the definitions of SUB1, NUMBERP, EQUAL, TIMES, LESSP, and QUOTIENT, to two new goals: Case 2. (IMPLIES (AND (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (LESSP (SUB1 N) 17) (LESSP W R) (NOT (EQUAL N 0))) (EQUAL (QUOTIENT (PLUS (TIMES W (SUB1 N)) (TIMES (SUB1 N) (DIFFERENCE R W)) (DIFFERENCE W (TIMES (SUB1 N) (DIFFERENCE R W)))) R) (SUB1 N))). Applying the lemma DIFFERENCE-ELIM, replace R by (PLUS W X) to eliminate (DIFFERENCE R W). We employ the type restriction lemma noted when DIFFERENCE was introduced to restrict the new variable. We thus obtain the following two new formulas: Case 2.2. (IMPLIES (AND (LESSP R W) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (LESSP (SUB1 N) 17) (LESSP W R) (NOT (EQUAL N 0))) (EQUAL (QUOTIENT (PLUS (TIMES W (SUB1 N)) (TIMES (SUB1 N) (DIFFERENCE R W)) (DIFFERENCE W (TIMES (SUB1 N) (DIFFERENCE R W)))) R) (SUB1 N))). This further simplifies, using linear arithmetic, to: T. Case 2.1. (IMPLIES (AND (NUMBERP X) (NOT (LESSP (PLUS W X) W)) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL (PLUS W X) 0)) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 (PLUS W X)))) (NOT (LESSP (PLUS (PLUS W X) (PLUS W X) (TIMES 17 (PLUS W X))) (PLUS W (TIMES 17 W)))) (LESSP (SUB1 N) 17) (LESSP W (PLUS W X)) (NOT (EQUAL N 0))) (EQUAL (QUOTIENT (PLUS (TIMES W (SUB1 N)) (TIMES (SUB1 N) X) (DIFFERENCE W (TIMES (SUB1 N) X))) (PLUS W X)) (SUB1 N))), which further simplifies, rewriting with TIMES-DISTRIBUTES1, PLUS-ASSOCIATES, PLUS-COMMUTES2, and TIMES-COMMUTES1, to: (IMPLIES (AND (NUMBERP X) (NOT (LESSP (PLUS W X) W)) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL (PLUS W X) 0)) (NOT (LESSP (PLUS W (TIMES 17 W)) (PLUS (TIMES 17 W) (TIMES 17 X)))) (NOT (LESSP (PLUS W W X X (TIMES 17 W) (TIMES 17 X)) (PLUS W (TIMES 17 W)))) (LESSP (SUB1 N) 17) (LESSP W (PLUS W X)) (NOT (EQUAL N 0))) (EQUAL (QUOTIENT (PLUS (TIMES W (SUB1 N)) (TIMES X (SUB1 N)) (DIFFERENCE W (TIMES X (SUB1 N)))) (PLUS W X)) (SUB1 N))). Applying the lemma DIFFERENCE-ELIM, replace W by: (PLUS (TIMES X (SUB1 N)) Z) to eliminate (DIFFERENCE W (TIMES X (SUB1 N))). We rely upon the type restriction lemma noted when DIFFERENCE was introduced to restrict the new variable. We thus obtain the following two new formulas: Case 2.1.2. (IMPLIES (AND (LESSP W (TIMES X (SUB1 N))) (NUMBERP X) (NOT (LESSP (PLUS W X) W)) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL (PLUS W X) 0)) (NOT (LESSP (PLUS W (TIMES 17 W)) (PLUS (TIMES 17 W) (TIMES 17 X)))) (NOT (LESSP (PLUS W W X X (TIMES 17 W) (TIMES 17 X)) (PLUS W (TIMES 17 W)))) (LESSP (SUB1 N) 17) (LESSP W (PLUS W X)) (NOT (EQUAL N 0))) (EQUAL (QUOTIENT (PLUS (TIMES W (SUB1 N)) (TIMES X (SUB1 N)) (DIFFERENCE W (TIMES X (SUB1 N)))) (PLUS W X)) (SUB1 N))). However this further simplifies, using linear arithmetic and rewriting with TIMES-MONOTONIC and TIMES-COMMUTES1, to: T. Case 2.1.1. (IMPLIES (AND (NUMBERP Z) (NOT (LESSP (PLUS (TIMES X (SUB1 N)) Z) (TIMES X (SUB1 N)))) (NUMBERP X) (NOT (LESSP (PLUS (PLUS (TIMES X (SUB1 N)) Z) X) (PLUS (TIMES X (SUB1 N)) Z))) (NUMBERP N) (NOT (EQUAL (PLUS (TIMES X (SUB1 N)) Z) 0)) (NOT (EQUAL (PLUS (PLUS (TIMES X (SUB1 N)) Z) X) 0)) (NOT (LESSP (PLUS (PLUS (TIMES X (SUB1 N)) Z) (TIMES 17 (PLUS (TIMES X (SUB1 N)) Z))) (PLUS (TIMES 17 (PLUS (TIMES X (SUB1 N)) Z)) (TIMES 17 X)))) (NOT (LESSP (PLUS (PLUS (TIMES X (SUB1 N)) Z) (PLUS (TIMES X (SUB1 N)) Z) X X (TIMES 17 (PLUS (TIMES X (SUB1 N)) Z)) (TIMES 17 X)) (PLUS (PLUS (TIMES X (SUB1 N)) Z) (TIMES 17 (PLUS (TIMES X (SUB1 N)) Z))))) (LESSP (SUB1 N) 17) (LESSP (PLUS (TIMES X (SUB1 N)) Z) (PLUS (PLUS (TIMES X (SUB1 N)) Z) X)) (NOT (EQUAL N 0))) (EQUAL (QUOTIENT (PLUS (TIMES (PLUS (TIMES X (SUB1 N)) Z) (SUB1 N)) (TIMES X (SUB1 N)) Z) (PLUS (PLUS (TIMES X (SUB1 N)) Z) X)) (SUB1 N))). This further simplifies, appealing to the lemmas PLUS-COMMUTES1, PLUS-COMMUTES2, PLUS-ASSOCIATES, TIMES-DISTRIBUTES1, TIMES-ASSOCIATES, TIMES-DISTRIBUTES2, TIMES-COMMUTES1, NSIG*-UPPER-BOUND-HACK3, and QUOTIENT-PLUS-TIMES3, and opening up the functions QUOTIENT, EQUAL, and PLUS, to: T. Case 1. (IMPLIES (AND (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (LESSP (SUB1 N) 17) (LESSP W R) (EQUAL N 0)) (EQUAL (QUOTIENT 0 R) (SUB1 N))), which again simplifies, unfolding the functions NUMBERP, SUB1, LESSP, EQUAL, and QUOTIENT, to: T. Q.E.D. [ 0.0 0.1 0.0 ] NSIG*-UPPER-BOUND-LEMMA2-2 (PROVE-LEMMA NSIG*-UPPER-BOUND-LEMMA2-EQUALITY (REWRITE) (IMPLIES (AND (NUMBERP N) (NOT (ZEROP W)) (NOT (ZEROP R)) (RATE-PROXIMITY W R) (LESSP N 18)) (EQUAL (QUOTIENT (TIMES N W) R) (IF (LESSP W R) (SUB1 N) N))) ((DISABLE TIMES) (USE (NSIG*-UPPER-BOUND-LEMMA2-1) (NSIG*-UPPER-BOUND-LEMMA2-2)))) This conjecture can be simplified, using the abbreviations RATE-PROXIMITY, ZEROP, NOT, IMPLIES, and AND, to the formula: (IMPLIES (AND (IMPLIES (AND (NUMBERP N) (NOT (ZEROP W)) (NOT (ZEROP R)) (RATE-PROXIMITY W R) (LESSP N 18) (NOT (LESSP W R))) (EQUAL (QUOTIENT (TIMES N W) R) N)) (IMPLIES (AND (NUMBERP N) (NOT (ZEROP W)) (NOT (ZEROP R)) (RATE-PROXIMITY W R) (LESSP N 18) (LESSP W R)) (EQUAL (QUOTIENT (TIMES N W) R) (SUB1 N))) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (TIMES 18 W) (TIMES 17 R))) (NOT (LESSP (TIMES 19 R) (TIMES 18 W))) (LESSP N 18)) (EQUAL (QUOTIENT (TIMES N W) R) (IF (LESSP W R) (SUB1 N) N))). This simplifies, applying the lemma EQUAL-TIMES-0, and unfolding ZEROP, NOT, RATE-PROXIMITY, SUB1, NUMBERP, EQUAL, LESSP, AND, IMPLIES, and QUOTIENT, to: T. Q.E.D. [ 0.0 0.1 0.0 ] NSIG*-UPPER-BOUND-LEMMA2-EQUALITY (PROVE-LEMMA NSIG*-UPPER-BOUND-LEMMA2 (REWRITE) (IMPLIES (AND (NUMBERP N) (NOT (ZEROP W)) (NOT (ZEROP R)) (RATE-PROXIMITY W R) (LESSP N 18)) (NOT (LESSP N (QUOTIENT (TIMES N W) R))))) WARNING: Note that the proposed lemma NSIG*-UPPER-BOUND-LEMMA2 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 RATE-PROXIMITY, ZEROP, NOT, AND, and IMPLIES, to the goal: (IMPLIES (AND (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (TIMES 18 W) (TIMES 17 R))) (NOT (LESSP (TIMES 19 R) (TIMES 18 W))) (LESSP N 18)) (NOT (LESSP N (QUOTIENT (TIMES N W) R)))). This simplifies, rewriting with NSIG*-UPPER-BOUND-LEMMA2-EQUALITY, and unfolding the functions SUB1, NUMBERP, EQUAL, TIMES, and RATE-PROXIMITY, to two new goals: Case 2. (IMPLIES (AND (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (LESSP N 18) (NOT (LESSP W R))) (NOT (LESSP N N))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (LESSP N 18) (LESSP W R)) (NOT (LESSP N (SUB1 N)))), which again simplifies, using linear arithmetic, to: (IMPLIES (AND (EQUAL N 0) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS W (TIMES 17 W)) (TIMES 17 R))) (NOT (LESSP (PLUS R R (TIMES 17 R)) (PLUS W (TIMES 17 W)))) (LESSP N 18) (LESSP W R)) (NOT (LESSP N (SUB1 N)))). This again simplifies, expanding the definitions of NUMBERP, LESSP, and SUB1, to: T. Q.E.D. [ 0.0 0.0 0.0 ] NSIG*-UPPER-BOUND-LEMMA2 (PROVE-LEMMA NSIG*-LOWER-BOUND-LEMMA1 (REWRITE) (IMPLIES (AND (NOT (ZEROP R)) (NOT (LESSP W TR-TS))) (NOT (LESSP (QUOTIENT (DIFFERENCE (TIMES N W) TR-TS) R) (QUOTIENT (TIMES (SUB1 N) W) R))))) WARNING: When the linear lemma NSIG*-LOWER-BOUND-LEMMA1 is stored under: (QUOTIENT (TIMES (SUB1 N) W) R) it contains the free variable TR-TS which will be chosen by instantiating the hypothesis (NOT (LESSP W TR-TS)). WARNING: Note that the proposed lemma NSIG*-LOWER-BOUND-LEMMA1 is to be stored as zero type prescription rules, zero compound recognizer rules, two linear rules, and zero replacement rules. This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to the new conjecture: (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP W TR-TS))) (NOT (LESSP (QUOTIENT (DIFFERENCE (TIMES N W) TR-TS) R) (QUOTIENT (TIMES (SUB1 N) W) R)))), which simplifies, rewriting with TIMES-COMMUTES1 and LESSP-QUOTIENT-TO-LESSP-TIMES, and opening up the function TIMES, to the following three new formulas: Case 3. (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP W TR-TS)) (NOT (EQUAL N 0)) (NUMBERP N)) (NOT (LESSP (DIFFERENCE (PLUS W (TIMES W (SUB1 N))) TR-TS) (TIMES R (QUOTIENT (TIMES W (SUB1 N)) R))))). This again simplifies, using linear arithmetic and applying NOT-LESSP-TIMES-QUOTIENT, to: T. Case 2. (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP W TR-TS)) (EQUAL N 0)) (NOT (LESSP (DIFFERENCE 0 TR-TS) (TIMES R (QUOTIENT (TIMES W (SUB1 N)) R))))). This again simplifies, using linear arithmetic, rewriting with the lemmas DIFFERENCE-IS-0 and TIMES-COMMUTES1, and expanding the functions SUB1, EQUAL, TIMES, LESSP, and QUOTIENT, to: T. Case 1. (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP W TR-TS)) (NOT (NUMBERP N))) (NOT (LESSP (DIFFERENCE 0 TR-TS) (TIMES R (QUOTIENT (TIMES W (SUB1 N)) R))))), which again simplifies, using linear arithmetic, rewriting with DIFFERENCE-IS-0, SUB1-NNUMBERP, and TIMES-COMMUTES1, and expanding EQUAL, TIMES, LESSP, and QUOTIENT, to: T. Q.E.D. [ 0.0 0.0 0.0 ] NSIG*-LOWER-BOUND-LEMMA1 (PROVE-LEMMA LESSP-TIMES (REWRITE) (IMPLIES (NOT (ZEROP N)) (NOT (LESSP (TIMES N W) W)))) WARNING: Note that the proposed lemma LESSP-TIMES is to be stored as zero type prescription rules, zero compound recognizer rules, one linear rule, and zero replacement rules. This formula can be simplified, using the abbreviations ZEROP, NOT, and IMPLIES, to: (IMPLIES (AND (NOT (EQUAL N 0)) (NUMBERP N)) (NOT (LESSP (TIMES N W) W))), which we will name *1. We will appeal to induction. There are two plausible inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP N) (p N W)) (IMPLIES (AND (NOT (ZEROP N)) (p (SUB1 N) W)) (p N W))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be used to show that the measure (COUNT N) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme produces three new conjectures: Case 3. (IMPLIES (AND (ZEROP N) (NOT (EQUAL N 0)) (NUMBERP N)) (NOT (LESSP (TIMES N W) W))), which simplifies, opening up the definition of ZEROP, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP N)) (EQUAL (SUB1 N) 0) (NOT (EQUAL N 0)) (NUMBERP N)) (NOT (LESSP (TIMES N W) W))), which simplifies, using linear arithmetic, rewriting with TIMES-MONOTONIC, PLUS-ASSOCIATES, EQUAL-TIMES-0, TIMES-DISTRIBUTES1, and PLUS-COMMUTES1, and opening up the functions PLUS, EQUAL, and TIMES, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP N)) (NOT (LESSP (TIMES (SUB1 N) W) W)) (NOT (EQUAL N 0)) (NUMBERP N)) (NOT (LESSP (TIMES N W) W))). This simplifies, using linear arithmetic, rewriting with the lemmas TIMES-MONOTONIC, PLUS-ASSOCIATES, and TIMES-DISTRIBUTES1, and opening up the function TIMES, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LESSP-TIMES (PROVE-LEMMA PLUS-CANCELLATION (REWRITE) (EQUAL (EQUAL (PLUS I J) (PLUS I K)) (EQUAL (FIX J) (FIX K)))) This conjecture simplifies, expanding the definition of FIX, to the following seven new formulas: Case 7. (IMPLIES (AND (NUMBERP K) (NUMBERP J) (NOT (EQUAL J K))) (NOT (EQUAL (PLUS I J) (PLUS I K)))). This again simplifies, using linear arithmetic, to: T. Case 6. (IMPLIES (AND (NUMBERP K) (NOT (NUMBERP J)) (NOT (EQUAL 0 K))) (NOT (EQUAL (PLUS I J) (PLUS I K)))), which we will name *1. Case 5. (IMPLIES (AND (NOT (NUMBERP K)) (NUMBERP J) (NOT (EQUAL J 0))) (NOT (EQUAL (PLUS I J) (PLUS I K)))), which we would usually push and work on later by induction. But if we must use induction to prove the input conjecture, we prefer to induct on the original formulation of the problem. Thus we will disregard all that we have previously done, give the name *1 to the original input, and work on it. So now let us consider: (EQUAL (EQUAL (PLUS I J) (PLUS I K)) (EQUAL (FIX J) (FIX K))). We gave this the name *1 above. Perhaps we can prove it by induction. Two inductions are suggested by terms in the conjecture. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (ZEROP I) (p I J K)) (IMPLIES (AND (NOT (ZEROP I)) (p (SUB1 I) J K)) (p I J K))). Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definition of ZEROP inform us that the measure (COUNT I) 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 I) (EQUAL (EQUAL (PLUS I J) (PLUS I K)) (EQUAL (FIX J) (FIX K)))). This simplifies, expanding the functions ZEROP, EQUAL, PLUS, and FIX, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP I)) (EQUAL (EQUAL (PLUS (SUB1 I) J) (PLUS (SUB1 I) K)) (EQUAL (FIX J) (FIX K)))) (EQUAL (EQUAL (PLUS I J) (PLUS I K)) (EQUAL (FIX J) (FIX K)))). This simplifies, rewriting with ADD1-EQUAL and PLUS-COMMUTES1, and unfolding the definitions of ZEROP, FIX, PLUS, and EQUAL, to two new goals: Case 1.2. (IMPLIES (AND (NOT (EQUAL I 0)) (NUMBERP I) (NOT (NUMBERP K)) (EQUAL J 0) (EQUAL (EQUAL (PLUS (SUB1 I) J) (PLUS (SUB1 I) K)) T)) (EQUAL I (ADD1 (PLUS (SUB1 I) K)))), which again simplifies, rewriting with the lemmas PLUS-COMMUTES1 and ADD1-SUB1, and opening up EQUAL and PLUS, to: T. Case 1.1. (IMPLIES (AND (NOT (EQUAL I 0)) (NUMBERP I) (NOT (NUMBERP J)) (EQUAL 0 K) (EQUAL (EQUAL (PLUS (SUB1 I) J) (PLUS (SUB1 I) K)) T)) (EQUAL (ADD1 (PLUS (SUB1 I) J)) I)), which again simplifies, appealing to the lemmas PLUS-COMMUTES1 and ADD1-SUB1, and expanding EQUAL and PLUS, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] PLUS-CANCELLATION (DEFN BOOLP (X) (OR (EQUAL X T) (EQUAL X F))) Observe that (OR (FALSEP (BOOLP X)) (TRUEP (BOOLP X))) is a theorem. [ 0.0 0.0 0.0 ] BOOLP (DISABLE BOOLP) [ 0.0 0.0 0.0 ] BOOLP-OFF (PROVE-LEMMA BOOLP-T (REWRITE) (IMPLIES (AND (BOOLP X) X) (EQUAL (EQUAL T X) T)) ((ENABLE BOOLP))) This simplifies, opening up the function BOOLP, to: T. Q.E.D. [ 0.0 0.0 0.0 ] BOOLP-T (DEFN B-NOT (X) (NOT X)) Observe that (OR (FALSEP (B-NOT X)) (TRUEP (B-NOT X))) is a theorem. [ 0.0 0.0 0.0 ] B-NOT (DISABLE B-NOT) [ 0.0 0.0 0.0 ] B-NOT-OFF (DEFN B-XOR (X Y) (IF X (NOT Y) (IF Y T F))) From the definition we can conclude that: (OR (FALSEP (B-XOR X Y)) (TRUEP (B-XOR X Y))) is a theorem. [ 0.0 0.0 0.0 ] B-XOR (DISABLE B-XOR) [ 0.0 0.0 0.0 ] B-XOR-OFF (PROVE-LEMMA B-XOR-B-NOT (REWRITE) (AND (B-XOR X (B-NOT X)) (B-XOR (B-NOT X) X)) ((ENABLE B-XOR B-NOT))) WARNING: Note that the proposed lemma B-XOR-B-NOT is to be stored as zero type prescription rules, zero compound recognizer rules, zero linear rules, and two replacement rules. This formula can be simplified, using the abbreviation AND, to the following two new formulas: Case 2. (B-XOR X (B-NOT X)). This simplifies, opening up B-NOT and B-XOR, to: T. Case 1. (B-XOR (B-NOT X) X). This simplifies, expanding the definitions of B-NOT and B-XOR, to: T. Q.E.D. [ 0.0 0.0 0.0 ] B-XOR-B-NOT (DEFN SMOOTH (PREV-VAL LST) (IF (NLISTP LST) NIL (IF (B-XOR PREV-VAL (CAR LST)) (CONS 'Q (SMOOTH (CAR LST) (CDR LST))) (CONS (CAR LST) (SMOOTH (CAR LST) (CDR LST)))))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each recursive call. Hence, SMOOTH is accepted under the principle of definition. Note that: (OR (LITATOM (SMOOTH PREV-VAL LST)) (LISTP (SMOOTH PREV-VAL LST))) is a theorem. [ 0.0 0.1 0.0 ] SMOOTH (DEFN RECONCILE-SIGNALS (A B) (IF (EQUAL A B) A 'Q)) Observe that: (OR (LITATOM (RECONCILE-SIGNALS A B)) (EQUAL (RECONCILE-SIGNALS A B) A)) is a theorem. [ 0.0 0.0 0.0 ] RECONCILE-SIGNALS (DEFN SIG (LST TS TR W) (IF (NLISTP LST) 'Q (IF (LESSP (PLUS TS W) TR) (RECONCILE-SIGNALS (CAR LST) (SIG (CDR LST) (PLUS TS W) TR W)) (CAR LST)))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP establish that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each recursive call. Hence, SIG is accepted under the principle of definition. [ 0.0 0.0 0.0 ] SIG (DEFN ENDP (LST TS TR W) (IF (NLISTP LST) T (IF (LESSP (PLUS TS W) TR) (ENDP (CDR LST) (PLUS TS W) TR W) F))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each recursive call. Hence, ENDP is accepted under the definitional principle. Observe that: (OR (FALSEP (ENDP LST TS TR W)) (TRUEP (ENDP LST TS TR W))) is a theorem. [ 0.0 0.0 0.0 ] ENDP (DEFN LST+ (LST TS NXTR W) (IF (NLISTP LST) LST (IF (LESSP NXTR (PLUS TS W)) LST (LST+ (CDR LST) (PLUS TS W) NXTR W)))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to establish that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each recursive call. Hence, LST+ is accepted under the principle of definition. [ 0.0 0.0 0.0 ] LST+ (DEFN TS+ (LST TS NXTR W) (IF (NLISTP LST) TS (IF (LESSP NXTR (PLUS TS W)) TS (TS+ (CDR LST) (PLUS TS W) NXTR W)))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to establish that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each recursive call. Hence, TS+ is accepted under the principle of definition. Note that: (OR (NUMBERP (TS+ LST TS NXTR W)) (EQUAL (TS+ LST TS NXTR W) TS)) is a theorem. [ 0.0 0.0 0.0 ] TS+ (PROVE-LEMMA LST+-WEAKLY-SHORTENS-LST (REWRITE) (NOT (LESSP (COUNT LST) (COUNT (LST+ LST TS TR W))))) WARNING: Note that the proposed lemma LST+-WEAKLY-SHORTENS-LST is to be stored as zero type prescription rules, zero compound recognizer rules, one linear rule, and zero replacement rules. Give the conjecture the name *1. We will try to prove it by induction. There is only one suggested induction. We will induct according to the following scheme: (AND (IMPLIES (NLISTP LST) (p LST TS TR W)) (IMPLIES (AND (NOT (NLISTP LST)) (LESSP TR (PLUS TS W))) (p LST TS TR W)) (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP TR (PLUS TS W))) (p (CDR LST) (PLUS TS W) TR W)) (p LST TS TR W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme generates three new goals: Case 3. (IMPLIES (NLISTP LST) (NOT (LESSP (COUNT LST) (COUNT (LST+ LST TS TR W))))), which simplifies, expanding NLISTP and LST+, to the goal: (IMPLIES (NOT (LISTP LST)) (NOT (LESSP (COUNT LST) (COUNT LST)))). However this again simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST)) (LESSP TR (PLUS TS W))) (NOT (LESSP (COUNT LST) (COUNT (LST+ LST TS TR W))))), which simplifies, unfolding the definitions of NLISTP and LST+, to the formula: (IMPLIES (AND (LISTP LST) (LESSP TR (PLUS TS W))) (NOT (LESSP (COUNT LST) (COUNT LST)))). But this again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP TR (PLUS TS W))) (NOT (LESSP (COUNT (CDR LST)) (COUNT (LST+ (CDR LST) (PLUS TS W) TR W))))) (NOT (LESSP (COUNT LST) (COUNT (LST+ LST TS TR W))))), which simplifies, opening up the definitions of NLISTP and LST+, to: (IMPLIES (AND (LISTP LST) (NOT (LESSP TR (PLUS TS W))) (NOT (LESSP (COUNT (CDR LST)) (COUNT (LST+ (CDR LST) (PLUS TS W) TR W))))) (NOT (LESSP (COUNT LST) (COUNT (LST+ (CDR LST) (PLUS TS W) TR W))))). But this again simplifies, using linear arithmetic and rewriting with CDR-LESSEQP, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LST+-WEAKLY-SHORTENS-LST (PROVE-LEMMA TS+-INCREASES-TR (REWRITE) (IMPLIES (AND (NOT (ENDP LST TS (PLUS R TR) W)) (NOT (ZEROP R)) (EQUAL (COUNT LST) (COUNT (LST+ LST TS (PLUS R TR) W)))) (EQUAL (LESSP (DIFFERENCE (PLUS W (TS+ LST TS (PLUS R TR) W)) (PLUS R TR)) (DIFFERENCE (PLUS TS W) TR)) T)) ((EXPAND (LST+ LST TS (PLUS R TR) W) (TS+ LST TS (PLUS R TR) W)))) This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to the new conjecture: (IMPLIES (AND (NOT (ENDP LST TS (PLUS R TR) W)) (NOT (EQUAL R 0)) (NUMBERP R) (EQUAL (COUNT LST) (COUNT (LST+ LST TS (PLUS R TR) W)))) (EQUAL (LESSP (DIFFERENCE (PLUS W (TS+ LST TS (PLUS R TR) W)) (PLUS R TR)) (DIFFERENCE (PLUS TS W) TR)) T)), which simplifies, rewriting with PLUS-COMMUTES1, and opening up LST+ and TS+, to the following five new conjectures: Case 5. (IMPLIES (AND (NOT (ENDP LST TS (PLUS R TR) W)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LISTP LST))) (LESSP (DIFFERENCE (PLUS TS W) (PLUS R TR)) (DIFFERENCE (PLUS TS W) TR))). However this again simplifies, using linear arithmetic, to: (IMPLIES (AND (LESSP (PLUS TS W) (PLUS R TR)) (NOT (ENDP LST TS (PLUS R TR) W)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LISTP LST))) (LESSP (DIFFERENCE (PLUS TS W) (PLUS R TR)) (DIFFERENCE (PLUS TS W) TR))). This again simplifies, opening up the function ENDP, to: T. Case 4. (IMPLIES (AND (NOT (ENDP LST TS (PLUS R TR) W)) (NOT (EQUAL R 0)) (NUMBERP R) (LESSP (PLUS R TR) (PLUS TS W))) (LESSP (DIFFERENCE (PLUS TS W) (PLUS R TR)) (DIFFERENCE (PLUS TS W) TR))), which again simplifies, using linear arithmetic, to: (IMPLIES (AND (LESSP (PLUS TS W) (PLUS R TR)) (NOT (ENDP LST TS (PLUS R TR) W)) (NOT (EQUAL R 0)) (NUMBERP R) (LESSP (PLUS R TR) (PLUS TS W))) (LESSP (DIFFERENCE (PLUS TS W) (PLUS R TR)) (DIFFERENCE (PLUS TS W) TR))). However this again simplifies, using linear arithmetic, to: T. Case 3. (IMPLIES (AND (NOT (ENDP LST TS (PLUS R TR) W)) (NOT (EQUAL R 0)) (NUMBERP R) (EQUAL (COUNT LST) (COUNT (LST+ (CDR LST) (PLUS TS W) (PLUS R TR) W))) (LESSP (PLUS R TR) (PLUS TS W))) (LESSP (DIFFERENCE (PLUS W TS) (PLUS R TR)) (DIFFERENCE (PLUS TS W) TR))), which again simplifies, using linear arithmetic, to: (IMPLIES (AND (LESSP (PLUS W TS) (PLUS R TR)) (NOT (ENDP LST TS (PLUS R TR) W)) (NOT (EQUAL R 0)) (NUMBERP R) (EQUAL (COUNT LST) (COUNT (LST+ (CDR LST) (PLUS TS W) (PLUS R TR) W))) (LESSP (PLUS R TR) (PLUS TS W))) (LESSP (DIFFERENCE (PLUS W TS) (PLUS R TR)) (DIFFERENCE (PLUS TS W) TR))). This again simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (ENDP LST TS (PLUS R TR) W)) (NOT (EQUAL R 0)) (NUMBERP R) (EQUAL (COUNT LST) (COUNT (LST+ (CDR LST) (PLUS TS W) (PLUS R TR) W))) (NOT (LISTP LST))) (LESSP (DIFFERENCE (PLUS W TS) (PLUS R TR)) (DIFFERENCE (PLUS TS W) TR))), which again simplifies, using linear arithmetic, to: (IMPLIES (AND (LESSP (PLUS W TS) (PLUS R TR)) (NOT (ENDP LST TS (PLUS R TR) W)) (NOT (EQUAL R 0)) (NUMBERP R) (EQUAL (COUNT LST) (COUNT (LST+ (CDR LST) (PLUS TS W) (PLUS R TR) W))) (NOT (LISTP LST))) (LESSP (DIFFERENCE (PLUS W TS) (PLUS R TR)) (DIFFERENCE (PLUS TS W) TR))). However this again simplifies, applying PLUS-COMMUTES1, and opening up the function ENDP, to: T. Case 1. (IMPLIES (AND (NOT (ENDP LST TS (PLUS R TR) W)) (NOT (EQUAL R 0)) (NUMBERP R) (EQUAL (COUNT LST) (COUNT (LST+ (CDR LST) (PLUS TS W) (PLUS R TR) W))) (LISTP LST) (NOT (LESSP (PLUS R TR) (PLUS TS W)))) (LESSP (DIFFERENCE (PLUS W (TS+ (CDR LST) (PLUS TS W) (PLUS R TR) W)) (PLUS R TR)) (DIFFERENCE (PLUS TS W) TR))). But this again simplifies, using linear arithmetic and rewriting with the lemmas CDR-LESSP and LST+-WEAKLY-SHORTENS-LST, to: T. Q.E.D. [ 0.0 0.1 0.0 ] TS+-INCREASES-TR (DEFN WARP (LST TS TR W R) (IF (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) NIL (CONS (SIG LST TS (PLUS TR R) W) (WARP (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R))) ((ORD-LESSP (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR))))) Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, TS+-INCREASES-TR, SUB1-ADD1, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LST+-WEAKLY-SHORTENS-LST, and the definitions of LISTP, ORDINALP, LESSP, ORD-LESSP, EQUAL, OR, and ZEROP establish that the measure: (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each recursive call. Hence, WARP is accepted under the principle of definition. From the definition we can conclude that: (OR (LITATOM (WARP LST TS TR W R)) (LISTP (WARP LST TS TR W R))) is a theorem. [ 0.0 0.0 0.0 ] WARP (DEFN DET (LST ORACLE) (IF (NLISTP LST) LST (IF (EQUAL (CAR LST) 'Q) (CONS (IF (CAR ORACLE) T F) (DET (CDR LST) (CDR ORACLE))) (CONS (CAR LST) (DET (CDR LST) ORACLE))))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to establish that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each recursive call. Hence, DET is accepted under the definitional principle. Note that: (OR (LISTP (DET LST ORACLE)) (EQUAL (DET LST ORACLE) LST)) is a theorem. [ 0.0 0.0 0.0 ] DET (DEFN ASYNC (LST TS TR W R ORACLE) (DET (WARP (SMOOTH T LST) TS TR W R) ORACLE)) Note that: (OR (LITATOM (ASYNC LST TS TR W R ORACLE)) (LISTP (ASYNC LST TS TR W R ORACLE))) is a theorem. [ 0.0 0.0 0.0 ] ASYNC (DEFN LISTN (N VALUE) (IF (ZEROP N) NIL (CONS VALUE (LISTN (SUB1 N) VALUE)))) 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, LISTN is accepted under the definitional principle. From the definition we can conclude that: (OR (LITATOM (LISTN N VALUE)) (LISTP (LISTN N VALUE))) is a theorem. [ 0.0 0.0 0.0 ] LISTN (DEFN CSIG (PREV-SIGNAL BIT) (IF BIT PREV-SIGNAL (B-NOT PREV-SIGNAL))) Observe that: (OR (OR (FALSEP (CSIG PREV-SIGNAL BIT)) (TRUEP (CSIG PREV-SIGNAL BIT))) (EQUAL (CSIG PREV-SIGNAL BIT) PREV-SIGNAL)) is a theorem. [ 0.0 0.0 0.0 ] CSIG (DEFN CELL (PREV-SIGNAL N1 N2 BIT) (APP (LISTN N1 (B-NOT PREV-SIGNAL)) (LISTN N2 (CSIG PREV-SIGNAL BIT)))) Note that: (OR (LITATOM (CELL PREV-SIGNAL N1 N2 BIT)) (LISTP (CELL PREV-SIGNAL N1 N2 BIT))) is a theorem. [ 0.0 0.0 0.0 ] CELL (DEFN CELLS (PREV-SIGNAL N1 N2 MSG) (IF (NLISTP MSG) NIL (APP (CELL PREV-SIGNAL N1 N2 (CAR MSG)) (CELLS (CSIG PREV-SIGNAL (CAR MSG)) N1 N2 (CDR MSG))))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT MSG) decreases according to the well-founded relation LESSP in each recursive call. Hence, CELLS is accepted under the definitional principle. Observe that: (OR (LITATOM (CELLS PREV-SIGNAL N1 N2 MSG)) (LISTP (CELLS PREV-SIGNAL N1 N2 MSG))) is a theorem. [ 0.0 0.0 0.0 ] CELLS (DEFN SEND (MSG PAD1 N1 N2 PAD2) (APP (LISTN PAD1 T) (APP (CELLS T N1 N2 MSG) (LISTN PAD2 T)))) Observe that: (OR (LITATOM (SEND MSG PAD1 N1 N2 PAD2)) (LISTP (SEND MSG PAD1 N1 N2 PAD2))) is a theorem. [ 0.0 0.0 0.0 ] SEND (DEFN SCAN (PREV-SIGNAL LST) (IF (NLISTP LST) NIL (IF (B-XOR PREV-SIGNAL (CAR LST)) LST (SCAN PREV-SIGNAL (CDR LST))))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to establish that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each recursive call. Hence, SCAN is accepted under the principle of definition. Note that: (OR (LITATOM (SCAN PREV-SIGNAL LST)) (LISTP (SCAN PREV-SIGNAL LST))) is a theorem. [ 0.0 0.0 0.0 ] SCAN (DEFN CDRN (N LST) (IF (ZEROP N) LST (CDRN (SUB1 N) (CDR LST)))) 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, CDRN is accepted under the principle of definition. [ 0.0 0.0 0.0 ] CDRN (DEFN NTH (N LST) (CAR (CDRN N LST))) [ 0.0 0.0 0.0 ] NTH (DEFN RECV-BIT (K LST) (IF (B-XOR (CAR LST) (NTH K LST)) T F)) Note that (OR (FALSEP (RECV-BIT K LST)) (TRUEP (RECV-BIT K LST))) is a theorem. [ 0.0 0.0 0.0 ] RECV-BIT (DEFN RECV (I FLG K LST) (IF (ZEROP I) NIL (CONS (RECV-BIT K (SCAN FLG LST)) (RECV (SUB1 I) (NTH K (SCAN FLG LST)) K (CDRN K (SCAN FLG LST)))))) Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform us that the measure (COUNT I) decreases according to the well-founded relation LESSP in each recursive call. Hence, RECV is accepted under the definitional principle. Observe that: (OR (LITATOM (RECV I FLG K LST)) (LISTP (RECV I FLG K LST))) is a theorem. [ 0.0 0.0 0.0 ] RECV (DEFN BVP (X) (IF (NLISTP X) (EQUAL X NIL) (AND (BOOLP (CAR X)) (BVP (CDR X))))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT X) decreases according to the well-founded relation LESSP in each recursive call. Hence, BVP is accepted under the principle of definition. Note that: (OR (FALSEP (BVP X)) (TRUEP (BVP X))) is a theorem. [ 0.0 0.0 0.0 ] BVP (DISABLE LISTN) [ 0.0 0.0 0.0 ] LISTN-OFF (DISABLE *1*LISTN) [ 0.0 0.0 0.0 ] G*1*LISTN-OFF (DISABLE CELL) [ 0.0 0.0 0.0 ] CELL-OFF (DISABLE *1*CELL) [ 0.0 0.0 0.0 ] G*1*CELL-OFF (DISABLE CSIG) [ 0.0 0.0 0.0 ] CSIG-OFF (DISABLE *1*CSIG) [ 0.0 0.0 0.0 ] G*1*CSIG-OFF (DISABLE BOOLP) [ 0.0 0.0 0.0 ] BOOLP-OFF1 (DISABLE SMOOTH) [ 0.0 0.0 0.0 ] SMOOTH-OFF (DISABLE WARP) [ 0.0 0.0 0.0 ] WARP-OFF (DISABLE DET) [ 0.0 0.0 0.0 ] DET-OFF (DISABLE RECV-BIT) [ 0.0 0.0 0.0 ] RECV-BIT-OFF (DISABLE SCAN) [ 0.0 0.0 0.0 ] SCAN-OFF (DISABLE SEND) [ 0.0 0.0 0.0 ] SEND-OFF (PROVE-LEMMA B-XOR-X-X (REWRITE) (NOT (B-XOR X X)) ((ENABLE B-XOR))) This conjecture simplifies, opening up the definition of B-XOR, to: T. Q.E.D. [ 0.0 0.0 0.0 ] B-XOR-X-X (DEFN LST* (LST TS TR W R) (IF (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) LST (LST* (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R)) ((ORD-LESSP (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR))))) Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, TS+-INCREASES-TR, SUB1-ADD1, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LST+-WEAKLY-SHORTENS-LST, and the definitions of LISTP, ORDINALP, LESSP, ORD-LESSP, EQUAL, OR, and ZEROP inform us that the measure: (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each recursive call. Hence, LST* is accepted under the definitional principle. [ 0.0 0.0 0.0 ] LST* (DEFN TS* (LST TS TR W R) (IF (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) TS (TS* (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R)) ((ORD-LESSP (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR))))) Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, TS+-INCREASES-TR, SUB1-ADD1, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LST+-WEAKLY-SHORTENS-LST, and the definitions of LISTP, ORDINALP, LESSP, ORD-LESSP, EQUAL, OR, and ZEROP inform us that the measure: (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each recursive call. Hence, TS* is accepted under the definitional principle. From the definition we can conclude that: (OR (NUMBERP (TS* LST TS TR W R)) (EQUAL (TS* LST TS TR W R) TS)) is a theorem. [ 0.0 0.0 0.0 ] TS* (DEFN TR* (LST TS TR W R) (IF (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) TR (TR* (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R)) ((ORD-LESSP (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR))))) Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, TS+-INCREASES-TR, SUB1-ADD1, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LST+-WEAKLY-SHORTENS-LST, and the definitions of LISTP, ORDINALP, LESSP, ORD-LESSP, EQUAL, OR, and ZEROP inform us that the measure: (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each recursive call. Hence, TR* is accepted under the definitional principle. From the definition we can conclude that: (OR (NUMBERP (TR* LST TS TR W R)) (EQUAL (TR* LST TS TR W R) TR)) is a theorem. [ 0.0 0.0 0.0 ] TR* (PROVE-LEMMA NOT-LESSP-TS+ (REWRITE) (IMPLIES (AND (NOT (LESSP TR TS)) (NOT (ZEROP W))) (NOT (LESSP TR (TS+ LST TS TR W))))) WARNING: Note that the proposed lemma NOT-LESSP-TS+ is to be stored as zero type prescription rules, zero compound recognizer rules, one linear rule, and zero replacement rules. This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to the new formula: (IMPLIES (AND (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP TR (TS+ LST TS TR W)))), which we will name *1. We will appeal to induction. There are four plausible inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (NLISTP LST) (p TR LST TS W)) (IMPLIES (AND (NOT (NLISTP LST)) (LESSP TR (PLUS TS W))) (p TR LST TS W)) (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP TR (PLUS TS W))) (p TR (CDR LST) (PLUS TS W) W)) (p TR LST TS W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme leads to the following three new formulas: Case 3. (IMPLIES (AND (NLISTP LST) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP TR (TS+ LST TS TR W)))). This simplifies, unfolding the functions NLISTP and TS+, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST)) (LESSP TR (PLUS TS W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP TR (TS+ LST TS TR W)))). This simplifies, unfolding the definitions of NLISTP and TS+, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP TR (PLUS TS W))) (NOT (LESSP TR (TS+ (CDR LST) (PLUS TS W) TR W))) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP TR (TS+ LST TS TR W)))). This simplifies, unfolding the definitions of NLISTP and TS+, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] NOT-LESSP-TS+ (PROVE-LEMMA LESSP-TS+ (REWRITE) (IMPLIES (AND (NOT (ENDP LST TS TR W)) (NOT (LESSP TR TS)) (NOT (ZEROP W))) (LESSP TR (PLUS W (TS+ LST TS TR W))))) WARNING: Note that the proposed lemma LESSP-TS+ is to be stored as zero type prescription rules, zero compound recognizer rules, one linear rule, and zero replacement rules. This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to the formula: (IMPLIES (AND (NOT (ENDP LST TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (TS+ LST TS TR W)))). Call the above conjecture *1. Perhaps we can prove it by induction. There are six plausible inductions. They merge into three likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (NLISTP LST) (p TR W LST TS)) (IMPLIES (AND (NOT (NLISTP LST)) (LESSP (PLUS TS W) TR) (p TR W (CDR LST) (PLUS TS W))) (p TR W LST TS)) (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP (PLUS TS W) TR))) (p TR W LST TS))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme leads to the following five new goals: Case 5. (IMPLIES (AND (NLISTP LST) (NOT (ENDP LST TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (TS+ LST TS TR W)))). This simplifies, opening up NLISTP and ENDP, to: T. Case 4. (IMPLIES (AND (NOT (NLISTP LST)) (LESSP (PLUS TS W) TR) (ENDP (CDR LST) (PLUS TS W) TR W) (NOT (ENDP LST TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (TS+ LST TS TR W)))). This simplifies, expanding NLISTP and ENDP, to: T. Case 3. (IMPLIES (AND (NOT (NLISTP LST)) (LESSP (PLUS TS W) TR) (LESSP TR (PLUS TS W)) (NOT (ENDP LST TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (TS+ LST TS TR W)))). This simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST)) (LESSP (PLUS TS W) TR) (LESSP TR (PLUS W (TS+ (CDR LST) (PLUS TS W) TR W))) (NOT (ENDP LST TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (TS+ LST TS TR W)))). This simplifies, expanding the functions NLISTP, ENDP, and TS+, to: (IMPLIES (AND (LISTP LST) (LESSP (PLUS TS W) TR) (LESSP TR (PLUS W (TS+ (CDR LST) (PLUS TS W) TR W))) (NOT (ENDP (CDR LST) (PLUS TS W) TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP TR (PLUS TS W))) (LESSP TR (PLUS W TS))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP (PLUS TS W) TR)) (NOT (ENDP LST TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (TS+ LST TS TR W)))), which simplifies, expanding the functions NLISTP, ENDP, and TS+, to two new conjectures: Case 1.2. (IMPLIES (AND (LISTP LST) (NOT (LESSP (PLUS TS W) TR)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR (PLUS TS W)))) (LESSP TR (PLUS W (TS+ (CDR LST) (PLUS TS W) TR W)))), which again simplifies, using linear arithmetic, to two new formulas: Case 1.2.2. (IMPLIES (AND (NOT (NUMBERP TR)) (LISTP LST) (NOT (LESSP (PLUS TS W) TR)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR (PLUS TS W)))) (LESSP TR (PLUS W (TS+ (CDR LST) (PLUS TS W) TR W)))), which again simplifies, unfolding the definitions of LESSP, EQUAL, and PLUS, to: T. Case 1.2.1. (IMPLIES (AND (NUMBERP TR) (LISTP LST) (NOT (LESSP (PLUS TS W) (PLUS W TS))) (NOT (LESSP (PLUS W TS) TS)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS W TS) (PLUS TS W)))) (LESSP (PLUS W TS) (PLUS W (TS+ (CDR LST) (PLUS TS W) (PLUS W TS) W)))), which again simplifies, rewriting with PLUS-COMMUTES1, to: (IMPLIES (AND (NUMBERP TR) (LISTP LST) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NOT (LESSP (PLUS TS W) TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (PLUS TS W) (PLUS W (TS+ (CDR LST) (PLUS TS W) (PLUS TS W) W)))). Applying the lemma CAR-CDR-ELIM, replace LST by (CONS Z X) to eliminate (CDR LST) and (CAR LST). We thus obtain: (IMPLIES (AND (NUMBERP TR) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NOT (LESSP (PLUS TS W) TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (PLUS TS W) (PLUS W (TS+ X (PLUS TS W) (PLUS TS W) W)))), which we generalize by replacing (PLUS TS W) by Y. We restrict the new variable by recalling the type restriction lemma noted when PLUS was introduced. We would thus like to prove: (IMPLIES (AND (NUMBERP Y) (NUMBERP TR) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (TS+ X Y Y W)))), which has an irrelevant term in it. By eliminating the term we get the new goal: (IMPLIES (AND (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (TS+ X Y Y W)))), which we will finally name *1.1. Case 1.1. (IMPLIES (AND (LISTP LST) (NOT (LESSP (PLUS TS W) TR)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP TR (PLUS TS W))) (LESSP TR (PLUS W TS))). This again simplifies, using linear arithmetic, to: T. So we now return to: (IMPLIES (AND (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (TS+ X Y Y W)))), which we named *1.1 above. Let us appeal to the induction principle. There are seven plausible inductions. They merge into three likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (NLISTP X) (p Y W X TS)) (IMPLIES (AND (NOT (NLISTP X)) (LESSP Y (PLUS Y W))) (p Y W X TS)) (IMPLIES (AND (NOT (NLISTP X)) (NOT (LESSP Y (PLUS Y W))) (p (PLUS Y W) W (CDR X) TS)) (p Y W X TS))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP establish that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for Y. The above induction scheme generates five new goals: Case 5. (IMPLIES (AND (NLISTP X) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (TS+ X Y Y W)))), which simplifies, expanding the functions NLISTP and TS+, to: (IMPLIES (AND (NOT (LISTP X)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W Y))). However this again simplifies, using linear arithmetic, to: T. Case 4. (IMPLIES (AND (NOT (NLISTP X)) (LESSP Y (PLUS Y W)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (TS+ X Y Y W)))), which simplifies, applying PLUS-COMMUTES1, and unfolding NLISTP and TS+, to: T. Case 3. (IMPLIES (AND (NOT (NLISTP X)) (NOT (LESSP Y (PLUS Y W))) (LESSP (PLUS Y W) (PLUS Y W)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (TS+ X Y Y W)))). This simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP X)) (NOT (LESSP Y (PLUS Y W))) (LESSP (PLUS Y W) TS) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (TS+ X Y Y W)))). This simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP X)) (NOT (LESSP Y (PLUS Y W))) (LESSP (PLUS Y W) (PLUS W (TS+ (CDR X) (PLUS Y W) (PLUS Y W) W))) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (TS+ X Y Y W)))). This simplifies, using linear arithmetic, to: T. That finishes the proof of *1.1, which, consequently, also finishes the proof of *1. Q.E.D. [ 0.0 0.1 0.0 ] LESSP-TS+ (PROVE-LEMMA LST+-APP (REWRITE) (IMPLIES (AND (NOT (ENDP LST1 TS TR+ W)) (NOT (ZEROP W))) (EQUAL (LST+ (APP LST1 LST2) TS TR+ W) (APP (LST+ LST1 TS TR+ W) LST2)))) This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to the formula: (IMPLIES (AND (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP LST1 LST2) TS TR+ W) (APP (LST+ LST1 TS TR+ W) LST2))). Call the above conjecture *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 (NLISTP LST1) (p LST1 LST2 TS TR+ W)) (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (p (CDR LST1) LST2 (PLUS TS W) TR+ W)) (p LST1 LST2 TS TR+ W)) (IMPLIES (AND (NOT (NLISTP LST1)) (NOT (LESSP (PLUS TS W) TR+))) (p LST1 LST2 TS TR+ W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT LST1) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme leads to the following four new goals: Case 4. (IMPLIES (AND (NLISTP LST1) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP LST1 LST2) TS TR+ W) (APP (LST+ LST1 TS TR+ W) LST2))). This simplifies, opening up NLISTP and ENDP, to: T. Case 3. (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (ENDP (CDR LST1) (PLUS TS W) TR+ W) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP LST1 LST2) TS TR+ W) (APP (LST+ LST1 TS TR+ W) LST2))). This simplifies, expanding NLISTP and ENDP, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (EQUAL (LST+ (APP (CDR LST1) LST2) (PLUS TS W) TR+ W) (APP (LST+ (CDR LST1) (PLUS TS W) TR+ W) LST2)) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP LST1 LST2) TS TR+ W) (APP (LST+ LST1 TS TR+ W) LST2))). This simplifies, rewriting with CDR-CONS, and unfolding the definitions of NLISTP, ENDP, APP, and LST+, to the conjecture: (IMPLIES (AND (LISTP LST1) (LESSP (PLUS TS W) TR+) (EQUAL (LST+ (APP (CDR LST1) LST2) (PLUS TS W) TR+ W) (APP (LST+ (CDR LST1) (PLUS TS W) TR+ W) LST2)) (NOT (ENDP (CDR LST1) (PLUS TS W) TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP TR+ (PLUS TS W))) (EQUAL (CONS (CAR LST1) (APP (CDR LST1) LST2)) (APP LST1 LST2))). But this again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST1)) (NOT (LESSP (PLUS TS W) TR+)) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP LST1 LST2) TS TR+ W) (APP (LST+ LST1 TS TR+ W) LST2))), which simplifies, applying CDR-CONS, and expanding the functions NLISTP, ENDP, APP, and LST+, to the following two new formulas: Case 1.2. (IMPLIES (AND (LISTP LST1) (NOT (LESSP (PLUS TS W) TR+)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR+ (PLUS TS W)))) (EQUAL (LST+ (APP (CDR LST1) LST2) (PLUS TS W) TR+ W) (APP (LST+ (CDR LST1) (PLUS TS W) TR+ W) LST2))). This again simplifies, using linear arithmetic, to two new conjectures: Case 1.2.2. (IMPLIES (AND (NOT (NUMBERP TR+)) (LISTP LST1) (NOT (LESSP (PLUS TS W) TR+)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR+ (PLUS TS W)))) (EQUAL (LST+ (APP (CDR LST1) LST2) (PLUS TS W) TR+ W) (APP (LST+ (CDR LST1) (PLUS TS W) TR+ W) LST2))), which again simplifies, unfolding the definitions of LESSP, PLUS, EQUAL, and LST+, to: (IMPLIES (AND (NOT (NUMBERP TR+)) (LISTP LST1) (NOT (EQUAL W 0)) (NUMBERP W) (EQUAL (PLUS TS W) 0)) (EQUAL (APP (CDR LST1) LST2) (APP (LST+ (CDR LST1) (PLUS TS W) TR+ W) LST2))). But this again simplifies, using linear arithmetic, to: T. Case 1.2.1. (IMPLIES (AND (NUMBERP TR+) (LISTP LST1) (NOT (LESSP (PLUS TS W) (PLUS W TS))) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS W TS) (PLUS TS W)))) (EQUAL (LST+ (APP (CDR LST1) LST2) (PLUS TS W) (PLUS W TS) W) (APP (LST+ (CDR LST1) (PLUS TS W) (PLUS W TS) W) LST2))), which again simplifies, applying PLUS-COMMUTES1, to: (IMPLIES (AND (NUMBERP TR+) (LISTP LST1) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP (CDR LST1) LST2) (PLUS TS W) (PLUS TS W) W) (APP (LST+ (CDR LST1) (PLUS TS W) (PLUS TS W) W) LST2))). Applying the lemma CAR-CDR-ELIM, replace LST1 by (CONS Z X) to eliminate (CDR LST1) and (CAR LST1). We would thus like to prove the new goal: (IMPLIES (AND (NUMBERP TR+) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP X LST2) (PLUS TS W) (PLUS TS W) W) (APP (LST+ X (PLUS TS W) (PLUS TS W) W) LST2))), which we generalize by replacing (PLUS TS W) by Y. We restrict the new variable by recalling the type restriction lemma noted when PLUS was introduced. This produces: (IMPLIES (AND (NUMBERP Y) (NUMBERP TR+) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP X LST2) Y Y W) (APP (LST+ X Y Y W) LST2))), which has an irrelevant term in it. By eliminating the term we get the new conjecture: (IMPLIES (AND (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP X LST2) Y Y W) (APP (LST+ X Y Y W) LST2))), which we will finally name *1.1. Case 1.1. (IMPLIES (AND (LISTP LST1) (NOT (LESSP (PLUS TS W) TR+)) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP TR+ (PLUS TS W))) (EQUAL (CONS (CAR LST1) (APP (CDR LST1) LST2)) (APP LST1 LST2))). But this again simplifies, expanding the function APP, to: T. So let us turn our attention to: (IMPLIES (AND (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP X LST2) Y Y W) (APP (LST+ X Y Y W) LST2))), which we named *1.1 above. Let us appeal to the induction principle. There are four plausible inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (NLISTP X) (p X LST2 Y W)) (IMPLIES (AND (NOT (NLISTP X)) (p (CDR X) LST2 (PLUS Y W) W)) (p X LST2 Y W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP establish that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for Y. The above induction scheme generates three new formulas: Case 3. (IMPLIES (AND (NLISTP X) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP X LST2) Y Y W) (APP (LST+ X Y Y W) LST2))), which simplifies, unfolding the definitions of NLISTP, APP, and LST+, to: (IMPLIES (AND (NOT (LISTP X)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ LST2 Y Y W) LST2)). Eliminate the irrelevant term. This produces: (IMPLIES (AND (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ LST2 Y Y W) LST2)), which we will name *1.1.1. Case 2. (IMPLIES (AND (NOT (NLISTP X)) (LESSP (PLUS Y W) (PLUS Y W)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP X LST2) Y Y W) (APP (LST+ X Y Y W) LST2))). This simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP X)) (EQUAL (LST+ (APP (CDR X) LST2) (PLUS Y W) (PLUS Y W) W) (APP (LST+ (CDR X) (PLUS Y W) (PLUS Y W) W) LST2)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (APP X LST2) Y Y W) (APP (LST+ X Y Y W) LST2))). This simplifies, rewriting with the lemmas PLUS-COMMUTES1 and CDR-CONS, and unfolding the functions NLISTP, APP, and LST+, to the following two new goals: Case 1.2. (IMPLIES (AND (LISTP X) (EQUAL (LST+ (APP (CDR X) LST2) (PLUS W Y) (PLUS W Y) W) (APP (LST+ (CDR X) (PLUS Y W) (PLUS Y W) W) LST2)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP Y (PLUS W Y)))) (EQUAL (LST+ (APP (CDR X) LST2) (PLUS W Y) Y W) (APP (LST+ (CDR X) (PLUS W Y) Y W) LST2))). However this again simplifies, using linear arithmetic, to: T. Case 1.1. (IMPLIES (AND (LISTP X) (EQUAL (LST+ (APP (CDR X) LST2) (PLUS W Y) (PLUS W Y) W) (APP (LST+ (CDR X) (PLUS Y W) (PLUS Y W) W) LST2)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP Y (PLUS W Y))) (EQUAL (CONS (CAR X) (APP (CDR X) LST2)) (APP X LST2))), which again simplifies, opening up the function APP, to: T. So we now return to: (IMPLIES (AND (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ LST2 Y Y W) LST2)), which is formula *1.1.1 above. We will try to prove it by induction. Three inductions are suggested by terms in the conjecture. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (NLISTP LST2) (p LST2 Y W)) (IMPLIES (AND (NOT (NLISTP LST2)) (LESSP Y (PLUS Y W))) (p LST2 Y W)) (IMPLIES (AND (NOT (NLISTP LST2)) (NOT (LESSP Y (PLUS Y W))) (p (CDR LST2) (PLUS Y W) W)) (p LST2 Y W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP establish that the measure (COUNT LST2) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for Y. The above induction scheme produces four new goals: Case 4. (IMPLIES (AND (NLISTP LST2) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ LST2 Y Y W) LST2)), which simplifies, unfolding NLISTP and LST+, to: T. Case 3. (IMPLIES (AND (NOT (NLISTP LST2)) (LESSP Y (PLUS Y W)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ LST2 Y Y W) LST2)), which simplifies, appealing to the lemma PLUS-COMMUTES1, and expanding the definitions of NLISTP and LST+, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST2)) (NOT (LESSP Y (PLUS Y W))) (LESSP (PLUS Y W) (PLUS Y W)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ LST2 Y Y W) LST2)), which simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST2)) (NOT (LESSP Y (PLUS Y W))) (EQUAL (LST+ (CDR LST2) (PLUS Y W) (PLUS Y W) W) (CDR LST2)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ LST2 Y Y W) LST2)), which simplifies, using linear arithmetic, to: T. That finishes the proof of *1.1.1, which, consequently, finishes the proof of *1.1, which finishes the proof of *1. Q.E.D. [ 0.0 0.1 0.0 ] LST+-APP (PROVE-LEMMA TS+-APP (REWRITE) (IMPLIES (AND (NOT (ENDP LST1 TS TR+ W)) (NOT (ZEROP W))) (EQUAL (TS+ (APP LST1 LST2) TS TR+ W) (TS+ LST1 TS TR+ W)))) This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP LST1 LST2) TS TR+ W) (TS+ LST1 TS TR+ W))), which we will name *1. Perhaps we can prove it by induction. Three inductions are suggested by terms in the conjecture. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (NLISTP LST1) (p LST1 LST2 TS TR+ W)) (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (p (CDR LST1) LST2 (PLUS TS W) TR+ W)) (p LST1 LST2 TS TR+ W)) (IMPLIES (AND (NOT (NLISTP LST1)) (NOT (LESSP (PLUS TS W) TR+))) (p LST1 LST2 TS TR+ W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT LST1) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme generates the following four new formulas: Case 4. (IMPLIES (AND (NLISTP LST1) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP LST1 LST2) TS TR+ W) (TS+ LST1 TS TR+ W))). This simplifies, unfolding the functions NLISTP and ENDP, to: T. Case 3. (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (ENDP (CDR LST1) (PLUS TS W) TR+ W) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP LST1 LST2) TS TR+ W) (TS+ LST1 TS TR+ W))). This simplifies, expanding the functions NLISTP and ENDP, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (EQUAL (TS+ (APP (CDR LST1) LST2) (PLUS TS W) TR+ W) (TS+ (CDR LST1) (PLUS TS W) TR+ W)) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP LST1 LST2) TS TR+ W) (TS+ LST1 TS TR+ W))). This simplifies, applying CDR-CONS, and unfolding the functions NLISTP, ENDP, APP, and TS+, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST1)) (NOT (LESSP (PLUS TS W) TR+)) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP LST1 LST2) TS TR+ W) (TS+ LST1 TS TR+ W))), which simplifies, applying CDR-CONS, and opening up the functions NLISTP, ENDP, APP, and TS+, to: (IMPLIES (AND (LISTP LST1) (NOT (LESSP (PLUS TS W) TR+)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR+ (PLUS TS W)))) (EQUAL (TS+ (APP (CDR LST1) LST2) (PLUS TS W) TR+ W) (TS+ (CDR LST1) (PLUS TS W) TR+ W))), which again simplifies, using linear arithmetic, to two new goals: Case 1.2. (IMPLIES (AND (NOT (NUMBERP TR+)) (LISTP LST1) (NOT (LESSP (PLUS TS W) TR+)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR+ (PLUS TS W)))) (EQUAL (TS+ (APP (CDR LST1) LST2) (PLUS TS W) TR+ W) (TS+ (CDR LST1) (PLUS TS W) TR+ W))), which again simplifies, expanding LESSP, PLUS, EQUAL, and TS+, to the conjecture: (IMPLIES (AND (NOT (NUMBERP TR+)) (LISTP LST1) (NOT (EQUAL W 0)) (NUMBERP W) (EQUAL (PLUS TS W) 0)) (EQUAL 0 (TS+ (CDR LST1) (PLUS TS W) TR+ W))). This again simplifies, using linear arithmetic, to: T. Case 1.1. (IMPLIES (AND (NUMBERP TR+) (LISTP LST1) (NOT (LESSP (PLUS TS W) (PLUS W TS))) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS W TS) (PLUS TS W)))) (EQUAL (TS+ (APP (CDR LST1) LST2) (PLUS TS W) (PLUS W TS) W) (TS+ (CDR LST1) (PLUS TS W) (PLUS W TS) W))), which again simplifies, rewriting with PLUS-COMMUTES1, to: (IMPLIES (AND (NUMBERP TR+) (LISTP LST1) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP (CDR LST1) LST2) (PLUS TS W) (PLUS TS W) W) (TS+ (CDR LST1) (PLUS TS W) (PLUS TS W) W))). Applying the lemma CAR-CDR-ELIM, replace LST1 by (CONS Z X) to eliminate (CDR LST1) and (CAR LST1). This produces: (IMPLIES (AND (NUMBERP TR+) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP X LST2) (PLUS TS W) (PLUS TS W) W) (TS+ X (PLUS TS W) (PLUS TS W) W))), which we generalize by replacing (PLUS TS W) by Y. We restrict the new variable by recalling the type restriction lemma noted when PLUS was introduced. This produces: (IMPLIES (AND (NUMBERP Y) (NUMBERP TR+) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP X LST2) Y Y W) (TS+ X Y Y W))), which has an irrelevant term in it. By eliminating the term we get the new goal: (IMPLIES (AND (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP X LST2) Y Y W) (TS+ X Y Y W))), which we will finally name *1.1. Perhaps we can prove it by induction. The recursive terms in the conjecture suggest four inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (NLISTP X) (p X LST2 Y W)) (IMPLIES (AND (NOT (NLISTP X)) (p (CDR X) LST2 (PLUS Y W) W)) (p X LST2 Y W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to prove that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for Y. The above induction scheme leads to three new goals: Case 3. (IMPLIES (AND (NLISTP X) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP X LST2) Y Y W) (TS+ X Y Y W))), which simplifies, expanding the functions NLISTP, APP, and TS+, to the goal: (IMPLIES (AND (NOT (LISTP X)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ LST2 Y Y W) Y)). Eliminate the irrelevant term. We would thus like to prove: (IMPLIES (AND (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ LST2 Y Y W) Y)), which we will name *1.1.1. Case 2. (IMPLIES (AND (NOT (NLISTP X)) (LESSP (PLUS Y W) (PLUS Y W)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP X LST2) Y Y W) (TS+ X Y Y W))). This simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP X)) (EQUAL (TS+ (APP (CDR X) LST2) (PLUS Y W) (PLUS Y W) W) (TS+ (CDR X) (PLUS Y W) (PLUS Y W) W)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ (APP X LST2) Y Y W) (TS+ X Y Y W))). This simplifies, applying PLUS-COMMUTES1 and CDR-CONS, and opening up the functions NLISTP, APP, and TS+, to: (IMPLIES (AND (LISTP X) (EQUAL (TS+ (APP (CDR X) LST2) (PLUS W Y) (PLUS W Y) W) (TS+ (CDR X) (PLUS Y W) (PLUS Y W) W)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP Y (PLUS W Y)))) (EQUAL (TS+ (APP (CDR X) LST2) (PLUS W Y) Y W) (TS+ (CDR X) (PLUS W Y) Y W))). But this again simplifies, using linear arithmetic, to: T. So we now return to: (IMPLIES (AND (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ LST2 Y Y W) Y)), named *1.1.1 above. Let us appeal to the induction principle. Three inductions are suggested by terms in the conjecture. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (NLISTP LST2) (p LST2 Y W)) (IMPLIES (AND (NOT (NLISTP LST2)) (LESSP Y (PLUS Y W))) (p LST2 Y W)) (IMPLIES (AND (NOT (NLISTP LST2)) (NOT (LESSP Y (PLUS Y W))) (p (CDR LST2) (PLUS Y W) W)) (p LST2 Y W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to show that the measure (COUNT LST2) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for Y. The above induction scheme leads to the following four new formulas: Case 4. (IMPLIES (AND (NLISTP LST2) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ LST2 Y Y W) Y)). This simplifies, expanding the functions NLISTP and TS+, to: T. Case 3. (IMPLIES (AND (NOT (NLISTP LST2)) (LESSP Y (PLUS Y W)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ LST2 Y Y W) Y)). This simplifies, applying PLUS-COMMUTES1, and unfolding the definitions of NLISTP and TS+, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST2)) (NOT (LESSP Y (PLUS Y W))) (LESSP (PLUS Y W) (PLUS Y W)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ LST2 Y Y W) Y)), which simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST2)) (NOT (LESSP Y (PLUS Y W))) (EQUAL (TS+ (CDR LST2) (PLUS Y W) (PLUS Y W) W) (PLUS Y W)) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (TS+ LST2 Y Y W) Y)), which simplifies, using linear arithmetic, to: T. That finishes the proof of *1.1.1, which finishes the proof of *1.1, which finishes the proof of *1. Q.E.D. [ 0.0 0.1 0.1 ] TS+-APP (PROVE-LEMMA SIG-APP (REWRITE) (IMPLIES (AND (NOT (ENDP LST1 TS TR+ W)) (NOT (ZEROP W))) (EQUAL (SIG (APP LST1 LST2) TS TR+ W) (SIG LST1 TS TR+ W)))) This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (SIG (APP LST1 LST2) TS TR+ W) (SIG LST1 TS TR+ W))), which we will name *1. Perhaps we can prove it by induction. Three inductions are suggested by terms in the conjecture. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (NLISTP LST1) (p LST1 LST2 TS TR+ W)) (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (p (CDR LST1) LST2 (PLUS TS W) TR+ W)) (p LST1 LST2 TS TR+ W)) (IMPLIES (AND (NOT (NLISTP LST1)) (NOT (LESSP (PLUS TS W) TR+))) (p LST1 LST2 TS TR+ W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT LST1) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme generates the following four new formulas: Case 4. (IMPLIES (AND (NLISTP LST1) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (SIG (APP LST1 LST2) TS TR+ W) (SIG LST1 TS TR+ W))). This simplifies, unfolding the functions NLISTP and ENDP, to: T. Case 3. (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (ENDP (CDR LST1) (PLUS TS W) TR+ W) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (SIG (APP LST1 LST2) TS TR+ W) (SIG LST1 TS TR+ W))). This simplifies, expanding the functions NLISTP and ENDP, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (EQUAL (SIG (APP (CDR LST1) LST2) (PLUS TS W) TR+ W) (SIG (CDR LST1) (PLUS TS W) TR+ W)) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (SIG (APP LST1 LST2) TS TR+ W) (SIG LST1 TS TR+ W))). This simplifies, applying CDR-CONS and CAR-CONS, and unfolding the functions NLISTP, ENDP, APP, RECONCILE-SIGNALS, and SIG, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST1)) (NOT (LESSP (PLUS TS W) TR+)) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (SIG (APP LST1 LST2) TS TR+ W) (SIG LST1 TS TR+ W))), which simplifies, applying CAR-CONS, and opening up the functions NLISTP, ENDP, APP, and SIG, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] SIG-APP (PROVE-LEMMA ENDP-APP (REWRITE) (IMPLIES (AND (NOT (ENDP LST1 TS TR+ W)) (NOT (ZEROP W))) (NOT (ENDP (APP LST1 LST2) TS TR+ W)))) This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (ENDP (APP LST1 LST2) TS TR+ W))), which we will name *1. We will appeal to induction. The recursive terms in the conjecture suggest two inductions. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (NLISTP LST1) (p LST1 LST2 TS TR+ W)) (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (p (CDR LST1) LST2 (PLUS TS W) TR+ W)) (p LST1 LST2 TS TR+ W)) (IMPLIES (AND (NOT (NLISTP LST1)) (NOT (LESSP (PLUS TS W) TR+))) (p LST1 LST2 TS TR+ W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to establish that the measure (COUNT LST1) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme produces four new goals: Case 4. (IMPLIES (AND (NLISTP LST1) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (ENDP (APP LST1 LST2) TS TR+ W))), which simplifies, opening up the definitions of NLISTP and ENDP, to: T. Case 3. (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (ENDP (CDR LST1) (PLUS TS W) TR+ W) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (ENDP (APP LST1 LST2) TS TR+ W))), which simplifies, unfolding NLISTP and ENDP, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST1)) (LESSP (PLUS TS W) TR+) (NOT (ENDP (APP (CDR LST1) LST2) (PLUS TS W) TR+ W)) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (ENDP (APP LST1 LST2) TS TR+ W))), which simplifies, rewriting with the lemma CDR-CONS, and opening up the definitions of NLISTP, ENDP, and APP, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST1)) (NOT (LESSP (PLUS TS W) TR+)) (NOT (ENDP LST1 TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (ENDP (APP LST1 LST2) TS TR+ W))), which simplifies, opening up the functions NLISTP, ENDP, and APP, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.1 0.0 ] ENDP-APP (DEFN TARGET (X) X) Note that (EQUAL (TARGET X) X) is a theorem. [ 0.0 0.0 0.0 ] TARGET (DISABLE TARGET) [ 0.0 0.0 0.0 ] TARGET-OFF (PROVE-LEMMA WARP-APP (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (ZEROP W)) (NOT (ZEROP R))) (EQUAL (TARGET (WARP (APP LST1 LST2) TS TR W R)) (APP (WARP LST1 TS TR W R) (WARP (APP (LST* LST1 TS TR W R) LST2) (TS* LST1 TS TR W R) (TR* LST1 TS TR W R) W R)))) ((ENABLE TARGET WARP))) This formula can be simplified, using the abbreviations ZEROP, NOT, AND, IMPLIES, and TARGET, to: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (WARP (APP LST1 LST2) TS TR W R) (APP (WARP LST1 TS TR W R) (WARP (APP (LST* LST1 TS TR W R) LST2) (TS* LST1 TS TR W R) (TR* LST1 TS TR W R) W R)))), which we will name *1. We will appeal to induction. There are nine plausible inductions. They merge into three likely candidate inductions, all of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (OR (ZEROP R) (ENDP LST1 TS (PLUS TR R) W)) (p LST1 LST2 TS TR W R)) (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST1 TS (PLUS TR R) W))) (p (LST+ LST1 TS (PLUS TR R) W) LST2 (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R)) (p LST1 LST2 TS TR W R))). Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, TS+-INCREASES-TR, SUB1-ADD1, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LST+-WEAKLY-SHORTENS-LST, and the definitions of LISTP, ORDINALP, LESSP, ORD-LESSP, EQUAL, OR, and ZEROP can be used to prove that the measure: (CONS (CONS (ADD1 (COUNT LST1)) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each induction step of the scheme. The above induction scheme produces five new conjectures: Case 5. (IMPLIES (AND (OR (ZEROP R) (ENDP LST1 TS (PLUS TR R) W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (WARP (APP LST1 LST2) TS TR W R) (APP (WARP LST1 TS TR W R) (WARP (APP (LST* LST1 TS TR W R) LST2) (TS* LST1 TS TR W R) (TR* LST1 TS TR W R) W R)))), which simplifies, rewriting with PLUS-COMMUTES1, and opening up ZEROP, OR, WARP, LST*, TS*, TR*, LISTP, and APP, to: T. Case 4. (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST1 TS (PLUS TR R) W))) (NOT (NUMBERP (TS+ LST1 TS (PLUS TR R) W))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (WARP (APP LST1 LST2) TS TR W R) (APP (WARP LST1 TS TR W R) (WARP (APP (LST* LST1 TS TR W R) LST2) (TS* LST1 TS TR W R) (TR* LST1 TS TR W R) W R)))). This simplifies, rewriting with PLUS-COMMUTES1, and unfolding the functions ZEROP and OR, to: T. Case 3. (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST1 TS (PLUS TR R) W))) (LESSP (PLUS TR R) (TS+ LST1 TS (PLUS TR R) W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (WARP (APP LST1 LST2) TS TR W R) (APP (WARP LST1 TS TR W R) (WARP (APP (LST* LST1 TS TR W R) LST2) (TS* LST1 TS TR W R) (TR* LST1 TS TR W R) W R)))), which simplifies, using linear arithmetic and applying NOT-LESSP-TS+, to: T. Case 2. (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST1 TS (PLUS TR R) W))) (NOT (LESSP (PLUS TR R) (PLUS (TS+ LST1 TS (PLUS TR R) W) W))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (WARP (APP LST1 LST2) TS TR W R) (APP (WARP LST1 TS TR W R) (WARP (APP (LST* LST1 TS TR W R) LST2) (TS* LST1 TS TR W R) (TR* LST1 TS TR W R) W R)))). This simplifies, rewriting with the lemmas PLUS-COMMUTES1, CDR-CONS, and CAR-CONS, and opening up the definitions of ZEROP, OR, WARP, LST*, TS*, TR*, and APP, to: (IMPLIES (AND (NOT (ENDP LST1 TS (PLUS R TR) W)) (NOT (LESSP (PLUS R TR) (PLUS W (TS+ LST1 TS (PLUS R TR) W)))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (WARP (APP LST1 LST2) TS TR W R) (CONS (SIG LST1 TS (PLUS R TR) W) (APP (WARP (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) (WARP (APP (LST* (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) LST2) (TS* (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) (TR* (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) W R))))), which again simplifies, using linear arithmetic and applying LESSP-TS+, to: T. Case 1. (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST1 TS (PLUS TR R) W))) (EQUAL (WARP (APP (LST+ LST1 TS (PLUS TR R) W) LST2) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) (APP (WARP (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) (WARP (APP (LST* (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) LST2) (TS* (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) (TR* (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) W R))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (WARP (APP LST1 LST2) TS TR W R) (APP (WARP LST1 TS TR W R) (WARP (APP (LST* LST1 TS TR W R) LST2) (TS* LST1 TS TR W R) (TR* LST1 TS TR W R) W R)))). This simplifies, appealing to the lemmas PLUS-COMMUTES1, CDR-CONS, and CAR-CONS, and opening up the functions ZEROP, OR, WARP, LST*, TS*, TR*, and APP, to: (IMPLIES (AND (NOT (ENDP LST1 TS (PLUS R TR) W)) (EQUAL (WARP (APP (LST+ LST1 TS (PLUS R TR) W) LST2) (TS+ LST1 TS (PLUS R TR) W) (PLUS R TR) W R) (APP (WARP (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) (WARP (APP (LST* (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) LST2) (TS* (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) (TR* (LST+ LST1 TS (PLUS TR R) W) (TS+ LST1 TS (PLUS TR R) W) (PLUS TR R) W R) W R))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (WARP (APP LST1 LST2) TS TR W R) (CONS (SIG LST1 TS (PLUS R TR) W) (WARP (APP (LST+ LST1 TS (PLUS R TR) W) LST2) (TS+ LST1 TS (PLUS R TR) W) (PLUS R TR) W R)))), which again simplifies, appealing to the lemmas TS+-APP, LST+-APP, SIG-APP, ENDP-APP, and PLUS-COMMUTES1, and opening up WARP, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.3 0.0 ] WARP-APP (DEFN NLST+ (N TS TR W) (IF (ZEROP N) N (IF (LESSP TR (PLUS TS W)) N (NLST+ (SUB1 N) (PLUS TS W) TR W)))) Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be used to establish that the measure (COUNT N) decreases according to the well-founded relation LESSP in each recursive call. Hence, NLST+ is accepted under the principle of definition. Note that: (OR (NUMBERP (NLST+ N TS TR W)) (EQUAL (NLST+ N TS TR W) N)) is a theorem. [ 0.0 0.0 0.0 ] NLST+ (PROVE-LEMMA LEN-LST+ (REWRITE) (EQUAL (LEN (LST+ LST TS TR W)) (NLST+ (LEN LST) TS TR W))) Give the conjecture the name *1. We will appeal to induction. There are two plausible inductions. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (NLISTP LST) (p LST TS TR W)) (IMPLIES (AND (NOT (NLISTP LST)) (LESSP TR (PLUS TS W))) (p LST TS TR W)) (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP TR (PLUS TS W))) (p (CDR LST) (PLUS TS W) TR W)) (p LST TS TR W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP establish that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme produces the following three new formulas: Case 3. (IMPLIES (NLISTP LST) (EQUAL (LEN (LST+ LST TS TR W)) (NLST+ (LEN LST) TS TR W))). This simplifies, opening up NLISTP, LST+, LEN, EQUAL, and NLST+, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST)) (LESSP TR (PLUS TS W))) (EQUAL (LEN (LST+ LST TS TR W)) (NLST+ (LEN LST) TS TR W))). This simplifies, opening up the definitions of NLISTP, LST+, LEN, and NLST+, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP TR (PLUS TS W))) (EQUAL (LEN (LST+ (CDR LST) (PLUS TS W) TR W)) (NLST+ (LEN (CDR LST)) (PLUS TS W) TR W))) (EQUAL (LEN (LST+ LST TS TR W)) (NLST+ (LEN LST) TS TR W))). This simplifies, applying the lemma SUB1-ADD1, and opening up NLISTP, LST+, LEN, and NLST+, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LEN-LST+ (DEFN NTS+ (N TS TR W) (IF (ZEROP N) TS (IF (LESSP TR (PLUS TS W)) TS (NTS+ (SUB1 N) (PLUS TS W) TR W)))) Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be used to establish that the measure (COUNT N) decreases according to the well-founded relation LESSP in each recursive call. Hence, NTS+ is accepted under the principle of definition. Note that: (OR (NUMBERP (NTS+ N TS TR W)) (EQUAL (NTS+ N TS TR W) TS)) is a theorem. [ 0.0 0.0 0.0 ] NTS+ (PROVE-LEMMA LEN-TS+ (REWRITE) (EQUAL (TS+ LST TS TR W) (NTS+ (LEN LST) TS TR W))) WARNING: the newly proposed lemma, LEN-TS+, could be applied whenever the previously added lemma TS+-APP could. Call the conjecture *1. Perhaps we can prove it by induction. Two inductions are suggested by terms in the conjecture. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (NLISTP LST) (p LST TS TR W)) (IMPLIES (AND (NOT (NLISTP LST)) (LESSP TR (PLUS TS W))) (p LST TS TR W)) (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP TR (PLUS TS W))) (p (CDR LST) (PLUS TS W) TR W)) (p LST TS TR W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to prove that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme leads to three new goals: Case 3. (IMPLIES (NLISTP LST) (EQUAL (TS+ LST TS TR W) (NTS+ (LEN LST) TS TR W))), which simplifies, opening up the definitions of NLISTP, TS+, LEN, EQUAL, and NTS+, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST)) (LESSP TR (PLUS TS W))) (EQUAL (TS+ LST TS TR W) (NTS+ (LEN LST) TS TR W))), which simplifies, expanding NLISTP, TS+, LEN, and NTS+, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP TR (PLUS TS W))) (EQUAL (TS+ (CDR LST) (PLUS TS W) TR W) (NTS+ (LEN (CDR LST)) (PLUS TS W) TR W))) (EQUAL (TS+ LST TS TR W) (NTS+ (LEN LST) TS TR W))), which simplifies, applying the lemma SUB1-ADD1, and opening up the functions NLISTP, TS+, LEN, and NTS+, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LEN-TS+ (DEFN NENDP (N TS TR W) (IF (ZEROP N) T (IF (LESSP (PLUS TS W) TR) (NENDP (SUB1 N) (PLUS TS W) TR W) F))) 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, NENDP is accepted under the definitional principle. Observe that: (OR (FALSEP (NENDP N TS TR W)) (TRUEP (NENDP N TS TR W))) is a theorem. [ 0.0 0.0 0.0 ] NENDP (PROVE-LEMMA LEN-ENDP (REWRITE) (EQUAL (ENDP LST TS TR W) (NENDP (LEN LST) TS TR W))) Call the conjecture *1. Perhaps we can prove it by induction. Two inductions are suggested by terms in the conjecture. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (NLISTP LST) (p LST TS TR W)) (IMPLIES (AND (NOT (NLISTP LST)) (LESSP (PLUS TS W) TR) (p (CDR LST) (PLUS TS W) TR W)) (p LST TS TR W)) (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP (PLUS TS W) TR))) (p LST TS TR W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to prove that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme leads to three new goals: Case 3. (IMPLIES (NLISTP LST) (EQUAL (ENDP LST TS TR W) (NENDP (LEN LST) TS TR W))), which simplifies, opening up the definitions of NLISTP, ENDP, LEN, EQUAL, and NENDP, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP LST)) (LESSP (PLUS TS W) TR) (EQUAL (ENDP (CDR LST) (PLUS TS W) TR W) (NENDP (LEN (CDR LST)) (PLUS TS W) TR W))) (EQUAL (ENDP LST TS TR W) (NENDP (LEN LST) TS TR W))), which simplifies, applying SUB1-ADD1, and unfolding NLISTP, ENDP, LEN, and NENDP, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP LST)) (NOT (LESSP (PLUS TS W) TR))) (EQUAL (ENDP LST TS TR W) (NENDP (LEN LST) TS TR W))). This simplifies, expanding the functions NLISTP, ENDP, LEN, NENDP, and EQUAL, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LEN-ENDP (PROVE-LEMMA LESSP-NLST+ (REWRITE) (NOT (LESSP N (NLST+ N TS TR W)))) WARNING: Note that the proposed lemma LESSP-NLST+ is to be stored as zero type prescription rules, zero compound recognizer rules, one linear rule, and zero replacement rules. Call the conjecture *1. We will try to prove it by induction. 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 (OR (EQUAL (NLST+ N TS TR W) 0) (NOT (NUMBERP (NLST+ N TS TR W)))) (p N TS TR W)) (IMPLIES (AND (NOT (OR (EQUAL (NLST+ N TS TR W) 0) (NOT (NUMBERP (NLST+ N TS TR W))))) (OR (EQUAL N 0) (NOT (NUMBERP N)))) (p N TS TR W)) (IMPLIES (AND (NOT (OR (EQUAL (NLST+ N TS TR W) 0) (NOT (NUMBERP (NLST+ N TS TR W))))) (NOT (OR (EQUAL N 0) (NOT (NUMBERP N)))) (p (SUB1 N) (PLUS TS W) TR W)) (p N TS TR W))). Linear arithmetic, the lemmas SUB1-LESSEQP and SUB1-LESSP, and the definitions of OR and NOT can be used to establish that the measure (COUNT N) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme generates the following three new formulas: Case 3. (IMPLIES (OR (EQUAL (NLST+ N TS TR W) 0) (NOT (NUMBERP (NLST+ N TS TR W)))) (NOT (LESSP N (NLST+ N TS TR W)))). This simplifies, expanding the definitions of NLST+, NOT, OR, EQUAL, and LESSP, to the following three new conjectures: Case 3.3. (IMPLIES (AND (NOT (LESSP TR (PLUS TS W))) (EQUAL (NLST+ (SUB1 N) (PLUS TS W) TR W) 0) (EQUAL N 0)) (NOT (LESSP N 0))). But this again simplifies, using linear arithmetic, to: T. Case 3.2. (IMPLIES (AND (NOT (LESSP TR (PLUS TS W))) (EQUAL (NLST+ (SUB1 N) (PLUS TS W) TR W) 0) (NUMBERP N)) (NOT (LESSP N 0))), which again simplifies, using linear arithmetic, to: T. Case 3.1. (IMPLIES (AND (NOT (LESSP TR (PLUS TS W))) (EQUAL (NLST+ (SUB1 N) (PLUS TS W) TR W) 0) (NOT (EQUAL N 0)) (NOT (NUMBERP N))) (NOT (LESSP N N))), which again simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (OR (EQUAL (NLST+ N TS TR W) 0) (NOT (NUMBERP (NLST+ N TS TR W))))) (OR (EQUAL N 0) (NOT (NUMBERP N)))) (NOT (LESSP N (NLST+ N TS TR W)))), which simplifies, expanding NLST+, NOT, and OR, to: T. Case 1. (IMPLIES (AND (NOT (OR (EQUAL (NLST+ N TS TR W) 0) (NOT (NUMBERP (NLST+ N TS TR W))))) (NOT (OR (EQUAL N 0) (NOT (NUMBERP N)))) (NOT (LESSP (SUB1 N) (NLST+ (SUB1 N) (PLUS TS W) TR W)))) (NOT (LESSP N (NLST+ N TS TR W)))), which simplifies, opening up the functions NLST+, NOT, OR, and LESSP, to three new conjectures: Case 1.3. (IMPLIES (AND (NOT (EQUAL N 0)) (NUMBERP N) (NOT (EQUAL (NLST+ (SUB1 N) (PLUS TS W) TR W) 0)) (NOT (LESSP (SUB1 N) (NLST+ (SUB1 N) (PLUS TS W) TR W))) (NOT (LESSP TR (PLUS TS W)))) (NOT (LESSP N (NLST+ (SUB1 N) (PLUS TS W) TR W)))), which again simplifies, using linear arithmetic, to: T. Case 1.2. (IMPLIES (AND (NOT (EQUAL N 0)) (NUMBERP N) (NOT (EQUAL (NLST+ (SUB1 N) (PLUS TS W) TR W) 0)) (NOT (LESSP (SUB1 N) (NLST+ (SUB1 N) (PLUS TS W) TR W))) (LESSP TR (PLUS TS W))) (NOT (LESSP N N))), which again simplifies, using linear arithmetic, to: T. Case 1.1. (IMPLIES (AND (NOT (EQUAL N 0)) (NUMBERP N) (LESSP TR (PLUS TS W)) (NOT (LESSP (SUB1 N) (NLST+ (SUB1 N) (PLUS TS W) TR W)))) (NOT (LESSP (SUB1 N) (SUB1 N)))), which again simplifies, using linear arithmetic, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LESSP-NLST+ (PROVE-LEMMA NLST+-EQUAL-N (REWRITE) (EQUAL (EQUAL (NLST+ N TS (PLUS R TR) W) N) (OR (ZEROP N) (LESSP (PLUS R TR) (PLUS TS W))))) This formula simplifies, unfolding the functions ZEROP and OR, to four new goals: Case 4. (IMPLIES (NOT (EQUAL (NLST+ N TS (PLUS R TR) W) N)) (NOT (EQUAL N 0))), which again simplifies, opening up the definitions of EQUAL and NLST+, to: T. Case 3. (IMPLIES (NOT (EQUAL (NLST+ N TS (PLUS R TR) W) N)) (NUMBERP N)), which again simplifies, unfolding the function NLST+, to: T. Case 2. (IMPLIES (NOT (EQUAL (NLST+ N TS (PLUS R TR) W) N)) (NOT (LESSP (PLUS R TR) (PLUS TS W)))), which again simplifies, opening up the function NLST+, to: T. Case 1. (IMPLIES (AND (EQUAL (NLST+ N TS (PLUS R TR) W) N) (NOT (EQUAL N 0)) (NUMBERP N)) (EQUAL (LESSP (PLUS R TR) (PLUS TS W)) T)), which again simplifies, trivially, to: (IMPLIES (AND (EQUAL (NLST+ N TS (PLUS R TR) W) N) (NOT (EQUAL N 0)) (NUMBERP N)) (LESSP (PLUS R TR) (PLUS TS W))). We now use the above equality hypothesis by substituting: (NLST+ N TS (PLUS R TR) W) for N and keeping the equality hypothesis. This generates: (IMPLIES (AND (EQUAL (NLST+ N TS (PLUS R TR) W) N) (NOT (EQUAL (NLST+ N TS (PLUS R TR) W) 0)) (NUMBERP (NLST+ N TS (PLUS R TR) W))) (LESSP (PLUS R TR) (PLUS TS W))). This further simplifies, obviously, to the new formula: (IMPLIES (AND (EQUAL (NLST+ N TS (PLUS R TR) W) N) (NOT (EQUAL N 0)) (NUMBERP N)) (LESSP (PLUS R TR) (PLUS TS W))), which we would normally push and work on later by induction. But if we must use induction to prove the input conjecture, we prefer to induct on the original formulation of the problem. Thus we will disregard all that we have previously done, give the name *1 to the original input, and work on it. So now let us return to: (EQUAL (EQUAL (NLST+ N TS (PLUS R TR) W) N) (OR (ZEROP N) (LESSP (PLUS R TR) (PLUS TS W)))). We named this *1. We will try to prove it by induction. There are four plausible inductions. They merge into three likely candidate inductions, two of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (ZEROP N) (p N TS R TR W)) (IMPLIES (AND (NOT (ZEROP N)) (LESSP (PLUS R TR) (PLUS TS W))) (p N TS R TR W)) (IMPLIES (AND (NOT (ZEROP N)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (p (SUB1 N) (PLUS TS W) R TR W)) (p N TS R TR W))). 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. Note, however, the inductive instance chosen for TS. The above induction scheme produces three new goals: Case 3. (IMPLIES (ZEROP N) (EQUAL (EQUAL (NLST+ N TS (PLUS R TR) W) N) (OR (ZEROP N) (LESSP (PLUS R TR) (PLUS TS W))))), which simplifies, opening up the functions ZEROP, EQUAL, NLST+, and OR, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP N)) (LESSP (PLUS R TR) (PLUS TS W))) (EQUAL (EQUAL (NLST+ N TS (PLUS R TR) W) N) (OR (ZEROP N) (LESSP (PLUS R TR) (PLUS TS W))))), which simplifies, expanding the functions ZEROP, NLST+, OR, and EQUAL, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP N)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (EQUAL (EQUAL (NLST+ (SUB1 N) (PLUS TS W) (PLUS R TR) W) (SUB1 N)) (OR (ZEROP (SUB1 N)) (LESSP (PLUS R TR) (PLUS (PLUS TS W) W))))) (EQUAL (EQUAL (NLST+ N TS (PLUS R TR) W) N) (OR (ZEROP N) (LESSP (PLUS R TR) (PLUS TS W))))), which simplifies, rewriting with PLUS-ASSOCIATES, and opening up ZEROP, OR, and NLST+, to the following three new conjectures: Case 1.3. (IMPLIES (AND (NOT (EQUAL N 0)) (NUMBERP N) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (EQUAL (NLST+ (SUB1 N) (PLUS TS W) (PLUS R TR) W) (SUB1 N)) (EQUAL (LESSP (PLUS R TR) (PLUS TS W W)) T)) (NOT (EQUAL (SUB1 N) N))). But this again simplifies, using linear arithmetic, to: T. Case 1.2. (IMPLIES (AND (NOT (EQUAL N 0)) (NUMBERP N) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (NOT (EQUAL (NLST+ (SUB1 N) (PLUS TS W) (PLUS R TR) W) (SUB1 N))) (NOT (EQUAL (SUB1 N) 0)) (NOT (LESSP (PLUS R TR) (PLUS TS W W)))) (NOT (EQUAL (NLST+ (SUB1 N) (PLUS TS W) (PLUS R TR) W) N))), which again simplifies, using linear arithmetic and applying LESSP-NLST+, to: T. Case 1.1. (IMPLIES (AND (NOT (EQUAL N 0)) (NUMBERP N) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (EQUAL (NLST+ (SUB1 N) (PLUS TS W) (PLUS R TR) W) (SUB1 N)) (EQUAL (SUB1 N) 0)) (NOT (EQUAL (SUB1 N) N))). This again simplifies, clearly, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.1 0.0 ] NLST+-EQUAL-N (DEFN NLST* (N TS TR W R) (IF (OR (ZEROP R) (NENDP N TS (PLUS TR R) W)) N (NLST* (NLST+ N TS (PLUS TR R) W) (NTS+ N TS (PLUS TR R) W) (PLUS TR R) W R)) ((ORD-LESSP (CONS (CONS (ADD1 N) 0) (DIFFERENCE (PLUS TS W) TR))))) Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, NLST+-EQUAL-N, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LESSP-NLST+, and the definitions of LISTP, ORDINALP, NLST+, LESSP, ORD-LESSP, EQUAL, OR, ZEROP, NTS+, and NENDP can be used to show that the measure: (CONS (CONS (ADD1 N) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each recursive call. Hence, NLST* is accepted under the principle of definition. Note that: (OR (NUMBERP (NLST* N TS TR W R)) (EQUAL (NLST* N TS TR W R) N)) is a theorem. [ 0.0 0.0 0.0 ] NLST* (PROVE-LEMMA LEN-LST* (REWRITE) (EQUAL (LEN (LST* LST TS TR W R)) (NLST* (LEN LST) TS TR W R))) Name the conjecture *1. Perhaps we can prove it by induction. Two inductions are suggested by terms in the conjecture, both of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) (p LST TS TR W R)) (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W))) (p (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R)) (p LST TS TR W R))). Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, TS+-INCREASES-TR, SUB1-ADD1, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LST+-WEAKLY-SHORTENS-LST, and the definitions of LISTP, ORDINALP, LESSP, ORD-LESSP, EQUAL, OR, and ZEROP inform us that the measure: (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each induction step of the scheme. The above induction scheme leads to the following two new conjectures: Case 2. (IMPLIES (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) (EQUAL (LEN (LST* LST TS TR W R)) (NLST* (LEN LST) TS TR W R))). This simplifies, rewriting with the lemmas PLUS-COMMUTES1 and LEN-ENDP, and opening up the definitions of ZEROP, OR, EQUAL, LST*, and NLST*, to: T. Case 1. (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W))) (EQUAL (LEN (LST* (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R)) (NLST* (LEN (LST+ LST TS (PLUS TR R) W)) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R))) (EQUAL (LEN (LST* LST TS TR W R)) (NLST* (LEN LST) TS TR W R))). This simplifies, appealing to the lemmas PLUS-COMMUTES1, LEN-ENDP, LEN-LST+, and LEN-TS+, and expanding ZEROP, OR, LST*, and NLST*, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LEN-LST* (DEFN NTS* (N TS TR W R) (IF (OR (ZEROP R) (NENDP N TS (PLUS TR R) W)) TS (NTS* (NLST+ N TS (PLUS TR R) W) (NTS+ N TS (PLUS TR R) W) (PLUS TR R) W R)) ((ORD-LESSP (CONS (CONS (ADD1 N) 0) (DIFFERENCE (PLUS TS W) TR))))) Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, NLST+-EQUAL-N, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LESSP-NLST+, and the definitions of LISTP, ORDINALP, NLST+, LESSP, ORD-LESSP, EQUAL, OR, ZEROP, NTS+, and NENDP can be used to show that the measure: (CONS (CONS (ADD1 N) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each recursive call. Hence, NTS* is accepted under the principle of definition. Note that: (OR (NUMBERP (NTS* N TS TR W R)) (EQUAL (NTS* N TS TR W R) TS)) is a theorem. [ 0.0 0.1 0.0 ] NTS* (PROVE-LEMMA LEN-TS* (REWRITE) (EQUAL (TS* LST TS TR W R) (NTS* (LEN LST) TS TR W R))) Give the conjecture the name *1. We will appeal to induction. There are two plausible inductions, both of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) (p LST TS TR W R)) (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W))) (p (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R)) (p LST TS TR W R))). Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, TS+-INCREASES-TR, SUB1-ADD1, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LST+-WEAKLY-SHORTENS-LST, and the definitions of LISTP, ORDINALP, LESSP, ORD-LESSP, EQUAL, OR, and ZEROP establish that the measure: (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each induction step of the scheme. The above induction scheme produces the following two new formulas: Case 2. (IMPLIES (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) (EQUAL (TS* LST TS TR W R) (NTS* (LEN LST) TS TR W R))). This simplifies, rewriting with the lemmas PLUS-COMMUTES1 and LEN-ENDP, and unfolding ZEROP, OR, EQUAL, TS*, and NTS*, to: T. Case 1. (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W))) (EQUAL (TS* (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R) (NTS* (LEN (LST+ LST TS (PLUS TR R) W)) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R))) (EQUAL (TS* LST TS TR W R) (NTS* (LEN LST) TS TR W R))). This simplifies, rewriting with PLUS-COMMUTES1, LEN-ENDP, LEN-LST+, and LEN-TS+, and expanding the functions ZEROP, OR, TS*, and NTS*, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LEN-TS* (DEFN NTR* (N TS TR W R) (IF (OR (ZEROP R) (NENDP N TS (PLUS TR R) W)) TR (NTR* (NLST+ N TS (PLUS TR R) W) (NTS+ N TS (PLUS TR R) W) (PLUS TR R) W R)) ((ORD-LESSP (CONS (CONS (ADD1 N) 0) (DIFFERENCE (PLUS TS W) TR))))) Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, NLST+-EQUAL-N, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LESSP-NLST+, and the definitions of LISTP, ORDINALP, NLST+, LESSP, ORD-LESSP, EQUAL, OR, ZEROP, NTS+, and NENDP can be used to show that the measure: (CONS (CONS (ADD1 N) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each recursive call. Hence, NTR* is accepted under the principle of definition. Note that: (OR (NUMBERP (NTR* N TS TR W R)) (EQUAL (NTR* N TS TR W R) TR)) is a theorem. [ 0.0 0.1 0.0 ] NTR* (PROVE-LEMMA LEN-TR* (REWRITE) (EQUAL (TR* LST TS TR W R) (NTR* (LEN LST) TS TR W R))) Give the conjecture the name *1. We will appeal to induction. There are two plausible inductions, both of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) (p LST TS TR W R)) (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W))) (p (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R)) (p LST TS TR W R))). Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, TS+-INCREASES-TR, SUB1-ADD1, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LST+-WEAKLY-SHORTENS-LST, and the definitions of LISTP, ORDINALP, LESSP, ORD-LESSP, EQUAL, OR, and ZEROP establish that the measure: (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each induction step of the scheme. The above induction scheme produces the following two new formulas: Case 2. (IMPLIES (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) (EQUAL (TR* LST TS TR W R) (NTR* (LEN LST) TS TR W R))). This simplifies, rewriting with the lemmas PLUS-COMMUTES1 and LEN-ENDP, and unfolding ZEROP, OR, EQUAL, TR*, and NTR*, to: T. Case 1. (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W))) (EQUAL (TR* (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R) (NTR* (LEN (LST+ LST TS (PLUS TR R) W)) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R))) (EQUAL (TR* LST TS TR W R) (NTR* (LEN LST) TS TR W R))). This simplifies, rewriting with PLUS-COMMUTES1, LEN-ENDP, LEN-LST+, and LEN-TS+, and expanding the functions ZEROP, OR, TR*, and NTR*, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LEN-TR* (PROVE-LEMMA LEN-LISTN (REWRITE) (EQUAL (LEN (LISTN N FLG)) (FIX N)) ((ENABLE LISTN))) This simplifies, unfolding FIX, to two new formulas: Case 2. (IMPLIES (NOT (NUMBERP N)) (EQUAL (LEN (LISTN N FLG)) 0)), which again simplifies, unfolding LISTN, LEN, and EQUAL, to: T. Case 1. (IMPLIES (NUMBERP N) (EQUAL (LEN (LISTN N FLG)) N)), which we will name *1. We will appeal to induction. There is only one plausible induction. We will induct according to the following scheme: (AND (IMPLIES (ZEROP N) (p N FLG)) (IMPLIES (AND (NOT (ZEROP N)) (p (SUB1 N) FLG)) (p N FLG))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform us that the measure (COUNT N) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme generates the following two new goals: Case 2. (IMPLIES (AND (ZEROP N) (NUMBERP N)) (EQUAL (LEN (LISTN N FLG)) N)). This simplifies, opening up the definitions of ZEROP, NUMBERP, EQUAL, LISTN, and LEN, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP N)) (EQUAL (LEN (LISTN (SUB1 N) FLG)) (SUB1 N)) (NUMBERP N)) (EQUAL (LEN (LISTN N FLG)) N)). This simplifies, applying ADD1-SUB1 and CDR-CONS, and expanding ZEROP, LISTN, and LEN, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LEN-LISTN (DEFN LASTN (N LST) (IF (EQUAL N (LEN LST)) LST (IF (NLISTP LST) LST (LASTN N (CDR LST))))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definitions of NLISTP and LEN establish that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each recursive call. Hence, LASTN is accepted under the definitional principle. [ 0.0 0.0 0.0 ] LASTN (DEFN TAILP (X LST) (IF (EQUAL X LST) T (IF (NLISTP LST) F (TAILP X (CDR LST))))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to establish that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each recursive call. Hence, TAILP is accepted under the principle of definition. Note that: (OR (FALSEP (TAILP X LST)) (TRUEP (TAILP X LST))) is a theorem. [ 0.0 0.0 0.0 ] TAILP (PROVE-LEMMA TAILP-TRANSITIVE (REWRITE) (IMPLIES (AND (TAILP X Y) (TAILP Y Z)) (TAILP X Z))) WARNING: Note that TAILP-TRANSITIVE contains the free variable Y which will be chosen by instantiating the hypothesis (TAILP X Y). Call the conjecture *1. Perhaps we can prove it by induction. Three inductions are suggested by terms in the conjecture. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (EQUAL Y Z) (p X Z Y)) (IMPLIES (AND (NOT (EQUAL Y Z)) (NLISTP Z)) (p X Z Y)) (IMPLIES (AND (NOT (EQUAL Y Z)) (NOT (NLISTP Z)) (p X (CDR Z) Y)) (p X Z Y))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to prove that the measure (COUNT Z) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to four new goals: Case 4. (IMPLIES (AND (EQUAL Y Z) (TAILP X Y) (TAILP Y Z)) (TAILP X Z)), which simplifies, trivially, to: T. Case 3. (IMPLIES (AND (NOT (EQUAL Y Z)) (NLISTP Z) (TAILP X Y) (TAILP Y Z)) (TAILP X Z)). This simplifies, expanding the definitions of NLISTP and TAILP, to: T. Case 2. (IMPLIES (AND (NOT (EQUAL Y Z)) (NOT (NLISTP Z)) (NOT (TAILP Y (CDR Z))) (TAILP X Y) (TAILP Y Z)) (TAILP X Z)). This simplifies, opening up the functions NLISTP and TAILP, to: T. Case 1. (IMPLIES (AND (NOT (EQUAL Y Z)) (NOT (NLISTP Z)) (TAILP X (CDR Z)) (TAILP X Y) (TAILP Y Z)) (TAILP X Z)). This simplifies, opening up NLISTP and TAILP, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] TAILP-TRANSITIVE (PROVE-LEMMA TAILP-LST+ (REWRITE) (TAILP (LST+ LST TS TR W) LST)) Name the conjecture *1. Let us appeal to the induction principle. Two inductions are suggested by terms in the conjecture. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (EQUAL (LST+ LST TS TR W) LST) (p LST TS TR W)) (IMPLIES (AND (NOT (EQUAL (LST+ LST TS TR W) LST)) (NLISTP LST)) (p LST TS TR W)) (IMPLIES (AND (NOT (EQUAL (LST+ LST TS TR W) LST)) (NOT (NLISTP LST)) (p (CDR LST) (PLUS TS W) TR W)) (p LST TS TR W))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme leads to three new conjectures: Case 3. (IMPLIES (EQUAL (LST+ LST TS TR W) LST) (TAILP (LST+ LST TS TR W) LST)), which simplifies, expanding LST+ and TAILP, to: T. Case 2. (IMPLIES (AND (NOT (EQUAL (LST+ LST TS TR W) LST)) (NLISTP LST)) (TAILP (LST+ LST TS TR W) LST)), which simplifies, unfolding the definitions of LST+ and NLISTP, to: T. Case 1. (IMPLIES (AND (NOT (EQUAL (LST+ LST TS TR W) LST)) (NOT (NLISTP LST)) (TAILP (LST+ (CDR LST) (PLUS TS W) TR W) (CDR LST))) (TAILP (LST+ LST TS TR W) LST)), which simplifies, rewriting with TAILP-TRANSITIVE, and unfolding LST+, NLISTP, and TAILP, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] TAILP-LST+ (PROVE-LEMMA TAILP-LST* (REWRITE) (TAILP (LST* LST TS TR W R) LST)) Give the conjecture the name *1. We will appeal to induction. Two inductions are suggested by terms in the conjecture, both of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) (p LST TS TR W R)) (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W))) (p (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R)) (p LST TS TR W R))). Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, TS+-INCREASES-TR, SUB1-ADD1, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LST+-WEAKLY-SHORTENS-LST, and the definitions of LISTP, ORDINALP, LESSP, ORD-LESSP, EQUAL, OR, and ZEROP inform us that the measure: (CONS (CONS (ADD1 (COUNT LST)) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each induction step of the scheme. The above induction scheme produces the following two new conjectures: Case 2. (IMPLIES (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W)) (TAILP (LST* LST TS TR W R) LST)). This simplifies, applying PLUS-COMMUTES1 and LEN-ENDP, and opening up the functions ZEROP, OR, EQUAL, LST*, and TAILP, to: T. Case 1. (IMPLIES (AND (NOT (OR (ZEROP R) (ENDP LST TS (PLUS TR R) W))) (TAILP (LST* (LST+ LST TS (PLUS TR R) W) (TS+ LST TS (PLUS TR R) W) (PLUS TR R) W R) (LST+ LST TS (PLUS TR R) W))) (TAILP (LST* LST TS TR W R) LST)), which simplifies, rewriting with PLUS-COMMUTES1, LEN-ENDP, TAILP-LST+, and TAILP-TRANSITIVE, and opening up ZEROP, OR, and LST*, to: T. That finishes the proof of *1. Q.E.D. [ 0.1 0.0 0.0 ] TAILP-LST* (PROVE-LEMMA LEN-LASTN (REWRITE) (EQUAL (LEN (LASTN N LST)) (IF (LESSP (LEN LST) N) 0 (FIX N)))) This simplifies, unfolding the function FIX, to the following three new formulas: Case 3. (IMPLIES (AND (NOT (LESSP (LEN LST) N)) (NUMBERP N)) (EQUAL (LEN (LASTN N LST)) N)). Give the above formula the name *1. Case 2. (IMPLIES (LESSP (LEN LST) N) (EQUAL (LEN (LASTN N LST)) 0)). But this again simplifies, applying EQUAL-LEN-0, to: (IMPLIES (LESSP (LEN LST) N) (NOT (LISTP (LASTN N LST)))), 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 (LEN (LASTN N LST)) (IF (LESSP (LEN LST) N) 0 (FIX N))). We named this *1. We will try to prove it by induction. Three inductions are suggested by terms in the conjecture. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (EQUAL N (LEN LST)) (p N LST)) (IMPLIES (AND (NOT (EQUAL N (LEN LST))) (NLISTP LST)) (p N LST)) (IMPLIES (AND (NOT (EQUAL N (LEN LST))) (NOT (NLISTP LST)) (p N (CDR LST))) (p N LST))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definitions of NLISTP and LEN inform us that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme generates three new conjectures: Case 3. (IMPLIES (EQUAL N (LEN LST)) (EQUAL (LEN (LASTN N LST)) (IF (LESSP (LEN LST) N) 0 (FIX N)))), which simplifies, expanding the definitions of LEN, LASTN, and FIX, to the goal: (IMPLIES (AND (LISTP LST) (LESSP (ADD1 (LEN (CDR LST))) (ADD1 (LEN (CDR LST))))) (EQUAL (ADD1 (LEN (CDR LST))) 0)). But this again simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (EQUAL N (LEN LST))) (NLISTP LST)) (EQUAL (LEN (LASTN N LST)) (IF (LESSP (LEN LST) N) 0 (FIX N)))), which simplifies, opening up LEN, NLISTP, LASTN, EQUAL, LESSP, and FIX, to: T. Case 1. (IMPLIES (AND (NOT (EQUAL N (LEN LST))) (NOT (NLISTP LST)) (EQUAL (LEN (LASTN N (CDR LST))) (IF (LESSP (LEN (CDR LST)) N) 0 (FIX N)))) (EQUAL (LEN (LASTN N LST)) (IF (LESSP (LEN LST) N) 0 (FIX N)))), which simplifies, appealing to the lemma SUB1-ADD1, and opening up the functions LEN, NLISTP, FIX, LASTN, LESSP, and EQUAL, to three new formulas: Case 1.3. (IMPLIES (AND (LISTP LST) (NOT (EQUAL N (ADD1 (LEN (CDR LST))))) (NOT (LESSP (LEN (CDR LST)) N)) (NUMBERP N) (EQUAL (LEN (LASTN N (CDR LST))) N) (NOT (EQUAL N 0))) (NOT (LESSP (LEN (CDR LST)) (SUB1 N)))), which again simplifies, using linear arithmetic, to: T. Case 1.2. (IMPLIES (AND (LISTP LST) (NOT (EQUAL N (ADD1 (LEN (CDR LST))))) (LESSP (LEN (CDR LST)) N) (EQUAL (LEN (LASTN N (CDR LST))) 0) (NUMBERP N) (NOT (LESSP (LEN (CDR LST)) (SUB1 N)))) (EQUAL 0 N)), which again simplifies, using linear arithmetic, to: T. Case 1.1. (IMPLIES (AND (LISTP LST) (NOT (EQUAL N (ADD1 (LEN (CDR LST))))) (LESSP (LEN (CDR LST)) N) (EQUAL (LEN (LASTN N (CDR LST))) 0) (EQUAL N 0) (NUMBERP N)) (EQUAL 0 N)), which again simplifies, clearly, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LEN-LASTN (PROVE-LEMMA TAILP-IMPLIES-LASTN-LEN (REWRITE) (IMPLIES (TAILP X Y) (EQUAL (LASTN (LEN X) Y) X))) Give the conjecture the name *1. We will try to prove it by induction. There are three plausible inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (EQUAL X Y) (p X Y)) (IMPLIES (AND (NOT (EQUAL X Y)) (NLISTP Y)) (p X Y)) (IMPLIES (AND (NOT (EQUAL X Y)) (NOT (NLISTP Y)) (p X (CDR Y))) (p X Y))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT Y) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme generates four new goals: Case 4. (IMPLIES (AND (EQUAL X Y) (TAILP X Y)) (EQUAL (LASTN (LEN X) Y) X)), which simplifies, expanding TAILP and LASTN, to: T. Case 3. (IMPLIES (AND (NOT (EQUAL X Y)) (NLISTP Y) (TAILP X Y)) (EQUAL (LASTN (LEN X) Y) X)), which simplifies, opening up the functions NLISTP and TAILP, to: T. Case 2. (IMPLIES (AND (NOT (EQUAL X Y)) (NOT (NLISTP Y)) (NOT (TAILP X (CDR Y))) (TAILP X Y)) (EQUAL (LASTN (LEN X) Y) X)), which simplifies, opening up the definitions of NLISTP and TAILP, to: T. Case 1. (IMPLIES (AND (NOT (EQUAL X Y)) (NOT (NLISTP Y)) (EQUAL (LASTN (LEN X) (CDR Y)) X) (TAILP X Y)) (EQUAL (LASTN (LEN X) Y) X)), which simplifies, opening up NLISTP, TAILP, LASTN, and LEN, to: (IMPLIES (AND (NOT (EQUAL X Y)) (LISTP Y) (EQUAL (LASTN (LEN X) (CDR Y)) X) (TAILP X (CDR Y))) (NOT (EQUAL (LEN X) (ADD1 (LEN (CDR Y)))))). Appealing to the lemma CAR-CDR-ELIM, we now replace Y by (CONS V Z) to eliminate (CDR Y) and (CAR Y). This generates the goal: (IMPLIES (AND (NOT (EQUAL X (CONS V Z))) (EQUAL (LASTN (LEN X) Z) X) (TAILP X Z)) (NOT (EQUAL (LEN X) (ADD1 (LEN Z))))). We use the first equality hypothesis by substituting (LASTN (LEN X) Z) for X and throwing away the equality. We would thus like to prove: (IMPLIES (AND (NOT (EQUAL (LASTN (LEN X) Z) (CONS V Z))) (TAILP (LASTN (LEN X) Z) Z)) (NOT (EQUAL (LEN (LASTN (LEN X) Z)) (ADD1 (LEN Z))))), which further simplifies, rewriting with LEN-LASTN, to the following two new conjectures: Case 1.2. (IMPLIES (AND (NOT (EQUAL (LASTN (LEN X) Z) (CONS V Z))) (TAILP (LASTN (LEN X) Z) Z) (NOT (LESSP (LEN Z) (LEN X)))) (NOT (EQUAL (LEN X) (ADD1 (LEN Z))))). However this again simplifies, using linear arithmetic, to: T. Case 1.1. (IMPLIES (AND (NOT (EQUAL (LASTN (LEN X) Z) (CONS V Z))) (TAILP (LASTN (LEN X) Z) Z) (LESSP (LEN Z) (LEN X))) (NOT (EQUAL 0 (ADD1 (LEN Z))))), which again simplifies, using linear arithmetic, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] TAILP-IMPLIES-LASTN-LEN (PROVE-LEMMA LST*-IS-LASTN NIL (EQUAL (LASTN (LEN (LST* LST TS TR W R)) LST) (LST* LST TS TR W R)) ((DISABLE LEN-LST*))) This formula simplifies, applying TAILP-LST* and TAILP-IMPLIES-LASTN-LEN, to: T. Q.E.D. [ 0.0 0.0 0.0 ] LST*-IS-LASTN (DEFN PROPERP (X) (IF (NLISTP X) (EQUAL X NIL) (PROPERP (CDR X)))) Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP can be used to establish that the measure (COUNT X) decreases according to the well-founded relation LESSP in each recursive call. Hence, PROPERP is accepted under the principle of definition. From the definition we can conclude that (OR (FALSEP (PROPERP X)) (TRUEP (PROPERP X))) is a theorem. [ 0.0 0.0 0.0 ] PROPERP (PROVE-LEMMA LASTN-NIL (REWRITE) (IMPLIES (AND (PROPERP LST) (LESSP (LEN LST) N)) (EQUAL (LASTN N LST) NIL))) Call the conjecture *1. We will appeal to induction. There are four plausible inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (EQUAL N (LEN LST)) (p N LST)) (IMPLIES (AND (NOT (EQUAL N (LEN LST))) (NLISTP LST)) (p N LST)) (IMPLIES (AND (NOT (EQUAL N (LEN LST))) (NOT (NLISTP LST)) (p N (CDR LST))) (p N LST))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definitions of NLISTP and LEN can be used to establish that the measure (COUNT LST) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme generates five new formulas: Case 5. (IMPLIES (AND (EQUAL N (LEN LST)) (PROPERP LST) (LESSP (LEN LST) N)) (EQUAL (LASTN N LST) NIL)), which simplifies, using linear arithmetic, to: T. Case 4. (IMPLIES (AND (NOT (EQUAL N (LEN LST))) (NLISTP LST) (PROPERP LST) (LESSP (LEN LST) N)) (EQUAL (LASTN N LST) NIL)), which simplifies, opening up the definitions of LEN, NLISTP, PROPERP, EQUAL, LESSP, LISTP, and LASTN, to: T. Case 3. (IMPLIES (AND (NOT (EQUAL N (LEN LST))) (NOT (NLISTP LST)) (NOT (PROPERP (CDR LST))) (PROPERP LST) (LESSP (LEN LST) N)) (EQUAL (LASTN N LST) NIL)), which simplifies, unfolding the definitions of LEN, NLISTP, and PROPERP, to: T. Case 2. (IMPLIES (AND (NOT (EQUAL N (LEN LST))) (NOT (NLISTP LST)) (NOT (LESSP (LEN (CDR LST)) N)) (PROPERP LST) (LESSP (LEN LST) N)) (EQUAL (LASTN N LST) NIL)), which simplifies, applying SUB1-ADD1, and expanding LEN, NLISTP, PROPERP, LESSP, and LASTN, to: (IMPLIES (AND (LISTP LST) (NOT (EQUAL N (ADD1 (LEN (CDR LST))))) (NOT (LESSP (LEN (CDR LST)) N)) (PROPERP (CDR LST)) (NOT (EQUAL N 0)) (NUMBERP N) (LESSP (LEN (CDR LST)) (SUB1 N))) (EQUAL (LASTN N (CDR LST)) NIL)), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (EQUAL N (LEN LST))) (NOT (NLISTP LST)) (EQUAL (LASTN N (CDR LST)) NIL) (PROPERP LST) (LESSP (LEN LST) N)) (EQUAL (LASTN N LST) NIL)), which simplifies, appealing to the lemma SUB1-ADD1, and opening up the definitions of LEN, NLISTP, PROPERP, LESSP, LASTN, and EQUAL, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LASTN-NIL (PROVE-LEMMA PROPERP-LISTN (REWRITE) (PROPERP (LISTN N FLG)) ((ENABLE LISTN))) 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 FLG)) (IMPLIES (AND (NOT (ZEROP N)) (p (SUB1 N) FLG)) (p N FLG))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be used to show that the measure (COUNT N) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to two new goals: Case 2. (IMPLIES (ZEROP N) (PROPERP (LISTN N FLG))), which simplifies, unfolding the definitions of ZEROP, EQUAL, LISTN, and PROPERP, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP N)) (PROPERP (LISTN (SUB1 N) FLG))) (PROPERP (LISTN N FLG))), which simplifies, rewriting with the lemma CDR-CONS, and expanding ZEROP, LISTN, and PROPERP, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] PROPERP-LISTN (PROVE-LEMMA LASTN-LISTN (REWRITE) (IMPLIES (AND (NUMBERP N) (NUMBERP K) (NOT (LESSP K N))) (EQUAL (LASTN N (LISTN K FLG)) (LISTN N FLG))) ((ENABLE LISTN) (INDUCT (LISTN K FLG)))) This conjecture can be simplified, using the abbreviations ZEROP, IMPLIES, NOT, OR, and AND, to two new conjectures: Case 2. (IMPLIES (AND (ZEROP K) (NUMBERP N) (NUMBERP K) (NOT (LESSP K N))) (EQUAL (LASTN N (LISTN K FLG)) (LISTN N FLG))), which simplifies, unfolding the definitions of ZEROP, NUMBERP, EQUAL, LESSP, LISTN, and LASTN, to: T. Case 1. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (IMPLIES (AND (NUMBERP N) (NUMBERP (SUB1 K)) (NOT (LESSP (SUB1 K) N))) (EQUAL (LASTN N (LISTN (SUB1 K) FLG)) (LISTN N FLG))) (NUMBERP N) (NOT (LESSP K N))) (EQUAL (LASTN N (LISTN K FLG)) (LISTN N FLG))), which simplifies, rewriting with LASTN-NIL, PROPERP-LISTN, CDR-CONS, LEN-LISTN, and ADD1-SUB1, and expanding the definitions of NOT, AND, IMPLIES, LISTN, LEN, and LASTN, to the following three new goals: Case 1.3. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (LESSP (SUB1 K) N) (NUMBERP N) (NOT (LESSP K N)) (NOT (EQUAL N K))) (EQUAL NIL (LISTN N FLG))). However this again simplifies, using linear arithmetic, to: T. Case 1.2. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (LESSP (SUB1 K) N) (NUMBERP N) (NOT (LESSP K N)) (EQUAL N K)) (EQUAL (CONS FLG (LISTN (SUB1 K) FLG)) (LISTN N FLG))), which again simplifies, expanding the functions LESSP and LISTN, to: T. Case 1.1. (IMPLIES (AND (NOT (EQUAL K 0)) (NUMBERP K) (EQUAL (LASTN N (LISTN (SUB1 K) FLG)) (LISTN N FLG)) (NUMBERP N) (NOT (LESSP K N)) (EQUAL N K)) (EQUAL (CONS FLG (LISTN (SUB1 K) FLG)) (LISTN N FLG))), which again simplifies, using linear arithmetic, appealing to the lemmas LEN-LISTN, PROPERP-LISTN, and LASTN-NIL, and expanding the function LISTN, to: T. Q.E.D. [ 0.0 0.0 0.0 ] LASTN-LISTN (PROVE-LEMMA LESSP-NLST* (REWRITE) (NOT (LESSP N (NLST* N TS TR W R)))) WARNING: Note that the proposed lemma LESSP-NLST* 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, both of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (OR (ZEROP R) (NENDP N TS (PLUS TR R) W)) (p N TS TR W R)) (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP N TS (PLUS TR R) W))) (p (NLST+ N TS (PLUS TR R) W) (NTS+ N TS (PLUS TR R) W) (PLUS TR R) W R)) (p N TS TR W R))). Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, NLST+-EQUAL-N, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LESSP-NLST+, and the definitions of LISTP, ORDINALP, NLST+, LESSP, ORD-LESSP, EQUAL, OR, ZEROP, NTS+, and NENDP establish that the measure: (CONS (CONS (ADD1 N) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each induction step of the scheme. The above induction scheme produces the following two new goals: Case 2. (IMPLIES (OR (ZEROP R) (NENDP N TS (PLUS TR R) W)) (NOT (LESSP N (NLST* N TS TR W R)))). This simplifies, applying PLUS-COMMUTES1, and unfolding the definitions of ZEROP, OR, EQUAL, and NLST*, to three new formulas: Case 2.3. (IMPLIES (EQUAL R 0) (NOT (LESSP N N))), which again simplifies, using linear arithmetic, to: T. Case 2.2. (IMPLIES (NOT (NUMBERP R)) (NOT (LESSP N N))), which again simplifies, using linear arithmetic, to: T. Case 2.1. (IMPLIES (NENDP N TS (PLUS R TR) W) (NOT (LESSP N N))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP N TS (PLUS TR R) W))) (NOT (LESSP (NLST+ N TS (PLUS TR R) W) (NLST* (NLST+ N TS (PLUS TR R) W) (NTS+ N TS (PLUS TR R) W) (PLUS TR R) W R)))) (NOT (LESSP N (NLST* N TS TR W R)))), which simplifies, rewriting with the lemma PLUS-COMMUTES1, and unfolding ZEROP, OR, and NLST*, to: (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP N TS (PLUS R TR) W)) (NOT (LESSP (NLST+ N TS (PLUS R TR) W) (NLST* (NLST+ N TS (PLUS TR R) W) (NTS+ N TS (PLUS TR R) W) (PLUS TR R) W R)))) (NOT (LESSP N (NLST* (NLST+ N TS (PLUS TR R) W) (NTS+ N TS (PLUS TR R) W) (PLUS TR R) W R)))). But this again simplifies, using linear arithmetic and rewriting with LESSP-NLST+, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LESSP-NLST* (PROVE-LEMMA LST*-LISTN (REWRITE) (IMPLIES (NUMBERP N) (EQUAL (LST* (LISTN N FLG) TS TR W R) (LISTN (NLST* N TS TR W R) FLG))) ((USE (LST*-IS-LASTN (LST (LISTN N FLG)))))) This formula can be simplified, using the abbreviations IMPLIES and LEN-LST*, to: (IMPLIES (AND (EQUAL (LASTN (NLST* (LEN (LISTN N FLG)) TS TR W R) (LISTN N FLG)) (LST* (LISTN N FLG) TS TR W R)) (NUMBERP N)) (EQUAL (LST* (LISTN N FLG) TS TR W R) (LISTN (NLST* N TS TR W R) FLG))), which simplifies, using linear arithmetic and rewriting with LEN-LISTN, LESSP-NLST*, and LASTN-LISTN, to: T. Q.E.D. [ 0.0 0.0 0.0 ] LST*-LISTN (DEFN N* (N TS TR W R) (IF (OR (ZEROP R) (NENDP N TS (PLUS TR R) W)) 0 (ADD1 (N* (NLST+ N TS (PLUS TR R) W) (NTS+ N TS (PLUS TR R) W) (PLUS TR R) W R))) ((ORD-LESSP (CONS (CONS (ADD1 N) 0) (DIFFERENCE (PLUS TS W) TR))))) Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, NLST+-EQUAL-N, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LESSP-NLST+, and the definitions of LISTP, ORDINALP, NLST+, LESSP, ORD-LESSP, EQUAL, OR, ZEROP, NTS+, and NENDP establish that the measure: (CONS (CONS (ADD1 N) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each recursive call. Hence, N* is accepted under the definitional principle. Observe that: (NUMBERP (N* N TS TR W R)) is a theorem. [ 0.0 0.1 0.0 ] N* (PROVE-LEMMA NOT-LESSP-NTS+ (REWRITE) (IMPLIES (AND (NOT (LESSP TR TS)) (NOT (ZEROP W))) (NOT (LESSP TR (NTS+ N TS TR W))))) WARNING: Note that the proposed lemma NOT-LESSP-NTS+ is to be stored as zero type prescription rules, zero compound recognizer rules, one linear rule, and zero replacement rules. This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to the new formula: (IMPLIES (AND (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP TR (NTS+ N TS TR W)))), which we will name *1. We will appeal to induction. There are four plausible inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP N) (p TR N TS W)) (IMPLIES (AND (NOT (ZEROP N)) (LESSP TR (PLUS TS W))) (p TR N TS W)) (IMPLIES (AND (NOT (ZEROP N)) (NOT (LESSP TR (PLUS TS W))) (p TR (SUB1 N) (PLUS TS W) W)) (p TR N TS W))). 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. Note, however, the inductive instance chosen for TS. The above induction scheme leads to the following three new formulas: Case 3. (IMPLIES (AND (ZEROP N) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP TR (NTS+ N TS TR W)))). This simplifies, unfolding the functions ZEROP, EQUAL, and NTS+, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP N)) (LESSP TR (PLUS TS W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP TR (NTS+ N TS TR W)))). This simplifies, unfolding the definitions of ZEROP and NTS+, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP N)) (NOT (LESSP TR (PLUS TS W))) (NOT (LESSP TR (NTS+ (SUB1 N) (PLUS TS W) TR W))) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP TR (NTS+ N TS TR W)))). This simplifies, unfolding the definitions of ZEROP and NTS+, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] NOT-LESSP-NTS+ (PROVE-LEMMA LESSP-NTS+ (REWRITE) (IMPLIES (AND (NOT (NENDP N TS TR W)) (NOT (LESSP TR TS)) (NOT (ZEROP W))) (LESSP TR (PLUS W (NTS+ N TS TR W))))) WARNING: Note that the proposed lemma LESSP-NTS+ is to be stored as zero type prescription rules, zero compound recognizer rules, one linear rule, and zero replacement rules. This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to the formula: (IMPLIES (AND (NOT (NENDP N TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (NTS+ N TS TR W)))). Call the above conjecture *1. Perhaps we can prove it by induction. There are six plausible inductions. They merge into three likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP N) (p TR W N TS)) (IMPLIES (AND (NOT (ZEROP N)) (LESSP (PLUS TS W) TR) (p TR W (SUB1 N) (PLUS TS W))) (p TR W N TS)) (IMPLIES (AND (NOT (ZEROP N)) (NOT (LESSP (PLUS TS W) TR))) (p TR W N TS))). 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. Note, however, the inductive instance chosen for TS. The above induction scheme leads to the following five new goals: Case 5. (IMPLIES (AND (ZEROP N) (NOT (NENDP N TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (NTS+ N TS TR W)))). This simplifies, opening up ZEROP, EQUAL, and NENDP, to: T. Case 4. (IMPLIES (AND (NOT (ZEROP N)) (LESSP (PLUS TS W) TR) (NENDP (SUB1 N) (PLUS TS W) TR W) (NOT (NENDP N TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (NTS+ N TS TR W)))). This simplifies, expanding ZEROP and NENDP, to: T. Case 3. (IMPLIES (AND (NOT (ZEROP N)) (LESSP (PLUS TS W) TR) (LESSP TR (PLUS TS W)) (NOT (NENDP N TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (NTS+ N TS TR W)))). This simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP N)) (LESSP (PLUS TS W) TR) (LESSP TR (PLUS W (NTS+ (SUB1 N) (PLUS TS W) TR W))) (NOT (NENDP N TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (NTS+ N TS TR W)))). This simplifies, expanding the functions ZEROP, NENDP, and NTS+, to: (IMPLIES (AND (NOT (EQUAL N 0)) (NUMBERP N) (LESSP (PLUS TS W) TR) (LESSP TR (PLUS W (NTS+ (SUB1 N) (PLUS TS W) TR W))) (NOT (NENDP (SUB1 N) (PLUS TS W) TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP TR (PLUS TS W))) (LESSP TR (PLUS W TS))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP N)) (NOT (LESSP (PLUS TS W) TR)) (NOT (NENDP N TS TR W)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP TR (PLUS W (NTS+ N TS TR W)))), which simplifies, expanding the functions ZEROP, NENDP, and NTS+, to two new conjectures: Case 1.2. (IMPLIES (AND (NOT (EQUAL N 0)) (NUMBERP N) (NOT (LESSP (PLUS TS W) TR)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR (PLUS TS W)))) (LESSP TR (PLUS W (NTS+ (SUB1 N) (PLUS TS W) TR W)))), which again simplifies, using linear arithmetic, to two new formulas: Case 1.2.2. (IMPLIES (AND (NOT (NUMBERP TR)) (NOT (EQUAL N 0)) (NUMBERP N) (NOT (LESSP (PLUS TS W) TR)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR (PLUS TS W)))) (LESSP TR (PLUS W (NTS+ (SUB1 N) (PLUS TS W) TR W)))), which again simplifies, unfolding the definitions of LESSP, EQUAL, and PLUS, to: T. Case 1.2.1. (IMPLIES (AND (NUMBERP TR) (NOT (EQUAL N 0)) (NUMBERP N) (NOT (LESSP (PLUS TS W) (PLUS W TS))) (NOT (LESSP (PLUS W TS) TS)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS W TS) (PLUS TS W)))) (LESSP (PLUS W TS) (PLUS W (NTS+ (SUB1 N) (PLUS TS W) (PLUS W TS) W)))), which again simplifies, rewriting with PLUS-COMMUTES1, to: (IMPLIES (AND (NUMBERP TR) (NOT (EQUAL N 0)) (NUMBERP N) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NOT (LESSP (PLUS TS W) TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (PLUS TS W) (PLUS W (NTS+ (SUB1 N) (PLUS TS W) (PLUS TS W) W)))). Applying the lemma SUB1-ELIM, replace N by (ADD1 X) to eliminate (SUB1 N). We use the type restriction lemma noted when SUB1 was introduced to restrict the new variable. This produces: (IMPLIES (AND (NUMBERP X) (NUMBERP TR) (NOT (EQUAL (ADD1 X) 0)) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NOT (LESSP (PLUS TS W) TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (PLUS TS W) (PLUS W (NTS+ X (PLUS TS W) (PLUS TS W) W)))), which further simplifies, obviously, to the new goal: (IMPLIES (AND (NUMBERP X) (NUMBERP TR) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NOT (LESSP (PLUS TS W) TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (PLUS TS W) (PLUS W (NTS+ X (PLUS TS W) (PLUS TS W) W)))), which we generalize by replacing (PLUS TS W) by Y. We restrict the new variable by recalling the type restriction lemma noted when PLUS was introduced. We would thus like to prove the new conjecture: (IMPLIES (AND (NUMBERP Y) (NUMBERP X) (NUMBERP TR) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (NTS+ X Y Y W)))), which has an irrelevant term in it. By eliminating the term we get the new conjecture: (IMPLIES (AND (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (NTS+ X Y Y W)))), which we will finally name *1.1. Case 1.1. (IMPLIES (AND (NOT (EQUAL N 0)) (NUMBERP N) (NOT (LESSP (PLUS TS W) TR)) (NOT (LESSP TR TS)) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP TR (PLUS TS W))) (LESSP TR (PLUS W TS))). But this again simplifies, using linear arithmetic, to: T. So let us turn our attention to: (IMPLIES (AND (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (NTS+ X Y Y W)))), named *1.1 above. We will try to prove it by induction. Seven inductions are suggested by terms in the conjecture. They merge into three likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP X) (p Y W X TS)) (IMPLIES (AND (NOT (ZEROP X)) (LESSP Y (PLUS Y W))) (p Y W X TS)) (IMPLIES (AND (NOT (ZEROP X)) (NOT (LESSP Y (PLUS Y W))) (p (PLUS Y W) W (SUB1 X) TS)) (p Y W X TS))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be used to prove that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for Y. The above induction scheme generates the following five new conjectures: Case 5. (IMPLIES (AND (ZEROP X) (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (NTS+ X Y Y W)))). This simplifies, expanding ZEROP, NUMBERP, EQUAL, and NTS+, to: (IMPLIES (AND (EQUAL X 0) (NUMBERP Y) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W Y))), which again simplifies, using linear arithmetic, to: T. Case 4. (IMPLIES (AND (NOT (ZEROP X)) (LESSP Y (PLUS Y W)) (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (NTS+ X Y Y W)))), which simplifies, rewriting with PLUS-COMMUTES1, and opening up the functions ZEROP and NTS+, to: T. Case 3. (IMPLIES (AND (NOT (ZEROP X)) (NOT (LESSP Y (PLUS Y W))) (LESSP (PLUS Y W) (PLUS Y W)) (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (NTS+ X Y Y W)))). This simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP X)) (NOT (LESSP Y (PLUS Y W))) (LESSP (PLUS Y W) TS) (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (NTS+ X Y Y W)))). This simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP X)) (NOT (LESSP Y (PLUS Y W))) (LESSP (PLUS Y W) (PLUS W (NTS+ (SUB1 X) (PLUS Y W) (PLUS Y W) W))) (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (LESSP Y TS)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP Y (PLUS W (NTS+ X Y Y W)))). This simplifies, using linear arithmetic, to: T. That finishes the proof of *1.1, which also finishes the proof of *1. Q.E.D. [ 0.0 0.1 0.0 ] LESSP-NTS+ (PROVE-LEMMA LST+-LISTN (REWRITE) (IMPLIES (AND (NUMBERP N) (NOT (NENDP N TS TR+ W)) (NOT (ZEROP W))) (EQUAL (LST+ (LISTN N FLG) TS TR+ W) (LISTN (NLST+ N TS TR+ W) FLG))) ((ENABLE LISTN))) This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NUMBERP N) (NOT (NENDP N TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN N FLG) TS TR+ W) (LISTN (NLST+ N TS TR+ W) FLG))), which we will name *1. Perhaps we can prove it by induction. Three inductions are suggested by terms in the conjecture. However, they merge into one likely candidate induction. We will induct according to the following scheme: (AND (IMPLIES (ZEROP N) (p N FLG TS TR+ W)) (IMPLIES (AND (NOT (ZEROP N)) (LESSP (PLUS TS W) TR+) (p (SUB1 N) FLG (PLUS TS W) TR+ W)) (p N FLG TS TR+ W)) (IMPLIES (AND (NOT (ZEROP N)) (NOT (LESSP (PLUS TS W) TR+))) (p N FLG TS TR+ W))). 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. Note, however, the inductive instance chosen for TS. The above induction scheme leads to the following four new conjectures: Case 4. (IMPLIES (AND (ZEROP N) (NUMBERP N) (NOT (NENDP N TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN N FLG) TS TR+ W) (LISTN (NLST+ N TS TR+ W) FLG))). This simplifies, opening up ZEROP, NUMBERP, EQUAL, and NENDP, to: T. Case 3. (IMPLIES (AND (NOT (ZEROP N)) (LESSP (PLUS TS W) TR+) (NENDP (SUB1 N) (PLUS TS W) TR+ W) (NUMBERP N) (NOT (NENDP N TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN N FLG) TS TR+ W) (LISTN (NLST+ N TS TR+ W) FLG))). This simplifies, expanding ZEROP and NENDP, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP N)) (LESSP (PLUS TS W) TR+) (EQUAL (LST+ (LISTN (SUB1 N) FLG) (PLUS TS W) TR+ W) (LISTN (NLST+ (SUB1 N) (PLUS TS W) TR+ W) FLG)) (NUMBERP N) (NOT (NENDP N TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN N FLG) TS TR+ W) (LISTN (NLST+ N TS TR+ W) FLG))). This simplifies, appealing to the lemma CDR-CONS, and expanding the functions ZEROP, NENDP, LISTN, LST+, and NLST+, to: (IMPLIES (AND (NOT (EQUAL N 0)) (LESSP (PLUS TS W) TR+) (EQUAL (LST+ (LISTN (SUB1 N) FLG) (PLUS TS W) TR+ W) (LISTN (NLST+ (SUB1 N) (PLUS TS W) TR+ W) FLG)) (NUMBERP N) (NOT (NENDP (SUB1 N) (PLUS TS W) TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP TR+ (PLUS TS W))) (EQUAL (CONS FLG (LISTN (SUB1 N) FLG)) (LISTN N FLG))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP N)) (NOT (LESSP (PLUS TS W) TR+)) (NUMBERP N) (NOT (NENDP N TS TR+ W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN N FLG) TS TR+ W) (LISTN (NLST+ N TS TR+ W) FLG))), which simplifies, applying CDR-CONS, and opening up ZEROP, NENDP, LISTN, LST+, and NLST+, to the following two new goals: Case 1.2. (IMPLIES (AND (NOT (EQUAL N 0)) (NOT (LESSP (PLUS TS W) TR+)) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR+ (PLUS TS W)))) (EQUAL (LST+ (LISTN (SUB1 N) FLG) (PLUS TS W) TR+ W) (LISTN (NLST+ (SUB1 N) (PLUS TS W) TR+ W) FLG))). But this again simplifies, using linear arithmetic, to two new conjectures: Case 1.2.2. (IMPLIES (AND (NOT (NUMBERP TR+)) (NOT (EQUAL N 0)) (NOT (LESSP (PLUS TS W) TR+)) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR+ (PLUS TS W)))) (EQUAL (LST+ (LISTN (SUB1 N) FLG) (PLUS TS W) TR+ W) (LISTN (NLST+ (SUB1 N) (PLUS TS W) TR+ W) FLG))), which again simplifies, expanding the definitions of LESSP, PLUS, EQUAL, and LST+, to: (IMPLIES (AND (NOT (NUMBERP TR+)) (NOT (EQUAL N 0)) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (EQUAL (PLUS TS W) 0)) (EQUAL (LISTN (SUB1 N) FLG) (LISTN (NLST+ (SUB1 N) (PLUS TS W) TR+ W) FLG))). However this again simplifies, using linear arithmetic, to: T. Case 1.2.1. (IMPLIES (AND (NUMBERP TR+) (NOT (EQUAL N 0)) (NOT (LESSP (PLUS TS W) (PLUS W TS))) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP (PLUS W TS) (PLUS TS W)))) (EQUAL (LST+ (LISTN (SUB1 N) FLG) (PLUS TS W) (PLUS W TS) W) (LISTN (NLST+ (SUB1 N) (PLUS TS W) (PLUS W TS) W) FLG))), which again simplifies, rewriting with PLUS-COMMUTES1, to: (IMPLIES (AND (NUMBERP TR+) (NOT (EQUAL N 0)) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN (SUB1 N) FLG) (PLUS TS W) (PLUS TS W) W) (LISTN (NLST+ (SUB1 N) (PLUS TS W) (PLUS TS W) W) FLG))). Applying the lemma SUB1-ELIM, replace N by (ADD1 X) to eliminate (SUB1 N). We rely upon the type restriction lemma noted when SUB1 was introduced to restrict the new variable. This produces the new goal: (IMPLIES (AND (NUMBERP X) (NUMBERP TR+) (NOT (EQUAL (ADD1 X) 0)) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN X FLG) (PLUS TS W) (PLUS TS W) W) (LISTN (NLST+ X (PLUS TS W) (PLUS TS W) W) FLG))), which further simplifies, trivially, to the new formula: (IMPLIES (AND (NUMBERP X) (NUMBERP TR+) (NOT (LESSP (PLUS TS W) (PLUS TS W))) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN X FLG) (PLUS TS W) (PLUS TS W) W) (LISTN (NLST+ X (PLUS TS W) (PLUS TS W) W) FLG))), which we generalize by replacing (PLUS TS W) by Y. We restrict the new variable by recalling the type restriction lemma noted when PLUS was introduced. We thus obtain: (IMPLIES (AND (NUMBERP Y) (NUMBERP X) (NUMBERP TR+) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN X FLG) Y Y W) (LISTN (NLST+ X Y Y W) FLG))), which has an irrelevant term in it. By eliminating the term we get: (IMPLIES (AND (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN X FLG) Y Y W) (LISTN (NLST+ X Y Y W) FLG))), which we will finally name *1.1. Case 1.1. (IMPLIES (AND (NOT (EQUAL N 0)) (NOT (LESSP (PLUS TS W) TR+)) (NUMBERP N) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP TR+ (PLUS TS W))) (EQUAL (CONS FLG (LISTN (SUB1 N) FLG)) (LISTN N FLG))). This again simplifies, expanding LISTN, to: T. So we now return to: (IMPLIES (AND (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN X FLG) Y Y W) (LISTN (NLST+ X Y Y W) FLG))), which we named *1.1 above. Let us appeal to the induction principle. There are four plausible inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP X) (p X FLG Y W)) (IMPLIES (AND (NOT (ZEROP X)) (p (SUB1 X) FLG (PLUS Y W) W)) (p X FLG Y W))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform us that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for Y. The above induction scheme generates three new goals: Case 3. (IMPLIES (AND (ZEROP X) (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN X FLG) Y Y W) (LISTN (NLST+ X Y Y W) FLG))), which simplifies, expanding ZEROP, NUMBERP, EQUAL, LISTN, LISTP, LST+, and NLST+, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP X)) (LESSP (PLUS Y W) (PLUS Y W)) (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN X FLG) Y Y W) (LISTN (NLST+ X Y Y W) FLG))), which simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP X)) (EQUAL (LST+ (LISTN (SUB1 X) FLG) (PLUS Y W) (PLUS Y W) W) (LISTN (NLST+ (SUB1 X) (PLUS Y W) (PLUS Y W) W) FLG)) (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (LST+ (LISTN X FLG) Y Y W) (LISTN (NLST+ X Y Y W) FLG))), which simplifies, rewriting with PLUS-COMMUTES1 and CDR-CONS, and unfolding the definitions of ZEROP, LISTN, LST+, and NLST+, to the following two new conjectures: Case 1.2. (IMPLIES (AND (NOT (EQUAL X 0)) (EQUAL (LST+ (LISTN (SUB1 X) FLG) (PLUS W Y) (PLUS W Y) W) (LISTN (NLST+ (SUB1 X) (PLUS Y W) (PLUS Y W) W) FLG)) (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP Y (PLUS W Y)))) (EQUAL (LST+ (LISTN (SUB1 X) FLG) (PLUS W Y) Y W) (LISTN (NLST+ (SUB1 X) (PLUS W Y) Y W) FLG))). But this again simplifies, using linear arithmetic, to: T. Case 1.1. (IMPLIES (AND (NOT (EQUAL X 0)) (EQUAL (LST+ (LISTN (SUB1 X) FLG) (PLUS W Y) (PLUS W Y) W) (LISTN (NLST+ (SUB1 X) (PLUS Y W) (PLUS Y W) W) FLG)) (NUMBERP Y) (NUMBERP X) (NOT (LESSP Y Y)) (NOT (EQUAL W 0)) (NUMBERP W) (LESSP Y (PLUS W Y))) (EQUAL (CONS FLG (LISTN (SUB1 X) FLG)) (LISTN X FLG))), which again simplifies, opening up the function LISTN, to: T. That finishes the proof of *1.1, which, consequently, finishes the proof of *1. Q.E.D. [ 0.0 0.1 0.0 ] LST+-LISTN (PROVE-LEMMA SIG-LISTN (REWRITE) (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP N TS (PLUS R TR) W)) (NUMBERP N) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (SIG (LISTN N FLG) TS (PLUS R TR) W) FLG)) ((ENABLE LISTN))) Name the conjecture *1. We will appeal to induction. Eight inductions are suggested by terms in the conjecture. They merge into three likely candidate inductions, two of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (ZEROP N) (p N FLG TS R TR W)) (IMPLIES (AND (NOT (ZEROP N)) (LESSP (PLUS TS W) (PLUS R TR)) (p (SUB1 N) FLG (PLUS TS W) R TR W)) (p N FLG TS R TR W)) (IMPLIES (AND (NOT (ZEROP N)) (NOT (LESSP (PLUS TS W) (PLUS R TR)))) (p N FLG TS R TR W))). 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. Note, however, the inductive instance chosen for TS. The above induction scheme produces the following three new conjectures: Case 3. (IMPLIES (AND (ZEROP N) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP N TS (PLUS R TR) W)) (NUMBERP N) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (SIG (LISTN N FLG) TS (PLUS R TR) W) FLG)). This simplifies, expanding the definitions of ZEROP, EQUAL, and NENDP, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP N)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP N TS (PLUS R TR) W)) (NUMBERP N) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (SIG (LISTN N FLG) TS (PLUS R TR) W) FLG)). This simplifies, applying CDR-CONS and CAR-CONS, and unfolding the functions ZEROP, NENDP, LISTN, RECONCILE-SIGNALS, and SIG, to the formula: (IMPLIES (AND (NOT (EQUAL N 0)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP (SUB1 N) (PLUS TS W) (PLUS R TR) W)) (NUMBERP N) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL FLG (SIG (LISTN (SUB1 N) FLG) (PLUS TS W) (PLUS R TR) W)))) (EQUAL 'Q FLG)). 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. The result is: (IMPLIES (AND (NUMBERP X) (NOT (EQUAL (ADD1 X) 0)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP X (PLUS TS W) (PLUS R TR) W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL FLG (SIG (LISTN X FLG) (PLUS TS W) (PLUS R TR) W)))) (EQUAL 'Q FLG)). This further simplifies, obviously, to: (IMPLIES (AND (NUMBERP X) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP X (PLUS TS W) (PLUS R TR) W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL FLG (SIG (LISTN X FLG) (PLUS TS W) (PLUS R TR) W)))) (EQUAL 'Q FLG)), which we generalize by replacing (PLUS R TR) by Y and (PLUS TS W) by A. We restrict the new variables by recalling the type restriction lemma noted when PLUS was introduced. We would thus like to prove the new conjecture: (IMPLIES (AND (NUMBERP Y) (NUMBERP A) (NUMBERP X) (LESSP A Y) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP X A Y W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR A) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL FLG (SIG (LISTN X FLG) A Y W)))) (EQUAL 'Q FLG)), which has two irrelevant terms in it. By eliminating these terms we get: (IMPLIES (AND (NUMBERP Y) (NUMBERP A) (NUMBERP X) (LESSP A Y) (NOT (NENDP X A Y W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR A) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL FLG (SIG (LISTN X FLG) A Y W)))) (EQUAL 'Q FLG)), which we will finally name *1.1. Case 1. (IMPLIES (AND (NOT (ZEROP N)) (NOT (LESSP (PLUS TS W) (PLUS R TR))) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP N TS (PLUS R TR) W)) (NUMBERP N) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (SIG (LISTN N FLG) TS (PLUS R TR) W) FLG)). This simplifies, rewriting with CAR-CONS, and opening up the definitions of ZEROP, NENDP, LISTN, and SIG, to: T. So we now return to: (IMPLIES (AND (NUMBERP Y) (NUMBERP A) (NUMBERP X) (LESSP A Y) (NOT (NENDP X A Y W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR A) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL FLG (SIG (LISTN X FLG) A Y W)))) (EQUAL 'Q FLG)), which we named *1.1 above. Let us appeal to the induction principle. There are eight plausible inductions. They merge into two likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP X) (p FLG X A Y W TR TS)) (IMPLIES (AND (NOT (ZEROP X)) (LESSP (PLUS A W) Y) (p FLG (SUB1 X) (PLUS A W) Y W TR TS)) (p FLG X A Y W TR TS)) (IMPLIES (AND (NOT (ZEROP X)) (NOT (LESSP (PLUS A W) Y))) (p FLG X A Y W TR TS))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be used to prove that the measure (COUNT X) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for A. The above induction scheme generates the following five new conjectures: Case 5. (IMPLIES (AND (ZEROP X) (NUMBERP Y) (NUMBERP A) (NUMBERP X) (LESSP A Y) (NOT (NENDP X A Y W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR A) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL FLG (SIG (LISTN X FLG) A Y W)))) (EQUAL 'Q FLG)). This simplifies, unfolding the functions ZEROP, NUMBERP, EQUAL, and NENDP, to: T. Case 4. (IMPLIES (AND (NOT (ZEROP X)) (LESSP (PLUS A W) Y) (NENDP (SUB1 X) (PLUS A W) Y W) (NUMBERP Y) (NUMBERP A) (NUMBERP X) (LESSP A Y) (NOT (NENDP X A Y W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR A) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL FLG (SIG (LISTN X FLG) A Y W)))) (EQUAL 'Q FLG)). This simplifies, unfolding ZEROP and NENDP, to: T. Case 3. (IMPLIES (AND (NOT (ZEROP X)) (LESSP (PLUS A W) Y) (NOT (LESSP TR (PLUS A W))) (NUMBERP Y) (NUMBERP A) (NUMBERP X) (LESSP A Y) (NOT (NENDP X A Y W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR A) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL FLG (SIG (LISTN X FLG) A Y W)))) (EQUAL 'Q FLG)). This simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP X)) (LESSP (PLUS A W) Y) (EQUAL FLG (SIG (LISTN (SUB1 X) FLG) (PLUS A W) Y W)) (NUMBERP Y) (NUMBERP A) (NUMBERP X) (LESSP A Y) (NOT (NENDP X A Y W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR A) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL FLG (SIG (LISTN X FLG) A Y W)))) (EQUAL 'Q FLG)). This simplifies, applying the lemmas CDR-CONS and CAR-CONS, and expanding the definitions of ZEROP, NENDP, LISTN, RECONCILE-SIGNALS, and SIG, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP X)) (NOT (LESSP (PLUS A W) Y)) (NUMBERP Y) (NUMBERP A) (NUMBERP X) (LESSP A Y) (NOT (NENDP X A Y W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR A) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL FLG (SIG (LISTN X FLG) A Y W)))) (EQUAL 'Q FLG)). This simplifies, appealing to the lemma CAR-CONS, and opening up ZEROP, NENDP, LISTN, and SIG, to: T. That finishes the proof of *1.1, which also finishes the proof of *1. Q.E.D. [ 0.0 0.1 0.0 ] SIG-LISTN (PROVE-LEMMA WARP-LISTN (REWRITE) (IMPLIES (AND (NUMBERP N) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (ZEROP W)) (NOT (ZEROP R))) (EQUAL (WARP (LISTN N FLG) TS TR W R) (LISTN (N* N TS TR W R) FLG))) ((INDUCT (N* N TS TR W R)) (ENABLE LISTN) (EXPAND (WARP (LISTN N FLG) TS TR W R)))) This conjecture can be simplified, using the abbreviations ZEROP, IMPLIES, NOT, OR, and AND, to two new goals: Case 2. (IMPLIES (AND (OR (ZEROP R) (NENDP N TS (PLUS TR R) W)) (NUMBERP N) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R)) (EQUAL (WARP (LISTN N FLG) TS TR W R) (LISTN (N* N TS TR W R) FLG))), which simplifies, applying the lemmas PLUS-COMMUTES1, LEN-LISTN, and LEN-ENDP, and opening up the definitions of ZEROP, OR, WARP, N*, EQUAL, and LISTN, to: T. Case 1. (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP N TS (PLUS TR R) W)) (IMPLIES (AND (NUMBERP (NLST+ N TS (PLUS TR R) W)) (NUMBERP (NTS+ N TS (PLUS TR R) W)) (NUMBERP (PLUS TR R)) (NOT (LESSP (PLUS TR R) (NTS+ N TS (PLUS TR R) W))) (LESSP (PLUS TR R) (PLUS (NTS+ N TS (PLUS TR R) W) W)) (NOT (ZEROP W)) (NOT (ZEROP R))) (EQUAL (WARP (LISTN (NLST+ N TS (PLUS TR R) W) FLG) (NTS+ N TS (PLUS TR R) W) (PLUS TR R) W R) (LISTN (N* (NLST+ N TS (PLUS TR R) W) (NTS+ N TS (PLUS TR R) W) (PLUS TR R) W R) FLG))) (NUMBERP N) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (WARP (LISTN N FLG) TS TR W R) (LISTN (N* N TS TR W R) FLG))), which simplifies, applying the lemmas PLUS-COMMUTES1, LEN-LISTN, LEN-ENDP, SIG-LISTN, LST+-LISTN, and LEN-TS+, and opening up the functions NOT, ZEROP, AND, IMPLIES, and WARP, to three new conjectures: Case 1.3. (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP N TS (PLUS R TR) W)) (LESSP (PLUS R TR) (NTS+ N TS (PLUS R TR) W)) (NUMBERP N) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (CONS FLG (WARP (LISTN (NLST+ N TS (PLUS R TR) W) FLG) (NTS+ N TS (PLUS R TR) W) (PLUS R TR) W R)) (LISTN (N* N TS TR W R) FLG))), which again simplifies, using linear arithmetic and rewriting with NOT-LESSP-NTS+, to: T. Case 1.2. (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP N TS (PLUS R TR) W)) (NOT (LESSP (PLUS R TR) (PLUS W (NTS+ N TS (PLUS R TR) W)))) (NUMBERP N) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (CONS FLG (WARP (LISTN (NLST+ N TS (PLUS R TR) W) FLG) (NTS+ N TS (PLUS R TR) W) (PLUS R TR) W R)) (LISTN (N* N TS TR W R) FLG))). This again simplifies, using linear arithmetic and rewriting with LESSP-NTS+, to: T. Case 1.1. (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP N TS (PLUS R TR) W)) (EQUAL (WARP (LISTN (NLST+ N TS (PLUS R TR) W) FLG) (NTS+ N TS (PLUS R TR) W) (PLUS R TR) W R) (LISTN (N* (NLST+ N TS (PLUS R TR) W) (NTS+ N TS (PLUS R TR) W) (PLUS R TR) W R) FLG)) (NUMBERP N) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (EQUAL (CONS FLG (LISTN (N* (NLST+ N TS (PLUS R TR) W) (NTS+ N TS (PLUS R TR) W) (PLUS R TR) W R) FLG)) (LISTN (N* N TS TR W R) FLG))). However this again simplifies, rewriting with PLUS-COMMUTES1 and SUB1-ADD1, and expanding N* and LISTN, to: T. Q.E.D. [ 0.0 0.1 0.0 ] WARP-LISTN (PROVE-LEMMA LST+-APP-GAP (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR+) (NENDP (LEN PAD) TS TR+ W)) (EQUAL (LST+ (APP PAD LST) TS TR+ W) (LST+ LST (PLUS TS (TIMES (LEN PAD) W)) TR+ W))) ((INDUCT (ENDP PAD TS TR+ W)))) This conjecture can be simplified, using the abbreviations IMPLIES, NLISTP, NOT, OR, AND, and PLUS-ASSOCIATES, to three new goals: Case 3. (IMPLIES (AND (NOT (LISTP PAD)) (NUMBERP TS) (NUMBERP TR+) (NENDP (LEN PAD) TS TR+ W)) (EQUAL (LST+ (APP PAD LST) TS TR+ W) (LST+ LST (PLUS TS (TIMES (LEN PAD) W)) TR+ W))), which simplifies, applying the lemma PLUS-COMMUTES1, and unfolding the functions LEN, EQUAL, NENDP, APP, TIMES, and PLUS, to: T. Case 2. (IMPLIES (AND (LISTP PAD) (LESSP (PLUS TS W) TR+) (IMPLIES (AND (NUMBERP (PLUS TS W)) (NUMBERP TR+) (NENDP (LEN (CDR PAD)) (PLUS TS W) TR+ W)) (EQUAL (LST+ (APP (CDR PAD) LST) (PLUS TS W) TR+ W) (LST+ LST (PLUS TS W (TIMES (LEN (CDR PAD)) W)) TR+ W))) (NUMBERP TS) (NUMBERP TR+) (NENDP (LEN PAD) TS TR+ W)) (EQUAL (LST+ (APP PAD LST) TS TR+ W) (LST+ LST (PLUS TS (TIMES (LEN PAD) W)) TR+ W))), which simplifies, applying the lemmas TIMES-COMMUTES1, SUB1-ADD1, CDR-CONS, and TIMES-ADD1, and unfolding the functions AND, IMPLIES, LEN, NENDP, APP, and LST+, to the formula: (IMPLIES (AND (LISTP PAD) (LESSP (PLUS TS W) TR+) (EQUAL (LST+ (APP (CDR PAD) LST) (PLUS TS W) TR+ W) (LST+ LST (PLUS TS W (TIMES W (LEN (CDR PAD)))) TR+ W)) (NUMBERP TS) (NUMBERP TR+) (NENDP (LEN (CDR PAD)) (PLUS TS W) TR+ W) (LESSP TR+ (PLUS TS W))) (EQUAL (CONS (CAR PAD) (APP (CDR PAD) LST)) (LST+ (APP (CDR PAD) LST) (PLUS TS W) TR+ W))). But this again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (LISTP PAD) (NOT (LESSP (PLUS TS W) TR+)) (NUMBERP TS) (NUMBERP TR+) (NENDP (LEN PAD) TS TR+ W)) (EQUAL (LST+ (APP PAD LST) TS TR+ W) (LST+ LST (PLUS TS (TIMES (LEN PAD) W)) TR+ W))), which simplifies, appealing to the lemma EQUAL-LEN-0, and expanding the function NENDP, to: T. Q.E.D. [ 0.0 0.0 0.0 ] LST+-APP-GAP (PROVE-LEMMA NTS+-APP-GAP (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR+) (NUMBERP K) (NENDP K TS TR+ W)) (EQUAL (NTS+ (PLUS N K) TS TR+ W) (NTS+ N (PLUS TS (TIMES K W)) TR+ W)))) This formula simplifies, applying PLUS-COMMUTES1, to: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR+) (NUMBERP K) (NENDP K TS TR+ W)) (EQUAL (NTS+ (PLUS K N) TS TR+ W) (NTS+ N (PLUS TS (TIMES K W)) TR+ W))). Give the above formula the name *1. We will appeal to induction. The recursive terms in the conjecture suggest five inductions. They merge into three likely candidate inductions. However, only one is unflawed. We will induct according to the following scheme: (AND (IMPLIES (ZEROP K) (p K N TS TR+ W)) (IMPLIES (AND (NOT (ZEROP K)) (LESSP (PLUS TS W) TR+) (p (SUB1 K) N (PLUS TS W) TR+ W)) (p K N TS TR+ W)) (IMPLIES (AND (NOT (ZEROP K)) (NOT (LESSP (PLUS TS W) TR+))) (p K N TS TR+ W))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP can be used to prove that the measure (COUNT K) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme generates four new goals: Case 4. (IMPLIES (AND (ZEROP K) (NUMBERP TS) (NUMBERP TR+) (NUMBERP K) (NENDP K TS TR+ W)) (EQUAL (NTS+ (PLUS K N) TS TR+ W) (NTS+ N (PLUS TS (TIMES K W)) TR+ W))), which simplifies, rewriting with the lemma PLUS-COMMUTES1, and opening up the definitions of ZEROP, NUMBERP, EQUAL, NENDP, PLUS, and TIMES, to the formula: (IMPLIES (AND (EQUAL K 0) (NUMBERP TS) (NUMBERP TR+) (NOT (NUMBERP N))) (EQUAL (NTS+ 0 TS TR+ W) (NTS+ N TS TR+ W))). However this again simplifies, opening up the definitions of EQUAL and NTS+, to: T. Case 3. (IMPLIES (AND (NOT (ZEROP K)) (LESSP (PLUS TS W) TR+) (NOT (NENDP (SUB1 K) (PLUS TS W) TR+ W)) (NUMBERP TS) (NUMBERP TR+) (NUMBERP K) (NENDP K TS TR+ W)) (EQUAL (NTS+ (PLUS K N) TS TR+ W) (NTS+ N (PLUS TS (TIMES K W)) TR+ W))), which simplifies, unfolding the functions ZEROP and NENDP, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP K)) (LESSP (PLUS TS W) TR+) (EQUAL (NTS+ (PLUS (SUB1 K) N) (PLUS TS W) TR+ W) (NTS+ N (PLUS (PLUS TS W) (TIMES (SUB1 K) W)) TR+ W)) (NUMBERP TS) (NUMBERP TR+) (NUMBERP K) (NENDP K TS TR+ W)) (EQUAL (NTS+ (PLUS K N) TS TR+ W) (NTS+ N (PLUS TS (TIMES K W)) TR+ W))), which simplifies, applying PLUS-ASSOCIATES and SUB1-ADD1, and opening up the functions ZEROP, NENDP, PLUS, NTS+, and TIMES, to: (IMPLIES (AND (NOT (EQUAL K 0)) (LESSP (PLUS TS W) TR+) (EQUAL (NTS+ (PLUS (SUB1 K) N) (PLUS TS W) TR+ W) (NTS+ N (PLUS TS W (TIMES (SUB1 K) W)) TR+ W)) (NUMBERP TS) (NUMBERP TR+) (NUMBERP K) (NENDP (SUB1 K) (PLUS TS W) TR+ W) (LESSP TR+ (PLUS TS W))) (EQUAL TS (NTS+ (PLUS (SUB1 K) N) (PLUS TS W) TR+ W))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP K)) (NOT (LESSP (PLUS TS W) TR+)) (NUMBERP TS) (NUMBERP TR+) (NUMBERP K) (NENDP K TS TR+ W)) (EQUAL (NTS+ (PLUS K N) TS TR+ W) (NTS+ N (PLUS TS (TIMES K W)) TR+ W))), which simplifies, unfolding the definitions of ZEROP and NENDP, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.1 0.0 ] NTS+-APP-GAP (PROVE-LEMMA WARP-APP-GAP (REWRITE) (IMPLIES (AND (NUMBERP TS) (NOT (ZEROP R)) (NENDP (LEN PAD) TS (PLUS R TR) W)) (EQUAL (WARP (APP PAD LST) TS TR W R) (IF (NENDP (PLUS (LEN PAD) (LEN LST)) TS (PLUS R TR) W) NIL (CONS (SIG (APP PAD LST) TS (PLUS R TR) W) (WARP (LST+ LST (PLUS TS (TIMES (LEN PAD) W)) (PLUS R TR) W) (NTS+ (LEN LST) (PLUS TS (TIMES (LEN PAD) W)) (PLUS R TR) W) (PLUS R TR) W R))))) ((EXPAND (WARP (APP PAD LST) TS TR W R)))) This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to the new conjecture: (IMPLIES (AND (NUMBERP TS) (NOT (EQUAL R 0)) (NUMBERP R) (NENDP (LEN PAD) TS (PLUS R TR) W)) (EQUAL (WARP (APP PAD LST) TS TR W R) (IF (NENDP (PLUS (LEN PAD) (LEN LST)) TS (PLUS R TR) W) NIL (CONS (SIG (APP PAD LST) TS (PLUS R TR) W) (WARP (LST+ LST (PLUS TS (TIMES (LEN PAD) W)) (PLUS R TR) W) (NTS+ (LEN LST) (PLUS TS (TIMES (LEN PAD) W)) (PLUS R TR) W) (PLUS R TR) W R))))), which simplifies, appealing to the lemmas PLUS-COMMUTES1, LEN-APP, LEN-ENDP, TIMES-COMMUTES1, LST+-APP-GAP, NTS+-APP-GAP, and LEN-TS+, and unfolding WARP, to: T. Q.E.D. [ 0.0 0.0 0.0 ] WARP-APP-GAP (PROVE-LEMMA NENDP-NLST* (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (ZEROP R)) (NOT (ZEROP W)) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NENDP (NLST* K TS TR W R) (NTS* K TS TR W R) (PLUS R (NTR* K TS TR W R)) W))) This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NENDP (NLST* K TS TR W R) (NTS* K TS TR W R) (PLUS R (NTR* K TS TR W R)) W)), which we will name *1. We will appeal to induction. Eight inductions are suggested by terms in the conjecture. They merge into three likely candidate inductions, two of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (OR (ZEROP R) (NENDP K TS (PLUS TR R) W)) (p K TS TR W R)) (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (p (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R)) (p K TS TR W R))). Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, NLST+-EQUAL-N, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LESSP-NLST+, and the definitions of LISTP, ORDINALP, NLST+, LESSP, ORD-LESSP, EQUAL, OR, ZEROP, NTS+, and NENDP inform us that the measure: (CONS (CONS (ADD1 K) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each induction step of the scheme. The above induction scheme produces the following five new goals: Case 5. (IMPLIES (AND (OR (ZEROP R) (NENDP K TS (PLUS TR R) W)) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NENDP (NLST* K TS TR W R) (NTS* K TS TR W R) (PLUS R (NTR* K TS TR W R)) W)). This simplifies, appealing to the lemma PLUS-COMMUTES1, and unfolding the functions ZEROP, OR, NLST*, NTS*, and NTR*, to: T. Case 4. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (NOT (NUMBERP (NTS+ K TS (PLUS TR R) W))) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NENDP (NLST* K TS TR W R) (NTS* K TS TR W R) (PLUS R (NTR* K TS TR W R)) W)). This simplifies, applying PLUS-COMMUTES1, and unfolding the definitions of ZEROP and OR, to: T. Case 3. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (LESSP (PLUS TR R) (NTS+ K TS (PLUS TR R) W)) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NENDP (NLST* K TS TR W R) (NTS* K TS TR W R) (PLUS R (NTR* K TS TR W R)) W)), which simplifies, using linear arithmetic and rewriting with NOT-LESSP-NTS+, to: T. Case 2. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (NOT (LESSP (PLUS TR R) (PLUS (NTS+ K TS (PLUS TR R) W) W))) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NENDP (NLST* K TS TR W R) (NTS* K TS TR W R) (PLUS R (NTR* K TS TR W R)) W)). This simplifies, applying PLUS-COMMUTES1, and unfolding the definitions of ZEROP, OR, NLST*, NTS*, and NTR*, to: (IMPLIES (AND (NOT (NENDP K TS (PLUS R TR) W)) (NOT (LESSP (PLUS R TR) (PLUS W (NTS+ K TS (PLUS R TR) W)))) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NENDP (NLST* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R) (NTS* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R) (PLUS R (NTR* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R)) W)). This again simplifies, using linear arithmetic and applying LESSP-NTS+, to: T. Case 1. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (NENDP (NLST* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R) (NTS* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R) (PLUS R (NTR* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R)) W) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NENDP (NLST* K TS TR W R) (NTS* K TS TR W R) (PLUS R (NTR* K TS TR W R)) W)). This simplifies, appealing to the lemma PLUS-COMMUTES1, and expanding the definitions of ZEROP, OR, NLST*, NTS*, and NTR*, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] NENDP-NLST* (DEFN NQG (K TS TR W R) (IF (LESSP (PLUS R TR) (PLUS W TS (TIMES W K))) (IF (LESSP (PLUS R R TR) (PLUS W TS (TIMES W K))) 3 2) 1)) From the definition we can conclude that (NUMBERP (NQG K TS TR W R)) is a theorem. [ 0.0 0.0 0.0 ] NQG (DEFN DWG (K TS TR W R) (IF (LESSP (PLUS R TR) (PLUS TS W (TIMES K W))) (IF (LESSP (PLUS R R TR) (PLUS TS W W (TIMES K W))) 0 1) (IF (EQUAL (PLUS R TR) (PLUS TS W (TIMES K W))) 0 (IF (AND (LESSP (PLUS TS W (TIMES K W)) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W (TIMES K W)))) 0 (IF (LESSP (PLUS R TR) (PLUS TS W W (TIMES K W))) 0 1))))) Observe that (NUMBERP (DWG K TS TR W R)) is a theorem. [ 0.0 0.0 0.0 ] DWG (DEFN TSG (K TS TR W R) (PLUS TS (TIMES W K) W (TIMES W (DWG K TS TR W R)))) Note that (NUMBERP (TSG K TS TR W R)) is a theorem. [ 0.0 0.0 0.0 ] TSG (DEFN TRG (K TS TR W R) (PLUS TR (TIMES R (NQG K TS TR W R)))) Observe that (NUMBERP (TRG K TS TR W R)) is a theorem. [ 0.0 0.0 0.0 ] TRG (PROVE-LEMMA NOT-LESSP-NTR*-NTS* (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (ZEROP W))) (NOT (LESSP (NTR* K TS TR W R) (NTS* K TS TR W R))))) WARNING: Note that the proposed lemma NOT-LESSP-NTR*-NTS* is to be stored as zero type prescription rules, zero compound recognizer rules, two linear rules, and zero replacement rules. This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP (NTR* K TS TR W R) (NTS* K TS TR W R)))), which we will name *1. We will appeal to induction. There are six plausible inductions. They merge into two likely candidate inductions, both of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (OR (ZEROP R) (NENDP K TS (PLUS TR R) W)) (p K TS TR W R)) (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (p (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R)) (p K TS TR W R))). Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, NLST+-EQUAL-N, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LESSP-NLST+, and the definitions of LISTP, ORDINALP, NLST+, LESSP, ORD-LESSP, EQUAL, OR, ZEROP, NTS+, and NENDP establish that the measure: (CONS (CONS (ADD1 K) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each induction step of the scheme. The above induction scheme leads to the following five new conjectures: Case 5. (IMPLIES (AND (OR (ZEROP R) (NENDP K TS (PLUS TR R) W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP (NTR* K TS TR W R) (NTS* K TS TR W R)))). This simplifies, rewriting with the lemma PLUS-COMMUTES1, and opening up ZEROP, OR, EQUAL, NTR*, and NTS*, to: T. Case 4. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (NOT (NUMBERP (NTS+ K TS (PLUS TR R) W))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP (NTR* K TS TR W R) (NTS* K TS TR W R)))). This simplifies, rewriting with PLUS-COMMUTES1, and unfolding the functions ZEROP and OR, to: T. Case 3. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (LESSP (PLUS TR R) (NTS+ K TS (PLUS TR R) W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP (NTR* K TS TR W R) (NTS* K TS TR W R)))), which simplifies, using linear arithmetic and rewriting with NOT-LESSP-NTS+, to: T. Case 2. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (NOT (LESSP (PLUS TR R) (PLUS (NTS+ K TS (PLUS TR R) W) W))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP (NTR* K TS TR W R) (NTS* K TS TR W R)))). This simplifies, applying PLUS-COMMUTES1, and opening up the functions ZEROP, OR, NTR*, and NTS*, to: (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP K TS (PLUS R TR) W)) (NOT (LESSP (PLUS R TR) (PLUS W (NTS+ K TS (PLUS R TR) W)))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP (NTR* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R) (NTS* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R)))). But this again simplifies, using linear arithmetic and rewriting with LESSP-NTS+, to: T. Case 1. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (NOT (LESSP (NTR* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R) (NTS* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (NOT (LESSP (NTR* K TS TR W R) (NTS* K TS TR W R)))). This simplifies, rewriting with PLUS-COMMUTES1, and unfolding the definitions of ZEROP, OR, NTR*, and NTS*, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] NOT-LESSP-NTR*-NTS* (PROVE-LEMMA LESSP-NTR*-NTS* (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (ZEROP W))) (LESSP (NTR* K TS TR W R) (PLUS W (NTS* K TS TR W R))))) WARNING: Note that the proposed lemma LESSP-NTR*-NTS* is to be stored as zero type prescription rules, zero compound recognizer rules, two linear rules, and zero replacement rules. This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (NTR* K TS TR W R) (PLUS W (NTS* K TS TR W R)))). Call the above conjecture *1. We will appeal to induction. Seven inductions are suggested by terms in the conjecture. They merge into three likely candidate inductions, two of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (OR (ZEROP R) (NENDP K TS (PLUS TR R) W)) (p K TS TR W R)) (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (p (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R)) (p K TS TR W R))). Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, NLST+-EQUAL-N, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LESSP-NLST+, and the definitions of LISTP, ORDINALP, NLST+, LESSP, ORD-LESSP, EQUAL, OR, ZEROP, NTS+, and NENDP can be used to show that the measure: (CONS (CONS (ADD1 K) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each induction step of the scheme. The above induction scheme produces five new formulas: Case 5. (IMPLIES (AND (OR (ZEROP R) (NENDP K TS (PLUS TR R) W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (NTR* K TS TR W R) (PLUS W (NTS* K TS TR W R)))), which simplifies, applying PLUS-COMMUTES1, and opening up the definitions of ZEROP, OR, EQUAL, NTR*, and NTS*, to: T. Case 4. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (NOT (NUMBERP (NTS+ K TS (PLUS TR R) W))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (NTR* K TS TR W R) (PLUS W (NTS* K TS TR W R)))). This simplifies, applying PLUS-COMMUTES1, and opening up ZEROP and OR, to: T. Case 3. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (LESSP (PLUS TR R) (NTS+ K TS (PLUS TR R) W)) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (NTR* K TS TR W R) (PLUS W (NTS* K TS TR W R)))), which simplifies, using linear arithmetic and applying NOT-LESSP-NTS+, to: T. Case 2. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (NOT (LESSP (PLUS TR R) (PLUS (NTS+ K TS (PLUS TR R) W) W))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (NTR* K TS TR W R) (PLUS W (NTS* K TS TR W R)))). This simplifies, applying PLUS-COMMUTES1, and unfolding ZEROP, OR, NTR*, and NTS*, to the conjecture: (IMPLIES (AND (NOT (EQUAL R 0)) (NUMBERP R) (NOT (NENDP K TS (PLUS R TR) W)) (NOT (LESSP (PLUS R TR) (PLUS W (NTS+ K TS (PLUS R TR) W)))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (NTR* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R) (PLUS W (NTS* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R)))). This again simplifies, using linear arithmetic and applying LESSP-NTS+, to: T. Case 1. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (LESSP (NTR* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R) (PLUS W (NTS* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R))) (NUMBERP TS) (NUMBERP TR) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (NOT (EQUAL W 0)) (NUMBERP W)) (LESSP (NTR* K TS TR W R) (PLUS W (NTS* K TS TR W R)))). This simplifies, rewriting with PLUS-COMMUTES1, and expanding the definitions of ZEROP, OR, NTR*, and NTS*, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.2 0.0 ] LESSP-NTR*-NTS* (PROVE-LEMMA NENDP-IS-USUALLY-F (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LESSP 2 K)) (NOT (NENDP K TS (PLUS R TR) W))) ((EXPAND (NENDP K TS (PLUS R TR) W) (NENDP (SUB1 K) (PLUS TS W) (PLUS R TR) W) (NENDP (SUB1 (SUB1 K)) (PLUS TS W W) (PLUS R TR) W)))) This conjecture simplifies, applying the lemma PLUS-ASSOCIATES, and expanding the function NENDP, to the following five new conjectures: Case 5. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LESSP 2 K)) (NOT (EQUAL K 0))). But this again simplifies, using linear arithmetic, to: T. Case 4. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LESSP 2 K)) (NUMBERP K)), which again simplifies, opening up the definition of LESSP, to: T. Case 3. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LESSP 2 K) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR))) (NOT (EQUAL (SUB1 (SUB1 K)) 0))), which again simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LESSP 2 K) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (LESSP (PLUS TS W W W) (PLUS R TR))) (NOT (NENDP (SUB1 (SUB1 (SUB1 K))) (PLUS TS W W W) (PLUS R TR) W))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LESSP 2 K) (LESSP (PLUS TS W) (PLUS R TR))) (NOT (EQUAL (SUB1 K) 0))), which again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] NENDP-IS-USUALLY-F (PROVE-LEMMA LESSP-PLUS-NTS*-TIMES-W-NLST*-PLUS-R-NTR*-LEMMA (REWRITE) (IMPLIES (AND (NENDP K TS (PLUS R TR) W) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS R TR) TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS (TIMES K W)))))) WARNING: When the linear lemma: LESSP-PLUS-NTS*-TIMES-W-NLST*-PLUS-R-NTR*-LEMMA is stored under (TIMES K W) it contains the free variables TR, R, and TS which will be chosen by instantiating the hypothesis (NENDP K TS (PLUS R TR) W). WARNING: Note that the proposed lemma: LESSP-PLUS-NTS*-TIMES-W-NLST*-PLUS-R-NTR*-LEMMA 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. Nine inductions are suggested by terms in the conjecture. They merge into four likely candidate inductions, two of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (ZEROP K) (p R TR TS K W)) (IMPLIES (AND (NOT (ZEROP K)) (LESSP (PLUS TS W) (PLUS R TR)) (p R TR (PLUS TS W) (SUB1 K) W)) (p R TR TS K W)) (IMPLIES (AND (NOT (ZEROP K)) (NOT (LESSP (PLUS TS W) (PLUS R TR)))) (p R TR TS K W))). Linear arithmetic, the lemma COUNT-NUMBERP, and the definition of ZEROP inform us that the measure (COUNT K) decreases according to the well-founded relation LESSP in each induction step of the scheme. Note, however, the inductive instance chosen for TS. The above induction scheme produces the following six new conjectures: Case 6. (IMPLIES (AND (ZEROP K) (NENDP K TS (PLUS R TR) W) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS R TR) TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS (TIMES K W))))). This simplifies, applying PLUS-COMMUTES1, and unfolding the definitions of ZEROP, EQUAL, NENDP, TIMES, and PLUS, to: T. Case 5. (IMPLIES (AND (NOT (ZEROP K)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (NENDP (SUB1 K) (PLUS TS W) (PLUS R TR) W)) (NENDP K TS (PLUS R TR) W) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS R TR) TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS (TIMES K W))))), which simplifies, opening up ZEROP and NENDP, to: T. Case 4. (IMPLIES (AND (NOT (ZEROP K)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W)) (NENDP K TS (PLUS R TR) W) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS R TR) TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS (TIMES K W))))), which simplifies, using linear arithmetic, to: T. Case 3. (IMPLIES (AND (NOT (ZEROP K)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (LESSP TR (PLUS (PLUS TS W) W))) (NENDP K TS (PLUS R TR) W) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS R TR) TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS (TIMES K W))))), which simplifies, using linear arithmetic, to: T. Case 2. (IMPLIES (AND (NOT (ZEROP K)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS (PLUS TS W) (TIMES (SUB1 K) W)))) (NENDP K TS (PLUS R TR) W) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS R TR) TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS (TIMES K W))))), which simplifies, applying PLUS-ASSOCIATES, and opening up the functions ZEROP, NENDP, and TIMES, to: T. Case 1. (IMPLIES (AND (NOT (ZEROP K)) (NOT (LESSP (PLUS TS W) (PLUS R TR))) (NENDP K TS (PLUS R TR) W) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP (PLUS R TR) TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS (TIMES K W))))). This simplifies, opening up ZEROP and NENDP, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LESSP-PLUS-NTS*-TIMES-W-NLST*-PLUS-R-NTR*-LEMMA (PROVE-LEMMA NOT-LESSP-PLUS-R-NTR*-PLUS-NTS*-TIMES-W-NLST* (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (ZEROP W)) (NOT (ZEROP R)) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R (NTR* K TS TR W R)) (PLUS (NTS* K TS TR W R) (TIMES W (NLST* K TS TR W R))))))) WARNING: Note that the proposed lemma: NOT-LESSP-PLUS-R-NTR*-PLUS-NTS*-TIMES-W-NLST* is to be stored as zero type prescription rules, zero compound recognizer rules, one linear rule, and zero replacement rules. This formula can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R (NTR* K TS TR W R)) (PLUS (NTS* K TS TR W R) (TIMES W (NLST* K TS TR W R)))))), which we will name *1. Perhaps we can prove it by induction. Nine inductions are suggested by terms in the conjecture. They merge into four likely candidate inductions, two of which are unflawed. So we will choose the one suggested by the largest number of nonprimitive recursive functions. We will induct according to the following scheme: (AND (IMPLIES (OR (ZEROP R) (NENDP K TS (PLUS TR R) W)) (p R K TS TR W)) (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (p R (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W)) (p R K TS TR W))). Linear arithmetic, the lemmas CAR-CONS, CDR-CONS, SUB1-ADD1, NLST+-EQUAL-N, ADD1-EQUAL, CONS-EQUAL, PLUS-COMMUTES1, and LESSP-NLST+, and the definitions of LISTP, ORDINALP, NLST+, LESSP, ORD-LESSP, EQUAL, OR, ZEROP, NTS+, and NENDP establish that the measure: (CONS (CONS (ADD1 K) 0) (DIFFERENCE (PLUS TS W) TR)) decreases according to the well-founded relation ORD-LESSP in each induction step of the scheme. The above induction scheme produces the following five new conjectures: Case 5. (IMPLIES (AND (OR (ZEROP R) (NENDP K TS (PLUS TR R) W)) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R (NTR* K TS TR W R)) (PLUS (NTS* K TS TR W R) (TIMES W (NLST* K TS TR W R)))))). This simplifies, appealing to the lemmas PLUS-COMMUTES1 and TIMES-COMMUTES1, and unfolding ZEROP, OR, NTR*, NTS*, and NLST*, to: (IMPLIES (AND (NENDP K TS (PLUS R TR) W) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS (TIMES K W))))), which again simplifies, using linear arithmetic and applying LESSP-PLUS-NTS*-TIMES-W-NLST*-PLUS-R-NTR*-LEMMA, to: T. Case 4. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (NOT (NUMBERP (NTS+ K TS (PLUS TR R) W))) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R (NTR* K TS TR W R)) (PLUS (NTS* K TS TR W R) (TIMES W (NLST* K TS TR W R)))))). This simplifies, rewriting with the lemma PLUS-COMMUTES1, and unfolding the functions ZEROP and OR, to: T. Case 3. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (LESSP (PLUS TR R) (NTS+ K TS (PLUS TR R) W)) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R (NTR* K TS TR W R)) (PLUS (NTS* K TS TR W R) (TIMES W (NLST* K TS TR W R)))))). This simplifies, using linear arithmetic and applying NOT-LESSP-NTS+, to: T. Case 2. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (NOT (LESSP (PLUS TR R) (PLUS (NTS+ K TS (PLUS TR R) W) W))) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R (NTR* K TS TR W R)) (PLUS (NTS* K TS TR W R) (TIMES W (NLST* K TS TR W R)))))), which simplifies, rewriting with PLUS-COMMUTES1, and expanding ZEROP, OR, NTR*, NTS*, and NLST*, to the new goal: (IMPLIES (AND (NOT (NENDP K TS (PLUS R TR) W)) (NOT (LESSP (PLUS R TR) (PLUS W (NTS+ K TS (PLUS R TR) W)))) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R (NTR* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R)) (PLUS (NTS* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R) (TIMES W (NLST* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R)))))), which again simplifies, using linear arithmetic and applying the lemma LESSP-NTS+, to: T. Case 1. (IMPLIES (AND (NOT (OR (ZEROP R) (NENDP K TS (PLUS TR R) W))) (NOT (LESSP (PLUS R (NTR* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R)) (PLUS (NTS* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R) (TIMES W (NLST* (NLST+ K TS (PLUS TR R) W) (NTS+ K TS (PLUS TR R) W) (PLUS TR R) W R))))) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W))) (NOT (LESSP (PLUS R (NTR* K TS TR W R)) (PLUS (NTS* K TS TR W R) (TIMES W (NLST* K TS TR W R)))))), which simplifies, appealing to the lemma PLUS-COMMUTES1, and opening up the functions ZEROP, OR, NTR*, NTS*, and NLST*, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.1 0.0 ] NOT-LESSP-PLUS-R-NTR*-PLUS-NTS*-TIMES-W-NLST* (PROVE-LEMMA HELPER1 (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LESSP (PLUS TS W W) (PLUS R TR)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS TS W W)))) (EQUAL (WARP (LST+ REST (PLUS TS W W) (PLUS R TR) W) (NTS+ (LEN REST) (PLUS TS W W) (PLUS R TR) W) (PLUS R TR) W R) (WARP REST (PLUS TS W W) (PLUS R TR) W R))) ((EXPAND (LST+ REST (PLUS TS W W) (PLUS R TR) W) (NTS+ (LEN REST) (PLUS TS W W) (PLUS R TR) W)))) This simplifies, appealing to the lemmas PLUS-ASSOCIATES and EQUAL-LEN-0, and unfolding the definitions of LST+ and NTS+, to: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LESSP (PLUS TS W W) (PLUS R TR)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS TS W W))) (NOT (LESSP (PLUS R TR) (PLUS TS W W W)))) (EQUAL (WARP (LST+ (CDR REST) (PLUS TS W W W) (PLUS R TR) W) (NTS+ (SUB1 (LEN REST)) (PLUS TS W W W) (PLUS R TR) W) (PLUS R TR) W R) (WARP REST (PLUS TS W W) (PLUS R TR) W R))), which again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] HELPER1 (PROVE-LEMMA HELPER5 (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (EQUAL (SUB1 (SUB1 K)) 0) (LESSP (PLUS TS W W) (PLUS R TR)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W (TIMES K W))) (NOT (LESSP (PLUS R R TR) (PLUS TS W (TIMES K W)))) (LESSP (PLUS R R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (WARP (CONS 'Q REST) (PLUS TS (TIMES K W)) (PLUS R TR) W R) (CONS 'Q (WARP REST (PLUS TS W (TIMES K W)) (PLUS TR (TIMES 2 R)) W R)))) ((EXPAND (WARP (CONS 'Q REST) (PLUS TS W (TIMES W (SUB1 K))) (PLUS R TR) W R) (TIMES 2 R)))) This formula simplifies, using linear arithmetic, applying PLUS-COMMUTES1, TIMES-COMMUTES1, PLUS-ASSOCIATES, CDR-CONS, EQUAL-LEN-0, SUB1-ADD1, NENDP-IS-USUALLY-F, LEN-ENDP, CAR-CONS, LEN-TS+, and PLUS-COMMUTES2, and opening up the functions TIMES, EQUAL, NUMBERP, SUB1, PLUS, WARP, LEN, LESSP, RECONCILE-SIGNALS, SIG, LST+, and NTS+, to: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (EQUAL (SUB1 (SUB1 K)) 0) (LESSP (PLUS TS W W) (PLUS R TR)) (LESSP (PLUS TS W) (PLUS R TR)) (EQUAL K 0) (LESSP (PLUS R TR) (PLUS TS W 0)) (NOT (LESSP (PLUS R R TR) (PLUS TS W))) (LESSP (PLUS R R TR) (PLUS TS W W))) (EQUAL (WARP (CONS 'Q REST) TS (PLUS R TR) W R) (CONS 'Q (WARP REST (PLUS TS W) (PLUS R R TR) W R)))). But this again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.1 0.0 ] HELPER5 (PROVE-LEMMA HELPER7 (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS TS W W))) (LESSP (PLUS R TR) (PLUS TS W W W))) (EQUAL (WARP (CONS FLG1 (CONS 'Q REST)) TS TR W R) (CONS 'Q (WARP REST (PLUS TS W W) (PLUS R TR) W R)))) ((EXPAND (WARP (CONS FLG1 (CONS 'Q REST)) TS TR W R)))) This conjecture simplifies, using linear arithmetic, applying PLUS-COMMUTES1, CDR-CONS, NENDP-IS-USUALLY-F, LEN-ENDP, CAR-CONS, PLUS-ASSOCIATES, SUB1-ADD1, LEN-TS+, and CONS-EQUAL, and opening up WARP, LEN, RECONCILE-SIGNALS, SIG, LST+, NTS+, and EQUAL, to: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS TS W W))) (LESSP (PLUS R TR) (PLUS TS W W W)) (LESSP (PLUS R TR) (PLUS TS W))) (EQUAL (WARP (CONS FLG1 (CONS 'Q REST)) TS (PLUS R TR) W R) (WARP REST (PLUS TS W W) (PLUS R TR) W R))). This again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.0 0.0 ] HELPER7 (PROVE-LEMMA HELPER8 (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (NOT (EQUAL (PLUS R TR) (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS W W)))) (EQUAL (WARP (CONS 'Q REST) TS TR W R) (CONS 'Q (WARP (CDR REST) (PLUS TS W W) (PLUS R TR) W R)))) ((EXPAND (WARP (CONS 'Q REST) TS TR W R) (LST+ (CDR REST) (PLUS TS W W) (PLUS R TR) W) (NTS+ (LEN (CDR REST)) (PLUS TS W W) (PLUS R TR) W) (LST+ REST (PLUS TS W) (PLUS R TR) W) (NTS+ (ADD1 (LEN (CDR REST))) (PLUS TS W) (PLUS R TR) W)))) This formula simplifies, rewriting with the lemmas PLUS-COMMUTES1, CDR-CONS, EQUAL-LEN-0, SUB1-ADD1, NENDP-IS-USUALLY-F, LEN-ENDP, CAR-CONS, PLUS-ASSOCIATES, LEN-TS+, and CONS-EQUAL, and opening up WARP, LEN, LESSP, EQUAL, NUMBERP, SUB1, RECONCILE-SIGNALS, SIG, and NTS+, to two new formulas: Case 2. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (NOT (EQUAL (PLUS R TR) (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS W W))) (NOT (LESSP (PLUS R TR) (PLUS TS W W W)))) (EQUAL (WARP (LST+ (CONS 'Q REST) TS (PLUS R TR) W) (NTS+ (SUB1 (LEN (CDR REST))) (PLUS TS W W W) (PLUS R TR) W) (PLUS R TR) W R) (WARP (CDR REST) (PLUS TS W W) (PLUS R TR) W R))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (NOT (EQUAL (PLUS R TR) (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS W W))) (LESSP (PLUS R TR) (PLUS TS W W W))) (EQUAL (WARP (LST+ (CONS 'Q REST) TS (PLUS R TR) W) (PLUS TS W W) (PLUS R TR) W R) (WARP (CDR REST) (PLUS TS W W) (PLUS R TR) W R))), which again simplifies, applying the lemmas PLUS-ASSOCIATES and CDR-CONS, and opening up LST+, to: T. Q.E.D. [ 0.0 0.1 0.0 ] HELPER8 (PROVE-LEMMA HELPER9 (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (NOT (LESSP (PLUS R R TR) (PLUS TS W W))) (NOT (LESSP (PLUS R R TR) (PLUS TS W W W)))) (EQUAL (WARP (CONS FLG1 (CONS 'Q REST)) TS TR W R) (CONS 'Q (CONS 'Q (WARP (CDR REST) (PLUS TS W W W) (PLUS R R TR) W R))))) ((EXPAND (WARP (CONS FLG1 (CONS 'Q REST)) TS TR W R)))) This formula simplifies, using linear arithmetic, rewriting with PLUS-COMMUTES1, CDR-CONS, NENDP-IS-USUALLY-F, LEN-ENDP, CAR-CONS, PLUS-ASSOCIATES, SUB1-ADD1, LEN-TS+, and CONS-EQUAL, and expanding the functions WARP, LEN, RECONCILE-SIGNALS, SIG, LST+, NTS+, and EQUAL, to two new goals: Case 2. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (NOT (LESSP (PLUS R R TR) (PLUS TS W W))) (NOT (LESSP (PLUS R R TR) (PLUS TS W W W))) (NOT (LESSP (PLUS R TR) (PLUS TS W)))) (EQUAL (WARP (CONS 'Q REST) (PLUS TS W) (PLUS R TR) W R) (CONS 'Q (WARP (CDR REST) (PLUS TS W W W) (PLUS R R TR) W R)))), which again simplifies, using linear arithmetic and applying PLUS-ASSOCIATES and HELPER8, to: T. Case 1. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (NOT (LESSP (PLUS R R TR) (PLUS TS W W))) (NOT (LESSP (PLUS R R TR) (PLUS TS W W W))) (LESSP (PLUS R TR) (PLUS TS W))) (EQUAL (WARP (CONS FLG1 (CONS 'Q REST)) TS (PLUS R TR) W R) (CONS 'Q (WARP (CDR REST) (PLUS TS W W W) (PLUS R R TR) W R)))). However this again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.1 0.0 ] HELPER9 (PROVE-LEMMA HELPER10 (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (NOT (LESSP (PLUS R R TR) (PLUS TS W W))) (LESSP (PLUS R R TR) (PLUS TS W W W))) (EQUAL (WARP (CONS FLG1 (CONS 'Q REST)) TS TR W R) (CONS 'Q (CONS 'Q (WARP REST (PLUS TS W W) (PLUS R R TR) W R))))) ((EXPAND (WARP (CONS FLG1 (CONS 'Q REST)) TS TR W R) (WARP (CONS 'Q REST) (PLUS TS W) (PLUS R TR) W R)))) This simplifies, using linear arithmetic, rewriting with PLUS-COMMUTES1, CDR-CONS, NENDP-IS-USUALLY-F, LEN-ENDP, CAR-CONS, PLUS-ASSOCIATES, SUB1-ADD1, LEN-TS+, and CONS-EQUAL, and expanding the definitions of WARP, LEN, RECONCILE-SIGNALS, SIG, LST+, NTS+, and EQUAL, to the following two new formulas: Case 2. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (NOT (LESSP (PLUS R R TR) (PLUS TS W W))) (LESSP (PLUS R R TR) (PLUS TS W W W)) (NOT (LESSP (PLUS R TR) (PLUS TS W)))) (EQUAL (WARP (CONS 'Q REST) (PLUS TS W) (PLUS R TR) W R) (CONS 'Q (WARP REST (PLUS TS W W) (PLUS R R TR) W R)))). But this again simplifies, using linear arithmetic, rewriting with PLUS-COMMUTES1, PLUS-ASSOCIATES, CDR-CONS, EQUAL-LEN-0, SUB1-ADD1, NENDP-IS-USUALLY-F, LEN-ENDP, CAR-CONS, and LEN-TS+, and expanding the definitions of WARP, LEN, LESSP, EQUAL, NUMBERP, SUB1, RECONCILE-SIGNALS, SIG, LST+, and NTS+, to: T. Case 1. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (NOT (LESSP (PLUS R R TR) (PLUS TS W W))) (LESSP (PLUS R R TR) (PLUS TS W W W)) (LESSP (PLUS R TR) (PLUS TS W))) (EQUAL (WARP (CONS FLG1 (CONS 'Q REST)) TS (PLUS R TR) W R) (CONS 'Q (WARP REST (PLUS TS W W) (PLUS R R TR) W R)))). However this again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.1 0.0 ] HELPER10 (PROVE-LEMMA HELPER11 (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W W))) (EQUAL (WARP (CONS FLG1 (CONS 'Q REST)) TS TR W R) (CONS 'Q (CONS 'Q (CONS 'Q (WARP REST (PLUS TS W W) (PLUS TR (TIMES 3 R)) W R)))))) ((EXPAND (WARP (CONS FLG1 (CONS 'Q REST)) TS TR W R) (WARP (CONS 'Q REST) (PLUS TS W) (PLUS R R TR) W R) (WARP (CONS 'Q REST) (PLUS TS W) (PLUS R TR) W R) (TIMES 2 R) (TIMES 3 R)))) This simplifies, using linear arithmetic, applying PLUS-COMMUTES1, CDR-CONS, NENDP-IS-USUALLY-F, LEN-ENDP, CAR-CONS, PLUS-ASSOCIATES, SUB1-ADD1, LEN-TS+, PLUS-COMMUTES2, and CONS-EQUAL, and unfolding the definitions of WARP, LEN, PLUS, SUB1, NUMBERP, EQUAL, TIMES, RECONCILE-SIGNALS, SIG, LST+, and NTS+, to two new conjectures: Case 2. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W W)) (NOT (LESSP (PLUS R TR) (PLUS TS W)))) (EQUAL (WARP (CONS 'Q REST) (PLUS TS W) (PLUS R TR) W R) (CONS 'Q (CONS 'Q (WARP REST (PLUS TS W W) (PLUS R R R TR) W R))))), which again simplifies, using linear arithmetic, applying PLUS-COMMUTES1, PLUS-ASSOCIATES, CDR-CONS, EQUAL-LEN-0, SUB1-ADD1, NENDP-IS-USUALLY-F, LEN-ENDP, CAR-CONS, LEN-TS+, and CONS-EQUAL, and unfolding the functions WARP, LEN, LESSP, PLUS, SUB1, NUMBERP, EQUAL, TIMES, RECONCILE-SIGNALS, SIG, LST+, and NTS+, to the following three new conjectures: Case 2.3. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W W)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (NOT (LESSP (PLUS R R R TR) (PLUS TS W W))) (LESSP (PLUS R R R TR) (PLUS TS W W W))) (EQUAL (WARP (LST+ REST (PLUS TS W W) (PLUS R R R TR) W) (PLUS TS W W) (PLUS R R R TR) W R) (WARP REST (PLUS TS W W) (PLUS R R R TR) W R))). But this again simplifies, rewriting with PLUS-ASSOCIATES, and opening up LST+, to: T. Case 2.2. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W W)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (NOT (LESSP (PLUS R R R TR) (PLUS TS W W))) (NOT (LESSP (PLUS R R R TR) (PLUS TS W W W)))) (EQUAL (WARP (LST+ REST (PLUS TS W W) (PLUS R R R TR) W) (NTS+ (LEN (CDR REST)) (PLUS TS W W W) (PLUS R R R TR) W) (PLUS R R R TR) W R) (WARP REST (PLUS TS W W) (PLUS R R R TR) W R))). However this again simplifies, using linear arithmetic, to: T. Case 2.1. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W W)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (LESSP (PLUS R R R TR) (PLUS TS W W))) (EQUAL (WARP (CONS 'Q REST) (PLUS TS W) (PLUS R R R TR) W R) (WARP REST (PLUS TS W W) (PLUS R R R TR) W R))), which again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W)) (LESSP (PLUS R R TR) (PLUS TS W W W)) (LESSP (PLUS R TR) (PLUS TS W))) (EQUAL (WARP (CONS FLG1 (CONS 'Q REST)) TS (PLUS R TR) W R) (CONS 'Q (CONS 'Q (WARP REST (PLUS TS W W) (PLUS R R R TR) W R))))), which again simplifies, using linear arithmetic, to: T. Q.E.D. [ 0.0 0.1 0.0 ] HELPER11 (PROVE-LEMMA LESSP-TIMES-18 (REWRITE) (IMPLIES (LISTP MSG) (NOT (LESSP (TIMES 18 (LEN MSG)) 18)))) WARNING: Note that the proposed lemma LESSP-TIMES-18 is to be stored as zero type prescription rules, zero compound recognizer rules, one linear rule, and zero replacement rules. Name the conjecture *1. Perhaps we can prove it by induction. There is only one plausible induction. We will induct according to the following scheme: (AND (IMPLIES (NLISTP MSG) (p MSG)) (IMPLIES (AND (NOT (NLISTP MSG)) (p (CDR MSG))) (p MSG))). Linear arithmetic, the lemmas CDR-LESSEQP and CDR-LESSP, and the definition of NLISTP inform us that the measure (COUNT MSG) decreases according to the well-founded relation LESSP in each induction step of the scheme. The above induction scheme leads to the following three new conjectures: Case 3. (IMPLIES (AND (NLISTP MSG) (LISTP MSG)) (NOT (LESSP (TIMES 18 (LEN MSG)) 18))). This simplifies, opening up NLISTP, to: T. Case 2. (IMPLIES (AND (NOT (NLISTP MSG)) (NOT (LISTP (CDR MSG))) (LISTP MSG)) (NOT (LESSP (TIMES 18 (LEN MSG)) 18))). This simplifies, rewriting with TIMES-ADD1, and expanding the functions NLISTP and LEN, to the formula: (IMPLIES (AND (NOT (LISTP (CDR MSG))) (LISTP MSG)) (NOT (LESSP (PLUS 18 (TIMES 18 (LEN (CDR MSG)))) 18))). However this again simplifies, using linear arithmetic, to: T. Case 1. (IMPLIES (AND (NOT (NLISTP MSG)) (NOT (LESSP (TIMES 18 (LEN (CDR MSG))) 18)) (LISTP MSG)) (NOT (LESSP (TIMES 18 (LEN MSG)) 18))), which simplifies, applying TIMES-ADD1, and unfolding NLISTP and LEN, to: (IMPLIES (AND (NOT (LESSP (TIMES 18 (LEN (CDR MSG))) 18)) (LISTP MSG)) (NOT (LESSP (PLUS 18 (TIMES 18 (LEN (CDR MSG)))) 18))), which again simplifies, using linear arithmetic, to: T. That finishes the proof of *1. Q.E.D. [ 0.0 0.0 0.0 ] LESSP-TIMES-18 (PROVE-LEMMA LISTN-ADD1 (REWRITE) (EQUAL (LISTN (ADD1 N) FLG) (CONS FLG (LISTN N FLG))) ((ENABLE LISTN))) This formula simplifies, applying SUB1-ADD1, CAR-CONS, CDR-CONS, and CONS-EQUAL, and opening up the function LISTN, to: (IMPLIES (NOT (NUMBERP N)) (EQUAL (LISTN 0 FLG) (LISTN N FLG))), which again simplifies, opening up the functions EQUAL and LISTN, to: T. Q.E.D. [ 0.0 0.0 0.0 ] LISTN-ADD1 (PROVE-LEMMA HELPER14 (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (LESSP (PLUS R TR) (PLUS TS W W))) (EQUAL (WARP (CONS 'Q REST) TS TR W R) (CONS 'Q (WARP REST (PLUS TS W) (PLUS R TR) W R)))) ((EXPAND (WARP (CONS 'Q REST) TS TR W R)))) This simplifies, using linear arithmetic, applying PLUS-COMMUTES1, CDR-CONS, LESSP-TIMES-18, NENDP-IS-USUALLY-F, LEN-ENDP, CAR-CONS, PLUS-ASSOCIATES, SUB1-ADD1, and LEN-TS+, and expanding WARP, LEN, RECONCILE-SIGNALS, SIG, LST+, and NTS+, to: T. Q.E.D. [ 0.0 0.0 0.0 ] HELPER14 (PROVE-LEMMA HELPER15 (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS R TR) (PLUS TS W)) (NOT (LESSP (PLUS R R TR) (PLUS TS W))) (LESSP (PLUS R R TR) (PLUS TS W W))) (EQUAL (WARP (CONS 'Q REST) TS TR W R) (CONS 'Q (CONS 'Q (WARP REST (PLUS TS W) (PLUS R R TR) W R))))) ((EXPAND (WARP (CONS 'Q REST) TS TR W R)))) This conjecture simplifies, using linear arithmetic, applying PLUS-COMMUTES1, CDR-CONS, LESSP-TIMES-18, NENDP-IS-USUALLY-F, LEN-ENDP, CAR-CONS, LEN-TS+, and HELPER14, and opening up WARP, LEN, RECONCILE-SIGNALS, SIG, LST+, and NTS+, to: T. Q.E.D. [ 0.0 0.0 0.0 ] HELPER15 (PROVE-LEMMA WARP-APP-ACROSS-GAP (REWRITE) (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (ZEROP W)) (NOT (ZEROP R)) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (NENDP K TS (PLUS R TR) W)) (EQUAL (WARP (APP (LISTN K FLG1) (CONS 'Q REST)) TS TR W R) (APP (LISTN (NQG K TS TR W R) 'Q) (WARP (CDRN (DWG K TS TR W R) REST) (TSG K TS TR W R) (TRG K TS TR W R) W R)))) ((DO-NOT-INDUCT T) (ENABLE LISTN) (EXPAND (NENDP K TS (PLUS R TR) W) (NENDP (SUB1 K) (PLUS TS W) (PLUS R TR) W) (NENDP (SUB1 (SUB1 K)) (PLUS TS W W) (PLUS R TR) W) (TIMES 2 R)))) This conjecture can be simplified, using the abbreviations ZEROP, NOT, AND, and IMPLIES, to the goal: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (TIMES 2 R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (NENDP K TS (PLUS R TR) W)) (EQUAL (WARP (APP (LISTN K FLG1) (CONS 'Q REST)) TS TR W R) (APP (LISTN (NQG K TS TR W R) 'Q) (WARP (CDRN (DWG K TS TR W R) REST) (TSG K TS TR W R) (TRG K TS TR W R) W R)))). This simplifies, using linear arithmetic, rewriting with PLUS-COMMUTES1, PLUS-ASSOCIATES, TIMES-COMMUTES1, PLUS-COMMUTES2, LEN-LISTN, CDR-CONS, PLUS-ADD1, LESSP-TIMES-18, NENDP-IS-USUALLY-F, SUB1-ADD1, and WARP-APP-GAP, and expanding TIMES, EQUAL, NUMBERP, SUB1, PLUS, NENDP, LISTN, LISTP, APP, NQG, DWG, TSG, TRG, LEN, LST+, and NTS+, to 35 new conjectures: Case 35.(IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (EQUAL K 0) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (LESSP (PLUS R TR) (PLUS TS W W))) (EQUAL (WARP (CONS 'Q REST) TS TR W R) (APP (LISTN 1 'Q) (WARP (CDRN 0 REST) (PLUS 0 TS W (TIMES W 0)) (PLUS TR (TIMES R 1)) W R)))), which again simplifies, rewriting with HELPER14, LISTN-ADD1, TIMES-COMMUTES1, and PLUS-COMMUTES1, and expanding the functions NUMBERP, EQUAL, LISTN, CONS, CDRN, TIMES, PLUS, SUB1, CDR, CAR, LISTP, and APP, to: T. Case 34.(IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (EQUAL K 0) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (EQUAL (PLUS R TR) (PLUS TS W))) (EQUAL (WARP (CONS 'Q REST) TS TR W R) (APP (LISTN 1 'Q) (WARP (CDRN 0 REST) (PLUS 0 TS W (TIMES W 0)) (PLUS TR (TIMES R 1)) W R)))). This again simplifies, using linear arithmetic, applying the lemmas HELPER14, LISTN-ADD1, TIMES-COMMUTES1, and PLUS-COMMUTES1, and opening up the functions NUMBERP, EQUAL, LISTN, CONS, CDRN, TIMES, PLUS, SUB1, CDR, CAR, LISTP, and APP, to: T. Case 33.(IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (EQUAL K 0) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (NOT (EQUAL (PLUS R TR) (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS W W)))) (EQUAL (WARP (CONS 'Q REST) TS TR W R) (APP (LISTN 1 'Q) (WARP (CDRN 1 REST) (PLUS 0 TS W (TIMES W 1)) (PLUS TR (TIMES R 1)) W R)))), which again simplifies, using linear arithmetic, applying PLUS-COMMUTES1, HELPER8, LISTN-ADD1, and TIMES-COMMUTES1, and opening up the functions NUMBERP, PLUS, SUB1, EQUAL, TIMES, LISTN, CONS, CDRN, CDR, CAR, LISTP, and APP, to: T. Case 32.(IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (EQUAL K 0) (LESSP (PLUS R TR) (PLUS TS W)) (LESSP (PLUS R R TR) (PLUS TS W)) (LESSP (PLUS R R TR) (PLUS TS W W))) (EQUAL (WARP (CONS 'Q REST) TS TR W R) (APP (LISTN 3 'Q) (WARP (CDRN 0 REST) (PLUS 0 TS W (TIMES W 0)) (PLUS TR (TIMES R 3)) W R)))). This again simplifies, using linear arithmetic, to: T. Case 31.(IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (EQUAL K 0) (LESSP (PLUS R TR) (PLUS TS W)) (LESSP (PLUS R R TR) (PLUS TS W)) (NOT (LESSP (PLUS R R TR) (PLUS TS W W)))) (EQUAL (WARP (CONS 'Q REST) TS TR W R) (APP (LISTN 3 'Q) (WARP (CDRN 1 REST) (PLUS 0 TS W (TIMES W 1)) (PLUS TR (TIMES R 3)) W R)))), which again simplifies, using linear arithmetic, to: T. Case 30.(IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (EQUAL K 0) (LESSP (PLUS R TR) (PLUS TS W)) (NOT (LESSP (PLUS R R TR) (PLUS TS W))) (LESSP (PLUS R R TR) (PLUS TS W W))) (EQUAL (WARP (CONS 'Q REST) TS TR W R) (APP (LISTN 2 'Q) (WARP (CDRN 0 REST) (PLUS 0 TS W (TIMES W 0)) (PLUS TR (TIMES R 2)) W R)))), which again simplifies, applying HELPER15, LISTN-ADD1, TIMES-COMMUTES1, PLUS-COMMUTES1, and PLUS-COMMUTES2, and opening up NUMBERP, EQUAL, LISTN, CONS, CDRN, TIMES, PLUS, SUB1, CDR, CAR, LISTP, and APP, to: T. Case 29.(IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (EQUAL K 0) (LESSP (PLUS R TR) (PLUS TS W)) (NOT (LESSP (PLUS R R TR) (PLUS TS W))) (NOT (LESSP (PLUS R R TR) (PLUS TS W W)))) (EQUAL (WARP (CONS 'Q REST) TS TR W R) (APP (LISTN 2 'Q) (WARP (CDRN 1 REST) (PLUS 0 TS W (TIMES W 1)) (PLUS TR (TIMES R 2)) W R)))). However this again simplifies, using linear arithmetic, to: T. Case 28.(IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (NOT (LESSP (PLUS R TR) (PLUS TS W (TIMES K W)))) (LESSP (PLUS R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (CONS (SIG (APP (LISTN K FLG1) (CONS 'Q REST)) TS (PLUS R TR) W) (WARP (LST+ REST (PLUS TS W (TIMES K W)) (PLUS R TR) W) (PLUS TS W (TIMES K W)) (PLUS R TR) W R)) (APP (LISTN 1 'Q) (WARP (CDRN 0 REST) (PLUS TS W (TIMES K W) (TIMES W 0)) (PLUS TR (TIMES R 1)) W R)))), which again simplifies, applying PLUS-ASSOCIATES, PLUS-COMMUTES1, LISTN-ADD1, TIMES-COMMUTES1, CAR-CONS, and CONS-EQUAL, and unfolding the definitions of LST+, EQUAL, LISTN, CONS, CDRN, TIMES, PLUS, SUB1, NUMBERP, CDR, CAR, LISTP, and APP, to the new goal: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (NOT (LESSP (PLUS R TR) (PLUS TS W (TIMES K W)))) (LESSP (PLUS R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (SIG (APP (LISTN K FLG1) (CONS 'Q REST)) TS (PLUS R TR) W) 'Q)). Applying the lemma CAR-CDR-ELIM, replace REST by (CONS Z X) to eliminate (CDR REST) and (CAR REST). This produces the new goal: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (NOT (LESSP (PLUS R TR) (PLUS TS W (TIMES K W)))) (LESSP (PLUS R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (SIG (APP (LISTN K FLG1) (CONS 'Q (CONS Z X))) TS (PLUS R TR) W) 'Q)). Applying the lemma SUB1-ELIM, replace K by (ADD1 V) to eliminate (SUB1 K) and V by (ADD1 D) to eliminate (SUB1 V). We rely upon the type restriction lemma noted when SUB1 was introduced to restrict the new variable. We thus obtain the following three new formulas: Case 28.3. (IMPLIES (AND (EQUAL K 0) (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (NOT (LESSP (PLUS R TR) (PLUS TS W (TIMES K W)))) (LESSP (PLUS R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (SIG (APP (LISTN K FLG1) (CONS 'Q (CONS Z X))) TS (PLUS R TR) W) 'Q)). However this further simplifies, using linear arithmetic, to: T. Case 28.2. (IMPLIES (AND (EQUAL V 0) (NUMBERP V) (NOT (EQUAL (ADD1 V) 0)) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 V) 0) (NOT (LESSP (PLUS R TR) (PLUS TS W (TIMES (ADD1 V) W)))) (LESSP (PLUS R TR) (PLUS TS W W (TIMES (ADD1 V) W)))) (EQUAL (SIG (APP (LISTN (ADD1 V) FLG1) (CONS 'Q (CONS Z X))) TS (PLUS R TR) W) 'Q)), which further simplifies, applying PLUS-COMMUTES1, LISTN-ADD1, CDR-CONS, CAR-CONS, and PLUS-ASSOCIATES, and expanding the functions NUMBERP, EQUAL, SUB1, TIMES, PLUS, LISTN, APP, LISTP, RECONCILE-SIGNALS, and SIG, to: T. Case 28.1. (IMPLIES (AND (NUMBERP D) (NOT (EQUAL (ADD1 D) 0)) (NOT (EQUAL (ADD1 (ADD1 D)) 0)) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL D 0) (NOT (LESSP (PLUS R TR) (PLUS TS W (TIMES (ADD1 (ADD1 D)) W)))) (LESSP (PLUS R TR) (PLUS TS W W (TIMES (ADD1 (ADD1 D)) W)))) (EQUAL (SIG (APP (LISTN (ADD1 (ADD1 D)) FLG1) (CONS 'Q (CONS Z X))) TS (PLUS R TR) W) 'Q)). However this further simplifies, using linear arithmetic, to: T. Case 27.(IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (NOT (LESSP (PLUS R TR) (PLUS TS W (TIMES K W)))) (EQUAL (PLUS R TR) (PLUS TS W (TIMES K W))) (NOT (LESSP (PLUS R TR) (PLUS TS W W (TIMES K W))))) (EQUAL (CONS (SIG (APP (LISTN K FLG1) (CONS 'Q REST)) TS (PLUS R TR) W) (WARP (LST+ REST (PLUS TS W (TIMES K W)) (PLUS R TR) W) (NTS+ (LEN (CDR REST)) (PLUS TS W W (TIMES K W)) (PLUS R TR) W) (PLUS R TR) W R)) (APP (LISTN 1 'Q) (WARP (CDRN 0 REST) (PLUS TS W (TIMES K W) (TIMES W 0)) (PLUS TR (TIMES R 1)) W R)))), which again simplifies, using linear arithmetic, to: T. Case 26.(IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (NOT (LESSP (PLUS R TR) (PLUS TS W (TIMES K W)))) (NOT (EQUAL (PLUS R TR) (PLUS TS W (TIMES K W)))) (NOT (LESSP (PLUS R TR) (PLUS TS W W (TIMES K W))))) (EQUAL (CONS (SIG (APP (LISTN K FLG1) (CONS 'Q REST)) TS (PLUS R TR) W) (WARP (LST+ REST (PLUS TS W (TIMES K W)) (PLUS R TR) W) (NTS+ (LEN (CDR REST)) (PLUS TS W W (TIMES K W)) (PLUS R TR) W) (PLUS R TR) W R)) (APP (LISTN 1 'Q) (WARP (CDRN 1 REST) (PLUS TS W (TIMES K W) (TIMES W 1)) (PLUS TR (TIMES R 1)) W R)))), which again simplifies, using linear arithmetic and rewriting with the lemma LESSP-TIMES, to two new conjectures: Case 26.2. (IMPLIES (AND (EQUAL (SUB1 K) 0) (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (NOT (LESSP (PLUS R TR) (PLUS TS W (TIMES K W)))) (NOT (EQUAL (PLUS R TR) (PLUS TS W (TIMES K W)))) (NOT (LESSP (PLUS R TR) (PLUS TS W W (TIMES K W))))) (EQUAL (CONS (SIG (APP (LISTN K FLG1) (CONS 'Q REST)) TS (PLUS R TR) W) (WARP (LST+ REST (PLUS TS W (TIMES K W)) (PLUS R TR) W) (NTS+ (LEN (CDR REST)) (PLUS TS W W (TIMES K W)) (PLUS R TR) W) (PLUS R TR) W R)) (APP (LISTN 1 'Q) (WARP (CDRN 1 REST) (PLUS TS W (TIMES K W) (TIMES W 1)) (PLUS TR (TIMES R 1)) W R)))), which again simplifies, using linear arithmetic and appealing to the lemma LESSP-TIMES, to: (IMPLIES (AND (EQUAL K 0) (EQUAL (SUB1 K) 0) (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 0) 0) (NOT (LESSP (PLUS R TR) (PLUS TS W (TIMES K W)))) (NOT (EQUAL (PLUS R TR) (PLUS TS W (TIMES K W)))) (NOT (LESSP (PLUS R TR) (PLUS TS W W (TIMES K W))))) (EQUAL (CONS (SIG (APP (LISTN K FLG1) (CONS 'Q REST)) TS (PLUS R TR) W) (WARP (LST+ REST (PLUS TS W (TIMES K W)) (PLUS R TR) W) (NTS+ (LEN (CDR REST)) (PLUS TS W W (TIMES K W)) (PLUS R TR) W) (PLUS R TR) W R)) (APP (LISTN 1 'Q) (WARP (CDRN 1 REST) (PLUS TS W (TIMES K W) (TIMES W 1)) (PLUS TR (TIMES R 1)) W R)))). This again simplifies, applying PLUS-COMMUTES1, CDR-CONS, CAR-CONS, LISTN-ADD1, TIMES-COMMUTES1, and CONS-EQUAL, and opening up SUB1, EQUAL, NUMBERP, TIMES, PLUS, LISTN, LISTP, APP, RECONCILE-SIGNALS, SIG, CONS, CDRN, CDR, and CAR, to: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (NOT (EQUAL (PLUS R TR) (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS W W)))) (EQUAL (WARP (LST+ REST (PLUS TS W) (PLUS R TR) W) (NTS+ (LEN (CDR REST)) (PLUS TS W W) (PLUS R TR) W) (PLUS R TR) W R) (WARP (CDR REST) (PLUS TS W W) (PLUS R TR) W R))). Applying the lemma CAR-CDR-ELIM, replace REST by (CONS Z X) to eliminate (CDR REST) and (CAR REST). This produces: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (NOT (EQUAL (PLUS R TR) (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS W W)))) (EQUAL (WARP (LST+ (CONS Z X) (PLUS TS W) (PLUS R TR) W) (NTS+ (LEN X) (PLUS TS W W) (PLUS R TR) W) (PLUS R TR) W R) (WARP X (PLUS TS W W) (PLUS R TR) W R))), which finally simplifies, using linear arithmetic, applying CDR-CONS, PLUS-ASSOCIATES, PLUS-COMMUTES1, and HELPER1, and opening up the definitions of LST+, PLUS, SUB1, NUMBERP, EQUAL, and TIMES, to: T. Case 26.1. (IMPLIES (AND (EQUAL K 0) (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (NOT (LESSP (PLUS R TR) (PLUS TS W (TIMES K W)))) (NOT (EQUAL (PLUS R TR) (PLUS TS W (TIMES K W)))) (NOT (LESSP (PLUS R TR) (PLUS TS W W (TIMES K W))))) (EQUAL (CONS (SIG (APP (LISTN K FLG1) (CONS 'Q REST)) TS (PLUS R TR) W) (WARP (LST+ REST (PLUS TS W (TIMES K W)) (PLUS R TR) W) (NTS+ (LEN (CDR REST)) (PLUS TS W W (TIMES K W)) (PLUS R TR) W) (PLUS R TR) W R)) (APP (LISTN 1 'Q) (WARP (CDRN 1 REST) (PLUS TS W (TIMES K W) (TIMES W 1)) (PLUS TR (TIMES R 1)) W R)))). But this again simplifies, applying PLUS-COMMUTES1, CDR-CONS, CAR-CONS, LISTN-ADD1, TIMES-COMMUTES1, and CONS-EQUAL, and unfolding the functions NUMBERP, SUB1, EQUAL, TIMES, PLUS, LISTN, LISTP, APP, RECONCILE-SIGNALS, SIG, CONS, CDRN, CDR, and CAR, to the new conjecture: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (NOT (EQUAL (PLUS R TR) (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS W W)))) (EQUAL (WARP (LST+ REST (PLUS TS W) (PLUS R TR) W) (NTS+ (LEN (CDR REST)) (PLUS TS W W) (PLUS R TR) W) (PLUS R TR) W R) (WARP (CDR REST) (PLUS TS W W) (PLUS R TR) W R))). Applying the lemma CAR-CDR-ELIM, replace REST by (CONS Z X) to eliminate (CDR REST) and (CAR REST). This produces the new goal: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (NOT (LESSP (PLUS R TR) (PLUS TS W))) (NOT (EQUAL (PLUS R TR) (PLUS TS W))) (NOT (LESSP (PLUS R TR) (PLUS TS W W)))) (EQUAL (WARP (LST+ (CONS Z X) (PLUS TS W) (PLUS R TR) W) (NTS+ (LEN X) (PLUS TS W W) (PLUS R TR) W) (PLUS R TR) W R) (WARP X (PLUS TS W W) (PLUS R TR) W R))), which further simplifies, using linear arithmetic, applying the lemmas CDR-CONS, PLUS-ASSOCIATES, PLUS-COMMUTES1, and HELPER1, and expanding LST+, PLUS, SUB1, NUMBERP, EQUAL, and TIMES, to: T. Case 25.(IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (LESSP (PLUS R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (CONS (SIG (APP (LISTN K FLG1) (CONS 'Q REST)) TS (PLUS R TR) W) (WARP (CONS 'Q REST) (PLUS TS (TIMES K W)) (PLUS R TR) W R)) (APP (LISTN 3 'Q) (WARP (CDRN 0 REST) (PLUS TS W (TIMES K W) (TIMES W 0)) (PLUS TR (TIMES R 3)) W R)))), which again simplifies, rewriting with LISTN-ADD1, TIMES-COMMUTES1, PLUS-COMMUTES1, CAR-CONS, and CONS-EQUAL, and opening up the definitions of EQUAL, LISTN, CONS, CDRN, TIMES, PLUS, CDR, CAR, LISTP, and APP, to the following two new formulas: Case 25.2. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (LESSP (PLUS R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (SIG (APP (LISTN K FLG1) (CONS 'Q REST)) TS (PLUS R TR) W) 'Q)). Appealing to the lemma CAR-CDR-ELIM, we now replace REST by (CONS Z X) to eliminate (CDR REST) and (CAR REST). The result is: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (LESSP (PLUS R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (SIG (APP (LISTN K FLG1) (CONS 'Q (CONS Z X))) TS (PLUS R TR) W) 'Q)). Appealing to the lemma SUB1-ELIM, we now replace K by (ADD1 V) to eliminate (SUB1 K) and V by (ADD1 D) to eliminate (SUB1 V). We employ the type restriction lemma noted when SUB1 was introduced to constrain the new variable. We must thus prove three new formulas: Case 25.2.3. (IMPLIES (AND (EQUAL K 0) (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (LESSP (PLUS R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (SIG (APP (LISTN K FLG1) (CONS 'Q (CONS Z X))) TS (PLUS R TR) W) 'Q)), which further simplifies, using linear arithmetic, to: T. Case 25.2.2. (IMPLIES (AND (EQUAL V 0) (NUMBERP V) (NOT (EQUAL (ADD1 V) 0)) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 V) 0) (LESSP (PLUS R TR) (PLUS TS W (TIMES (ADD1 V) W))) (LESSP (PLUS R R TR) (PLUS TS W (TIMES (ADD1 V) W))) (LESSP (PLUS R R TR) (PLUS TS W W (TIMES (ADD1 V) W)))) (EQUAL (SIG (APP (LISTN (ADD1 V) FLG1) (CONS 'Q (CONS Z X))) TS (PLUS R TR) W) 'Q)), which further simplifies, using linear arithmetic, to: T. Case 25.2.1. (IMPLIES (AND (NUMBERP D) (NOT (EQUAL (ADD1 D) 0)) (NOT (EQUAL (ADD1 (ADD1 D)) 0)) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL D 0) (LESSP (PLUS R TR) (PLUS TS W (TIMES (ADD1 (ADD1 D)) W))) (LESSP (PLUS R R TR) (PLUS TS W (TIMES (ADD1 (ADD1 D)) W))) (LESSP (PLUS R R TR) (PLUS TS W W (TIMES (ADD1 (ADD1 D)) W)))) (EQUAL (SIG (APP (LISTN (ADD1 (ADD1 D)) FLG1) (CONS 'Q (CONS Z X))) TS (PLUS R TR) W) 'Q)), which further simplifies, using linear arithmetic, to: T. Case 25.1. (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP REST) (LISTP (CDR REST)) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (LESSP (PLUS R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (WARP (CONS 'Q REST) (PLUS TS (TIMES K W)) (PLUS R TR) W R) (CONS 'Q (CONS 'Q (WARP REST (PLUS TS W (TIMES K W)) (PLUS TR (TIMES 3 R)) W R))))). Applying the lemma CAR-CDR-ELIM, replace REST by (CONS Z X) to eliminate (CDR REST) and (CAR REST). We would thus like to prove the new formula: (IMPLIES (AND (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (LESSP (PLUS R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (WARP (CONS 'Q (CONS Z X)) (PLUS TS (TIMES K W)) (PLUS R TR) W R) (CONS 'Q (CONS 'Q (WARP (CONS Z X) (PLUS TS W (TIMES K W)) (PLUS TR (TIMES 3 R)) W R))))). Applying the lemma SUB1-ELIM, replace K by (ADD1 V) to eliminate (SUB1 K) and V by (ADD1 D) to eliminate (SUB1 V). We rely upon the type restriction lemma noted when SUB1 was introduced to restrict the new variable. We thus obtain the following three new conjectures: Case 25.1.3. (IMPLIES (AND (EQUAL K 0) (NUMBERP TS) (NUMBERP TR) (NUMBERP K) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 (SUB1 K)) 0) (LESSP (PLUS R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W (TIMES K W))) (LESSP (PLUS R R TR) (PLUS TS W W (TIMES K W)))) (EQUAL (WARP (CONS 'Q (CONS Z X)) (PLUS TS (TIMES K W)) (PLUS R TR) W R) (CONS 'Q (CONS 'Q (WARP (CONS Z X) (PLUS TS W (TIMES K W)) (PLUS TR (TIMES 3 R)) W R))))). But this further simplifies, using linear arithmetic, to: T. Case 25.1.2. (IMPLIES (AND (EQUAL V 0) (NUMBERP V) (NOT (EQUAL (ADD1 V) 0)) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL (SUB1 V) 0) (LESSP (PLUS R TR) (PLUS TS W (TIMES (ADD1 V) W))) (LESSP (PLUS R R TR) (PLUS TS W (TIMES (ADD1 V) W))) (LESSP (PLUS R R TR) (PLUS TS W W (TIMES (ADD1 V) W)))) (EQUAL (WARP (CONS 'Q (CONS Z X)) (PLUS TS (TIMES (ADD1 V) W)) (PLUS R TR) W R) (CONS 'Q (CONS 'Q (WARP (CONS Z X) (PLUS TS W (TIMES (ADD1 V) W)) (PLUS TR (TIMES 3 R)) W R))))), which further simplifies, using linear arithmetic, to: T. Case 25.1.1. (IMPLIES (AND (NUMBERP D) (NOT (EQUAL (ADD1 D) 0)) (NOT (EQUAL (ADD1 (ADD1 D)) 0)) (NUMBERP TS) (NUMBERP TR) (NOT (EQUAL W 0)) (NUMBERP W) (NOT (EQUAL R 0)) (NUMBERP R) (NOT (LESSP TR TS)) (LESSP TR (PLUS TS W)) (LESSP W (PLUS R R)) (LESSP R (TIMES 2 W)) (LISTP X) (LESSP (PLUS TS W) (PLUS R TR)) (LESSP (PLUS TS W W) (PLUS R TR)) (EQUAL D 0) (LESSP (PLUS R TR)