>All of that code is a series of logical statements and expressions. Mathematical logic.
Which code? The machine code that underlies everything? Or the lines of simple high-level CRUD that don't even need a single number or logic statement to function? Not all programming has to be mathematical or even logical at a high enough level, and I say this as someone who's been coding assembly language for 40 years.
Storing a string in some abstraction is not a mathematical operation. I'm done with this thread, it's going way too far down too many rabbit holes. The quarks that make up the matter that the computers are made of are pure "math". There, now I've moved the goalposts.
That is a narrow perspective of mathematics and computer science.
Assigning a variable is a mathematical operation. It is a logical state transition. This is formalized in Programming Language Theory.
We are not talking about quarks. We are talking about lines of code which are objectively mathematical statements, no matter how non-mathematical they seem to you subjectively.
You start with a practical problem to solve, and a computing machine that can perform logical operations on data. Your job is to figure out a correct sequence of logical operations that will solve the problem. The program that you have written is a mathematical structure. It is mathematics.
You confuse map with the territory. By the same logic you can say quarks are mathematics, because they are modeled by a theory that has some mathematics in it.
Our mathematical models of reality (i.e. Physics) is not the same as reality. So yes, by the same logic "quarks" are mathematics, but only in the same way that a "cup" is English. The quark was a great example, considering we can't observe it and purely rely on mathematical models, but the same argument would still hold true for a bowling ball. Physics is our description of reality, not reality itself. Our description of reality highly leverages the language of math, as that language was developed to enforce rules of consistency. Much the same way we design our programming languages, which is why programming language people study so much more math than your typical CS person.
If you're going to accuse someone of confusing the map with the territory, you really should make sure you aren't making the same error.
How math helps with programming languages? What math says about zero based indexes? How do you prevent off by one errors? How do you prevent buffer overflows? It's ergonomics problems.
It is hard to answer because of exactly what ndriscoll said[0]
> It's like trying to argue about the distinction between U(1), the complex numbers with magnitude 1, and the unit circle, and getting upset when the mathematicians say "those are 3 names for the same thing". Or saying that writing C is programming but writing in a functional language like Scala or Haskell (or Lean) is not.
As ndriscoll suggests, it is tautological. I mean look at what I said. I really need you to hear it. I said that coding is math. So what I hear is "How programming languages helps with programming languages?" Why are you expecting me to hear anything different?
> What math says about zero based indexes?
Start at 0? Start at 1? Who cares, it is the same thing. The natural numbers, non-negative integers, integers, even integers, who cares? They're the same thing. And who cares about indexing at 0 or 1 in programming? That's always been a silly argument that's inconsequential.
> How do you prevent off by one errors?
By not being off by one? What's the question? Like being confused about if you start at 0 or start at 1 and how to get the right bound? It is a shift from one to the other, but they are isomorphic. We can perfectly map. But I really don't get the question. You can formalize these relationships with equations you know. I know it isn't "cool" but you can grab a pen and paper (or a whiteboard) and write down your program structure if you are often falling for these mistakes. This seems more about the difficulties of keeping track of a lot of things in your head all at once.
> How do you prevent buffer overflows?
By not going over your bounds? I'm so confused. I mean you are asking something like "if f(x) = inf when x > 10, how does math help you prevent the output of the function from being infinite?"
Maybe what will help is seeing what some of the Programming Languages people do and why they like Haskell[1].
Or maybe check out Bartosz Milewski[2,3]. His blog[2], is titled "Bartosz Milewski's Programming Cafe: Category Theory, Haskell, Concurrency, C++". It may look very mathy, and you'd be right(!), but it is all about programming! Go check out his Category Theory Course[3], it is _for programmers_.
Don't trust me, go look at papers published in programming language conferences [4]. You'll find plenty of papers that are VERY mathy as well as plenty that are not. It really depends on the topic and what is the best language for the problems they're solving. But you'll certainly find some of the answers you're looking for.
Seriously, don't trust me, verify these things yourself. Google them. Ask an LLM. I don't know what to tell you because these are verifiable things (i.e. my claims are falsifiable!). The only thing you need to do is look.
Nonmathematical problems are difficult to answer when you try to find mathematical answers. It should be obvious, why it doesn't work.
Mentioning Scala is ironic, it's very light on math spik and to begin with was created to unify object oriented with functional programming, which is mathematically meaningless, because both are Turing complete and thus equivalent, tautological.
>So what I hear is "How programming languages helps with programming languages?"
Oh, right, in mathematics axiom is argument, but in reality it isn't. In programming you should assert what you assume, otherwise your assumptions can be wrong due to divergence from reality, but there no reality in mathematics, only fantasy, so you can't understand this with mathematics alone.
That may be true to some extent, but I think you are missing the point. Quarks are physical in nature, and code is logical in nature. Programs themselves are formal systems. Code isn’t just modelled by mathematics, it is defined by mathematics.
In the case of code, we can argue that the map is the territory.
Code is logical if you define logic as reasoning in general, broader than mathematics, and since it runs in physical environment, it now interacts with a messy world. Code is defined by business requirements, and there's no mathematics for that.
The discussion started about whether human needs math skills to write code. That's what I mean when I say programming isn't mathematics. Meaning of code is defined by human, how do you intend code to be defined by mathematics? The human first imagines mathematical formulas, then by some unknown process they become code? I don't think anybody does it like that. You start with requirements, intuitively guess architecture, then decompose it, it works more like Cauchy problem (but less numeric, more conceptual, you have an owl, now draw it), but I don't think anybody models it like that.
>Once the code is actually written, that exists as a formal logical system, defined by mathematics
I still think that's not code, but your favorite model of code. For spellchecker language is defined by mathematics too: it splits text into words by whitespace, then for each word not found in dictionary it selects best matches and sorts them by relevance. Oh and characters are stored as numbers.
> The discussion started about whether human needs math skills to write code.
Writing code IS a math skill. When writing code you are writing logic in a formal system. Logic is mathematics.
You may be thinking that mathematics is just like doing arithmetic or solving equations. It is way deeper and broader than that.
> I still think that's not code, but your favourite model of code
Code is not just modelled through mathematics, it is actually defined by mathematics. It is fundamentally a mathematical construct, grounded in formal semantics.
Which code? The machine code that underlies everything? Or the lines of simple high-level CRUD that don't even need a single number or logic statement to function? Not all programming has to be mathematical or even logical at a high enough level, and I say this as someone who's been coding assembly language for 40 years.