Name | PDDL-Prover JSON |
Version |
1.0.0
JSON |
| download |
home_page | |
Summary | A python prover for evaluating FOL formulas on PDDL |
upload_time | 2023-11-22 00:22:50 |
maintainer | |
docs_url | None |
author | |
requires_python | |
license | MIT License Copyright (c) 2023 Carlos Núñez Molina Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
logic
automated planning
theorem prover
pddl
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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
Raw data
{
"_id": null,
"home_page": "",
"name": "PDDL-Prover",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "logic,automated planning,theorem prover,pddl",
"author": "",
"author_email": "Carlos N\u00fa\u00f1ez Molina <ccaarlos@ugr.es>",
"download_url": "https://files.pythonhosted.org/packages/74/37/b581229baefc10191c18b33518700a5d72ad6f4a6818e70c5712fcf17cbc/PDDL-Prover-1.0.0.tar.gz",
"platform": null,
"description": "# PDDL-Prover\nA python prover for evaluating FOL formulas on PDDL.\n\nPDDL-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).\n\nThis 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:\n\n```\n(ontable(A) & on(B,A)).evaluate(kb)\n```\n\nwhere `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.\n\n## Installation\n\nThe package is available in PyPI and can be installed with `pip install pddl-prover`.\nAlternatively, you can clone this repository.\n\n## Example of use\n\n```\nfrom pddl-prover import *\n\nb0, b1, b2, b3, b4 = Constant(0), Constant(1), Constant(2), Constant(3), Constant(4)\nx, y = Variable('x'), Variable('y')\n\nhandempty = Predicate('handempty', 0) # The second argument is the arity\nontable = Predicate('ontable', 1)\non = Predicate('on', 2)\nclear = Predicate('clear', 1)\n\n# Note: atoms in the knowledge base can be represented either in tuple form or as instances of the class logic.Atom\nkb = ({b0,b1,b2},{('ontable', (0,)), ('on',(1,0)), ('on', (2,1)), ('clear',(2,)),\n('handempty', tuple())})\n\nprint(\"Evaluation:\", handempty().evaluate(kb)) # True\nprint(\"Evaluation:\", (ontable(b0) & on(b1,b0)).evaluate(kb)) # True\nprint(\"Evaluation:\", TE(x, on(x,b0)).evaluate(kb)) # There Exists some x for which on(x,b0) -> True\nprint(\"Evaluation:\", (TE(x, ontable(x)) == 1).evaluate(kb)) # There exists <only> one object for which ontable(x) is True -> True (counting quantifier)\nprint(\"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\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2023 Carlos N\u00fa\u00f1ez Molina Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "A python prover for evaluating FOL formulas on PDDL",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/TheAeryan/PDDL-Prover"
},
"split_keywords": [
"logic",
"automated planning",
"theorem prover",
"pddl"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e8b8fafe3d29d432e4714813e440af0daadb0328f1e26ede9723c8620380a09e",
"md5": "2c837f4f24fcc053424ce2e0b546ca70",
"sha256": "e02d6a928498072f3b25d6f55814c3b048ce8bccc5925fa298817de0e34cc277"
},
"downloads": -1,
"filename": "PDDL_Prover-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c837f4f24fcc053424ce2e0b546ca70",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10495,
"upload_time": "2023-11-22T00:22:49",
"upload_time_iso_8601": "2023-11-22T00:22:49.039316Z",
"url": "https://files.pythonhosted.org/packages/e8/b8/fafe3d29d432e4714813e440af0daadb0328f1e26ede9723c8620380a09e/PDDL_Prover-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7437b581229baefc10191c18b33518700a5d72ad6f4a6818e70c5712fcf17cbc",
"md5": "dfdadc27073dddb43e2b21e0be761478",
"sha256": "a37736e20ea93cfdd264de08b68ad7cee9651e2cf6d26b5dce2fad9cf1928b26"
},
"downloads": -1,
"filename": "PDDL-Prover-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "dfdadc27073dddb43e2b21e0be761478",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8799,
"upload_time": "2023-11-22T00:22:50",
"upload_time_iso_8601": "2023-11-22T00:22:50.780696Z",
"url": "https://files.pythonhosted.org/packages/74/37/b581229baefc10191c18b33518700a5d72ad6f4a6818e70c5712fcf17cbc/PDDL-Prover-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-22 00:22:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "TheAeryan",
"github_project": "PDDL-Prover",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pddl-prover"
}