Predicate Logic Terms represent specific objects in the world and can be constants, variables or functions. Predicate Symbols refer to a particular relation.

Slides:



Advertisements
Similar presentations
CS4026 Formal Models of Computation Part II The Logic Model Lecture 1 – Programming in Logic.
Advertisements

First-Order Logic.
Biointelligence Lab School of Computer Sci. & Eng.
Inference Rules Universal Instantiation Existential Generalization
1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 06 : First Order Logic Resolution Prove.
Standard Logical Equivalences
Resolution.
First Order Logic Resolution
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
Logic Use mathematical deduction to derive new knowledge.
Resolution
13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution.
Chapter 6 Logical Reasoning Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
Automated reasoning and theorem proving Introduction: logic in AI Automated reasoning: ResolutionUnificationNormalization.
Using Predicate Logic Chapter 5.
Propositional Calculus A propositional calculus formula is composed of atomic propositions, which area simply statements that are either true or false.
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
AI - Week 16 Logic and Reasoning in AI: Resolution Refutation Lee McCluskey, room 2/07
1 Automated Reasoning Introduction to Weak Methods in Theorem Proving 13.1The General Problem Solver and Difference Tables 13.2Resolution Theorem.
Inference and Resolution for Problem Solving
Propositional Calculus Knowledge based agent Knowledge is contained in agents in the form of sentences in a knowledge representation language stored in.
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
UBI517 Expert Systems 1 Lecture 2 Knowledge Representation.
Automated reasoning and theorem proving Introduction: logic in AI Automated reasoning: ResolutionUnificationNormalization.
Inference in First-Order logic Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
For Wednesday Read chapter 10 Prolog Handout 4. Exam 1 Monday Take home due at the exam.
SAT-solving Introduction: logic in AI SAT-solving techniques: Unit-propagationLocal-search.
UNIVERSITI TENAGA NASIONAL 1 CSNB234 ARTIFICIAL INTELLIGENCE Chapter 3 Propositional Logic & Predicate Logic Chapter 3 Propositional Logic & Predicate.
Conjunctive normal form: any formula of the predicate calculus can be transformed into a conjunctive normal form. Def. A formula is said to be in conjunctive.
1 Chapter 8 Inference and Resolution for Problem Solving.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Logical Representations and Resolution. Boolean Logic Conjunctive normal form Resolution.
CSE S. Tanimoto Horn Clauses and Unification 1 Horn Clauses and Unification Propositional Logic Clauses Resolution Predicate Logic Horn Clauses.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Dr. Muhammed Al-Mulhem ICS An Introduction to Logical Programming.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Prolog Conversion to clause form Reference: Artificial Intelligence, by Elaine Rich and Kevin Knight.
For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9.
Reasoning using First-Order Logic
Propositional Logic Predicate Logic
第 1 6 章 谓词演算中的归结. 2 Outline Unification Predicate-Calculus Resolution Completeness and Soundness Converting Arbitrary wffs to Clause Form Using Resolution.
For Friday Read chapter 8 Homework: –Chapter 7, exercises 2 and 10 Program 1, Milestone 2 due.
For Wednesday Finish reading chapter 10 – can skip chapter 8 No written homework.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 11 Jim Martin.
MB: 26 Feb 2001CS Lecture 11 Introduction Reading: Read Chapter 1 of Bratko Programming in Logic: Prolog.
1 Example: The following knowledge is given :The following knowledge is given : 1. Marcus was a man. 2. Marcus was a Pompeian. 3. All Pompeians were Romans.
CIT 856 – Artificial Intelligence
1-1 An Introduction to Logical Programming Sept
Converting arbitrary wffs to CNF A wff is in prenex form iff it consists of a string of quantifiers (called a prefix) followed by a quantifier free formula.
Chapter 3 Propositional calculus Predicate calculus Artificial Intelligence Dr.Hassan Al-Tarawneh.
Conversion to Conjunctive Normal Form. Assertion All Romans who know Marcus either hate Caesar or think than anyone who hates anyone is crazy. All Romans.
CSE 341, S. Tanimoto Logic Programming -
Automated reasoning and theorem proving
A I (Artificial Intelligence)
Predicate Logic Lecture 7.
Horn Clauses and Unification
Inference in First-Order Logic Chapter 9
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
Horn Clauses and Unification
Prolog IV Logic, condensed.
Horn Clauses and Unification
Horn Clauses and Unification
Horn Clauses and Unification
CSNB234 ARTIFICIAL INTELLIGENCE
RESOLUTION.
Teorie assiomatico-deduttive (calcolo dei predicati)
Presentation transcript:

Predicate Logic Terms represent specific objects in the world and can be constants, variables or functions. Predicate Symbols refer to a particular relation among objects. Sentences represent facts, and are made of of terms, quantifiers and predicate symbols.

Predicate Logic Functions allow us to refer to objects indirectly (via some relationship). Quantifiers and variables allow us to refer to a collection of objects without explicitly naming each object.

Some Examples Predicates: Brother, Sister, Mother , Father Objects: Bill, Hillary, Chelsea, Roger Facts expressed as atomic sentences a.k.a. literals: Father(Bill,Chelsea) Mother(Hillary,Chelsea) Brother(Bill,Roger)  Father(Bill,Chelsea)

Variables and Universal Quantification Universal Quantification allows us to make a statement about a collection of objects: x Cat(x)  Mammel(x) All cats are mammels  x Father(Bill,x)  Mother(Hillary,x) All of Bill’s kids are also Hillary’s kids. “For All”

Variables and Existential Quantification Existential Quantification allows us to state that an object does exist (without naming it): x Cat(x)  Mean(x) There is a mean cat.  x Father(Bill,x)  Mother(Hillary,x) There is a kid whose father is Bill and whose mother is Hillary “There exists”

Nested Quantification  x,y Parent(x,y)  Child(y,x)  x  y Loves(x,y)  x [Passtest(x)  ( x ShootDave(x))]

fatherof(x) age(x) times(x,y) succ(x) Functions Functions are terms - they refer to a specific object. We can use functions to symbolically refer to objects without naming them. Examples: fatherof(x) age(x) times(x,y) succ(x)

Using functions  x Equal(x,x) Equal(factorial(0),1)  x Equal(factorial(s(x)), times(s(x),factorial(x)))

Representing facts with Predicate Logic - Example Marcus was a man Marcus was a Pompeian All Pompeians were Romans Caesar was a ruler. All Romans were either loyal to Caesar or hated him. Everyone is loyal to someone. Men only try to assassinate rulers they are not loyal to. Marcus tried to assassinate Caesar

Predicate Logic Knowledgebase Man(Marcus) Pompeian(Marcus)  x Pompeian(x)  Roman(x) Ruler(Caesar)  x Romans(x)  Loyalto(x,Caesar)  Hate(x,Caesar)  x  y Loyalto(x,y)  x  y Man(x)  Ruler(y)  Tryassassinate(x,y)  Loyalto(x,y) Tryassassinate(Marcus,Caesar)

Was Marcus loyal to Caesar? Questions (Goals) Was Marcus a Roman? Was Marcus loyal to Caesar? Who was Marcus loyal to? Was Marcus a ruler? Will the test be easy?

Isa and Instance relationships The example uses inheritance without explicitly having isa or instance predicates. We could rewrite the facts using isa and instance explicitly: instance(Marcus,man) instance(Marcus,Pompeian) isa(Pompeian,Roman)

Father(x,y) Mother(x,y) Brother(x,y) Sister(x,y) Quiz Using the predicates: Father(x,y) Mother(x,y) Brother(x,y) Sister(x,y) Construct predicate logic facts that establish the following relationships: GrandParent GrandFather GrandMother Uncle Cousin

Proof procedure for Predicate Logic Same idea, but a few added complexities: conversion to CNF is much more complex. Matching of literals requires providing a matching of variables, constants and/or functions.  Skates(x)  LikesHockey(x)  LikesHockey(y) We can resolve these only if we assume x and y refer to the same object.

Predicate Logic and CNF Converting to CNF is harder - we need to worry about variables and quantifiers. 1. Eliminate all implications  2. Reduce the scope of all  to single term. * 3. Make all variable names unique 4. Move Quantifiers Left * 5. Eliminate Existential Quantifiers * 6. Eliminate Universal Quantifiers * 7. Convert to conjunction of disjuncts 8. Create separate clause for each conjunct.

Eliminate Existential Quantifiers Any variable that is existentially quantified means we are saying there is some value for that variable that makes the expression true. To eliminate the quantifier, we can replace the variable with a function. We don’t know what the function is, we just know it exists.

Skolem functions  y President(y) We replace y with a new function func: President(func()) func is called a skolem function. In general the function must have the same number of arguments as the number of universal quantifiers in the current scope.

Skolemization Example x y Father(y,x) create a new function named foo and replace y with the function.  x Father(foo(x),x)

Predicate Logic Resolution We have to worry about the arguments to predicates, so it is harder to know when 2 literals match and can be used by resolution. For example, does the literal Father(Bill,Chelsea) match Father(x,y) ? The answer depends on how we substitute values for variables.

Unification The process of finding a substitution for predicate parameters is called unification. We need to know: that 2 literals can be matched. the substitution is that makes the literals identical. There is a simple algorithm called the unification algorithm that does this.

The Unification Algorithm 1. Initial predicate symbols must match. 2. For each pair of predicate arguments: different constants cannot match. a variable may be replaced by a constant. a variable may be replaced by another variable. a variable may be replaced by a function as long as the function does not contain an instance of the variable.

Unification Algorithm When attempting to match 2 literals, all substitutions must be made to the entire literal. There may be many substitutions that unify 2 literals, the most general unifier is always desired.

Unification Example P(x) and P(y): substitution = (x/y) “substitute x for y” P(x) and P(y): substitution = (x/y) P(x,x) and P(y,z): (z/y)(y/x) P(x,f(y)) and P(Joe,z): (Joe/x, f(y)/z) P(f(x)) and P(x): can’t do it! P(x)  Q(Jane) and P(Bill)  Q(y): (Bill/x, Jane/y) y for x, then z for y

Unification & Resolution Examples Father(Bill,Chelsea)  Father(Bill,x)Mother(Hillary,x) Man(Marcus)  Man(x)  Mortal(x) Loves(father(a),a)  Loves(x,y)  Loves(y,x) This is a function

Predicate Logic Resolution Algorithm While no empty clause exists and there are clauses that can be resolved: select 2 clauses that can be resolved. resolve the clauses (after unification), apply the unification substitution to the result and store in the knowledge base.

Example:  Skates(z)  LikesHockey(z) Smart(Joe) Skates(Joe)  Smart(x)   LikesHockey(x)  RPI(x)  Canadian(y)  LikesHockey(y)  Skates(z)  LikesHockey(z) Smart(Joe) Skates(Joe) Goal is to find out if RPI(Joe) is true.

 Pompeian(x1)  Roman(x1) Man(Marcus) Pompeian(Marcus)  Pompeian(x1)  Roman(x1) Ruler(Caesar)  Romans(x2)  Loyalto(x2,Caesar)  Hate(x2,Caesar) Loyalto(x3 , f(x3))  Man(x4)   Ruler(y1)   Tryassassinate(x4,y1)  Loyalto(x4,y1) PROVE: Tryassassinate(Marcus,Caesar)

Answering Questions We can also use the proof procedure to answer questions such as “who tried to assassinate Caesar” by proving: Tryassassinate(y,Caesar). Once the proof is complete we need to find out what was substitution was made for y.

Computation Equal(y,y) Equal(factorial(s(x)),times(s(x),factorial(x))) s(x) is the integer successor function Equal(y,y) Equal(factorial(s(x)),times(s(x),factorial(x))) …assume s(_) and times(_,_) can compute. We can ask for 10!: Equal(factorial(10),z)

Test Type Question The members of a bridge club are Joe, Sally, Bill and Ellen. Joe is married to Sally. Bill is Ellen’s Brother. The spouse of every married person in the club is also in the club. The last meeting of the club was at Joe’s house Was the last meeting at Sally’s house? Is Ellen married?

Logic Programming - Prolog Prolog is a declarative programming language based on logic. A Prolog program is a list of facts. There are various predicates and functions supplied to support I/O, graphics, etc. Instead of CNF, prolog uses an implicative normal form: A  B  ...  C D

Prolog Example - Towers of Hanoi hanoi(N) :- move(N,left,middle,right). move(1,A,_,C) :- inform(A,C),!. move(N,A,B,C) :- N1=N-1, move(N1,A,C,B), inform(A,C), move(N1,B,A,C). inform(Loc1,Loc2) :- write(“Move disk from”,Loc1,” to”, Loc2). hanoi(3)