perm filename TTY24[1,GUE] blob sn#020919 filedate 1973-01-22 generic text, type T, neo UTF8
00100	BEGIN
00200	EXPR ENTER();
00300	     BEGIN
00400	     PRINTSTR '"THE SYSTEM IS STARTED";
00500	   S;PRINTSTR '"
00600	
00700	            PLEASE TYPE IN A REQUEST
00800	                      
00900	 ...";
01000	     L←READ();
01100	     LHOLD←L;
01200	     IF NULL(L) THEN RETURN  '"THE SYSTEM IS ENDED.";
01300	     PRINT D(L);
01400	     GO S;
01500	     END;
01600	EXPR D(L);
01700	     BEGIN NEW FN, A, N, RELATEDF;
01800	     I←READINKNOWN();
01900	     KNOWNF←IDATA[1];
02000	     TARG←IDATA[2];
02100	     NARG←IDATA[3];
02200	     TRE←IDATA[4];
02300	     BA1←IDATA[5];
02400	     BA2←IDATA[6];
02500	     TF←IDATA[7];
02600	     T2F←IDATA[8];
02700	     FN←L[1];
02800	     FN2←FN;
02900	     A←CDR(L);
03000	     N←LENGTH(A);
03100	     NVARIABLES←N;
03200	     RELATEDF←'(NIL NIL NIL NIL);
03300	     IF MEMBER(FN,KNOWNF) THEN RETURN K1(FN,A,N,RELATEDF)
03400	       ELSE RETURN K2(FN,A,N,RELATEDF);
03500	     END;
03600	EXPR INIT();
03700	     BEGIN
03800	      UNKNOWN ←'UNKNOWN;
03900	     INF←0;
04000	     ORD←'(NIL);
04100	     PRINTSTR '"TYPE IN HOW DEEPLY WE SHOULD RECURSE BEFORE
04200	       GIVING UP AS INFINITE LOOP (I SUGGEST 15) ...";
04300	     LIMINFBASE←READ();
04400	     LIMINF← LIMINFBASE;
04500	     TWICELIMINF ← LIMINF + LIMINF;
04600	     TRIPLELIMINF ← LIMINF + TWICELIMINF;
04700	     IF LIMINFBASE ≥ 38 THEN TWICELIMINF←76;
04800	     IF LIMINFBASE ≥ 26 THEN TRIPLELIMINF←78;
04900	     BA1←'(FN CAR CDR IDEN MINUS ATOM LISTP NUMBERP NULL
05000	     LIST CONST1  ZERO1
05100	        QUOTE EVAL LENGTH NOT HALF SUB1 ADD1 );
05200	     BA2←'(CONS PI12 PI22 FN2 LIST PLUS TIMES MEMBER APPEND 
05300	        GREATERP LESSP EQUAL AND OR NOT);
05400	     PRINTSTR '"TYPE IN MESSAGE LEVEL (I SUGGEST 3)...";
05500	     MSGLEVEL←READ();
05600	     KNOWNF ←'(CAR CDR CONS IDEN
05700	       PLUS TIMES MINUS
05800	       ATOM LISTP NUMBERP NULL
05900	       QUOTE EVAL
06000	       LENGTH MEMBER
06100	       GREATERP LESSP EQUAL
06200	       AND OR NOT 
06300	       HALF PI12 PI22 ZERO1 ZERO2 
06400	       CONST1 CONST2 SUB1 ADD1 LIST APPEND FN FN2);
06500	     SCHEMA←'(DE FN(L) (COND
06600	       ((EQUAL (F1 L) C1)  (F2 L))
06700	       ((EQUAL (F8 L) C3)  (F9 L))
06800	       ((OR (GT L) (AND (INFINITY ) ((CAR (GET F4 TARGS)) (F3 L))
06900	         ((CAR (GET F6 TARGS)) (F5 L))
07000	         ((CAR (GET F7 TARGS)) (F4 (F3 L)))
07100	         ((CADR (GET F7 TARGS)) (F6 (F5 L))) ))
07200	        (F7 (F4 (F3 L)) (F6 (F5 L))))
07300	       (T  C2)));
07400	     I ← EVAL(SCHEMA);
07500	     I←GS2(); I←EVAL(SCHEMA2);
07600	     NARGS←'NARGS; TARGS←'TARGS;TRES←'TRES;
07700	     RETURN PUTFORM();
07800	     END;
07900	EXPR IDEN(A); A;
08000	EXPR HALF(A); A/2;
08100	EXPR K1(FN,A,N,RELATEDF); 
08200	     BEGIN NEW I;
08300	     I← GET(FN,'NARGS);
08400	     IF I=N OR I=11 THEN RETURN EVAL(L);
08500	     PRINTSTR '"THIS FUNCTION TAKES EXACTLY";
08600	     PRIN1(I);
08700	     PRINTSTR '" ARGUMENT(S), BUT YOU USED IT WITH";
08800	     PRIN1(N); PRINTSTR '"ARGUMENT(S).
08900	         ARE WE DEFINING A NEW BUT CLOSELY
09000	        RELATED FUNCTION  Y OR N ...";
09100	      IF READ()='Y THEN RELATEDF[1,1]←FN
09200	       ELSE PRINTSTR '"ARE WE DEFINING A NEW FUNCTION HERE OR
09300	         NOT  Y OR N ..."
09400	         ALSO IF READ()='N THEN RETURN  '"IGNORING THE REQUEST ENTIRELY";
09500	     PRINTSTR '"PICK A NEW FUNCTION NAME TO REPLACE THIS NEWEST USE OF";
09600	     PRIN1 FN;
09700	     PRINTSTR '"...";
09800	     FN←READ();
09900	     FN2←FN;
10000	     IF MEMBER(FN,KNOWNF) THEN RETURN K1(FN,A,N,RELATEDF)
10100	     ELSE RETURN K2(FN,A,N,RELATEDF);
10200	     END;
10300	EXPR K2(FN,A,N,RELATEDF);
10400	     BEGIN NEW II,I;
10500	     PRINTSTR '"READY TO MAKE NEW FUNCTION. DO YOU WANT TO";
10600	     PRINTSTR '"  CHANGE YOUR REQUEST Y OR N...";
10700	     IF READ()='Y THEN RETURN  '"VERY WELL. IGNORING
10800	     THE REQUEST ENTIRELY";
10900	     FOR NEW J←1 TO LENGTH(KNOWNF)-2 DO 
11000	       PUTPROP(KNOWNF[J],NIL,'RVAL);
11100	     F1←NIL; F2←NIL; F3←NIL; F4←NIL; F5←NIL; F6 ←NIL; 
11200	      F7←NIL; F8←NIL;F9←NIL; F10←NIL; F11←NIL; F12←NIL;
11300	      F13←NIL; F14←NIL; F15←NIL; F16←NIL; F17←NIL;
11400	      F18←NIL; F19←NIL;     EXAMPLE←NIL;
11500	     CO←CDR(BA1); CO2 ←CDR(BA2);
11600	     ORDER2←<BA2,CO,CO,BA2,CO,CO,BA2,CO,CO,BA2,CO,CO,
11700	       BA2,BA2,CO,CO,BA2,CO,CO>;
11800	     ORDER←<CO,CO,CO,BA1,CO,BA1,CO2>;
11900	          PRINTSTR '"FOR EACH OF THE FOLLOWINGS FUNCTIONS, TYPE 
12000	EITHER TH WORD STOP OR A FUNCTION NAME, A SPACE, AND THEN A
12100	     1/2/3/4/5, MEANING THAT THE FN. IS DEFINITELY/PROBABLY/POSSIBLY
12200	     /PROBABLY NOT/DEFINITELY NOT  RELATED TO"; 
12300	     PRIN1 (FN);
12400	     PRINT (KNOWNF);
12500	     FOR NEW J←1 TO LENGTH(KNOWNF) DO BEGIN
12600	   S;    I←READ();
12700	     IF I= 'STOP THEN GO SSS;
12800	     II←READ();
12900	     PUTPROP (I, II, 'RVAL);
13000	       IF MEMBER(II,'(1 2 3 4)) THEN 
13100	       RELATEDF[II] ← I CONS RELATEDF[II]
13200	          ELSE IF NOT(II=5) THEN
13300	        PRINTSTR '"NO,NO! TYPE IN ONE DIGIT FROM 1 TO 5!!!"
13400	       ALSO GO S;
13500	   SSS; END UNTIL I= 'STOP;
13600	     PRINTSTR '"DO YOU THINK RECURSION (OR AN AUXILLIARY FN. WILL
13700	     BE REQUIRED HERE  Y OR N OR M(FOR MAYBE) ...";
13800	     I←READ();
13900	     IF I='Y THEN RETURN REC(FN,A,N,RELATEDF)
14000	       ELSE RETURN NREC(FN,A,N,RELATEDF,I);
14100	     END;
14200	EXPR PUTFORM();
14300	     BEGIN NEW ID,NA,TA,TR;
14400	     TF←NIL;
14500	     IF MAKELISTS()=NIL THEN RETURN PRINTSTR '"MAKELISTS IS NIL";
14600	     PF←NIL;
14700	     PF[1]←'PF1; PF[2]←'PF2; PF[3]←'PF3; PF[4]← 'PF4;
14800	     PF[5]←'PF5; PF[6]←'PF6; PF[7]←'PF7;
14900	     PF[8]←'PF8; PF[9]←'PF9; P2F[1]←'P2F1; P2F[2]←'P2F2; 
15000	     P2F[3]←'P2F3; P2F[4]←'P2F4; P2F[5]←'P2F5; P2F[6]←'P2F6;
15100	     P2F[7]←'P2F7; P2F[8]←'P2F8; P2F[9]←'P2F9;
15200	      P2F[10]←'P2F10; P2F[11]←'P2F11;
15300	      P2F[12]←'P2F12; P2F[13]←'P2F13; P2F[14]←'P2F14;
15400	      P2F[15]←'P2F15; P2F[16]←'P2F16; P2F[17]←'P2F17;
15500	     P2F[18]←'P2F18; P2F[19]←'P2F19;
15600	     FOR NEW I←1 TO LENGTH(KNOWNF) DO   BEGIN
15700	     ID←KNOWNF[I];
15800	     NA←NARG[I];
15900	     PUTPROP(ID,NA,'NARGS);
16000	     TA←TARG[I];
16100	     PUTPROP(ID,TA,'TARGS);
16200	     TR←TRE[I];
16300	     PUTPROP(ID,TR,'TRES);
16400	     FOR NEW J←1 TO 9 DO PUTPROP(ID,TF[J,I],PF[J]);
16500	     FOR NEW J←1 TO 19 DO PUTPROP(ID,T2F[J,I],P2F[J]);
16600	     END;
16700	     PUTPROP('FN,2,'RVAL);
16800	     PUTPROP ('FN2,1,'RVAL);
16900	     PUTPROP('FFALSE,'(ANY),TARGS);
17000	     PUTPROP('FFALSE2,'(ANY ANY), TARGS);
17100	     END;
17200	EXPR MAKELISTS();
17300	     BEGIN
17400	     NARG ← '(1 1 2 11 11 11 1
17500	     1 1 1 1 1 1 1 2 11 11 11 11 11 11 1 2 2 1 
17600	      2 1 2 1 1 11 2 1 2);
17700	     TARG←'((LISTP) (LISTP) (ATOM LISTP) (ANY ANY)
17800	         (NUMBER NUMBER) (NUMBER NUMBER)
17900	       (NUMBER) (ANY) (ANY) (ANY) (ANY) (ANY) (ANY) (ANY) 
18000	       (ANY LISTP) (NUMBER NUMBER)  (NUMBER NUMBER) (ANY ANY)
18100	       (ANY ANY) (ANY ANY) (ANY ANY) (NUMBER) (ANY ANY) (ANY ANY)
18200	       (ANY) (ANY ANY) (ANY) (ANY ANY) (NUMBER) (NUMBER)
18300	       (ANY ANY) (ANYLIST ANYLIST) (ANY) (ANY ANY));
18400	     TRE←'(ANY LISTP LISTP ANY NUMBER NUMBER NUMBER
18500	       TF TF TF TF ANY ANY
18600	       NUMBER TF TF TF TF TF TF TF NUMBER ANY ANY NUMBER
18700	       NUMBER ANY ANY NUMBER NUMBER ANYLIST LIST ANY ANY);
18800	     TF[1]← '(7 7 0 5 0 0 14 5 14 14 10 25 14 10 0 0 0 0 0 0
18900	       14 10 0 0 25 0 25 0 10 10 14 0 0);
19000	     TF[2]← '(10 10 0 5 0 0 14 5 14 14 14 25 14 14 0 0 0 0 0 0
19100	       25 10 0 0 10 0 10 0 14 14 7 0 0);
19200	     TF[3] ← '(5 7 0 10 0 0 10 14 14 14 14 14 14 14 0 0 0 0 0 0
19300	       25 14 0 0 14 0 14 0 7 7 10 0 0);
19400	     TF[4] ← '(7 10 0 7 0 0 14 14 14 14 14 14 14 14 0 0 0 0 0 0
19500	       14 10 0 0 25 0 25 0 10 10 14 0 5);
19600	     TF[5] ← '(7 5 0 10 0 0 10 14 14 14 14 14 14 14 0 0 0 0 0 0
19700	       25 14 0 0 14 0 14 0 7 7 7 0 0);
19800	     TF[6] ← '(10 7 0 7 0 0 14 14 14 14 14 14 14 14 0 0 0 0 0 0
19900	       14 10 0 0 25 0 25 0 10 10 10 0 5);
20000	     TF[7] ← '(0 0 5 0 10 10 0 0 0 0 0 0 0 0 25 25 14 25 14 14
20100	       0 0 7 7 0 14 0 14 0 0 0 5 0);
20200	     TF[8]←TF[1]; TF[9]←TF[2];
20300	     I←GETT2F();
20400	     RETURN PRINTSTR '"SUCCESFUL END OF MAKELISTS";
20500	     END;
20600	EXPR FFALSE(A); NIL;
20700	EXPR TTRUE(A); T;
20800	EXPR GETEX(N8);
20900	     BEGIN NEW I;
21000	     N9 ← LENGTH(EXAMPLE) + 1;
21100	     IF N9=1 THEN RETURN PRIM(NIL);
21200	    S; PRINTSTR '"PLEASE GIVE ME AN EXAMPLE.";
21300	       PRINTSTR '" THE ARGUMENT LIST...";
21400	      EXAMPLE[N9,1]←READ();
21500	      PRINTSTR '"THE FUNCTION VALUE...";
21600	      EXAMPLE[N9,2]←READ();
21700	      PRINTSTR '"DID YOU MAKE AN ERROR?  ";
21800	      I←READ();
21900	      IF I='Y THEN GO S;
22000	      RETURN EXAMPLE[N9];
22100	     END;
22200	EXPR PI12(A,B); A;
22300	EXPR PI22(A,B); B;
22400	EXPR ZERO1(A); 0;
22500	EXPR ZERO2(A,B); 0;
22600	EXPR CONST1(A); 1;
22700	EXPR CONST2(A,B); NIL;
22800	EXPR INFINITY();
22900	     BEGIN
23000	     INF←INF+1;
23100	     RETURN  LESSP(INF,LIMINF);
23200	     END;
23300	EXPR REC(FN,A,N,RELATEDF);
23400	     BEGIN
23500	     NEW I,II,I1,I2,KK,JJ1,JJ2;
23600	    S; PRINTSTR '"WHICH:  TYPE AN R(RECURSION), A(AUX.FN.), OR
23700	     B(BOTH)...";
23800	     I←READ();
23900	     IF NOT(MEMBER(I,'(R A B))) THEN
24000	         PRINTSTR '"NO,NO!! TYPE R,A, OR B  ONLY..."
24100	      ALSO GO S;
24200	     IF NOT I='R THEN RETURN '"O.K. LET'S WORK ON THE AUX.FN.
24300	       TYPE IT IN AS IF IT WERE YOUR REQUEST:";
24400	     IF N=2 THEN I←PRIM2() ELSE
24500	     I←GETEX(1);
24600	     NEX←0;
24700	     PRINTSTR '"HOW MANY MORE EXAMPLES WILL YOU GIVE ME
24800	       (I SUGGEST 2) ....";
24900	      NEX←READ();
25000	     FOR NEW KK←1 TO NEX DO II←GETEX(KK+1);
25100	      L←CADAR(A);
25200	     NEX ← NEX + ONEX;
25300	     IF NOT(N=1) THEN  RETURN REC2(FN,A,N,RELATEDF);
25400	        I←'(ANY);
25500	     E←NIL; MA←T; MN←T; MAL←T; EXAMPLE[NEX+2,1]←L;
25600	     FOR NEW X←1 TO NEX+1 DO BEGIN E←EXAMPLE[X+1,1];
25700	     MA←MA AND ATOM(E); MN←MN AND NUMBER(E);
25800	     MAL←MAL AND ANYLIST(E); END; 
25900	     IF MAL THEN I←'(ANYLIST);
26000	     IF MA THEN I←'(ATOM);
26100	     IF MN THEN I←'(NUMBER);
26200	     PUTPROP('FN,I,'TARGS);
26300	     PUTPROP('FN,1,'NARGS);
26400	     PUTPROP('FN,'ANY,'TRES);
26500	     IHOLD←I;
26600	     PRINTSTR '"DO YOU KNOW THE TYPE OF ARGUMENTS 
26700	       FOR THE FN?   MY GUESS IS"; PRINC (IHOLD);
26800	     PRINTSTR '"ANSWER Y IF YOU WANT TO MAKE A BETTER GUESS,
26900	             N IF YOU THINK THAT IT IS O.K. AS STATED ...  ";
27000	     I←READ(); IF I='Y THEN BEGIN PRINTSTR '"O.K. TYPE IN ONE
27100	     OF TH FOLLOWING WORDS: ANY ANYLIST LISTP NUMBER...";
27200	     I←READ(); 
27300	     PUTPROP('FN,<I>,'TARGS);
27400	     IHOLD←<I>;
27500	      END;
27600	     FOR NEW K←1 TO 7 DO
27700	     ORD[K]←INTERSECTION(RELATEDF[1]@
27800	       RELATEDF[2]@<'FN>@RELATEDF[3]
27900	       @RELATEDF[4],ORDER[K]);
28000	     ORD[8]←ORD[1]; ORD[9]←ORD[2];
28100	      FOR NEW K←1 TO 9 DO ORD[K]←RANK(K,ORD);
28200	     PRINTSTR '"DO YOU WANT TO CUT DOWN THE POSSIBILITIES
28300	         EVEN FURTHER?  Y OR N ...";  I←READ();
28400	     IF I='Y THEN FOR NEW X←1 TO 9 DO BEGIN
28500	       PRINT (<'ORD,X,ORD[X]>); PRINTSTR '"NOW RETYPE ORD[X]";
28600	     I ← READ(); IF NOT(I='S) THEN ORD[X]←I;
28700	 END;
28800	     IF C1=UNKNOWN THEN C1←T;
28900	     IF C3=UNKNOWN THEN C3←T;
29000	     I←NIL; II←NIL;
29100	     LIMINF←LIMINFBASE;
29200	     FOR NEW T1←1 TO LENGTH(ORD[1]) DO BEGIN
29300	       F1←ORD[1,T1];
29400	     IF GREATERP(MSGLEVEL,0) THEN
29500	PRINT(<1,'T1,T1,'F1,F1,'L,L,'RELATEDF,RELATEDF,'ORD,ORD>);
29600	     IF FOR NEW X←2 TO NEX+1 ; AND BEGIN
29700	       E←EXAMPLE[X,1];
29800	       RETURN EVAL '((CAR (GET F1 TARGS)) E) ;
29900	       END AND
30000	     (GOODEX=NIL OR F1(GOODEX[1])=C1) THEN
30100	     FOR NEW T2←1 TO LENGTH(ORD[2]) DO BEGIN
30200	          F2←ORD[2,T2];
30300	     IF GREATERP(MSGLEVEL,1) THEN
30400	PRINT(<2,'T2,T2,'F2,F2>);
30500	     IF FOR NEW X←2 TO NEX+1; AND BEGIN
30600	      E←EXAMPLE[X,1];
30700	       RETURN EVAL '((CAR (GET F2 TARGS)) E) ;
30800	        END  AND
30900	     (NOT(GOODEX) OR F2(GOODEX[1])=GOODEX[2]) THEN
31000	     FOR NEW T8←1 TO LENGTH(ORD[8]) DO BEGIN
31100	       F8←ORD[8,T8];
31200	     IF GREATERP(MSGLEVEL,9) THEN PRINT(<8,'T8,T8,'F8,F8>);
31300	     IF FOR NEW X←2 TO NEX+1; AND BEGIN
31400	       E←EXAMPLE[X,1];
31500	       RETURN EVAL '((CAR (GET F8 TARGS)) E); END AND
31600	     (GOODEX2=NIL OR F8(GOODEX2[1])=C3)  THEN
31700	     FOR NEW T9←1 TO LENGTH(ORD[9]) DO BEGIN
31800	       F9←ORD[9,T9];
31900	     IF GREATERP (MSGLEVEL,10) THEN PRINT(<9,'T9,T9,'F9,F9>);
32000	     IF FOR NEW X←2 TO NEX+1; AND BEGIN
32100	       E←EXAMPLE[X,1];
32200	       RETURN EVAL '((CAR (GET F9 TARGS)) E); END AND
32300	     (NOT(GOODEX2) OR F9(GOODEX2[1])=GOODEX2[2]) THEN
32400	     FOR NEW T3←1 TO LENGTH(ORD[3]) DO BEGIN
32500	       F3←ORD[3,T3];
32600	     IF GREATERP(MSGLEVEL,2) THEN
32700	  PRINT(<3,'T3,T3,'F3,F3>);
32800	     IF FOR NEW X←2 TO NEX+1; AND BEGIN
32900	       E←EXAMPLE[X,1];
33000	       RETURN ( GT(E) OR  EVAL '((CAR (GET F3 TARGS)) E) );
33100	     END THEN
33200	     FOR NEW T4←1 TO LENGTH(ORD[4]) DO BEGIN
33300	     F4←ORD[4,T4];
33400	     IF F4='FN THEN LIMINF←TWICELIMINF;
33500	     IF GREATERP(MSGLEVEL,3) THEN
33600	  PRINT(<4,'T4,T4,'F4,F4,'GETF4TARGS,GET(F4,TARGS)>);
33700	     IF FOR NEW X←2 TO NEX+1; AND BEGIN
33800	       E←EXAMPLE[X,1];
33900	       RETURN ( GT(E) OR  EVAL '((CAR (GET F4 TARGS)) (F3 E) )) ;
34000	       END THEN 
34100	     FOR NEW T5←1 TO LENGTH(ORD[5]) DO BEGIN
34200	     F5←ORD[5,T5];
34300	     IF GREATERP(MSGLEVEL,4) THEN
34400	  PRINT (<5,'T5,T5,'F5,F5>);
34500	     IF FOR NEW X←2 TO NEX+1; AND BEGIN
34600	       E←EXAMPLE[X,1];
34700	       RETURN (GT(E) OR EVAL '((CAR (GET F5 TARGS)) E)) ;
34800	       END THEN
34900	     FOR NEW T6←1 TO LENGTH(ORD[6]) DO BEGIN
35000	     F6←ORD[6,T6];
35100	     IF F6='FN THEN LIMINF ← TRIPLELIMINF;
35200	     IF GREATERP(MSGLEVEL,5) THEN
35300	PRINT (<6,'T6,T6,'F6,F6,'(I HAVE CHOSEN LIMINF TO BE),LIMINF>);
35400	     IF FOR NEW X←2 TO NEX+1; AND BEGIN
35500	       E←EXAMPLE[X,1];
35600	       RETURN ( GT(E) OR  EVAL '((CAR (GET F6 TARGS)) (F5 E) )) ;
35700	       END THEN
35800	     FOR NEW T7←1 TO LENGTH(ORD[7]) DO BEGIN
35900	     F7←ORD[7,T7];
36000	     IF GREATERP(MSGLEVEL,6) THEN
36100	  PRINT (<7,'T7,T7,'F7,F7>);
36200	JJ1← FOR NEW KK←2 TO NEX+2; AND BEGIN E←EXAMPLE[KK,1];
36300	     RETURN (GT(E) OR
36400	       EVAL('((CAR (GET F7 TARGS)) (F4 (F3 E))))); END;
36500	JJ2← FOR NEW HH←2 TO NEX+2; AND BEGIN E←EXAMPLE[HH,1];
36600	     RETURN (GT(E) OR
36700	      EVAL ('((CADR (GET F7 TARGS)) (F6 (F5 E))))) 
36800	     ; END;
36900	     IF JJ1 AND JJ2 THEN  INF←0
37000	     ALSO I← FOR NEW X←2 TO NEX+1; AND BEGIN
37100	       INF←0;
37200	       E←EXAMPLE[X,1];
37300	       RETURN (EXAMPLE[X,2] = EVAL '(FN E)  );
37400	       END;
37500	     IF I THEN PRINTSTR '"
37600	                 HOORAY, HOORAY!!!
37700	                    SUCCESS!!
37800	            ";
37900	      RETURN I;
38000	     END UNTIL I
38100	     END UNTIL I
38200	     END UNTIL I
38300	     END UNTIL I
38400	     END UNTIL I
38500	     END UNTIL I
38600	     END UNTIL I
38700	     END UNTIL I
38800	     END UNTIL I;
38900	     IF GREATERP(MSGLEVEL,0) THEN
39000	      PRINT <'F123456789,F1,F2,F3,F4,F5,F6,F7,F8,F9,'C1234,C1,C2,C3,C4>;
39100	     KNOWNF← FN CONS KNOWNF; TARG ←GET('FN,'TARGS) CONS TARG;
39200	     NARG←N CONS NARG; TRE ← GET('FN,'TRES) CONS TRE;
39300	     BA1 ← FN CONS BA1; IF GREATERP(MSGLEVEL,2) THEN
39400	     PRINT <'KNOWNF,KNOWNF,
39500	       'TARGNARGTRE,TARG,NARG,TRE,'BA1,BA1>;
39600	      TF ← 11.0  CONS⊗   TF;
39700	     FINALIZE();
39800	     PUTPROP(FN,1,NARGS);
39900	     PUTPROP(FN,IHOLD,TARGS);
40000	        PUTPROP(FN,'(ANY),TRES);
40100	     FOR NEW J←1 TO 9 DO PUTPROP(FN,11,PF[J]);
40200	     RETURN FN
40300	     END;
40400	EXPR GT(E);
40500	     OR( GOODEX AND GOODEX[1]=E, GOODEX2 AND GOODEX2[1]=E);
40600	EXPR INTERSECTION(A,B);
40700	     BEGIN NEW III;
40800	     III←NIL;
40900	     FOR NEW JJJ IN A DO
41000	     IF MEMBER(JJJ,B) THEN III←  III @ <JJJ>;
41100	     RETURN III;
41200	     END;
41300	EXPR LISTP(A);AND( NOT(ATOM(A)), LENGTH(A) ≥ 1);
41400	EXPR ANY(A); T;
41500	EXPR NUMBER(A); NUMBERP(A);
41600	EXPR ANYLIST(A);OR(NULL(A),NOT(ATOM(A)));
41700	EXPR PRINTMATRIX();
41800	     BEGIN NEW J;
41900	     PRINTSTR '"FNAME   TF1    TF2    TF3    TF4    TF5    TF6    TF7    TF8    TF9";
42000	     FOR NEW I IN KNOWNF DO BEGIN
42100	     J← FOR NEW K IN PF COLLECT
42200	       <GET(I,K)>;
42300	        RETURN PRINT (I CONS J);
42400	       END;
42500	     END;
42600	EXPR PRIM(NIL);
42700	     BEGIN NEW I,I1,I2;
42800	     GOODEX←NIL;
42900	     GOODEX2 ← NIL;
43000	     F8←NIL;
43100	     F9←NIL;
43200	     ONEX ← 0;
43300	     F1 ← NIL;
43400	      F2 ← NIL;
43500	     PRINTSTR '"THERE IS SOME TRIVIAL (PRIMITIVE) CASE (OR TWO).
43600	       DO YOU KNOW ANYTHING ABOUT IT?  Y OR N ...";
43700	     I ← READ();
43800	     IF I ='N THEN BEGIN
43900	           IF GREATERP(MSGLEVEL,1) THEN PRINTSTR
44000	       '"ASSUMING C1 TO BE T, C2 TO BE UNKNOWN";
44100	       C1 ← T; C2 ← UNKNOWN;
44200	     C3←T; C4←UNKNOWN;
44300	       EXAMPLE[1] ← <C1,C2>;
44400	       RETURN NIL; END ALSO RETURN NIL;
44500	     PRINTSTR '"FOR SOME FUNCTIONS F1,F2 AND SOME CONSTANTS C1,C2
44600	       WHEN F1(ARGUMENT)=C1 THEN THE VALUE OF YOUR FN IS C2=F2(ARG)
44700	          NOTE: C2 MAY NOT ACTUALLY BE A CONSTANT (JUST TYPE UNKNOWN)
44800	
44900	        NOW TYPE IN A FUNCTION NAME OR THE WORD NIL FOR F1,F2
45000	        AND A CONSTANT OR TH WORD UNKNOWN FOR C1,C2 :
45100	       F1 ...";
45200	     F1←READ();
45300	     PRINTSTR '"      F2 ..."; 
45400	     F2 ← READ();
45500	     PRINTSTR '"       C1 ...";
45600	     C1 ← READ();
45700	     PRINTSTR '"       C2 ...";
45800	     C2 ← READ();
45900	     EXAMPLE[1] ← <C1,C2>;
46000	     PRINTSTR '"CAN YOU GIVE ME AN EXAMPLE OF THIS TRIVIAL CASE? ";
46100	     PRINTSTR '"Y OR N ...";
46200	     I ← READ();
46300	     IF I='Y THEN I←GETEX(2) ALSO ONEX←1 ALSO GOODEX←EXAMPLE[2];
46400	     IF GOODEX AND F1 THEN C1←F1(GOODEX[1]);
46500	     IF GOODEX AND F2 THEN C2←F2(GOODEX[1]);
46600	     PRINTSTR '"IS THERE ANOTHER TRIVIAL CASE? Y OR N...";
46700	     I←READ();
46800	                 IF I='N THEN BEGIN
46900	      C3←T; C4←UNKNOWN;
47000	      F8←'FFALSE; F9←'FFALSE;
47100	       END 
47200	     ALSO RETURN NIL;
47300	     PRINTSTR '"FOR SOME FUNCTIONS F8,F9,  AND SOME CONSTANTS C3,C4
47400	       WHEN F8(ARGUMENT)=C3  HEN THE VALUE OF YOUR FUNCTION
47500	         IS C3=F9(ARGUMENT)
47600	           NOTE: C4 MAY NOT ACTUALLY BE A CONSTANT (SAY UNKNOWN)
47700	
47800	        AS BEFORE, TYPE IN SOMETHING FOR ....
47900	                  F8  F9  C3  C4       HERE:";
48000	     F8←READ();F9←READ();C3←READ();C4←READ();
48100	     PRINTSTR '"CAN YOU GIVE ME AN EXAMPLE OF THIS TRIVIAL CASE? 
48200	        Y OR N ...";
48300	     I←READ();
48400	     IF I='Y THEN I←GETEX(3) ALSO ONEX←ONEX+1 ALSO GOODEX2←EXAMPLE[3];
48500	     IF GOODEX2 AND F8 THEN C3←F8(GOODEX2[1]);
48600	     IF GOODEX2 AND F9 THEN C4←F9(GOODEX2[1]);
48700	     RETURN NIL; END;
48800	EXPR RANK(K,LL);
48900	     BEGIN NEW VAL, EXCHANGE,TEMP,OLDR,RL;
49000	     L←LL;
49100	     IF NULL(L[K]) THEN 
49200	       (IF K=7 THEN RETURN '(PI22) ELSE RETURN '(IDEN));
49300	     IF FSUB(K) THEN RETURN <FSUB(K)>;
49400	     VAL←NIL;
49500	     II←NIL;
49600	     II←L[K];
49700	     L←II;
49800	     LEN ← LENGTH(L);
49900	     OLDL←L;
50000	     IF NVARIABLES=2 THEN EXCHANGE←PF ALSO PF←P2F;
50100	     FOR NEW II ←1 TO LEN  DO
50200	     BEGIN
50300	       I←L[II];
50400	       IF MEMBER(I,KNOWNF) AND
50500	           GET(I,'RVAL) AND
50600	           GET(I, PF[K]) AND NOT(GET(I,PF[K])=0) THEN
50700	         VAL[II] ← TIMES( GET(I,PF[K]), GET(I,'RVAL))
50800	       ELSE VAL[II] ← 1000;
50900	     END;
51000	     IF GREATERP(MSGLEVEL,20) THEN
51100	       PRINT(<'VAL,VAL,'L,L>);
51200	     FOR NEW I1←1 TO LEN-1 DO
51300	     FOR NEW I2←I1+1 TO LEN DO
51400	       IF GREATERP(VAL[I1],VAL[I2]) THEN BEGIN
51500	         TEMP←VAL[I1]; VAL[I1]←VAL[I2]; VAL[I2]←TEMP;
51600	         TEMP←L[I1]; L[I1]←L[I2]; L[I2]←TEMP;
51700	       END;
51800	       RL←L;
51900	     IF NVARIABLES=2 THEN PF←EXCHANGE;
52000	     TEMP← FOR NEW J←1 TO LEN COLLECT
52100	     BEGIN IF VAL[J]=1000 THEN RETURN NIL
52200	       ELSE RETURN <L[J]>;
52300	       END;
52400	     L ← TEMP;
52500	     IF GREATERP(MSGLEVEL,9) THEN PRINT (<'OLDL,OLDL,'RANKEDL,
52600	       RL, 'CHOPPEDL, L>);
52700	     RETURN L;
52800	     END;
52900	EXPR FINALIZE();
53000	     BEGIN 
53100	     IF F4='FN THEN F4←FN; IF F6='FN THEN F6←FN;
53200	     EVAL <'DE, FN, '(L),
53300	       <'COND, <<'EQUAL, <F1, 'L>, C1>, <F2,'L>>,
53400	               <<'EQUAL, <F8, 'L>, C3>, <F9, 'L>>,
53500	               <'T,<F7, <F4, <F3, 'L>>,
53600	                        <F6, <F5, 'L>>>>>>;
53700	     RETURN KEEP();
53800	     END;
53900	EXPR PERMANENT();
54000	     BEGIN NEW I;
54100	     EVAL '(OUTC (OUTPUT DSK: PW1KNOWNF) NIL);
54200	     PRINT(<KNOWNF,TARG,NARG,TRE,
54300	       BA1,BA2,TF,T2F >  );
54400	     EVAL '(OUTC NIL T);
54500	     END;
54600	EXPR KEEP();
54700	     BEGIN NEW I;
54800	     PRINTSTR '"THE ANSWER TO YOUR REQUEST IS";
54900	     PRINT (EVAL(LHOLD));
55000	     PRINTSTR '"
55100	
55200	     DO YOU WISH TO ENTER THIS FUNCTION AS A PERMANENT PART
55300	          OF THE SYSTEM?  Y OR N...";
55400	     I←READ();
55500	     IF I='N THEN RETURN NIL;
55600	     I← PERMANENT();
55700	     IF GREATERP(MSGLEVEL,23) THEN PRINT
55800	     (<'KNOWNF,KNOWNF,'TARG,TARG,'NARG,NARG,'TRE,TRE,'BA1,
55900	      BA1,'BA2,BA2>);
56000	     RETURN NIL; END;
56100	EXPR READINKNOWN();
56200	     BEGIN NEW I;
56300	     I←EVAL '(INC (INPUT DSK: PW1KNOWNF) NIL);
56400	     IDATA←NIL;
56500	     IDATA← READ();
56600	     I←EVAL '(INC NIL T);
56700	     IF GREATERP(MSGLEVEL ,24) THEN PRINT (<'IDATA,
56800	       IDATA>);
56900	     RETURN NIL; END;
     

00100	EXPR GETT2F();
00200	     BEGIN
00300	     T2F←NIL; P2F←NIL;
00400	     T2F[1]← '(0 0 14 0 25 25 0 0 0 0 0 0 0 0 25 14 14 25 14
00500	        14 0 0 7 7 0 25 0 25 0 0 25 25 0  0);
00600	     T2F[2] ← '(10 10 0 7 0 0 25 14 14 14 14 25 25 14 0 0 0 0 0
00700	              0 25 14 0 0
00800	       25 0 25 0 10 10 25 0 0 0);
00900	     T2F[3] ← T2F[2];
01000	     T2F[4] ← '(0 0 10 0 25 25 0 0 0 0 0 0 0
01100	           0 25 25 25 25 25 25 0 0 7 7 0 25 0
01200	       25 0 0 24 14 0  0);
01300	     T2F[5] ← '(10 10 0 7 0 0 14 25 25 25 25 25 25 25 0
01400	       0 0 0 0  0 25 25 0 0
01500	       14 0 10 0 14 14 14 0 0 0);
01600	     T2F[6]← '(10 10 0 7 0 0 14 25 25 25 25 25 25 25 0 
01700	       0 0 0 0 0 25 25 0 0
01800	       25 0 10 0 14 14 14 0 0 0);
01900	     T2F[7]← T2F[1];
02000	     T2F[8]← T2F[2];
02100	     T2F[9] ← T2F[3];
02200	     T2F[10] ← T2F[4];
02300	     T2F[11] ← T2F[5];
02400	     T2F[12] ← T2F[6];
02500	     T2F[13] ← '(0 0 10 0 25 25 0 0 0 0 0 0 0 0 25 25 25 25 25 14
02600	       0 0 14 14 0 25 0 25 0 0 25 20 0 14);
02700	     T2F[14] ← '(0 0 14 0 25 25 0 0 0 0 0 0 0 0 25 15 15 15 15 25 0
02800	       0 7 10 0 25 0 25 0 0 24 20 0 10);
02900	     T2F[15] ← '(7 10 0 10 0 0 14 25 25 25 25 25 25 25 0 0 0 0 0
03000	         0 25 25 0 0 25 0 25 0 14 14 0 0 0 0);
03100	     T2F[16] ← T2F[15];
03200	     T2F[17] ← T2F[14];
03300	     T2F[18] ← '(10 7 0 10 0 0 14 25 25 25 25 25 25 25 0 0 0 0 0 0 
03400	       25 25 0 0 25 0 25 0 14 14 0 0 0 0 );
03500	     T2F[19] ← T2F[18];
03600	     END;
03700	EXPR GS2();
03800	     BEGIN
03900	     SCHEMA2 ← '(DE FN2(L M)  (COND
04000	     ((AND ((CAR (GET F2 TARGS)) L)
04100	           ((CAR (GET F3 TARGS)) M)
04200	           ((CAR (GET F1 TARGS)) (F2 L))
04300	           ((CADR (GET F1 TARGS)) (F3 M))
04400	           (EQUAL (F1 (F2 L) (F3 M)) C1)
04500	           ((CAR (GET F5 TARGS)) L)
04600	           ((CAR (GET F6 TARGS)) M)
04700	           ((CAR (GET F4 TARGS)) (F5 L))
04800	           ((CADR (GET F4 TARGS)) (F6 M)))
04900	       (F4 (F5 L) (F6 M)))
05000	     ((AND ((CAR (GET F8 TARGS)) L)
05100	           ((CAR (GET F9 TARGS)) M)
05200	           ((CAR (GET F7 TARGS)) (F8 L))
05300	           ((CADR (GET F7 TARGS)) (F9 M))
05400	           (EQUAL (F7 (F8 L) (F9 M)) C3)
05500	            ((CAR (GET F11 TARGS)) L)
05600	           ((CAR (GET F12 TARGS)) M)
05700	           ((CAR (GET F10 TARGS)) (F11 L))
05800	           ((CADR (GET F10 TARGS)) (F12 M)))
05900	      (F10 (F11 L) (F12 M) )  )
06000	
06100	     ((OR (GT2 L M) 
06200	          (AND (INFINITY)
06300	               ((CAR (GET F16 TARGS)) M)
06400	               ((CAR (GET F15 TARGS)) L)
06500	               ((CAR (GET F14 TARGS)) (F15 L))
06600	               ((CADR (GET F14 TARGS)) (F16 M))
06700	               ((CAR (GET F18 TARGS)) L)
06800	               ((CAR (GET F19 TARGS)) M)
06900	               ((CAR (GET F17 TARGS)) (F18 L))
07000	               ((CADR (GET F17 TARGS)) (F19 M))
07100	               ((CAR (GET F13 TARGS))
07200	                        (SETQ CE1 (F14 (F15 L) (F16 M))))
07300	               ((CADR (GET F13 TARGS))
07400	                        (SETQ CE2 (F17 (F18 L) (F19 M))))))
07500	      (F13 CE1 CE2))
07600	     (T C2))  ); 
07700	     IF GREATERP(MSGLEVEL, 54) THEN PRINTSTR '" SCHEMA TWO IS";
07800	     IF GREATERP(MSGLEVEL, 53) THEN PRINT (SCHEMA2);
07900	     RETURN NIL;
08000	     END;
08100	EXPR REC2(FN,A,N,RELATEDF);
08200	     BEGIN NEW I,II,I1,I2,KK,JJ1,JJ2;
08300	     EE1←NIL;
08400	     EE2 ← NIL;
08500	     L1← NIL;
08600	     L2 ← NIL;
08700	     E←NIL;
08800	     MA←T;
08900	     MN←T;
09000	     MAL←T;
09100	     MA2 ←T;
09200	      MN2←T;
09300	     MAL2←T;
09400	     E1←NIL;
09500	     E2←NIL;
09600	     EXAMPLE[NEX+2,1]←<L,CADADR(A)>;
09700	     FOR NEW X←1 TO NEX+1 DO BEGIN
09800	       E1← EXAMPLE[X+1,1,1];
09900	       E2← EXAMPLE[X+1,1,2];
10000	     MA← MA AND ATOM(E1);
10100	     MA2← MA2 AND ATOM(E2);
10200	     MN ← MN AND NUMBER(E1);
10300	     MN2 ← MN2 AND NUMBER(E2);
10400	     MAL ← MAL AND ANYLIST(E1);
10500	     MAL2 ← MAL2 AND ANYLIST(E2);
10600	     END;
10700	     I← '(ANY ANY);
10800	     IF MAL THEN I[1] ← 'ANYLIST;
10900	     IF MAL2 THEN I[2] ← 'ANYLIST;
11000	     IF MA THEN I[1] ← 'ATOM;
11100	     IF MA2 THEN I[2] ← 'ATOM;
11200	     IF MN THEN I[1] ← 'NUMBER;
11300	     IF MN2 THEN I[2] ← 'NUMBER;
11400	     PUTPROP ('FN2, I, 'TARGS);
11500	     PUTPROP ('FN2, 2, 'NARGS);
11600	     PUTPROP ('FN2, 'ANY, 'TRES);
11700	     IHOLD← I;
11800	     PRINTSTR '"DO YOU KNOW THE TYPE OF ARGUMENTS FOR THE FN?
11900	        MY GUESS IS";
12000	     PRINC (IHOLD);
12100	     PRINTSTR '"     ANSWER N MEANS GUESS IS OK,
12200	       ANSWER Y MEANS YOU WANT TO CHANGE MY GUESS ...";
12300	     I←READ();
12400	     IF I='Y THEN BEGIN
12500	      PRINTSTR '"TYPE IN TWO OF THE WORDS:
12600	     ANY  ANYLIST  NUMBER  LISTP
12700	                          ( LISTP MEANS A NONNULL LIST)...";
12800	     I ← READ();
12900	     II ← READ();
13000	     IHOLD ← <I,II>;
13100	      PUTPROP('FN2, IHOLD, 'TARGS);
13200	     END;
13300	     FOR NEW K←1 TO 19 DO
13400	     ORD[K]←INTERSECTION(RELATEDF[1]@RELATEDF[2]@<'FN2>
13500	       @RELATEDF[3]@RELATEDF[4], ORDER2[K]);
13600	     FOR NEW K←1 TO 19 DO
13700	       ORD[K] ← RANK(K,ORD);
13800	     PRINTSTR '"DO YOU WANT TO CUT DOWN THE POSSIBILITIES?";
13900	     I←READ();
14000	     IF I='Y THEN  FOR NEW X←1 TO 19 DO
14100	     BEGIN
14200	     PRINT <'ORD,X,ORD[X]>;
14300	     PRINTSTR '"NOW RETYPE THIS SECTION OF ORD:";
14400	     I←READ();
14500	     IF NOT(I='S) THEN ORD[X]←I;
14600	     END;
14700	     IF C1='UNKNOWN THEN C1=T;
14800	     IF C3='UNKNOWN THEN C3=T;
14900	     I←NIL; II←NIL;
15000	     LIMINF←LIMINFBASE;
15100	     TAGF1 ← F1;
15200	    TAGF7 ← F7;
15300	    FOR NEW T2 ← 1 TO LENGTH(ORD[2]) DO BEGIN
15400	       F2 ← ORD[2,T2];
15500	     IF GREATERP(MSGLEVEL,0) THEN
15600	       PRINT <2,'T2,T2,'F2,F2>;
15700	     IF GREATERP(MSGLEVEL,49) THEN
15800	     PRINT<'L,L,'RELATEDFUNCTIONS,RELATEDF,'ORD,ORD>;
15900	     IF FOR NEW X← 2 TO NEX+1; AND
16000	        MAT(EXAMPLE[X,1],F2)        THEN
16100	     FOR NEW T3 ← 1 TO LENGTH(ORD[3]) DO BEGIN
16200	       F3←ORD[3,T3];
16300	     IF GREATERP(MSGLEVEL,1) THEN
16400	        PRINT <3,'T3,T3,'F3,F3>;
16500	      IF FOR NEW X←2 TO NEX+1; AND
16600	        MAT3(EXAMPLE[X,1],F3) THEN
16700	        FOR NEW T1←1 TO LENGTH(ORD[1]) DO BEGIN
16800	        F1← ORD[1,T1];
16900	       IF GREATERP(MSGLEVEL,2) THEN PRINT <1,'T1,T1,'F1,F1>;
17000	       IF FOR NEW X←2 TO NEX+1; AND
17100	           MAT2(EXAMPLE[X,1],F1,F2,F3) AND
17200	           (TAGF1 OR GOODEX=NIL OR F1(F2 (GOODEX[1,1]),
17300	             F3(GOODEX[1,2]))=C1) THEN
17400	     FOR NEW T5←1 TO LENGTH(ORD[5]) DO BEGIN
17500	     F5 ← ORD[5,T5];
17600	     IF GREATERP(MSGLEVEL,4) THEN PRINT<5,'T5,T5,'F5,F5>;
17700	      IF FOR NEW X←2 TO NEX+1; AND MAT(EXAMPLE[X,1],F5) THEN
17800	     FOR NEW T6←1 TO LENGTH(ORD[6]) DO BEGIN
17900	     F6 ← ORD[6,T6];
18000	     IF GREATERP(MSGLEVEL,5) THEN PRINT <6,'T6,T6,'F6,F6>;
18100	     IF FOR NEW X←2 TO NEX+1; AND MAT3(EXAMPLE[X,1],F6) THEN
18200	     FOR NEW T4← 1 TO LENGTH(ORD[4]) DO BEGIN
18300	     F4←ORD[4,T4];
18400	     IF GREATERP(MSGLEVEL,6) THEN PRINT <4,'T4,T4,'F4,F4>;
18500	     IF FOR NEW X←2 TO NEX+1; AND
18600	       MAT2(EXAMPLE[X,1],F4,F5,F6) AND
18700	       (LENGTH(ORD[4])=1 OR C2=NIL OR C2=UNKNOWN
18800	         OR F4(F5(L),F6(M))=C2)
18900	       AND ((NOT GOODEX) OR 
19000	            (F4(F5(GOODEX[1,1]),F6(GOODEX[1,2]))=GOODEX[2]))
19100	         THEN
19200	     FOR NEW T8←1 TO LENGTH(ORD[8]) DO BEGIN
19300	     F8←ORD[8,T8];
19400	     IF GREATERP(MSGLEVEL,6) THEN PRINT <8,'T8,T8,'F8,F8>;
19500	     IF FOR NEW X←2 TO NEX+1; AND 
19600	       
19700	       GT4(EXAMPLE[X,1,1],EXAMPLE[X,1,2]) OR
19800	     MAT(EXAMPLE[X,1],F8) THEN
19900	     FOR NEW T9←1 TO LENGTH(ORD[9]) DO BEGIN
20000	     F9 ← ORD[9,T9];
20100	     IF GREATERP(MSGLEVEL,7) THEN PRINT <9,'T9,T9,'F9,F9>;
20200	     IF FOR NEW X←2 TO NEX+1; AND
20300	       GT4(EXAMPLE[X,1,1],EXAMPLE[X,1,2])  OR
20400	       MAT3(EXAMPLE[X,1],F9) THEN
20500	     FOR NEW T7←1 TO LENGTH(ORD[7]) DO  BEGIN
20600	     F7←ORD[7,T7];
20700	     IF GREATERP(MSGLEVEL,8) THEN PRINT <7,'T7,T7,'F7,F7 >;
20800	     IF MAT2(GOODEX2[1],F7,F8,F9) AND
20900	         FOR NEW X←2 TO NEX+1; AND
21000	      ( GT4(EXAMPLE[X,1,1],EXAMPLE[X,1,2]) OR
21100	       MAT2(EXAMPLE[X,1],F7,F8,F9)) AND
21200	       
21300	       (TAGF7 OR GOODEX2=NIL OR
21400	        F7(F8(GOODEX2[1,1]),F9(GOODEX2[1,2]))=C3) THEN
21500	     FOR NEW T11←1 TO LENGTH(ORD[11]) DO BEGIN
21600	     F11←ORD[11,T11];
21700	     IF GREATERP(MSGLEVEL,9) THEN PRINT <11,'T11,T11,'F11,F11>;
21800	     IF FOR NEW X←2 TO NEX+1; AND 
21900	       GT4(EXAMPLE[X,1,1],EXAMPLE[X,1,2]) OR
22000	      MAT(EXAMPLE[X,1],F11) THEN
22100	     FOR NEW T12←1 TO LENGTH(ORD[12]) DO BEGIN
22200	     F12←ORD[12,T12];
22300	     IF GREATERP(MSGLEVEL,10) THEN PRINT <12,'T12,T12,'F12,F12>;
22400	     IF FOR NEW X←2 TO NEX+1; AND 
22500	       (GT4(EXAMPLE[X,1,1],EXAMPLE[X,1,2]) OR
22600	      MAT3(EXAMPLE[X,1],F12))
22700	        THEN
22800	     FOR NEW T10←1 TO LENGTH(ORD[10]) DO BEGIN
22900	     F10←ORD[10,T10];
23000	     IF GREATERP(MSGLEVEL,11) THEN PRINT <10,'T10,T10,'F10,F10>;
23100	     IF ( FOR NEW X←2 TO NEX+1; AND 
23200	      GT4(EXAMPLE[X,1,1],EXAMPLE[X,1,2]) OR
23300	       MAT2(EXAMPLE[X,1],F10,F11,F12))
23400	       AND ((NOT GOODEX2) OR
23500	       (F10(F11(GOODEX2[1,1]), F12(GOODEX2[1,2]))
23600	          = GOODEX2[2]))       THEN
23700	     FOR NEW T15← 1 TO LENGTH(ORD[15]) DO BEGIN
23800	     F15← ORD[15,T15];
23900	     IF GREATERP(MSGLEVEL,12) THEN PRINT <15,'T15,T15,'F15,F15>;
24000	     IF FOR NEW X←2 TO NEX+1; AND HH(X) OR MAT(EXAMPLE[X,1],F15) THEN
24100	     FOR NEW T16←1 TO LENGTH(ORD[16]) DO BEGIN
24200	     F16←ORD[16,T16];
24300	     IF GREATERP(MSGLEVEL,13) THEN PRINT <16,'T16,T16,'F16,F16>;
24400	     IF FOR NEW X←2 TO NEX+1; AND HH(X) OR MAT3(EXAMPLE[X,1],F16) THEN
24500	     FOR NEW T14←1 TO LENGTH(ORD[14]) DO BEGIN
24600	     F14←ORD[14,T14];
24700	     IF GREATERP(MSGLEVEL,14) THEN PRINT <14,'T14,T14,'F14,F14>;
24800	     IF FOR NEW X←2 TO NEX+1; AND 
24900	       HH(X) OR MAT2(EXAMPLE[X,1],F14,F15,F16) THEN
25000	     FOR NEW T18←1 TO LENGTH(ORD[18]) DO BEGIN
25100	     F18←ORD[18,T18];
25200	     IF GREATERP(MSGLEVEL,15) THEN PRINT <18,'T18,T18,'F18,F18>;
25300	     IF FOR NEW X←2 TO NEX+1; AND
25400	       HH(X) OR  MAT(EXAMPLE[X,1],F18) THEN
25500	     FOR NEW T19←1 TO LENGTH(ORD[19]) DO BEGIN
25600	     F19←ORD[19,T19];
25700	     IF GREATERP(MSGLEVEL,16) THEN PRINT <19,'T19,T19,'F19,F19>;
25800	     IF FOR NEW X←2 TO NEX+1; AND
25900	       HH(X) OR MAT3(EXAMPLE[X,1],F19) THEN
26000	     FOR NEW T17←1 TO LENGTH(ORD[17]) DO BEGIN
26100	     F17←ORD[17,T17];
26200	     IF GREATERP(MSGLEVEL,17) THEN PRINT <17,'T17,T17,'F17,F17>;
26300	     IF FOR NEW X←2 TO NEX+1; AND
26400	       HH(X) OR  MAT2(EXAMPLE[X,1],F17,F18,F19) THEN
26500	     FOR NEW T13←1 TO LENGTH (ORD[13]) DO BEGIN
26600	     F13←ORD[13,T13];
26700	     IF GREATERP(MSGLEVEL,18) THEN PRINT <13,'T13,T13,'F13,F13>;
26800	     I←INNERLOOP();
26900	     RETURN I;
27000	     END UNTIL I
27100	     END UNTIL I
27200	     END UNTIL I
27300	     END UNTIL I
27400	     END UNTIL I
27500	     END UNTIL I
27600	     END UNTIL I
27700	     END UNTIL I
27800	     END UNTIL I
27900	     END UNTIL I
28000	     END UNTIL I
28100	     END UNTIL I
28200	     END UNTIL I
28300	     END UNTIL I
28400	     END UNTIL I
28500	     END UNTIL I
28600	      END UNTIL I
28700	     END UNTIL I
28800	     END UNTIL I;
28900	     IF GREATERP(MSGLEVEL,0) THEN
29000	      PRINT <'F1TOF19,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,
29100	        F11,F12,F13,F14,F15,F16,F17,F18,F19,'C1234,C1,C2,
29200	        C3,C4>;
29300	     KNOWNF ← FN2 CONS KNOWNF;
29400	     TARG ← GET('FN,'TARGS) CONS TARG;
29500	     NARG← N CONS NARG;
29600	     TRE ← GET('FN,'TRES) CONS TRE;
29700	     BA2 ← FN2 CONS BA2;
29800	     IF GREATERP(MSGLEVEL,35) THEN PRINT <'KNOWNF,KNOWNF,
29900	       'RELATESDF,RELATEDF,'TARG,TARG,'NARG,NARG,'TRE,
30000	       TRE,'BA2,BA2>;
30100	      PUTPROP(FN2,2,NARGS);
30200	     PUTPROP(FN2,IHOLD,TARGS);
30300	     PUTPROP(FN2,'ANY,TRES);
30400	     T2F ← 11.0  CONS⊗  T2F;
30500	      FINALIZE2();
30600	     FOR NEW J←1 TO 19 DO PUTPROP(FN2,11,P2F[J]);
30700	     RETURN FN2;
30800	     END;
30900	EXPR PRIM2();
31000	     BEGIN NEW I;
31100	     GOODEX ← NIL;
31200	     GOODEX2 ← NIL;
31300	     ONEX ← 0;
31400	     F1 ← NIL;
31500	     F12 ← NIL;
31600	     F3 ← NIL;
31700	     F2 ← NIL;
31800	     F4 ← NIL;
31900	     F5 ← NIL;
32000	     F6 ← NIL;
32100	     F7 ← NIL;
32200	     F8 ← NIL;
32300	     F9←NIL;
32400	     F10 ← NIL;
32500	     F11 ← NIL;
32600	     PRINTSTR '"THERE IS SOME PRIMITIVE CASE (OR TWO).
32700	     DO YOU KNOW ANYTHING ABOUT IT? Y OR N...";
32800	     I← READ();
32900	     IF I='N THEN  BEGIN
33000	       IF GREATERP(MSGLEVEL,3) THEN PRINTSTR 
33100	       '"I AM ASSUMING F1 THROUGH F12 TO BE NIL,
33200	         C1 AND C3 TO BE T, C2 AND C4 TO BE UNKNOWN";
33300	       C1 ←T;
33400	       C3← T;
33500	       C2← UNKNOWN;
33600	       C4 ← UNKNOWN;
33700	     EXAMPLE[1] ←<C1,C2>;
33800	     RETURN NIL; 
33900	     END  ALSO RETURN NIL;
34000	     PRINTSTR '"FOR SOME FUNCTIONS F1,F2,F3,F4,F5,F6,
34100	     AND SOME CONSTANT C1, WHEN
34200	       F1( F2(ARG1), F3(ARG2) )  =  C1    THEN
34300	     THE VALUE OF YOUR FUNCTION IS 
34400	       F4( F5(ARG1), F6(ARG2) ) = C2
34500	
34600	     NOW TYPE IN NIL OR A FUNCTION NAME FOR F1,F2,F3,F4,F5,F6:";
34700	     F1←READ();
34800	     F2←READ();
34900	     F3←READ();
35000	     F4←READ();
35100	     F5←READ();
35200	     F6←READ();
35300	     PRINTSTR '"NOW TYPE IN A CONSTANT OR THE VALUE UNKNOWN FOR C1";
35400	     C1←READ();
35500	     PRINTSTR '"IF C2 IS A CONSTANT, TYPE IN ITS VALUE. IF IT
35600	     IS NOT CONSTANT, OR IF YOU DONT KNOW THE VALUE,TYPE UNKNOWN";
35700	     C2←READ();
35800	     EXAMPLE[1]←<C1,C2>;
35900	     PRINTSTR '"CAN YOU GIVE ME AN EXAMPLE OF THIS
36000	     PRIMITIVE CASE? Y OR N...";
36100	     I←READ();
36200	     IF I='Y THEN I←GETEX(2) ALSO ONEX←1 ALSO GOODEX←EXAMPLE[2];
36300	     PRINTSTR '"IS THERE ANOTHER PRIMITICE CASE? Y OR N...";
36400	     I←READ();
36500	     IF I='N THEN BEGIN
36600	     C3←T;
36700	    C4←UNKNOWN;
36800	     F7←'FFALSE2;
36900	     F8←'FFALSE;
37000	     F9←'FFALSE;
37100	     F10←'FFALSE2;
37200	     F11←'FFALSE;
37300	     F12←'FFALSE;
37400	     END ALSO RETURN NIL;
37500	     PRINTSTR '"FOR SOME FUNCTIONS F7,F8,F9,F10,F11,F12,
37600	     AND SOME CONSTANT C3, WHEN
37700	       F7( F8(ARG1), F9(ARG2) ) = C3 THEN
37800	     THE VALUE OF YOUR FUNCTION IS
37900	       F10( F11(ARG1), F12(ARG2) ) = C4
38000	
38100	     NOW TYPE IN NIL OR A FUNCTION NAME FOR F7 THROUGH F12:";
38200	     F7←READ();
38300	     F8←READ();
38400	     F9←READ();
38500	     F10←READ();
38600	     F11←READ();
38700	     F12←READ();
38800	     PRINTSTR '"NOW TYPE IN UNKNOWN OR A CONSTANT FOR C3,C4:";
38900	     C3←READ();
39000	     C4←READ();
39100	     PRINTSTR '"CAN YOU GIVE ME AN EXAMPLE OF THIS? Y OR N>>>";
39200	     I←READ();
39300	     IF I='Y THEN I←GETEX(3) ALSO ONEX←2 ALSO GOODEX2←EXAMPLE[3];
39400	     RETURN NIL;
39500	     END;
39600	EXPR FSUB(I);
39700	     IF I=1 THEN F1
39800	     ELSE IF I=2 THEN F2
39900	     ELSE IF I=3 THEN F3
40000	     ELSE IF I=4 THEN F4
40100	     ELSE IF I=5 THEN F5
40200	     ELSE IF I=6 THEN F6
40300	     ELSE IF I=7 THEN F7
40400	     ELSE IF I=8 THEN F8
40500	     ELSE IF I=9 THEN F9
40600	     ELSE IF I=10 THEN F10
40700	     ELSE IF I=11 THEN F11
40800	     ELSE IF I=12 THEN F12
40900	     ELSE IF I=13 THEN F13
41000	     ELSE IF I=14 THEN F14
41100	     ELSE IF I=15 THEN F15
41200	     ELSE IF I=16 THEN F16
41300	     ELSE IF I=17 THEN F17
41400	     ELSE IF I=18 THEN F18
41500	     ELSE IF I=19 THEN F19
41600	     ELSE PRINT <'FSUBERROR,'I,I>;
41700	EXPR FINALIZE2();
41800	     BEGIN
41900	     FOR NEW I←1 TO 19 DO
42000	     IF F1='FN2 THEN F1←FN2;
42100	     IF F4='FN2 THEN F4←FN2;
42200	     IF F7='FN2 THEN F7←FN2;
42300	     IF F10='FN2 THEN F10←FN2;
42400	     IF F13='FN2 THEN F13←FN2;
42500	     IF F14='FN2 THEN F14←FN2;
42600	     IF F17='FN2 THEN F17←FN2;
42700	     EVAL <'DE, FN2, '(L M),
42800	     <'COND, <<'EQUAL, <F1, <F2, 'L>,<F3,'M>>,C1>,
42900	                       <F4, <F5, 'L>,<F6, 'M>>>,
43000	                <<'EQUAL,<F7,<F8,'L>,<F9,'M>>,C3>,
43100	                         <F10,<F11,'L>,<F12,'M>>>,
43200	         <T,<F13,<F14,<F15,'L>,<F16,'M>>,
43300	                 <F17,<F18,'L>,<F19,'M>>>>>>;
43400	     RETURN KEEP();
43500	     END;
43600	EXPR FFALSE2(A,B); NIL;
43700	EXPR GT2(L,M); OR(GOODEX AND GOODEX[1,1]=L AND GOODEX[1,2]=M,
43800	     GOODEX2 AND GOODEX2[1,1]=L AND GOODEX2[1,2]=M);
43900	EXPR HH(X);
44000	     GT2(EXAMPLE[X,1,1],EXAMPLE[X,1,2]);
44100	EXPR GT4(L,M); AND(GOODEX, GOODEX[1,1]=L, GOODEX[1,2]=M);
44200	EXPR GT5(L,M); AND(GOODEX2, GOODEX2[1,1]=L, GOODEX2[1,2]=M);
44300	EXPR MAT(E ,F);
44400	     EVAL '((CAR (GET F TARGS)) (CAR E));
44500	EXPR MAT2(E,F,G1,G2);
44600	     EVAL '((CAR (GET F TARGS)) (G1 (CAR E))) AND
44700	    EVAL '((CADR (GET F TARGS)) (G2 (CADR E)));
44800	EXPR MAT3(E,F);
44900	     EVAL '((CAR (GET F TARGS)) (CADR E));
45000	EXPR MAT4(E,F,G1,G2);
45100	     GT4(CAR(E),CADR(E)) OR
45200	     EVAL '((CAR (GET F TARGS)) (G1 (CAR E))) AND
45300	     EVAL '((CADR (GET F TARGS)) (G2 (CADR E)));
45400	EXPR MAT5(E,F,G1,G2);
45500	     GT5(CAR(E),CADR(E)) OR
45600	     EVAL '((CAR (GET F TARGS)) (G1 (CAR E))) AND
45700	     EVAL '((CADR (GET F TARGS)) (G2 (CADR E)));
45800	EXPR INNERLOOP();
45900	     BEGIN
46000	     I←NIL;
46100	     INF←0;
46200	     IF FOR NEW X←2 TO NEX+1; AND
46300	       BEGIN
46400	       L1←EXAMPLE[X,1,1];
46500	       L2←EXAMPLE[X,1,2];
46600	       I← EVAL '((CAR (GET F13 TARGS))
46700	                 (SETQ EE1 (F14 (F15 L1) (F16 L2))));
46800	     IF I THEN I← EVAL '((CADR (GET F13 TARGS))
46900	                 (SETQ EE2 (F17 (F18 L1) (F19 L2))));
47000	     IF I THEN I←(EVAL '(FN2 EE1 EE2) = EXAMPLE[X,2]);
47100	       RETURN I;
47200	       END
47300	     THEN PRINTSTR '"HOORAY, SUCCESS!!!" 
47400	       ALSO RETURN I;
47500	     END;
47600	END.