Discrete Math - Module #1 - Logic

Slides:



Advertisements
Similar presentations
Slides adapted from Michael P. Frank ' s course based on the text Discrete Mathematics & Its Applications (5 th Edition) by Kenneth H. Rosen CS2013 Mathematics.
Advertisements

L41 Lecture 2: Predicates and Quantifiers.. L42 Agenda Predicates and Quantifiers –Existential Quantifier  –Universal Quantifier 
2009/91 Predicates and Quantifiers (§1.3) In the sentence “x is greater than 3”: The phrase “x” denotes the subject - the object or entity that the sentence.
1 Predicate Logic Rosen 6 th ed., § Predicate Logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
Module #1 - Logic 5/16/2015Michael Frank / Kees van Deemter1 Predicate Logic Rosen 5 th ed., §§ (but much extended) ~135 slides, ~5 lectures.
Computability and Complexity 8-1 Computability and Complexity Andrei Bulatov Logic Reminder.
EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 6 Limitations of propositional logic Introduction to predicate logic Symbols, terms and formulae, Parse.
CSE115/ENGR160 Discrete Mathematics 01/20/11 Ming-Hsuan Yang UC Merced 1.
EE1J2 - Slide 1 EE1J2 – Discrete Maths Lecture 11 Introduction to Predicate Logic Limitations of Propositional Logic Predicates, quantifiers and propositions.
First Order Logic. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about first order.
Section 1.3: Predicates and Quantifiers
Predicates & Quantifiers Goal: Introduce predicate logic, including existential & universal quantification Introduce translation between English sentences.
Module #1 - Logic 8/28/2015Michael Frank / Kees van Deemter1 Remember: I. Construct a model where 1 and 4 are true, while 2 and 3 are false Let the u.d.
Discrete Mathematics Goals of a Discrete Mathematics Learn how to think mathematically 1. Mathematical Reasoning Foundation for discussions of methods.
CSci 2011 Discrete Mathematics Lecture 3 CSci 2011.
Logical Equivalence & Predicate Logic
Introduction to Proofs
MATH 224 – Discrete Mathematics
1 Chapter 7 Propositional and Predicate Logic. 2 Chapter 7 Contents (1) l What is Logic? l Logical Operators l Translating between English and Logic l.
1.1 CompSci 102© Michael Frank Today’s topics Propositional equivalencesPropositional equivalences Predicate logicPredicate logic Reading: Sections Reading:
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
First Order Logic Lecture 2: Sep 9. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about.
Slides adapted from Michael P. Frank ' s course based on the text Discrete Mathematics & Its Applications (5 th Edition) by Kenneth H. Rosen University.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
1 Predicate (Relational) Logic 1. Introduction The propositional logic is not powerful enough to express certain types of relationship between propositions.
Copyright © Curt Hill Quantifiers. Copyright © Curt Hill Introduction What we have seen is called propositional logic It includes.
Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.
Module #1 - Logic 11/24/2015Michael Frank / Kees van Deemter1 University of Aberdeen, Computing Science CS3511 Discrete Methods Kees van Deemter Slides.
1 Introduction to Abstract Mathematics Predicate Logic Instructor: Hayk Melikya Purpose of Section: To introduce predicate logic (or.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 02: QUANTIFIERS Sections 1.3 and 1.4 Jarek Rossignac CS1050:
Discrete Mathematics CS 2610 August 22, Agenda Last class Propositional logic Logical equivalences This week Predicate logic & rules of inference.
Discrete Structures – CNS 2300
CS 285- Discrete Mathematics Lecture 4. Section 1.3 Predicate logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
First Order Logic Lecture 3: Sep 13 (chapter 2 of the book)
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
Copyright © Peter Cappello 2011 Predicates & Quantifiers.
CS104:Discrete Structures Chapter 2: Proof Techniques.
Albert Gatt LIN3021 Formal Semantics Lecture 3. Aims This lecture is divided into two parts: 1. We make our first attempts at formalising the notion of.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
PREDICATES AND QUANTIFIERS COSC-1321 Discrete Structures 1.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
Lecture 1.3: Predicate Logic, and Rules of Inference* CS 250, Discrete Structures, Fall 2011 Nitesh Saxena *Adopted from previous lectures by Cinda Heeren.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Section 1.7. Section Summary Mathematical Proofs Forms of Theorems Direct Proofs Indirect Proofs Proof of the Contrapositive Proof by Contradiction.
Logic Hubert Chan [O1 Abstract Concepts] [O2 Proof Techniques]
Chapter 7. Propositional and Predicate Logic
CSE 311 Foundations of Computing I
Predicates & Quantifiers
Logic Hubert Chan [O1 Abstract Concepts] [O2 Proof Techniques]
Chapter 1 The Foundations: Logic and Proofs
CS201: Data Structures and Discrete Mathematics I
The Foundations: Logic and Proofs
CS 220: Discrete Structures and their Applications
Discrete Math - Module #1 - Logic
CSE 311: Foundations of Computing
Predicate Logic (§1.3) Predicate logic is an extension of propositional logic that permits concisely reasoning about whole classes of entities. Propositional.
First Order Logic Rosen Lecture 3: Sept 11, 12.
MA/CSSE 474 More Math Review Theory of Computation
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
Negations of quantifiers
Lecture 1.3: Predicate Logic
Discrete Mathematics Lecture 3: Predicate and Quantifier
Discrete Mathematics CMP-200 Propositional Equivalences, Predicates & Quantifiers, Negating Quantified Statements Abdul Hameed
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
Predicates and Quantifiers
Chapter 1: Propositional and First-Order Logic
CS201: Data Structures and Discrete Mathematics I
Lecture 1.3: Predicate Logic
Presentation transcript:

Discrete Math - Module #1 - Logic 5/18/2018 University of Aberdeen, Computing Science CS2013 Predicate Logic-1 Kees van Deemter A word about organization: Since different courses have different lengths of lecture periods, and different instructors go at different paces, rather than dividing the material up into fixed-length lectures, we will divide it up into “modules” which correspond to major topic areas and will generally take 1-3 lectures to cover. Within modules, we have smaller “topics”. Within topics are individual slides. The instructor can bring several modules to each lecture with him, to make sure he has enough material to fill the lecture, or in case he wants to preview or review slides from upcoming or recent past lectures. 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

First-Order Predicate Logic (FOPL) Lecture 1 Discrete Math - Module #1 - Logic 5/18/2018 First-Order Predicate Logic (FOPL) Lecture 1 Background for the early parts of these lectures can be found in K.H. Rosen, Discrete Mathematics and Its Applications (relevant chapter, any edition) In Spring 2003 I spent 7 fifty-minute lecture periods on this material, but two half-lectures were taken up by team selection and a quiz, so it really only took 6 lectures. 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

This lecture: quick introduction to the syntax and semantics of First-Order Predicate Logic (FOPL) After that: getting to understand FOPL formulas and some of their limitations Understanding the notion of a FOPL model 18/05/2018 Kees van Deemter

Recap of Propositional Logic How many Propositional Logic connectives are there? 18/05/2018 Kees van Deemter

P connective Q 1 ? 1 1 ? 0 0 ? 1 0 ? 0 18/05/2018 Kees van Deemter

On to Predicate Logic 18/05/2018 Kees van Deemter

Lecture I Basics of First Order Predicate Logic (FOPL) FOPL compared with Propositional Logic Simple examples Syntax of FOPL Truth of a FOPL formula More complex examples: quantifier nesting 18/05/2018 Kees van Deemter

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Predicate Logic (§1.3) We can use propositional logic to prove that certain real-life inferences are valid. If it’s cold then it snows. If it snows there are accidents There are no accidents. Therefore: It’s not cold In propositional logic: ((cs sa a) c) is a tautology 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Predicate Logic (§1.3) In propositional logic: (((cs) (sa) a) c) is a tautology Saying this differently, It follows by propositional logic from (cs) (sa) a (premisse) that c (conclusion) 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Predicate Logic (§1.3) But other valid inferences cannot be proven valid by propositional logic Some girl is adored by everyone. Therefore: Everyone adores someone For inferences like this, we need a more expressive logic Needed: treatment of `some’ and `every’ (a bit analogous to `or’ and `and’) 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Predicate Logic (§1.3) Predicate logic is an extension of propositional logic that permits quantification over classes of entities. Propositional logic (recall) treats simple propositions (sentences) as atomic entities. In contrast, predicate logic distinguishes the subject of a sentence from its predicate. 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Applications of Predicate Logic Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Applications of Predicate Logic It is one of the most-used formal notations for writing mathematical definitions, axioms, and theorems. For example, in linear algebra, a partial order is introduced saying that a relation R is reflexive and transitive – and these notions are defined using predicate logic. E.g., Axyz((Rxy & Ryz)  Rxz)) 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

FOPL is complex Many things can be expressed very straightforwardly and simply Other things take more effort to express Understanding the precise limitations of FOPL is extremely difficult: a rich mathematical system CS2013 can only cover scratch the surface 18/05/2018 Kees van Deemter

Practical Applications of Predicate Logic Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Practical Applications of Predicate Logic Basis for proving correctness of computer programs Basis for many Artificial Intelligence systems. Predicate-logic like statements are supported by some sophisticated database query engines 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic First: A bit of grammar In the sentence “The dog is sleeping”: The phrase “the dog” denotes the subject - which the sentence is about. The phrase “is sleeping” denotes the predicate- a property that is true of the subject. Predicate logic will follow the same pattern. 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Formulas of predicate logic (informal) Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Formulas of predicate logic (informal) We will use various kinds of individual constants that denote individuals/objects: a,b,c,… Constants are a bit like names Individual variables over objects: x, y, z , … The result of applying a predicate P to a constant a is the proposition P(a) Meaning: the object denoted by a has the property denoted by P. 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Formulas of predicate logic (informal) Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Formulas of predicate logic (informal) The result of applying a predicate P to a variable x is the propositional form P(x). E.g. if P = “is a prime number”, then P(x) is the propositional form “x is a prime number”. Explain the notion of a propositional form 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Predicates/relations with n places Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Predicates/relations with n places Predicate logic generalises the notion of a predicate to include propositional functions of any number of arguments. E.g.: R(x,y) = “x adores y” P(x,y,z) = “x gave y the grade z” Q(x,y,z,u)= “ x*(y+z)=u ” 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Universes of Discourse (U.D.s) Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Universes of Discourse (U.D.s) Predicate Logic lets you state things about many objects at once: you can “quantify” over them E.g., let P(x) = “ (x*2)  x ” We can then say, “For any number x, P(x) is true” instead of (0*2  0)  (1*2  1)  (2*2  2)  ... The collection of values that a variable x can take is called x’s universe of discourse. (u.d. is something outside the formula that helps giving it its intended interpretation.) 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Universes of Discourse (U.D.s) Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Universes of Discourse (U.D.s) E.g., let P(x)=“x*2  x”. We can then say, “For any number x, P(x) is true” instead of (0*2  0)  (1*2  1)  (2*2  2)  ... Applying the notion of an u.d.: “For any number x, P(x) is true” is true when u.d. = N “For any number x, P(x) is true” is false when u.d. = Z 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Back to propositional logic In propositional logic, we could not simply say whether a formula is TRUE; what we could say is whether it is TRUE with respect to a given assignment of TRUE/FALSE to the Atoms in the formula E.g., pq is TRUE with respect to the assignment p=TRUE, q=TRUE 18/05/2018 Kees van Deemter

Predicate logic In predicate logic, we say that a formula is TRUE (FALSE) with respect to a model Model = u.d. plus specification of the “meanings” of the predicates. This can be done e.g. by giving an English equivalent of a predicate by listing explicitly which objects the predicate is true of ... as long the extension of the predicate is clear. (By definition, this is the set of objects in the u.d. for which the predicate holds.) 18/05/2018 Kees van Deemter

Quantifier Expressions Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Quantifier Expressions Quantifiers allow us to quantify how many objects in the u.d. satisfy a given predicate. “” is the FORLL or universal quantifier. “” is the XISTS or existential quantifier. For example, x P(x) and x P(x) are propositions 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Meaning of Quantified Expressions Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Meaning of Quantified Expressions First, informally: x P(x) means for all x in the u.d., P holds. x P(x) means there exist x in the u.d. (that is, 1 or more) such that P(x) is true. 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Example:  Let the u.d. be the parking spaces at UF. Let P(x) mean “x is full.” Then the existential quantification of P(x), x P(x), is the proposition saying that “Some parking spaces at UF are full.” “There is a parking space at UF that is full.” “At least one parking space at UF is full.” 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Example:  Let the u.d. be parking spaces at UF. Let P(x) be the prop. form “x is occupied” Then the universal quantification of P(x), x P(x), is the proposition: “All parking spaces at UF are occupied.” “For each parking space at UF, that space is full.” Instructors: You can substitute your favorite overly-crowded destination in place of the University of Florida in this example. 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic “first order” First-Order Predicate Logic (FOPL) lets us talk about/quantify over things in the u.d. Second-Order Predicate Logic can also talk about, and quantify over, properties of things (e.g., “a and b have some properties in common”) This course focusses on FOPL 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Syntax of predicate logic (for 1- and 2-place predicates) Variable: x,y,z,… Constants: a,b,c,… 1-place predicates: P,Q,… 2-place predicates: R,S,… Atomic formulas: If  is a 1-pace predicate and  a variable or constant then () is an atomic formula. If  is a 2-pace predicate and  and  are variables or constants then (,) is an atomic formula. 18/05/2018 Kees van Deemter

Syntax of predicate logic (for 1- and 2-place predicates) (Wellformed) Formulas: All atomic formulas are formulas If  and  are formulas then , ( ), (), ( ) are formulas. If  is a formula then x  and x  are formulas. (Likewise, y  and y , and so on.) 18/05/2018 Kees van Deemter

Syntax of predicate logic (for 1- and 2-place predicates) Show that these are wellformed formulas: xP(x) yQ(x) xy R(x,y) xP(b) 18/05/2018 Kees van Deemter

Syntax of predicate logic (for 1- and 2-place predicates) xP(x) yQ(x) xy R(x,y) xP(b) P(x) is a (atomic) formula, hence xP(x) is a formula Q(x) is a (atomic) formula, hence yQ(x) is a formula R(x,y) is a (atomic) formula, hence y R(x,y) is a formula, hence xy R(x,y) is a formula P(b) is a (atomic) formula, hence xP(b) is a formula 18/05/2018 Kees van Deemter

Syntax of predicate logic (for 1- and 2-place predicates) Examples: xP(x) and yQ(x), x(y R(x,y)), x(x R(x,y)), xP(b) etc. Lots of pathological cases. For example, It will follow from the meaning of these formulas that xP(b) is true iff P(b) is true Rule of thumb: a quantifier that does not bind any variables can be ignored 18/05/2018 Kees van Deemter

Free and Bound Variables Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Free and Bound Variables An expression like P(x) is said to have a free variable x (i.e., x is not “defined”). A quantifier (either  or ) operates on an expression having one or more free variables, and binds one or more of those variables, to produce an expression having one or more bound variables. 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Example of Binding P(x,y) has 2 free variables, x and y. x P(x,y) has 1 free variable, and one bound variable. [Which is which?] An expression with zero free variables is a bona-fide (actual) proposition. An expression with one or more free variables is similar to a predicate: e.g. let Q(y) = x Adore(x,y) y x 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Free variables, defined formally Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Free variables, defined formally The free-variable occurrences in an Atom are: all the variable occurrences in that Atom The free-variable occurrences in  are: the free-variable occurrences in  The free-variable occurrences in ( connective ) are: the free-variable occurrences in  plus the free-variable occurrences in  The free-variable occurrences in x and x are: the free-variable occurrences in  except for all/any occurrences of x. 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Occurrences of variables that are not free are bound. Test your understanding: Which (if any) variables are free in x P(x) x P(x) yQ(x) xP(b) (NB, b is a constant) x(y R(x,y)) 18/05/2018 Kees van Deemter

Occurrences of variables that are not free are bound. Check your understanding: Which (if any) variables are free in x P(x) [no free variables] x P(x) [no free variables] yQ(x) [x is free] xP(b) (NB, b is a constant) [no free var.] x(y R(x,y)) [no free variables] 18/05/2018 Kees van Deemter

A more precise definition of the truth/falsity of quantified formulas Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic A more precise definition of the truth/falsity of quantified formulas (Formulation is simplified somewhat because we assume that every object in the u.d. D has a `name` (i.e., a constant referring to it)). First some notation: (x:=a) is the result of substituting all free occurrences of the variable x in  by the constant a 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Exercise Say what (x:=a) is, if  = P(x) R(x,y) P(b) x P(x) yQ(x) 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Exercise Say what (x:=a) is, if  = P(x) ..... P(a) R(x,y) .... R(a,y) P(b) ..... P(b) x P(x) ...... x P(x) yQ(x) ...... yQ(a) 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

A more precise definition of the truth/falsity of quantified formulas Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic A more precise definition of the truth/falsity of quantified formulas (Formulation is simplified somewhat because we assume that every object in the u.d. has a `name` (i.e., a constant referring to it)). Let  be a formula. Then x is true in D if at least one expression of the form (x:=a) is true in D, and false otherwise. (a can be any constant) 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

A more precise definition Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic A more precise definition Let  be a formula. Then x is true in D if at least one expression (x:=a) is true in D, and false otherwise. A simple example:  = P(x) P(x) is a formula, hence x P(x) is true in D if at least one expression of the form P(a) is true in D, and false otherwise. 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

Discrete Math - Module #1 - Logic 5/18/2018 Topic #3 – Predicate Logic Similarly for  Let  be a formula. Then the proposition x is true in D if every expression of the form (x:=a) is true in D, and false otherwise. A simple example:  = P(x) P(x) is a formula, hence x P(x) is true in D if every expression P(a) is true in D, and false otherwise. 18/05/2018 Kees van Deemter (c)2001-2002, Michael P. Frank

18/05/2018 Kees van Deemter