# Is it a rule of formal languages that all occurences of a symbol must 'refer' to the same object?

A rule of subsitution is that we replace all free occurences of a symbol x with free occurences of a symbol y to subsitute y for x in a formula φ.

Hence the sentence 'x=x' is inherently true for all x if '=' is our identity relation as each occurence of 'x' may be replaces with a reference to the same object under the assignment function.

In written languages you may see sentences like, 'I need him, him and him' where 'him' refers to a different person each time (based on the pragmatics of the context).

Obviously natural language and conversation is not entirely formal, yet in most formal languages such as that used in Mathematics if I introduce a variable x every occurence of x has to be considered as referring to the same mathematical object.

• The observation in the body seems to answer the question in the headline. What sort of answer are you looking for? Jan 9 at 13:15
• Yes; the formal counterpart of 'I need him, him and him' (plus pragmatics of the context) is "I need x, y and z". Jan 9 at 14:00
• IF we do not follow the rule, form x=x we can derive 0=1. That's all. Jan 9 at 17:24
• This sort of issue is why logicians and computer programmers developed unique languages to express logic and algorithms in. Natural language is too vague and malleable to support fully valid logic. Jan 9 at 17:27
• The answer to the question in your title is simply "yes". Jan 9 at 18:56

A variable has a context, and within that context, all instances must denote the same object, but in different contexts, the same name can denote different objects. For example, here is one way to express the second-order induction axiom in Peano arithmeteic:

(∀X)[(0∈X∧(∀n)[n∈X→n+1∈X])→(∀n)[n∈X]]

In the above, n occurs as the bound variable for two different universal quantifiers. It means something different in each instance. Whether you would call n the "same variable" in both cases depends on specific terminology. I would say that they are different variables with the same name.

In your example with "him", the word "him" is not like a variable because it is being used as an indexical, a place-holder that must be filled in by the extra-linguistic context. Other indexicals include "me", "now", and "last year". However, there are contexts in which "him" is used much like a variable. For example:

Mary says she gave the keys to John, but John says she didn't give them to him, and Dan says she gave them to him instead.

This is an awkward phrasing that your editor should ask you to improve, but in this case the first "him" seems to act like a variable referring to John and the second is like a variable referring to Dan.

• I find it confusing, in some logical situations can you have a variable where each occurence acts differently in the same formula? Why in this particular case does it work? From my (limited) understanding it would be an incorrectly defined formal language? Jan 9 at 23:05
• The quantifier is said to bind the variable. It only has meaning within the expression that directly follows the quantifier. All instances in that expression refer to the same thing. All instances outside of that expression refer to something different. Jan 10 at 2:00
• ah yes, I forgot about that, the constants are defined in the formal langauge but the scope of the variable is defined within the expression (and perhaps some simplifications later on). Jan 10 at 13:27

Is it a rule of formal languages that all occurences of a symbol must 'refer' to the same object?

It's a rule, specifically a convention, so yes. Why is it a convention? Because when you have a symbol represent more than one different thing, it creates ambiguity. Generally accepted practice to differentiate is often using tick marks or subscripts if one wants to use very similar labels, say, of items belonging to the same class. Consider:

S1 A contains a, a, a
S2 A contains a1, a2, a3

Does S1 contain three separate as? From a semantic perspective, they all seem to be the same. From a syntactic perspective, if they're written more than once, it seems to suggest no. S1 could be a multiset, for instance, or it could be a problem of naive set theory to test if a student understands that sets can only contain one of an element no matter how many times written. S2 on the other leaves no doubt that the elements in some important way differ.

In written languages you may see sentences like, 'I need him, him and him' where 'him' refers to a different person each time (based on the pragmatics of the context).

In natural language, there's a lot more context so it might be easier to tell without explicit notation, but still, by conventions, one would never put such a sentence in a deposition or a history essay for exactly the same reason. It might be interesting to note that there seems to be conventions for spoken language too. One widely accepted set of conventions are known as the Gricean cooperative principle which is illustrated by some maxims. In the sentence you offer, having three hims is an example of the use of deixis which is the use of reference to an object outside of the language itself:

In linguistics, deixis (/ˈdaɪksɪs/, /ˈdeɪksɪs/)2 is the use of general words and phrases to refer to a specific time, place, or person in context, e.g., the words tomorrow, there, and they. Words are deictic if their semantic meaning is fixed but their denoted meaning varies depending on time and/or place. Words or phrases that require contextual information to be fully understood—for example, English pronouns—are deictic.

Just remember that conventions of language are just that: conventions. While you can follow convention or oppose it (ee cummings comes to mind), generally there are social consequences, so sometimes its important to go along and get along. One could write an entire math paper using the same variable with numerical subscripts, but getting it published might be a tough sell

• This clarifies a lot for me, in the example you give with S1 and S2, there is still a chance that the three elements could be the same in S2? But I guess the difference between the case is that in S1 we don't have that posibility, it is a certainty. Jan 10 at 18:58
• Well, to be technical, we would say that a1, a2, and a3 might be different senses of the same reference they label. They certainly could be the same, but by numbering them differently, we are creating the impression they are the same. Thus, an author is trying to create an impression they're similar in the S1, and different S2. To what extent they are the same and different is contextual.
– J D
Jan 11 at 0:05

To my knowledge, the translation of I want him, him and him is as follows:

Wcx & (Wcy & (Wcz & (~(x = y) & (~(x = z) & ~(y = z)))))

where ...

c = Confused (the OP), I

Wxy = x wants y

So, NO, variables are not bound to a particular value it is given.

• If y=~x, ~x=z then by transitivity y=z and ~(~y=z), no?
– J D
Jan 11 at 0:07
• ~x= y means x is not identical to y; it doesn't mean not x is identical to y. Jan 11 at 4:56
• I thought that required parens since negation has higher precedence than comparison? How do you write not x is identical to y?
– J D
Jan 11 at 19:59
• Like this: math.stackexchange.com/a/1424998/712729
– J D
Jan 11 at 20:11
• @JD, gracias, will edit the post. In logic texts, you'll find ~x = y to mean x is not identical to y. I can see it leads to confusion which is to say the notation needs to be disambiguated. Jan 12 at 8:01