classical-logic


Nameclassical-logic JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/ederic-oytas/classical-logic
SummaryPython package for propositional logic.
upload_time2024-02-14 05:09:38
maintainer
docs_urlNone
authorEderic
requires_python>=3.9,<4.0
licenseMIT
keywords and biconditional conditional conjunction connective disjunction if and only if iff implies implication logic logical connective negation not or classical logic proposition propositional calculus propositional logic sentence sentential calculus sentential logic statement logic zeroth-order logic
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# classical-logic - Tools for Classical Logic

<a href='https://classical-logic.readthedocs.io/en/stable/?badge=stable'>
    <img src='https://readthedocs.org/projects/classical-logic/badge/?version=stable' alt='Documentation Status' />
</a>
<a href="https://github.com/ederic-oytas/classical-logic/blob/main/LICENSE"><img alt="GitHub license" src="https://img.shields.io/github/license/ederic-oytas/classical-logic"></a>

`classical-logic` is a Python package that allows you to work with logical
propositions as Python objects.

It's extremely simple to use:

```python
from classical_logic import prop

p = prop('P & Q')
assert p(P=True, Q=True) is True
assert p(P=True, Q=False) is False
```

## Features

Parse proposition objects:

```python
from classical_logic import prop

# Can parse simple propositions:
p = prop('P | Q')
# As well as complex ones!
p = prop('P & (Q | (Q -> R)) <-> S')
```

Compose proposition objects:

```python
p = prop('P')
q = prop('Q')

# Create conjunctions and disjunctions with & and |:
u = p & (q | p)   # P & (Q | P)

# Create conditionals and biconditionals as well:
u = p.implies(q)  # P -> Q
u = p.iff(q)      # P <-> Q
```

Decompose propositions:

```python
u = prop('P & Q')

# Use indexing to 
assert u[0] == prop('P')
assert u[1] == prop('Q')

# You can also use Python's unpacking feature!
p, q = u
assert p == prop('P')
assert q == prop('Q')
```

Interpret propositions (assign truth values):

```python
u = prop('P <-> Q')

# Call the proposition like a function to interpret it
assert u(P=True, Q=True) is True
assert u(P=True, Q=False) is False
assert u(P=False, Q=False) is True
```

**No dependencies.** This package doesn't use any dependencies.

Want to use this package? See the [documentation](
https://classical-logic.readthedocs.io/en/stable/)!

## Links

[Documentation @ ReadTheDocs](
https://classical-logic.readthedocs.io/en/stable/)

[Github Repository](https://github.com/ederic-oytas/classical-logic)

[PyPI Page](https://pypi.org/project/classical-logic/)

## Installation

This package can be installed using Pip:

```bash
pip install classical-logic
```

Please make sure you use a dash (-) instead of an underscore (_).

## Bug Reports and Feature Requests

You can report a bug or suggest a feature on the Github repo.

See the [Issues page on Github](
https://github.com/ederic-oytas/classical-logic/issues/new/choose).

## Contributions

Contributions to this project are welcome. :)

See the [pull requests page on Github](
https://github.com/ederic-oytas/classical-logic/pulls).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ederic-oytas/classical-logic",
    "name": "classical-logic",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "and,biconditional,conditional,conjunction,connective,disjunction,if and only if,iff,implies,implication,logic,logical connective,negation,not,or,classical logic,proposition,propositional calculus,propositional logic,sentence,sentential calculus,sentential logic,statement logic,zeroth-order logic",
    "author": "Ederic",
    "author_email": "edericoytas@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/73/16/37cb69021d3ddb263750427f1c0f72d18ef655fdc115d6115e6deaec2a50/classical_logic-0.1.1.tar.gz",
    "platform": null,
    "description": "\n# classical-logic - Tools for Classical Logic\n\n<a href='https://classical-logic.readthedocs.io/en/stable/?badge=stable'>\n    <img src='https://readthedocs.org/projects/classical-logic/badge/?version=stable' alt='Documentation Status' />\n</a>\n<a href=\"https://github.com/ederic-oytas/classical-logic/blob/main/LICENSE\"><img alt=\"GitHub license\" src=\"https://img.shields.io/github/license/ederic-oytas/classical-logic\"></a>\n\n`classical-logic` is a Python package that allows you to work with logical\npropositions as Python objects.\n\nIt's extremely simple to use:\n\n```python\nfrom classical_logic import prop\n\np = prop('P & Q')\nassert p(P=True, Q=True) is True\nassert p(P=True, Q=False) is False\n```\n\n## Features\n\nParse proposition objects:\n\n```python\nfrom classical_logic import prop\n\n# Can parse simple propositions:\np = prop('P | Q')\n# As well as complex ones!\np = prop('P & (Q | (Q -> R)) <-> S')\n```\n\nCompose proposition objects:\n\n```python\np = prop('P')\nq = prop('Q')\n\n# Create conjunctions and disjunctions with & and |:\nu = p & (q | p)   # P & (Q | P)\n\n# Create conditionals and biconditionals as well:\nu = p.implies(q)  # P -> Q\nu = p.iff(q)      # P <-> Q\n```\n\nDecompose propositions:\n\n```python\nu = prop('P & Q')\n\n# Use indexing to \nassert u[0] == prop('P')\nassert u[1] == prop('Q')\n\n# You can also use Python's unpacking feature!\np, q = u\nassert p == prop('P')\nassert q == prop('Q')\n```\n\nInterpret propositions (assign truth values):\n\n```python\nu = prop('P <-> Q')\n\n# Call the proposition like a function to interpret it\nassert u(P=True, Q=True) is True\nassert u(P=True, Q=False) is False\nassert u(P=False, Q=False) is True\n```\n\n**No dependencies.** This package doesn't use any dependencies.\n\nWant to use this package? See the [documentation](\nhttps://classical-logic.readthedocs.io/en/stable/)!\n\n## Links\n\n[Documentation @ ReadTheDocs](\nhttps://classical-logic.readthedocs.io/en/stable/)\n\n[Github Repository](https://github.com/ederic-oytas/classical-logic)\n\n[PyPI Page](https://pypi.org/project/classical-logic/)\n\n## Installation\n\nThis package can be installed using Pip:\n\n```bash\npip install classical-logic\n```\n\nPlease make sure you use a dash (-) instead of an underscore (_).\n\n## Bug Reports and Feature Requests\n\nYou can report a bug or suggest a feature on the Github repo.\n\nSee the [Issues page on Github](\nhttps://github.com/ederic-oytas/classical-logic/issues/new/choose).\n\n## Contributions\n\nContributions to this project are welcome. :)\n\nSee the [pull requests page on Github](\nhttps://github.com/ederic-oytas/classical-logic/pulls).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python package for propositional logic.",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/ederic-oytas/classical-logic",
        "Repository": "https://github.com/ederic-oytas/classical-logic"
    },
    "split_keywords": [
        "and",
        "biconditional",
        "conditional",
        "conjunction",
        "connective",
        "disjunction",
        "if and only if",
        "iff",
        "implies",
        "implication",
        "logic",
        "logical connective",
        "negation",
        "not",
        "or",
        "classical logic",
        "proposition",
        "propositional calculus",
        "propositional logic",
        "sentence",
        "sentential calculus",
        "sentential logic",
        "statement logic",
        "zeroth-order logic"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fe0d2a20421b70ee0cbe6fe4ef92286d4e0d0710ee88748237977be74caf7c16",
                "md5": "93706a45ca10526a3179b8de2f002fa2",
                "sha256": "6c955d605d9c28f4db58529e687fc7b5b3f90e9425dd021e8615732dda861335"
            },
            "downloads": -1,
            "filename": "classical_logic-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "93706a45ca10526a3179b8de2f002fa2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 11820,
            "upload_time": "2024-02-14T05:09:36",
            "upload_time_iso_8601": "2024-02-14T05:09:36.406258Z",
            "url": "https://files.pythonhosted.org/packages/fe/0d/2a20421b70ee0cbe6fe4ef92286d4e0d0710ee88748237977be74caf7c16/classical_logic-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "731637cb69021d3ddb263750427f1c0f72d18ef655fdc115d6115e6deaec2a50",
                "md5": "61182abd245c186f895f147aac75dd7c",
                "sha256": "30c751ff2ff8b63a449b86a259da663f5e698b5dfe942d93e920d78799508078"
            },
            "downloads": -1,
            "filename": "classical_logic-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "61182abd245c186f895f147aac75dd7c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 11213,
            "upload_time": "2024-02-14T05:09:38",
            "upload_time_iso_8601": "2024-02-14T05:09:38.004792Z",
            "url": "https://files.pythonhosted.org/packages/73/16/37cb69021d3ddb263750427f1c0f72d18ef655fdc115d6115e6deaec2a50/classical_logic-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-14 05:09:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ederic-oytas",
    "github_project": "classical-logic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "classical-logic"
}
        
Elapsed time: 0.18767s