Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discrete Structures Chapter 1 Part A Fundamentals of Logic Nurul Amelina Nasharuddin Multimedia Department 1.

Similar presentations


Presentation on theme: "Discrete Structures Chapter 1 Part A Fundamentals of Logic Nurul Amelina Nasharuddin Multimedia Department 1."— Presentation transcript:

1 Discrete Structures Chapter 1 Part A Fundamentals of Logic Nurul Amelina Nasharuddin Multimedia Department 1

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

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 3

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. 4

5 Logical Form Argument 2: “If x 2, then x 2 > 4.” p = x 2, r = x 2 > 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.” 5

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. 6

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 7

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  8

9 Logical Form Translation of English to symbolic logic statements: 1.The sky is blue. One simple (primitive) statement – assign to a letter i.e. p 2.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 3.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 9

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 pq p  qp  q  p FFFFT FTFTT TFFTF TTTTF 10

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.” pq p  q FFF FTT TFT TTF 11

12 Logical Form Construct a truth table for the statement form (p  q)   r pqr p  q  r(p  q)   r FFFFTT FFTFFF FTFFTT FTTFFF TFFFTT TFTFFF TTFTTT TTTTFT n = number of statements How to calculate number of rows? Answer = 2 n 12

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 13

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 14

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 p  pp   pp   p FTTF TFTF 15

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 16

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  cNegation law  pIdentity law 17

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

19 Answers (p  (~p  q))  ~(q  ~r) pqr  p  p  qp  (  p  q)  r  (q   r) (p  (~p  q))  ~(q  ~r) FFFTTTTTT FFTTTTFTT FTFTTTTFF FTTTTTFTT TFFFFTTTT TFTFFTFTT TTFFTTTFF TTTFTTFTT 19

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  tNegation law   pIdentity law 20

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? 21

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 22

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 23 pq p  q FFT FTT TFF TTT

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 24

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 25

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. 26 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 27

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 28

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 29

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 30 pq p  q FFT FTF TFF TTT

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. 31

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” 32

33 Order of Operations for Logical Operators 1.  Evaluate negation first 2. ,  Evaluate  and  second. When both are present, parentheses may be needed 3. ,  Evaluate  and  third. When both are present, parentheses may be needed 33

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 36 p  q   rq  p  rp  r TTT TFF FTT TTF TFT TFT TTT TTT 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 37 p  (q  r) rrp  r TFT TTT TFT TTT TFT TTT TFF FTF

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 p  q pq TTT FTF TFT TFF 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 RulesRelated logical implicationName of rule p  q p  q [(p  q)  p]  q Modus Ponens (Rule of Detachment) p  q  q   p [(p  q)   q]   p Modus Tollens p  p  q q  p  q p  p  q q  p  q Generalization (Disjunctive Amplification) p  q  p p  q  q p  q  p p  q  q Specialization (Conjunctive Simplification) p q  p  q Conjunction p  q  q  p p  q  p  q [(p  q)   q]  p [(p  q)   p]  q Elimination (Disjunctive Syllogism) p  q q  r  p  r [(p  q)  (q  r)]  (p  r) Transitivity (Law of the Syllogism) p  q p  r q  r  r [(p  q)  (p  r)  (q  r)]  r Proof by Division into Cases  p  c  p (  p  c)  p Contradiction Rule

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

42 Answer Letp = 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: 1.p by (a) p   q by (d)   q by modus ponens 42 2.  q by the conclusion of  q   r by (c)   r by modus ponens

43 Complex Deduction (2) Premises: a)If my glasses are on the kitchen table, then I saw them at breakfast b)I was reading the newspaper in the living room or I was reading the newspaper in the kitchen c)If I was reading the newspaper in the living room, then my glasses are on the coffee table d)I did not see my glasses at breakfast e)If I was reading my book in bed, then my glasses are on the bed table f)If I was reading the newspaper in the kitchen, then my glasses are on the kitchen table Where are the glasses?

44 Answer Letp = 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

45 Answer 1.p  q by (a)  q by (d)   p by modus tollens 2.s  p by (f)  p by the conclusion of 1   s by modus tollens 3.r  s by (b)  s by the conclusion of 2  r by elimination 45 4.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:

46 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


Download ppt "Discrete Structures Chapter 1 Part A Fundamentals of Logic Nurul Amelina Nasharuddin Multimedia Department 1."

Similar presentations


Ads by Google