eyeling 1.22.6 → 1.22.8
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/HANDBOOK.md +245 -0
- package/dist/browser/eyeling.browser.js +188 -33
- package/examples/act-alarm-bit-interoperability.n3 +180 -0
- package/examples/act-barley-seed-lineage.n3 +565 -0
- package/examples/act-docking-abort.n3 +285 -0
- package/examples/act-gravity-mediator-witness.n3 +235 -0
- package/examples/act-isolation-breach.n3 +354 -0
- package/examples/act-photosynthetic-exciton-transfer.n3 +245 -0
- package/examples/act-sensor-memory-reset.n3 +190 -0
- package/examples/act-tunnel-junction-wake-switch.n3 +225 -0
- package/examples/act-yeast-self-reproduction.n3 +248 -0
- package/examples/complex-matrix-stability.n3 +288 -0
- package/examples/deck/act-barley-seed-lineage.md +593 -0
- package/examples/fundamental-theorem-arithmetic.n3 +244 -0
- package/examples/harborsmr.n3 +233 -0
- package/examples/meta-rule-audit.n3 +135 -0
- package/examples/output/act-alarm-bit-interoperability.txt +20 -0
- package/examples/output/act-barley-seed-lineage.txt +25 -0
- package/examples/output/act-docking-abort.txt +22 -0
- package/examples/output/act-gravity-mediator-witness.txt +24 -0
- package/examples/output/act-isolation-breach.txt +27 -0
- package/examples/output/act-photosynthetic-exciton-transfer.txt +20 -0
- package/examples/output/act-sensor-memory-reset.txt +20 -0
- package/examples/output/act-tunnel-junction-wake-switch.txt +21 -0
- package/examples/output/act-yeast-self-reproduction.txt +23 -0
- package/examples/output/complex-matrix-stability.txt +14 -0
- package/examples/output/fundamental-theorem-arithmetic.txt +15 -0
- package/examples/output/get-uuid.n3 +2 -2
- package/examples/output/harborsmr.txt +20 -0
- package/examples/output/meta-rule-audit.n3 +44 -0
- package/examples/output/theory-diff.n3 +22 -0
- package/examples/theory-diff.n3 +125 -0
- package/eyeling.js +188 -33
- package/lib/builtins.js +18 -1
- package/lib/cli.js +31 -5
- package/lib/engine.js +139 -27
- package/package.json +1 -1
- package/test/api.test.js +100 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# Fundamental Theorem of Arithmetic — ARC-style
|
|
3
|
+
#
|
|
4
|
+
# Single scenario:
|
|
5
|
+
# n = 202692987 = 3^2 * 7 * 829 * 3881
|
|
6
|
+
#
|
|
7
|
+
# This example translates the Eyelet/Prolog ARC example into Notation3 for
|
|
8
|
+
# Eyeling. It computes the prime factors of one target integer by repeated
|
|
9
|
+
# smallest-divisor decomposition, reports the result in ARC form, and includes
|
|
10
|
+
# independent checks for product reconstruction, primality, and uniqueness up
|
|
11
|
+
# to order.
|
|
12
|
+
# ============================================================================
|
|
13
|
+
|
|
14
|
+
@prefix : <https://example.org/fundamental-theorem-arithmetic#> .
|
|
15
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
16
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
|
|
17
|
+
@prefix list: <http://www.w3.org/2000/10/swap/list#> .
|
|
18
|
+
@prefix string: <http://www.w3.org/2000/10/swap/string#> .
|
|
19
|
+
|
|
20
|
+
# --------------
|
|
21
|
+
# Editable input
|
|
22
|
+
# --------------
|
|
23
|
+
|
|
24
|
+
:Case
|
|
25
|
+
:n 202692987;
|
|
26
|
+
:expectedSmallestFactors (3 3 7 829 3881);
|
|
27
|
+
:expectedPrimePower "3^2 * 7 * 829 * 3881";
|
|
28
|
+
:expectedFlat "3 * 3 * 7 * 829 * 3881";
|
|
29
|
+
:expectedLargestFlat "3881 * 829 * 7 * 3 * 3".
|
|
30
|
+
|
|
31
|
+
# -------------------------
|
|
32
|
+
# Backward helper relations
|
|
33
|
+
# -------------------------
|
|
34
|
+
|
|
35
|
+
# divides0(A,B): A divides B in the positive integers.
|
|
36
|
+
{ (?A ?B) :divides0 true }
|
|
37
|
+
<=
|
|
38
|
+
{ ?A math:greaterThan 0.
|
|
39
|
+
?B math:greaterThan 0.
|
|
40
|
+
(?B ?A) math:remainder 0. } .
|
|
41
|
+
|
|
42
|
+
# trialPrime(P): simple trial-division primality for individual numbers.
|
|
43
|
+
{ 2 :trialPrime true } <= true.
|
|
44
|
+
{ 3 :trialPrime true } <= true.
|
|
45
|
+
|
|
46
|
+
{ ?P :trialPrime true }
|
|
47
|
+
<=
|
|
48
|
+
{ ?P math:greaterThan 3.
|
|
49
|
+
(?P 2) :smallestDivisorFrom ?P. } .
|
|
50
|
+
|
|
51
|
+
# smallestDivisorFrom(N,D,S): S is the smallest divisor of N starting from D.
|
|
52
|
+
{ (?N ?D) :smallestDivisorFrom ?D }
|
|
53
|
+
<=
|
|
54
|
+
{ (?D ?N) :divides0 true. } .
|
|
55
|
+
|
|
56
|
+
{ (?N ?D) :smallestDivisorFrom ?N }
|
|
57
|
+
<=
|
|
58
|
+
{ (?D ?D) math:product ?D2.
|
|
59
|
+
?D2 math:greaterThan ?N. } .
|
|
60
|
+
|
|
61
|
+
{ (?N ?D) :smallestDivisorFrom ?S }
|
|
62
|
+
<=
|
|
63
|
+
{ 1 log:notIncludes { (?D ?N) :divides0 true. }.
|
|
64
|
+
(?D ?D) math:product ?D2.
|
|
65
|
+
?D2 math:notGreaterThan ?N.
|
|
66
|
+
(?D 1) math:sum ?D1.
|
|
67
|
+
(?N ?D1) :smallestDivisorFrom ?S. } .
|
|
68
|
+
|
|
69
|
+
# factorSmallest(N,Fs): prime factors of N in nondecreasing order.
|
|
70
|
+
{ ?N :factorSmallest () }
|
|
71
|
+
<=
|
|
72
|
+
{ ?N math:lessThan 2. } .
|
|
73
|
+
|
|
74
|
+
{ ?N :factorSmallest (?N) }
|
|
75
|
+
<=
|
|
76
|
+
{ ?N math:notLessThan 2.
|
|
77
|
+
(?N 2) :smallestDivisorFrom ?D.
|
|
78
|
+
?D math:equalTo ?N. } .
|
|
79
|
+
|
|
80
|
+
{ ?N :factorSmallest ?Fs }
|
|
81
|
+
<=
|
|
82
|
+
{ ?N math:notLessThan 2.
|
|
83
|
+
(?N 2) :smallestDivisorFrom ?D.
|
|
84
|
+
?D math:notEqualTo ?N.
|
|
85
|
+
(?N ?D) math:integerQuotient ?N1.
|
|
86
|
+
?D :factorSmallest ?Fs1.
|
|
87
|
+
?N1 :factorSmallest ?Fs2.
|
|
88
|
+
(?Fs1 ?Fs2) list:append ?Fs. } .
|
|
89
|
+
|
|
90
|
+
# factorLargest(N,Fs): same factors in reverse order.
|
|
91
|
+
{ ?N :factorLargest ?Fs }
|
|
92
|
+
<=
|
|
93
|
+
{ ?N :factorSmallest ?Small.
|
|
94
|
+
?Small list:reverse ?Fs. } .
|
|
95
|
+
|
|
96
|
+
# product(Fs,P): product of all numbers in an RDF list.
|
|
97
|
+
{ () :product 1 }
|
|
98
|
+
<=
|
|
99
|
+
true .
|
|
100
|
+
|
|
101
|
+
{ ?Fs :product ?P }
|
|
102
|
+
<=
|
|
103
|
+
{ ?Fs list:firstRest (?X ?Rest).
|
|
104
|
+
?Rest :product ?P0.
|
|
105
|
+
(?X ?P0) math:product ?P. } .
|
|
106
|
+
|
|
107
|
+
# ---------------------------
|
|
108
|
+
# Materialized scenario facts
|
|
109
|
+
# ---------------------------
|
|
110
|
+
|
|
111
|
+
{ :Case :n ?N.
|
|
112
|
+
?N :factorSmallest ?Fs.
|
|
113
|
+
?N :factorLargest ?Fr.
|
|
114
|
+
?Fs :product ?P.
|
|
115
|
+
?Fs list:sort ?SortedS.
|
|
116
|
+
?Fr list:sort ?SortedL.
|
|
117
|
+
?Fs list:first ?Smallest.
|
|
118
|
+
?Fs list:last ?Largest. }
|
|
119
|
+
=>
|
|
120
|
+
{ :Case :factorsSmallest ?Fs;
|
|
121
|
+
:factorsLargest ?Fr;
|
|
122
|
+
:product ?P;
|
|
123
|
+
:sortedSmallest ?SortedS;
|
|
124
|
+
:sortedLargest ?SortedL;
|
|
125
|
+
:smallestPrimeFactor ?Smallest;
|
|
126
|
+
:largestPrimeFactor ?Largest. } .
|
|
127
|
+
|
|
128
|
+
{ :Case :factorsSmallest ?Fs; :expectedSmallestFactors ?Fs. }
|
|
129
|
+
=>
|
|
130
|
+
{ :Case :flatFactorString "3 * 3 * 7 * 829 * 3881";
|
|
131
|
+
:primePowerString "3^2 * 7 * 829 * 3881";
|
|
132
|
+
:distinctPrimeCount 4;
|
|
133
|
+
:largestFlatFactorString "3881 * 829 * 7 * 3 * 3". } .
|
|
134
|
+
|
|
135
|
+
# ------------------
|
|
136
|
+
# Independent checks
|
|
137
|
+
# ------------------
|
|
138
|
+
|
|
139
|
+
{ :Case :factorsSmallest ?Fs; :expectedSmallestFactors ?Fs. }
|
|
140
|
+
=>
|
|
141
|
+
{ :Check :c1 "OK - repeated smallest-divisor decomposition produced the expected smallest-first factor list (3 3 7 829 3881).". } .
|
|
142
|
+
|
|
143
|
+
{ :Case :n ?N; :product ?N. }
|
|
144
|
+
=>
|
|
145
|
+
{ :Check :c2 "OK - the product of the computed factors reconstructs n = 202692987.". } .
|
|
146
|
+
|
|
147
|
+
{ 3 :trialPrime true.
|
|
148
|
+
7 :trialPrime true.
|
|
149
|
+
829 :trialPrime true.
|
|
150
|
+
3881 :trialPrime true. }
|
|
151
|
+
=>
|
|
152
|
+
{ :Check :c3 "OK - every distinct factor in the decomposition is prime by trial division.". } .
|
|
153
|
+
|
|
154
|
+
{ :Case :primePowerString ?S; :expectedPrimePower ?S. }
|
|
155
|
+
=>
|
|
156
|
+
{ :Check :c4 "OK - the prime-power form matches 3^2 * 7 * 829 * 3881.". } .
|
|
157
|
+
|
|
158
|
+
{ :Case :sortedSmallest ?S; :sortedLargest ?S. }
|
|
159
|
+
=>
|
|
160
|
+
{ :Check :c5 "OK - smallest-first and largest-first traversals have the same multiset of primes, so the factorization agrees up to order.". } .
|
|
161
|
+
|
|
162
|
+
{ :Case :smallestPrimeFactor 3; :largestPrimeFactor 3881. }
|
|
163
|
+
=>
|
|
164
|
+
{ :Check :c6 "OK - the smallest and largest prime factors are 3 and 3881.". } .
|
|
165
|
+
|
|
166
|
+
# -----
|
|
167
|
+
# Fuses
|
|
168
|
+
# -----
|
|
169
|
+
|
|
170
|
+
{ :Case :n ?N; :product ?P.
|
|
171
|
+
?P log:notEqualTo ?N. }
|
|
172
|
+
=> false .
|
|
173
|
+
|
|
174
|
+
{ :Case :factorsSmallest ?Fs; :expectedSmallestFactors ?Expected.
|
|
175
|
+
?Fs log:notEqualTo ?Expected. }
|
|
176
|
+
=> false .
|
|
177
|
+
|
|
178
|
+
{ :Case :sortedSmallest ?A; :sortedLargest ?B.
|
|
179
|
+
?A log:notEqualTo ?B. }
|
|
180
|
+
=> false .
|
|
181
|
+
|
|
182
|
+
{ 1 log:notIncludes { 3 :trialPrime true. }. }
|
|
183
|
+
=> false .
|
|
184
|
+
|
|
185
|
+
{ 1 log:notIncludes { 7 :trialPrime true. }. }
|
|
186
|
+
=> false .
|
|
187
|
+
|
|
188
|
+
{ 1 log:notIncludes { 829 :trialPrime true. }. }
|
|
189
|
+
=> false .
|
|
190
|
+
|
|
191
|
+
{ 1 log:notIncludes { 3881 :trialPrime true. }. }
|
|
192
|
+
=> false .
|
|
193
|
+
|
|
194
|
+
{ :Case :smallestPrimeFactor ?S.
|
|
195
|
+
?S log:notEqualTo 3. }
|
|
196
|
+
=> false .
|
|
197
|
+
|
|
198
|
+
{ :Case :largestPrimeFactor ?L.
|
|
199
|
+
?L log:notEqualTo 3881. }
|
|
200
|
+
=> false .
|
|
201
|
+
|
|
202
|
+
{ :Case :factorsSmallest ?A, ?B.
|
|
203
|
+
?A log:notEqualTo ?B. }
|
|
204
|
+
=> false .
|
|
205
|
+
|
|
206
|
+
# ---------------------
|
|
207
|
+
# Answer and reason why
|
|
208
|
+
# ---------------------
|
|
209
|
+
|
|
210
|
+
{ :Case :n ?N;
|
|
211
|
+
:flatFactorString ?Flat;
|
|
212
|
+
:primePowerString ?PrimePower;
|
|
213
|
+
:largestFlatFactorString ?LargestFlat;
|
|
214
|
+
:distinctPrimeCount ?Distinct;
|
|
215
|
+
:smallestPrimeFactor ?Smallest;
|
|
216
|
+
:largestPrimeFactor ?Largest.
|
|
217
|
+
:Check :c1 ?C1.
|
|
218
|
+
:Check :c2 ?C2.
|
|
219
|
+
:Check :c3 ?C3.
|
|
220
|
+
:Check :c4 ?C4.
|
|
221
|
+
:Check :c5 ?C5.
|
|
222
|
+
:Check :c6 ?C6.
|
|
223
|
+
(
|
|
224
|
+
"Fundamental Theorem of Arithmetic — ARC-style\n\n"
|
|
225
|
+
"Answer\n"
|
|
226
|
+
"For n = " ?N ", the prime factors are " ?Flat ", the prime-power form is " ?PrimePower
|
|
227
|
+
", and the product of these factors is " ?N " with " ?Distinct " distinct primes.\n\n"
|
|
228
|
+
"Reason Why\n"
|
|
229
|
+
"Existence in this run comes from repeated smallest-divisor decomposition: " ?N
|
|
230
|
+
" factors as " ?Flat ". Each distinct factor is prime. "
|
|
231
|
+
"For uniqueness up to order, the reverse traversal gives " ?LargestFlat
|
|
232
|
+
", and both traversals sort to the same multiset of primes. "
|
|
233
|
+
"So this concrete case exhibits the Fundamental Theorem of Arithmetic for " ?N
|
|
234
|
+
": a prime factorization exists and is unique up to order. The extreme prime factors are " ?Smallest " and " ?Largest ".\n\n"
|
|
235
|
+
"Check\n"
|
|
236
|
+
"C1 " ?C1 "\n"
|
|
237
|
+
"C2 " ?C2 "\n"
|
|
238
|
+
"C3 " ?C3 "\n"
|
|
239
|
+
"C4 " ?C4 "\n"
|
|
240
|
+
"C5 " ?C5 "\n"
|
|
241
|
+
"C6 " ?C6 "\n"
|
|
242
|
+
) string:concatenation ?Block. }
|
|
243
|
+
=>
|
|
244
|
+
{ :report log:outputString ?Block. } .
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# ===========================================================================
|
|
2
|
+
# HarborSMR — bounded flexible-export insight for port electrolysis.
|
|
3
|
+
#
|
|
4
|
+
# The port hydrogen hub does not need raw reactor telemetry in order
|
|
5
|
+
# to schedule one electrolyzer train for a short window.
|
|
6
|
+
#
|
|
7
|
+
# The SMR operator keeps detailed plant data local. What crosses the boundary
|
|
8
|
+
# is a narrow, expiring insight: a temporary flexible-export window of 18 MW,
|
|
9
|
+
# scoped to the port hydrogen hub and usable only for electrolysis dispatch.
|
|
10
|
+
#
|
|
11
|
+
# That is the Insight Economy in action. The hub receives a permissioned
|
|
12
|
+
# decision object rather than control-rod positions, neutron flux traces,
|
|
13
|
+
# or other sensitive operational telemetry.
|
|
14
|
+
# ===========================================================================
|
|
15
|
+
|
|
16
|
+
@prefix : <https://example.org/insight/harborsmr/> .
|
|
17
|
+
@prefix arc: <https://example.org/arc#> .
|
|
18
|
+
@prefix ins: <https://example.org/insight-economy#> .
|
|
19
|
+
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
|
|
20
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
21
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#> .
|
|
22
|
+
@prefix string: <http://www.w3.org/2000/10/swap/string#> .
|
|
23
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
24
|
+
|
|
25
|
+
# -----
|
|
26
|
+
# Facts
|
|
27
|
+
# -----
|
|
28
|
+
|
|
29
|
+
:case a arc:Case ;
|
|
30
|
+
:caseName "harborsmr" ;
|
|
31
|
+
arc:question "May the port hydrogen hub use a temporary SMR flexible-export insight to schedule electrolysis for the next four-hour balancing window?" ;
|
|
32
|
+
:requestPurpose "electrolysis_dispatch" ;
|
|
33
|
+
:requestAction odrl:use ;
|
|
34
|
+
:hubAuthAt "2026-06-18T13:10:00+00:00"^^xsd:dateTime .
|
|
35
|
+
|
|
36
|
+
:portHydrogenHub a :IndustrialOfftaker ;
|
|
37
|
+
:hubName "North Quay Hydrogen Hub" .
|
|
38
|
+
|
|
39
|
+
:secureAggregate a :SecureAggregate ;
|
|
40
|
+
:availableFlexibleExportMW 18 ;
|
|
41
|
+
:reserveMarginMW 24 ;
|
|
42
|
+
:coolingMarginPct 18 ;
|
|
43
|
+
:plannedOutage false ;
|
|
44
|
+
:containsCoreTemperature false ;
|
|
45
|
+
:containsRodPosition false ;
|
|
46
|
+
:containsNeutronFlux false ;
|
|
47
|
+
:containsOperatorBadgeIds false .
|
|
48
|
+
|
|
49
|
+
:flexInsight a ins:Insight ;
|
|
50
|
+
:id <https://example.org/insight/harborsmr> ;
|
|
51
|
+
:metric "temporary_flexible_export_window" ;
|
|
52
|
+
:targetLoad "PEM_electrolyzer_train_2" ;
|
|
53
|
+
:exportMW 18 ;
|
|
54
|
+
:windowStart "2026-06-18T14:00:00+00:00"^^xsd:dateTime ;
|
|
55
|
+
:expiresAt "2026-06-18T18:00:00+00:00"^^xsd:dateTime ;
|
|
56
|
+
:scopeDevice "port-hydrogen-hub" ;
|
|
57
|
+
:scopeEvent "day_ahead_balancing" ;
|
|
58
|
+
:serializedLowercase """{"createdat":"2026-06-18t13:00:00+00:00","expiresat":"2026-06-18t18:00:00+00:00","exportmw":18,"id":"https://example.org/insight/harborsmr","metric":"temporary_flexible_export_window","scopedevice":"port-hydrogen-hub","scopeevent":"day_ahead_balancing","targetload":"pem_electrolyzer_train_2","type":"ins:insight"}""" .
|
|
59
|
+
|
|
60
|
+
:electrolyzerRequest a :Request ;
|
|
61
|
+
:requester :portHydrogenHub ;
|
|
62
|
+
:requestedMW 16 ;
|
|
63
|
+
:purpose "electrolysis_dispatch" ;
|
|
64
|
+
:targetLoad "PEM_electrolyzer_train_2" .
|
|
65
|
+
|
|
66
|
+
:dispatchPlan a :DispatchPlan ;
|
|
67
|
+
:dispatchMW 16 ;
|
|
68
|
+
:windowStart "2026-06-18T14:00:00+00:00"^^xsd:dateTime ;
|
|
69
|
+
:windowEnd "2026-06-18T18:00:00+00:00"^^xsd:dateTime ;
|
|
70
|
+
:forLoad "PEM_electrolyzer_train_2" .
|
|
71
|
+
|
|
72
|
+
:policy a odrl:Policy ;
|
|
73
|
+
:profile "HarborSMR-Insight-Policy" ;
|
|
74
|
+
odrl:permission [
|
|
75
|
+
odrl:action odrl:use ;
|
|
76
|
+
odrl:target <https://example.org/insight/harborsmr> ;
|
|
77
|
+
odrl:constraint [
|
|
78
|
+
odrl:leftOperand odrl:purpose ;
|
|
79
|
+
odrl:operator odrl:eq ;
|
|
80
|
+
odrl:rightOperand "electrolysis_dispatch"
|
|
81
|
+
]
|
|
82
|
+
] ;
|
|
83
|
+
odrl:prohibition [
|
|
84
|
+
odrl:action odrl:distribute ;
|
|
85
|
+
odrl:target <https://example.org/insight/harborsmr> ;
|
|
86
|
+
odrl:constraint [
|
|
87
|
+
odrl:leftOperand odrl:purpose ;
|
|
88
|
+
odrl:operator odrl:eq ;
|
|
89
|
+
odrl:rightOperand "market_resale"
|
|
90
|
+
]
|
|
91
|
+
] .
|
|
92
|
+
|
|
93
|
+
# -----
|
|
94
|
+
# Logic
|
|
95
|
+
# -----
|
|
96
|
+
|
|
97
|
+
{ :secureAggregate :reserveMarginMW ?mw .
|
|
98
|
+
?mw math:greaterThan 19 .
|
|
99
|
+
} => { :case :checkC1 :Passed . } .
|
|
100
|
+
|
|
101
|
+
{ :secureAggregate :coolingMarginPct ?pct .
|
|
102
|
+
?pct math:greaterThan 14 .
|
|
103
|
+
} => { :case :checkC2 :Passed . } .
|
|
104
|
+
|
|
105
|
+
{ :secureAggregate :plannedOutage false .
|
|
106
|
+
} => { :case :checkC3 :Passed . } .
|
|
107
|
+
|
|
108
|
+
{ :electrolyzerRequest :requestedMW ?req .
|
|
109
|
+
:flexInsight :exportMW ?cap .
|
|
110
|
+
?req math:notGreaterThan ?cap .
|
|
111
|
+
} => { :case :checkC4 :Passed . } .
|
|
112
|
+
|
|
113
|
+
{ :flexInsight :serializedLowercase ?s .
|
|
114
|
+
?s string:notMatches "coretemp|rodposition|neutronflux|operatorbadge" .
|
|
115
|
+
} => { :case :checkC5 :Passed . } .
|
|
116
|
+
|
|
117
|
+
{ :secureAggregate
|
|
118
|
+
:containsCoreTemperature false ;
|
|
119
|
+
:containsRodPosition false ;
|
|
120
|
+
:containsNeutronFlux false ;
|
|
121
|
+
:containsOperatorBadgeIds false .
|
|
122
|
+
} => { :case :checkC6 :Passed . } .
|
|
123
|
+
|
|
124
|
+
{ :policy odrl:permission [
|
|
125
|
+
odrl:action odrl:use ;
|
|
126
|
+
odrl:target <https://example.org/insight/harborsmr> ;
|
|
127
|
+
odrl:constraint [
|
|
128
|
+
odrl:leftOperand odrl:purpose ;
|
|
129
|
+
odrl:operator odrl:eq ;
|
|
130
|
+
odrl:rightOperand "electrolysis_dispatch"
|
|
131
|
+
]
|
|
132
|
+
] .
|
|
133
|
+
:case :hubAuthAt ?authAt .
|
|
134
|
+
:flexInsight :expiresAt ?expiresAt .
|
|
135
|
+
?authAt math:notGreaterThan ?expiresAt .
|
|
136
|
+
} => { :case :checkC7 :Passed . } .
|
|
137
|
+
|
|
138
|
+
{ :policy odrl:prohibition [
|
|
139
|
+
odrl:action odrl:distribute ;
|
|
140
|
+
odrl:target <https://example.org/insight/harborsmr> ;
|
|
141
|
+
odrl:constraint [
|
|
142
|
+
odrl:leftOperand odrl:purpose ;
|
|
143
|
+
odrl:operator odrl:eq ;
|
|
144
|
+
odrl:rightOperand "market_resale"
|
|
145
|
+
]
|
|
146
|
+
] .
|
|
147
|
+
} => { :case :checkC8 :Passed . } .
|
|
148
|
+
|
|
149
|
+
{ :flexInsight
|
|
150
|
+
:scopeDevice ?device ;
|
|
151
|
+
:scopeEvent ?event ;
|
|
152
|
+
:windowStart ?start ;
|
|
153
|
+
:expiresAt ?end .
|
|
154
|
+
} => { :case :checkC9 :Passed . } .
|
|
155
|
+
|
|
156
|
+
{ :dispatchPlan :dispatchMW ?mw .
|
|
157
|
+
:electrolyzerRequest :requestedMW ?req .
|
|
158
|
+
:dispatchPlan :forLoad ?load .
|
|
159
|
+
:electrolyzerRequest :targetLoad ?load .
|
|
160
|
+
?req math:notGreaterThan ?mw .
|
|
161
|
+
} => { :case :checkC10 :Passed . } .
|
|
162
|
+
|
|
163
|
+
{ :case :checkC1 :Passed .
|
|
164
|
+
:case :checkC2 :Passed .
|
|
165
|
+
:case :checkC3 :Passed .
|
|
166
|
+
:case :checkC4 :Passed .
|
|
167
|
+
:case :checkC5 :Passed .
|
|
168
|
+
:case :checkC6 :Passed .
|
|
169
|
+
:case :checkC7 :Passed .
|
|
170
|
+
:case :checkC8 :Passed .
|
|
171
|
+
:case :checkC9 :Passed .
|
|
172
|
+
:case :checkC10 :Passed .
|
|
173
|
+
} => {
|
|
174
|
+
:case :decision :Permit .
|
|
175
|
+
:decision :target <https://example.org/insight/harborsmr> ;
|
|
176
|
+
:outcome "Allowed" .
|
|
177
|
+
} .
|
|
178
|
+
|
|
179
|
+
# ------------------
|
|
180
|
+
# Presentation (ARC)
|
|
181
|
+
# ------------------
|
|
182
|
+
|
|
183
|
+
{ :case :decision :Permit . }
|
|
184
|
+
=> {
|
|
185
|
+
:out log:outputString """HarborSMR — bounded flexible-export insight for port electrolysis
|
|
186
|
+
|
|
187
|
+
Answer
|
|
188
|
+
PERMIT
|
|
189
|
+
The port hydrogen hub may use the SMR insight to run PEM electrolyzer train 2 at 16 MW from 14:00 to 18:00.
|
|
190
|
+
|
|
191
|
+
Reason Why
|
|
192
|
+
The operator shares only a narrow, expiring insight that a temporary 18 MW flexible-export window is available. The request is for electrolysis dispatch only, the requested 16 MW fits inside the permitted window, safety margins are above threshold, no outage blocks the window, and the policy forbids redistribution for market resale. Raw reactor telemetry stays local.
|
|
193
|
+
|
|
194
|
+
Check
|
|
195
|
+
C1 OK - reserve margin exceeds the dispatch threshold
|
|
196
|
+
C2 OK - cooling margin exceeds the dispatch threshold
|
|
197
|
+
C3 OK - no planned outage blocks the window
|
|
198
|
+
C4 OK - requested MW fits within the export window
|
|
199
|
+
C5 OK - serialized insight omits sensitive telemetry terms
|
|
200
|
+
C6 OK - aggregate excludes core temperature, rod position, neutron flux, and operator IDs
|
|
201
|
+
C7 OK - policy allows use for electrolysis dispatch before expiry
|
|
202
|
+
C8 OK - policy prohibits redistribution for market resale
|
|
203
|
+
C9 OK - scope is explicit: device, event, start, and expiry
|
|
204
|
+
C10 OK - dispatch plan matches the requested load and power
|
|
205
|
+
""" .
|
|
206
|
+
} .
|
|
207
|
+
|
|
208
|
+
# ----------------
|
|
209
|
+
# Fail-loud checks
|
|
210
|
+
# ----------------
|
|
211
|
+
|
|
212
|
+
{ :case :decision :Permit .
|
|
213
|
+
:electrolyzerRequest :requestedMW ?req .
|
|
214
|
+
:flexInsight :exportMW ?cap .
|
|
215
|
+
?req math:greaterThan ?cap .
|
|
216
|
+
} => false .
|
|
217
|
+
|
|
218
|
+
{ :case :decision :Permit .
|
|
219
|
+
:secureAggregate :plannedOutage ?x .
|
|
220
|
+
?x log:notEqualTo false .
|
|
221
|
+
} => false .
|
|
222
|
+
|
|
223
|
+
{ :case :decision :Permit .
|
|
224
|
+
:case :hubAuthAt ?authAt .
|
|
225
|
+
:flexInsight :expiresAt ?expiresAt .
|
|
226
|
+
?authAt math:greaterThan ?expiresAt .
|
|
227
|
+
} => false .
|
|
228
|
+
|
|
229
|
+
{ :case :decision :Permit .
|
|
230
|
+
:dispatchPlan :forLoad ?planLoad .
|
|
231
|
+
:electrolyzerRequest :targetLoad ?requestLoad .
|
|
232
|
+
?planLoad log:notEqualTo ?requestLoad .
|
|
233
|
+
} => false .
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# =====================================================================
|
|
2
|
+
# Meta-rule audit with quoted =>, <=, includes
|
|
3
|
+
#
|
|
4
|
+
# This example audits a quoted theory that mixes:
|
|
5
|
+
# - a bidirectional rule pair,
|
|
6
|
+
# - a forward-only rule,
|
|
7
|
+
# - a backward-only rule,
|
|
8
|
+
# and checks which rule bodies are currently active.
|
|
9
|
+
#
|
|
10
|
+
# It exercises:
|
|
11
|
+
# - quoted formulas as first-class terms
|
|
12
|
+
# - log:includes with { ?B log:implies ?H }
|
|
13
|
+
# - log:includes with { ?H log:impliedBy ?B }
|
|
14
|
+
# - log:notIncludes to detect missing dual rules
|
|
15
|
+
# - reusing a bound quoted body formula as the argument of log:includes
|
|
16
|
+
#
|
|
17
|
+
# Expected highlights:
|
|
18
|
+
# - subclass lifting is bidirectional and active
|
|
19
|
+
# - parentOf -> childOf is forward-only and active
|
|
20
|
+
# - worksFor <= employs is backward-only and active
|
|
21
|
+
# =====================================================================
|
|
22
|
+
|
|
23
|
+
@prefix : <http://example.org/> .
|
|
24
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
25
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
26
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
27
|
+
|
|
28
|
+
<> :theory {
|
|
29
|
+
|
|
30
|
+
# Bidirectional pair
|
|
31
|
+
{
|
|
32
|
+
?X a ?C .
|
|
33
|
+
?C rdfs:subClassOf ?D .
|
|
34
|
+
}
|
|
35
|
+
=>
|
|
36
|
+
{
|
|
37
|
+
?X a ?D .
|
|
38
|
+
}.
|
|
39
|
+
|
|
40
|
+
{
|
|
41
|
+
?X a ?D .
|
|
42
|
+
}
|
|
43
|
+
<=
|
|
44
|
+
{
|
|
45
|
+
?X a ?C .
|
|
46
|
+
?C rdfs:subClassOf ?D .
|
|
47
|
+
}.
|
|
48
|
+
|
|
49
|
+
# Forward-only rule
|
|
50
|
+
{
|
|
51
|
+
?P :parentOf ?Q .
|
|
52
|
+
}
|
|
53
|
+
=>
|
|
54
|
+
{
|
|
55
|
+
?Q :childOf ?P .
|
|
56
|
+
}.
|
|
57
|
+
|
|
58
|
+
# Backward-only rule
|
|
59
|
+
{
|
|
60
|
+
?P :worksFor ?Org .
|
|
61
|
+
}
|
|
62
|
+
<=
|
|
63
|
+
{
|
|
64
|
+
?Org :employs ?P .
|
|
65
|
+
}.
|
|
66
|
+
|
|
67
|
+
# Facts that activate all three bodies
|
|
68
|
+
:alice a :Student .
|
|
69
|
+
:Student rdfs:subClassOf :Person .
|
|
70
|
+
|
|
71
|
+
:alice :parentOf :bob .
|
|
72
|
+
|
|
73
|
+
:acme :employs :carol .
|
|
74
|
+
}.
|
|
75
|
+
|
|
76
|
+
# --------------------------------------------------
|
|
77
|
+
# Audit the quoted theory for forward/backward pairs
|
|
78
|
+
# --------------------------------------------------
|
|
79
|
+
|
|
80
|
+
{
|
|
81
|
+
?W :theory ?F.
|
|
82
|
+
?F log:includes { ?B log:implies ?H }.
|
|
83
|
+
?F log:includes { ?H log:impliedBy ?B }.
|
|
84
|
+
}
|
|
85
|
+
=>
|
|
86
|
+
{
|
|
87
|
+
?B :ruleStatus :Bidirectional .
|
|
88
|
+
?B :ruleHead ?H .
|
|
89
|
+
}.
|
|
90
|
+
|
|
91
|
+
{
|
|
92
|
+
?W :theory ?F.
|
|
93
|
+
?F log:includes { ?B log:implies ?H }.
|
|
94
|
+
?F log:notIncludes { ?H log:impliedBy ?B }.
|
|
95
|
+
}
|
|
96
|
+
=>
|
|
97
|
+
{
|
|
98
|
+
?B :ruleStatus :ForwardOnly .
|
|
99
|
+
?B :ruleHead ?H .
|
|
100
|
+
}.
|
|
101
|
+
|
|
102
|
+
{
|
|
103
|
+
?W :theory ?F.
|
|
104
|
+
?F log:includes { ?H log:impliedBy ?B }.
|
|
105
|
+
?F log:notIncludes { ?B log:implies ?H }.
|
|
106
|
+
}
|
|
107
|
+
=>
|
|
108
|
+
{
|
|
109
|
+
?B :ruleStatus :BackwardOnly .
|
|
110
|
+
?B :ruleHead ?H .
|
|
111
|
+
}.
|
|
112
|
+
|
|
113
|
+
# --------------------------------------
|
|
114
|
+
# Check which rule bodies are active now
|
|
115
|
+
# --------------------------------------
|
|
116
|
+
|
|
117
|
+
{
|
|
118
|
+
?W :theory ?F.
|
|
119
|
+
?F log:includes { ?B log:implies ?H }.
|
|
120
|
+
?F log:includes ?B.
|
|
121
|
+
}
|
|
122
|
+
=>
|
|
123
|
+
{
|
|
124
|
+
?B :activeAs :ForwardBody .
|
|
125
|
+
}.
|
|
126
|
+
|
|
127
|
+
{
|
|
128
|
+
?W :theory ?F.
|
|
129
|
+
?F log:includes { ?H log:impliedBy ?B }.
|
|
130
|
+
?F log:includes ?B.
|
|
131
|
+
}
|
|
132
|
+
=>
|
|
133
|
+
{
|
|
134
|
+
?B :activeAs :BackwardBody .
|
|
135
|
+
}.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
ACT harbor alarm bit interoperability
|
|
2
|
+
|
|
3
|
+
Answer
|
|
4
|
+
YES for the classical alarm bit.
|
|
5
|
+
NO for universal cloning and unrestricted fan-out of the quantum-like token.
|
|
6
|
+
|
|
7
|
+
Reason Why
|
|
8
|
+
The alarm state is modeled as an abstract bit carried by two unlike classical substrates. Because both the optical beacon and the relay register are information media for the same variable, local permutation and copying in both directions are possible. By contrast, the quantum-like token is treated as a superinformation medium, so universal cloning of all of its states is impossible, and unrestricted classical-style fan-out is blocked as well.
|
|
9
|
+
|
|
10
|
+
Check
|
|
11
|
+
C1 OK - the optical beacon is an information medium
|
|
12
|
+
C2 OK - the relay register is an information medium
|
|
13
|
+
C3 OK - both substrates encode the same abstract variable: AlarmBit
|
|
14
|
+
C4 OK - AlarmBit can be copied from optical beacon to relay register
|
|
15
|
+
C5 OK - AlarmBit can be copied from relay register to optical beacon
|
|
16
|
+
C6 OK - local permutation of AlarmBit is possible on the optical beacon
|
|
17
|
+
C7 OK - local permutation of AlarmBit is possible on the relay register
|
|
18
|
+
C8 OK - cloning all states of the quantum token is an impossible task
|
|
19
|
+
C9 OK - the quantum token cannot be universally cloned
|
|
20
|
+
C10 OK - the quantum token cannot support unrestricted classical-style fan-out
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
ACT barley seed lineage — can and can't
|
|
2
|
+
|
|
3
|
+
Answer
|
|
4
|
+
YES for the viable barley lineage.
|
|
5
|
+
NO for the contrast lineages when digital heredity, repair, protected dormancy, or heritable variation are missing.
|
|
6
|
+
|
|
7
|
+
Reason Why
|
|
8
|
+
The main lineage can achieve genome copying under no-design laws because its hereditary information is digitally instantiated. It can also pass through protected dormancy, germinate, produce propagules, reproduce accurately, close its life cycle, and adaptively persist under saline selection. But the contrast lineages show the "can't" side: non-digital heredity blocks accurate genome copying under no-design laws, lack of repair blocks accurate self-reproduction, lack of dormancy protection blocks lineage closure through a protected seed phase, and lack of heritable variation blocks adaptive evolution and thus blocks evolvability.
|
|
9
|
+
|
|
10
|
+
Check
|
|
11
|
+
C1 OK - no-design laws are assumed
|
|
12
|
+
C2 OK - the viable genome can be copied under no-design laws
|
|
13
|
+
C3 OK - the viable seed can achieve protected dormancy
|
|
14
|
+
C4 OK - the viable seed can germinate
|
|
15
|
+
C5 OK - the viable adult can produce propagules
|
|
16
|
+
C6 OK - the viable lineage can achieve accurate self-reproduction
|
|
17
|
+
C7 OK - the viable lineage can achieve lineage closure
|
|
18
|
+
C8 OK - the viable lineage can exhibit heritable variation
|
|
19
|
+
C9 OK - the viable lineage can adaptively persist
|
|
20
|
+
C10 OK - the viable lineage is evolvable
|
|
21
|
+
C11 OK - the non-digital lineage cannot achieve accurate self-reproduction
|
|
22
|
+
C12 OK - the repair-deficient lineage cannot achieve accurate self-reproduction
|
|
23
|
+
C13 OK - the coatless lineage cannot achieve lineage closure through protected dormancy
|
|
24
|
+
C14 OK - the static lineage cannot achieve adaptive evolution
|
|
25
|
+
C15 OK - the static lineage cannot be an evolvable lineage
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
ACT docking abort token — constructor-theory coverage case
|
|
2
|
+
|
|
3
|
+
Answer
|
|
4
|
+
YES for the classical abort token.
|
|
5
|
+
NO for universal cloning and unrestricted audit fan-out of the quantum seal.
|
|
6
|
+
|
|
7
|
+
Reason Why
|
|
8
|
+
The docking-abort token is treated as an abstract information variable carried by unlike classical media: lamp state, PLC register, radio frame, and audit display. Because those substrates are information media for the same variable, the token can be permuted locally, cloned locally, copied across media, measured into an output record, and embedded in serial and parallel task networks. By contrast, the quantum authenticity seal is treated as a superinformation medium, so cloning all of its states is impossible and unrestricted audit fan-out is blocked.
|
|
9
|
+
|
|
10
|
+
Check
|
|
11
|
+
C1 OK - the abort lamp is a computation medium
|
|
12
|
+
C2 OK - the abort lamp distinguishes the abort bit
|
|
13
|
+
C3 OK - permutation of the abort bit is possible on the abort lamp
|
|
14
|
+
C4 OK - local cloning of the abort bit is possible on the PLC register
|
|
15
|
+
C5 OK - the abort bit can be copied from lamp to PLC
|
|
16
|
+
C6 OK - the abort bit can be copied from PLC to radio frame
|
|
17
|
+
C7 OK - the abort bit can be measured from radio frame into the audit display
|
|
18
|
+
C8 OK - a serial network from lamp via PLC to audit display is possible
|
|
19
|
+
C9 OK - a parallel network from PLC to radio frame and audit display is possible
|
|
20
|
+
C10 OK - cloning all states of the quantum seal is an impossible task
|
|
21
|
+
C11 OK - the quantum seal cannot be universally cloned
|
|
22
|
+
C12 OK - the quantum seal cannot be used for unrestricted audit fan-out
|