eyeling 1.22.1 → 1.22.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/examples/arcling/README.md +37 -167
- package/examples/calidor.n3 +500 -0
- package/examples/output/calidor.n3 +29 -0
- package/package.json +2 -3
- package/examples/arcling/delfour/delfour.data.json +0 -67
- package/examples/arcling/delfour/delfour.expected.json +0 -88
- package/examples/arcling/delfour/delfour.model.go +0 -564
- package/examples/arcling/delfour/delfour.spec.md +0 -117
- package/examples/arcling/flandor/flandor.data.json +0 -106
- package/examples/arcling/flandor/flandor.expected.json +0 -98
- package/examples/arcling/flandor/flandor.model.go +0 -655
- package/examples/arcling/flandor/flandor.spec.md +0 -155
- package/examples/arcling/medior/medior.data.json +0 -96
- package/examples/arcling/medior/medior.expected.json +0 -100
- package/examples/arcling/medior/medior.model.go +0 -652
- package/examples/arcling/medior/medior.spec.md +0 -157
- package/test/arcling.test.js +0 -191
|
@@ -1,185 +1,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ARC-style examples in Eyeling
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This page points to the ARC-style examples that currently live in [`examples/`](../). The files themselves are one level up; this folder exists as a convenient index for readers who want to browse Eyeling examples that follow the same presentation pattern.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## What ARC is
|
|
6
6
|
|
|
7
|
-
In
|
|
7
|
+
[ARC](https://josd.github.io/arc/) stands for **Answer • Reason Why • Check**. The idea is to make a program do three things at once: give the result, explain the small reason that matters, and include a check that can fail loudly when an assumption is wrong. In practice, ARC turns a runnable example into a small, auditable artifact rather than a black box.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
In Eyeling, ARC fits naturally: facts hold the data, rules derive the result, `log:outputString` can render a human-readable report, and `=> false` rules can act as hard validation fuses.
|
|
10
10
|
|
|
11
|
-
## Insight Economy
|
|
11
|
+
## What the Insight Economy is
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Ruben Verborgh’s [Insight Economy](https://ruben.verborgh.org/blog/2025/08/12/inside-the-insight-economy/) argues that raw data is a bad thing to trade directly. Instead of handing over the source data, a system should refine it into a **specific, purpose-limited, time-bound insight** that is useful in one context, loses value when copied, and can be governed more safely.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
That makes the examples below especially relevant: Eyeling can derive those narrow insights explicitly, explain why they hold, and check that the resulting decision respects policy, purpose, and consistency constraints.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
- **Medior** keeps laboratory, medication, and readmission evidence local and turns it into a minimal post-discharge coordination insight that can justify activating a continuity bundle.
|
|
19
|
-
- **Flandor** keeps exporter, labour-market, and grid evidence local and turns it into a regional macro-economic insight that justifies a temporary retooling response.
|
|
17
|
+
## ARC-style examples in `examples/`
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
### Insight Economy and governed-data cases
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
- [`../auroracare.n3`](../auroracare.n3) — Purpose-based medical data exchange with explicit allow/deny reasoning and checks around role, purpose, and conditions.
|
|
22
|
+
- [`../calidor.n3`](../calidor.n3) — Heatwave-response case where private household signals become a narrow, expiring cooling-support insight.
|
|
23
|
+
- [`../delfour.n3`](../delfour.n3) — Shopping-assistance case where a private condition becomes a bounded “prefer lower-sugar products” insight.
|
|
24
|
+
- [`../flandor.n3`](../flandor.n3) — Macro-economic coordination case for Flanders that turns sensitive local signals into a regional retooling insight.
|
|
25
|
+
- [`../medior.n3`](../medior.n3) — Post-discharge care-coordination case that derives a minimal continuity-bundle insight without sharing the full record.
|
|
26
|
+
- [`../parcellocker.n3`](../parcellocker.n3) — One-time parcel pickup authorization with a clear permit decision, justification, and misuse checks.
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
### Core ARC-style walkthroughs
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
- [`../bmi.n3`](../bmi.n3) — Body Mass Index calculation with normalization, WHO category assignment, and boundary checks.
|
|
31
|
+
- [`../control-system.n3`](../control-system.n3) — Small control-system example that derives actuator commands and explains feedforward and feedback contributions.
|
|
32
|
+
- [`../easter.n3`](../easter.n3) — Gregorian Easter computus with a readable explanation and date-window checks.
|
|
33
|
+
- [`../french-cities.n3`](../french-cities.n3) — Graph reachability over French cities with explicit path reasoning.
|
|
34
|
+
- [`../gps.n3`](../gps.n3) — Tiny route-planning example for western Belgium with route comparison and metric checks.
|
|
35
|
+
- [`../resto.n3`](../resto.n3) — RESTdesc-style service composition from person and date to a concrete restaurant reservation.
|
|
36
|
+
- [`../sudoku.n3`](../sudoku.n3) — Sudoku solver and report generator with consistency checks over the solved grid.
|
|
37
|
+
- [`../wind-turbine.n3`](../wind-turbine.n3) — Predictive-maintenance example that turns sensor readings into an auditable inspection decision.
|
|
28
38
|
|
|
29
|
-
|
|
30
|
-
- a **reference realization** in Go,
|
|
31
|
-
- a **concrete instance** in JSON,
|
|
32
|
-
- and an **expected result** for comparison and regression testing.
|
|
39
|
+
### Technical and scientific ARC demos
|
|
33
40
|
|
|
34
|
-
|
|
41
|
+
- [`../matrix-mechanics.n3`](../matrix-mechanics.n3) — Small 2×2 matrix example deriving trace, determinant, products, and a non-zero commutator.
|
|
42
|
+
- [`../pn-junction-tunneling.n3`](../pn-junction-tunneling.n3) — Semiconductor toy model that explains current-proxy behavior across bias points.
|
|
43
|
+
- [`../transistor-switch.n3`](../transistor-switch.n3) — NPN low-side switch model with exact arithmetic and cutoff-versus-saturation checks.
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
### Deep-classification stress tests
|
|
37
46
|
|
|
38
|
-
ARC
|
|
47
|
+
- [`../deep-taxonomy-10.n3`](../deep-taxonomy-10.n3) — ARC-style deep-taxonomy benchmark at depth 10.
|
|
48
|
+
- [`../deep-taxonomy-100.n3`](../deep-taxonomy-100.n3) — ARC-style deep-taxonomy benchmark at depth 100.
|
|
49
|
+
- [`../deep-taxonomy-1000.n3`](../deep-taxonomy-1000.n3) — ARC-style deep-taxonomy benchmark at depth 1000.
|
|
50
|
+
- [`../deep-taxonomy-10000.n3`](../deep-taxonomy-10000.n3) — ARC-style deep-taxonomy benchmark at depth 10000.
|
|
51
|
+
- [`../deep-taxonomy-100000.n3`](../deep-taxonomy-100000.n3) — ARC-style deep-taxonomy benchmark at depth 100000.
|
|
39
52
|
|
|
40
|
-
|
|
41
|
-
- **Reason Why**
|
|
42
|
-
- **Check**
|
|
53
|
+
## Why these examples fit together
|
|
43
54
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
That means:
|
|
47
|
-
|
|
48
|
-
- the **answer** is clearly identifiable,
|
|
49
|
-
- the **reason why** is visible as named clauses or derived predicates,
|
|
50
|
-
- and the **check** is real, meaning it could fail for a meaningful reason.
|
|
51
|
-
|
|
52
|
-
## What belongs here
|
|
53
|
-
|
|
54
|
-
A case belongs in `examples/arcling/` when:
|
|
55
|
-
|
|
56
|
-
- there is a useful ARC-style case in `examples/`,
|
|
57
|
-
- there is value in giving the case a direct operational form,
|
|
58
|
-
- we want the logic to stay explicit and auditable,
|
|
59
|
-
- and we want a specification that can be read independently of the code.
|
|
60
|
-
|
|
61
|
-
Typical uses:
|
|
62
|
-
|
|
63
|
-
- policy and governance examples,
|
|
64
|
-
- privacy-preserving decision examples,
|
|
65
|
-
- cases with a stable logical core and a small executable shell,
|
|
66
|
-
- cases that benefit from conformance-style testing.
|
|
67
|
-
|
|
68
|
-
## The four files
|
|
69
|
-
|
|
70
|
-
Each Arcling case should contain these files.
|
|
71
|
-
|
|
72
|
-
### 1. `name.spec.md`
|
|
73
|
-
|
|
74
|
-
The normative case description.
|
|
75
|
-
|
|
76
|
-
This file should use **mathematical English**. It should define the vocabulary, the inputs, the derived predicates, the decision rule, the governance rule, the checks, and the output contract.
|
|
77
|
-
|
|
78
|
-
The spec should be written so that a careful reader can understand the case without reading the Go source first.
|
|
79
|
-
|
|
80
|
-
### 2. `name.data.json`
|
|
81
|
-
|
|
82
|
-
The concrete instance data.
|
|
83
|
-
|
|
84
|
-
This file contains the facts for the case: entities, thresholds, observed values, policies, timestamps, candidate actions, and any other case inputs.
|
|
85
|
-
|
|
86
|
-
### 3. `name.model.go`
|
|
87
|
-
|
|
88
|
-
The reference Go realization.
|
|
89
|
-
|
|
90
|
-
This file should implement the case directly and clearly. A good pattern is to map named clauses in the spec to named functions in the model.
|
|
91
|
-
|
|
92
|
-
For example:
|
|
93
|
-
|
|
94
|
-
- `clauseR1ExportWeakness`
|
|
95
|
-
- `clauseS2RecommendedPackage`
|
|
96
|
-
- `clauseG1AuthorizedUse`
|
|
97
|
-
- `clauseM2PayloadHash`
|
|
98
|
-
|
|
99
|
-
The model is not the normative source. It is the **reference realization** of the normative source.
|
|
100
|
-
|
|
101
|
-
Input validation is part of the reference model. A malformed instance should fail before evaluation rather than requiring a separate schema artifact.
|
|
102
|
-
|
|
103
|
-
### 4. `name.expected.json`
|
|
104
|
-
|
|
105
|
-
The expected derived result.
|
|
106
|
-
|
|
107
|
-
This file is the conformance vector for the case. It should capture the main derived predicates, the selected answer, the visible checks, and any stable integrity values needed for regression testing.
|
|
108
|
-
|
|
109
|
-
## How to read an Arcling case
|
|
110
|
-
|
|
111
|
-
A good reading order is:
|
|
112
|
-
|
|
113
|
-
1. start with `name.spec.md`,
|
|
114
|
-
2. inspect `name.data.json`,
|
|
115
|
-
3. run `go run name.model.go --json`,
|
|
116
|
-
4. compare the result with `name.expected.json`,
|
|
117
|
-
5. then relate the case back to its N3 counterpart.
|
|
118
|
-
|
|
119
|
-
That order keeps the meaning visible before the operational details.
|
|
120
|
-
|
|
121
|
-
## Relationship to the rest of `examples/`
|
|
122
|
-
|
|
123
|
-
A useful mental model is:
|
|
124
|
-
|
|
125
|
-
- `examples/` shows ARC cases in **declarative Eyeling form**,
|
|
126
|
-
- `examples/arcling/` shows the same kind of cases in **mathematical-English specification plus reference Go form**.
|
|
127
|
-
|
|
128
|
-
So the two collections are complementary:
|
|
129
|
-
|
|
130
|
-
- **N3** is best for seeing the logic in the open,
|
|
131
|
-
- **Arcling** is best for stating the case normatively and running a portable reference model.
|
|
132
|
-
|
|
133
|
-
## Design rules
|
|
134
|
-
|
|
135
|
-
When adding a case here, prefer the following.
|
|
136
|
-
|
|
137
|
-
### 1. Keep the spec normative
|
|
138
|
-
|
|
139
|
-
The spec should say what the case means. It should not merely paraphrase the code.
|
|
140
|
-
|
|
141
|
-
### 2. Keep the code direct
|
|
142
|
-
|
|
143
|
-
The Go model should say what it does and do what it says. Avoid unnecessary framework machinery.
|
|
144
|
-
|
|
145
|
-
### 3. Keep the data separate
|
|
146
|
-
|
|
147
|
-
Case facts belong in JSON, not hard-coded into the prose.
|
|
148
|
-
|
|
149
|
-
### 4. Keep checks substantive
|
|
150
|
-
|
|
151
|
-
A check should add confidence. It should not only restate the answer.
|
|
152
|
-
|
|
153
|
-
### 5. Keep names aligned
|
|
154
|
-
|
|
155
|
-
If a case is called `delfour`, `medior`, or `flandor` in `examples/`, the Arcling case should use the same base name.
|
|
156
|
-
|
|
157
|
-
## Suggested workflow for a new case
|
|
158
|
-
|
|
159
|
-
1. Start from a strong ARC-style N3 example.
|
|
160
|
-
2. Write a mathematical-English specification of the case.
|
|
161
|
-
3. Move the concrete instance into JSON.
|
|
162
|
-
4. Implement a small Go reference model.
|
|
163
|
-
5. Capture the expected result in JSON.
|
|
164
|
-
6. Keep the visible output in Answer / Reason Why / Check shape.
|
|
165
|
-
7. Link the Arcling case to its N3 counterpart.
|
|
166
|
-
|
|
167
|
-
## What Arcling is not
|
|
168
|
-
|
|
169
|
-
Arcling is not:
|
|
170
|
-
|
|
171
|
-
- a replacement for declarative Eyeling,
|
|
172
|
-
- a performance collection,
|
|
173
|
-
- a general application framework,
|
|
174
|
-
- or a place for prose that cannot be tested.
|
|
175
|
-
|
|
176
|
-
It exists to make a case simultaneously:
|
|
177
|
-
|
|
178
|
-
- readable,
|
|
179
|
-
- executable,
|
|
180
|
-
- checkable,
|
|
181
|
-
- and portable.
|
|
182
|
-
|
|
183
|
-
## In one line
|
|
184
|
-
|
|
185
|
-
`examples/arcling/` presents ARC cases in mathematical English with reference Go realizations, JSON instances, and expected results, alongside declarative Eyeling examples.
|
|
55
|
+
These files all present reasoning in a recognizably ARC-like way: they derive an answer, make the reason visible in a compact report, and include checks that are meant to catch real mistakes. Some are classical logic or numeric examples; others show how Eyeling can express policy-aware, insight-oriented decision flows without collapsing everything into opaque application code.
|