In discrete mathematics and computer engineering, propositional logic serves as the mathematical foundation for digital circuit design, automated reasoning, and compiler optimization. This module explores how complex logical expressions can be simplified, transformed, and represented using minimal sets of operators, culminating in the concepts of functional completeness, duality, and alternative syntax notations.
A proposition is a declarative sentence that is either true ( or ) or false ( or ), but not both. Compound propositions are constructed by joining propositional variables using logical operators.
When evaluating compound propositions, we classify them based on their truth values across all possible interpretations:
Two compound propositions and are logically equivalent (denoted or ) if they have identical truth values in every row of a truth table. This is equivalent to stating that the biconditional is a tautology.
Consider the logical equivalence between the negation of an implication and a conjunction:
We can prove this equivalence using a truth table:
| | | | | | | | :---: | :---: | :---: | :---: | :---: | :---: | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Because the column for matches the column for row-by-row, the equivalence is verified.
The Duality Principle is an algebraic property of propositional logic that allows us to derive new logical equivalences from known ones without re-evaluating truth tables.
Let be a formula containing only the logical operators , , and (where negations only apply directly to variables). The dual of , denoted , is obtained by:
Note: Negation operators () remain unchanged.
Let be the formula:
To find its dual :
The power of duality lies in the Duality Theorem, which states:
This allows us to immediately assert dual equivalences. For instance, knowing the distributive law:
By applying the Duality Theorem, we obtain the second distributive law automatically:
While standard propositional logic relies heavily on , practical hardware design benefits from simpler, highly efficient universal gates. Two special connectives are central to this optimization: NAND (Sheffer stroke) and NOR (Peirce arrow).
The NAND operator is denoted by the Sheffer stroke symbol or . It represents the negation of a conjunction:
It produces a value of False if and only if both of its operands are True.
| | | | | :---: | :---: | :---: | | | | | | | | | | | | | | | | |
The NOR operator is denoted by the Peirce arrow symbol . It represents the negation of a disjunction:
It produces a value of True if and only if both of its operands are False.
| | | | | :---: | :---: | :---: | | | | | | | | | | | | | | | | |
A set of logical connectives is functionally complete if any possible truth function (or Boolean function) can be expressed using an equivalent formula containing only the connectives from that set.
Every truth table defines a boolean function. We can construct an equivalent formula for any truth table using its rows that evaluate to True. This technique is known as expressing the function in Disjunctive Normal Form (DNF). Since DNF uses only negations (), conjunctions (), and disjunctions (), the set is functionally complete.
Using De Morgan’s Laws, we can reduce this set even further:
Can we achieve functional completeness using a set containing only one connective? Yes. Both and are individually functionally complete.
To prove is functionally complete, we must show we can define both negation () and conjunction () using only the NAND operator:
Negation: Proof: .
To prove is functionally complete, we express negation () and disjunction () using only the NOR operator:
Negation: Proof: .
The following matrix displays how the primary operations are mapped to NAND and NOR:
| Base Operator | Expression using NAND () | Expression using NOR () | | :--- | :--- | :--- | | | | | | | | | | | | |
In standard logic expressions, we write operators between their operands (e.g., ). This is known as Infix Notation. To resolve ambiguity in complex expressions, we rely on parenthetical scoping and operator precedence.
Alternatively, we can express logical formulas without parentheses using prefix and postfix notations, often termed Polish Notations.
When parentheses are omitted, the order of evaluation is dictated by the standard operator hierarchy:
For example, is implicitly parsed as .
An Abstract Syntax Tree is a binary tree representing the syntactic structure of an expression. Leaf nodes represent propositional variables, while internal nodes represent operators.
For the infix expression:
We construct the syntax tree below:
[ -> ]
/ \
[ v ] [ ^ ]
/ \ / \
P [~] R S
|
QUsing this tree, we can generate all three notations:
The following Python code demonstrates the execution of functionally complete systems. It defines a baseline nand_gate and builds the standard operators (not, and, or, implies) exclusively from it, evaluating a compound proposition.
"""
Logic Gate Simulator using Functionally Complete Operators.
This module demonstrates how any logical operation can be constructed
using ONLY the primitive NAND operation.
"""
def nand_gate(p: bool, q: bool) -> bool:
"""The universal Sheffer Stroke (NAND) gate."""
return not (p and q)
# --- Constructing basic gates from NAND ---
def logical_not(p: bool) -> bool:
"""Negation: NOT P = P NAND P"""
return nand_gate(p, p)
def logical_and(p: bool, q: bool) -> bool:
"""Conjunction: P AND Q = (P NAND Q) NAND (P NAND Q)"""
temp = nand_gate(p, q)
return nand_gate(temp, temp)
def logical_or(p: bool, q:
A set of logical connectives is functionally complete if every possible truth function can be expressed using only the connectives from that set.
Represented as '|' or '↑', it outputs false if and only if both operands are true; it is a singleton functionally complete operator.
Represented as '↓', it outputs true if and only if both operands are false; it is another singleton functionally complete operator.
For any logical formula, its dual is obtained by swapping conjunction with disjunction, and true with false, preserving equivalence structures.
A parenthesized-free notation system (prefix or postfix) used to represent propositional formulas unambiguously based on operator precedence.
Test your understanding with 5 questions
Which of the following sets of connectives is NOT functionally complete?
What is the dual of the compound proposition (P \wedge Q) \vee \neg R?
How is the negation \neg P represented using only the Sheffer stroke (\uparrow)?
Which of the following defines the Peirce arrow (NOR, \downarrow)?
What is the Polish prefix notation for the logical formula (P \vee \neg Q) \rightarrow R?
Conjunction: Proof: .
Disjunction: Proof: .
Disjunction: Proof: .
Conjunction: Proof: .
6 Modules
6 Modules