An open API service indexing awesome lists of open source software.

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

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.