Define negationp where a formula is a negation iff it is a list whose first member is '~'.
Define the function (neg p) which returns the negation of p if p is not a negation, and returns what p negates if p is a negation.
Define a LISP function GMT implementing Generalized Modus Tollens:
Given a conditional (-> (& p1 ... pn) q) (where p1,…,pn and q are strings) from (neg q) and from all but one of the p's, infer (neg p) for the remaining p.
Note that there are two cases to consider regarding the role of P in the inference (i.e., P can be related to the conditional in either of two ways).
Test your definition by making *inference-rules* (GMP GMT) and setting *beliefs* to ((-> (& P1 P2) Q) (-> (& (~ P2) R) S)), *new-beliefs* to (P1 R (~ Q)), and running (cognize-epistemically). What is the value of *beliefs* afterwards?