First-Order Predicate Logic. Basics

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

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

CS156: The Calculus of Computation Zohar Manna Winter 2010

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

03 Review of First-Order Logic

AAA615: Formal Methods. Lecture 2 First-Order Logic

First-order logic Syntax and semantics

First order logic. Example The deduction of statements: This reasoning is intuitively correct. Every man is mortal. Since Ade is a man, he is mortal.

Predicate Logic: Sematics Part 1

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

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

Automated Reasoning Lecture 5: First-Order Logic

First-Order Logic. Chapter Overview Syntax

First-Order Logic (FOL)

Syntax of propositional logic. Syntax tree of a formula. Semantics of propositional logic (I) Subformulas

2-4: The Use of Quantifiers

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

Mathematical Logics. 12. Soundness and Completeness of tableaux reasoning in first order logic. Luciano Serafini

Logic for Computer Scientists

Logic for Computer Scientists

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

Exercises 1 - Solutions

Predicate Logic - Deductive Systems

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

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

Normal Forms for First-Order Logic

4 Predicate / First Order Logic

Propositional and Predicate Logic

Computational Logic. Standardization of Interpretations. Damiano Zanardini

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

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

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza

Automated Reasoning in First-Order Logic

Notes. Corneliu Popeea. May 3, 2013

G52DOA - Derivation of Algorithms Predicate Logic

Comp487/587 - Boolean Formulas

Propositional Logic Language

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

Part 2: First-Order Logic

First Order Logic (FOL) 1 znj/dm2017

Predicate Logic - Semantic Tableau

Logic for Computer Scientists

Propositional Logic: Models and Proofs

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

Notes on Satisfiability-Based Problem Solving. First Order Logic. David Mitchell October 23, 2013

Classical First-Order Logic

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

Predicate Logic. Andreas Klappenecker

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

Introduction to Sets and Logic (MATH 1190)

Notation for Logical Operators:

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

1 Introduction to Predicate Resolution

Herbrand Theorem, Equality, and Compactness

Predicate Calculus - Syntax

Discrete Mathematics

Predicate Calculus - Semantics 1/4

Introduction to first-order logic:

TR : Binding Modalities

On the Stable Model Semantics for Intensional Functions

Example. Lemma. Proof Sketch. 1 let A be a formula that expresses that node t is reachable from s

3 Propositional Logic

Team Semantics and Recursive Enumerability

Classical First-Order Logic

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

Binary Decision Diagrams. Graphs. Boolean Functions

INTRODUCTION TO LOGIC

Part I: Propositional Calculus


First-Order Stable Model Semantics and First-Order Loop Formulas

First-Order Logic. Resolution

Two New Definitions of Stable Models of Logic Programs with Generalized Quantifiers

Computational Logic Fundamentals (of Definite Programs): Syntax and Semantics

Introduction to Logic in Computer Science: Autumn 2006

Lloyd-Topor Completion and General Stable Models

Logic: The Big Picture

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either

Homework #2 Solutions Due: September 5, for all n N n 3 = n2 (n + 1) 2 4

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

CHAPTER 2. FIRST ORDER LOGIC

Predicate Logic: Semantics

if t 1,...,t k Terms and P k is a k-ary predicate, then P k (t 1,...,t k ) Formulas (atomic formulas)

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

System f2lp Computing Answer Sets of First-Order Formulas

COMP4418: Knowledge Representation and Reasoning First-Order Logic

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

Provably Total Functions of Arithmetic with Basic Terms

Theory of Computation

The Mother of All Paradoxes

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

Binary Decision Diagrams

Today. Proof using contrapositive. Compound Propositions. Manipulating Propositions. Tautology

Learning Goals of CS245 Logic and Computation

CS 2800: Logic and Computation Fall 2010 (Lecture 13)

PSPACE-completeness of LTL/CTL model checking

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

Complete Induction and the Well- Ordering Principle

The predicate calculus is complete

First Order Logic (FOL)

arxiv: v1 [cs.lo] 8 Jan 2013

Transcription:

First-Order Predicate Logic Basics 1

Syntax of predicate logic: terms A variable is a symbol of the form x i where i = 1, 2, 3.... A function symbol is of the form fi k where i = 1, 2, 3... und k = 0, 1, 2.... A predicate symbol is of the form Pi k k = 0, 1, 2.... We call i the index and k the arity of the symbol. Terms are inductively defined as follows: 1. Variables are terms. where i = 1, 2, 3... and 2. If f is a function symbol of arity k and t 1,..., t k are terms then f (t 1,..., t k ) is a term. Function symbols of arity 0 are called constant symbols. Instead of fi 0 () we write fi 0. 2

Syntax of predicate logic: formulas If P is a predicate symbol of arity k and t 1,..., t k are terms then P(t 1,..., t k ) is an atomic formula. If k = 0 we write P instead of P(). Formulas (of predicate logic) are inductively defined as follows: Every atomic formula is a formula. If F is a formula, then F is also a formula. If F and G are formulas, then F G, F G and F G are also formulas. If x is a variable and F is a formula, then x F and x F are also formulas. The symbols and are called the universal and the existential quantifier. 3

Syntax trees and subformulas Syntax trees are defined as before, extended with the following trees for xf and xf : x x F F Subformulas again correspond to subtrees. 4

Sructural induction of formulas Like for propositional logic but Different base case: P(P(t 1,..., t k )) Two new induction steps: prove P( x F ) under the induction hypothesis P(F ) prove P( x F ) under the induction hypothesis P(F ) 5

Naming conventions x, y, z,... instead of x 1, x 2, x 3,... a, b, c,... for constant symbols f, g, h,... for function symbols of arity > 0 P, Q, R,... instead of Pi k 6

Precedence of quantifiers Quantifiers have the same precedence as Example x P(x) Q(x) abbreviates ( x P(x)) Q(x) not x (P(x) Q(x)) Similarly for etc. [This convention is not universal] 7

Free and bound variables, closed formulas A variable x occurs in a formula F if it occurs in some atomic subformula of F. An occurrence of a variable in a formula is either free or bound. An occurrence of x in F is bound if it occurs in some subformula of F of the form xg or xg; the smallest such subformula is the scope of the occurrence. Otherwise the occurrence is free. A formula without any free occurrence of any variable is closed. Example x P(x) y Q(a, x, y) 8

Exercise x P(a) x y (Q(x, y) R(x, y)) x Q(x, x) x Q(x, y) x P(x) x Q(x, x) x (P(y) y P(x)) P(x) x Q(x, P(x)) Closed? Y N Y N N x P(f (x)) f P(f (x)) Formula? 9

Semantics of predicate logic: structures A structure is a pair A = (U A, I A ) where U A is an arbitrary, nonempty set called the universe of A, and the interpretation I A is a partial function that maps variables to elements of the universe U A, function symbols of arity k to functions of type U k A U A, predicate symbols of arity k to functions of type UA k {0, 1} (predicates) [or equivalently to subsets of UA k (relations)] I A maps syntax (variables, functions and predicate symbols) to their meaning (elements, functions and predicates) The special case of arity 0 can be written more simply: constant symbols are mapped to elements of U A, predicate symbols of arity 0 are mapped to {0, 1}. 10

Abbreviations: x A abbreviates I A (x) f A abbreviates I A (f ) P A abbreviates I A (P) Example U A = N I A (P) = P A = {(m, n) m, n N and m < n} I A (Q) = Q A = {m m N and m is prime} I A (f ) is the successor function: f A (n) = n + 1 I A (g) is the addition function: g A (m, n) = m + n I A (a) = a A = 2 I A (z) = z A = 3 Intuition: is x P(x, f (x)) Q(g(a, z)) true in this structure? 11

Evaluation of a term in a structure Definition Let t be a term and let A = (U A, I A ) be a structure. A is suitable for t if I A is defined for all variables and function symbols occurring in t. The value of a term t in a suitable structure A, denoted by A(t), is defined recursively: A(x) = x A A(c) = c A A(f (t 1,..., t k ) = f A (A(t 1 ),..., A(t k )) Example A(f (g(a, z))) = 12

Definition Let F be a formula and let A = (U A, I A ) be a structure. A is suitable for F if I A is defined for all predicate and function symbols occurring in F and for all variables occurring free in F. 13

Evaluation of a formula in a structure Let A be suitable for F. The (truth)value of F in A, denoted by A(F ), is defined recursively: A( F ), A(F G), A(F G), A(F G) as for propositional logic A(P(t 1,..., t k )) = A( x F ) = A( x F ) = { 1 if (A(t1 ),..., A(t k )) P A 0 otherwise { 1 if for every d UA, (A[d/x])(F ) = 1 0 otherwise { 1 if for some d UA, (A[d/x])(F ) = 1 0 otherwise A[d/x] coincides with A everywhere except that x A[d/x] = d. 14

Notes During the evaluation of a formulas in a structure, the structure stays unchanged except for the interpretation of the variables. If the formula is closed, the initial interpretation of the variables is irrelevant. 15

Example A( x P(x, f (x)) Q(g(a, z))) = 16

Relation to propositional logic Every propositional formula can be seen as a formula of predicate logic where the atom A i is replaced by the atom P 0 i. Conversely, every formula of predicate logic that does not contain quantifiers and variables can be seen as a formula of propositional logic by replacing atomic formulas by propositional atoms. Example F = (Q(a) P(f (b), b) P(b, f (b))) can be viewed as the propositional formula F = (A 1 A 2 A 3 ). Exercise F is satifiable/valid iff F is satisfiable/valid 17

Predicate logic with equality Predicate logic + distinguished predicate symbol = of arity 2 Semantics: A structure A of predicate logic with equality always maps the predicate symbol = to the identity relation: A(=) = {(d, d) d U A } 18

Model, validity, satisfiability Like in propositional logic Definition We write A = F to denote that the structure A is suitable for the formula F and that A(F ) = 1. Then we say that F is true in A or that A is a model of F. If every structure suitable for F is a model of F, then we write = F and say that F is valid. If F has at least one model then we say that F is satisfiable. 19

Exercise V: valid S: satisfiable, but not valid U: unsatisfiable x P(a) x ( P(x) P(a)) P(a) x P(x) P(x) x P(x) x P(x) x P(x) x P(x) y P(y) V S U 20

Consequence and equivalence Like in propositional logic Definition A formula G is a consequence of a set of formulas M if every structure that is a model of all F M and suitable for G is also model of G. The we write M = G. Two formulas F and G are (semantically) equivalent if every structure A suitable for both F and G satisfies A(F ) = A(G). Then we write F G. 21

Exercise 1. x P(x) x Q(x, x) 2. x (P(x) Q(x, x)) 3. x ( z P(z) y Q(x, y)) 1 = 2 2 = 3 3 = 1 Y N 22

Exercise 1. y x P(x, y) 2. x y P(x, y) 1 = 2 2 = 1 Y N 23

Exercise x y F y x F x y F x y F x y F y x F x F x G x (F G) x F x G x (F G) x F x G x (F G) x F x G x (F G) Y N 24

Equivalences Theorem 1. xf x F xf x F 2. If x does not occur free in G then: ( xf G) x(f G) ( xf G) x(f G) ( xf G) x(f G) ( xf G) x(f G) 3. ( xf xg) x(f G) ( xf xg) x(f G) 4. x yf y xf x yf y xf 25

Replacement theorem Just like for propositional logic it can be proved: Theorem Let F G. Let H be a formula with an occurrence of F as a subformula. Then H H, where H is the result of replacing an arbitrary occurrence of F in H by G. 26