Git Product home page Git Product logo

predicatelogictableaux's Introduction

PredicateLogicTableaux

A simple tool to represent predicate logic and assess formulas using tableaux method

Available operator

The basic predicate logic operators (->, <->, v, ^, ~) are available through the following classes :

Implies(), Equivalence(), Or(), And(), Not()

An atom (for example p) can be represented using the following class :

Atom('p')

How to use ?

Let's say you want to find a solution for this set of formulas : p->q, q->r, p->r. First, create the list of formulas :

formulas = [ Implies(Atom('p'), Atom('q')), \
            Implies(Atom('q'), Atom('r')),  \
            Implies(Atom('p'), Atom('r'))   \
            ]

Then create a tree :

# We initialize the tree with the formula
pt = ProofTree(formulas)

And finally derive it and print the solution(s) :

# Derive all node of the tree until the tree is exhausted or a node is open and finished
pt.derive()

# Print the solutions
print('Solution for ex 1 : ' + pt.__str__())

The solution are printed or a message indicate that the tree is exhausted if no solutions were found :

Solution for ex 1 : [¬p, ¬q, ¬p]

or

Tree is exhausted, no solution

TODO

  • Find all solutions (the program only returns maximum 1 solution)

predicatelogictableaux's People

Contributors

mreliptik avatar

Watchers

 avatar  avatar

Forkers

saurav1601

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.