What Counts as a Formula
Is P ∧ ∨ Q a formula? Your eye says no, but why? To talk about all formulas, we need to say exactly which strings count. The question: what are the rules for building a formula?
Three building rules
A formula is a string we may build in these steps. Each rule uses φ and ψ for any formulas already built.
Rule 1: a letter, such as P, is a formula. Rule 2: if φ is a formula, then ¬φ is a formula. Rule 3: if φ and ψ are formulas, then (φ ∧ ψ), (φ ∨ ψ), (φ → ψ) and (φ ↔ ψ) are formulas. Nothing else is a formula. A string that can be built this way is called well-formed.
As in earlier levels, we may drop the outer brackets when writing, so P ∧ Q stands for (P ∧ Q).
Testing strings
Let us test three strings. Is ¬(P ∧ Q) a formula? Yes. P and Q are formulas by rule 1. (P ∧ Q) is one by rule 3. Then ¬(P ∧ Q) is one by rule 2.
Is P ∧ ∨ Q a formula? No. The sign ∨ needs a formula on each side, and no rule puts two signs together.
Is (P) a formula? No. Rule 1 gives P, and no rule adds brackets around one formula alone.
The formula tree
Building a formula can be drawn as a tree. The last rule used is the root. For (P ∧ ¬Q) → R the root is →, its main connective, and below it are the two formulas it joins.
Read it from the bottom up and you see how it was built. Every formula has exactly one tree, so there is only one way to read it. Logicians use that fact when they prove things about all formulas at once.
Try it at home
- Decide which are formulas:
¬¬P,P ¬ Q,(P ∨ Q) → R,∧ P. - For each one that is, write the rules you used to build it.
- Draw the tree of
¬(P ∨ (Q ∧ R))on paper.
Words to know
- well-formed formula - a string that can be built with the building rules
- building rule - a step that makes a new formula from smaller ones
- formula tree - a drawing of how a formula is built, with the main connective at the root
Big idea
A formula is exactly what the three building rules can make, and each one has a single tree.