1 / 46

Discrete Structures Chapter 1 Part A Fundamentals of Logic

Discrete Structures Chapter 1 Part A Fundamentals of Logic. Nurul Amelina Nasharuddin Multimedia Department. Logic of Statements. Logical Form and Logical Equivalence Conditional Statements Valid and Invalid Arguments Logic of Quantified Statements Application : Digital Logic Circuits.

ramiro
Download Presentation

Discrete Structures Chapter 1 Part A Fundamentals of Logic

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 StructuresChapter 1 Part AFundamentals of Logic Nurul Amelina Nasharuddin Multimedia Department

  2. Logic of Statements • Logical Form and Logical Equivalence • Conditional Statements • Valid and Invalid Arguments • Logic of Quantified Statements • Application: Digital Logic Circuits

  3. Logical Form • Concept of logic – argument form • Argument is a sequence of statements aimed to demonstrate the truth of an assertion • The preceding statements are called premises • Assertion at the end of the sequence is called the conclusion • Arguments are valid in the sense that if their premises are true, then their conclusions must also be true

  4. Logical Form • To illustrate the logical form of arguments, we use letters of the alphabet (p, q, and r) to represent the statements • Argument 1: “If Jane is a computer science major, then Jane will take SSK3003” p = Jane is a computer science major q = Jane will take SSK3003 The common logical form: If p, then q.

  5. Logical Form • Argument 2: “If x < -2 or x > 2, then x2 > 4.” p = x < -2, q = x > 2, r = x2 > 4 The common logical form: If p or q, then r. • Argument 3: “If the program syntax is faulty or if program execution results in division by 0, then the computer will generate an error message. Therefore, if the computer does not generate an error message, then the program syntax is correct and program execution does not result in division by 0.”

  6. Logical Form p = The program syntax faulty, q = The computer will generate an error message r = The program execution results in division by 0 The common logical form: If p and q, then r. Therefore, if not r, then not p and not q.

  7. Logical Form • Initial terms in logic: sentence, true, false • Statement (proposition) is a sentence that is true or false BUT not both • Compound statement is a statement built out of simple statements using logical operations: negation, conjunction, disjunction

  8. Logical Form • Given two statements, p and q. Negation of p (NOT p) = symbolized by  /  Conjunction of p and q (p AND q) = symbolized by  Disjunction of p and q (p OR q) = symbolized by 

  9. Logical Form • Translation of English to symbolic logic statements: • The sky is blue. • One simple (primitive) statement – assign to a letter i.e. p • The sky is blue and the grass is green. • One compound statement • Conjunction of two primitive statements • Each single statement gets a letter i.e. p q • And join with  i.e. p  q • The sky is blue or the sky is purple. • One compound statement • Disjunction of two primitive statements • Each single statement gets a letter i.e. r s • And join with  i.e. r  s

  10. Logical Form • Each statement must have well-define truth values – they must either be true or false. • We summarized all the possible truth values of a statement in truth tables. • Truth tables for operators can be • Alone • Combined • Using 0’s or 1’s

  11. Logical Form • Given two statements, p and q. Exclusive Or of p and q (p XOR q) = symbolized by  = when or is used in its exclusive sense, when the statement “p or q” means “p or q but not both.”

  12. Logical Form • Construct a truth table for the statement form (p q)  r n = number of statements How to calculate number of rows? Answer = 2n

  13. Logical Equivalence • Truth table for (~pq)  (q ~r) • Two statements (P and Q) are called logically equivalent if and only if (iff) they have identical truth tables (P  Q) • How to check two statements are logically equivalent? • Double negation, ~(~p)  p • De Morgan’s Laws: • The negation of and AND statement is logically equivalent to the OR statement in which component is negated, ~(pq)  ~p ~q • The negation of an OR statement is logically equivalent to the AND statement in which each component is negated, ~(pq)  ~p ~q

  14. Logical Equivalence • Applying De-Morgan’s Laws: • Write negation for • The bus was late or Tom’s watch was slow • -1 < x <= 4 • Tautology is a statement that is always true regardless of the truth values of the individual logical variables • Contradiction is a statement that is always false regardless of the truth values of the individual logical variables

  15. Logical Equivalence • Show that the statement form p p is a tautology and p p is a contradiction • A number of logical equivalences are summarized in Theorem 1.1.1 for future reference (pg. 14) • The theorem can be used in a formal way to simplify complicated statements

  16. THEOREM 1.1.1 Logical Equivalences • Commutative laws: p  q  q  p, p  q  q  p • Associative laws: (p  q)  r  p  (q  r), (p  q)  r  p  (q  r) • Distributive laws: p  (q  r)  (p  q)  (p  r) p  (q  r)  (p  q)  (p  r) • Identity laws: p  t  p, p  c  p • Negation laws: p  ~p  t, p  ~p  c • Double negative law: ~(~p)  p • Idempotent laws: p  p  p, p  p  p • De Morgan’s laws: ~(p  q)  ~p  ~q, ~(p  q)  ~p  ~q • Universal bound laws: p  t  t, p  c  c • Absorption laws: p  (p  q)  p, p  (p  q)  p • Negation of t and c: ~t  c, ~c  t

  17. Logical Equivalence • Use Theorem 1.1.1 to verify the logical equivalence of (p  q)  (p  q)  p (p  q)  (p  q)  ((p)  q)  (p  q) DM laws  (p  q)  (p  q) Double negative law  p  ( q  q) Distributive law  p  (q  q) Commutative law for   p  c Negation law  p Identity law

  18. Exercises • Write truth table for: (p (~pq))  ~(q ~r) • Simplify: ~(~pq)  (pq) • Simplify: ~(p ~q)  (~p ~ q)  ~p

  19. Answers • (p (~pq))  ~(q ~r)

  20. Answers • ~(p ~q)  (~p ~ q)  ~p (p q)  (p q)  (p (q))  (p q) DM law  (p  q)  (p q) Double negative law  p  (q q) Distributive law  p  t Negation law  p Identity law

  21. Conditional Statements • “If something, then something”: p  q, p is called the hypothesis and q is called the conclusion • The formal definition of truth values for p  q is based on its everyday, intuitive meaning • Eg: You go for an interview, and the boss promise you, “If you show up for work Monday morning, then you will get the job” • Under what circumstances, the above sentence is false?

  22. Conditional Statements • Ans: You do show up for work Monday morning and you do not get the job • What happen when you do not show up for work Monday morning? • The boss’ promise ONLY say you will get the job if a certain condition (showing up for work) is met • It says nothing about what will happen if the condition is not met • So if the condition is not met, you can not simply say the promise is false regardless of whether or not you get the job

  23. Conditional Statements • The only combination of circumstances in which a conditional sentence is false is when the hypothesis is true and the conclusion is false • A conditional statements is called vacuously true or true by default when its hypothesis is false

  24. Conditional Statements • Among , , ~ and  operations,  has the lowest priority • Show that (p  q)  r  (p  r)  (q  r) by using truth table • Representation of : p  q  ~p  q • Re-write using if-then: Either you get in class on time, or you risk missing some material

  25. Conditional Statements • Ans: ~p  q, Let ~p be you get in class on time and q be you risk missing some material • So, the equivalent if-then version, p  q is If you do not get in class on time, then you risk missing some material • Negation of : ~(p  q)  p  ~q

  26. Conditional Statements • Contrapositive of the statement p  q is another conditional statement, ~q  ~p • A conditional statement is equivalent to its contrapositive • Write in contrapositive form: If today is Easter, then tomorrow is Monday. • Ans: If tomorrow is not Monday, then today is not Easter. Easter is a Christian celebration celebrated on Sunday

  27. Conditional Statements • The converse of p  q is q  p • The inverse of p  q is ~p  ~q • Conditional statement and its converse are NOT equivalent • Conditional statement and its inverse are NOT equivalent • The converse and inverse of a statement are logically equivalent to each other • Write the converse and inverse: If today is Easter, then tomorrow is Monday • Converse: If tomorrow is Monday, then today is Easter • Inverse: If today is not Easter, then tomorrow is not Monday

  28. Exercises • Write contrapositive, converse and inverse statements for: • If P is a square, then P is a rectangle • If n is prime, then n is odd or n is 2 • If x is nonnegative, then x is positive or x is 0 • If n is divisible by 6, then n is divisible by 2 and n is divisible by 3

  29. Answers • If P is a square, then P is a rectangle Contrapositive: If P is not a rectangle, then P is not a square Converse: If P is a rectangle, then P is a square Inverse: If P is not a square, then P is not a rectangle

  30. Conditional Statements • Biconditional of p and q means “p if and only if q” (iff) and is denoted as p  q • True when both statement have the same truth values

  31. Conditional Statements • “p only if q” means p occurs only if q also occurs • Means ~q  ~p, or p  q • Re-write using if-then: You will get an A only if you get 80 marks. • Ans 1: If you do not get 80 marks, then you will not get an A. • Ans 2: If you get an A, then you will have to get 80 marks.

  32. Conditional Statements • p  q  (p  q)  (q  p) • 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” and “if s then r” • r is a necessary and sufficient condition for s means “r if and only if s”

  33. Order of Operations for Logical Operators

  34. Arguments • An argument is a sequence of statements. All statements except the final one are called premises (or assumptions or hypotheses). The final statement is called the conclusion If Ali is a man, then Ali is mortal. Ali is a man. Ali is mortal. • An argument is considered valid if from the truth of all premises, the conclusion must also be true. • The conclusion is said to be inferred or deduced from the truth of the premises

  35. Arguments • Test to determine the validity of the argument: • Identify the premises and conclusion of the argument • Construct the truth table for all premises and the conclusion • Find critical rows in which all the premises are true • If the conclusion is true in all critical rows then the argument is valid, otherwise it is invalid

  36. Invalid Argument • Example of invalid argument form: • Premises: p  q  ~r and q  p  r, conclusion: p  r This row shows it is possible for this argument to have true premises and false conclusion. Hence this form of argument is invalid

  37. Valid Argument • Example of valid argument form: • Premises: p  (q  r) and ~r, conclusion: p  q

  38. Rules of Inference • An argument consisting of two premises and a conclusion is called a syllogism • A rule of inference is a form of argument that is valid • Modus ponens (method of affirming): Has the form If p then q. p. q

  39. Rules of Inference • Modus tollens (method of denying): Has the form • Use ponens or tollens to make arguments valid: • If 5 is divisible by 6, the it is divisible by 3. 5 is not divisible by 3. _________________________________ • If this is a while loop, then the body of the loop may never be executed. ______________________ The body of the loop may never be executed • If p then q. • q. •   p

  40. Complex Deduction (1) • Premises: • Rita is baking a cake. • If Rita is baking a cake, then she is not practicing her flute. • If Rita is not practicing her flute, then her father will not buy her a car. • Therefore Rita’s father will not buy her a car. • Consider and validate

  41. Answer • Let p = Rita is baking a cake q = She is practicing her flute r = Her father will not buy her a car • Translate question into premises: (a) p (b) p  q (c) q  r • The following deductions can be made: • p by (a) p  q by (d)   q by modus ponens  q by the conclusion of q  r by (c)  r by modus ponens

  42. Complex Deduction (2) • Premises: • If my glasses are on the kitchen table, then I saw them at breakfast • I was reading the newspaper in the living room or I was reading the newspaper in the kitchen • If I was reading the newspaper in the living room, then my glasses are on the coffee table • I did not see my glasses at breakfast • If I was reading my book in bed, then my glasses are on the bed table • If I was reading the newspaper in the kitchen, then my glasses are on the kitchen table • Where are the glasses?

  43. Answer • Let p = My glasses are on the kitchen table q = I saw them at breakfast r = I was reading the newspaper in the living room s = I was reading the newspaper in the kitchen t = My glasses are on the coffee table u = I was reading my book in bed v = My glasses are on the bed table • Translate question into premises: (a) p  q (b) r  s (c) r  t (d) q (e) u  v (f) s  p

  44. Answer r  t by (c) r by the conclusion of 3  t by modus ponens Hence t is true and the glasses are on the coffee table. • The following deductions can be made: • p  q by (a) q by (d)   p by modus tollens • s  p by (f) p by the conclusion of 1   s by modus tollens • r  s by (b) s by the conclusion of 2  r by elimination

  45. Fallacies • A fallacy is an error in reasoning that results in an invalid argument • Three common fallacies: • Vague or ambiguous premises • Begging the question (assuming what is to be proved) • Jumping to conclusions without adequate grounds • Converse Error: • Premises: p  q and q, conclusion: p • Inverse Error: • Premises: p  q and ~p, conclusion: ~q

More Related