Assignment 3: Logical Agents: Solutions

Similar documents
Knowledge Representation. CS 486/686: Introduction to Artificial Intelligence

Example of a Demonstration that a Problem is NP-Complete by reduction from CNF-SAT

Introduction to Spring 2007 Artificial Intelligence Midterm Solutions

2SAT Andreas Klappenecker

CS446: Machine Learning Fall Problem Set 4. Handed Out: October 17, 2013 Due: October 31 th, w T x i w

(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1

First Order Predicate Logic CIS 32

COMP4418 Knowledge Representation and Reasoning

Homework 1 CS 1050 A Due:

a. Given that we search depth first from left to right, list all leaf nodes above that we need to search/expand. (35 Points)

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture

Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 9 Normal Forms

Resolution (14A) Young W. Lim 6/14/14

Implementation of a Sudoku Solver Using Reduction to SAT

The Resolution Algorithm

Propositional logic (Ch. 7)

Typed Lambda Calculus

Answer Key #1 Phil 414 JL Shaheen Fall 2010

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

Propositional Logic. Part I

NP-Complete Reductions 2

First-Order Logic PREDICATE LOGIC. Syntax. Terms

Integrity Constraints (Chapter 7.3) Overview. Bottom-Up. Top-Down. Integrity Constraint. Disjunctive & Negative Knowledge. Proof by Refutation

NP-Completeness of 3SAT, 1-IN-3SAT and MAX 2SAT

Where Can We Draw The Line?

CSC242: Intro to AI. Lecture 8 LOGIC

Theorem 3.1 (Berge) A matching M in G is maximum if and only if there is no M- augmenting path.

Linear Time Unit Propagation, Horn-SAT and 2-SAT

Parallel and Distributed Computing

Propositional logic (Ch. 7)

8 NP-complete problem Hard problems: demo

Section 1.1 Logic LOGIC

1. Define admissibility and suggest an admissible heuristic functions for the Rubik s cube. (half-twist is counted as a single move).

DM841 DISCRETE OPTIMIZATION. Part 2 Heuristics. Satisfiability. Marco Chiarandini

PROPOSITIONAL LOGIC (2)

Program Verification & Testing; Review of Propositional Logic

Mixed Integer Linear Programming

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

HW1. Due: September 13, 2018

COMP Intro to Logic for Computer Scientists. Lecture 2

Polynomial Exact-3-SAT-Solving Algorithm

The DPL (Decisive Plausible Logic) Tool

Artificial Intelligence. Chapters Reviews. Readings: Chapters 3-8 of Russell & Norvig.

Section 2.4: Arguments with Quantified Statements

To prove something about all Boolean expressions, we will need the following induction principle: Axiom 7.1 (Induction over Boolean expressions):

Discrete structures - CS Fall 2017 Questions for chapter 2.1 and 2.2

Combinatorial Optimization

Computer-Aided Program Design

PCP and Hardness of Approximation

Finding a winning strategy in variations of Kayles

Resolution in FO logic (Ch. 9)

Today. Finish Euclid. Bijection/CRT/Isomorphism. Review for Midterm.

CSE 20 DISCRETE MATH. Fall

The Satisfiability Problem [HMU06,Chp.10b] Satisfiability (SAT) Problem Cook s Theorem: An NP-Complete Problem Restricted SAT: CSAT, k-sat, 3SAT

Lecture Notes 15 Number systems and logic CSS Data Structures and Object-Oriented Programming Professor Clark F. Olson

CSC242: Intro to AI. Lecture 10. Tuesday, February 26, 13

Binary Decision Diagrams

Dipartimento di Elettronica Informazione e Bioingegneria. Cognitive Robotics. SATplan. Act1. Pre1. Fact. G. Gini Act2

Set 7: Predicate logic Chapter 8 R&N. ICS 271 Fall 2015

Propositional Logic. Andreas Klappenecker

Inf2D 12: Resolution-Based Inference

(QiuXin Hui) 7.2 Given the following, can you prove that the unicorn is mythical? How about magical? Horned? Decide what you think the right answer

Knowledge & Reasoning

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

Logical Connectives. All kittens are cute. ; I like pizza. ; The sky is blue. ; Triangles have three sides.

Question 1: 25% of students lost more than 2 points Question 2: 50% of students lost 2-4 points; 50% got it entirely correct Question 3: 95% of

1 / 43. Today. Finish Euclid. Bijection/CRT/Isomorphism. Fermat s Little Theorem. Review for Midterm.

LECTURE 2 An Introduction to Boolean Algebra

Chapter 3. Set Theory. 3.1 What is a Set?

SAT Solvers. Ranjit Jhala, UC San Diego. April 9, 2013

Decision Procedures in First Order Logic

1 Matchings in Graphs

Last time: Logic and Reasoning

1.4 Normal Forms. We define conjunctions of formulas as follows: and analogously disjunctions: Literals and Clauses

Complexity of unique list colorability

Notes for Chapter 12 Logic Programming. The AI War Basic Concepts of Logic Programming Prolog Review questions

Typed Lambda Calculus for Syntacticians

Propositional Logic:

UNIT 14C The Limits of Computing: Non computable Functions. Problem Classifications

Part II: Propositional Logic Homework Problems

Automated Reasoning PROLOG and Automated Reasoning 13.4 Further Issues in Automated Reasoning 13.5 Epilogue and References 13.

A Random Walk through CS70

Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5

1 Definition of Reduction

P -vs- NP. NP Problems. P = polynomial time. NP = non-deterministic polynomial time

Logic: TD as search, Datalog (variables)

For next Tuesday. Read chapter 8 No written homework Initial posts due Thursday 1pm and responses due by class time Tuesday

P Is Not Equal to NP. ScholarlyCommons. University of Pennsylvania. Jon Freeman University of Pennsylvania. October 1989

Using Functions in Alice

Lecture 17 of 41. Clausal (Conjunctive Normal) Form and Resolution Techniques

CS 512, Spring 2017: Take-Home End-of-Term Examination

(More) Propositional Logic and an Intro to Predicate Logic. CSCI 3202, Fall 2010

Discrete Mathematics and Probability Theory Summer 2016 Dinh, Psomas, and Ye HW 2

Boolean Functions (Formulas) and Propositional Logic

comma, comma, comma, comma, comma, chameleon

Mathematical Logic Prof. Arindama Singh Department of Mathematics Indian Institute of Technology, Madras. Lecture - 37 Resolution Rules

8.1 Polynomial-Time Reductions

CSL105: Discrete Mathematical Structures. Ragesh Jaiswal, CSE, IIT Delhi

Towards a Logical Reconstruction of Relational Database Theory

Mathematical Logic Part One

Transcription:

Assignment 3: Logical Agents: Solutions Due 2/22 at 11:59pm. Please work individually and use the submission instructions. Q1. Basics (2 points) State if each of the sentences below are unsatisfiable, satisfiable, or valid. P Q Satisfiable P Q Satisfiable P P Valid P P Unsatisfiable P (Q P) Valid Q2. Manipulating propositional sentences (3 points) Show that any CNF formula (conjunction of clauses, where each clause is a disjunct of literals) can be converted to a 3-CNF formula (conjunction of clauses where each clause is at most a disjunction of 3 literals) where the 3-CNF formula is true in the same models that the original CNF sentence was true. Extra Credit (1 point). Show that a CNF formula can be converted to a 3-CNF formula where each clause has exactly 3 disjuncts. The following procedure converts a formula in CNF into 3-CNF with exactly 3 disjuncts. If we remove Step 1 from the procedure below, we get a 3-CNF form where each clause has at most 3 disjuncts. 1. In each clause which currently has one or two literals, we replicate one of the literals until the total number is three. 2. In each clause that has more than three literals we split it into several clauses and add several variables to preserve the satisfiability or nonsatisfiability of the original. a. For example, we replace clause (a 1 a 2 a 3 a 4 ) with (a 1 a 2 z) ( z a 3 a 4 ) where z is a new variable. If some assignment of the a's satisfies the original clause, we can find some assignment of z so that the two new clauses are satisfied. 3. In general, if the clause contains k literals, (a 1 a 2... a k ), we can replace it with the k-2 clauses, a. (a 1 a 2 z 1 ) ( z 1 a 3 z 2 ) ( z 2 a 4 z 3 )... ( z k-3 a k-1 a k ).

We may easily verify that the new formula is satisifable if and only if the original formula was (the reader is invited to do so). Q3. Propositional Resolution (2 points) Consider the sentence Heads, I win. Tails, you lose. Design a propositional KB that represents the sentence (create the propositions and rules required). Then use propositional resolution to prove that I always win. 1. Make our objects: a. H heads T tails I I win Y you win 2. State your rules: a. H I and T Y 3. Is that all? Don t forget, you must specify implicit rules, too! The system doesn t know that heads and tails are mutually exclusive. a. H T and I Y 4. Convert to CNF a. H I T Y (H T ) ( H T ) b. (I Y ) ( I Y ) 5. We want to prove I, so insert the literal I for the proof by contradiction. Now start resolving clauses: a. T Y and H T resolves to H Y b. H I and H Y resolves to I Y c. I and I Y resolves to Y d. I Y and Y resolves to I e. I and I {} -- we have a contradiction, so I is true. Q4. Propositional Puzzle (3 points) Write out the facts as sentences in Propositional Logic, and use propositional resolution to solve the crime. 1. There are three suspects for a murder: Adams, Brown, and Clark. 2. Adams says I didn t do it. The victim was old acquaintance of Brown s. But Clark hated him. 3. Brown states I didn t do it. I didn t know the guy. Besides I was out of town all the week. 4. Clark says I didn t do it. I saw both Adams and Brown downtown with the victim that day; one of them must have done it. 5. Assume that the two innocent men are telling the truth, but that the guilty man might not be.

The key to the solution is to make the suspect s statements conditional on their innocence. The following rules/axioms are sufficient. Let Adams, Brown, and Clark be A, B, and C respectively. Let V be the victim. Let I (A) be the proposition that A is innocent, I (B) the proposition that B is innocent, and I (C) the proposition that C is innocent. Let F (A, V) indicate that A is a friend (acquaintance) of V and L (A,V) indicate that A liked V. Let W (A,V) be the proposition that A was with V on the day of the murder and W (B,V) the proposition that B was with V on that day. Let T (B) be the proposition that B was in town on the day of the murder. Let K (B,V) be the proposition that B knows V. Here are the rules. 1. If A was innocent, then B was V s friend and C did not like V, just as A said. 1.1. I(A) F (B,V) 1.2. I(A) L (C,V) 2. If B was innocent, then he wasn t in town and he doesn t know V 2.1. I(B) T(B) 2.2. I(B) K(B, V) 3. If C was innocent, then A was with V and B was with V 3.1. I(C) W (A,V) 3.2. I(C) W (B,V) 4. Now some general knowledge rules in our KB 1 4.1. W (B,V) T (B) 4.2. F (B,V) K (B,V) 4.3. L (C,V) K (C,V) 5. Now we assert that only one of A, B, and C is the guilty person 5.1. I (A) Ι (Β) 5.2. I (A) Ι (C) 5.3. I (B) Ι (C) Converting to CNF form leads to the first twelve clauses shown below. Let us say we want to prove that Ι (Β) (B did it). We assert the negation I (B) and perform resolution. This is the clause 13 below 1. { Ι (Α), F (B, V)} 2. { Ι (Α), L (C, V)} 3. { Ι (Β), T (B)} 1 Of course these are first order statements of the form x,y L(x, y) K(x, y), etc. But for the purpose of this puzzle, we can instantiate them with the specific objects (A, B, C) to make them propositional and use propositional resolution to solve the puzzle.

So B did it. 4. { Ι (Β), Κ (Β, V)} 5. { Ι (C), W (A, V)} 6. { Ι (C), W (B, V)} 7. { W (B, V), T (B)} 8. { F (B, V), K (B, V)} 9. { L (C, V), K (C, V)} 10. { I (A), I (B)} 11. { I (A), I (C)} 12. { I (B), I (C)} 13. {I (B)} 14. { Ι (Α), Κ (Β, V)} -- RESOLVING Clauses 1 and 8 15. { Ι (C), Τ (Β)} -- RESOLVING Clauses 6 and 7 16. { Ι (Α), Ι (Β)} -- RESOLVING 4 and 14 17. { Ι (C), Ι (Β)} -- RESOLVING 3 and 15 18. {Ι (C), Ι (Β)} -- RESOLVING 11 and 16 19. { Ι (B)} RESOLVING 17 and 18 20. {} RESOLVING 13 and 19. Q5. First Order Logic (Translation for FOL to Natural Language) (2 points) Translate the following FOL sentences into colloquial English. You may assume the obvious meanings of all constants. 1. x Hesitates(x) Lost (x) Anyone (well, He) who hesitates is lost. 2. x Business(x) Like(x, Showbusiness) There is no business like Showbusiness. 3. x Glitters (x) Gold(x) Not everything that glitters is gold. 4. x Mushroom(x) ( z (z = x) Mushroom (z)) There is exactly one mushroom. Q6. First Order Logic (Translation from Natural Language) (3 points) Translate the following sentences. Use the following vocabulary. Male (x) means that the object denoted by x is male. Female (x) means that the object denoted by x is female. Vegetarian (x) means that x is vegetarian. Butcher (x) means that x is a butcher. Like (x, y) means that x likes y. 1. No man is both a butcher and a vegetarian. x Male (x) Butcher (x) Vegetarian (x) 2. All men except butchers like vegetarians.

x y Male (x) Butcher (x) Vegetarian (y) Likes (x, y) 3. The only vegetarian butchers are women. x Vegetarian (x) Butcher (x) Female (x) 4. No man likes a woman who is vegetarian. x y Male (x) Female (y) Vegetarian (y) Likes (x, y) 5. No woman likes a man who does not like all vegetarians. x y z Female (x) Male (y) Vegetarian (z) Likes (y, z) Likes (x, y)