Giter Site home page Giter Site logo

truthtables's Introduction

Truth Tables.

Unix truth table generator for propositional logic formulas developed with Haskell.

This program employs syntax analysis algorithms for the propositional logic language, balanced parentheses algorithms for syntax, and propositional logic interpretations for semantics. It is developed using a custom data structure implementation.

Made exclusively for Unix systems.

Prerequisites.

The program makes use of the STACK v2.7.5 or higher packager.

   https://docs.haskellstack.org/en/v2.7.5/README/
  1. Clone the repository.
   git clone https://github.com/richardfm77/truthtables.git
   cd truthtables
  1. Config proyect.
   stack setup
  1. Compile.
   stack build
  1. Run tests.
   stack test

Start program.

   stack exec truthtables-exe

Enter the propositional logic formula you want to know its truth table.

It is important that the input has the following format.

  • Atomic formulas of propositional logic must be alphabetic characters, they can be lowercase or uppercase, except for the 'v' character. For example: p,q,r,s,t,...

  • The propositional logic operators have the following syntax:

    • Not --> Not (exp) where exp is a formula of propositional logic.

    • Or --> Or (exp1) (exp2) where exp1 and exp2 are formulas of propositional logic.

    • And --> And (exp1) (exp2) where exp1 and exp2 are formulas of propositional logic.

    • Implies --> Implies (exp1) (exp2) where exp1 and exp2 are formulas of propositional logic.

    • Equal --> Equal (exp1) (exp2) where exp1 and exp2 are formulas of propositional logic.

Examples of inputs and outputs.

  • Example 1.

    Input: The input is in standard unix input.

     Or p q

    Output: The output is in standard unix output

     ----------------------
     | p | q | ('p'v'q') |
     ------------
     | F | F | F |
     ------------
     | F | T | T |
     ------------
     | T | F | T |
     ------------
     | T | T | T | 
  • Example 2.

    Input: The input is in standard unix input.

     Equal (Implies p q) (Or (Not p) q)

    Output: The output is in standard unix output

     ----------------------------------------------------------
     | p | q | (('p'=>'q')<=>(¬('p')v'q')) |
     ------------
     | F | F | T |
     ------------
     | F | T | T |
     ------------
     | T | F | T |
     ------------
     | T | T | T |
  • Example 3.

    Input: The input is in standard unix input.

     Implies (And (Implies p q) (Implies q r)) (Implies p r)

    Output: The output is in standard unix output

     --------------------------------------------------------------------------------
     | q | p | r | ((('p'=>'q')^('q'=>'r'))=>('p'=>'r')) |
     ----------------
     | F | F | F | T |
     ----------------
     | F | F | T | T |
     ----------------
     | F | T | F | T |
     ----------------
     | F | T | T | T |
     ----------------
     | T | F | F | T |
     ----------------
     | T | F | T | T |
     ----------------
     | T | T | F | T |
     ----------------
     | T | T | T | T |

truthtables's People

Contributors

richardfm77 avatar

Watchers

 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.