Predicates & Quantifiers

Propositional logic

This forms the basis of simple logical arguments. You may recognise the notation from first year Computation & Logic:

  • Negation: ¬\lnot
  • Conjunction: \land
  • Disjunction: \lor
  • Implication: \to
  • Biconditional: \leftrightarrow

This can often be useful for dealing with a selection of facts and working out their implications. However, these laws do not give us the tautologies that we are looking for in solid mathematical proof.

Predicate logic

This takes propositional logic an important step further by adding:

  • Variables: x,y,z...x, y, z ...
  • Predicates: P(x),Q(y),R(x,y)...P(x), Q(y), R(x,y) ...
  • Quantifiers: ,\forall, \exists

Predicates are a generalisation of propositions since they can contain variables which stand for elements from their domain.

A simple example of this in action would be:

P(x)P(x) is defined by x>0x \gt 0 and the domain of xx is Z\Z.

In this case, we can see:

  • P(5)=P(5) = true
  • P(5)=P(-5) = false

Quantifiers

An important part of what makes predicate logic so specific in its arguments is quantifiers. These allow us to specify whether a predicate is true for all xx, at least one xx or no xx in the domain.

The two of these that we use in this course are:

  • \forall specifies for all xx.
  • \exists specifies at least one xx.

Variables that are in the scope of a quantifier are called ‘bound variables’ and those not in the scope are called ‘free variables’.

Rules of inference

Suppose we take an arbitrary proposition P(x)P(x); there are a few truths we can infer from knowing if P(x)P(x) holds for all, some or none of the domain.

x,P(x)P(v)\dfrac{\forall x \\, P(x)}{P(v)}

In this case, vv is an arbitrary element in the domain. If we know x,P(x)\forall x \\, P(x) holds, we can infer that P(v)P(v) is true for any value of vv in the domain.

If we know ¬(x,P(x))\lnot (\forall x \\, P(x)) then that implies x,(¬P(x))\exists x \\, (\lnot P(x)), there is a counterexample. Conversely, if we know ¬(x,P(x))\lnot (\exists x \\, P(x)) then that implies x,(¬P(x))\forall x \\, (\lnot P(x)).

Suppose we flip this and do not know if x,P(x)\forall x \\, P(x) holds, that is what we are trying to determine.

P(c)x,P(x)\dfrac{P(c)}{\forall x \\, P(x)}

In this case, cc is an arbitery element in the domain. We can infer x,P(x)\forall x \\, P(x) if we choose a generalised value for cc, for example 2k+12k+1 to represent odd numbers, and prove P(c)P(c).

Proof techniques

All of the above logic can be applied in order to prove mathematical facts from first principles. For example:

x\forall x (if xx is odd then x2x^2 is also odd).

This can be shown by framing it as A(x)B(x)A(x) \to B(x) in each of the following ways:

  • Direct proof
    • Assume nn is an arbitrary element of the domain
    • Assume A(n)A(n) is true
    • Show x(A(n)B(n))\forall x (A(n) \to B(n)) is true
  • Proof by contraposition
    • Use equivalence of A(x)B(x)¬B(x)¬A(x)A(x) \to B(x) \leftrightarrow \lnot B(x) \to \lnot A(x)
    • Assume nn is an arbitrary element of the domain
    • Assume ¬B(n)\lnot B(n) is true
    • Show x(¬B(n)¬A(n))\forall x (\lnot B(n) \to \lnot A(n)) is true
  • Proof by contradiction
    • Assume statement pp is false
    • Show ¬p\lnot p implies both qq and ¬q\lnot q
    • Since (q¬q)(q \land \lnot q) is always false this shows pp must be true
  • Proof by cases
    • To prove a proposition of the form (p1p2...pk)q(p_1 \lor p_2 \lor ... \lor p_k) \to q
    • Use the tautology (p1...pkq)((p1q)...(pkq))(p_1 \lor ... \lor p_k \to q) \leftrightarrow ((p_1 \to q) \land ... \land (p_k \to q))
    • If each of these kk cases are true then the proposition must be true

These kinds of proof questions become much easier if you are familiar with mathematical definitions, such as the definition of an odd number being 2k+12k+1 for some kk.

Nested quantifiers

There can be multiple quantifiers in a single statement, for example x,y,(x+y=0)\forall x \\, \exists y \\, (x + y = 0). One quantifier is said to be in the scope of another.

The order they are placed in does have an effect on and can completely change the proposition. Following the example above:

x y (x+y=0)TRUE\forall x \ \exists y \ (x + y = 0) \qquad \text{TRUE}

y x (x+y=0)FALSE\exists y \ \forall x \ (x + y = 0) \qquad \text{FALSE}

The former statement is saying that for each value of xx there is a separate value of yy to match each one, whereas the latter is saying that there is a single value of yy which remains the same for all values of xx.