duncanc19 / logic-tool Goto Github PK
View Code? Open in Web Editor NEWSemantic Equivalence Logic Tool
Semantic Equivalence Logic Tool
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.
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.
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.
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.
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.
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.
e.g. Absorption on A∧(A∨B) should return A, console logging the changed tree shows just a node with A but on the screen the area is blank.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.