{"id":17176287,"url":"https://github.com/evhub/pyprover","last_synced_at":"2025-05-07T17:50:19.826Z","repository":{"id":49154171,"uuid":"83852877","full_name":"evhub/pyprover","owner":"evhub","description":"Resolution theorem proving for predicate logic in pure Python.","archived":false,"fork":false,"pushed_at":"2023-11-20T02:44:51.000Z","size":352,"stargazers_count":93,"open_issues_count":3,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-01T01:18:10.823Z","etag":null,"topics":["coconut","first-order-logic","prover","python","theorem-prover","theorem-proving"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evhub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-04T00:17:36.000Z","updated_at":"2025-03-21T12:08:12.000Z","dependencies_parsed_at":"2023-11-20T03:41:44.031Z","dependency_job_id":null,"html_url":"https://github.com/evhub/pyprover","commit_stats":{"total_commits":94,"total_committers":3,"mean_commits":"31.333333333333332","dds":0.0957446808510638,"last_synced_commit":"91c4a771533dd129c8de3e568522e09ea981dc15"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evhub%2Fpyprover","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evhub%2Fpyprover/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evhub%2Fpyprover/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evhub%2Fpyprover/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evhub","download_url":"https://codeload.github.com/evhub/pyprover/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252931391,"owners_count":21827104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coconut","first-order-logic","prover","python","theorem-prover","theorem-proving"],"created_at":"2024-10-14T23:59:48.616Z","updated_at":"2025-05-07T17:50:19.807Z","avatar_url":"https://github.com/evhub.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyProver\n\nPyProver is a resolution theorem prover for first-order predicate logic. PyProver is written in [Coconut](http://coconut-lang.org/) which compiles to pure, universal Python, allowing PyProver to work on any Python version.\n\nInstalling PyProver is as simple as\n```\npip install pyprover\n```\n\n## Usage\n\nTo use PyProver from a Python interpreter, it is recommended to\n```python\nfrom pyprover import *\n```\nwhich will populate the global namespace with capital letters as propositions/predicates, and lowercase letters as constants/variables/functions. When using PyProver from a Python file, however, it is recommended to only import what you need.\n\nFormulas can be constructed using the built-in Python operators on propositions and terms combined with `Exists` (or `EX`), `ForAll` (or `FA`), `Eq`, `top`, and `bot`. For example:\n```python\nA \u0026 B\nA | ~B\n~(A | B)\nP \u003e\u003e Q\nP \u003e\u003e (Q \u003e\u003e P)\n(F \u0026 G) \u003e\u003e H\nE \u003e\u003e top\nbot \u003e\u003e E\nFA(x, F(x))\nTE(x, F(x) | G(x))\nFA(x, F(f(x)) \u003e\u003e F(x))\nEq(a, b)\n```\n\nAlternatively, the `expr(formula)` function can be used, which parses a formula in standard mathematical notation. For example:\n```\nF ∧ G ∨ (C → ¬D)\nF /\\ G \\/ (C -\u003e ~D)\nF \u0026 G | (C -\u003e -D)\n⊤ ∧ ⊥\ntop /\\ bot\nF -\u003e G -\u003e H\nA x. F(x) /\\ G(x)\n∀x. F(x) /\\ G(x)\nE x. C(x) \\/ D(x)\n∃x. C(x) \\/ D(x)\n∀x. ∃y. G(f(x, y))\na = b\nforall x: A, B(x)\nexists x: A, B(x)\n```\n\n_Note that `expr` requires propositions/predicates to start with a capital letter and constants/variables/functions to start with a lowercase letter._\n\nOnce a formula has been constructed, various functions are provided to work with them. Some of the most important of these are:\n\n- `strict_simplify(expr)` finds an equivalent, standardized version of the given `expr`,\n- `simplify(expr)` is the same as `strict_simplify`, but it implicitly assumes `TE(x, top)` (something exists),\n- `strict_proves(givens, concl)` determines if `concl` can be derived from `givens`, and\n- `proves(givens, concl)` is the same as `strict_proves`, but it implicitly assumes `TE(x, top)` (something exists).\n\nTo construct additional propositions/predicates, the function `props(\"name1 name2 name3 ...\")` will return propositions/predicates for the given names, and to construct additional constants/variables/functions, the function `terms(\"name1 name2 name3 ...\")` can be used similarly.\n\n## Examples\n\n_The backtick infix syntax here is from [Coconut](http://coconut-lang.org/). If using Python instead simply adjust to standard function call syntax._\n\n```python\nfrom pyprover import *\n\n# constructive propositional logic\nassert (E, E\u003e\u003eF, F\u003e\u003eG) `proves` G\nassert (E\u003e\u003eF, F\u003e\u003eG) `proves` E\u003e\u003eG\n\n# classical propositional logic\nassert ~~E `proves` E\nassert top `proves` (E\u003e\u003eF)|(F\u003e\u003eE)\n\n# constructive predicate logic\nassert R(j) `proves` TE(x, R(x))\nassert (FA(x, R(x) \u003e\u003e S(x)), TE(y, R(y))) `proves` TE(z, S(z))\n\n# classical predicate logic\nassert ~FA(x, R(x)) `proves` TE(y, ~R(y))\nassert top `proves` TE(x, D(x)) | FA(x, ~D(x))\n\n# use of expr parser\nassert expr(r\"A x. E y. F(x) \\/ G(y)\") == FA(x, TE(y, F(x) | G(y)))\nassert expr(r\"a = b /\\ b = c\") == Eq(a, b) \u0026 Eq(b, c)\n```\n\n## Compiling PyProver\n\nIf you want to compile PyProver yourself instead of installing it from PyPI with `pip`, you can\n\n1. clone the `git` repository,\n2. run `make setup`, and\n3. run `make install`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevhub%2Fpyprover","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevhub%2Fpyprover","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevhub%2Fpyprover/lists"}