Metadata-Version: 2.1
Name: classical-logic
Version: 0.1.1
Summary: Python package for propositional logic.
Home-page: https://github.com/ederic-oytas/classical-logic
License: MIT
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
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Typing :: Typed
Project-URL: Repository, https://github.com/ederic-oytas/classical-logic
Description-Content-Type: text/markdown


# 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).

