Theory of Computer Science

Similar documents
Theory of Computer Science

Logic: First Order Logic (Part I)

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

B1.1 Motivation. Theory of Computer Science. Theory of Computer Science. B1.1 Motivation. B1.2 Syntax. B1.3 Semantics

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


Theory of Computer Science

First Order Logic (FOL) 1 znj/dm2017

Review of Predicate Logic

ACLT: Algebra, Categories, Logic in Topology - Grothendieck's generalized topological spaces (toposes)

Introduction to first-order logic:

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

Theory of Computer Science

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

Predicate Calculus - Syntax

G52DOA - Derivation of Algorithms Predicate Logic

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

Predicate Logic: Sematics Part 1

Relations to first order logic

Predicate Logic. CSE 595 Semantic Web Instructor: Dr. Paul Fodor Stony Brook University

C1.1 Introduction. Theory of Computer Science. Theory of Computer Science. C1.1 Introduction. C1.2 Alphabets and Formal Languages. C1.

AAA615: Formal Methods. Lecture 2 First-Order Logic

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

Logic Part I: Classical Logic and Its Semantics

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

AI Principles, Semester 2, Week 2, Lecture 5 Propositional Logic and Predicate Logic

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

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

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

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

Infinite Truth-Functional Logic

Discrete Mathematics and Its Applications

MAI0203 Lecture 7: Inference and Predicate Calculus

Theory of Computer Science

INF3170 Logikk Spring Homework #8 For Friday, March 18

Chapter 4: Classical Propositional Semantics

Classical First-Order Logic

Predicate Calculus - Semantics 1/4

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

Propositional and Predicate Logic

185.A09 Advanced Mathematical Logic

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

First-Order Predicate Logic. Basics

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

Introduction to Sets and Logic (MATH 1190)

Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics Lecture notes in progress (27 March 2010)

03 Review of First-Order Logic

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

CHAPTER 2. FIRST ORDER LOGIC

Automated Reasoning Lecture 5: First-Order Logic

06 From Propositional to Predicate Logic

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

Notes on Propositional and First-Order Logic (CPSC 229 Class Notes, January )

From Constructibility and Absoluteness to Computability and Domain Independence

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

Why Knowledge Representation?

1 First-order logic. 1 Syntax of first-order logic. 2 Semantics of first-order logic. 3 First-order logic queries. 2 First-order query evaluation

Section Summary. Section 1.5 9/9/2014

Why Knowledge Representation? Example. Example. CSE 3401: Intro to AI & LP Knowledge Representation & First-Order Logic

Foundations of Artificial Intelligence

Introduction to Model Theory

First-order logic Syntax and semantics

Logic. Definition [1] A logic is a formal language that comes with rules for deducing the truth of one proposition from the truth of another.

Modal Logic. UIT2206: The Importance of Being Formal. Martin Henz. March 19, 2014

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

Propositional Logic Language

Formal Methods for Java

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

Lecture 1: Logical Foundations

An Introduction to Modal Logic III

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.

First order Logic ( Predicate Logic) and Methods of Proof

ICS141: Discrete Mathematics for Computer Science I

02 Propositional Logic

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

Tecniche di Verifica. Introduction to Propositional Logic

CS589 Principles of DB Systems Fall 2008 Lecture 4e: Logic (Model-theoretic view of a DB) Lois Delcambre

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

LING 501, Fall 2004: Quantification

Some consequences of compactness in Lukasiewicz Predicate Logic

Final Exam (100 points)

Chapter 2: Introduction to Propositional Logic

Mat 243 Exam 1 Review

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Part 2: First-Order Logic

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

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

Predicate Logic: Syntax

MATH 770 : Foundations of Mathematics. Fall Itay Ben-Yaacov

Lecture 4: Proposition, Connectives and Truth Tables

Applied Logic for Computer Scientists. Answers to Some Exercises

cis32-ai lecture # 18 mon-3-apr-2006

Lecture 12. Statement Logic as a word algebra on the set of atomic statements. Lindenbaum algebra.

PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

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

Fundamentals of Software Engineering

First Order Logic: Syntax and Semantics

Logic for Computer Science - Week 4 Natural Deduction

CS1021. Why logic? Logic about inference or argument. Start from assumptions or axioms. Make deductions according to rules of reasoning.

First-Order Logic (FOL)

Transcription:

Theory of Computer Science B3. Predicate Logic I Malte Helmert University of Basel March 7, 2016

Motivation

Limits of Propositional Logic group axioms for G, and neutral element e: 1 For all x, y, z G, (x y) z = x (y z). 2 For all x G, x e = x. 3 For all x G, there is a y G with x y = e. cannot be expressed in propositional logic: objects x, y, z from G object references (x y) with function equality = for all, there is need more expressive logic predicate logic German: Prädikatenlogik

Limits of Propositional Logic group axioms for G, and neutral element e: 1 For all x, y, z G, (x y) z = x (y z). 2 For all x G, x e = x. 3 For all x G, there is a y G with x y = e. cannot be expressed in propositional logic: objects x, y, z from G object references (x y) with function equality = for all, there is need more expressive logic predicate logic German: Prädikatenlogik

Limits of Propositional Logic group axioms for G, and neutral element e: 1 For all x, y, z G, (x y) z = x (y z). 2 For all x G, x e = x. 3 For all x G, there is a y G with x y = e. cannot be expressed in propositional logic: objects x, y, z from G object references (x y) with function equality = for all, there is need more expressive logic predicate logic German: Prädikatenlogik

Syntax of Predicate Logic

Syntax: Building Blocks Signatures define allowed symbols. analogy: variable set A in propositional logic Terms are associated with objects by the semantics. no analogy in propositional logic Formulas are associated with truth values (true or false) by the semantics. analogy: formulas in propositional logic German: Signatur, Term, Formel

Signatures: Definition Definition (Signature) A signature (of predicate logic) is a 4-tuple S = V, C, F, P consisting of the following four disjoint sets: a finite or countable set V of variable symbols a finite or countable set C of constant symbols a finite or countable set F of function symbols a finite or countable set P of predicate symbols (or relation symbols) Every function symbol f F and predicate symbol P P has an associated arity ar(f), ar(p) N 1 (number of arguments). German: Variablen-, Konstanten-, Funktions-, Prädikat- und Relationssymbole; Stelligkeit

Signatures: Terminology and Conventions terminology: k-ary (function or predicate) symbol: symbol s with arity ar(s) = k. also: unary, binary, ternary German: k-stellig, unär, binär, ternär conventions (in this lecture): variable symbols written in italics, other symbols upright. predicate symbols begin with capital letter, other symbols with lower-case letters

Signatures: Examples Example: Arithmetic V = {x, y, z, x 1, x 2, x 3,... } C = {zero, one} F = {sum, product} P = {Positive, SquareNumber} ar(sum) = ar(product) = 2, ar(positive) = ar(squarenumber) = 1

Signatures: Examples Example: Genealogy V = {x, y, z, x 1, x 2, x 3,... } C = {roger-federer, lisa-simpson} F = P = {Female, Male, Parent} ar(female) = ar(male) = 1, ar(parent) = 2

Terms: Definition Definition (Term) Let S = V, C, F, P be a signature. A term (over S) is inductively constructed according to the following rules: Every variable symbol v V is a term. Every constant symbol c C is a term. If t 1,..., t k are terms and f F is a function symbol with arity k, then f(t 1,..., t k ) is a term. German: Term examples: x 4 lisa-simpson sum(x 3, product(one, x 5 ))

Terms: Definition Definition (Term) Let S = V, C, F, P be a signature. A term (over S) is inductively constructed according to the following rules: Every variable symbol v V is a term. Every constant symbol c C is a term. If t 1,..., t k are terms and f F is a function symbol with arity k, then f(t 1,..., t k ) is a term. German: Term examples: x 4 lisa-simpson sum(x 3, product(one, x 5 ))

Formulas: Definition Definition (Formula) For a signature S = V, C, F, P the set of predicate logic formulas (over S) is inductively defined as follows:... If t 1,..., t k are terms (over S) and P P is a k-ary predicate symbol, then the atomic formula (or the atom) P(t 1,..., t k ) is a formula over S. If t 1 and t 2 are terms (over S), then the identity (t 1 = t 2 ) is a formula over S. If x V is a variable symbol and ϕ a formula over S, then the universal quantification x ϕ and the existential quantification x ϕ are formulas over S. German: atomare Formel, Atom, Identität, Allquantifizierung, Existenzquantifizierung

Formulas: Definition Definition (Formula) For a signature S = V, C, F, P the set of predicate logic formulas (over S) is inductively defined as follows:... If ϕ is a formula over S, then so is its negation ϕ. If ϕ and ψ are formulas over S, then so are the conjunction (ϕ ψ) and the disjunction (ϕ ψ). German: Negation, Konjunktion, Disjunktion

Formulas: Examples Examples: Arithmetic and Genealogy Positive(x 2 ) x ( SquareNumber(x) Positive(x)) x 3 (SquareNumber(x 3 ) Positive(x 3 )) x (x = y) x (sum(x, x) = product(x, one)) x y (sum(x, y) = zero) x y (Parent(y, x) Female(y)) Terminology: The symbols and are called quantifiers. German: Quantoren

Abbreviations and Placement of Parentheses by Convention abbreviations: (ϕ ψ) is an abbreviation for ( ϕ ψ). (ϕ ψ) is an abbreviation for ((ϕ ψ) (ψ ϕ)). Sequences of the same quantifier can be abbreviated. For example: x y z ϕ xyz ϕ x y z ϕ xyz ϕ w x y z ϕ w xy z ϕ placement of parentheses by convention: analogous to propositional logic quantifiers and bind more strongly than anything else. example: x P(x) Q(x) corresponds to ( x P(x) Q(x)), example: not x (P(x) Q(x)).

Abbreviations and Placement of Parentheses by Convention abbreviations: (ϕ ψ) is an abbreviation for ( ϕ ψ). (ϕ ψ) is an abbreviation for ((ϕ ψ) (ψ ϕ)). Sequences of the same quantifier can be abbreviated. For example: x y z ϕ xyz ϕ x y z ϕ xyz ϕ w x y z ϕ w xy z ϕ placement of parentheses by convention: analogous to propositional logic quantifiers and bind more strongly than anything else. example: x P(x) Q(x) corresponds to ( x P(x) Q(x)), example: not x (P(x) Q(x)).

Questions Questions?

Semantics of Predicate Logic

Semantics: Motivation interpretations in propositional logic: truth assignments for the propositional variables There are no propositional variables in predicate logic. instead: interpretation determines meaning of the constant, function and predicate symbols. meaning of variable symbols not determined by interpretation but by separate variable assignment.

Interpretations and Variable Assignments Let S = V, C, F, P be a signature. Definition (Interpretation, Variable Assignment) An interpretation (for S) is a pair I = U, I of: a non-empty set U called the universe and a function I that assigns a meaning to the constant, function, and predicate symbols: c I U for constant symbols c C f I : U k U for k-ary function symbols f F P I U k for k-ary predicate symbols P P A variable assignment (for S and universe U) is a function α : V U. German: Interpretation, Variablenzuweisung, Universum (or Grundmenge)

Interpretations and Variable Assignments: Example Example signature: S = V, C, F, P with V = {x, y, z}, C = {zero, one}, F = {sum, product}, P = {SquareNumber} ar(sum) = ar(product) = 2, ar(squarenumber) = 1 I = U, I with U = {u 0, u 1, u 2, u 3, u 4, u 5, u 6 } zero I = u 0 one I = u 1 sum I (u i, u j ) = u (i+j) mod 7 for all i, j {0,..., 6} product I (u i, u j ) = u (i j) mod 7 for all i, j {0,..., 6} SquareNumber I = {u 0, u 1, u 2, u 4 } α = {x u 5, y u 5, z u 0 }

Interpretations and Variable Assignments: Example Example signature: S = V, C, F, P with V = {x, y, z}, C = {zero, one}, F = {sum, product}, P = {SquareNumber} ar(sum) = ar(product) = 2, ar(squarenumber) = 1 I = U, I with U = {u 0, u 1, u 2, u 3, u 4, u 5, u 6 } zero I = u 0 one I = u 1 sum I (u i, u j ) = u (i+j) mod 7 for all i, j {0,..., 6} product I (u i, u j ) = u (i j) mod 7 for all i, j {0,..., 6} SquareNumber I = {u 0, u 1, u 2, u 4 } α = {x u 5, y u 5, z u 0 }

Semantics: Informally Example: ( x(block(x) Red(x)) Block(a)) For all objects x: if x is a block, then x is red. Also, the object called a is a block. Terms are interpreted as objects. Unary predicates denote properties of objects (to be a block, to be red, to be a square number,... ) General predicates denote relations between objects (to be someone s child, to have a common divisor,... ) Universally quantified formulas ( ) are true if they hold for every object in the universe. Existentially quantified formulas ( ) are true if they hold for at least one object in the universe.

Interpretations of Terms Let S = V, C, F, P be a signature. Definition (Interpretation of a Term) Let I = U, I be an interpretation for S, and let α be a variable assignment for S and universe U. Let t be a term over S. The interpretation of t under I and α, written as t I,α, is the element of the universe U defined as follows: If t = x with x V (t is a variable term): x I,α = α(x) If t = c with c C (t is a constant term): c I,α = c I If t = f(t 1,..., t k ) (t is a function term): f(t 1,..., t k ) I,α = f I (t I,α 1,..., t I,α k )

Interpretations of Terms: Example Example signature: S = V, C, F, P with V = {x, y, z}, C = {zero, one}, F = {sum, product}, ar(sum) = ar(product) = 2 I = U, I with U = {u 0, u 1, u 2, u 3, u 4, u 5, u 6 } zero I = u 0 one I = u 1 sum I (u i, u j ) = u (i+j) mod 7 for all i, j {0,..., 6} product I (u i, u j ) = u (i j) mod 7 for all i, j {0,..., 6} α = {x u 5, y u 5, z u 0 }

Interpretations of Terms: Example Example signature: S = V, C, F, P with V = {x, y, z}, C = {zero, one}, F = {sum, product}, ar(sum) = ar(product) = 2 I = U, I with U = {u 0, u 1, u 2, u 3, u 4, u 5, u 6 } zero I = u 0 one I = u 1 sum I (u i, u j ) = u (i+j) mod 7 for all i, j {0,..., 6} product I (u i, u j ) = u (i j) mod 7 for all i, j {0,..., 6} α = {x u 5, y u 5, z u 0 }

Interpretations of Terms: Example (ctd.) Example (ctd.) zero I,α = y I,α = sum(x, y) I,α = product(one, sum(x, zero)) I,α =

Semantics of Predicate Logic Formulas Let S = V, C, F, P be a signature. Definition (Formula is Satisfied or True) Let I = U, I be an interpretation for S, and let α be a variable assignment for S and universe U. We say that I and α satisfy a predicate logic formula ϕ (also: ϕ is true under I and α), written: I, α = ϕ, according to the following inductive rules:... I, α = P(t 1,..., t k ) iff t I,α 1,..., t I,α P I I, α = (t 1 = t 2 ) iff t I,α 1 = t I,α 2 I, α = ϕ iff I, α = ϕ I, α = (ϕ ψ) iff I, α = ϕ and I, α = ψ I, α = (ϕ ψ) iff I, α = ϕ or I, α = ψ k

Semantics of Predicate Logic Formulas Let S = V, C, F, P be a signature. Definition (Formula is Satisfied or True)... I, α = xϕ iff I, α[x := u] = ϕ for all u U I, α = xϕ iff I, α[x := u] = ϕ for at least one u U where α[x := u] is the same variable assignment as α, except that it maps variable x to the value u. Formally: { u if z = x (α[x := u])(z) = α(z) if z x German: I und α erfüllen ϕ (also: ϕ ist wahr unter I und α)

Semantics: Example Example signature: S = V, C, F, P with V = {x, y, z}, C = {a, b}, F =, P = {Block, Red}, ar(block) = ar(red) = 1. I = U, I with U = {u 1, u 2, u 3, u 4, u 5 } a I = u 1 b I = u 3 Block I = {u 1, u 2 } Red I = {u 1, u 2, u 3, u 5 } α = {x u 1, y u 2, z u 1 }

Semantics: Example Example signature: S = V, C, F, P with V = {x, y, z}, C = {a, b}, F =, P = {Block, Red}, ar(block) = ar(red) = 1. I = U, I with U = {u 1, u 2, u 3, u 4, u 5 } a I = u 1 b I = u 3 Block I = {u 1, u 2 } Red I = {u 1, u 2, u 3, u 5 } α = {x u 1, y u 2, z u 1 }

Semantics: Example (ctd.) Example (ctd.) Questions: I, α = (Block(b) Block(b))? I, α = (Block(x) (Block(x) Block(y)))? I, α = (Block(a) Block(b))? I, α = x(block(x) Red(x))?

Semantics: Example (ctd.) Example (ctd.) Questions: I, α = (Block(b) Block(b))?

Semantics: Example (ctd.) Example (ctd.) Questions: I, α = (Block(x) (Block(x) Block(y)))?

Semantics: Example (ctd.) Example (ctd.) Questions: I, α = (Block(a) Block(b))?

Semantics: Example (ctd.) Example (ctd.) Questions: I, α = x(block(x) Red(x))?

Questions Questions?

Summary

Summary Predicate logic is more expressive than propositional logic and allows statements over objects an their properties. Objects are described by terms that are built from variable, constant and function symbols. Properties and relations are described by formulas that are built from predicates, quantifiers and the usual logical operators. As with all logics, we analyze syntax: what is a formula? semantics: how do we interpret a formula?