Title: The Laws of Logic: Boolean Algebra A State High Math Club Presentation START==TRUE
1The Laws of LogicBoolean AlgebraA State High
Math Club PresentationSTARTTRUE
2What is Boolean Algebra?
- Two values
- True and False - Logic Set Theory
- 1 and 0 - Computers Probability
- High and Low Digital Electronics
3AND - Basic
- Notation - AND
- (A AND B) returns true iff A and B are both true
- Numerically A B
- Identity - 1
- 0 AND 1 0
- 1 AND 1 1
- Annihilator - 0
- 0 AND 0 0
- 1 AND 0 0
4AND - Representations
5OR (Inclusive or) - Basic
- Notation - OR v
- (A OR B) returns true if either (or both) of A
and B are true - Numerically A B - A B
- Probability P(A or B) P(A)P(B)-P(A AND B)
- And/Or Construction
- Identity - 0
- Annihilator - 1
6OR - Representations
7NOT - Basic
- Notation NOT !
- Unary - only takes one argument
- Others are called binary
- Returns the opposite of its argument
- Analogous to negative sign
8NOT - Representations
9XOR (Exclusive or) - Derived
- Notation XOR
- (A XOR B) returns true iff exactly one of A and B
is true - Can also be considered not equals
- Either/or construction
- A XOR B (A B) v (A B)
- Numerically AB (mod 2)
- Also AB 2(AB) Same formula in probability
- A XOR 1 NOT(A)
- A XOR 0 A
10XOR - Representations
11Equivalence - Derived
- Notation
- Returns true iff AB
12Material Implication - Derived
- Notation xgty
- Linguistically If X, then Y
- X is called the antecedent y is called the
consequent - False ONLY when x is true and y is false
- NOT(X) OR Y
- More intuitively NOT(X AND NOT(Y))
- Why is x-gty true when x is false???
- This means that If two is odd, then two is even
is a true statement!
13TautologiesThe Theorems of Boolean Algebra
- Called laws
- Proven with either truth tables or derivations
- Truth table true iff last column is all 1s
(i.e. true for all input values) - Example Proof of X X 0
X X XX XX 0
1 0 0 1
0 1 0 1
14De Morgans LawsDistributing a NOT
- (xVy)(x)(y)
- (xy)(x)V(y)
- Proofs?
X Y (x)(y) (xvy)
1 1 0 0
1 0 0 0
0 1 0 0
0 0 1 1
X Y (x)v(y) (xy)
1 1 0 0
1 0 1 1
0 1 1 1
0 0 1 1
15Important Laws
- AND and OR are
- Distributive over each other
- Associative
- Commutative
- X X
- XX0
- XvX1
- De Morgans Laws
16A Derivation
- (w V x) V (y V z) ((w V x) V y) V z (w V (x
V y)) V z (w V (y V x)) V z ((w V y) V x) V
z (w V y) V (x V z) - Why is this valid?
17ApplicationsLogic Deduction
- Propositional Calculus gives valid forms of
arguments - Arguments are valid iff they are laws of boolean
algebra - Tends to use -gt a lot
- Examples
- (P (P-gtQ)) -gt Q Modus Ponens
- (Q (P-gtQ)) -gt P Modus Tollens
- ((P-gtQ) (Q-gtR)) -gt (P-gtR) Hypothetical
Syllogism
18Modus Ponens Proof
P Q P-gtQ (P (P-gtQ)) (P (P-gtQ)) -gt Q
1 1 1 1 1
1 0 0 0 1
0 1 1 0 1
0 0 1 0 1
19Modus Tollens Proof
P Q P-gtQ (Q (P-gtQ)) (Q (P-gtQ)) -gt P
1 1 1 0 1
1 0 0 0 1
0 1 1 0 1
0 0 1 1 1
20Hypothetical Syllogism Proof
P Q R P-gtQ Q-gtR P-gtQ Q-gtR P-gtR
1 1 1 1 1 1 1
1 1 0 1 0 0 0
1 0 1 0 1 0 1
1 0 0 0 1 0 0
0 1 1 1 1 1 1
0 1 0 1 0 0 1
0 0 1 1 1 1 1
0 0 0 1 1 1 1
21ApplicationsComputer Curcuits
- Everything in a computer is either a 1 or 0
(called a bit, or binary unit) - 1 is high voltage 0 is low voltage
- Why?
- Calculations are done with AND, OR, and NOT logic
gates - Sound familiar?
22How Do Computers Add?
- We want to add two numbers, which are sequences
of bits - We add one place value (two bits) at a time
- Input The two bits, A and B
- Output sum bit (the actual place value) and
carry bit (if we need to carry a 2) - How can we make this circuit?
23Adding
- Make a truth table and translate it into a
circuit diagram
A B Sum Carry
1 1 0 1
1 0 1 0
0 1 1 0
0 0 0 0
24Adding
- Sum A XOR B
- Carry A AND B
25What about the carry bit?
- We forgot we might need to add a carry bit as
well - So we really have three inputs A,B, and Cin
(carry in) - Still two outputs
- Cout (carry out)
- Sum
26Take Two
A B Cin S Cout
1 1 1 1 1
1 1 0 0 1
1 0 1 0 1
1 0 0 1 0
0 1 1 0 1
0 1 0 1 0
0 0 1 1 0
0 0 0 0 0
- How do we make this circuit diagram?
27Full 1-bit Adder
28How about more bits?
29How many basic gates?
- We use AND, OR, and NOT as basic gates
- Wouldnt it be nice to have ONE basic gate?
- Can mass-produce a single circuit dont have to
worry about which (tiny and impossible to see)
circuit is which
30NAND Sheffer Stroke
- Notation NAND ?
- A NAND B NOT (A AND B)
- Can be used to make AND, OR, and NOT gates
- How?
31NAND as a Universal Gate
- NOT(A) A NAND A
- A AND B NOT(A NAND B) (A NAND B) NAND (A NAND
B) - A OR B NOT(A) NAND NOT(B) by Demorgans Law
(A NAND A) NAND (B NAND B) - A -gt B NOT(A) OR B A NAND NOT(B) A NAND (B
NAND B)
32NOR Pierce Arrow
- Notation NOR ?
- A NOR B NOT(A OR B)
- Can be used to make AND,OR, and NOT gates
- How?
33NOR as a Universal Gate
- NOT(A) A NOR A
- A OR B NOT(A OR B) (A NOR B) NOR (A NOR B)
- A AND B NOT(A) NOR NOT(B) by Demorgans Law
(A NOR A) NOR (B NOR B) - A-gtB NOT(A) OR B (NOT(A) NOR B) NOR (NOT(A)
NOR B) - ((A NOR A) NOR B) NOR ((A NOR A) NOR B)
34An Everyday ExampleSearch Engines
- Google uses boolean algebra on your search terms
- Automatically uses AND (i.e. whitespace AND)
- boolean algebra -gt Pages with BOTH boolean and
algebra in them - Use OR for logical OR
- Boolean OR algebra -gt Pages with EITHER boolean
or algebra in them - Use - for NOT
- Boolean Algebra -gtPages WITH boolean but
WITHOUT algebra
35END1