Docsity

LECTURE 3 Discrete Structures, Slides of Computer Science

Partial preview of the text

Download LECTURE 3 Discrete Structures and more Slides Computer Science in PDF only on Docsity!

CSC102 - Discrete Structures By Mahwish Waqas

Department Of Computer Science, CUI

Lahore Campus

Lecture Outline

• Predicate Logic

  • Predicate
  • Quantifier
  • Translation of Quantified Statements

Why Predicate Logic?

  • Propositional Logic is not expressive enough
    • It cannot adequately express the meaning of statements in mathematics and in natural language

Example 1 :

“Every computer connected to the university

network is functioning properly.”

  • No rules of propositional logic allow us to

conclude the truth of the statement.

Why Predicate Logic?

Example 2 :

  • “There is a computer on the university network that is under attack by an intruder.”

Predicate Logic is more expressive

and powerful

Propositional Functions(Example)

  • Let A(x) = “Computer x is under attack by an intruder.”
  • Suppose computers on campus, only CS 2 and MATH 1 are currently under attack by intruders.
  • What are truth values of A (CS 1 ), A (CS 2 ), and A (MATH 1 )?
  • The statement A (CS 1 ) by setting x = CS 1 in the statement “Computer x is under attack by an intruder.”
  • CS 1 is not on the list of computers currently under attack, A (CS 1 ) is false.
  • CS 2 and MATH 1 are on the list of computers under attack, A (CS 2 ) and A (MATH 1 ) are true.

Propositional Functions

  • Functions with multiple variables:
    • P(x,y) = x + y == 0
      • P( 1 , 2 ) is false, P( 1 ,- 1 ) is true
    • P(x,y,z) = x + y == z
      • P( 3 , 4 , 5 ) is false, P( 1 , 2 , 3 ) is true
    • P(x 1

,x

2

,x

3

… x

n

  • Anatomy of a propositional function
  • P(x) = x + 5 > x variable predicate

Predicates

  • Suppose Q(x,y) = “x > y” Proposition, YES or NO? Q(x,y) Q(3,4) Q(x,9)

Predicate, YES or NO?

Q(x,y)

Q(3,4)

Q(x,9)

No Yes No Yes Yes No

Quantification

  • Quantification expresses the extent to which a predicate is true over a range of elements.
  • In English, the words all , some , many , none , and few are used in quantifications.
  • The area of logic that deals with predicates and quantifiers is called the predicate calculus.

Universal Quantifiers

  • Represented by an upside-down A: 
    • It means “for all”
    • Let P( x ) = x + 1 > x
  • We can state the following:
    • x P( x )
    • English translation: “for all values of x , P( x ) is
true”
  • English translation: “for all values of x , x + 1 > x is
true”

Besides “for all”, universal quantification can be expressed in many other ways: “for every”, “all of”, “for each”, “given any”, “for arbitrary”, “for each” and “for any”

Universal Quantifiers

  • You need to specify the universe of quantification!
    • What values 𝑥 can represent
    • Called the “domain of discourse” or “universe of discourse”
    • Or just “domain” or “universe”
  • The meaning of the universal quantification of P(x) changes when we change the domain. The domain must always be specified when a universal quantifier is used; without it, the universal quantification of a statement is not defined.

Universal Quantifiers

  • Let P(x) is “𝑥 2 > 0.” To show that the statement ∀ xP(x) is false where the universe of discourse consists of all integers, we give a counterexample.
  • x = 0 is a counterexample because 𝑥 2 = 0 when x = 0, so that 𝑥 2 is not greater than 0 when x = 0.

Universal Quantification

  • Given some propositional function P(x) And values in the universe x 1 .. x n
  • The universal quantification x P(x) implies:
  • P(x 1 )  P(x 2 )  …  P(x n )

Existential Quantification

  • Represented by an backwards E: 
    • It means “there exists”, there is”, “for some”, etc.
    • Let P(x) = x+ 1 > x
  • We can state the following:
    • x P(x)
    • English translation: “there exists (a value of) x such that P(x) is true”
    • English translation: “for at least one value of x, x+ 1 >x is true”
    • English translation: “for some x, P(x)”

Existential Quantification

  • Let P(x) = x+1 > x
    • There is a numerical value for which x+1>x
    • In fact, it’s true for all of the values of x. Thus,  x P(x) is true
  • In order to show an existential quantification is true, you only have to find ONE value
  • In order to show an existential quantification is false, you have to show it’s false for ALL values