Giter Club home page Giter Club logo

lrs's Introduction

Logical Resolution Solver

Build Status Build status Coverage Status Crates.io Version Docs.rs Waffle.io - Columns and their card count

Still early in development. Might break at any time for no reason. And all functionality not guaranteed. Have patience :)

What is this?

This is a crate that allows you to quickly (eh...more or less) solve logical equations (clauses) in conjunctive normal form for solvability.

This README is a stub for the repo for now. There are two crates here: the library which does all the heavy lifting and a cli tool which can be used to quickly resolve clauses in the terminal.

If you want to learn more about this check out the excellent wikipedia article

lrs's People

Contributors

spacekookie avatar

Watchers

 avatar  avatar

lrs's Issues

Implement "search_reduce_candidates" function

This function is essentially a dry-run of the reduce function. It needs some of the functions described in #8 to work properly (and not be too bloated) and returns a set of possible actions, ordered by their appeal.

Then either the user (or an engulfing algorithm can pick whichever it thinks is best and execute it

Restructure struct layouts

Terms and Clauses are kinda the same thing just with different operators. So they should share some code. Could use an enum or a common "Logic" type or something like that

Implement Term formatting

It should be possible to call println!("{:?}", my_term) and actually get the (example) output: { A, ¬B, C }. Should probably look into how to do that 😅

Implement "reduce_single_operation" function

Coming out of #9 is a set of possible operations on a clause which are ordered in their appeal to an algorithm (or certain parameters maybe). After this the API needs a function to take one of these operation structs and execute the reduction on a clause

Make merge-reduce unit tests work

That can be done in two ways (one simple, one not so simple)

  1. Making some assumptions and counting state, analysing the clause often before making a move
  2. Implement a trial system and backtracking in case a branch didn't work out

Regardless of what is chosen, there are some things that need to be implemented nonetheless

  • Instead of calling reduce there needs to be a consider_reduce_choices function which returns a set of terms that can be acted on, saying what operation can be performed
  • The reduce function then needs to build priorities according to the resolution rules
  • Record every action taken in the clause history (implement a queue?)
  • Add a results struct into the clause that can be slowly filled with data as it trickles in

Derivations are simple and can immediately lead to a field in the result struct.

Merges are a bit more complicated because they might need to be performed in a specific order { A, B }, { !A, D }, { A, B! } for example.

To be continued

Support first order logic

Something to think about when redesigning some of the internal structures talked about in #4... 🤷‍♀️

Support "fuzzy" results

Sometimes a clause is solvable but it's result isn't one set of interpretations for it's set of symbols. Therefore lrs needs to be able to handle "fuzzy" (what is the technically correct term for this?) results.

The clause { A, B } has the results:

A B
1 1
1 0
0 1

This can either be done by

  • Letting the final resolve function return a list of possible interpretations
  • Changing the "LResult" struct (Should this be named Interpretation instead?) to handle these fuzzy-cases

Implement more utility functions

lrs can do a few things already but especially terms need more awareness of what's inside them. So there need to be a few utility functions that handle this. They don't need to be super fast (at least not for now) but need to provide easily callable functionality.

  • Find offending terms in a term ({ A, ¬A } which will start a branch reduce run)
  • Count occurrences of symbols in a clause ({ A, ¬B }, { A, C } should result in A: 2, ¬B: 1, C: 1)
  • Recognise "fuzzy results" ( { A, B } works with A=1, B=1 and A=1, B=0 and A=0, B=1 See #10)

Write unit tests

The lrs crate is still pretty simple but there are already some stuff we can unit test

  • Create terms with symbols
  • Join terms together
  • Remove symbols from terms

When feature complete we can also test complete clause resolutions

Implement normal_form transforms

It should be possible to give lrs any (propositional – let's talk about first order later) logical clause that it can then transform to CNF, DNF and NNF as the user requests or an algorithm sees fit.

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.