eyeling 1.34.2 → 1.34.3
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 +2 -3
- package/docs/eyelang-guide.md +4 -21
- package/docs/eyelang-language-reference.md +1 -1
- package/examples/eyelang/basic-monadic.pl +16 -2
- package/examples/eyelang/output/basic-monadic.pl +1314 -1314
- package/examples/eyelang/output/path-discovery.pl +3 -3
- package/examples/eyelang/path-discovery.pl +22 -7
- package/lib/eyelang/builtins/registry.js +1 -2
- package/package.json +1 -1
- package/test/eyelang/conformance/README.md +1 -1
- package/examples/eyelang/dense-hamiltonian-cycle.pl +0 -92
- package/examples/eyelang/hamiltonian-cycle.pl +0 -55
- package/examples/eyelang/n-queens.pl +0 -23
- package/examples/eyelang/output/dense-hamiltonian-cycle.pl +0 -4
- package/examples/eyelang/output/hamiltonian-cycle.pl +0 -4
- package/examples/eyelang/output/n-queens.pl +0 -93
- package/examples/eyelang/output/quine-mccluskey.pl +0 -3
- package/examples/eyelang/output/sat-dpll.pl +0 -5
- package/examples/eyelang/output/traveling-salesman.pl +0 -1
- package/examples/eyelang/quine-mccluskey.pl +0 -143
- package/examples/eyelang/sat-dpll.pl +0 -80
- package/examples/eyelang/traveling-salesman.pl +0 -64
- package/lib/eyelang/builtins/search.js +0 -519
- package/test/eyelang/conformance/cases/extension/042_n_queens_small.pl +0 -3
- package/test/eyelang/conformance/cases/extension/043_cnf_model.pl +0 -3
- package/test/eyelang/conformance/expected/extension/042_n_queens_small.out +0 -2
- package/test/eyelang/conformance/expected/extension/043_cnf_model.out +0 -1
package/README.md
CHANGED
|
@@ -819,7 +819,7 @@ Formula-aware built-ins make Eyeling useful for meta-reasoning. `log:includes`,
|
|
|
819
819
|
|
|
820
820
|
### eyelang built-ins
|
|
821
821
|
|
|
822
|
-
The eyelang engine has its own built-in registry under `lib/eyelang/builtins/`. These are separate from the N3 namespaces above and are called as ordinary eyelang predicates. See the [eyelang language reference](docs/eyelang-language-reference.md#9-standard-built-in-predicates) for the portable profile. The bundled implementation currently registers
|
|
822
|
+
The eyelang engine has its own built-in registry under `lib/eyelang/builtins/`. These are separate from the N3 namespaces above and are called as ordinary eyelang predicates. See the [eyelang language reference](docs/eyelang-language-reference.md#9-standard-built-in-predicates) for the portable profile. The bundled implementation currently registers 59 name/arity entries across 57 predicate names:
|
|
823
823
|
|
|
824
824
|
| Family | Count | Built-ins |
|
|
825
825
|
|---|---:|---|
|
|
@@ -830,10 +830,9 @@ The eyelang engine has its own built-in registry under `lib/eyelang/builtins/`.
|
|
|
830
830
|
| Aggregation | 5 | `findall/3`, `countall/2`, `sumall/3`, `aggregate_min/5`, `aggregate_max/5` |
|
|
831
831
|
| Control | 2 | `not/1`, `once/1` |
|
|
832
832
|
| Context terms | 2 | `holds/2`, `holds/3` |
|
|
833
|
-
| Search and optimization helpers | 9 | `n_queens/2`, `weighted_hamiltonian_cycle/4`, `weighted_hamiltonian_path/4`, `hamiltonian_cycle/3`, `fixed_length_cycle/4`, `bounded_path/5`, `cnf_model/3`, `qm_prime_implicants/4`, `qm_minimal_cover/4` |
|
|
834
833
|
| Numeric extension helpers | 4 | `extended_gcd/5`, `collatz_trajectory/2`, `kaprekar_steps/2`, `goldbach_pair/3` |
|
|
835
834
|
| Matrix helpers | 6 | `matrix_sum/2`, `matrix_multiply/2`, `cholesky_decomposition/2`, `determinant/2`, `matrix_inv_triang/2`, `matrix_inversion/2` |
|
|
836
|
-
| **Total** | **
|
|
835
|
+
| **Total** | **59** | |
|
|
837
836
|
|
|
838
837
|
## Custom built-ins
|
|
839
838
|
|
package/docs/eyelang-guide.md
CHANGED
|
@@ -240,7 +240,7 @@ The CLI is output-oriented and uses `materialize/2` to decide what to print. Emb
|
|
|
240
240
|
Add `-s` or `--stats` when you want lightweight solver counters on stderr without changing stdout:
|
|
241
241
|
|
|
242
242
|
```sh
|
|
243
|
-
eyeling --engine eyelang -s examples/eyelang/
|
|
243
|
+
eyeling --engine eyelang -s examples/eyelang/observability-log-correlation.pl
|
|
244
244
|
```
|
|
245
245
|
|
|
246
246
|
The playground has matching `--stats` and `--proof` checkboxes, so browser runs can show the same counters or explanations like the CLI.
|
|
@@ -250,18 +250,7 @@ The playground has matching `--stats` and `--proof` checkboxes, so browser runs
|
|
|
250
250
|
|
|
251
251
|
eyelang builtins are registered by name and arity in small modules under [`lib/eyelang/builtins`](../lib/eyelang/builtins). This keeps the runtime portable to Node.js and the browser while giving each builtin family a clear boundary. Builtins are enabled by normal predicate calls.
|
|
252
252
|
|
|
253
|
-
The
|
|
254
|
-
|
|
255
|
-
```prolog
|
|
256
|
-
answer(Queens) :-
|
|
257
|
-
n_queens(8, Queens).
|
|
258
|
-
|
|
259
|
-
best(Cycle, Cost) :-
|
|
260
|
-
cities(Cities),
|
|
261
|
-
weighted_hamiltonian_cycle(edge, Cities, Cycle, Cost).
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
The reusable search and numeric helpers include `n_queens/2`, Hamiltonian path/cycle helpers, `bounded_path/5`, `cnf_model/3`, Quine-McCluskey helpers, number-theory helpers such as `extended_gcd/5`, and matrix helpers such as `matrix_multiply/2`. These helpers are extension builtins of this implementation; [the eyelang language reference](eyelang-language-reference.md) defines the portable core and standard builtin profile. The complete bundled implementation list is kept in the top-level [README built-ins section](../README.md#built-ins-1), and the regression suite checks that table against the actual runtime registry.
|
|
253
|
+
The builtin families cover unification, arithmetic, comparison, dates, strings, lists, aggregation, context terms, search control, number-theory helpers, and matrix helpers. The previous finite-search helper module has been removed because those predicates were too example-specific to be reusable. Examples that are still practical with ordinary relations and reusable list/arithmetic builtins have been rewritten in that style; only the examples that depended on non-portable shortcuts were dropped. The complete bundled implementation list is kept in the top-level [README built-ins section](../README.md#built-ins-1), and the regression suite checks that table against the actual runtime registry.
|
|
265
254
|
|
|
266
255
|
To add a builtin, create or extend a module with `register(registry)` and call `registry.add(name, arity, handler, options)`. The default registry is assembled in [`lib/eyelang/builtins/registry.js`](../lib/eyelang/builtins/registry.js). Builtins that are only safe for specific argument modes should provide a `ready` predicate and `fallbackWhenNotReady: true`, so user-defined clauses remain visible until the builtin is applicable.
|
|
267
256
|
|
|
@@ -320,7 +309,7 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
320
309
|
| [`annotation.pl`](../examples/eyelang/annotation.pl) | Derives facts from quoted annotation data. | [`output/annotation.pl`](../examples/eyelang/output/annotation.pl) |
|
|
321
310
|
| [`auroracare.pl`](../examples/eyelang/auroracare.pl) | Evaluates purpose-based medical data access scenarios. | [`output/auroracare.pl`](../examples/eyelang/output/auroracare.pl) |
|
|
322
311
|
| [`backward.pl`](../examples/eyelang/backward.pl) | Shows a backward-rule pattern as a goal-directed numeric rule. | [`output/backward.pl`](../examples/eyelang/output/backward.pl) |
|
|
323
|
-
| [`basic-monadic.pl`](../examples/eyelang/basic-monadic.pl) | Runs
|
|
312
|
+
| [`basic-monadic.pl`](../examples/eyelang/basic-monadic.pl) | Runs the basic monadic benchmark with explicit indexed edge joins instead of specialized search builtins. | [`output/basic-monadic.pl`](../examples/eyelang/output/basic-monadic.pl) |
|
|
324
313
|
| [`bayes-diagnosis.pl`](../examples/eyelang/bayes-diagnosis.pl) | Computes scaled Bayesian diagnosis posteriors. | [`output/bayes-diagnosis.pl`](../examples/eyelang/output/bayes-diagnosis.pl) |
|
|
325
314
|
| [`bayes-therapy.pl`](../examples/eyelang/bayes-therapy.pl) | Ranks therapies using Bayesian disease likelihoods. | [`output/bayes-therapy.pl`](../examples/eyelang/output/bayes-therapy.pl) |
|
|
326
315
|
| [`beam-deflection.pl`](../examples/eyelang/beam-deflection.pl) | Computes cantilever beam deflection. | [`output/beam-deflection.pl`](../examples/eyelang/output/beam-deflection.pl) |
|
|
@@ -351,7 +340,6 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
351
340
|
| [`deep-taxonomy-10000.pl`](../examples/eyelang/deep-taxonomy-10000.pl) | Stress-tests recursive taxonomy depth 10000. | [`output/deep-taxonomy-10000.pl`](../examples/eyelang/output/deep-taxonomy-10000.pl) |
|
|
352
341
|
| [`deep-taxonomy-100000.pl`](../examples/eyelang/deep-taxonomy-100000.pl) | Stress-tests recursive taxonomy depth 100000. | [`output/deep-taxonomy-100000.pl`](../examples/eyelang/output/deep-taxonomy-100000.pl) |
|
|
353
342
|
| [`delfour.pl`](../examples/eyelang/delfour.pl) | Derives shopping and authorization recommendations. | [`output/delfour.pl`](../examples/eyelang/output/delfour.pl) |
|
|
354
|
-
| [`dense-hamiltonian-cycle.pl`](../examples/eyelang/dense-hamiltonian-cycle.pl) | Searches a dense Hamiltonian cycle with aggregate minimization. | [`output/dense-hamiltonian-cycle.pl`](../examples/eyelang/output/dense-hamiltonian-cycle.pl) |
|
|
355
343
|
| [`deontic-logic.pl`](../examples/eyelang/deontic-logic.pl) | Reports obligations, prohibitions, and violations. | [`output/deontic-logic.pl`](../examples/eyelang/output/deontic-logic.pl) |
|
|
356
344
|
| [`derived-backward-rule.pl`](../examples/eyelang/derived-backward-rule.pl) | Derives an inverse-property backward rule from rule data. | [`output/derived-backward-rule.pl`](../examples/eyelang/output/derived-backward-rule.pl) |
|
|
357
345
|
| [`derived-rule.pl`](../examples/eyelang/derived-rule.pl) | Derives conclusions from rule data. | [`output/derived-rule.pl`](../examples/eyelang/output/derived-rule.pl) |
|
|
@@ -391,7 +379,6 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
391
379
|
| [`gray-code-counter.pl`](../examples/eyelang/gray-code-counter.pl) | Generates Gray-code counter states. | [`output/gray-code-counter.pl`](../examples/eyelang/output/gray-code-counter.pl) |
|
|
392
380
|
| [`greatest-lower-bound-uniqueness.pl`](../examples/eyelang/greatest-lower-bound-uniqueness.pl) | Shows uniqueness of greatest lower bounds in a finite order instance. | [`output/greatest-lower-bound-uniqueness.pl`](../examples/eyelang/output/greatest-lower-bound-uniqueness.pl) |
|
|
393
381
|
| [`group-inverse-uniqueness.pl`](../examples/eyelang/group-inverse-uniqueness.pl) | Shows uniqueness of inverses in a finite group instance. | [`output/group-inverse-uniqueness.pl`](../examples/eyelang/output/group-inverse-uniqueness.pl) |
|
|
394
|
-
| [`hamiltonian-cycle.pl`](../examples/eyelang/hamiltonian-cycle.pl) | Finds a Hamiltonian cycle. | [`output/hamiltonian-cycle.pl`](../examples/eyelang/output/hamiltonian-cycle.pl) |
|
|
395
382
|
| [`hamiltonian-path.pl`](../examples/eyelang/hamiltonian-path.pl) | Finds a Hamiltonian path. | [`output/hamiltonian-path.pl`](../examples/eyelang/output/hamiltonian-path.pl) |
|
|
396
383
|
| [`hamming-code.pl`](../examples/eyelang/hamming-code.pl) | Corrects a single-bit Hamming word. | [`output/hamming-code.pl`](../examples/eyelang/output/hamming-code.pl) |
|
|
397
384
|
| [`hanoi.pl`](../examples/eyelang/hanoi.pl) | Derives the Towers of Hanoi moves. | [`output/hanoi.pl`](../examples/eyelang/output/hanoi.pl) |
|
|
@@ -409,7 +396,6 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
409
396
|
| [`matrix.pl`](../examples/eyelang/matrix.pl) | Runs matrix operations over sample inputs. | [`output/matrix.pl`](../examples/eyelang/output/matrix.pl) |
|
|
410
397
|
| [`microgrid-dispatch.pl`](../examples/eyelang/microgrid-dispatch.pl) | Plans microgrid dispatch and reserve. | [`output/microgrid-dispatch.pl`](../examples/eyelang/output/microgrid-dispatch.pl) |
|
|
411
398
|
| [`monkey-bananas.pl`](../examples/eyelang/monkey-bananas.pl) | Solves the monkey-and-bananas puzzle. | [`output/monkey-bananas.pl`](../examples/eyelang/output/monkey-bananas.pl) |
|
|
412
|
-
| [`n-queens.pl`](../examples/eyelang/n-queens.pl) | Searches for N-queens placements. | [`output/n-queens.pl`](../examples/eyelang/output/n-queens.pl) |
|
|
413
399
|
| [`network-sla.pl`](../examples/eyelang/network-sla.pl) | Checks network path SLA compliance. | [`output/network-sla.pl`](../examples/eyelang/output/network-sla.pl) |
|
|
414
400
|
| [`newton-raphson.pl`](../examples/eyelang/newton-raphson.pl) | Finds roots by Newton-Raphson iteration. | [`output/newton-raphson.pl`](../examples/eyelang/output/newton-raphson.pl) |
|
|
415
401
|
| [`nixon-diamond.pl`](../examples/eyelang/nixon-diamond.pl) | Reports the classic Nixon-diamond conflict. | [`output/nixon-diamond.pl`](../examples/eyelang/output/nixon-diamond.pl) |
|
|
@@ -425,10 +411,8 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
425
411
|
| [`polynomial.pl`](../examples/eyelang/polynomial.pl) | Finds complex integer polynomial roots. | [`output/polynomial.pl`](../examples/eyelang/output/polynomial.pl) |
|
|
426
412
|
| [`proof-contrapositive.pl`](../examples/eyelang/proof-contrapositive.pl) | Models proof by contrapositive. | [`output/proof-contrapositive.pl`](../examples/eyelang/output/proof-contrapositive.pl) |
|
|
427
413
|
| [`quadratic-formula.pl`](../examples/eyelang/quadratic-formula.pl) | Solves sample quadratic equations. | [`output/quadratic-formula.pl`](../examples/eyelang/output/quadratic-formula.pl) |
|
|
428
|
-
| [`quine-mccluskey.pl`](../examples/eyelang/quine-mccluskey.pl) | Minimizes Boolean terms with Quine-McCluskey. | [`output/quine-mccluskey.pl`](../examples/eyelang/output/quine-mccluskey.pl) |
|
|
429
414
|
| [`radioactive-decay.pl`](../examples/eyelang/radioactive-decay.pl) | Computes radioactive decay over time. | [`output/radioactive-decay.pl`](../examples/eyelang/output/radioactive-decay.pl) |
|
|
430
415
|
| [`riemann-hypothesis.pl`](../examples/eyelang/riemann-hypothesis.pl) | Checks a finite catalogue of non-trivial zeta zeros against the Riemann-hypothesis condition. | [`output/riemann-hypothesis.pl`](../examples/eyelang/output/riemann-hypothesis.pl) |
|
|
431
|
-
| [`sat-dpll.pl`](../examples/eyelang/sat-dpll.pl) | Solves a finite SAT instance. | [`output/sat-dpll.pl`](../examples/eyelang/output/sat-dpll.pl) |
|
|
432
416
|
| [`security-incident-correlation.pl`](../examples/eyelang/security-incident-correlation.pl) | Correlates security incidents across signals. | [`output/security-incident-correlation.pl`](../examples/eyelang/output/security-incident-correlation.pl) |
|
|
433
417
|
| [`service-impact.pl`](../examples/eyelang/service-impact.pl) | Analyzes service impact over cyclic dependencies. | [`output/service-impact.pl`](../examples/eyelang/output/service-impact.pl) |
|
|
434
418
|
| [`sieve.pl`](../examples/eyelang/sieve.pl) | Enumerates primes with a sieve-style program. | [`output/sieve.pl`](../examples/eyelang/output/sieve.pl) |
|
|
@@ -438,7 +422,6 @@ The repository includes examples for recursion, graph reachability, finite searc
|
|
|
438
422
|
| [`socrates.pl`](../examples/eyelang/socrates.pl) | Derives that Socrates is mortal. | [`output/socrates.pl`](../examples/eyelang/output/socrates.pl) |
|
|
439
423
|
| [`statistics-summary.pl`](../examples/eyelang/statistics-summary.pl) | Computes population statistics for a sample. | [`output/statistics-summary.pl`](../examples/eyelang/output/statistics-summary.pl) |
|
|
440
424
|
| [`superdense-coding.pl`](../examples/eyelang/superdense-coding.pl) | Models superdense-coding bit transmission. | [`output/superdense-coding.pl`](../examples/eyelang/output/superdense-coding.pl) |
|
|
441
|
-
| [`traveling-salesman.pl`](../examples/eyelang/traveling-salesman.pl) | Finds an optimal traveling-salesman tour. | [`output/traveling-salesman.pl`](../examples/eyelang/output/traveling-salesman.pl) |
|
|
442
425
|
| [`trust-flow-provenance-threshold.pl`](../examples/eyelang/trust-flow-provenance-threshold.pl) | Classifies message trust from provenance confidence scores. | [`output/trust-flow-provenance-threshold.pl`](../examples/eyelang/output/trust-flow-provenance-threshold.pl) |
|
|
443
426
|
| [`turing.pl`](../examples/eyelang/turing.pl) | Simulates a binary-increment Turing machine. | [`output/turing.pl`](../examples/eyelang/output/turing.pl) |
|
|
444
427
|
| [`vector-similarity.pl`](../examples/eyelang/vector-similarity.pl) | Computes dot product, norm, and cosine similarity. | [`output/vector-similarity.pl`](../examples/eyelang/output/vector-similarity.pl) |
|
|
@@ -500,7 +483,7 @@ eyeling --engine eyelang --help
|
|
|
500
483
|
Useful profiling smoke test:
|
|
501
484
|
|
|
502
485
|
```sh
|
|
503
|
-
eyeling --engine eyelang -s examples/eyelang/
|
|
486
|
+
eyeling --engine eyelang -s examples/eyelang/observability-log-correlation.pl > /dev/null
|
|
504
487
|
```
|
|
505
488
|
|
|
506
489
|
For a release:
|
|
@@ -473,7 +473,7 @@ An extension built-in SHOULD obey the same surface-language discipline as standa
|
|
|
473
473
|
- it SHOULD document its intended modes, especially which arguments must be ground before it runs deterministically;
|
|
474
474
|
- it MUST NOT change the meaning of ordinary facts, rules, unification, or standard built-ins.
|
|
475
475
|
|
|
476
|
-
For example, an implementation may include extension modules for number-theory algorithms,
|
|
476
|
+
For example, an implementation may include extension modules for number-theory algorithms, matrix operations, or host-specific integrations. Those modules may be valuable and may make example programs much faster, but their predicate names, arities, algorithms, and modes are implementation-defined unless they are separately standardized.
|
|
477
477
|
|
|
478
478
|
An implementation that provides explanation output SHOULD make extension built-ins explainable at least as opaque successful or failed built-in calls, so that proof traces do not incorrectly report "no clauses" for a host-provided relation.
|
|
479
479
|
|
|
@@ -10014,5 +10014,19 @@ edge(i48, i89, i48).
|
|
|
10014
10014
|
edge(i26, i42, i54).
|
|
10015
10015
|
|
|
10016
10016
|
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
10017
|
-
|
|
10018
|
-
|
|
10017
|
+
%
|
|
10018
|
+
% Keep this example independent from specialized search builtins by spelling out the
|
|
10019
|
+
% ten-edge monadic benchmark directly. The left-to-right shape binds the next
|
|
10020
|
+
% node before the next edge lookup, so the ordinary predicate indexes can keep the
|
|
10021
|
+
% query finite and selective.
|
|
10022
|
+
cycle(R, [D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D0]) :-
|
|
10023
|
+
edge(D0, R, D1),
|
|
10024
|
+
edge(D1, R, D2),
|
|
10025
|
+
edge(D2, R, D3),
|
|
10026
|
+
edge(D3, R, D4),
|
|
10027
|
+
edge(D4, R, D5),
|
|
10028
|
+
edge(D5, R, D6),
|
|
10029
|
+
edge(D6, R, D7),
|
|
10030
|
+
edge(D7, R, D8),
|
|
10031
|
+
edge(D8, R, D9),
|
|
10032
|
+
edge(D9, R, D0).
|