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

Similar documents
06 From Propositional to Predicate Logic

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

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

A Logic Primer. Stavros Tripakis University of California, Berkeley

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

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

Predicate Calculus. CS 270 Math Foundations of Computer Science Jeremy Johnson

Predicate Logic - Introduction

PREDICATE LOGIC: UNDECIDABILITY AND INCOMPLETENESS HUTH AND RYAN 2.5, SUPPLEMENTARY NOTES 2

Introduction to Logic in Computer Science: Autumn 2006

15414/614 Optional Lecture 3: Predicate Logic

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

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

Classical First-Order Logic

Propositional and Predicate Logic - II

First Order Logic (FOL) 1 znj/dm2017

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

Introduction to first-order logic:

Advanced Topics in LP and FP

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

CSCE 222 Discrete Structures for Computing. Propositional Logic. Dr. Hyunyoung Lee. !!!!!! Based on slides by Andreas Klappenecker

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

Classical First-Order Logic

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

Propositional logic (revision) & semantic entailment. p. 1/34

Propositional Logic: Syntax

GS03/4023: Validation and Verification Predicate Logic Jonathan P. Bowen Anthony Hall

The semantics of propositional logic

Logic as a Tool Chapter 1: Understanding Propositional Logic 1.1 Propositions and logical connectives. Truth tables and tautologies

Automated Reasoning Lecture 5: First-Order Logic

Logic Part I: Classical Logic and Its Semantics

Propositional Logic Language

INTRODUCTION TO LOGIC. Propositional Logic. Examples of syntactic claims

Stanford University CS103: Math for Computer Science Handout LN9 Luca Trevisan April 25, 2014

Propositional Logic: Models and Proofs

Logic: Propositional Logic (Part I)

Logic. Readings: Coppock and Champollion textbook draft, Ch

Logic. Propositional Logic: Syntax

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.

Learning Goals of CS245 Logic and Computation

Knowledge base (KB) = set of sentences in a formal language Declarative approach to building an agent (or other system):

Chapter 4: Classical Propositional Semantics

Mathematics 114L Spring 2018 D.A. Martin. Mathematical Logic

Part 1: Propositional Logic

A statement is a sentence that is definitely either true or false but not both.

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

A Little Deductive Logic

Propositional Logic: Part II - Syntax & Proofs 0-0

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

A Little Deductive Logic

Natural Deduction for Propositional Logic

Comp487/587 - Boolean Formulas

Lecture 1: Logical Foundations

MAI0203 Lecture 7: Inference and Predicate Calculus

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

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


PROPOSITIONAL LOGIC. VL Logik: WS 2018/19

Propositional Logic: Review

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

1 Propositional Logic

Logic Overview, I. and T T T T F F F T F F F F

Introduction to Sets and Logic (MATH 1190)

First-Order Logic. Chapter Overview Syntax

2/2/2018. CS 103 Discrete Structures. Chapter 1. Propositional Logic. Chapter 1.1. Propositional Logic

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

Proseminar on Semantic Theory Fall 2013 Ling 720 Propositional Logic: Syntax and Natural Deduction 1

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

Introduction to Theoretical Computer Science

Informal Statement Calculus

Predicate Logic: Sematics Part 1

Logic. Propositional Logic: Syntax. Wffs

Lecture 11: Measuring the Complexity of Proofs

Logical Structures in Natural Language: Propositional Logic II (Truth Tables and Reasoning

Reasoning with Quantified Boolean Formulas

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

02 Propositional Logic

Supplementary exercises in propositional logic

Example. Logic. Logical Statements. Outline of logic topics. Logical Connectives. Logical Connectives

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

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

Examples: P: it is not the case that P. P Q: P or Q P Q: P implies Q (if P then Q) Typical formula:

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

Logic and Proofs. (A brief summary)

Přednáška 12. Důkazové kalkuly Kalkul Hilbertova typu. 11/29/2006 Hilbertův kalkul 1

Mathematical Preliminaries. Sipser pages 1-28

Mat 243 Exam 1 Review

Tecniche di Verifica. Introduction to Propositional Logic

3 Propositional Logic

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

A brief introduction to Logic. (slides from

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

First Order Logic (FOL)

Discrete Mathematical Structures. Chapter 1 The Foundation: Logic

CHAPTER 2. FIRST ORDER LOGIC

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

COMP 2600: Formal Methods for Software Engineeing

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.

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

COMP219: Artificial Intelligence. Lecture 19: Logic for KR

Transcription:

INTRODUCTION TO PREDICATE LOGIC HUTH AND RYAN 2.1, 2.2, 2.4 Neil D. Jones DIKU 2005 Some slides today new, some based on logic 2004 (Nils Andersen), some based on kernebegreber (NJ 2005)

PREDICATE LOGIC: SYNTAX AND SEMANTICS Quick review of models versus proofs Models of propositional logic, completeness Formal syntax of predicate logic Informal predicate logic Formal syntax of predicate logic Models and environments Semantic entailment 1

THREE WORLDS, TWO VIEWS ON MODELING Engineering The real world model in the sense of science World of models, meanings model in the sense of logic World of logical formulas M = φ Left side: scientific experiments, measurements, what is out there? Purpose: analytic, to understand nature. Right side: specifications to define what is to be done! Purpose: synthetic, to construct systems. 2

MODEL THEORY VERSUS PROOF THEORY M = φ Model (or system) M satisfies statement φ (a formula) - This says something about how system M behaves - It is about validity or truth (Alfred Tarski, 1930s) Γ φ Model M satisfies formula φ - This says that formula φ can be proven from assumptions Γ (dates back to the ancient Greeks) - It is about a formal system, not about truth Amazingly, these two approaches are often equivalent: One can prove: true properties about systems by means of : formal manipulation of symbols This is the central point of this course. (in spite of what sometimes looks like pedantic symbol pushing.) 3

MODELING ( =) VERSUS PROVING ( ) A major theme is the equivalence of the two: Soundness: implies =: What can be is true. Completeness: = implies : What is true can be proven. Propositional logic: is equivalent to =, but nontrivial (in spite of the simplicity of truth tables). Reason: SAT is NP-hard. 4

PROPOSITIONAL LOGIC Judgements formed with propositional variables p, q, r, p 1,..., and operators: Negation φ, φ, φ Disjunction Classically exclusive (lat. aut... aut... ), now always inclusive (lat. vel... vel... ), φ v ψ, φ ψ, φ + ψ Conjunction φ & ψ, φ ψ, φψ, φ ψ Implication φ ψ, φ < ψ, φ ψ, φ ψ Absurdity, contradiction 0, F,, Λ, (bottom) Priorities: binds tighter than {, }, We don t decide on a priority between and.) Other logical operators: Exclusive disjunction +,. Equivalence =,,,. Tautology 1, T,, 5

THE BOOLEAN UNIVERSE OF MEANINGS, AND OPERATIONS The Boolean universe: Bool = {0, 1} = {F, T}. Truth tables that define the semantic operations,,, on boolean values. x x x y x y x y x y x y x y 0 1 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 1 1 1 0 0 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 6

INTERPRETATION OF BOOLEAN FORMULAS We distinguish carefully between a Boolean formula and a Boolean value A Boolean formula is a piece of syntax such as 0 (0 0), i.e., a string of symbols. The value of this formula is the Boolean value 0, the same as the value of another formula 1 (0 1). If no variables, we write [[φ]] to denote the value of φ, one of the two elements of Bool. Using the rules just given, for instance, we would expect: [[0 (0 0)]] = 0 7

HOW TO EVALUATE A PROPOSITIONAL FORMULAS WITH VARIABLES? It seems natural, for example, that P P should evaluate to 1, and that P P should evaluate to 0, even if P is a Boolean variable. But what about formula P Q? Answer: it depends on the values that variables P and Q currently have. An interpretation of propositional formula φ is a function I : BooleanVariable Bool that assigns a value in Bool to every propositional variable in φ. In the book I is also called an environment or a look-up table. 8

EVALUATION OF PROPOSITIONAL FORMULAS. [[φ]] I this is defined in the natural way, using the interpretation l to find the values of propositional variables: [[T ]] I = 1 [[F ]] I = 0 [[P ]] I = I(P ) for any propositional variable P [[ φ]] I = ([[φ]] I ) [[φ 1 φ 2 ]] I [[φ 1 φ 2 ]] I = [[φ 1 ]] I [[φ 2 ]] I = [[φ 1 ]] I [[φ 2 ]] I [[φ 1 φ 2 ]] I Remarks. = [[φ 1 ]] I [[φ 2 ]] I This definition uses syntactic operations to the left, inside [[ ]]. On the right sides are their semantic counterparts. Thus the to the left of the = is a symbol appearing in Boolean formulas, and the to the right of the = is a function on Boolean values. 9

SATISFIABILITY, TAUTOLOGY, SEMANTIC ENTAILMENT Propositional φ is satisfiable if [[φ]] I = 1 for some interpretation I for φ: φ = (A B) (B C) ( A C) is satisfiable by interpretation (truth assignment) I = [A 0, B 0, C 1] φ is a tautology if [[φ]] I = 1 for all interpretations I: A A (A B) A B (A B) A B A (B C) (A B) (A C) We say φ 1,..., φ n semantically entail ψ, written φ 1,..., φ n = ψ if φ 1,..., φ n evaluate to 1 implies ψ evaluates to 1 for all interpretations I, i.e.: [[φ 1 φ 2... φ n ]] I = 1 implies [[φ 1 φ 2... φ n ]] I = 1 10

NEED FOR A MORE EXPRESSIVE LOGICAL LANGUAGE Not natural in simple propositional logic:not all birds can fly, x(b(x) F (x)) or perhaps x(b(x) F (x)) Andy and Paul have the same maternal grandmother (Da.: mormor), v w(a(v) P (w) x y z(m(z, x) M(z, y) M(x, v) M(y, w))). Ann likes Mary s brother: Do we mean or perhaps x y z(a(x) M(y) B(z, y) L(x, z)) x y z(a(x) M(y) B(z, y) L(x, z)) Function f (from one topological space to another one) is continuous in the point x... 11

NEW FEATURES IN PREDICATE LOGIC Individual variables: x, y, z,... may be considered to vary over one (or more) universes. (Letters in the propositional calculus denoted fixed statements, like it rains, taxis are available at the station, etc.) Predicate symbols: B( ), M(, ), etc. denote fixed relations is a bird, is mother of. Quantifiers: For all x ( x) and there exists an x ( x) bind the individual variable x. Limits to first order predicate logic: No quantifiers over predicates no predicates applied to predicates x y(s(y, x) P (P (x)...)) P (Q, x)... 12

A FAMILIAR EXAMPLE Beginning analysis texts usually define a function f : R R on the real numbers to be continuous iff it satisfies ε > 0( δ > 0( x y ( x y < δ f(x) f(y) < ε))) This could be expressed in our notation as where ε(p (ε) δ(p (δ) x y(l(a(x, y), δ) L(a(f(x), f(y)), ε)))) predicate name P : P (z) stands for z > 0, and function symbol: a(x, y) stands for x y, and predicate name L: L(r, s) stands for r < s. How can we make the phrase stands for more precise? 13

VARIANTS Quantifiers over several universes: (not studied!) may be expressed IR+ ε IN0 N IN0 n(n N a a n ε) ε(real(ε) ε > 0 N(Nat(N) n(nat(n) (n N a a n ε)))) Equality: A special predicate Equal(x, y), usually written with infix notation: x = y. (Reflexive, symmetric, transitive, substitutive.) Constants and function symbols: Could be eliminated, but are nice to have: mother(mother(andy)) = mother(mother(paul)) or z(b(z, mary) L(ann, z)) Constants can be considered functions of arity 0 (taking 0 arguments), but we write them without the parentheses: mary, rather than mary(). 14

There are two syntactic sorts: SYNTAX OF PREDICATE LOGIC formulas φ or ψ: denote true or false, i.e., 1 or 0; and terms t: denote values. Each predicate name P or function symbol f is pre-assigned an arity, a natural number n. φ, ψ ::= φ φ 1 φ 2 φ 1 φ 2 φ 1 φ 2 x φ x φ universal and existential quantifiers P (t 1,..., t n ) where n =arity(p ) t ::= x f(t 1,..., t n ) where n =arity(f) x ::= (individual) variable There are no propositional variables P ::= predicate symbol (including = with arity 2) f ::= function symbol (each has arity n 0) 15

PRIORITIES, FREE AND BOUND VARIABLES Priorities. has lowest priority,, have same priority, has highest priority. Free and bound variables. Each occurrence of a variable is either free or bound in a (sub)formula. An occurrence of x is bound by the smallest xϕ or xϕ where the ϕ contains this occurrence of x; unbound occurrences are free. In xϕ, ϕ, with the exception of any inner subformulas of form xψ or xψ, is said to be the scope of this x. The scope of an occurrence of x is defined similarly. Close analogy: scopes of declared variables in a programming language. Statement: a formula with no free variables. 16

MODEL (More complex than for the propositional calculus.) A first order language is specified by a pair (F, P) of function symbols F (we include constants as arity 0 function symbols) and predicate symbols P, each with a specified arity. A model M for such a pair has 1. A non-empty carrier or universe of values A 2. For each f F of arity m a concrete function f M : A m A (for a constant c a concrete value c M A) 3. For each P P of arity n a relation P M A n. 4. Constraint: If P is the equality symbol, then = M we will require to be the identity relation on A. = M = {(a, a) a A} 17

A SILLY EXAMPLE: LOLA S LOVERS Predicates: one 2-ary L ( loves ) Constants: one 0-ary lola (a function symbol ) A statement: φ x (L(lola, x) L(x, lola)) Anyone Lola loves, loves Lola A model M of φcould have 1. Universe A M = {lola, john, harry} 2. Constant lola M = lola (in the flesh!) 3. Loves relation interpretation: L M = {(lola, lola), (lola, john), (john, lola), (harry, john)} A non-model M of φ has same Universe and Constant, but L interpreted: L M = {(lola, lola), (lola, john), (lola, harry), (john, lola), (harry, john)} 18

An environment l for the model interprets variables ENVIRONMENT M = (A, (f M ) f F, (P M ) P P ) l : var A Term evaluation. Presented with a model M for (F, P) and an environment l for M we may interpret any term over (F, P): [[x]] M l = l(x) [[c]] M l = c M [[f(t 1,..., t m )]] M l = f M ([[t 1 ]] M l,..., [[t m]] M l ) 19

SATISFACTION IN AN ENVIRONMENT ϕ is satisfied in M with respect to l, written M = l ϕ is defined by M = l ϕ ψ if and only if M = l ψ whenever M = l ϕ M = l ϕ ψ if and only if M = l ϕ and M = l ψ M = l ϕ ψ if and only if M = l ϕ or M = l ψ M = l ϕ if and only if M = l ϕ does not hold M = l xϕ M = l xϕ if and only if M = l[x a] ϕ holds for all a A if and only if M = l[x a] ϕ holds for some a A M = l P (t 1,..., t n ) if and only if { ([[t 1 ]] M l,..., [[t n]] M l ) P M l[x a](y) = a if y = x l(y) otherwise M = l ϕ means: M = l ϕ does not hold We write just I = φ in case φ is closed, since the value of l plays no role. 20

SEMANTIC ENTAILMENT If l and l only differ outside of the free variables of ϕ, then M = l ϕ if and only if M = l ϕ. For statements the environment is irrelevant and may be omitted: M = ϕ. For n IN 0 and formulas ϕ 1,..., ϕ n, ψ over some (F, P) the relation ϕ 1,..., ϕ n = ψ is defined by: For all models M for (F, P) and all environments l for M we have M = l ψ whenever M = l ϕ 1,..., M = l ϕ n all hold. Some authors use the terminology that in this case ψ is a (semantic) consequence of ϕ 1,..., ϕ n. 21

A model MODEL CHECKING: THE FINITE CASE M = (A, (f M ) f F, (P M ) P P ) for (F, P) where A, F and P are all finite, can be represented finitely, via, e.g., a table of m + 1-tuples for each function symbol of arity m and a table of n-tuples for each predicate symbol of arity n. Consequently, the term evaluation function [[t]] M l is computable by a simple recursive algorithm. (We may assume l finite, only dealing with the variables of t.) Similarly, the satisfaction relation M = l ϕ is algorithmically decidable. 22

SUPPLEMENTARY EXERCISES Assume F = {f}, P = {P }, where f and P are both binary, and model M = (A, {f M }, {P M }), where A has n elements. 1. How much memory is required to represent M? 2. Outline an algorithm to compute [[t]] M l. 3. Outline an algorithm to decide M = l ϕ. Argue that it terminates. 4. Find an upper bound on the time the algorithm takes to decide M = xp (x, x). Find an upper bound on the time the algorithm takes to decide M = x yp (x, y). 5. Find an upper bound on the time the algorithm takes to decide M = ϕ where ϕ is a sentence with q quantifiers. 23