Logic. Foundations of First Order Logic. franconi. Enrico Franconi

Similar documents
Logic: First Order Logic (Part I)

First-order logic. Chapter 8. Chapter 8 1

Logic: First Order Logic

CS 380: ARTIFICIAL INTELLIGENCE INFERENCE IN PROPOSITIONAL LOGIC

CS 380: ARTIFICIAL INTELLIGENCE FIRST ORDER LOGIC. Santiago Ontañón

First-order logic. First-order logic. Logics in general. Outline. Syntax of FOL: Basic elements. Pros and cons of propositional logic

First order logic (FOL) Chapters 8 & 9

First Order Logic. Philipp Koehn. 8 October 2015

First-order logic. Chapter 8. Chapter 8 1

Outline. Formale Methoden der Informatik First-Order Logic for Forgetters. Why PL1? Why PL1? Cont d. Motivation

Lecture 8: (Predicate) First Order Logic

Agenda Artificial Intelligence. Let s Talk About the Wumpus Instead? Let s Talk About Blocks, Baby...

Logic: First Order Logic

Theory of Computer Science

CS:4420 Artificial Intelligence

Theory of Computer Science

First-order logic. AI Slides (5e) c Lin

Syntax. Notation Throughout, and when not otherwise said, we assume a vocabulary V = C F P.

Foundations of Artificial Intelligence

Logic: Propositional Logic (Part I)

ITS336 Lecture 6 First-Order Logic

First-Order Logic (FOL)

Predicate Logic: Sematics Part 1

Logical Structures in Natural Language: First order Logic (FoL)


Artificial Intelligence

Computational Logic. Davide Martinenghi. Spring Free University of Bozen-Bolzano. Computational Logic Davide Martinenghi (1/26)

AAA615: Formal Methods. Lecture 2 First-Order Logic

CS156: The Calculus of Computation Zohar Manna Winter 2010

First-Order Logic. Language of FOL: Grammar. 22c:145 Artificial Intelligence. Norvig. Universal quantification. A common mistake to avoid

First-Order Logic. Michael Rovatsos. University of Edinburgh R&N: February Informatics 2D

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

Logic Part I: Classical Logic and Its Semantics

Reasoning. Inference. Knowledge Representation 4/6/2018. User

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

Logic and Modelling. Introduction to Predicate Logic. Jörg Endrullis. VU University Amsterdam

Logic III. Introduction to Artificial Intelligence CSE 150

First Order Logic (FOL) 1 znj/dm2017

First-order logic Syntax and semantics

CS 1571 Introduction to AI Lecture 14. First-order logic. CS 1571 Intro to AI. Midterm

Mathematical Logic Part Three

Reading: AIMA Chapter 9 (Inference in FOL)

Automated Reasoning Lecture 5: First-Order Logic

J Propositional logic is declarative J Propositional logic is compositional: q meaning of B 1,1 P 1,2 is derived from meaning of B 1,1 and of P 1,2

Introduction to Logic in Computer Science: Autumn 2006

First-Order Predicate Calculus

First-Order Logic. Chapter 8

First-Order Logic. Chapter 8

First order Logic ( Predicate Logic) and Methods of Proof

Mathematical Logic Part Three

Propositional Logic Language

Chapter 8 First Order Logic

First-Order Logic. Propositional logic. First Order logic. First Order Logic. Logics in General. Syntax of FOL. Examples of things we can say:

Outline. First-order logic. Atomic sentences. Intelligent Systems and HCI D7023E. Syntax of FOL: Basic elements. Pros and cons of propositional logic

CS 188: Artificial Intelligence Spring 2007

Inference in first-order logic

CS 730/730W/830: Intro AI

Introduction to Sets and Logic (MATH 1190)

Logic as a Tool Chapter 4: Deductive Reasoning in First-Order Logic 4.4 Prenex normal form. Skolemization. Clausal form.

Predicate Logic. CSE 191, Class Note 02: Predicate Logic Computer Sci & Eng Dept SUNY Buffalo

First-Order Logic. Chapter 8

Normal Forms of Propositional Logic

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

Predicate Calculus. Formal Methods in Verification of Computer Systems Jeremy Johnson

3. Only sequences that were formed by using finitely many applications of rules 1 and 2, are propositional formulas.

Introduction to first-order logic:

First-Order Logic. 1 Syntax. Domain of Discourse. FO Vocabulary. Terms

Propositional Logic: Models and Proofs

Advanced Topics in LP and FP

Intelligent Agents. First Order Logic. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University. last change: 19.

Introduction to Logic in Computer Science: Autumn 2007

Syntax of FOL. Introduction to Logic in Computer Science: Autumn Tableaux for First-order Logic. Syntax of FOL (2)

INTRODUCTION TO PREDICATE LOGIC HUTH AND RYAN 2.1, 2.2, 2.4

Computational Logic. Recall of First-Order Logic. Damiano Zanardini

Logic. Stephen G. Ware CSCI 4525 / 5525

Propositional Logic: Review

The predicate calculus is complete

COMP4418: Knowledge Representation and Reasoning First-Order Logic

First-Order Logic Chap8 1. Pros and Cons of Prop. Logic

Section Summary. Section 1.5 9/9/2014

Chapter 2: The Logic of Quantified Statements

Mathematical Logic. Reasoning in First Order Logic. Chiara Ghidini FBK-IRST, Trento, Italy. May 2, 2013

Propositional logic. First order logic. Alexander Clark. Autumn 2014

Announcements. CS311H: Discrete Mathematics. Introduction to First-Order Logic. A Motivating Example. Why First-Order Logic?

7.5.2 Proof by Resolution

Learning Goals of CS245 Logic and Computation

Discrete Mathematics and Its Applications

Handout: Proof of the completeness theorem

First-Order Logic. CS367 ARTIFICIAL INTELLIGENCE Chapter 8

22c:145 Artificial Intelligence. First-Order Logic. Readings: Chapter 8 of Russell & Norvig.

Propositional Logic. Premises: If Jack knows Jill, then Jill knows Jack. Jack knows Jill. Conclusion: Is it the case that Jill knows Jack?

First-Order Logic. Chapter Overview Syntax

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

Propositional and First-Order Logic

Predicate Logic & Quantification

CSC165 Mathematical Expression and Reasoning for Computer Science

Exercises 1 - Solutions

Translating Ontologies from Predicate-based to Frame-based Languages

First Order Logic (FOL)

Conjunction: p q is true if both p, q are true, and false if at least one of p, q is false. The truth table for conjunction is as follows.

Transcription:

(1/41) Logic Foundations of First Order Logic Enrico Franconi franconi@inf.unibz.it http://www.inf.unibz.it/ franconi Faculty of Computer Science, Free University of Bozen-Bolzano

(2/41) Motivation We can already do a lot with propositional logic. But it is unpleasant that we cannot access the structure of atomic sentences. Atomic formulas of propositional logic are too atomic they are just statement which my be true or false but which have no internal structure. In First Order Logic (FOL) the atomic formulas are interpreted as statements about relationships between objects.

(3/41) Predicates and Constants Let s consider the statements: Mary is female John is male Mary and John are siblings In propositional logic the above statements are atomic propositions: Mary-is-female John-is-male Mary-and-John-are-siblings In FOL atomic statements use predicates, with constants as argument: Female(mary) Male(john) Siblings(mary,john)

(4/41) Variables and Quantifiers Let s consider the statements: Everybody is male or female A male is not a female In FOL predicates may have variables as arguments, whose value is bounded by quantifiers: x. Male(x) Female(x) x. Male(x) Female(x) Deduction (why?): Mary is not male Male(mary)

(5/41) Functions Let s consider the statement: The father of a person is male In FOL objects of the domain may be denoted by functions applied to (other) objects: x. Male(father(x))

(6/41) Syntax of FOL: atomic sentences Countably infinite supply of symbols (signature): variable symbols: x, y, z,... n-ary function symbols: f, g, h,... individual constants: a, b, c,... n-are predicate symbols: P, Q, R,... Terms: t x variable a constant f(t 1,..., t n ) function application Ground terms: terms that do not contain variables Formulas: φ P (t 1,..., t n ) atomic formulas E.g., Brother(kingJohn, richardt helionheart) > (length(lef tlegof(richard)), length(lef tlegof(kingjohn)))

Syntax of FOL: propositional sentences Formulas: φ, ψ P (t 1,..., t n ) atomic formulas false true φ negation φ ψ conjunction φ ψ disjunction φ ψ implication φ ψ equivalence (Ground) atoms and (ground) literals. E.g. Sibling(kingJohn, richard) Sibling(richard, kingjohn) >(1, 2) (1, 2) >(1, 2) >(1, 2) (7/41)

Syntax of full FOL Formulas: φ, ψ P (t 1,..., t n ) atomic formulas false true φ negation φ ψ conjunction φ ψ disjunction φ ψ implication φ ψ equivalence x. φ universal quantification x. φ existential quantification E.g. Everyone in England is smart: x. In(x, england) Smart(x) Someone in France is smart: x. In(x, f rance) Smart(x) (8/41)

(9/41) Summary of Syntax of FOL Terms variables constants functions Literals atomic formula relation (predicate) negation Well formed formulas truth-functional connectives existential and universal quantifiers

(10/41) Semantics of FOL: intuition Just like in propositional logic, a (complex) FOL formula may be true (or false) with respect to a given interpretation. An interpretation specifies referents for constant symbols objects predicate symbols relations function symbols functional relations An atomic sentence P (t 1,..., t n ) is true in a given interpretation iff the objects referred to by t 1,..., t n are in the relation referred to by the predicate P. An interpretation in which a formula is true is called a model for the formula.

{ (11/41) { Models for FOL: Example objects relations: < sets of tuples of objects < < {,,,,... < functional < relations: all tuples of objects < + "value" object < {,,,,... <

(12/41) Semantic of FOL: Interpretations Interpretation: I =, I where is an arbitrary non-empty set and I is a function that maps n-ary function symbols to functions over : f I [ n ] individual constants to elements of : a I n-ary predicate symbols to relation over : P I n

(13/41) Semantic of FOL: Satisfaction Interpretation of ground terms: (f(t 1,..., t n )) I = f I (t 1 I,..., t n I ) ( ) Satisfaction of ground atoms P (t 1,..., t n ): I = P (t 1,..., t n ) iff t 1 I,..., t n I P I

(14/41) Examples = {d 1,..., d n, n > 1} a I = d 1 b I = d 2 Block I = {d 1 } Red I = = {1, 2, 3,...} 1 I = 1 2 I = 2. Even I = {2, 4, 6,...} succ I = {(1 2), (2 3),...}

(14/41) Examples = {d 1,..., d n, n > 1} a I = d 1 b I = d 2 Block I = {d 1 } Red I = I = Red(b) I = Block(b) = {1, 2, 3,...} 1 I = 1 2 I = 2. Even I = {2, 4, 6,...} succ I = {(1 2), (2 3),...}

(14/41) Examples = {d 1,..., d n, n > 1} a I = d 1 b I = d 2 Block I = {d 1 } Red I = I = Red(b) I = Block(b) = {1, 2, 3,...} 1 I = 1 2 I = 2. Even I = {2, 4, 6,...} succ I = {(1 2), (2 3),...} I = Even(3) I = Even(succ(3))

(15/41) Semantics of FOL: Variable Assignments V set of all variables. Function α: V. Notation: α[x/d] is identical to α except for the variable x. Interpretation of terms under I, α: x I,α = α(x) a I,α = a I (f(t 1,..., t n )) I,α = f I (t I,α 1,..., t I,α n ) Satisfiability of atomic formulas: I, α = P (t 1,..., t n ) iff t 1 I,α,..., t n I,α P I

(16/41) Variable Assignment example α = {(x d 1 ), (y d 2 )} I, α = Red(x) I, α[y/d 1 ] = Block(y)

Semantics of FOL: Satisfiability of formulas A formula φ is satisfied by (is true in) an interpretation I under a variable assignment α, I, α = φ : I, α = P (t 1,..., t n ) iff t I,α 1,..., t I,α n P I I, α = φ iff I, α = φ I, α = φ ψ iff I, α = φ and I, α = ψ I, α = φ ψ iff I, α = φ or I, α = ψ I, α = x. φ iff for all d : I, α[x/d] = φ I, α = x. φ iff there exists a d : I, α[x/d] = φ (17/41)

(18/41) Examples = {d 1,..., d n, } n > 1 a I = d 1 b I = d 1 Block I = {d 1 } Red I = α = {(x d 1 ), (y d 2 )} 1. I, α = Block(c) Block(c)? 2. I, α = Block(x) Block(x) Block(y)? 3. I, α =. x Block(x) Red(x)? Block(a), Block(b) 4. Θ = x (Block(x) Red(x)) I, α = Θ?

(19/41) Example Find a model of the formula: y. [ P (y) Q(y) ] z. [ P (z) Q(z) ]

(19/41) Example Find a model of the formula: y. [ P (y) Q(y) ] z. [ P (z) Q(z) ] = {a, b} P I = {a} Q I = {b}

(20/41) Satisfiability and Validity An interpretation I is a model of φ under α, if I, α = φ. Similarly as in propositional logic, a formula φ can be satisfiable, unsatisfiable, falsifiable or valid the definition is in terms of the pair (I, α). A formula φ is satisfiable, if there is some (I, α) that satisfies φ, unsatisfiable, if φ is not satisfiable, falsifiable, if there is some (I, α) that does not satisfy φ, valid (i.e., a tautology), if every (I, α) is a model of φ.

(21/41) Equivalence Analogously, two formulas are logically equivalent (φ ψ), if for all I, α we have: I, α = φ iff I, α = ψ Note: P(x) P(y)!

Free and Bound Variables x. (R( y, z ) y. ( P(y,x) R(y, z ))) Variables in boxes are free; other variables are bound. Free variables of a formula (inductively defined over the structure of expressions): free(x) = {x} free(a) = free(f(t 1,..., t n )) = free(t 1 )... free(t n ) free(p (t 1,..., t n )) = free(t 1 )... free(t n ) free( φ) = free(φ) free(φ ψ) = free(φ) free(ψ), =,,... free( x. φ) = free(φ) {x} free( x. φ) = free(φ) {x} (22/41)

(23/41) Open and Closed Formulas A formula is closed or a sentence if no free variables occurs in it. When formulating theories, we only use closed formulas. Note: For closed formulas, the properties logical equivalence, satisfiability, entailment etc. do not depend on variable assignments. If the property holds for one variable assignment then it holds for all of them. For closed formulas, the symbol α on the left hand side of the = sign is omitted. I = φ

(24/41) Entailment Entailment is defined similarly as in propositional logic. The formula φ is logically implied by a formula ψ, if φ is true in all models of ψ (symbolically, ψ = φ): ψ = φ iff I = φ for all models I of ψ

(25/41) More Exercises = x. (P (x) P (x)) x. [ P (x) (P (x) Q(x)) ] = x. Q(x) = ( x. [ y. [ P (x) Q(y) ] ]) y. [ P (y) Q(y) ] z. [ P (z) Q(z) ] satisfiable

(26/41) Equality Equality is a special predicate. t 1 = t 2 is true under a given interpretation (I, α = t 1 = t 2 ) if and only if t 1 and t 2 refer to the same object: t I,α I,α 1 = t 2 E.g., x. ( (sqrt(x), sqrt(x)) = x) is satisfiable 2 = 2 is valid E.g., definition of (full) Sibling in terms of P arent: x, y. Sibling(x, y) ( (x = y) m, f. (m = f) P arent(m, x) P arent(f, x) P arent(m, y) P arent(f, y) )

(27/41) Universal quantification Everyone in England is smart: x. In(x, england) Smart(x) ( x. φ) is equivalent to the conjunction of all possible instantiations in x of φ: In(kingJohn, england) Smart(kingJohn) In(richard, england) Smart(richard) In(england, england) Smart(england)... Typically, is the main connective with. Common mistake: using as the main connective with : x. In(x, england) Smart(x) means Everyone is in England and everyone is smart

(28/41) Existential quantification Someone in France is smart: x. In(x, france) Smart(x) ( x. φ) is equivalent to the disjunction of all possible instantiations in x of φ In(kingJohn, f rance) Smart(kingJohn) In(richard, f rance) Smart(richard) In(f rance, f rance) Smart(f rance)... Typically, is the main connective with. Common mistake: using as the main connective with : x. In(x, france) Smart(x) is true if there is anyone who is not in France!

(29/41) Properties of quantifiers ( x. y. φ) is the same as ( y. x. φ) (Why?) ( x. y. φ) is the same as ( y. x. φ) (Why?) ( x. y. φ) is not the same as ( y. x. φ) x. y. Loves(x, y) There is a person who loves everyone in the world y. x. Loves(x, y) Everyone in the world is loved by at least one person (not necessarily the same) Quantifier duality: each can be expressed using the other: x. Likes(x, icecream) x. Likes(x, broccoli) x. Likes(x, icecream) x. Likes(x, broccoli)

(30/41) Equivalences ( x. φ) ψ x. (φ ψ) if x not free in ψ ( x. φ) ψ x. (φ ψ) if x not free in ψ ( x. φ) ψ x. (φ ψ) if x not free in ψ ( x. φ) ψ x. (φ ψ) if x not free in ψ x. φ x. ψ x. (φ ψ) x. φ x. ψ x. (φ ψ) x. φ x. φ x. φ x. φ & propositional equivalences

The Prenex Normal Form Quantifier prefix + (quantifier free) matrix x 1 x 2 x 3... x n φ 1. Elimination of and 2. push inwards 3. pull quantifiers outwards E.g. x. (( x. p(x)) q(x)) x. ( ( x. p(x)) q(x)) x. (( x. p(x)) q(x)) and now? Notation: renaming of variables. Let φ[x/t] be the formula φ where all occurrences of x have been replaced by the term t. (31/41)

(32/41) The Prenex Normal Form: theorems Lemma. Let y be a variable that does not occur in φ. Then we have xφ ( xφ)[x/y] and xφ ( xφ)[x/y]. Theorem. There is an algorithm that computes for every formula its prenex normal form.

(33/41) FOL at work: reasoning by cases Γ = FRIEND(john,susan) FRIEND(john,andrea) LOVES(susan,andrea) LOVES(andrea,bill) Female(susan) Female(bill) john FRIEND FRIEND andrea LOVES susan: Female LOVES bill: Female

(34/41) john FRIEND FRIEND andrea LOVES susan: Female LOVES Γ = bill: Female Does John have a female friend loving a male (i.e. not female) person? Γ = X, Y. FRIEND(john, X) Female(X) LOVES(X, Y ) Female(Y )

(34/41) john FRIEND FRIEND andrea LOVES susan: Female LOVES Γ = bill: Female Does John have a female friend loving a male (i.e. not female) person? YES! Γ = X, Y. FRIEND(john, X) Female(X) LOVES(X, Y ) Female(Y )

(35/41) [ Female] andrea FRIEND john LOVES FRIEND susan: Female LOVES bill: Female FRIEND(john,susan), Female(susan), LOVES(susan,andrea), Female(andrea)

(36/41) john FRIEND FRIEND [Female] andrea LOVES susan: Female LOVES bill: Female FRIEND(john,andrea), Female(andrea), LOVES(andrea,bill), Female(bill)

Theories and Models Γ 1 = FRIEND(john, susan) FRIEND(john, andrea) LOVES(susan, andrea) LOVES(andrea, bill) Female(susan) Male(bill) X. Male(X) Female(X) john FRIEND FRIEND andrea LOVES susan: Female LOVES bill: Male Male =. Female (37/41)

(38/41) john FRIEND FRIEND andrea LOVES susan: Female LOVES Γ 1 = bill: Male Male. = Female Does John have a female friend loving a male person? Γ 1 = X, Y. FRIEND(john, X) Female(X) LOVES(X, Y ) Male(Y )

(39/41) Γ = FRIEND(john,susan) FRIEND(john,andrea) LOVES(susan,andrea) LOVES(andrea,bill) Female(susan) Female(bill) Γ 1 = FRIEND(john, susan) FRIEND(john, andrea) LOVES(susan, andrea) LOVES(andrea, bill) Female(susan) Male(bill) X. Male(X) Female(X)

(39/41) Γ = FRIEND(john,susan) FRIEND(john,andrea) LOVES(susan,andrea) LOVES(andrea,bill) Female(susan) Female(bill) = {john, susan, andrea, bill} Female I = {susan} Γ 1 = FRIEND(john, susan) FRIEND(john, andrea) LOVES(susan, andrea) LOVES(andrea, bill) Female(susan) Male(bill) X. Male(X) Female(X)

Γ = FRIEND(john,susan) FRIEND(john,andrea) LOVES(susan,andrea) LOVES(andrea,bill) Female(susan) Female(bill) Γ 1 = FRIEND(john, susan) FRIEND(john, andrea) LOVES(susan, andrea) LOVES(andrea, bill) Female(susan) Male(bill) X. Male(X) Female(X) = {john, susan, andrea, bill} Female I = {susan} I 1 = {john, susan, andrea, bill} Female I 1 = {susan, andrea} Male I 1 = {bill, john} I 2 = {john, susan, andrea, bill} Female I 2 = {susan} Male I 2 = {bill, andrea, john} I 1 = {john, susan, andrea, bill} Female I 1 = {susan, andrea, john} Male I 1 = {bill} I 2 = {john, susan, andrea, bill} Female I 2 = {susan, john} Male I 2 = {bill, andrea} (39/41)

(40/41) Γ = Female(andrea) Γ = Female(andrea) Γ 1 = Female(andrea) Γ 1 = Female(andrea) Γ 1 = Male(andrea) Γ 1 = Male(andrea)

Exercise (41/41)? Is it true that the top block is on a white block touching a black block?