Assignment 5
Written Assignment - Game Playing
The assignment should be submitted via Blackboard.
Instructions
- The answers can be typed as a document or handwritten and
scanned.
- Name files as
assignment5_<net-id>.<format>
- Accepted document formats are (.pdf, .doc or
.docx). If you are using OpenOffice or LibreOffice, make sure
to
save as .pdf or .doc
- Please do not submit
.txt files.
- If
you are scanning handwritten documents make sure to scan it at a
minimum of 600dpi and save as a .pdf or .png file. Do not
insert images in word document and submit.
- If there are multiple files in your submission, zip them
together as assignment5_<net-id>.zip and submit the .zip
file.
Problem 1
20 points.
Let S1 be a statement in propositional logic. Write a function
CHECK_TRUE(S1) that:
- returns true if there exists a model (i.e., a row in the
truth table) where S1 is true.
- returns false otherwise.
Your pseudocode can re-use any code from the textbook or slides, and
can call any of the functions given in the textbook or slides, as long
as such code and functions are used correctly, with correct names for
the functions, and with well-specified values for all variables and
arguments.
Remember that a model is a complete assignment of Boolean
values for
each symbol of S1. In other words, a model corresponds to a row of the
truth table. Thus, given a model, for any symbol of S1 we know whether
that symbol is true or false in that model.
Problem 2
20 points.
Two logical statements A and B are logically equivalent if A
<=>
B. We have two knowledge bases, KB1 and KB2.. Write a function
CHECK_EQUIVALENCE(KB1, KB2) that:
- returns true if KB1 and KB2 are logically equivalent.
- returns false otherwise.
Your pseudocode can re-use any code from the textbook or
slides, and can call any of the functions given in the textbook or
slides, as long as such code and functions are used correctly, with
correct names for the functions, and with well-specified values for all
variables and arguments.
Problem 3
20 points.
A |
B |
C |
KB |
S1 |
True |
True |
True |
True |
True |
True |
True |
False |
False |
True |
True |
False |
True |
True |
True |
True |
False |
False |
False |
True |
False |
True |
True |
False |
False |
False |
True |
False |
False |
False |
False |
False |
True |
False |
False |
False |
False |
False |
False |
False |
KB and S1 are two propositional logic statements, that are constructed
using symbols A, B, C, and using various connectives. The above truth
table shows, for each combination of values of A, B, C, whether KB and
S1 are true or false.
Part a: Given the above
information, does KB entail S1? Justify your answer.
Part b: Given the above
information, does statement NOT(KB) entail statement NOT(S1)? Justify
your answer.
Problem 4
10 points.
Convert the following to CNF
Part a: A
=> (NOT (C OR B))
Part b: (NOT
(C OR B)) => A
Problem 5
10 points.
Let S1 and S2 be two logical statements in propositional logic.
Write pseudocode that determines if the statement (S1 XOR S2) is valid
(a statement is valid if it is true in all models). The XOR of the two
statements S1 and S2 is true in two cases:
When S1 is true and S2 is false
When S1 is false and S2 is true.
Your
pseudocode can use as building blocks any of the functions given in the
textbook, as long as such functions are called correctly and with
well-specified arguments.
Problem 6
10 points.
Consider a knowledge base with these facts:
- There is a dog called Shadow.
- John gave Shadow to Mary.
- If Shadow is male, Mary gave a smartphone to John.
- If Shadow is female, Mary gave John a laptop.
- John only gives male dogs to people.
- Mary gave John a laptop.
Convert the above knowledge-base to a first-order logic knowledge base.
For each predicate, function, constant, or variable that you use,
explicitly state:
- What type of entity it is (is it a predicate, function,
constant, or variable).
- What its semantics are (what it means).
Problem 7
10 points.
Consider
this first-order logic knowledge base:
taller(John, Bill)
for-every x, taller(x, Bill) => tall(x)
In
this first-order logic knowledge base, taller and tall are
predicates, x is a
variable, and John, Bill are
constants. Convert this first-order logic knowledge base into a
propositional logic knowledge base, by performing the following two
steps:
- Define symbols for the propositional-logic version of the
knowledge base, and specify what their equivalents are in the original
first-order logic knowledge base.
- Define the statements that should be stored in the
propositional-logic version of the knowledge base.
The
symbols you define should be comprehensive enough to allow us to
translate any well-defined inference problem in the original knowledge
base to an equivalent problem for the propositional knowledge base.
Anything that we can infer from the original first-order logic
knowledge base we should also be able to infer from the
propositionalized knowledge base, and vice versa.