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
Intro
Boolean Logic
Boolean logic gives you a small language for decisions. A Boolean value has two possible states: true or false. You combine those values with operators to describe when a larger condition is true.
The model appears throughout computing. A program branches when a condition is true. A search keeps or rejects a record. A digital circuit combines high and low signals through logic gates. The notation changes across these settings, but the underlying truth relationships stay recognizable.
The three core operators
Start with three operators:
- NOT reverses one truth value.
- AND is true only when both inputs are true.
- OR is true when at least one input is true.
In Boolean logic, OR is inclusive. It is true when either input is true and also when both are true. XOR, or exclusive OR, handles the different rule: exactly one input must be true.
Suppose has_badge means a worker has a valid badge, and door_unlocked means the door is already unlocked.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
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
