Giter VIP home page Giter VIP logo

pytruthtable's Introduction



PyPI Latest Release License

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

License

MIT

Contributing is awesome!

See CONTRIBUTING

Contact

Developed with ❤️ by Leonardo Mariga

[email protected]

Did you like it? Remember to click on 🌟 button.

pytruthtable's People

Contributors

leomariga avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.