If a 'variable assignment' function maps from a set of symbols, would it be correct to formulate a variable as simply a particular symbol that performs the role of a variable in my language? So when we write "'x' is a variable" we are unambiguously referring to the symbol 'x' which is indeed a variable in our language?

  • 1
    Yes, technically a variable is a symbol, though sloppily by "x" one often also refer to the value assigned to that variable rather than the symbol itself. Oct 12, 2022 at 20:29
  • 2
    Well, '5' is a symbol too, a numeral representing the abstract number 5. So calling a variable a symbol does not distinguish it from a constant. In logic texts they talk about variable symbols and constant symbols.
    – user4894
    Oct 12, 2022 at 20:57
  • 1
    @user4894 this is my exact point, a variable is a symbol that acts as a 'variable'.
    – Confused
    Oct 12, 2022 at 21:21
  • To say that "a variable is a symbol that acts as a 'variable'" is begging the question, because if a symbol refers to something (a name for an object) to say that it "acts as a 'variable'" seems to allude to the fact that there are some sort of "variable objects", which is not. Suggestion: consider again the role of pronouns in natural language. Oct 13, 2022 at 7:27
  • But yes, "x" is a symbol. Compare "x is red" with "it is red". Oct 13, 2022 at 7:29

1 Answer 1


In a formally-defined language, there is a list of defined symbols. The language may classify symbols according to their meaning. Common classes include constants, functions symbols, predicate symbols, connectives, quantifiers, and variables. So, yes, a variable is a symbol.

What makes a symbol a variable (other than the stipulation of the language)? There are basically three ways that a symbol is given a meaning in formal languages:

  1. An interpretation rule which directly specifies what a symbol means. For example, one rule might be that [P & Q] is true if and only if P is true and Q is true. This defines how the symbol "&" is to be understood in the language.

  2. A mapping in an interpretation function. An interpretation function maps symbols in the language to some set of values which we might call the domain. For example, the symbol "0" might be mapped to the number 0, and the symbol "succ" might be mapped to the successor function.

  3. A variable assignment, which, like an interpretation function is a mapping from symbols to the domain. But unlike an interpretation function, a variable assignment varies with context. For example there might be an interpretation rule that [∀xP] is true if and only if P is true for every variable assignment that assigns x to any member of the domain.

A variable assignment is like an interpretation because it maps symbols (specifically variables) to values in the domain, but the interpretation function is the same everywhere, while a variable assignment varies with context as defined by an interpretation rule. Also there isn't typically a single variable assignment that applies to a variable in a sentence. Normally, there is a set of variable assignments as in the example of [∀xP].

  • I don't understand this from the standpoint of math or logic, but I know that as a programmer, variables differ from this in a mysterious (to me) way. In math, a variable stands in for all possible values of some parameter. But in programming, it holds exactly one value at a time. So you can write things like x=x+1 without breaking the universe. To the people who say that a variable is an association between a name and a value, I say, that misses the point and is incomplete. So in short... I just wanted to mention this.
    – Scott Rowe
    Oct 13, 2022 at 14:02
  • 1
    @ScottRowe even if something has a particular value at a particular time, the statement x=x+1 is still wrong, but using programming languages where x on one side is the new value and on the other side the current one at the time the command is ran, it's more that mathematics uses entirely boolean equality and in programming '=' has a different meaning.
    – Confused
    Oct 13, 2022 at 15:50
  • 1
    @ScottRowe, in programming languages a variable is completely different from what it is in formal logic or mathematics. The computer memory is generally represented as a mapping from locations to values, and a variable is associated with a location (typically a different location every time you enter the context of the variable). An assignment statement is represented as a function that changes one store to another. Oct 13, 2022 at 16:12
  • It is kind of too bad that programming languages started using = and using the word variable. We could have called them symbols instead.
    – Scott Rowe
    Oct 13, 2022 at 17:33
  • 1
    @ScottRowe - sorry, my last statement is quite unclear. IMO it is not that programming is unrelated to logic, math or philosophy. IMO, the issue whether the symbol "x" is a symbol or not is not a philosophical issue: a symbol is a symbol. Oct 14, 2022 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .