home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Education
/
collectionofeducationcarat1997.iso
/
SCIENCE
/
CSA.ZIP
/
CSA.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1987-05-21
|
34KB
|
783 lines
;************************************************************************
;* *
;* program : CSA *
;* author : Chris Lord *
;* version : 3.17 (5/21/87) *
;* date : February 18, 1987 *
;* *
;* Copyright (c) 1987 by Chris Lord *
;* *
;* This program was written for a course in logic and lisp at FSC *
;* as a learning experience. Having served its purpose, the author *
;* contributes this code to the public domain so that others may also *
;* learn. I would be interested in any suggestions/improvements/bugs *
;* anyone finds. Please address all comments to: *
;* *
;* Chris Lord *
;* 38 Main Street *
;* Princeton, MA 01541 *
;* DEC ENET RAINBO::LORD *
;* *
;************************************************************************
;************************************************************************
;* *
;* program description *
;* *
;* This program is the first step in determining the validity of *
;* standard (and some non-standard) categorical syllogisms. The *
;* the validity of a syllogism is based on a collection of eight *
;* rules, seven of which are implemented in this version. See the *
;* accompanying manual for a completed description as well as a *
;* short tutorial in syllogism logic. *
;* *
;* edit history *
;* *
;* 3.15 add check for same premisses in main routine CSA to catch *
;* some other bad syllogism (ccl 5/13/87) *
;* 3.16 add further syllogism checks in function CSA (ccl 5/14/87) *
;* 3.17 add heuristic for dealing with subjects that are single *
;* atoms to format_prop (ccl 5/21/87) *
;* 3.18 add list of atoms to strip from props when parsing such as *
;* (the an a) (not yet) *
;* *
;************************************************************************
;************************************************************************
;* *
;* data declarations *
;* *
;* these are global symbols that are currently used by only single *
;* functions -- this is likely to change. *
;* *
;************************************************************************
;+
; this is the set of univeral-affirmative quantifiers that may appear
; in the proposition. Any member is replaced with the standard
; quantifier ALL
;-
(setq universal_affirm '(all every any everything anything everyone
anyone whoever whoso who whatever a an the))
;+
; this is the set of univeral-negative quantifiers that may appear
; in the proposition. Any member is replaced with the standard
; quantifier NO
;-
(setq universal_neg '(no none nothing no-one))
;+
; this is the set of particular quantifiers (quality is determined
; by the verb adjunct 'not') that may appear in the propostion.
; Any member is replaced with the standard quantifier SOME
;-
(setq particular_quantifiers '(some most many few))
;+
; this is the set of words that precede a form of the verb 'to be'
; an indicate (generally) that it is not the verb of the proposition
; as in: all men who are green are frogs
;-
(setq non_verb_preds '(who whom that))
;+
; this is the error code table, each error has a code followed
; by the actual error text
;-
(setq error_codes '(badprop "bad proposition encountered"
badquan "bad quantifier encountered"
badsubj "bad subject encountered"
badverb "bad verb encountered"
badpred "bad predicate encountered"
badform "bad form encountered"
badsyll "bad syllogism encountered"))
;************************************************************************
;* *
;* rule base *
;* *
;* the following functions are each responsible for checking a given *
;* form against one of the rules for valid functions. Rules return *
;* nil if they pass, something else otherwise. Every rule is passed *
;* the form of the syllogism in (n x x x) form. *
;* *
;************************************************************************
;+
; the following are inherent characteristics of each type of syllogism
; used in creating the rules:
;
; type quantity quality S P
; ---- ---------- ----------- --- ---
; A universal affirmative D U
; E universal negative D D
; I particular affirmative U U
; O particular negative U D
;
; where: U is undistributed S is subject
; D is distributed P is predicate
;-
;+
; Rule 1: A categorical syllogism must contain three and only
; three terms or it commits the fallacy of four terms.
;
; this rule cannot be implemented without an extensive knowledge of
; english vocabulary. It is in this rule that ambiguous class
; descriptors and the misuse of synonyms are caught. Often times
; this rule is also used to catch syllogisms with no middle term.
;-
(defun rule_1 (form)
nil)
;+
; Rule 2: The middle term must be distributed at least once
; or it commits the fallacy of undistributed middle.
;-
(defun rule_2 (form)
(setq p1 (cadr form)) ; type of prop 1
(setq p2 (caddr form)) ; type of prop 2
(not (case (car form)
(1 (or (member p1 '(A E)) (member p2 '(E O))))
(2 (or (member p1 '(E O)) (member p2 '(E O))))
(3 (or (member p1 '(A E)) (member p2 '(A E))))
(4 (or (member p1 '(E O)) (member p2 '(A E)))))))
;+
; Rule 3: No term may be distributed in the conclusion which
; is undistributed in the premisses or it commits the fallacy
; of illicit major or minor.
;
; this rule is in two parts. Part A checks for illicit major;
; part B checks for illicit minor.
;-
(defun rule_3A (form)
(setq p1 (cadr form)) ; type of prop 1
(setq p2 (caddr form)) ; type of prop 2
(and
(member (cadddr form) '(E O))
(case (car form)
(1 (member p1 '(A I)))
(2 (member p1 '(I O)))
(3 (member p1 '(A I)))
(4 (member p1 '(I O))))))