discrete structures chapter 1 part a fundamentals of logic
DESCRIPTION
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. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/1.jpg)
Discrete StructuresChapter 1 Part A
Fundamentals of Logic
Nurul Amelina NasharuddinMultimedia Department
1
![Page 2: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/2.jpg)
Logic of Statements
• Logical Form and Logical Equivalence• Conditional Statements• Valid and Invalid Arguments• Logic of Quantified Statements• Application: Digital Logic Circuits
2
![Page 3: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/3.jpg)
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
![Page 4: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/4.jpg)
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 majorq = Jane will take SSK3003The common logical form: If p, then q.
4
![Page 5: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/5.jpg)
Logical Form• Argument 2:
“If x < -2 or x > 2, then x2 > 4.”p = x < -2, q = x > 2, r = x2 > 4The 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
![Page 6: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/6.jpg)
Logical Form
p = The program syntax faulty,q = The computer will generate an error messager = 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
![Page 7: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/7.jpg)
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
![Page 8: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/8.jpg)
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
![Page 9: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/9.jpg)
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
![Page 10: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/10.jpg)
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
p q p q p q p
F F F F T
F T F T T
T F F T F
T T T T F10
![Page 11: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/11.jpg)
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.”
p q p q
F F F
F T T
T F T
T T F 11
![Page 12: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/12.jpg)
Logical Form
• Construct a truth table for the statement form (p q) r
p q r p q r (p q) r
F F F F T T
F F T F F F
F T F F T T
F T T F F F
T F F F T T
T F T F F F
T T F T T T
T T T T F T
n = number of statements
How to calculate number of rows?Answer = 2n
12
![Page 13: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/13.jpg)
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
![Page 14: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/14.jpg)
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
![Page 15: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/15.jpg)
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 p p p p p
F T T F
T F T F
15
![Page 16: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/16.jpg)
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
![Page 17: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/17.jpg)
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
17
![Page 18: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/18.jpg)
Exercises
• Write truth table for: (p (~p q)) ~(q ~r)• Simplify: ~(~p q) (p q)• Simplify: ~(p ~q) (~p ~ q) ~p
18
![Page 19: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/19.jpg)
Answers
• (p (~p q)) ~(q ~r)
p q r p p q p ( p q) r (q r)
(p (~p q)) ~(q ~r)
F F F T T T T T T
F F T T T T F T T
F T F T T T T F F
F T T T T T F T T
T F F F F T T T T
T F T F F T F T T
T T F F T T T F F
T T T F T T F T T19
![Page 20: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/20.jpg)
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
20
![Page 21: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/21.jpg)
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
![Page 22: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/22.jpg)
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
![Page 23: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/23.jpg)
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
p q p q
F F T
F T T
T F F
T T T
![Page 24: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/24.jpg)
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
![Page 25: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/25.jpg)
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 isIf you do not get in class on time, then you risk
missing some material
• Negation of : ~(p q) p ~q
25
![Page 26: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/26.jpg)
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
![Page 27: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/27.jpg)
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
Monday27
![Page 28: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/28.jpg)
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
![Page 29: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/29.jpg)
Answers
• If P is a square, then P is a rectangleContrapositive: If P is not a rectangle, then P is not a squareConverse: If P is a rectangle, then P is a squareInverse: If P is not a square, then P is not a rectangle
29
![Page 30: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/30.jpg)
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
p q p q
F F T
F T F
T F F
T T T
![Page 31: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/31.jpg)
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
![Page 32: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/32.jpg)
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
![Page 33: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/33.jpg)
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
![Page 34: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/34.jpg)
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 conclusionIf 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
![Page 35: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/35.jpg)
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
![Page 36: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/36.jpg)
Invalid Argument
• Example of invalid argument form:– Premises: p q ~r and q p r, conclusion: p r
36
p q r q p r p rT T T
T F F
F T T
T T F
T F T
T F T
T T T
T T T
This row shows it is possible for this argument to have true premises and false conclusion. Hence this form of argument is invalid
![Page 37: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/37.jpg)
Valid Argument
• Example of valid argument form:– Premises: p (q r) and ~r, conclusion: p q
37
p (q r) r p rT F T
T T T
T F T
T T T
T F T
T T T
T F F
F T F
![Page 38: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/38.jpg)
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 p qT T T
F T F
T F T
T F F
If p then q.p.q
![Page 39: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/39.jpg)
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
![Page 40: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/40.jpg)
Rules Related logical implication Name of rule
p qpq
[(p q) p] q Modus Ponens (Rule of Detachment)
p qq p
[(p q) q] p Modus Tollens
p p q
q p q
p p qq p q
Generalization (Disjunctive Amplification)
p q p
p qq
p q p p q q
Specialization(Conjunctive Simplification)
pq p q
Conjunction
p qq p
p qp q
[(p q) q] p
[(p q) p] q
Elimination (Disjunctive Syllogism)
p qq r p r
[(p q) (q r)] (p r) Transitivity (Law of the Syllogism)
p qp rq r r
[(p q) (p r) (q r)] r Proof by Division into Cases
p c p
(p c) p Contradiction Rule
![Page 41: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/41.jpg)
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
![Page 42: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/42.jpg)
Answer
42
2. q by the conclusion of
q r by (c)
r by modus ponens
![Page 43: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/43.jpg)
Complex Deduction (2)
• Premises:a) If my glasses are on the kitchen table, then I saw them at breakfastb) I was reading the newspaper in the living room or I was reading
the newspaper in the kitchenc) If I was reading the newspaper in the living room, then my glasses
are on the coffee tabled) I did not see my glasses at breakfaste) If I was reading my book in bed, then my glasses are on the bed
tablef) If I was reading the newspaper in the kitchen, then my glasses are
on the kitchen table
• Where are the glasses?
![Page 44: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/44.jpg)
Answer• Let p = My glasses are on the kitchen table
q = I saw them at breakfastr = I was reading the newspaper in the living rooms = I was reading the newspaper in the kitchent = My glasses are on the coffee tableu = I was reading my book in bedv = 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
![Page 45: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/45.jpg)
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:
![Page 46: Discrete Structures Chapter 1 Part A Fundamentals of Logic](https://reader036.vdocument.in/reader036/viewer/2022081514/56815d34550346895dcb304c/html5/thumbnails/46.jpg)
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