unification 0.1.8

unification #

This project is an implementation of logical first-order unification.

A first-order unification procedure unify is given by this library. It can be applied on two terms of type Termtype that are also given by the library.

The solution of a unification problem is a substitution, that is, a mapping assigning a symbolic value to each variable of the problem's expressions.

The unification procedure reports unsolvability for a given problem or computes the complete and minimal substitution set containing the most general unifier. This is a set covering all solutions containing no redundant members.

Example: #

import "package:tailcalls/tailcalls.dart";
import "package:unification/unification.dart";

var test = unify(
      new List()
        ..add(
          new Tupl(
            new Term("b0", [new Term("b1", []),new Term("b2", [])]),
            new Term("b0", [new Term("b1", []),new Term("b2", [])]),
          ),
        ),
    ).result();
var mgu = test;
print(mgu.toString());

Read more about unification in logic on Wikipedia.

Changelog #

0.0.1 #

  • Initial release.

0.0.2 #

  • Updated to use Dart 2.1.0
  • Added Examples

0.1.0 #

  • Fixed dependencies.

0.1.1 #

  • Fixed some minor issues discovered by pana.

0.1.2 #

  • term data structures into separate file.
  • improved comments and docs.

0.1.3 #

  • Fixed minor issues discovered by pana.

0.1.4 #

  • Fixed minor issues discovered by pana.

0.1.5 #

  • Fixed issues related to generics.

0.1.6 #

  • Fixed issues related to version 2.4.1 of Dart.

0.1.7 #

  • Fixed issues reported by pana.

0.1.8 #

  • Introduced split type variable for Var and Term.
  • Refactored Termtype.

example/main.dart

import 'package:unification/src/terms.dart';
import 'package:unification/unification.dart';
import 'dart:collection';

void main() {
  Unification<String, String> u = new Unification<String, String>();

  var res1 = u.unify(
    List<Tupl<Var<String, String>, Var<String, String>>>()
      ..add(
        new Tupl<Var<String, String>, Var<String, String>>(
          new Var("a"),
          new Var("a"),
        ),
      ),
  );

  List<Tupl<String, Termtype<String, String>>> res2 = u.unify(
    List<Tupl<Var<String, String>, Var<String, String>>>()
      ..add(
        new Tupl(
          new Var<String, String>("a"),
          new Var<String, String>("b"),
        ),
      ),
  );
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  unification: ^0.1.8

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:unification/unification.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Sep 19, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:unification/unification.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <3.0.0
tailcalls ^0.1.3 0.1.3
Dev dependencies
pedantic ^1.0.0
test 1.6.3