Prolog BFS
  • Limitations / Help
  • Report bug
  • Memory Usage:
Result tree view

What is this?

This is a tree of proof, also called search tree. It helps understanding how solutions are found for your querys. You can read more about it here.

What about variable bindings / most general unifiers?

These can been viewed for each step by hovering the mouse over an edge for a few seconds.

The tree is not shown completely / too small / too large.

Zoom: mouse wheel; Moving around: drag nodes or drag on free space

Can I export the tree / image without screenshotting it?

You may try and right click on the tree. Firefox and Chrome both offer an option to save it as an image file.

About Prolog BFS

Basic usage

Usage is very similar to SWISH, an online version of SWI Prolog.

In the left editor you put your program (see supported syntax below). Put your query in the bottom right editor. By clicking on "Run!" the interpreter will run the query against your program and try to give a first answer, which will appear on the top right. If you need more answers, you may click "next" below the answers. Each gray box keeps the program and query code and is not influenced by changes in the two editors.

Program and query code are saved in a cookie every minute and upon closing of the browser / tab. However, you should still save the code yourself and not rely on the cookie.

Known limitations

This is a very limited subset of Prolog! Don't get fooled by the syntax highlighting; it might provide highlighting for features that are not actually supported, because we didn't write the editor specifically for this interpreter.

These are the limitations:

  • Only integer arithmetic is supported.
  • Variables / constant names starting with an underscore are not supported. This especially includes anonymous variables ("_").
  • The only supported built in predicates are ==, \==, is/2 and append/3.
  • The memory limit is 500MB. If that is not enough, you might want to check out the offline version on Github. You may free some memory by closing results.
  • If you supply an infinite program (e.G.: a(x) :- a(X).; ? a(o). ), the site will freeze and eventually run out of memory. Any kind of occur check is not implemented.

The Prolog subset understood by the program can be viewed as a grammar here.

What's special about it? Isn't it just another Prolog interpreter?

It is one of the few, if not the only Prolog interpreters that does a breadth-first-search as its SLD resolution strategy. This strategy/algorithm is semidecidable as opposed to the more common (and more efficient) depth-first-search, which is neither decidable nor semidecidable.

In simpler words: you are less likely to run into infinte loops. Consider this example:

    a(X) :- a(X).
    a(a).
    ?- a(Z).
                        

That program and query will run infinitely on a normal Prolog interpreter while this one will give you all solutions.

Who created it?

The project was started in summer 2019 by Leonhard Kipp who coded the actual interpreter backend. Martin Weber joined the project later to create this web front end. Both are students of computer science at FH Aachen University of Applied Sciences in Aachen, Germany.

Is the source code available?

Yes. The project is hosted on Github.

System requirements

  • Operating System: independent
  • Browser:
    • WebAssembly must be supported by your browser of choice.
    • Tested on Firefox and Chrome.
    • Edge, Opera and Safari should work. They are not explicitly tested.
  • Network: once loaded, the software works without network-requests, as long as the browser tab remains open.
  • Cookies: you may disable cookies in your browser. In that case, automatic saving of your program and query code will not work though.
  • JavaScript: required.