/TruthTable

Connective Logic - Generates truth table given a polish notation input formula.

Primary LanguageHaskellBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Truth Table Generator

forthebadge made-with-python

Aline Lima
Hiaggo Bezerra
Leonardo Machado
Computer Science Graduation
Federal Fluminense University
Niteroi, 2020

This project was developed for the discipline of Programming Language from Federal Fluminense University - UFF.

Stack

  • Haskell - Functional programming language
  • Visual Code - MS text editor
  • Stack - build tool
  • Polish Notation
  • Sentential Logic

App

It generates a truth table with subformulas given a formula in polish notation.

If you want to evaluate (a^b)->(a ν ¬c), you'll have to write it as polish notation, which will lead to a formula like this: CKabAaNc

If you want to know how to write a sentential logic formula using Polish Notation, click here!

Example of input: CKabAaNc
Output:

It will give you the symbols, subformulas and whether it's tautology, satisfiable or contradiction.

Installation

This app requires Stack to run.

How to install:

For Windows Environment

$ https://get.haskellstack.org/stable/windows-x86_64-installer.exe
$ Double click and install it

For Linux Environment

$ curl -sSL https://get.haskellstack.org/ | sh

Build and Run

To build the app:

$ cd app
$ stack build

To run the app:

$ cd app
$ stack exec TruthTableGenerator-exe

You can combine both commands in one line:

$ stack build && stack exec TruthTableGenerator-exe

Test Cases

Change "let formula" in app/Main.hs with one of these values below:

  • CNaKbc
  • KNAbcKbc
  • CKabAaNc
  • Ead

OBS

  • CNaKbc is equivalent to (~a -> (b & c))
  • KNAbcKbc is equivalent to ¬(b ν c) Λ (b Λ c)
  • CKabAaNc is equivalent to (a Λ b)-> (a ν ¬c)
  • Ead is equivalent to (a <-> d)

Credits

@machadodev @Hiaggo @Alines009

Balburdia!