unify 0.1.5 copy "unify: ^0.1.5" to clipboard
unify: ^0.1.5 copied to clipboard

outdated

An implementation of logical unification for dart and flutter based on the algorithm by Ruzicka und Privara.

Unify #

An implementation of Ruzicka und Privara' algorithm of logical unification for dart and flutter.

This algorithm is an optimization of the algorithm by Corbin und Bidoit, which itself is based on Robinsons algorithmus.

Robinsons algorithm is inefficient if subterms are contained in several locations of a term tree, leading to unnecessary calculations. Ruzicka und Privara's algorithm takes the structure of terms into account by using directed acyclic graphs instead of the original term trees to avoid unnecessary calculations.

Ideally, in this reduced DAG all equal subterm are represented Teilterme by one identical subgraph.

Additionally, the occurs check is executed after the actual unification as search for cylces in the resulting DAG.

Getting started #

Add the dependency to your pubspec.yaml file:

dependencies:
  unify: #latest version

Add the import statement to your source files:

 import 'package:unify/unify.dart';

Or, give it a try and run the example:

dart ./example/main.dart 

Modify the example to test more complex tasks!

Example: #

 import 'package:unify/unify.dart';

void main() {
  

  // occurs check positive:

  var term1 = t(1, 1, [
    v(1, 2),
    v(1, 2),
  ]);

  //
  var term2 = t(2, 1, [
    v(2, 2),
    t(2, 3, [
      v(2, 2),
    ]),
  ]);

  //
  print('\nterm1      > ' + term1.toString());
  print('\nterm2      > ' + term2.toString());
  
  bool res = mgu(term1, term2);
  
  print('\nunifiable  > ' + res.toString());
  print('\nterm1      > ' + term1.toString());
  print('\nterm2      > ' + term2.toString());

}
1
likes
0
pub points
0%
popularity

Publisher

verified publisherwelopment.com

An implementation of logical unification for dart and flutter based on the algorithm by Ruzicka und Privara.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

unification

More

Packages that depend on unify