Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-04 - decus/20-0121/venn.sim
There are 2 other files named venn.sim in the archive. Click here to see a list.
COMMENT OPTIONS(/-A/-D/-I/-Q);
COMMENT-----------------------------------------------------------------------

VENN Version 1 (c) copyright 1977 by its author, Dr. Walter Maner, Department
of Philosophy, Old Dominion University, Norfolk, VA. 23508. TEL: (804) 489-6517

Use of this program implies an agreement to report all program errors and
modifications directly to the author.  A FILCOM listing of the differences
between the original version and the new version is the preferred vehicle.
Modifications must leave notices of copyright and related warnings intact.
In particular, the run-time program header must not be suppressed or altered.
Copying of this progam for use on another system IS permitted PROVIDED the
author is merely notified that a copy is about to be made, and for whom.
Failure to comply with these requests WILL CONSTITUTE A VIOLATION OF COPYRIGHT.


DOCUMENTATION:  In addition to the internal documentation, users should
consult VENN.DOC.

PEAK CORE REQUIREMENT:     47+12P (30K) without OPTIONS (in other words, as is)
or 42+12P (27K) with OPTIONS (initial "COMMENT " deleted)

------------------------------------------------------------------------------;

BEGIN

   EXTERNAL INTEGER PROCEDURE
   trmop,
   scanint;

   EXTERNAL LONG REAL PROCEDURE
   scanreal;

   EXTERNAL REAL PROCEDURE
   clocktime;

   EXTERNAL TEXT PROCEDURE
   conc,
   rest,
   upcase;

   EXTERNAL PROCEDURE
   sleep;

   EXTERNAL CLASS
   safmin;
   COMMENT-----------------------------------------------------------------
   This subset of the SAFEIO CLASS contains the "request" procedure body.
   ------------------------------------------------------------------------;

   BEGIN
      REF(vennterms) termlist;

      CLASS terms;
      BEGIN
         INTEGER seed;

         TEXT ARRAY
         classterms[1:67];

         TEXT PROCEDURE pickterm(index);
         INTEGER index;
         BEGIN
            IF index = 1 THEN pickterm:- classterms[Randint(1,42,seed)]
            ELSE IF index = 2 THEN pickterm:- classterms[Randint(43,49,seed)]
            ELSE IF index = 3 THEN pickterm:- classterms[Randint(50,57,seed)]
            ELSE pickterm:- classterms[Randint(58,67,seed)];
         END;

         seed:= Entier(clocktime);

         classterms[1]:- Copy("TRUE PHILOSOPHERS");
         classterms[2]:- Copy("CONFIRMED SKEPTICS");
         classterms[3]:- Copy("SUCCESSFUL LOGICIANS");
         classterms[4]:- Copy("SENSUOUS WOMEN");
         classterms[5]:- Copy("SENSUOUS MEN");
         classterms[6]:- Copy("WASHINGTON POLITICIANS");
         classterms[7]:- Copy("DISCO DANCERS");
         classterms[8]:- Copy("RAVING IDIOTS");
         classterms[9]:- Copy("ABSENT-MINDED PROFESSORS");
         classterms[10]:- Copy("GOOD LOVERS");
         classterms[11]:- Copy("TOMATO FONDLERS");
         classterms[12]:- Copy("CANDID PHOTOGRAPHERS");
         classterms[13]:- Copy("PATIO GARDENERS");
         classterms[14]:- Copy("WEE-HOUR SNACKERS");
         classterms[15]:- Copy("BIG SPENDERS");
         classterms[16]:- Copy("MATCHSTICK GAMBLERS");
         classterms[17]:- Copy("SEX OBJECTS");
         classterms[18]:- Copy("MIDNIGHT MARAUDERS");
         classterms[19]:- Copy("MORNING-AFTER BRAGGERS");
         classterms[20]:- Copy("BACKSEAT DRIVERS");
         classterms[21]:- Copy("FREE LOADERS");
         classterms[22]:- Copy("BATHTUB SAILORS");
         classterms[23]:- Copy("MASSAGE ARTISTS");
         classterms[24]:- Copy("COLLEGE GRADUATES");
         classterms[25]:- Copy("SELF-STYLED EXPERTS");
         classterms[26]:- Copy("PARTY POOPERS");
         classterms[27]:- Copy("GARBAGE PICKERS");
         classterms[28]:- Copy("UNSUNG HEROES");
         classterms[29]:- Copy("INCURABLE DREAMERS");
         classterms[30]:- Copy("BATHROOM POETS");
         classterms[31]:- Copy("COMPULSIVE LIARS");
         classterms[32]:- Copy("MEXICAN DENTISTS");
         classterms[33]:- Copy("TOOTH FAIRIES");
         classterms[34]:- Copy("FAST-FOOD JUNKIES");
         classterms[35]:- Copy("DEADLY RIVALS");
         classterms[36]:- Copy("CROP DUSTERS");
         classterms[37]:- Copy("STREET PEDDLERS");
         classterms[38]:- Copy("WILLING PRISONERS");
         classterms[39]:- Copy("STRANGE BEDFELLOWS");
         classterms[40]:- Copy("PEEPHOLE PERVERTS");
         classterms[41]:- Copy("STAND-UP COMICS");
         classterms[42]:- Copy("READY ROMANCERS");
         COMMENT----------------------------------------------------------------------
         The remaining terms, 43-67, establish a universe of discourse for the
         heuristic search mechanism (in CLASS "counterterms") which attempts to generate
         counterexamples to the syllogisms "makesyllogism" produces.  The seven terms
         immediately below, 43-49, are labels for (b)ig, roughly coextensive classes--
         'B' classes for short.
         ---------------------------------------------------------------------------;
         classterms[43]:- Copy("LIVING THINGS");
         classterms[44]:- Copy("CELLULAR ORGANISMS");
         classterms[45]:- Copy("MORTAL THINGS");
         classterms[46]:- Copy("CHROMOSOMAL CREATURES");
         classterms[47]:- Copy("BIOLOGICAL ENTITIES");
         classterms[48]:- Copy("BUNDLES OF PROTOPLASM");
         classterms[49]:- Copy("FORMS OF LIFE");
         COMMENT---------------------------------------------------------------------
         The eight terms immediately below, 50-57, are labels for classes of (m)edium
         extension--'M' classes for short.  Any 'M' class is a proper subset of any 'B'
         class.  (At least, it is in VENN's metaphysics!)
         ----------------------------------------------------------------------------;
         classterms[50]:- Copy("HOMOSAPIENS");
         classterms[51]:- Copy("RATIONAL BEINGS");
         classterms[52]:- Copy("PROMISE MAKERS");
         classterms[53]:- Copy("CONSCIOUS BEINGS");
         classterms[54]:- Copy("HUMAN BEINGS");
         classterms[55]:- Copy("PERSONS");
         classterms[56]:- Copy("POLITICAL ANIMALS");
         classterms[57]:- Copy("FEATHERLESS BIPEDS");
         COMMENT--------------------------------------------------------------------
         The ten terms below label classes which have so (l)ittle extension that
         they are likely to be mutually exclusive--'L' classes for short.  VENN also
         regards each of them as labeling a proper subset of any 'M' class.  This
         characteristic, plus their exclusivity, figure in the success of the heuristic.
         ---------------------------------------------------------------------------;
         classterms[58]:- Copy("WORLD BANK DIRECTORS");
         classterms[59]:- Copy("MULTIBILLIONAIRES");
         classterms[60]:- Copy("NOBEL LAUREATES");
         classterms[61]:- Copy("OLYMPIC GOLD MEDALISTS");
         classterms[62]:- Copy("SOVIET CHESS CHAMPIONS");
         classterms[63]:- Copy("LUNAR EXPLORERS");
         classterms[64]:- Copy("FORMER US PRESIDENTS");
         classterms[65]:- Copy("FIVE-YEAR-OLD BOYS");
         classterms[66]:- Copy("FIVE-YEAR-OLD GIRLS");
         classterms[67]:- Copy("AFRICAN HEADS OF STATE")
      END CLA*S terms;


      terms CLASS vennterms;
      BEGIN
         TEXT ARRAY fallacies[1:8];

         fallacies[1]:- Copy("Negative premises");
         fallacies[2]:- Copy("Undistributed middle");
         fallacies[3]:- Copy("+ Conclusion, - major");
         fallacies[4]:- Copy("+ Conclusion, - minor");
         fallacies[5]:- Copy("- Conclusion, + premises");
         fallacies[6]:- Copy("Illicit major");
         fallacies[7]:- Copy("Illicit minor");
         fallacies[8]:- Copy("Existential fallacy")
      END CLA*S vennterms;

      termlist:- NEW vennterms;
      INSPECT termlist DO
      BEGIN

         CLASS statement;
         BEGIN
            TEXT type, tag, quantifier, subjectterm, copula, predicateterm, all;

            PROCEDURE makestatement;
            BEGIN
               all:- conc(tag,"  ",quantifier," ",subjectterm," ",copula," ",predicateterm,".")
            END;
         END CLA*S statement;

         CLASS syllogism;
         BEGIN
            REF(statement)
            majorpremise, minorpremise, conclusion,
            truemajorpremise, trueminorpremise, falseconclusion;

            TEXT ARRAY
            vennfillers[1:7],
            COMMENT---------------------------------------------------------------------
            Subscript values of "vennfillers" correspond to Venn diagram sectors.  See
            the diagram at PROCEDURE "outblankdiagram."
            ----------------------------------------------------------------------------;
            fallacies[1:8];

            BOOLEAN ARRAY
            fallacyflags[1:8];

            TEXT
            mood,
            figure,
            form,
            latinname,
            majorterm, middleterm, minorterm,
            countermajorterm, countermiddleterm, counterminorterm,
            truemajorpairs, trueminorpairs, falseconpairs;

            BOOLEAN
            reviewing,
            justtesting,
            valid,
            swapforstar,
            aristotelian;


            PROCEDURE initialize;
            COMMENT----------------------------------------------------------------
            The default initialization of all other variables is satisfactory.
            -----------------------------------------------------------------------;
            BEGIN
               INTEGER i;

               FOR i:= 1 STEP 1 UNTIL 8 DO fallacyflags[i]:= TRUE;
               FOR i:= 1 STEP 1 UNTIL 7 DO vennfillers[i]:- Copy("BLANKS")
            END PR*CEDURE initialize;

            PROCEDURE choose;
            BEGIN
               majorterm:- pickterm(1);
               middleterm:- pickterm(1);
               minorterm:- pickterm(1);
               IF (majorterm == middleterm OR middleterm == minorterm OR minorterm == majorterm) THEN choose
            END;

            BOOLEAN PROCEDURE goodformspec;
            BEGIN
               INTEGER i;
               TEXT t;

               goodformspec:= TRUE;
               upcase(form);
               IF form.Length >3 THEN
               BEGIN
                  FOR i:= 1 STEP 1 UNTIL 3 DO
                  BEGIN
                     t:- form.Sub(i,1);
                     IF (t \= "?" AND t \= "A" AND t \= "E" AND t \= "I" AND t \= "O") THEN
                     BEGIN
                        Outtext("Faulty type specification for proposition ");
                        Outint(i,1);
                        Outchar('.');
                        Outimage;
                        goodformspec:= FALSE
                     END
                  END;
                  t:- Copy(form.Sub(form.Length,1));
                  IF (t \= "?" AND t \= "1" AND t \= "2" AND t \= "3" AND t \= "4") THEN
                  BEGIN
                     outline("Figure value (last item) other than 1, 2, 3, 4 or ?.");
                     goodformspec:= FALSE
                  END
               END ELSE
               BEGIN
                  outline("Specification too short...something is missing.");
                  goodformspec:= FALSE
               END;
            END PR*CEDURE goodformspec;

            PROCEDURE makesyllogism;
            BEGIN
               INTEGER i, j;

               FOR i:= 1 STEP 1 UNTIL 3 DO
               BEGIN
                  IF form.Sub(i,1) = "?" THEN
                  BEGIN
                     j:= Randint(1,4,seed);
                     IF j = 1 THEN form.Sub(i,1):= "A"
                     ELSE IF j = 2 THEN form.Sub(i,1):= "E"
                     ELSE IF j = 3 THEN form.Sub(i,1):= "I"
                     ELSE form.Sub(i,1):= "O"
                  END
               END;
               IF form.Sub(form.Length,1) = "?" THEN
               BEGIN
                  j:= Randint(1,4,seed);
                  IF j = 1 THEN form.Sub(form.Length,1):= "1"
                  ELSE IF j = 2 THEN form.Sub(form.Length,1):= "2"
                  ELSE IF j = 3 THEN form.Sub(form.Length,1):= "3"
                  ELSE form.Sub(form.Length,1):= "4"
               END;
               figure:- form.Sub(form.Length,1);

               majorpremise:- NEW statement;
               INSPECT majorpremise DO
               BEGIN
                  type:- form.Sub(1,1);
                  tag:- Copy("Major Premise:");
                  IF figure = "1" OR figure = "3" THEN
                  BEGIN
                     subjectterm:- middleterm;
                     predicateterm:- majorterm;
                     IF type = "A" THEN
                     BEGIN
                        quantifier:- Copy("All");
                        copula:- Copy("are");
                        vennfillers[4]:- vennfillers[3]:- Copy("/");
                        IF aristotelian THEN vennfillers[6]:- vennfillers[7]:- Copy("?");
                        COMMENT----------------------------------------------------------------------
                        Partial set-up for filling in Venn diagram.  The remaining sectors will be
                        assigned filler characters in the INSPECT "minorpremise" block.  Some filler
                        characters set here may be changed later, e.g., in the event of clashes.
                        ----------------------------------------------------------------------------;
                        fallacyflags[1]:= fallacyflags[2]:= fallacyflags[3]:= FALSE;
                        COMMENT---------------------------------------------------------------------
                        Fallacy[1] "Negative Premises," fallacy[2] "Undistributed Middle," and
                        fallacy[3] "+ Conclusion, - Major" have been eliminated as possibilities at
                        this point.  Other possibilities will be eliminated subsequently in the
                        INSPECT "minorpremise" block.
                        ----------------------------------------------------------------------------;
                        truemajorpairs:- Copy(" BM BL ML BB")
                        COMMENT-------------------------------------------------------------------
                        This particular Major Premise tends to be true IF (the major class, i.e., the
                        predicate class, is very (b)ig AND the middle class, i.e., the subject class,
                        is (m)edium-sized) OR (the major class is very (b)ig and the middle class is
                        very (l)ittle) OR (the major class is (m)edium-sized and the middle class is
                        (l)ittle) OR (the major class is (b)ig and the middle class is (b)ig).  These
                        four character pairs represent these four possibilities.  A similar comment
                        could be made about the text stored in "trueminorpairs" and "falseconpairs."
                        In each case, by convention, the middle class (if any) is represented on
                        the right.  Otherwise, the order is minor class followed by major class.  Note
                        too that, since "A" and "O" are contradictories, the same pair values which
                        tend to make "A" true as a premise also work to render the "O" false as a
                        conclusion.  See comment about class "counterterms" for further information.
                        --------------------------------------------------------------------------;
                     END
                     ELSE IF type = "E" THEN
                     BEGIN
                        quantifier:- Copy("No");
                        copula:- Copy("are");
                        vennfillers[6]:- vennfillers[7]:- Copy("/");
                        IF aristotelian THEN vennfillers[3]:- vennfillers[4]:- Copy("?");
                        fallacyflags[2]:= fallacyflags[5]:= fallacyflags[6]:= FALSE;
                        truemajorpairs:- Copy(" LL")
                     END
                     ELSE IF type = "I" THEN
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are");
                        vennfillers[6]:- vennfillers[7]:- Copy("?");
                        fallacyflags[1]:= fallacyflags[3]:= fallacyflags[8]:= FALSE;
                        truemajorpairs:- Copy(" BB MB LB BM MM LM BL ML")
                     END
                     ELSE COMMENT type = "O";
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are not");
                        vennfillers[3]:- vennfillers[4]:- Copy("?");
                        fallacyflags[5]:= fallacyflags[6]:= fallacyflags[8]:= FALSE;
                        truemajorpairs:- Copy(" MB LB LM LL")
                     END
                  END
                  ELSE COMMENT figure = "2" OR figure = "4";
                  BEGIN
                     subjectterm:- majorterm;
                     predicateterm:- middleterm;
                     IF type = "A" THEN
                     BEGIN
                        quantifier:- Copy("All");
                        copula:- Copy("are");
                        vennfillers[2]:- vennfillers[5]:- Copy("/");
                        IF aristotelian THEN vennfillers[6]:- vennfillers[7]:- Copy("?");
                        fallacyflags[1]:= fallacyflags[3]:= fallacyflags[6]:= FALSE;
                        truemajorpairs:- Copy(" MB LB LM BB")
                     END
                     ELSE IF type = "E" THEN
                     BEGIN
                        quantifier:- Copy("No");
                        copula:- Copy("are");
                        vennfillers[6]:- vennfillers[7]:- Copy("/");
                        IF aristotelian THEN vennfillers[2]:- vennfillers[5]:- Copy("?");
                        fallacyflags[2]:= fallacyflags[5]:= fallacyflags[6]:= FALSE;
                        truemajorpairs:- Copy(" LL")
                     END
                     ELSE IF type = "I" THEN
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are");
                        vennfillers[6]:- vennfillers[7]:- Copy("?");
                        fallacyflags[1]:= fallacyflags[3]:= fallacyflags[8]:= FALSE;
                        truemajorpairs:- Copy(" BB BM BL MB MM ML LB LM")
                     END
                     ELSE COMMENT type = "O";
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are not");
                        vennfillers[2]:- vennfillers[5]:- Copy("?");
                        fallacyflags[2]:= fallacyflags[5]:= fallacyflags[8]:= FALSE;
                        truemajorpairs:- Copy(" BM BL ML LL")
                     END
                  END;
                  makestatement
               END INSP*CT majorpremise;

               minorpremise:- NEW statement;
               INSPECT minorpremise DO
               BEGIN
                  type:- form.Sub(2,1);
                  tag:- Copy("Minor Premise:");
                  IF figure = "3" OR figure = "4" THEN
                  BEGIN
                     subjectterm:- middleterm;
                     predicateterm:- minorterm;
                     IF type = "A" THEN
                     BEGIN
                        quantifier:- Copy("All");
                        copula:- Copy("are");
                        swapforstar:= FALSE;
                        IF vennfillers[3] = "?" OR vennfillers[6] = "?" THEN swapforstar:= TRUE;
                        IF vennfillers[6] = "/" THEN vennfillers[6]:- Copy("X")
                        ELSE vennfillers[6]:- Copy("\");
                        IF vennfillers[3] = "/" THEN vennfillers[3]:- Copy("X")
                        ELSE vennfillers[3]:- Copy("\");
                        IF swapforstar THEN FOR i:= 2,4,5,7 DO IF vennfillers[i] = "?" THEN vennfillers[i]:= Copy("*");
                        IF aristotelian THEN
                        BEGIN
                           IF vennfillers[4] = "/" OR vennfillers[7] = "/" THEN
                           BEGIN
                              IF vennfillers[4] \= "/" THEN vennfillers[4]:- Copy("*")
                              ELSE vennfillers[7]:- Copy("*")
                           END
                           ELSE BEGIN
                              IF vennfillers[4] = "BLANKS" THEN vennfillers[4]:- Copy("?");
                              IF vennfillers[7] = "BLANKS" THEN vennfillers[7]:- Copy("?")
                           END
                        END;
                        fallacyflags[1]:= fallacyflags[2]:= fallacyflags[4]:= FALSE;
                        trueminorpairs:- Copy(" BM BL ML BB")
                     END
                     ELSE IF type = "E" THEN
                     BEGIN
                        quantifier:- Copy("No");
                        copula:- Copy("are");
                        swapforstar:= FALSE;
                        IF vennfillers[4] = "?" OR vennfillers[7] = "?" THEN swapforstar:= TRUE;
                        IF vennfillers[4] = "/" THEN vennfillers[4]:- Copy("X")
                        ELSE vennfillers[4]:- Copy("\");
                        IF vennfillers[7] = "/" THEN vennfillers[7]:- Copy("X")
                        ELSE vennfillers[7]:- Copy("\");
                        IF swapforstar THEN FOR i:= 1,2,3,5,6 DO IF vennfillers[i] = "?" THEN vennfillers[i]:= Copy("*");
                        IF aristotelian THEN
                        BEGIN
                           IF vennfillers[3] = "/" OR vennfillers[6] = "/" THEN
                           BEGIN
                              IF vennfillers[3] \= "/" THEN vennfillers[3]:- Copy("*")
                              ELSE vennfillers[6]:- Copy("*")
                           END
                           ELSE BEGIN
                              IF vennfillers[3] = "BLANKS" THEN vennfillers[3]:- Copy("?");
                              IF vennfillers[6] = "BLANKS" THEN vennfillers[6]:- Copy("?")
                           END
                        END;
                        fallacyflags[2]:= fallacyflags[5]:= fallacyflags[7]:= FALSE;
                        trueminorpairs:- Copy(" LL")
                     END
                     ELSE IF type = "I" THEN
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are");
                        IF vennfillers[4] \= "/" AND vennfillers[7] \= "/" THEN vennfillers[4]:- vennfillers[7]:- Copy("?")
                        ELSE BEGIN
                           IF vennfillers[4] \= "/" THEN vennfillers[4]:- Copy("*");
                           IF vennfillers[7] \= "/" THEN vennfillers[7]:- Copy("*")
                        END;
                        fallacyflags[1]:= fallacyflags[4]:= fallacyflags[8]:= FALSE;
                        trueminorpairs:- Copy(" BB MB LB BM MM LM BL ML")
                     END
                     ELSE COMMENT type = "O";
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are not");
                        IF vennfillers[3] \= "/" AND vennfillers[6] \= "/" THEN vennfillers[3]:- vennfillers[6]:- Copy("?")
                        ELSE BEGIN
                           IF vennfillers[3] \= "/" THEN vennfillers[3]:- Copy("*");
                           IF vennfillers[6] \= "/" THEN vennfillers[6]:- Copy("*")
                        END;
                        fallacyflags[5]:= fallacyflags[7]:= fallacyflags[8]:= FALSE;
                        trueminorpairs:- Copy(" MB LB LM LL")
                     END
                  END
                  ELSE COMMENT figure = "1" OR figure = "2";
                  BEGIN
                     subjectterm:- minorterm;
                     predicateterm:- middleterm;
                     IF type = "A" THEN
                     BEGIN
                        quantifier:- Copy("All");
                        copula:- Copy("are");
                        swapforstar:= FALSE;
                        IF vennfillers[1] = "?" OR vennfillers[5] = "?" THEN swapforstar:= TRUE;
                        IF vennfillers[5] = "/" THEN vennfillers[5]:- Copy("X")
                        ELSE vennfillers[5]:- Copy("\");
                        vennfillers[1]:- Copy("\");
                        IF swapforstar THEN FOR i:= 2,3,4,6,7 DO IF vennfillers[i] = "?" THEN vennfillers[i]:= Copy("*");
                        IF aristotelian THEN
                        BEGIN
                           IF vennfillers[4] = "/" OR vennfillers[7] = "/" THEN
                           BEGIN
                              IF vennfillers[4] \= "/" THEN vennfillers[4]:- Copy("*")
                              ELSE vennfillers[7]:- Copy("*")
                           END
                           ELSE BEGIN
                              IF vennfillers[4] = "BLANKS" THEN vennfillers[4]:- Copy("?");
                              IF vennfillers[7] = "BLANKS" THEN vennfillers[7]:- Copy("?")
                           END
                        END;
                        fallacyflags[1]:= fallacyflags[4]:= fallacyflags[7]:= FALSE;
                        trueminorpairs:- Copy(" MB LB LM BB")
                     END
                     ELSE IF type = "E" THEN
                     BEGIN
                        quantifier:- Copy("No");
                        copula:- Copy("are");
                        swapforstar:= FALSE;
                        IF vennfillers[4] = "?" OR vennfillers[7] = "?" THEN swapforstar:= TRUE;
                        IF vennfillers[4] = "/" THEN vennfillers[4]:- Copy("X")
                        ELSE vennfillers[4]:- Copy("\");
                        IF vennfillers[7] = "/" THEN vennfillers[7]:- Copy("X")
                        ELSE vennfillers[7]:- Copy("\");
                        IF swapforstar THEN FOR i:= 1,2,3,5,6 DO IF vennfillers[i] = "?" THEN vennfillers[i]:= Copy("*");
                        IF aristotelian THEN
                        BEGIN
                           IF vennfillers[1] = "/" OR vennfillers[5] = "/" THEN
                           BEGIN
                              IF vennfillers[1] \= "/" THEN vennfillers[1]:- Copy("*")
                              ELSE vennfillers[5]:- Copy("*")
                           END
                           ELSE BEGIN
                              IF vennfillers[1] = "BLANKS" THEN vennfillers[1]:- Copy("?");
                              IF vennfillers[5] = "BLANKS" THEN vennfillers[5]:- Copy("?")
                           END;
                        END;
                        fallacyflags[2]:= fallacyflags[5]:= fallacyflags[7]:= FALSE;
                        trueminorpairs:- Copy(" LL")
                     END
                     ELSE IF type = "I" THEN
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are");
                        IF vennfillers[4] \= "/" AND vennfillers[7] \= "/" THEN vennfillers[4]:- vennfillers[7]:- Copy("?")
                        ELSE BEGIN
                           IF vennfillers[4] \= "/" THEN vennfillers[4]:- Copy("*");
                           IF vennfillers[7] \= "/" THEN vennfillers[7]:- Copy("*")
                        END;
                        fallacyflags[1]:= fallacyflags[4]:= fallacyflags[8]:= FALSE;
                        trueminorpairs:- Copy(" BB BM BL MB MM ML LB LM")
                     END
                     ELSE COMMENT type = "O";
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are not");
                        IF vennfillers[1] \= "/" AND vennfillers[5] \= "/" THEN vennfillers[1]:- vennfillers[5]:- Copy("?")
                        ELSE BEGIN
                           IF vennfillers[1] \= "/" THEN vennfillers[1]:- Copy("*");
                           IF vennfillers[5] \= "/" THEN vennfillers[5]:- Copy("*")
                        END;
                        fallacyflags[2]:= fallacyflags[5]:= fallacyflags[8]:= FALSE;
                        trueminorpairs:- Copy(" BM BL ML LL")
                     END
                  END;
                  makestatement;
               END INSP*CT minorpremise;

               conclusion:- NEW statement;
               INSPECT conclusion DO
               BEGIN
                  type:- form.Sub(3,1);
                  subjectterm:- minorterm;
                  predicateterm:- majorterm;
                  tag:- Copy("Conclusion:   ");
                  IF type = "A" THEN
                  BEGIN
                     quantifier:- Copy("All");
                     copula:- Copy("are");
                     fallacyflags[5]:= fallacyflags[6]:= fallacyflags[8]:= FALSE;
                     falseconpairs:- Copy(" BM BL ML LL")
                  END
                  ELSE
                  IF type = "E" THEN
                  BEGIN
                     quantifier:- Copy("No");
                     copula:- Copy("are");
                     fallacyflags[3]:= fallacyflags[4]:= fallacyflags[8]:= FALSE;
                     falseconpairs:- Copy(" BB BM BL MB MM ML LB LM")
                  END
                  ELSE
                  IF type = "I" THEN
                  BEGIN
                     quantifier:- Copy("Some");
                     copula:- Copy("are");
                     fallacyflags[5]:= fallacyflags[6]:= fallacyflags[7]:= FALSE;
                     IF aristotelian THEN fallacyflags[8]:= FALSE;
                     falseconpairs:- Copy(" LL")
                  END
                  ELSE COMMENT type = "O";
                  BEGIN
                     quantifier:- Copy("Some");
                     copula:- Copy("are not");
                     fallacyflags[3]:= fallacyflags[4]:= fallacyflags[7]:= FALSE;
                     IF aristotelian THEN fallacyflags[8]:= FALSE;
                     falseconpairs:- Copy(" MB LB LM BB")
                  END;
                  makestatement;
               END of INSP*CT conclusion;

               mood:- conc(majorpremise.type,minorpremise.type,conclusion.type);
               form:- conc(mood,"-",figure);
            END PR*CEDURE makesyllogism;

            PROCEDURE makecounterexample;
            COMMENT-------------------------------------------------------------------
            This procedure is, in effect, a subset of "makesyllogism," so it could have
            been extracted from a call on that procedure if enough (confusing) conditional
            branching had been introduced.  It has been coded separately, however, for
            better readability.
            --------------------------------------------------------------------------;
            BEGIN
               truemajorpremise:- NEW statement;
               INSPECT truemajorpremise DO
               BEGIN
                  type:- form.Sub(1,1);
                  tag:- Copy("TRUE Major Premise:");
                  IF figure = "1" OR figure = "3" THEN
                  BEGIN
                     subjectterm:- countermiddleterm;
                     predicateterm:- countermajorterm;
                     IF type = "A" THEN
                     BEGIN
                        quantifier:- Copy("All");
                        copula:- Copy("are")
                     END
                     ELSE IF type = "E" THEN
                     BEGIN
                        quantifier:- Copy("No");
                        copula:- Copy("are")
                     END
                     ELSE IF type = "I" THEN
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are")
                     END
                     ELSE COMMENT type = "O";
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are not")
                     END
                  END
                  ELSE COMMENT figure = "2" OR figure = "4";
                  BEGIN
                     subjectterm:- countermajorterm;
                     predicateterm:- countermiddleterm;
                     IF type = "A" THEN
                     BEGIN
                        quantifier:- Copy("All");
                        copula:- Copy("are")
                     END
                     ELSE IF type = "E" THEN
                     BEGIN
                        quantifier:- Copy("No");
                        copula:- Copy("are")
                     END
                     ELSE IF type = "I" THEN
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are")
                     END
                     ELSE COMMENT type = "O";
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are not")
                     END
                  END;
                  makestatement
               END INSP*CT truemajorpremise;

               trueminorpremise:- NEW statement;
               INSPECT trueminorpremise DO
               BEGIN
                  type:- form.Sub(2,1);
                  tag:- Copy("TRUE Minor Premise:");
                  IF figure = "3" OR figure = "4" THEN
                  BEGIN
                     subjectterm:- countermiddleterm;
                     predicateterm:- counterminorterm;
                     IF type = "A" THEN
                     BEGIN
                        quantifier:- Copy("All");
                        copula:- Copy("are")
                     END
                     ELSE IF type = "E" THEN
                     BEGIN
                        quantifier:- Copy("No");
                        copula:- Copy("are")
                     END
                     ELSE IF type = "I" THEN
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are")
                     END
                     ELSE COMMENT TYPE = "O";
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are not")
                     END
                  END
                  ELSE COMMENT figure = "1" OR figure = "2";
                  BEGIN
                     subjectterm:- counterminorterm;
                     predicateterm:- countermiddleterm;
                     IF type = "A" THEN
                     BEGIN
                        quantifier:- Copy("All");
                        copula:- Copy("are")
                     END
                     ELSE IF type = "E" THEN
                     BEGIN
                        quantifier:- Copy("No");
                        copula:- Copy("are")
                     END
                     ELSE IF type = "I" THEN
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are")
                     END
                     ELSE COMMENT type = "O";
                     BEGIN
                        quantifier:- Copy("Some");
                        copula:- Copy("are not")
                     END
                  END;
                  makestatement
               END INSP*CT trueminorpremise;

               falseconclusion:- NEW statement;
               INSPECT falseconclusion DO
               BEGIN
                  type:- form.Sub(3,1);
                  subjectterm:- counterminorterm;
                  predicateterm:- countermajorterm;
                  tag:- Copy("FALSE Conclusion:  ");
                  IF type = "A" THEN
                  BEGIN
                     quantifier:- Copy("All");
                     copula:- Copy("are")
                  END
                  ELSE
                  IF type = "E" THEN
                  BEGIN
                     quantifier:- Copy("No");
                     copula:- Copy("are")
                  END
                  ELSE
                  IF type = "I" THEN
                  BEGIN
                     quantifier:- Copy("Some");
                     copula:- Copy("are")
                  END
                  ELSE COMMENT type = "O";
                  BEGIN
                     quantifier:- Copy("Some");
                     copula:- Copy("are not")
                  END;
                  makestatement
               END of INSP*CT falseconclusion;
            END PR*CEDURE makecounterexample;

            PROCEDURE validate;
            BEGIN
               IF figure = "1" THEN
               BEGIN
                  IF mood = "AAA" THEN latinname:- Copy("B(a)rb(a)r(a)")
                  ELSE IF mood = "EAE" THEN latinname:- Copy("C(e)l(a)r(e)nt")
                  ELSE IF mood = "AII" THEN latinname:- Copy("D(a)r(i)(i)")
                  ELSE IF mood = "EIO" THEN latinname:- Copy("F(e)r(i)(o)que")
                  ELSE IF aristotelian THEN
                  BEGIN
                     IF mood = "AAI" THEN latinname:- Copy("none given")
                     ELSE IF mood = "EAO" THEN latinname:- Copy("none given")
                  END
               END
               ELSE IF figure = "2" THEN
               BEGIN
                  IF mood = "EAE" THEN latinname:- Copy("C(e)s(a)r(e)")
                  ELSE IF mood = "AEE" THEN latinname:- Copy("C(a)m(e)str(e)s")
                  ELSE IF mood = "EIO" THEN latinname:- Copy("F(e)st(i)n(o)")
                  ELSE IF mood = "AOO" THEN latinname:- Copy("B(a)r(o)c(o)")
                  ELSE IF aristotelian THEN
                  BEGIN
                     IF mood = "AEO" THEN latinname:- Copy("none given")
                     ELSE IF mood = "EAO" THEN latinname:- Copy("none given")
                  END
               END
               ELSE IF figure = "3" THEN
               BEGIN
                  IF mood = "IAI" THEN latinname:- Copy("D(i)s(a)m(i)s")
                  ELSE IF mood = "AII" THEN latinname:- Copy("D(a)t(i)s(i)")
                  ELSE IF mood = "OAO" THEN latinname:- Copy("B(o)c(a)rd(o)")
                  ELSE IF mood = "EIO" THEN latinname:- Copy("F(e)r(i)s(o)n")
                  ELSE IF aristotelian THEN
                  BEGIN
                     IF mood = "AAI" THEN latinname:- Copy("D(a)r(a)pt(i)")
                     ELSE IF mood = "EAO" THEN latinname:- Copy("F(e)l(a)pt(o)n")
                  END;
               END
               ELSE
               IF figure = "4" THEN
               BEGIN
                  IF mood = "AEE" THEN latinname:- Copy("C(a)m(e)n(e)s")
                  ELSE IF mood = "IAI" THEN latinname:- Copy("D(i)m(a)r(i)s")
                  ELSE IF mood = "EIO" THEN latinname:- Copy("Fr(e)s(i)s(o)n")
                  ELSE IF aristotelian THEN
                  BEGIN
                     IF mood = "AEO" THEN
                     BEGIN
                        latinname:- Copy("none given");
                        Outimage;
                        outline("NOTE:  The syllogism you are about to see is the SOLE exception to the VENN");
                        outline("program's parsimonious implementation of the Aristotelian (or existential)");
                        outline("viewpoint.  If you work through the questions, you will discover why.")
                     END
                     ELSE IF mood = "EAO" THEN latinname:- Copy("F(e)s(a)p(o)")
                     ELSE IF mood = "AAI" THEN latinname:- Copy("Br(a)m(a)nt(i)p")
                  END
               END;
               IF latinname =/= NOTEXT THEN valid:= TRUE;
               COMMENT----------------------------------------------------------------------
               Validity could have been determined by stepping across ARRAY "fallacyflags,"
               but then "doublecheck" (below) would be unable to detect internal errors.
               "Validate," among other things, provides an independent check of validity.
               -----------------------------------------------------------------------------;
            END PR*CEDURE validate;


            PROCEDURE doublecheck;
            COMMENT------------------------------------------------------------------
            Used for debugging.  Checks for internal errors and reports any it finds.
            --------------------------------------------------------------------------;
            BEGIN
               INTEGER i, max;
               IF aristotelian THEN max:= 7 ELSE max:= 8;
               IF valid THEN FOR i:= 1 STEP 1 UNTIL max DO
               BEGIN
                  IF fallacyflags[i] THEN
                  BEGIN
                     Outtext("Program error: Fallacy flag(");
                     Outint(i,1);
                     Outtext(") set TRUE for valid ");
                     Outtext(form);
                     Outimage
                  END
               END;
               IF NOT valid THEN
               BEGIN
                  FOR i:= 1 STEP 1 UNTIL max DO
                  IF fallacyflags[i] THEN GOTO out;
                  Outtext("Program error: No fallacy flags set TRUE for invalid ");
                  Outtext(form);
                  Outimage;
                  out:
               END
            END PR*CEDURE doublecheck;

            PROCEDURE outline(t);
            NAME t; TEXT t;

            BEGIN
               Outtext(t);
               Outimage
            END;

            PROCEDURE outsyllogism;
            BEGIN
               Outimage;
               outline(majorpremise.all);
               outline(minorpremise.all);
               outline("-----------------------------------------------------------------");
               outline(conclusion.all);
               Outimage
            END PR*CEDURE outsyllogism;

            PROCEDURE outcounterexample;
            COMMENT------------------------------------------------------------------
            Like "outsyllogism," but coded separately for better readability.
            -------------------------------------------------------------------------;
            BEGIN
               Outimage;
               outline(truemajorpremise.all);
               outline(trueminorpremise.all);
               outline("-----------------------------------------------------------------");
               outline(falseconclusion.all);
               Outimage
            END PR*CEDURE outcounterexample;

            initialize;
            choose
         END CLA*S syllogism;

         syllogism CLASS venndiagram;
         BEGIN
            PROCEDURE outdiagram;
            BEGIN
               INTEGER i, j;

               PROCEDURE outdata;
               BEGIN
                  FOR j:= j STEP 1 UNTIL 8 DO
                  IF fallacyflags[j] THEN
                  BEGIN
                     Outtext("    FALLACY(");
                     Outint(j,1);
                     Outtext("):   ");
                     Outtext(termlist.fallacies[j]);
                     j:= j+1;
                     GOTO exit;
                  END;
                  exit:
               END;

               FOR i:= 1 STEP 1 UNTIL 7 DO IF vennfillers[i] = "BLANKS" THEN vennfillers[i]:- Copy(" ");

               !  LINE ONE;
               j:= 1;
               Outtext("  ------------------");
               Outtext("       MAJOR CLASS:  " );
               Outtext(majorterm);
               Outimage;

               !  LINE TWO;
               Outtext("M !");
               FOR i:= 1 STEP 1 UNTIL 6 DO Outtext(vennfillers[1]);
               Outchar('!');
               Outtext(vennfillers[5]);
               Outtext(vennfillers[5]);
               Outchar('!');
               FOR i:= 1 STEP 1 UNTIL 6 DO Outtext(vennfillers[2]);
               Outchar('!');
               Outtext(" M     MINOR CLASS:  ");
               Outtext(minorterm);
               Outimage;

               !  LINE THREE;
               Outtext("I !");
               FOR i:= 1 STEP 1 UNTIL 6 DO Outtext(vennfillers[1]);
               Outchar('!');
               Outtext(vennfillers[5]);
               Outtext(vennfillers[5]);
               Outchar('!');
               FOR i:= 1 STEP 1 UNTIL 6 DO Outtext(vennfillers[2]);
               Outchar('!');
               Outtext(" A     MIDDLE CLASS: ");
               Outtext(middleterm);
               Outimage;

               !  LINE FOUR;
               Outtext("N !");
               FOR i:= 1 STEP 1 UNTIL 3 DO Outtext(vennfillers[1]);
               Outtext("----------");
               FOR i:= 1 STEP 1 UNTIL 3 DO Outtext(vennfillers[2]);
               Outchar('!');
               Outtext(" J     MOOD-FIGURE:  ");
               Outtext(form);
               Outimage;

               !  LINE FIVE;
               Outtext("O !");
               FOR i:= 1 STEP 1 UNTIL 3 DO Outtext(vennfillers[1]);
               Outchar('!');
               Outtext(vennfillers[4]);
               Outtext(vennfillers[4]);
               Outchar('!');
               Outtext(vennfillers[7]);
               Outtext(vennfillers[7]);
               Outchar('!');
               Outtext(vennfillers[6]);
               Outtext(vennfillers[6]);
               Outchar('!');
               FOR i:= 1 STEP 1 UNTIL 3 DO Outtext(vennfillers[2]);
               Outchar('!');
               Outtext(" O     VIEWPOINT:    ");
               IF aristotelian THEN Outtext("Aristotelian (existential)")
               ELSE Outtext("Boolean (hypothetical)");
               Outimage;

               !  LINE SIX;
               Outtext("R !");
               FOR i:= 1 STEP 1 UNTIL 3 DO Outtext(vennfillers[1]);
               Outchar('!');
               Outtext(vennfillers[4]);
               Outtext(vennfillers[4]);
               Outchar('!');
               Outtext(vennfillers[7]);
               Outtext(vennfillers[7]);
               Outchar('!');
               Outtext(vennfillers[6]);
               Outtext(vennfillers[6]);
               Outchar('!');
               FOR i:= 1 STEP 1 UNTIL 3 DO Outtext(vennfillers[2]);
               Outtext("! R ");
               IF NOT reviewing THEN
               BEGIN
                  IF valid THEN Outtext("    VALID:        Yes")
                  ELSE Outtext("    VALID:        No");
               END;
               Outimage;

               !  LINE SEVEN;
               Outtext("  ------------------   ");
               IF NOT reviewing THEN
               BEGIN
                  IF valid THEN
                  BEGIN
                     Outtext("    LATIN NAME:   ");
                     Outtext(latinname)
                  END ELSE IF j<8 THEN outdata;
               END;
               Outimage;

               !  LINE eight;
               Outtext("      !");
               FOR i:= 1 STEP 1 UNTIL 8 DO Outtext(vennfillers[3]);
               Outtext("!       ");
               IF NOT reviewing AND NOT valid AND j<8 THEN outdata;
               Outimage;

               !  LINE NINE;
               Outtext("      !");
               FOR i:= 1 STEP 1 UNTIL 8 DO Outtext(vennfillers[3]);
               Outtext("!       ");
               IF NOT reviewing AND NOT valid AND j<8 THEN outdata;
               Outimage;

               !  LINE TEN;
               Outtext("      ----------       ");
               IF NOT reviewing AND NOT valid AND j<8 THEN outdata;
               Outimage;
               outline("        MIDDLE             ");

               FOR i:= 1 STEP 1 UNTIL 7 DO IF vennfillers[i] = " " THEN vennfillers[i]:- Copy("BLANKS");
            END PR*CEDURE outdiagram;

            BOOLEAN PROCEDURE outblankdiagram;
            BEGIN
               outline("  ------------------");
               outline("M !1     !5 !2     ! M                    CONVENTIONS");
               outline("I !      !  !      ! A");
               outline("N !   ----------   ! J       '/' = this sector empty by Major Premise");
               outline("O !   !4 !7 !6 !   ! O       '\' = this sector empty by Minor Premise");
               outline("R !   !  !  !  !   ! R       'X' = this sector empty by BOTH the above");
               outline("  ------------------         '?' = this OR adjacent sector MUST have a member");
               outline("      !3       !             '*' = this sector MUST have a member");
               outline("      !        !");
               outline("      ----------             Otherwise, value of sector is 'BLANKS'");
               outline("        MIDDLE               (simply due to lack of information)");
               Outimage;
               outsyllogism
            END PR*CEDURE outblankdiagram;

            BOOLEAN PROCEDURE validityhelp;
            BEGIN
               outline("The syllogism is valid only if you can 'read' the conclusion from the diagram");
               Outtext("just as it is.  That is, ");
               IF conclusion.type = "A" THEN Outtext("both sectors 1 and 4 would have to be shaded out.")
               ELSE IF conclusion.type = "E" THEN Outtext("both sectors 5 and 7 would have to be shaded out.")
               ELSE IF conclusion.type = "I" THEN Outtext("either sector 5 or 7 would have to contain a '*'.")
               ELSE Outtext("either sector 1 or 4 would have to contain a '*'.");
               Outimage
            END PR*CEDURE validityhelp;

         END CLA*S venndiagram;

         INSPECT NEW safmin DO
         BEGIN
            REF(venndiagram) ordinarysyllogism;
            INTEGER i, contacttime;
            BOOLEAN toggle, quit;
            COMMENT--------------------------------------------------------------------
            Note that "toggle" is used for several DIFFERENT purposes.
            ---------------------------------------------------------------------------;
            TEXT response, target;

            BOOLEAN PROCEDURE viewpointhelp;
            BEGIN
               Outimage;
               outline("Under the Aristotelian (or existential) interpretation, the SUBJECT");
               outline("class of each 'A' and 'E' (universal) premise is assumed to have at");
               outline("least one member.  (Some logicians assume that each class mentioned--three");
               outline("in all--must have members, but the stingy VENN program refuses to multiply");
               outline("entities beyond necessity.  Under the Boolean (or hypothetical) viewpoint,");
               outline("even this stingy assumption about the subject class of 'A' and 'E' premises");
               outline("is void.  Of course, it makes no difference which interpretation you select");
               outline("in the case of 'I' and 'O' (particular) premises since 'some' forces us");
               outline("to assume that their subject classes have at least one member.");
               COMMENT----------------------------------------------------------------------
               Parsimony was an important consideration, but this decision was also motivated
               by a desire to keep VENN.SIM and QUICK.SIM (an interactive, generative program
               for teaching immediate inference) consistent.  Eventually parts of QUICK.SIM
               will be used in VENN, e.g., to produce syllogisms with obverted premises.
               Thus it is imperative that "adopting the existential viewpoint" mean ONE
               thing, whether we speak of immeidate inferences or syllogistic inferences.
               In fact, however, most authors MODIFY their stand on the existential viewpoint
               as they pass from immediate inference to syllogistic inference.  Such slippage
               would wreak havoc in a computer algorithm, however!  As a side-effect of this
               decision, we have the problem of deciding what to do with AEO-4.  I prefer to
               consider it invalid, contending that its invalidity shows that the "rules"
               are incomplete.  Nevertheless, AEO-4 IS considered valid by the program at this
               time.  Later verions of VENN will probably treat it as invalid, however, and
               the rules will be modified so that AEO-4 will commit the existential fallacy.
               User comments are invited.
               -----------------------------------------------------------------------------;
               Outimage;
            END;

            BOOLEAN PROCEDURE figurehelp;
            BEGIN
               Outimage;
               outline("The figure of a syllogism is determined by the spatial arrangement of");
               outline("the two occurrences of the MIDDLE term ('X') in the premises:");
               Outimage;
               outline("              -1-                       -2-");
               outline("            X   Major               Major    X");
               outline("          Minor   X                 Minor    X");
               outline("          -----------               ----------");
               Outimage;
               outline("              -3-                       -4-");
               outline("          X    Major                Major   X");
               outline("          X    Minor                  X   Minor");
               outline("          ----------                -----------");
               Outimage
            END;

            IF trmop(8r2012, Sysout, 80) \= 80 THEN
            BEGIN
               COMMENT------------------------------------------------------------
               Simulates "SET TTY WIDTH 80" if necessary and, if it was, reopens
               Sysout with this new parameter.
               ------------------------------------------------------------------;
               Sysout.Close;
               Sysout.Open(Blanks(80));
               outline("TTY WIDTH reset to 80 by program.")
            END;

            Outimage;
            outline("VENN Version 1 (c) copyright 1977 by its author, Dr. Walter Maner, Department");
            outline("of Philosophy, Old Dominion University, Norfolk, VA 23508. TEL: (804) 489-6517");
            Outimage;
            outline("Use of VENN implies an agreement to report all modifications and any program");
            outline("errors directly to the author.");
            Outimage;
            outline("NOTE:  Typing a capital 'H' gets help, if any is available.");
            outline("       Default answers (if any) appear between slash marks,");
            outline("       e.g.,'/yes/'.  If just the RETURN key is pushed, the");
            outline("       program will use the default value indicated.  If not");
            outline("       it will use the value you supply after the final ':'.");
            Outimage;
            margin:= 1;
            helpchar:= 'H';

            request("Need to review the description of this program ('yes' or 'no')? ",
            "yes",boolinput(toggle),
            "Huh?",nohelp);
            IF toggle THEN
            BEGIN
               Outimage;
               outline("This program will generate new  (standard)  syllogisms for you for  as");
               outline("long  as  you want to work at analyzing them.  There are 256  formally");
               outline("distinct  syllogisms and (in this  program) so many novel combinations");
               outline("of terms  for  each of these 256 that the chance that you will get two");
               outline("syllogisms alike in two successive generations approaches zero.  Since");
               outline("most  of  these  256  basic  forms  are  invalid and since the program");
               outline("chooses at random from these  forms (or a subset thereof), you must be");
               outline("skeptical of the arguments produced.  As a rule, the chance of getting");
               outline("a valid syllogism under the Aristotelian interpretation is about 1  in");
               outline("11 while, under the tighter Boolean interpretation, it shrinks to near");
               outline("1 in 17.  (You'll get to choose which interpretation the program is to");
               outline("use.)  When you have correctly answered all the questions posed by the");
               outline("program regarding a syllogism, the program will proceed  to  draw  the");
               outline("Venn diagram for the syllogism and print out a table of relevant data.");
               outline("At this point you can either work through the same syllogism again  or");
               outline("have the program generate a new one (or quit).  Instead of answering a");
               outline("question, you can type 'H' for help.  A program clock will keep  track");
               outline("of  how long it takes you to work through a given series of questions.");
               outline("You'll probably enjoy trying to best your own record.  Of course,  you");
               outline("can skip the questions if you just want to use VENN to check validity.");
               outline("You can even ask VENN to make up counterexamples to his own syllogism!");
               Outimage
            END;

            WHILE NOT quit DO
            BEGIN
               ordinarysyllogism:- NEW venndiagram;
               INSPECT ordinarysyllogism DO
               BEGIN
                  request("Specify syllogism by MOOD and FIGURE (use '?' as a wild card): ","???-?",
                  textinput(form,goodformspec),
                  "Response should resemble 'AEI-2','EOE-4', '??E-?', '???-4', 'EII-?', etc.",
                  help("Each statement's type (A,E,I, O or ?), followed by figure (1,2,3, 4 or ?)."));

                  request("Suggest a label (for the MAJOR class): ",
                  majorterm,textinput(majorterm,majorterm.Length<25),
                  "? Too long...try again",
                  help("Any general category term not beginning with 'H' will work."));
                  IF majorterm.Sub(1,1) \= "h" THEN upcase(majorterm);

                  request("And another label (for the MINOR class): ",
                  minorterm,textinput(minorterm,minorterm.Length<25),
                  "? Too long...try again",
                  help("Any general category term not beginning with 'H' will work."));
                  IF minorterm.Sub(1,1) \= "h" THEN upcase(minorterm);

                  request("And one more (for the MIDDLE class): ",
                  middleterm,textinput(middleterm,middleterm.Length<25),
                  "? Too long...try again",
                  help("Any general category term not beginning with 'H' will work."));
                  IF middleterm.Sub(1,1) \= "h" THEN upcase(middleterm);

                  request("Aristotelian interpretation ('yes' or 'no')? ",
                  "yes",boolinput(aristotelian),
                  "Huh?  Type 'H' for help.",
                  viewpointhelp);

                  makesyllogism;
                  validate;
                  doublecheck;

                  samesyllogism:
                  request("Want to skip the question routine ('yes' or 'no')? ",
                  "no",boolinput(justtesting),
                  "Huh?  Type 'H' for help.",
                  help("If you say 'yes', the program will generate the Venn diagram immediately."));

                  IF NOT justtesting THEN
                  BEGIN
                     contacttime:= Entier(clocktime);
                     Outimage;
                     outline("Here we go...the clock is running.  Good luck!");
                     outsyllogism;

                     request("MOOD of this syllogism:",nodefault,
                     textinput(response,upcase(response)= mood),
                     "No.  Try again or type 'H' for help.",
                     help("A 3-letter word giving the type of each proposition in turn e.g., 'AEI'"));
                     outline("Right!");
                     Outimage;
                     outsyllogism;

                     request("Figure:",nodefault,
                     textinput(response, response = figure),
                     "No.  Try again or type 'H' for help.",
                     figurehelp);
                     outline("Right!");
                     Outimage;
                     outsyllogism;

                     request("Venn diagram, sector 1, will contain (/, \, X, ?, * or BLANKS): ",
                     "BLANKS",textinput(response,response = vennfillers[1]),
                     "Wrong.  Type 'H' for help.",
                     outblankdiagram);
                     outline("Right!");
                     Outimage;
                     outsyllogism;

                     request("Sector 2 will contain (/, \, X, ?, * or BLANKS): ",
                     "BLANKS",textinput(response,response = vennfillers[2]),
                     "Wrong.  Type 'H' for help.",
                     outblankdiagram);
                     outline("Right!");
                     Outimage;
                     outsyllogism;

                     request("Sector 3 will contain (/, \, X, ?, * or BLANKS): ",
                     "BLANKS",textinput(response,response = vennfillers[3]),
                     "Wrong.  Type 'H' for help.",
                     outblankdiagram);
                     outline("Right!");
                     Outimage;
                     outsyllogism;

                     request("Sector 4 will contain (/, \, X, ?, * or BLANKS): ",
                     "BLANKS",textinput(response,response = vennfillers[4]),
                     "Wrong.  Type 'H' for help.",
                     outblankdiagram);
                     outline("Right!");
                     Outimage;
                     outsyllogism;

                     request("Sector 5 will contain (/, \, X, ?, * or BLANKS): ",
                     "BLANKS",textinput(response,response = vennfillers[5]),
                     "Wrong.  Type 'H' for help.",
                     outblankdiagram);
                     outline("Right!");
                     Outimage;
                     outsyllogism;

                     request("Sector 6 will contain (/, \, X, ?, * or BLANKS): ",
                     "BLANKS",textinput(response,response = vennfillers[6]),
                     "Wrong.  Type 'H' for help.",
                     outblankdiagram);
                     outline("Right!");
                     Outimage;
                     outsyllogism;

                     request("Sector 7 will contain (/, \, X, ?, * or BLANKS): ",
                     "BLANKS",textinput(response,response = vennfillers[7]),
                     "Wrong.  Type 'H' for help.",
                     outblankdiagram);
                     outline("Right!");
                     Outimage;

                     outline("Now study the syllogism and the complete Venn diagram carefully");
                     outline("in order to decide whether the syllogism is valid or invalid:");
                     outsyllogism;
                     reviewing:= TRUE;
                     outdiagram;

                     IF valid THEN target:- Copy("YES") ELSE target:- Copy("NO");
                     Outimage;
                     request("Is it valid ('yes' or 'no')? ","no",
                     textinput(response, upcase(response)= target),
                     "Wrong.  Shame on you!  Try again or type 'H' for help.",
                     validityhelp);
                     outline("Right!");
                     Outimage;

                     BEGIN
                        INTEGER i;
                        Outimage;
                        outline("From these same two premises, i.e.,");
                        outline(majorpremise.all);
                        outline(minorpremise.all);
                        Outimage;
                        outline("we can validly deduce the following conclusions:");
                        IF (vennfillers[1] = "\") AND (vennfillers[4] = "\" OR vennfillers[4] = "/" OR vennfillers[4] =
                        "X") THEN
                        BEGIN
                           i:= i + 1;
                           outline(conc("Conclusion:     All ",minorterm," are ",majorterm))
                        END;
                        IF (vennfillers[2] = "/") AND (vennfillers[6] = "/" OR vennfillers[6] = "\" OR vennfillers[6] =
                        "X") THEN
                        BEGIN
                           i:= i + 1;
                           outline(conc("Conclusion:     All ",majorterm," are ",minorterm))
                        END;
                        IF (vennfillers[5] = "\" OR vennfillers[5] = "/" OR vennfillers[5] = "X")
                        AND (vennfillers[7] = "\" OR vennfillers[7] = "/" OR vennfillers[7] = "X") THEN
                        BEGIN
                           i:= i + 2;
                           outline(conc("Conclusion:     No ",minorterm," are ",majorterm,"."));
                           outline(conc("Conclusion:     No ",majorterm," are ",minorterm,"."))
                        END;
                        IF (vennfillers[5] = "*" OR vennfillers[7] = "*") THEN
                        BEGIN
                           i:= i + 2;
                           outline(conc("Conclusion:     Some ",minorterm," are ",majorterm,"."));
                           outline(conc("Conclusion:     Some ",majorterm," are ",minorterm,"."))
                        END;
                        IF (vennfillers[1] = "*" OR vennfillers[4] = "*") THEN
                        BEGIN
                           i:= i + 1;
                           outline(conc("Conclusion:     Some ",minorterm," are not ",majorterm,"."))
                        END;
                        IF (vennfillers[2] = "*" OR vennfillers[6] = "*") THEN
                        BEGIN
                           i:= i + 1;
                           outline(conc("Conclusion:     Some ",majorterm," are not ",minorterm,"."))
                        END;
                        IF i = 0 THEN
                        BEGIN
                           outline("     NONE!");
                           Outimage
                        END
                        ELSE
                        BEGIN
                           Outimage;
                           outline("No other valid deductions are possible.")
                        END;
                        outline("You will have about 45 seconds to verify this for yourself by");
                        outline("referring again to the Venn diagram:");
                        reviewing:= TRUE;
                        Outimage;
                        outdiagram;
                        sleep(45);
                        reviewing:= FALSE
                     END;
                     outsyllogism;


                     IF NOT valid THEN
                     BEGIN
                        outline("Now let's determine which fallacies were committed");
                        outline("by evaluating the following TRUE/FALSE questions...");
                        Outimage;

                        IF fallacyflags[1] THEN target:- Copy("T")
                        ELSE target:- Copy("F");
                        request("(1) Both premises negative ('T' or 'F'): ","F",
                        textinput(response, upcase(response) = target),
                        "No.",
                        nohelp);
                        outline("Right!");
                        Outimage;
                        outsyllogism;

                        IF fallacyflags[2] THEN target:- Copy("T")
                        ELSE target:- Copy("F");
                        request("(2) Neither premise distributes middle term ('T' or 'F'): ","F",
                        textinput(response, upcase(response) = target),
                        "No.  Try again or type 'H' for help.",
                        help("'..distributes..' = '..refers to ALL members of the class named by..'"));
                        outline("Right!");
                        Outimage;
                        outsyllogism;

                        IF fallacyflags[3] THEN target:- Copy("T")
                        ELSE target:- Copy("F");
                        request("(3) Positive conclusion from negative Major Premise ('T' or 'F'): ","F",
                        textinput(response, upcase(response) = target),
                        "No.  Try again or type 'H' for help.",
                        help("'A' and 'I' are positive (affirmative) while 'E' and 'O' are negative."));
                        outline("Right!");
                        Outimage;
                        outsyllogism;

                        IF fallacyflags[4] THEN target:- Copy("T")
                        ELSE target:- Copy("F");
                        request("(4) Positive conclusion from negative Minor Premise ('T' or 'F'): ","F",
                        textinput(response, upcase(response) = target),
                        "No.  Try again or type 'H' for help.",
                        help("'A' and 'I' are positive (affirmative) while 'E' and 'O' are negative."));
                        outline("Right!");
                        Outimage;
                        outsyllogism;

                        IF fallacyflags[5] THEN target:- Copy("T")
                        ELSE target:- Copy("F");
                        request("(5) Negative conclusion from all positive premises ('T' or 'F'): ","F",
                        textinput(response, upcase(response) = target),
                        "No.",
                        nohelp);
                        outline("Right!");
                        Outimage;
                        outsyllogism;

                        IF fallacyflags[6] THEN target:- Copy("T")
                        ELSE target:- Copy("F");
                        request("(6) Conclusion distributes MAJOR term but Major Premise doesn't ('T' or 'F'): ","F",
                        textinput(response, upcase(response) = target),
                        "No.  Try again or type 'H' for help.",
                        help("'..distributes..' = '..refers to ALL members of the class named by..'"));
                        outline("Right!");
                        Outimage;
                        outsyllogism;

                        IF fallacyflags[7] THEN target:- Copy("T")
                        ELSE target:- Copy("F");
                        request("(7) Conclusion distributes MINOR term but Minor Premise doesn't ('T' or 'F'): ","F",
                        textinput(response, upcase(response) = target),
                        "No.  Try again or type 'H' for help.",
                        help("'..distributes..' = '..refers to ALL members of the class named by..'"));
                        outline("Right!");
                        Outimage;

                        IF NOT aristotelian THEN
                        BEGIN
                           outsyllogism;
                           IF fallacyflags[8] THEN target:- Copy("T")
                           ELSE target:- Copy("F");
                           request("(8) Both premises universal, yet conclusion is particular ('T' or 'F'): ","F",
                           textinput(response, upcase(response) = target),
                           "No.",
                           nohelp);
                           outline("Right!");
                           Outimage;
                        END;
                     END;

                     Outtext("You worked through these questions in ");
                     Outint(Entier(clocktime)-contacttime,6);
                     Outtext(" seconds.");
                     Outimage;
                     outline("Now it's time to summarize our findings:")
                  END NOT justtesting;

                  outsyllogism;
                  outdiagram;
                  Outimage;

                  request("Want VENN to try to make up a counterexample ('yes' or 'no')? ",
                  "yes", boolinput(toggle),
                  "Huh?  Type 'H' for help.",
                  help("A syllogism of the same form with true premises and a false conclusion."));

                  IF toggle THEN
                  BEGIN
                     CLASS counterterms;
                     COMMENT---------------------------------------------------------------------
                     This CLASS implements a heuristic search for a set of three terms which, when
                     substituted for the original three terms of a syllogism, will make both its
                     premises true and its conclusion false.  The most promising size combinations
                     of subject and predicate classes for each statement are already known and
                     stored by "makesyllogism" in the variables "truemajorpairs," "trueminorpairs,"
                     "falseconpairs."  (See comment at the first occurrence of "truemajorpairs:-" for
                     further information about the content of these variables.)  This CLASS
                     object simply tries to find a set of three terms which will simultaneously
                     satisfy the size specifications of three pairs, one each from "truemajorpairs,"
                     "trueminorpairs," and "falseconpairs."  If it succeeds, the CLASS detaches and
                     a counterexample is generated with appropriate big, medium and little class terms.
                     (See comments embedded in CLASS "terms" above.)
                     ---------------------------------------------------------------------------;
                     BEGIN
                        INTEGER i, j;

                        BOOLEAN onematch, found;

                        CHARACTER ch, sizeofmajorclass, sizeofmiddleclass, sizeofminorclass;

                        PROCEDURE choose;
                        BEGIN
                           IF sizeofmajorclass = 'B' THEN countermajorterm:- pickterm(2)
                           ELSE IF sizeofmajorclass = 'M' THEN countermajorterm:- pickterm(3)
                           ELSE countermajorterm:- pickterm(4);
                           IF sizeofmiddleclass = 'B' THEN countermiddleterm:- pickterm(2)
                           ELSE IF sizeofmiddleclass = 'M' THEN countermiddleterm:- pickterm(3)
                           ELSE countermiddleterm:- pickterm(4);
                           IF sizeofminorclass = 'B' THEN counterminorterm:- pickterm(2)
                           ELSE IF sizeofminorclass = 'M' THEN counterminorterm:- pickterm(3)
                           ELSE counterminorterm:- pickterm(4);
                           IF (countermajorterm == countermiddleterm OR countermiddleterm == counterminorterm
                           OR countermajorterm == counterminorterm) THEN choose
                        END PR*CEDURE choose;

                        truemajorpairs.Setpos(1);
                        trueminorpairs.Setpos(1);
                        falseconpairs.Setpos(1);

                        IF valid THEN outline("You must be kidding.  It can't be done.")
                        ELSE WHILE falseconpairs.More DO
                        BEGIN
                           j:= j + 1;
                           falseconpairs.Getchar;
                           COMMENT This position is blank so we continue...;
                           sizeofminorclass:= falseconpairs.Getchar;
                           sizeofmajorclass:= falseconpairs.Getchar;
                           WHILE trueminorpairs.More DO
                           BEGIN
                              j:= j + 1;
                              trueminorpairs.Getchar;
                              COMMENT This position is blank so we continue...;
                              IF trueminorpairs.Getchar = sizeofminorclass THEN
                              BEGIN
                                 sizeofmiddleclass:= trueminorpairs.Getchar;
                                 WHILE truemajorpairs.More DO
                                 BEGIN
                                    i:= i + 1;
                                    truemajorpairs.Getchar;
                                    COMMENT This position is blank so we continue...;
                                    ch:= truemajorpairs.Getchar;
                                    IF ch = sizeofmajorclass AND truemajorpairs.Getchar = sizeofmiddleclass
                                    THEN
                                    BEGIN
                                       onematch:= found:= TRUE;
                                       choose;
                                       Detach;
                                       choose;
                                       COMMENT---------------------------------------------------------------------
                                       Before seeking new pair matches, VENN first tries different terms using current
                                       size data.
                                       -----------------------------------------------------------------------------;
                                       Detach;
                                       found:= FALSE
                                    END
                                 END;
                                 truemajorpairs.Setpos(1)
                              END
                              ELSE trueminorpairs.Getchar
                           END;
                           trueminorpairs.Setpos(1);
                        END;
                        IF NOT valid THEN
                        BEGIN
                           IF NOT onematch THEN
                           BEGIN
                              j:= i + j;
                              Outtext("After");
                              Outint(j,3);
                              Outtext(" tries,");
                              Outint(i,3);
                              Outtext(" of which almost succeeded,");
                              outline(" VENN ran out of ideas and gave up.");
                              Outimage
                           END
                           ELSE outline("VENN can't think of another one.  Sorry.")
                        END
                     END CLA*S match;

                     REF(counterterms) heuristic;
                     heuristic:- NEW counterterms;
                     INSPECT heuristic DO
                     WHILE found AND toggle DO
                     BEGIN
                        Outimage;
                        outline("The original syllogism was:");
                        outsyllogism;
                        outline("VENN proposes this as a counterexample:");
                        makecounterexample;
                        outcounterexample;

                        request("Want VENN to try to make up another counterexample ('yes' or 'no')? ",
                        "no", boolinput(toggle),
                        "Huh?", nohelp);

                        IF toggle THEN Resume(heuristic)
                     END
                  END;

                  request("Want to stop ('yes' or 'no')? ","no",
                  boolinput(quit),"Huh?  Type 'H' for help.",
                  help("'No' will end execution of the program."));

                  IF NOT quit THEN
                  BEGIN
                     request("Different syllogism this time ('yes' or 'no')? ","yes",
                     boolinput(toggle),
                     "Huh?  Type 'H' for help.",
                     help("'No' repeats the cycle on the current syllogism."));
                     IF NOT toggle THEN GOTO samesyllogism
                  END
               END INSP*CT ordinary syllogism;
            END "WHILE NOT quit DO" loop;
         END INSP*CT safmin;
      END INSP*CT termlist;
   END
END