I have to do this.
report not necessary .coding is more important
1. We consider a particular assignment of truth values to our given variables a state in a search graph. We will represent a state in Lisp as a list of pairs. Each pair is a list containing the variable name (a symbol in Lisp) and its corresponding truth value t (true) or nil (false). Write a function eval-var that returns the value associated with a particular variable:
> (setf *state* '((a nil) (b t) (c t) (d nil)))
(A NIL) (B T) (C T) (D NIL))
> (eval-var 'b *state*)
T
> (eval-var 'd *state*)
NIL
[login to view URL] will represent a single clause in Lisp as a list of 3 elements. Each element is either a single variable name (i.e., an atom) or a list containing the symbol not followed by a variable name. Write the function eval-clause that evaluates a clause (i.e., returns t or nil) for a given variables state:(defun eval-clause (clause state)
...
)
For example
> *state*
((A NIL) (B T) (C T) (D NIL))
> (setf *clause* '(a (not b) c))
(A (NOT B) C)
> (eval-clause *clause* *state*)
T
3. Write a function unsat-clauses that returns all the unsatisfied clauses in an expressions for a given state:
(defun unsat-clauses (clauses state)
...
)
For example
> *state*
((A NIL) (B T) (C T) (D NIL))
> *clauses*
((A (NOT B) C) (A (NOT B) (NOT C)) (A (NOT B) D))
> (unsat-clauses *clauses* *state*)
((A (NOT B) (NOT C)) (A (NOT B) D))
Readme file and a ten-page report would be appreciated