Boolean Logic
Boolean logic is the algebra of true and false values, using operations like AND, OR, and NOT to combine conditions. It underpins digital circuit design, programming conditionals, database queries, and any system that makes binary decisions.
itComputer fundamentals | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic: Boolean Logic
Boolean logic is the small machinery of true and false. It gives computing a way to say when a condition holds, when a rule should pass, and when a circuit output should change. The machinery is small enough to fit on a napkin. The surprises arrive when people assume the napkin checked every row by itself.
The basic parts are propositions, which are statements that can be true or false, and operators such as NOT, AND, OR, and XOR. NOT reverses a value. AND requires both inputs. OR requires at least one input. XOR is the fussy cousin that accepts exactly one input and refuses the both-true case. This is why the word either causes so much trouble in meetings.
A truth table is the antidote to guesswork. It lays out every possible input pattern, then pins an output beside each pattern. Two propositions produce four rows. Three produce eight. Once the table exists, the expression has fewer places to hide. If two expressions should be equivalent, compare their final columns row by row rather than trusting one friendly example.
Grouping matters because compound expressions form a tree. (A OR B) AND C is not the same rule as A OR (B AND C). Parentheses are cheap and readers are expensive, so write the grouping down. The same applies when moving NOT through a group: De Morgan's laws swap AND with OR as the negation moves inward. Forget the swap and you have changed the rule, not simplified it.
Software adds local customs. Many languages short-circuit AND and OR, so the right side may not run. Some convert other values to truth values. Python's and and or can return an operand rather than a Boolean. SQL can add unknown. Bitwise operators work on bits, not truth conditions. Boolean logic gives you the skeleton; the host language supplies some of the bones' less charming legal clauses.
Start with the Practice Reference if you need a method. It gives the formulas, row counts, and rewrite checks. Then do the Exercise: build the access-rule table and verify the denial condition. Use the Cheatsheet when you forget whether OR includes both true. It does. It absolutely does.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://xlinux.nist.gov/dads/HTML/boolean.html
Supports
- Boolean entities in computer science use two values such as true and false or one and zero
- Core Boolean operations include AND, OR, and NOT
- Boolean algebra relates to intersection, union, and complement
- https://openstax.org/books/introduction-computer-science/pages/7-2-programming-language-constructs
Supports
- Logical operators combine expressions and produce true or false
- AND, OR, and NOT follow the truth tables used in the course
- Conditions and comparisons use Boolean results in programs
- https://openstax.org/books/contemporary-mathematics/pages/2-3-constructing-truth-tables
Supports
- A truth table lists possible truth values and outcomes for component statements
- A table for n independent propositions has two to the power n input rows
- Intermediate columns support evaluation of compound statements
- Tautologies are true for every assignment and contradictions are false for every assignment
- https://openstax.org/books/contemporary-mathematics/pages/2-2-compound-statements
Supports
- Conjunction is true only when all component statements are true
- Disjunction is true when one or both component statements are true
- Parentheses and connective dominance determine evaluation order
- https://openstax.org/books/contemporary-mathematics/pages/2-6-de-morgans-laws
Supports
- Negated conjunction is equivalent to the disjunction of negated inputs
- Negated disjunction is equivalent to the conjunction of negated inputs
- Matching truth-table results can verify logical equivalence
- Boolean logic underlies computer science and digital electronics
- Double negation, commutative, associative, and related logical properties support expression rewriting
- https://docs.python.org/3/library/stdtypes.html#truth-value-testing
Supports
- Python objects can be tested for truth value
- Python and and or short-circuit based on the left operand
- Python and and or return an operand, while not returns a Boolean value
- Python documents priority among or, and, and not
- Python distinguishes logical operations from bitwise operations
- https://nvlpubs.nist.gov/nistpubs/Legacy/FIPS/fipspub127.pdf
Supports
- SQL search conditions can evaluate to true, false, or unknown
- Three-valued AND, OR, and NOT require truth tables beyond classical two-value Boolean logic
- https://www.nand2tetris.org/project01
Supports
- Elementary logic gates are building blocks for computer hardware
- The project constructs NOT, AND, OR, XOR, multiplexor, and demultiplexor gates
- Composite gates can be built from NAND and previously constructed gates
- https://www.nand2tetris.org/course
Supports
- Boolean Logic is the first hardware project in a course that builds a computer from first principles
- The course provides project guidelines and lecture material for structured practice
