Lecture 4: January 12, 2015

Similar documents
Lecture 7: January 15, 2014

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

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

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

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

COMP4418 Knowledge Representation and Reasoning

THE PREDICATE CALCULUS

Logic Languages. Hwansoo Han

Introduction to Logic Programming

What is a Logic Program. Introduction to Logic Programming. Introductory Examples. Introductory Examples. Foundations, First-Order Language

What is the study of logic?

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

Automated Reasoning Systems

Lecture 1: Conjunctive Queries

Knowledge Representation and Reasoning Logics for Artificial Intelligence

Logical reasoning systems

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

Chapter 2 & 3: Representations & Reasoning Systems (2.2)

Logic Programming and Resolution Lecture notes for INF3170/4171

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

Declarative Programming. 2: theoretical backgrounds

Constraint Solving. Systems and Internet Infrastructure Security

Full Clausal Logic - Syntax: clauses

Advanced Logic and Functional Programming

CS 321 Programming Languages and Compilers. Prolog

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

Logic (or Declarative) Programming Foundations: Prolog. Overview [1]

Propositional Logic. Part I

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

Automatic Reasoning (Section 8.3)

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

First-Order Logic PREDICATE LOGIC. Syntax. Terms

CS 4700: Artificial Intelligence

First Order Predicate Logic CIS 32

Towards a Logical Reconstruction of Relational Database Theory

Knowledge Representation and Reasoning Logics for Artificial Intelligence

Prolog. Reading: Sethi, Chapter 11. Overview. Predicate Calculus. Substitution and Unication. Introduction to Prolog. Prolog Inference Rules

Lecture 11: Feb. 10, 2016

Going beyond propositional logic

Programming Languages Third Edition

6. Inference and resolution

First-Order Logic (FOL)

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

Automated Reasoning. Natural Deduction in First-Order Logic

Logic and its Applications

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

Logic as a Programming Language

Knowledge Representation

The Logic Paradigm. Joseph Spring. 7COM1023 Programming Paradigms

Part I Logic programming paradigm

X-KIF New Knowledge Modeling Language

Database Theory VU , SS Introduction to Datalog. Reinhard Pichler. Institute of Logic and Computation DBAI Group TU Wien

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Formal Predicate Calculus. Michael Meyling

Software Paradigms (Lesson 6) Logic Programming

Logic Programming Languages

CS 561: Artificial Intelligence

COMP219: Artificial Intelligence. Lecture 14: Knowledge Representation

Quantification. Using the suggested notation, symbolize the statements expressed by the following sentences.

Implementação de Linguagens 2016/2017

Prolog Programming. Lecture Module 8

Chapter 1.3 Quantifiers, Predicates, and Validity. Reading: 1.3 Next Class: 1.4. Motivation

7. Relational Calculus (Part I) 7.1 Introduction

Diagonalization. The cardinality of a finite set is easy to grasp: {1,3,4} = 3. But what about infinite sets?

Automata Theory for Reasoning about Actions

Propositional Logic. Andreas Klappenecker

Data Integration: Logic Query Languages

Notes. Notes. Introduction. Notes. Propositional Functions. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry.

Typed Lambda Calculus for Syntacticians

6.034 Notes: Section 11.1

1. Logic as a subject matter is the study of logics, understood as models of acceptable inference patterns

Chapter 16. Logic Programming Languages

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

Range Restriction for General Formulas

PdOd Kev Events I Re-world war I1 rwa

COMP2411 Lecture 20: Logic Programming Examples. (This material not in the book)

STABILITY AND PARADOX IN ALGORITHMIC LOGIC

CITS2211 Discrete Structures Logic

Typed Lambda Calculus

Chapter 3: Propositional Languages

Chapter 9: Constraint Logic Programming

The discussion of Chapter 1 will be split into two sessions; the first will cover 1.1 and 1.2; the second will cover 1.3, 1.4, and 1.5.

INF5390 Kunstig intelligens. First-Order Logic. Roar Fjellheim

Efficient Two-Phase Data Reasoning for Description Logics

SOFTWARE ENGINEERING DESIGN I

15-780: Graduate AI Lecture 2. Proofs & FOL. Geoff Gordon (this lecture) Tuomas Sandholm TAs Byron Boots, Sam Ganzfried

Logic Programming. Let us have airline flight information of the form: 1. Application Domains: 2. Definitions

Fundamentals of Prolog

Introduction to Prolog

Introduction to predicate calculus

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

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

What is all the Fuzz about?

CS221 / Autumn 2017 / Liang & Ermon. Lecture 17: Logic II

Chapter 16. Logic Programming Languages ISBN

Chapter 24. Active Database Concepts and Triggers. Outline. Trigger Example. Event-Condition-Action (ECA) Model

First Order Logic and Resolution

Name: CSCI E-220: Artificial Intelligence Midterm Exam, Fall Term 2001

Lecture 5. Logic I. Statement Logic

Recap Datalog Datalog Syntax Datalog Semantics. Logic: Datalog. CPSC 322 Logic 6. Textbook Logic: Datalog CPSC 322 Logic 6, Slide 1

Transcription:

32002: AI (First Order Predicate Logic, Interpretation and Inferences) Spring 2015 Lecturer: K.R. Chowdhary Lecture 4: January 12, 2015 : Professor of CS (VF) Disclaimer: These notes have not been subjected to the usual scrutiny reserved for formal publications. They may be distributed outside this class only with the permission of the Instructor. 4.1 First Order Predicate Logic First-order logic is best suited as a basic theoretical instrument of a computer theorem proving program. From the theoretical point of view, however, an inference principle need only be sound (i.e., allow only logical consequences of premises to be deduced from them) and effective (i.e., it must be algorithmically decidable whether an alleged application of the inference principle is indeed an application of it). The resolution principle is machine-oriented rather than human-oriented. The resolution principle is quite powerful, both in the psychological sense that it condones single inferences which are often beyond the ability of the human to grasp, and in the theoretical sense that it alone, as sole inference principle, forms a complete system of first-order logic. 4.2 Syntax and Semantics The Syntax deals with the formal part of language in abstraction from its meaning. It concerns with the definition of well-formed formulas. Syntax in its narrow sense and also deals with the study of axioms, rules of reference and proofs, which constitute proof theory. Semantics is concerned with the interpretation of language and includes such notions as meaning, logical implication and truth. It is convenient to restrict attention to predicate logic programs written in clausal form. Such programs have an especially simple syntax but retain all the expressive power of the full predicate logic. Atomic formula. A string of symbols consisting of a predicate symbol of degree n 0 followed by n terms is an atomic formula. Clause. A clause is a disjunction L 1 L n of literals L i, each of which is atomic formula P(t 1,...,t m ) or the negation of atomic formulas, where P is a predicate symbol and t i, are terms. A finite set (possibly empty) of literals is called a clause. The empty clause is denoted by: [] Sentence. A sentence is a finite set of clauses. Literals. An atomic formula is a literal; and if A is an atomic formula then A is a literal. Term. A term is either a variable or an expression like f(t i,...,t n ), where f is a function symbol and t i are terms. Constants are 0 ary function symbols. A variable is a term, and a string of symbols consisting of 4-1

4-2 Lecture 4: January 12, 2015 a function symbol of degree n 0 followed by n terms is a term. A set of clauses {C 1...,C n } is interpreted as the conjunction, C 1 and..., and C n. A clause C containing just the variables x 1,...,x n is regarded as universally quantified, for example, for all x 1,...,x n C (4.1) Ground literals. A literal which contains no variables is called a ground literal. Ground clauses. A clause, each member of which is a ground literal, is called a ground clause. In particular [] is a ground clause. 4.3 Representation in Predicate Logic The statements of FOPL are flexible enough to permit the accurate representation of natural languages. English sentence: Ram is man and Sita is women. Predicate form: man(ram) woman(sita) English sentence: Ram is married to Sita. Predicate form: married(ram, Sita) English sentence: Every person has a mother. Reorganized form of above: For all x, there exists a y, such that if x is person then x s mother is y. Predicate form: x y[person(x) hasmother(x, y)] English sentence: If x and y are parents of a child z, and x is man, then y is not man. x y[[parents(x, z) parents(y, z) man(x)] man(y)] We note that predicate language comprises constants {Ram, Sita}, variables {x, y}, operators {,,, }, quantifiers {, } and functions/ predicates {married(x, y), person(x)}. Unless specifically mentioned, the letters a,b,c,... at the beginning of English alphabets shall be treated as constants to indicate names of objects and entities, and those at the end, i.e., u,v,w,... shall be used as variables or identifiers for objects and entities. To indicate that an expression is universally true, we use the universal quantifier symbol, meaning for all. Consider the sentence any object that has a feathers is a bird. Its predicate formula is: x[hasf eathers(x) isbird(x)]. Then certainly, hasf eathers(parrot) isbird(parrot) is true. Some expressions, although not always True, are True at least for some objects: in logic, this is indicted by there exists, and the existential quantifier symbol is used for this. For example, x[bird(x)], when True, this expression means that there is at least one possible object, that when substituted in the position of x, makes the expression inside the parenthesis as True. Following are some examples of representations of knowledge FOPL.

Lecture 4: January 12, 2015 4-3 Example 4.1 Kinship Relations. Solution. mother(namrata, priti).(that is, Namrata is mother of Preeti.) mother(namrata, bharat). f ather(rajan, priti). f ather(rajan, bharat). x y z[f ather(y, x) mother(z, x) spouse(y, z)]. x y z[mother(z, x) mother(z, y) sibling(x, y)]. Example 4.2 Represent the following sentences by predicate calculus wffs. Ans. 1. A computer system is intelligent if it can perform a task which, if performed by a human, requires intelligence. x[[(perf orm(human, x) requires(human, intelligence)) (perf orm(computer, x)] intelligent(computer))] 2. If a program cannot be told a fact, then it cannot learn that fact. Ans. x[(program(x) told(x, f act)) learn(x, f act)] Example 4.3 Blocks world. Consider that there are are physical objects, like - cuboid, cone, cylinder placed on the table-top, with some relative positions, as shown in figure 4.1. There are four blocks on the table:a,c,d are cuboid, and b is a cone. Along with these there is a robot arm, to lift one of the object having clear top. robot arm b d c a Figure 4.1: Blocks World.

4-4 Lecture 4: January 12, 2015 Solution. Following is the set of statements about the blocks world (called knowledge base): cuboid(a). cone(b). cuboid(c). cuboid(d). onground(a). onground(c). ontop(b, a). ontop(d, c). toplcear(b). topclear(d). x y[topclear(x) toplcear(y) cone(x) puton(y, x)] The knowledge specified in the blocks world indicate that objects a,c,d are cuboid, b is cone, a,c are put on the ground, and b,d are on top of a,c, respectively, and the top of b,d are clear. These are called facts in knowledge representation. At the end, the rule says that there exists objects x and y such that both have their tops clear and x is not a cone, then y can be put on the object x. 4.3.1 Bound and Free Variables A variable in a wff is bound if it is within the scope of a quantifier naming the variable, otherwise the variable is free. For example, in x(p(x) q(x,y)), x is bound and y is free; in x(p(x) q(x)) r(x), the x in r(x) is free variable. In the latter case it is better to rename the variable to remove the ambiguity, hence we rephrase this statement as x(p(x) q(x)) r(z). An expression can be evaluated only when all the variables in that are bound. 4.4 Interpretation and Inferences A FOPL statement is made of predicates, arguments (constants or variables), functions, operators, and quantifiers. Interpretation is process of assignment of truth values(true/false) to subexpressions and atomic expressions, and computing the resultant value of any expression/ statement. A statement or expression in predicate logic is also called wwf (well formed formula). Consider the interpretation of predicate formula: x[bird(x) flies(x)] (4.2) To find out the satisfiability of the formula (4.2), we need to substitute (instantiate) a value for x (an instance of x) and check if flies(x) is true. Until, that x is found, it may require instantiation with large number of values. Similarly, to check if the equation (4.2) is valid, it may require infinitely large number of values in the domain of x to be verified. If any one of that makes the formula false, the formula is not valid. Example 4.4 Given, All men are mortal and Socrates is man, infer using predicate logic, that Socrates is mortal.

Lecture 4: January 12, 2015 4-5 Solution. The above statement can be written in predicate logic as: x[man(x) mortal(x)], man(socrates). (4.3) Using a rule called universal instantiation, a variable can be instantiated by a constant and universal quantifier can be dropped. Hence, from 4.3 we have man(socrates) mortal(socrates), man(socrates). (4.4) Using the rule of modus ponens on 4.4 we deduce mortal(socrates). It is also logical consequence. If Γ = {[man(socrates) mortal(socrates)] man(socrates)}, and α = mortal(socrates), then we can say that Γ α. The set of formulas Γ is called knowledge-base. To find out the result for the query Who is man?, we must give the query?man(x). in Prolog (to be discussed later), which will match (called unify or substitute) man(x) with man(socrates) with a unification set, say, θ = {socrates/x}. The substitution which returns man(socrates) is represented by man(x)θ. Example 4.5 Prolog Program. The sentence in equation (4.3) will appear in prolog as, mortal(socrates) : man(socrates). man(socrates). where, sign :- is read as if. The subexpression before :- is called head or procedure name and the part after :- is called body of the rule. The sentence (4.4) can also be written in a clause form, (to be precise, in Horn clause form) it becomes, mortal(socrates) man(socrates). man(socrates). (4.5)

4-6 Lecture 4: January 12, 2015 4.4.1 The Procedural Interpretation It is easy to procedurally interpret the sets of clauses which contain at most one positive literal per clause. However, along with this any number of negative literals can also exist. Such sets of clauses are called Horn sentences or Horn Clauses or simply clauses. We distinguish three kinds of Horn clauses. In the procedural interpretation a set of procedure declarations is a program. Computation is initiated by an initial goal statement, which proceeds by using declared procedures to derive new goal statements (subgoals) from old goal statements, and terminates on the derivation of the halt statement. Such derivation of goal statements is accomplished by resolution, which is interpreted as procedural invocation. Consider that, a selected procedure call Ā 1 inside the body of a goal statement as, and a procedure declaration is given as, Ā 1 Āi 1 Āi Āi+1 Ān (4.6) A B 1 B m,m 0. (4.7) Suppose, the name of procedure matches with the procedure call, i,e., some substitution θ of terms for variablesmakesa i anda identical. Insuchacase, theresolutionderivesanewgoalstatementbydisjunction formulas (4.6) and (4.7) as given below, subject to substitution θ. (Ā1 Āi 1 B 1 B m Āi+1 Ān)θ. (4.8) In general, any derivation can be regarded as a computation, and any refutation (i.e. derivation of []) can be regarded as a successfully terminating computation. It is to be noted that, only goal oriented resolution derivations correspond to the standard notion of computation.