Better HN
topnewbestaskshowjobs
Log inSign up

pedromsrocha

6 karma · joined Jan 31, 2025 (1y ago) · 3 submissions

Submissions

comment 1y ago · link · parent

I disagree with the author’s claim that there are no black boxes in mathematics. In fact, this is exactly what lemmas and theorems serve as: a statement (like a typing interface or function signature) together with a proof (a “program”) that satisfies that interface. In large-scale mathematics we rarely unfold every proof; we use those results as black boxes — otherwise the work would be unsustainable.

I also disagree with the broader implication that the languages of programming and mathematics (i.e., logic) are inherently distant. On the contrary, they share deep structural isomorphisms as evidenced by the Curry–Howard correspondence.

comment 1y ago · link · parent

This blog post is very interesting, using Rust’s compiler optimizer as a theorem prover. This makes me wonder: are there any formal specifications on the complexity of this "optimizer as theorem prover"?

Specifically, how does it handle recursion? Consider, for example, the following function, which decrements a number until it reaches zero. At each step, it asserts that the number is nonzero before recursing:

fn recursive_countdown(n: u32) -> u32 { assert!(n > 0, "n should always be positive"); if n == 1 { return 1; } recursive_countdown(n - 1) }

Can the compiler prove that the assertion always holds and possibly optimize it away? Or does the presence of recursion introduce limitations in its ability to reason about the program?