1 Predicates and quantifiers Chapter 8 Formal Specification using Z.

Slides:



Advertisements
Similar presentations
Nested Quantifiers Section 1.4.
Advertisements

Artificial Intelligence
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.
© 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 
Propositional Logic. Negation Given a proposition p, negation of p is the ‘not’ of p.
Predicate Logic. Universal Quantifier Everything of a certain kind has a certain property (for every, for all)
From Chapter 4 Formal Specification using Z David Lightfoot
Computing Fundamentals 1 Lecture 6 A Theory of Sets Lecturer: Patrick Browne Room K308 Based on Chapter 11. A Logical approach.
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.
Predicates and Quantifiers
Section 1.3: Predicates and Quantifiers
Predicates & Quantifiers Goal: Introduce predicate logic, including existential & universal quantification Introduce translation between English sentences.
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.
Discussion #141/20 Discussion #14 Predicate Calculus.
Logic Specification and Z Schema 3K04 McMaster. Basic Logic Operators Logical negation ( ¬ ) Logical conjunction ( Λ or & ) Logical disjunction ( V or.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
ARTIFICIAL INTELLIGENCE Lecture 3 Predicate Calculus.
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 © 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.
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.
Math 51/COEN 19 Day 3, 1.4 Quantifiers 1. 3 Predicates A lot like functions that return booleans Let P(x) denote x
Predicates and Quantified Statements
Naïve Set Theory. Basic Definitions Naïve set theory is the non-axiomatic treatment of set theory. In the axiomatic treatment, which we will only allude.
Sets Goal: Introduce the basic terminology of set theory.
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:
Lecture Predicates and Quantifiers 1.4 Nested Quantifiers.
Lecture 7 – Jan 28, Chapter 2 The Logic of Quantified Statements.
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)
Semantics of Predicate Calculus For the propositional calculus, an interpretation was simply an assignment of truth values to the proposition letters of.
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
Copyright © Peter Cappello 2011 Predicates & Quantifiers.
Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction.
1 CMSC 250 Chapter 3, Number Theory. 2 CMSC 250 Introductory number theory l A good proof should have: –a statement of what is to be proven –"Proof:"
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.
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.
Discrete Mathematical الرياضيات المتقطعة. Example 12 June OR Q(x,y): x+y=x-y a) Q(1,1): 2=0 False b) Q(2,0): 2+0=2-0 True c) Q(1,y): 1+y=1-y False(take.
Uniqueness Quantifier ROI for Quantified Statement.
Chapter 1 Logic and Proof.
CSE15 Discrete Mathematics 01/23/17
Chapter 3 The Logic of Quantified Statements
Predicates & Quantifiers
Predicate Calculus Discussion #14 Chapter 2, Section 1 1/20.
Discussion #14 Predicate Calculus
Chapter 1 The Foundations: Logic and Proofs
CS 220: Discrete Structures and their Applications
Copyright © Cengage Learning. All rights reserved.
Predicate Calculus Discussion #14 Chapter 2, Section 1.
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
Discrete Mathematics Lecture 3: Predicate and Quantifier
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
Predicates and Quantifiers
Predicate Calculus. Predicate Calculus Topics Predicates Variables and instantiation Quantifiers Logical expressions Bound and free variables.
Presentation transcript:

1 Predicates and quantifiers Chapter 8 Formal Specification using Z

2 Predicates A predicate is a logical statement that depends on a value or values. When a predicate is applied to a particular value it becomes a proposition. For example: prime(x) depends on some numeric value of x prime(7) is a true proposition; the only devisors of 7 are 1 and 7. Prime(6) is a false proposition; 6 can be divided by 2,3. A predicate can be viewed as a propositional function, that for some set of arguments returns to either true or false

3 Quantifiers Consider the following statements: All cats have tails. Some people like cake. Everyone gets a break once in a while. All these statements indicate how frequently certain things are true. In predicate calculus we use quantifiers in this context.

4 Universal Quantifier The Universal Quantifier is written : A and is pronounced ‘for all’. It is often used in the form : A declaration | constraint predicate Which states the for the declarations given, restricted to certain values (the constraint), the predicate holds.

5 Universal Quantifier The constraint may be omitted. The declaration introduces a typical element that is then optionally constrained or restricted in some some way: For example: A i: N | i < 10 i 2 < 100 Which states that for all natural numbers less than 10 their square is less that 100. Separators Constraint Predicate

6 Universal Quantifier A universal quantifier can be viewed as a chain of conjunctions. So: A i: N | i < 10 i 2 < 100 is equivalent to: 0 2 < 100 L 1 2 < 100 L.. L 9 2 < 100 If the set of values over which the variable is universally quantified is empty, then the quantification is defined as true. A i: N | 0 i < 0 i 2 < 100 is true.

7 Existential Quantifier The Existential Quantifier is written : E and is pronounced ‘there exists’. It is often used in the form : E declaration | constraint predicate The declaration introduces a typical element that is then optionally constrained or restricted in some way: For example: E i: N | i < 10 i 2 < 100

8 Existential Quantifier There may be more than one value of i for which this is true, in the previous example there are ten values, 0 to 9, that satisfy the predicate. Another example: Even(x)  E k: Z k * 2 = x The existential quantifier can be considered as a chain of disjunctions (ors). If the set of values over which the variable is existentially quantified is empty, then the quantification is defined as false. E i: N | 0 i < 0 i 2 < 100

9 Unique Quantifier The unique quantifier is similar to the existential quantifier except that it states that there exists only one value for which the predicate is true. It is written as: E 1 An example: E 1 i: N | i 80

10 Unique Quantifier The previous unique quantifier example is equivalent to saying that the predicate holds for i, but there is no value j for which it holds This is written as: E 1 i: N | i 80  E 1 i: N | i 80  ¬( E j: N | j 80)

11 Counting Quantifier Some notations use a counting quantifier that counts for how many values of a variable the predicate holds. In Z this is not needed, we use set comprehension instead.

12 Set Comprehension Set Comprehension: It is possible to give the value of a set by giving a condition (a predicate) which must hold true for every member of the set. The general form is: {declaration | constraint expression} SetA ::= {x: Z | Even(x) x*x}

13 Set Comprehension {declaration | constraint expression} The declaration is for a typical element and it gives the element’s name and type. The constraint restricts the possible values of the typical element. It is a logical expression which must be true for that value of the typical element to be included. The expression indicates the value to be held in the set

14 Set Comprehension SetA ::= {x: Z | Even(x) x*x} The above defines a set of type integer. The value of x is constrained to be even. Each element will be the square of an even integer. SetB ::= {x: Z | Even(x) x} The above defines a set of type integer. The value of x is constrained to be even. Each element will be an even integer.

15 Ranges of numbers We have already introduced m..n. This is shorthand for {i: Z | m i  n i i}

16 Relationship between Logic and Set Theory There is a direct relationship between some of the operations of logic and operations on sets: [X] any set S,T: P X S  T == {x:X | x  S  x  T x} S  T == {x:X | x  S  x  T x} S \ T == {x:X | x  S  x  T x}

17 Summary of Quantifier A x:T P for all x of type T, P is true. E x:T P there exists an x of type T, such that P is true. E 1 x :T P there exists a unique x of type T, such that P is true.

18 Summary of Quantifier {D | P t} The set of t’s declared by D where P is true.

19 Mixing Quantifiers What is the precedence or associativity used. Is forAll(x),forAll(y) equivalent to forAll(y),forAll(x)? Assuming standard notation, they are read left to right; two universal quantifiers following one another commute (just like multiplication a*b=b*a).

20 Mixing Quantifiers Likewise, if you have two existential quantifiers, they commute, because Exists(x),Exists(y), p(x,y) is true if and only if Exists(y),Exists(x), p(x,y) is true.

21 Mixing Quantifiers But if you have mixed universal and existential quantifiers, you have to be careful. If you write A (x), E (y), p(x,y) that means that for each x, there exists a y, which may depend on x, for which p(x,y) is true. But if you write E (y), A (x), p(x,y) you are saying that there is a y which works for any given x (including y=x), that make p(x,y) true.

22 Mixing Quantifiers

23 Mixing Quantifiers

24 Exercises Let O(x,y) be the predicate (or propositional function) “x is older than y”. The domain of discourse consists of three people Garry, who is 30; Ellen who is 20; and Martin who is 35. Write each of the following propositions in words and state whether they are true or false.

25 Exercises

26 Exercises

27 Exercise

28 Exercise