Predicate vs function [duplicate]

In logic, what is the difference between a predicate and a function?

To be specific, I am just interested in First Order Logic.

Thanks!


Solution 1:

Syntactically predicates are used to form formulas; function symbols are used to form terms.

Terms later translate to objects in the structure, whereas formulas are evaluated to be true or false in a particular structure and assignment.

From the semantic point of view there is little difference from how we usually treat functions and relations. In the sense that an $n$-ary function is just an $(n+1)$-ary predicate. In fact if $F$ is a binary function symbol then $\{(x,y,z)\mid F(x,y)=z\}$ is a definable ternary relation in every structure.

In the other direction if we have a predicate $R(x,y)$ and we know that in a certain structure for the language, $M$, every $u$ has exactly one $v$ such that $M\models R(u,v)$ then in fact $R$ defines a function $f_R(u)$, by saying that "$f_R(u)$ is the unique object $v$ such that $R(u,v)$ holds" we essentially write $f_R(u)=v$, and while we cannot use this to create syntactical terms, we can always write a formula and require that a variable satisfies this condition - so effectively we do write $f_R(u)$.

This is why when we deal with theories rather than structures we can always assume the symbols are relations, because we can add axioms specifying that these relations are really functions (or constants which are constant functions of course, or relations which exactly one object satisfies).

Solution 2:

In addition to the link above What is the difference between a predicate and a function, you might want to read the distinctions provided by Wikipedia. See, e.g.

  • predicates, and
  • function-predicate, or function.

In short, a predicate is a (strictly Boolean-valued) function, but a function is not necessarily, and usually not, a predicate.

A predicate takes one or more argument(s) and evaluates to a Boolean value: true, or false. For $x, y \in \mathbb{Z}$, $\;x \leq y,\;$ is a predicate: its "output" is true, or false. $\;\leq(x, y) \mapsto \{\text{true or false}\}$.

Functions takes of one or more "arguments" (elements) in a set (from the domain of the function) and assign a unique element of another set (which is the range of the function). Note, sometimes the domain is the same set as the range. Arguments of the domain and elements of the range are in the "domain of discourse."

Note: Both predicates and functions have an associated "arity," meaning the number of arguments in in the domain that are mapped onto each value, or respectively, element, of range.

So, e.g., the "arity" of the predicate "x is a parrot": $P(x)$ is one; the arity of the predicate "y sits between x and z": $B(x, y, z)$ is three. In each case the output is true or false.

Addition of integers, on the other hand, is a function of arity two, which takes two numbers as arguments, say $x, y \in \mathbb{Z}$ and returns a number $z = x + y\;\in \mathbb{Z}$

Solution 3:

I would say that : predicate give you true or false based on your input(s). While, a function gives you an output per your input(s). So a predicate is a special function gives you only "true" or "false".