CS 4700: Artificial Intelligence

Similar documents
CS 4700: Artificial Intelligence

EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS

Intelligent Agents. Pınar Yolum Utrecht University

Title: Logical Agents AIMA: Chapter 7 (Sections 7.4 and 7.5)

Lecture 9: Search 8. Victor R. Lesser. CMPSCI 683 Fall 2010

COMP9414: Artificial Intelligence Propositional Logic: Automated Reasoning

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Inference in first-order logic

Introduction to Artificial Intelligence. Logical Agents

Proof Methods for Propositional Logic

Logical Agents. Chapter 7

CS 771 Artificial Intelligence. Propositional Logic

COMP219: Artificial Intelligence. Lecture 20: Propositional Reasoning

Class Assignment Strategies

CSC384: Intro to Artificial Intelligence Knowledge Representation II. Required Readings: 9.1, 9.2, and 9.5 Announcements:

Artificial Intelligence Chapter 7: Logical Agents


Advanced Topics in LP and FP

Chapter 7 R&N ICS 271 Fall 2017 Kalev Kask

CS 380: ARTIFICIAL INTELLIGENCE PREDICATE LOGICS. Santiago Ontañón

CS 380: ARTIFICIAL INTELLIGENCE

Logic. Knowledge Representation & Reasoning Mechanisms. Logic. Propositional Logic Predicate Logic (predicate Calculus) Automated Reasoning

The Wumpus Game. Stench Gold. Start. Cao Hoang Tru CSE Faculty - HCMUT

Kecerdasan Buatan M. Ali Fauzi

Logical Agents (I) Instructor: Tsung-Che Chiang

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence

Inference Methods In Propositional Logic

Logic Programming (PLP 11) Predicate Calculus, Horn Clauses, Clocksin-Mellish Procedure

Logical Inference. Artificial Intelligence. Topic 12. Reading: Russell and Norvig, Chapter 7, Section 5

CS 188: Artificial Intelligence Spring 2007

Agenda. Artificial Intelligence. Reasoning in the Wumpus World. The Wumpus World

Foundations of Artificial Intelligence

Propositional Logic: Methods of Proof. Chapter 7, Part II

Propositional Logic: Methods of Proof (Part II)

CS:4420 Artificial Intelligence

Inference Methods In Propositional Logic

An Early (1971) Conversation. Logic Programming (PLP 11.3) Horn Clauses Introduction to Prolog: Resolution, Unification.

Logical Agents. Outline

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

Predicate Logic: Sematics Part 1

Tautologies, Contradictions, and Contingencies

Logic and Inferences

CS 730/730W/830: Intro AI

CS 730/830: Intro AI. 3 handouts: slides, asst 6, asst 7. Wheeler Ruml (UNH) Lecture 12, CS / 16. Reasoning.

Logic: Propositional Logic (Part I)

Outline First-order logic. First-order Logic. Introduction. Recall: 4-Queens problem. First-order Logic. First-order Logic Syntax.

Lecture 10: Even more on predicate logic" Prerequisites for lifted inference: Skolemization and Unification" Inference in predicate logic"

Logic in AI Chapter 7. Mausam (Based on slides of Dan Weld, Stuart Russell, Dieter Fox, Henry Kautz )

Propositional logic II.

Artificial Intelligence

Self-assessment due: Monday 3/18/2019 at 11:59pm (submit via Gradescope)

Agents that reason logically

Propositional Logic: Methods of Proof (Part II)

Revised by Hankui Zhuo, March 21, Logical agents. Chapter 7. Chapter 7 1

Logical Agents. Santa Clara University

Artificial Intelligence

cse 311: foundations of computing Fall 2015 Lecture 6: Predicate Logic, Logical Inference

Logic in AI Chapter 7. Mausam (Based on slides of Dan Weld, Stuart Russell, Subbarao Kambhampati, Dieter Fox, Henry Kautz )

Logic. proof and truth syntacs and semantics. Peter Antal

Propositional Logic. Logic. Propositional Logic Syntax. Propositional Logic

7 LOGICAL AGENTS. OHJ-2556 Artificial Intelligence, Spring OHJ-2556 Artificial Intelligence, Spring

Propositional Calculus: Formula Simplification, Essential Laws, Normal Forms

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

TDT4136 Logic and Reasoning Systems

Inference in first-order logic

7. Logical Agents. COMP9414/ 9814/ 3411: Artificial Intelligence. Outline. Knowledge base. Models and Planning. Russell & Norvig, Chapter 7.

1.1 Language and Logic

Introduction to Artificial Intelligence Propositional Logic & SAT Solving. UIUC CS 440 / ECE 448 Professor: Eyal Amir Spring Semester 2010

Logical agents. Chapter 7. Chapter 7 1

Logical Agent & Propositional Logic

Propositional Logic: Models and Proofs

Logical Agent & Propositional Logic

Logical Agents. Chapter 7

Inf2D 06: Logical Agents: Knowledge Bases and the Wumpus World

The Calculus of Computation: Decision Procedures with Applications to Verification. Part I: FOUNDATIONS. by Aaron Bradley Zohar Manna

Propositional Logic Basics Propositional Equivalences Normal forms Boolean functions and digital circuits. Propositional Logic.

Propositions. c D. Poole and A. Mackworth 2010 Artificial Intelligence, Lecture 5.1, Page 1

INF5390 Kunstig intelligens. Logical Agents. Roar Fjellheim

Deliberative Agents Knowledge Representation I. Deliberative Agents

Inference in Propositional Logic

3. The Logic of Quantified Statements Summary. Aaron Tan August 2017

Logical Agents. Soleymani. Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter 7

Logical Agents. Course material: Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter 7

Outline. Logical Agents. Logical Reasoning. Knowledge Representation. Logical reasoning Propositional Logic Wumpus World Inference

Description Logics. Foundations of Propositional Logic. franconi. Enrico Franconi

AI Programming CS S-09 Knowledge Representation

Foundations of Artificial Intelligence

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

Logic: First Order Logic

Propositional Logic Part 1

Propositional Logic: Bottom-Up Proofs

Knowledge-based Agents. CS 331: Artificial Intelligence Propositional Logic I. Knowledge-based Agents. Outline. Knowledge-based Agents

CS 331: Artificial Intelligence Propositional Logic I. Knowledge-based Agents

CS 4700: Foundations of Artificial Intelligence

Logical Agents: Propositional Logic. Chapter 7

Introduction to Intelligent Systems

Introduction to Intelligent Systems

Announcements. CS311H: Discrete Mathematics. Propositional Logic II. Inverse of an Implication. Converse of a Implication

7.5.2 Proof by Resolution

Transcription:

CS 4700: Foundations of Artificial Intelligence Fall 2017 Instructor: Prof. Haym Hirsh Lecture 14

Today Knowledge Representation and Reasoning (R&N Ch 7-9) Prelim, Statler Auditorium Tuesday, March 21 Thursday, March 23 Knowledge Representation and Reasoning (R&N Ch 8-9)

Resolution Example: Rules KB: P Q L M P B L M A P L A B L A B KB P Q?

Resolution Example: Rules KB: P Q L M P B L M A P L A B L A B KB P Q? Is the following CNF unsatisfiable? ( P Q) ( L M P) ( B L M) ( A P L) ( A B L) A B ( P Q)

Horn Clause Logic KB: P Q L M P B L M A P L A B L A B KB P Q? Is the following CNF unsatisfiable? ( P Q) ( L M P) ( B L M) ( A P L) ( A B L) A B ( P Q)

Horn Clause Logic Horn clauses: A sentence in CNF where each clause (disjunction) has at most one unnegated literal Typically arises when KB is a set of implications whose antecedents are conjunctions of unnegated literals Inference methods: Forward chaining: Start from unnegated literal facts, add new facts from rules whose antecedents are true, apply recursively

Horn Clause Logic Forward chaining example: A [6] B [7] KB: 1. P Q 2. L M P 3. B L M 4. A P L 5. A B L 6. A 7. B

Horn Clause Logic Forward chaining example: A [6] B [7] L [5] KB: 1. P Q 2. L M P 3. B L M 4. A P L 5. A B L 6. A 7. B

Horn Clause Logic Forward chaining example: A [6] B [7] L [5] M [3] KB: 1. P Q 2. L M P 3. B L M 4. A P L 5. A B L 6. A 7. B

Horn Clause Logic Forward chaining example: A [6] B [7] L [5] M [3] P [2] KB: 1. P Q 2. L M P 3. B L M 4. A P L 5. A B L 6. A 7. B

Horn Clause Logic Forward chaining example: A [6] B [7] L [5] M [3] P [2] Q [1] KB: 1. P Q 2. L M P 3. B L M 4. A P L 5. A B L 6. A 7. B

Horn Clause Logic Which facts to combine with which rules? This is a search problem: States: Sets of facts Operators: The set of rules If the given state contains all the facts necessary for a rule, add the rule s consequence to the set of facts to create a new state Initial state: Starting facts Goal: One or more facts that are being asked about

Horn Clause Logic Example: Initial state: {A,B} Operators: {A B L, A P L, } Result of applying A B L to initial state: {A,B,L} Goal state: A state containing P and Q

Horn Clause Logic Horn clauses: A sentence in CNF where each clause (disjunction) has at most one unnegated literal Typically arises when KB is a set of implications whose antecedents are conjunctions of unnegated literals Inference methods: Forward chaining: Start from unnegated literal facts, add new facts from rules whose antecedents are true, apply recursively

Horn Clause Logic Horn clauses: A sentence in CNF where each clause (disjunction) has at most one unnegated literal Typically arises when KB is a set of implications whose antecedents are conjunctions of unnegated literals Inference methods: Forward chaining: Start from unnegated literal facts, add new facts from rules whose antecedents are true, apply recursively Backward chaining: Start from goal, find rule that concludes it, apply recursively to antecedents (this is the core of what the Prolog programming language does)

Horn Clause Logic Horn clauses: A sentence in CNF where each clause (disjunction) has at most one unnegated literal Typically arises when KB is a set of implications whose antecedents are conjunctions of unnegated literals Inference methods: Forward chaining: Start from unnegated literal facts, add new facts from rules whose antecedents are true, apply recursively Backward chaining: Start from goal, find rule that concludes it, apply recursively to antecedents (this is the core of what the Prolog programming language does) There is a linear time algorithm for satisfiability of Horn clauses

Satisfiability At one extreme: Tautology: Sentence is true no matter what truth assignments are given to the propositional variables At the other extreme: Unsatisfiable: The sentence is never true no matter what truth assignments are given to the propositional variables Satisfiability: Is the sentence true for any truth assignment? What truth assignment makes the sentence true?

Example: N-Queens Encode in propositional logic Qij: There is a queen in position (i,j) One queen in each row, column, diagonal: (Qi1 Qi2 QiN) for i {1,,N} (Q1j Q2j QNj) for i {1,,N} (Q11 Q22 QNN) etc. for each diagonal No two attacking queens: (Qab Qac) for all b c (Qab Qdb) for all a d (Qij Qkl) for all k=i m, l=j m, m 0 (Qij Qkl) for all i+j = k+l, i k

Example: N-Queens Unsatisfiable: Means there is no placement of the queens (N=2, 3) Satisfiable: Means there is a placement of the queens (N > 3) Don t just want to be told there is a placement, want an actual placement!

Searching for Truth Assignments Brute-force search: Assign a variable True or False Is any clause violated? If not, go on to another variable If yes, backtrack to most recent variable assignment and flip it If both options have been tried and failed, backtrack to the next most recent assignment Complete Davis-Putnam: Backtracking exploiting some additional observations that simplify the problem in certain cases Further efficiency: Grab bag of clever ideas

Searching for Truth Assignments Hill climbing: Surprisingly effective Pick random assignment If it doesn t satisfy the sentence, flip whichever one most increases the number of satisfied terms and repeat If there are none, restart

First Order Logic Sentence AtomicSentence ComplexSentence AtomicSentence Predicate Predicate(Arguments) Term = Term Arguments Term Term,Arguments Term Function(Arguments) Constant Variable ComplexSentence (Sentence) [Sentence] Sentence Sentence Sentence Sentence Sentence Sentence Sentence Quantifiers Sentence Quantifiers Quantifier Variables Quantifier Variables Quantifiers Quantifier Constant/Predicate/Function <strings starting with upper case letters> Variables Variable Variable,Variables Variable <strings comprised of lower case letters>

Examples Mother(Alice,Charlie) Father(Bob,Charlie)

Examples Mother(Alice,Charlie) Father(Bob,Charlie) x,y Mother(x,y) Parent(x,y) x,y Father(x,y) Parent(x,y)

Examples Mother(Alice,Charlie) Father(Bob,Charlie) x,y Mother(x,y) Parent(x,y) x,y Father(x,y) Parent(x,y) x,y Parent(x,y) Ancestor(x,y)

Examples Mother(Alice,Charlie) Father(Bob,Charlie) x,y Mother(x,y) Parent(x,y) x,y Father(x,y) Parent(x,y) x,y Parent(x,y) Ancestor(x,y) x,y,z Ancestor(x,y) Ancestor(y,z) Ancestor(x,z)

Examples Mother(Alice,Charlie) Father(Bob,Charlie) x,y Mother(x,y) Parent(x,y) x,y Father(x,y) Parent(x,y) x,y Parent(x,y) Ancestor(x,y) x,y,z Ancestor(x,y) Ancestor(y,z) Ancestor(x,z) x y Mother(y,x) x y Father(y,x)

Examples Mother(Alice,Charlie) Father(Bob,Charlie) x,y Mother(x,y) Parent(x,y) x,y Father(x,y) Parent(x,y) x,y Parent(x,y) Ancestor(x,y) x,y,z Ancestor(x,y) Ancestor(y,z) Ancestor(x,z) x y Mother(y,x) x y Father(y,x) x y Mother(x,y)

Inference in First Order Logic First-order Horn clauses are an analogous subset of first-order logic They have analogs of forward chaining and backward chaining Prolog is a programming language based on backward chaining on first-order Horn clauses There is a conjunctive normal form for First-Order Logic There is a resolution inference rule for First-Order Logic

CNF Replace α β with α β everywhere [no more ] Replace (α β) with α β [push inward until Replace (α β) with α β you can t any more] Replace α with α [ only before prop symbols] Distribute over : Rewrite α (β γ) as (α β) (α γ)

CNF Replace α β with α β everywhere Replace (α β) with α β Replace (α β) with α β Replace α with α Distribute over : Rewrite α (β γ) as (α β) (α γ)

CNF Replace α β with α β everywhere Replace (α β) with α β Replace (α β) with α β Replace α with α Distribute over : Rewrite α (β γ) as (α β) (α γ)

CNF Replace α β with α β everywhere Replace (α β) with α β Replace (α β) with α β Replace α with α Replace x with x Replace x with x Distribute over : Rewrite α (β γ) as (α β) (α γ)

CNF Replace α β with α β everywhere Replace (α β) with α β Replace (α β) with α β Replace α with α Replace x with x Replace x with x Distribute over : Rewrite α (β γ) as (α β) (α γ)

CNF Replace α β with α β everywhere Replace (α β) with α β Replace (α β) with α β Replace α with α Replace x with x Replace x with x Standardize variables: If the same variable name is used in multiple places with multiple quantifiers, rename them so there is no duplication x P(x) x Q(x) becomes x P(x) z Q(z) [where z is new] Distribute over : Rewrite α (β γ) as (α β) (α γ)

CNF Replace α β with α β everywhere Replace (α β) with α β Replace (α β) with α β Replace α with α Replace x with x Replace x with x Standardize variables: If the same variable name is used in multiple places with multiple quantifiers, rename them so there is no duplication x P(x) x Q(x) becomes x P(x) z Q(z) [where z is new] Distribute over : Rewrite α (β γ) as (α β) (α γ)

CNF Replace α β with α β everywhere Replace (α β) with α β Replace (α β) with α β Replace α with α Replace x with x Replace x with x Standardize variables: If the same variable name is used in multiple places with multiple quantifiers, rename them so there is no duplication x P(x) x Q(x) becomes x P(x) z Q(z) [where z is new] Skolemization Distribute over : Rewrite α (β γ) as (α β) (α γ)

CNF Replace α β with α β everywhere Replace (α β) with α β Replace (α β) with α β Replace α with α Replace x with x Replace x with x Standardize variables: If the same variable name is used in multiple places with multiple quantifiers, rename them so there is no duplication x P(x) x Q(x) becomes x P(x) z Q(z) [where z is new] Skolemization Distribute over : Rewrite α (β γ) as (α β) (α γ)

CNF Replace α β with α β everywhere Replace (α β) with α β Replace (α β) with α β Replace α with α Replace x with x Replace x with x Standardize variables: If the same variable name is used in multiple places with multiple quantifiers, rename them so there is no duplication x P(x) x Q(x) becomes x P(x) z Q(z) [where z is new] Skolemization Drop universal quantifiers Distribute over : Rewrite α (β γ) as (α β) (α γ)

Skolemization x P(x) becomes P(A) where A is a constant that is new

Skolemization x P(x) becomes P(A) where A is a new constant x,y z P(z) becomes P(F(x,y)) where F is a new function

Skolemization x P(x) becomes P(A) where A is a new constant x,y z P(z) becomes P(F(x,y)) where F is a new function Replace existentially quantified variables with Skolem functions new functions whose arguments are all universally quantified variables of higher scope

Resolution in First Order Logic Recall: (l α 1 α k ) where each α i and β j are propositional ( l β 1 β n ) symbols or their negations and l is a (α 1 α k β 1 β n ) propositional symbol

Resolution in First Order Logic Here: (l α 1 α k ) [l and l can be made identical by ( l β 1 β n ) substituting variables with terms] Subst(ѳ, α 1 α k β 1 β n ) [the necessary substitution] where ѳ = Unify(l, l )