Generate complete truth tables for any Boolean expression. Supports AND, OR, NOT, XOR, and IMPLIES (→) operators with up to 6 variables. Instant results, interactive & educational.
This verification table shows the truth values for the expression: (p → q) ∧ q
| p | q | (p → q) ∧ q |
|---|---|---|
| F | F | F |
| F | T | T |
| T | F | F |
| T | T | T |
Analysis: The expression is true in 2 out of 4 cases (50.0%). This expression is contingent (true in some cases, false in others).
A truth table is a mathematical table used in logic—specifically in Boolean algebra and digital circuit design—to list all possible combinations of truth values (True/False or 1/0) for input variables, alongside the resulting output of a logical expression. Truth tables form the foundation of propositional calculus, computer architecture, and algorithmic reasoning.
For any Boolean function f(x₁, x₂, ..., xₙ), the truth table exhaustively maps 2ⁿ possible input states to the output.
Operators supported:
AND (∧) : true only if both operands true
OR (∨) : true if at least one operand true
NOT (¬) : inverts truth value
XOR (⊕) : true if operands differ
IMPLIES (→) : false only when antecedent true and consequent false (p→q ≡ ¬p ∨ q)
IFF (↔) : true if both operands have same truth value (biconditional)
eval risk.A 2‑to‑1 multiplexer selects between two inputs (A, B) based on a control signal (S). Its Boolean expression: Output = (¬S ∧ A) ∨ (S ∧ B). Using this tool with variables (S, A, B), you can verify all 8 scenarios, confirming that when S=0, Output=A, and when S=1, Output=B.
Validate complex conditionals in programming: if ((user.isAdmin || user.isModerator) && (post.isPublic || overrideFlag)) { ... }. Model as (A ∨ B) ∧ (C ∨ D) with 4 variables, generating 16 rows to ensure all access‑control cases are handled correctly.
Consider a simplified intersection controller with sensors: CarA (vehicle on road A), CarB (vehicle on road B), and a Timer override. The green light for road A activates if CarA is present AND (CarB is absent OR Timer is active): GreenA = CarA ∧ (¬CarB ∨ Timer). Generate the truth table to verify all 8 scenarios.
You might wonder: why only these operators? The sets {NOT, AND} or {NOT, OR} are each functionally complete—they can express any Boolean function. Our tool provides {NOT, AND, OR, XOR, IMPLIES, IFF} for intuitive expression.
Use this tool to verify equivalences like: p XOR q ≡ (p ∨ q) ∧ ¬(p ∧ q) and p → q ≡ ¬p ∨ q.
| Equivalence | Description |
|---|---|
| p → q ≡ ¬p ∨ q | Implication to OR |
| p ↔ q ≡ (p → q) ∧ (q → p) | Biconditional definition |
| ¬(p ∧ q) ≡ ¬p ∨ ¬q | De Morgan's Law (AND) |
| ¬(p ∨ q) ≡ ¬p ∧ ¬q | De Morgan's Law (OR) |
| p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) | Distributive (OR over AND) |
| p XOR q ≡ (p ∨ q) ∧ ¬(p ∧ q) | XOR definition |
| p ↔ q ≡ (p ∧ q) ∨ (¬p ∧ ¬q) | Biconditional equivalence |
Complexity note: Generating a truth table for n variables requires O(2ⁿ) computations. For n=6, that's 64 rows; for n=10, 1024 rows. Our tool limits to 6 variables for real‑time responsiveness. For complex expressions, use Karnaugh Maps for simplification.
expr1 ↔ expr2 (biconditional). If the result is a tautology (all True), they are equivalent.