Skip to main content

PDDL-Prover

A python prover for evaluating FOL formulas on PDDL.

PDDL-Prover allows to construct arbitrary formulas in first-order logic (FOL) in Python, using a declarative syntax and including counting quantifiers. Then, the truth values of these formulas can be evaluated on a knowledge base, which represents a set of objects/contants and a set of true atoms (as in PDDL).

This results useful for evaluating conditions on PDDL states. For example, to check if in a given blocksworld state block A is on top of the table and under block B, we can do the following:

(ontable(A) & on(B,A)).evaluate(kb)

where kb is the knowledge base containing the objects and atoms of the blocksworld state. The line above will return True if the condition is met at the state, and False otherwise. You can find a more elaborate example below.

Installation

The package is available in PyPI and can be installed with pip install pddl-prover. Alternatively, you can clone this repository.

Example of use

from pddl-prover import *

b0, b1, b2, b3, b4  =  Constant(0), Constant(1), Constant(2), Constant(3), Constant(4)
x, y  =  Variable('x'), Variable('y')

handempty  =  Predicate('handempty', 0) # The second argument is the arity
ontable  =  Predicate('ontable', 1)
on  =  Predicate('on', 2)
clear  =  Predicate('clear', 1)

# Note: atoms in the knowledge base can be represented either in tuple form or as instances of the class logic.Atom
kb  = ({b0,b1,b2},{('ontable', (0,)), ('on',(1,0)), ('on', (2,1)), ('clear',(2,)),
('handempty', tuple())})

print("Evaluation:", handempty().evaluate(kb)) # True
print("Evaluation:", (ontable(b0) & on(b1,b0)).evaluate(kb)) # True
print("Evaluation:", TE(x, on(x,b0)).evaluate(kb)) # There Exists some x for which on(x,b0) -> True
print("Evaluation:", (TE(x, ontable(x)) == 1).evaluate(kb)) # There exists <only> one object for which ontable(x) is True -> True (counting quantifier)
print("Number of true substitutions:", Count(on(x,y), x, y).evaluate(kb)[0]) # Returns the number of x and y substitutions for which on(x,y) is True -> 2

Release files for PDDL-Prover 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PDDL-Prover 1.0.0
File Size Uploaded
PDDL-Prover-1.0.0.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PDDL-Prover 1.0.0
File Interpreter ABI Platform
PDDL_Prover-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.3 kB

Release files / PDDL-Prover-1.0.0.tar.gz

Download URL PDDL-Prover-1.0.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a37736e20ea93cfdd264de08b68ad7cee9651e2cf6d26b5dce2fad9cf1928b26
BLAKE2b-256 checksum
How to use checksums
7437b581229baefc10191c18b33518700a5d72ad6f4a6818e70c5712fcf17cbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / PDDL_Prover-1.0.0-py3-none-any.whl

Download URL PDDL_Prover-1.0.0-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e02d6a928498072f3b25d6f55814c3b048ce8bccc5925fa298817de0e34cc277
BLAKE2b-256 checksum
How to use checksums
e8b8fafe3d29d432e4714813e440af0daadb0328f1e26ede9723c8620380a09e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page