Pylog is a lightweight Python library that implements core features of Prolog, enabling logic programming paradigms within Python. It allows defining facts and rules to perform simple logical deductions and goal-oriented queries. The current stable version is 1.1, with an infrequent release cadence focusing on stability and minor enhancements.
pip install pylogVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define facts, create a simple rule using other predicates, set a goal, and retrieve solutions using the `run()` function. It showcases basic logical inference capabilities.
Update all import statements. Instead of `import pylog` or `from pylog import symbol`, use `from pylog.pylog import symbol` for functions like `facts`, `rules`, `goal`, and `run`.
Be aware that the knowledge base is global. For applications requiring isolated logical contexts, manually manage state or consider external mechanisms, as `pylog` does not provide explicit APIs for context management or resetting the knowledge base directly.
Consult the library's GitHub repository for current capabilities and examples. Do not expect full Prolog compatibility; plan your logic programming tasks accordingly within the library's demonstrated scope.
No dependency data recorded yet.