https://github.com/onepointert/libtruth
Basic and general concepts for truth evaluation of algebraic-logic terms
https://github.com/onepointert/libtruth
Last synced: 9 months ago
JSON representation
Basic and general concepts for truth evaluation of algebraic-logic terms
- Host: GitHub
- URL: https://github.com/onepointert/libtruth
- Owner: onepointerT
- License: other
- Created: 2025-06-21T10:56:29.000Z (12 months ago)
- Default Branch: dev
- Last Pushed: 2025-07-01T11:24:53.000Z (12 months ago)
- Last Synced: 2025-07-01T12:29:36.086Z (12 months ago)
- Language: C++
- Homepage:
- Size: 8.51 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### OnePointer C++ LibTruth
##### v0.1.2
###### Basic and general concepts for truth evaluation with C++ from OnePointer UG
This library helps evaluating truth values of algebraic truth terms corresponding to
their real value of coherent variables. Under development.
The documentation can be found in the folder `doc/`.
#### Usage
You may easily create your own logical expressions and evaluate its substantial parts down
until atomic logical terms and algebraic operands consisting of only two variables and and a operator
or even two logical terms and a operator.
```C++
#include
#include
#include
#include
using namespace truth;
BoolExpr expr = "(a && b) >> c";
BoolType* type = new BoolType( expr );
BoolDict* bd = new BoolDict();
(*bd)["a"] = True;
(*bd)["b"] = True;
(*bd)["c"] = False;
BoolValue value = BoolType::evaluate_bool( expr, *bd );
type->results[expr] = value;
```
Also you may inspect terms and their result in shape of a b-tree.
```C++
#include
truth::Tree* btree = Tree::get_new( expr );
btree->eval( *bd );
```
Lastly you may get an evaluation pair for inspection and evaluate it later.
```C++
#include
truth_pair_t& tp = truth::get_new( new AtomicBoolTerm(expr) );
tp.second->set("a", false);
tp.second->set("c", true);
tp.second->set("b", []() { return btree->eval(*bd) } );
truth::eval( tp );
```
* Numeric comparison operators in logical expressions will be implemented
* Interaction for getting the realistic values of bool dicts is under development as well as logging functionality.