unification 0.1.15

Unification #

A library providing implementations of first-order logical unification for dart and flutter.

Getting started #

Add the dependency to your pubspec.yaml file:

dependencies:
  unification: #latest version

Add the import statement to your source files:

import 'package:unification/unification.dart';

Or, give it a try and run the example:

dart ./example/main.dart 

Modify the example to test more less simple tasks!

Example: #

  import "package:unification/unification.dart";
  
 
  //
   Termtype<String, Id> term1 = Term(Id(1, 1), [
    Var(
      Id(1, 2),
    ),
    Var(
      Id(1, 2),
    ),
  ]);
  //
  Termtype<String, Id> term2 = Term(Id(2, 1), [
    Var(
      Id(2, 2),
    ),
    Term(Id(2, 3), [
      Var(
        Id(2, 2),
      ),
    ]),
  ]);

  UnificationR<String, Id> u = UnificationR<String, Id>();
  
  var mgu = u.unify(term1, term2, []);
  var unifiedTerm1 = u.subsitute(mgu, term1);
  var unifiedTerm2 = u.subsitute(mgu, term2);
  
  print('mgu      > ' + mgu.toString());
  print('term 1   > ' + unifiedTerm1.toString());
  print('term 2   > ' + unifiedTerm2.toString());

Read more about unification in logic on Wikipedia.

Changelog #

0.1.15 #

  • fix issues discovered by pana

0.1.14 #

  • improve style

0.1.13 #

  • fixed issues discovered by pana

0.1.12 #

  • improve style (omit type annotations for local variables)

0.1.11 #

  • fixed issues discovered by pana
  • Much more documentation

0.1.10 #

  • Remove nullable field "name" in class "Term"

0.1.9 #

  • Fix issues reported by pana

0.1.8 #

  • Introduce type variable for Var and Term
  • Refactor Termtype

0.1.7 #

  • Fix issues reported by pana

0.1.6 #

  • Fix issues related to version 2.4.1 of Dart

0.1.5 #

  • Fix issues related to generics

0.1.4 #

  • Fix minor issues discovered by pana

0.1.3 #

  • Fix issues reported by pana

0.1.2 #

  • Separate term data structures
  • Improve comments and docs

0.1.1 #

  • Fix some minor issues discovered by pana

0.1.0 #

  • Fix dependencies

0.0.2 #

  • Update to use Dart 2.1.0
  • Add Examples

0.0.1 #

  • Publish initial release

example/main.dart

import 'package:unification/unification.dart';

void main() {
  // 1.

  //
  Termtype<String, Id> term1 = Term(Id(1, 1), [
    Var(
      Id(1, 2),
    ),
    Var(
      Id(1, 2),
    ),
  ]);
  //
  Termtype<String, Id> term2 = Term(Id(2, 1), [
    Var(
      Id(2, 2),
    ),
    Term(Id(2, 3), [
      Var(
        Id(2, 2),
      ),
    ]),
  ]);
  print('Occurs Check: Circularity.');
  var u = UnificationR<String, Id>();
  var mgu = u.unify(term1, term2, []);
  var unifiedTerm1 = u.subsitute(mgu, term1);
  var unifiedTerm2 = u.subsitute(mgu, term2);
  print('mgu      > ' + mgu.toString());
  print('term 1   > ' + unifiedTerm1.toString());
  print('term 2   > ' + unifiedTerm2.toString());
}

Use this package as a library

1. Depend on it

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


dependencies:
  unification: ^0.1.15

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]
44
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]
72
Learn more about scoring.

We analyzed this package on Feb 25, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Dependencies

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