Live data from Hacker News

Discovering algorithms by enumerating terms in Haskell

twitter.com

11–20 of 50 posts

Re: Discovering algorithms by enumerating terms in Haskell

#11
post #10

Earlier quoted context omitted.

For non-twitter, I was looking the other day at https://reasonablypolymorphic.com/blog/syntax-guided-synthes... , which unfortunately points at a dead page related to https://sygus.org/comp/2019/ , but seems related?

I believe the dead link in the article is referencing this journal paper[1], which is an expanded version of the original syntax guided synthesis paper. [1] https://web.eecs.umich.edu/~weimerw/2022-481W/readings/Alur1...

Thanks! Looks like barliman is also (like its namesake?) slowly progressing: https://github.com/webyrd/Barliman

Re: Discovering algorithms by enumerating terms in Haskell

#12
Uhm author here. Not sure why this tweet is on Hacker News, as it is just a non-technical "blog post". But I've posted a follow-up today with some code and details, if you're curious:

https://x.com/VictorTaelin/status/1819774880130158663

That's as much as I can share for now though

Re: Discovering algorithms by enumerating terms in Haskell

#13
Maciej Bendkowski has some related work [1] on generating random lambda terms, but was unable to overcome what he calls the asymptotic sparsity problem:

  Sampling simply-typed terms seems notoriously more challenging than sampling closed ones. Even rejection sampling, whenever applicable, admits serious limitations due to the imminent asymptotic sparsity problem — asymptotically almost no term, be it either plain or closed, is at the same time (simply) typeable. [...] Asymptotic sparsity of simply-typed λ-terms is an impenetrable barrier to rejection sampling techniques. As the term size tends to infinity, so does the induced rejection overhead. In order to postpone this inevitable obstacle, it is possible to use dedicated mechanisms interrupting the sampler as soon as it is clear that the partially generated term cannot be extended to a typeable one. The current state-of-the-art samplers take this approach, combining Boltzmann models with modern logic programming execution engines backed by highly-optimised unification algorithms. Nonetheless, even with these sophisticated optimisations, such samplers are not likely to generate terms of sizes larger than one hundred.
I would be curious to see a more rigorous analysis of the sample complexity of generating well-typed expressions in, e.g., the STLC. Maybe there is a way to avoid or reduce the rejection rate before evaluation.

[1]: https://arxiv.org/pdf/2005.08856

Re: Discovering algorithms by enumerating terms in Haskell

#14
This kind of reminds me of what happens when you implement an interpreter in a relational programming language, which lets you do cool stuff like generating quines by specifying that the program and it’s output should be the same.

Quick search lead to this paper which is exactly what I’m talking about: http://webyrd.net/quines/quines.pdf

Re: Discovering algorithms by enumerating terms in Haskell

#15
Super interesting. Sounds like the algo I created Prioritized Grammar Enumeration.

https://seminars.math.binghamton.edu/ComboSem/worm-chiu.pge_...

PGE is essentially a BFS/DFS traversal of the space of all formulas, by using local enumeration of the AST. The biggest gains where from eliminating duplicate work (commutativity / associativity) and not going down bad branches (too much complexity added for no meaningful change to output). A lot of overlap in ideas here, and a lot of open research questions that could be worked on (like can use use RL to help guide the search like A*). There's definitely an exponential explosion or wall as the AST gets wider / deeper.

At one point I wrote the core algorithm in Haskell, which made it so much more concise and beautiful, but eventually landed on python https://github.com/verdverm/pypge

In all of Genetic Programming / Symbolic Regression, everyone starts by trying to generate computer code and then switches to just math formula. They are different classes of problems because code has more "genes" and is order sensitive, whereas math is not

Re: Discovering algorithms by enumerating terms in Haskell

#16

Uhm author here. Not sure why this tweet is on Hacker News, as it is just a non-technical "blog post". But I've posted a follow-up today with some code and details, if you're curious: https://x.com/VictorTaelin/status/1819774880130158663 That's as much as I can share for now though

Only thing I could read (don't understand any of this otherwise) was that you take input pairs and you give python function to generate that output. Does that mean that many math etc problems can be just solved? What kind of python code will it generate to return primes?

Re: Discovering algorithms by enumerating terms in Haskell

#18
post #13

Maciej Bendkowski has some related work [1] on generating random lambda terms, but was unable to overcome what he calls the asymptotic sparsity problem: Sampling simply-typed terms seems notoriously more challenging than sampling closed ones. Even rejection sampling, whenever applicable, admits serious limitations due to the imminent asymptotic sparsity problem — asymptotically almost no term, be it either plain or c…

There are quite a few publications that explore the concept of generating programs, either using typed or untyped functional languages.

For example, wake-sleep learning and NN on a Lisp-like language [1] or synthesis of Haskell guided by refinement types [2].

[1] https://royalsocietypublishing.org/doi/full/10.1098/rsta.202....

[2] https://dl.acm.org/doi/abs/10.1145/2980983.2908093

Re: Discovering algorithms by enumerating terms in Haskell

#19

Uhm author here. Not sure why this tweet is on Hacker News, as it is just a non-technical "blog post". But I've posted a follow-up today with some code and details, if you're curious: https://x.com/VictorTaelin/status/1819774880130158663 That's as much as I can share for now though

Only thing I could read (don't understand any of this otherwise) was that you take input pairs and you give python function to generate that output. Does that mean that many math etc problems can be just solved? What kind of python code will it generate to return primes?

I imagine it like content addressable computation which implicitly means data too.

Why compute anything more than once? Find by identity and reuse.

This then opens up interesting things when applied in a network that can optimize pathing (like an internet, DHT-like overlay).

Re: Discovering algorithms by enumerating terms in Haskell

#20
post #18
post #13

Maciej Bendkowski has some related work [1] on generating random lambda terms, but was unable to overcome what he calls the asymptotic sparsity problem: Sampling simply-typed terms seems notoriously more challenging than sampling closed ones. Even rejection sampling, whenever applicable, admits serious limitations due to the imminent asymptotic sparsity problem — asymptotically almost no term, be it either plain or c…

There are quite a few publications that explore the concept of generating programs, either using typed or untyped functional languages. For example, wake-sleep learning and NN on a Lisp-like language [1] or synthesis of Haskell guided by refinement types [2]. [1] https://royalsocietypublishing.org/doi/full/10.1098/rsta.202... . [2] https://dl.acm.org/doi/abs/10.1145/2980983.2908093

Another relevant publication in this line of research: https://dl.acm.org/doi/10.1145/3632919
Post reply on HN