eyeprolog 0.5.18 → 1.0.0
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 +7 -20
- 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/conformance-report.md +2 -2
- package/examples/basic-monadic.pl +1 -1
- package/examples/blocks-world-planning.pl +3 -3
- package/examples/book/README.md +0 -9
- package/examples/combinatorics-findall-sort.pl +4 -4
- package/examples/complex.pl +3 -3
- package/examples/d3-group.pl +3 -3
- package/examples/dijkstra-findall-sort.pl +3 -3
- package/examples/enigma1225.pl +1 -1
- package/examples/eulerian-path.pl +4 -4
- package/examples/four-color-map.pl +2 -2
- package/examples/output/complex.pl +5 -0
- package/examples/output/enigma1225.pl +1 -1
- package/examples/output/iso-integer-arithmetic.pl +1 -1
- package/examples/proof/d3-group.pl +4 -4
- package/examples/proof/iso-dynamic-database.pl +1 -1
- package/examples/quine-mccluskey.pl +7 -7
- package/examples/sudoku.pl +1 -1
- package/index.d.ts +3 -0
- package/package.json +1 -4
- package/playground.html +0 -18
- package/src/eyeprolog-autoload.js +1 -7
- package/src/eyeprolog-common-library.pl +1 -1
- package/src/eyeprolog-library.pl +10 -57
- package/src/iso.js +229 -19
- package/src/parser.js +39 -19
- package/src/program.js +5 -2
- package/test/conformance/ISO-MATRIX.md +37 -0
- package/test/conformance/README.md +6 -4
- package/test/conformance/cases/aggregation/098_aggregation_nested_templates.pl +3 -0
- package/test/conformance/cases/arithmetic/062_reusable_numeric_builtins.pl +2 -2
- package/test/conformance/cases/arithmetic/081_zero_safe_numeric_functions.pl +2 -2
- package/test/conformance/cases/arithmetic/extra_acos_one.pl +1 -1
- package/test/conformance/cases/arithmetic/extra_asin_zero.pl +1 -1
- package/test/conformance/cases/arithmetic/extra_atan2_axis.pl +1 -1
- package/test/conformance/cases/iso/corrigenda_arithmetic.pl +15 -0
- package/test/conformance/cases/iso/corrigenda_bar_operator.pl +10 -0
- package/test/conformance/cases/iso/corrigenda_call_closure.pl +9 -0
- package/test/conformance/cases/iso/corrigenda_catch_callability.pl +7 -0
- package/test/conformance/cases/iso/corrigenda_retractall.pl +14 -0
- package/test/conformance/cases/iso/corrigenda_sort_keysort.pl +10 -0
- package/test/conformance/cases/iso/corrigenda_term_predicates.pl +11 -0
- package/test/conformance/cases/iso/corrigendum1_double_quote_operator.pl +9 -0
- package/test/conformance/cases/iso/corrigendum3_write_variable_names.pl +8 -0
- package/test/conformance/cases/lists/031_lists_aggregation_ordering.pl +1 -1
- package/test/conformance/cases/lists/045_sort_deduplicates_atoms.pl +2 -2
- package/test/conformance/cases/lists/087_sort_reverse_length.pl +2 -2
- package/test/conformance/cases/lists/extra_sort_iri_atoms.pl +1 -1
- package/test/conformance/cases/lists/sort_structured_terms.pl +1 -1
- package/test/conformance/errors/iso/arithmetic_float_overflow.pl +3 -0
- package/test/conformance/errors/iso/arithmetic_underflow.pl +3 -0
- package/test/conformance/errors/iso/catch_unbound_goal.pl +1 -1
- package/test/conformance/errors/iso/corrigenda_atan2_zero.pl +3 -0
- package/test/conformance/errors/iso/corrigenda_integer_negative_power.pl +3 -0
- package/test/conformance/errors/iso/corrigenda_keysort_pair_type.pl +3 -0
- package/test/conformance/errors/iso/corrigenda_op_bar_priority.pl +3 -0
- package/test/conformance/errors/iso/corrigenda_op_empty_list.pl +3 -0
- package/test/conformance/errors/iso/corrigenda_op_infix_postfix_conflict.pl +5 -0
- package/test/conformance/errors/iso/corrigenda_open_uninstantiation.pl +3 -0
- package/test/conformance/errors/iso/corrigenda_retractall_static.pl +4 -0
- package/test/conformance/errors/iso/corrigenda_sort_output_type.pl +3 -0
- package/test/conformance/errors/iso/corrigenda_sort_partial.pl +3 -0
- package/test/conformance/errors/iso/corrigendum3_close_option_component_variable.pl +3 -0
- package/test/conformance/errors/iso/corrigendum3_open_option_variable.pl +3 -0
- package/test/conformance/errors/iso/corrigendum3_write_option_variable.pl +3 -0
- package/test/conformance/expected/aggregation/098_aggregation_nested_templates.pl +1 -0
- package/test/conformance/expected/iso/corrigenda_arithmetic.pl +1 -0
- package/test/conformance/expected/iso/corrigenda_bar_operator.pl +1 -0
- package/test/conformance/expected/iso/corrigenda_call_closure.pl +1 -0
- package/test/conformance/expected/iso/corrigenda_catch_callability.pl +1 -0
- package/test/conformance/expected/iso/corrigenda_retractall.pl +1 -0
- package/test/conformance/expected/iso/corrigenda_sort_keysort.pl +1 -0
- package/test/conformance/expected/iso/corrigenda_term_predicates.pl +1 -0
- package/test/conformance/expected/iso/corrigendum1_double_quote_operator.pl +1 -0
- package/test/conformance/expected/iso/corrigendum3_write_variable_names.pl +2 -0
- package/test/conformance/expected-errors/iso/arithmetic_float_overflow.txt +1 -0
- package/test/conformance/expected-errors/iso/arithmetic_underflow.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigenda_atan2_zero.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigenda_integer_negative_power.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigenda_keysort_pair_type.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigenda_op_bar_priority.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigenda_op_empty_list.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigenda_op_infix_postfix_conflict.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigenda_open_uninstantiation.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigenda_retractall_static.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigenda_sort_output_type.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigenda_sort_partial.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigendum3_close_option_component_variable.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigendum3_open_option_variable.txt +1 -0
- package/test/conformance/expected-errors/iso/corrigendum3_write_option_variable.txt +1 -0
- package/test/conformance/expected-errors/iso/retract_static_procedure.txt +1 -1
- package/test/run-all.mjs +0 -2
- package/test/run-examples.mjs +0 -11
- package/test/run-regression.mjs +21 -3
- package/the-art-of-eyeprolog.md +99 -254
- 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/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.
|
|
@@ -29,24 +28,12 @@ proper list of one-character atoms (`chars`), matching Trealla and Scryer.
|
|
|
29
28
|
|
|
30
29
|
## Portable library
|
|
31
30
|
|
|
32
|
-
EyeProlog adds
|
|
33
|
-
**All
|
|
31
|
+
EyeProlog adds 44 public library predicates to its 127-entry ISO core registry.
|
|
32
|
+
**All 44 are ordinary Prolog clauses** across `src/eyeprolog-library.pl` and
|
|
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>
|
package/conformance-report.md
CHANGED
|
@@ -11,7 +11,7 @@ This report summarizes the file-based conformance corpus under `test/conformance
|
|
|
11
11
|
| builtins | 11 | 0 | 0 | 0 | 11 |
|
|
12
12
|
| context | 11 | 0 | 0 | 0 | 11 |
|
|
13
13
|
| control | 15 | 0 | 0 | 0 | 15 |
|
|
14
|
-
| iso |
|
|
14
|
+
| iso | 130 | 174 | 0 | 0 | 304 |
|
|
15
15
|
| lists | 52 | 3 | 0 | 0 | 55 |
|
|
16
16
|
| negation | 8 | 0 | 19 | 0 | 27 |
|
|
17
17
|
| proofs | 0 | 0 | 0 | 21 | 21 |
|
|
@@ -22,4 +22,4 @@ This report summarizes the file-based conformance corpus under `test/conformance
|
|
|
22
22
|
| terms | 26 | 3 | 0 | 0 | 29 |
|
|
23
23
|
| unification | 18 | 0 | 0 | 0 | 18 |
|
|
24
24
|
| variables | 16 | 9 | 0 | 0 | 25 |
|
|
25
|
-
| **Total** | **
|
|
25
|
+
| **Total** | **443** | **227** | **19** | **21** | **710** |
|
|
@@ -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
|
%
|
|
@@ -48,7 +48,7 @@ move(State, move(Block, From, To), Newstate) :-
|
|
|
48
48
|
(Block \= To),
|
|
49
49
|
(From \= To),
|
|
50
50
|
select(on(Block, From), State, Rest),
|
|
51
|
-
|
|
51
|
+
sort([on(Block, To)|Rest], Newstate).
|
|
52
52
|
|
|
53
53
|
plan(State, Goal, 0, _visited, [], State) :-
|
|
54
54
|
(State = Goal).
|
|
@@ -63,8 +63,8 @@ plan(State, Goal, Depth, Visited, [Move|Moves], Final) :-
|
|
|
63
63
|
five_move_plan(Moves, Final) :-
|
|
64
64
|
initial(Start),
|
|
65
65
|
goal(Goal),
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
sort(Start, Sortedstart),
|
|
67
|
+
sort(Goal, Sortedgoal),
|
|
68
68
|
plan(Sortedstart, Sortedgoal, 5, [Sortedstart], Moves, Final).
|
|
69
69
|
|
|
70
70
|
status(blocks_world, planned) :-
|
package/examples/book/README.md
CHANGED
|
@@ -85,15 +85,6 @@ npm run generate
|
|
|
85
85
|
|
|
86
86
|
- [01-heating.pl](chapter-14/01-heating.pl)
|
|
87
87
|
|
|
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
88
|
## Chapter 17: Logic and control
|
|
98
89
|
|
|
99
90
|
- [01-path.pl](chapter-17/01-path.pl)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
% Eyelet-inspired combinations example using findall/3 and
|
|
1
|
+
% Eyelet-inspired combinations example using findall/3 and sort/2.
|
|
2
2
|
%
|
|
3
3
|
% combination/3 generates the same subset in several selection orders. findall/3
|
|
4
|
-
% collects those candidates, and
|
|
4
|
+
% collects those candidates, and sort/2 canonicalizes the list so each unordered
|
|
5
5
|
% 3-combination of five items is reported once.
|
|
6
6
|
%% goal: combinations(X0, X1)
|
|
7
7
|
|
|
@@ -24,12 +24,12 @@ combination(I, Items, Combination) :-
|
|
|
24
24
|
select(Item, Items, Remaining),
|
|
25
25
|
(J is I - 1),
|
|
26
26
|
combination(J, Remaining, Partial),
|
|
27
|
-
|
|
27
|
+
sort([Item | Partial], Combination).
|
|
28
28
|
|
|
29
29
|
% findall collects all generation orders; sort canonicalizes and deduplicates.
|
|
30
30
|
unique_combinations(K, Items, Unique) :-
|
|
31
31
|
findall(C, combination(K, Items, C), All),
|
|
32
|
-
|
|
32
|
+
sort(All, Unique).
|
|
33
33
|
|
|
34
34
|
combinations(combinations_5_choose_3, Unique) :-
|
|
35
35
|
unique_combinations(3, [1, 2, 3, 4, 5], Unique).
|
package/examples/complex.pl
CHANGED
|
@@ -50,7 +50,7 @@ complex_asin([A, B], [C, D]) :-
|
|
|
50
50
|
(E is Z10 / 2),
|
|
51
51
|
(Z11 is Z5 + Z9),
|
|
52
52
|
(F is Z11 / 2),
|
|
53
|
-
asin(E
|
|
53
|
+
(C is asin(E)),
|
|
54
54
|
(Z12 is F ** 2),
|
|
55
55
|
(Z13 is Z12 - 1),
|
|
56
56
|
(Z14 is Z13 ** 0.5),
|
|
@@ -71,7 +71,7 @@ complex_acos([A, B], [C, D]) :-
|
|
|
71
71
|
(E is Z10 / 2),
|
|
72
72
|
(Z11 is Z5 + Z9),
|
|
73
73
|
(F is Z11 / 2),
|
|
74
|
-
acos(E
|
|
74
|
+
(C is acos(E)),
|
|
75
75
|
(Z12 is F ** 2),
|
|
76
76
|
(Z13 is Z12 - 1),
|
|
77
77
|
(Z14 is Z13 ** 0.5),
|
|
@@ -86,7 +86,7 @@ complex_polar([X, Y], [R, Tp]) :-
|
|
|
86
86
|
(R is Z3 ** 0.5),
|
|
87
87
|
(Z4 is abs(X)),
|
|
88
88
|
(Z5 is Z4 / R),
|
|
89
|
-
acos(Z5
|
|
89
|
+
(T is acos(Z5)),
|
|
90
90
|
complex_dial(X, Y, T, Tp).
|
|
91
91
|
|
|
92
92
|
complex_dial(X, Y, T, Tp) :-
|
package/examples/d3-group.pl
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
% Eyelet-inspired D3 group example using findall/3 and
|
|
1
|
+
% Eyelet-inspired D3 group example using findall/3 and sort/2.
|
|
2
2
|
% The six facts are the symmetries of an equilateral triangle, with compose/3 as
|
|
3
3
|
% the Cayley table and inverse/2 as the inverse relation. Candidate subsets are
|
|
4
4
|
% generated as subsequences, then filtered for subgroup closure.
|
|
@@ -72,7 +72,7 @@ subsequence([_head | Tail], Rest) :-
|
|
|
72
72
|
|
|
73
73
|
all_symmetries(Symmetries) :-
|
|
74
74
|
findall(X, symmetry(X), Raw),
|
|
75
|
-
|
|
75
|
+
sort(Raw, Symmetries).
|
|
76
76
|
|
|
77
77
|
% A valid subgroup is closed under both composition and inverse.
|
|
78
78
|
closed_under_composition(Group) :-
|
|
@@ -90,7 +90,7 @@ valid_group(Group) :-
|
|
|
90
90
|
|
|
91
91
|
all_subgroups(Groups) :-
|
|
92
92
|
findall(G, valid_group(G), Raw),
|
|
93
|
-
|
|
93
|
+
sort(Raw, Groups).
|
|
94
94
|
|
|
95
95
|
subgroups(d3_group, Groups) :-
|
|
96
96
|
all_subgroups(Groups).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
% Eyelet-inspired Dijkstra example using findall/3 and
|
|
1
|
+
% Eyelet-inspired Dijkstra example using findall/3 and sort/2.
|
|
2
2
|
% The priority queue is represented as sorted list entries [Cost, Node | Path].
|
|
3
3
|
% Each expansion collects unvisited neighbors with findall/3, appends them to
|
|
4
|
-
% the frontier, and uses
|
|
4
|
+
% the frontier, and uses sort/2 so the cheapest frontier entry is processed next.
|
|
5
5
|
|
|
6
6
|
%% goal: shortestPath(X0, X1)
|
|
7
7
|
|
|
@@ -34,7 +34,7 @@ dijkstra_queue([[Cost, Node | Path] | Queue], Goal, Visited, Resultpath, Resultc
|
|
|
34
34
|
(edge(Node, Neighbor, Weight), \+ member(Neighbor, Visited), (Newcost is Cost + Weight)),
|
|
35
35
|
Neighbors),
|
|
36
36
|
append(Queue, Neighbors, Newqueue),
|
|
37
|
-
|
|
37
|
+
sort(Newqueue, Sortedqueue),
|
|
38
38
|
dijkstra_queue(Sortedqueue, Goal, [Node | Visited], Resultpath, Resultcost).
|
|
39
39
|
|
|
40
40
|
shortestPath(dijkstra_findall_sort, Path) :-
|
package/examples/enigma1225.pl
CHANGED
|
@@ -89,7 +89,7 @@ eval_matrix(Matrix, FreqSorted) :-
|
|
|
89
89
|
setof(E, member(E, Entries), Set),
|
|
90
90
|
maplist(count_var(Entries), Set, Multiplicities),
|
|
91
91
|
zip(Multiplicities, Set, Frequencies),
|
|
92
|
-
|
|
92
|
+
sort(Frequencies, FreqSorted),
|
|
93
93
|
maplist(snd, FreqSorted, VarsSorted),
|
|
94
94
|
length(VarsSorted, NVars),
|
|
95
95
|
from_to(1, NVars, VarsSorted).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
% Eyelet-inspired Eulerian path example using findall/3 and
|
|
1
|
+
% Eyelet-inspired Eulerian path example using findall/3 and sort/2.
|
|
2
2
|
%
|
|
3
3
|
% The graph is undirected; edges have identifiers so the trail consumes each
|
|
4
4
|
% physical edge exactly once even when vertices are revisited. The remaining
|
|
@@ -49,15 +49,15 @@ odd_degree(V) :-
|
|
|
49
49
|
|
|
50
50
|
odd_vertices(Odds) :-
|
|
51
51
|
findall(V, odd_degree(V), Raw),
|
|
52
|
-
|
|
52
|
+
sort(Raw, Odds).
|
|
53
53
|
|
|
54
54
|
all_edges(Edges) :-
|
|
55
55
|
findall(E, edge(E, _a, _b), Raw),
|
|
56
|
-
|
|
56
|
+
sort(Raw, Edges).
|
|
57
57
|
|
|
58
58
|
vertices(Vertices) :-
|
|
59
59
|
findall(V, vertex(V), Raw),
|
|
60
|
-
|
|
60
|
+
sort(Raw, Vertices).
|
|
61
61
|
|
|
62
62
|
eulerian_start(Start) :-
|
|
63
63
|
odd_vertices([Start, _end]).
|
|
@@ -102,13 +102,13 @@ border_count(36).
|
|
|
102
102
|
|
|
103
103
|
all_countries_coloured(map_eu) :-
|
|
104
104
|
findall(Country, valid_assignment(Country), Countries),
|
|
105
|
-
|
|
105
|
+
sort(Countries, Uniquecountries),
|
|
106
106
|
length(Uniquecountries, Count),
|
|
107
107
|
country_count(Count).
|
|
108
108
|
|
|
109
109
|
all_borders_checked(map_eu) :-
|
|
110
110
|
findall([A, B], border_colours_differ(A, B), Borders),
|
|
111
|
-
|
|
111
|
+
sort(Borders, Uniqueborders),
|
|
112
112
|
length(Uniqueborders, Count),
|
|
113
113
|
border_count(Count).
|
|
114
114
|
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
complex_power(sqrt_minus_one, [-1, 0], [0.5, 0], [6.123233995736766e-17, 1.0]).
|
|
2
|
+
complex_power(e_to_i_pi, [2.718281828459045, 0], [0, 3.141592653589793], [-1.0, 1.2246467991473532e-16]).
|
|
1
3
|
complex_power(i_to_i, [0, 1], [0, 1], [0.20787957635076193, 0.0]).
|
|
4
|
+
complex_power(e_to_minus_pi_over_two, [2.718281828459045, 0], [-1.57079632679, 0], [0.20787957635177984, 0.0]).
|
|
5
|
+
complex_function(asin, two, [2, 0], [1.5707963267948966, 1.3169578969248166]).
|
|
6
|
+
complex_function(acos, two, [2, 0], [0.0, -1.3169578969248166]).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
enigma1225(8, [[2, 1, 4, 3, 6, 5, 8, 7], [[
|
|
1
|
+
enigma1225(8, [[2, 1, 4, 3, 6, 5, 8, 7], [[1, 1, 2, 3, 4, 5, 6, 7], [1, 1, 3, 2, 5, 4, 7, 6], [3, 2, 8, 8, 9, 10, 11, 12], [2, 3, 8, 8, 10, 9, 12, 11], [5, 4, 10, 9, 13, 13, 14, 15], [4, 5, 9, 10, 13, 13, 15, 14], [7, 6, 12, 11, 15, 14, 16, 16], [6, 7, 11, 12, 14, 15, 16, 16]], 544]).
|