eyeling 1.33.5 → 1.33.7

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.
Files changed (34) hide show
  1. package/README.md +50 -106
  2. package/docs/eyelang-guide.md +550 -0
  3. package/docs/eyelang-language-reference.md +11 -9
  4. package/examples/eyelang/annotation.pl +9 -9
  5. package/examples/eyelang/context-association.pl +3 -3
  6. package/examples/eyelang/delfour.pl +7 -7
  7. package/examples/eyelang/dijkstra-risk-path.pl +2 -2
  8. package/examples/eyelang/dijkstra.pl +2 -2
  9. package/examples/eyelang/family-cousins.pl +1 -1
  10. package/examples/eyelang/gps.pl +4 -4
  11. package/examples/eyelang/odrl-dpv-healthcare-risk-ranked.pl +2 -2
  12. package/examples/eyelang/odrl-dpv-risk-ranked.pl +2 -2
  13. package/examples/eyelang/proof/annotation.pl +12 -12
  14. package/examples/eyelang/resilient-city-orchestration.pl +5 -5
  15. package/lib/eyelang/builtins/context.js +42 -0
  16. package/lib/eyelang/builtins/registry.js +2 -2
  17. package/package.json +1 -1
  18. package/test/eyelang/conformance/README.md +1 -1
  19. package/test/eyelang/conformance/cases/extension/006_holds_parts.pl +4 -0
  20. package/test/eyelang/conformance/cases/extension/026_nested_holds_parts.pl +4 -0
  21. package/test/eyelang/conformance/cases/extension/027_formula_member.query +1 -0
  22. package/test/eyelang/conformance/cases/extension/027_holds_member.pl +3 -0
  23. package/test/eyelang/conformance/expected/extension/006_holds_parts.out +3 -0
  24. package/test/eyelang/conformance/expected/extension/026_nested_holds_parts.out +3 -0
  25. package/test/eyelang/conformance/expected/extension/027_holds_member.out +2 -0
  26. package/test/eyelang/run-regression.mjs +2 -2
  27. package/test/packlist.test.js +1 -0
  28. package/examples/eyelang/INTEGRATION.md +0 -20
  29. package/examples/eyelang/README.md +0 -553
  30. package/lib/eyelang/builtins/formula.js +0 -26
  31. package/test/eyelang/conformance/cases/extension/006_formula_terms.pl +0 -4
  32. package/test/eyelang/conformance/cases/extension/026_nested_formula_terms.pl +0 -4
  33. package/test/eyelang/conformance/expected/extension/006_formula_terms.out +0 -2
  34. package/test/eyelang/conformance/expected/extension/026_nested_formula_terms.out +0 -3
@@ -1,553 +0,0 @@
1
- # eyelang
2
-
3
- [![npm version](https://img.shields.io/npm/v/eyelang.svg)](https://www.npmjs.com/package/eyelang)
4
- [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.1242549108-blue.svg)](https://doi.org/10.5281/zenodo.20342331)
5
-
6
- eyelang is a small rule engine for Prolog-style Horn clauses over ordinary terms, lists, arithmetic, strings, and finite search. The command-line executable is `eyelang`.
7
-
8
- Programs write relations directly, for example `ancestor(pat, emma)` or `status(case1, accepted)`. eyelang output is ordinary eyelang syntax: by default, the CLI materializes selected answer facts and prints those facts only. Pass `--proof` (or `-p`) when you also want each answer followed by a `why/2` explanation fact that records the proof. Programs may add `materialize(Name, Arity).` declarations to focus output on selected predicates.
9
-
10
-
11
- Try it in the [browser playground](https://eyereasoner.github.io/eyelang/playground). The playground includes run options equivalent to CLI `--stats` and `--proof`.
12
-
13
- For the normative language definition, including lexical syntax, terms, clauses, goals, built-ins, `memoize/2`, `materialize/2`, and conformance boundaries, read the [eyelang language reference](../../docs/eyelang-language-reference.md).
14
-
15
- ## Contents
16
-
17
- 1. [Quick start](#quick-start)
18
- 2. [Running eyelang](#running-eyelang)
19
- 3. [Default output](#default-output)
20
- 4. [Writing programs](#writing-programs)
21
- 5. [Aggregation helpers](#aggregation-helpers)
22
- 6. [Formula data](#formula-data)
23
- 7. [Example catalog](#example-catalog)
24
- 8. [Golden outputs, tests, and conformance](#golden-outputs-tests-and-conformance)
25
- 9. [Development and release](#development-and-release)
26
- 10. [Relationship to Eyeling](#relationship-to-eyeling)
27
- 11. [Performance notes](#performance-notes)
28
- 12. [Implementation limits](#implementation-limits)
29
-
30
- ## Quick start
31
-
32
- Install dependencies, if any, and run the command-line executable:
33
-
34
- ```sh
35
- npm install
36
- ```
37
-
38
- There is no build step for the CLI. Run examples, multiple inputs, stdin, or a URL:
39
-
40
- ```sh
41
- bin/eyelang --version
42
- bin/eyelang examples/ancestor.pl
43
- bin/eyelang facts.pl rules.pl
44
- printf 'works(stdin, true) :- eq(ok, ok).\n' | bin/eyelang -
45
- bin/eyelang https://raw.githubusercontent.com/eyereasoner/eyelang/refs/heads/main/examples/ancestor.pl
46
- ```
47
-
48
- The CLI runs directly on Node.js 18 or newer. The browser playground uses the same source modules through `playground-worker.mjs`; no separate browser build is required.
49
-
50
- Serve the playground locally:
51
-
52
- ```sh
53
- python3 -m http.server 8000
54
- # then open http://localhost:8000/playground.html
55
- ```
56
-
57
- ## Running eyelang
58
-
59
- Show the package version:
60
-
61
- ```sh
62
- bin/eyelang --version
63
- bin/eyelang -v
64
- ```
65
-
66
- Run a program and let eyelang print derived binary facts:
67
-
68
- ```sh
69
- bin/eyelang examples/ancestor.pl
70
- ```
71
-
72
- Enable proof explanations when you want machine-readable provenance:
73
-
74
- ```sh
75
- bin/eyelang --proof examples/ancestor.pl
76
- bin/eyelang -p examples/ancestor.pl
77
- ```
78
-
79
- eyelang-readable explanations are opt-in proof output. Each `why/2` fact contains a nested abstract proof term, and a blank line separates consecutive explanations. Using eyelang syntax for explanations keeps them in the same language as the answers themselves: they are readable by humans, parseable by eyelang, easy to test, and can be transformed or explained further like any other eyelang data. For example:
80
-
81
- ```prolog
82
- type(socrates, mortal).
83
- why(
84
- type(socrates, mortal),
85
- proof(
86
- goal(type(socrates, mortal)),
87
- by(rule("socrates.pl", clause(4))),
88
- bindings([binding("X", socrates)]),
89
- uses([
90
- proof(
91
- goal(type(socrates, man)),
92
- by(fact("socrates.pl", clause(3)))
93
- )
94
- ])
95
- )
96
- ).
97
-
98
- ```
99
-
100
- The explanation output can itself be read as eyelang input; for example, another program can materialize `why/2` facts such as `why(type(socrates, mortal), Proof)`. `--proof` adds only these explanation facts; it does not change the answers found by the solver.
101
-
102
- ### Explanation cookbook
103
-
104
- eyelang answers can carry their own provenance when proof output is enabled.
105
-
106
- Explain one derived fact:
107
-
108
- ```sh
109
- bin/eyelang --proof examples/socrates.pl
110
- ```
111
-
112
- The output contains the answer and a `why/2` fact. The proof term shows the source rule that produced the answer and the source fact used below it. Source references use `rule("file.pl", clause(N))` and `fact("file.pl", clause(N))`, where `N` is the 1-based clause number in that file.
113
-
114
- Inspect variable bindings with a small policy program:
115
-
116
- ```prolog
117
- score(case1, 95).
118
- threshold(90).
119
-
120
- status(Case, accepted) :-
121
- score(Case, Score),
122
- threshold(T),
123
- ge(Score, T).
124
- ```
125
-
126
- ```sh
127
- bin/eyelang --proof policy.pl
128
- ```
129
-
130
- The explanation contains the instantiated answer and the variables that made the rule succeed:
131
-
132
- ```prolog
133
- status(case1, accepted).
134
- why(
135
- status(case1, accepted),
136
- proof(
137
- goal(status(case1, accepted)),
138
- by(rule("policy.pl", clause(3))),
139
- bindings([binding("Case", case1), binding("Score", 95), binding("T", 90)]),
140
- uses([...])
141
- )
142
- ).
143
- ```
144
-
145
- Use the `uses([...])` list to follow the proof tree. In the policy example it contains one subproof for `score(case1, 95)`, one for `threshold(90)`, and one for the built-in comparison `ge(95, 90)`. Built-ins are shown as `builtin(Name, Arity)` because they do not come from source clauses.
146
-
147
- Reuse explanations as data:
148
-
149
- ```sh
150
- bin/eyelang --proof examples/socrates.pl > socrates.why.pl
151
- ```
152
-
153
- The resulting file is ordinary eyelang syntax containing both answers and `why/2` proof facts.
154
-
155
- Compose multiple files, stdin, and URLs:
156
-
157
- ```sh
158
- bin/eyelang facts.pl rules.pl
159
- printf 'works(stdin, true) :- eq(ok, ok).\n' | bin/eyelang -
160
- bin/eyelang https://example.test/program.pl
161
- ```
162
-
163
- ## Default output
164
-
165
- eyelang programs write relation predicates directly:
166
-
167
- ```prolog
168
- parent(pat, jan).
169
- parent(jan, emma).
170
-
171
- ancestor(X, Y) :- parent(X, Y).
172
- ancestor(X, Z) :- parent(X, Y), ancestor(Y, Z).
173
- ```
174
-
175
- By default, eyelang asks for new ground consequences of selected output predicates, suppresses duplicates, excludes source facts, sorts the result, and prints Prolog facts:
176
-
177
- ```prolog
178
- ancestor(jan, emma).
179
- ancestor(pat, emma).
180
- ancestor(pat, jan).
181
- ```
182
-
183
- This default is intentionally output-oriented. It is not a complete bottom-up saturation engine. Built-ins and proof search remain goal-directed; use `materialize/2` declarations and small output predicates when you want a specific relation, arity, or non-binary answer.
184
-
185
- ### Focusing default output
186
-
187
- Large examples often have internal helper predicates. Add `materialize(Name, Arity).` declarations to restrict default output to selected predicates:
188
-
189
- ```prolog
190
- materialize(answer, 2).
191
-
192
- seed(case1).
193
- helper(Case, score(95)) :- seed(Case).
194
- answer(Case, accepted) :- helper(Case, score(95)).
195
- ```
196
-
197
- The default output is then:
198
-
199
- ```prolog
200
- answer(case1, accepted).
201
- ```
202
-
203
- `materialize/2` is a declaration, not a logical rule to prove. It affects which predicates the CLI prints, not the meaning of the rules themselves.
204
-
205
- ## Writing programs
206
-
207
- A good eyelang program normally has three layers:
208
-
209
- 1. source facts;
210
- 2. helper predicates for calculation or search;
211
- 3. concise relation-style outputs, usually binary predicates such as `status(Case, Value)`, `reason(Case, Text)`, `ancestor(Person, Ancestor)`, or `cost(Path, Amount)`.
212
-
213
- Example:
214
-
215
- ```prolog
216
- score(case1, 95).
217
- threshold(90).
218
-
219
- accepted(Case) :-
220
- score(Case, Score),
221
- threshold(Threshold),
222
- ge(Score, Threshold).
223
-
224
- status(Case, accepted) :- accepted(Case).
225
- reason(Case, "score exceeds threshold") :- accepted(Case).
226
- ```
227
-
228
- When `status/2` and `reason/2` are derived, they appear in default output. If the program has many helper binary predicates, declare the intended output predicates:
229
-
230
- ```prolog
231
- materialize(status, 2).
232
- materialize(reason, 2).
233
- ```
234
-
235
- ### Naming
236
-
237
- Predicate names and atom constants use the same lexical form. Namespace-like names should be plain names such as `type`, `person_name`, or `odrl_permission`; colon names are not part of the language.
238
-
239
- ### Embedding remains general
240
-
241
- The CLI is output-oriented and uses `materialize/2` to decide what to print. Embedders can still use the JavaScript API and `Solver` directly for arbitrary goals and arities.
242
-
243
- Add `-s` or `--stats` when you want lightweight solver counters on stderr without changing stdout:
244
-
245
- ```sh
246
- bin/eyelang -s examples/eyelang/n-queens.pl
247
- ```
248
-
249
- The playground has matching `--stats` and `--proof` checkboxes, so browser runs can show the same counters or explanations like the CLI.
250
-
251
-
252
- ### Builtins
253
-
254
- 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.
255
-
256
- The core builtin families cover unification, arithmetic, comparison, dates, strings, lists, aggregation, formula terms, and search control. Additional reusable finite-search helpers are available only where bundled examples need them to avoid large amounts of repetitive generate-and-test code. These helpers are deliberately general relations rather than shortcuts tied to a particular example name. For example:
257
-
258
- ```prolog
259
- answer(Queens) :-
260
- n_queens(8, Queens).
261
-
262
- best(Cycle, Cost) :-
263
- cities(Cities),
264
- weighted_hamiltonian_cycle(edge, Cities, Cycle, Cost).
265
- ```
266
-
267
- The reusable search and numeric helpers include `n_queens/2`, Hamiltonian path/cycle helpers, `cnf_model/3`, Quine-McCluskey helpers, bounded subset/path helpers, number-theory helpers such as `extended_gcd/5`, matrix helpers such as `matrix_multiply/2`, and `alphametic_sum/5`. These helpers are extension builtins of this implementation; [the eyelang language reference](../../docs/eyelang-language-reference.md) defines the portable core and standard builtin profile.
268
-
269
- 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.
270
-
271
-
272
- ## Aggregation helpers
273
-
274
- eyelang includes goal-directed aggregation helpers for finite searches:
275
-
276
- ```prolog
277
- countall(Goal, Count).
278
- sumall(Value, Goal, Sum).
279
- aggregate_min(Key, Template, Goal, BestKey, BestTemplate).
280
- aggregate_max(Key, Template, Goal, BestKey, BestTemplate).
281
- ```
282
-
283
- Use `countall/2` for solution counts, `sumall/3` for numeric totals, and `aggregate_min/5` or `aggregate_max/5` when a search should keep only the best candidate instead of collecting and sorting every answer. The `Key` can be a number, atom constant, string, compound term, or list; normal term ordering is used, so compound keys such as `[Cost, Path]` are useful for deterministic tie-breaking.
284
-
285
- Example:
286
-
287
- ```prolog
288
- best_cycle(Cycle, Cost) :-
289
- cities(Cities),
290
- aggregate_min([Cost, Cycle], Cycle, candidate_cycle(Cities, Cycle, Cost), [Cost, Cycle], Cycle).
291
- ```
292
-
293
- ## Formula data
294
-
295
- Comma terms can be data as well as conjunctions. eyelang provides a relation-oriented formula utility.
296
-
297
- `formula_binary(Formula, S, P, O)` enumerates binary terms and exposes their functor as an atom constant:
298
-
299
- ```prolog
300
- formula_binary((name(alice, "Alice"), knows(alice, bob)), S, P, O).
301
- ```
302
-
303
- This can yield `S = alice`, `P = name`, `O = "Alice"` and `S = alice`, `P = knows`, `O = bob`. The utility is useful for quoted formula data, but it does not make those formula members true in the ambient program.
304
-
305
-
306
- ## Example catalog
307
-
308
- The repository includes examples for recursion, graph reachability, finite search, arithmetic, list processing, optimization, policies, puzzles, and applied scientific calculations. Bundled examples use relation-style output.
309
-
310
- | Input | Short description | Output |
311
- | --- | --- | --- |
312
- | [`access-control-policy.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/access-control-policy.pl) | Evaluates role and condition based access decisions. | [`output/access-control-policy.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/access-control-policy.pl) |
313
- | [`ackermann.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/ackermann.pl) | Computes Ackermann-style hyperoperation values. | [`output/ackermann.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/ackermann.pl) |
314
- | [`age.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/age.pl) | Checks whether people meet age thresholds. | [`output/age.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/age.pl) |
315
- | [`aliases-and-namespaces.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/aliases-and-namespaces.pl) | Shows ordinary predicate names for vocabulary aliases. | [`output/aliases-and-namespaces.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/aliases-and-namespaces.pl) |
316
- | [`alignment-demo.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/alignment-demo.pl) | Rolls dataset concepts up through a small alignment taxonomy. | [`output/alignment-demo.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/alignment-demo.pl) |
317
- | [`allen-interval-calculus.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/allen-interval-calculus.pl) | Classifies interval relations with integer time offsets. | [`output/allen-interval-calculus.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/allen-interval-calculus.pl) |
318
- | [`ancestor.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/ancestor.pl) | Derives ancestors from parent facts. | [`output/ancestor.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/ancestor.pl) |
319
- | [`animal.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/animal.pl) | Classifies animals from traits. | [`output/animal.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/animal.pl) |
320
- | [`annotation.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/annotation.pl) | Derives facts from quoted annotation data. | [`output/annotation.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/annotation.pl) |
321
- | [`auroracare.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/auroracare.pl) | Evaluates purpose-based medical data access scenarios. | [`output/auroracare.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/auroracare.pl) |
322
- | [`backward.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/backward.pl) | Shows a backward-rule pattern as a goal-directed numeric rule. | [`output/backward.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/backward.pl) |
323
- | [`basic-monadic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/basic-monadic.pl) | Runs a monadic benchmark over generated inputs. | [`output/basic-monadic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/basic-monadic.pl) |
324
- | [`bayes-diagnosis.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/bayes-diagnosis.pl) | Computes scaled Bayesian diagnosis posteriors. | [`output/bayes-diagnosis.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/bayes-diagnosis.pl) |
325
- | [`bayes-therapy.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/bayes-therapy.pl) | Ranks therapies using Bayesian disease likelihoods. | [`output/bayes-therapy.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/bayes-therapy.pl) |
326
- | [`beam-deflection.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/beam-deflection.pl) | Computes cantilever beam deflection. | [`output/beam-deflection.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/beam-deflection.pl) |
327
- | [`blocks-world-planning.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/blocks-world-planning.pl) | Searches a finite blocks-world plan. | [`output/blocks-world-planning.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/blocks-world-planning.pl) |
328
- | [`bmi.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/bmi.pl) | Normalizes BMI inputs and classifies weight. | [`output/bmi.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/bmi.pl) |
329
- | [`braking-safety-worlds.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/braking-safety-worlds.pl) | Classifies braking safety under alternative worlds. | [`output/braking-safety-worlds.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/braking-safety-worlds.pl) |
330
- | [`buck-converter-design.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/buck-converter-design.pl) | Checks buck-converter ripple design. | [`output/buck-converter-design.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/buck-converter-design.pl) |
331
- | [`cache-performance.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/cache-performance.pl) | Summarizes cache latency performance. | [`output/cache-performance.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/cache-performance.pl) |
332
- | [`canary-release.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/canary-release.pl) | Decides canary rollout or rollback. | [`output/canary-release.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/canary-release.pl) |
333
- | [`cat-koko.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/cat-koko.pl) | Demonstrates named existential witnesses from a Cat Koko rule pattern. | [`output/cat-koko.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/cat-koko.pl) |
334
- | [`clinical-trial-screening.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/clinical-trial-screening.pl) | Screens candidates for a trial. | [`output/clinical-trial-screening.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/clinical-trial-screening.pl) |
335
- | [`collatz-1000.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/collatz-1000.pl) | Computes shared Collatz trajectories. | [`output/collatz-1000.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/collatz-1000.pl) |
336
- | [`combinatorics-findall-sort.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/combinatorics-findall-sort.pl) | Collects and sorts finite combinations. | [`output/combinatorics-findall-sort.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/combinatorics-findall-sort.pl) |
337
- | [`competitive-enzyme-kinetics.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/competitive-enzyme-kinetics.pl) | Computes inhibited enzyme reaction rates. | [`output/competitive-enzyme-kinetics.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/competitive-enzyme-kinetics.pl) |
338
- | [`complex-matrix-stability.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/complex-matrix-stability.pl) | Checks stability of a 2x2 system. | [`output/complex-matrix-stability.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/complex-matrix-stability.pl) |
339
- | [`complex.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/complex.pl) | Performs arithmetic on complex pairs. | [`output/complex.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/complex.pl) |
340
- | [`composition-of-injective-functions-is-injective.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/composition-of-injective-functions-is-injective.pl) | Encodes composition and injectivity of finite functions. | [`output/composition-of-injective-functions-is-injective.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/composition-of-injective-functions-is-injective.pl) |
341
- | [`context-association.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/context-association.pl) | Associates named contexts with their contents. | [`output/context-association.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/context-association.pl) |
342
- | [`control-system.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/control-system.pl) | Evaluates control-system measurements and targets. | [`output/control-system.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/control-system.pl) |
343
- | [`cryptarithmetic-send-more-money.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/cryptarithmetic-send-more-money.pl) | Solves SEND+MORE and related puzzles. | [`output/cryptarithmetic-send-more-money.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/cryptarithmetic-send-more-money.pl) |
344
- | [`cyclic-path.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/cyclic-path.pl) | Computes paths in a cyclic graph. | [`output/cyclic-path.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/cyclic-path.pl) |
345
- | [`d3-group.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/d3-group.pl) | Enumerates subgroups of the D3 group. | [`output/d3-group.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/d3-group.pl) |
346
- | [`dairy-energy-balance.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/dairy-energy-balance.pl) | Classifies dairy cow energy balance. | [`output/dairy-energy-balance.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/dairy-energy-balance.pl) |
347
- | [`data-negotiation.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/data-negotiation.pl) | Chooses an accepted data-negotiation offer. | [`output/data-negotiation.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/data-negotiation.pl) |
348
- | [`deep-taxonomy-10.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/deep-taxonomy-10.pl) | Stress-tests recursive taxonomy depth 10. | [`output/deep-taxonomy-10.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/deep-taxonomy-10.pl) |
349
- | [`deep-taxonomy-100.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/deep-taxonomy-100.pl) | Stress-tests recursive taxonomy depth 100. | [`output/deep-taxonomy-100.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/deep-taxonomy-100.pl) |
350
- | [`deep-taxonomy-1000.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/deep-taxonomy-1000.pl) | Stress-tests recursive taxonomy depth 1000. | [`output/deep-taxonomy-1000.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/deep-taxonomy-1000.pl) |
351
- | [`deep-taxonomy-10000.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/deep-taxonomy-10000.pl) | Stress-tests recursive taxonomy depth 10000. | [`output/deep-taxonomy-10000.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/deep-taxonomy-10000.pl) |
352
- | [`deep-taxonomy-100000.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/deep-taxonomy-100000.pl) | Stress-tests recursive taxonomy depth 100000. | [`output/deep-taxonomy-100000.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/deep-taxonomy-100000.pl) |
353
- | [`delfour.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/delfour.pl) | Derives shopping and authorization recommendations. | [`output/delfour.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/delfour.pl) |
354
- | [`dense-hamiltonian-cycle.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/dense-hamiltonian-cycle.pl) | Searches a dense Hamiltonian cycle with aggregate minimization. | [`output/dense-hamiltonian-cycle.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/dense-hamiltonian-cycle.pl) |
355
- | [`deontic-logic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/deontic-logic.pl) | Reports obligations, prohibitions, and violations. | [`output/deontic-logic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/deontic-logic.pl) |
356
- | [`derived-backward-rule.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/derived-backward-rule.pl) | Derives an inverse-property backward rule from rule data. | [`output/derived-backward-rule.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/derived-backward-rule.pl) |
357
- | [`derived-rule.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/derived-rule.pl) | Derives conclusions from rule data. | [`output/derived-rule.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/derived-rule.pl) |
358
- | [`diamond-property.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/diamond-property.pl) | Checks the diamond property of a relation. | [`output/diamond-property.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/diamond-property.pl) |
359
- | [`dijkstra-findall-sort.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/dijkstra-findall-sort.pl) | Finds shortest paths using collected candidates. | [`output/dijkstra-findall-sort.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/dijkstra-findall-sort.pl) |
360
- | [`dijkstra-risk-path.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/dijkstra-risk-path.pl) | Ranks routes by cost and trust. | [`output/dijkstra-risk-path.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/dijkstra-risk-path.pl) |
361
- | [`dijkstra.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/dijkstra.pl) | Enumerates weighted simple paths. | [`output/dijkstra.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/dijkstra.pl) |
362
- | [`dining-philosophers.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/dining-philosophers.pl) | Simulates Chandy-Misra fork exchanges. | [`output/dining-philosophers.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/dining-philosophers.pl) |
363
- | [`dog.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/dog.pl) | Counts dogs and derives when a license is required. | [`output/dog.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/dog.pl) |
364
- | [`drone-corridor-planner.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/drone-corridor-planner.pl) | Plans bounded drone corridor routes. | [`output/drone-corridor-planner.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/drone-corridor-planner.pl) |
365
- | [`easter-computus.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/easter-computus.pl) | Computes Gregorian Easter dates. | [`output/easter-computus.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/easter-computus.pl) |
366
- | [`electrical-rc-filter.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/electrical-rc-filter.pl) | Sizes an RC low-pass filter. | [`output/electrical-rc-filter.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/electrical-rc-filter.pl) |
367
- | [`epidemic-policy.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/epidemic-policy.pl) | Chooses policies from risk and social cost. | [`output/epidemic-policy.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/epidemic-policy.pl) |
368
- | [`equivalence-classes-overlap-implies-same-class.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/equivalence-classes-overlap-implies-same-class.pl) | Packages the shared-member proof pattern for equivalence classes. | [`output/equivalence-classes-overlap-implies-same-class.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/equivalence-classes-overlap-implies-same-class.pl) |
369
- | [`eulerian-path.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/eulerian-path.pl) | Finds an Eulerian path using each edge once. | [`output/eulerian-path.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/eulerian-path.pl) |
370
- | [`ev-range-worlds.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/ev-range-worlds.pl) | Estimates electric-vehicle trip feasibility. | [`output/ev-range-worlds.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/ev-range-worlds.pl) |
371
- | [`existential-rule.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/existential-rule.pl) | Represents existential witnesses with explicit Skolem-style terms. | [`output/existential-rule.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/existential-rule.pl) |
372
- | [`exoplanet-validation-worlds.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/exoplanet-validation-worlds.pl) | Validates exoplanet candidates across worlds. | [`output/exoplanet-validation-worlds.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/exoplanet-validation-worlds.pl) |
373
- | [`expression-eval.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/expression-eval.pl) | Evaluates a small arithmetic expression tree. | [`output/expression-eval.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/expression-eval.pl) |
374
- | [`family-cousins.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/family-cousins.pl) | Derives cousin and family labels. | [`output/family-cousins.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/family-cousins.pl) |
375
- | [`fastpow.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/fastpow.pl) | Computes powers by repeated squaring. | [`output/fastpow.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/fastpow.pl) |
376
- | [`fft8-numeric.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/fft8-numeric.pl) | Runs an 8-point FFT over complex pairs. | [`output/fft8-numeric.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/fft8-numeric.pl) |
377
- | [`fibonacci.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/fibonacci.pl) | Computes large Fibonacci numbers by fast doubling. | [`output/fibonacci.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/fibonacci.pl) |
378
- | [`field-nitrogen-balance.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/field-nitrogen-balance.pl) | Classifies field nitrogen balance. | [`output/field-nitrogen-balance.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/field-nitrogen-balance.pl) |
379
- | [`floating-point.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/floating-point.pl) | Exercises floating-point arithmetic and comparisons. | [`output/floating-point.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/floating-point.pl) |
380
- | [`flandor.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/flandor.pl) | Derives a Flanders macro-insight authorization and retooling package. | [`output/flandor.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/flandor.pl) |
381
- | [`four-color-map.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/four-color-map.pl) | Checks a four-colour map assignment. | [`output/four-color-map.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/four-color-map.pl) |
382
- | [`fundamental-theorem-arithmetic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/fundamental-theorem-arithmetic.pl) | Factors integers and reconstructs products. | [`output/fundamental-theorem-arithmetic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/fundamental-theorem-arithmetic.pl) |
383
- | [`gcd-bezout-identity.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/gcd-bezout-identity.pl) | Computes gcd and Bézout coefficients. | [`output/gcd-bezout-identity.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/gcd-bezout-identity.pl) |
384
- | [`gd-step-certified.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/gd-step-certified.pl) | Certifies a gradient-descent step. | [`output/gd-step-certified.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/gd-step-certified.pl) |
385
- | [`gdpr-compliance.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/gdpr-compliance.pl) | Checks GDPR-style processing compliance. | [`output/gdpr-compliance.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/gdpr-compliance.pl) |
386
- | [`goldbach-1000.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/goldbach-1000.pl) | Finds Goldbach prime pairs up to 1000. | [`output/goldbach-1000.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/goldbach-1000.pl) |
387
- | [`good-cobbler.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/good-cobbler.pl) | Demonstrates term-level structure with a good-cobbler statement. | [`output/good-cobbler.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/good-cobbler.pl) |
388
- | [`gps.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/gps.pl) | Finds and verifies route paths. | [`output/gps.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/gps.pl) |
389
- | [`graph-reachability.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/graph-reachability.pl) | Derives reachable nodes in a graph. | [`output/graph-reachability.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/graph-reachability.pl) |
390
- | [`gray-code-counter.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/gray-code-counter.pl) | Generates Gray-code counter states. | [`output/gray-code-counter.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/gray-code-counter.pl) |
391
- | [`greatest-lower-bound-uniqueness.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/greatest-lower-bound-uniqueness.pl) | Shows uniqueness of greatest lower bounds in a finite order instance. | [`output/greatest-lower-bound-uniqueness.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/greatest-lower-bound-uniqueness.pl) |
392
- | [`group-inverse-uniqueness.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/group-inverse-uniqueness.pl) | Shows uniqueness of inverses in a finite group instance. | [`output/group-inverse-uniqueness.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/group-inverse-uniqueness.pl) |
393
- | [`hamiltonian-cycle.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/hamiltonian-cycle.pl) | Finds a Hamiltonian cycle. | [`output/hamiltonian-cycle.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/hamiltonian-cycle.pl) |
394
- | [`hamiltonian-path.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/hamiltonian-path.pl) | Finds a Hamiltonian path. | [`output/hamiltonian-path.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/hamiltonian-path.pl) |
395
- | [`hamming-code.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/hamming-code.pl) | Corrects a single-bit Hamming word. | [`output/hamming-code.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/hamming-code.pl) |
396
- | [`hanoi.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/hanoi.pl) | Derives the Towers of Hanoi moves. | [`output/hanoi.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/hanoi.pl) |
397
- | [`heat-loss.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/heat-loss.pl) | Computes conductive heat loss. | [`output/heat-loss.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/heat-loss.pl) |
398
- | [`heron-theorem.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/heron-theorem.pl) | Computes triangle area by Heron's theorem. | [`output/heron-theorem.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/heron-theorem.pl) |
399
- | [`ideal-gas-law.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/ideal-gas-law.pl) | Applies the ideal gas law. | [`output/ideal-gas-law.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/ideal-gas-law.pl) |
400
- | [`illegitimate-reasoning.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/illegitimate-reasoning.pl) | Detects suspect reasoning patterns. | [`output/illegitimate-reasoning.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/illegitimate-reasoning.pl) |
401
- | [`kaprekar.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/kaprekar.pl) | Iterates toward Kaprekar's constant. | [`output/kaprekar.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/kaprekar.pl) |
402
- | [`law-of-cosines.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/law-of-cosines.pl) | Computes a triangle side by cosine law. | [`output/law-of-cosines.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/law-of-cosines.pl) |
403
- | [`least-squares-regression.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/least-squares-regression.pl) | Fits a least-squares regression line. | [`output/least-squares-regression.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/least-squares-regression.pl) |
404
- | [`list-collection.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/list-collection.pl) | Demonstrates list and collection built-ins. | [`output/list-collection.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/list-collection.pl) |
405
- | [`lldm.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/lldm.pl) | Calculates leg-length discrepancy measurements. | [`output/lldm.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/lldm.pl) |
406
- | [`manufacturing-quality-control.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/manufacturing-quality-control.pl) | Evaluates process capability and quality. | [`output/manufacturing-quality-control.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/manufacturing-quality-control.pl) |
407
- | [`matrix.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/matrix.pl) | Runs matrix operations over sample inputs. | [`output/matrix.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/matrix.pl) |
408
- | [`microgrid-dispatch.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/microgrid-dispatch.pl) | Plans microgrid dispatch and reserve. | [`output/microgrid-dispatch.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/microgrid-dispatch.pl) |
409
- | [`monkey-bananas.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/monkey-bananas.pl) | Solves the monkey-and-bananas puzzle. | [`output/monkey-bananas.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/monkey-bananas.pl) |
410
- | [`n-queens.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/n-queens.pl) | Searches for N-queens placements. | [`output/n-queens.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/n-queens.pl) |
411
- | [`network-sla.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/network-sla.pl) | Checks network path SLA compliance. | [`output/network-sla.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/network-sla.pl) |
412
- | [`newton-raphson.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/newton-raphson.pl) | Finds roots by Newton-Raphson iteration. | [`output/newton-raphson.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/newton-raphson.pl) |
413
- | [`nixon-diamond.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/nixon-diamond.pl) | Reports the classic Nixon-diamond conflict. | [`output/nixon-diamond.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/nixon-diamond.pl) |
414
- | [`odrl-dpv-healthcare-risk-ranked.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/odrl-dpv-healthcare-risk-ranked.pl) | Ranks healthcare policy risks and mitigations. | [`output/odrl-dpv-healthcare-risk-ranked.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/odrl-dpv-healthcare-risk-ranked.pl) |
415
- | [`odrl-dpv-risk-ranked.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/odrl-dpv-risk-ranked.pl) | Ranks data-policy risks and mitigations. | [`output/odrl-dpv-risk-ranked.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/odrl-dpv-risk-ranked.pl) |
416
- | [`orbital-transfer-design.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/orbital-transfer-design.pl) | Designs a Hohmann orbital transfer. | [`output/orbital-transfer-design.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/orbital-transfer-design.pl) |
417
- | [`path-discovery.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/path-discovery.pl) | Discovers bounded air-route paths. | [`output/path-discovery.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/path-discovery.pl) |
418
- | [`peano-arithmetic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/peano-arithmetic.pl) | Computes Peano addition, multiplication, and factorial. | [`output/peano-arithmetic.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/peano-arithmetic.pl) |
419
- | [`peasant.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/peasant.pl) | Performs peasant multiplication and exponentiation. | [`output/peasant.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/peasant.pl) |
420
- | [`pendulum-period.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/pendulum-period.pl) | Computes simple pendulum periods. | [`output/pendulum-period.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/pendulum-period.pl) |
421
- | [`polynomial.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/polynomial.pl) | Finds complex integer polynomial roots. | [`output/polynomial.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/polynomial.pl) |
422
- | [`project-portfolio-optimization.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/project-portfolio-optimization.pl) | Optimizes a constrained project portfolio with pruning and aggregate builtins. | [`output/project-portfolio-optimization.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/project-portfolio-optimization.pl) |
423
- | [`proof-contrapositive.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/proof-contrapositive.pl) | Models proof by contrapositive. | [`output/proof-contrapositive.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/proof-contrapositive.pl) |
424
- | [`quadratic-formula.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/quadratic-formula.pl) | Solves sample quadratic equations. | [`output/quadratic-formula.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/quadratic-formula.pl) |
425
- | [`quine-mccluskey.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/quine-mccluskey.pl) | Minimizes Boolean terms with Quine-McCluskey. | [`output/quine-mccluskey.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/quine-mccluskey.pl) |
426
- | [`radioactive-decay.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/radioactive-decay.pl) | Computes radioactive decay over time. | [`output/radioactive-decay.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/radioactive-decay.pl) |
427
- | [`resilient-city-orchestration.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/resilient-city-orchestration.pl) | Orchestrates storm-response missions from signals, policy, routes, teams, and portfolio optimization. | [`output/resilient-city-orchestration.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/resilient-city-orchestration.pl) |
428
- | [`riemann-hypothesis.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/riemann-hypothesis.pl) | Checks a finite catalogue of non-trivial zeta zeros against the Riemann-hypothesis condition. | [`output/riemann-hypothesis.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/riemann-hypothesis.pl) |
429
- | [`sat-dpll.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/sat-dpll.pl) | Solves a finite SAT instance. | [`output/sat-dpll.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/sat-dpll.pl) |
430
- | [`security-incident-correlation.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/security-incident-correlation.pl) | Correlates security incidents across signals. | [`output/security-incident-correlation.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/security-incident-correlation.pl) |
431
- | [`service-impact.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/service-impact.pl) | Analyzes service impact over cyclic dependencies. | [`output/service-impact.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/service-impact.pl) |
432
- | [`sieve.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/sieve.pl) | Enumerates primes with a sieve-style program. | [`output/sieve.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/sieve.pl) |
433
- | [`skolem-functions.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/skolem-functions.pl) | Generates deterministic functional terms. | [`output/skolem-functions.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/skolem-functions.pl) |
434
- | [`socket-age.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/socket-age.pl) | Shows socket-declared age reasoning inputs and plugs. | [`output/socket-age.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/socket-age.pl) |
435
- | [`socket-family.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/socket-family.pl) | Shows socket-declared family-source inputs and ancestry rules. | [`output/socket-family.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/socket-family.pl) |
436
- | [`socrates.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/socrates.pl) | Derives that Socrates is mortal. | [`output/socrates.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/socrates.pl) |
437
- | [`statistics-summary.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/statistics-summary.pl) | Computes population statistics for a sample. | [`output/statistics-summary.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/statistics-summary.pl) |
438
- | [`superdense-coding.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/superdense-coding.pl) | Models superdense-coding bit transmission. | [`output/superdense-coding.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/superdense-coding.pl) |
439
- | [`traveling-salesman.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/traveling-salesman.pl) | Finds an optimal traveling-salesman tour. | [`output/traveling-salesman.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/traveling-salesman.pl) |
440
- | [`turing.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/turing.pl) | Simulates a binary-increment Turing machine. | [`output/turing.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/turing.pl) |
441
- | [`vector-similarity.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/vector-similarity.pl) | Computes dot product, norm, and cosine similarity. | [`output/vector-similarity.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/vector-similarity.pl) |
442
- | [`vulnerability-impact.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/vulnerability-impact.pl) | Analyzes vulnerable transitive dependencies and urgent patch impact. | [`output/vulnerability-impact.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/vulnerability-impact.pl) |
443
- | [`witch.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/witch.pl) | Derives the classic “burn the witch” rule chain. | [`output/witch.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/witch.pl) |
444
- | [`wolf-goat-cabbage.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/wolf-goat-cabbage.pl) | Solves the wolf-goat-cabbage river crossing. | [`output/wolf-goat-cabbage.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/wolf-goat-cabbage.pl) |
445
- | [`zebra.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/zebra.pl) | Solves the zebra logic puzzle. | [`output/zebra.pl`](https://github.com/eyereasoner/eyelang/blob/main/examples/output/zebra.pl) |
446
-
447
-
448
-
449
- ## Golden outputs, tests, and conformance
450
-
451
- Golden answer outputs live in [`examples/output`](examples/output). `npm run test:examples` covers every top-level runnable `.pl` example. A curated proof-output suite for `.pl` examples lives in [`examples/proof`](examples/proof). Example tests pin `local_time/1` to `2026-05-30` so date-dependent examples stay deterministic. Regenerate them after an intentional output or explanation change:
452
-
453
- ```sh
454
- for f in examples/*.pl; do
455
- [ -e "$f" ] || continue
456
- b=$(basename "$f")
457
- EYELANG_LOCAL_TIME=2026-05-30 bin/eyelang "$f" > "examples/output/$b"
458
- done
459
-
460
- for f in examples/proof/*.pl; do
461
- b=$(basename "$f")
462
- EYELANG_LOCAL_TIME=2026-05-30 bin/eyelang --proof "examples/$b" > "examples/proof/$b"
463
- done
464
- ```
465
-
466
- Run the full test suite:
467
-
468
- ```sh
469
- npm test
470
- ```
471
-
472
- The test suite runs in this order: Conformance, Regression/API/White-box, Examples. Each section prints its own subtotal, followed by a suite-specific grand total. The suite checks the conformance cases derived from the language reference, supplemental regression/API/white-box checks, and every runnable example against its golden output.
473
-
474
- Run only one suite when you are iterating:
475
-
476
- ```sh
477
- npm run test:conformance
478
- npm run test:regression
479
- npm run test:examples
480
- ```
481
-
482
- The conformance suite lives in [`conformance/`](conformance/) and is split into `core` and `extension` profiles matching the language reference. Each case is a small program with an exact expected stdout file, and some internal conformance cases also include a goal file for testing the embeddable solver, so other implementations can reuse the same cases. The regression suite lives in [`test/run-regression.js`](test/run-regression.js) and covers CLI regressions, the public JavaScript API, and white-box invariants for parser, unification, and indexing behavior.
483
-
484
- ## Development and release
485
-
486
- Common commands:
487
-
488
- ```sh
489
- npm test # conformance, regression/API/white-box, and examples
490
- npm run test:conformance # only the conformance suite
491
- npm run test:regression # CLI regression, API, and white-box checks
492
- npm run test:examples # every example against examples/output
493
- node bin/eyelang --help
494
- ```
495
-
496
- Useful profiling smoke test:
497
-
498
- ```sh
499
- bin/eyelang -s examples/eyelang/n-queens.pl > /dev/null
500
- ```
501
-
502
- For a release:
503
-
504
- 1. update `VERSION`;
505
- 2. update `README.md` and the language reference;
506
- 3. regenerate golden outputs if behavior changed;
507
- 4. run `npm test`;
508
- 5. publish the repository with `playground.html` and `playground-worker.mjs` if publishing the playground. The playground includes controls equivalent to CLI `--stats` and `--proof`.
509
-
510
- ## Relationship to Eyeling
511
-
512
- [Eyeling](https://github.com/eyereasoner/eyeling) and eyelang share the same goal of small, inspectable rule-based reasoning in JavaScript, but they make different language and implementation trade-offs.
513
-
514
- Eyeling is the RDF/Notation3 member of the family. It reads N3-style triples, quoted formulas, forward rules written with `=>`, backward rules written with `<=`, RDF terms, RDF-JS data, and RDF-oriented streams. That makes it the better fit when data interchange with RDF/N3 tools is the main requirement.
515
-
516
- eyelang is the compact Prolog-style member of the family. It uses ordinary predicate syntax such as `parent(alice, bob).` and `ancestor(X, Z) :- parent(X, Y), ancestor(Y, Z).` This keeps the core syntax close to the ISO-standardized Prolog tradition while deliberately staying much smaller than ISO Prolog. It is a good fit when the problem is naturally relational, goal-directed, finite, and does not need RDF graph interchange.
517
-
518
- A useful rule of thumb:
519
-
520
- | Use case | Prefer | Why |
521
- | --- | --- | --- |
522
- | RDF/N3 data, triples, prefixes, graph terms, RDF-JS, RDF message streams | Eyeling | The surface language and APIs are RDF/Notation3-native. |
523
- | Compact relational rules over ordinary terms, lists, arithmetic, and finite search | eyelang | The syntax is shorter for non-RDF relation programs and output is ordinary facts. |
524
- | Human-auditable derivations | Either | Both can emit proof explanations when requested. |
525
- | Large generated Horn-clause workloads | eyelang | The engine specializes in predicate/arity indexing, scalar argument indexes, fast fact paths, and materialized output goals. |
526
-
527
- For the deep taxonomy benchmark, eyelang is substantially faster in current local checks. On one sandbox run, `node bin/eyelang examples/deep-taxonomy-100000.pl > /dev/null` took about `1.60 sec`, while `eyeling` package version `1.28.7` on `examples/deep-taxonomy-100000.n3` took about `4.56 sec` without proof and about `5.04 sec` with proof. Treat those numbers as a smoke comparison rather than a formal benchmark: hardware, Node.js version, package version, and CLI startup all matter.
528
-
529
- The projects are therefore complementary rather than replacements for each other: Eyeling optimizes for Semantic Web interoperability and N3 expressiveness; eyelang optimizes for a small standard-looking relational rule language and fast finite goal-directed execution.
530
-
531
- ## Performance notes
532
-
533
- Use `-s` or `--stats` for a quick sanity check while optimizing solver changes. It prints counters such as `solve_goals_calls`, `unify_calls`, `deterministic_rule_expansions`, `candidate_lists_selected`, `clause_candidates_considered`, `clauses_tried`, `max_depth`, and `max_solver_call_depth` to stderr, leaving normal output stable for golden-file tests. The `max_solver_call_depth` counter is especially useful for browser regressions, where the VM call stack can be tighter than a command-line run.
534
-
535
- eyelang hashes predicate groups by name and arity, then indexes clauses by scalar argument values. It also builds two-argument composite indexes for scalar pairs and probes those composite indexes without per-lookup heap allocation. This helps both large generated programs with many predicates and selective queries such as:
536
-
537
- ```prolog
538
- edge(g1, a, X).
539
- path(a, Y).
540
- status(Case, accepted).
541
- ```
542
-
543
- Ground facts use a fast path that avoids freshening and copying a rule body. Recursive-predicate detection uses an explicit work stack, which keeps large predicate chains safer in the browser. Recursive examples use an active-call variant guard to prevent common cyclic closures from looping. Selected predicates can be memoized with:
544
-
545
- ```prolog
546
- memoize(path, 2).
547
- ```
548
-
549
- For large programs, keep helper predicates selective, bind arguments early, and declare focused output predicates with `materialize/2` when default output would otherwise solve broad helper goals.
550
-
551
- ## Implementation limits
552
-
553
- eyelang is intentionally smaller than ISO Prolog. It has no operators, cut, modules, dynamic database updates, DCGs, or complete ISO library. Negation is negation-as-failure through `not/1`. Search is goal-directed and expected to be finite for the selected output goals. Output explanations are non-normative proof printouts and do not change answer semantics.
@@ -1,26 +0,0 @@
1
- // Formula builtins that treat conjunctions as first-class data terms.
2
- // These are used by examples that construct or inspect rule bodies programmatically.
3
- import { atom, deref, isConjunction, unify } from '../term.js';
4
-
5
- export const formulaBuiltins = {
6
- register(registry) {
7
- registry.add('formula_binary', 4, formulaBinary);
8
- }
9
- };
10
-
11
-
12
- function* emitFormulaBinary(formula, subject, predicate, object, env) {
13
- formula = deref(formula, env);
14
- if (isConjunction(formula)) {
15
- yield* emitFormulaBinary(formula.args[0], subject, predicate, object, env);
16
- yield* emitFormulaBinary(formula.args[1], subject, predicate, object, env);
17
- return;
18
- }
19
- if (formula.type !== 'compound' || formula.arity !== 2) return;
20
- const next = env.clone();
21
- if (unify(subject, formula.args[0], next) && unify(predicate, atom(formula.name), next) && unify(object, formula.args[1], next)) yield next;
22
- }
23
-
24
- function* formulaBinary({ goal, env }) {
25
- yield* emitFormulaBinary(goal.args[0], goal.args[1], goal.args[2], goal.args[3], env);
26
- }