spacekookie / lrs Goto Github PK
View Code? Open in Web Editor NEWA library crate for resolving logical clauses in conjuctive normal form
Home Page: https://crates.io/crates/lrs
License: MIT License
A library crate for resolving logical clauses in conjuctive normal form
Home Page: https://crates.io/crates/lrs
License: MIT License
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
Interpretation
instead?) to handle these fuzzy-casesThe lrs
crate is still pretty simple but there are already some stuff we can unit test
When feature complete we can also test complete clause resolutions
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 😅
Instead of assuming CNF we should be able to take any logical equation and transform it into a normal_form
of the users liking
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
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
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.
{ A, ¬A }
which will start a branch reduce run){ A, ¬B }, { A, C }
should result in A: 2, ¬B: 1, C: 1
){ A, B }
works with A=1, B=1
and A=1, B=0
and A=0, B=1
See #10)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.
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
Something to think about when redesigning some of the internal structures talked about in #4... 🤷♀️
That can be done in two ways (one simple, one not so simple)
Regardless of what is chosen, there are some things that need to be implemented nonetheless
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 performedreduce
function then needs to build priorities according to the resolution rulesDerivations 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
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.