Presentation is loading. Please wait.

Presentation is loading. Please wait.

9/21/2015 1 A sample class of Discrete Structures Gongjun Yan Computer Science Department, Old Dominion University, Norfolk, VA (Logical conjunction and.

Similar presentations


Presentation on theme: "9/21/2015 1 A sample class of Discrete Structures Gongjun Yan Computer Science Department, Old Dominion University, Norfolk, VA (Logical conjunction and."— Presentation transcript:

1 9/21/2015 1 A sample class of Discrete Structures Gongjun Yan Computer Science Department, Old Dominion University, Norfolk, VA (Logical conjunction and logical implication)

2 9/21/2015 2 Review Proposition Proposition Declarative statement (no question, no imperative statement) Declarative statement (no question, no imperative statement) Either true or false but not both Either true or false but not both Examples Examples Which of the following are propositions? Which of the following are propositions? Today is Friday. Today is Friday. Everyone is happy. Everyone is happy. What time is it? What time is it? Game Time! Game Time! Game Time! Game Time!True! False!

3 9/21/2015 3 More Questions What are the values of propositions below? What are the values of propositions below? If a fly has no wings, it is called a walk. If a fly has no wings, it is called a walk. If olive oil comes from olives, then baby oil comes from babies. If olive oil comes from olives, then baby oil comes from babies. How does the if statement work in the java code below? How does the if statement work in the java code below? dScore = 93; dScore = 93; if ( (dScore 90) ) if ( (dScore 90) ) { print "You got an A." print "You got an A." }

4 9/21/2015 4 Today’s Content Logical conjunction (AND) Logical conjunction (AND) Logical implication (IF-Then) Logical implication (IF-Then) The truth table of AND and IF-THEN The truth table of AND and IF-THEN

5 9/21/2015 5 Logical conjunction: AND Is an operation on two propositions Is an operation on two propositions Produces a value of true if and only if both of its propositions are true Produces a value of true if and only if both of its propositions are true Keywords: &&, and, &. Keywords: &&, and, &. We often use p q We often use p q

6 9/21/2015 6 Truth Table Indicate the value of the logical expressions. Indicate the value of the logical expressions. The Truth table of p ∧ q The Truth table of p ∧ q if both p and q are true, then p ∧ q is true

7 9/21/2015 7 Example 1 Translate the underlined expression into logical expression. Translate the underlined expression into logical expression. dScore = 93; if ( (dScore 90) ) { print(“you got an A.”); } dScore = 93; if ( (dScore 90) ) { print(“you got an A.”); } Let p = (dScore <= 100); Let p = (dScore <= 100); q = (dScore > 90). q = (dScore > 90). p q p q

8 9/21/2015 8 Logical implication: IMPLIES Is a proposition “if p, then q”. Is a proposition “if p, then q”. Produces all true values except when p is true and q is false. Produces all true values except when p is true and q is false. Keywords: if-then, if, then, whenever, only if, etc. Keywords: if-then, if, then, whenever, only if, etc. We often use p q We often use p q The Truth table of p → q The Truth table of p → q All true except when p is true and q is false.

9 9/21/2015 9 Example 2 2.1 Translate English into logical implication p → q: 2.1 Translate English into logical implication p → q: If olive oil comes from olives, then baby oil comes from babies. If olive oil comes from olives, then baby oil comes from babies. Answer: Let p = “Olive oil comes from olives.” Answer: Let p = “Olive oil comes from olives.” q = “Baby oil comes from babies.” q = “Baby oil comes from babies.” We write: p q. We write: p q.

10 9/21/2015 10 Example 2 2.2 What is the value of the statement: 2.2 What is the value of the statement: If olive oil comes from olives, then baby oil comes from babies. If olive oil comes from olives, then baby oil comes from babies. Answer: Answer: Let p = “Olive oil comes from olives.” q = “Baby oil comes from babies.” Let p = “Olive oil comes from olives.” q = “Baby oil comes from babies.” We write: p → q; We write: p → q; p=true; p=true; q=false. q=false. By truth table, By truth table, the answer is false. the answer is false.

11 9/21/2015 11 Quiz What are the values of propositions? What are the values of propositions? 1. Tom Cruise is an actor and he is handsome. 1. Tom Cruise is an actor and he is handsome. p = “Tom Cruise is an actor.” q = “Tom Cruise is handsome.” Answer: We write p ∧ q. Answer: We write p ∧ q. p=true. p=true. In my wife’s opinion, q=true. In my wife’s opinion, q=true. By truth table, the answer is true. By truth table, the answer is true. 2. If Tiger Woods is studying discrete structures, then he will not play golf. p = “Tiger Woods is studying discrete structures.” q = “Tiger Woods will not play golf.” 2. If Tiger Woods is studying discrete structures, then he will not play golf. p = “Tiger Woods is studying discrete structures.” q = “Tiger Woods will not play golf.” Answer: We write p → q. Answer: We write p → q. In my mind, p=false; In my mind, p=false; q=false. q=false. By truth table, the answer is true. By truth table, the answer is true.

12 9/21/2015 12 Summary Two definitions: Two definitions: logical conjunction p ∧ q logical conjunction p ∧ q Logical implication p → q Logical implication p → q Truth table of p ∧ q, p → q Truth table of p ∧ q, p → q Any questions? Any questions?

13 9/21/2015 13 More Information Course home page link Course home page link http://www.cs.odu.edu/~ygongjun/courses/cs 381fall09/instructions/ http://www.cs.odu.edu/~ygongjun/courses/cs 381fall09/instructions/ http://www.cs.odu.edu/~ygongjun/courses/cs 381fall09/instructions/ http://www.cs.odu.edu/~ygongjun/courses/cs 381fall09/instructions/ Homework: reading and playing! Homework: reading and playing! Translation between p ∧ q, p → q and English Link: course-home-page/if_then.html Translation between p ∧ q, p → q and English Link: course-home-page/if_then.htmlcourse-home-page/if_then.html Truth Tables Link: course-home-page/truth_table.html Truth Tables Link: course-home-page/truth_table.htmlcourse-home-page/truth_table.html Office hours: Monday 10:00-12:00am Wednesday 10:00-12:00am Office hours: Monday 10:00-12:00am Wednesday 10:00-12:00am


Download ppt "9/21/2015 1 A sample class of Discrete Structures Gongjun Yan Computer Science Department, Old Dominion University, Norfolk, VA (Logical conjunction and."

Similar presentations


Ads by Google