**Unformatted text preview:**

Question 1Part a. Consider the following knowledge base:A AND BC OR D(A => (C OR D)) AND (NOT (A => C))How many rows are there in the truth table for this knowledge base? How did you determine this number?There are four symbols, A, B, C, D, so there are 2^4=16 rows in the truth table.Part b. John and Mary sign the following binding contract in front of their parents:1. On Sunday, John will mow the lawn or buy groceries.2. On Sunday, Mary will mow the lawn or wash the car.This is an all-inclusive list of what actually happens on Sunday:1. Mary mows the lawn on Sunday.2. Mary washes the car on Sunday.3. Mary buys groceries on Sunday.How can the above statements be represented using propositional logic? First, define literals and specify what English phrase each literal corresponds to. Second, represent theknowledge base (i.e., what happens on Sunday) using those literals. Third, represent the contract as a single logical statement, using those literals. Four, determine (in any way you like) whether, according to the rules of propositional logic, the contract was violated or not.We define the following literals:JM: John mows the lawn on SundayJB: John buys groceries on SundayMB: Mary buys groceries on SundayMM: Mary mows the lawn on SundayMW: Mary washes the car on SundayThis is what happens on Sunday:MM and MW and MB and (not JM) and (not JB)Note: (not JM) and (not JB) are included because the question explicitly says that the given list of what happens on Sunday is all-inclusive (so, whatever is not specified there, did not happen).The contract is represented as:(JM or JB) and (MM or MW)The contract was violated, since (JM or JB) was false.1Part c. Suppose that a knowledge base contains only symbols A, B, and C. When does such a knowledge base entail the statement D (i.e., the statement consisting of a single symbol that does not appear in the knowledge base)? Always, sometimes, or never? If sometimes, then identify precisely the conditions that determine whether this knowledge base entails the statement D.There is only one case where this knowledge base entails D: the case where the knowledge base is always false. A knowledge base that is always false entails everything.2Question 2Determine if the following pairs of sentences are logically equivalent, meaning that one istrue if and only iff the other is true. You do not have to justify your answer.Part a. Propositional logic.A or B or not(B) or CA or B or (C <=> C)Logically equivalent, they are both always truePart b. First-order logic, x and y are variables, f is a predicate.for-every x, for-every y: f(x, y)for-every x, for-every y: f(y, x)Logically equivalent, “for-every x, for-every y” is the same as for-every y, for-every x, so:for-every x, for-every y: f(x, y) is the same asfor-every y, for-every x: f(x, y)By consistently replacing x with y and y with x in “for-every y, for-every x: f(x, y)”, we obtain “for-every x, for-every y: f(y, x)”Part c. Propositional logic.(A and B) => (E and G)not(A) or not(B) or (E and G)logically equivalent, the second statement is obtained from the first one by applying the rule that “X => Y” is the same as “(not X) or Y”3Question 3For of the following pairs of sentences, determine if they are logically equivalent (i.e., if each sentence of the pair implies the other sentence in the pair). Do not assume anything except the laws of propositional and first order logic.Part a. for-every x, exists y: color(x) = y not (exists x, for-every y: not (color(x) = y) )logically equivalentPart b. for-every x, exists y: f(x, y) exists y, for-every x,: f(x, y)not logically equivalentPart c. for-every x, exists y: color(x) = y Not (for-every x, exists y: not (color(x) = y) )not logically equivalentPart d. for-every x, exists y: son(x) = y for-every x, exists y: father(y) = xnot logically equivalent4Question 4Part a. Consider the following set of actions:Action(PutSockOnFoot(a, f): Precond: Sock(a), Foot(f), FreeSock(a) Effect: not (FreeSock(a)), SockOn(f)) Action(PutShoeOnFoot(b, f): Precond: Shoe(b), Foot(f), SockOn(f), FreeShoe(b) Effect: not (FreeShoe(b)), ShoeOn(f))Now, consider this initial state, and this goal:InitState: Sock(sock1) and Sock(sock2) and FreeSock(sock1)and FreeSock(sock2) and Shoe(left_shoe) and Shoe(right_shoe) and FreeShoe(left_shoe)and FreeShoe(right_shoe) and Foot(left_foot) and Foot(right_foot)Goal: ShoeOn(left_foot) and ShoeOn(right_foot) Make two different plans to achieve the goal, given the initial state.First plan:PutSockOnFoot(sock1, left_foot)PutSockOnFoot(sock2, right_foot)PutShoeOnFoot(left_shoe, left_foot)PutShoeOnFoot(right_shoe, right_foot)Second plan:PutSockOnFoot(sock1, left_foot)PutShoeOnFoot(left_shoe, left_foot)PutSockOnFoot(sock2, right_foot)PutShoeOnFoot(right_shoe, right_foot)5Part b. Consider the following set of actions (just a little different from Part a).Action(PutSockOnFoot(a, f): Precond: Sock(a), Foot(f) Effect: SockOn(f)) Action(PutShoeOnFoot(b, f): Precond: Shoe(b), Foot(f), SockOn(f) Effect: ShoeOn(f))Now, consider this initial state, and this goal:InitState: Sock(sock1) and Shoe(left_shoe) and Foot(left_foot) and Foot(right_foot)Goal: ShoeOn(left_foot) and ShoeOn(right_foot) Make a plan to achieve the goal, given the initial state.PutSockOnFoot(sock1, left_foot)PutShoeOnFoot(left_shoe, left_foot)PutSockOnFoot(sock1, right_foot)PutShoeOnFoot(left_shoe, right_foot)Part c. Consider the following set of actions.Action(PutSockOnFoot(a, f): Precond: Sock(a), Foot(f) Effect: SockOn(f) or SockOnFloor(a)) Action(PutShoeOnFoot(b, f): Precond: Shoe(b), Foot(f), SockOn(f) Effect: ShoeOn(f))Now, consider this initial state, and this goal (exactly the same as Part b).InitState: Sock(sock1) and Shoe(left_shoe) and Foot(left_foot) and Foot(right_foot)Goal: ShoeOn(left_foot) and ShoeOn(right_foot) Is there a finite conditional plan that always achieves the goal given the initial state? If yes, describe the plan. If not, why not?6There is no finite conditional plan that always achieves the goal. There is no guarantee that, after any finite number of repeating the PutSockOnFoot(sock1, left_foot) action, we will achieve SockOn(left_foot), which is a precondition for putting a shoe on the left foot.7Part d. Consider the following set of actions (exactly the same as in Part

View Full Document