1 / 100

DISCRETE STRUCTURES

DISCRETE STRUCTURES. LOGICAL STRUCTURE. Logic - study of reasoning - focuses on the relationship among statements as opposed to the content of any particular statement.

jeroen
Télécharger la présentation

DISCRETE STRUCTURES

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DISCRETE STRUCTURES

  2. LOGICAL STRUCTURE • Logic - study of reasoning - focuses on the relationship among statements as opposed to the content of any particular statement. Logical methods are used in mathematics to prove theorems and in computer science to prove that programs do what they are alleged to do. ex. All mathematicians wear sandals. Anyone who wears sandals is an algebraist. Therefore, all mathematicians are algebraist.

  3. LOGICAL STRUCTURE Propositions – A sentence that is either true or false, but not both. Examples: • 1+1=3 • 2+2=4 - A fact-based declaration is a proposition, even if no one knows whether it is true.

  4. LOGICAL STRUCTURE • A statement cannot be true or false unless it is declarative. This excludes commands and questions. examples: • What time is it? • Go home.

  5. LOGICAL STRUCTURE Definition Let p and q be propositions • The conjunction of p and q, denoted by p ᴧ q, is the proposition p and q • The disjunction of p and q, denoted p ᴠ q, is the proposition p or q

  6. LOGICAL STRUCTURE Compound proposition – combination of propositions Example : p: 1+1 = 3 q: a decade is 10 years then: conjunction: p ᴧ q : 1+1 = 3 and a decade is 10 years. disjunction: p ᴠ q : 1+1 = 3 or a decade is 10 years

  7. LOGICAL STRUCTURE Each sentence or the propositions has a truth value of either true or false. The truth values of propositions can be described by truth tables.

  8. LOGICAL STRUCTURE Definition The truth value of the compound proposition p ᴧ q is defined by the truth table - states that the conjunction p ᴧ q is true provided that p and q are both true; p ᴧ q is false otherwise.

  9. LOGICAL STRUCTURE Definition The truth value of the compound proposition p ᴠ q is defined by the truth table - states that the disjunction p ᴠ q is true if either p or q or both are true; false if both p and q are false

  10. LOGICAL STRUCTURE Definition The negation of p denoted by ¬p is the proposition not p. The truth value of the proposition ¬p is defined by the truth table In other words, the negation of a proposition has the opposite truth value from the proposition itself.

  11. LOGICAL STRUCTURE Example p: Blaise Pascal invented several calculating machines. q: The first all-electronic digital computer was constructed in the 20th century. r: П was calculated to 1M decimal digits in 1954

  12. LOGICAL STRUCTURE • represent the proposition: Either Blaise Pascal invented several calculating machines and it is not the case that the first all electronic digital computer was constructed in the 20th century; or П was calculated to 1M decimal digits in 1954.

  13. LOGICAL STRUCTURE Definition: If p and q are propositions, the compound propositions if p then q is called conditional proposition and is denoted by p→ q. • The proposition p is called the hypothesis (or antecedent) and the proposition q is called the conclusion (or consequent)

  14. LOGICAL STRUCTURE example: p: The Math Dept. gets an additional Php 200,00. q: The Math Dept. hires one new faculty member p→ q: If the Math Dept. gets an additional Php 200,000, then it will hire one new faculty member.

  15. LOGICAL STRUCTURE p→ q • if p then q • p implies q (q is implied by p) • whenever p, q (q whenever p) • q unless ¬p • p only if q (if not q then not p) • ¬q implies ¬p • p is a sufficient condition for q • q is a necessary condition for p

  16. LOGICAL STRUCTURE examples • If 3+3=7, then you are the pope. • If the Lakers win the NBA, then they sign Artest. A necessary condition for the Lakers to win the NBA is that they sign Artest. 3. If John takes calculus, then he passed algebra. John may take calculus only if he passed algebra. 4. If Jane goes to EK, then she visits Laguna. A sufficient condition for Jane to visit Laguna is that she goes to EK.

  17. LOGICAL STRUCTURE Definition: The truth value of the conditional proposition p→ q is defined by the following truth table.

  18. LOGICAL STRUCTURE Examples: • p: 1>2 False q: 4<8 True p→ q ? q→ p ? 2. Given p is true, q is false, r is true, find the truth value of: a. (pᴧq)→r b. (pᴠq)→¬r

  19. LOGICAL STRUCTURE NOTE: • Converse: The proposition q→ p is the converse of the proposition p→ q. • Inverse: The proposition ¬p→¬q is the inverse of the proposition p→ q. • Contrapositive: The contrapositive (or transposition) of the conditional proposition p→ q is the proposition ¬q→¬p.

  20. LOGICAL STRUCTURE Example: “The home team wins whenever it is raining” (“If it is raining, then the home team wins.”) Converse: “ If the home team wins, then it is raining.” Inverse: “ If it is not raining, then the home team does not win.” Contrapositive: “If the home team does not win, then it is not raining.”

  21. LOGICAL STRUCTURE Definition If p and q are propositions, the compound proposition p if and only if q is called a biconditional proposition and is denoted by p↔ q.

  22. LOGICAL STRUCTURE p↔ q • p is equivalent to q • p iff q • p is a sufficient and necessary condition for q • p →q and q→ p (p implies q and q implies p)

  23. LOGICAL STRUCTURE Definition The truth value of the proposition p↔ q is defined by the following truth table. Example: 1<5 iff 2<8

  24. LOGICAL STRUCTURE Derfinition Suppose that the compound propositions P and Q are made up of the propositions p1,p2,…,pn . We say that P and Q are logically equivalent and write P ≡ Q , provided that given any truth values of p1,p2,…,pn, either P and Q are both true or P and Q are both false.

  25. LOGICAL STRUCTURE example: 1. De Morgan’s Laws for Logic ¬ (pᴠq) ≡ ¬p ᴧ ¬q 2. ¬(p→q) ≡ pᴧ¬q 3. State whether P ≡ Q a. P = pᴧ(¬qᴠr) ; Q = pᴠ(qᴧ¬r) b. P = (p→q)→r ; Q = p→(q→r) Note: The conditional proposition p→q and its contrapositive¬q→¬p are logically equivalent.

  26. LOGICAL STRUCTURE Exercises: • Let p,q,r be the following sentences p: John is at the office. q: Joan is at the office. r: Laura is at the office. Use logical connectives to express the following sentences: • John is not at the office. • If Joan and Laura are at the office then John is at the office.

  27. LOGICAL STRUCTURE 3. If John is at the office then either Joan or Laura is at the office. 4. John, Joan and Laura are all at the office. 5. Joan is not at the office and either John or Laura are at the office. 6. If Laura is not at the office then John and Joan are both at the office.

  28. LOGICAL STRUCTURE B. Translate the following into logical expression. • “ You can access the internet from campus only if you are a computer science major or you are not a freshman.” • “ You cannot ride the roller coaster if you are under 4 feet tall unless you are older than 16 years old.”

  29. LOGICAL STRUCTURE C. Solve a Crime Four friends have been identified as suspects for an unauthorized access into a computer system. They have made statements to the investigating authorities. Alice said “Carlos did it.” John said “ I did not do it .” Carlos said “ Diana did it.” Diana said “Carlos lied when he said that I did it.” If the authorities also know that exactly one of the four suspects is telling the truth, who did it?

  30. LOGICAL STRUCTURE Theorem The following list of logically equivalent properties can be established using truth tables. • Indempotent Laws pᴧp ≡ p pᴠp ≡ p 2. Double Negation ¬(¬p) ≡ p 3. De Morgan’s Laws ¬ (pᴠq) ≡ ¬p ᴧ ¬q ¬ (pᴧq) ≡ ¬p ᴠ ¬q 4. Commutative properties pᴧq ≡ qᴧp pᴠq ≡ qᴠp

  31. LOGICAL STRUCTURE 5. Associative properties pᴧ(qᴧr) ≡ (pᴧq)ᴧr pᴠ(qᴠr) ≡ (pᴠq)ᴠr 6. Distributive properties pᴧ(qᴠr) ≡ (pᴧq)ᴠ(pᴧr) pᴠ(qᴧr) ≡ (pᴠq)ᴧ(pᴠr) 7. Equivalence of Contrapositive p→q ≡ ¬q→¬p 8. Other useful properties p→q ≡ ¬pᴠq p↔q ≡ (p→q)ᴧ(q→p)

  32. LOGICAL STRUCTURE QUANTIFIERS Definition Let P(x) be a statement involving the variable x and let D be a set. We call P a propositional function (with respect to D) if for each x in D, P(x) is a proposition. We call D the domain of discourse of P.

  33. LOGICAL STRUCTURE P(x): value of the propositional function P of x. Example: “x>5” these statement is not a proposition because whether it is true or false depends on the value of x. Once a value has been assigned to the variable x, the statement P(x) becomes a proposition and has a truth value.

  34. LOGICAL STRUCTURE In general, a statement involving n variables x1, x2,…,xn can be denoted by P(x1, x2,…,xn). A statement of the form P(x1, x2,…,xn) is the value of the propositional function P at the n-tuples (x1, x2,…,xn) and P is also called a predicate.

  35. LOGICAL STRUCTURE To create proposition from a propositional function: • Assign values to the variables • Quantification types: 1. universal quantification 2. existential quantification

  36. LOGICAL STRUCTURE Definition The universal quantification of P(x) is the proposition “P(x) is true for all values of x in the domain of discourse.” Notation: • denotes the universal quantification of P(x) • called the universal quantifier • read as “for all x P(x)” ; “for every x P(x)” • true if P(x) is true for every x • false if P(x) is false for at least one x in the Domain

  37. LOGICAL STRUCTURE Examples: Domain for x is the set of real numbers • P(x): “x+1>x” • P(x): “x>5” • Q(x): “x2 >= x” Note: is false if P(x) is false for at least one x in D. A value x in the domain of discourse that makes P(x) false is called a counterexample to the statement .

  38. LOGICAL STRUCTURE Definition The existential quantification of P(x) is the proposition “There exist an element x in the domain of discourse such that P(x) is true. Notation: • denotes the existential quantification of x • is called the existential quantifier • read as “there is an x s.t. P(x)” “there is at least one xs.t. P(x)” “for some x, P(x)”

  39. LOGICAL STRUCTURE • true if P(x) is true for at least one x in the domain • false if P(x) is false for every x in the domain Examples: Domain is the set of real numbers • P(x): x>3 • Q(x): x = x+1 3. P(x):

  40. LOGICAL STRUCTURE Exercises. Give the domain. 1. 2. True or False. Domain is the set of integers. P(x): x>2 Q(x): x<2 1. 2.

  41. LOGICAL STRUCTURE Negation with Quantifiers example : Every student in the class has taken a course in calculus. P(x) :“x has taken a course in calculus” Negation of : • It is not the case that every student in the class has taken a course in calculus. • There is a student in the class who has not taken a course in calculus. :

  42. LOGICAL STRUCTURE Example :There is a student in this class who has taken a course in calculus. Q(x) :“x has taken a course in calculus” Negation of • It is not the case that there is a student in this class who has taken a course in calculus. • Every student in this class has not taken calculus. :

  43. LOGICAL STRUCTURE RULES of INFERENCE Definition (Argument) Anargument is a sequence of propositions written as. The propositions p1,p2,…,pnare called the hypotheses (or premises), and the proposition q is called the conclusion. The argument is valid provided that if p1 andp2 and pn are all true, then q must also be true; otherwise, the argument is invalid (or a fallacy).

  44. LOGICAL STRUCTURE Rules of inference- brief and valid argument used within a larger argument such as proof Example Determine whether the argument is valid. p→q p q D:\DiscreteMath\QUANTIFIERS.doc

  45. LOGICAL STRUCTURE Example (A Logical Argument) If I dance all night, then I get tired. I danced all night. Therefore I got tired. Logical representation of the underlying variables: p: I dance all night. q: I get tired. Logical analysis of the argument: p→q p q

  46. LOGICAL STRUCTURE If I dance all night, then I get tired. I got tired. Therefore I danced all night. Logical form of argument: p→q q p

  47. LOGICAL STRUCTURE Examples: 1. Show that the hypotheses “ If you send me an email message, then I will finish writing the program,” If you do not send me an email message, then I will go to sleep early,” and “If I go to sleep early, then I will wake up feeling refreshed “ lead to the conclusion “If I do not finish writing the program, then I will wake up feeling refreshed.”

  48. LOGICAL STRUCTURE 2. Show that the hypotheses "It is not sunny this afternoon and it is colder than yesterday," "We will go swimming only if it is sunny," "If we do not go swimming, then we will take a canoe trip, " and " If we take a canoe trip, then we will be home by sunset" lead to the conclusion "We will be home by sunset. "

  49. FUNCTIONS

  50. FUNCTIONS Definition Let A and B be sets. A function f from A to B is an assignment of exactly one B element to each element of A . We write f(a)=b if b is the unique element of B assigned by the function f to the element a of A. If is a function from A to B, we write f:A→B.

More Related