Math vs Programing, What-is vs How-to

By Xah Lee. Date: . Last updated: .

there are 2 major forces in computer science. What Is, and How To.

What Is is a axiomatic description of how things are. It is math, basically. Equations, algebra.

How To is step-by-step instruction. For example: algorithm. Computer language code, in general, are How To.

WHAT IS, is typically easy to understand. Because, it describes. Shows you the character. Shows you What It Is.

How To, is typically impossible to understand. The longer, the less comprehensible. For example, software source code.

The problem with What Is, is that it doesn't tell you how to. Say, you know all the science of a car. But you can't build it.

The problem with How To, is that you don't understand it. Say, you are given instructions to build car from scratch. You don't know how it works.

Automatic Translation between What Is and How To, is almost the ultimate goal of computer science. Or, one of the most fundamental topic.

Programing language docs, when well written, is What Is. It describes the language's functions and other parts, describes, the system.

Bad language docs by majority of programers, is 50% How To. Because coders don't understand their code. They just paraphrase the source code.

languages like #prolog, #coq, are What Is languages. You tell it axioms, and it answer yes/no questions.

functional language like haskell, are declarative languages at micro level. As soon as you apply a lambda, it's an instruction. Prolog would be a declarative lang.


also, basically ALL programing language doc are descriptive. I can only think of Wolfram Language doc being declarative. (all my tutorials, tries to be as much as declarative as possible.)

See also: Technical Writing as Symbolic Logic: Clojure Intern Symbol

math vs algorithm example: x==y==z

one example to illustrate the different nature of math vs algorithm is: x==y==z or explicit 3==3==3. In math, it's a statement. In programing, 3==3 eval to true, then true==3 is false.

more specifically, == in math is a relational operator. By that, it means, when we say x==y, we are making a statement that x and y are related by ==. (in formal language theory, it can actually mean anything, but here we typically mean they are “equal”). In programing, == is also called a “relational operator”. However, the concept is entirely different. Here, operator is a specific syntax of a instruction. It “evaluates” the operands to get a result.

If you have a question, put $5 at patreon and message me.