News for hackers. Stuff that matters.

manasij7479

These are indeed neat papers!
Neat, I wonder if this idea could be developed into a more refined programming experience where you you spend time in the imperative world by default and only express some iterations as logic puzzles to be solved like this.
The issue you have circled around here is a bit deeper and nuanced than trimming down exponential code to something more tractable. In fact, it's often worse, and O(2^n) can be blessing!

The problem with logic programming is the 'logic' part.

Modern imperative and functional programming languages are constructive.

Logic programming is not, and the expressive power varies with the exact logic being used.

Elementary logic gives you the following intuition. Propositional logic -- easy. First order logic -- easy (with caveats). And (some kinds of) second order logic -- only easy if you get lucky with the problem you are trying to solve.

For logic based programming languages and systems, both the language implementer and the programmer have to be careful about supporting and using language constructs which boil down to tractable computation.

This is much more difficult than it seems like.

For example, when using SMT solvers you learn quickly that multiplication and division with constants is very fast while the same operations with variables can be intractable.

Re:My first superoptimizer on Monday May 29, 2023 @06:59PM (#36119101)
Input's and other side effects are not too tricky to handle.

In most cases, you just slice the program to isolate pure computation, and just optimize that.

Most traditional compiler optimizations stick to that as well, the exceptions to this rule are carefully engineered.

Re:My first superoptimizer on Monday May 29, 2023 @06:43PM (#36118984)
The pruning part can do a lot of heavy lifting to make it a practical tool.

Related: I work on Souper (https://github.com/google/souper).

Feel free to reach out if anyone has questions!