Logical Equivalence Checker
Test whether two propositional logic expressions produce identical truth values across all variable assignments.
About this calculator
This calculator builds the full truth table for two propositional-logic expressions and reports whether they agree on every row. Expression 1 and Expression 2 are each a single operator code — 1 for AND, 2 for OR, 3 for XOR, 4 for IMPLIES, 5 for NAND (evalOp's switch statement, lines 11-18) — and Number of Variables (2 to 4) sets how many rows the table has: rowCount = 2^variableCount (line 8). For more than two variables, evalRow does not evaluate a genuine n-ary version of the chosen operator; it folds the operator pairwise, left to right, across the bits (lines 21-31) — result starts as bits[0], then repeatedly combines with the next bit. That distinction only matters for operators that aren't associative: AND, OR, and XOR give the same answer whichever way you fold them, but IMPLIES and NAND do not, so a three- or four-variable IMPLIES or NAND comparison here reflects that specific left-to-right fold, not a single canonical multi-variable definition — there isn't one.
Matching Rows counts how many of the rowCount truth-table rows produce identical outputs for both expressions, and the two are only reported Equivalent when every row matches. Expression 1 and Number of Variables both default to values that genuinely round back to themselves under a ±10% nudge (Math.round(1.1) and Math.round(0.9) are both 1; Math.round(2.2) and Math.round(1.8) are both 2), so a proportional sensitivity check reads no effect from either. Expression 2 is different: its default of 5 only rounds back to itself on the −10% side (4.5 → 5, still NAND); the +10% side computes Math.round(5.5) = 6, which is outside the calculator's declared 1-5 range and falls through evalOp's switch statement to its default: case (line 17) — coded identically to case 1 (AND) — silently aliasing NAND to AND rather than exercising a genuine sixth operator. A genuinely different, in-range code, like switching Expression 2 from NAND to OR, absolutely changes the result.
Inputs
Results
Equivalent (1=Yes)
0
Matching Rows
0
How to Use This Calculator
- Select the operator (1=AND, 2=OR, 3=XOR, 4=IMPLIES, 5=NAND) for Expression 1 and Expression 2.
- Set the Number of Variables (2 to 4) to generate the full truth table for both expressions.
- Review Matching Rows and Different Rows to see how many of the truth table's rows the two expressions agree on.
- If the truth values match for all inputs, the expressions are logically equivalent.
- Use the equivalence check to simplify complex propositions in proofs or circuit design.
How the result changes with Expression 2 (1=AND, 2=OR, 3=XOR, 4=IMPLIES, 5=NAND)
| Expression 2 (1=AND, 2=OR, 3=XOR, 4=IMPLIES, 5=NAND) | Equivalent (1=Yes) | Matching Rows |
|---|---|---|
| 2.5 | 0 | 1 |
| 3.75 | 0 | 2 |
| 5 | 0 | 0 |
What each input means
- Expression 1 (1=AND, 2=OR, 3=XOR, 4=IMPLIES, 5=NAND)
- Logical operation for the first expression
- Expression 2 (1=AND, 2=OR, 3=XOR, 4=IMPLIES, 5=NAND)
- Logical operation for the second expression
- Number of Variables
- Number of propositional variables shared between both expressions
How this is calculated
Worked example, using the default values
- Identify Input ParametersExpression 1 (1=AND, 2=OR, 3=XOR, 4=IMPLIES, 5=NAND) = 1, Expression 2 (1=AND, 2=OR, 3=XOR, 4=IMPLIES, 5=NAND) = 5, Number of Variables = 2 = 3 input(s) provided
- Calculate EquivalentEquivalent0 = 0
- Calculate Matching RowsMatching Rows0 = 0
- Calculate Different RowsDifferent Rows4 = 4
- Calculate Match PercentageMatch Percentage0 = 0
Engine last updated . Checked against 5 independently-derived tests — how we verify calculators. Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.
Frequently Asked Questions
What do the numbers 1-5 mean for Expression 1 and Expression 2?
They each select a single logical operator: 1 is AND, 2 is OR, 3 is XOR, 4 is IMPLIES, and 5 is NAND (evalOp's switch statement, lines 11-18). The default pairing (1 and 5) compares AND against NAND, which is why they disagree on every row of the default 2-variable table.
With 3 or 4 variables, does the calculator evaluate a true multi-variable IMPLIES or NAND?
Not exactly. evalRow folds the chosen operator pairwise across the bits from left to right (lines 21-31), and because IMPLIES and NAND aren't associative, that left-to-right fold is one specific way to combine three or more variables, not the only mathematically valid one — AND, OR, and XOR don't have this ambiguity since they're associative.
Why does nudging Number of Variables up or down slightly show no effect on the results?
Number of Variables defaults to 2, and a small proportional nudge lands on 2.2 and 1.8, both of which round back to 2 (Math.round, line 6) — the probe happens to land on the same integer both times. Picking a genuinely different value like 3 or 4 in the input itself does change the row count and can change whether the expressions are equivalent.
What does "Match Percentage" tell me beyond the Equivalent yes/no answer?
Match Percentage is Matching Rows divided by Total Rows (line 46), so two expressions that disagree on only one row out of a 16-row, 4-variable table still show a high match percentage (93.75%) even though they are not, strictly, logically equivalent — useful for judging "close" versus "totally different" expressions.
Related Calculators
The questions that sit next to this one — chosen by subject, including calculators filed under a different category.
Truth Table Generator
Generate a complete truth table for propositional logic formulas with 2-4 variables and common logical operations.
Logic & Formal ReasoningBoolean Algebra Simplifier
Estimate Boolean expression simplification from sum-of-products form. Calculates term and literal reduction using grouping heuristics.
Logic & Formal ReasoningSyllogism Validator
Check the validity of categorical syllogisms by figure and mood. Identifies all 19 traditionally valid syllogistic forms.
More in Math & Statistics.