Boolean Algebra - ACSL Category Descriptions PDF

Summary

This document provides a general overview of Boolean algebra, including its operators, and its importance for computer science students. It includes sample problems and online resources.

Full Transcript

2024/5/26 下午3:09 Boolean Algebra - ACSL Category Descriptions Boolean Algebra Boolean algebra is the branch of algebra in which the values of the variables and constants have exactly two values: true and false, usually denoted 1 and 0 re...

2024/5/26 下午3:09 Boolean Algebra - ACSL Category Descriptions Boolean Algebra Boolean algebra is the branch of algebra in which the values of the variables and constants have exactly two values: true and false, usually denoted 1 and 0 respectively. Contents Operators Why is Boolean Algebra Important for ACSL Students? Laws Order of Precedence Fundamental Identities Sample Problems Problem 1: Simplify the Expression Problem 2: Find Solutions Online Resources Websites Videos Operators The basic operators in Boolean algebra are AND, OR, and NOT. The secondary operators are eXclusive OR (often called XOR) and eXclusive NOR (XNOR, sometimes called equivalence). They are secondary in the sense that they can be composed from the basic operators. The AND of two values is true only whenever both values are true. It is written as xy or x ⋅ y. The values of and for all possible inputs is shown in the following truth table: x y xy 0 0 0 0 1 0 1 0 0 1 1 1 The OR of two values is true whenever either or both values are true. It is written as x + y. The values of or for all possible inputs is shown in the following truth table: https://www.categories.acsl.org/wiki/index.php?title=Boolean_Algebra 1/8 2024/5/26 下午3:09 Boolean Algebra - ACSL Category Descriptions x y x+y 0 0 0 0 1 1 1 0 1 1 1 1 The NOT of a value is its opposite; that is, the not of a true value is false whereas the not of a false value is true. It is written as x or ¬x. The values of not for all possible inputs is ⎯ ⎯⎯ shown in the following truth table: ⎯ ⎯ ⎯ x x 0 1 1 0 The XOR of two values is true whenever the values are different. It uses the ⊕ operator, and can be built from the basic operators: x ⊕ y = x y + x y The values of xor for all ⎯ ⎯ ⎯ ⎯ ⎯⎯ possible inputs is shown in the following truth table: x y x⊕y 0 0 0 0 1 1 1 0 1 1 1 0 The XNOR of two values is true whenever the values are the same. It is the NOT of the XOR ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯⎯ ⎯ ⎯⎯ function. It uses the ⊙ operator: x ⊙ y = x ⊕ y. The xnor can be built from basic operators: x ⊙ y = xy + xy The values of xnor for all possible inputs is shown in the ⎯ ⎯ ⎯⎯ ⎯ ⎯ following truth table: x y x⊙y 0 0 1 0 1 0 1 0 0 1 1 1 https://www.categories.acsl.org/wiki/index.php?title=Boolean_Algebra 2/8 2024/5/26 下午3:09 Boolean Algebra - ACSL Category Descriptions Just as algebra has basic rules for simplifying and evaluating expressions, so does Boolean algebra. Why is Boolean Algebra Important for ACSL Students? Boolean algebra is important to programmers, computer scientists, and the general population. For programmers, Boolean expressions are used for conditionals and loops. For example, the following snippet of code sums the even numbers that are not also multiples of 3, stopping when the sum hits 100: s = 0 x = 1 while (s < 100): if (x % 2 == 0) and (x % 3 != 0) then s = s + x x = x + 1 Both the conditional statement s < 100 and the Boolean expression with 2 conditional statements (x % 2 == 0) and (x % 3 != 0) evaluate to true or false. For computer scientists, Boolean algebra is the basis for digital circuits that make up a computer's hardware. The Digital Electronics category concerns a graphical representation of a circuit. That circuit is typically easiest to understand and evaluate by converting it to its Boolean algebra representation. The general population uses Boolean algebra, probably without knowing that they are doing so, when they enter search terms in Internet search engines. For example, the search expression jaguar speed -car is parsed by the search engine as the Boolean expression "jaguar" and "car" and not "speed"; it returns pages about the speed of the jaguar animal, not the Jaguar car. Laws A law of Boolean algebra is an identity such as x + (y + z) = (x + y) + z between two Boolean terms, where a Boolean term is defined as an expression built up from variables, the constants 0 and 1, and operations and, or, not, xor, and xnor. Like ordinary algebra, parentheses are used to group terms. When a not is represented with an ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯ overhead horizontal line, there is an implicit grouping of the terms under the line. That is, x ⋅ y + z is ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ evaluated as if it were written x ⋅ (y + z). Order of Precedence https://www.categories.acsl.org/wiki/index.php?title=Boolean_Algebra 3/8 2024/5/26 下午3:09 Boolean Algebra - ACSL Category Descriptions The order of operator precedence is not; then and; then xor and xnor; and finally or. Operators with the same level of precedence are evaluated from left-to-right. Fundamental Identities Commutative Law – The order of application of two x+y = y+x x⋅y = y⋅x separate terms is not important. Associative Law – Regrouping of the terms in an expression (x + y) + z = x ⋅ (y ⋅ z) = (x ⋅ y) ⋅ z doesn't change the value of the expression. x + (y + z) Idempotent Law – A term that is or'´ed or and´ed with itself x+x = x x⋅x = x is equal to that term. Annihilator Law – A term that is or'´ed with 1 is 1; a term and x+1 = 1 x⋅0 = 0 ´ed with 0 is 0. Identity Law – A term or´ed 0 or and´ed with a 1 will always x+0 = x x⋅1 = x equal that term. Complement Law – A term or´ed with its complement equals ⎯ ⎯ ⎯ ⎯ ⎯ ⎯ x+x= 1 x⋅x= 0 1 and a term and´ed with its complement equals 0. x + xy = x Absorptive Law – Complex expressions can be reduced to a x + xy = x + y ⎯ ⎯ ⎯ simpler ones by absorbing like terms. x(x + y) = x x ⋅ (y + z) = xy + xz Distributive Law – It's OK to multiply or factor-out an expression. (x + y) ⋅ (p + q) = xp + xq + yp + yq (x + y)(x + z) = x + yz DeMorgan's Law – An or (and) expression that is negated is ⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯ ⎯ ⎯ ⎯ ⎯⎯⎯ ⎯ x+y = x⋅y x ⋅ y= x+ y equal to the and (or) of the negation of each term. Double Negation – A term that is inverted twice is equal to ⎯ ⎯ ⎯ the original term. x=x ⎯ ⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ Relationship between XOR and XNOR x⊙y = x⊕y= x⊕⎯ y = x⊕y ⎯ ⎯ ⎯ ⎯ ⎯ Sample Problems https://www.categories.acsl.org/wiki/index.php?title=Boolean_Algebra 4/8 2024/5/26 下午3:09 Boolean Algebra - ACSL Category Descriptions Problems in this category are typically of the form "Given a Boolean expression, simplify it as much as possible" or "Given a Boolean expression, find the values of all possible inputs that make the expression true." Simplify means writing an equivalent expression using the fewest number of operators. Problem 1: Simplify the Expression ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ Problem: Simplify the following expression as much as possible: A(A + B) + BA Solution: The simplification proceeds as follows: ⎯ ⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ A(A + B) + BA ( ) ( ) ⎯ ⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯ ⎯⎯⎯ ⎯ ⎯ ⎯⎯ ⎯⎯ = A(A + B) ⋅ BA (DeMorgan's Law) ( ) ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ = (A(A + B)) ⋅ B + A (Double Negation; DeMorgan's Law) = A ⋅ ( B + A) ⎯ ⎯ ⎯⎯ (Absorption; Double Negation) =A (Absorption) Problem 2: Find Solutions ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ Problem: Find all orderd pairs (A, B) that make the following expression true: (A + B) + AB Solution: There are typically two approaches to solving this type of problem. One approach is to simplify the expression as much as possible, until it's obvious what the solutions are. The other approach is to create a truth table of all possible inputs, with columns for each subexpression. The simplification approach is as following: ⎯ ⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ (A + B) + AB ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯⎯ ⎯ ⎯ ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯ ⎯⎯ = A + B ⋅ AB ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ = (A + B) ⋅ (A + B) https://www.categories.acsl.org/wiki/index.php?title=Boolean_Algebra 5/8 2024/5/26 下午3:09 Boolean Algebra - ACSL Category Descriptions ⎯ ⎯ ⎯⎯ = (A + B) ⋅ (A + B) ⎯ ⎯⎯⎯ ⎯ ⎯ ⎯⎯ = AA + AB + BA + BB ⎯ ⎯⎯ ⎯ = A + A(B + B) + 0 = A + A(1) = A+A = A This means that all inputs are valid whenever A is true: (1, 0) and (1, 1) The truth table approach is as following. Each column is the result of a basic operation on two other columns. #1 #2 #3 #4 #5 #6 #7 #8 OR of ADD of NOT of NOT of OR of Col#4, NOT of Col#1, Col#1, Col#3 Col#1 Col#6 Col#7 Col#2 Col#2 ⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯ A B A+B A+B A AB A + B + AB ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ A + B + AB 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 0 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 The rightmost column is the expression we are solving; it is true for the 3rd and 4th rows, where the inputs are (1, 0) and (1, 1). Online Resources Websites A great online tutorial on Boolean Algebra is part of Ryan's Tutorials (https://ryanstutorials.net/boole an-algebra-tutorial/). There are many online Boolean Calculators. This one gives Truth Tables calculator (https://sheabunge.github.io/boolcalc/). This link that has ads also simplifies and uses ! for NOT calculator (https://www.boolean-algebra.com/). Videos The following YouTube videos show ACSL students and advisors working out some previous problems. To access the YouTube page with the video, click on the title of the video in the icon. (You can also play the video directly by clicking on the arrow in the center of the image; however, you'll https://www.categories.acsl.org/wiki/index.php?title=Boolean_Algebra 6/8 2024/5/26 下午3:09 Boolean Algebra - ACSL Category Descriptions probably want to have a larger viewing of the video since it contains writing on a whiteboard.) Some of the videos contain ads; ACSL is not responsible for the ads and does not receive compensation in any form for those ads. ACSL Boolean Algebra Contest 2 ACSL Boolean Algebra Co… Co… Worksheet 1 (misterminich) (https://youtu.b e/HJdhEjpVYsY) Mr. Minich is an ACSL advisor. This video was one of two he created to help prepare his students for the ACSL Boolean algebra category. It shows solutions to 5 different problems that have appeared in recent years. ACSL Boolean Algebra Contest 2 ACSL Boolean Algebra Co… Co… Worksheet 2 (misterminich) (https://youtu. be/4io6xgz8Zwk) Mr. Minich is an ACSL advisor. This video was one of two he created to help prepare his students for the ACSL Boolean algebra category. It shows solutions to 5 different problems that have appeared in recent years. ACSL 3 13-14 #1 - AM (Gordon Campbell) (https://youtu.be/6vI1mO1XOjQ) ACSL 3 13-14 #1 - AM This video walks through the solution to finding all ordered triples that make the following Boolean expression true: ⎯ ⎯ ⎯⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ (AB + C )(A + BC)(A + B + C) This problem appeared in 2013-2014 in the Senior Division, Contest #3. ACSL 3 #1 14-15 - AM (Gordon Campbell) ACSL 3 #1 14-15 - AM (2) (https://youtu.be/KRKTbAZYlLM) This video walks through the simplification of the expression: ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ (A + B) (B + C)(A + C ) (AB + BC) https://www.categories.acsl.org/wiki/index.php?title=Boolean_Algebra 7/8 2024/5/26 下午3:09 Boolean Algebra - ACSL Category Descriptions This problem appeared in 2014-2015 in the Senior Division, Contest #3. A general tutorial on boolean algebra that can be used for American Computer Boolean Algebra Basics a… a… Science League. (Tangerine Code) (https:// youtu.be/jDnni-zm2g8) Walks through the simplification of the following Boolean expression: ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯⎯ ⎯⎯ ⎯ ⎯⎯ ⎯ ⎯ ⎯⎯ ⎯ (A + B)(AB) + (A + B)(AB) Retrieved from "http://www.categories.acsl.org/wiki/index.php?title=Boolean_Algebra&oldid=883" This page was last edited on 24 May 2024, at 16:22. https://www.categories.acsl.org/wiki/index.php?title=Boolean_Algebra 8/8

Use Quizgecko on...
Browser
Browser