First-Order Predicate Logic (2)

Similar documents
CHAPTER 7 GENERAL PROOF SYSTEMS

Summary Last Lecture. Automated Reasoning. Outline of the Lecture. Definition sequent calculus. Theorem (Normalisation and Strong Normalisation)

3. Mathematical Induction

ON FUNCTIONAL SYMBOL-FREE LOGIC PROGRAMS

Handout #1: Mathematical Reasoning

Predicate logic Proofs Artificial intelligence. Predicate logic. SET07106 Mathematics for Software Engineering

Lecture 13 of 41. More Propositional and Predicate Logic

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Predicate Logic Review

This asserts two sets are equal iff they have the same elements, that is, a set is determined by its elements.

CHAPTER 3. Methods of Proofs. 1. Logical Arguments and Formal Proofs

University of Ostrava. Reasoning in Description Logic with Semantic Tableau Binary Trees

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

Automated Theorem Proving - summary of lecture 1

CS510 Software Engineering

Computability Theory

def: An axiom is a statement that is assumed to be true, or in the case of a mathematical system, is used to specify the system.

Computational Logic and Cognitive Science: An Overview

Scalable Automated Symbolic Analysis of Administrative Role-Based Access Control Policies by SMT solving

Quotient Rings and Field Extensions

Predicate Logic. Example: All men are mortal. Socrates is a man. Socrates is mortal.

Certamen 1 de Representación del Conocimiento

6.080/6.089 GITCS Feb 12, Lecture 3

The Halting Problem is Undecidable

Theory of Automated Reasoning An Introduction. Antti-Juhani Kaijanaho

ML for the Working Programmer

Math 3000 Section 003 Intro to Abstract Math Homework 2

Mathematical Induction

So let us begin our quest to find the holy grail of real analysis.

Solutions Q1, Q3, Q4.(a), Q5, Q6 to INTLOGS16 Test 1

Research Note. Bi-intuitionistic Boolean Bunched Logic

Computational Models Lecture 8, Spring 2009

First-Order Logics and Truth Degrees

(LMCS, p. 317) V.1. First Order Logic. This is the most powerful, most expressive logic that we will examine.

Likewise, we have contradictions: formulas that can only be false, e.g. (p p).

EQUATIONAL LOGIC AND ABSTRACT ALGEBRA * ABSTRACT

CS 3719 (Theory of Computation and Algorithms) Lecture 4

Logic in general. Inference rules and theorem proving

Rigorous Software Development CSCI-GA

2. The Language of First-order Logic

Formalization of the CRM: Initial Thoughts

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

CONTENTS 1. Peter Kahn. Spring 2007

A Propositional Dynamic Logic for CCS Programs

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

Logic in Computer Science: Logic Gates

Algorithmic Software Verification

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

COMPUTER SCIENCE TRIPOS

Regular Languages and Finite Automata

Math 4310 Handout - Quotient Vector Spaces

A Problem Course in Mathematical Logic Version 1.6. Stefan Bilaniuk

A Beginner s Guide to Modern Set Theory

The last three chapters introduced three major proof techniques: direct,

Binary Adders: Half Adders and Full Adders

Predicate Logic. For example, consider the following argument:

Foundational Proof Certificates

Turing Machines: An Introduction

Lecture 8: Resolution theorem-proving

CSE 459/598: Logic for Computer Scientists (Spring 2012)

Basic Proof Techniques

CMPSCI 250: Introduction to Computation. Lecture #19: Regular Expressions and Their Languages David Mix Barrington 11 April 2013

Lecture Notes in Discrete Mathematics. Marcel B. Finan Arkansas Tech University c All Rights Reserved

Bounded Treewidth in Knowledge Representation and Reasoning 1

Schedule. Logic (master program) Literature & Online Material. gic. Time and Place. Literature. Exercises & Exam. Online Material

Updating Action Domain Descriptions

The Foundations of Mathematics

Equality and dependent type theory. Oberwolfach, March 2 (with some later corrections)

A Note on Context Logic

MATHEMATICS: CONCEPTS, AND FOUNDATIONS Vol. III - Logic and Computer Science - Phokion G. Kolaitis

Aikaterini Marazopoulou

INCIDENCE-BETWEENNESS GEOMETRY

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics

Monitoring Metric First-order Temporal Properties

Reading 13 : Finite State Automata and Regular Expressions

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Correspondence analysis for strong three-valued logic

The Steepest Descent Algorithm for Unconstrained Optimization and a Bisection Line-search Method

Remarks on Non-Fregean Logic

Question Answering and the Nature of Intercomplete Databases

First-Order Theories

WHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT?

(IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

Math 223 Abstract Algebra Lecture Notes

A Few Basics of Probability

The Recovery of a Schema Mapping: Bringing Exchanged Data Back

How To Understand The Theory Of Computer Science

Mathematical Induction. Lecture 10-11

Fixed-Point Logics and Computation

Real Roots of Univariate Polynomials with Real Coefficients

Neighborhood Data and Database Security

Full and Complete Binary Trees

WOLLONGONG COLLEGE AUSTRALIA. Diploma in Information Technology

GRAPH THEORY LECTURE 4: TREES

Copyright 2012 MECS I.J.Information Technology and Computer Science, 2012, 1, 50-63

Non-deterministic Semantics and the Undecidability of Boolean BI

Models of Sequential Computation

NP-Completeness and Cook s Theorem

Computational Methods for Database Repair by Signed Formulae

Introduction to Turing Machines

Transcription:

First-Order Predicate Logic (2)

Predicate Logic (2) Understanding first-order predicate logic formulas. Satisfiability and undecidability of satisfiability. Tautology, logical consequence, and logical equivalence. Completeness of first-order predicate logic Incompleteness of arithmetic and second-order logic. Logic in Computer Science 2012 2

Translations into Predicate Logic Every house is a physical object is translated as x.(house(x) physical object(x)), where house and physical object are unary predicate symbols. Some physical objects are houses is translated as x.(physical object(x) house(x)) Every house has an owner or, equivalently, every house is owned by somebody is translated as x(house(x) y.owns(y, x)), here owns is a binary predicate symbol. Everybody owns a house is translated as x. y.(owns(x, y) house(y)) Logic in Computer Science 2012 3

Translations into Predicate Logic Sue owns a house is translated as x.(owns(sue, x) house(x)) where Sue is an individual constant symbol. Peter does not own a house is translated as x.(owns(peter, x) house(x)) Somebody does not own a house is translated as x. y.(owns(x, y) house(y)) Logic in Computer Science 2012 4

The truth relation Let S be the signature consisting of the unary predicates house and human, the binary predicate owns, and the individual constant Sue. Give an S-interpretation F with F = G for the following sentences G: there are houses: x.house(x) there are human beings: x.human(x) no house is a human being: x.(house(x) human(x)) some humans own a house: x. y.(human(x) house(y) owns(x, y)) Sue is human: human(sue) Sue does not own a house: x.(owns(sue, x) house(x)) every house has an owner: x.(house(x) y.owns(y, x)) Logic in Computer Science 2012 5

The S-interpretation F We can take, for example, F defined by D F = {a, b, c, d, e}; human F = {a, b, c}; house F = {d, e} owns F = {(b, d), (c, e)}; Sue F = a. Note that in this interpretation all owners are humans. We can also take human F = {a, b} and the sentences from the previous slide are still true in F. (Note that this is not the case for human F = {a}.) Logic in Computer Science 2012 6

Satisfiability Definition A first-order predicate logic sentence G over S is satisfiable if there exists an S-structure F such that F = G Examples (a) x.(p (x) P (x)) is not satisfiable. (b) x. y.q(x, y) u. v.q(v, u) is satisfiable. (The sentence states that the domain of Q is the whole domain of discourse and that the range of Q is not the whole domain of discourse.) (c) x.p (x) x. P (x) is not satisfiable. Logic in Computer Science 2012 7

Proof for (b) To show that x. y.q(x, y) u. v.q(v, u) is satisfiable we have to define a {Q}-structure F such that F = x. y.q(x, y) u. v.q(v, u) Let D F = {a, b}; Q F = {(a, b), (b, b)}. We have: for all d D F there exists d D F with (d, d ) Q F. Thus, F = x y.q(x, y). For d = a there does not exists d D F such that (d, d) Q F. Thus, F = u. v.q(v, u). Logic in Computer Science 2012 8

Proof for (c) To prove that x.p (x) x. P (x) is not satisfiable, we have to show that for all {P }-structures F: F = x.p (x) x. P (x) For a proof by contradiction assume there exists a {P }-structure F such that F = x.p (x) x. P (x) Since F = x. P (x), there exists d D F such that d P F. Take an assignment a with a(x) = d. Then (F, a) = P (x). Hence F = x.p (x) and we have derived a contradiction to F = x.p (x) x. P (x). Logic in Computer Science 2012 9

Undecidability of satisfiability (very informal!) We show that there does not exist any algorithm (no computer program) that decides whether a first-order predicate logic sentence is satisfiable; i.e., for input sentence G outputs Yes if G is satisfiable and No if G is not satisfiable. To this end, we show that there is no computer program that decides whether a given computer program P halts for a given input number n. (Called undecidability of the halting problem.) To formulate this a bit more precisely, let L be some standard programming language. If a problem is decidable, then one can implement a program in L solving it. With every program P in L we associate a unique number P. Logic in Computer Science 2012 10

Undecidability Now we show: there is no program in L which outputs yes for input (P, n) (P a program in L and n a number) if program P terminates for input n, and outputs no otherwise. For a proof by contradiction, assume there exists a program in L which outputs yes for input (P, n) if P terminates for input n and outputs no otherwise. Then there exists a program Q term that outputs yes for input P if P terminates for input P. Otherwise it outputs no. Logic in Computer Science 2012 11

Undecidability We can rewrite Q term into a program A term that terminates for input P if Q term outputs no for input P. Otherwise it does not terminate. Then A term terminates for input A term if, and only if (by def. of A term ) Q term outputs no for input A term if, and only if (by def. of Q term ) A term does not terminate for input A term. We have derived a contradiction. Now, for any (P, n), (P in a standard programming language L), one can write up a first-order predicate logic sentence F P,n such that F P,n is satisfiable if, and only if, P does not terminate for input n. F P,n describes the computation steps of P. Since the halting problem is undecidable, we obtain that satisfiablility of firstorder predicate logic sentences is undecidable. Logic in Computer Science 2012 12

Tautology Definition A first-order predicate logic sentence G over S is a tautology if F = G holds for every S-structure F. Examples of tautologies (a) x.p (x) x.p (x); (b) x.p (x) P (c); (c) P (c) x.p (x); (d) x(p (x) P (x)); (e) x( (P 1 (x) P 2 (x)) ( P 1 (x) P 2 (x))). Logic in Computer Science 2012 13

Proof for (a) To show that x.p (x) x.p (x) is a tautology it is sufficient to prove that for every {P }-structure F: if F = x.p (x), then F = x.p (x). Assume F = x.p (x). Then P F coincides with the domain of discourse D F ; i.e., P F = D F. Note that D F is, by definition, always nonempty. Thus, there exists d P F. Define a variable assignment a by setting a(x) = d. Then (F, a) = P (x). Hence F = x.p (x). Logic in Computer Science 2012 14

The relationship between satisfiability and tautologies Observation A first-order predicate logic sentence G is a tautology if, and only if, G is not satisfiable. A first-order predicate logic sentence G is satisfiable if, and only if, G is not a tautology. Consequence There is no algorithm that decides whether a first-order predicate logic sentence is a tautology. Proof. Such an alogithm could be used to decide satisfiable of first-order predicate logic sentences. As satisfiability of first-order predicate logic sentences is undecidable, being a tautology is undecidable as well. Logic in Computer Science 2012 15

Semantic consequence Definition Let X be a set of sentences over a signature S and G be a sentence over S. Then G follows from X (is a semantic consequence of X) if the following implication holds for every S-structure F: If F = E for all E X, then F = G. This is denoted by X = G Observations For any first-order sentence G: = G if, and only if, G is a tautology. Since being a tautology is undecidable it follows that being a logical consequence is undecidable: there is not algorithm that decides whether X = G. {G} = F if, and only if, G F is a tautology. Logic in Computer Science 2012 16

Examples Let c be an individual constant and P, Q unary predicate symbols. We have: We have: We have: {P (c)} = xp (x). {P (c), x(p (x) Q(x))} = xq(x). {P (c), x(p (x) Q(x))} = Q(c). Logic in Computer Science 2012 17

Example We can model the logical consequence if my car is blue and all blue cars are fast, then my car is fast as follows: take individual constant MyCar and unary predicates blue, fast, car. Then {blue(mycar), car(mycar), x.((blue(x) car(x)) fast(x))} = fast(mycar) Logic in Computer Science 2012 18

F = G versus X = G Note that F = G or F = G, for every sentence G. Thus, we have complete information about the domain of discourse. There are many examples where X = G and X = G. We have incomplete information. F = G means that G is true in the structure F. Checking whether this is the case for finite F coincides with querying relational database instances and can be done very efficiently. It is also the underlying problem of model checking approaches to program verification: F is a representation of a program and one wants to know whether a property expressed by G is true. X = G means that G is true in every structure in which X is true. This is a much harder problem; in fact, it is undecidable. The research area automated reasoning develops methods which work in some cases. Incomplete databases, ontologies, and theorem proving are application areas which are based on the problem of deciding X = G. Logic in Computer Science 2012 19

Logical equivalence Definition Two first-order predicate logic sentences G 1 and G 2 over a signature S are called logically equivalent if they are true in the same S-structures. In other words, G 1 and G 2 are logically equivalent if the following holds for all S-structures F: F = G 1 if and only if F = G 2. This is denoted by G 1 G 2. Observations G 1 G 2 if, and only if, {G 1 } = G 2 and {G 2 } = G 1 ; G 1 G 2 if, and only if, G 1 G 2 is a tautology. Logic in Computer Science 2012 20

Examples Let G and H be first-order predicate logic formulas. x.g x. G; x.g x. G; x.g x. G; x.g x. G; x.g x.h x.(g H); x.g x.h x.(g H); x.g x.h x(g H); x.g x.h x.(g H). Logic in Computer Science 2012 21

Completeness of First-order Predicate Logic Theorem There exists a computer program that outputs exactly the tautologies of first-order predicate logic. There are many distinct types of deduction systems that can be used to implement such a program: Hilbert-style systems Natural deduction Sequent calculus Tableaux method Resolution Logic in Computer Science 2012 22

Hilbert Style System We assume that formulas are constructed using,, and. We regard,, and as abbreviations: (G D) = ( G D); (G D) = ( G D); x.g = x. G. We set (G D F ) = (G (D F )) Intuitively, (G D F ) means If G and D are true, then F is true. We slightly generalise the notion of a tautology: a formula G is called a tautology if, and only if, the sentence x 1.... x n.g is a tautology, where x 1,..., x n are the free varables of G. Logic in Computer Science 2012 23

The Axioms (Part 1) The following formulas are tautologies, for any first-order predicate logic formulas D, G, and F : (A1) ((G D F ) (G D) (G F )) (A2) (G (D G D)) (A3) ((G D) G) (A4) ((G D) D) (A5) ((G D) (D G)) Note that (A1)-(A5) axiomatize the propositional part of first-order predicate logic. Logic in Computer Science 2012 24

The Axioms (Part 2) If t is a term, then we write G t for the formula obtained from G by replacing x every free occurrence of x in G by t. For example P (x) c = P (c) x x.p (x) c x = x.p (x) The following formulas are tautologies for all first-order predicate logic formulas G and D: (A6) x.g G t x (t not bound in G) (A7) G x.g (x not free in G) (A8) ( x.(g D) ( x.g x.d)) (A9) ( y.g y x x.g) (y not in G) Logic in Computer Science 2012 25

Two Rules We take, in addition to the axioms (A1)-(A9), the following two rules: (MP) G, G D/D; (GE) G/ x.g. The first rules is called Modus Ponens. The second rule is called Generalisation. Note if G and G D are tautologies, then D is a tautology if G is a tautology, then x.g is a tautology. Logic in Computer Science 2012 26

Completeness We say that G is provable from (A1)-(A9) with (MP) and (GE) if, and only if, there is a sequence G 1,..., G n such that for all G i one of the following conditions holds: G i is of the form (A1) or (A2) or or (A9); there exists j < i such that G j = F and G i = x.f (for some F, x); there exist j, k < i such that G j = F and G k = F G i (for some F ). Theorem A formula G is a tautology if, and only if, it is provable from (A1)-(A9) with (MP) and (GE). Logic in Computer Science 2012 27

Arithmetic is incomplete Recall that S AR = {smaller, sum, prod, even, 0, 1,...} The standard structure for S AR is given by A = (D A, smaller A, sum A, prod A, even A, 0 A, 1 A,...) where D A is the set of natural numbers 0, 1, 2...; smaller A = {(n, m) n < m}; sum A = {(n, m, k) n + m = k}; prod A = {(n, m, k) n m = k}; even A = {n n is even }; 0 A = 0, 1 A = 1, and so on. Logic in Computer Science 2012 28

Incompleteness of Arithmetic Theorem There does not exist an algorithm (computer program) that outputs exactly the first-order sentences G over S AR such that A = G. It follows, in particular, that there is no finitary calculus that captures the sentences that are true in A. Undecidability of arithmetic follows from incompleteness: Theorem There does not exist an algorithm (computer program) that decides whether for a first-order sentence G over S AR it holds that A = G. Logic in Computer Science 2012 29

Second-order Predicate Logic Second-order predicate logic is an extension of first-order predicate logic which has, for every arity n > 0, variables X for relations of arity n. If X is a variable of arity n and t 1,..., t n are terms, then X(t 1,..., t n ) is a second-order formula. Then, if X is a variable and G is a second-order predicate logic formula, X.G is a formula of second-order predicate logic. Second-order logic is much more expressive than first-order logic. For example, one can formalise induction (we use, for simplicity, + instead of sum): X.((X(0) ( x.x(x) X(x + 1))) y.x(y)) Theorem There does not exist an algorithm (computer program) that outputs exactly the tautologies of second-order logic. Logic in Computer Science 2012 30