00 mi piace00 non mi piace

14 visualizzazioni56 pagineMMU's Discrete Structure.Notes Provided for IT Students.

May 20, 2014

© © All Rights Reserved

PPT, PDF, TXT o leggi online da Scribd

MMU's Discrete Structure.Notes Provided for IT Students.

© All Rights Reserved

14 visualizzazioni

00 mi piace00 non mi piace

MMU's Discrete Structure.Notes Provided for IT Students.

© All Rights Reserved

Sei sulla pagina 1di 56

CHAPTER 1

(PART 2)

1

Introduction to Logic

Differentiate and write the Predicates and

Quantifiers .

Write Proposition Equivalences; Truth

tables; Implication and equivalence;

Tautology; Contradiction and Contigency;

Write the Negation Quantifiers Expressions

and determine its truth values

2

DCS5028

CONSTRUCT TRUTH TABLE

A compound proposition may have many

component parts, each of which is itself a

proposition, represented by some

propositional variable.

The proposition s: p (q r) involves three

propositions, p,q and r.

If a compound statement s contains n

proposition variables, there will need to be 2

n

rows in the truth table for s.

DCS5028

3

CONSTRUCT TRUTH TABLE

s: p (q r)

3 variables, therefore need 2

3

= 8 rows

DCS5028

4

p q r q r p (q r)

T T T

T T F

T F T

T F F

F T T

F T F

F F T

F F F

T

F

F

F

T

F

F

F

T

T

T

T

T

F

F

F

EXERCISE:

Make a truth table for the proposition

(p q) (~p)

Answer:

DCS5028

5

Propositional Equivalence consist of

three types;

Tautology

Contradiction

Contingency

6

DCS5028

TAUTOLOGY

A tautology occurs when a compound proposition

that is true for all possible values of its

proposition variables.

Example:

(p . q ) p

7

DCS5028

(p . q ) p

8

p q p . q (p . q ) p

T T T T

T F F T

F T F T

F F F T

DCS5028

CONTRADICTION

A contradiction occurs when a compound

proposition is always false.

Example:

((p q).q).p

9

DCS5028

((p q).q).p

10

p q p q (p q).q ((p q).q).p

T T F F F

T F T F F

F T T T F

F F F F F

DCS5028

CONTINGENCY

A contingency occurs when a compound

proposition is neither a Tautology nor a

Contradiction (consists both true and false

value for different combination of

propositions that involve)

Example

11

(( ) ) p q q p .

DCS5028

(( ) ) p q q p .

12

p q pq (pq).q

((pq).q)p

T T T T T

T F F F T

F T T T F

F F T F T

DCS5028

QUESTION

State whether the proposition below is

tautology, contradiction or contingency.

13

) ( ) ( q p q p .

DCS5028

SOLUTION

) ( ) ( q p q p .

14

p q

DCS5028

Two different compound propositions are

logically equivalent if they have the same

truth-values no matter what truth-values their

constituent propositions have.

The notation p q denotes that p and q are

logically equivalent if p q is tautology.

15

DCS5028

Example

Prove or disprove that and

is a logical equivalence.

It is not a logical equivalence

16

)) ( ( q p q

)) ( ( q p p .

DCS5028

PROPERTIES

The operations for propositions have the

following properties.

DCS5028

17

Commutative Properties

1. p q q p

2. p q q p

Associative Properties

3. p ( q r) (p q) r

4. p ( q r) (p q) r

Distributive Properties

5. p ( q r) (p q) (p r)

6. p ( q r) (p q) (p r)

PROPERTIES

DCS5028

18

Idempotent Properties

7. p p p

8. p p p

Properties of Negation

9. ~(~p) p

10. ~(p q) (~ p) (~q)

11. ~(p q) (~ p) (~q)

De Morgans Laws

PROPERTIES (IMPLICATION)

The implication operation also has a number

of important properties.

DCS5028

19

Properties for implication operation

1. p q ( (~ p) q )

2. p q (~ q ~p )

3. (p q) ((p q) (q p))

4. ~ (p q) (p ~q )

4. ~ (p q) ((p ~q ) (q ~p))

LOGICAL EQUIVALENCE

Exercise:

1. Show the following De morgans Law for

Logic are logically equivalence.

2. Prove the conditional (or implication)

proposition p q and its contrapositive

are logically equivalence.

DCS5028

20

q p

q p q p . v ) (

q p q p v . ) (

Predicate and quantifiers are usually used

when involved in mathematical equation in

computer programs such as x> 3, x=y+3

and x + y=z.

This is usually involved one variable (or more

variables).

These statements are either true or false as

it depends on the values of variables.

21

DCS5028

PREDICATES

An element of {x | P(x)} is an object t for

which the statement P(t) is true.

Such a sentence P(x) is called a predicate.

P(x) is also called a propositional function

because each choice of x produces a

proposition P(x) that is either true or false.

22

DCS5028

EXAMPLE

Let A = {x | x is an integer less than 8}.

P(x) is the sentence x is an integer less than 8

The common property is is an integer less than

8

x =1, P(1) is the statement 1 is an integer less

than 8which is true.

DCS5028

23

A. Single Variable

Let P(m) denote the statement (m + 80 * m) /

m = 81. What are the truth values of P(8) and

P(6)?

Solution:

P(8), replace m with 8 in the (8 + 80 * 8) / 8 =

81 statement. FALSE

P(6), replace m with 6 in the (6 + 80 * 6) / 6 =

81 statement. TRUE

24

DCS5028

B. Multiple Variables

Let Q(x,y) denote the statement x = y + 8

What are the truth values of the propositions

Q(15,7) and Q(20,8)?

25

DCS5028

SOLUTION

26

DCS5028

C. n variables

Let R(x,y,z) denote the statement (y + 2) -

(x * 6) = z what are the truth values of the

propositions R(1,2,3) and R(5,32,4).

27

DCS5028

SOLUTION

28

DCS5028

QUANTIFIER

When all variables assigned with values, the

resulting statement becomes a proposition

with certain truth-value.

But there is another way to make the

statement becomes proposition with certain

truth-value, called Quantification.

29

DCS5028

QUANTIFIERS

There are two types of quantifiers;

A. Universal Quantifier

B. Existential Quantifier

DCS5028

30

A. UNIVERSAL QUANTIFIER

A logical quantifier(operator containing a

variable) of a proposition that asserts that the

proposition is true for every element in a domain

of discourse or of a type.

The universal quantification of P (x) is the

proposition

P (x) is true for all values of x in the universe of discourse

31

DCS5028

The notation xP(x) denotes the universal

quantification of P (x).

-Called universal quantifier

The proposition xP(x) is read as

for all x, P(x)

for every x, P(x)

for any x, P(x)

32

DCS5028

Example 1:

Let P(x) be the statement x likes Discrete

Structure where the universe of discourse

consists of a set of students. Write x P(x) in

words:

Answer:

All students like Discrete Structure

DCS5028

33

Example 2:

Let P(x) be the statement x

2

+1>x. What is the

truth value of the quantification x P(x), where

the universe of discourse consists of all positive

integers

Answer

Since P(x) is true for all positive integers x, the

quantification x P(x) is TRUE.

34

DCS5028

B. EXISTENTIAL QUANTIFIER

A logical quantifier of a proposition that asserts the

existence of at least one thing for which the

proposition is true

The existential quantification of P (x) is the

proposition where there exist an element x in the

universe of discourse such that P (x) is true

35

DCS5028

We use the notation -xP(x) for the existential

qualification of P(x).

- is called existential quantifier.

The existence quantification -xP(x) is read

as

There is an x such that P (x)

There is at least one x such that P (x)

For some x, P(x)

36

DCS5028

Example 1:

Let P(y) be the statement y likes Discrete

Structure where the universe of discourse

consists of a set of students. Write -y P(y) in

words:

Answer

Some students like Discrete Structure

Or

Not all Students like Discrete Structure

DCS5028

37

Example 2:

Let P(x) be the statement x > 5 . What is the

truth value of the quantification -x P(x),

where the universe of discourse consists of a

set of positive integers

Answer

Since P(6) is true, the quantification -x P(x) is

TRUE.

38

DCS5028

39

Quantifiers

Statement When True? When False?

x P(x)

(Conjunction)

P(x) true for every x

(All x must be true)

There is an x for

which P(x) is false

(At least one x is

false)

-xP(x)

(Disjunction)

There is an x for

which P(x) is true

(At least one x is

true)

P(x) false for every x

(All x must be false)

DCS5028

QUESTION

Let P(x) be x has taken a course in Program

Design and the domain of discourse consist

of the students in the class. Write the

universal quantifiers and existential

quantifiers for the P(x). What is the truth

value of the statement for Universal

Quantifier and Existential Quantifier in your

class?

40

DCS5028

SOLUTION

x P(x) = All student in the class has taken a

course in Program Design, FALSE/ TRUE

-xP(x) = Some students in the class has

taken a course in Program Design, TRUE

41

DCS5028

NEGATION QUANTIFIERS EXPRESSIONS

Sometimes we need to negate a quantified

expression. Let us look at the effect of

negation to the Universal and Existential

Quantifiers.

42

UNIVERSAL QUANTIFICATION

Example:

Every student in the class wear black colour T-

Shirt

This statement is a universal

quantification, named with x P(x), where

P(x)- x wear black colour T-Shirt

Question:

What is the negation quantifier

expression?

43

Solution:

Negation to the Universal Quantification:

(x P(x)) = - x P (x)

It is not the case that every student in the class

wears black colour T-Shirt

OR

There is a student in the class who is not

wearing a black colour T-Shirt

44

EXISTENTIAL QUANTIFICATION

Example:

At least one student in Discrete Structures class

has taken Mathematical Techniques 1

This statement is an existential quantification,

named with - x P (x) where P(x)- x has taken

Mathematical Techniques 1

Question:

What is the negation quantifier expression?

45

Solution:

Negation to the Existential Quantification:

(- x P(x)) = x P(x)

Every student in Discrete Structures class has

not taken Mathematical Techniques 1

OR

All student in Discrete Structures class has not

taken Mathematical Techniques 1.

46

The rules for negations for quantifiers are called De

Morgans Law for Quantifiers.

Negation Equivalent

Statement

When is

Negation

True?

When False?

(-x P(x)) x P(x)

For every x,

P(x) is false.

There is an x

for which

P(x) is true

(x P(x)) -x P(x) There is an x

for which

P(x) is false

P(x) is true

for every x

47

COUNTEREXAMPLE

To conclude that a statement of the form x

P(x) is false, where P(x) is a propositional

function, we need only to find a value of x in

the universe of discourse for which P(x) is

false.

Such a value of x is called the

counterexample to the statement x P(x).

For example, the prime number 2 is a

counterexample to the statement "All prime

numbers are odd."

48

QUESTION

Let q(x) denotes x

2

10. What are the truth

values of the quantifications x q(x) and -x

q(x), where the domain of discourse consists

of 0, 1, 2, 3 and 4?

49

SOLUTION

When the domain of discourse is {0, 1, 2, 3,

4}, a counterexample to the statement x (x

2

10) is 4, since 4

2

= 16 is not 10.

Hence the statement x (x

2

10) is false.

But the statement -x q(x), is true.

50

SUMMARY

Propositional Equivalence consist of three

types;

Tautology

Contradiction

Contingency

Predicates - involved one variable (or more

variables)

Quantifiers (Universal Quantifier , Existential

Quantifier)

Negations Quantifiers Expressions

51

DCS5028

REVIEW QUESTIONS

1. Build a truth table to verify that the proposition

( p q ) . ( p . q ) is a contradiction.

2. Show that ( p q ) . ( q p ) is

logically equivalent to p q

3. Let P(x) denote the statement x + 1 > 7.

What are the truth values for these

propositions?

P(1)

P(8)

P(6)

52

DCS5028

REVIEW QUESTIONS

4. Let P(n) be the propositional function n < 66. Write each

proposition below in words and tell whether its true or

false. The domain of discourse is a set of positive

integers.

n P(n)

-n P(n)

5. Let P(x) denote the statement x spends more than 3

hours every weekend in the library, where the universe

of discourse for x consists of all students. Write each

propositions below in words:

x P(x)

-x P(x)

53

DCS5028

REVIEW QUESTIONS

6. Let P(m) denote the statement m is taking an IT course,

where the universe of discourse for m is a set of students.

Translate each of these statements into logical expression

using predicates and quantifiers.

Some students are taking an IT course.

All students are taking an IT course.

54

DCS5028

REVIEW QUESTIONS

7. Let P(x) denote the statement x spends more than 3

hours every weekend in the library, where the

universe of discourse for x consists of all students.

Write each propositions below in words:

x P(x)

-x P(x)

8. Let P(m) denote the statement m is taking an IT

course, where the universe of discourse for m is a set

of students. Translate each of these statements into

logical expression using predicates and quantifiers.

All students are not taking an IT course.

There is a student who is not taking an IT course.

55

REVIEW QUESTIONS

9. Let P(y) be the propositional function y+1 > y. The

domain of discourse is the set = {y | 0 < y < 5}

Write each proposition below in words and tell whether

each proposition below is true or false.

(a) y P(y)

(b) -y P(y)

(c) (yP(y))

(d) (-y P(y))

56

## Molto più che documenti.

Scopri tutto ciò che Scribd ha da offrire, inclusi libri e audiolibri dei maggiori editori.

Annulla in qualsiasi momento.