Docsity

Predicates and Quantifiers, Lecture Notes - Computer Science, Study notes of Number Theory

Partial preview of the text

Download Predicates and Quantifiers, Lecture Notes - Computer Science and more Study notes Number Theory in PDF only on Docsity!

Lecture 4: Predicates and

Quantifiers; Sets.

Zeph Grunschlag

Announcements

HW1 due now

Motivating example

Consider the compound proposition:

If Zeph is an octopus then Zeph has 8 limbs.

Q1: What are the atomic propositions and how

do they form this proposition.

Q2: Is the proposition true or false?

Q3: Why?

Motivating example

A1: Let p = ―Zeph is an octopus‖ and q =

―Zeph has 8 limbs‖. The compound

proposition is represented by p  q.

A2: True!

A3: Conditional always true when p is false!

Q: Why is this not satisfying?

Motivating example

Expressions such as the previous are built up from propositional functions – statements that have a variable or variables that represent various possible subjects. Then quantifiers are used to bind the variables and create a proposition with embedded semantics. For example: ―For all x, if x is an octopus then x has 8 limbs.‖ there are two atomic propositional functions  P (x) = “ x is an octopus‖  Q (x) = ― x has 8 limbs‖ whose conditional P (x)  Q (x) is formed and is bound by ―For all x ‖.

Semantics

If logical propositions are to have meaning, they need to describe something. Up to now, propositions such as ―Johnny is tall‖, ―Debbie is 5 years old‖, and ―Andre is immature‖ had no intrinsic meaning. Either they are true or false, but no more.

In order to endow such propositions with

meaning, we need to have a universe of

discourse , i.e. a collection of subjects (or

nouns) about which the propositions relate.

Q: What is the universe of discourse for the three propositions above?

Predicates

A predicate is a property or description of

subjects in the universe of discourse. The

following predicates are all italicized :

 Johnny is tall.  The bridge is structurally sound.  17 is a prime number.

Java: predicates are boolean- valued method

calls-  someLinkedList. isEmpty ()isPrime (17)

Propositional Functions

By taking a variable subject denoted by symbols

such as x, y, z, and applying a predicate one

obtains a propositional function (or

formula ). When an object from the universe

is plugged in for x, y, etc. a truth value

results:  x is tall. …e.g. plug in x = Johnny  y is structurally sound. …e.g. plug in y = GWB  n is a prime number. … e.g. plug in n = 111

Java: propositional functions are boolean

methods, rather than particular calls.  boolean isEmpty(){…} //in LinkedListboolean isPrime(int n){…}

Multivariable Predicates

A: Again, many correct answers. The most obvious answers are:  For ―Johnny is taller than Debbie‖ the universe of discourse of both variables is all people in the universe  For ― 17 is greater than one of 12, 45‖ the universe of discourse of all three variables is Z (the set of integers)  For ―Johnny is at least 5 inches taller than Debbie‖ the first and last variable have people as their universe of discourse, while the second variable has R (the set of real numbers).

Multivariable Propositional

Functions

The multivariable predicates, together with their

variables create multivariable propositional

functions. In the above examples, we have

the following generalizations:  x is taller than y  a is greater than one of b, c  x is at least n inches taller than y

In Java, a multivariable predicate is a boolean

method with several arguments: tallerByNumInches(Person x, double n, Person y) { … }

Existential Quantifier

 ― x P (x)‖ is true when an instance can be

found which when plugged in for x makes

P (x) true

 Like disjunctioning over entire universe

 x P (x )  P (x 1 )  P (x 2 )  P (x 3 )  …

Existential Quantifier.

Example

Consider a universe consisting of

 Leo: a lion  Jan: an octopus with all 8 tentacles  Bill: an octopus with only 7 tentacles

And recall the propositional functions

 P (x) = “ x is an octopus‖

 Q (x) = ― x has 8 limbs‖

 x ( P (x)  Q (x) )

Q: Is the proposition true or false?

The Universal Quantifier

 ― x P (x)‖ true when every instance of x

makes P (x) true when plugged in

 Like conjunctioning over entire universe

 x P (x )  P (x 1 )  P (x 2 )  P (x 3 )  …

Universal Quantifier. Example

Consider the same universe and

propositional functions as before.

 x ( P (x)  Q (x ) )

Q: Is the proposition true or false?