Which are the Bound and Free Variables in these expressions?

Intuitively the variable is bound if it was introduced in the formula, while it is free if it comes "from the outside".

For example, in $$\forall x.\ \exists y.\ \phi(x,y,z)$$ we have $x$ introduced by $\forall$ quantifier and $y$ introduced by $\exists$ quantifier. On the other hand, $z$ comes from outside, or in other words, is not bound by any quantifier.

Please, beware of different variables with the same names, e.g. $x = x \land \forall x. x = x$ has two variables, which becomes obvious if you rewrite the formula as $x_1 = x_1 \land \forall x_2.\ x_2 = x_2$ (sometimes it might happen that we would like to say that there are even more than two variables, but I doubt you should concern yourself with such curiosities right now). As the example shows, one of the $x$-es is free ($x_1$) and the other $x$ ($x_2$) is bounded, even if at the beginning those had the same name. (Of course, it is a good practice to avoid such situations, however, as always, there might be some special cases where it would be even desirable.)

As for the second case, the integral sign $\int f(t) \, \mathrm{d}t$ binds $t$, similarly to how $\sum_{i = 0}^{n} a_i$ binds $i$, but NOT $n$. The dotted notation $\int \cdots \int$ is to be understood as those integrals are all there, that is for $n = 3$ we have $\iiint f(x_1,x_2,x_3) \, \mathrm{d}x_1 \, \mathrm{d}x_2 \, \mathrm{d}x_3$, i.e. all the $x_i$-s are introduced by integrals and none of them are free. This also the case in your $\int \cdots \int f(x_1,\ldots,x_n) \, \mathrm{d}x_1 \, \ldots \, \mathrm{d}x_n$. However, you missed one additional variable, namely $f$. It denotes a function, but it is still a variable (roughly a letter without any special meaning). None of the integrals bind $f$. $f$ and $n$ (appearing in $x_n)$ are free; that is, they could be substituted for anything (as long as the formula makes sense, so it has to be a function).

In the first case you correctly observed that $h$ is bound by the limit, or in my words introduced. You also correctly claimed that $x$ is free, and as in the second case, you missed $f$, which is also free.

Concluding, I would like to note, that $\phi$ from the third case might or might not be considered free, depending on whether you recognize it as a variable or not. The usual convention in logic is that $\phi$ (and any other symbol denoting formulae) is a special symbol and it is not to be considered a variable (and thus neither free, nor bound). Depending on the context and used convention, in analysis $f$ might or might not be treated as a variable, for example during the first semester of calculus usually it isn't to avoid confusion, but later, at functional analysis course it certainly is (consider problems like "solve for $f : \mathbb{R} \to \mathbb{R}$, $f(x+y) = f(x)\cdot f(y)$").

I hope this helps $\ddot\smile$

Edit: Thanks to user87690 for being scrupulous.

Edit 2: Some more explanations. Many, many, many more explanations. It may screw your mind or your computer screen, use at your own risk. Also, despite trying to be precise, I did fail. This is quite a long text, I don't know if I will be able correct all the mistakes, even if pointed out, so sorry if your comment might get ignored.


To be more precise, we need to overformalize a bit, I will say some things are wrong, but that's unclear at best, because it's also wrong to overformalize. Mathematics has a long history of notation abuse and this is for the sake of simplicity, a valuable goal indeed. However, logic is peculiar in its ways, and to correctly resolve all the issues, we have to be specific, and this becomes cumbersome when you have to deal also with a number of special cases and tons of syntactic sugar. I will try not to confuse you, but it might be hard...

This being said, I also use some notations and conventions, and one cannot be free, because I would have to write a whole book to define all the concepts, and there still be many, many issues. One such convention is dot usage, e.g.

\begin{align} &\forall x.\ \exists y.\ \phi(x,y,z) \\ &\forall x{:}\ \exists y{:}\ \phi(x,y,z) \\ &\forall x\cdot\exists y\cdot\phi(x,y,z) \\ &\forall x \mid \exists y\mid\phi(x,y,z) \\ &\forall x\ \exists y\ \phi(x,y,z) \\ &\forall_x\ \exists_y\ \phi(x,y,z) \\ &\forall x\ \exists y\ (\phi(x,y,z)) \\ &\forall x\ (\exists y\ (\phi(x,y,z))) \\ &(\forall x)\ (\exists y)\ \phi(x,y,z) \\ &\bigwedge_x\bigvee_y\phi(x,y,z) \\ \end{align} would all denote the same formula with different notations. Each of those has its advantages and disadvantages, strengths and weaknesses. I picked the first because it works in wide range of contexts, e.g. it is similar to a dot in $\lambda$-calculus, doesn't clash with other separators (I can use comma for multiple variables or multiple formulas; colon is frequently used to denote types), and doesn't involve a huge number of parentheses, one huge weakness is that in hand-writing it is hardly visible, and, of course, there are those who hate dots used this way. One thing worth to mention is that $\bigwedge$ and $\bigvee$ can have nowadays a slightly different meaning, i.e. $\bigwedge_{i \in \mathbb{N}} x_i$ would be $x_0 \land x_1 \land x_2 \land \ldots$. Finally, observe that some formulas have dots or commas as text symbols, for example when a sentence or a phrase ends.

$4.$ The above should partially answer your confusion. To address the rest, $x = x \land \forall x.\ x = x$ could be rewritten using a brace (another wide-spread convention) as $$\begin{cases}x = x\\\forall x.\ x = x\end{cases}$$ or with variable indices $$\begin{cases}x_1 = x_1\\\forall x_2.\ x_2 = x_2\end{cases}$$ Please observe, that the quantifier is written before the formula it quantifies and its scope extends as far right as it can, so

$$\forall x. x = x \land x = x \quad \text{ is } \quad \forall x_1. x_1 = x_1 \land x_1 = x_1,$$

but

$$(\forall x. x = x) \land x = x \quad \text{ is } \quad (\forall x_1. x_1 = x_1) \land x_2 = x_2.$$

The use of a quantifier suggest that what follows is a logical formula (first order, or something else, depending on the context). Therefore, usage like "...contains no restrictions on $x_i$ $∀1≤i≤n$" is bad. Even if the meaning is clear, typing "for all" works independent of the context, while writing $∀1≤i≤n$ at the end of a sentence is mathematically ungrammatical, mixes text and math symbols ($g\nu\epsilon{}s_5\ \omega\hbar\gamma\ {+}\mathbf{h}\ddot\iota{}s\ \lfloor\mathrm{s}\ \beta\mathtt{a}\mathrm{d}$), breaks the flow and suggest some additional formality which is not there (creating even more confusion). On the other hand, with a proper use of quantifiers you employ the semantics of the logic in context (usually first- or second-order logic) and get (instead of intuitive explanation), a formal definition. Naturally, there is place for both and misusing/overusing any of the above is a bad practice.

$2.1.$ First I need to clarify one thing: $f(x)$ is a point, not a function. The function is $f$ and when applied to $x$ we get $f(x)$. When $x$ is free/unbound/whatever, then one may argue that $f(x)$ is an expression, but it certainly is not a function. The functions are $f$ or $x \mapsto f(x)$ (or in computer science we could write $\lambda x.\ f(x)$).

Talking about $f(x)$ being a function is quite common, but it's wrong (if you want to being formal), in particular it is ok to write $\int f$ or $\int f(x) \mathrm{d}x$, but it's not ok to write $\int f(x)$. (The last one looks weird, right? Also, there are missing ranges in all those expressions.) A very similar example is $\int f(x) \mathrm{d}x = F(x)$ and there are two issues. First could be solved like this $\int f(x)\mathrm{d}x = F$ or $\int f(x)\mathrm{d}x = y \mapsto F(y)$ or $(\int f(x)\mathrm{d}x)(y) = F(y)$. The second is the fact that the expression is ambiguous with regard to integration constant (i.e. $y \mapsto F(y) + 1$ also fits). In fact $\int f$ or $\int f(x) \mathrm{d}x$ usually denotes the equivalence class for equivalence relation $$f \sim_1 g \stackrel{\text{def}}{\iff} \exists \alpha.\ \forall x. f(x) = g(x) + \alpha$$ or even (with Lebesgue integrals) $$f \sim_2 g \stackrel{\text{def}}{\iff} \text{ there exists $\alpha$ such that $f = g + \alpha$ almost everywhere}$$

Note that the addition operator $+$ was defined only for numbers, not functions, and $f = g + \alpha$ is another abuse/convention which formally should be written as $f(x) = g(x) + \alpha$ with some appropriately quantified $x$, or like this

$$f \sim_2 g \stackrel{\text{def}}{\iff} \exists \alpha. \mu(\{x \mid f(x) \neq g(x) + \alpha\}) = 0,$$

where $\mu$ is some measure. Here the set notation $\{x | \ldots\}$ also binds $x$ inside the braces (any $x$ outside the braces would be free).

Now to answer the main question, there are two main ways symbol $\int$ could be used:

  • with specified range: $\int_{[0,2\pi]} \sin = 0$ or $\int_0^{2\pi} \cos(\alpha)\ \mathrm{d}\alpha = 0$ (yet again, there are many conventions),
  • as a linear operator that "processes" functions, you put in one function, and it spits out another, or using mathematical terminology, its domain is a set of functions, and the value range are functions too (or to be more specific, equivalence classes of functions),
  • there is some mid-way when writing like $F(x) = \int_0^x f(t) \mathrm{d}t$, you use a definite integral, but extract a function $F$ out of it (here, it actually is a function, not an equivalence class); another way of writing it down would be $F = x \mapsto \int_0^x f(t) \mathrm{d}t$.

This bring us to what $F(x) = \int f(x) \mathrm{d}x$ means. First, there are two $x$-es which are different $F(x_1) = \int f(x_2) \mathrm{d}x_2$. Now we could interpret it in two ways:

  • $F = \int f(x_2) \mathrm{d}x_2$, the equivalence class (or some canonical representant),
  • $F(x_1) = \int_{?}^{x_1} \mathrm{d} x_2$, where we don't know actually what $?$ is, but it probably doesn't matter, i.e. the results would differ only by a constant, so we can again take the equivalence class.

All in all, by different interpretations we arrive at the same result (almost). Now, to answer how $\int \ldots \mathrm{d}x$ binds $x$, it all roughly means "$\mathrm{d}x$ tells us where the input should go", but let's consider those two cases:

  • A definite integral: $\int \Phi \mathrm{d}x$ specifies which symbol should be substituted for, that is, you calculate (by your definition) $\lim_{n \rightarrow \infty}\sum_{i = 1}^n \Phi[x \mapsto x_i^*] \Delta x$ by substituting $x_i^*$ for $x$ in $\Phi$ (here $\mapsto$ in brackets has different meaning), which later goes into its definition, where you replace all the occurrences of $x$ (this particular $x$, not other $x$-es if there are any).
  • An indefinite integral: $\int \Phi\mathrm{d}x$ specifies that your input is a function (or some other similar object) defined as $x \mapsto \Phi$ (here $\mapsto$ without the brackets has meaning as used at the beginning). With this approach the symbol $\mapsto$ binds $x$, for example if $\Phi = f(x)$, then $x \mapsto f(x)$ is equivalent to $f$ and the symbol $x$ was removed.

Analogical situation happens with derivatives, where $(x^2)' = 2x$ is yet another convention or notation abuse. The formal way to write it would be $(x \mapsto x^2)' = x \mapsto 2x$. That's why $f'(x)$ is ok, because it is $(x \mapsto f(x))'(x)$, but $(f(x))'$ is bad. This is in contrast with $\frac{\mathrm{d}}{\mathrm{d}x} f(x)$ where $\frac{\mathrm{d}}{\mathrm{d}x}f$ would be bad (in other words, $\frac{\mathrm{d}}{\mathrm{d}x}$ binds $x$).


That was some huge edit, I hope I didn't confuse you that much...


The concept of bound and free occurrences of variables is a matter of structure of notation, it's a matter of syntax. You can think of a mathematical expression as a tree structure. Variables and constants are end-nodes. Function symbols or operators have their operands as child nodes and a subtree represents a subexpression. There are symbols which bind the occurrences of variables in the subexpression. The logical quantifiers are the most obvious example.

For your third example, $x$ and $y$ are bound and $z$ is free because there are quantifiers binding $x$ and $y$. Note that being free or bound is a property of variable occurrence not the variable itself. For example in $(x = z) ∨ ∀x, ∀y, φ(x, y, z)$, the first occurrence of $x$ is free and the second is bound. One important thing about this concept is, that it makes sense to substitute only into free occurrences, and that's how substitution is formally defined and why the concept of free and bound occurrence is needed. So if you substitute $x = 3$ into example above, you get $(3 = z) ∨ ∀x, ∀y, φ(x, y, z)$. That's also hint how to distinguish them since e.g. $∀3, ∀y, φ(3, y, z)$ doesn't make sense.

For your first example $\lim_{h \to 0}$ is syntactic element which binds the variable $h$ and that's why $h$ is bound. For your second example $∫…∫ (–) dx_1 … dx_n$ is a syntactic element which binds variables $x_1, …, x_n$, so they are bound. Note that $∫\cos(x)dx = ∫\cos = \sin = \sin(x)$ so when you write $∫\cos(x)dx = \sin(x)$, then the $x$ on RHS is actually different $x$ then the one on LHS.

Tags:

Logic