eyeling 1.24.5 → 1.24.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 (294) hide show
  1. package/HANDBOOK.md +0 -99
  2. package/README.md +2 -2
  3. package/dist/browser/eyeling.browser.js +6 -0
  4. package/{see/examples/n3 → examples}/annotation.n3 +1 -1
  5. package/{see/examples/n3/backward_recursion.n3 → examples/backward-recursion.n3} +0 -2
  6. package/examples/collection.n3 +3 -0
  7. package/examples/context-association.n3 +59 -0
  8. package/{see/examples/n3/dijkstra_risk_path.n3 → examples/dijkstra-risk-path.n3} +3 -18
  9. package/{see/examples/n3/eco_route_insight.n3 → examples/eco-route-insight.n3} +2 -47
  10. package/{see/examples/n3/genetic_knapsack_selection.n3 → examples/genetic-knapsack-selection.n3} +2 -24
  11. package/{see/examples → examples}/input/annotation.trig +3 -3
  12. package/{see/examples/input/backward_recursion.trig → examples/input/backward-recursion.trig} +2 -2
  13. package/{see/examples/input/builtin_coverage.trig → examples/input/builtin-coverage.trig} +2 -2
  14. package/{see/examples → examples}/input/collection.trig +3 -3
  15. package/examples/input/context-association.trig +35 -0
  16. package/{see/examples/input/dijkstra_risk_path.trig → examples/input/dijkstra-risk-path.trig} +4 -4
  17. package/{see/examples/input/eco_route_insight.trig → examples/input/eco-route-insight.trig} +4 -4
  18. package/{see/examples/input/genetic_knapsack_selection.trig → examples/input/genetic-knapsack-selection.trig} +4 -4
  19. package/{see/examples/input/rc_discharge_envelope.trig → examples/input/rc-discharge-envelope.trig} +4 -4
  20. package/{see/examples/input/rdf_dataset.trig → examples/input/rdf-dataset.trig} +4 -4
  21. package/{see/examples/input/rdf_message_flow.trig → examples/input/rdf-message-flow.trig} +3 -3
  22. package/{see/examples/input/rdf_messages.trig → examples/input/rdf-messages.trig} +4 -4
  23. package/{see/examples/input/school_placement_audit.trig → examples/input/school-placement-audit.trig} +4 -4
  24. package/{see/examples/input/smoke_arithmetic.trig → examples/input/smoke-arithmetic.trig} +3 -3
  25. package/{see/examples/input/triple_terms.trig → examples/input/triple-terms.trig} +3 -3
  26. package/examples/output/annotation.n3 +0 -0
  27. package/examples/output/backward-recursion.n3 +4 -0
  28. package/examples/output/builtin-coverage.n3 +0 -0
  29. package/examples/output/collection.n3 +0 -0
  30. package/examples/output/context-association.n3 +9 -0
  31. package/examples/output/dijkstra-risk-path.n3 +3 -0
  32. package/examples/output/eco-route-insight.n3 +3 -0
  33. package/examples/output/genetic-knapsack-selection.n3 +3 -0
  34. package/examples/output/rc-discharge-envelope.n3 +9 -0
  35. package/examples/output/rc-discharge-envelope.txt +9 -0
  36. package/examples/output/rdf-dataset.n3 +5 -0
  37. package/examples/output/rdf-message-flow.n3 +7 -0
  38. package/examples/output/rdf-messages.n3 +7 -0
  39. package/examples/output/school-placement-audit.n3 +3 -0
  40. package/examples/output/smoke-arithmetic.n3 +5 -0
  41. package/examples/output/smoke-arithmetic.txt +5 -0
  42. package/examples/output/triple-terms.n3 +5 -0
  43. package/{see/examples/n3/rc_discharge_envelope.n3 → examples/rc-discharge-envelope.n3} +2 -15
  44. package/{see/examples/n3/rdf_dataset.n3 → examples/rdf-dataset.n3} +2 -11
  45. package/{see/examples/n3/rdf_message_flow.n3 → examples/rdf-message-flow.n3} +9 -75
  46. package/{see/examples/n3/rdf_messages.n3 → examples/rdf-messages.n3} +6 -43
  47. package/{see/examples/n3/school_placement_audit.n3 → examples/school-placement-audit.n3} +2 -14
  48. package/{see/examples/n3/smoke_arithmetic.n3 → examples/smoke-arithmetic.n3} +3 -5
  49. package/{see/examples/n3/triple_terms.n3 → examples/triple-terms.n3} +1 -4
  50. package/eyeling.js +6 -0
  51. package/lib/builtins.js +6 -0
  52. package/package.json +4 -7
  53. package/test/api.test.js +25 -8
  54. package/test/examples.test.js +22 -2
  55. package/test/package.test.js +16 -2
  56. package/see/README.md +0 -149
  57. package/see/examples/_see.js +0 -249
  58. package/see/examples/age.js +0 -1459
  59. package/see/examples/annotation.js +0 -1320
  60. package/see/examples/backward.js +0 -1405
  61. package/see/examples/backward_recursion.js +0 -1504
  62. package/see/examples/bayes_diagnosis.js +0 -2883
  63. package/see/examples/bayes_therapy.js +0 -4152
  64. package/see/examples/bmi.js +0 -3038
  65. package/see/examples/builtin_coverage.js +0 -2524
  66. package/see/examples/collection.js +0 -1320
  67. package/see/examples/complex.js +0 -3762
  68. package/see/examples/complex_matrix_stability.js +0 -2973
  69. package/see/examples/composition_of_injective_functions_is_injective.js +0 -2170
  70. package/see/examples/control_system.js +0 -1918
  71. package/see/examples/crypto_builtins_tests.js +0 -1489
  72. package/see/examples/delfour.js +0 -3174
  73. package/see/examples/digital_product_passport.js +0 -2856
  74. package/see/examples/dijkstra.js +0 -2070
  75. package/see/examples/dijkstra_risk_path.js +0 -1874
  76. package/see/examples/doc/age.md +0 -27
  77. package/see/examples/doc/annotation.md +0 -24
  78. package/see/examples/doc/backward.md +0 -26
  79. package/see/examples/doc/backward_recursion.md +0 -26
  80. package/see/examples/doc/bayes_diagnosis.md +0 -41
  81. package/see/examples/doc/bayes_therapy.md +0 -40
  82. package/see/examples/doc/bmi.md +0 -38
  83. package/see/examples/doc/builtin_coverage.md +0 -53
  84. package/see/examples/doc/collection.md +0 -24
  85. package/see/examples/doc/complex.md +0 -38
  86. package/see/examples/doc/complex_matrix_stability.md +0 -35
  87. package/see/examples/doc/composition_of_injective_functions_is_injective.md +0 -24
  88. package/see/examples/doc/control_system.md +0 -32
  89. package/see/examples/doc/crypto_builtins_tests.md +0 -27
  90. package/see/examples/doc/delfour.md +0 -37
  91. package/see/examples/doc/digital_product_passport.md +0 -36
  92. package/see/examples/doc/dijkstra.md +0 -28
  93. package/see/examples/doc/dijkstra_risk_path.md +0 -30
  94. package/see/examples/doc/dog.md +0 -28
  95. package/see/examples/doc/eco_route_insight.md +0 -33
  96. package/see/examples/doc/equals.md +0 -26
  97. package/see/examples/doc/equivalence_classes_overlap_implies_same_class.md +0 -24
  98. package/see/examples/doc/euler_identity.md +0 -39
  99. package/see/examples/doc/ev_roundtrip_planner.md +0 -32
  100. package/see/examples/doc/existential_rule.md +0 -24
  101. package/see/examples/doc/expression_eval.md +0 -26
  102. package/see/examples/doc/family_cousins.md +0 -24
  103. package/see/examples/doc/fastpow.md +0 -29
  104. package/see/examples/doc/fibonacci.md +0 -28
  105. package/see/examples/doc/french_cities.md +0 -28
  106. package/see/examples/doc/fundamental_theorem_arithmetic.md +0 -36
  107. package/see/examples/doc/genetic_knapsack_selection.md +0 -29
  108. package/see/examples/doc/goldbach_1000.md +0 -31
  109. package/see/examples/doc/good_cobbler.md +0 -27
  110. package/see/examples/doc/gps.md +0 -35
  111. package/see/examples/doc/gray_code_counter.md +0 -31
  112. package/see/examples/doc/greatest_lower_bound_uniqueness.md +0 -24
  113. package/see/examples/doc/group_inverse_uniqueness.md +0 -24
  114. package/see/examples/doc/hadamard_approx.md +0 -32
  115. package/see/examples/doc/hanoi.md +0 -26
  116. package/see/examples/doc/odrl_dpv_risk_ranked.md +0 -57
  117. package/see/examples/doc/path_discovery.md +0 -33
  118. package/see/examples/doc/rc_discharge_envelope.md +0 -33
  119. package/see/examples/doc/rdf_dataset.md +0 -26
  120. package/see/examples/doc/rdf_message_flow.md +0 -35
  121. package/see/examples/doc/rdf_messages.md +0 -37
  122. package/see/examples/doc/school_placement_audit.md +0 -31
  123. package/see/examples/doc/smoke_arithmetic.md +0 -31
  124. package/see/examples/doc/socrates.md +0 -24
  125. package/see/examples/doc/triple_terms.md +0 -26
  126. package/see/examples/doc/wind_turbine.md +0 -37
  127. package/see/examples/doc/witch.md +0 -28
  128. package/see/examples/dog.js +0 -1436
  129. package/see/examples/eco_route_insight.js +0 -2110
  130. package/see/examples/equals.js +0 -1363
  131. package/see/examples/equivalence_classes_overlap_implies_same_class.js +0 -1792
  132. package/see/examples/euler_identity.js +0 -2038
  133. package/see/examples/ev_roundtrip_planner.js +0 -2562
  134. package/see/examples/existential_rule.js +0 -1363
  135. package/see/examples/expression_eval.js +0 -1798
  136. package/see/examples/family_cousins.js +0 -1586
  137. package/see/examples/fastpow.js +0 -2207
  138. package/see/examples/fibonacci.js +0 -1594
  139. package/see/examples/french_cities.js +0 -1492
  140. package/see/examples/fundamental_theorem_arithmetic.js +0 -2106
  141. package/see/examples/genetic_knapsack_selection.js +0 -1743
  142. package/see/examples/goldbach_1000.js +0 -1798
  143. package/see/examples/good_cobbler.js +0 -1396
  144. package/see/examples/gps.js +0 -2813
  145. package/see/examples/gray_code_counter.js +0 -1641
  146. package/see/examples/greatest_lower_bound_uniqueness.js +0 -1918
  147. package/see/examples/group_inverse_uniqueness.js +0 -1897
  148. package/see/examples/hadamard_approx.js +0 -4417
  149. package/see/examples/hanoi.js +0 -1625
  150. package/see/examples/input/age.trig +0 -27
  151. package/see/examples/input/backward.trig +0 -25
  152. package/see/examples/input/bayes_diagnosis.trig +0 -111
  153. package/see/examples/input/bayes_therapy.trig +0 -130
  154. package/see/examples/input/bmi.trig +0 -28
  155. package/see/examples/input/complex.trig +0 -26
  156. package/see/examples/input/complex_matrix_stability.trig +0 -65
  157. package/see/examples/input/composition_of_injective_functions_is_injective.trig +0 -35
  158. package/see/examples/input/control_system.trig +0 -31
  159. package/see/examples/input/crypto_builtins_tests.trig +0 -25
  160. package/see/examples/input/delfour.trig +0 -90
  161. package/see/examples/input/digital_product_passport.trig +0 -116
  162. package/see/examples/input/dijkstra.trig +0 -34
  163. package/see/examples/input/dog.trig +0 -31
  164. package/see/examples/input/equals.trig +0 -25
  165. package/see/examples/input/equivalence_classes_overlap_implies_same_class.trig +0 -28
  166. package/see/examples/input/euler_identity.trig +0 -34
  167. package/see/examples/input/ev_roundtrip_planner.trig +0 -90
  168. package/see/examples/input/existential_rule.trig +0 -26
  169. package/see/examples/input/expression_eval.trig +0 -41
  170. package/see/examples/input/family_cousins.trig +0 -39
  171. package/see/examples/input/fastpow.trig +0 -25
  172. package/see/examples/input/fibonacci.trig +0 -51
  173. package/see/examples/input/french_cities.trig +0 -38
  174. package/see/examples/input/fundamental_theorem_arithmetic.trig +0 -42
  175. package/see/examples/input/goldbach_1000.trig +0 -53
  176. package/see/examples/input/good_cobbler.trig +0 -24
  177. package/see/examples/input/gps.trig +0 -35
  178. package/see/examples/input/gray_code_counter.trig +0 -33
  179. package/see/examples/input/greatest_lower_bound_uniqueness.trig +0 -29
  180. package/see/examples/input/group_inverse_uniqueness.trig +0 -29
  181. package/see/examples/input/hadamard_approx.trig +0 -32
  182. package/see/examples/input/hanoi.trig +0 -26
  183. package/see/examples/input/odrl_dpv_risk_ranked.trig +0 -107
  184. package/see/examples/input/path-discovery.trig +0 -96448
  185. package/see/examples/input/path_discovery.trig +0 -29
  186. package/see/examples/input/socrates.trig +0 -26
  187. package/see/examples/input/wind_turbine.trig +0 -48
  188. package/see/examples/input/witch.trig +0 -26
  189. package/see/examples/n3/age.n3 +0 -28
  190. package/see/examples/n3/backward.n3 +0 -22
  191. package/see/examples/n3/bayes_diagnosis.n3 +0 -122
  192. package/see/examples/n3/bayes_therapy.n3 +0 -149
  193. package/see/examples/n3/bmi.n3 +0 -145
  194. package/see/examples/n3/collection.n3 +0 -3
  195. package/see/examples/n3/complex.n3 +0 -140
  196. package/see/examples/n3/complex_matrix_stability.n3 +0 -113
  197. package/see/examples/n3/composition_of_injective_functions_is_injective.n3 +0 -27
  198. package/see/examples/n3/control_system.n3 +0 -59
  199. package/see/examples/n3/crypto_builtins_tests.n3 +0 -18
  200. package/see/examples/n3/delfour.n3 +0 -167
  201. package/see/examples/n3/digital_product_passport.n3 +0 -156
  202. package/see/examples/n3/dijkstra.n3 +0 -46
  203. package/see/examples/n3/dog.n3 +0 -20
  204. package/see/examples/n3/equals.n3 +0 -11
  205. package/see/examples/n3/equivalence_classes_overlap_implies_same_class.n3 +0 -19
  206. package/see/examples/n3/euler_identity.n3 +0 -41
  207. package/see/examples/n3/ev_roundtrip_planner.n3 +0 -82
  208. package/see/examples/n3/existential_rule.n3 +0 -10
  209. package/see/examples/n3/expression_eval.n3 +0 -21
  210. package/see/examples/n3/family_cousins.n3 +0 -62
  211. package/see/examples/n3/fastpow.n3 +0 -56
  212. package/see/examples/n3/fibonacci.n3 +0 -44
  213. package/see/examples/n3/french_cities.n3 +0 -28
  214. package/see/examples/n3/fundamental_theorem_arithmetic.n3 +0 -84
  215. package/see/examples/n3/goldbach_1000.n3 +0 -66
  216. package/see/examples/n3/good_cobbler.n3 +0 -10
  217. package/see/examples/n3/gps.n3 +0 -70
  218. package/see/examples/n3/gray_code_counter.n3 +0 -53
  219. package/see/examples/n3/greatest_lower_bound_uniqueness.n3 +0 -20
  220. package/see/examples/n3/group_inverse_uniqueness.n3 +0 -19
  221. package/see/examples/n3/hadamard_approx.n3 +0 -43
  222. package/see/examples/n3/hanoi.n3 +0 -16
  223. package/see/examples/n3/odrl_dpv_risk_ranked.n3 +0 -460
  224. package/see/examples/n3/path_discovery.n3 +0 -43
  225. package/see/examples/n3/socrates.n3 +0 -21
  226. package/see/examples/n3/wind_turbine.n3 +0 -85
  227. package/see/examples/n3/witch.n3 +0 -30
  228. package/see/examples/odrl_dpv_risk_ranked.js +0 -5128
  229. package/see/examples/output/age.md +0 -48
  230. package/see/examples/output/annotation.md +0 -43
  231. package/see/examples/output/backward.md +0 -50
  232. package/see/examples/output/backward_recursion.md +0 -54
  233. package/see/examples/output/bayes_diagnosis.md +0 -103
  234. package/see/examples/output/bayes_therapy.md +0 -84
  235. package/see/examples/output/bmi.md +0 -164
  236. package/see/examples/output/builtin_coverage.md +0 -99
  237. package/see/examples/output/collection.md +0 -44
  238. package/see/examples/output/complex.md +0 -61
  239. package/see/examples/output/complex_matrix_stability.md +0 -55
  240. package/see/examples/output/composition_of_injective_functions_is_injective.md +0 -62
  241. package/see/examples/output/control_system.md +0 -61
  242. package/see/examples/output/crypto_builtins_tests.md +0 -68
  243. package/see/examples/output/delfour.md +0 -100
  244. package/see/examples/output/digital_product_passport.md +0 -100
  245. package/see/examples/output/dijkstra.md +0 -74
  246. package/see/examples/output/dijkstra_risk_path.md +0 -76
  247. package/see/examples/output/dog.md +0 -50
  248. package/see/examples/output/eco_route_insight.md +0 -88
  249. package/see/examples/output/equals.md +0 -50
  250. package/see/examples/output/equivalence_classes_overlap_implies_same_class.md +0 -86
  251. package/see/examples/output/euler_identity.md +0 -73
  252. package/see/examples/output/ev_roundtrip_planner.md +0 -79
  253. package/see/examples/output/existential_rule.md +0 -54
  254. package/see/examples/output/expression_eval.md +0 -50
  255. package/see/examples/output/family_cousins.md +0 -187
  256. package/see/examples/output/fastpow.md +0 -36
  257. package/see/examples/output/fibonacci.md +0 -53
  258. package/see/examples/output/french_cities.md +0 -70
  259. package/see/examples/output/fundamental_theorem_arithmetic.md +0 -101
  260. package/see/examples/output/genetic_knapsack_selection.md +0 -66
  261. package/see/examples/output/goldbach_1000.md +0 -58
  262. package/see/examples/output/good_cobbler.md +0 -54
  263. package/see/examples/output/gps.md +0 -102
  264. package/see/examples/output/gray_code_counter.md +0 -68
  265. package/see/examples/output/greatest_lower_bound_uniqueness.md +0 -60
  266. package/see/examples/output/group_inverse_uniqueness.md +0 -60
  267. package/see/examples/output/hadamard_approx.md +0 -510
  268. package/see/examples/output/hanoi.md +0 -51
  269. package/see/examples/output/odrl_dpv_risk_ranked.md +0 -139
  270. package/see/examples/output/path_discovery.md +0 -65
  271. package/see/examples/output/rc_discharge_envelope.md +0 -102
  272. package/see/examples/output/rdf_dataset.md +0 -54
  273. package/see/examples/output/rdf_message_flow.md +0 -198
  274. package/see/examples/output/rdf_messages.md +0 -134
  275. package/see/examples/output/school_placement_audit.md +0 -99
  276. package/see/examples/output/smoke_arithmetic.md +0 -54
  277. package/see/examples/output/socrates.md +0 -55
  278. package/see/examples/output/triple_terms.md +0 -53
  279. package/see/examples/output/wind_turbine.md +0 -108
  280. package/see/examples/output/witch.md +0 -87
  281. package/see/examples/path_discovery.js +0 -1774
  282. package/see/examples/rc_discharge_envelope.js +0 -1993
  283. package/see/examples/rdf_dataset.js +0 -1512
  284. package/see/examples/rdf_message_flow.js +0 -2580
  285. package/see/examples/rdf_messages.js +0 -2176
  286. package/see/examples/school_placement_audit.js +0 -1867
  287. package/see/examples/smoke_arithmetic.js +0 -1483
  288. package/see/examples/socrates.js +0 -1420
  289. package/see/examples/triple_terms.js +0 -1442
  290. package/see/examples/wind_turbine.js +0 -2853
  291. package/see/examples/witch.js +0 -1519
  292. package/see/see.js +0 -2179
  293. package/test/see.test.js +0 -159
  294. /package/{see/examples/n3/builtin_coverage.n3 → examples/builtin-coverage.n3} +0 -0
@@ -1,140 +0,0 @@
1
- # ================================================
2
- # Complex numbers
3
- # See https://en.wikipedia.org/wiki/Complex_number
4
- # ================================================
5
- @prefix math: <http://www.w3.org/2000/10/swap/math#>.
6
- @prefix log: <http://www.w3.org/2000/10/swap/log#>.
7
- @prefix complex: <https://eyereasoner.github.io/eye/complex#>.
8
- @prefix : <http://example.org/#>.
9
-
10
- {
11
- ((?A ?B) (?C ?D)) complex:exponentiation (?E ?F).
12
- } <= {
13
- (?A ?B) complex:polar (?R ?T).
14
- (?R ?C) math:exponentiation ?Z1.
15
- ?D math:negation ?Z2.
16
- (?Z2 ?T) math:product ?Z3.
17
- (2.718281828459045 ?Z3) math:exponentiation ?Z4.
18
- (2.718281828459045 ?Z5) math:exponentiation ?R.
19
- (?D ?Z5) math:product ?Z6.
20
- (?C ?T) math:product ?Z7.
21
- (?Z6 ?Z7) math:sum ?Z8.
22
- ?Z8 math:cos ?Z9.
23
- (?Z1 ?Z4 ?Z9) math:product ?E.
24
- ?Z8 math:sin ?Z10.
25
- (?Z1 ?Z4 ?Z10) math:product ?F.
26
- }.
27
-
28
- {
29
- (?A ?B) complex:asin (?C ?D).
30
- } <= {
31
- (1 ?A) math:sum ?Z1.
32
- (?Z1 2) math:exponentiation ?Z2.
33
- (?B 2) math:exponentiation ?Z3.
34
- (?Z2 ?Z3) math:sum ?Z4.
35
- (?Z4 0.5) math:exponentiation ?Z5.
36
- (1 ?A) math:difference ?Z6.
37
- (?Z6 2) math:exponentiation ?Z7.
38
- (?Z7 ?Z3) math:sum ?Z8.
39
- (?Z8 0.5) math:exponentiation ?Z9.
40
- (?Z5 ?Z9) math:difference ?Z10.
41
- (?Z10 2) math:quotient ?E.
42
- (?Z5 ?Z9) math:sum ?Z11.
43
- (?Z11 2) math:quotient ?F.
44
- ?E math:asin ?C.
45
- (?F 2) math:exponentiation ?Z12.
46
- (?Z12 1) math:difference ?Z13.
47
- (?Z13 0.5) math:exponentiation ?Z14.
48
- (?F ?Z14) math:sum ?Z15.
49
- (2.718281828459045 ?D) math:exponentiation ?Z15.
50
- }.
51
-
52
- {
53
- (?A ?B) complex:acos (?C ?D).
54
- } <= {
55
- (1 ?A) math:sum ?Z1.
56
- (?Z1 2) math:exponentiation ?Z2.
57
- (?B 2) math:exponentiation ?Z3.
58
- (?Z2 ?Z3) math:sum ?Z4.
59
- (?Z4 0.5) math:exponentiation ?Z5.
60
- (1 ?A) math:difference ?Z6.
61
- (?Z6 2) math:exponentiation ?Z7.
62
- (?Z7 ?Z3) math:sum ?Z8.
63
- (?Z8 0.5) math:exponentiation ?Z9.
64
- (?Z5 ?Z9) math:difference ?Z10.
65
- (?Z10 2) math:quotient ?E.
66
- (?Z5 ?Z9) math:sum ?Z11.
67
- (?Z11 2) math:quotient ?F.
68
- ?E math:acos ?C.
69
- (?F 2) math:exponentiation ?Z12.
70
- (?Z12 1) math:difference ?Z13.
71
- (?Z13 0.5) math:exponentiation ?Z14.
72
- (?F ?Z14) math:sum ?Z15.
73
- (2.718281828459045 ?U) math:exponentiation ?Z15.
74
- ?U math:negation ?D.
75
- }.
76
-
77
- {
78
- (?X ?Y) complex:polar(?R ?Tp).
79
- } <= {
80
- (?X 2) math:exponentiation ?Z1.
81
- (?Y 2) math:exponentiation ?Z2.
82
- (?Z1 ?Z2) math:sum ?Z3.
83
- (?Z3 0.5) math:exponentiation ?R.
84
- ?X math:absoluteValue ?Z4.
85
- (?Z4 ?R) math:quotient ?Z5.
86
- ?Z5 math:acos ?T.
87
- (?X ?Y ?T) complex:dial ?Tp.
88
- }.
89
-
90
- {
91
- (?X ?Y ?T) complex:dial ?Tp.
92
- } <= {
93
- ?X math:notLessThan 0.
94
- ?Y math:notLessThan 0.
95
- (0 ?T) math:sum ?Tp.
96
- }.
97
-
98
- {
99
- (?X ?Y ?T) complex:dial ?Tp.
100
- } <= {
101
- ?X math:lessThan 0.
102
- ?Y math:notLessThan 0.
103
- (3.141592653589793 ?T) math:difference ?Tp.
104
- }.
105
-
106
- {
107
- (?X ?Y ?T) complex:dial ?Tp.
108
- } <= {
109
- ?X math:lessThan 0.
110
- ?Y math:lessThan 0.
111
- (3.141592653589793 ?T) math:sum ?Tp.
112
- }.
113
-
114
- {
115
- (?X ?Y ?T) complex:dial ?Tp.
116
- } <= {
117
- ?X math:notLessThan 0.
118
- ?Y math:lessThan 0.
119
- (3.141592653589793 2) math:product ?Z1.
120
- (?Z1 ?T) math:difference ?Tp.
121
- }.
122
-
123
- # test
124
- {
125
- ((-1 0) (0.5 0)) complex:exponentiation ?C1.
126
- ((2.718281828459045 0) (0 3.141592653589793)) complex:exponentiation ?C2.
127
- ((0 1) (0 1)) complex:exponentiation ?C3.
128
- ((2.718281828459045 0) (-1.57079632679 0)) complex:exponentiation ?C4.
129
- (2 0) complex:asin ?C5.
130
- (2 0) complex:acos ?C6.
131
- } => {
132
- :test :is {
133
- ((-1 0) (0.5 0)) complex:exponentiation ?C1.
134
- ((2.718281828459045 0) (0 3.141592653589793)) complex:exponentiation ?C2.
135
- ((0 1) (0 1)) complex:exponentiation ?C3.
136
- ((2.718281828459045 0) (-1.57079632679 0)) complex:exponentiation ?C4.
137
- (2 0) complex:asin ?C5.
138
- (2 0) complex:acos ?C6.
139
- }.
140
- }.
@@ -1,113 +0,0 @@
1
- # ==========================================================================
2
- # Complex Matrix Stability
3
- # ==========================================================================
4
- # Diagonal 2x2 complex matrices are classified for discrete-time stability.
5
- # This adapts the Eyeling complex matrix example as a committed SEE N3
6
- # source that compiles to a standalone JavaScript example.
7
-
8
- @prefix : <https://eyereasoner.github.io/see/examples/complex-matrix-stability#>.
9
- @prefix log: <http://www.w3.org/2000/10/swap/log#>.
10
- @prefix math: <http://www.w3.org/2000/10/swap/math#>.
11
- @prefix string: <http://www.w3.org/2000/10/swap/string#>.
12
-
13
- :Case :unstableMatrix :A_unstable;
14
- :stableMatrix :A_stable;
15
- :dampedMatrix :A_damped.
16
-
17
- :Scale2 :k 2.
18
-
19
- :c_0_0 :re 0; :im 0; :pretty "(0,0)".
20
- :c_0_1 :re 0; :im 1; :pretty "(0,1)".
21
- :c_1_0 :re 1; :im 0; :pretty "(1,0)".
22
- :c_m1_0 :re -1; :im 0; :pretty "(-1,0)".
23
- :c_1_1 :re 1; :im 1; :pretty "(1,1)".
24
- :c_1_2 :re 1; :im 2; :pretty "(1,2)".
25
- :c_2_0 :re 2; :im 0; :pretty "(2,0)".
26
-
27
- :A_unstable
28
- :a11 :c_1_1; :a12 :c_0_0; :a21 :c_0_0; :a22 :c_2_0;
29
- :pretty "[[(1,1),(0,0)],[(0,0),(2,0)]]".
30
- :A_stable
31
- :a11 :c_1_0; :a12 :c_0_0; :a21 :c_0_0; :a22 :c_m1_0;
32
- :pretty "[[(1,0),(0,0)],[(0,0),(-1,0)]]".
33
- :A_damped
34
- :a11 :c_0_0; :a12 :c_0_0; :a21 :c_0_0; :a22 :c_0_0;
35
- :pretty "[[(0,0),(0,0)],[(0,0),(0,0)]]".
36
-
37
- { ?Z :abs2 ?A2 } <= {
38
- ?Z :re ?R; :im ?I.
39
- (?R ?R) math:product ?R2.
40
- (?I ?I) math:product ?I2.
41
- (?R2 ?I2) math:sum ?A2.
42
- }.
43
-
44
- { ?Z :isZero true } <= { ?Z :re 0; :im 0. }.
45
-
46
- { ?M :eigenvalue1 ?L1 } <= {
47
- ?M :a11 ?L1; :a12 ?Z1; :a21 ?Z2; :a22 ?L2.
48
- ?Z1 :isZero true.
49
- ?Z2 :isZero true.
50
- }.
51
- { ?M :eigenvalue2 ?L2 } <= {
52
- ?M :a11 ?L1; :a12 ?Z1; :a21 ?Z2; :a22 ?L2.
53
- ?Z1 :isZero true.
54
- ?Z2 :isZero true.
55
- }.
56
-
57
- { ?M :spectralRadiusSq ?A1 } <= {
58
- ?M :eigenvalue1 ?L1; :eigenvalue2 ?L2.
59
- ?L1 :abs2 ?A1.
60
- ?L2 :abs2 ?A2.
61
- ?A1 math:notLessThan ?A2.
62
- }.
63
- { ?M :spectralRadiusSq ?A2 } <= {
64
- ?M :eigenvalue1 ?L1; :eigenvalue2 ?L2.
65
- ?L1 :abs2 ?A1.
66
- ?L2 :abs2 ?A2.
67
- ?A2 math:greaterThan ?A1.
68
- }.
69
-
70
- { ?M :spectralRadius 2 } <= { ?M :spectralRadiusSq 4. }.
71
- { ?M :spectralRadius 1 } <= { ?M :spectralRadiusSq 1. }.
72
- { ?M :spectralRadius 0 } <= { ?M :spectralRadiusSq 0. }.
73
-
74
- { ?M :classification :unstable } <= { ?M :spectralRadiusSq ?R2. ?R2 math:greaterThan 1. }.
75
- { ?M :classification :stable } <= { ?M :spectralRadiusSq 1. }.
76
- { ?M :classification :damped } <= { ?M :spectralRadiusSq ?R2. ?R2 math:lessThan 1. }.
77
-
78
- { :sampleProduct :re ?Cr } <= {
79
- :c_1_2 :re ?Ar; :im ?Ai.
80
- :c_0_1 :re ?Br; :im ?Bi.
81
- (?Ar ?Br) math:product ?P1.
82
- (?Ai ?Bi) math:product ?P2.
83
- (?P1 ?P2) math:difference ?Cr.
84
- }.
85
- { :sampleProduct :im ?Ci } <= {
86
- :c_1_2 :re ?Ar; :im ?Ai.
87
- :c_0_1 :re ?Br; :im ?Bi.
88
- (?Ar ?Bi) math:product ?P3.
89
- (?Ai ?Br) math:product ?P4.
90
- (?P3 ?P4) math:sum ?Ci.
91
- }.
92
-
93
- { :A_unstable :scaledRadiusSq ?S2 } <= {
94
- :Scale2 :k ?K.
95
- (?K ?K) math:product ?K2.
96
- (?K2 4) math:product ?S2.
97
- }.
98
-
99
- {
100
- :Case :unstableMatrix ?Mu; :stableMatrix ?Ms; :dampedMatrix ?Md.
101
- ?Mu :classification :unstable; :spectralRadius 2.
102
- ?Ms :classification :stable; :spectralRadius 1.
103
- ?Md :classification :damped; :spectralRadius 0.
104
- } => { :Case :scenarioOk true. }.
105
-
106
-
107
- {
108
- :Case :scenarioOk true.
109
- :A_unstable :pretty ?UnstableMatrix; :spectralRadius ?Ru.
110
- :A_stable :pretty ?StableMatrix; :spectralRadius ?Rs.
111
- :A_damped :pretty ?DampedMatrix; :spectralRadius ?Rd.
112
- ("=== Answer ===\nA_unstable = %s has spectral radius %s and is unstable. A_stable = %s has spectral radius %s and is marginally stable. A_damped = %s has spectral radius %s and is damped.\n\n=== Explanation ===\nFor a discrete-time linear system x_{k+1} = A x_k, diagonal matrix eigenvalues are the diagonal entries. The largest squared complex modulus determines the spectral radius class. The N3 derivation also validates that |z*w|^2 = |z|^2*|w|^2 for a concrete complex product and that scaling A_unstable by 2 multiplies the squared spectral radius by 4." ?UnstableMatrix ?Ru ?StableMatrix ?Rs ?DampedMatrix ?Rd) string:format ?Block.
113
- } => { :report log:outputString ?Block. }.
@@ -1,27 +0,0 @@
1
- # Composition of injective functions is injective.
2
- @prefix : <https://eyereasoner.github.io/eye/reasoning#>.
3
- @prefix log: <http://www.w3.org/2000/10/swap/log#>.
4
-
5
- { ?x :inX true. } => { (?x ?x) :sameTerm true. }.
6
- { ?y :inY true. } => { (?y ?y) :sameTerm true. }.
7
- { ?z :inZ true. } => { (?z ?z) :sameTerm true. }.
8
- { (?a ?b) :sameTerm true. } => { (?b ?a) :sameTerm true. }.
9
- { (?f ?x) :app ?u. (?f ?x) :app ?v. } => { (?u ?v) :sameTerm true. }.
10
- { ?f :injective true. (?f ?x) :app ?u. (?f ?y) :app ?v. (?u ?v) :sameTerm true. } => { (?x ?y) :sameTerm true. }.
11
- { ?h :compositeOf (?g ?f). (?f ?x) :app ?y. (?g ?y) :app ?z. } => { (?h ?x) :app ?z. }.
12
- { ?h :compositeOf (?g ?f). ?f :injective true. ?g :injective true. (?f ?x) :app ?fx. (?f ?y) :app ?fy. (?g ?fx) :app ?u. (?g ?fy) :app ?v. (?u ?v) :sameTerm true. (?x ?y) :sameTerm true. } => { (?h ?x ?y) :sameInputUnderEqualCompositeOutput true. }.
13
-
14
- :a :inX true.
15
- :b :inX true.
16
- :p :inY true.
17
- :q :inY true.
18
- :r :inZ true.
19
- :f :injective true.
20
- :g :injective true.
21
- :h :compositeOf (:g :f).
22
- (:f :a) :app :p.
23
- (:f :b) :app :q.
24
- (:g :p) :app :r.
25
- (:g :q) :app :r.
26
-
27
- { (?h ?x ?y) :sameInputUnderEqualCompositeOutput true. ?x log:notEqualTo ?y. } log:query { :result :sameInputByCompositeInjectivity (?h ?x ?y). }.
@@ -1,59 +0,0 @@
1
- # Control System
2
- # Compact SEE version of the EYE reasoning/control-system example.
3
-
4
- @prefix math: <http://www.w3.org/2000/10/swap/math#>.
5
- @prefix log: <http://www.w3.org/2000/10/swap/log#>.
6
- @prefix : <https://eyereasoner.github.io/see/examples/control-system#>.
7
-
8
- # Input, disturbance, state, and output facts used by the controller.
9
- :input1 :measurement1 (6 11).
10
- :input2 :measurement2 true.
11
- :input3 :measurement3 56967.
12
- :disturbance1 :measurement3 35766.
13
- :state3 :observation3 22.
14
- :output2 :measurement4 24.
15
- :output2 :target2 29.
16
-
17
- # Feedforward control for actuator 1.
18
- {
19
- :input1 :measurement10 ?M1.
20
- :input2 :measurement2 true.
21
- :disturbance1 :measurement3 ?D1.
22
- (?M1 19.6) math:product ?C1.
23
- (10 ?C2) math:exponentiation ?D1.
24
- (?C1 ?C2) math:difference ?C.
25
- } => {
26
- :actuator1 :control1 ?C.
27
- }.
28
-
29
- # PND feedback control for actuator 2.
30
- {
31
- :input3 :measurement3 ?M3.
32
- :state3 :observation3 ?P3.
33
- :output2 :measurement4 ?M4.
34
- :output2 :target2 ?T2.
35
- (?T2 ?M4) math:difference ?E.
36
- (?P3 ?M4) math:difference ?D.
37
- (5.8 ?E) math:product ?C1.
38
- (7.3 ?E) math:quotient ?N.
39
- (?N ?D) math:product ?C2.
40
- (?C1 ?C2) math:sum ?C.
41
- } => {
42
- :actuator2 :control1 ?C.
43
- }.
44
-
45
- # Backward rules for normalized sensor measurement.
46
- { ?I :measurement10 ?M. } <= {
47
- ?I :measurement1 (?M1 ?M2).
48
- ?M1 math:lessThan ?M2.
49
- (?M2 ?M1) math:difference ?M3.
50
- (?M3 0.5) math:exponentiation ?M.
51
- }.
52
-
53
- { ?I :measurement10 ?M1. } <= {
54
- ?I :measurement1 (?M1 ?M2).
55
- ?M1 math:notLessThan ?M2.
56
- }.
57
-
58
- # SEE projection of the two control commands.
59
- { ?O :control1 ?C. } log:query { ?O :control1 ?C. }.
@@ -1,18 +0,0 @@
1
- # =====================
2
- # crypto builtins tests
3
- # =====================
4
- @prefix : <https://eyereasoner.github.io/see/examples/crypto-builtins-tests#>.
5
- @prefix crypto: <http://www.w3.org/2000/10/swap/crypto#>.
6
-
7
- # 4.1.1 crypto:sha (SHA-1)
8
- # "hello world" → 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed
9
- { "hello world" crypto:sha "2aae6c35c94fcfb415dbe95f408b9ce91ee846ed" . } => { :ok_crypto_sha_1 a :Pass . } .
10
-
11
- # Extra: crypto:md5
12
- { "hello world" crypto:md5 "5eb63bbbe01eeed093cb22bb8f5acdc3" . } => { :ok_crypto_md5_1 a :Pass . } .
13
-
14
- # Extra: crypto:sha256
15
- { "hello world" crypto:sha256 "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9" . } => { :ok_crypto_sha256_1 a :Pass . } .
16
-
17
- # Extra: crypto:sha512
18
- { "hello world" crypto:sha512 "309ecc489c12d6eb4cc40f50c902f2b4d0ed77ee511a7c7a9bcd3ca86d4cd86f989dd35bc5ff499670da34255b45b0cfd830e81f605dcf7dc5542e93ae9cd76f" . } => { :ok_crypto_sha512_1 a :Pass . } .
@@ -1,167 +0,0 @@
1
- # =======
2
- # Delfour
3
- # =======
4
- # N3-compiled version of the Delfour insight-economy example. A private phone
5
- # condition is desensitized into a scoped low-sugar insight; the scanner may use
6
- # it for shopping assistance, but not for marketing.
7
-
8
- @prefix : <https://eyereasoner.github.io/see/examples/delfour#>.
9
- @prefix ins: <https://example.org/insight#>.
10
- @prefix odrl: <http://www.w3.org/ns/odrl/2/>.
11
- @prefix math: <http://www.w3.org/2000/10/swap/math#>.
12
- @prefix string: <http://www.w3.org/2000/10/swap/string#>.
13
- @prefix crypto: <http://www.w3.org/2000/10/swap/crypto#>.
14
- @prefix log: <http://www.w3.org/2000/10/swap/log#>.
15
- @prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
16
-
17
- :case a :ShoppingCase;
18
- :caseName "delfour";
19
- :requestPurpose "shopping_assist";
20
- :requestAction odrl:use;
21
- :scannerAuthAt "2025-10-05T20:35:48Z"^^xsd:dateTime;
22
- :scannerDutyAt "2025-10-05T20:37:48Z"^^xsd:dateTime;
23
- :filesWritten 6;
24
- :auditEntries 1.
25
-
26
- :householdProfile :condition "Diabetes".
27
- :scan :scannedProduct :classicBiscuits.
28
-
29
- :classicBiscuits a :Product;
30
- :productName "Classic Tea Biscuits";
31
- :sugarTenths 120;
32
- :sugarPerServing 12.0.
33
- :lowSugarBiscuits a :Product;
34
- :productName "Low-Sugar Tea Biscuits";
35
- :sugarTenths 30;
36
- :sugarPerServing 3.0.
37
- :darkChocolate a :Product;
38
- :productName "85% Dark Chocolate";
39
- :sugarTenths 60;
40
- :sugarPerServing 6.0.
41
- :milkChocolate a :Product;
42
- :productName "Milk Chocolate Bar";
43
- :sugarTenths 150;
44
- :sugarPerServing 15.0.
45
-
46
- :insight a ins:Insight;
47
- :metric "sugar_g_per_serving";
48
- :thresholdTenths 100;
49
- :thresholdDisplay "10.0";
50
- :thresholdG 10.0;
51
- :scopeDevice "self-scanner";
52
- :scopeEvent "pick_up_scanner";
53
- :retailer "Delfour";
54
- :createdAt "2025-10-05T20:33:48Z"^^xsd:dateTime;
55
- :expiresAt "2025-10-05T22:33:48Z"^^xsd:dateTime;
56
- :serializedLowercase "metric=sugar_g_per_serving;retailer=delfour;threshold=10.0;scope=self-scanner".
57
-
58
- :policy a odrl:Policy;
59
- odrl:permission [
60
- odrl:action odrl:use;
61
- odrl:target :insight;
62
- odrl:constraint [ odrl:leftOperand odrl:purpose; odrl:operator odrl:eq; odrl:rightOperand "shopping_assist" ]
63
- ];
64
- odrl:prohibition [
65
- odrl:action odrl:distribute;
66
- odrl:target :insight;
67
- odrl:constraint [ odrl:leftOperand odrl:purpose; odrl:operator odrl:eq; odrl:rightOperand "marketing" ]
68
- ];
69
- odrl:duty [
70
- odrl:action odrl:delete;
71
- odrl:constraint [ odrl:leftOperand odrl:dateTime; odrl:operator odrl:eq; odrl:rightOperand "2025-10-05T22:33:48Z"^^xsd:dateTime ]
72
- ].
73
-
74
- :envelope :canonicalJson "insight=lower_sugar;policy=shopping_assist_only;expires=2025-10-05T22:33:48Z".
75
- :signature :alg "SHA-256"; :payloadHashSHA256 "9025c5ccc1cc3e97aa639e3ca2d62e65ba0abed9cf3573b487c61d8cec6b3460".
76
-
77
- { :householdProfile :condition "Diabetes". } => { :case :needsLowSugar true. }.
78
- { :case :needsLowSugar true. } => { :insight :derivedFromNeed "low_sugar". }.
79
- { :envelope :canonicalJson ?json. ?json crypto:sha256 ?digest. :signature :payloadHashSHA256 ?digest. } => { :assurance :payloadHashMatches true. }.
80
- { :insight :serializedLowercase ?s. ?s string:notMatches "diabetes|medical". } => { :assurance :minimizationStripsSensitiveTerms true. }.
81
- { :insight :scopeDevice ?device; :scopeEvent ?event; :expiresAt ?expiry. } => { :assurance :scopeComplete true. }.
82
- {
83
- :policy odrl:permission [ odrl:action odrl:use; odrl:target :insight; odrl:constraint [ odrl:rightOperand "shopping_assist" ] ].
84
- :case :scannerAuthAt ?authAt.
85
- :insight :expiresAt ?expiresAt.
86
- ?authAt math:notGreaterThan ?expiresAt.
87
- } => { :decision :outcome "Allowed". :assurance :authorizationAllowed true. }.
88
- {
89
- :decision :outcome "Allowed".
90
- :scan :scannedProduct ?product.
91
- ?product :sugarPerServing ?sugar.
92
- :insight :thresholdG ?threshold.
93
- ?sugar math:notLessThan ?threshold.
94
- } => { :banner :headline "Track sugar per serving while you scan"; :note "High sugar". }.
95
- {
96
- :scan :scannedProduct ?scanned.
97
- ?scanned :sugarTenths ?scannedSugar.
98
- ?candidate a :Product; :sugarTenths ?candidateSugar.
99
- ?scannedSugar math:greaterThan ?candidateSugar.
100
- 1 log:notIncludes {
101
- ?other a :Product; :sugarTenths ?otherSugar.
102
- ?scannedSugar math:greaterThan ?otherSugar.
103
- ?otherSugar math:lessThan ?candidateSugar.
104
- }.
105
- } => { :case :suggestedAlternative ?candidate. }.
106
- { :case :suggestedAlternative ?alt. ?alt :productName ?altName. } => { :banner :suggestedAlternative ?altName. }.
107
- { :case :scannerDutyAt ?dutyAt. :insight :expiresAt ?expiresAt. ?dutyAt math:notGreaterThan ?expiresAt. } => { :assurance :dutyTimingConsistent true. }.
108
- { :policy odrl:prohibition [ odrl:action odrl:distribute; odrl:constraint [ odrl:rightOperand "marketing" ] ]. } => { :assurance :marketingProhibited true. }.
109
- { :case :filesWritten 6. } => { :assurance :filesWrittenExpected true. }.
110
- { :banner :note "High sugar". } => { :assurance :bannerFlagsHighSugar true. }.
111
- {
112
- :scan :scannedProduct ?scanned.
113
- ?scanned :sugarTenths ?scannedSugar.
114
- :case :suggestedAlternative ?alt.
115
- ?alt :sugarTenths ?altSugar.
116
- ?scannedSugar math:greaterThan ?altSugar.
117
- } => { :assurance :alternativeIsLowerSugar true. }.
118
- {
119
- :assurance :payloadHashMatches true;
120
- :minimizationStripsSensitiveTerms true;
121
- :scopeComplete true;
122
- :authorizationAllowed true;
123
- :bannerFlagsHighSugar true;
124
- :alternativeIsLowerSugar true;
125
- :dutyTimingConsistent true;
126
- :marketingProhibited true;
127
- :filesWrittenExpected true.
128
- } => { :result :ready true. }.
129
-
130
- { :case :filesWritten ?n. ?n math:notEqualTo 6. } => false.
131
- { :case :scannerAuthAt ?authAt. :insight :expiresAt ?expiresAt. ?authAt math:greaterThan ?expiresAt. } => false.
132
- { :policy odrl:prohibition [ odrl:action ?action ]. ?action log:notEqualTo odrl:distribute. } => false.
133
-
134
- {
135
- :result :ready true.
136
- :scan :scannedProduct ?scanned.
137
- ?scanned :productName ?scannedName.
138
- :case :suggestedAlternative ?alt; :caseName ?caseName; :auditEntries ?auditEntries; :filesWritten ?filesWritten.
139
- ?alt :productName ?altName.
140
- :insight :metric ?metric; :thresholdDisplay ?threshold; :scopeDevice ?device; :scopeEvent ?event; :retailer ?retailer; :expiresAt ?expiresAt.
141
- :signature :alg ?alg.
142
- :banner :headline ?headline.
143
- ("=== Answer ===
144
- The scanner is allowed to use a neutral shopping insight and recommends %s instead of %s.
145
- case : %s
146
- decision : Allowed
147
- scanned product : %s
148
- suggested alternative: %s
149
-
150
- === Explanation ===
151
- The phone desensitizes a diabetes-related household condition into a scoped low-sugar need, wraps it in an expiring Insight + Policy envelope, and the scanner consumes that envelope for shopping assistance.
152
- metric : %s
153
- threshold : %s
154
- scope : %s @ %s
155
- retailer : %s
156
- signature alg : %s
157
- banner headline : %s
158
- expires at : %s
159
- audit entries : %s
160
- bus files written : %s
161
- " ?altName ?scannedName ?caseName ?scannedName ?altName ?metric ?threshold ?device ?event ?retailer ?alg ?headline ?expiresAt ?auditEntries ?filesWritten) string:format ?Block.
162
- } => {
163
- :delfour log:outputString ?Block.
164
- :delfour :suggests ?alt.
165
- }.
166
-
167
- { :delfour :suggests ?Product } log:query { :delfour :suggests ?Product }.
@@ -1,156 +0,0 @@
1
- # ========================
2
- # Digital Product Passport
3
- # ========================
4
- # N3-compiled version of the smartphone Digital Product Passport example. The
5
- # rules fold component mass, recycled content, critical raw materials, public
6
- # documents, lifecycle footprint, and access-policy validations into a public PASS.
7
-
8
- @prefix : <https://eyereasoner.github.io/see/examples/digital-product-passport#>.
9
- @prefix math: <http://www.w3.org/2000/10/swap/math#>.
10
- @prefix list: <http://www.w3.org/2000/10/swap/list#>.
11
- @prefix log: <http://www.w3.org/2000/10/swap/log#>.
12
- @prefix string: <http://www.w3.org/2000/10/swap/string#>.
13
-
14
- :passport a :DigitalProductPassport;
15
- :caseName "digital_product_passport";
16
- :forProduct :ACME_X1000_SN123;
17
- :publicEndpoint "https://example.org/dpp/ACME-X1000-SN123";
18
- :publicSection "public";
19
- :restrictedSection "restricted".
20
-
21
- :ACME_X1000_SN123 a :Product;
22
- :model "ACME X1000";
23
- :serialNumber "SN123";
24
- :digitalLink "https://example.org/dpp/ACME-X1000-SN123";
25
- :hasComponent :BatteryPack_01, :Chassis_01, :Mainboard_01.
26
-
27
- :BatteryPack_01 a :Component; :componentLabel "BatteryPack-01 Battery"; :type :Battery; :massG 48; :recycledMassG 0; :replaceable true; :containsMaterial :Lithium, :Cobalt, :Nickel.
28
- :Chassis_01 a :Component; :componentLabel "Chassis-01 Housing"; :type :Housing; :massG 32; :recycledMassG 12; :replaceable false; :containsMaterial :Aluminium.
29
- :Mainboard_01 a :Component; :componentLabel "Mainboard-01 Electronics"; :type :Electronics; :massG 25; :recycledMassG 2; :replaceable false; :containsMaterial :Copper, :GoldTrace.
30
-
31
- :Lithium a :Material; :criticalRawMaterial true; :materialName "Lithium".
32
- :Cobalt a :Material; :criticalRawMaterial true; :materialName "Cobalt".
33
- :Nickel a :Material; :criticalRawMaterial false; :materialName "Nickel".
34
- :Aluminium a :Material; :criticalRawMaterial false; :materialName "Aluminium".
35
- :Copper a :Material; :criticalRawMaterial false; :materialName "Copper".
36
- :GoldTrace a :Material; :criticalRawMaterial false; :materialName "GoldTrace".
37
-
38
- :Doc_UserManual a :Document; :docType :UserManual; :docTypeLabel "UserManual"; :section "public"; :url "https://example.org/manuals/acme-x1000".
39
- :Doc_RepairGuide a :Document; :docType :RepairGuide; :docTypeLabel "RepairGuide"; :section "public"; :url "https://example.org/repair/acme-x1000"; :declares :BatteryReplacementSupported.
40
- :Doc_SpareParts a :Document; :docType :SparePartsCatalog; :docTypeLabel "SparePartsCatalog"; :section "public"; :url "https://example.org/spares/acme-x1000".
41
- :Doc_DoC_CE a :Document; :docType :DeclarationOfConformity; :section "restricted".
42
- :Doc_SubstanceDeclaration a :Document; :docType :SubstanceDeclaration; :section "restricted".
43
-
44
- :Policy :publicDocType :UserManual, :RepairGuide, :SparePartsCatalog;
45
- :restrictedDocType :DeclarationOfConformity, :SubstanceDeclaration;
46
- :requiredPublicClaim :BatteryReplacementSupported.
47
-
48
- :Footprint :manufacturingGCO2e 32000; :transportGCO2e 2500; :usePhaseGCO2e 18000.
49
- :Lifecycle :orderedEvents (:Event_Mfg_01 :Event_Sale_01 :Event_Repair_01).
50
- :Event_Mfg_01 :onDate "2026-01-15".
51
- :Event_Sale_01 :onDate "2026-01-25".
52
- :Event_Repair_01 :onDate "2026-02-05".
53
-
54
- {
55
- :ACME_X1000_SN123 :hasComponent ?c.
56
- ?c :containsMaterial ?m.
57
- ?m :criticalRawMaterial true.
58
- } => {
59
- :passport :exposesCriticalMaterial ?m.
60
- }.
61
- {
62
- :ACME_X1000_SN123 :hasComponent ?c.
63
- ?c :massG ?m; :recycledMassG ?r.
64
- } => {
65
- :MassRollup :componentMass ?m;
66
- :componentRecycledMass ?r.
67
- }.
68
- {
69
- (48 32 25) math:sum ?totalMass.
70
- (0 12 2) math:sum ?recycledMass.
71
- ( ?recycledMass 100 ) math:product ?pctNumerator.
72
- ( ?pctNumerator ?totalMass ) math:integerQuotient ?recycledPct.
73
- } => {
74
- :passport :totalMassG ?totalMass;
75
- :recycledMassG ?recycledMass;
76
- :recycledPct ?recycledPct.
77
- }.
78
- {
79
- :Footprint :manufacturingGCO2e ?mfg; :transportGCO2e ?transport; :usePhaseGCO2e ?use.
80
- ( ?mfg ?transport ?use ) math:sum ?total.
81
- } => {
82
- :passport :lifecycleFootprintGCO2e ?total.
83
- }.
84
- {
85
- :Policy :publicDocType ?docType.
86
- ?doc a :Document; :docType ?docType; :section "public".
87
- } => {
88
- :passport :hasRequiredPublicDocType ?docType.
89
- }.
90
- {
91
- :Policy :restrictedDocType ?docType.
92
- ?doc a :Document; :docType ?docType; :section "restricted".
93
- } => {
94
- :passport :keepsRestrictedDocTypeRestricted ?docType.
95
- }.
96
- {
97
- :ACME_X1000_SN123 :hasComponent ?battery.
98
- ?battery :type :Battery; :replaceable true.
99
- :Doc_RepairGuide :section "public"; :declares :BatteryReplacementSupported.
100
- :passport :hasRequiredPublicDocType :UserManual, :RepairGuide, :SparePartsCatalog.
101
- } => {
102
- :passport :repairFriendly true.
103
- }.
104
- {
105
- :passport :publicEndpoint ?endpoint.
106
- :ACME_X1000_SN123 :digitalLink ?endpoint.
107
- } => {
108
- :passport :digitalLinkMatchesEndpoint true.
109
- }.
110
- {
111
- :Event_Mfg_01 :onDate ?d1.
112
- :Event_Sale_01 :onDate ?d2.
113
- :Event_Repair_01 :onDate ?d3.
114
- ?d1 string:notGreaterThan ?d2.
115
- ?d2 string:notGreaterThan ?d3.
116
- } => {
117
- :passport :lifecycleChronological true.
118
- }.
119
- {
120
- :passport :totalMassG ?totalMass; :recycledMassG ?recycledMass.
121
- ?totalMass math:greaterThan 0.
122
- ?recycledMass math:notGreaterThan ?totalMass.
123
- } => {
124
- :passport :massBalanced true.
125
- }.
126
- {
127
- :passport :massBalanced true;
128
- :recycledPct ?pct;
129
- :lifecycleFootprintGCO2e ?footprint;
130
- :exposesCriticalMaterial :Lithium, :Cobalt;
131
- :repairFriendly true;
132
- :hasRequiredPublicDocType :UserManual, :RepairGuide, :SparePartsCatalog;
133
- :keepsRestrictedDocTypeRestricted :DeclarationOfConformity, :SubstanceDeclaration;
134
- :digitalLinkMatchesEndpoint true;
135
- :lifecycleChronological true.
136
- } => {
137
- :passport :decision "PASS".
138
- }.
139
-
140
- { :passport :decision ?decision. ?decision log:notEqualTo "PASS". } => false.
141
- { :passport :recycledMassG ?r; :totalMassG ?t. ?r math:greaterThan ?t. } => false.
142
-
143
- {
144
- :passport :decision "PASS";
145
- :totalMassG ?mass;
146
- :recycledPct ?pct;
147
- :lifecycleFootprintGCO2e ?footprint;
148
- :publicEndpoint ?endpoint.
149
- :ACME_X1000_SN123 :model ?model; :serialNumber ?serial.
150
- ("=== Answer ===\nPassport decision : PASS for %s %s.\nrecycled content : %d%%\nlifecycle footprint : %d gCO2e\ntotal component mass : %d g\ncritical raw materials : Lithium, Cobalt\ncircularity hint : repairFriendly\npublic endpoint : %s\n\n=== Explanation ===\nThe passport folds the explicit component list to derive total mass and recycled mass, then computes an integer recycled-content percentage. Lifecycle footprint is derived by summing manufacturing, transport, and use-phase emissions. The product is repair-friendly because the battery is replaceable and the public passport section exposes repair, spare-parts, and manual documentation. Restricted declarations remain in the restricted section.\n\nComponent roll-up:\nBatteryPack-01 Battery mass=48g recycled=0g materials=Lithium, Cobalt, Nickel replaceable=yes\nChassis-01 Housing mass=32g recycled=12g materials=Aluminium replaceable=no\nMainboard-01 Electronics mass=25g recycled=2g materials=Copper, GoldTrace replaceable=no\nPublic documents:\nDoc-UserManual UserManual https://example.org/manuals/acme-x1000\nDoc-RepairGuide RepairGuide https://example.org/repair/acme-x1000\nDoc-SpareParts SparePartsCatalog https://example.org/spares/acme-x1000" ?model ?serial ?pct ?footprint ?mass ?endpoint) string:format ?Block.
151
- } => {
152
- :digitalProductPassport log:outputString ?Block.
153
- :digitalProductPassport :decision "PASS".
154
- }.
155
-
156
- { :digitalProductPassport :decision ?Decision } log:query { :digitalProductPassport :decision ?Decision }.