eyeling 1.16.3 → 1.16.5

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 (61) hide show
  1. package/HANDBOOK.md +153 -0
  2. package/README.md +0 -1
  3. package/examples/auroracare.n3 +528 -0
  4. package/examples/control-system.n3 +223 -47
  5. package/examples/delfour.n3 +409 -0
  6. package/examples/gps.n3 +144 -53
  7. package/examples/ill-formed-literals.n3 +195 -0
  8. package/examples/output/auroracare.n3 +118 -0
  9. package/examples/output/control-system.n3 +24 -1
  10. package/examples/output/delfour.n3 +40 -0
  11. package/examples/output/gps.n3 +14 -2
  12. package/examples/output/ill-formed-literals.n3 +27 -0
  13. package/examples/output/parcellocker.n3 +15 -0
  14. package/examples/parcellocker.n3 +164 -0
  15. package/eyeling.js +16 -1
  16. package/lib/engine.js +14 -1
  17. package/lib/prelude.js +2 -0
  18. package/package.json +2 -3
  19. package/arctifacts/README.md +0 -59
  20. package/arctifacts/ackermann.html +0 -678
  21. package/arctifacts/auroracare.html +0 -1297
  22. package/arctifacts/bike-trip.html +0 -752
  23. package/arctifacts/binomial-theorem.html +0 -631
  24. package/arctifacts/bmi.html +0 -511
  25. package/arctifacts/building-performance.html +0 -750
  26. package/arctifacts/clinical-care.html +0 -726
  27. package/arctifacts/collatz.html +0 -403
  28. package/arctifacts/complex.html +0 -321
  29. package/arctifacts/control-system.html +0 -482
  30. package/arctifacts/delfour.html +0 -849
  31. package/arctifacts/earthquake-epicenter.html +0 -982
  32. package/arctifacts/eco-route.html +0 -662
  33. package/arctifacts/euclid-infinitude.html +0 -564
  34. package/arctifacts/euler-identity.html +0 -667
  35. package/arctifacts/exoplanet-transit.html +0 -1000
  36. package/arctifacts/faltings-theorem.html +0 -1046
  37. package/arctifacts/fibonacci.html +0 -299
  38. package/arctifacts/fundamental-theorem-arithmetic.html +0 -398
  39. package/arctifacts/godel-numbering.html +0 -743
  40. package/arctifacts/gps-bike.html +0 -759
  41. package/arctifacts/gps-clinical-bench.html +0 -792
  42. package/arctifacts/graph-french.html +0 -449
  43. package/arctifacts/grass-molecular.html +0 -592
  44. package/arctifacts/group-theory.html +0 -740
  45. package/arctifacts/health-info.html +0 -833
  46. package/arctifacts/kaprekar-constant.html +0 -576
  47. package/arctifacts/lee.html +0 -805
  48. package/arctifacts/linked-lists.html +0 -502
  49. package/arctifacts/lldm.html +0 -612
  50. package/arctifacts/matrix-multiplication.html +0 -502
  51. package/arctifacts/matrix.html +0 -651
  52. package/arctifacts/newton-raphson.html +0 -944
  53. package/arctifacts/peano-factorial.html +0 -456
  54. package/arctifacts/pi.html +0 -363
  55. package/arctifacts/polynomial.html +0 -646
  56. package/arctifacts/prime.html +0 -366
  57. package/arctifacts/pythagorean-theorem.html +0 -468
  58. package/arctifacts/rest-path.html +0 -469
  59. package/arctifacts/roots-of-unity.html +0 -363
  60. package/arctifacts/turing.html +0 -409
  61. package/arctifacts/wind-turbines.html +0 -726
@@ -1,469 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <title>REST‑path</title>
7
- <style>
8
- :root {
9
- --bg: #ffffff;
10
- --ink: #111827;
11
- --muted: #6b7280;
12
- --panel: #f8fafc;
13
- --border: #e5e7eb;
14
- --accent: #0ea5e9;
15
- --good: #16a34a;
16
- --amber: #f59e0b;
17
- --blue: #3b82f6;
18
- --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
19
- --ui:
20
- system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji',
21
- 'Segoe UI Emoji';
22
- }
23
- body {
24
- margin: 0;
25
- background: var(--bg);
26
- color: var(--ink);
27
- font: 15px/1.55 var(--ui);
28
- }
29
- .wrap {
30
- max-width: 980px;
31
- margin: 36px auto;
32
- padding: 0 16px;
33
- }
34
- header {
35
- display: flex;
36
- align-items: center;
37
- justify-content: space-between;
38
- margin-bottom: 16px;
39
- }
40
- h1 {
41
- font-size: 22px;
42
- margin: 0;
43
- letter-spacing: 0.2px;
44
- }
45
- .pill {
46
- display: inline-flex;
47
- align-items: center;
48
- gap: 8px;
49
- padding: 6px 10px;
50
- border: 1px solid var(--border);
51
- border-radius: 999px;
52
- color: var(--muted);
53
- background: #fff;
54
- }
55
- .row {
56
- display: flex;
57
- flex-direction: column;
58
- gap: 16px;
59
- }
60
- .card {
61
- background: var(--panel);
62
- border: 1px solid var(--border);
63
- border-radius: 14px;
64
- overflow: hidden;
65
- }
66
- .head {
67
- display: flex;
68
- align-items: center;
69
- justify-content: space-between;
70
- padding: 10px 12px;
71
- border-bottom: 1px solid var(--border);
72
- }
73
- .head h2 {
74
- font-size: 13px;
75
- text-transform: uppercase;
76
- letter-spacing: 0.08em;
77
- color: var(--muted);
78
- margin: 0;
79
- }
80
- .body {
81
- padding: 12px;
82
- }
83
- pre {
84
- white-space: pre-wrap;
85
- background: #fff;
86
- border: 1px solid var(--border);
87
- border-radius: 10px;
88
- padding: 12px;
89
- overflow: auto;
90
- font-family: var(--mono);
91
- font-size: 13.25px;
92
- }
93
- button {
94
- all: unset;
95
- background: #fff;
96
- border: 1px solid var(--border);
97
- padding: 8px 12px;
98
- border-radius: 10px;
99
- cursor: pointer;
100
- }
101
- button:hover {
102
- border-color: #cbd5e1;
103
- }
104
- .arc-grid {
105
- display: flex;
106
- flex-direction: column;
107
- gap: 12px;
108
- }
109
- .arc-card {
110
- background: #fff;
111
- border: 1px solid var(--border);
112
- border-radius: 14px;
113
- overflow: hidden;
114
- }
115
- .arc-card .ac-head {
116
- display: flex;
117
- align-items: center;
118
- gap: 8px;
119
- padding: 10px 12px;
120
- border-bottom: 1px solid var(--border);
121
- font-size: 12px;
122
- letter-spacing: 0.08em;
123
- text-transform: uppercase;
124
- color: var(--muted);
125
- }
126
- .arc-card .ac-body {
127
- padding: 12px;
128
- }
129
- .arc-card.answer {
130
- border-left: 4px solid var(--good);
131
- }
132
- .arc-card.reason {
133
- border-left: 4px solid var(--blue);
134
- }
135
- .arc-card.check {
136
- border-left: 4px solid var(--amber);
137
- }
138
- </style>
139
- </head>
140
- <body>
141
- <div class="wrap">
142
- <header>
143
- <h1>REST‑path</h1>
144
- <div class="pill" id="status">Ready</div>
145
- </header>
146
-
147
- <div class="card" style="margin-bottom: 16px">
148
- <div class="body">
149
- <p>
150
- <strong>What this is?</strong> A self‑contained harness of the <em>REST‑path</em> example. It starts from
151
- the fact <code>&lt;x&gt; ex:rel1 &lt;y&gt;</code>, creates three lanes, promotes them across
152
- <code>rel2…rel10</code> in nine steps while emitting an HTTP GET per step on lane‑1, and finally asserts
153
- <code>&lt;x&gt; ex:relGoal &lt;y&gt;</code>. ARC cards below summarize the result, proof, and checks.
154
- </p>
155
- </div>
156
- </div>
157
-
158
- <div class="row">
159
- <div class="card">
160
- <div class="head">
161
- <h2>Controls</h2>
162
- <div style="display: flex; gap: 8px; align-items: center">
163
- <button onclick="run()">▶ Run</button>
164
- <button onclick="downloadARC()">⬇ Export .txt</button>
165
- </div>
166
- </div>
167
- <div class="body">Deterministic run (no inputs). Auto‑runs on load.</div>
168
- </div>
169
-
170
- <div class="card">
171
- <div class="head"><h2>ARC Output</h2></div>
172
- <div class="body">
173
- <div class="arc-grid">
174
- <div class="arc-card answer">
175
- <div class="ac-head">Answer</div>
176
- <div class="ac-body"><pre id="ans">(no run yet)</pre></div>
177
- </div>
178
- <div class="arc-card reason">
179
- <div class="ac-head">Reason why</div>
180
- <div class="ac-body"><pre id="why">(no run yet)</pre></div>
181
- </div>
182
- <div class="arc-card check">
183
- <div class="ac-head">Check (harness)</div>
184
- <div class="ac-body"><pre id="chk">(no run yet)</pre></div>
185
- </div>
186
- </div>
187
- </div>
188
- </div>
189
- </div>
190
- </div>
191
-
192
- <script>
193
- // ------- Tiny RDF-like KB -------
194
- class KB {
195
- constructor() {
196
- this._triples = new Set();
197
- this._gens = { req: 1, resp: 1, a: 1, b: 1 };
198
- }
199
- key(s, p, o) {
200
- return s + '|' + p + '|' + o;
201
- }
202
- add(s, p, o) {
203
- this._triples.add(this.key(s, p, o));
204
- }
205
- ask(s = null, p = null, o = null) {
206
- const out = [];
207
- for (const k of this._triples) {
208
- const [S, P, O] = k.split('|');
209
- if ((s === null || s === S) && (p === null || p === P) && (o === null || o === O)) out.push([S, P, O]);
210
- }
211
- return out;
212
- }
213
- has(s = null, p = null, o = null) {
214
- return this.ask(s, p, o).length > 0;
215
- }
216
- fresh(stem) {
217
- return '_:' + stem + this._gens[stem]++;
218
- }
219
- }
220
-
221
- // ------- Pretty proof scaffold -------
222
- class Conclusion {
223
- constructor(kind, payload) {
224
- this.kind = kind;
225
- this.payload = payload;
226
- }
227
- pretty() {
228
- return String(this.payload);
229
- }
230
- }
231
- class Step {
232
- constructor(id, rule, premises, conclusion, notes = null) {
233
- this.id = id;
234
- this.rule = rule;
235
- this.premises = premises;
236
- this.conclusion = conclusion;
237
- this.notes = notes;
238
- }
239
- }
240
- class Proof {
241
- constructor() {
242
- this.steps = [];
243
- }
244
- add(rule, premises, conclusion, notes = null) {
245
- const id = this.steps.length + 1;
246
- this.steps.push(new Step(id, rule, premises, conclusion, notes));
247
- return id;
248
- }
249
- pretty() {
250
- const lines = [];
251
- for (const s of this.steps) {
252
- const prem = s.premises && s.premises.length ? ` [${s.premises.join(', ')}]` : '';
253
- const note = s.notes ? ` // ${s.notes}` : '';
254
- lines.push(`[${s.id}] ${s.rule}${prem}: ${s.conclusion.pretty()}${note}`);
255
- }
256
- return lines.join('\n');
257
- }
258
- }
259
-
260
- // ------- Rule applications -------
261
- const X = '<x>',
262
- Y = '<y>'; // IRI placeholders to mirror reference printout
263
-
264
- function apply_step1(kb, proof) {
265
- const req = kb.fresh('req'),
266
- resp = kb.fresh('resp');
267
- const a2 = kb.fresh('a'),
268
- b2 = kb.fresh('b');
269
- const a3 = kb.fresh('a'),
270
- b3 = kb.fresh('b');
271
-
272
- kb.add(req, 'http:methodName', '"GET"');
273
- kb.add(req, 'http:requestURI', X);
274
- kb.add(req, 'http:resp', resp);
275
- kb.add(resp, 'http:body', Y);
276
-
277
- kb.add(X, 'ex:rel2', Y);
278
- kb.add(a2, 'ex:rel2', b2);
279
- kb.add(a3, 'ex:rel2', b3);
280
-
281
- proof.add(
282
- 'Step-1 (rel1→rel2)',
283
- [],
284
- new Conclusion(
285
- 'text',
286
- `emit GET(req=${req}, uri=${X}, body=${Y}); create lanes: (a1,b1)=(${X},${Y}), (a2,b2)=(${a2},${b2}), (a3,b3)=(${a3},${b3})`,
287
- ),
288
- 'Existential a2,b2,a3,b3',
289
- );
290
- return [
291
- [X, Y],
292
- [a2, b2],
293
- [a3, b3],
294
- ];
295
- }
296
-
297
- function apply_mid_step(kb, k, lanes_k, proof) {
298
- const [a1, b1] = lanes_k[0];
299
- const req = kb.fresh('req'),
300
- resp = kb.fresh('resp');
301
- kb.add(req, 'http:methodName', '"GET"');
302
- kb.add(req, 'http:requestURI', a1);
303
- kb.add(req, 'http:resp', resp);
304
- kb.add(resp, 'http:body', b1);
305
-
306
- const lanes_next = [];
307
- for (const [ai, bi] of lanes_k) {
308
- kb.add(ai, `ex:rel${k + 1}`, bi);
309
- lanes_next.push([ai, bi]);
310
- }
311
- proof.add(
312
- `Step-${k} (rel${k}→rel${k + 1})`,
313
- [],
314
- new Conclusion('text', `emit GET(req=${req}, uri=${a1}, body=${b1}); promote 3 lanes to rel${k + 1}`),
315
- );
316
- return lanes_next;
317
- }
318
-
319
- function apply_final_step(kb, lanes9, proof) {
320
- const [a1, b1] = lanes9[0];
321
- const req = kb.fresh('req'),
322
- resp = kb.fresh('resp');
323
- kb.add(req, 'http:methodName', '"GET"');
324
- kb.add(req, 'http:requestURI', a1);
325
- kb.add(req, 'http:resp', resp);
326
- kb.add(resp, 'http:body', b1);
327
-
328
- for (const [ai, bi] of lanes9) {
329
- kb.add(ai, 'ex:rel10', bi);
330
- }
331
- kb.add(X, 'ex:relGoal', Y);
332
- proof.add(
333
- 'Step-9 (rel9→rel10 + relGoal)',
334
- [],
335
- new Conclusion(
336
- 'text',
337
- `emit GET(req=${req}, uri=${a1}, body=${b1}); promote to rel10; assert relGoal(${X},${Y})`,
338
- ),
339
- );
340
- }
341
-
342
- // ------- Pipeline orchestration -------
343
- function run_pipeline() {
344
- const kb = new KB();
345
- const proof = new Proof();
346
-
347
- // seed fact and goal sketch to match reference style
348
- kb.add(X, 'ex:rel1', Y);
349
- proof.add('Facts', [], new Conclusion('text', `${X} ex:rel1 ${Y}`));
350
- proof.add('Goal', [], new Conclusion('text', `{ ${X} ex:relGoal ${Y} }`));
351
- proof.add(
352
- 'Premise-Rule',
353
- [],
354
- new Conclusion(
355
- 'text',
356
- 'Chain: rel1→rel2 (create 3 lanes), then relk→rel{k+1} for k=2..9; final also asserts relGoal',
357
- ),
358
- 'Each step emits a GET on lane-1',
359
- );
360
-
361
- const lanes2 = apply_step1(kb, proof);
362
- let lanes = lanes2;
363
- for (let k = 2; k <= 8; k++) lanes = apply_mid_step(kb, k, lanes, proof);
364
- apply_final_step(kb, lanes, proof);
365
-
366
- return { kb, proof };
367
- }
368
-
369
- // ------- Formatting helpers -------
370
- function list_gets(kb) {
371
- const gets = kb.ask(null, 'http:methodName', '"GET"').sort((a, b) => a[0].localeCompare(b[0]));
372
- const out = [];
373
- for (const [req] of gets) {
374
- const uri = (kb.ask(req, 'http:requestURI', null)[0] || ['', '', '?'])[2];
375
- const resp = (kb.ask(req, 'http:resp', null)[0] || ['', '', ''])[2];
376
- const body = resp ? (kb.ask(resp, 'http:body', null)[0] || ['', '', '?'])[2] : '?';
377
- out.push([req, uri, body]);
378
- }
379
- return out;
380
- }
381
-
382
- // ------- ARC sections (no duplicate headings) -------
383
- function arc_answer(kb) {
384
- const parts = [];
385
- const goals = kb.ask(null, 'ex:relGoal', null).sort();
386
- for (const [s, _, o] of goals) {
387
- parts.push(`${s} ex:relGoal ${o}`);
388
- }
389
- const gets = list_gets(kb);
390
- parts.push('', 'Emitted GET requests: ' + gets.length);
391
- for (const [req, uri, body] of gets) {
392
- parts.push(` ${req}: GET ${uri} → body ${body}`);
393
- }
394
- return parts.join('\n');
395
- }
396
- function arc_reason(proof) {
397
- return proof.pretty();
398
- }
399
- function arc_check(kb, proof) {
400
- const parts = [];
401
-
402
- // (1) Exactly one relGoal and it is (<x>,<y>)
403
- const goals = kb.ask(null, 'ex:relGoal', null);
404
- if (!(goals.length === 1 && goals[0][0] === X && goals[0][2] === Y)) {
405
- parts.push('✗ Unexpected ex:relGoal facts: ' + JSON.stringify(goals));
406
- }
407
-
408
- // (2) Exactly 9 GETs; lane‑1 uses <x>/<y>
409
- const gets = list_gets(kb);
410
- if (gets.length !== 9) parts.push(`✗ Expected 9 GETs, found ${gets.length}`);
411
- for (const [_, uri, body] of gets) {
412
- if (!(uri === X && body === Y)) parts.push('✗ GET should use lane‑1 URI <x> and body <y>');
413
- }
414
-
415
- // (3) For each level k=2..10 exactly 3 lanes; lane‑1 present
416
- for (let k = 2; k <= 10; k++) {
417
- const triples = kb.ask(null, `ex:rel${k}`, null);
418
- if (triples.length !== 3) parts.push(`✗ Expected 3 lanes at rel${k}, found ${triples.length}`);
419
- if (!triples.some((t) => t[0] === X && t[2] === Y)) parts.push(`✗ Missing lane‑1 at rel${k}`);
420
- }
421
-
422
- // (4) Proof shape
423
- if (proof.steps.length !== 12) parts.push(`✗ Unexpected number of proof steps: ${proof.steps.length}`);
424
- if (!proof.steps[0].rule.startsWith('Facts')) parts.push('✗ First proof step should record Facts');
425
- if (!(proof.steps[1].rule === 'Goal')) parts.push('✗ Second proof step should record Goal');
426
- if (!(proof.steps[2].rule.indexOf('Premise-Rule') >= 0))
427
- parts.push('✗ Third step should sketch the rule chain');
428
- for (let i = 1; i <= 9; i++) {
429
- const s = proof.steps[2 + i];
430
- if (!s.rule.startsWith(`Step-${i}`)) parts.push(`✗ Expected Step-${i}, got ${s.rule}`);
431
- }
432
-
433
- if (parts.length === 0) {
434
- parts.push('OK: goal fact, GET count/linking, lane counts per level, and proof shape verified.');
435
- }
436
- return parts.join('\n');
437
- }
438
-
439
- // ------- Runner + UI -------
440
- function run() {
441
- const { kb, proof } = run_pipeline();
442
- document.getElementById('ans').textContent = arc_answer(kb);
443
- document.getElementById('why').textContent = arc_reason(proof);
444
- document.getElementById('chk').textContent = arc_check(kb, proof);
445
- document.getElementById('status').textContent = 'Computed';
446
- }
447
- function downloadARC() {
448
- const blob = new Blob(
449
- [
450
- 'Answer\n------\n',
451
- document.getElementById('ans').textContent,
452
- '\n\n',
453
- 'Reason why\n----------\n',
454
- document.getElementById('why').textContent,
455
- '\n\n',
456
- 'Check (harness)\n---------------\n',
457
- document.getElementById('chk').textContent,
458
- ],
459
- { type: 'text/plain' },
460
- );
461
- const a = document.createElement('a');
462
- a.href = URL.createObjectURL(blob);
463
- a.download = 'restpath_output.txt';
464
- a.click();
465
- }
466
- window.addEventListener('DOMContentLoaded', run);
467
- </script>
468
- </body>
469
- </html>