
For mathematicians, = does not mean equality - hds
https://jeremykun.com/2018/04/13/for-mathematicians-does-not-mean-equality/
======
kps
(I assume this was inspired by
[https://news.ycombinator.com/item?id=16803874](https://news.ycombinator.com/item?id=16803874))

The use of ‘=’ for assignment in programming languages comes, not directly
from mathematics, but indirectly from the use of mathematics in science and
engineering. As an example, consider the formula for kinetic energy, commonly
written

    
    
            𝑚𝑣²
        𝐾 = ───
             2
    

Why isn't it written 2 _K_ = _m_ _v_ ², which expresses the same mathematical
equality in a smaller, simpler form? Or any of the other equivalent
rearrangements? It's because formulas have a convention, where the LHS is a
single term naming the value you _want_ , and the RHS contains the terms for
values you _have_. That is, a formula doesn't just state an equality, it
states a _method for calculating_ something. That usage predates programming,
and was explicitly copied by early programming languages like For[ _mula_
]tran[ _slator_ ] that were designed for scientific & engineering
calculations.

~~~
bhnmmhmd
I'm always asking "why haven't scientists come up with more symbols yet?"

I also ask "why haven't more symbols been introduced to our keyboards? Just
!@#$%&*..."

It's strange, esp. when you realize coming up with a new symbol that everyone
uses is easier these days than it was 4 centuries ago!

~~~
swiley
There are many strange symbols in math already that can be difficult to type
without something like LaTeX. I feel like something pronounceable is usually
better unless you have a sufficiently general idea.

------
lou1306
Some more food for thought on the meaning of =, from Girard's "Proofs and
Types" [0]:

> There is a standard procedure for multiplication, which yields for the
> inputs 27 and 37 the result 999. What can we say about that? A first attempt
> is to say that we have an equality "27 x 37 = 999". This equality makes
> sense in the mainstream of mathematics by saying that the two sides denote
> the same integer [...] but it misses the essential point: There is a finite
> computation process which shows that the denotations are equal.

> [...] if the two things we have were _the same_ then we would never feel the
> need to state their equality. Concretely we ask a question, 27 x 37, and get
> an answer, 999. The two expressions have different senses and we must do
> something (make a proof or a calculation, or at least look in an
> encyclopedia) to show that these two _senses_ have the same _denotation_.

[0]:
[http://www.paultaylor.eu/stable/prot.pdf](http://www.paultaylor.eu/stable/prot.pdf)

~~~
pron
Just a bit of background: Girard is paraphrasing Frege's famous paper _On
Sense and Reference_ [1] which is an investigation into the meaning of
equality. As a result of that investigation, Frege shows that terms in a
language have at least two kinds of meanings (sense and reference or
denotation), which Girard presents in a programming context.

[1]:
[http://www.scu.edu.tw/philos/98class/Peng/05.pdf](http://www.scu.edu.tw/philos/98class/Peng/05.pdf)

~~~
cortesoft
Oh man, I took a great class on that paper in college. Spent the whole quarter
reading it, yet lecture was always interesting.

------
smadge
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}}

~~~
triska
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.

~~~
narag
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.

~~~
pron
> 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.

~~~
narag
_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.

~~~
pron
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.

~~~
narag
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.

------
xg15
Fully agreed, though to nitpick:

> _Rather than precisely say, f(2) = 7, we say that for x=2, f(x) = 7. So x is
> simultaneously an indeterminate input and a concrete value_

This seems like a perfectly by-the-book piece of second-order logic with two
equality predicates.

i.e., the statement asserts that if you look at the space of all possible
values for x, then for each value where the predicate "x = 2" holds, the other
predicate "f(x) = 7" will also hold. It happens there is only a single value
that will satisfy "x = 2", but that's not the equality's problem.

So both = signs really _are_ equality here.

~~~
j2kun
Fair point. I'd add that f(x) = 7 can be both equality of functions and
equality of evaluations, and binding x=2 suddenly changes the meaning of the
equality and the expression.

~~~
xg15
True. I don't want to dispute that there is a hell of ambiguity in using =.

~~~
diffeomorphism
I wouldn't call that ambiguity. While several shorthand notations use =, it is
always clear from the context which one and only one is referring to (and if
there are multiple that all of them agree).

This touches on another point that one sees much of in mathematics lectures
but little in math lectures. Mathematical notation needs to be unambiguous but
also facilitate communication and hence tends to be very terse. Thus when
discussing addition on a finite field F_5, one usually starts defining
equivalence classes [j] and an addition operator "+" and then says that
[3]"+"[3]=[3+3]=[5+1]=[1] followed by a disclaimer like:

"We hence see that this notion is compatible with the previously defined one
when identifying ... . Hence, if there is no possible confusion, we will
simply write ..."

See also Tao's comments on rigor in mathematics:
[https://terrytao.wordpress.com/career-advice/theres-more-
to-...](https://terrytao.wordpress.com/career-advice/theres-more-to-
mathematics-than-rigour-and-proofs/)

All notation can be made rigorous, if one wants to, but discussion is more
concise if we let everybody do that by themselves.

~~~
xg15
Yeah, I think that's a good point and, I think, an important differecne
between math notation and programming languages.

I think mathematicians thend to use a lot of "notational slang" or "ad-hoc
syntactic sugar", if you will. This will make the _notation_ often look
imcomprehensible for people not familiar with the exact domain - however,
there is usually a consistent meaning behind it. If one wanted, the notation
could be "desugared" into a more rigid (but more verbose) form that expresses
the same.

To take big-O-notation as an example, if you write something crazy-looking
like

    
    
      x + 5 = O(x)
    

What you _mean_ is

 _The function "f(x) := x + 5" is a member of the set of functions "O(x)"._

Where "O(x)" is itself shorthand for a convoluted set expression.

Similarly, if you write

    
    
      x^3 + O(x)
    

You mean _Take x cubed, then add the result of some function from the set
O(x)_. (Whether you mean _any_ function or _one specific function_ is again
context-dependent but usually it's made clear which of the two is meant.)

Contrast that with programming languages, where you often have a rigid syntax
but higher-level semantics being quite fuzzy.

E.g., equals() and toString() in java are straight-forward to write but they
can "mean" quite a lot of different things depending which kinds of objects
you call them.

e.g., the "obvious" meaning of equals (value equality) works only with
immutable value types - yet the method is defined on _any_ kind of object. So
it might also mean instance equality - or even entity equality if you deal
with ORM proxies - or even wilder things...

------
harrygallagher4
I noticed this recently when I was trying to define a note-taking syntax for
my math classes. I thought it would be smart to use := for definitions and =
for equality, but then I was frustrated when = didn't always mean equals in
the same way, and some things didn't really fit into either category. I ended
up just giving up and switching back to abusing = in all situations. I think
math has a really cool human aspect, it's very rigorous but also relies on the
fact that your notes/proofs/whatevers are going to be read by a person.

------
giomasce
The author itself admits in the postscript that he has embellished a bit the
article, but allow me to take it at its face value: to me, it seems that the
article confuses mathematics with its notation (and the same for computer
science, but at this level CS is just a branch of mathematics). All the funny
stuff he goes on describing follow from this confusion. When a mathematician
does mathematics, they have very well defined concepts for "equality",
"equality up to some equivalent relation" (my preferred: "equality up to
diffeomorphisms that are isotopic to the identity") and so on. However
notation is chosen saving on clarity and conciseness, sometimes at the expense
of the direct mapping with underlying mathematical concepts. Thus in some case
the sign "=" is meant to mean equality (in a certain sense), in some other
cases it is not.

Computer languages make no exception: they are nothing else than formalisms to
express computations. As for every other formalism, the meaning of signs is
chosen to be what appears most comfortable in that context by the formalism
designer. The statement "x = x+1" has very different interpretations depending
on whether you consider it written in C or in standard polynomial equation
theory; but in both cases there is a well known meaning for it. In exactly the
same way the word "case" has different meaning depending on whether your are
reading in English or in Italian.

~~~
fjsolwmv
The article and the article it is written in response to are explicitly about
_notation_ , not semantics.

------
raphlinus
There are few more examples that come to mind, like statements about intervals
(π = 3.14 ± 0.01) and the usual notation for modular arithmetic; 3 * 3 = 1
(mod 4).

Oh, and the wonderful notation for integrals, ∫ 2x dx = x² + C

~~~
lvh
The usual notation for modular arithmetic uses three dashes, not two, to
denote congruence.

~~~
gus_massa
At least in my university, in one of the first Algebra courses about integers,
factorization and congruence the usual notation is

    
    
      3 * 3 ≡ 1 (mod 4)
    

but in the next year Algebra course about groups and crazy algebraic
structures the notation in the group Z_4 is just

    
    
      3 * 3 = 1
    

and everyone understand that you are working in Z_4 (and the * and = symbols
are "overloaded" (but no one call them "overloaded")).

~~~
lvh
Sure; I think we’re in violent agreement here, it’s absolutely the case that
people write the simpler version when the meaning is clear from context. I’ve
definitely done that a bunch.

~~~
mclehman
Piling on with a bit more pedantry, my experience is a bit different.

In my current ring theory course, we have indeed written things like 3 * 3 = 1
when working in |F_5 (not sure that notation is going to work as well as I
hope, looks alright in the app I use), but it's not the equality symbol is
overloaded, but the numbers themselves. Rather than using = to mean numeric
equality and equality w.r.t. equivalence classes, we just use the numbers
themselves as shorthand for their equivalence classes.

~~~
laingc
That seems odd to me. I don't think I've read any ring/algebra/module theory
text that doesn't explicitly denote equivalence classes with, for example,
square brackets.

~~~
heinrich5991
There's a canonical ring homomorphism from the integers into any commutative
ring with 1. When such a homomorphism is unique, you often omit it, hence
mathematicians sometimes just write numbers without equivalence class
brackets.

This is not limited to rings of the form Z/nZ.

------
rsp1984
This. It's even more obvious in linear algebra where mathematicians routinely
start with the premise "Ax = b", even if there is no solution x that would
satisfy the equation exactly.

~~~
maho
I disagree: "Ax = b" is a statement. It does not need to be true. This is
quite useful and often used for "proofs by contradiction".

~~~
rsp1984
I see it being used all over the place as a starting point to solve for x,
even if A is non-square and/or x ends up being a least squares solution.

------
allthenews
Operators in mathematics are overloaded in a very similar way to operators in
computer science (in languages that permit overloading).

I think the author hints toward a good point: there is no use arguing over the
meaning of "=" in a general sense, because the meaning is contextual.

I think this whole discussion is merely indicative of inexperience on the part
of computer scientists attempting to navigate mathematics.

~~~
roywiggins
CS already abuses equality all the time with big-O notation. Often you see
stuff like f(n) = O(N²), when they mean that f ∈ O(N²). It's fine because
everyone knows what's going on, but it's not using it in the sense of
equality.

~~~
danharaj
Sure it is, O notation denotes equivalence classes and being part of the same
equivalence class is a perfectly cromulent notion of equality.

~~~
gizmo686
Big-theta gives you equivalence classes. Big-O only gives you partial
ordering.

For instance, we might say x = O(x^2) and x=O(x), but we would not say
O(x^2)=O(x).

Interestingly, in my experience, some people will actually say O(x)=O(x^2),
but that seems a bit too abusive for my liking.

~~~
danharaj
Yea, my mistake :)

------
victorNicollet
Interestingly, when using mathematics to describe the semantics of programming
languages (say, operational structural semantics for an imperative language),
the assignment tends to use an arrow, i.e.

S[ x ↦ V ]

indicates that the new state is equal to old state S, but with variable x now
bound to value V.

~~~
evincarofautumn
Most commonly I see a “substitution” notation for that, S[V/x], but
unfortunately there are _dozens_ of variations in use, including: [V/x]S, [x ↦
V]S, [x ⇒ V]S, [x → V]S, {V/x}S, {x ↦ V}S, S_(x → V), S[V|x], S[x := V],
S[x/V], S[x ← V], S[V\x], S(v/x), S{V/x}, S{x ↦ V}, S{x := V}, S{x → V}, S⦃x ←
V⦄, S{x ← V}, …

------
grosjona
I remember thinking the same thing after reading
[https://www.hillelwayne.com/post/equals-as-
assignment/](https://www.hillelwayne.com/post/equals-as-assignment/)

Math symbols and expressions are inconsistent just like regular languages.
But, unlike math, other languages don't claim to be consistent.

It's not surprising that John von Neumann said "in mathematics you don't
understand things. You just get used to them." \- I've never heard a software
developer say this about coding.

For example, I did not enjoy integrals at school because of the 'dx' at the
end which means 'with respect to x' but which actually looks like a
multiplication (* d * x).

I think that the reason why I never got deep into math is because the language
of math is too inconsistent and has too many logical shortcuts and I can't
operate in such environment.

~~~
analog31
My understanding was that the "d" is an operator, and there are notations in
which an operator on an operand is notated by just putting the one before the
other. Also, the dx corresponds to delta x in the limit definition of the
integral. One reason for keeping it, is that it makes the units of measure
work out if the integral involves things that have units. So, notational
consistency aside, it saved my arse when doing physics problems. ;-)

(even in my pure math classes, I sometimes imagined that the variables had
units, to help find mistakes).

But your point is well taken about the consistency of math notation. Math
spent most of its history being scribbled by hand and read by humans. It got
the job done. And it was not uncommon to invent a new notation on the fly to
replace an abstraction with a single symbol. That's the precursor to the
subroutine.

The need for perfect formality of notation is a new thing, brought on by the
computer age. This may illustrate the point that programming is not "just
math," and math is not a form of programming.

------
howling
All these discussions of "=" are missing the point.

The notation "x = x + 1" is awful because at lhs x denotes a reference to an
integer while at rhs x denotes the value hold by the reference. If you know C,
it is similar to the difference between an integer pointer *x and an integer
x. As an illustration, here are two programs that are doing the same thing,
one in C and one in Haskell.

    
    
      #include <stdio.h>
    
      int main() {
        int x = 0;
        x = x + 1;
        printf("%d\n", x);
        return 0;
      }
    
    
      import Data.IORef
    
      main :: IO ()
      main = do
        xref <- newIORef 0
        x1 <- readIORef xref
        writeIORef xref (x1 + 1)
        x2 <- readIORef xref
        print x2

~~~
segmondy
We don't have such problem in Prolog. In prolog X can never be equal to X+1. X
will always be X. Once X has a value, it never changes. One of the thing that
gives most procedural programmers a headache.

------
hyperpallium
Geometry distinguishes between equivalence and value. An "angle" isn't its
degrees, but the geometric figure (two rays or segments meeting at an end-
point of each). It's the _measure_ of the angle that is the degrees.

You don't say "angles are equal" \- you say they are _congruent_. It's their
_measures_ that are "equal".

Although congruency implies measure equality, it doesn't really mean that, but
that the shapes are the same (can be rotated/translated to coincide).

~~~
fjsolwmv
Congruent means that you have some relevant information that you are
discarding (projecting away) information, such as position and rotation. It's
just as correct to say equal if you've already established the relevant
context / quotient space.

Two triangles on a page are congruent, because they have different position.
The three corners of an eauikao trisne are congruent, because their
corner+angles are equal. If you take angle to mean corner, you say congruent.
If you aren't also talking so about their position, you say equal.

In math you can slice things every which way, so it's impossible to use the
different words for every different concept, so you have to establish a
context

Equal vs congruent (and equal vs equivalent, which are also synonymous in
math) is a crutch for beginners who are over reliant on their informal
intuition.

------
ChrisSD
I agree with the thoughts on the = sign but I'm not so sure about mutations.

> If mutation is so great, why do mathematicians use recursion so much? Huh?
> Huh?

> Well, I’ve got two counterpoints. The first is that the goal here is to
> reason about the sequence, not to describe it in a way that can be
> efficiently carried out by a computer.

Most high level languages try to avoid making the programmer describe the most
efficient way to handle variables. The idea is to describe your algorithms and
how they connect and allow the compiler (or interpreter) to figure out how to
use registers etc to implement it. Of course that ideal breaks down sometimes
but most high level programmers don't normally need to stress the low level
details too much.

> My second point is that mathematical notation is so flexible and adaptable
> that it doesn’t need mutation the same way programming languages need it. In
> mathematics we have no stack overflows, no register limits or page swaps, no
> limitations on variable names or memory allocation, our brains do the
> continuation passing for us, and we can rewrite history ad hoc and pile on
> abstractions as needed to achieve a particular goal.

It's true that there's a limit to abstractions even the highest level
languages can make if they want to remain general purpose. However I think
languages can handle immutable variables as a default.

That's not to say I agree that programming should always follow mathematical
notation. But I also don't think it's a bad ideal in many cases.

~~~
skybrian
The thing that blew my mind was that there are some mathematical programming
languages where the point is _not_ to ever actually run the program. Just
type-checking it is enough to prove the result. (In the "programs are proofs"
sense.) In these languages, it's important not to allow infinite loops because
you will never test the code.

Even though there's a correspondence, there's always going to be a difference
between writing a program so that you can actually run it and writing proofs,
where you don't, and ridiculously inefficient algorithms don't matter at all,
so long as they don't diverge.

~~~
hexane360
[https://aphyr.com/posts/342-typing-the-technical-
interview](https://aphyr.com/posts/342-typing-the-technical-interview)

>"You… do realize that the type system is meant to constrain values, right?”

>“No,” you inform him, matter-of-factly. “No, that doesn’t sound right.”

------
cconroy
Alan Kay had a good answer on quora for this.

 _Let me confess that I’ve not read every answer. But the ones that I did read
were all very concerned with “squaring” etc.

The simplest answer — and I think the reason many people have difficulty with
both arithmetic and especially algebra — is that you need to deeply
internalize just what the “=” sign symbolizes and asserts: that there is the
very same number on each side.

In other words don’t be distracted by the symbols and operations. One way to
think about this is that “a number is all the ways you can make it” (i.e. it
can be thought of as “processes” (an infinite number of them) as well as a
“value”).

This means whatever you can do to any number can be done on both sides of the
“=” because there is just the same number underneath the gobblydegook on both
sides.

This is what “=” actually means. And it’s why algebra is actually quite easy
rather than mysterious or difficult._ [0]

[0] [http://qr.ae/TU1SxJ](http://qr.ae/TU1SxJ)

~~~
cconroy
I also think prolog has the most advanced sense of this concept with
equalities and unification operators.

------
sykh
Think about the equation

x + 3 = 1

Typically we write that the solution is "x = –2". This to me is the most
abusive form of usage for "=" in mathematics. The solution to the equation is
–2. The solution to the equation x = –2 is also –2.

Solving the equation x = –2 is very easy. We can solve it just by looking at
the equation. What we are really doing when solving an equation is
transforming the original equation into a simpler equation with the same
solution set. Tt gets tedious to write this all out so we just say things like
"the solution is x = -2" when we've transformed the original equation to x =
–2. This is weird because x is not the number -2. x is a variable that can
assume a myriad of values. The only value of x that solves the equation is –2.

As the article states the abuse of the = sign in mathematics is rampant. We do
it mostly without realizing it. In this sense mathematical language mimics
human languages. All human languages are prone to abuse of rules and to
shifting with the times.

The notation in mathematics, while much more precise than spoken human
languages, is abused frequently and the purpose is to make things cognitively
easier. The ancient Greeks didn't have symbols for numbers and in their
mathematics they wrote everything out in Greek. This makes it very hard to do
tedious calculations. Using symbols in lieu of writing out all the minutia
makes doing math easier provided you learn the contextual meaning of the
symbols. Over the centuries symbols have been introduced as a shorthand for
complex ideas/objects/operations. If you want everything precisely stated then
reading Principia Mathematica ought to cure you of this desire. Mathematics is
written by humans for humans.

Code is written by humans for computers and hence the notation needs to be
rigorously defined in the language you are using and why your code needs to be
commented.

~~~
jcranberry
Suppose x is an integer such that x + 3 = 1. Then, x is -2. There's no
solutions here, just implications and an alternative way of defining the value
of x.

I think variables in equations are not meant to express the existence of
variance within an equation, but a sense of context-dependency of the value of
x. At least, IMO.

~~~
sykh
There is a solution. An equation is really a question.

x+3 = 1

is asking the question, “what value for x makes x+3 the number 1?”

The polynomial x+3 is defined for all values in R, the base ring you are
working in. We are trying to find the elements of R for which x+3 is the
element 1.

~~~
jcranberry
An equation is an instance of equating.

A solution necessitates a question, and questions associated with equations
involving variables aren't restricted to: what is set of possible values which
satisfy those equations?

~~~
sykh
You are incorrect. This is not how mathematicians view a polynomial equation
like the one I used as an example. That equation does have a solution.

------
waynecochran
Lisp has many flavors of "equal":

    
    
        =
        eq
        eql
        equal
        equalp
        string=
        ...
    

Because equivalence mean many things in both the mathematical and programming
world.

~~~
xfer
Most languages have that, they encode it in the type system.

------
nilanp
Jeremy – I’m a mega fan of your work.

But think going deeper into this is quite fun

Your post goes to the point at the heart of philsophical number theory.

What does equality mean ?

Yup – you got functinal equivalence, isomorphism, and temporary assignment of
values.

But I think you could prove – that all these types of equality – are
“instances” of “different implementations” of “equivalence.

They are no more equivalent than 1 = 1 is equivalent.

I.e. 1 = 1 means I think we can define a bijective “counting function” that
proves there’s the “same number” of “elemetns” in the “sets”

I think (not sure) – if you define – counting fucntion / same number /
elements / sets differently – you get the differing definitions of equivalence
you enumerate.

The interesting thing for me is that 1 = 1 is defined clear in 4 of peano’s
axioms

[https://en.wikipedia.org/wiki/Peano_axioms#Formulation](https://en.wikipedia.org/wiki/Peano_axioms#Formulation)

And you could mentally – try to develop different (and potentially) – more
powerful notions of “equivalence” – with differing axioms

A final point… the prevalence of several “similar” concepts of equivalence in
computer science – may point to an underlying “platonic idea” of equivalence –
that either exists dormant in the world awaiting for us to discover it; or is
a useful “technologocial” construct – that has accelerated “progress”

------
qxmat
I have an engineers understanding of higher maths - overly general and very
patchy. Short of taking an undergraduate math course, are there any resources
to help me parse math notation? For example, while brushing up on
endogeneity/exogeneity, E[B'|X] = 0 completely threw me - I had to search
Google for the use cases of a bar/pipe aka latex vert/mid. I usually lose
interest in a paper if I get stuck trying to decode the syntax.

~~~
xiaq
[https://en.wikipedia.org/wiki/List_of_mathematical_symbols](https://en.wikipedia.org/wiki/List_of_mathematical_symbols)

Also, if I were you, I would always look up introductory textbooks before
trying to read math literature. The example you gave is conditional
probability; any textbook on probability theory would cover it.

------
ttctciyf
> The usual way to get half an apple is to chop one into "two equal parts". Of
> course, the parts are actually NOT EQUAL - if they were, there would be only
> one part! They are merely ISOMORPHIC.

\- John Baez (
[http://math.ucr.edu/home/baez/week147.html](http://math.ucr.edu/home/baez/week147.html)
)

------
smadge
Some authors might prefer

    
    
      --
      \
      /
      --
      0 < i < n
    

Ass opposed to

    
    
      n
      --
      \
      /
      --
      i = 1

~~~
vlasev
Sometimes we even leave it as "i" instead of "0 < i < n" or "i = 1 to n".
Sometimes the range of the summation doesn't even need to be determined in
intermediate steps.

------
vinchuco
Humans are compilers of math.

'=', like number, means that concept, regardless of instantiation.

Beyond that note, I don't see the value in listing all the ways you could
interpret notation.

Maybe you would also find it entertaining to list all the ways a program can
interpret a binary string?

------
jovial_cavalier
When you say 'i=0', what you mean is that that is the base case, and the sigma
specifies a bunch of other cases.

i_1 =/= i_2.

As xg15 noted, it's perfectly fine to say (x=2) => (x + 3 = 5). The problem
the first example really addresses is that in mathematics, the namespaces are
loosely defined, but in programming they aren't. 'i' can mean several things
at once, and it doesn't really matter because those things never really
interact in the same context. In programming, you need to specify the name 'i'
every time you want to reference it, so it's important that you have a
stricter namespace rule.

------
OscarCunningham
One can at least say that in formal ZFC the symbol "=" has exactly one
interpretation. And it's this interpretation that people talking about Haskell
are referring to.

------
jasonkostempski
Aren't we all taught to write "y = 3" as the answer to algebra questions?
That's how I always thought of it, not as assignment, but as a declaration of
truth.

------
thetruthseeker1
When I learnt programming, i was confused by x=x+1;

After I understood what it really meant, I wondered why they didn’t use some
other symbol to capture this semantic. Say something like x <\- x+1 ; Which
implies assignment rather than equality - That way this would be unambiguous
and I feel is more clear. I now guess the choice of using ‘=‘ was probably an
attempt at making a (compromised) choice given the limited symbols that were
available back when High level languages were first written?

~~~
gcmac
Go write a couple hundred lines of R (please don't actually do this R is
atrocious imo) and then you'll understand why '=' is used instead of '<-' \-
because it's a pain in the ass, even with hotkeys

~~~
haZard_OS
Hey, hey, hey! R IDEs give plenty of options which utterly mitigate such
alleged difficulties:

[https://stackoverflow.com/questions/1741820/what-are-the-
dif...](https://stackoverflow.com/questions/1741820/what-are-the-differences-
between-and-in-r)

------
nothrabannosir
Minor note:

 _> A = { n^2 : n = 1, 2, …, 100 }_

 _> In Python, or interpreting the expression literally, the value of n would
be a tuple, producing a type error. (In Javascript, it produces 2.[link] How
could it be Javascript if it didn’t?)_

That linked JS code uses ^, which is xor, not pow. Math.pow([], 2) = NaN. Or
maybe that was the joke and it flew completely over my head.

~~~
lotharbot
I suspect that's the joke. Making fun of how Javascript parses or evaluates
expressions is a favorite passtime in programmer circles.

See, for example,
[https://www.destroyallsoftware.com/talks/wat](https://www.destroyallsoftware.com/talks/wat)

------
theparanoid
A succinct summary is that mathematics is about understanding a thing and
computing is about describing a concrete process.

~~~
jonnybgood
Depending on your philosophy of math, math also describes concrete processes.

------
mabbo
Title could use a touch up. On mobile chrome at least, I'm not seeing the "="
in the title.

~~~
hds
Thanks, fixed.

------
abhishekjha
Also the asymptotic notation where f(n) = O(n^2) means a set membership
operation.

~~~
jcranberry
IMO one of the most irritating abuses of notation that I've come across given
that it requires no additional effort to use the 'is an element of' symbol
instead.

~~~
contravariant
Could be worse. I've seen things like f(x) = g(x) + O(h(x)) a few times.

~~~
svat
That's not “worse”, that's the entire point of using O() notation! The beauty
of O() notation is that it lets us carry out, fully rigorously, computations
like

(n + O(√n))(n + O(log n))^2 = (n + O(√n)(n^2 + O(n)) = n^3 + O(n^(5/2))

without dealing with a mess of sets and quantifiers. Please take a look at
some works where asymptotic expressions are dealt with proficiently; you'll
understand. (de Bruijn's book
[https://news.ycombinator.com/item?id=16834297](https://news.ycombinator.com/item?id=16834297)
for example, or at least Chapter 9 of _Concrete Mathematics_.) I recently
worked out an example here:
[https://cs.stackexchange.com/a/88562/891](https://cs.stackexchange.com/a/88562/891)
— replacing all O() equations with “∈” and “⊆”, though it can be done (
[https://math.stackexchange.com/a/86096/205](https://math.stackexchange.com/a/86096/205)
), is just cumbersome and only distracts from what's going on.

~~~
contravariant
I think you lost a factor log n there. Pretty sure (n + O(log n))^2 is (n^2 +
O(n log n)).

In any case your notation works perfectly fine as an equality of _sets_. It's
not that unusual to add and multiply sets together, there's really only one
sensible definition, and the slight abuse of notation to use x instead of {x}
is perfectly acceptable if you're careful.

The problem is that f = h + O(g) is generally used in a way that's _false_ as
an equality of sets, it's usually used to mean f ∈ h + O(g), which just makes
using '=' needlessly sloppy notation (especially since you can make it correct
by just changing a single character, no mess or quantifiers required).

Still, that's nothing compared to the suggestions on stack overflow which
suggest using = to mean ⊆. Which is a _terrible_ idea, equivalent to using =
instead of ≤. In fact you point out one of the reasons it's _terrible_
yourself, when you note that all equality signs only work one way, going
against all mathematical convention.

Even stronger, ⊆ has some very nice properties. It's a total order on the big
O sets, which is one of the nicer properties you can have (it's merely a
partial order on the f + O(g) sets, but you can't have everything). Why on
earth would you sacrifice all that just so you can avoid a scary math symbol?

~~~
svat
(Thanks for the correction, and the polite response.)

The purpose of notation is to communicate effectively, and ideally notation
should match the thoughts that the writer has and wishes the reader to have.
That is, notation should match thought, rather than humans change their
thinking to match notation.

When a mathematician (who works often with asymptotics, say in analytic number
theory) writes something like O(n), they are not thinking of a set; they are
thinking of “some unspecified quantity that is at most a constant times n”.
(As de Bruijn illustrates with his L() example:
[https://shreevatsa.wordpress.com/2014/03/13/big-o-
notation-a...](https://shreevatsa.wordpress.com/2014/03/13/big-o-notation-a-
couple-of-sources/)) So for example, the sentence

(n + O(log n))^2 = n^2 + O(n log n)

is thought of (by the person writing it) as something like

“when you take n and add a quantity that is at most a constant times log n,
and square it, you get n^2 plus at most a constant times n log n”

and _not_ as something like

“the set of functions obtainable by adding the function n ↦ n to a member of
the set of functions that map n to at most a constant times log n, and
squaring the sum, is a subset of the set of functions obtainable by adding the
function n ↦ n^2 to a member of the set of the functions that map n to at most
a constant times n log n”,

even if the latter is the fully formal and precise way of articulating it.
(Consider “the sky is blue” versus “the sky is a member of the set of all blue
things”, where “the set of all blue things” was never a part of the original
speaker's thoughts.)

That's one reason for preferring the equals sign.

I think what's happening is that we lack a good theory or notation for talking
about unspecified things the way we think of them, and set theory (and
associated notation) is the closest thing that anyone's bother to develop. (An
unspecified thing is “just” a member of some set. And when someone wants to be
fully formal, that works fine enough and in fact the differences disappear. As
Thurston says ([https://shreevatsa.wordpress.com/2016/03/26/multiple-ways-
of...](https://shreevatsa.wordpress.com/2016/03/26/multiple-ways-of-
understanding/)): _“Unless great efforts are made to maintain the tone and
flavor of the original human insights, the differences start to evaporate as
soon as the mental concepts are translated into precise, formal and explicit
definitions.”_ ) Using the equals sign here captures the original thought
better than ∈ or ⊆.

What's so terrible about a one-way = sign anyway? The problem can't be that it
goes “against all mathematical convention”, because using it that way _is_ the
mathematical convention for over a century, ever since soon after Bachmann
introduced it in 1894. It seems that as people learn more mathematics, they
learn to accept a great many things and extensions to notation, but the
thought of an asymmetric = sign, used like “is”, is just too much to bear for
some people. But everyone who works with asymptotics enough does get used to
it and comes to appreciate it, so it can't be that either...

~~~
contravariant
I have no problem with using notation in a more 'intuitive' way than the
technical definitions allow. However I won't ever acknowledge such notation as
correct. If you want to be precise you'll need to use precise notation, and
insisting that abusing the '=' sign is precise will do more harm than good.
Unless you consider 1+1=3 to be good notation.

If you seriously think you're not missing out by removing the distinction
between ⊆ and =, consider that O and subset relations are enough to denote
_all_ relations that you'd normally use the different big Os for that nobody
ever bothers to remember.

So f being of order o(g) is equivalent to O(f) being a proper subset of O(g)
(O(f)⊊O(g)), f being of order Theta(g) is simply equivalent to O(f)=O(g), and
f being of order Omega(g) is simply O(f)⊋(g). You might need to restrict
yourself to nonnegative monotonically increasing functions, but that's pretty
much done in practice anyway. And this might differ from some of the existing
definitions that are being used, but those do vary a bit across sources, and
these definitions are as sensible as any, and are compatible with the natural
partial order on sets of the form O(f) given by inclusion.

Seriously though there's nothing you'll gain from throwing away a nice
inequality relation just because it saves you from writing ⊆.

I'm also not sure what you have against thinking of something as sets, but you
can't be precise in mathematics and insist you're not using sets, at least not
without going through a lot more trouble then you'd ever avoid that way. In
particular it's fine to think of:

>“when you take n and add a quantity that is at most a constant times log n,
and square it, you get n^2 plus at most a constant times n log n”

and

>“the set of functions obtainable by adding the function n ↦ n to a member of
the set of functions that map n to at most a constant times log n, and
squaring the sum, is a subset of the set of functions obtainable by adding the
function n ↦ n^2 to a member of the set of the functions that map n to at most
a constant times n log n”,

as being the same thing. One is just written in slightly more obnoxious math
speak. However if you insist that the meanings are different then something is
wrong, because that would imply that the most straightforward mathematical
interpretation is apparently different from what you meant.

------
amelius
I think of mathematical = as similar to a let-binding: it's valid within a
certain context.

------
MaxLeiter
Can someone explain why the JavaScript example equals 2?

~~~
l_t
The JS code in question:

console.log([1,2,3,4,5,6,7] ^ 2);

This produces 2 because ^ is the bitwise XOR operator in Javascript. Arrays
are not numeric types, so they appear to be coerced to 0 for this comparison.
In short, they are effectively logging "0 XOR 2", which is 2.

~~~
mattnewton
I think it is actually NaN since it should be equivalent to Number([1,2,3])

------
internetman55
I don't mean to be rude cause this seems like a really interesting and well
researched article, but my question is what an I gonna gain by reading it

