Code Monkey home page Code Monkey logo

logic-tool's People

Contributors

duncanc19 avatar

Watchers

 avatar

logic-tool's Issues

Associativity and Distributivity Reverse Rule Bug

The associativity reverse rule works for simple cases, but can go wrong when the nodes to swap are formulae in brackets which contain the same symbols ∧ or ∨ as the ones being checked.
e.g.
associativityRule('((a∨b) ∨ (b∨c)) ∨ (a∨c)')
it should return (a∨b) ∨ ((b∨c) ∨ (a∨c)) but returns a strange tree, because it meets the conditions of the second if condition:
else if (node.value === '∨' && node.children[1].value === '∨')
but to return the correct output it should fail this condition and go on to the 4th else if.

Apply Rule button constraints

You can highlight any part of the tool page to pass through the Apply Rule button, should be restricted to just the current version of the formula.

Node Comparison Not Thorough

For rules when comparing if nodes are the same, the functions currently only compare the values, they need to compare the values of all of the children to check that they are the same.

Formula Input Symbol Position

When you add a symbol with either buttons or keyboard shortcut, it gets added to the end of the input, no matter where in the formula you have selected.

Can't parse false or true from string

The negation rule can be applied and the node will equal false/true, it can be converted back into a string correctly, but you then can't act on that string, e.g.
q∨(p∧¬p) | negation works fine
q∨false
if you try to apply a rule to this formula, it doesn't work(too much recursion error). When converting from string there needs to be a check for true/false.

Highlighting of formula only works when done left to right

Because finding the root node of the selected part of the formula is based on the selection offset, it only matches when the section is highlighted from left to right. Could add in if statement to check whether anchorOffset is more or less than the focusOffset.

Negation rule comparison not of whole nodes, only values

The negation rule currently only checks if the values of the children are the same, not the whole nodes. This means it may apply negation when the parts of the formula are different, e.g.
Negation on (a∧b)∧¬(b∧c) would return 'false' because it only checks the values which are both ∧'s. It shouldn't modify the formula.

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.