← Back to Blog

COMP-2310 Proof Guide

Justin Bornais
education computer-science

What is a Proof?

In order to succeed in COMP2310, you need to have a good understanding of proofs. Here’s the definition of a proof from the courseware:

A derivation or proof of a wff α\alpha from a set of wffs Γ\Gamma in propositional logic is a sequence of wffs, α1,α2,,αn\alpha_1,\alpha_2,\dots,\alpha_n such that αn=α\alpha_n=\alpha, and for each i,  1ini,\;1\leq i\leq n,

  1. αi\alpha_i is a wff in Γ\Gamma, or
  2. αi\alpha_i is of the form ωω\omega\lor\sim\omega, called axiom, where ω\omega is a wff, or
  3. αi\alpha_i is a direct consequence of some of the preceding wffs by substitution or by virtue of one of the inference rules.

This definition perfectly describes a proof. What it translates to is this:

  • A proof involves deriving some wff α\alpha from a set of wffs called Γ\Gamma. Effectively, Γ\Gamma can be understood as your list of premises that you already know, while α\alpha is whatever you are trying to prove.
  • The “sequence of wffs, α1,α2,,αn\alpha_1,\alpha_2,\dots,\alpha_n such that αn=α\alpha_n=\alpha” simply means a proof contains many lines such that the last line is what you are trying to prove, which is α\alpha.
  • Each line of the proof must meet one of the three conditions:
    1. It must be one of the premises you start with (it’s a wff in Γ\Gamma).
    2. It must be the axiom, which is ωω\omega\lor\sim\omega where ω\omega is any wff. For example: (αβ)(αβ)(\alpha\land\sim\beta)\lor\sim(\alpha\land\sim\beta) is a valid line.
    3. It must be the result of applying an equivalence or inference rule on a previous line.

Tips when Writing Proofs

When writing proofs, follow these general tips:

  1. Write your proof method at the top of the proof, before proceeding, in parentheses.
    • If you are simply doing a proof by definition, without using a method, then no proof method is needed.
  2. Always state your justification for each line.
    • If you applied an equivalence or inference rule, state the line you applied it to. If you applied E10 on line 3, write “3, E10”.
    • If you are stating the premise in a direct proof or proof by contraposition, write “Premise”.
    • If you are stating the hypothesis in a proof by contradiction or vacuous proof, write “Hypothesis”.
    • If you are stating the assumption in an indirect proof, write “Assumption”.
    • If you are writing a given premise from Γ\Gamma, write “from Γ\Gamma.
    • If you are writing the axiom ωω\omega\lor\sim\omega, write “axiom”.
  3. Don’t apply two equivalences/inference rules on the same line. Do one equivalence or inference rule at a time. Otherwise, you are skipping steps and marks will be deducted.
  4. Don’t apply the same equivalence twice on the same line. Do one at a time.
    • If you have (pq)(rs)(p\lor q)\land(r\lor s), you may be tempted to write ”(qp)(sr)(q\lor p)\land(s\lor r) 1, E10” as the next line. However, E10 was applied twice here. Instead, apply E10 once per line, or marks will be deducted.

Proof Methods

There are many proof methods to discuss.

Direct Proof

This is one of the most common proofs. The exact form in the courseware is:

To prove that (αβ)\vdash(\alpha\Rightarrow\beta), we may prove that αβ\alpha\vdash\beta. i.e. we may derive a proof of β\beta from α\alpha.

This effectively means, if the wff we are trying to prove is of the form αβ\alpha\Rightarrow\beta, then we can assume α\alpha (call it the premise) and prove β\beta.

Example

Prove the following: ((pr)(rq))(pq)\vdash((p\Rightarrow r)\land(r\Rightarrow q))\Rightarrow(p\Rightarrow q).

This is of the form αβ\alpha\Rightarrow\beta, where α\alpha is (pr)(rq)(p\Rightarrow r)\land(r\Rightarrow q) and β\beta is pqp\Rightarrow q. Here is a solution:

(Direct proof)
1. (pr)(rq)(p\Rightarrow r)\land(r\Rightarrow q)\quad Premise
2. prp\Rightarrow r\quad 1, I2
3. (rq)(pr)(r\Rightarrow q)\land(p\Rightarrow r)\quad 1, E9
4. rqr\Rightarrow q\quad 3, I2
5. pqp\Rightarrow q\quad 2, 4, I5

Thus ((pr)(rq))(pq)((p\Rightarrow r)\land(r\Rightarrow q))\Rightarrow(p\Rightarrow q)\qquad\blacksquare

Proof by Contradiction

This is probably the second most common proof. The exact form in the courseware is:

To prove that ω\vdash\omega, we may proceed to prove that ωfalse\sim\omega\vdash false.

This means, if we’re trying to prove something (i.e. ω\omega), we can assume the negation (ω\sim\omega) and show that we eventually lead to false.

Example

Prove the following: ((pr)(rq))(pq)\vdash((p\Rightarrow r)\land(r\Rightarrow q))\Rightarrow(p\Rightarrow q).

(Proof by Contradiction)
1. ((pr)(rq))(pq)((p\Rightarrow r)\land(r\Rightarrow q))\land\sim(p\Rightarrow q)\quad Hypothesis
2. (pr)(rq)(p\Rightarrow r)\land(r\Rightarrow q)\quad 1, I2
3. prp\Rightarrow r\quad 2, I2
4. (rq)(pr)(r\Rightarrow q)\land(p\Rightarrow r)\quad 2, E9
5. rqr\Rightarrow q\quad 4, I2
6. pqp\Rightarrow q\quad 3, 5, I5
7. (pq)((pr)(rq))\sim(p\Rightarrow q)\land((p\Rightarrow r)\land(r\Rightarrow q))\quad 1, E9
8. (pq)\sim(p\Rightarrow q)\quad 7, I2
9. (pq)(pq)(p\Rightarrow q)\land\sim(p\Rightarrow q)\quad 6, 8, I6
10. falsefalse\quad 9, E1

Thus ((pr)(rq))(pq)((p\Rightarrow r)\land(r\Rightarrow q))\Rightarrow(p\Rightarrow q)\qquad\blacksquare

Indirect Proof

This proof is used sparingly, but is also beneficial to know. The exact form in the courseware is:

To prove that (αβ)\vdash(\alpha\Rightarrow\beta), we may proceed to prove that (βα)\vdash(\sim\beta\Rightarrow\sim\alpha).

This is effectively the opposite of a direct proof. We prove its contrapositive instead. Then, you proceed with the proof using another proof method.

Example

Prove the following: (pp)p\vdash(\sim p\Rightarrow p)\Rightarrow p

(Indirect proof) We shall prove that p(pp)\vdash\sim p\Rightarrow\sim(\sim p\Rightarrow p)

(Direct proof)
1. p\sim p\quad Assumption
2. (pp)\sim(p\lor p)\quad 1, E4
3. (pp)\sim(\sim p\lor p)\quad 2, E15
4. (pp)\sim(\sim p\Rightarrow p)\quad 4, E18

Thus p(pp)\vdash\sim p\Rightarrow\sim(\sim p\Rightarrow p).

Consequently, (pp)p\vdash(\sim p\Rightarrow p)\Rightarrow p\qquad\blacksquare

See how there’s two conclusion statements? That’s because we have to show we finished the direct proof, then we have to finish the indirect proof.

Proof by Cases

This is useful in later chapters, primarily chapters 4-7. The exact form in the courseware is:

To prove that (α1α2αk)β\vdash(\alpha_1\lor\alpha_2\lor\dots\lor\alpha_k)\Rightarrow\beta, we may proceed to prove that α1β\vdash\alpha_1\Rightarrow\beta and α2β\vdash\alpha_2\Rightarrow\beta and \dots and αkβ\vdash\alpha_k\Rightarrow\beta.

Then with each case, you need to specify a proof method and prove each case.

Note

The order of cases doesn’t matter.

Example

Prove the following: ((pp)((pq)q))p\vdash((\sim p\Rightarrow p)\lor((\sim p\Rightarrow q)\land\sim q))\Rightarrow p.

(Proof by Cases)

Case 1: Prove that (pp)p\vdash(\sim p\Rightarrow p)\Rightarrow p. (see the Indirect Proof example above)

Case 2: Prove that ((pq)q)p\vdash((\sim p\Rightarrow q)\land\sim q)\Rightarrow p.

(Direct proof)
1. (pq)q(\sim p\Rightarrow q)\land\sim q\quad Premise
2. pq\sim p\Rightarrow q\quad 1, I2
3. q(pq)\sim q\land (\sim p\Rightarrow q)\quad 1, E9
4. q\sim q\quad 3, I2
5. p\sim p\quad 4, 2, I4
6. pp\quad 5, E15

Hence ((pq)q)p\vdash((\sim p\Rightarrow q)\land\sim q)\Rightarrow p.

Thus, ((pp)((pq)q))p\vdash((\sim p\Rightarrow p)\lor((\sim p\Rightarrow q)\land\sim q))\Rightarrow p\qquad\blacksquare

Bidirectional Proof

This is used whenever you are trying to prove a wff with a bidirectional. The exact form in the courseware is:

To prove that αβ\vdash\alpha\Leftrightarrow\beta, we may prove that αβ\vdash\alpha\Rightarrow\beta and βα\vdash\beta\Rightarrow\alpha.

Similarly to a proof by cases, break the proof up into two cases and prove each case separately.

Note

The order in which you prove them doesn’t matter.

Note

If you only use equivalences for one side of the proof (no inference rules), then this greatly shortens the bidirectional proof as you only need to write “Same as above case but in the reverse order.”

Example

(Simple example to show the format of the proof)
Prove that (pp)p\vdash(p\lor p)\Leftrightarrow p.

(Bidirectional proof)

(i) Prove that (pp)p\vdash(p\lor p)\Rightarrow p.

(Direct proof)
1. ppp\lor p\quad Premise
2. pp\quad 1, E4

Hence (pp)p\vdash(p\lor p)\Rightarrow p.

(ii) Prove that p(pp)\vdash p\Rightarrow(p\lor p).
Same as above proof but in the reverse order.
Hence p(pp)\vdash p\Rightarrow(p\lor p).

Combining the results of (i) and (ii), we have (pp)p\vdash(p\lor p)\Leftrightarrow p\qquad\blacksquare

Trivial Proof

This is hardly used at all, except for specific circumstances. The exact form in the courseware is:

To prove that αβ\vdash\alpha\Rightarrow\beta, we may attempt to prove that β\vdash\beta.

This means we are only proving β\beta with the axiom ωω\omega\lor\sim\omega.

Example

Prove that p(qq)\vdash p\Rightarrow\sim(q\land\sim q).

(Trivial proof)
1. qq\sim q\lor\sim q\quad axiom
2. (qq)\sim(q\land\sim q)\quad 1, E16

Thus p(qq)\vdash p\Rightarrow\sim(q\land\sim q)\qquad\blacksquare

Vacuous Proof

Honestly, I am not even sure if I have used this proof method before. The exact form in the courseware is:

To prove that αβ\vdash\alpha\Rightarrow\beta, we may attempt to prove that αfalse\vdash\alpha\Rightarrow false

Example

Prove that (pp)(qp)\vdash(p\land\sim p)\Rightarrow(q\lor\sim p)

(Vacuous proof)
1. ppp\land\sim p\quad Hypothesis
2. falsefalse\quad 1, E1

Hence, (pp)(qp)\vdash(p\land\sim p)\Rightarrow(q\lor\sim p)\qquad\blacksquare