(csc 102) lecture 3 discrete structures. previous lecture summary logical equivalences. de...

25
(CSC 102) Lecture 3 Discrete Structures

Upload: allyson-coleen-riley

Post on 13-Jan-2016

228 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

(CSC 102)

Lecture 3

Discrete Structures

Page 2: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Previous Lecture Summary

• Logical Equivalences.

• De Morgan’s laws.

• Tautologies and Contradictions.

• Laws of Logic.

• Logical Equivalences using Logical Laws.

Page 3: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Lecture`s outline

• Conditional Propositions.

• Negation, Inverse and Converse of the conditional statements.

• Contra positive .

• Bi conditional statements.

• Necessary and Sufficient Conditions.

• Conditional statements and their Logical equivalences.

Page 4: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Conditional propositions

DefinitionIf p and q are propositions, the conditional of q by p is if p then q or p implies q and is denoted by p→q.

It is false when p is true and q is false otherwise it is true.

ExamplesIf you work hard then you will succeed.

If John lives in Islamabad, then he lives in Pakistan.

Page 5: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Implication (if - then)

• Binary Operator, Symbol:

P Q P Q

T T T

T F F

F T T

F F T

Page 6: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Examples

“The online user is sent a notification of a link error if the network link is down”.

The statement is equivalent to

“If the network link is down, then the online user is sent a notification of a link error.”

Using p : The network link is down, q : the online user is sent a notification of a link error.

The statement becomes (q if p)

p → q.

Interpreting Conditional Statements

Page 7: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Examples

“When you study the theory, you understand the material”.

The statement is equivalent to (using if for ‘‘when’’)

“If you study the theory, then you understand the material.”

Using p : you study the theory, q : you understand the material.

The statement becomes (when p, q)

p → q.

Page 8: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Examples

“Studying the theory is sufficient for solving the exercise”.

The statement is equivalent to

“If you study the theory, then you can solve the exercise.”

Using p : you study the theory, q : you can solve the exercise.

The statement becomes (p is sufficient for q)

p → q.

Page 9: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Other forms of conditional propositions

• if p and q are statements then “p only if q” means ‘’if p then q”.

John will break the world`s record for the mile run only if he runs the mile in under four minutes.

is equivalent to

If john breaks the world`s record, then he will have to run the mile in under four minutes.

Page 10: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Activity

• Show that

p→q ≡ ¬p q

This shows that a conditional proposition is simple a proposition form that uses a not and an or.

• Show that

¬(p→q) ≡ p ¬qThis means that negation of ‘if p then q’ is logically equivalent to ‘p and not q’.

Page 11: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Solution

From the above table it is obvious that conditional proposition is equivalent to a “not or proposition” and that its negation is not of the form ‘if then’.

p q p q ¬pq ¬(pq) p¬q

T T T T F F

T F F F T T

F T T T F F

F F T T F F

Page 12: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Negations of some Conditionals

Proposition: If my car is in the repair shop, then I

cannot get the class.

Negation: My car is in the repair shop and I can get the class.

Proposition: If Sara lives in Athens, then she lives in

Greece.

Negation: Sara lives in Athens and she does not live in Greece.

Page 13: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Converse and inverse of the Conditional

Suppose a conditional proposition of the form ‘If p then q’ is given.

1.The converse is ‘if q then p’.

2.The inverse is ‘if ¬p then ¬q’.

Symbolically,

The converse of p→q is q→p,

And

The inverse of p→q is ¬p→¬q.

Page 14: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Continue…..Note: that the converse is not equivalent to the given

conditional proposition, for instance “ if john is from Chicago

then john is from Illinois” is true , but the converse “ if john is

from Illinois then john is from Chicago” may be false.

Similarly the inverse is also not equivalent to the conditional

proposition, for instance “ if an object is triangle then it is a

polygon” is true, but the inverse “ if an object is not a triangle

then it is not a polygon” is false i.e. square is a polygon.

Page 15: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Contraposition

Definition

The contra positive of a conditional proposition of the form ‘if p then q’ is ‘if ¬q then ¬p’. Symbolically, the contra positive of p→q is ¬q→¬p.

A conditional proposition is logically equivalent to its contra- positive. ExampleIf today is Sunday, then tomorrow is Monday.

Contra positive: If tomorrow is not Monday, then today is not Sunday.

Page 16: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

The Biconditional

Definition Given proposition variables p and q, the Bi conditional of p and q is p if and only if q and is denoted p↔q.

It is true if both p and q have the same truth values and is false if p and q have opposite truth values.

The words if and only if are sometime abbreviated iff.

Example This computer program is correct iff it produces the correct answer for all possible sets of input data.

Page 17: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Truth table

p q p↔q

T T T

T F F

F T F

F F T

p q p→q q→p p↔q (p→q) (q→p)

T T T T T T

T F F T F F

F T T F F F

F F T T T T

Page 18: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Interpreting Necessary and sufficient conditions

“If a number is divisible by 10, then it is divisible by 2”.

The clause introduced by If A number is divisible by 10” is called the hypothesis.  It is what we are given, or what we may assume.

The clause introduced by then It is divisible by 2 is called the conclusion. It is the statement that "follows" from the hypothesis.

When the If-then sentence is true, we say that the hypothesis is a sufficient condition for the conclusion. Thus it is sufficient to know that a number is divisible by 10, in order to conclude that it is divisible by 2.

The conclusion is then called a necessary condition of that hypothesis. For, if a number is divisible by 10, it necessarily follows that it will be divisible by 2.

Page 19: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Interpreting Necessary and sufficient conditions

Example: Consider the proposition

‘if John is eligible to vote then he is at least 18 year old’.

The truth of the condition ‘John is eligible to vote’ is sufficient to ensure the truth of the condition ‘John is at least 18 year old’.

In addition, the condition ‘John is at least 18 year old’ is necessary for the condition ‘John is eligible to vote’ to be true. If John were younger than 18, then he would not eligible to vote.

Page 20: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Necessary and Sufficient Conditions

Let r and s are two propositions

r is a sufficient condition for s means ‘if r then s’.

r is a necessary condition for s means ‘if not r then not s’

r is necessary and sufficient condition for s means ‘r if and only if s’

Page 21: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Prove that ¬[r (q (¬r →¬p))] ∨ ∧ ≡ ¬r (p ¬q)∧ ∨

Logical Equivalence of Conditional propositions

¬[r (q (¬r → ¬p))]∨ ∧≡ ¬r ¬(q (¬r → ¬p)), ∧ ∧ De Morgan’s law

≡ ¬r ¬(q (¬¬r ¬p)), ∧ ∧ ∨ Conditional rewritten as disjunction

≡ ¬r ¬(q (r ¬p)), ∧ ∧ ∨ Double negation law

≡ ¬r (¬q ¬(r ¬p)), ∧ ∨ ∨ De Morgan’s law

≡ ¬r (¬q (¬r p)), ∧ ∨ ∧ De Morgan’s law, double negation

≡ (¬r ¬q) (¬r (¬r p)), ∧ ∨ ∧ ∧ Distributive law

≡ (¬r ¬q) ((¬r ¬r) p), ∧ ∨ ∧ ∧ Associative law

≡ (¬r ¬q) (¬r p), ∧ ∨ ∧ Idempotent law

≡ ¬r (¬q p), ∧ ∨ Distributive law

≡ ¬r (p ¬q),∧ ∨ Commutative law

Page 22: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Conversion of statements in to symbols

Write these system specifications in symbols using the propositions

v: “The user enters a valid password,”a: “Access is granted to the user,”c: “The user has contacted the network administrator,”

and logical connectives. Then determine if the system specifications are consistent.

(i) “The user has contacted the network administrator, but does not enter a valid password.”

c ¬ v∧

Page 23: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Cont….

ii) “Access is granted whenever the user has contacted the network administrator or enters a valid password.”

(c ∨ v) → a

(iii) “Access is denied if the user has not entered a valid password or has not contacted the network administrator.”

(¬v ∨ ¬c) → ¬a

Page 24: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Conversion of statements in to symbols

Translate this system specification into symbols:

“Whenever the file is locked or the system is in executive clearance mode, the user cannot make changes in the data.”

l : “the file is locked”e : “the system is in executive clearance mode” u : “the user can make changes in the data” then the statement in symbolic form would be

(l ∨ e) → ¬ u

Page 25: (CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic

Lecture Summary

• Conditional Propositions.

• Negation, Inverse and Converse of the conditional statements.

• Contra positive .

• Bi conditional statements.

• Necessary and Sufficient Conditions.

• Conditional statements and their Logical equivalences.

• Translating English to Symbols.