https://github.com/welopment/unification
Unification Algorithm in Dart.
https://github.com/welopment/unification
algorithm dart flutter flutter-package logic pattern-matching unification
Last synced: 22 days ago
JSON representation
Unification Algorithm in Dart.
- Host: GitHub
- URL: https://github.com/welopment/unification
- Owner: welopment
- License: mit
- Created: 2018-10-04T10:55:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-18T15:41:17.000Z (over 6 years ago)
- Last Synced: 2023-08-20T23:27:38.846Z (over 2 years ago)
- Topics: algorithm, dart, flutter, flutter-package, logic, pattern-matching, unification
- Language: Dart
- Homepage: https://pub.dev/packages/unification
- Size: 6.75 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE
Awesome Lists containing this project
README
Unification
===========
A library providing implementations of first-order logical unification for dart and flutter.
# Getting started
Add the dependency to your pubspec.yaml file:
```yaml
dependencies:
unification: #latest version
```
Add the import statement to your source files:
```dart
import 'package:unification/unification.dart';
```
Or, give it a try and run the example:
```dart
dart ./example/main.dart
```
Modify the example to test more less simple tasks!
# Example:
```dart
import "package:unification/unification.dart";
//
Termtype term1 = Term(Id(1, 1), [
Var(
Id(1, 2),
),
Var(
Id(1, 2),
),
]);
//
Termtype term2 = Term(Id(2, 1), [
Var(
Id(2, 2),
),
Term(Id(2, 3), [
Var(
Id(2, 2),
),
]),
]);
print('Occurs Check: Circularity.');
UnificationR u = UnificationR();
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](https://en.wikipedia.org/wiki/Unification)
about unification in logic on Wikipedia.