Title: Boolean Algebra
1Boolean Algebra
2Logical Statements
- A proposition that may or may not be true
- Today is Monday
- Today is Sunday
- It is raining
3Compound Statements
- More complicated expressions can be built from
simpler ones - Today is Monday AND it is raining.
- Today is Sunday OR it is NOT raining
- Today is Monday OR today is NOT Monday
- (This is a tautology)
- Today is Monday AND today is NOT Monday
- (This is a contradiction)
- The expression as a whole is either true or false.
4Things can get a little tricky
- Are these two statements equivalent?
- It is not nighttime and it is Monday OR it is
raining and it is Monday. - It is not nighttime or it is raining and Monday
AND it is Monday.
5Boolean Algebra
- Boolean Algebra allows us to formalize this sort
of reasoning. - Boolean variables may take one of only two
possible values TRUE or FALSE. - (or, equivalently, 1 or 0)
- Algebraic operators - /
- Logical operators - AND, OR, NOT, XOR
6Logical Operators
- A AND B is True when both A and B are true.
- A OR B is always True unless both A and B are
false. - NOT A changes the value from True to False or
False to True. - XOR either a or b but not both
7Writing AND, OR, NOT
- A AND B A B AB
- A OR B A v B AB
- NOT A A A
- TRUE T 1
- FALSE F 0
8Exercise
- AB AB
- A AND B OR A AND NOT B
- (A B)(B)
- NOT (A OR B) AND B
9Boolean Algebra
- The in Boolean Algebra means equivalent
- Two statements are equivalent if they have the
same truth table. (More in a second) - For example,
- True True,
- A A,
10Truth Tables
- Provide an exhaustive approach to describing when
some statement is true (or false)
11Truth Table
M R M R MR M R
T T
T F
F T
F F
12Truth Table
M R M R MR M R
T T F F
T F F T
F T T F
F F T T
13Truth Table
M R M R MR M R
T T F F T
T F F T F
F T T F F
F F T T F
14Truth Table
M R M R MR M R
T T F F T T
T F F T F T
F T T F F T
F F T T F F
15Example
- Write the truth table for A(A B) AB
- Fill in the following columns
- A, B, A, B, A B, AB, A (A B), whole
expression.
16A (A B) AB
A B A B A B A B A(AB) Whole
T T F F T F T T
T F F T F T F T
F T T F T F F F
F F T T T F F F
17Exercise
- Write the truth table for (A A) B
18Solution to (A A) B
A B A A A (A A) B
T T F T T
T F F T F
F T T T T
F F T T F
19Boolean Algebra - Identities
- A True True
- A False A
- A A A
- A B B A
- (commutative)
- A AND True A
- A AND False False
- A AND A A
- AB BA
- (commutative)
20Associative and Distributive Identities
- A(BC) (AB)C
- A (B C) (A B) C
- A (B C) (AB)(AC)
- A (BC) (A B) (A C)
- Exercise using truth tables prove -
- A(A B) A
21Solution A AND (A OR B) A
A B A B A (A B)
T T T T
T F T T
F T T F
F F F F
22Using Identities
- A (BC) (A B)(A C)
- A(B C) (AB) (AC)
- A(A B) A
- A A A
- Exercise - using identities prove
- A (AB) A
- A (AB) (A A)(A B)
- A (A B) A
23Identities with NOT
24DeMorgans Laws
- (A B) AB
- (AB) A B
- Exercise - Simplify the following with identities
- (AB)
25Solving a Truth Table
A B X When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
T T T When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
T F T When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
F T F When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
F F F When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
For example, X AB AB For example, X AB AB For example, X AB AB For example, X AB AB
26Exercise Solving a Truth Table
A B X When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
T T T When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
T F F When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
F T T When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
F F F When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
Solve the Truth Table given above. Solve the Truth Table given above. Solve the Truth Table given above. Solve the Truth Table given above.
27Exercise Solving a Truth Table
A B X When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
T T T When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
T F F When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
F T T When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
F F F When you see a True value in the X column, you must have a term in the expression. Each term consists of the variables AB. A will be NOT A when the truth value of A is False, B will be NOT B when the truth value of B is false. They will be connected by OR.
Solution is, X AB AB (A AND B) OR ( NOT A AND B) Solution is, X AB AB (A AND B) OR ( NOT A AND B) Solution is, X AB AB (A AND B) OR ( NOT A AND B) Solution is, X AB AB (A AND B) OR ( NOT A AND B)