6

That makes me crazy to think about it because my book and other pages on the web talks about free and bound variables without any definition. I think everything in mathematics has a definition so there must be a definition for it.

Also, I am taking a course called abstract mathematics talks about how to proof and logic. I am curious about if logic and these proof study have another name in mathematics.

Smyra
  • 99
  • 2
    Using GOOGLE, you’ll find answers to your question. Like http://www.math.helsinki.fi/logic/opetus/log1/18_Logic_Predicate_Logic_free_bound_text.pdf. – mathcounterexamples.net May 11 '19 at 08:59
  • 2
    Yes an occurrence of a variable is bound if it is in the scope of a quantifier : the occurrence of $x$ in $\forall x P(x)$, otherwise is free : the occurrence of $y$ in $\forall x (P(x) \land Q(y))$. – Mauro ALLEGRANZA May 11 '19 at 09:06
  • 1
    @MauroALLEGRANZA How is it like to be a bound and free variable ? – Smyra May 11 '19 at 09:15
  • @Smyra Doesn't Mauro's definition satisfy you ? If so, please clarify what is still unclear. – Peter May 11 '19 at 09:29
  • 2
    What I know so far, A free variable is just a standing letter for an object but since the object isn't clear we can free to assert any object for the free variable. It can change the meaning of a statement. A bound variable is only a letter it doesnt mean it stands for an object and even we could change the letter the meaning of a statement will not change. It has a connection with a set. But the free variable also has a connection with a set since we choose our objects for free variable according to it. I dont understand clearly the difference in some cases like this. – Smyra May 11 '19 at 09:45
  • 2
    And I thought that if I have a clear definition like what is a function I could solve my problem. However what Mauro says just the names, they could be something else rather then free and bound variables. For example, I could say instead of free variable, ugly variable. It doesnt mean any sense for me unless I know their properties. It doesnt satisfy me. – Smyra May 11 '19 at 09:48
  • 1
    Probably, it is not the only names and someone can easily understand the meaning with the help of quantifiers. – Smyra May 11 '19 at 09:55
  • 1
    Thank you, for your help – Smyra May 11 '19 at 12:25

2 Answers2

6

Free and bound variables are defined in the context of the syntax of first-order logic, considering terms (i.e. "names" for objects) and formuals (i.e. statements).

The formal definition of the set $\text {FV}(φ)$ of free variables of a formula $φ$ is defined by :

all the variables occurring in a term or atomic formula are free.

$\text {FV}(¬φ) = \text {FV}(φ)$;

$\text {FV}(φ ∨ ψ) = \text {FV}(φ) \cup \text {FV}(ψ)$, (and the same for the other binary connectives);

$\text {FV}(∀xφ) = \text {FV}(∃xφ) = \text {FV}(φ) \setminus \{ x \}$.

A variable that is not free is bound.

A formula $φ$ is called closed if $\text {FV}(φ)=\emptyset$.

In formula $\forall x P(x)$, the variable $x$ is bound.

In formula $\forall x R(x,y)$ the variable $x$ is bound while the variable $y$ is free.


A closed formula, when interpreted, expresses a sentence, i.e. has a definite tuth value.

$\forall n (n \ge 0)$ is true in $\mathbb N$, while $\exists n (n < 0)$ is false in it.

What is the truth value of a formula with a free variable, like e.g. $(x > 0)$ ?

It depends... It depends on the value we assign to the variable $x$.

A free variable acts as a pronoun of natural language : its reference must be identified according to the context : if I say "it is red", the truth vale of the statement depends on the object I'm pointing at with my finger : the red book or the blue pen on my table.

In the same way, there are ways (defined by the formal semantical specifications of the first-order language : see variable assignment function) to give "temporary" reference to free variables of a formula.

Consider the formula :

$x+2=5$;

if we substitute to $x$ the (name for the) number $3$, we obtain a true sentence (i.e. $3+2=5$).

If instead we substitute to $x$ the (name for the) number $4$, we obtain a false sentence (i.e. $4+2=5$).

A formula with free var is called "open" because it has no (fixed) meaning : it is "open to" different interpretations; in order to give it meaning, we have to transform it into a sentence (i.e. a closed formula).

  • 1
    It is a high class answer! Thank you! – Smyra May 11 '19 at 15:48
  • “A variable that is not free is bound” can’t a variable be both free and bound? – Vivaan Daga Dec 01 '21 at 12:01
  • @Lobic - yes; we have multiple occurrences of a variable in a formula, some of which are free and some bound. E.g. $Px \land \forall x Qx$. – Mauro ALLEGRANZA Dec 01 '21 at 12:03
  • So can we at that a variable is bound iff there exists atleast one bound occurrence of it? [Thanks for the quick response] – Vivaan Daga Dec 01 '21 at 12:32
  • Is that the def? – Vivaan Daga Dec 01 '21 at 12:40
  • 1
    @Lobic - in what sense? Apply the "procedure" above to some formula... Let $\varphi := Px$ (atomic case). Then $\text {FV}(\varphi)= { x }$. Now, what is $\text {FV}(\forall x Px)$ ? Obviously $\emptyset$ and thus $x$ is bound in it. Consider now the case $\varphi := Px \land \forall x Px$; we have that the first occurrence of $x$ is free while the two others are bound. – Mauro ALLEGRANZA Dec 01 '21 at 13:02
  • Obviously, we can always avoid cases such that renaming bound vars, because $(Px \land \forall x Px) \equiv (Px \land \forall z Pz)$. – Mauro ALLEGRANZA Dec 01 '21 at 13:03
2

Unfortunately variables are really fiddly.

The problem of variables comes up a lot in computer science with respect to theories like the lambda calculus which neatly handles binding and substitution. If you permit a framework of multisorted higher order logic you can axiomize and define quantifiers in terms of the Simply Typed Lambda Calculus. A quantifier over a domain of discourse can be directly given a type of $\text{join} \colon (\text{domain} \rightarrow \text{prop}) \rightarrow \text{prop}$. Such a foundation of Simple Type Theory is used in practice in theorem provers like Isabelle/HOL. Look into The seven virtues of simple type theory for a bit more info.

The STLC doesn't directly solve variable binding but it does provide a nice example to formalize and generalize from. One of the simpler techniques for dealing away with the ugliness of variables and capture avoiding substitution which is often used in practice in metatheory is the use of de Bruijn indices. Basically variables are handled as numbers indexing are indexing into the local scope and so for example the constant function $\lambda x y. x$ becomes $\lambda. \lambda. 1$. If you are interested in this sort of stuff there's a nice blog post on binders by Jesper Cockx.

If you are not happy with this sort of approach you can compile down the STLC to Cartesian closed categories. See Compiling to Categories by Conal Elliott. BCKW is probably a more traditional sets of combinators to compile down to. Unfortunately the full category theory treatment of dependent types and quantifiers in terms of slices and subobjects is pretty eldritch. I think really one of the only areas a combinatorial approach is used in practice is the class comprehension metatheorem of NBG set theory where formulas for classes are compiled down to permutations of tuples and such.

More direct approaches to dealing with variables are the area of Algebraic Logic. You probably want to look into Alfred Tarski's Cylindrical Algebras where basically you can treat existential quantifiers as a sort of modal operator. There are also other approaches to the problem such as polyadic algebras but I don't understand them as well.

Lastly I feel like I ought to mention Hilbert's indefinite description operator which arguably makes some problems with variables worse by interleaving propositions and terms but can simplify metatheory. $\varepsilon x. P(x)$ is used to describe "an indefinite term such that P is true." Existential quantification can then be defined as $\exists x. P(x) \equiv P(\varepsilon x. P(x))$.

You don't mention the issue but in addition to free and bound variables there are also the problems of global and local definitions and definitorial expansion. In some cases you can desugar local definitions to lambda expressions $\textbf{let} \, x := e \, \textbf{in} \, e' \equiv (\lambda x. e) e'$ although for technical reasons highly specific to computer programs this doesn't always work. The most succinct method of dealing with global variables might be to abuse a definite description operator.

Also this isn't really a problem for first order logic but computer science needs to deal with control flow/continuations as another kind of variable. However, focusing as in the lambda bar mu mu-tilde calculus is nondeterministic.

I hope I have convinced you it is possible if not actual that someone has formalized capture avoiding substitution of variables correctly and that if you are a Cylon you can Schonfinkle everything to an unreadable mess free of name binders. Unfortunately variables are really fiddly.