Rules of Inference Calculator online

Versión en español →

Propositional logic · Free · No sign-up

Rules of inference calculator with step-by-step proofs

Type your premises and the conclusion and get the proof line by line, applying the rules of inference directly to the formulas: modus ponens, modus tollens, syllogisms, simplification and more. And if the argument is not valid, you get the counterexample that breaks it.

Check whether your argument is valid

Use the buttons if you can’t type the symbols
Operators
Variables
Examples: P→Q · Q→R · P ⊢ R (P∨Q)→R · ¬R · S→P ⊢ ¬S P∨Q · ¬P · Q→R ⊢ R P→Q · P∧S ⊢ S∧Q (¬P∨¬Q)→(R∧S) · R→T · ¬T ⊢ P P→Q · Q→R · S→R ⊢ (P∨S)→R P→Q · Q ⊢ P (fallacy)
AD SPACE

What are rules of inference?

A rule of inference is a step you can always take without risk of getting it wrong: if the formulas you start from are true, the one you get is true as well. That’s all. Chaining steps like these is how you build a proof.

An argument has two parts: the premises (or hypotheses), which we take as given, and the conclusion, which we want to justify. It is usually written with the symbol ⊢:

P → Q,  Q → R,  P  ⊢  R


An argument is valid when it is impossible for all the premises to be true and the conclusion false. Careful: valid does not mean “true”. An argument can be flawless and still start from false premises; what we check here is the reasoning, not the facts.

The rules of inference, one by one

These are the ones you use in practically every exercise. In each pattern, what is above the line are the premises, and what is below it (after ∴, “therefore”) is what you can deduce:

RulePatternWhat it says
Modus ponensPP → Q∴ QIf P is true and P leads to Q, then Q is true. It is the most used step of all.
Modus tollens¬QP → Q∴ ¬PIf P led to Q and Q doesn’t hold, then P doesn’t either. You reason backwards.
Hypothetical syllogismP → QQ → R∴ P → RTwo implications that fit together chain into one, skipping the middle step.
Disjunctive syllogismP ∨ Q¬P∴ QIf one of the two holds and you rule one out, it has to be the other.
ResolutionA ∨ B¬B ∨ C∴ A ∨ CDisjunctive syllogism, but when what rules out the member is not a single formula but another “or”. You cross out the opposite pair and join what’s left. It is the rule behind the resolution method, and here it is only used when the others aren’t enough.
SimplificationP ∧ Q∴ PFrom an “and” you can keep either of the two parts on its own. If the “and” sits inside an implication, as in A → (B ∧ C), you first distribute it into (A → B) ∧ (A → C) and then you can keep A → B.
ConjunctionPQ∴ P ∧ QThe opposite: two things you have separately can be joined with an “and”.
AdditionP∴ P ∨ QIf P is true, “P or anything” is true as well: an “or” only needs one side to hold.

The equivalences you need along the way

Besides the rules above, there are rewrites that don’t deduce anything new: they say the same thing in a different way. The calculator applies them on its own when they’re needed, and flags them in the proof:

  • Material implication: P → Q is equivalent to ¬P ∨ Q. Read the other way round, a disjunction P ∨ Q is the same as ¬P → Q, which lets you bring an “or” into a chain of syllogisms.
  • Contraposition: P → Q is equivalent to ¬Q → ¬P.
  • De Morgan’s laws: ¬(P ∧ Q) is equivalent to ¬P ∨ ¬Q, and ¬(P ∨ Q) is equivalent to ¬P ∧ ¬Q.
  • Double negation: ¬¬P is the same as P.
  • Idempotence: P ∨ P is equivalent to P, and so is P ∧ P. It shows up more than you’d think: if you reach P → ¬P, by material implication that is ¬P ∨ ¬P, that is, ¬P. If something leads to its own negation, it is false.
  • Negated implication: ¬(P → Q) is equivalent to P ∧ ¬Q.
  • Distribution of implication: there are four, and they’re worth keeping at hand because they unlock half the course.
    • (P ∨ Q) → R is equivalent to (P → R) ∧ (Q → R)
    • P → (Q ∧ R) is equivalent to (P → Q) ∧ (P → R)
    • P → (Q ∨ R) is equivalent to (P → Q) ∨ (P → R)
    • (P ∧ Q) → R is equivalent to (P → R) ∨ (Q → R)
    Notice the pattern: when you distribute, the connective of the consequent stays the same and the one of the antecedent flips. They work both ways: to split a long premise into manageable pieces, and to assemble the conclusion at the end.
  • Definition of the biconditional: P ↔ Q is equivalent to (P → Q) ∧ (Q → P).
  • Exclusive or: P ⊕ Q is equivalent to (P ∨ Q) ∧ ¬(P ∧ Q).

Two you’ll miss a lot if you forget them: De Morgan, because as soon as a modus tollens leaves you with something like ¬(P ∨ Q) you need to turn it into ¬P ∧ ¬Q to keep going; and material implication, which is what lets you use a loose disjunction as if it were an implication. For example, from P → ¬Q and Q ∨ R you get P → R: just read Q ∨ R as ¬Q → R and chain a hypothetical syllogism.

How to solve an exercise step by step

There’s no guesswork involved: almost every exercise works out with this order.

Step 1 · Identify the premises and the conclusion

Separate what you’re given from what you have to justify. If the exercise gives you a single formula A → B, the left side holds the premises and the right side is the conclusion.

Step 2 · Break the premises down

Before combining anything, make the premises as simple as possible: split conjunctions by simplification, expand biconditionals and apply De Morgan wherever a negation sits outside a parenthesis. The more loose formulas you have, the easier it is for a rule to fit.

Step 3 · Chain rules forward

Look for pairs that fit a rule and keep writing new lines, numbered and with the name of the rule next to them. The usual approach is to start with modus ponens (you have the antecedent of an implication), continue with modus tollens (you have the consequent negated) and finish with disjunctive syllogisms when you’re left with a disjunction and the negation of one of its sides.

Step 4 · Build the conclusion

Look at what you need to reach. If the conclusion is a conjunction such as S ∧ Q, don’t look for it whole: get S on one side and Q on the other and join them with the conjunction rule. And if it’s a disjunction such as Q ∨ Z, it’s enough to get one of the two sides and add the other by addition.

Step 5 · If it doesn’t work, question the argument

If you’ve run out of possible combinations, the argument may simply not be valid. To check, look for a counterexample: an assignment of true and false to each variable that makes every premise true and the conclusion false. If you find one, that’s it: there is no possible proof, however hard you try. The calculator always runs this check, and when the argument is not valid it shows you the counterexample with every premise substituted and evaluated, so you can see exactly where it breaks.

Worked example, step by step

Let’s look at a typical exam exercise:

“Prove that ¬S follows from the hypotheses/premises (P ∨ Q) → R, ¬R and S → P, using rules of inference.”

  1. Step 1 — We identify the premises and the conclusion.
    They are given explicitly: three premises, and we have to reach ¬S.
    (1)(P ∨ Q) → RPremise
    (2)¬RPremise
    (3)S → PPremise
  2. Step 2 — We break down what we can.
    There’s no conjunction to split here, so we go straight to combining.
  3. Step 3 — We chain rules.
    In (1) the consequent is R, and (2) tells us exactly that R is false: that’s a modus tollens. What we get, ¬(P ∨ Q), isn’t useful yet, so we apply De Morgan and keep the part we care about.
    (4)¬(P ∨ Q)Modus tollens from (2) and (1)
    (5)¬P ∧ ¬QDe Morgan on (4)
    (6)¬PSimplification of (5)
  4. Step 4 — We reach the conclusion.
    We now have ¬P, and (3) says that S leads to P. One more modus tollens and we’re done.
    (7)¬SModus tollens from (6) and (3) → it is the conclusion
    We’ve reached ¬S starting only from the premises, so the argument is valid.

Notice that ¬Q could also be taken from line (5), but it wasn’t needed at all. That’s normal: a proof only includes the steps that lead somewhere, and the calculator does the same.

What if the argument is valid but I can’t prove it?

It happens, and it isn’t always your fault. These rules work forward: they combine what you already have. Some valid arguments need a different kind of move, mainly two: assuming the antecedent (to prove A → B you assume A, reach B and discharge the assumption) and reasoning by cases (if you know P ∨ Q, look at what happens assuming P and what happens assuming Q). A simple example that doesn’t come out with the table alone: (P ∧ Q) → R ⊢ P → (Q → R). Be aware this is rarer than it seems: almost every conclusion of the form A → B comes out without assuming anything, using contraposition, material implication or the four distribution laws above, and the calculator does all of that on its own.

When the calculator runs into that situation it tells you plainly, instead of telling you the argument is false: it shows how far it got with the rules, checks validity on its own by evaluating every possible case, and lets you know that the argument is valid even though it didn’t find the proof.

Frequently asked questions

How is this different from the resolution method?

Here the rules are applied to the formulas exactly as they are written, with their usual names (modus ponens, modus tollens, syllogisms…). In the resolution method you first turn everything into conjunctive normal form, work with clauses, and almost every step ends up being called “resolution”. Both are correct; resolution is more mechanical and complete, while this one is closer to what you’re asked to do in class when the exercise says “using rules of inference”.

Do I have to convert the formulas to conjunctive normal form?

No, and that’s the whole point of this calculator. The premises are used as you type them. The only things rewritten are the unavoidable equivalences (double negation, De Morgan, biconditional), and they always appear flagged as one more step of the proof.

Why does it sometimes say “valid, but no proof”?

Because the basic rules aren’t enough for every valid argument: some need you to assume the antecedent or reason by cases. When that happens, the calculator checks validity by evaluating every possible case and lets you know the argument is valid, even though it couldn’t prove it with these rules. That’s more honest than telling you it’s false.

How do I know an argument is not valid?

With a counterexample: an assignment of true and false to the variables that makes every premise true and the conclusion false. If even one exists, the argument is not valid and no proof will ever work. The calculator shows it to you directly.

Which symbols can I use?

The ones on the buttons (¬ ∧ ∨ → ↔ ⊕) and their keyboard versions too: ! or ~ for negation, & or /\ for conjunction, \/ for disjunction, -> for implication and <-> for the biconditional. Variables can be any letter (A, B, x, y…) or names like p1, p2.

Go up