logic gates
TRANSCRIPT
![Page 1: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/1.jpg)
LOGICLOGIC
![Page 2: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/2.jpg)
Introduction to logic
What is logic? Why is it useful? Types of logic
Propositional logic Predicate logic
![Page 3: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/3.jpg)
Introduction to logic
What is logic? Why is it useful? Types of logic
Propositional logic Predicate logic
![Page 4: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/4.jpg)
What is logic?
“Logic is the beginning of
wisdom, not the end”
![Page 5: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/5.jpg)
What is logic? Logic : The branch of philosophy
concerned with analysing the patterns of reasoning by which a conclusion is drawn from a set of premises, without reference to meaning or context
![Page 6: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/6.jpg)
Why study logic?
Logic is concerned with two key skills, which any computer engineer or scientist should have: Abstraction Formalisation
![Page 7: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/7.jpg)
Why is logic important? Logic is a formalisation of reasoning.
Logic is a formal language for
deducing knowledge from a small number of explicitly stated premises (or hypotheses, axioms, facts)
Logic provides a formal framework for representing knowledge
Logic differentiates between the structure and content of an argument
![Page 8: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/8.jpg)
Def: A proposition is a statement that is either true or false. or A proposition is a declarative sentence that is either true or false,but not both.e.g. “It is raining in Delhi.”e.g. “The square of 5 is 16”.
Some propositions may not be easily verified:e.g. “The universe is infinite.”
What is proposition?
![Page 9: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/9.jpg)
The Negation Operator
The negation operator “¬” (NOT) transforms a prop. into its logical negation.
E.g. If p = “I have brown hair.”
then ¬p = “I do not have brown hair.”
The truth table for NOT:p p T F F T
T :≡ True; F :≡ False“:≡” means “is defined as”
Operandcolumn
Resultcolumn
Topic #1.0 – Propositional Logic: Operators
![Page 10: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/10.jpg)
Logic• Notation for propositions: Truth Values
– If it’s true, denoted by T; – If it’s false, denoted by F– Used in truth tables:
P P
T
F
F
T
![Page 11: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/11.jpg)
Compound Propositions Composite
Composed of subpropositions & various connectives
Primitive or not composite
E.g. This book is good and cheap
![Page 12: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/12.jpg)
Propositional Variable
Symbol representing any proposition
real variable (x)
not propositon but can be replaced by a proposition
![Page 13: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/13.jpg)
Basic Logical Operators
1. Conjunction , pq (and)
2. Disjunction, pq (or)
3. Negation p(not)
![Page 14: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/14.jpg)
The Conjunction Operator
The binary conjunction operator “” (AND) combines two propositions to form their logical conjunction.
E.g. If p=“I will have salad for lunch.” and q=“I will have soup for dinner.”, then pq=“I will have salad for lunch and I will have soup for dinner.”
Topic #1.0 – Propositional Logic: Operators
![Page 15: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/15.jpg)
Logic• More with Truth Tables: conjunction
• If you have propositions p and q, the proposition “p and q” is true when they’re both true, and false otherwise:
P Q P ^ Q
T T
T F
F T
F F
T
F
F
F
![Page 16: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/16.jpg)
The Disjunction Operator
The binary disjunction operator “” (OR) combines two propositions to form their logical disjunction.
p=“My car has a bad engine.”
q=“My car has a bad carburetor.”
pq=“Either my car has a bad engine, or my car has a bad carburetor.”
After the downward-pointing “axe” of “””splits the wood, yousplits the wood, youcan take 1 piece OR the can take 1 piece OR the other, or both.other, or both.
Topic #1.0 – Propositional Logic: Operators
![Page 17: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/17.jpg)
Logic• More with Truth Tables: disjunction
• If you have propositions p and q, the proposition “p or q” is false when they’re both false, and true otherwise:
P Q P v Q
T T
T F
F T
F F
T
T
T
F
![Page 18: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/18.jpg)
Propositional calculus.
• truth tables for logical connectives
P ~P P Q P Q P Q
T F T T T TF T T F F T
F T F T
F F F F
![Page 19: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/19.jpg)
ExampleIf p represents “ This book is good” and q represents This book is cheap”, write the following sentences in symbolic form:
(a) This book is good and cheap.(b) This book is costly but good(c) This book is neither good nor cheap(d) This book is not good but cheap(e) This book is good or cheap
(a) pq (b)(q) p (c)(p) (q)
(d)( p)q (e)pq
![Page 20: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/20.jpg)
The Implication (conditional) Operator
The implication p q states that p implies q.
I.e., If p is true, then q is true; but if p is not true, then q could be either true or false.
E.g., let p = “You study hard.” q = “You will get a good grade.”
p q = “If you study hard, then you will get a good grade.”
Topic #1.0 – Propositional Logic: Operators
![Page 21: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/21.jpg)
Logic• More with Truth Tables: implication p q• If you have propositions p and q, the
implication p q of p and q is false when p is true and q is false and is true otherwise:
p q p q
T T
T F
F T
F F
T
F
T
T
![Page 22: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/22.jpg)
Logic
• More with Truth Tables: implication p q• Other ways to refer to this implication:
– q if p if p, q q whenever p– p only if q q is necessary for p– If p, then q p is sufficient for q p implies q
p q p q
T T
T F
F T
F F
T
F
T
T
![Page 23: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/23.jpg)
Logic• More with Truth Tables: implication p q• In other words, p is the hypothesis (or
antecedent or premise); and q is the conclusion (or consequence)
p q p q
T T
T F
F T
F F
T
F
T
T
![Page 24: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/24.jpg)
The biconditional operator
The biconditional p q states that p is true if and only if (IFF) q is true.
p = “Bush wins the 2005 election.”
q = “Bush will be president for all of 2006.”
p q = “If, and only if, Bush wins the 2005 election, Bush will be president for all of 2006.”
Topic #1.0 – Propositional Logic: Operators
2005 I’m stillhere!
2006
![Page 25: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/25.jpg)
• More with Tables: biconditional p q
• True when p and q have the same truth values and is false otherwise
• Other ways to express it: p IFF q; p is necessary and sufficient for q; if p then q, and vice versa
p q p q
T T
T F
F T
F F
T
F
F
T
![Page 26: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/26.jpg)
Let P(p,q,........) denote an expression constructed fromlogical variables p,q,......., which take on the value True(T) or False(F), and the logical connectives , , and E.g. P(p,q) = (p q)
p q q p q (p q)
T
T
T
T
T
T
T
T
T
T
F
F
F
F
F
F
F
F
F
F
Proposition
![Page 27: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/27.jpg)
Well-Formed Formulas(wff)
(i) If P is a propositional variable then it is wff.
(ii) If x is wff , then ~ x is a wff.(iii) If x and y are wff , then (xy), (xy), (xy),(xy)are wffs.(iv) A string of symbols is a wff iff it is obtained by finitely many applications of (i)-(iii)
A wff is not a proposition , but if we substitute the proposition in place of propositional variable , we geta proposition.
![Page 28: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/28.jpg)
p q
TTFF
TFTF
(p q)
step
TTFF
1
TFTF
12
FTFT
3
FTFF
4
TFTT
Another method of constructing a truth table
![Page 29: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/29.jpg)
Propositional calculus cont.
• Truth tables for common sentences• (PQ)=(~Q~P) /contrapositive equivalence
P Q ~Q ~P P Q ~Q ~P
T T F F T T
T F T F F F
F T F T T T
F F T T T T
![Page 30: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/30.jpg)
Propositional calculus cont.
• Truth tables for common sentences• (~PQ)=(PQ) and (P Q)=(~P Q)
/disjunctive equivalence
P Q ~P ~P Q P Q P Q ~P Q
T T F T T T T
T F F T T F F
F T T T T T T
F F T F F T T
![Page 31: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/31.jpg)
Construct truth table for pq and (pq)
![Page 32: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/32.jpg)
Propositional Equivalences In mathematical arguments, you can replace a statement or proposition with another statement or proposition with the same truth valueTautology: A compound proposition (combination of propositions using logical operators) that is always True, no matter what the truth values of the propositions that are in itContradiction: a compound proposition that is always falseContingency: proposition that is neither a tautology or a contradiction
Logic - Equivalences
![Page 33: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/33.jpg)
Logic - Equivalences• Propositional Equivalences
p p p v p p ^ p
T F T F
F T T F
Contingency tautology contradiction
![Page 34: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/34.jpg)
Let P(p,q,.......) be a tautology , and let P1(p,q,......),P2(p,q,......),...... be any propositions.
Since P(p,q,........) does not depend upon the particular truth values of its variables p,q,..., we can substitute P1 for p , P2 for q, in the tautology P(p,q,.....) and still have tautology.
Theorem- If P(p,q,....) is a tautology, then P(P1,P2,.....) is a tautology for any propositions P1,P2,..........
Principle of Substitution
![Page 35: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/35.jpg)
Logical Equivalence
P(p,q,.....) Q(p,q,........) (if identical truth tables)
e.g. p p, p p p
Show that (pq) (p q) p
![Page 36: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/36.jpg)
Show ¬( p V q ) and ¬ p ¬ q are logically equivalentusing truth tables.
PROPOSITIONAL EQUIVALENCES
Logically equivalent using truth tables
F
p q p V q ¬ p ¬ q
T T
F T
T T
T
T T
T
T
T T
T F
F F F
F
F F
F
F
F
F
F
F
¬(p V q) (¬p ¬ q)
![Page 37: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/37.jpg)
Logic - Equivalences• Logical Equivalences: compound propositions
that have the same truth value in all possible cases words, denotes logical equivalence between p and q, for example.
p q p v q (p v q) p q p ^ q
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
These are logically equivalent
Truth Table for (p v q) and p ^ q
![Page 38: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/38.jpg)
Logic - Equivalences(Laws of Algebra)
Logical Equivalences: (T denotes any proposition that is always true, F denotes one that is always false)
p ^ T p identity laws
p v F p
p v T T domination laws
p ^ F F
p v p p idempotent laws
p ^ p p
( p) p double negation laws
p v q q v p commutative laws
p ^ q q ^ p
![Page 39: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/39.jpg)
Logic - Equivalences(Laws of Algebra)
• Logical Equivalences: (T denotes any proposition that is always true, F denotes one that is always false)
(p v q) v r p v (q v r) Associative laws
(p ^ q) ^ r p ^ (q ^ r)
(p v (q ^ r) (p v q) ^ (p v r) Distributive laws
p ^ (q v r) (p ^ q) v (p ^ r)
(p ^ q) p v q DeMorgan’s Laws
(p v q) p ^ q
These laws can be used to prove whether different compound propositions are logically equivalent
![Page 40: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/40.jpg)
Useful Law # 1 p V ¬ p T
Useful Law # 2 p ¬ p F
Useful Law # 3 p q ¬ p V q
![Page 41: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/41.jpg)
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,
This is easy to prove using the truth table. But now we want to prove it using the logical equivalences.
![Page 42: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/42.jpg)
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,
Some guidance in proving using logical equivalences. 1. Do implication first
Note: How many laws have to do with implies???
When trying to decide which laws to use in a proof, first ask yourself, are there any implications to prove. If there are then use the third useful law
![Page 43: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/43.jpg)
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,
2. Do DeMorgan’s second
Next ask yourself, are there any negations with and/or operators? If there are, then use DeMorgan’s Law.
![Page 44: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/44.jpg)
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,
3. Use Distributative Law
Next ask yourself, are there both and & or operators? If there are, then use the Distributive Law.
![Page 45: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/45.jpg)
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,
4. Use Double Negation Anytime
5. Use Other Laws as they Apply
![Page 46: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/46.jpg)
Prove ¬ (p V (¬p q)) ¬ p ¬q,
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,
We are trying to make both sides equivalent.
Begin with the left hand side. Try to make it expressed as the right hand side
by using your laws.
![Page 47: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/47.jpg)
Prove ¬ (p V (¬p q)) ¬ p ¬q,
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,
Do we have any implications?no
Can we use DeMorgan’s law?Yes
¬ (p V (¬p q))
![Page 48: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/48.jpg)
Prove ¬ (p V (¬p q)) ¬ p ¬q,
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,
How do we use DeMorgan’s law?
¬ (p V (¬p q)) ¬ p ¬ (¬p q)
DeMorgan’s Law ( p V q) ¬ p ¬ q
![Page 49: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/49.jpg)
Prove ¬ (p V (¬p q)) ¬ p ¬q,
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,
Now we have
¬ (p V (¬p q)) ¬ p ¬ (¬p q)) DeMorgan’s Law
Do we have any implications?no
Can we use DeMorgan’s law?yes
¬ (¬p q)
![Page 50: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/50.jpg)
How do we use DeMorgan’s law?
¬ (¬p q) ¬ (¬ p) V ¬ q
DeMorgan’s Law ¬( p V q) ¬ p ¬ q
Prove ¬ (p V (¬p q)) ¬ p ¬q,
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,
![Page 51: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/51.jpg)
Prove ¬ (p V (¬p q)) ¬ p ¬q,
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,
Now we have
¬ (p V (¬p q)) ¬ p ¬ (¬p q)) DeMorgan’s Law ¬ p [¬ (¬p) V ¬q)] ) DeMorgan’s Law
Now we can use the double negation.
¬ p [¬ (¬p) V ¬q)] ¬ p ( p V ¬q)
![Page 52: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/52.jpg)
PROPOSITIONAL EQUIVALENCES
Now we have
¬ (p V (¬p q)) ¬ p ¬ (¬p q)) DeMorgan’s Law
¬ p [¬ (¬p) V ¬q)] ) DeMorgan’s Law
¬ p (p V ¬q) Double negation
Do we have any implications? no Can we use DeMorgan’s law? no Can we use the distributive law? Yes
¬ p (p V ¬q)
![Page 53: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/53.jpg)
How do we use the distributive law?
¬ p (p V ¬q) (¬p p) V (¬p ¬q )
Distributive Law p (q V r) (p q) V (p r)
PROPOSITIONAL EQUIVALENCES
![Page 54: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/54.jpg)
PROPOSITIONAL EQUIVALENCES
Now we have
¬ (p V (¬p q)) ¬ p ¬ (¬p q)) DeMorgan’s Law
¬ p [¬ (¬p) V ¬q)] ) DeMorgan’s Law
¬ p (p V ¬q) Double negation
(¬ p p) V (¬ p ¬q) Distributative Law
Do we have any implications? no Can weuse DeMorgan’s law? no Can we use the distributive law? no Can we use any of the useful laws? Yes
Useful Law # 2 p ¬ p F
![Page 55: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/55.jpg)
How do we use Useful Law #2?
(¬ p p) V (¬ p ¬q)
F V (¬ p ¬q)
PROPOSITIONAL EQUIVALENCES
Useful Law #2 p ¬ p F
![Page 56: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/56.jpg)
PROPOSITIONAL EQUIVALENCESNow we have
¬ (p V (¬p q)) ¬ p ¬ (¬p q)) DeMorgan’s Law ¬ p [¬ (¬p) V ¬q)] ) DeMorgan’s Law
¬ p (p V ¬q) Double negation
(¬ p p) V (¬ p ¬q) Distributative Law
(F) V (¬ p ¬q)
Do we have any implications? no Can we use DeMorgan’s law? no Can we use the distributive law? no Can we use any of the useful laws? No
Now weneed to look at the result and determinehow we might get to that answer.
![Page 57: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/57.jpg)
PROPOSITIONAL EQUIVALENCESNow we have
¬ (p V (¬p q)) ¬ p ¬ (¬p q)) DeMorgan’s Law ¬ p [¬ (¬p) V ¬q)] ) DeMorgan’s Law
¬ p (p V ¬q) Double negation
(¬ p p) V (¬ p ¬q) Distributative Law
(F) V (¬ p ¬q)
What do we have? (F) V (¬ p ¬q)
What are we trying to get? ¬ p ¬q
What do we need to get this result?
We need the identity law. How can we get there?
![Page 58: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/58.jpg)
How do we get to the identity law?
F V (¬ p ¬q) (¬ p ¬q) V F
Now apply the identity law?
(¬ p ¬q) V F (¬ p ¬q)
PROPOSITIONAL EQUIVALENCES
Commutative Laws p V q q V p
Identity Law p V F p
![Page 59: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/59.jpg)
PROPOSITIONAL EQUIVALENCES
Prove ¬ (p V (¬p q)) ¬ p ¬q,Prove ¬ (p V (¬p q)) ¬ p ¬q,
¬ (p V (¬p q)) ¬ p ¬ (¬p q)) DeMorgan’s Law
¬ p [¬ (¬p) V ¬q)] ) DeMorgan’s Law
¬ p (p V ¬q) Double negation
(¬ p p) V (¬ p ¬q) Distributive Law
(F) V (¬ p ¬q)
(¬ p ¬q) V (F) Commutative Law
¬ p ¬q Identity Law
![Page 60: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/60.jpg)
PROPOSITIONAL EQUIVALENCES
Prove (p q) ( p V q) is a Tautology.
How do we express this?
Prove (p q) ( p V q) T
![Page 61: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/61.jpg)
PROPOSITIONAL EQUIVALENCES
(p q) ( p V q) T
Prove (p q) ( p V q) T
Do we have any implications? Yes
(p q) ( p V q) T
![Page 62: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/62.jpg)
How do you use Useful Law #3?
(p q) ( p V q) ¬ ( p q) V ( p V q)
PROPOSITIONAL EQUIVALENCES
Useful Law #3 ( p q ) ¬ p V q
![Page 63: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/63.jpg)
PROPOSITIONAL EQUIVALENCES
Prove (p q) ( p V q) is a Tautology.
Now we have
(pq)(pVq)
¬( p q) V ( p V q)
Do we have any implications? no Can we use DeMorgan’s law? Yes
![Page 64: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/64.jpg)
How do we use DeMorgan’s law?
¬( p q) V ( p V q) ( ¬ p V ¬ q) V ( p V q)
DeMorgan’s Law ¬ ( p q) ¬ p V ¬q
PROPOSITIONAL EQUIVALENCES
![Page 65: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/65.jpg)
PROPOSITIONAL EQUIVALENCES
Now we have
(p q) ( p V q) T
¬( p q) V ( p V q)
( ¬ p V ¬ q) V ( p V q) DeMorgan’s Law
Do we have any implications? no Can we use DeMorgan’s law? no Can we use the distributive law? no Can we use any of the useful laws? No
![Page 66: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/66.jpg)
PROPOSITIONAL EQUIVALENCES
What do we have? ( ¬ p V ¬ q) V ( p V q)
What are we trying to get? T
What do weneed to get this result?
We need UL #1 or Identity law or Domination Law.
Now we have
(p q) ( p V q) T
¬( p q) V ( p V q)
( ¬ p V ¬ q) V ( p V q) DeMorgan’s Law
![Page 67: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/67.jpg)
Since we have all V (ors), we will try UL#1.How can we get there?
Use the Associative Law
( ¬ p V ¬ q) V ( p V q) ¬ p V (¬ q V p) V q
PROPOSITIONAL EQUIVALENCES
Associative Laws (p V q) V r p V (q V r)
![Page 68: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/68.jpg)
Then Use the Commulative Law
¬ p V (¬ q V p) V q ¬ p V (p V ¬ q) V q
PROPOSITIONAL EQUIVALENCES
Commulative Laws p V q q V p
![Page 69: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/69.jpg)
Then Again use the Associative Law
¬ p V (p V ¬ q) V q (¬ p V p) V (¬ q V q)
PROPOSITIONAL EQUIVALENCES
Associative Laws (p V q) V r p V (q V r)
![Page 70: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/70.jpg)
Then we can use Useful Law #1.
(¬ p V p) V (¬ q V q) T V T
PROPOSITIONAL EQUIVALENCES
Useful Law#1 p V ¬ p T
![Page 71: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/71.jpg)
And finally the Domination Law.
T V T T
PROPOSITIONAL EQUIVALENCES
Domination Laws p V T T
![Page 72: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/72.jpg)
PROPOSITIONAL EQUIVALENCES
Prove (p q) ( p V q) is a Tautology.
(p q) ( p V q) T
¬( p q) V ( p V q)
( ¬ p V ¬ q) V ( p V q) DeMorgan’s Law
( ¬ p V p) V (¬ q V q) Associative Law
( ¬ p V p) V (¬ q V q) Commulative Law
( T ) V ( T ) Useful Law # 1
T V T Domination Law
![Page 73: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/73.jpg)
Prove
¬(p q) (p ¬q)
Show that ((pq) ¬(¬p (¬q ¬r))) (¬p ¬q) (¬p ¬r)is a tautology.
![Page 74: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/74.jpg)
Arguments
In logical reasoning , a certain number of propositionsare assumed to be true and based on the assumption someother proposition is derived(deduced or inferred)
premises
conclusion
valid argument
qDefinition - An argument p1,p2,p3,.......,pn is said to be valid if q is true whenever all premises
p1,p2,......,pn are true.
fallacy
![Page 75: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/75.jpg)
Theorem - The argument p1,p2,p3,.......,pn q
is valid iff the proposition (p1p2 ........... pn) q
is a tautology
![Page 76: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/76.jpg)
Inference Rules - General Form
• An Inference Rule is – A pattern establishing that if we know that a
set of antecedent statements of certain forms are all true, then we can validly deduce that a certain related consequent statement is true.
• antecedent 1 antecedent 2 … consequent “” means “therefore”
![Page 77: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/77.jpg)
Some Inference Rules
• p Rule of Addition pq
• pq Rule of Simplification p
• p Rule of Conjunction q pq
![Page 78: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/78.jpg)
Some Inference Rules
• p
• pq (law of detachment)q
• qpq p
“the mode of affirming”
“the mode of denying”
![Page 79: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/79.jpg)
Syllogism Inference Rules
• pq Rule of hypothetical qr syllogismpr
• p q Rule of disjunctive p syllogism q
![Page 80: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/80.jpg)
Formal Proof Example
• Suppose we have the following premises:“It is not sunny and it is cold.”“We will swim only if it is sunny.”“If we do not swim, then we will play.”“If we play, then we will be home early.”
• Given these premises, prove the theorem“We will be home early” using inference rules.
![Page 81: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/81.jpg)
Proof Example cont.
• Let us adopt the following abbreviations:– p = “It is sunny”; q = “It is cold”;
r = “We will swim”; s = “We will play”;
t = “We will be home early”.
• Then, the premises can be written as:(1) p q (2) r p(3) r s (4) s t
![Page 82: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/82.jpg)
Proof Example cont.
Step Proved by1. p q Premise #1.2. p Simplification of 1.3. rp Premise #2.4. r rules 2,3.5. rs Premise #3.6. s rules 4,5.7. st Premise #4.8. t rules 6,7.
![Page 83: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/83.jpg)
Example
Consider the following argument:S1:If a man is a bachelor, he is unhappyS2:If a man is unhappy, he dies young----------------------------------------------------
S:Bachelors die young
![Page 84: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/84.jpg)
Predicate Calculus
* Ram is a student * Shyam is a student
* x is a student
* ‘ is a student ‘ - Predicate
e.g. “2x + 3y = 4z”
Definition- A part of a declarative sentence describingthe properties of an object or relation among objects iscalled a predicate.
![Page 85: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/85.jpg)
Predicate Calculus
* Let A be a given set . A propositional function(or an open sentence or condition) defined on A is an expression p(x) which has property that p(a) is true or false for each
a A.
*A - domain of p(x)
*T - all elements of A for which p(a) is true is called the truth set of p(x)
*T = {x:x A, p(x) is true}or T = {x:p(x)}
p
p p
![Page 86: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/86.jpg)
Predicate Calculus e.g.- 1. x is the father of y - P(x,y) 2. 2x+3y = 4z - S(x,y,z)
P(x,y) , S(x,y,z) are not propositions but if x=2 , y=0 and z =1 in S(x,y,z) or S(2,0,1) is proposition with truth value T
e.g. Find the truth set of each propositional function p(x)defined on the set N of positive integers.(a) Let p(x) be “x+2>7”(b) Let p(x) be “x+5<3”(c) Let p(x) be “x+5>1”
(a) {x:xN, x+2 >7} = {6,7,8,.......},
(b) {x:xN, x+5<3} = (c) {x:xN, x+5>1} = N
![Page 87: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/87.jpg)
Predicate Calculus
Definition - For a declarative sentence involving a predicate, the universe of discourse , or simply the universe, is the set of all possible values which can be assigned to variables.
e.g. -1. For p(x): “x is a student “ the universe of discourseis the set of all human names.
e.g. - E(n): “n is an even integer”
![Page 88: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/88.jpg)
Logic - Quantifiers• Let’s say you have a predicate like P(x) and
you want to apply a statement for all possible values of x. You can use quantifiers to do this.
• The notation x P(x) shows the universal quantification of P(x), with the upside-down A as the universal quantifier.
– It says, FOR ALL x P(x) or FOR EVERY x P(x)
![Page 89: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/89.jpg)
Logic - Quantifiers• An example: Every student in JUIT has
studied Maths could be expressed as:– x (S(x) P(x))
• Where P(x) denotes that x has studied Maths• And S(x) denotes that x is in JUIT• And the arrow denotes “then”
![Page 90: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/90.jpg)
Logic - Quantifiers– Existential Quantifier of a proposition: there exists
an element x in the universe of discourse such that P(x) is true
– That is, there is AN x, or at least ONE x, such that P(x) is true
– In this case, one would use the backwards E to denote this type quantifier rather than the all inclusive upside down A:• x P(x)• For example, if P(x) was the statement x > 89, and
your data set included test scores of 65, 72, 85, 88, and 95 what would be the existential quantification of P(x)?– TRUE!
![Page 91: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/91.jpg)
Example
“For all x there is a y such that x is greater than y and less than y+1”.
In the universe of rational numbers, with the usual interpretation of “+” and “<“, this sentence is true.
In the universe of integers, this sentence is false.
![Page 92: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/92.jpg)
Further Examples1) Similar quantifiers are order independent
2) Different quantifiers are not
3) If P is true of an object, so is Q
4) This is the negation of the above: for some object, P is true but Q is false.
![Page 93: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/93.jpg)
Relations between negation, universal and existential quantifiers
~X p(X) = X ~p(X)
~ X p(X) = X ~ p(X)
X p(X) = Y p(Y)
X q(X) = Y q(Y)
X (p(X) q(X)) = X p(X) Y q(Y)
X (p(X) q(X)) = X p(X) Y q(Y)
![Page 94: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/94.jpg)
Negation of Quantified Statements“All math majors are male”
“It is not the case that all math majors are male” or “There exists at least one math major who is a female”
M- the set of math majors( x M)(x is a male) (x M)(x is not male)
( x M)p(x) (x M) p(x) or x p(x) x p
![Page 95: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/95.jpg)
De Morgans Law
(xA)p(x) ( xA) p(x)
( xA) p(x) (xA) p(x)
e.g. “For all positive integers n we have n+2 >8”“There exists a positive integer n such that n+2not>8”
![Page 96: Logic gates](https://reader033.vdocument.in/reader033/viewer/2022061116/54660c1db4af9f1c548b47f7/html5/thumbnails/96.jpg)
Negating Quantified Statements with More than One Variable
e.g. [(x y z, p(x,y,z)] x [y z, p(x,y,z)]
x y [ z, p(x,y,z)] x y z, p(x,y,z)]
e.g. L is the limit of a sequence
LannNnfollowsa n,,,0 .....,......... 001
L is not the limit of the sequence LannNnaa n,,,0 when ...,........., 0021