Download presentation
Presentation is loading. Please wait.
1
Module 2: Conditionals and Logical Equivalences
9/10/2018 Module 2: Conditionals and Logical Equivalences 1 1
2
Due dates Pre-class quiz 3 due Sunday January 15 at 7pm.
9/10/2018 Due dates Pre-class quiz 3 due Sunday January 15 at 7pm. Assigned Readings: Epp, 4th edition: 2.5 m uts/signed-binary-decimal-conversions.html Assignment #1 is due Thursday January 19 at 4pm. Hand in a hard copy to box 31 in ICCS X235. 2 2 2
3
Learning goals: pre-class
9/10/2018 Learning goals: pre-class By the start of this class you should be able to Translate back and forth between simple natural language statements and propositional logic, now with conditionals and biconditionals. Evaluate the truth of propositional logical statements that include conditionals and biconditionals using truth tables Given a propositional logic statement and an equivalence rule, apply the rule to create an equivalent statement. 3 3 3
4
Learning goals: in-class
9/10/2018 Learning goals: in-class By the end of this module, you should be able to Explore alternate forms of propositional logic statements by application of equivalence rules, especially in order to simplify complex statements or massage statements into a desired form. Explain why instability is a shortfall of propositional logic as a “model of computation” for combinational circuits. 4 4 4
5
CPSC 121: the BIG questions:
9/10/2018 CPSC 121: the BIG questions: We are not quite ready yet to directly address any of the big questions. Our discussion of propositional logic gets us closer to proving facts about our algorithms. We will look at circuits a bit more, and talk about a multiplexer: a component that is very useful when building computers. Rosen uses \neg instead of \sim. 5 5 5
6
Module 2 outline Meaning of Logical Equivalence Proofs Multiplexers
9/10/2018 Module 2 outline Meaning of Logical Equivalence Proofs Multiplexers More exercises Comparing the meaning of conditional statement in symbolic logic might not be the same as its meaning in everyday English. How to apply logical equivalence laws to convert from one statement to another. Multiplexer, a very useful component in the computer. This shows that propositional logic is not a perfect model of how gates work in reality. 6 6 6
7
Review questions p q p -> q 1
8
Alice pays your tuition
9/10/2018 Meaning of P: If Alice is rich, Alice will pay your tuition for you. If the proposition P is true and Alice is rich, will Alice pay your tuition? Yes No Maybe Alice is rich Alice pays your tuition P 1 8 8 8
9
Alice pays your tuition
9/10/2018 Meaning of P: If Alice is rich, Alice will pay your tuition for you. If the proposition P is true and Alice pays your tuition, is Alice rich? Yes No Maybe Alice is rich Alice pays your tuition P 1 9 9 9
10
Alice pays your tuition
9/10/2018 Meaning of P: If Alice is rich, Alice will pay your tuition for you. If Alice is not rich, is the proposition P true? Yes No Maybe Alice is rich Alice pays your tuition P 1 10 10 10
11
Let’s continue with the 7-segment display problem.
12
Quiz 2B: 7-segment display
9/10/2018 Quiz 2B: 7-segment display Two students produced 2 different circuits for the same light. Can they both be correct? Yes. Can they be logically equivalent? Yes. Must they be logically equivalent? No. Give an example when 2 circuits are different, both correct, and logically equivalent. Give an example when 2 circuits are different, correct, and not logically equivalent. 12 12 12
13
Module 2 outline Meaning of Logical Equivalence Proofs Multiplexers
9/10/2018 Module 2 outline Meaning of Logical Equivalence Proofs Multiplexers More exercises Comparing the meaning of conditional statement in symbolic logic might not be the same as its meaning in everyday English. How to apply logical equivalence laws to convert from one statement to another. Multiplexer, a very useful component in the computer. This shows that propositional logic is not a perfect model of how gates work in reality. 13 13 13
14
9/10/2018 Review questions What does it mean for a proposition to be a tautology or a contradiction? How do you prove that two propositions are logically equivalent? How do you prove that two propositions are NOT logically equivalent? 14 14 14
15
Writing a logical equivalence proof
Theorem: (~a b) a a b Proof: (~a b) a (~a a) (b a) by distributive law T (b a) b a a b QED
16
Writing a logical equivalence proof
9/10/2018 Writing a logical equivalence proof Example: (~a ∧ b) ∨ a ≡ a ∨ b Example: (~p v q) ^ ~ (~q v p) ≡ ~p ^ q Trick: simplifying a complicated proposition is easier than making a simple one more complicated. (~p V q) ^ (~~q ^ ~p) De Morgan’s law = (~p V q) ^ (q ^ ~p) Double negative law = ((~p V q) ^ q) ^ ~p Associative law = q ^ ~p Absorption law = ~p ^ q 17 17 17
17
Logical equivalence laws
9/10/2018 Logical equivalence laws Name Rule Identity laws p ^ T ≡ p p v F ≡ p Universal bounds laws p ^ F ≡ F p v T ≡ T Idempotent laws p ^ p ≡ p p v p ≡ p Commutative laws p ^ q ≡ q ^ p p v q ≡ q v p Associative laws p ^ (q ^ r) ≡ (p ^ q) ^ r p v (q v r) ≡ (p v q) v r Distributive laws p v (q ^ r) ≡ (p v q) ^ (p v r) p ^ (q v r) ≡ (p ^ q) v (p ^ r) Absorption laws p v (p ^ q) ≡ p p ^ (p v q) ≡ p Negation laws p ^ ~p ≡ F p v ~p ≡ T Double negative law ~(~p) ≡ p DeMorgan's laws ~(p ^ q) ≡ (~p) v (~q) ~(p v q) ≡ (~p) ^ (~q) Definition of ⊕ p ⊕ q ≡ (p v q) ^ ~(p ^ q) Definition of → p → q ≡ ~p v q Contrapositive law p → q ≡ (~q) → (~p) Example: (~a ∧ b) ∨ a ≡ a ∨ b Example: (~p v q) ^ ~ (~q v p) ≡ ~p ^ q Trick: simplifying a complicated proposition is easier than making a simple one more complicated. 18 18 18
18
Useful strategies Work from the more complex side first.
Switch to different strategies/sides when you get stuck. No need to memorize logical equivalence laws, but know when to apply them. Try getting rid of : p q ~p q Try getting rid of : p q ~(p q) Try getting rid of : p q p q q p Try moving negations inward: ~(p q) ~p ~q In the end, write the proof in clean “one-side-to-the- other” form and double-check steps.
19
Module 2 outline Meaning of Logical Equivalence Proofs Multiplexers
9/10/2018 Module 2 outline Meaning of Logical Equivalence Proofs Multiplexers More exercises Comparing the meaning of conditional statement in symbolic logic might not be the same as its meaning in everyday English. How to apply logical equivalence laws to convert from one statement to another. Multiplexer, a very useful component in the computer. This shows that propositional logic is not a perfect model of how gates work in reality. 20 20 20
20
9/10/2018 A flaw in our model Propositional Logic is not a perfect model of how gates work. A multiplexer: A circuit that chooses between two or more values. In its simplest form, it takes 3 inputs, a, b, and a control input select. It outputs the value of a if select is F, and the value of b if select is T. 21 21 21
21
9/10/2018 A simple multiplexer a b select output 1 22 22 22
22
One possible implementation
9/10/2018 One possible implementation Let us see why this may not work as we expect... 23 23 23
23
When a and b are both true
9/10/2018 When a and b are both true If both a and b are T, what should the output be? T F Unknown... but could be answered given a value for select. Unknown... and might still be unknown even given a value for select. 24 24 24
24
Circuits in practice Each gate takes 10ns to operate. 25 25 25
9/10/2018 Circuits in practice Each gate takes 10ns to operate. 25 25 25
25
9/10/2018 Tracing a multiplexer In the worst case, how long will it take before the output reflects any changes in a, b, select and is stable? 10ns 20ns 30ns 40ns It may never be stable. 26 26 26
26
Tracing a multiplexer: -1ns
9/10/2018 Tracing a multiplexer: -1ns Let’s change select from T to F. The output is still T. T F T F T T T T select 27 27 27
27
Tracing a multiplexer: 5ns
9/10/2018 Tracing a multiplexer: 5ns The output is still T. T F T F T T F F select 28 28 28
28
Tracing a multiplexer: 10ns
9/10/2018 Tracing a multiplexer: 10ns The output is still T. T F T T T F F F select 29 29 29
29
Tracing a multiplexer: 20ns
9/10/2018 Tracing a multiplexer: 20ns The output is now F. T T F T T F F F select 30 30 30
30
Tracing a multiplexer: 30ns
9/10/2018 Tracing a multiplexer: 30ns The output is now T again. T T T T T F F F select 31 31 31
31
An instability The output should always be T.
In reality, the output changes from T, to F, to T. The instability occurs because an update in select travels two paths with different delays. While the longer path “catches up”, the circuit can be incorrect.
32
Can other updates cause an instability?
9/10/2018 Can other updates cause an instability? Which one(s) of the following operations may cause an instability? Changing a or b only Changing select when exactly one of a and b is F Changing select, when both a and b are F Both (a) and (b) None of (a), (b) and (c). Answer: f. 33 33 33
33
A multiplexer that avoids the instability
9/10/2018 A multiplexer that avoids the instability Example: (~a ∧ b) ∨ a ≡ a ∨ b Example: (~p v q) ^ ~ (~q v p) ≡ ~p ^ q Trick: simplifying a complicated proposition is easier than making a simple one more complicated. 34 34 34
34
Module 2 outline Meaning of Logical Equivalence Proofs Multiplexers
9/10/2018 Module 2 outline Meaning of Logical Equivalence Proofs Multiplexers More exercises Comparing the meaning of conditional statement in symbolic logic might not be the same as its meaning in everyday English. How to apply logical equivalence laws to convert from one statement to another. Multiplexer, a very useful component in the computer. This shows that propositional logic is not a perfect model of how gates work in reality. 35 35 35
35
Module 2.4: More exercises
9/10/2018 Module 2.4: More exercises Consider the code: if target = value then if lean-left-mode = true then call the go-left() routine else call the go-right() routine else if target < value then call the go-right routine Let gl mean “the go-left() routine is called”. Complete the following: gl ↔ 36 36 36
36
Module 2.4: More exercises
9/10/2018 Module 2.4: More exercises Consider: The Java [String] equals() method returns true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object. Let n1: the string is null n2: the argument is null nt: the method returns true s: the two objects are strings that represent the same sequence of characters. Is the sentence logically equivalent to nt ↔ (n1 ^ n2) v s? Why or why not? 37 37 37
37
Module 2.4: More exercises
9/10/2018 Module 2.4: More exercises Prove: (a ^ ~b) v (~a ^ b) ≡ (a v b) ^ ~ (a ^ b) 38 38 38
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.