29 points · by amichail · 4y ago · 41 comments
Explicit proofs (e.g., in math and CS) are more precise but longer, harder to check, and harder to debug. And a missed detail or small mistake can render the entire proof wrong and unfixable.
So it seems that the same individual could accomplish more in life with programming than proofs.
One question that comes to mind is "What would happen if everyone did this?". To me, it seems straightforward that we don't want everyone writing proofs to switch over entirely to programming, nor do we want everyone coding to switch over entirely to writing proofs. We would want a certain proportion of people doing proofs, and other proportion doing programming. Each person's own experiences and talents would determine which one is more useful, but on-balance we might have some proportion p doing proofs, and 1-p doing programming.
So, the question of "Can the same individual accomplish more with programming than proofs" turns into 2 questions - the situation that person is in, and also the global context of whether society is doing a good job at maintaining p provers and 1-p programmers for the overall benefit of society.
For my money, I think society has made p too small. There are way too many good reasons to go into software engineering as opposed to math and CS (namely $$$$) and as a result the social benefit of proofs is under-explored. I don't think however, that I would accept very bad odds for that bet like 1:100 or 1:1000. Proofs (and the societal structure, academia, that has been created to create proofs) have their own problems and as such it's very hard to even determine what p should be.
Mechanized proof checkers leverage this idea to enable users to specify formal proofs as programs.
In practice, writing programs and finding proofs feel like quite different activities, and at least in my experience of doing both I almost never try to write a program by thinking "how could I prove that such-and-such a type is nonempty" and I literally never try to prove something by finding a corresponding type and writing a program that computes or represents something of that type.
The Curry-Howard isomorphism is a beautiful theorem, and as you say it inspires some nice methods of automated proving / proof-checking, but I don't think it says anything much about the relationship between the programming and theorem-proving activities that actual humans engage in.
True, and (mostly) irrelevant. When I write a program, I am also writing a proof, but I don't care about it as a proof. It proves something that I am completely uninterested in proving. But as a program, it's a program that I am interested in running.
Interesting that you contradict yourself in successive sentences
By running the program, you, in fact, demonstrate that you are quite interested in proving whatever it is you wrote
No, I didn't. You managed to either completely miss my point, or to completely ignore it.
Just in case you didn't ignore it, let me try again. I could care about a proof for the sake of the proof. If that were the case, I probably wouldn't write a program, I'd just write the proof. (Yes, that could be mechanically turned into a program, but I didn't actually do that, because I cared about the proof rather than the program.)
When I write a program, I usually care about it as a program, not as a proof. When I write a GUI, say, I care about how it enables the users to access the rest of the program's features. You can turn that into a proof, and the compiler may in fact do so, but what it proves is something that is really unrelated to what I'm trying to do. The "proof" won't prove anything about usability or human factors or pleasing color scheme or user workflow or efficient use of screen real estate. It will prove something that, from the programming point of view, is completely uninteresting.
So, as I said, I'm not interested in the proof, I'm interested in the program. And, despite the correspondence, they are not the same thing.
A function List -> Sorted List can both be considered a proof that lists can be sorted as well as a procedure for sorting lists.
Edit: And for this topic in question, If you don't understand what you are proving then you aren't working with proofs. I really doubt that programmers actually constructs their programs by mapping it to mathematical statements, seeing what it proves and then mapping it back to a program, so they are writing programs, not proofs.
The value of the proof comes from the things it enables. I guess the Rust memory safety guarantees are based on some proofs?
It's possible to write incorrect code and compile it with a correct compiler, so I don't think so. It's more like a citation that proven correct programs can use to say "I wrote this program correctly (see my own proof), and I compiled it correctly (see citation), thus I have a correct executable file".
> I guess the Rust memory safety guarantees are based on some proofs?
People have retroactively come up with formal proofs for much of it, but I believe the initial design was just based on intuition not a proof. For unsafe code some of the exact details of the memory model are still being worked out too (and thus definitely aren't proven correct).
https://en.wikipedia.org/wiki/Computational_engineering
Some universities call these "Scientific Computing" as well. E.g., https://gradadm.seas.upenn.edu/masters/scientific-computing/
There is even an industry journal (closely linked to high performance computing). Of course this CSE is said to mean "Computing in Science and Engineering" (just to add confusion):
https://www.computer.org/csdl/magazine/cs/2022/01
Here's a paper that touches on some of the challenges of implementing proofs (and other scientific theory) in software. https://f1000research.com/articles/9-1192
And about 80 thousand mathematicians [2]
So about 375 individuals programming for every 1 person writing proofs
If we assume this configuration is optimal, then my answer to your question is that if you had a group of 10000 people who like programming and proofs and have 9983 program and 27 write proofs this would be the best way to “accomplish more in life”
[1] https://www.future-processing.com/blog/how-many-developers-a...
[2] https://mathoverflow.net/questions/5485/how-many-mathematici...
You can write programs to search for and do other things with prime numbers. However this can only tell you about specific prime numbers.
With proof you can prove things about all prime numbers or the integers as a whole. For instance Euclid proved that there are an infinite number of prime numbers.
We remember Euclid 2300 later so he accomplished a lot with his life. Today there is a big market for web pages, microcontrollers for gas pumps and washing machines, missile defense systems, etc. You can keep very busy writing programs for that stuff but it probably won’t be remember in 2300 years. (What’s a gas pump?)
The two also can go together like peanut butter and jelly.
When I was in grad school my thesis contained a derivation of the Gutzwiller trace formula
https://inspirehep.net/files/20b84db59eace6a7f90fc38516f530e...
integrating over phase space instead of position space (that paper does it over position space.)
It was about 40 pages worth of math and while I wrote the math I also wrote each equation in a computer program that would try different inputs and check that the equality held. This didn't "prove" anything, but it convinced me that I had the math right. When you do a calculation like that you might have 50+ places where there might be or might not be a minus sign and if you make any mistakes you might as well flip the coin to get the sign. I could have done the calculation without writing the program but I would have either gotten the wrong answer (not so likely in this case because I knew what the answer was) or gotten the right answer in the wrong way.
I think other comments already said it. "more" is an ambiguous term. Do whatever you want and feel free to call that "accomplishing more".
For your specific case:
definition infinite_primes (n : nat) : {p | p ≥ n ∧ prime p} := let m := fact (n + 1) in have m ≥ 1, from le_of_lt_succ (succ_lt_succ (fact_pos _)), have m + 1 ≥ 2, from succ_le_succ this, obtain p `prime p` `p ∣ m + 1`, from sub_prime_and_dvd this, have p ≥ 2, from ge_two_of_prime `prime p`, have p > 0, from lt_of_succ_lt (lt_of_succ_le `p ≥ 2`), have p ≥ n, from by_contradiction (suppose ¬ p ≥ n, have p < n, from lt_of_not_ge this, have p ≤ n + 1, from le_of_lt (lt.step this), have p ∣ m, from dvd_fact `p > 0` this, have p ∣ 1, from dvd_of_dvd_add_right (!add.comm ▸ `p ∣ m + 1`) this, have p ≤ 1, from le_of_dvd zero_lt_one this, absurd (le.trans `2 ≤ p` `p ≤ 1`) dec_trivial), subtype.tag p (and.intro this `prime p`)
https://homotopytypetheory.org/2015/12/02/the-proof-assistan...
On the other hand, programming languages are designed first to be easily parsed by computers. With supercomputers, exascale computing [0] is now possible. Yet it is still hard to use fully the power of such computers because what is intuitive for a human mind is not always easy to program. For example the video proof of the inversion of the sphere [1] is checked more easily by a human than by a computer.
Finally instead of using only the power of computers, or only the power of human brains, it is also possible to combine both. This requires to improve the interaction between computers and human beings. In a video on thinking the unthinkable [2], the author notably remarks that the introduction of symbols in algebra allowed human beings to extend the problems they could think about. With better interfaces, the computers could help us to write fuzzy or explicit proofs, but more importantly, they could help us to think.
[0]: https://en.wikipedia.org/wiki/Exascale_computing
There are reasons to prove things and reasons to program things. What is the hypothetical individual trying to accomplish that they can do more via programming than proofs?
Also, as pointed out by others, as of the 20th century we had automated proof systems which have only improved in the 21st century. So someone wanting to prove things can do a lot more now without relying as much on proving "by hand".
I don't see how supporting workflows or setting/managing/evolving models of thinking can have anything to do with proof systems or proving correctness of algorithms.
Since we have CRUD basically worked out there is so much more software that can be written without being mathematically strict like the DBMS that we build on top.
Sorry, I've done a LOT in both (1) proofs in pure and applied math and (2) algorithms and software, and your statement is strongly wrong and backwards -- the math is much easier than the computing.
E.g., my Ph.D. dissertation in applied math had both proofs and the results of some software. There was no problem getting errors out of the proofs.
Proofs are really easy to check. I've done thousands of proofs, and I'm not sure I've ever had a mistake in one.
I've written perhaps a million lines of software, and over 50% of the programs had bugs until I found and fixed them.
One of the real advantages, powers, of math is how easy it is to check proofs.
Commonly it is much easier to have a correct and relatively easy to read proof of a math theorem than it is to have a correct and relatively easy to read proof of an algorithm where it is easy to see that the proof and the algorithm are as claimed. Even for just a simple, old algorithm such as Quicksort, it is not easy to prove it is correct; even the notation is not easy. In computing, proofs of correctness commonly have to be in the framework of mathematical induction, and there some notation is needed typically not seen otherwise for the algorithm.
Uh, mathematical induction is to show something is true for all the natural numbers, and the technique basically returns to one of the good definitions of the natural numbers.
Beyond just algorithms, in computing proofs of correctness are so difficult that we essentially give up: The reason is, the assumptions are too difficult to list. If you will, a common problem is "too many edge cases".
It is true that there is something to learn about how to write proofs.
Pure math has a standard that in precision puts it far above essentially all other writing: Some pictures or intuitive explanations may be tolerated but they are not necessary and mostly not wanted. Also, there is no role for "try it and find out", for "doing some examples to see how it goes", some manual manipulation like do when when learning to use socket wrenches or a chef's knife. An old joke was, how complicated a math description would be for how to put on a suit coat.
E.g., a missed definition sticks out worse than a sore thumb. E.g., it should be clear, maybe even mentioned, in the proof, for each of the assumptions, where it got used.
So, the math writing has to give really solid results just from the words and math notation. Bluntly, that is unique in writing.
For accomplishing good, new things, I'm strongly on the side of math with proofs.
The core of my startup is an example. There are no heuristics there, just some math with proofs. Without the math, there would be only guessing and heuristics on how to manipulate the input data to give the desired outputs, and the chances of any heuristics having stumbled onto the same manipulations as provided by the math are zip, zilch, and zero.
E.g., some of the math is close to some math commonly considered, but my math fixes some essentially universal mistakes, really misunderstandings, that have become standard. That is, the common understanding is that there is a fundamental problem there, but that is not true, and my math, with proofs, shows that. Without the math and proofs, I would not have thought of the data manipulations or, if I did, have confidence in their correctness or power.
Sorry, guys: In my opinion, math is the main tool for the most important progress in applying computing to help civilization.
I am genuinely interested in your response.
From what I have gathered, computing is actually ill-defined, almost as hand-wavy as "the consciousness problem."
Mathematics is a set of mental models and or formal languages to reason about quantities or at least "things." Is one way I look at it, would you agree, have an additional perspective?
Computation is.... ?
I've come to some simple definitions of computation trying to find an axiomatic root, I'll share if interested.
My definition is: computation is the transformation of information into meaning. (Simply)
Or more expanded…
> the transformation of energy into meaning == consciousness
> the transformation of energy into information == computation
> the transformation of energy == physics
Something I’ve been working with in my research and nomenclature.
Yes, there are some deep questions and answers about some of what can or cannot be done with the current, usual concept of computers, or if something can be done, what is the fastest it can be done?
But for what computers really are:
A guy has a calculator. He stands in front of a wall with cubby holes like behind the desk of an old hotel. Ah, there's a picture at
https://www.amazon.com/Happybuy-Storage-Classroom-Plywood-Cu...
Each cubby hole has an address, e.g., room number of some room in the hotel. The example at Amazon is missing the addresses!
Some of the cubby holes have in them a small piece of paper.
The guy has been instructed to start with the cubby hole with address 1 and do what its piece of paper says to do. When he has done that, unless the paper tells him otherwise, he is to move to the next cubby hole and do what it says.
Another example is a recipe:
Cut a large onion into small pieces.
Place a frozen ground beef steak of about 1/2 pound in a cast iron skillet. Surround it with the onions. Add pepper. Put a cover on the skillet and turn the heat to low.
In about 20 minutes, flip the steak.
In another 10 minutes move the steak to a serving bowl.
Add to the skillet the contents of a 10.5 ounce can of Campbell's Beef Consomme.
Use a spatula to scrape the bottom of the skillet until nothing is stuck.
Move the contents of the skillet to a strainer set over the skillet and press liquid out of the onions.
Put the onions with the beef.
Over high heat, boil down the liquid in the skillet to a light syrup.
Add the syrup to a bowl with 1 T (tablespoon, 15 ml) of each of Worcestershire Sauce, Dijon mustard, minced garlic, and 4 T of heavy cream and, to make a sauce, mix the contents of the bowl.
Pour over the onions and beef.
Warm in a microwave oven.
So, a recipe is some instructions, step by step.
A more complicated recipe might have uses of
if-then-else
do-while
If we want we can also get into computability, the halting problem (a self-referencing paradox), computational complexity, e.g., the question of P versus NP, numerical linear algebra, numerical partial differential equations, ray tracing graphics, cryptography, etc., but still the computing itself can be regarded as just following some recipes. Since I'm trying to get a business going and am not trying for academic tenure, that view of computing is enough for me.
Yes, the steps in a computer recipe might be from the results of some math theorems and proofs. A good example is the Gauss elimination in linear algebra.
For math, one view is to start with the truth table and propositional logic (calculus). The truth table defines AND, OR, NOT, and IF-THEN, that is, the results, TRUE or FALSE, depending on the inputs TRUE or FALSE.
From that can argue that math can be reduced to just symbol substitution and uses of the truth table. The result refutes counterexamples.
Might insert: A math statement such as
x + 1 = 0
can be read: There is a number, call it x, such that .... So, in this way we make more clear the meaning of variables in math. Then get to use such notation when working with truth tables, etc.
A little deeper and closer to math, we can have sets:
So, a set is a collection of elements. We're supposed already to know what the elements are.
Given a set A and an element x, x is either in set A or it is not. When x is in set A, it is in that set exactly once, i.e., never twice or more. The elements in set A are distinct. They are not in the set in any particular order; e.g., we can't say what is the first element in the set. Suppose
x = y
that is, x and y are just two names for the same element. Then if x is in A, also y is in A. That is, it is possible to have x and y both in A when x and y are not distinct -- this is easy, just have
x = y
From that we can move to a book on axiomatic set theory and see some more -- axioms -- have to assume, e.g., to get rid of self-referencing paradoxes.
From sets, in particular, starting with just the empty set, we can give definitions of everything else in math. The definitions are often tricky and even weird, still in principle it is possible to go through some elaborate constructions, starting with only the empty set, to define everything else. Since the results are so elaborate, even bizarre, we don't think of the math that way; instead, for skeptics or people who worry, we can say "if you just believe in the empty set, we can define everything else". When this is done, everything in math is a set -- the natural numbers, relations, functions, groups, rings, fields, vector spaces, curves, surfaces, etc.
Then, in fundamental terms, the proofs in math are essentially just using propositional logic on sets.
In common high school courses in plane geometry, proofs are written in a special style based on a table. Those proofs are valid as proofs.
In practice in the rest of math proofs are essentially always written with an especially precise use of some natural language, e.g., English, but it is possible to convert such proofs to a table such as in plane geometry or just back to symbol substitution.
For what I've seen, done, and do in math, that description is enough.