A small propositional logic package that can form arguments and generate truth tables. Aimed to be used a tool to speed up propositional logic studying for students.
Project description
Propysition Logic Package
propysition is a Python package for propositional logic. It allows you to define propositional variables, build complex logical expressions, form arguments, and generate truth tables. This package is designed to help students and enthusiasts study and analyze propositional logic efficiently.
Features
- Define propositional variables with optional descriptions
- Build logical expressions using AND, OR, NOT, XOR, and IMPLIES
- Form arguments with premises and conclusions
- Generate and display truth tables
- Check argument validity, tautologies, and contradictions
Installation
- Install from PyPI:
pip install propysition
Usage Example
from propysition import Variable, And, Or, Not, Xor, Implies, Argument
a = Variable("A", "It is raining")
b = Variable("B", "I have an umbrella")
expr = And(a, Not(b))
print(expr) # (A ∧ (¬B))
assignment = {a: True, b: False}
print(expr.evaluate(assignment)) # True
premise1 = a | b
premise2 = a & ~b
conclusion = And(a, Not(b))
argument = Argument([premise1, premise2], conclusion)
print(argument)
argument.truth_table()
Documentation
See the docstrings in the code for details on each class and method.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file propysition-0.0.1.tar.gz.
File metadata
- Download URL: propysition-0.0.1.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2194f50e52d1f4e224cf7ca7f2b9577766b3766b37d9c1c021158ce2b51b04b
|
|
| MD5 |
5816bf265ede0f30b286427d497d5763
|
|
| BLAKE2b-256 |
12cc56524e97f1278eb76cda6a55019600fa79bf8823678b0863ed1f049735ad
|
File details
Details for the file propysition-0.0.1-py3-none-any.whl.
File metadata
- Download URL: propysition-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f608db9c088d1d7089197b06c53741b3448413c3e7a84a5d65869a99b74348b
|
|
| MD5 |
8ccda5abcf04b486fdf49e3ecde6bf65
|
|
| BLAKE2b-256 |
5b3a4d72311bb581384633133309873d376c5de36e59b049b7c95cbaf00d7818
|