A proposition whose truth depeonds on the value of one or more variables (called a free variable). "n is a perfect square" is a predicate, since you don't know its true or false until a value for n is provided.
Like other propositions, a predicate is often named with a letter. Furthermore, a function-like notation is used to denote a predicate supplied with specific variable vlaues. For example...
When a quantifier is used on the variable x, we say this occurence of the variable is bound. An occurence of a variable that is not bound by a quantifier or set equal to a particular value is said to be free.
In the statement ∃x(x+y=1), x is bound and y is free.
Many mathematical statements involve several quantifiers. Goldbach's Conjecture states:
"Every even integer greater than 2 is the sum of two primes."
Rewritten to make the use of quantification clearer:
For every even integer n greater than 2, there exist primes p and q such that n=p+q
Let Ev be the set of even integers greater than 2, and let Primes be the set of primes. Then we can write Goldbach’s Conjecture in logic notation as follows:
for every even integer n≥2∀n∈ Ev there exist primes p and q such that ∃p∈ Primes ∃q∈ Primes. n=p+q
When all the variables in a formula are understood to take values from the same nonempty set D it's conventional to omit mention of D.
For example instead of ∀x∈D∃y∈D.Q(x,y) we would write ∀x∃y.Q(x,y). The unnamed empty set that x and y range over is called the domain.
Goldbach's Conjecture could be expressed with all variables ranging over the domain N as
For a predicate formula to be valid, a formula must evaluate to true no matter what the domain of discourse may be, no matter what values its variables may take over the domain, and no matter what interpretations its predicate variables may be given.
Lefthand side reads: There is an x for which P(x,y) is true for every y
Righthand side reads For every y, there is a x for which P(x,y) is true.
There is an x for which P(x,y) is true for every y IMPLIES For every y, there is a x for which P(x,y) is true.
Proof: Let D be the domain for the variables and P0 be some binary predicate on D. We need to show that if ∃x∀y.P(x,y) holds under this interpretation, then so does ∀y∃x.P(x,y).
Suppose ∃x∀y.P(x,y). Some element x0∈D has the property that P0(x0,y) is true for all y∈D. So for every y∈D, there is some x∈D, namely x0, such that P0(x,y) is true. That is, ∀y∃x.P(x,y) holds under this interpretation. ■
This is a helpful way of thinking about nested quantifiers. For example, to see whether ∀x∀yP(x,y) is true, we loop through the values for x, and for each x we loop through the values for y. If we find that P(x,y) is true for all values for x and y, we have determined that ∀x∀yP(x,y) is true. If we ever hit a value x for which we hit a value y which makes P(x,y) false, we have shown ∀x∀yP(x,y) is false.
A similar procedure is done for ∀x∃yP(x,y), although this time we don't have to loop through all y... just until we find one that satisfies the proposition.