What is pyTruthTable?
pyTruthTable is a python library to create logical tables and make relations between its elements. It makes possible prepositional logic clauses analysis and binary operations to be used in classic logical problems.
Features:
- Uses Pandas Dataframe.
- Big set of logic operations.
- Simplified function calls.
- Automatic column naming.
- Customizible appearence.
Installation
Requirements: Python 3 and Pandas.
Install with Pypi:
pip3 install pyTruthTable
Take a look:
Example 1 - Binary operations
import pyTruthTable as ptt
# Initialize
t_table = ptt.PyTruthTable(["A", "B"])
# Create relations
t_table.append("not", "A")
t_table.append("and", "A", "B")
t_table.append("or", 2, "B") # Use the column index or name
t_table.append("xor", -2, -1)
t_table.append("nand", -1, 0, name = "C") # Rename column
t_table.append("equals", "C", "A")
| A | B | ¬ A | A ^ B | ¬ A v B | (A ^ B) ⊕ (¬ A v B) | C | C ↔ A |
|---|---|---|---|---|---|---|---|
| True | True | False | True | True | False | True | True |
| True | False | False | False | False | False | True | True |
| False | True | True | False | True | True | True | False |
| False | False | True | False | True | True | True | False |
Example 2 - Prepositional logic clauses
import pyTruthTable as ptt
# Initialize
tt = ptt.PyTruthTable(["Hot", "Wet", "Rains"])
# Append new column with specified operation
tt.append("and", "Hot", "Wet")
tt.append("implies", 3, "Rains")
| Hot | Wet | Rains | Hot ^ Wet | (Hot ^ Wet) → (Rains) |
|---|---|---|---|---|
| True | True | True | True | True |
| True | True | False | True | False |
| True | False | True | False | True |
| True | False | False | False | True |
| False | True | True | False | True |
| False | True | False | False | True |
| False | False | True | False | True |
| False | False | False | False | True |
See more examples here
Documentation & other links
- The amazing documentation is this Ṕage.
- Source code in the Github repository.
- Pypi pakage installer
License
Contributing is awesome!
See CONTRIBUTING
Contact
Developed with ❤️ by Leonardo Mariga
Did you like it? Remember to click on 🌟 button.
Metadata
Release files for pyTruthTable 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyTruthTable-0.0.2.tar.gz | 5.6 kB | Without provenance | Details for pyTruthTable-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyTruthTable-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for pyTruthTable-0.0.2-py3-none-any.whl |
Total release size: 12.2 kB
Release files / pyTruthTable-0.0.2.tar.gz
| Download URL | pyTruthTable-0.0.2.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef2d17a31c1f4a37346ecfee6830494c6659c8a257d13d94eeb26fc14f3df011
|
|
BLAKE2b-256 checksum How to use checksums |
d60b115d2d32fa04905f6c86204ba47f1e0b936b9e5abb93386a518a37a59ca7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/2.7.17
|
Release files / pyTruthTable-0.0.2-py3-none-any.whl
| Download URL | pyTruthTable-0.0.2-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3aa4bc418e607ffc0107eaac6cee851e86880387876a49f31c82333f513d8a32
|
|
BLAKE2b-256 checksum How to use checksums |
4a64648314b957b59d25883c829b9900045a30e8cbaaa6949eea34975fdd06f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/2.7.17
|
Security for pyTruthTable 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.