eyelang 1.1.19 → 1.1.20
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/docs/guide.md +1 -0
- package/examples/graph.pl +35 -0
- package/examples/output/graph.pl +21 -0
- package/package.json +1 -1
- package/playground.html +1 -0
package/docs/guide.md
CHANGED
|
@@ -385,6 +385,7 @@ Each example has a checked golden output in `examples/output`.
|
|
|
385
385
|
| [`gdpr-compliance.pl`](../examples/gdpr-compliance.pl) | Checks GDPR-style processing compliance. | [`output/gdpr-compliance.pl`](../examples/output/gdpr-compliance.pl) |
|
|
386
386
|
| [`good-cobbler.pl`](../examples/good-cobbler.pl) | Demonstrates term-level structure with a good-cobbler statement. | [`output/good-cobbler.pl`](../examples/output/good-cobbler.pl) |
|
|
387
387
|
| [`gps.pl`](../examples/gps.pl) | Finds and verifies route paths. | [`output/gps.pl`](../examples/output/gps.pl) |
|
|
388
|
+
| [`graph.pl`](../examples/graph.pl) | Derives transitive paths over French-city road links while showing the productive recursive rule order. | [`output/graph.pl`](../examples/output/graph.pl) |
|
|
388
389
|
| [`graph-reachability.pl`](../examples/graph-reachability.pl) | Derives reachable nodes in a graph. | [`output/graph-reachability.pl`](../examples/output/graph-reachability.pl) |
|
|
389
390
|
| [`gray-code-counter.pl`](../examples/gray-code-counter.pl) | Generates Gray-code counter states. | [`output/gray-code-counter.pl`](../examples/output/gray-code-counter.pl) |
|
|
390
391
|
| [`greatest-lower-bound-uniqueness.pl`](../examples/greatest-lower-bound-uniqueness.pl) | Shows uniqueness of greatest lower bounds in a finite order instance. | [`output/greatest-lower-bound-uniqueness.pl`](../examples/output/greatest-lower-bound-uniqueness.pl) |
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
% Transitive graph paths over a small map of French cities.
|
|
2
|
+
%
|
|
3
|
+
% The base relation is directed: oneway(A, B) means there is a road from A
|
|
4
|
+
% to B. The derived relation path(A, B) is the transitive closure: B is
|
|
5
|
+
% reachable from A by one or more directed legs.
|
|
6
|
+
%
|
|
7
|
+
% The recursive rule is written in a productive, right-recursive form:
|
|
8
|
+
%
|
|
9
|
+
% path(A, C) :- oneway(A, B), path(B, C).
|
|
10
|
+
%
|
|
11
|
+
% That order matters in a goal-directed reasoner. A left-recursive closure
|
|
12
|
+
% rule such as `path(A, C) :- path(A, B), path(B, C).` starts by asking for
|
|
13
|
+
% the same open relation it is currently proving, so eyelang's recursion guard
|
|
14
|
+
% must stop it to avoid an infinite loop. The result is under-generation: only
|
|
15
|
+
% direct edges are printed. Starting with the concrete generator `oneway/2`
|
|
16
|
+
% first makes each recursive step smaller and yields the complete closure.
|
|
17
|
+
|
|
18
|
+
materialize(path, 2).
|
|
19
|
+
|
|
20
|
+
oneway(paris, orleans).
|
|
21
|
+
oneway(paris, chartres).
|
|
22
|
+
oneway(paris, amiens).
|
|
23
|
+
oneway(orleans, blois).
|
|
24
|
+
oneway(orleans, bourges).
|
|
25
|
+
oneway(blois, tours).
|
|
26
|
+
oneway(chartres, lemans).
|
|
27
|
+
oneway(lemans, angers).
|
|
28
|
+
oneway(lemans, tours).
|
|
29
|
+
oneway(angers, nantes).
|
|
30
|
+
|
|
31
|
+
path(A, B) :-
|
|
32
|
+
oneway(A, B).
|
|
33
|
+
path(A, C) :-
|
|
34
|
+
oneway(A, B),
|
|
35
|
+
path(B, C).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
path(paris, orleans).
|
|
2
|
+
path(paris, chartres).
|
|
3
|
+
path(paris, amiens).
|
|
4
|
+
path(orleans, blois).
|
|
5
|
+
path(orleans, bourges).
|
|
6
|
+
path(blois, tours).
|
|
7
|
+
path(chartres, lemans).
|
|
8
|
+
path(lemans, angers).
|
|
9
|
+
path(lemans, tours).
|
|
10
|
+
path(angers, nantes).
|
|
11
|
+
path(paris, blois).
|
|
12
|
+
path(paris, bourges).
|
|
13
|
+
path(paris, tours).
|
|
14
|
+
path(paris, lemans).
|
|
15
|
+
path(paris, angers).
|
|
16
|
+
path(paris, nantes).
|
|
17
|
+
path(orleans, tours).
|
|
18
|
+
path(chartres, angers).
|
|
19
|
+
path(chartres, tours).
|
|
20
|
+
path(chartres, nantes).
|
|
21
|
+
path(lemans, nantes).
|
package/package.json
CHANGED