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)?
First-order logic is symbolized reasoning in which each sentence, or statement, is broken down into a subject and a predicate. The predicate modifies or defines the properties of the subject. In first-order logic, a predicate can only refer to a single subject.
Definition A first-order predicate logic sentence G over S is a tautology if F |= G holds for every S-structure F. Examples of tautologies (a) ∀x.P(x) → ∃x.P(x); (b) ∀x.P(x) → P(c); (c) P(c) → ∃x.P(x); (d) ∀x(P(x) ↔ ¬¬P(x)); (e) ∀x(¬(P1(x) ∧ P2(x)) ↔ (¬P1(x) ∨ ¬P2(x))).
FOL is a mode of representation in Artificial Intelligence. It is an extension of PL. FOL represents natural language statements in a concise way. FOL is also called predicate logic. It is a powerful language used to develop information about an object and express the relationship between objects.
As propositional logic we also have inference rules in first-order logic, so following are some basic inference rules in FOL: Universal Generalization. Universal Instantiation. Existential Instantiation.
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.
PyLog:
PyLog is a first order logic library including a PROLOG engine in Python.
Recipe 303057: Pythologic -- Prolog syntax in Python / http://code.activestate.com/recipes/303057/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With