PyProver: Resolution Theorem Proving

0.6.2 · active · verified Mon Apr 13

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.

Warnings

Install

Imports

Quickstart

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}")

view raw JSON →