Coder Social home page Coder Social logo

ryukinix / lisp-inference Goto Github PK

View Code? Open in Web Editor NEW
39.0 6.0 1.0 126 KB

An Inference Engine based on Propositional Calculus written in Common Lisp

Home Page: https://logic.manoel.dev

License: BSD 3-Clause "New" or "Revised" License

Common Lisp 97.27% Makefile 1.64% Dockerfile 1.09%
inference-engine common-lisp truth-table propositional-logic propositional-calculus inference-rules lisp-inference

lisp-inference's Introduction

Build Status

Lisp Inference

A non-full featured Lisp Inference Engine because I didn't implemented the reductor yet. The algorithm commonly used it's the Wang Algorithm, maybe can you help me?

screenshot

Usage

The main usage for now it's using as a truth-table generator by using its command line interface. You can download the last release and use as showed in the last picture as following:

ros install ryukinix/lisp-inference
~/.roswell/bin/inference

You need ros installed: Roswell

License

BSD

Author

Manoel Vilela

lisp-inference's People

Contributors

ryukinix avatar weslleymberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

cl-kuthirgal

lisp-inference's Issues

Fix problem about namespace issues on the printh-truth-table procedure

Because a problem of namespace operators defined inside of https://github.com/ryukinix/lisp-inference/blob/master/src/operators.lisp are not been catched as normal operators on the eval-operations function used in printh-truth-table. The strategy is to remap all the EXP car symbols to eventual symbols defined inside of :inference package, as defined a util function here:

(defun intern-symbol (s)
"Get a internal symbol reference of S"
(intern (symbol-name s) :lisp-inference))

Related to:

(defun eval-operations (exp-tree)
"Generate all the truth-table cases and evaluated it based on EXP-TREE"
(let ((cases (group-cases-to-propositions exp-tree)))
(labels ((eval-expression (exp case)
(loop for pair in case do
(let ((prop (car pair))
(value (cadr pair)))
(nsubst value prop exp)))
(eval exp)))
(let ((exps (stack-of-expressions exp-tree)))
(loop for case in cases
collect (append case
(loop for exp in exps
collect (list exp
(eval-expression (copy-tree exp)
case)))))))))

The following images are examples of this bug occurying when we set different namespaces by (in-package :inference) or (in-package :cl-user)

image
image
image

Refactor string parser and lexer: mainly for webapp usage

  • It should tokenize tokens first based on operations, supporting concatenated (without whitespaces) exps like this: p^q.
  • It should use a LL(1) parser
  • It should supports parenthesis without any problem
  • It should fail early instead of trying be clever.

Example:

In: "p^q=>r" 
Out: (=> (^ p q) r)

Setup Dockerfile + Travis CI

It should execute properly the unit tests. The ENTRYPOINT for the Dockerfile should be the inference-server running at port 40000.

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.