eyeprolog 1.0.3 → 1.1.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 +10 -9
- package/conformance-report.md +3 -2
- package/examples/age.pl +2 -0
- package/examples/aliases-and-namespaces.pl +2 -0
- package/examples/allen-interval-calculus.pl +2 -0
- package/examples/binomial-vandermonde.pl +2 -0
- package/examples/blocks-world-planning.pl +2 -0
- package/examples/book/chapter-02/02-measurement.pl +3 -0
- package/examples/book/chapter-03/01-eligible.pl +3 -0
- package/examples/book/chapter-03/02-adult.pl +3 -0
- package/examples/book/chapter-04/02-path.pl +3 -0
- package/examples/book/chapter-06/01-next.pl +3 -0
- package/examples/book/chapter-06/03-square.pl +3 -0
- package/examples/book/chapter-08/01-findall.pl +3 -0
- package/examples/book/chapter-08/02-outgoing_costs.pl +3 -0
- package/examples/book/chapter-08/03-best_route.pl +3 -0
- package/examples/book/chapter-09/02-normalized.pl +3 -0
- package/examples/book/chapter-09/03-message.pl +3 -0
- package/examples/book/chapter-10/02-plan.pl +3 -0
- package/examples/book/chapter-11/01-why.pl +3 -0
- package/examples/book/chapter-17/01-path.pl +3 -0
- package/examples/book/chapter-17/02-adult.pl +3 -0
- package/examples/book/chapter-17/03-bad_member.pl +3 -0
- package/examples/book/chapter-18/01-routeable.pl +3 -0
- package/examples/book/chapter-18/02-routeable-2.pl +3 -0
- package/examples/book/chapter-21/03-loop_edge.pl +3 -0
- package/examples/book/chapter-21/04-eligible.pl +3 -0
- package/examples/book/chapter-22/02-tree_member.pl +3 -0
- package/examples/book/chapter-22/06-lookup.pl +3 -0
- package/examples/book/chapter-23/01-adult.pl +3 -0
- package/examples/book/chapter-23/02-adult-2.pl +3 -0
- package/examples/book/chapter-23/03-can_board.pl +3 -0
- package/examples/book/chapter-23/04-traveler_in_good_standing.pl +3 -0
- package/examples/book/chapter-24/02-simple_path.pl +3 -0
- package/examples/book/chapter-24/03-reachable.pl +3 -0
- package/examples/book/chapter-24/04-best_plan.pl +3 -0
- package/examples/book/chapter-25/01-person.pl +3 -0
- package/examples/book/chapter-25/02-active_badge.pl +3 -0
- package/examples/book/chapter-25/04-permit.pl +3 -0
- package/examples/book/chapter-26/02-triple.pl +3 -0
- package/examples/book/chapter-26/03-triple-2.pl +3 -0
- package/examples/book/chapter-26/04-edge.pl +3 -0
- package/examples/book/chapter-27/02-list_length.pl +3 -0
- package/examples/book/chapter-28/02-triangle.pl +3 -0
- package/examples/book/chapter-28/03-rectangle.pl +3 -0
- package/examples/book/chapter-28/04-integer_rectangle.pl +3 -0
- package/examples/book/chapter-28/05-preserves_combine.pl +3 -0
- package/examples/book/chapter-29/01-counterexample_to_odd_square.pl +3 -0
- package/examples/book/chapter-31/01-edge.pl +3 -0
- package/examples/book/chapter-31/03-double.pl +3 -0
- package/examples/book/chapter-32/01-eligible.pl +3 -0
- package/examples/book/chapter-32/02-eligible-2.pl +3 -0
- package/examples/book/chapter-32/03-candidate_debug.pl +3 -0
- package/examples/book/chapter-32/04-reference_square.pl +3 -0
- package/examples/book/chapter-33/01-assigned_badge.pl +3 -0
- package/examples/book/chapter-33/02-source_role.pl +3 -0
- package/examples/book/chapter-33/03-chosen_pair.pl +3 -0
- package/examples/book/chapter-33/04-path.pl +3 -0
- package/examples/book/chapter-33/09-invalid_badge_assignment.pl +3 -0
- package/examples/book/chapter-34/03-regional_total.pl +3 -0
- package/examples/book/chapter-38/01-city.pl +3 -0
- package/examples/book/chapter-39/01-answer.pl +3 -0
- package/examples/book/chapter-39/02-answer-2.pl +3 -0
- package/examples/book/chapter-39/03-answer-3.pl +3 -0
- package/examples/book/chapter-39/04-cost.pl +3 -0
- package/examples/book/chapter-39/05-message.pl +3 -0
- package/examples/catalan-convolution.pl +2 -0
- package/examples/cdcl-sat-solver.pl +2 -0
- package/examples/chart-parser.pl +2 -0
- package/examples/collatz-1000.pl +2 -0
- package/examples/combinatorics-findall-sort.pl +2 -0
- package/examples/context-schema-audit.pl +2 -0
- package/examples/continued-fraction-sqrt2.pl +2 -0
- package/examples/critical-path-schedule.pl +2 -0
- package/examples/d3-group.pl +2 -0
- package/examples/data-negotiation.pl +2 -0
- package/examples/delfour.pl +3 -0
- package/examples/dijkstra-findall-sort.pl +2 -0
- package/examples/dijkstra.pl +2 -0
- package/examples/dog.pl +2 -0
- package/examples/donald-gerald-robert.pl +2 -0
- package/examples/drone-corridor-planner.pl +2 -0
- package/examples/easter-computus.pl +2 -0
- package/examples/enigma1225.pl +3 -0
- package/examples/equality-saturation.pl +3 -0
- package/examples/eulerian-path.pl +2 -0
- package/examples/flandor.pl +2 -0
- package/examples/four-color-map.pl +2 -0
- package/examples/fundamental-theorem-arithmetic.pl +4 -1
- package/examples/goldbach.pl +2 -0
- package/examples/gps.pl +2 -0
- package/examples/graph-reachability.pl +2 -0
- package/examples/hamiltonian-path.pl +2 -0
- package/examples/hanoi.pl +2 -0
- package/examples/integer-partitions.pl +2 -0
- package/examples/job-shop-scheduling.pl +3 -0
- package/examples/knapsack-optimization.pl +3 -0
- package/examples/knuth-bendix-completion.pl +2 -0
- package/examples/lee.pl +2 -0
- package/examples/linear-logic-resources.pl +2 -0
- package/examples/list-collection.pl +2 -0
- package/examples/map-four-color-search.pl +2 -0
- package/examples/markov-logic-network.pl +2 -0
- package/examples/matrix-chain-order.pl +3 -0
- package/examples/missionaries-cannibals.pl +3 -0
- package/examples/monkey-bananas.pl +2 -0
- package/examples/n-queens.pl +2 -0
- package/examples/observability-log-correlation.pl +2 -0
- package/examples/path-discovery.pl +3 -0
- package/examples/pell-equation.pl +2 -0
- package/examples/polynomial.pl +3 -0
- package/examples/prime-range.pl +3 -0
- package/examples/proof/iso-dynamic-database.pl +1 -1
- package/examples/quine-mccluskey.pl +2 -0
- package/examples/register-allocation.pl +3 -0
- package/examples/reusable-builtins.pl +3 -0
- package/examples/sat-solver-dpll.pl +3 -0
- package/examples/send-more-money.pl +2 -0
- package/examples/stable-marriage.pl +2 -0
- package/examples/statistics-summary.pl +2 -0
- package/examples/stirling-bell-numbers.pl +2 -0
- package/examples/sudoku.pl +3 -0
- package/examples/term-tools.pl +2 -0
- package/examples/totient-summatory.pl +3 -0
- package/examples/truth-maintenance-system.pl +2 -0
- package/examples/turing.pl +2 -0
- package/examples/uuid.pl +3 -0
- package/examples/weighted-interval-scheduling.pl +3 -0
- package/examples/wolf-goat-cabbage.pl +2 -0
- package/examples/zebra.pl +2 -0
- package/index.d.ts +7 -3
- package/package.json +1 -1
- package/src/cli.js +1 -1
- package/src/explain.js +5 -5
- package/src/index.js +3 -3
- package/src/iso.js +14 -9
- package/src/{eyeprolog-library.pl → lib/eyeprolog.pl} +37 -2
- package/src/lib/lists.pl +94 -0
- package/src/parser.js +12 -4
- package/src/program.js +222 -40
- package/src/solver.js +39 -7
- package/src/standard-library.js +60 -0
- package/src/term.js +18 -6
- package/test/conformance/cases/modules/qualified_call.pl +6 -0
- package/test/conformance/cases/modules/selective_library_import.pl +5 -0
- package/test/conformance/expected/modules/qualified_call.pl +1 -0
- package/test/conformance/expected/modules/selective_library_import.pl +1 -0
- package/test/run-conformance.mjs +10 -4
- package/test/run-playground.mjs +7 -7
- package/test/run-regression.mjs +56 -25
- package/the-art-of-eyeprolog.md +265 -55
- package/tools/extract-book-examples.mjs +1 -1
- package/why-eyeprolog.md +5 -4
- package/src/eyeprolog-autoload.js +0 -127
- package/src/eyeprolog-common-library.pl +0 -44
- package/test/conformance/errors/syntax/colon_name_rejected.pl +0 -1
- package/test/conformance/errors/syntax/unquoted_colon_predicate.pl +0 -1
- package/test/conformance/expected-errors/syntax/colon_name_rejected.txt +0 -1
- package/test/conformance/expected-errors/syntax/unquoted_colon_predicate.txt +0 -1
package/README.md
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
EyeProlog turns portable ISO Prolog programs into answers and inspectable proofs.
|
|
7
7
|
|
|
8
|
-
<p
|
|
8
|
+
<p>
|
|
9
9
|
<a href="https://eyereasoner.github.io/eyeprolog/the-art-of-eyeprolog">
|
|
10
|
-
<img src="book-assets/title-page.svg" alt="Read The Art of EyeProlog" width="
|
|
11
|
-
</a>
|
|
10
|
+
<img src="book-assets/title-page.svg" alt="Read The Art of EyeProlog" title="Click to read The Art of EyeProlog" width="320">
|
|
11
|
+
</a><br>
|
|
12
|
+
<strong>Click the cover to read <em>The Art of EyeProlog</em>.</strong>
|
|
12
13
|
</p>
|
|
13
14
|
|
|
14
15
|
**[Why EyeProlog?](https://eyereasoner.github.io/eyeprolog/why-eyeprolog)** — Discover its purpose and design.
|
|
@@ -32,14 +33,14 @@ Programs may declare their default queries with `%% goal:` comments.
|
|
|
32
33
|
Double-quoted text follows the ISO `double_quotes` flag and defaults to a
|
|
33
34
|
proper list of one-character atoms (`chars`), matching Trealla and Scryer.
|
|
34
35
|
|
|
35
|
-
##
|
|
36
|
+
## Standard library modules
|
|
36
37
|
|
|
37
38
|
EyeProlog adds 44 public library predicates to its 127-entry ISO core registry.
|
|
38
|
-
**All 44 are ordinary Prolog clauses**
|
|
39
|
-
`src/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
**All 44 are ordinary Prolog clauses** in `src/lib/eyeprolog.pl` and
|
|
40
|
+
`src/lib/lists.pl`. They are ISO/IEC 13211-2 modules, loaded explicitly with
|
|
41
|
+
`use_module(library(eyeprolog))` or `use_module(library(lists))`, following the
|
|
42
|
+
layout used by Scryer Prolog. None requires host support. Portable text
|
|
43
|
+
predicates use ISO atoms or character lists.
|
|
43
44
|
|
|
44
45
|
## Development
|
|
45
46
|
|
package/conformance-report.md
CHANGED
|
@@ -13,13 +13,14 @@ This report summarizes the file-based conformance corpus under `test/conformance
|
|
|
13
13
|
| control | 15 | 0 | 0 | 0 | 15 |
|
|
14
14
|
| iso | 130 | 174 | 0 | 0 | 304 |
|
|
15
15
|
| lists | 52 | 3 | 0 | 0 | 55 |
|
|
16
|
+
| modules | 2 | 0 | 0 | 0 | 2 |
|
|
16
17
|
| negation | 8 | 0 | 19 | 0 | 27 |
|
|
17
18
|
| proofs | 0 | 0 | 0 | 21 | 21 |
|
|
18
19
|
| query | 8 | 2 | 0 | 0 | 10 |
|
|
19
20
|
| rules | 13 | 3 | 0 | 0 | 16 |
|
|
20
21
|
| strings | 40 | 0 | 0 | 0 | 40 |
|
|
21
|
-
| syntax | 12 |
|
|
22
|
+
| syntax | 12 | 23 | 0 | 0 | 35 |
|
|
22
23
|
| terms | 26 | 3 | 0 | 0 | 29 |
|
|
23
24
|
| unification | 18 | 0 | 0 | 0 | 18 |
|
|
24
25
|
| variables | 16 | 9 | 0 | 0 | 25 |
|
|
25
|
-
| **Total** | **
|
|
26
|
+
| **Total** | **445** | **225** | **19** | **21** | **710** |
|
package/examples/age.pl
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
% From The Art of EyeProlog, Chapter 17 — The same relation, a different computation.
|
|
2
|
+
:- use_module(library(eyeprolog)).
|
|
3
|
+
:- use_module(library(lists)).
|
|
4
|
+
|
|
2
5
|
adult(Person) :- person(Person), age(Person, Age), (Age >= 18).
|
|
3
6
|
|
|
4
7
|
adult(Person) :- (Age >= 18), age(Person, Age), person(Person).
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
% From The Art of EyeProlog, Chapter 24 — Existence, one witness, and all witnesses.
|
|
2
|
+
:- use_module(library(eyeprolog)).
|
|
3
|
+
:- use_module(library(lists)).
|
|
4
|
+
|
|
2
5
|
reachable(From, To).
|
|
3
6
|
once(simple_path(From, To, Path)).
|
|
4
7
|
findall(Path, simple_path(From, To, Path), Paths).
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
% From The Art of EyeProlog, Chapter 33 — Pattern 9: Integrity before inference.
|
|
2
|
+
:- use_module(library(eyeprolog)).
|
|
3
|
+
:- use_module(library(lists)).
|
|
4
|
+
|
|
2
5
|
invalid_badge_assignment(Badge, PersonA, PersonB) :-
|
|
3
6
|
assigned_badge(PersonA, Badge),
|
|
4
7
|
assigned_badge(PersonB, Badge),
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
% From The Art of EyeProlog, Chapter 39 — The EyeProlog library.
|
|
2
|
+
:- use_module(library(eyeprolog)).
|
|
3
|
+
:- use_module(library(lists)).
|
|
4
|
+
|
|
2
5
|
answer(square, S) :- (S is 12 * 12).
|
|
3
6
|
answer(day_count, N) :- between(3, 5, N).
|
|
4
7
|
answer(age, D) :- difference('2026-07-28', '2020-05-20', D).
|