Hacker News new | past | comments | ask | show | jobs | submit login
Dogelog player is a Prolog system for the JavaScript and the Python platform (xlog.ch)
54 points by bryanrasmussen on July 31, 2022 | hide | past | favorite | 12 comments



Great timing! I've lately been studying up on Prolog and miniKanren, and increasingly I've been wishing that I had one or the other embedded in my usual programming languages. I believe there is already at least one miniKanren implementation in each of JS and Python, but it's cool to see this pop up.

One thing I've wondered about with such systems as performance: I would be nervous about pathological cases leading to really bad performance or even DOS attacks. My understanding of Prolog in particular is that sometimes in order to get your program to run to completion requires a nontrivial understanding of the backtracking algorithm them so you can judiciously place cuts, etc.

Inspired by Will Byrd's many presentation on quines, this leads me to wonder: what if you had a logic language that does not run at runtime, but that generates code with certain properties according to some set of rules? It's such a thing possible? Are there theoretical results on that subject?


> One thing I've wondered about with such systems as performance: I would be nervous about pathological cases leading to really bad performance or even DOS attacks. My understanding of Prolog in particular is that sometimes I get in your program to run to completion requires a nontrivial understanding of the backtracking algorithm them so you can judiciously place cuts, etc.

That depends on which constructs are you using. It's perfectly fine to write modern Prolog code without any cut, but the sad thing is that those constructs (once/1, dif/2, if_/3, tabling, ...) aren't taught in most books out there (the exception is The Power of Prolog) which still perpetuates these ideas about Prolog.


You would probably need to do some testing before heading to production, but the easiest insurance would probably be to wrap every query in a timeout and just cancel the query after a max timeout. Most net systems work this anyway and it gives you insurance around a slow query saturating your business logic.


You'd be interested in Grammar-Guided Genetic Programming.

It's tangential, but along similar lines. You generate a grammar of what a successful program looks like, and then that grammar can spit out programs of that "shape" ad infinitum.

The main difference is that you don't have the same verifiable guarantees as logic-al solutions because the grammar is generated and evolved over time instead of induced from a ruleset.



I always love to see Prolog in the wild, but a project that's this protective about its documentation (e.g., http://pages.xlog.ch/littab/doclet/en/docs/15_manual/02_refe...):

> All industrial property rights regarding the information - copyright and patent rights in particular - are the sole property of XLOG Technologies AG. If the company was not the originator of some excerpts, XLOG Technologies AG has at least obtained the right to reproduce, change and translate the information.

> Reproduction is restricted to the whole unaltered document. Reproduction of the information is only allowed for non-commercial uses. Small excerpts can be used if properly cited. Citations must at least include the document title, the product family, the product version, the company, the date and the page.

(am I already violating the provisions by quoting those paragraphs?) makes me immediately scared of what will happen if I use it.


The Common Lisp HyperSpec has a similarly nerve-wracking proprietary license. The result is that nobody is able to so much as reupload its contents in a different web UI, let alone make substantive additions to it, even if the additions are clearly labeled as such and the original content is not modified.


The HyperSpec is a specific web UI to the ANSI Common Lisp Standard (actually some ANSI CL documentation version before it was officially published as a standards document). In this case the HyperSpec is based on the works of a standardization body AND is the specific HTML version (incl. more documentation from the standardization) created by a company.

There are other versions in HTML (and also other documentation formats, IIRC) of the ANSI CL standard. One example is this web version, provided by Franz, Inc.: https://franz.com/support/documentation/ansicl.94/ansicl.htm The content is basically the same as in the HyperSpec, but the rendering to HTML is very different.


There seems to be a growing number of ISO Prolog systems running in the browser, including native systems ported over to a browser target. I guess a common restriction is the lack of ISO I/O predicates (which don't make sense in a browser or wouldn't help portability if implemented over HTTP in an ad-hoc way).

[1]: http://tau-prolog.org/

[2]: https://quantumprolog.sgml.io


How does dogelog compare with tao prolog?

http://tau-prolog.org/


Tau Prolog is an ISO Prolog system from scratch and just for JavaScript. It tries to follow some of the innovations of Scryer and Trella Prolog. Dogelog inherits some stuff from Jekejeke Prolog and has an innovative GC.


I found this cool link in one of the examples: https://www.philipzucker.com/javascript-automated-proving/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: