eyelang 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -362,6 +362,7 @@ The repository includes examples for recursion, graph reachability, finite searc
362
362
  | [`delfour.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/delfour.pl) | Derives shopping and authorization recommendations. | [`output/delfour.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/delfour.pl) |
363
363
  | [`dense-hamiltonian-cycle.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/dense-hamiltonian-cycle.pl) | Searches a dense Hamiltonian cycle with aggregate minimization. | [`output/dense-hamiltonian-cycle.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/dense-hamiltonian-cycle.pl) |
364
364
  | [`deontic-logic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/deontic-logic.pl) | Reports obligations, prohibitions, and violations. | [`output/deontic-logic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/deontic-logic.pl) |
365
+ | [`derived-backward-rule.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/derived-backward-rule.pl) | Derives an inverse-property backward rule from rule data. | [`output/derived-backward-rule.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/derived-backward-rule.pl) |
365
366
  | [`derived-rule.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/derived-rule.pl) | Derives conclusions from rule data. | [`output/derived-rule.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/derived-rule.pl) |
366
367
  | [`diamond-property.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/diamond-property.pl) | Checks the diamond property of a relation. | [`output/diamond-property.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/diamond-property.pl) |
367
368
  | [`dijkstra-findall-sort.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/dijkstra-findall-sort.pl) | Finds shortest paths using collected candidates. | [`output/dijkstra-findall-sort.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/dijkstra-findall-sort.pl) |
@@ -0,0 +1,27 @@
1
+ % Derived backward rule example adapted from Eyeling derived-backward-rule.n3.
2
+ %
3
+ % Eyeling source shape:
4
+ % parentOf invOf childOf.
5
+ % alice parentOf bob.
6
+ % { ?p invOf ?q. } => { { ?x ?q ?y. } <= { ?y ?p ?x. }. }.
7
+ % { ?x childOf ?y. } => { ?x hasParent ?y. }.
8
+ %
9
+ % The generated backward rule is represented as quoted formula data in
10
+ % log_impliedBy/2, then mirrored as an ordinary eyelang rule so the generated
11
+ % childOf relation can feed the ordinary hasParent rule.
12
+
13
+ materialize(log_impliedBy, 2).
14
+ materialize(childOf, 2).
15
+ materialize(hasParent, 2).
16
+
17
+ invOf(parentOf, childOf).
18
+ parentOf(alice, bob).
19
+
20
+ log_impliedBy(childOf(var(x), var(y)), parentOf(var(y), var(x))) :-
21
+ invOf(parentOf, childOf).
22
+
23
+ childOf(X, Y) :-
24
+ log_impliedBy(childOf(var(x), var(y)), parentOf(var(y), var(x))),
25
+ parentOf(Y, X).
26
+
27
+ hasParent(X, Y) :- childOf(X, Y).
@@ -0,0 +1,3 @@
1
+ log_impliedBy(childOf(var(x), var(y)), parentOf(var(y), var(x))).
2
+ childOf(bob, alice).
3
+ hasParent(bob, alice).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyelang",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "type": "module",
5
5
  "description": "A small rule engine for Prolog-style Horn clauses",
6
6
  "keywords": [
package/playground.html CHANGED
@@ -466,6 +466,7 @@
466
466
  "delfour",
467
467
  "dense-hamiltonian-cycle",
468
468
  "deontic-logic",
469
+ "derived-backward-rule",
469
470
  "derived-rule",
470
471
  "diamond-property",
471
472
  "dijkstra",