Hacker News new | ask | show | jobs
by smadge 2988 days ago
I agree that “=“ as interpreted by people doing math requires context, but in most situations they are able to translate it into a “correct” or formal notion of equality. For example, translating on the fly these ad hoc notions of equality into precise notions of equality in first order logic and/or set theory. For example,

  f(x) = 2x + 3
Might be translate into something like,

  For all x in the domain of f, f(x) = 2x + 3
Or maybe further,

  f = { (x, y) in Cartesian product of domain and codomain | y = 2x + 3 }
Where equality is, I think, strictly defined here as set equality.

The articles other point in this example is that we might way “when x = 2, f(x) = 7.” Claiming that x is used both as an indeterminate value and a concrete value. Again, I think the ambiguity is resolved when translate using the correct quantifies, something like “for all x in the domain of f, if x = 2, then f(x) = 7.”

Or perhaps you might claim, “there exists an x in the domain of f such that f(x) = 7.” The important point being that the function f is formally NOT the formula f(x) = 2x + 3, but a particular set of ordered pairs, of which you can make formal statements about in first order logic.

Another example used was

  A = {n^2 | n = 1, 2, ... 100}
But again this is just “syntactic sugar” that a reader would translate into perhaps

  A = { n^2 | n in {1, 2, ..., 100}}
2 comments

This comment contains an important key distinction between different usages of "=" that are often casually intermixed in such discussions: There is a major difference in how we quantify the logical variables that occur in formulas.

For example, if we consider the atomic formula x = 5+y, then we may mean the identity ∀x∀y (x = 5+y), where all variables are universally quantified.

Or we may mean ∃x∃y (x = 5+y), where the variables are existentially quantified. To determine whether this holds, we can search for a solution given by a substitution that makes the terms equal modulo some theory E we associate with =. If E is empty, then this corresponds to syntactic unification.

Confusingly, in the literature, sometimes "equation" is used for both, and an entire subthread in this discussion is due to this issue.

When one is asked to "solve for x" etc., then one answers whether there is any solution, thus solving the existentially quantified version. When one means "this identity holds", then one states the universally quantified sentence.

You're trying too hard. The problem with "=" is usability. If you read the previous article about "why does = mean assignment" you'll find the true reason:

Since assignment is about twice as frequent as equality testing in typical programs, it’s appropriate that the operator be half as long.

Of course, that's wrong. Trying to make it easier to type, a bigger usability problem is created, assigning counterintuitive symbols to functionality that most people would not associate to them.

So the problem is not what = means in maths, it's what it means for people learning a language. Anyway, smadge is right: most of the uses in maths are of the kind "a little imprecission saves tons of explanation". In other words: that's not a question of what = is, but a question of how we use it to get things done.

Oh and then there is the "I'm used to it so it must not be so bad" crowd and the rationalization ensues.

I disagree with what the previous article states: There are languages such as Prolog where = doesn't mean assignment. In logic, = means equality, often modulo some theory. In Prolog, = means (syntactic) unification, which is distinguished from identity only by the different quantification of variables.

I would like to emphasize the distinction that smadge made, since distinguishing between universal and existential quantification is important to properly discuss different meanings and usage modes of equations.

> Trying to make it easier to type, a bigger usability problem is created, assigning counterintuitive symbols to functionality that most people would not associate to them.

How do you know? It seems no such problem has been reported, so the burden is on you to show it exists. I don't think people assume that the same token has the same meaning in different languages.

It seems no such problem has been reported

Oh, please. This has been a flamewar since the 80's. Every angle you can think of has been tried before. The real question is why are we still using plain text. A lot of the difference between languages is this kind of absurd minutiae taken too seriously as if we're discussing about the reality fabric instead of mere conventions.

A flamewar is a disagreement of opinion. I am not aware of any actual problem reported as a result of using the `=` sign for things other than equality or anything suggesting it is generally counterintuitive.
If I were you, I would start searching articles about a more interesting question: can everybody learn to program?

When you're teaching children, this is one of the most common complaints.

In every formal system, such as FOL/ZFC, all operators must have a precise meaning. And while it is true that most informal uses of the `=` sign in mathematics could be translated to some formal expression making use of a precisely-defined `=` sign, I think the point was that some (or most) mathematical notation is not formal, and therefore saying that `=` always means a precise notion of equality is wrong, even if in a particular formal language it always has this precise meaning. Therefore, this is not a sin to use the same `=` sign in some other formal language (say, a programming language) to mean something other than its meaning in a particular mathematical formal language.
I agree with your interpretation of the article, but I find that the article doesnt match the title. I think the equals sign almost always represents usage of an RST equivalence of some sort, even if the formula containing it isnt an equality (with the irritating exception of Big O notation).

However, I think that using this as a justification for programming languages' use of the equals sign for assignment (whether or not it needs any justification at all) I think is a moot point because mathematics is more expository, and isnt always strictly rigorous as long as its clear that everything is well defined and correct in the end (although there is expressiveness in the formalities as well).