Predicates
Learn about predicates and how they are different from propositions.
We'll cover the following
A predicate in English is everything except the subject in a declarative sentence. For example, if we take the sentence:
Smith is more than six feet tall.
The statement “is more than six feet tall” is a predicate. It does not become a complete sentence until we specify a subject. Once we have identified a subject, this declarative sentence might or might not be true. Therefore, a predicate describes a property that a subject may or may not possess.
Luckily, in mathematics, we can use variables to denote unspecified subjects. Using variables becomes a powerful way of expressing many ideas precisely: this is the basis of first-order logic. As we’ll see, this logic is so powerful that we can state several open problems in mathematics (and other areas) using first-order logic.
What is a predicate?
In mathematical logic, predicates are propositions containing one or more variables. We can view these variables as placeholders. These variables are allowed to take any value from a set called their domain. The predicate asserts some property the elements of the domain may or may not possess. For a statement to qualify as a bona fide predicate, the predicate must become a proposition each time we substitute any value from the domain.
To see a concrete example, consider three students, Jane, Jim, and Zain, who took a discrete maths course. Let’s assume we want to know which students have secured an A in the course. We can craft the following sentence with a variable :
- : has secured an A in discrete math.
The statement “has secured an A in discrete math” is a predicate. The variable allows us to use this predicate in a complete sentence. is not a proposition because it has a variable. But if we substitute with some specific value, that is, the name of a student in the class, it will become a proposition. It will have a definite truth value. In this case, we say that we are instantiating the predicate. What is important is that each instantiation of the variable from the domain should yield a proposition.
The domain should always be clear. If there is any possible ambiguity, we must mention the domain explicitly. For the , the domain of is the students registered in the discrete maths class. To be concrete, let’s define the domain to be Jim, Jane, Zain
We can instantiate this predicate by substituting a value for for any value from . Instantiating will turn it into a proposition with a definite truth value. For example, when we substitute Jim for , we get the proposition,
- Jim: Jim has secured an A in discrete math.
We can also visualize a predicate as a row of truth values. The columns are labeled values given in the domain. So, for example, if Jim is the only student who did not get an in the course, then Jane = true, Jim = false, Zain = true, we can view as the following table:
Jane | Jim | Zain |
---|---|---|
T | F | T |
In this table, T represents true and F represents false.
Let’s define another predicate with the same domain . Let,
- : scored at least on the final.
For , we notice that:
- is a variable.
- The domain of is once again .
- The predicate captures a property of the elements in the subject.
If only Zain scored at least on the final, then Zain true and (Jane)Smith false . Once again, we can visualize the truth values of this predicate using the following table:
Jane | Jim | Zain |
---|---|---|
F | F | T |
Let,
- : x>7, \:\:\:\:\:\:\:\: Where, is an integer.
What are the truth values of and ?
These are worked out in the following table:
Proposition | Truth-value | Reason |
---|---|---|
F | ||
F | ||
F | ||
F | ||
T | 14 > 7 | |
T | 517 > 7 |
In this case, the above table is not complete. We have only determined the truth values for a subset of the domain. The entire truth table will have infinitely many entries, one for each integer.
Let’s look at an example involving more than one variable.
Consider the following predicate:
- : Where, and are integers.
Let’s look at a few possibilities for values of variables.
Property Evaluation | Truth-value | Reason | |
---|---|---|---|
F | |||
T | |||
T | |||
T | |||
T | |||
F |
Predicate code example
In computer programs, we use predicates in conditional statements. As an example, look at the following Python code. Run this code to know the truth value of the resulting proposition from the predicate for different x
variable values. The predicate is P(x):x<7.
> Note: We can change the values in the domain
to experiment with different values of x.
domain = {14,3,12,-1,0,7}for x in domain:if x < 7:print("P("+ str(x) +") is true.")else:print("P("+ str(x) +") is false.")
Explanation
-
Line 1: This line specifies the
domain
for thex
variable. -
Line 2: We will look at the predicate for each value of the
x
variable. -
Line 3: The
if
statement has the predicate : . -
Line 4: This line will execute when the predicate is true.
-
Line 6: This line will execute when the predicate is false.
Leap year code example
In the following program, the truth value of is computed for different values of . The predicate is as follows:
The year is a leap year if it is divisible by and not by or if it is divisible by .
Note: We can change the values in the
domain
to experiment with different values ofy
and check if a year is a leap year or not.
domain = {2014, 2103, 1208, 2087, 1604, 714, 1700, 1800, 1900, 2100, 2200, 2000}for y in domain:if (y % 4 == 0 and y % 100 != 0) or (y % 400 == 0):print("L("+ str(y) +") is true because "+ str(y) +" is a leap year.")else:print("L("+ str(y) +") is false because "+ str(y) +" is not a leap year.")
Explanation
-
Line 1: Notice that this line specifies the
domain
containing different values for they
variable. -
Line 2: We will check for the leap year for each value of the
y
variable from thedomain
. -
Line 3: The
if
statement has the predicate is leap year. -
Line 4: This line will execute when the predicate is true.
-
Line 6: This line will execute when the predicate is false.
Quiz
Test your understanding of predicates.
Which option is a predicate?
Jack is two years older than Harry.
.
Where is my jacket?
.