17
CSNB143 – Discrete Structure Topic 4 – Logic

CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Embed Size (px)

Citation preview

Page 1: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

CSNB143 – Discrete Structure

Topic 4 – Logic

Page 2: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicLearning Outcomes• Students should be able to define statement. • Students should be able to identify connectives and compound

statements.• Students should be able to use the Truth Table without difficulties

Page 3: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicLogic - explanation

Statements are the basic building block of logic

Statements or propositions is a declarative sentence with the value of true

or false but not both.

Which one is a statement?

•The world is round.

•2 + 3 = 5

•Have you taken your lunch?

•3 - x = 5

•The temperature on the surface of Mars is 800F.

•Tomorrow is a bright day.

•Read this!

Page 4: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicLogical Connectives and Compound Statements• Many mathematical statements are constructed by combining one or more

statements• Statement usually will be replaced by variables such as p, q, r or s. Example :

p: The sun will shine todayq: It is a cold weather.

• Statements can be combined by logical connectives to obtain compound statements.

• Example : AND (p and q): The sun will shine today and it is a cold weather.

Page 5: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicLogical Connectives - Conjunction• Connectives AND is what we called conjunction for p and q, written p q.

The compound statement is true if both statements are true. • To prove the value of any statement (or compound statements), we need

to use the Truth Table.

p q p q

T T

T F

F T

F F

Page 6: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicLogical Connectives – Disjunction• Connectives OR is what we called disjunction for p and q, written p q.

The compound statement is false if both statements are false. • To prove the value of any statement (or compound statements), we need

to use the Truth Table.

p q p q

T T

T F

F T

F F

Page 7: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicLogical Connectives - Negation• Negation for any statement p is not p, written as ~p or p. • The Truth Table for negation is:

p ~p

T F

F T

Page 8: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicTruth Table – work this out:• Find the value of the following compound statements using Truth Table.

– p ~ q– (~ p q) p– ~ p ~ q

Page 9: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicConditional Statements• If p and q are statements, the compound statement if p then q, denoted

by p q is called a conditional statement or implication. • Statement p is called the antecedent or hypothesis (let say); and

statement q is called consequent or conclusion. The connective if … then is denoted by the symbol .

• Example a) p : I am hungry q : I will eat

b) p : It is cold q : 3 + 5 = 8• The implication would be: a) If I am hungry, then I will eat.

b) If it is cold, then 3 + 5 = 8.

Page 10: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicTruth table for Conditional Statements

p q p q

T T T

T F F

F T T

F F T

Note that whenever p is false, p q is always true, whenever p and q are both true, p q is true. If p is true and q is false, p q is false. Remember that p is hypothesis and q is the conclusion.

A little help:To remember the layout of the

conditional statement truth table, imagine you are dealing with the statements if it is raining (as the hypothesis) , I use an umbrella

(as the conclusion)

Page 11: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicBiconditional statements• If p and q are statements, compound statement p if and only if q, denoted

by p q, is called an equivalence or biconditional.• Its Truth Table is as below:

p q p q

T T T

T F F

F T F

F F T

•Note that p q is True in two conditions: both p and q are True, or both p and q are false.

Page 12: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicWork this out:• Find the truth value for the statement (p q) (~q ~p)

Page 13: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – Logic• A statement that is true for all possible values of its propositional variables

is called a tautology.• A statement that is always false for all possible values of its propositional

variables is called a contradiction. • A statement that can be either true or false, depending on the truth

values of its propositional variables is called a contingency

p q p q

(A)

~q ~p ~q ~p

(B)

(A) (B)

T T T F F T T

T F F T F F T

F T T F T T T

F F T T T T T

Page 14: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicLogically Equivalent• Two statements p and q are said to be logically equivalent if p q is a

tautology.• Example :

Show that statements p q and (~p) q are logically equivalent.

p q p q

(A)

~p (~p) q

(B)

(A) (B)

T T T F T

T F F F F

F T T T T

F F T T T

Page 15: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicQuantifier• Quantifier is used to define about all elements that have something in

common.• Such as in set, one way of writing it is {x | P(x)} where P(x) is called

predicate or propositional function, in which each choice of x will produces a proposition P(x) that is either true or false.

• There are two types of quantifier being used:• Universal Quantification () of a predicate P(x) is the statement

“For all values of x, P(x) is true” In other words:

• for every x• every x• for any x

Example:For the propositional function P(x) : - (-x) = x, where x is a positive integer determine if x P(x) is a true or false statement

Page 16: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicQuantifier (continued)• Existential Quantification () of a predicate P(x) is the statement• “There exists a value of x for which P(x) is true”• In other words:

– there is an x– there is some x– there exists an x– there is at least one x

Example:For the propositional function Q(x) : x + 1 < 4, find out if x Q(x) is a true or false statement

Page 17: CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives

Topic 4 – LogicWork this out (Universal Quantifier), where x is a positive integer larger

than 0• Let Q(x): x + 1 < 4. Determine the truth value of x Q(x)• Let P(x) : x + 1 > 4. Determine the truth value of x P(x) • Let R(x) : x < 2. Determine the truth value of x R(x)

Work this out (Existential Quantifier)• Let P(x): x > 3. Determine the truth value of x P(x) • Let R(x) : x= x + 1. Determine the truth value of x R(x), where x is a

positive integer. • Let S(x) : x2 > 10, where x is a positive integer not exceeding 3, determine

the truth value of x S(x),