osa1 feed

MANTI - Prolog implementation in 515 lines of Haskell

July 31, 2013 - Tagged as: en, haskell, prolog.

MANTI is a pure Prolog implementation in 515 lines of Haskell. It’s only implements pure parts, meaning it doesn’t have cuts, IO predicates, non-pure arithmetic(is structures in modern Prolog implementation) or other structures that break logical reasoning of Prolog programs.

Here are some example Prolog programs that currently runs under MANTI: (you can find these in tests/ folder in source repository)

My aim while writing MANTI was to make it as simple as possible, yet a complete Prolog implementation that is capable to solve some real problems. For this reasons, it doesn’t have arithmetic, list structures and list operations built-in. Instead, arithmetic is implemented using Peano definitions, you can see the implementation here. List operations are also implemented in MANTI itself, you can see definitions here. List syntax is nothing special, it’s just a syntactic sugar that destructs to ordinary Prolog functors(you can see parser for list syntax here).

For these reasons(and probably others, for instance, unification and not connective are implemented in most inefficient ways possible), it’s very slow. Also, there’s no way to disable occurs check without recompiling MANTI.

It’s mostly done and I don’t think I’ll work more on that. I hope you find MANTI useful(for learning purposes or others).