Fiveable
Fiveable
pep
Fiveable
Fiveable

or

Log in

Find what you need to study


Light

3.6 Equivalent Boolean Expressions

4 min readdecember 21, 2022

Athena_Codes

Athena_Codes

Milo Chang

Milo Chang

Athena_Codes

Athena_Codes

Milo Chang

Milo Chang

Sometimes there are multiple ways to represent the same boolean expression. To show that they are the same expression, either prove that they can be simplified to the same expression using boolean properties and identities or prove that they can be the same in all cases.

Proof By Simplification

We can simplify one boolean expression to another in order to show that the two expressions are equivalent. To do so, we will use boolean properties, identities, and . You do NOT need to memorize these, as we will do an easier formulaic way after.

For boolean values a, b, and c, we have the following:

Basic Theorems

  1. a && false == false

  2. a && true == a

  3. == a

  4. == false

  5. == a

  6. == true

  7. == a

  8. == true

  9. !(!a) == a (The inverse of an inverse is the original value)

Consensus Theorems (Nice to know, but not required)

  • a || (!a && b) == a || b

  • a || (!a && !b) == a || !b

  • !a || (a && b) == !a || b

  • !a || (a && !b) == !a || !b

Commutative Law (boolean AND and OR are commutative)

  • a && b == b && a

  • a || b == b || a

Associative Law (boolean AND and OR are associative)

  • a && (b && c) == (a && b) && c

  • a || (b || c) == (a || b) || c

Distributive Law (boolean AND distributes over boolean OR)

  • a && (b || c) == (a && b) || (a && c)

DeMorgan's Theorems (Important to know) (boolean NOT does not distribute over boolean OR or AND)

  • !(a && b) == !a || !b

  • !(a || b) == !a && !b

We can use these properties to simplify boolean expressions. This example is probably more complicated than what you would see on the exam, but it still serves as a good guide:

!a && b && c || a && !b && c || a && b && !c || a && b && c = !a && b && c || a && b && c || a && b && !c || a && !b && c (Commutative Law) = (!) && b && c || a && b && !c || a && !b && c () = (true) && b && c || a && b && !c || a && !b && c (Basic Theorem 8) = b && c || a && b && !c || a && !b && c (Basic Theorem 2) = b && (c || a && !c) || a && !b && c () = b && (c || !c && a) || a && !b && c (Commutative Law) = b && (c || a) || a && !b && c (Consensus Theorem) = b && c || b && && !b && c () = b && c || a && (b || !b && c) () = b && c || a && (b || c) (Consensus Theorem) = b && c || a && b || a && c. ()

In this simplification, every row is equivalent to the first row due to boolean properties. However, this can get a little messy at times, as seen above, so we have... drumroll please...

Proof By Testing All Cases

Sometimes, the simplification of a boolean expression may not be obvious, so we can test all possible cases of input in a boolean expression to get all possible outputs. If the outputs of two boolean statements are all the same, then these two statements are equivalent. We can do this with truth tables, which are a methodical way to organize these.

Remember that there is an order of operations to these operators if there are multiple boolean logical operators in one expression. The has the highest precedence, followed by the and finally the .

Truth Table Example 1

Here is a truth table for !a && b || !a && !b:

ab!a!b!a && b!a && !b!a && b || !a && !b
FalseFalseTrueTrueFalseTrueTrue
FalseTrueTrueFalseTrueFalseTrue
TrueFalseFalseTrueFalseFalseFalse
TrueTrueFalseFalseFalseFalseFalse

Note that this expression evaluates to true any time a is false, so an equivalent boolean expression for this is simply !a.

As for the structure of the truth table, the leftmost columns are the inputs with the number of rows dictated by the possible number of inputs. The following columns represent the evaluation of the boolean expression step by step according to the boolean order of operations. Once you become more familiar with these operations, you can skip some of the columns, but it's better to keep all of the columns to be safe.

Truth Table Example 2

Here is a truth table for (!a || b) && (!a || !b):

ab!a!b!a || b!a || !b(!a || b) && (!a || !b)
FalseFalseTrueTrueTrueTrueTrue
FalseTrueTrueFalseTrueTrueTrue
TrueFalseFalseTrueFalseTrueFalse
TrueTrueFalseFalseTrueFalseFalse

Note that this expression also evaluates to true any time a is false, so an equivalent boolean expression for this is also !a.

Key Terms to Review (14)

a && !a

: This term refers to an expression that checks if one condition is true while the other is false using the logical AND operator.

a && a

: This term refers to the logical AND operator in programming, which checks if both conditions on either side of the operator are true.

a || !a

: The logical OR operator (||) can also be used in combination with the logical NOT operator (!). It checks whether at least one of the original value or its negation is true.

a || a

: The logical OR operator (||) can also be used to combine the same boolean value twice. If the value is true, the result will be true; otherwise, it will be false.

a || false

: This term refers to the logical OR operator in programming, which checks if at least one of the conditions on either side of the operator is true.

a || true

: The logical OR operator (||) is used to combine two boolean values. If either of the values is true, the result will be true.

AND Operator

: The AND operator is a logical operator that combines two or more conditions and returns true only if all conditions are true.

Associative Law

: The associative law states that the grouping of operations does not affect the result. In other words, it doesn't matter how you group the operations, the outcome will be the same.

DeMorgan's Theorems

: DeMorgan's Theorems state two rules for simplifying logical expressions involving negations (NOT), conjunctions (AND), and disjunctions (OR). These rules allow us to switch between negating individual terms and negating the entire expression.

Distributive Law

: The distributive law allows us to distribute (or break apart) an expression into smaller parts and then combine them back together. It helps simplify calculations by breaking down complex expressions.

Key Term: !(!a)

: Definition: The term !(!a) represents the double negation of a boolean variable a. It is equivalent to simply a.

NOT operator

: The NOT operator is a logical operator that reverses the truth value of a given expression. It returns true if the expression is false, and false if the expression is true.

OR Operator

: The OR operator is a logical operator that combines two or more conditions and returns true if at least one condition is true.

Theorems

: Theorems are statements that have been proven to be true using logical reasoning and previously established facts.

3.6 Equivalent Boolean Expressions

4 min readdecember 21, 2022

Athena_Codes

Athena_Codes

Milo Chang

Milo Chang

Athena_Codes

Athena_Codes

Milo Chang

Milo Chang

Sometimes there are multiple ways to represent the same boolean expression. To show that they are the same expression, either prove that they can be simplified to the same expression using boolean properties and identities or prove that they can be the same in all cases.

Proof By Simplification

We can simplify one boolean expression to another in order to show that the two expressions are equivalent. To do so, we will use boolean properties, identities, and . You do NOT need to memorize these, as we will do an easier formulaic way after.

For boolean values a, b, and c, we have the following:

Basic Theorems

  1. a && false == false

  2. a && true == a

  3. == a

  4. == false

  5. == a

  6. == true

  7. == a

  8. == true

  9. !(!a) == a (The inverse of an inverse is the original value)

Consensus Theorems (Nice to know, but not required)

  • a || (!a && b) == a || b

  • a || (!a && !b) == a || !b

  • !a || (a && b) == !a || b

  • !a || (a && !b) == !a || !b

Commutative Law (boolean AND and OR are commutative)

  • a && b == b && a

  • a || b == b || a

Associative Law (boolean AND and OR are associative)

  • a && (b && c) == (a && b) && c

  • a || (b || c) == (a || b) || c

Distributive Law (boolean AND distributes over boolean OR)

  • a && (b || c) == (a && b) || (a && c)

DeMorgan's Theorems (Important to know) (boolean NOT does not distribute over boolean OR or AND)

  • !(a && b) == !a || !b

  • !(a || b) == !a && !b

We can use these properties to simplify boolean expressions. This example is probably more complicated than what you would see on the exam, but it still serves as a good guide:

!a && b && c || a && !b && c || a && b && !c || a && b && c = !a && b && c || a && b && c || a && b && !c || a && !b && c (Commutative Law) = (!) && b && c || a && b && !c || a && !b && c () = (true) && b && c || a && b && !c || a && !b && c (Basic Theorem 8) = b && c || a && b && !c || a && !b && c (Basic Theorem 2) = b && (c || a && !c) || a && !b && c () = b && (c || !c && a) || a && !b && c (Commutative Law) = b && (c || a) || a && !b && c (Consensus Theorem) = b && c || b && && !b && c () = b && c || a && (b || !b && c) () = b && c || a && (b || c) (Consensus Theorem) = b && c || a && b || a && c. ()

In this simplification, every row is equivalent to the first row due to boolean properties. However, this can get a little messy at times, as seen above, so we have... drumroll please...

Proof By Testing All Cases

Sometimes, the simplification of a boolean expression may not be obvious, so we can test all possible cases of input in a boolean expression to get all possible outputs. If the outputs of two boolean statements are all the same, then these two statements are equivalent. We can do this with truth tables, which are a methodical way to organize these.

Remember that there is an order of operations to these operators if there are multiple boolean logical operators in one expression. The has the highest precedence, followed by the and finally the .

Truth Table Example 1

Here is a truth table for !a && b || !a && !b:

ab!a!b!a && b!a && !b!a && b || !a && !b
FalseFalseTrueTrueFalseTrueTrue
FalseTrueTrueFalseTrueFalseTrue
TrueFalseFalseTrueFalseFalseFalse
TrueTrueFalseFalseFalseFalseFalse

Note that this expression evaluates to true any time a is false, so an equivalent boolean expression for this is simply !a.

As for the structure of the truth table, the leftmost columns are the inputs with the number of rows dictated by the possible number of inputs. The following columns represent the evaluation of the boolean expression step by step according to the boolean order of operations. Once you become more familiar with these operations, you can skip some of the columns, but it's better to keep all of the columns to be safe.

Truth Table Example 2

Here is a truth table for (!a || b) && (!a || !b):

ab!a!b!a || b!a || !b(!a || b) && (!a || !b)
FalseFalseTrueTrueTrueTrueTrue
FalseTrueTrueFalseTrueTrueTrue
TrueFalseFalseTrueFalseTrueFalse
TrueTrueFalseFalseTrueFalseFalse

Note that this expression also evaluates to true any time a is false, so an equivalent boolean expression for this is also !a.

Key Terms to Review (14)

a && !a

: This term refers to an expression that checks if one condition is true while the other is false using the logical AND operator.

a && a

: This term refers to the logical AND operator in programming, which checks if both conditions on either side of the operator are true.

a || !a

: The logical OR operator (||) can also be used in combination with the logical NOT operator (!). It checks whether at least one of the original value or its negation is true.

a || a

: The logical OR operator (||) can also be used to combine the same boolean value twice. If the value is true, the result will be true; otherwise, it will be false.

a || false

: This term refers to the logical OR operator in programming, which checks if at least one of the conditions on either side of the operator is true.

a || true

: The logical OR operator (||) is used to combine two boolean values. If either of the values is true, the result will be true.

AND Operator

: The AND operator is a logical operator that combines two or more conditions and returns true only if all conditions are true.

Associative Law

: The associative law states that the grouping of operations does not affect the result. In other words, it doesn't matter how you group the operations, the outcome will be the same.

DeMorgan's Theorems

: DeMorgan's Theorems state two rules for simplifying logical expressions involving negations (NOT), conjunctions (AND), and disjunctions (OR). These rules allow us to switch between negating individual terms and negating the entire expression.

Distributive Law

: The distributive law allows us to distribute (or break apart) an expression into smaller parts and then combine them back together. It helps simplify calculations by breaking down complex expressions.

Key Term: !(!a)

: Definition: The term !(!a) represents the double negation of a boolean variable a. It is equivalent to simply a.

NOT operator

: The NOT operator is a logical operator that reverses the truth value of a given expression. It returns true if the expression is false, and false if the expression is true.

OR Operator

: The OR operator is a logical operator that combines two or more conditions and returns true if at least one condition is true.

Theorems

: Theorems are statements that have been proven to be true using logical reasoning and previously established facts.


© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.


© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.