eyeprolog 0.6.0 → 1.0.1
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 +5 -18
- package/book-assets/example-landscape.svg +3 -3
- package/book-assets/laboratory-progression.svg +1 -1
- package/book-assets/title-page.svg +62 -212
- package/examples/basic-monadic.pl +1 -1
- package/examples/book/README.md +45 -28
- package/examples/book/chapter-01/02-child.pl +1 -3
- package/examples/book/chapter-02/01-same_shape.pl +2 -0
- package/examples/book/chapter-04/01-ancestor.pl +3 -0
- package/examples/book/chapter-10/01-color.pl +14 -0
- package/examples/book/chapter-21/01-parent.pl +7 -0
- package/examples/book/chapter-22/04-sentence.pl +19 -0
- package/examples/book/chapter-24/01-worker.pl +17 -0
- package/examples/book/chapter-25/04-permit.pl +9 -0
- package/examples/book/chapter-26/02-triple.pl +9 -2
- package/examples/book/chapter-26/03-triple-2.pl +2 -0
- package/examples/book/chapter-28/04-integer_rectangle.pl +5 -0
- package/examples/book/chapter-29/01-counterexample_to_odd_square.pl +7 -0
- package/examples/book/chapter-31/01-edge.pl +6 -0
- package/examples/book/chapter-31/02-program.pl +6 -0
- package/examples/book/chapter-31/03-double.pl +13 -0
- package/examples/book/chapter-32/03-candidate_debug.pl +7 -0
- package/examples/book/chapter-32/04-reference_square.pl +12 -0
- package/examples/book/chapter-39/01-answer.pl +5 -0
- package/examples/book/chapter-39/02-answer-2.pl +6 -0
- package/examples/book/chapter-39/03-answer-3.pl +10 -0
- package/examples/book/chapter-39/04-cost.pl +10 -0
- package/examples/book/chapter-39/05-message.pl +16 -0
- package/index.d.ts +3 -0
- package/package.json +1 -4
- package/playground.html +0 -16
- package/test/conformance/ISO-MATRIX.md +1 -1
- package/test/conformance/README.md +3 -3
- package/test/run-all.mjs +0 -2
- package/test/run-examples.mjs +0 -11
- package/test/run-regression.mjs +23 -0
- package/the-art-of-eyeprolog.md +188 -238
- package/why-eyeprolog.md +53 -264
- package/book-assets/rdf-adapter-pipeline.svg +0 -14
- package/book-assets/sockets-providers.svg +0 -21
- package/examples/book/chapter-15/01-rdf.pl +0 -3
- package/examples/book/chapter-16/01-socket.pl +0 -9
- package/examples/book/chapter-16/02-socket-2.pl +0 -5
- package/examples/dpv-odrl-purpose-mapping.pl +0 -94
- package/examples/input/dpv-odrl-purpose-mapping-rules.pl +0 -63
- package/examples/input/dpv-odrl-purpose-mapping.ttl +0 -34
- package/examples/input/odrl-dpv-fpv-trust-flow-rules.pl +0 -74
- package/examples/input/odrl-dpv-fpv-trust-flow.ttl +0 -38
- package/examples/input/odrl-dpv-healthcare-risk-ranked-rules.pl +0 -109
- package/examples/input/odrl-dpv-healthcare-risk-ranked.ttl +0 -45
- package/examples/input/odrl-dpv-risk-ranked-rules.pl +0 -121
- package/examples/input/odrl-dpv-risk-ranked.ttl +0 -59
- package/examples/input/odrl-policy-advanced-rules.pl +0 -90
- package/examples/input/odrl-policy-advanced.ttl +0 -26
- package/examples/input/odrl-policy-rules.pl +0 -50
- package/examples/input/odrl-policy.ttl +0 -10
- package/examples/input/rdf12-annotated-claims-rules.pl +0 -96
- package/examples/input/rdf12-annotated-claims.ttl +0 -19
- package/examples/input/rdf12-annotation-rules.pl +0 -23
- package/examples/input/rdf12-annotation.ttl +0 -10
- package/examples/input/rdf12-directional-language-rules.pl +0 -5
- package/examples/input/rdf12-directional-language.ttl +0 -6
- package/examples/input/rdf12-nested-triple-term-rules.pl +0 -13
- package/examples/input/rdf12-nested-triple-term.ttl +0 -7
- package/examples/input/rdf12-trig-graph-join-rules.pl +0 -15
- package/examples/input/rdf12-trig-graph-join.trig +0 -9
- package/examples/input/rdf12-trig-named-graph-rules.pl +0 -8
- package/examples/input/rdf12-trig-named-graph.trig +0 -8
- package/examples/input/rdf12-trig-triple-term-rules.pl +0 -9
- package/examples/input/rdf12-trig-triple-term.trig +0 -7
- package/examples/input/rdf12-triple-term-rules.pl +0 -9
- package/examples/input/rdf12-triple-term.ttl +0 -5
- package/examples/odrl-dpv-fpv-trust-flow.pl +0 -109
- package/examples/odrl-dpv-healthcare-risk-ranked.pl +0 -150
- package/examples/odrl-dpv-risk-ranked.pl +0 -174
- package/examples/odrl-policy-advanced-from-turtle.pl +0 -114
- package/examples/odrl-policy-from-turtle.pl +0 -63
- package/examples/output/dpv-odrl-purpose-mapping.pl +0 -1
- package/examples/output/odrl-dpv-fpv-trust-flow.pl +0 -1
- package/examples/output/odrl-dpv-healthcare-risk-ranked.pl +0 -1
- package/examples/output/odrl-dpv-risk-ranked.pl +0 -1
- package/examples/output/odrl-policy-advanced-from-turtle.pl +0 -1
- package/examples/output/odrl-policy-from-turtle.pl +0 -1
- package/examples/output/rdf12-annotated-claims.pl +0 -1
- package/examples/output/rdf12-annotation.pl +0 -1
- package/examples/output/rdf12-directional-language.pl +0 -2
- package/examples/output/rdf12-nested-triple-term.pl +0 -1
- package/examples/output/rdf12-trig-graph-join.pl +0 -1
- package/examples/output/rdf12-trig-named-graph.pl +0 -3
- package/examples/output/rdf12-trig-triple-term.pl +0 -1
- package/examples/output/rdf12-triple-term.pl +0 -1
- package/examples/output/socket-age.pl +0 -1
- package/examples/output/socket-family.pl +0 -3
- package/examples/proof/dpv-odrl-purpose-mapping.pl +0 -16
- package/examples/proof/odrl-policy-from-turtle.pl +0 -40
- package/examples/proof/rdf12-annotation.pl +0 -28
- package/examples/proof/rdf12-directional-language.pl +0 -32
- package/examples/proof/rdf12-nested-triple-term.pl +0 -16
- package/examples/proof/rdf12-trig-graph-join.pl +0 -20
- package/examples/proof/rdf12-trig-named-graph.pl +0 -52
- package/examples/proof/rdf12-trig-triple-term.pl +0 -16
- package/examples/proof/rdf12-triple-term.pl +0 -16
- package/examples/proof/socket-age.pl +0 -32
- package/examples/proof/socket-family.pl +0 -59
- package/examples/rdf12-annotated-claims.pl +0 -112
- package/examples/rdf12-annotation.pl +0 -33
- package/examples/rdf12-directional-language.pl +0 -13
- package/examples/rdf12-nested-triple-term.pl +0 -20
- package/examples/rdf12-trig-graph-join.pl +0 -23
- package/examples/rdf12-trig-named-graph.pl +0 -16
- package/examples/rdf12-trig-triple-term.pl +0 -16
- package/examples/rdf12-triple-term.pl +0 -16
- package/examples/socket-age.pl +0 -40
- package/examples/socket-family.pl +0 -29
- package/test/run-rdf-tools.mjs +0 -74
- package/tools/README.md +0 -31
- package/tools/pl-to-rdf.mjs +0 -29
- package/tools/rdf-codec.mjs +0 -242
- package/tools/rdf-input.mjs +0 -30
- package/tools/rdf-to-pl.mjs +0 -53
- /package/examples/book/chapter-02/{01-measurement.pl → 02-measurement.pl} +0 -0
- /package/examples/book/chapter-02/{02-label.pl → 03-label.pl} +0 -0
- /package/examples/book/chapter-04/{01-path.pl → 02-path.pl} +0 -0
- /package/examples/book/chapter-10/{01-plan.pl → 02-plan.pl} +0 -0
- /package/examples/book/chapter-21/{01-grandparent.pl → 02-grandparent.pl} +0 -0
- /package/examples/book/chapter-21/{02-loop_edge.pl → 03-loop_edge.pl} +0 -0
- /package/examples/book/chapter-21/{03-eligible.pl → 04-eligible.pl} +0 -0
- /package/examples/book/chapter-21/{04-grows.pl → 05-grows.pl} +0 -0
- /package/examples/book/chapter-22/{04-evaluate.pl → 05-evaluate.pl} +0 -0
- /package/examples/book/chapter-22/{05-lookup.pl → 06-lookup.pl} +0 -0
- /package/examples/book/chapter-22/{06-simplify.pl → 07-simplify.pl} +0 -0
- /package/examples/book/chapter-24/{01-simple_path.pl → 02-simple_path.pl} +0 -0
- /package/examples/book/chapter-24/{02-reachable.pl → 03-reachable.pl} +0 -0
- /package/examples/book/chapter-24/{03-best_plan.pl → 04-best_plan.pl} +0 -0
- /package/examples/book/chapter-25/{04-incompatible_status.pl → 05-incompatible_status.pl} +0 -0
- /package/examples/book/chapter-26/{03-edge.pl → 04-edge.pl} +0 -0
- /package/examples/book/chapter-28/{04-preserves_combine.pl → 05-preserves_combine.pl} +0 -0
- /package/examples/book/chapter-29/{01-noncommuting_pair.pl → 02-noncommuting_pair.pl} +0 -0
package/README.md
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/eyeprolog)
|
|
4
4
|
[](https://doi.org/10.5281/zenodo.21446308)
|
|
5
5
|
|
|
6
|
-
EyeProlog
|
|
6
|
+
EyeProlog turns portable ISO Prolog programs into answers and inspectable proofs.
|
|
7
7
|
|
|
8
8
|
**[Book — *The Art of EyeProlog*](https://eyereasoner.github.io/eyeprolog/the-art-of-eyeprolog)** ·
|
|
9
9
|
**[Why EyeProlog?](https://eyereasoner.github.io/eyeprolog/why-eyeprolog)** ·
|
|
10
10
|
**[Playground](https://eyereasoner.github.io/eyeprolog/playground)**
|
|
11
11
|
|
|
12
12
|
The book is the reference for the language, command line, JavaScript API,
|
|
13
|
-
|
|
13
|
+
examples, proofs, conformance, and implementation.
|
|
14
14
|
|
|
15
15
|
## Quick start
|
|
16
16
|
|
|
@@ -18,9 +18,8 @@ EyeProlog requires Node.js 18 or newer.
|
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
20
|
npm install --global eyeprolog
|
|
21
|
-
|
|
22
|
-
eyeprolog --proof
|
|
23
|
-
eyeprolog --goal 'type(socrates, mortal)' examples/socrates.pl
|
|
21
|
+
printf 'human(socrates).\nmortal(X) :- human(X).\n' |
|
|
22
|
+
eyeprolog --proof --goal 'mortal(socrates)' -
|
|
24
23
|
```
|
|
25
24
|
|
|
26
25
|
Programs may declare their default queries with `%% goal:` comments.
|
|
@@ -34,19 +33,7 @@ EyeProlog adds 44 public library predicates to its 127-entry ISO core registry.
|
|
|
34
33
|
`src/eyeprolog-common-library.pl`; both are autoloaded in Node and the
|
|
35
34
|
browser. None requires host support. Other Prolog systems should load only
|
|
36
35
|
`eyeprolog-library.pl`, which avoids redefining their common list predicates.
|
|
37
|
-
Portable text predicates use ISO atoms or character lists
|
|
38
|
-
RDF tools emit lexical values as ISO atoms as well.
|
|
39
|
-
|
|
40
|
-
## RDF 1.2
|
|
41
|
-
|
|
42
|
-
```sh
|
|
43
|
-
node tools/rdf-to-pl.mjs --rules rules.pl data.ttl -o program.pl
|
|
44
|
-
eyeprolog program.pl > derived.pl
|
|
45
|
-
node tools/pl-to-rdf.mjs derived.pl -o derived.nq
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
See the book for RDF mappings, graphs, triple terms, reifiers, annotations,
|
|
49
|
-
formats, and policy examples.
|
|
36
|
+
Portable text predicates use ISO atoms or character lists.
|
|
50
37
|
|
|
51
38
|
## Development
|
|
52
39
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<svg xmlns="http://www.w3.org/2000/svg" width="900" height="500" viewBox="0 0 900 500" role="img" aria-labelledby="title desc">
|
|
2
2
|
<title id="title">The executable example landscape</title>
|
|
3
|
-
<desc id="desc">A map connects a central EyeProlog program to mathematics, search, planning, policy, science, program analysis, symbolic systems,
|
|
3
|
+
<desc id="desc">A map connects a central EyeProlog program to mathematics, search, planning, policy, science, program analysis, and symbolic systems, with paths to answers and proofs.</desc>
|
|
4
4
|
<defs>
|
|
5
5
|
<style>
|
|
6
6
|
.bg{fill:#FFF9E8}.region{stroke:#17324D;stroke-width:2}.core{fill:#17324D;stroke:#102A3A;stroke-width:3}
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
<text class="small" x="145" y="374" text-anchor="middle">integrity · audit</text>
|
|
29
29
|
|
|
30
30
|
<path class="region" fill="#BFEAF1" d="M655 280H865V440H630L600 345Z"/>
|
|
31
|
-
<text class="label" x="755" y="326" text-anchor="middle">SCIENCE &
|
|
31
|
+
<text class="label" x="755" y="326" text-anchor="middle">SCIENCE & MODELS</text>
|
|
32
32
|
<text class="small" x="755" y="353" text-anchor="middle">models · measurements</text>
|
|
33
|
-
<text class="small" x="755" y="374" text-anchor="middle">
|
|
33
|
+
<text class="small" x="755" y="374" text-anchor="middle">equations · evidence</text>
|
|
34
34
|
|
|
35
35
|
<path class="link" d="M270 145L355 205M630 145L545 205M270 355L355 295M630 355L545 295"/>
|
|
36
36
|
<rect class="core" x="335" y="175" width="230" height="150" rx="18"/>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<rect class="stage s4" x="540" y="105" width="160" height="235" rx="16"/>
|
|
34
34
|
<text class="number" x="620" y="143" text-anchor="middle">8–11</text>
|
|
35
35
|
<text class="label" x="620" y="176" text-anchor="middle">DOMAINS</text>
|
|
36
|
-
<text class="small" x="620" y="207" text-anchor="middle">analysis · policy</text><text class="small" x="620" y="229" text-anchor="middle">science ·
|
|
36
|
+
<text class="small" x="620" y="207" text-anchor="middle">analysis · policy</text><text class="small" x="620" y="229" text-anchor="middle">science · models</text>
|
|
37
37
|
<text class="small" x="620" y="290" text-anchor="middle">preserve evidence</text><text class="small" x="620" y="313" text-anchor="middle">and boundaries</text>
|
|
38
38
|
|
|
39
39
|
<rect class="stage s5" x="720" y="85" width="150" height="275" rx="18"/>
|
|
@@ -2,223 +2,73 @@
|
|
|
2
2
|
width="1000" height="1450" viewBox="0 0 1000 1450"
|
|
3
3
|
role="img" aria-labelledby="title desc">
|
|
4
4
|
<title id="title">The Art of EyeProlog</title>
|
|
5
|
-
<desc id="desc">
|
|
5
|
+
<desc id="desc">Minimal book title page with a vector rendering of the EYE logo, the book title, subtitle, and author.</desc>
|
|
6
6
|
|
|
7
7
|
<defs>
|
|
8
|
-
<linearGradient id="
|
|
9
|
-
<stop offset="0
|
|
10
|
-
<stop offset="
|
|
8
|
+
<linearGradient id="eye-spectrum" x1="20" y1="4" x2="48" y2="65" gradientUnits="userSpaceOnUse">
|
|
9
|
+
<stop offset="0" stop-color="#ff2738"/>
|
|
10
|
+
<stop offset="0.28" stop-color="#ff6b25"/>
|
|
11
|
+
<stop offset="0.47" stop-color="#fff23c"/>
|
|
12
|
+
<stop offset="0.69" stop-color="#51e523"/>
|
|
13
|
+
<stop offset="1" stop-color="#38e7a2"/>
|
|
11
14
|
</linearGradient>
|
|
15
|
+
<linearGradient id="eye-ring" x1="12" y1="23" x2="57" y2="48" gradientUnits="userSpaceOnUse">
|
|
16
|
+
<stop offset="0" stop-color="#efff38"/>
|
|
17
|
+
<stop offset="0.45" stop-color="#fff947"/>
|
|
18
|
+
<stop offset="1" stop-color="#bdf02b"/>
|
|
19
|
+
</linearGradient>
|
|
20
|
+
<linearGradient id="eye-center" x1="18" y1="25" x2="53" y2="45" gradientUnits="userSpaceOnUse">
|
|
21
|
+
<stop offset="0" stop-color="#57d9ca"/>
|
|
22
|
+
<stop offset="0.45" stop-color="#22bde7"/>
|
|
23
|
+
<stop offset="1" stop-color="#18b6ec"/>
|
|
24
|
+
</linearGradient>
|
|
25
|
+
<clipPath id="eye-orb-clip">
|
|
26
|
+
<path d="M34 3.5C52 3.5 65.5 17 65.5 34.5S52 65 34 65 3 51.5 3 34.5 16 3.5 34 3.5Z"/>
|
|
27
|
+
</clipPath>
|
|
12
28
|
<style>
|
|
13
|
-
.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.codesm { fill:#17324D; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:15px; }
|
|
38
|
-
.label { fill:#17324D; font-family: Georgia, 'Times New Roman', serif; font-size:21px; }
|
|
39
|
-
.node { fill:#FFFDF8; stroke:#17324D; stroke-width:3; }
|
|
40
|
-
.rdfnode { fill:#78AFC0; stroke:#008EAA; stroke-width:3; }
|
|
41
|
-
.panel { fill:#FFFDF8; fill-opacity:0.96; stroke-width:3.5; }
|
|
42
|
-
.softbox { fill:#EAF8FA; stroke:#17324D; stroke-width:2.2; }
|
|
29
|
+
.title-small {
|
|
30
|
+
fill: #17324d;
|
|
31
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
32
|
+
font-size: 52px;
|
|
33
|
+
letter-spacing: 8px;
|
|
34
|
+
}
|
|
35
|
+
.title-main {
|
|
36
|
+
fill: #17324d;
|
|
37
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
38
|
+
font-size: 108px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
letter-spacing: -3px;
|
|
41
|
+
}
|
|
42
|
+
.subtitle {
|
|
43
|
+
fill: #3f6371;
|
|
44
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
45
|
+
font-size: 30px;
|
|
46
|
+
}
|
|
47
|
+
.author {
|
|
48
|
+
fill: #17324d;
|
|
49
|
+
font-family: Georgia, 'Times New Roman', serif;
|
|
50
|
+
font-size: 28px;
|
|
51
|
+
letter-spacing: 3px;
|
|
52
|
+
}
|
|
43
53
|
</style>
|
|
44
54
|
</defs>
|
|
45
55
|
|
|
46
|
-
<rect width="1000" height="1450"
|
|
47
|
-
|
|
48
|
-
<!--
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</g>
|
|
65
|
-
|
|
66
|
-
<!-- upper labels -->
|
|
67
|
-
<g id="labels">
|
|
68
|
-
<text x="210" y="455" text-anchor="middle" class="section wine">ISO PROLOG</text>
|
|
69
|
-
<text x="210" y="480" text-anchor="middle" class="smallserif wine">(RULES)</text>
|
|
70
|
-
<text x="790" y="455" text-anchor="middle" class="section green">RDF 1.2</text>
|
|
71
|
-
<text x="790" y="480" text-anchor="middle" class="smallserif green">(LINKED DATA)</text>
|
|
72
|
-
</g>
|
|
73
|
-
|
|
74
|
-
<!-- hero diagrams -->
|
|
75
|
-
<g id="prolog-rules">
|
|
76
|
-
<rect x="80" y="510" width="220" height="180" rx="18"
|
|
77
|
-
fill="#FFFDF8" stroke="#C8A100" stroke-width="3"/>
|
|
78
|
-
<text x="100" y="552" class="codesm" style="font-size:14px">path(X, Y) :-</text>
|
|
79
|
-
<text x="122" y="580" class="codesm" style="font-size:14px">edge(X, Y).</text>
|
|
80
|
-
<text x="100" y="615" class="codesm" style="font-size:14px">path(X, Y) :-</text>
|
|
81
|
-
<text x="122" y="643" class="codesm" style="font-size:14px">edge(X, Z),</text>
|
|
82
|
-
<text x="122" y="671" class="codesm" style="font-size:14px">path(Z, Y).</text>
|
|
83
|
-
</g>
|
|
84
|
-
|
|
85
|
-
<g id="rdf-graph">
|
|
86
|
-
<line x1="735" y1="535" x2="805" y2="575" class="green-stroke mid round"/>
|
|
87
|
-
<line x1="805" y1="575" x2="765" y2="640" class="green-stroke mid round"/>
|
|
88
|
-
<line x1="805" y1="575" x2="875" y2="610" class="green-stroke mid round"/>
|
|
89
|
-
<line x1="765" y1="640" x2="835" y2="690" class="green-stroke mid round"/>
|
|
90
|
-
<circle cx="735" cy="535" r="17" class="rdfnode"/>
|
|
91
|
-
<circle cx="805" cy="575" r="17" class="rdfnode"/>
|
|
92
|
-
<circle cx="765" cy="640" r="17" class="rdfnode"/>
|
|
93
|
-
<circle cx="875" cy="610" r="17" class="rdfnode"/>
|
|
94
|
-
<circle cx="835" cy="690" r="17" class="rdfnode"/>
|
|
95
|
-
|
|
96
|
-
<rect x="748" y="500" width="116" height="40" rx="8" fill="#FFF9E8" stroke="#17324D" stroke-width="2"/>
|
|
97
|
-
<text x="806" y="526" text-anchor="middle" class="smallserif navy">ex:Alice</text>
|
|
98
|
-
|
|
99
|
-
<rect x="855" y="558" width="118" height="40" rx="8" fill="#FFF9E8" stroke="#17324D" stroke-width="2"/>
|
|
100
|
-
<text x="914" y="584" text-anchor="middle" class="smallserif navy">ex:knows</text>
|
|
101
|
-
|
|
102
|
-
<rect x="846" y="682" width="106" height="40" rx="8" fill="#FFF9E8" stroke="#17324D" stroke-width="2"/>
|
|
103
|
-
<text x="899" y="708" text-anchor="middle" class="smallserif navy">ex:Bob</text>
|
|
104
|
-
</g>
|
|
105
|
-
|
|
106
|
-
<!-- abstract bridge -->
|
|
107
|
-
<g id="bridge">
|
|
108
|
-
<path d="M320 710 C338 560, 410 500, 500 500 C590 500, 662 560, 680 710"
|
|
109
|
-
fill="none" stroke="#F6D978" stroke-width="62" stroke-linecap="round"/>
|
|
110
|
-
<path d="M320 710 C338 560, 410 500, 500 500 C590 500, 662 560, 680 710"
|
|
111
|
-
class="navy-stroke mid round"/>
|
|
112
|
-
|
|
113
|
-
<path d="M442 488 L558 488 L572 556 L428 556 Z" fill="#FFF4BF" stroke="#17324D" stroke-width="3"/>
|
|
114
|
-
<text x="500" y="523" text-anchor="middle" class="section" style="font-size:14px; letter-spacing:0.5px;"><tspan class="logo-eye">EYE</tspan><tspan class="logo-prolog">PROLOG</tspan></text>
|
|
115
|
-
|
|
116
|
-
<rect x="290" y="690" width="68" height="148" rx="7" fill="#FFF4BF" stroke="#17324D" stroke-width="3"/>
|
|
117
|
-
<rect x="278" y="676" width="92" height="22" rx="5" fill="#F6D978" stroke="#17324D" stroke-width="3"/>
|
|
118
|
-
<rect x="276" y="830" width="96" height="24" rx="5" fill="#F6D978" stroke="#17324D" stroke-width="3"/>
|
|
119
|
-
<line x1="306" y1="708" x2="306" y2="824" class="gold-stroke thin"/>
|
|
120
|
-
<line x1="342" y1="708" x2="342" y2="824" class="gold-stroke thin"/>
|
|
121
|
-
|
|
122
|
-
<rect x="642" y="690" width="68" height="148" rx="7" fill="#FFF4BF" stroke="#17324D" stroke-width="3"/>
|
|
123
|
-
<rect x="630" y="676" width="92" height="22" rx="5" fill="#F6D978" stroke="#17324D" stroke-width="3"/>
|
|
124
|
-
<rect x="628" y="830" width="96" height="24" rx="5" fill="#F6D978" stroke="#17324D" stroke-width="3"/>
|
|
125
|
-
<line x1="658" y1="708" x2="658" y2="824" class="gold-stroke thin"/>
|
|
126
|
-
<line x1="694" y1="708" x2="694" y2="824" class="gold-stroke thin"/>
|
|
127
|
-
</g>
|
|
128
|
-
|
|
129
|
-
<!-- proof tree -->
|
|
130
|
-
<g id="proof-tree">
|
|
131
|
-
<circle cx="500" cy="590" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
132
|
-
<circle cx="455" cy="660" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
133
|
-
<circle cx="545" cy="660" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
134
|
-
<circle cx="420" cy="730" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
135
|
-
<circle cx="500" cy="730" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
136
|
-
<circle cx="580" cy="730" r="18" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
137
|
-
<path d="M500 608 L455 642 M500 608 L545 642 M455 678 L420 712 M455 678 L500 712 M545 678 L580 712"
|
|
138
|
-
class="green-stroke mid round"/>
|
|
139
|
-
<line x1="500" y1="752" x2="500" y2="790" class="green-stroke mid round" stroke-dasharray="4 8"/>
|
|
140
|
-
<path d="M491 785 L500 796 L509 785" class="green-stroke mid round"/>
|
|
141
|
-
<circle cx="500" cy="824" r="29" fill="#008EAA" stroke="#17324D" stroke-width="3"/>
|
|
142
|
-
<path d="M486 825 L497 836 L516 810" fill="none" stroke="#FFFDF8" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
143
|
-
</g>
|
|
144
|
-
|
|
145
|
-
<line x1="70" y1="875" x2="930" y2="875" class="gold-stroke thin"/>
|
|
146
|
-
<circle cx="500" cy="875" r="6" class="gold"/>
|
|
147
|
-
|
|
148
|
-
<!-- panels -->
|
|
149
|
-
<g id="panel1">
|
|
150
|
-
<rect x="45" y="925" width="280" height="360" rx="28" class="panel" stroke="#C8A100"/>
|
|
151
|
-
<circle cx="185" cy="925" r="38" fill="#FFFDF8" stroke="#C8A100" stroke-width="3"/>
|
|
152
|
-
<text x="185" y="936" text-anchor="middle" class="code wine" style="font-size:27px">:-</text>
|
|
153
|
-
<text x="185" y="990" text-anchor="middle" class="paneltitle wine" style="font-size:20px">1. ISO PROLOG RULES</text>
|
|
154
|
-
|
|
155
|
-
<text x="75" y="1050" class="codesm">path(X, Y) :-</text>
|
|
156
|
-
<text x="100" y="1080" class="codesm">edge(X, Y).</text>
|
|
157
|
-
|
|
158
|
-
<text x="75" y="1130" class="codesm">path(X, Y) :-</text>
|
|
159
|
-
<text x="100" y="1160" class="codesm">edge(X, Z),</text>
|
|
160
|
-
<text x="100" y="1190" class="codesm">path(Z, Y).</text>
|
|
161
|
-
|
|
162
|
-
<line x1="75" y1="1220" x2="295" y2="1220" class="wine-stroke thin"/>
|
|
163
|
-
<text x="185" y="1250" text-anchor="middle" class="smallserif wine" style="font-size:16px">clauses · unification · recursion</text>
|
|
164
|
-
</g>
|
|
165
|
-
|
|
166
|
-
<g id="panel2">
|
|
167
|
-
<rect x="340" y="925" width="320" height="360" rx="28" class="panel" stroke="#008EAA"/>
|
|
168
|
-
<circle cx="500" cy="925" r="38" fill="#FFFDF8" stroke="#008EAA" stroke-width="3"/>
|
|
169
|
-
<circle cx="484" cy="925" r="6" class="rdfnode"/>
|
|
170
|
-
<circle cx="516" cy="908" r="6" class="rdfnode"/>
|
|
171
|
-
<circle cx="520" cy="942" r="6" class="rdfnode"/>
|
|
172
|
-
<path d="M490 922 L510 911 M490 928 L514 939 M516 914 L519 936" class="green-stroke thin round"/>
|
|
173
|
-
<text x="500" y="990" text-anchor="middle" class="paneltitle green">2. RDF 1.2 DATASET</text>
|
|
174
|
-
|
|
175
|
-
<circle cx="405" cy="1060" r="18" class="rdfnode"/>
|
|
176
|
-
<circle cx="500" cy="1060" r="18" class="rdfnode"/>
|
|
177
|
-
<circle cx="595" cy="1060" r="18" class="rdfnode"/>
|
|
178
|
-
<line x1="423" y1="1060" x2="482" y2="1060" class="green-stroke mid round"/>
|
|
179
|
-
<line x1="518" y1="1060" x2="577" y2="1060" class="green-stroke mid round"/>
|
|
180
|
-
|
|
181
|
-
<rect x="375" y="1110" width="250" height="38" rx="8" fill="#EAF8FA" stroke="#008EAA" stroke-width="2"/>
|
|
182
|
-
<text x="500" y="1135" text-anchor="middle" class="codesm">ex:alice ex:knows ex:bob</text>
|
|
183
|
-
|
|
184
|
-
<rect x="375" y="1160" width="250" height="54" rx="8" fill="#EAF8FA" stroke="#008EAA" stroke-width="2"/>
|
|
185
|
-
<text x="500" y="1183" text-anchor="middle" class="codesm" style="font-size:13px">named graphs · literals</text>
|
|
186
|
-
<text x="500" y="1202" text-anchor="middle" class="codesm" style="font-size:13px">triple terms</text>
|
|
187
|
-
|
|
188
|
-
<text x="500" y="1250" text-anchor="middle" class="smallserif green" style="font-size:16px">linked data remains RDF</text>
|
|
189
|
-
</g>
|
|
190
|
-
|
|
191
|
-
<g id="panel3">
|
|
192
|
-
<rect x="675" y="925" width="280" height="360" rx="28" class="panel" stroke="#17324D"/>
|
|
193
|
-
<circle cx="815" cy="925" r="38" fill="#FFFDF8" stroke="#17324D" stroke-width="3"/>
|
|
194
|
-
<rect x="807" y="903" width="16" height="12" rx="2" fill="#FFFDF8" stroke="#17324D" stroke-width="2"/>
|
|
195
|
-
<rect x="790" y="934" width="16" height="12" rx="2" fill="#FFFDF8" stroke="#17324D" stroke-width="2"/>
|
|
196
|
-
<rect x="824" y="934" width="16" height="12" rx="2" fill="#FFFDF8" stroke="#17324D" stroke-width="2"/>
|
|
197
|
-
<path d="M815 915 V926 M798 926 H832 M798 926 V934 M832 926 V934" class="navy-stroke thin round"/>
|
|
198
|
-
<text x="815" y="990" text-anchor="middle" class="paneltitle navy">3. ANSWERS & PROOFS</text>
|
|
199
|
-
|
|
200
|
-
<rect x="758" y="1038" width="114" height="38" rx="8" class="softbox"/>
|
|
201
|
-
<text x="815" y="1062" text-anchor="middle" class="codesm">path(a, X)</text>
|
|
202
|
-
|
|
203
|
-
<rect x="700" y="1122" width="104" height="38" rx="8" class="softbox"/>
|
|
204
|
-
<rect x="826" y="1122" width="104" height="38" rx="8" class="softbox"/>
|
|
205
|
-
<text x="752" y="1146" text-anchor="middle" class="codesm">edge(a,b)</text>
|
|
206
|
-
<text x="878" y="1146" text-anchor="middle" class="codesm">path(b,X)</text>
|
|
207
|
-
|
|
208
|
-
<rect x="824" y="1206" width="106" height="38" rx="8" class="softbox"/>
|
|
209
|
-
<text x="877" y="1230" text-anchor="middle" class="codesm">edge(b,c)</text>
|
|
210
|
-
|
|
211
|
-
<path d="M815 1076 L752 1122 M815 1076 L878 1122 M878 1160 L877 1206" class="navy-stroke mid round"/>
|
|
212
|
-
<text x="877" y="1268" text-anchor="middle" class="codesm" style="font-size:22px">…</text>
|
|
213
|
-
</g>
|
|
214
|
-
|
|
215
|
-
<!-- footer -->
|
|
216
|
-
<g id="footer">
|
|
217
|
-
<line x1="145" y1="1350" x2="285" y2="1350" class="gold-stroke thin round"/>
|
|
218
|
-
<circle cx="310" cy="1350" r="4" class="gold"/>
|
|
219
|
-
<text x="500" y="1360" text-anchor="middle" class="subtitle" style="font-size:20px; font-style:italic;">ISO Prolog rules over RDF linked data</text>
|
|
220
|
-
<circle cx="690" cy="1350" r="4" class="gold"/>
|
|
221
|
-
<line x1="715" y1="1350" x2="855" y2="1350" class="gold-stroke thin round"/>
|
|
222
|
-
<path d="M500 1390 L510 1400 L500 1410 L490 1400 Z" class="green"/>
|
|
223
|
-
</g>
|
|
56
|
+
<rect width="1000" height="1450" fill="#fffdf8"/>
|
|
57
|
+
|
|
58
|
+
<!-- Native SVG rendering of the original EYE rainbow mark. -->
|
|
59
|
+
<svg x="340" y="180" width="320" height="320" viewBox="0 0 68 68"
|
|
60
|
+
role="img" aria-label="EYE logo">
|
|
61
|
+
<g clip-path="url(#eye-orb-clip)">
|
|
62
|
+
<rect width="68" height="68" fill="url(#eye-spectrum)"/>
|
|
63
|
+
<ellipse cx="34" cy="35" rx="30" ry="14.5"
|
|
64
|
+
transform="rotate(11 34 35)" fill="url(#eye-ring)"/>
|
|
65
|
+
<ellipse cx="34" cy="35" rx="22.5" ry="9.2"
|
|
66
|
+
transform="rotate(11 34 35)" fill="url(#eye-center)"/>
|
|
67
|
+
</g>
|
|
68
|
+
</svg>
|
|
69
|
+
|
|
70
|
+
<text x="500" y="625" text-anchor="middle" class="title-small">THE ART OF</text>
|
|
71
|
+
<text x="500" y="755" text-anchor="middle" class="title-main">EyeProlog</text>
|
|
72
|
+
<text x="500" y="830" text-anchor="middle" class="subtitle">ISO Prolog with inspectable proofs</text>
|
|
73
|
+
<text x="500" y="1260" text-anchor="middle" class="author">JOS DE ROO</text>
|
|
224
74
|
</svg>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
% Basic Monadic Benchmark port from EYE reasoning/basic-monadic.
|
|
2
2
|
%
|
|
3
|
-
% This example
|
|
3
|
+
% This example adapts ten small monadic reasoning cases.
|
|
4
4
|
% from EYE and the EYE selected-goal shape:
|
|
5
5
|
% D0 R D1, D1 R D2, ..., D9 R D0 -> R cycle (D0 ... D9 D0).
|
|
6
6
|
%
|
package/examples/book/README.md
CHANGED
|
@@ -18,8 +18,9 @@ npm run generate
|
|
|
18
18
|
|
|
19
19
|
## Chapter 2: Terms, variables, and substitution
|
|
20
20
|
|
|
21
|
-
- [01-
|
|
22
|
-
- [02-
|
|
21
|
+
- [01-same_shape.pl](chapter-02/01-same_shape.pl) — Unification
|
|
22
|
+
- [02-measurement.pl](chapter-02/02-measurement.pl)
|
|
23
|
+
- [03-label.pl](chapter-02/03-label.pl)
|
|
23
24
|
|
|
24
25
|
## Chapter 3: Rules and their two readings
|
|
25
26
|
|
|
@@ -37,7 +38,8 @@ npm run generate
|
|
|
37
38
|
|
|
38
39
|
## Chapter 4: Recursion: describing reachability
|
|
39
40
|
|
|
40
|
-
- [01-
|
|
41
|
+
- [01-ancestor.pl](chapter-04/01-ancestor.pl)
|
|
42
|
+
- [02-path.pl](chapter-04/02-path.pl) — Constructing the recursive argument
|
|
41
43
|
|
|
42
44
|
## Chapter 5: Lists as relations
|
|
43
45
|
|
|
@@ -70,7 +72,8 @@ npm run generate
|
|
|
70
72
|
|
|
71
73
|
## Chapter 10: From puzzles to models
|
|
72
74
|
|
|
73
|
-
- [01-
|
|
75
|
+
- [01-color.pl](chapter-10/01-color.pl)
|
|
76
|
+
- [02-plan.pl](chapter-10/02-plan.pl)
|
|
74
77
|
|
|
75
78
|
## Chapter 11: Queries, answers, and proofs
|
|
76
79
|
|
|
@@ -85,15 +88,6 @@ npm run generate
|
|
|
85
88
|
|
|
86
89
|
- [01-heating.pl](chapter-14/01-heating.pl)
|
|
87
90
|
|
|
88
|
-
## Chapter 15: RDF 1.2 as the interoperable data boundary
|
|
89
|
-
|
|
90
|
-
- [01-rdf.pl](chapter-15/01-rdf.pl)
|
|
91
|
-
|
|
92
|
-
## Chapter 16: Embedding EyeProlog
|
|
93
|
-
|
|
94
|
-
- [01-socket.pl](chapter-16/01-socket.pl) — Sockets: naming the knowledge boundary
|
|
95
|
-
- [02-socket-2.pl](chapter-16/02-socket-2.pl)
|
|
96
|
-
|
|
97
91
|
## Chapter 17: Logic and control
|
|
98
92
|
|
|
99
93
|
- [01-path.pl](chapter-17/01-path.pl)
|
|
@@ -122,19 +116,21 @@ npm run generate
|
|
|
122
116
|
|
|
123
117
|
## Chapter 21: Reading the computation
|
|
124
118
|
|
|
125
|
-
- [01-
|
|
126
|
-
- [02-
|
|
127
|
-
- [03-
|
|
128
|
-
- [04-
|
|
119
|
+
- [01-parent.pl](chapter-21/01-parent.pl)
|
|
120
|
+
- [02-grandparent.pl](chapter-21/02-grandparent.pl) — Substitutions accumulate
|
|
121
|
+
- [03-loop_edge.pl](chapter-21/03-loop_edge.pl)
|
|
122
|
+
- [04-eligible.pl](chapter-21/04-eligible.pl) — Failure rewinds choices, not facts
|
|
123
|
+
- [05-grows.pl](chapter-21/05-grows.pl) — Variants, cycles, and tables
|
|
129
124
|
|
|
130
125
|
## Chapter 22: Trees, languages, and symbolic evaluation
|
|
131
126
|
|
|
132
127
|
- [01-tree.pl](chapter-22/01-tree.pl)
|
|
133
128
|
- [02-tree_member.pl](chapter-22/02-tree_member.pl)
|
|
134
129
|
- [03-mirror.pl](chapter-22/03-mirror.pl) — Transforming a tree
|
|
135
|
-
- [04-
|
|
136
|
-
- [05-
|
|
137
|
-
- [06-
|
|
130
|
+
- [04-sentence.pl](chapter-22/04-sentence.pl) — A grammar without special syntax
|
|
131
|
+
- [05-evaluate.pl](chapter-22/05-evaluate.pl) — Interpreting an expression
|
|
132
|
+
- [06-lookup.pl](chapter-22/06-lookup.pl)
|
|
133
|
+
- [07-simplify.pl](chapter-22/07-simplify.pl) — Rewriting symbolic expressions
|
|
138
134
|
|
|
139
135
|
## Chapter 23: Transforming programs
|
|
140
136
|
|
|
@@ -149,22 +145,25 @@ npm run generate
|
|
|
149
145
|
|
|
150
146
|
## Chapter 24: Designing finite search
|
|
151
147
|
|
|
152
|
-
- [01-
|
|
153
|
-
- [02-
|
|
154
|
-
- [03-
|
|
148
|
+
- [01-worker.pl](chapter-24/01-worker.pl) — Generate, constrain, describe
|
|
149
|
+
- [02-simple_path.pl](chapter-24/02-simple_path.pl) — Search over states
|
|
150
|
+
- [03-reachable.pl](chapter-24/03-reachable.pl) — Existence, one witness, and all witnesses
|
|
151
|
+
- [04-best_plan.pl](chapter-24/04-best_plan.pl) — Optimization is search plus an order
|
|
155
152
|
|
|
156
153
|
## Chapter 25: Case study: an auditable decision service
|
|
157
154
|
|
|
158
155
|
- [01-person.pl](chapter-25/01-person.pl) — Source and concept layers
|
|
159
156
|
- [02-active_badge.pl](chapter-25/02-active_badge.pl)
|
|
160
157
|
- [03-in_good_standing.pl](chapter-25/03-in_good_standing.pl) — Closed-world choice
|
|
161
|
-
- [04-
|
|
158
|
+
- [04-permit.pl](chapter-25/04-permit.pl) — Decision, reasons, and proof
|
|
159
|
+
- [05-incompatible_status.pl](chapter-25/05-incompatible_status.pl) — Integrity before decisions
|
|
162
160
|
|
|
163
161
|
## Chapter 26: A proof can be a computation
|
|
164
162
|
|
|
165
163
|
- [01-mortal.pl](chapter-26/01-mortal.pl)
|
|
166
|
-
- [02-triple.pl](chapter-26/02-triple.pl) —
|
|
167
|
-
- [03-
|
|
164
|
+
- [02-triple.pl](chapter-26/02-triple.pl) — Answers are existential witnesses
|
|
165
|
+
- [03-triple-2.pl](chapter-26/03-triple-2.pl) — Proof objects and proof checking
|
|
166
|
+
- [04-edge.pl](chapter-26/04-edge.pl) — The least model as mathematical closure
|
|
168
167
|
|
|
169
168
|
## Chapter 27: Recursion is induction in motion
|
|
170
169
|
|
|
@@ -177,16 +176,26 @@ npm run generate
|
|
|
177
176
|
- [01-program.pl](chapter-28/01-program.pl) — Unification is structural equation solving
|
|
178
177
|
- [02-triangle.pl](chapter-28/02-triangle.pl) — Symmetry reduces search
|
|
179
178
|
- [03-rectangle.pl](chapter-28/03-rectangle.pl) — Relations reveal inverse problems
|
|
180
|
-
- [04-
|
|
179
|
+
- [04-integer_rectangle.pl](chapter-28/04-integer_rectangle.pl)
|
|
180
|
+
- [05-preserves_combine.pl](chapter-28/05-preserves_combine.pl) — Composition, homomorphism, and reusable laws
|
|
181
181
|
|
|
182
182
|
## Chapter 29: Search as experimental mathematics
|
|
183
183
|
|
|
184
|
-
- [01-
|
|
184
|
+
- [01-counterexample_to_odd_square.pl](chapter-29/01-counterexample_to_odd_square.pl) — Examples suggest; proofs compel
|
|
185
|
+
- [02-noncommuting_pair.pl](chapter-29/02-noncommuting_pair.pl) — One counterexample has asymmetric power
|
|
186
|
+
|
|
187
|
+
## Chapter 31: Testing a theory
|
|
188
|
+
|
|
189
|
+
- [01-edge.pl](chapter-31/01-edge.pl) — Positive and negative observers
|
|
190
|
+
- [02-program.pl](chapter-31/02-program.pl)
|
|
191
|
+
- [03-double.pl](chapter-31/03-double.pl) — Properties over finite domains
|
|
185
192
|
|
|
186
193
|
## Chapter 32: Debugging by meaning, search, and proof
|
|
187
194
|
|
|
188
195
|
- [01-eligible.pl](chapter-32/01-eligible.pl) — Follow bindings from left to right
|
|
189
196
|
- [02-eligible-2.pl](chapter-32/02-eligible-2.pl)
|
|
197
|
+
- [03-candidate_debug.pl](chapter-32/03-candidate_debug.pl) — Create diagnostic relations
|
|
198
|
+
- [04-reference_square.pl](chapter-32/04-reference_square.pl) — Compare specification and implementation
|
|
190
199
|
|
|
191
200
|
## Chapter 33: A pattern catalog for reasoning
|
|
192
201
|
|
|
@@ -224,3 +233,11 @@ npm run generate
|
|
|
224
233
|
## Chapter 38: Language and ISO profile
|
|
225
234
|
|
|
226
235
|
- [01-city.pl](chapter-38/01-city.pl)
|
|
236
|
+
|
|
237
|
+
## Chapter 39: Built-in predicates by programming role
|
|
238
|
+
|
|
239
|
+
- [01-answer.pl](chapter-39/01-answer.pl) — The EyeProlog library
|
|
240
|
+
- [02-answer-2.pl](chapter-39/02-answer-2.pl)
|
|
241
|
+
- [03-answer-3.pl](chapter-39/03-answer-3.pl)
|
|
242
|
+
- [04-cost.pl](chapter-39/04-cost.pl)
|
|
243
|
+
- [05-message.pl](chapter-39/05-message.pl)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
% From The Art of EyeProlog, Chapter 22 — A grammar without special syntax.
|
|
2
|
+
sentence(Input, Rest) :-
|
|
3
|
+
noun_phrase(Input, AfterNoun),
|
|
4
|
+
verb_phrase(AfterNoun, Rest).
|
|
5
|
+
|
|
6
|
+
noun_phrase([the | Input], Rest) :- noun(Input, Rest).
|
|
7
|
+
noun_phrase([a | Input], Rest) :- noun(Input, Rest).
|
|
8
|
+
|
|
9
|
+
noun([robot | Rest], Rest).
|
|
10
|
+
noun([scientist | Rest], Rest).
|
|
11
|
+
|
|
12
|
+
verb_phrase(Input, Rest) :-
|
|
13
|
+
verb(Input, AfterVerb),
|
|
14
|
+
noun_phrase(AfterVerb, Rest).
|
|
15
|
+
|
|
16
|
+
verb([helps | Rest], Rest).
|
|
17
|
+
verb([observes | Rest], Rest).
|
|
18
|
+
|
|
19
|
+
complete_sentence(Words) :- sentence(Words, []).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
% From The Art of EyeProlog, Chapter 24 — Generate, constrain, describe.
|
|
2
|
+
worker(ada).
|
|
3
|
+
worker(byron).
|
|
4
|
+
worker(clara).
|
|
5
|
+
|
|
6
|
+
task(inspect).
|
|
7
|
+
task(repair).
|
|
8
|
+
|
|
9
|
+
qualified(ada, inspect).
|
|
10
|
+
qualified(byron, repair).
|
|
11
|
+
qualified(clara, inspect).
|
|
12
|
+
qualified(clara, repair).
|
|
13
|
+
|
|
14
|
+
assignment(Worker, Task) :-
|
|
15
|
+
worker(Worker),
|
|
16
|
+
task(Task),
|
|
17
|
+
qualified(Worker, Task).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
% From The Art of EyeProlog, Chapter 25 — Decision, reasons, and proof.
|
|
2
|
+
permit(Person, Zone) :-
|
|
3
|
+
active_badge(Person, Badge),
|
|
4
|
+
cleared_for(Badge, Zone),
|
|
5
|
+
prepared_for(Person, Zone),
|
|
6
|
+
in_good_standing(Person).
|
|
7
|
+
|
|
8
|
+
reason(Person, Zone, badge_and_training_verified) :-
|
|
9
|
+
permit(Person, Zone).
|