home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / club100 / pg / pggene / sylcat.ba < prev   
Text File  |  2006-10-19  |  7KB  |  203 lines

  1. SYLCAT.BA by Paul Globman
  2.           Copyright (c) 1990
  3.  
  4. A categorical syllogism consists of three sentences, two of which are premises,
  5. and the third being the conclusion inferred by the premises.
  6.  
  7. All sentences in the syllogism must be of form A,E,I, or O type sentences.
  8.  
  9.   A:all  S is P      E:no S is P
  10.   I:some S is P      O:some S is not P
  11.  
  12. You must first provide two premises.  If the premises are properly formed then
  13. you will be prompted for a conclusion.  If the conclusion is valid (based upon
  14. the premises), the program will confirm the validity.
  15.  
  16. OPERATION
  17. ---------
  18. The prompt for a premise is... P->
  19.  
  20. A premise is a simple sentence in the form shown above.  
  21.  
  22. <quantifier> <noun phrase> is <noun phrase>.
  23.  
  24. If the sentence is not in that form, you will hear a BEEP and be prompted
  25. again.  If the sentence does not begin with the word "all", "some", or "no"
  26. then the word "all" will be assumed and inserted.  So the sentence...
  27.  
  28.  "whales are mammals" will become "all whales are mammals".
  29.  
  30. If the predicate noun phrase begins with the word "not", the quantifier will be
  31. modified when possible.  For example...
  32.  
  33. "men are not gods" will become "no men are gods"
  34.  
  35. "no whales are not mammals" will become "all whales are mammals"
  36.  
  37. "some mammals are not whales" will remain "some mammals are not whales"
  38.  
  39.  
  40. After entering two premises, they are analyzed and if they are found to lack
  41. the qualities that will lead to a conclusion, then a BEEP will sound and an
  42. appropriate error message is displayed.
  43.  
  44. Such errors might be ...
  45.  
  46. A) two negative premises...
  47.  
  48.  No students are wage earners
  49.  Some wage earners are not voters
  50.  
  51. B) lack of a "middle term"...
  52.  
  53.  All wild horses are free spirits
  54.  Some spirits are not tangible objects
  55.    (spirits <> free spirits)
  56.  
  57. C) failure to distribute the "middle term"....
  58.  
  59.  All bananas are yellow fruit
  60.  Some yellow fruit are poisonous fruit
  61.  
  62.  
  63. CONCLUSION
  64. ----------
  65. If the two premises are acceptable then you are prompted for a conclusion...
  66.  
  67.  C->
  68.  
  69. The conclusion is examined, converted in form (if necessary), and checked for
  70. validity.  Some errors may be...
  71.  
  72. D) negative conclusion required or unsupported.
  73.  
  74. E) a "term" is distributed in the conclusion without having been distributed in
  75. the premise.
  76.  
  77. F) a "term" in conclusion was not referenced in premise.
  78.  
  79. If there are no errors in logic, and the conclusion is valid, then the program
  80. announces "Valid conclusion!"
  81.  
  82. LOGIC
  83. -----
  84. I did not use any of the esoteric logic operatives that BASIC makes available.
  85. The testing is done thru brute force by looking at all possibilities.
  86.  
  87. SUGGESTIONS
  88. -----------
  89. Language can often be quite cumbersome so I recommend the use of mnemonics for
  90. noun phrases.
  91.  
  92.  "All bananas are yellow fruit" can be entered as "All B are YF"
  93.  
  94. The program allows upper or lower case input, but it is converted to lower case
  95. for evaluation.  The verb "is" can be used instead of "are".
  96.  
  97. COMMENTS
  98. --------
  99. This program was written to simulate the results offered by Venn diagrams. The
  100. syllogism to be considered must be in the form of a "categorical" syllogism.
  101.  
  102. The "hypothetical" syllogism is not considered.  This instruction file is not
  103. a logic course replacement and discussion of "middle term", "subject term",
  104. "predicate term", "quantifiers", and "distribution" is left to reference books
  105. on the topic of LOGIC.
  106.  
  107.  
  108. 1 REM SYLCAT.BA by Paul Globman
  109. 2 REM        Copyright (c) 1990
  110. 5 CLEAR 512
  111. 6 PRINT "-----------------------------"
  112. 10 GOSUB 500:GOSUB 600:X1$=X$
  113. 15 Q1$=Q$:S1$=S$:C1$=C$:P1$=P$:T1=T
  114. 20 GOSUB 500:GOSUB 600:X2$=X$
  115. 25 Q2$=Q$:S2$=S$:C2$=C$:P2$=P$:T2=T
  116. 30 PRINT:PRINT "P->"X1$:PRINT "P->"X2$
  117. 35 GOSUB 100:GOSUB 200
  118. 40 GOSUB 510:GOSUB 600:X3$=X$:PRINT
  119. 45 Q3$=Q$:S3$=S$:C3$=C$:P3$=P$:T3=T
  120. 50 GOSUB 450:GOSUB 300:GOSUB 400
  121. 99 PRINT"Valid conclusion!":RUN
  122. 100 REM ----------- middle term test
  123. 105 IF (S1$=S2$) AND (P1$<>P2$) THEN 135
  124. 110 IF (S1$=P2$) AND (P1$<>S2$) THEN 140
  125. 115 IF (P1$=S2$) AND (S1$<>P2$) THEN 145
  126. 120 IF (P1$=P2$) AND (S1$<>S2$) THEN 150
  127. 125 PRINT "no valid middle term"
  128. 130 GOTO 480
  129. 135 IF T1<3 OR T2<3 THEN RETURN ELSE 155
  130. 140 IF T1<3 OR T2 MOD 2=0 THEN RETURN ELSE 155
  131. 145 IF T1 MOD 2=0 OR T2<3 THEN RETURN ELSE 155
  132. 150 IF T1 MOD 2=0 OR T2 MOD 2=0 THEN RETURN
  133. 155 PRINT "middle term not distributed
  134. 160 GOTO 480
  135. 200 REM --------- double negative test
  136. 210 IF T1 MOD 2=1 THEN RETURN
  137. 220 IF T2 MOD 2=1 THEN RETURN
  138. 230 PRINT "two negative premises"
  139. 240 GOTO 480
  140. 300 REM ----- negative conclusion test
  141. 310 IF (T1+T2+T3) MOD 2=1 THEN RETURN
  142. 320 PRINT:PRINT "negative conclusion ";
  143. 330 IF (T1+T2) MOD 2=0 THEN 350
  144. 340 PRINT "required":GOTO 360
  145. 350 PRINT "unsupported"
  146. 360 GOTO 480
  147. 400 REM ------------ distribution test
  148. 405 IF T3=3 THEN RETURN
  149. 410 IF T3=1 THEN 425
  150. 412 IF T3=2 THEN GOSUB 415:GOTO 425
  151. 415 IF P3$=S1$ AND T1<3 THEN RETURN
  152. 417 IF P3$=S2$ AND T2<3 THEN RETURN
  153. 420 IF P3$=P1$ AND T1 MOD 2=0 THEN RETURN
  154. 422 IF P3$=P2$ AND T2 MOD 2=0 THEN RETURN
  155. 423 GOTO 445
  156. 425 IF S3$=S1$ AND T1<3 THEN RETURN
  157. 427 IF S3$=S2$ AND T2<3 THEN RETURN
  158. 430 IF S3$=P1$ AND T1 MOD 2=0 THEN RETURN
  159. 432 IF S3$=P2$ AND T2 MOD 2=0 THEN RETURN
  160. 445 PRINT "no prior distribution"
  161. 446 GOTO 480
  162. 450 REM ----------- verify final terms
  163. 455 IF (S3$<>S1$) AND (S3$<>P1$) AND (S3$<>S2$) AND (S3$<>P2$) THEN 470
  164. 460 IF (P3$<>S1$) AND (P3$<>P1$) AND (P3$<>S2$) AND (P3$<>P2$) THEN 470
  165. 465 RETURN
  166. 470 PRINT "term in conclusion was not"
  167. 475 PRINT "  referenced in premise"
  168. 480 BEEP:RUN
  169. 500 REM --------------- get input
  170. 505 LINE INPUT "P->";X$:RETURN
  171. 510 LINE INPUT "C->";X$:RETURN
  172. 515 LINE INPUT "-->";X$:RETURN
  173. 600 REM -------- Parse the sentence X$
  174. 605 X=INSTR(1,X$," ")
  175. 607 GOSUB 800
  176. 610 Q$=LEFT$(X$,X):IF Q$="all " THEN 625
  177. 615 IF Q$="some " OR Q$="no " THEN 625
  178. 620 X$="all "+X$:GOTO 605
  179. 625 X$=RIGHT$(X$,LEN(X$)-LEN(Q$))
  180. 630 C$=" is ":X=INSTR(1,X$,C$)
  181. 635 IF X>0 THEN 650
  182. 640 C$=" are ":X=INSTR(1,X$,C$)
  183. 645 IF X=0 THEN BEEP:GOSUB 515:GOTO 600
  184. 650 S$=LEFT$(X$,X-1)
  185. 655 P$=RIGHT$(X$,LEN(X$)-LEN(S$+C$))
  186. 660 IF LEFT$(P$,4)<>"not " THEN 685
  187. 665 P$=RIGHT$(P$,LEN(P$)-4)
  188. 670 IF Q$="all " THEN Q$="no ":GOTO 685
  189. 675 IF Q$="no " THEN Q$="all ":GOTO 685
  190. 680 C$=C$+"not "
  191. 685 X$=Q$+S$+C$+P$
  192. 690 IF Q$="all " THEN T=1:RETURN
  193. 695 IF Q$="no " THEN T=2:RETURN
  194. 700 IF LEN(C$)>5 THEN T=4:RETURN
  195. 705 T=3:RETURN
  196. 800 REM ------------ U/L CASE SENSITIVE
  197. 805 FOR I = 1 TO LEN(X$)
  198. 810 L$=MID$(X$,I,1)
  199. 820 IF L$=" " OR L$=>"a" THEN 840
  200. 830 L$=CHR$(32+ASC(L$)):MID$(X$,I)=L$
  201. 840 NEXT:RETURN
  202.  
  203.