Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discrete Math – Logic Unit

Similar presentations


Presentation on theme: "Discrete Math – Logic Unit"— Presentation transcript:

1 Discrete Math – Logic Unit
Jill Hubbard Tualatin High School

2 Oregon Department of Education approved discrete math advanced knowledge and skills
D.8 Logic: Understand the fundamentals of propositional logic, arguments, and methods of proof. D.8.1 Use truth tables to determine truth values of compounded propositional statements. D.8.3 Determine whether two propositions are logically equivalent. D.8.5 Construct logical arguments using laws of detachment (modus ponens), syllogism, tautology, and contradiction

3 Materials Needed Logisim free logic simulator Access to a computer
Access to a computer

4 First some vocabulary we’ll see
Proposition Compound Propositions Primitive propositions Logical Operators Truth Table Conjunction (AND) Disjunction (OR) Negation (NOT) What other logical operators do you know? Tautology Contradiction Have students guess what they think these works mean. The goal is to get them thinking about the words apart from math and then add the math definitions on top of that

5 Propositions A proposition is a statement that is either true or false
New York City is in Oregon (false) Today is Friday (its either true or false) Do your homework (not a proposition) It’s raining outside (probably true in Oregon!)

6 Compound and Primitive Propositions
Compound Propositions are propositions that are composed of sub-propositions connected together in various ways roses are red and violets are blue Mark is smart or he studies a lot Primitive propositions can not be broken down into simpler propositions If it’s not a composite proposition, it’s a primitive proposition

7 What do you think this means?
The truth value of a compound proposition id determined by the truth values of it sub-propositions together with the way in which they are connected John is short OR John is tall If either part is true, the entire proposition is true John is short AND John is tall Both parts have to be true for the entire proposition to be true. Open discussion. Try to get to the fact that in order to determine if the compound prop is true, we’ll need to break it up into its pieces and then figure out how we’re connecting the pieces

8 Basic Logical Operators Conjunction
Conjunction: p q / (p * q) Read as p AND q A truth table is used to shows how a logical operator works Use Logisim to model the AND operator and fill in the truth table Based on your truth table, write a definition of how the AND operator works p q p q p * q AND p q p q F T Share out the definitions and give student an official definition If p and q are true, then p AND q is true, otherwise its false

9 Basic Logical Operators Disjunction
Disjunction: p q / (p + q) Read as p OR q A truth table is used to shows how a logical operator works Use Logisim to model the OR operator and fill in the truth table Based on your truth table, write a definition of how the OR operator works p p q p + q OR q p q p q F T Share out the definitions and give student an official definition If either p or q are true, then p OR q is true, otherwise its false OR If p AND q are false, the p OR q is false. Otherwise, its true

10 Basic Logical Operators Negation
Negation: ¬p / !p Read as NOT p Use Logisim to model the NOT operator and fill in the truth table Based on your truth table, write a definition of how the NOT operator works Let p be the statement 2+2 = 5 (true or false) Give an example of a negation of this statement ¬ p !p p p ¬ p F T Share out the definitions and give student an official definition If p is true then not p is false If p is false then not p is true The statement 2+2 = 5 is false. Therefore, its negation must be true 2+2 is not equal to 5 (that’s true) or It is not true that 2+2 = 5 (also true)

11 Other Logical Operations (NAND, NOR, XOR, XNOR)
Use Logisim to model these operators Create a truth table for each operator Based on your truth table, write a definition of how the operator works XOR: read as exclusive OR XNOR: read as exclusive NOR NAND NOR XNOR XOR

12 Relationships between logical operators
People are related to each other right? So are logic gates. But you need to figure them out! What the relationship between the AND gate and the NAND gate What the relationship between the OR gate and the NOR gate What the relationship between the OR gate and the XOR gate. What makes it so exclusive anyway? What the relationship between the XOR gate and the XNOR gate NAND is not AND (hence the bubble on the output of the gate.) The truth table outputs are flipped (notted) NOR is not OR (hence the bubble on the output of the gate.) The truth table outputs are flipped (notted) An XOR looks like an OR operator except the case when both inputs are true results in an false output (its excluded) XNOR is not XOR (hence the bubble on the output of the gate.) The truth table outputs are flipped (notted)

13 Truth Tables for Compound Propositional Statements
Create a truth table for the following compound propositional statement: (p q) (¬ p q) (p * q) + (!p * q) Use Logisim to model this statement Run the simulator to make it matches your truth table. If it doesn’t, you made a mistake and must figure out how to fix it! From here on out, let’s use an engineer’s nomenclature mathematicians nomenclature engineers nomenclature

14 What the model looks like
File name of source: combo logic

15 The Mathematicians Method
p q !p p * q !p * q (p * q) + (!p * q) F T

16 The Engineers Method (p * q) + (!p * q) Sum of products form
Each term produces a true expression So, the expression is true when p is true AND q is true OR p is false (!p) AND q is true Everywhere else, the expression is false Engineers are lazy!

17 Tautologies Tautologies are propositions that are always true no matter what the truth values if their variables are (p + !p) is a tautology Why? If p is true, then !p is false and visa versa The OR logical operator states that if either p or !p is true, the result is true. One of those MUST be true Use the simulator to build this and test it.

18 Contradictions Contradictions are propositions that are always false no matter what the truth values if their variables are (p * !p) is a tautology Why? If p is true, then !p is false and visa versa The AND logical operator states that if either p or !p is false, the result is false. One of those MUST be false Use the simulator to build this and test it.

19 Simulate & Fill In the Truth Table
p p * !p F T p p + !p F T

20 Tautologies & Contradictions
Let p stand for the statement “It is cold outside” Then !p means it is not cold outside The proposition, p * !p would mean that it is cold outside and it is not cold outside. Clearly, always false and therefore a contradiction The proposition, p + !p would mean that it is cold outside or it is not cold outside. Clearly, always true and therefore a tautology

21 Tautologies & Contradictions
Is the following proposition a tautology or a contradiction? p + !(p * q) Prove using a truth table Prove using the Logisim simulator

22 Logical Equivalence Two propositions are logically equivalent if they have identical truth tables How is it possible that two propositions can have the same truth table? Take for example the following 2 propositions: !(p * q) !p + !q

23 Logical Equivalence F T F T !(p * q) !p + !q p q p * q !(p * q) p q !p

24 Logical Equivalence When engineers design circuits, the goal is to create designs that work robustly and are cheap The fewer gates engineers use, the cheaper the design will be Therefore, it is critical that engineers simplify their design to create cheap but equivalent logic Engineers use logic synthesizers to help them do the task of logic simplification.

25 Engineering Applications
Engineers use 1’s and 0’s instead of True and False 1 means True and 0 means False All truth tables therefore use 1’s and 0’s Computers use the binary number system When engineers create a design, their first job is to determine the interface for their design (the inputs and outputs needed to get the job done).

26 Number Systems Decimal – base 10
Remember back a long time ago when you were learning how to count? Our number system only has 10 symbols (0-9). So how do we represent the number after 9? Each number had a place value (Each place value is a power of 10 (base 10) You multiply each number with its place value and then added them all together. Now you just take it for granted!

27 Decimals Numbers - Base 10
10,000’s Place 1000’s Place 100’s Place 10’s 1’s Place Number 3 3*1 = 3 2 (2*10+3*1)= 23 1 (1*100)+(2*10)+(3*1)= 123

28 Number Systems Binary – Base 2
Computers use the binary number system or base 2. Base 2 uses only 2 numbers (1 and 0). This makes things very simple. But how do we represent numbers greater then 1? Just like base 10(decimal), each number had a place value. Each place value is a power of 2 (base 2) You multiply each number with its place value and then added them all together.

29 Binary Numbers - Base 2 1 (1*4)+ (1*2) = 6 (1*16) + (1*4)+ (1*2)
16’s Place 8’s Place 4’s Place 2’s 1’s Place Number 1 (1*4)+ (1*2) = 6 (1*16) + (1*4)+ (1*2) Or simply = 22 = 31

30 Counting in Binary is EASY!
Binary Number Decimal Equivalent zero 1 one two three four five six seven

31 Applications of logic – 7 segment display project
outA YOUR LOGIC outB in2 outC in1 outD outE in0 outF outG Note: A “1” on outA turn on the A segment of the 7 segment display, and a “0” on outA turns segment A off. The same is true for segments B through G

32 Applications of logic – 7 segment display project
Let’s use what we know to design logic that drives a 7-segment display. All inputs and outputs are binary numbers (1’s and 0’s) If your inputs are all 000, your 7 segment display should display the number 0 If your inputs are all 111, your 7 segment display should display the number 7 All input number encodings should work (0-7)

33 Let’s Make Truth Tables
Demo the truth table for outA Let students figure out equations for outB-outG Review your equations with your instructor

34 Lets’ Simplify our logic
Show students how to create K-Maps to create equivalent logic with less gates

35 Let’s use the logic simulator to make and test our design
Students must test their design to make sure they work If they do not work, they must debug their design

36


Download ppt "Discrete Math – Logic Unit"

Similar presentations


Ads by Google