eyeprolog 1.3.39 → 1.3.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -91,6 +91,11 @@ execution as positive STO evidence, and rejects `sto` when a finite execution
91
91
  completes without such an event (for example `?- true. sto.`). If execution is
92
92
  cut short by a search/resource boundary, the STO claim remains conservatively
93
93
  unverified rather than being guessed.
94
+ For nontermination expectations, `loops` is kept distinct from resource
95
+ exhaustion: structural loop evidence may satisfy `loops`, while a bounded
96
+ search that cannot establish the requested answer sequence is reported as
97
+ `UNDECIDED`. In CLI quad mode, failures use exit status `1`; if there are no
98
+ failures but at least one undecided quad, the exit status is `2`.
94
99
 
95
100
  ## Tabling and well-founded negation
96
101
 
@@ -248,3 +248,4 @@ npm run generate
248
248
  ## Chapter 40: Running EyeProlog: command line and corpus
249
249
 
250
250
  - [01-color.pl](chapter-40/01-color.pl) — Embedded quad tests
251
+ - [02-program.pl](chapter-40/02-program.pl)
@@ -0,0 +1,5 @@
1
+ % From The Art of EyeProlog, Chapter 40.
2
+ inf :- inf, inf.
3
+
4
+ ?- inf.
5
+ loops.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.39",
6
+ "version": "1.3.40",
7
7
  "description": "EyeProlog turns facts and rules into answers and proofs.",
8
8
  "type": "module",
9
9
  "main": "./index.js",
@@ -6896,26 +6896,67 @@ described answer or error, including output produced before a later exception.
6896
6896
  Its argument may be an exact character list/string or a DCG body: terminal
6897
6897
  sequences, conjunction/disjunction, `...`/`ad_infinitum` sequence wildcards,
6898
6898
  and user-defined DCG nonterminals are matched against the captured characters.
6899
- Following Trealla's quad convention, `sto` declares that the query is subject
6900
- to occurs-check; the answer portion of an `sto`-annotated leaf remains
6901
- implementation-dependent and is not compared. EyeProlog can nevertheless check
6902
- some of the declaration without a second execution: the normal finite-tree
6903
- unifier records a concrete occurs-check event as positive STO evidence. A
6904
- naturally completed finite execution with no such event disproves `sto` (so
6905
- `?- true. sto.` fails), while a search/resource boundary leaves the declaration
6906
- conservatively unchecked. When the same quad declares STO and an occurs-check
6907
- event is observed, an unannotated `unexpected` leaf does not reject an outcome
6908
- that is implementation-dependent precisely because the query is STO. This is
6909
- partial STO detection, not a decision procedure for the full STO/NSTO property.
6910
- `loops` explicitly asks for bounded nontermination evidence and accepts direct
6911
- active-variant cycle evidence from EyeProlog's normal recursion guard, with the
6912
- loop depth/inference bounds as a fallback. Ordinary quad descriptions also have
6913
- a finite inference budget (100000 by default); exhausting it does **not** mean
6914
- `loops` or `false`, but produces an `UNDECIDED` result. The JavaScript API may
6915
- override this with `quadMaxInferences`, while `loopMaxDepth` and
6916
- `loopMaxInferences` control the explicit `loops` probe. The advanced stream
6917
- annotations `peeks/1` and `waits`, and the unordered `other_answer_sequence`
6918
- annotation, are not executed by the current runner.
6899
+ The advanced stream annotations `peeks/1` and `waits`, and the unordered
6900
+ `other_answer_sequence` annotation, are not executed by the current runner.
6901
+
6902
+ #### STO, loops, and undecided quad results
6903
+
6904
+ Following Trealla's quad convention, `sto` declares that a query is subject to
6905
+ occurs-check. EyeProlog checks this conservatively rather than attempting a
6906
+ complete STO/NSTO decision procedure. During the query's ordinary execution,
6907
+ the finite-tree unifier records a concrete occurs-check event as positive STO
6908
+ evidence; the query is not run a second time merely to probe STO-ness. A finite
6909
+ execution that completes naturally without such an event disproves `sto`, while
6910
+ a search or resource boundary leaves the declaration conservatively unchecked.
6911
+ The answer portion of an `sto`-annotated leaf remains implementation-dependent
6912
+ and is therefore not compared.
6913
+
6914
+ For example, the cyclic binding in the first query provides positive STO
6915
+ evidence, whereas the second query is finite and cannot be STO:
6916
+
6917
+ ```eyeprolog
6918
+ ?- X = s(X).
6919
+ X = ..., unexpected.
6920
+ false, unexpected.
6921
+ sto, false
6922
+ | sto, true.
6923
+
6924
+ ?- true.
6925
+ sto. % fails: no STO evidence
6926
+ ```
6927
+
6928
+ When a quad declares STO and the execution observes an occurs-check event, an
6929
+ unannotated `unexpected` leaf does not reject the implementation-dependent
6930
+ finite-tree outcome. This is partial STO detection only: EyeProlog makes a
6931
+ definite statement where execution provides definite evidence and otherwise
6932
+ does not guess.
6933
+
6934
+ `loops` is kept distinct from merely exhausting the quad runner's resources.
6935
+ EyeProlog accepts structural nontermination evidence such as an active-variant
6936
+ recursion cycle, with the loop depth/inference bounds as a bounded fallback:
6937
+
6938
+ ```eyeprolog
6939
+ inf :- inf, inf.
6940
+
6941
+ ?- inf.
6942
+ loops.
6943
+ ```
6944
+
6945
+ Ordinary answer descriptions also have a finite inference budget (100000 by
6946
+ default). Exhausting that budget does **not** establish `loops` and does not
6947
+ turn an unfinished search into `false`; instead the description is reported as
6948
+ `UNDECIDED`, for example:
6949
+
6950
+ ```text
6951
+ quads: UNDECIDED expensive_case, program.pl:12
6952
+ undecided: inference limit reached.
6953
+ ```
6954
+
6955
+ Thus quad execution has three useful outcomes: passed, failed, and undecided.
6956
+ When there are no failures but at least one undecided description, the CLI exits
6957
+ with status `2`. The JavaScript API may override the ordinary search budget with
6958
+ `quadMaxInferences`; `loopMaxDepth` and `loopMaxInferences` control the explicit
6959
+ `loops` probe.
6919
6960
 
6920
6961
  The JavaScript API exposes the same operation without process I/O:
6921
6962