Registry / ai-ml / pyprover

pyprover

JSON →
library0.6.2pypypi✓ verified 24d ago

PyProver is a resolution theorem prover for first-order predicate logic, implemented in pure Python. It is written in Coconut, which compiles to universal Python, ensuring compatibility across various Python versions. The latest version is 0.6.2, released in March 2022. The project is currently in an alpha development stage and has an infrequent release cadence.

pip install pyprover
INSTALL
IMPORT
SIG · PYPROVER
P
pyprover
ai-mlpythonv0.6.2
Install
1.7s avg
Import
556ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.604s · 19.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.508s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

expr
from pyprover import expr
Used for parsing formulas from strings.
proves
from pyprover import proves
Determines if a conclusion can be derived from a set of givens.
strict_proves
from pyprover import strict_proves
Strict version of 'proves' without implicit assumptions.
simplify
from pyprover import simplify
Simplifies an expression, implicitly assuming something exists.
strict_simplify
from pyprover import strict_simplify
Strict simplification without implicit assumptions.
ForAll
from pyprover import ForAll
Represents the universal quantifier.
Exists
from pyprover import Exists
Represents the existential quantifier.
Eq
from pyprover import Eq
Represents equality.
props
from pyprover import props
Creates multiple propositions/predicates by name.
terms
from pyprover import terms
Creates multiple constants/variables/functions by name.
all_imports
from pyprover import *
from pyprover import *
While convenient for interactive use, it's recommended to import specific symbols in Python files to avoid global namespace pollution.

This quickstart demonstrates how to define formulas using the `expr` function and construct proofs using the `proves` function. It includes examples for propositional and first-order logic.

from pyprover import expr, proves, ForAll # Define some propositions/predicates and terms F, G = expr('F'), expr('G') x, y = expr('x'), expr('y') # Construct formulas formula1 = expr('A & B') formula2 = ForAll(x, F(x) >> G(x)) # Example of a simple proof: Modus Ponens givens = [expr('P >> Q'), expr('P')] conclusion = expr('Q') is_proven = proves(givens, conclusion) print(f"Does {givens} prove {conclusion}? {is_proven}") # Example with quantifiers givens_quant = [ForAll(x, F(x) >> G(x)), F(x)] # Note: F(x) here acts as an instance for some x conclusion_quant = G(x) is_proven_quant = proves(givens_quant, conclusion_quant) print(f"Does {givens_quant} prove {conclusion_quant}? {is_proven_quant}")
Debug
Known issues
gotchaThe library is currently in 'Development Status :: 3 - Alpha'. This means the API might change in future versions without strict adherence to semantic versioning, and it may not be suitable for production environments requiring high stability.
fix
Be aware of potential API changes and thoroughly test your code when upgrading versions. Consider the project's maturity level for your application's requirements.
affects: <=0.6.2
gotchaWhen using the `expr` function to parse formulas, propositions and predicates must start with a capital letter (e.g., `P`, `Q`, `F(x)`), while constants, variables, and functions must start with a lowercase letter (e.g., `x`, `y`, `f(a)`).
fix
Ensure correct casing for symbols when defining formulas via `expr` to avoid parsing errors.
affects: <=0.6.2
gotchaWhile `from pyprover import *` is demonstrated for interactive use, it is generally recommended to import specific functions or classes (e.g., `from pyprover import proves, expr`) in Python files to prevent polluting the global namespace and improve code clarity.
fix
Prefer explicit imports for better code organization and to avoid name collisions.
affects: <=0.6.2
gotchaThe last release (v0.6.2) was on March 2, 2022. This indicates that the project may not be actively maintained or updated, which could lead to a lack of new features, bug fixes, or compatibility updates for newer Python versions.
fix
Users should consider the implications of an inactive project for long-term usage and support. Check the GitHub repository for recent commits or issues before relying heavily on it.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'coconut'
PyProver is written in Coconut and requires the `coconut` package to be installed for its runtime or compilation artifacts to function correctly.
fix
pip install coconut
ImportError: cannot import name 'prove' from 'pyprover'
The `prove` function (and other core functions like `unify`, `resolve`) are located in the `pyprover.logic` submodule, not directly in the top-level `pyprover` package.
fix
from pyprover.logic import prove
TypeError: unsupported operand type(s) for &: 'Symbol' and 'Symbol'
Logical expressions in PyProver must be constructed using explicit function calls like `And()`, `Or()`, `Not()` from `pyprover.expressions`, not Python's built-in bitwise or logical operators (`&`, `|`, `~`).
fix
from pyprover.expressions import And, Or, Not, Implies; from pyprover.logic import P, Q
expr = And(P('x'), Not(Q('y')))
Upgrade
Version history
0.6.2latest on PyPI · released Mar 2, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
OpenAI (training)
1
Resources