Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROBLEM 1 (Regular): Your first task is to write a function that, given truth values for the propositional variables, produces a truth value for an

PROBLEM 1 (Regular): Your first task is to write a function that, given truth values for the propositional variables, produces a truth value for an entire formula. For example, given the formula A \/ (B /\ ~C) and the mapping `[("A", False), ("B", True), ("C", False)]`, your function should return `True`. The truth values for the propositional variables are provided as a list of string-Boolean pairs. The `lookup` function (from the standard Prelude) can be used to find values in this list. Your evaluation function may behave arbitrarily (i.e., it may fail, or return an arbitrary truth value) if it encounters a propositional variable whose truth value has not been provided The structure of your evaluation function should *exactly* follow the structure of formulae: you need a case for variables, a (single) case for negated formulae, and so forth, and you should rely on recursion whenever the definition of formulae is itself recursive. --------------------------------------------------------------------------------} eval :: [(String, Bool)] -> Formula -> Bool eval = error "eval not implemented" evalTests = TestList [ "A /\\ (B \\/ ~B) with A = True, B = True" ~: eval [("A", True), ("B", True)] (And (Var "A") (Or (Var "B") (Not (Var "B")))) ~?= True , "A /\\ (B \\/ ~B) with A = False, B = True" ~: eval [("A", False), ("B", True)] (And (Var "A") (Or (Var "B") (Not (Var "B")))) ~?= False -- Your tests go here ] 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

1 What is the general tone of our present relationship with them?

Answered: 1 week ago

Question

4. Does cultural aptitude impact ones emotional intelligence?

Answered: 1 week ago

Question

7. Do the organizations social activities reflect diversity?

Answered: 1 week ago