Predicate Logic One step stronger than propositional logic Copyright © 2007-2014 Curt Hill.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Propositional Predicate
Chapter 1: The Foundations: Logic and Proofs 1.1 Propositional Logic 1.2 Propositional Equivalences 1.3 Predicates and Quantifiers 1.4 Nested Quantifiers.
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Chapter 1: (Part 2): The Foundations: Logic and Proofs.
L41 Lecture 2: Predicates and Quantifiers.. L42 Agenda Predicates and Quantifiers –Existential Quantifier  –Universal Quantifier 
22C:19 Discrete Structures Logic and Proof Spring 2014 Sukumar Ghosh.
Formal Logic Mathematical Structures for Computer Science Chapter 1 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFormal Logic.
CSE115/ENGR160 Discrete Mathematics 01/20/11 Ming-Hsuan Yang UC Merced 1.
Adapted from Discrete Math
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.
Predicates and Quantifiers
Predicates & Quantifiers Goal: Introduce predicate logic, including existential & universal quantification Introduce translation between English sentences.
Lecture 8 Introduction to Logic CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Predicates and Quantifiers
Chapter 1: The Foundations: Logic and Proofs
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.
The Foundations: Logic and Proofs
Formal Logic Mathematical Structures for Computer Science Chapter Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFormal Logic.
MATH 224 – Discrete Mathematics
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.
Copyright © Curt Hill Mathematical Logic An Introduction.
Copyright © Cengage Learning. All rights reserved. CHAPTER 3 THE LOGIC OF QUANTIFIED STATEMENTS THE LOGIC OF QUANTIFIED STATEMENTS.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Nesting Quantifiers And Their Manipulation Copyright © Curt Hill.
Copyright © 2014 Curt Hill Sets Introduction to Set Theory.
Copyright © Curt Hill Quantifiers. Copyright © Curt Hill Introduction What we have seen is called propositional logic It includes.
Fundamentals of Logic 1. What is a valid argument or proof? 2. Study system of logic 3. In proving theorems or solving problems, creativity and insight.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.
Predicates and Quantified Statements
1 Introduction to Abstract Mathematics Expressions (Propositional formulas or forms) Instructor: Hayk Melikya
1 Sections 1.3 and 1.4 Predicates & Quantifiers. 2 Propositional Functions In a mathematical assertion, such as x < 3, there are two parts: –the subject,
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
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:
Logical Operations – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Logical Operations Reading: Kolman, Section 2.1.
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 1 The Foundations: Logic and Proofs Predicates and Quantifiers.
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)
CSci 2011 Recap ^Propositional operation summary not andorconditionalBi-conditional pq ppqqpqpqpqpqpqpqpqpq TTFFTTTT TFFTFTFF FTTFFTTF FFTTFFTT.
Chapter 2 Fundamentals of Logic 1. What is a valid argument or proof?
Copyright © Curt Hill Axiomatic Approach Some needed groundwork.
Copyright © Peter Cappello 2011 Predicates & Quantifiers.
Models of Computation: Automata and Formal Languages Sam M. Kim.
Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction.
PREDICATES AND QUANTIFIERS COSC-1321 Discrete Structures 1.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
Introduction to Predicates and Quantified Statements I Lecture 9 Section 2.1 Wed, Jan 31, 2007.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Propositional Logic. Assignment Write any five rules each from two games which you like by using propositional logic notations.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
CSE15 Discrete Mathematics 01/23/17
Chapter 3 The Logic of Quantified Statements
Predicates & Quantifiers
Chapter 1 The Foundations: Logic and Proofs
CS201: Data Structures and Discrete Mathematics I
Copyright © Cengage Learning. All rights reserved.
Introduction to Predicates and Quantified Statements I
Discrete Mathematics Lecture 3: Predicate and Quantifier
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
Predicates and Quantifiers
CS201: Data Structures and Discrete Mathematics I
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Predicates and Quantifiers
Presentation transcript:

Predicate Logic One step stronger than propositional logic Copyright © Curt Hill

Introduction What we have seen is called propositional logic It includes axioms and theorems concerning the operators of Boolean Algebra It lacks something We want to strengthen this into predicate logic –AKA First order logic or predicate calculus Copyright © Curt Hill

Statement Categories In mathematics, there are three types of statements: –True –False –Open True statements are usually characterized by: –Statements with only constants and a comparison such as = or > –A statement of fact –A tautology Copyright © Curt Hill

True Statements 5=2+3 5>2 The United States won its independence from England They may include variables in limited ways: –x+5 = 5+x –  p  q  p  q  q Copyright © Curt Hill

False statement False statements have a similar form but are false 5=4 2>5 The United States won its independence from Germany They may also include variables: –x  (y  z)  x  y  x  z –x = x + 1 Copyright © Curt Hill

Open statements Open standards generally cannot have a true or false value until a variable is given a value Almost all equations are open, the task of solving is finding a set of values that makes the statement true or determining that the set is empty 5x = 10 is neither true nor false It is true if x = 2 and false otherwise Copyright © Curt Hill

Discussion Logic is two valued, we cannot allow true, false, and maybe Therefore, we have to find a way to make a statement that is open into one that is true or false We now use predicates –AKA Propositional functions Copyright © Curt Hill

Predicates Up to this point we have mostly dealt with variables and operators We may also use predicates Predicate is a fancy name for a function that returns a boolean value It may have one or more arguments The argument does not have to be a boolean variable This is not startling since any boolean variable could hold the result of a predicate Copyright © Curt Hill

An Example Let P(x) be the statement x>8 P(x) is still open We may determine the truth value of: –P(12) –P(2) If the predicate is arbitrary single letter names are sufficient We may have others as well Copyright © Curt Hill

Naming Mathematicians seldom have to consider large real world problems Thus they tend to use single letter predicates to keep the notation easy Computer Science is an area where we want to describe these, so many variables or predicates may exist More descriptive names are then needed This also explains using parenthesis for arguments Copyright © Curt Hill

Mathematicians v. Computer Scientists prime(n) –The argument n is prime or not student(p) –A person p is a student at VCSU or not odd(n) or even(n) Predicate names generally are single word This word should indicate the purpose Copyright © Curt Hill

Predicate Notation As always there are multiple ways to represent the same thing I prefer: predicate(parameter1, parameter2) –This matches programming notation Others use single letter predicates with subscript indicating parameter: G x Thus P(x,y) or P x,y Copyright © Curt Hill

Usage One of the uses of predicates is in program and statement specifications –Correctness proofs as well We express the precondition and postcondition of a statement using this notation –Precondition captures the state before a statement is executed –Postcondition after Copyright © Curt Hill

Example Consider the statements: if(x>0) x = x+1; Since we know nothing about the context the precondition must be simply T However, the postcondition would be: (x  1) Copyright © Curt Hill

Example Again Suppose that P(x) denotes x>0 Moreover x 0 is the value of x before the statement The postcondition becomes: P(x)  x=x 0 +1  P(x)  x=x 0 Copyright © Curt Hill

Open Statements In a real sense we have skirted the Open statement problem P(x) is just as open as x>0 We next need quantifiers to say something useful about the possible values Copyright © Curt Hill

Quantifiers via familiar example You are probably familiar with summation notation –It gives us a compact way to express an infinite sum or even a large finite sum This gives us a convenient way to denote the sum of a finite or infinite number of terms We also have a similar notation of products Copyright © Curt Hill

Summation and Product Copyright © Curt Hill

Logical Quantifiers Just at the  denotes repeated addition and the  repeated multiplication, so we have symbols for And and Or  is the universal quantifier –Possibly infinite number of terms connected by   is the existential quantifier –Number of terms connected by  A quantified expression, like a proposition, still has a true or false value Copyright © Curt Hill

Universal Quantifier Notation: –  x P(x) –Read: for all x, P(x) The x is a dummy variable –It has an implied domain or range based on its type This is the same as: P(x 0 )  P(x 1 )  P(x 2 )  P(x 3 )  … –Through potentially infinite terms Copyright © Curt Hill

More The term, P(x) may also be more complicated than a single predicate Most of the time the type of the dummy is real numbers –We may just infer the type and range –They may be explicitly stated outside of the quantified expression –Like the universe of discourse, not always stated We may also specify them explicitly Copyright © Curt Hill

Explicit domains We are able to specify them as part of the quantification:  x (P(x)  x    x>0) Sometimes this is abbreviated into the dummy declaration  x>0  x   P(x) –This is the textbook’s preference –Recall the difference between mathematicians and computer scientists Copyright © Curt Hill

Existential Quantifier Notation:  x P(x) Read: there exists an x, P(x) This is the same as: P(x 0 )  P(x 1 )  P(x 2 )  P(x 3 )  … –Through potentially infinite terms The dummy variable and term rules are the same Copyright © Curt Hill

Number? The existential quantifier is true if one or more x’s make the condition true –We are only stating that there is at least one An infrequently used quantifier is that uniqueness quantifier states that there is one and only one: –  ! x P(x) Copyright © Curt Hill

Notation This is not the only notation, another is: (OP i:r:t) OP is an operator which is commutative, associative, and binary How many do we have? i is a list of dummies –Often just one but sometimes more r is the range t is the term Copyright © Curt Hill

Open Questions Again We now have a way to reduce an open question into a true false proposition The open question: 3x + 5 = 5x - 11 Becomes  x   3x + 5 = 5x – 11 This statement may be true only if a solution exists or false otherwise –No longer open Copyright © Curt Hill

More on quantifiers Quantifiers allow us to state things that are not directly expressible with just predicates, variables and the operators In practice this should allow us to state almost any real world fact or supposition A predicate may be defined in terms of a quantifier Copyright © Curt Hill

Precedence The quantifiers have higher precedence than any of the logical operators Thus:  x P(x)  Q(x) is (  x P(x))  Q(x) and not  x (P(x)  Q(x)) Copyright © Curt Hill

Variables There are two types of variables in a quantified expression: bound and free A bound variable is part of the quantifier –It ranges over some set of values as part of quantification –These are often known as dummies A free variable exists outside the quantified expression –These require a value, otherwise the quantifier is still open Copyright © Curt Hill

Variable Example Consider:  x (P(x+y)  Q(x+y)) The variable x is a bound variable It may only have a certain set of values determined by the quantifier The variable y is free –It may take on any value –The y variable must be given a value outside of the expression for this not to be open Copyright © Curt Hill

Variable Scope The scope of a variable is that part of the expression where it is known In any quantified expression the bound variables have a scope contained by the quantifier This occasionally gets messy when a quantified expression contains another quantified expression Copyright © Curt Hill

Equivalences Since quantifiers have the same characteristics as propositions, we may consider equivalences with them as well Some of these will considered Copyright © Curt Hill

Distribution  x (P(x)  Q(x))   x P(x)   x Q(x)) –This is distributing a universal quantifier over a conjunction Similarly we can distribute an existential quantifier over disjunctions  x (P(x)  Q(x))   x P(x)   x Q(x)) Does existential distribute over conjunctions?  x (P(x)  Q(x))   x P(x)   x Q(x)) Copyright © Curt Hill

Negation DeMorgan’s generalizes to quantifiers  i T    i  T  i T    i  T –T is any term or combination of predicates –Connects  and  –The outside negation may be moved across implication as well –   i T   i  T –   i T    i  T Copyright © Curt Hill

Audience Participation For each of the following: –Is it true? –What does it mean? –Assume Reals if no type is given  x 3<x  x 2<x  x x  0 = 0  x x+1>x  x 1/x    x 1/x   Copyright © Curt Hill

English to Logic Translating English statements to Logic statements is important but sometimes tricky –The ambiguity of English is a problem Certain words translate in an obvious fashion –Every, all –Not –And –Or –The variety of ways to say the same thing complicates Copyright © Curt Hill

Translation All students in CS 161 have had CS 160 –  x C160(x) –Where x is students in 161 and C160 is a predicate –You might also use:  x (C161(x)  C160(x)) Copyright © Curt Hill

Some quantifier examples Some apples are rotten  a  Apples rotten(a) All women are beautiful  w  Females beautiful(w) Some integers are positive All squares are rectangles Not all rectangles are squares Prime numbers exist in the integers Copyright © Curt Hill

Prime Definition Can we define a prime number? prime(n) =  i    i > 1  i ≠ n 0 ≠ n-floor(n  i)*i floor truncates a real number to an integer i is a dummy variable that can range over all integers greater than 1 and not equal to n Notice that for this expression i is bound but n is free Copyright © Curt Hill

Summary What was open before (that is not possible to assign to truth value to) is now closed –We may not always know the truth value –We do know that one exists We should now be able to state in a concise form any proposition Copyright © Curt Hill

Exercises Rosen 1.4 Problems: 5, 9, 15, 21, 25, 33, 39 Copyright © Curt Hill