Logic & Proofs · AI-Powered · Free

Logic & Proof Solver
Formal Proofs, Truth Tables, Inference

Construct formal mathematical proofs step by step. Verify logical equivalence, generate truth tables, and solve propositional logic problems. Free for CS and math students.

AND OR ¬ NOT IMPLIES IFF FOR ALL EXISTS XOR
logic-proof-solver.js · active
Insert:

Describe the conditional statement to prove. The solver will assume its negation and derive a contradiction.

Parsing logical structure…
Selecting proof strategy…
Constructing formal proof…
✓ Proof Complete Proof by Contradiction
🔓
Complete Proof Ready
Full formal proof with every inference rule, logical justification, and conclusion.
Get Full Solution Free →
Free Instant No signup

All Proof Methods Supported

Click any card to load an example into the solver.

Direct Proof
Use when: P → Q with clear chain
Assume P is true and derive Q through a sequence of logical steps. Each step follows from definitions, axioms, or previously proven results.
Proof by Contradiction
Use when: negation leads to absurdity
Assume the statement is false (assume ¬P). Derive a logical contradiction. Conclude the original statement must be true.
¬q→¬p
Proof by Contrapositive
Use when: ¬Q → ¬P is easier
Instead of proving P → Q, prove the logically equivalent ¬Q → ¬P. Often simpler when the negation of the conclusion is a strong assumption.
n+1
Mathematical Induction
Use when: statement holds for all n ∈ ℕ
Prove base case P(1). Assume P(k) (inductive hypothesis). Prove P(k+1) using P(k). Conclude P(n) holds for all natural numbers.
T/F
Truth Table
Use when: verifying tautologies
Enumerate all possible truth assignments for each variable. Evaluate the formula for each row. A tautology is true in every row; a contradiction false in all.
Logical Equivalence
Use when: showing P ≡ Q
Verify that two formulas have identical truth values for all variable assignments, or prove equivalence algebraically using known logical identities.

Logical Inference Rules

The solver labels every step with the inference rule applied. These are the rules it uses.

Modus Ponens
p → q
p
∴ q
If P implies Q and P is true, then Q is true.
Modus Tollens
p → q
¬q
∴ ¬p
If P implies Q and Q is false, then P is false.
Hypothetical Syllogism
p → q
q → r
∴ p → r
Transitivity of implication.
Disjunctive Syllogism
p ∨ q
¬p
∴ q
If one disjunct is false, the other is true.
Addition
p
∴ p ∨ q
A true proposition can be disjoined with anything.
Simplification
p ∧ q
∴ p
From a conjunction, either conjunct follows.
Conjunction
p
q
∴ p ∧ q
Two true propositions can be conjoined.
De Morgan’s Laws
¬(p ∧ q) ≡ ¬p ∨ ¬q
¬(p ∨ q) ≡ ¬p ∧ ¬q
Distribute negation over conjunction or disjunction.

Frequently Asked Questions

What proof methods does the solver support?+
The solver supports direct proof, proof by contradiction (reductio ad absurdum), proof by contrapositive, weak and strong mathematical induction, truth table verification, and logical equivalence checking. Each method produces a labeled step-by-step formal proof.
How do I enter logical formulas?+
Use the symbol toolbar to insert symbols directly, or type text equivalents: & or “and” for ∧, | or “or” for ∨, ~ or “not” for ¬, -> for →, <-> for ↔. You can also describe the statement in plain English and the solver will parse it.
What is the difference between proof by contradiction and proof by contrapositive?+
Proof by contrapositive proves P → Q by instead proving ¬Q → ¬P, which is logically equivalent. Proof by contradiction assumes ¬(P → Q) — i.e., that P is true and Q is false — and derives a contradiction (⊥). Both are indirect proofs, but contradiction can prove statements that aren’t implications, while contrapositive only works for conditionals.
How does mathematical induction work?+
Induction has two parts. First, the base case: prove the statement P(1) is true. Second, the inductive step: assume P(k) is true (the inductive hypothesis) and prove P(k+1). By the principle of induction, P(n) holds for all natural numbers n ≥ 1. The solver shows both parts separately with all algebraic steps.
What is a tautology vs. a contradiction?+
A tautology is a formula that is true for every possible truth assignment of its variables — for example, p ∨ ¬p. A contradiction (unsatisfiable formula) is false for every truth assignment — for example, p ∧ ¬p. The truth table solver identifies which category a formula falls into.
Can it verify if two formulas are logically equivalent?+
Yes. Select “Equivalence Check” mode, enter the two formulas, and the solver constructs a combined truth table and compares the final column for each formula. If they match for all variable combinations, the formulas are logically equivalent.

Logic and Proof Solver — Formal Proofs with Every Step Labeled

This solver handles the full range of formal proof problems that appear in discrete mathematics, mathematical logic, and theoretical computer science courses. The key difference from a general AI assistant is that every step in the output is labeled with the specific inference rule, theorem, or definition applied — which is exactly what professors expect in formal proof assignments and what students need to understand where their reasoning breaks down.

You can input a statement in plain English, in symbolic notation, or in a mix of both. The solver identifies the type of statement and selects the most appropriate proof strategy automatically, or you can select the proof method yourself from the mode selector.

Choosing the Right Proof Technique

One of the hardest parts of discrete math proofs is knowing which technique to apply. The choice depends on the structure of the statement being proved. Here is a guide to matching statement types to proof methods:

Statement TypeRecommended MethodWhy
P → Q (direct chain)Direct proofAssume P, derive Q step by step — simplest when Q follows naturally
P → Q (hard to derive Q)Contrapositive (¬Q → ¬P)Negation of conclusion gives a strong assumption to work with
P → Q (negation gives contradiction)ContradictionAssume P and ¬Q, derive ⊥ — works when irrationality or impossibility is involved
∀n ∈ ℕ, P(n)Mathematical inductionStatements about all natural numbers require base case + inductive step
Verify formula is tautologyTruth tableEnumerate all variable assignments — definitive for propositional logic
Show P ≡ QEquivalence / truth tableCompare truth tables column by column, or use algebraic laws

De Morgan’s Laws and Other Logical Equivalences

Logical equivalences are identities that allow you to rewrite formulas into equivalent forms. They are essential tools in formal proofs and Boolean algebra simplification. The most commonly needed equivalences in proof construction include:

  • De Morgan’s laws: ¬(p ∧ q) ≡ ¬p ∨ ¬q, and ¬(p ∨ q) ≡ ¬p ∧ ¬q — used constantly when negating compound statements
  • Implication rewriting: p → q ≡ ¬p ∨ q — allows converting implications to disjunctions for algebraic manipulation
  • Contrapositive equivalence: p → q ≡ ¬q → ¬p — the basis of proof by contrapositive
  • Double negation: ¬¬p ≡ p — simplifies negated negations in contradiction proofs
  • Distributive laws: p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r) — useful when expanding compound propositions
  • Absorption: p ∨ (p ∧ q) ≡ p — simplifies formulas with redundant subexpressions

The solver applies these identities automatically at the relevant steps and cites which law was used, making it easy to follow and replicate the reasoning.

Common Errors in Formal Proofs

Students learning to write formal proofs make a consistent set of errors. Recognizing these patterns helps avoid them before submitting work:

  • Circular reasoning — using the conclusion as a step in the proof without independently establishing it
  • Proving the converse instead of the original statement — proving Q → P when asked for P → Q
  • In proof by contradiction, forgetting to explicitly state what the contradiction is — the proof must identify the specific ⊥ derived
  • In induction, not clearly stating the inductive hypothesis before using it — the hypothesis must be named and bounded (P(k), not P(n))
  • Treating the inductive step as P(k+1) → P(k) instead of P(k) → P(k+1) — the direction is forward, not backward
  • In truth tables, missing rows — a formula with n variables requires exactly 2ⁿ rows

Ready to Prove Your Theorem?

Enter your statement above or access full formal proofs with every step labeled.

Get Full Solution Free →
Scroll to Top