An Introduction to Propositional Logic Proofs

Intro

Well, it’s been the far better part of a year since I’ve intended to write a follow up entry to the propositional logic. Hopefully I am still able to retain my chain of thought, but if it drifts or seems different that is why. Once again, this series is built off of the lecture work of Aris Papadopoulos.

Math

A review of the basics

Go back and read the introduction post for propositional logic if you haven’t already. Generally, we defined

  • Syntax, the propositional variables and connectives that are used to construct formulas (along with subformulas and substitution)
  • Semantics, the truth values of formulas and how they are evaluated (which led to models, tautologies, logical entailment and equivalence, and unsatisfiability)
  • And Expressive Power, which details how a formula defines a truth function with some finite support. This led us to finish with adequacy.

Now, we want to look at how we can use these tools to prove things. What we really did in the last part of the series was to demonstrate the meaning of propositional formulas. But what we really want is a way to prove things about formulas, specifically which formulas are always true (eg tautologies). Furthermore, we’d like them to be automated, or at least computable.

That is, we’d like a system of proofs that a β€œcomputer” can carry out. Eventually, we will build first a computer that is hopefully only capable of proving tautologies.

Recall last time that there was a theorem that {β†’,Β¬}\{\rightarrow, \neg\} is adequate. This means that we can use only these two connectives to express any truth function. Unfortunately at the time I was too busy to believe in proofs, so I didn’t write one; there are a lot of cool proofs online that show this, and you should look one up! So, we will build a proof system that uses only these two connectives for now.

I’ll try to provide proofs when they are easy to understand and are useful.

The computer

We want to expand on what the computer actually does.

Definition (Proof System): A proof system is a symbolic system that allows us to derive formulas from other formula. A proof system composes a set of axioms, and a set of deduction rules.

Definition (Axiom): An axiom is a formula that is assumed to be true.

Definition (Deduction Rule): A statement that allows us to derive a formula from other formulas. That is, assuming some formula is true, we can derive another formula.

We will first work with the following extremely simple proof system:

  • Axioms:

    • (A1) Ο•β†’(Οˆβ†’Ο•)\phi \to (\psi \to\phi)
    • (A2) ((Ο•β†’(Οˆβ†’Ο‡))β†’((Ο•β†’Οˆ)β†’(Ο•β†’Ο‡)))((\phi\to(\psi\to\chi))\to ((\phi\to \psi)\to (\phi\to\chi)))
    • (A3) (Β¬Ο•β†’Β¬Οˆ)β†’((Β¬Ο•β†’Οˆ)β†’Ο•)(\neg \phi \to \neg \psi) \to ((\neg \phi \to \psi) \to \phi) for any formula Ο•,ψ,Ο‡\phi, \psi, \chi.
  • Deduction Rules:

    • Modus Ponens (MP): If Ο•\phi and Ο•β†’Οˆ\phi \to \psi are both true, then ψ\psi is true.

Now, we will define the method by which we can utilize this proof system.

Definition (Formal Proof): A formal proof of formula Ο•\phi is a finite sequence (Ο•1,Ο•2,…,Ο•n)(\phi_1,\phi_2,\dots, \phi_n) of formulas such that Ο•n=Ο•\phi_n=\phi, and for each i≀ni\leq n, one of the following is true:

  • Ο•i\phi_i is an axiom
  • Ο•i\phi_i is derived from some Ο•j\phi_j and Ο•k\phi_k with j,k<ij,k<i using the deduction rules.

Definition (Theorem): If there exists a formal proof of formula Ο•\phi, then we say that Ο•\phi is a theorem, and we write βŠ’Ο•\vdash \phi.

Definition (Deducible): Let Ξ“\Gamma be a set of formulas. Then, Ο•\phi is deducible from Ξ“\Gamma if there exists a finite sequence (Ο•1,Ο•2,…,Ο•n)(\phi_1,\phi_2,\dots, \phi_n) of formulas such that Ο•n=Ο•\phi_n=\phi, and for each i≀ni\leq n, one of the following is true:

  • Ο•i\phi_i is an axiom
  • Ο•iβˆˆΞ“\phi_i \in \Gamma
  • Ο•i\phi_i is derived from some Ο•j\phi_j and Ο•k\phi_k with j,k<ij,k<i using the deduction rules.

In this case, we write that Ξ“βŠ’Ο•\Gamma \vdash \phi.

Note here that we added the line Ο•iβˆˆΞ“\phi_i \in \Gamma. This is important; the notation essentially says that not only is there a proof of Ο•\phi, but there is the restriction that Ο•\phi is provable from the set of formulas Ξ“\Gamma. In general, βŠ’Ο•\vdash \phi is a stronger statement than Ξ“βŠ’Ο•\Gamma \vdash \phi, since the latter is a restriction of the former and states essentially that we can prove Ο•\phi without the β€œassumptions” that construct Ξ“\Gamma.

Example: We want to prove that βŠ’Ο•β†’Ο•\vdash \phi\to \phi. We can do this as follows (note that we can use any formula as a placeholder for ψ\psi and Ο‡\chi in the axioms, including using Ο•\phi for more than one):

(A1):(Ο•β†’((Ο•β†’Ο•)β†’Ο•))(A2):((Ο•β†’((Ο•β†’Ο•)β†’Ο•))β†’((Ο•β†’(Ο•β†’Ο•))β†’(Ο•β†’Ο•)))(MP):(Ο•β†’(Ο•β†’Ο•))β†’(Ο•β†’Ο•)(A1):(Ο•β†’(Ο•β†’Ο•))(MP):Ο•β†’Ο•\begin{align*} (A1):& (\phi\to((\phi\to\phi)\to\phi))\\ (A2):& ((\phi\to((\phi\to\phi)\to\phi))\to((\phi\to(\phi\to\phi))\to(\phi\to\phi)))\\ (MP):& (\phi\to(\phi\to\phi))\to(\phi\to\phi)\\ (A1):& (\phi\to(\phi\to\phi))\\ (MP):& \phi\to\phi \end{align*}

Now you may say, β€œNyx, this proof system thing seems absurd. Who is writing out this by hand to show that something obviously true is true?” It’s correct that this starting proof is unnecessarily verbose for something like Ο•β†’Ο•\phi\to \phi. But now we can just add that Ο•β†’Ο•\phi\to\phi is provable, and we can use it in future proofs. More importantly, this entire system is computable and mechanized, and we can gradually build upon it to build more and more complex formulas.

If you have assumptions as part of Ξ“\Gamma, you can also declare the assumptions as steps in the proof similar to axioms. For example, if we have

Example: Prove Ξ“βŠ’(Ο•β†’Ο‡)\Gamma\vdash (\phi\to \chi) if Ξ“={(Ο•β†’Οˆ),(Οˆβ†’Ο‡)}\Gamma=\{(\phi\to \psi), (\psi\to \chi)\}. We can do this as follows:

(Ξ“):(Ο•β†’Οˆ)(Ξ“):(Οˆβ†’Ο‡)(A1):((Οˆβ†’Ο‡)β†’(Ο•β†’(Οˆβ†’Ο‡)))(MP):(Ο•β†’(Οˆβ†’Ο‡))(A2):((Ο•β†’(Οˆβ†’Ο‡))β†’((Ο•β†’Οˆ)β†’(Ο•β†’Ο‡)))(MP):((Ο•β†’Οˆ)β†’(Ο•β†’Ο‡))(MP):(Ο•β†’Ο‡)\begin{align*} (\Gamma):& (\phi\to \psi)\\ (\Gamma):& (\psi\to \chi)\\ (A1):& ((\psi\to\chi)\to(\phi\to(\psi\to\chi)))\\ (MP):& (\phi\to(\psi\to\chi))\\ (A2):& ((\phi\to(\psi\to\chi))\to((\phi\to \psi)\to (\phi\to\chi)))\\ (MP):& ((\phi\to \psi)\to (\phi\to\chi))\\ (MP):& (\phi\to\chi) \end{align*}

Soundness and Completeness

The central idea of soundness is that if a formula is provable, then it is true. That is, if we can prove a formula under our system, then in order for our system to be sound it must be the case that the formula is true. This ensures that we cannot report a β€œfalse positive”, and this concept of β€œsoundness” is generally used in a lot of computing and logic.

Theorem (Soundness of Predicate Logic): If Ξ“βŠ’Οˆ\Gamma\vdash\psi, then Ξ“βŠ¨Οˆ\Gamma\models\psi. In particular, if ⊒ψ\vdash\psi, then ⊨ψ\models\psi. In particular, this states that every theorem is a tautology.

Proof: We need to show that {Ο•:Ξ“βŠ¨Ο•}\{\phi:\Gamma\models \phi\} contains all the axioms, all the formulas in Ξ“\Gamma, and is closed under the deduction rules (in our case MP). The first part is trivial because tautologies are closed under substitutions (recall the last lesson) and (A1)-(A3) are tautologies by truth tables (try it yourself if you want). Then, if Ξ“βŠ¨(Ο•β†’Οˆ)\Gamma\models (\phi\to\psi) and Ξ“βŠ¨Ο•\Gamma\models \phi, then Ξ“βŠ¨Οˆ\Gamma\models \psi by the definition of logical entailment, which we showed last time. And this completes the proof.

The idea of completeness then, is complementary to soundness. We want to show that if a formula is true, then it is provable. That is, our system can β€œcomplete” the task of proving all tautologies. This is a much more difficult task, and we will not prove it here, but it is a very important result in logic.

Theorem (Completeness of Predicate Logic): If Ξ“βŠ¨Οˆ\Gamma \models \psi, then Ξ“βŠ’Οˆ\Gamma\vdash\psi. In particular, if ⊨ψ\models \psi, then ⊒ψ\vdash \psi. In particular, this states that every tautology is a theorem.

This proof is difficult and is kind of what we want to build up to in this series; as a result, I will omit it now, but let’s be committed to learning it slowly over time. First, begin with the Deduction Theorem.

Lemma (Deduction Theorem): The following are equivalent:

  1. Ξ“βŠ’(Ο•β†’Οˆ)\Gamma\vdash (\phi\to \psi)
  2. Ξ“βˆͺ{Ο•}⊒ψ\Gamma\cup\{\phi\}\vdash \psi

These say that if we can prove Ο•β†’Οˆ\phi\to \psi from Ξ“\Gamma, then we can prove ψ\psi from Ξ“\Gamma and the assumption of Ο•\phi. That is, if we can prove that Ο•\phi implies ψ\psi, then we can prove ψ\psi if we assume Ο•\phi. Intuitively, this makes sense, right? If we can prove that Ο•\phi implies ψ\psi, then if we assume Ο•\phi is true, we can conclude that ψ\psi is true. And in the other direction, if we can prove ψ\psi from Ξ“\Gamma and the assumption of Ο•\phi, then by β€œpulling the assumption out into the statement”, the proof should still hold the same way.

Proof: (1) β€…β€ŠβŸΉβ€…β€Š\implies (2): Well, this is just MP. If we have Ξ“βŠ’(Ο•β†’Οˆ)\Gamma\vdash (\phi\to \psi), then we can add Ο•\phi to the proof and use MP to conclude ψ\psi.

(2) β€…β€ŠβŸΉβ€…β€Š\implies (1): This is a fair bit more difficult. Suppose that Ο•1,…,Ο•n\phi_1,\dots,\phi_n is a deduction of ψ\psi from Ξ“βˆͺ{Ο•}\Gamma\cup\{\phi\}. We want to show that Ξ“βŠ’(Ο•β†’Οˆ)\Gamma\vdash (\phi\to \psi). We will do this by induction on ii, where i≀ni\leq n, that Ξ“βŠ’Ο•β†’Ο•i\Gamma\vdash \phi\to\phi_i. Since Ο•i=n=Ο•\phi_{i=n}=\phi, we would have that Ξ“βŠ’(Ο•β†’Οˆ)\Gamma\vdash (\phi\to \psi). Take some Ο•i\phi_i, an element in the sequence. Then, if Ο•i\phi_i is an axiom or an element of Ξ“\Gamma,

(Γ):ϕi(A1):ϕi→(ϕ→ϕi)(MP):ϕ→ϕi\begin{align*} (\Gamma):&\phi_i\\ (A1):& \phi_i\to(\phi\to\phi_i)\\ (MP):& \phi\to\phi_i \end{align*}

If Ο•i=ψ\phi_i=\psi, then we can use the tautology Ο•β†’Ο•\phi\to\phi to conclude that Ξ“βŠ’Ο•β†’Ο•i\Gamma\vdash \phi\to\phi_i. Finally, suppose that by induction we have the deductions that Ξ“βŠ’(Ο•β†’Ο•j)\Gamma\vdash (\phi\to \phi_j) for all j≀ij\leq i. Then, we will show that there is a deduction Ξ“βŠ’(Ο•β†’Ο•i)\Gamma\vdash (\phi\to\phi_i). By assumption, Ο•i\phi_i is not an axiom, or an element of Ξ“\Gamma, so it is deducible using MP from some Ο•j1,Ο•j2\phi_{j_1}, \phi_{j2} with j1,j2<ij_1,j_2<i. This also implies that Ο•j2\phi_{j_2} is (without loss of generality) Ο•j1β†’Ο•i\phi_{j_1}\to\phi_i. By induction we have deductions Ξ“βŠ’(Ο•β†’Ο•j1)\Gamma\vdash (\phi\to \phi_{j_1}) and Ξ“βŠ’(Ο•β†’(Ο•j1β†’Ο•i))\Gamma\vdash (\phi\to (\phi_{j_1}\to \phi_i)). Then,

(A2):((Ο•β†’(Ο•j1β†’Ο•i))β†’((Ο•β†’Ο•j1)β†’(Ο•β†’Ο•i)))(MP):((Ο•β†’Ο•j1)β†’(Ο•β†’Ο•i))(MP):(Ο•β†’Ο•i)\begin{align*} (A2):& ((\phi\to(\phi_{j_1}\to\phi_i))\to((\phi\to \phi_{j_1})\to (\phi\to\phi_i)))\\ (MP):& ((\phi\to \phi_{j_1})\to (\phi\to\phi_i))\\ (MP):& (\phi\to\phi_i) \end{align*}

And the proof is done.

End

A quick one. Next time, we’ll go over adequacy theorem, inconsistency, compactness, and decidability.