Evaluating compound logical statements allows computer scientists and mathematicians to prove system invariants, optimize digital hardware logic gates, and verify the correctness of software algorithms. This guide explores the core properties of propositional logic, detailing how logical expressions are classified, transformed, and simplified using algebra and truth tables.
A proposition (or statement) is a declarative sentence that is either strictly true () or false (), but not both. Upper-case letters (e.g., ) denote propositional variables, while their truth behavior is evaluated using logical operators.
We define truth tables for the five core logical operators that construct compound expressions:
The following master truth table synthesizes these core behaviors:
| | | | | | | | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
For any given conditional statement , we define three related logical structures:
An implication and its contrapositive are always logically equivalent ().
Converting natural language to propositional logic is crucial for modeling system specifications. Consider this safety constraint:
"You cannot ride the roller coaster () if you are under 4 feet tall () unless you are older than 16 years old ()."
The term "unless" acts as a conditional modifier meaning "if not". We represent this sentence formally as:
Alternatively, we can express this as:
We categorize compound propositions into three distinct classes based on their final truth columns in a truth table:
[Compound Propositions]
|
+-----------------+-----------------+
| | |
[ Tautology ] [ Contradiction ] [ Contingency ]
Always True Always False Mixed Values
(e.g., P v ~P) (e.g., P ^ ~P) (e.g., P -> Q)If a compound proposition is a tautology, we can generate infinitely many other tautologies from it using substitution.
A formula is a substitution instance of if is obtained by replacing variables in with other logical expressions. The primary condition is that the same expression must replace the same variable each time it occurs.
Establishing relationships between different propositions allows us to replace complex code routines or hardware logic with simplified expressions.
Two propositions and are logically equivalent if their truth values are identical in all possible cases. Formally, (or ) if and only if the biconditional statement is a tautology.
To prove that is logically equivalent to , we construct their joint truth table:
| | | | | | | | :---: | :---: | :---: | :---: | :---: | :---: | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Because the column for is identical to the column for , we prove that:
A proposition is said to logically imply (or tautologically imply) a proposition if is a tautology. We denote this as:
Rather than writing out large truth tables, we can simplify logic expressions algebraically using equivalence laws.
For any compound proposition containing only the operators , and , its dual is obtained by swapping:
Note: Negation operators () remain unchanged.
A set of logical connectives is functionally complete if every possible compound proposition can be expressed using only the connectives in that set.
We can construct single-operator systems that are functionally complete using NAND or NOR.
| | | (NAND) | (NOR) | | :---: | :---: | :---: | :---: | | | | | | | | | | | | | | | | | | | | |
Because is functionally complete on its own, we can build negation, conjunction, and disjunction using only NAND operations:
Modern computer architectures represent logical values using binary digits (bits): represents True () and represents False ().
A bit string is a sequence of zero or more bits. Bitwise operations apply logical operators to each matching position of two bit strings of equal length:
String A: 0 1 1 0 1 1 0 1 1 0
String B: 1 1 0 0 0 1 1 1 0 1
--------------------------------------
Bitwise OR: 1 1 1 0 1 1 1 1 1 1
Bitwise AND: 0 1 0 0 0 1 0 1 0 0
Bitwise XOR: 1 0 1 0 1 0 1 0 1 1Here is a short Python script demonstrating how to calculate these logical bitwise operations:
# Bitwise representation in Python
string_a = 0b0110110110
string_b = 0b1100011101
# Calculate bitwise results
bitwise_or = string_a | string_b
bitwise_and = string_a & string_b
bitwise_xor = string_a ^ string_b
# Print formatted binary strings padded to 10 bits
print(f"Bitwise OR: {bitwise_or:010b}")
print(f"Bitwise AND: {bitwise_and:010b}")
print(f"Bitwise XOR: {bitwise_xor:010b}")To limit the number of parentheses needed in complex expressions, we define a standard precedence hierarchy:
When an expression is fully parenthesized, every operator is explicitly bound by parenthesis pairs matching its hierarchical level:
Propositions can be represented in different syntactic styles depending on where the logical operator is written relative to its operands. Let's look at the compound proposition :
The operator is placed between its operands. This is the common format used in standard mathematical logic:
The operator is placed before its operands. This removes the need for grouping parentheses:
Prefix Tree Structure:
[^]
/ \
[v] [~]
/ \ |
P Q RThe operator is placed after its operands. This notation is widely used in stack-based compiler design and interpreter architectures:
Classification of compound propositions based on their truth values: tautologies are always true, contradictions are always false, and contingencies can be either.
Two compound propositions are logically equivalent if they possess identical truth values under all possible truth assignments.
A compound proposition obtained by uniformly substituting other logical formulas for the variables within a known valid formula.
A set of logical connectives is functionally complete if every possible boolean function can be expressed using only those connectives.
A fundamental transformation mapping logical formulas containing only conjunction, disjunction, and negation to their dual form by swapping operations and identity values.
Test your understanding with 5 questions
Which of the following represents a valid substitution instance of the tautology P -> (Q -> P)?
What is the dual of the compound proposition (P v T) ^ (Q v ~R)?
Which of the following sets of connectives is NOT functionally complete?
How can the negation of a proposition, ~p, be represented using only the logical NOR (↓) operator?
What is the postfix representation (Reverse Polish Notation) of the infix expression (P v Q) ^ ~R?
6 Modules
6 Modules