First Order Logic Engine
Asked Answered
M

3

16

I'd like to create an application that can do simple reasoning using first order logic. Can anyone recommend an "engine" that can accept an arbitrary number of FOL expressions, and allow querying of those expressions (preferably accessible via Python)?

Meathead answered 21/2, 2010 at 4:8 Comment(1)
Thanks for the PyLog and Pythologic suggestions. However, I'm already familiar with these. Allow me to clarify. I'm looking for non-toy engines. Something that's scalable, widely in use, and easily interacts with a database. It doesn't have to be implemented in Python, only accessible from Python.Meathead
S
9

PyLog:

PyLog is a first order logic library including a PROLOG engine in Python.

Sanborn answered 21/2, 2010 at 4:41 Comment(0)
T
12

Don't query using first-order logic (FOL) unless you absolutely have to: first-order logic is not decidable, but only semi-decidable, and so queries will often, unavoidably not terminate.

Description logic is essentially a decidable fragment of first-order logic, reformulated in a manner that is good for talking about classes of entity and their interrelationships. There are many engines for description logic in Python, for example seth, based on OWL-DL.

If you are really sure that you need the vastness of FOL, then FLiP is worth a look. I've not used it (not really keen on Python, to be honest), but this is a good approach to making logic checking available to a programming language.

Tableau answered 24/2, 2010 at 22:48 Comment(2)
It appears that neither Seth nor Flip are under active development. Seth uses Pellet, which appears to still be active, but I'm finding very little documentation on real-world uses for OWL-DL reasoners in general.Meathead
kanren seems mature and stable: pypi.org/project/kanrenAlvy
S
9

PyLog:

PyLog is a first order logic library including a PROLOG engine in Python.

Sanborn answered 21/2, 2010 at 4:41 Comment(0)
V
1

Recipe 303057: Pythologic -- Prolog syntax in Python / http://code.activestate.com/recipes/303057/

Villainy answered 21/2, 2010 at 4:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.