First-Order Logic (FOL)

Similar documents
CS156: The Calculus of Computation Zohar Manna Winter 2010

AAA615: Formal Methods. Lecture 2 First-Order Logic

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

Decision Procedures. Jochen Hoenicke. Software Engineering Albert-Ludwigs-University Freiburg. Winter Term 2015/16

Overview. CS389L: Automated Logical Reasoning. Lecture 7: Validity Proofs and Properties of FOL. Motivation for semantic argument method

Predicate Logic: Sematics Part 1

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

Learning Goals of CS245 Logic and Computation

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

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

Recall that the expression x > 3 is not a proposition. Why?

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

Classical First-Order Logic

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

Introduction to Sets and Logic (MATH 1190)

First Order Logic (FOL) 1 znj/dm2017

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


Outline. Logic. Definition. Theorem (Gödel s Completeness Theorem) Summary of Previous Week. Undecidability. Unification

Propositional Logic Not Enough

Classical First-Order Logic

CS156: The Calculus of Computation

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

Predicate Calculus - Semantics 1/4

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

First-Order Predicate Logic. Basics

Motivation. CS389L: Automated Logical Reasoning. Lecture 10: Overview of First-Order Theories. Signature and Axioms of First-Order Theory

Section Summary. Section 1.5 9/9/2014

Classical Propositional Logic

Exercises 1 - Solutions

Logic for Computer Scientists

Informal Statement Calculus

Logic for Computer Scientists

Introduction to Logic in Computer Science: Autumn 2006

Automated Reasoning Lecture 5: First-Order Logic

Predicate Calculus - Syntax

Review. Propositional Logic. Propositions atomic and compound. Operators: negation, and, or, xor, implies, biconditional.

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

The Calculus of Computation: Decision Procedures with Applications to Verification. by Aaron Bradley Zohar Manna. Springer 2007

Lecture 13: Soundness, Completeness and Compactness

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

Quantifiers. P. Danziger

Inference in first-order logic

Language of Propositional Logic

Predicate Calculus lecture 1

Herbrand Theorem, Equality, and Compactness

CS156: The Calculus of Computation Zohar Manna Autumn 2008

Logic: First Order Logic

Logic: First Order Logic (Part I)

The predicate calculus is complete

Propositional Logic: Review

03 Review of First-Order Logic

Computational Logic. Standardization of Interpretations. Damiano Zanardini

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.

Predicate Logic - Semantic Tableau

2-4: The Use of Quantifiers

CS156: The Calculus of Computation

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

Introduction to Predicate Logic Part 1. Professor Anita Wasilewska Lecture Notes (1)

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

A Logic Primer. Stavros Tripakis University of California, Berkeley. Stavros Tripakis (UC Berkeley) EE 144/244, Fall 2014 A Logic Primer 1 / 35

Logic for Computer Scientists

1.1 Language and Logic

A Little Logic. Propositional Logic. Satisfiability Problems. Solving Sudokus. First Order Logic. Logic Programming

Transparencies to accompany Rosen, Discrete Mathematics and Its Applications Section 1.3. Section 1.3 Predicates and Quantifiers

Mathematical Logic Part Three

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

Automated Program Verification and Testing 15414/15614 Fall 2016 Lecture 2: Propositional Logic

Tecniche di Verifica. Introduction to Propositional Logic

Logic Part I: Classical Logic and Its Semantics

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

Proseminar on Semantic Theory Fall 2013 Ling 720 First Order (Predicate) Logic: Syntax and Natural Deduction 1

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

KE/Tableaux. What is it for?

First-order Logic (Session 1) Anthony W. Lin Yale-nus College, Singapore

1.1 Language and Logic

ICS141: Discrete Mathematics for Computer Science I

MAI0203 Lecture 7: Inference and Predicate Calculus

Mat 243 Exam 1 Review

PROOFS IN PREDICATE LOGIC AND COMPLETENESS; WHAT DECIDABILITY MEANS HUTH AND RYAN 2.3, SUPPLEMENTARY NOTES 2

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

CMPSCI 601: Tarski s Truth Definition Lecture 15. where

First Order Logic (FOL)

Announcements CompSci 102 Discrete Math for Computer Science

Discrete Mathematics and Its Applications

First-Order Logic. Chapter Overview Syntax

Quantifiers. Leonardo de Moura Microsoft Research

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

Algebraizing Hybrid Logic. Evangelos Tzanis University of Amsterdam Institute of Logic, Language and Computation

Logical Operators. Conjunction Disjunction Negation Exclusive Or Implication Biconditional

CS 730/730W/830: Intro AI

ELEMENTS IN MATHEMATICS FOR INFORMATION SCIENCE NO.6 TURING MACHINE AND COMPUTABILITY. Tatsuya Hagino

THE LANGUAGE OF FIRST-ORDER LOGIC (FOL) Sec2 Sec1(1-16)

Halting and Equivalence of Program Schemes in Models of Arbitrary Theories

CMPS 217 Logic in Computer Science. Lecture #17

Section 2.1: Introduction to the Logic of Quantified Statements

Section Summary. Predicate logic Quantifiers. Negating Quantifiers. Translating English to Logic. Universal Quantifier Existential Quantifier

Predicate Calculus - Semantic Tableau (2/2) Moonzoo Kim CS Division of EECS Dept. KAIST

Predicate Logic: Semantics


Transcription:

First-Order Logic (FOL) Also called Predicate Logic or Predicate Calculus 2. First-Order Logic (FOL) FOL Syntax variables x, y, z, constants a, b, c, functions f, g, h, terms variables, constants or n-ary function applied to n terms as arguments a, x, f (a), g(x, b), f (g(x, g(b))) predicates p, q, r, atom,, or an n-ary predicate applied to n terms literal atom or its negation p(f (x), g(x, f (x))), p(f (x), g(x, f (x))) Note: 0-ary functions: constant 0-ary predicates: P, Q, R,... 2-1 2-2 quantifiers existential quantifier x.f [x] there exists an x such that F [x] universal quantifier for all x, F [x] x.f [x] FOL formula literal, application of logical connectives (,,,, ) to formulae, or application of a quantifier to a formula FOL formula x. p(f (x), x) ( y. p(f (g(x, y)), g(x, y)) ) q(x, f (x)) }{{} } {{ G } F The scope of x is F. The scope of y is G. The formula reads: for all x, if p(f (x), x) then there exists a y such that p(f (g(x, y)), g(x, y)) and q(x, f (x)) 2-3 2-4

Translations of English Sentences into FOL The length of one side of a triangle is less than the sum of the lengths of the other two sides x, y, z. triangle(x, y, z) length(x) < length(y)+length(z) Fermat s Last Theorem. n. integer(n) n > 2 x, y, z. integer(x) integer(y) integer(z) x > 0 y > 0 z > 0 x n + y n z n 2-5 FOL Semantics An interpretation I : (D I, α I ) consists of: Domain D I non-empty set of values or objects cardinality D I finite (eg, 52 cards), countably infinite (eg, integers), or uncountably infinite (eg, reals) Assignment α I each variable x assigned value xi D I each n-ary function f assigned f I : D n I D I In particular, each constant a (0-ary function) assigned value a I D I each n-ary predicate p assigned p I : D n I {true, false} In particular, each propositional variable P (0-ary predicate) assigned truth value (true, false) 2-6 F : p(f (x, y), z) p(y, g(z, x)) Interpretation I : (D I, α I ) D I = Z = {, 2, 1, 0, 1, 2, } α I : {f +, g, p >} Therefore, we can write integers F I : x + y > z y > z x (This is the way we ll write it in the future!) Also α I : {x 13, y 42, z 1} Thus F I : 13 + 42 > 1 42 > 1 13 Compute the truth value of F under I F is true under I 1. I = x + y > z since 13 + 42 > 1 2. I = y > z x since 42 > 1 13 3. I = F by 1, 2, and 2-7 Semantics: Quantifiers x variable. x-variant of interpretation I is an interpretation J : (D J, α J ) such that D I = D J α I [y] = α J [y] for all symbols y, except possibly x That is, I and J agree on everything except possibly the value of x Denote J : I {x v} the x-variant of I in which α J [x] = v for some v D I. Then I = x. F I = x. F iff for all v D I, I {x v} = F iff there exists v D I s.t. I {x v} = F 2-8

Example For Q, the set of rational numbers, consider F I : x. y. 2 y = x Compute the value of F I (F under I ): Let for v Q. Then J 1 : I {x v} J 2 : J 1 {y v 2 } x-variant of I y-variant of J 1 1. J 2 = 2 y = x since 2 v 2 = v 2. J 1 = y. 2 y = x 3. I = x. y. 2 y = x since v Q is arbitrary Satisfiability and Validity F is satisfiable iff there exists I s.t. I = F F is valid iff for all I, I = F F is valid iff F is unsatisfiable F : ( x. p(x)) ( x. p(x)) valid? Suppose not. Then there is I s.t. 0. I = ( x. p(x)) ( x. p(x)) First case 1. I = x. p(x) assumption 2. I = x. p(x) assumption 3. I = x. p(x) 2 and 4. I {x v} = p(x) 3 and, for some v D I 5. I {x v} = p(x) 1 and 2-9 4 and 5 are contradictory. 2-10 Second case 1. I = x. p(x) assumption 2. I = x. p(x) assumption 3. I {x v} = p(x) 1 and, for some v D I 4. I = x. p(x) 2 and 5. I {x v} = p(x) 4 and 6. I {x v} = p(x) 5 and 3 and 6 are contradictory. Both cases end in contradictions for arbitrary I F is valid. Prove F : p(a) x. p(x) Assume otherwise. is valid. 1. I = F assumption 2. I = p(a) 1 and 3. I = x. p(x) 1 and 4. I {x α I [a]} = p(x) 3 and 2 and 4 are contradictory. Thus, F is valid. 2-11 2-12

Show F : ( x. p(x, x)) ( x. y. p(x, y)) Find interpretation I such that i.e. is invalid. I = [( x. p(x, x)) ( x. y. p(x, y))] I = ( x. p(x, x)) ( x. y. p(x, y)) Choose D I = {0, 1} p I = {(0, 0), (1, 1)} I falsifying interpretation F is invalid. i.e. p I (0, 0) and p I (1, 1) are true p I (1, 0) and p I (1, 0) are false 2-13 Safe Substitution F σ F : ( x. scope of x {}}{ p(x, y) ) q(f (y), x) bound by x free free free free(f ) = {x, y} substitution F σ? σ : {x g(x), y f (x), q(f (y), x) x. h(x, y)} 1. Rename F : x. p(x, y) q(f (y), x) 2. F σ : x. p(x, f (x)) x. h(x, y) where x is a fresh variable 2-14 Rename x by x : replace x in x by x and all free x in the scope of x by x. x. G[x] x. G[x ] Same for x x. G[x] x. G[x ] where x is a fresh variable Proposition (Substitution of Equivalent Formulae) σ : {F 1 G 1,, F n G n } s.t. for each i, F i G i If F σ a safe substitution, then F F σ Formula Schema Formula ( x. p(x)) ( x. p(x)) Formula Schema H 1 : ( x. F ) ( x. F ) place holder Formula Schema (with side condition) H 2 : ( x. F ) F provided x / free(f ) Valid Formula Schema H is valid iff valid for any FOL formula F i obeying the side conditions H 1 and H 2 are valid. 2-15 2-16

Substitution σ of H σ : {F 1,..., F n } mapping place holders F i of H to FOL formulae, (obeying the side conditions of H) Proposition (Formula Schema) If H is valid formula schema and σ is a substitution obeying H s side conditions then Hσ is also valid. H : ( x. F ) F provided x / free(f ) is valid σ : {F p(y)} obeys the side condition Therefore Hσ : x. p(y) p(y) is valid Proving Validity of Formula Schema Prove validity of H : ( x. F ) F provided x / free(f ) Proof by contradiction. Consider the two directions of. First case: Second Case: 1. I = x. F assumption 2. I = F assumption 3. I = F 1,, since x free(f ) 4. I = 2, 3 1. I = x. F assumption 2. I = F assumption 3. I = x. F 1 and 4. I = F 3,, since x free(f ) 5. I = 2, 4 2-17 Hence, H is a valid formula schema. 2-18 Normal Forms 1. Negation Normal Forms (NNF) Augment the equivalence with (left-to-right) Example x. F [x] x. F [x] x. F [x] x. F [x] G : x. ( y. p(x, y) p(x, z)) w.p(x, w). 1. x. ( y. p(x, y) p(x, z)) w. p(x, w) 2. x. ( y. p(x, y) p(x, z)) w. p(x, w) F 1 F 2 F 1 F 2 3. x. ( y. (p(x, y) p(x, z))) w. p(x, w) x. F [x] x. F [x] 4. x. ( y. p(x, y) p(x, z)) w. p(x, w) 2. Prenex Normal Form (PNF) All quantifiers appear at the beginning of the formula Q 1 x 1 Q n x n. F [x 1,, x n ] where Q i {, } and F is quantifier-free. Every FOL formula F can be transformed to formula F in PNF s.t. F F. Find equivalent PNF of F : x. ( y. p(x, y) p(x, z)) y. p(x, y) to the end of the formula 1. Write F in NNF F 1 : x. ( y. p(x, y) p(x, z)) y. p(x, y) 2-19 2-20

2. Rename quantified variables to fresh names F 2 : x. ( y. p(x, y) p(x, z)) w. p(x, w) in the scope of x 3. Remove all quantifiers to produce quantifier-free formula F 3 : p(x, y) p(x, z) p(x, w) 4. Add the quantifiers before F 3 F 4 : x. y. w. p(x, y) p(x, z) p(x, w) Alternately, F 4 : x. w. y. p(x, y) p(x, z) p(x, w) Note: In F 2, y is in the scope of x, therefore the order of quantifiers must be x y Note: However G F F 4 F and F 4 F Decidability of FOL FOL is undecidable (Turing & Church) There does not exist an algorithm for deciding if a FOL formula F is valid, i.e. always halt and says yes if F is valid or say no if F is invalid. FOL is semi-decidable There is a procedure that always halts and says yes if F is valid, but may not halt if F is invalid. On the other hand, PL is decidable There does exist an algorithm for deciding if a PL formula F is valid, e.g. the truth-table procedure. Similarly for satisfiability G : y. w. x. p(x, y) p(x, z) p(x, w) 2-21 2-22 Semantic Argument Proof To show FOL formula F is valid, assume I = F and derive a contradiction I = in all branches Soundness If every branch of a semantic argument proof reach I =, then F is valid Completeness Each valid formula F has a semantic argument proof in which every branch reach I = 2-23