12. Predicates
12.1 Specification: predicate
A predicate is a meaningful statement containing variables that becomes true or false when appropriate values are substituted for the variables. The proposition obtained by substituting values for each of the variables in a predicate is called an instance of the predicate.
12.1.1 Usage In other texts, a predicate may be called a “formula” or an “open sentence”.
12.1.2 Example If $x$ is a variable of type integer, the statement “$25\leq x$” is a predicate. If you substitute an integer for $x$, the statement becomes true or false depending on the integer. If you substitute 44 for $x$ you get the proposition “$25\leq 44$”, which is true; if you substitute 5 for $x$, you get the proposition “$25\leq 5$”, which is false.
12.1.3 Usage We will regard a proposition as a predicate with no variables. In other words, every proposition is a predicate.
12.1.4 Algebraic expressions and predicates An algebraic expression is an arrangement of symbols such as
$$x^{2}-\frac{6}{x}+4y\tag{12.1}$$
It consists of variables ($x$ and $y$ in this case) and operation symbols. The expression must be correctly formed according to the rules of algebra.
A predicate is analogous to an algebraic expression, except that it also contains symbols such as “$<$” and “=” (called relational symbols) that make the expression denote a statement instead of a number.
12.1.5 Example The expression
$$x^{2}-\frac{6}{x}+4y>x+y\tag{12.2}$$
is a predicate.
12.2 Substitution
When numbers are substituted for the variables in an algebraic expression, the result is a number.
12.2.1 Example Setting $x= 2$ and $y= 3$ in the expression (12.1) gives the number 13.
On the other hand, if data of the correct type are substituted into a predicate the result is not a number but a statement which is true or false, in other words a proposition.
12.2.2 Example If you substitute $x= 3$ into the predicate $x^{2} <4$ you get the proposition $9<4$, which is false. The substitution $x= 1$ gives $1<4$, which is true.
12.2.3 Example Substituting $x= 2$ and $y= 3$ into the expression (12.2) gives the proposition $13>5$, which is true.
12.2.4 Exercise Find a pair of numbers $x$ and $y$ that when substituted in 12.2 give a false statement.
12.2.5 Example Expressions can be substituted into other expressions as well. For example one can substitute $xy$ for $x$ in the expression (12.2) to get
$$x^{2}y^{2}-\frac{6}{xy}+4y>xy+y$$
In doing such substitution you must take into account the rules concerning how algebra is written; for example to substitute $x +y$ for $x$ and $y +z$ for $y$ in (12.1) you must judiciously add parentheses:
$$(x+y)^{2}-\frac{6}{x+y}+4(y+z)>x+y+y+z$$
And the laws of algebra sometimes disallow a substitution; for example you cannot substitute 0 for $x$ in 12.2.
12.2.6 Exercise Write the result of substituting $x$ for both $x$ and for $y$ in 12.2. (Answer on page 243.)
12.3 Types
In this book, variables are normally assumed to be of a particular type; for example the variable $x$ mentioned in Example 12.1.2 is of type integer. We do not always specify the type of variables; in that case, you can assume that the variable can be replaced by any data that makes the predicate make sense. For example, in the predicate $x \leq 25 , x$ can be any number for which “$\leq$” makes sense — thus any real number number, but not a complex number. This informal practice would have to be tightened up for a correct formal treatment of predicates; the intent here is to provide an informal introduction to the subject in which predicates are used the way they are normally used in common mathematical practice.
12.3.1 Usage A real variable is a variable of type real. An integer variable is a variable of type integer. Don’t forget that both integer variables and real variables are allowed to have negative values.
12.3.2 Worked Exercise Let $x$ be a variable of type real. Find a value of $x$ that makes the statement “$x >1$ and $x <2$” true, and another that makes it false. Do the same for the case that $x$ is an integer variable. Answer Any real number between 1 and 2 makes “$x >1$ and $x <2$” true, for example $x =\tfrac{1}{2}$ or $x=\sqrt{2}$. The values $x = 0,x = 1,x =-1$, and $x= 42$ all make it false.
No integer value of $x$ makes the statement true; it is false for every integer.
12.4 Exercise set
Let $m$ be an integer variable. For each predicate in problems 12.4.1 through 12.4.5, give (if it is possible) a value of $m$ for which it is true and another value for which it is false.
12.4.1 $m|4$. (Answer on page 243.)
12.4.2 $m =m$. (Answer on page 243.)
12.4.3 $m =m+ 1$.
12.4.4 $m = 2m$.
12.4.5 $m^{2} =m$.
12.5 Naming predicates
We will name predicates with letters in much the same way that we use letters to denote numbers in algebra. It is allowed, but not required, to show the variable(s) in parentheses. For example, we can say: let $P (x)$ denote the predicate “$25\leq x$”. Then $P(42)$ would denote the proposition “$25\leq 42$”, which is true; but $P (-2)$ would be false. $P(42)$ is obtained from $P (x)$ by substitution.
We can also say, “Let $P$ denote the predicate $25\leq x$” without the $x$ being exhibited. This is useful when we want to refer to an arbitrary predicate without specifying how many variables it has.
Predicates can have more than one variable. For example, let $Q (x,y)$ be “$x \leq y$”. Then $Q (25,42)$ denotes the proposition obtained by substituting 25 for $x$ and 42 for $y$. $Q (25,42)$ is true; on the other hand, $Q (25,-2)$ is false, and $Q (25,y)$ is a predicate, neither true nor false.
12.5.1 Worked Exercise Let $m$ and $n$ be integer variables. Let $P (n)$ denote the predicate $n <42$ and $Q (m,n)$ the predicate $n| (m +n)$. Which of these predicates is true when 42 is substituted for $m$ and 4 is substituted for $n$? Answer $P(4)$ is $4<42$, which is true, and $Q (42,4)$ is $4|46$, which is false.
12.5.2 Exercise If $Q (x)$ is the predicate $x^{2} <4$, what are $Q (-1)$ and $Q (x-1)$? (Answer on page 243.)
12.5.3 Exercise Let $P (x,y,z)$ be the predicate $xy < x +z+ 1$. Write out each of these predicates.
a) $P (1,2,3)$.
b) $P (1,3,2)$.
c) $P (x,x,y)$
d) $P (x,x +y,y +z)$. (Answer on page 243.)
12.5.4 Exercise Let $P$ be the predicate of Exercise 12.5.3. Write out $P (x,x,x)$ and $P (x,x- 1,x+ 1)$ and for each predicate give a value of $x$ for which it is true and another value for which it is false.
12.5.5 Warning You may have seen notation such as “$f (x)$” to denote a function. Thus if $f (x)$ is the function whose value at $x$ is $2x+ 5$, then $f(3)=11$. We will consider functions formally in Chapter 39. Here we only want to call your attention to a difference between that notation and the notation for predicates: If $f (x ) = 2x+ 5$, then “$f (x)$” is an expression. It is the name of something. On the other hand, if $P (x)$ denotes the predicate “$25\leq x$”, then $P (x)$ is a statement – a complete sentence with a subject and a verb. It makes sense to say, “If $a= 42$, then $P (a)$”, for that is equivalent to saying, “If $a= 42$, then $25\leq a$”. It does not make sense to say, “If $a= 42$, then $f (a)$”, which would be “If $a= 42$, then $2a+ 5$”. Of course, it is meaningful to say “If $a= 42$, then $f (a) = 89$”.
12.6 Predicates in Mathematica
A statement such as 2 < x is a predicate. If x has not been given a value, if you type 2 < x you will merely get 2 < x back, since Mathematica doesn’t know whether it is true or false.
Pages 16–19 of the book (PDF).