# How does assignment work? [closed]

The only place that 'assignment' is dealt with in any kind of formal context is in formal logic, the idea of a variable assignment function is one I wish to understand in simple terms to allow me to understand the concept of assignment in less formal terms such as in scientific formulas where variables are used in a less formal way to generalise scenarios and contexts.

How does the treatment of assignment work in FOL and how does this reflect in less formal scenarios, should I use this to better understand and explain the same method in elementary algebra/calculus scenarios?

To what extent can we evaluate the idea of 'truth' in a variable assignment, is there a concept of a formula being 'true' under an assignment?

• There are no assignment functions in formal mathematics. Feb 2 at 23:07
• @DanChristensen ? Care to elaborate? Feb 3 at 1:02
• @lemontree You can think of computer memory as a giant array of numbers or other symbols. Variables and constants in the program code are assigned a location in this array. Example: Location 10455833 may be assigned to the variable X. Location 94476849 may be assigned to the variable Y. When the programing code "X=Y" is executed, the numbers or letters stored at location 94476849 (Y) are copied to location 10455833 (X). The contents of Y remains unchanged. Feb 3 at 1:50
• It would help if you clarified how far your 'less formal' usages are to (computer) programming Feb 3 at 4:59
• See this post. Feb 3 at 6:49

If you want a metaphor, you can think of assignment functions as pointing fingers.

Variables are like pronouns: `Old(x)` means "It is old". A variable is a term, i.e. an expression that stands for an individual object. But unlike constant names such as `monalisa`, which have a fixed reference, the interpretation of variables depends on the context. That context is provided by the assignment function. The assignment function maps variables to objects - effectively "pointing" pronouns to referents.

For free variables, we need to provide an assignment function to be able to make sense of the formula at all; there is no way to determine the truth value of `Old(x)` without knowing what value is assigned to `x`. Likewise, there is no way to tell what is meant by "This is old" unless you're pointing at the object you're talking about, literally or by introducing it as the relevant referent in the discourse context (as in, "I bought a painting yesterday; it is quite old"). By pointing at a particular object while we utter the sentence, we can give meaning to "it". A sentence with free variables is true iff it is true for the object the given variable assignment is pointing the variable at.

For bound variables, when we quantify, we're abstracting over possible referents in the universe: `Ax(Picture(x) -> Old(x))` means "For every object in the room, if it is a picture, then it is old". Here, "it" refers not to a single object throughout the sentence, but rather serves as a placeholder for possible objects that we iterate over when evaluating the quantifier. Essentially, `Ax(Picture(x) -> Old(x))` amounts to saying that every way of pointing at something in the room makes the sentence "If it is a picture, it is old" true. Likewise, `Ex(Picture(x) ^ Old(x))`, meaning "Some pictures are old", amounts to claiming that there exists at least one object we can point at and say "This is a picture and old" truthfully. Here, we're not steadily pointing a finger at one thing while uttering the sentence, but rather virtually going through every thing in the room saying "This is an old picture or this is an old picture or this one is", pointing at a different thing each time. An existentially quantified sentence is true iff the embedded it-sentence is true for at least one object to point the pronoun to; a univerally quantified sentence is true iff the embedded it-sentence is true for every object we could possibly assign the variable to.

In this metaphor, the mappings for the different variables defined by one assignment function amounts to using different fingers: I can say "This is old and that is new", pointing my right index finger at one thing and my left index finger at another. The combination of mappings between pronouns I use and fingers I'm pointing for them is the assignment function.

With nested quantifiers, this naturally extends to different combinations of pointing fingers at things: "Every picture is in a frame", formalized `Ax(Picture(x) -> Ey(Frame(y) ^ In(x,y)))`, means "This (pointing at picture number one with the right hand) is in that (pointing at frame number 1 with the left hand) frame or this (still pointing at picture number one with the right hand) is in that (pointing at frame number 2 with the left hand) frame or ... and this (pointing at picture number two) is in that frame (pointing again at frame number one) and ...)", so that there is at lest one frame we can successfully point at for every of the pictures we can point at.

• Assignment operators in programing languages simply copy information found at one location in computer memory to another. It takes a certain amount of time to complete this operation. The state of this memory changes over time. There is nothing comparable in formal predicate logic or set theory. You can think of every thing in mathematics as being true in the present and remaining unchanged over time. Changes over time are strictly in the realm of science. Feb 3 at 0:09
• @Dan Christensen Ok... But there still exist a thing called "assignment function" in logic which is what's on topic for this thread. Feb 3 at 1:05
• I have never seen "assignment functions/operators" mentioned in any context other than in computer programming languages, e.g. A=B, A:=B, or move A to B. Not in formal logic or mathematics. There is simply no need to formalize such functions in these areas AFAICT. Feb 3 at 1:26
• I must assume you haven't read a lot outside programming languages then. All of the first three textbooks on mathematical logic I could think of contain the word "assignment {_ / function / to variables}", with the meaning the OP and I am talking about. I'm happy to provide you with the references if you don't believe me. Feb 3 at 1:48
• My Ebbinghaus and Flum (1984) has no entry for "assignment" or "assignment function." Feb 3 at 2:08

There are no assignment functions in formal mathematics. – Dan Christensen

Given the comments on this post, let's get into the philosophy of language. The TLDR is assignment is a form of definition, the stipulative definition, and all theories employ it, though philosophy, mathematics, and computer science go about it in their own, overlapping dialects. Assignment is a speech act that imputes truth to a proposition.

There certainly are assignment functions in all theories, and even though are usually not referred to as such, we call them definitions. In mathematics, the magical 'let' is a speech act which transforms a conjecture or intuition into a true proposition. "Let x be 5" is a mathematical assignment insofar as it assigns a value to a variable. Why is it true? Because the author says so! This is what stipulate means. Logicians of course have formalized this sort of practice a bit, but the actual act itself nonetheless has the function of assignment, even if it isn't often recognized as such.

There's a certain interconnection between logic, mathematics, and computer science (as recognized by Curry-Howard and also by intuitionist mathematical philosophers (such as Per Martin-Löf and others). Therefore it should be no surprise that assignment occurs in all three, albeit in different ways.

• In logic, assignment is usually done with the syntax and semantics of existential and universal quantification explicitly. (∃x∀y)
• In mathematics, assignment is usually done with the syntax and semantics of existential and universal quantification implicitly often with arithmetic and set-theoretic operators (x=5:x∈ℕ)
• In computer assignment, assignment is usually done with the assignment operator and other peculiar syntactical conventions (x:=6.2f;)

The only place that 'assignment' is dealt with in any kind of formal context is in formal logic

Computer science takes assignment very seriously because computer scientists who write compilers have to create a syntax (usually expressed in BNF) and manufacture an adequate semantics for it (write a functional compiler). Therefore, there are formalisms related to compiler design that persist because assignment is a first-class operation (in fact, one simply can't write a programming language without them). Furthermore, formalisms of machines are usually written in set-theoretic (read mathematical) terms, where assignment is conveyed by the notion of functional mappings. Turing machine definitions include the concept of initial state, and assignment operation can be seen as taking inputs and associating them with initial state. Thus, a compiler may create a variable in a table and assign it an initial state of 0, but then given additional syntax, may then set that value to what the programmer wants after the act of creating the variable. In Dartmouth's original form of BASIC, the syntax actually used "LET" reflecting the mathematical origins of computer science.

Now, the act of definition does have some wrinkles in it, for example the advocates of early truth-conditional semantics (Frege, Russell, et al.) consider definitions imperatives and incapable of truth values, but a more relaxed interpretation of definition (there are three schools of thinking on the nature of definition in the literature) differentiates the act of definition or assignment from that of the proposition it contains much in the way propositional attitude and the propositions themselves are distinct entity. Thus, the imperative "assign 5 to x" can be read as "Let it be true S" where S is "x=5". To me, it's unintentional equivocation to confuse the speech act of definition with the actual definition itself much in the way that an assertion is more than a proposition.

Some of the comments indicate some scrapping over the phrase "assignment function", so what is fair to infer is that "assignment function" means different things to different people, however, part of the methodology of analytic philosophy is to examine the language, and try to make sense of defintions and their use. Thus, it's plain to an analytical philosopher that "assignment function" can be interpreted in several ways:

• Formal mathematical function language where mappings are constructed using canonical notation such as f:AxB where assignment is done by calculation.
• Computer science language where assign() can be used invoking imperative and declarative statements using something like := for assignment.
• The logical notions are explicated on by lemontree

But in the end, all assignment reduces to notions of definition which is to be understood as a philosophical topic in the philosophy of language. The best resource I own on definitions (and by extension the philosophical underpinnings of assignments) is Robinson's Definition which has a copyright of 1954 and is from Oxford Press. No preview is possible for Google Books. Looks like there are a few contemporaneous attempts also.

To what extent can we evaluate the idea of 'truth' in a variable assignment, is there a concept of a formula being 'true' under an assignment?

So, there to review and answer your question explicitly, there is a concept of a formula (form, statement, utterance, proposition, etc.) being true under an assignment, and is known as a definition which enjoys its own taxonomy. In mathematics, logic, and computer science, such assignments are generally species of stipulative definition. From Robinson, p. 61:

'Let us mean by a "pencil" a right cylinder whose cross-section is a regular polygon... This type of nominal definition was called 'sipulation' by James Mackaye in his The Logic of Language.

• If you bring in CS you muddy the waters by not mentioning this: John Backus may well be called the father of programming langs by inventing FORTRAN in 1957. For which he received the most prestigious Turing award in 78. In which he (effectively) lambasts the assignment in mainstream (so-called imperative) languages as a misguided and anti-mathematical construct. A more recent and well known update on the same is John Hughes. Feb 4 at 13:10
• In short: To say "assignment in PLs = assignment in logic" is a mistake. To say "assignment in PLs is unrelated to assignment in logic" is equally a mistake. To say "assignment in PLs is a mistake" is likely the most accurate!! [And if you find that polemical I refer back to Backus, Hughes and other research in 'functional programming' ] Feb 4 at 13:14
• @Rusi-packing-up I'll review the argument, thanks. I'm don't know that computer science necessarily need to conform to mathematical thinking strictly, but I'll assume that this is the "functions should be pure and free of side effects" cry.
– J D
Feb 4 at 16:16
• @Rusi-packing-up I did scan the Backus and he opens up with a salvo against von Neumann architecture! History certainly hasn't decided in his favor in terms of manufacture.
– J D
Feb 4 at 16:20
• Backus' argument may seem to be against extant machine architecture. It actually is against languages designed to closely conform to that architecture. In more traditional CS speak he is for much higher level machine independent languages. Caveat: hi level not in the OOP sense of better (clerical!) organization of the same old imperative atoms. But a deep math/logic respecting change of the atoms themselves, to the extent that the very notion of statement (therefore assignment in particular!) gets elided in favor of expressions Feb 4 at 17:48