eyeling 1.32.1 → 1.33.1

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 (629) hide show
  1. package/README.md +87 -16
  2. package/bin/eyeling.cjs +56 -4
  3. package/dist/browser/eyeling.browser.js +2 -11
  4. package/examples/eyelang/INTEGRATION.md +13 -0
  5. package/examples/eyelang/README.md +628 -0
  6. package/examples/eyelang/SPEC.md +684 -0
  7. package/examples/eyelang/access-control-policy.pl +52 -0
  8. package/examples/eyelang/ackermann.pl +46 -0
  9. package/examples/eyelang/age.pl +28 -0
  10. package/examples/eyelang/aliases-and-namespaces.pl +22 -0
  11. package/examples/eyelang/alignment-demo.pl +44 -0
  12. package/examples/eyelang/allen-interval-calculus.pl +64 -0
  13. package/examples/eyelang/ancestor.pl +21 -0
  14. package/examples/eyelang/animal.pl +21 -0
  15. package/examples/eyelang/annotation-rdf12.ttl +12 -0
  16. package/examples/eyelang/annotation.pl +34 -0
  17. package/examples/eyelang/auroracare.pl +309 -0
  18. package/examples/eyelang/backward.pl +12 -0
  19. package/examples/eyelang/basic-monadic.pl +10018 -0
  20. package/examples/eyelang/bayes-diagnosis.pl +108 -0
  21. package/examples/eyelang/bayes-therapy.pl +182 -0
  22. package/examples/eyelang/beam-deflection.pl +50 -0
  23. package/examples/eyelang/blocks-world-planning.pl +75 -0
  24. package/examples/eyelang/bmi.pl +232 -0
  25. package/examples/eyelang/braking-safety-worlds.pl +69 -0
  26. package/examples/eyelang/buck-converter-design.pl +78 -0
  27. package/examples/eyelang/cache-performance.pl +54 -0
  28. package/examples/eyelang/canary-release.pl +49 -0
  29. package/examples/eyelang/cat-koko.pl +24 -0
  30. package/examples/eyelang/clinical-trial-screening.pl +92 -0
  31. package/examples/eyelang/collatz-1000.pl +14 -0
  32. package/examples/eyelang/combinatorics-findall-sort.pl +37 -0
  33. package/examples/eyelang/competitive-enzyme-kinetics.pl +78 -0
  34. package/examples/eyelang/complex-matrix-stability.pl +45 -0
  35. package/examples/eyelang/complex.pl +121 -0
  36. package/examples/eyelang/composition-of-injective-functions-is-injective.pl +50 -0
  37. package/examples/eyelang/context-association.pl +53 -0
  38. package/examples/eyelang/control-system.pl +72 -0
  39. package/examples/eyelang/cryptarithmetic-send-more-money.pl +49 -0
  40. package/examples/eyelang/cyclic-path.pl +16 -0
  41. package/examples/eyelang/d3-group.pl +100 -0
  42. package/examples/eyelang/dairy-energy-balance.pl +65 -0
  43. package/examples/eyelang/data-negotiation.pl +39 -0
  44. package/examples/eyelang/deep-taxonomy-10.pl +115 -0
  45. package/examples/eyelang/deep-taxonomy-100.pl +385 -0
  46. package/examples/eyelang/deep-taxonomy-1000.pl +3085 -0
  47. package/examples/eyelang/deep-taxonomy-10000.pl +30094 -0
  48. package/examples/eyelang/deep-taxonomy-100000.pl +300184 -0
  49. package/examples/eyelang/delfour.pl +281 -0
  50. package/examples/eyelang/dense-hamiltonian-cycle.pl +92 -0
  51. package/examples/eyelang/deontic-logic.pl +52 -0
  52. package/examples/eyelang/derived-backward-rule.pl +30 -0
  53. package/examples/eyelang/derived-rule.pl +27 -0
  54. package/examples/eyelang/diamond-property.pl +38 -0
  55. package/examples/eyelang/dijkstra-findall-sort.pl +44 -0
  56. package/examples/eyelang/dijkstra-risk-path.pl +86 -0
  57. package/examples/eyelang/dijkstra.pl +46 -0
  58. package/examples/eyelang/dining-philosophers.pl +140 -0
  59. package/examples/eyelang/directional-language.ttl +9 -0
  60. package/examples/eyelang/dog.pl +25 -0
  61. package/examples/eyelang/drone-corridor-planner.pl +51 -0
  62. package/examples/eyelang/easter-computus.pl +89 -0
  63. package/examples/eyelang/electrical-rc-filter.pl +36 -0
  64. package/examples/eyelang/epidemic-policy.pl +67 -0
  65. package/examples/eyelang/equivalence-classes-overlap-implies-same-class.pl +27 -0
  66. package/examples/eyelang/eulerian-path.pl +85 -0
  67. package/examples/eyelang/ev-range-worlds.pl +82 -0
  68. package/examples/eyelang/exact-cover-sudoku.pl +113 -0
  69. package/examples/eyelang/existential-rule.pl +18 -0
  70. package/examples/eyelang/exoplanet-validation-worlds.pl +88 -0
  71. package/examples/eyelang/expression-eval.pl +43 -0
  72. package/examples/eyelang/eyeling-ackermann.n3 +41 -0
  73. package/examples/eyelang/eyeling-age-threshold.n3 +12 -0
  74. package/examples/eyelang/eyeling-alignment-demo.n3 +11 -0
  75. package/examples/eyelang/eyeling-allen-interval-calculus-small.n3 +13 -0
  76. package/examples/eyelang/eyeling-backward-recursion.n3 +11 -0
  77. package/examples/eyelang/eyeling-backward.n3 +10 -0
  78. package/examples/eyelang/eyeling-basic-monadic-small.n3 +11 -0
  79. package/examples/eyelang/eyeling-bmi.n3 +10 -0
  80. package/examples/eyelang/eyeling-cat-koko.n3 +15 -0
  81. package/examples/eyelang/eyeling-collatz-small.n3 +11 -0
  82. package/examples/eyelang/eyeling-collection.n3 +11 -0
  83. package/examples/eyelang/eyeling-complex-arithmetic.n3 +10 -0
  84. package/examples/eyelang/eyeling-context-association.n3 +11 -0
  85. package/examples/eyelang/eyeling-control-system-small.n3 +11 -0
  86. package/examples/eyelang/eyeling-crypto-builtins-extra.n3 +10 -0
  87. package/examples/eyelang/eyeling-crypto-builtins.n3 +8 -0
  88. package/examples/eyelang/eyeling-deep-taxonomy-10.n3 +18 -0
  89. package/examples/eyelang/eyeling-derived-backward-rule-flat.n3 +10 -0
  90. package/examples/eyelang/eyeling-derived-rule-flat.n3 +9 -0
  91. package/examples/eyelang/eyeling-digital-product-passport-small.n3 +11 -0
  92. package/examples/eyelang/eyeling-dijkstra-tiny.n3 +14 -0
  93. package/examples/eyelang/eyeling-dog-license.n3 +13 -0
  94. package/examples/eyelang/eyeling-drone-corridor-planner-small.n3 +13 -0
  95. package/examples/eyelang/eyeling-equals.n3 +8 -0
  96. package/examples/eyelang/eyeling-equivalence-classes.n3 +11 -0
  97. package/examples/eyelang/eyeling-euler-identity.n3 +9 -0
  98. package/examples/eyelang/eyeling-existential-rule.n3 +9 -0
  99. package/examples/eyelang/eyeling-expression-eval.n3 +11 -0
  100. package/examples/eyelang/eyeling-family-cousins-extended.n3 +12 -0
  101. package/examples/eyelang/eyeling-fastpow.n3 +10 -0
  102. package/examples/eyelang/eyeling-fibonacci.n3 +44 -0
  103. package/examples/eyelang/eyeling-french-cities-reachability.n3 +22 -0
  104. package/examples/eyelang/eyeling-goldbach-small.n3 +22 -0
  105. package/examples/eyelang/eyeling-good-cobbler.n3 +9 -0
  106. package/examples/eyelang/eyeling-list-builtins.n3 +10 -0
  107. package/examples/eyelang/eyeling-list-collection-extra.n3 +9 -0
  108. package/examples/eyelang/eyeling-math-builtins.n3 +9 -0
  109. package/examples/eyelang/eyeling-string-builtins-extra.n3 +9 -0
  110. package/examples/eyelang/eyeling-string-builtins.n3 +10 -0
  111. package/examples/eyelang/eyeling-time-builtins.n3 +11 -0
  112. package/examples/eyelang/eyeling-time-components-extra.n3 +10 -0
  113. package/examples/eyelang/eyeling-witch.n3 +10 -0
  114. package/examples/eyelang/family-cousins.n3 +17 -0
  115. package/examples/eyelang/family-cousins.pl +65 -0
  116. package/examples/eyelang/fastpow.pl +53 -0
  117. package/examples/eyelang/fft8-numeric.pl +83 -0
  118. package/examples/eyelang/fibonacci.pl +53 -0
  119. package/examples/eyelang/field-nitrogen-balance.pl +70 -0
  120. package/examples/eyelang/flandor.pl +296 -0
  121. package/examples/eyelang/floating-point.pl +23 -0
  122. package/examples/eyelang/four-color-map.pl +127 -0
  123. package/examples/eyelang/fundamental-theorem-arithmetic.pl +113 -0
  124. package/examples/eyelang/gcd-bezout-identity.pl +48 -0
  125. package/examples/eyelang/gd-step-certified.pl +158 -0
  126. package/examples/eyelang/gdpr-compliance.pl +69 -0
  127. package/examples/eyelang/goldbach-1000.pl +185 -0
  128. package/examples/eyelang/good-cobbler.pl +14 -0
  129. package/examples/eyelang/gps.pl +152 -0
  130. package/examples/eyelang/graph-reachability.pl +36 -0
  131. package/examples/eyelang/gray-code-counter.pl +48 -0
  132. package/examples/eyelang/greatest-lower-bound-uniqueness.pl +28 -0
  133. package/examples/eyelang/group-inverse-uniqueness.pl +34 -0
  134. package/examples/eyelang/hamiltonian-cycle.pl +55 -0
  135. package/examples/eyelang/hamiltonian-path.pl +49 -0
  136. package/examples/eyelang/hamming-code.pl +105 -0
  137. package/examples/eyelang/hanoi.pl +20 -0
  138. package/examples/eyelang/heat-loss.pl +51 -0
  139. package/examples/eyelang/heron-theorem.pl +36 -0
  140. package/examples/eyelang/ideal-gas-law.pl +37 -0
  141. package/examples/eyelang/illegitimate-reasoning.pl +88 -0
  142. package/examples/eyelang/kaprekar.pl +32 -0
  143. package/examples/eyelang/law-of-cosines.pl +31 -0
  144. package/examples/eyelang/least-squares-regression.pl +81 -0
  145. package/examples/eyelang/list-collection.pl +33 -0
  146. package/examples/eyelang/lldm.pl +78 -0
  147. package/examples/eyelang/manufacturing-quality-control.pl +73 -0
  148. package/examples/eyelang/matrix.pl +296 -0
  149. package/examples/eyelang/microgrid-dispatch.pl +85 -0
  150. package/examples/eyelang/monkey-bananas.pl +45 -0
  151. package/examples/eyelang/n-queens.pl +23 -0
  152. package/examples/eyelang/n3-builtins.n3 +28 -0
  153. package/examples/eyelang/network-sla.pl +48 -0
  154. package/examples/eyelang/newton-raphson.pl +49 -0
  155. package/examples/eyelang/nixon-diamond.pl +37 -0
  156. package/examples/eyelang/odrl-dpv-healthcare-risk-ranked.pl +266 -0
  157. package/examples/eyelang/odrl-dpv-risk-ranked.pl +320 -0
  158. package/examples/eyelang/orbital-transfer-design.pl +113 -0
  159. package/examples/eyelang/output/access-control-policy.pl +2 -0
  160. package/examples/eyelang/output/ackermann.pl +12 -0
  161. package/examples/eyelang/output/age.pl +2 -0
  162. package/examples/eyelang/output/aliases-and-namespaces.pl +5 -0
  163. package/examples/eyelang/output/alignment-demo.pl +32 -0
  164. package/examples/eyelang/output/allen-interval-calculus.pl +154 -0
  165. package/examples/eyelang/output/ancestor.pl +6 -0
  166. package/examples/eyelang/output/animal.pl +4 -0
  167. package/examples/eyelang/output/annotation-rdf12.ttl +1 -0
  168. package/examples/eyelang/output/annotation.pl +4 -0
  169. package/examples/eyelang/output/auroracare.pl +117 -0
  170. package/examples/eyelang/output/backward.pl +1 -0
  171. package/examples/eyelang/output/basic-monadic.pl +1518 -0
  172. package/examples/eyelang/output/bayes-diagnosis.pl +13 -0
  173. package/examples/eyelang/output/bayes-therapy.pl +23 -0
  174. package/examples/eyelang/output/beam-deflection.pl +5 -0
  175. package/examples/eyelang/output/blocks-world-planning.pl +4 -0
  176. package/examples/eyelang/output/bmi.pl +32 -0
  177. package/examples/eyelang/output/braking-safety-worlds.pl +18 -0
  178. package/examples/eyelang/output/buck-converter-design.pl +6 -0
  179. package/examples/eyelang/output/cache-performance.pl +4 -0
  180. package/examples/eyelang/output/canary-release.pl +5 -0
  181. package/examples/eyelang/output/cat-koko.pl +3 -0
  182. package/examples/eyelang/output/clinical-trial-screening.pl +9 -0
  183. package/examples/eyelang/output/collatz-1000.pl +1000 -0
  184. package/examples/eyelang/output/combinatorics-findall-sort.pl +2 -0
  185. package/examples/eyelang/output/competitive-enzyme-kinetics.pl +6 -0
  186. package/examples/eyelang/output/complex-matrix-stability.pl +5 -0
  187. package/examples/eyelang/output/complex.pl +1 -0
  188. package/examples/eyelang/output/composition-of-injective-functions-is-injective.pl +2 -0
  189. package/examples/eyelang/output/context-association.pl +3 -0
  190. package/examples/eyelang/output/control-system.pl +6 -0
  191. package/examples/eyelang/output/cryptarithmetic-send-more-money.pl +6 -0
  192. package/examples/eyelang/output/cyclic-path.pl +16 -0
  193. package/examples/eyelang/output/d3-group.pl +2 -0
  194. package/examples/eyelang/output/dairy-energy-balance.pl +13 -0
  195. package/examples/eyelang/output/data-negotiation.pl +1 -0
  196. package/examples/eyelang/output/deep-taxonomy-10.pl +16 -0
  197. package/examples/eyelang/output/deep-taxonomy-100.pl +16 -0
  198. package/examples/eyelang/output/deep-taxonomy-1000.pl +16 -0
  199. package/examples/eyelang/output/deep-taxonomy-10000.pl +16 -0
  200. package/examples/eyelang/output/deep-taxonomy-100000.pl +16 -0
  201. package/examples/eyelang/output/delfour.pl +31 -0
  202. package/examples/eyelang/output/dense-hamiltonian-cycle.pl +4 -0
  203. package/examples/eyelang/output/deontic-logic.pl +4 -0
  204. package/examples/eyelang/output/derived-backward-rule.pl +3 -0
  205. package/examples/eyelang/output/derived-rule.pl +2 -0
  206. package/examples/eyelang/output/diamond-property.pl +4 -0
  207. package/examples/eyelang/output/dijkstra-findall-sort.pl +2 -0
  208. package/examples/eyelang/output/dijkstra-risk-path.pl +29 -0
  209. package/examples/eyelang/output/dijkstra.pl +16 -0
  210. package/examples/eyelang/output/dining-philosophers.pl +350 -0
  211. package/examples/eyelang/output/directional-language.ttl +1 -0
  212. package/examples/eyelang/output/dog.pl +1 -0
  213. package/examples/eyelang/output/drone-corridor-planner.pl +17 -0
  214. package/examples/eyelang/output/easter-computus.pl +30 -0
  215. package/examples/eyelang/output/electrical-rc-filter.pl +3 -0
  216. package/examples/eyelang/output/epidemic-policy.pl +14 -0
  217. package/examples/eyelang/output/equivalence-classes-overlap-implies-same-class.pl +18 -0
  218. package/examples/eyelang/output/eulerian-path.pl +3 -0
  219. package/examples/eyelang/output/ev-range-worlds.pl +19 -0
  220. package/examples/eyelang/output/exact-cover-sudoku.pl +3 -0
  221. package/examples/eyelang/output/existential-rule.pl +2 -0
  222. package/examples/eyelang/output/exoplanet-validation-worlds.pl +22 -0
  223. package/examples/eyelang/output/expression-eval.pl +1 -0
  224. package/examples/eyelang/output/eyeling-ackermann.n3 +12 -0
  225. package/examples/eyelang/output/eyeling-age-threshold.n3 +4 -0
  226. package/examples/eyelang/output/eyeling-alignment-demo.n3 +1 -0
  227. package/examples/eyelang/output/eyeling-allen-interval-calculus-small.n3 +3 -0
  228. package/examples/eyelang/output/eyeling-backward-recursion.n3 +9 -0
  229. package/examples/eyelang/output/eyeling-backward.n3 +1 -0
  230. package/examples/eyelang/output/eyeling-basic-monadic-small.n3 +8 -0
  231. package/examples/eyelang/output/eyeling-bmi.n3 +2 -0
  232. package/examples/eyelang/output/eyeling-cat-koko.n3 +3 -0
  233. package/examples/eyelang/output/eyeling-collatz-small.n3 +3 -0
  234. package/examples/eyelang/output/eyeling-collection.n3 +1 -0
  235. package/examples/eyelang/output/eyeling-complex-arithmetic.n3 +5 -0
  236. package/examples/eyelang/output/eyeling-context-association.n3 +4 -0
  237. package/examples/eyelang/output/eyeling-control-system-small.n3 +4 -0
  238. package/examples/eyelang/output/eyeling-crypto-builtins-extra.n3 +3 -0
  239. package/examples/eyelang/output/eyeling-crypto-builtins.n3 +2 -0
  240. package/examples/eyelang/output/eyeling-deep-taxonomy-10.n3 +32 -0
  241. package/examples/eyelang/output/eyeling-derived-backward-rule-flat.n3 +4 -0
  242. package/examples/eyelang/output/eyeling-derived-rule-flat.n3 +2 -0
  243. package/examples/eyelang/output/eyeling-digital-product-passport-small.n3 +3 -0
  244. package/examples/eyelang/output/eyeling-dijkstra-tiny.n3 +9 -0
  245. package/examples/eyelang/output/eyeling-dog-license.n3 +1 -0
  246. package/examples/eyelang/output/eyeling-drone-corridor-planner-small.n3 +5 -0
  247. package/examples/eyelang/output/eyeling-equals.n3 +1 -0
  248. package/examples/eyelang/output/eyeling-equivalence-classes.n3 +2 -0
  249. package/examples/eyelang/output/eyeling-euler-identity.n3 +3 -0
  250. package/examples/eyelang/output/eyeling-existential-rule.n3 +4 -0
  251. package/examples/eyelang/output/eyeling-expression-eval.n3 +3 -0
  252. package/examples/eyelang/output/eyeling-family-cousins-extended.n3 +6 -0
  253. package/examples/eyelang/output/eyeling-fastpow.n3 +4 -0
  254. package/examples/eyelang/output/eyeling-fibonacci.n3 +6 -0
  255. package/examples/eyelang/output/eyeling-french-cities-reachability.n3 +25 -0
  256. package/examples/eyelang/output/eyeling-goldbach-small.n3 +2 -0
  257. package/examples/eyelang/output/eyeling-good-cobbler.n3 +2 -0
  258. package/examples/eyelang/output/eyeling-list-builtins.n3 +6 -0
  259. package/examples/eyelang/output/eyeling-list-collection-extra.n3 +5 -0
  260. package/examples/eyelang/output/eyeling-math-builtins.n3 +5 -0
  261. package/examples/eyelang/output/eyeling-string-builtins-extra.n3 +3 -0
  262. package/examples/eyelang/output/eyeling-string-builtins.n3 +4 -0
  263. package/examples/eyelang/output/eyeling-time-builtins.n3 +4 -0
  264. package/examples/eyelang/output/eyeling-time-components-extra.n3 +5 -0
  265. package/examples/eyelang/output/eyeling-witch.n3 +2 -0
  266. package/examples/eyelang/output/family-cousins.n3 +8 -0
  267. package/examples/eyelang/output/family-cousins.pl +28 -0
  268. package/examples/eyelang/output/fastpow.pl +6 -0
  269. package/examples/eyelang/output/fft8-numeric.pl +4 -0
  270. package/examples/eyelang/output/fibonacci.pl +6 -0
  271. package/examples/eyelang/output/field-nitrogen-balance.pl +21 -0
  272. package/examples/eyelang/output/flandor.pl +43 -0
  273. package/examples/eyelang/output/floating-point.pl +9 -0
  274. package/examples/eyelang/output/four-color-map.pl +3 -0
  275. package/examples/eyelang/output/fundamental-theorem-arithmetic.pl +9 -0
  276. package/examples/eyelang/output/gcd-bezout-identity.pl +36 -0
  277. package/examples/eyelang/output/gd-step-certified.pl +79 -0
  278. package/examples/eyelang/output/gdpr-compliance.pl +6 -0
  279. package/examples/eyelang/output/goldbach-1000.pl +667 -0
  280. package/examples/eyelang/output/good-cobbler.pl +1 -0
  281. package/examples/eyelang/output/gps.pl +21 -0
  282. package/examples/eyelang/output/graph-reachability.pl +3 -0
  283. package/examples/eyelang/output/gray-code-counter.pl +1 -0
  284. package/examples/eyelang/output/greatest-lower-bound-uniqueness.pl +2 -0
  285. package/examples/eyelang/output/group-inverse-uniqueness.pl +2 -0
  286. package/examples/eyelang/output/hamiltonian-cycle.pl +4 -0
  287. package/examples/eyelang/output/hamiltonian-path.pl +121 -0
  288. package/examples/eyelang/output/hamming-code.pl +6 -0
  289. package/examples/eyelang/output/hanoi.pl +1 -0
  290. package/examples/eyelang/output/heat-loss.pl +5 -0
  291. package/examples/eyelang/output/heron-theorem.pl +4 -0
  292. package/examples/eyelang/output/ideal-gas-law.pl +3 -0
  293. package/examples/eyelang/output/illegitimate-reasoning.pl +15 -0
  294. package/examples/eyelang/output/kaprekar.pl +8 -0
  295. package/examples/eyelang/output/law-of-cosines.pl +3 -0
  296. package/examples/eyelang/output/least-squares-regression.pl +5 -0
  297. package/examples/eyelang/output/list-collection.pl +3 -0
  298. package/examples/eyelang/output/lldm.pl +6 -0
  299. package/examples/eyelang/output/manufacturing-quality-control.pl +6 -0
  300. package/examples/eyelang/output/matrix.pl +10 -0
  301. package/examples/eyelang/output/microgrid-dispatch.pl +6 -0
  302. package/examples/eyelang/output/monkey-bananas.pl +5 -0
  303. package/examples/eyelang/output/n-queens.pl +93 -0
  304. package/examples/eyelang/output/n3-builtins.n3 +6 -0
  305. package/examples/eyelang/output/network-sla.pl +4 -0
  306. package/examples/eyelang/output/newton-raphson.pl +3 -0
  307. package/examples/eyelang/output/nixon-diamond.pl +5 -0
  308. package/examples/eyelang/output/odrl-dpv-healthcare-risk-ranked.pl +42 -0
  309. package/examples/eyelang/output/odrl-dpv-risk-ranked.pl +120 -0
  310. package/examples/eyelang/output/orbital-transfer-design.pl +7 -0
  311. package/examples/eyelang/output/path-discovery.pl +3 -0
  312. package/examples/eyelang/output/peano-arithmetic.pl +3 -0
  313. package/examples/eyelang/output/peasant.pl +10 -0
  314. package/examples/eyelang/output/pendulum-period.pl +4 -0
  315. package/examples/eyelang/output/polynomial.pl +14 -0
  316. package/examples/eyelang/output/project-portfolio-optimization.pl +6 -0
  317. package/examples/eyelang/output/proof-contrapositive.pl +3 -0
  318. package/examples/eyelang/output/quadratic-formula.pl +6 -0
  319. package/examples/eyelang/output/quine-mccluskey.pl +3 -0
  320. package/examples/eyelang/output/radioactive-decay.pl +5 -0
  321. package/examples/eyelang/output/resilient-city-orchestration.pl +67 -0
  322. package/examples/eyelang/output/riemann-hypothesis.pl +12 -0
  323. package/examples/eyelang/output/sat-dpll.pl +5 -0
  324. package/examples/eyelang/output/security-incident-correlation.pl +3 -0
  325. package/examples/eyelang/output/service-impact.pl +11 -0
  326. package/examples/eyelang/output/sieve.pl +1 -0
  327. package/examples/eyelang/output/skolem-functions.pl +16 -0
  328. package/examples/eyelang/output/socket-age.pl +1 -0
  329. package/examples/eyelang/output/socket-family.pl +3 -0
  330. package/examples/eyelang/output/socrates.n3 +1 -0
  331. package/examples/eyelang/output/socrates.pl +2 -0
  332. package/examples/eyelang/output/statistics-summary.pl +4 -0
  333. package/examples/eyelang/output/sudoku.pl +2 -0
  334. package/examples/eyelang/output/superdense-coding.pl +6 -0
  335. package/examples/eyelang/output/traveling-salesman.pl +1 -0
  336. package/examples/eyelang/output/triple-term.n3 +2 -0
  337. package/examples/eyelang/output/turing.pl +12 -0
  338. package/examples/eyelang/output/vector-similarity.pl +4 -0
  339. package/examples/eyelang/output/witch.pl +7 -0
  340. package/examples/eyelang/output/wolf-goat-cabbage.pl +3 -0
  341. package/examples/eyelang/output/zebra.pl +3 -0
  342. package/examples/eyelang/path-discovery.pl +44998 -0
  343. package/examples/eyelang/peano-arithmetic.pl +31 -0
  344. package/examples/eyelang/peasant.pl +30 -0
  345. package/examples/eyelang/pendulum-period.pl +50 -0
  346. package/examples/eyelang/polynomial.pl +124 -0
  347. package/examples/eyelang/project-portfolio-optimization.pl +101 -0
  348. package/examples/eyelang/proof/age.pl +71 -0
  349. package/examples/eyelang/proof/aliases-and-namespaces.pl +78 -0
  350. package/examples/eyelang/proof/ancestor.pl +140 -0
  351. package/examples/eyelang/proof/animal.pl +68 -0
  352. package/examples/eyelang/proof/annotation.pl +80 -0
  353. package/examples/eyelang/proof/backward.pl +22 -0
  354. package/examples/eyelang/proof/cat-koko.pl +86 -0
  355. package/examples/eyelang/proof/data-negotiation.pl +76 -0
  356. package/examples/eyelang/proof/derived-rule.pl +43 -0
  357. package/examples/eyelang/proof/dog.pl +31 -0
  358. package/examples/eyelang/proof/electrical-rc-filter.pl +105 -0
  359. package/examples/eyelang/proof/existential-rule.pl +40 -0
  360. package/examples/eyelang/proof/floating-point.pl +160 -0
  361. package/examples/eyelang/proof/good-cobbler.pl +16 -0
  362. package/examples/eyelang/proof/group-inverse-uniqueness.pl +84 -0
  363. package/examples/eyelang/proof/list-collection.pl +52 -0
  364. package/examples/eyelang/proof/proof-contrapositive.pl +78 -0
  365. package/examples/eyelang/proof/socket-age.pl +32 -0
  366. package/examples/eyelang/proof/socket-family.pl +59 -0
  367. package/examples/eyelang/proof/socrates.pl +38 -0
  368. package/examples/eyelang/proof-contrapositive.pl +27 -0
  369. package/examples/eyelang/quadratic-formula.pl +54 -0
  370. package/examples/eyelang/quine-mccluskey.pl +143 -0
  371. package/examples/eyelang/radioactive-decay.pl +56 -0
  372. package/examples/eyelang/resilient-city-orchestration.pl +303 -0
  373. package/examples/eyelang/riemann-hypothesis.pl +110 -0
  374. package/examples/eyelang/sat-dpll.pl +80 -0
  375. package/examples/eyelang/security-incident-correlation.pl +69 -0
  376. package/examples/eyelang/service-impact.pl +41 -0
  377. package/examples/eyelang/sieve.pl +20 -0
  378. package/examples/eyelang/skolem-functions.pl +52 -0
  379. package/examples/eyelang/socket-age.pl +39 -0
  380. package/examples/eyelang/socket-family.pl +28 -0
  381. package/examples/eyelang/socrates.n3 +11 -0
  382. package/examples/eyelang/socrates.pl +19 -0
  383. package/examples/eyelang/statistics-summary.pl +54 -0
  384. package/examples/eyelang/sudoku.pl +20 -0
  385. package/examples/eyelang/superdense-coding.pl +84 -0
  386. package/examples/eyelang/traveling-salesman.pl +64 -0
  387. package/examples/eyelang/triple-term.n3 +9 -0
  388. package/examples/eyelang/turing.pl +67 -0
  389. package/examples/eyelang/vector-similarity.pl +56 -0
  390. package/examples/eyelang/witch.pl +38 -0
  391. package/examples/eyelang/wolf-goat-cabbage.pl +56 -0
  392. package/examples/eyelang/zebra.pl +44 -0
  393. package/eyelang.d.ts +92 -0
  394. package/eyeling-builtins.ttl +1 -1
  395. package/eyeling.js +2 -11
  396. package/index.d.ts +50 -2
  397. package/index.js +95 -1
  398. package/lib/builtins.js +1 -11
  399. package/lib/cli.js +1 -0
  400. package/lib/eyelang/bin.js +7 -0
  401. package/lib/eyelang/builtins/aggregation.mjs +81 -0
  402. package/lib/eyelang/builtins/alphametic.mjs +144 -0
  403. package/lib/eyelang/builtins/arithmetic.mjs +197 -0
  404. package/lib/eyelang/builtins/control.mjs +22 -0
  405. package/lib/eyelang/builtins/core.mjs +78 -0
  406. package/lib/eyelang/builtins/formula.mjs +42 -0
  407. package/lib/eyelang/builtins/lists.mjs +149 -0
  408. package/lib/eyelang/builtins/matrix.mjs +226 -0
  409. package/lib/eyelang/builtins/n3.mjs +483 -0
  410. package/lib/eyelang/builtins/number-theory.mjs +114 -0
  411. package/lib/eyelang/builtins/portfolio.mjs +73 -0
  412. package/lib/eyelang/builtins/registry.mjs +54 -0
  413. package/lib/eyelang/builtins/search.mjs +579 -0
  414. package/lib/eyelang/builtins/strings.mjs +41 -0
  415. package/lib/eyelang/builtins/sudoku.mjs +141 -0
  416. package/lib/eyelang/cli.mjs +192 -0
  417. package/lib/eyelang/explain.mjs +324 -0
  418. package/lib/eyelang/hash.mjs +294 -0
  419. package/lib/eyelang/index.mjs +48 -0
  420. package/lib/eyelang/parser.mjs +428 -0
  421. package/lib/eyelang/program.mjs +244 -0
  422. package/lib/eyelang/rdf.mjs +747 -0
  423. package/lib/eyelang/solver.mjs +237 -0
  424. package/lib/eyelang/term.mjs +328 -0
  425. package/package.json +12 -3
  426. package/test/builtins.test.js +15 -2
  427. package/test/eyelang/conformance/README.md +45 -0
  428. package/test/eyelang/conformance/cases/core/001_fact_output.pl +4 -0
  429. package/test/eyelang/conformance/cases/core/001_fact_query.query +1 -0
  430. package/test/eyelang/conformance/cases/core/002_rule_recursion.pl +7 -0
  431. package/test/eyelang/conformance/cases/core/002_rule_recursion.query +1 -0
  432. package/test/eyelang/conformance/cases/core/003_terms_and_readback.pl +16 -0
  433. package/test/eyelang/conformance/cases/core/003_terms_and_readback.query +1 -0
  434. package/test/eyelang/conformance/cases/core/004_conjunction_and_parentheses.pl +5 -0
  435. package/test/eyelang/conformance/cases/core/004_conjunction_and_parentheses.query +1 -0
  436. package/test/eyelang/conformance/cases/core/005_list_deconstruction.pl +6 -0
  437. package/test/eyelang/conformance/cases/core/005_list_deconstruction.query +1 -0
  438. package/test/eyelang/conformance/cases/core/006_comma_formula_data.pl +4 -0
  439. package/test/eyelang/conformance/cases/core/006_comma_formula_data.query +1 -0
  440. package/test/eyelang/conformance/cases/core/007_anonymous_variables.pl +5 -0
  441. package/test/eyelang/conformance/cases/core/007_anonymous_variables.query +1 -0
  442. package/test/eyelang/conformance/cases/core/008_graphic_atoms.pl +6 -0
  443. package/test/eyelang/conformance/cases/core/008_graphic_atoms.query +1 -0
  444. package/test/eyelang/conformance/cases/core/009_comments_and_whitespace.pl +5 -0
  445. package/test/eyelang/conformance/cases/core/009_comments_and_whitespace.query +1 -0
  446. package/test/eyelang/conformance/cases/core/010_variable_scope_and_reuse.pl +8 -0
  447. package/test/eyelang/conformance/cases/core/010_variable_scope_and_reuse.query +1 -0
  448. package/test/eyelang/conformance/cases/core/011_predicate_arity.pl +6 -0
  449. package/test/eyelang/conformance/cases/core/011_predicate_arity.query +1 -0
  450. package/test/eyelang/conformance/cases/core/012_nested_compound_unification.pl +5 -0
  451. package/test/eyelang/conformance/cases/core/012_nested_compound_unification.query +1 -0
  452. package/test/eyelang/conformance/cases/core/013_multiple_clauses_order.pl +6 -0
  453. package/test/eyelang/conformance/cases/core/013_multiple_clauses_order.query +1 -0
  454. package/test/eyelang/conformance/cases/core/014_failure_filters_answers.pl +7 -0
  455. package/test/eyelang/conformance/cases/core/014_failure_filters_answers.query +1 -0
  456. package/test/eyelang/conformance/cases/core/015_improper_list_unification.pl +6 -0
  457. package/test/eyelang/conformance/cases/core/015_improper_list_unification.query +1 -0
  458. package/test/eyelang/conformance/cases/core/016_zero_arity_compound.pl +4 -0
  459. package/test/eyelang/conformance/cases/core/016_zero_arity_compound.query +1 -0
  460. package/test/eyelang/conformance/cases/core/017_three_step_recursion.pl +8 -0
  461. package/test/eyelang/conformance/cases/core/017_three_step_recursion.query +1 -0
  462. package/test/eyelang/conformance/cases/core/018_quoted_atom_readback.pl +6 -0
  463. package/test/eyelang/conformance/cases/core/018_quoted_atom_readback.query +1 -0
  464. package/test/eyelang/conformance/cases/core/019_parenthesized_three_conjuncts.pl +7 -0
  465. package/test/eyelang/conformance/cases/core/019_parenthesized_three_conjuncts.query +1 -0
  466. package/test/eyelang/conformance/cases/core/020_nested_list_terms.pl +5 -0
  467. package/test/eyelang/conformance/cases/core/020_nested_list_terms.query +1 -0
  468. package/test/eyelang/conformance/cases/core/021_repeated_variable_head.pl +7 -0
  469. package/test/eyelang/conformance/cases/core/022_rule_head_structure.pl +5 -0
  470. package/test/eyelang/conformance/cases/core/023_quoted_escapes_readback.pl +5 -0
  471. package/test/eyelang/conformance/cases/core/024_numeric_literal_readback.pl +6 -0
  472. package/test/eyelang/conformance/cases/core/025_body_parentheses_with_formula_data.pl +5 -0
  473. package/test/eyelang/conformance/cases/core/026_underscore_named_variable_reuse.pl +5 -0
  474. package/test/eyelang/conformance/cases/extension/001_default_derived_output.pl +5 -0
  475. package/test/eyelang/conformance/cases/extension/002_materialize_focus.pl +5 -0
  476. package/test/eyelang/conformance/cases/extension/003_arithmetic_and_comparison.pl +12 -0
  477. package/test/eyelang/conformance/cases/extension/003_arithmetic_and_comparison.query +1 -0
  478. package/test/eyelang/conformance/cases/extension/004_strings_and_atoms.pl +6 -0
  479. package/test/eyelang/conformance/cases/extension/004_strings_and_atoms.query +1 -0
  480. package/test/eyelang/conformance/cases/extension/005_lists_aggregation_ordering.pl +10 -0
  481. package/test/eyelang/conformance/cases/extension/005_lists_aggregation_ordering.query +1 -0
  482. package/test/eyelang/conformance/cases/extension/006_formula_terms.pl +5 -0
  483. package/test/eyelang/conformance/cases/extension/006_formula_terms.query +1 -0
  484. package/test/eyelang/conformance/cases/extension/007_negation_once_generators.pl +7 -0
  485. package/test/eyelang/conformance/cases/extension/007_negation_once_generators.query +1 -0
  486. package/test/eyelang/conformance/cases/extension/008_equality_and_inequality.pl +6 -0
  487. package/test/eyelang/conformance/cases/extension/008_equality_and_inequality.query +1 -0
  488. package/test/eyelang/conformance/cases/extension/009_list_relations.pl +6 -0
  489. package/test/eyelang/conformance/cases/extension/009_list_relations.query +1 -0
  490. package/test/eyelang/conformance/cases/extension/010_append_splits.pl +3 -0
  491. package/test/eyelang/conformance/cases/extension/010_append_splits.query +1 -0
  492. package/test/eyelang/conformance/cases/extension/011_matching_and_comparison.pl +7 -0
  493. package/test/eyelang/conformance/cases/extension/011_matching_and_comparison.query +1 -0
  494. package/test/eyelang/conformance/cases/extension/012_memoize_declaration.pl +8 -0
  495. package/test/eyelang/conformance/cases/extension/012_memoize_declaration.query +1 -0
  496. package/test/eyelang/conformance/cases/extension/013_numeric_functions.pl +9 -0
  497. package/test/eyelang/conformance/cases/extension/013_numeric_functions.query +1 -0
  498. package/test/eyelang/conformance/cases/extension/014_between_enumeration.pl +3 -0
  499. package/test/eyelang/conformance/cases/extension/014_between_enumeration.query +1 -0
  500. package/test/eyelang/conformance/cases/extension/015_smallest_divisor.pl +3 -0
  501. package/test/eyelang/conformance/cases/extension/015_smallest_divisor.query +1 -0
  502. package/test/eyelang/conformance/cases/extension/016_negation_filter.pl +7 -0
  503. package/test/eyelang/conformance/cases/extension/016_negation_filter.query +1 -0
  504. package/test/eyelang/conformance/cases/extension/017_once_user_predicate.pl +5 -0
  505. package/test/eyelang/conformance/cases/extension/017_once_user_predicate.query +1 -0
  506. package/test/eyelang/conformance/cases/extension/018_findall_user_goal.pl +6 -0
  507. package/test/eyelang/conformance/cases/extension/018_findall_user_goal.query +1 -0
  508. package/test/eyelang/conformance/cases/extension/019_sort_deduplicates_atoms.pl +3 -0
  509. package/test/eyelang/conformance/cases/extension/019_sort_deduplicates_atoms.query +1 -0
  510. package/test/eyelang/conformance/cases/extension/020_append_bound_prefix_suffix.pl +4 -0
  511. package/test/eyelang/conformance/cases/extension/020_append_bound_prefix_suffix.query +1 -0
  512. package/test/eyelang/conformance/cases/extension/021_nth0_index_generation.pl +3 -0
  513. package/test/eyelang/conformance/cases/extension/021_nth0_index_generation.query +1 -0
  514. package/test/eyelang/conformance/cases/extension/022_set_nth0_edges.pl +4 -0
  515. package/test/eyelang/conformance/cases/extension/022_set_nth0_edges.query +1 -0
  516. package/test/eyelang/conformance/cases/extension/023_select_duplicate_occurrences.pl +3 -0
  517. package/test/eyelang/conformance/cases/extension/023_select_duplicate_occurrences.query +1 -0
  518. package/test/eyelang/conformance/cases/extension/024_not_member_filter.pl +6 -0
  519. package/test/eyelang/conformance/cases/extension/024_not_member_filter.query +1 -0
  520. package/test/eyelang/conformance/cases/extension/025_is_list_filter.pl +5 -0
  521. package/test/eyelang/conformance/cases/extension/025_is_list_filter.query +1 -0
  522. package/test/eyelang/conformance/cases/extension/026_nested_formula_terms.pl +5 -0
  523. package/test/eyelang/conformance/cases/extension/026_nested_formula_terms.query +1 -0
  524. package/test/eyelang/conformance/cases/extension/027_materialize_excludes_source_fact.pl +6 -0
  525. package/test/eyelang/conformance/cases/extension/028_numeric_and_lexical_comparison.pl +5 -0
  526. package/test/eyelang/conformance/cases/extension/028_numeric_and_lexical_comparison.query +1 -0
  527. package/test/eyelang/conformance/cases/extension/029_string_matching_filters.pl +6 -0
  528. package/test/eyelang/conformance/cases/extension/029_string_matching_filters.query +1 -0
  529. package/test/eyelang/conformance/cases/extension/030_string_and_atom_concat.pl +4 -0
  530. package/test/eyelang/conformance/cases/extension/030_string_and_atom_concat.query +1 -0
  531. package/test/eyelang/conformance/cases/extension/031_countall_empty_and_nonempty.pl +4 -0
  532. package/test/eyelang/conformance/cases/extension/031_countall_empty_and_nonempty.query +1 -0
  533. package/test/eyelang/conformance/cases/extension/032_sumall_numeric_template.pl +5 -0
  534. package/test/eyelang/conformance/cases/extension/032_sumall_numeric_template.query +1 -0
  535. package/test/eyelang/conformance/cases/extension/033_aggregate_min_template.pl +5 -0
  536. package/test/eyelang/conformance/cases/extension/033_aggregate_min_template.query +1 -0
  537. package/test/eyelang/conformance/cases/extension/034_aggregate_max_compound_key.pl +5 -0
  538. package/test/eyelang/conformance/cases/extension/034_aggregate_max_compound_key.query +1 -0
  539. package/test/eyelang/conformance/cases/extension/035_date_difference.pl +4 -0
  540. package/test/eyelang/conformance/cases/extension/036_extended_gcd.pl +3 -0
  541. package/test/eyelang/conformance/cases/extension/037_collatz_trajectory.pl +3 -0
  542. package/test/eyelang/conformance/cases/extension/038_kaprekar_steps.pl +3 -0
  543. package/test/eyelang/conformance/cases/extension/039_goldbach_pair.pl +3 -0
  544. package/test/eyelang/conformance/cases/extension/040_matrix_operations.pl +5 -0
  545. package/test/eyelang/conformance/cases/extension/041_atom_range_generators.pl +5 -0
  546. package/test/eyelang/conformance/cases/extension/042_n_queens_small.pl +3 -0
  547. package/test/eyelang/conformance/cases/extension/043_cnf_model.pl +3 -0
  548. package/test/eyelang/conformance/cases/extension/044_cover9_filter.pl +6 -0
  549. package/test/eyelang/conformance/cases/extension/045_alphametic_sum_small.pl +3 -0
  550. package/test/eyelang/conformance/cases/extension/046_bounded_subset.pl +4 -0
  551. package/test/eyelang/conformance/expected/core/001_fact_output.out +1 -0
  552. package/test/eyelang/conformance/expected/core/002_rule_recursion.out +2 -0
  553. package/test/eyelang/conformance/expected/core/003_terms_and_readback.out +13 -0
  554. package/test/eyelang/conformance/expected/core/004_conjunction_and_parentheses.out +1 -0
  555. package/test/eyelang/conformance/expected/core/005_list_deconstruction.out +2 -0
  556. package/test/eyelang/conformance/expected/core/006_comma_formula_data.out +1 -0
  557. package/test/eyelang/conformance/expected/core/007_anonymous_variables.out +1 -0
  558. package/test/eyelang/conformance/expected/core/008_graphic_atoms.out +3 -0
  559. package/test/eyelang/conformance/expected/core/009_comments_and_whitespace.out +2 -0
  560. package/test/eyelang/conformance/expected/core/010_variable_scope_and_reuse.out +2 -0
  561. package/test/eyelang/conformance/expected/core/011_predicate_arity.out +2 -0
  562. package/test/eyelang/conformance/expected/core/012_nested_compound_unification.out +2 -0
  563. package/test/eyelang/conformance/expected/core/013_multiple_clauses_order.out +2 -0
  564. package/test/eyelang/conformance/expected/core/014_failure_filters_answers.out +1 -0
  565. package/test/eyelang/conformance/expected/core/015_improper_list_unification.out +3 -0
  566. package/test/eyelang/conformance/expected/core/016_zero_arity_compound.out +1 -0
  567. package/test/eyelang/conformance/expected/core/017_three_step_recursion.out +3 -0
  568. package/test/eyelang/conformance/expected/core/018_quoted_atom_readback.out +3 -0
  569. package/test/eyelang/conformance/expected/core/019_parenthesized_three_conjuncts.out +1 -0
  570. package/test/eyelang/conformance/expected/core/020_nested_list_terms.out +2 -0
  571. package/test/eyelang/conformance/expected/core/021_repeated_variable_head.out +2 -0
  572. package/test/eyelang/conformance/expected/core/022_rule_head_structure.out +2 -0
  573. package/test/eyelang/conformance/expected/core/023_quoted_escapes_readback.out +2 -0
  574. package/test/eyelang/conformance/expected/core/024_numeric_literal_readback.out +3 -0
  575. package/test/eyelang/conformance/expected/core/025_body_parentheses_with_formula_data.out +1 -0
  576. package/test/eyelang/conformance/expected/core/026_underscore_named_variable_reuse.out +1 -0
  577. package/test/eyelang/conformance/expected/extension/001_default_derived_output.out +3 -0
  578. package/test/eyelang/conformance/expected/extension/002_materialize_focus.out +1 -0
  579. package/test/eyelang/conformance/expected/extension/003_arithmetic_and_comparison.out +10 -0
  580. package/test/eyelang/conformance/expected/extension/004_strings_and_atoms.out +4 -0
  581. package/test/eyelang/conformance/expected/extension/005_lists_aggregation_ordering.out +9 -0
  582. package/test/eyelang/conformance/expected/extension/006_formula_terms.out +4 -0
  583. package/test/eyelang/conformance/expected/extension/007_negation_once_generators.out +2 -0
  584. package/test/eyelang/conformance/expected/extension/008_equality_and_inequality.out +4 -0
  585. package/test/eyelang/conformance/expected/extension/009_list_relations.out +5 -0
  586. package/test/eyelang/conformance/expected/extension/010_append_splits.out +3 -0
  587. package/test/eyelang/conformance/expected/extension/011_matching_and_comparison.out +5 -0
  588. package/test/eyelang/conformance/expected/extension/012_memoize_declaration.out +2 -0
  589. package/test/eyelang/conformance/expected/extension/013_numeric_functions.out +7 -0
  590. package/test/eyelang/conformance/expected/extension/014_between_enumeration.out +3 -0
  591. package/test/eyelang/conformance/expected/extension/015_smallest_divisor.out +1 -0
  592. package/test/eyelang/conformance/expected/extension/016_negation_filter.out +2 -0
  593. package/test/eyelang/conformance/expected/extension/017_once_user_predicate.out +1 -0
  594. package/test/eyelang/conformance/expected/extension/018_findall_user_goal.out +1 -0
  595. package/test/eyelang/conformance/expected/extension/019_sort_deduplicates_atoms.out +1 -0
  596. package/test/eyelang/conformance/expected/extension/020_append_bound_prefix_suffix.out +2 -0
  597. package/test/eyelang/conformance/expected/extension/021_nth0_index_generation.out +1 -0
  598. package/test/eyelang/conformance/expected/extension/022_set_nth0_edges.out +2 -0
  599. package/test/eyelang/conformance/expected/extension/023_select_duplicate_occurrences.out +2 -0
  600. package/test/eyelang/conformance/expected/extension/024_not_member_filter.out +1 -0
  601. package/test/eyelang/conformance/expected/extension/025_is_list_filter.out +1 -0
  602. package/test/eyelang/conformance/expected/extension/026_nested_formula_terms.out +6 -0
  603. package/test/eyelang/conformance/expected/extension/027_materialize_excludes_source_fact.out +1 -0
  604. package/test/eyelang/conformance/expected/extension/028_numeric_and_lexical_comparison.out +3 -0
  605. package/test/eyelang/conformance/expected/extension/029_string_matching_filters.out +2 -0
  606. package/test/eyelang/conformance/expected/extension/030_string_and_atom_concat.out +2 -0
  607. package/test/eyelang/conformance/expected/extension/031_countall_empty_and_nonempty.out +1 -0
  608. package/test/eyelang/conformance/expected/extension/032_sumall_numeric_template.out +1 -0
  609. package/test/eyelang/conformance/expected/extension/033_aggregate_min_template.out +1 -0
  610. package/test/eyelang/conformance/expected/extension/034_aggregate_max_compound_key.out +1 -0
  611. package/test/eyelang/conformance/expected/extension/035_date_difference.out +2 -0
  612. package/test/eyelang/conformance/expected/extension/036_extended_gcd.out +1 -0
  613. package/test/eyelang/conformance/expected/extension/037_collatz_trajectory.out +1 -0
  614. package/test/eyelang/conformance/expected/extension/038_kaprekar_steps.out +1 -0
  615. package/test/eyelang/conformance/expected/extension/039_goldbach_pair.out +2 -0
  616. package/test/eyelang/conformance/expected/extension/040_matrix_operations.out +3 -0
  617. package/test/eyelang/conformance/expected/extension/041_atom_range_generators.out +8 -0
  618. package/test/eyelang/conformance/expected/extension/042_n_queens_small.out +2 -0
  619. package/test/eyelang/conformance/expected/extension/043_cnf_model.out +1 -0
  620. package/test/eyelang/conformance/expected/extension/044_cover9_filter.out +2 -0
  621. package/test/eyelang/conformance/expected/extension/045_alphametic_sum_small.out +4 -0
  622. package/test/eyelang/conformance/expected/extension/046_bounded_subset.out +5 -0
  623. package/test/eyelang/run-all.mjs +20 -0
  624. package/test/eyelang/run-conformance.mjs +80 -0
  625. package/test/eyelang/run-examples.mjs +126 -0
  626. package/test/eyelang/run-regression.mjs +640 -0
  627. package/test/eyelang/test-style.mjs +91 -0
  628. package/test/eyelang.test.js +58 -0
  629. package/test/run.js +1 -0
@@ -0,0 +1,684 @@
1
+ # eyelang Language Specification
2
+
3
+ ## Table of contents
4
+
5
+ - [Abstract](#abstract)
6
+ - [1. Terminology and normative language](#1-terminology-and-normative-language)
7
+ - [2. Design goals](#2-design-goals)
8
+ - [3. Lexical structure](#3-lexical-structure)
9
+ - [3.1 Character stream](#31-character-stream)
10
+ - [3.2 Comments](#32-comments)
11
+ - [3.3 Punctuation tokens](#33-punctuation-tokens)
12
+ - [3.4 Variables](#34-variables)
13
+ - [3.5 Atom constants](#35-atom-constants)
14
+ - [3.6 Strings](#36-strings)
15
+ - [3.7 Numbers](#37-numbers)
16
+ - [4. Surface grammar](#4-surface-grammar)
17
+ - [5. Terms](#5-terms)
18
+ - [5.1 Variables](#51-variables)
19
+ - [5.2 Atom constants, strings, and numbers](#52-atom-constants-strings-and-numbers)
20
+ - [5.3 Compound terms and atomic formulas](#53-compound-terms-and-atomic-formulas)
21
+ - [5.4 Lists](#54-lists)
22
+ - [5.5 Comma terms](#55-comma-terms)
23
+ - [6. Clauses and predicates](#6-clauses-and-predicates)
24
+ - [7. Goals and proof search](#7-goals-and-proof-search)
25
+ - [7.1 Unification](#71-unification)
26
+ - [7.2 Failure](#72-failure)
27
+ - [7.3 Finite search expectation](#73-finite-search-expectation)
28
+ - [8. Logical reading: Herbrand semantics](#8-logical-reading-herbrand-semantics)
29
+ - [8.1 Variables and quantification](#81-variables-and-quantification)
30
+ - [8.2 Equality, identity, and unification](#82-equality-identity-and-unification)
31
+ - [8.3 Goal-directed execution versus model-theoretic meaning](#83-goal-directed-execution-versus-model-theoretic-meaning)
32
+ - [8.4 Built-ins and operational extensions](#84-built-ins-and-operational-extensions)
33
+ - [9. Standard built-in predicates](#9-standard-built-in-predicates)
34
+ - [9.1 Equality and unification](#91-equality-and-unification)
35
+ - [9.2 Arithmetic](#92-arithmetic)
36
+ - [9.3 Comparison](#93-comparison)
37
+ - [9.4 Dates and durations](#94-dates-and-durations)
38
+ - [9.5 Generators](#95-generators)
39
+ - [9.6 Strings and atom constants](#96-strings-and-atom-constants)
40
+ - [9.7 Lists](#97-lists)
41
+ - [9.8 Aggregation and ordering](#98-aggregation-and-ordering)
42
+ - [9.9 Formula terms](#99-formula-terms)
43
+ - [9.10 Search control](#910-search-control)
44
+ - [10. Extension built-ins](#10-extension-built-ins)
45
+ - [11. Declarations](#11-declarations)
46
+ - [11.1 Memoization](#111-memoization)
47
+ - [11.2 Default-output materialization](#112-default-output-materialization)
48
+ - [12. eyelang Sockets](#12-eyelang-sockets)
49
+ - [12.1 Socket vocabulary](#121-socket-vocabulary)
50
+ - [12.2 Socket example](#122-socket-example)
51
+ - [12.3 Sockets and AI agents](#123-sockets-and-ai-agents)
52
+ - [13. Output and read-back profile](#13-output-and-read-back-profile)
53
+ - [13.1 Explanation output](#131-explanation-output)
54
+ - [14. Conformance profiles](#14-conformance-profiles)
55
+ - [14.1 Core language profile](#141-core-language-profile)
56
+ - [14.2 Standard built-in profile](#142-standard-built-in-profile)
57
+ - [14.3 Standard host profile](#143-standard-host-profile)
58
+ - [15. Relationship to ISO Prolog](#15-relationship-to-iso-prolog)
59
+ - [16. Examples](#16-examples)
60
+ - [16.1 Transitive closure](#161-transitive-closure)
61
+ - [16.2 Arithmetic](#162-arithmetic)
62
+ - [16.3 Lists](#163-lists)
63
+ - [16.4 Negation as failure](#164-negation-as-failure)
64
+ - [17. Security and portability considerations](#17-security-and-portability-considerations)
65
+
66
+ ## Abstract
67
+
68
+ eyelang is a compact Prolog-like definite-clause language for rule-based programs over ordinary terms, lists, arithmetic, strings, and finite search. An eyelang program is a finite sequence of facts and Horn clauses. The underlying declarative semantics of the pure language is **Herbrand semantics**: constants, compound terms, and lists denote themselves, and predicates denote sets of ground atomic formulas over those terms. Evaluation is goal-directed: goals are solved by unification against facts, rules, and a fixed set of built-in predicates.
69
+
70
+ eyelang is intentionally smaller than ISO Prolog. It supports enough Prolog syntax to express Horn-clause reasoning, list processing, arithmetic examples, finite search, and formula data, without operators, cut, modules, dynamic predicates, DCGs, or a complete ISO standard library.
71
+
72
+ ## 1. Terminology and normative language
73
+
74
+ The key words **MUST**, **MUST NOT**, **SHOULD**, **SHOULD NOT**, and **MAY** are to be interpreted as normative requirements.
75
+
76
+ A **term** is a variable, atom constant, string, number, list, or compound term.
77
+
78
+ An **atom constant** is a symbolic scalar term, such as `pat`, `type`, or `'atom with spaces'`. It is a term and may appear as an argument, list element, functor name, or predicate name.
79
+
80
+ An **atomic formula** is a predicate application such as `parent(pat, jan)` or `status(case1, accepted)`. It is the unit of truth in a Herbrand interpretation. In some logic-programming literature atomic formulas are called "atoms"; this specification avoids that shorthand. Whenever the noun "atom" appears here outside a built-in name such as `formula_atom/2`, it means **atom constant**, not atomic formula.
81
+
82
+ This distinction is normative: `pat` is an atom constant and can appear as a term argument; `parent(pat, jan)` is an atomic formula and can appear as a fact, rule head, or goal. A compound term such as `pair(pat, jan)` has the same surface shape as an atomic formula, but its role is determined by context: as data it is a compound term, and as a clause head or goal it is an atomic formula with predicate symbol `pair/2`.
83
+
84
+ A **clause** is either a fact `Head.` or a rule `Head :- Body.`.
85
+
86
+ A **goal** is an atomic formula, a built-in call, or a comma conjunction.
87
+
88
+ A **source fact** is a fact written directly in the input program. A **new derivation** is a ground consequence found through at least one rule and not merely repeated from the source facts.
89
+
90
+ The **Herbrand universe** of a program is the set of all ground eyelang terms constructible from the constants and functors in the program, together with the built-in list constructors `[]` and `./2` where lists are used. The **Herbrand base** is the set of all ground atomic formulas whose predicate symbols occur in the program and whose arguments are terms from the Herbrand universe.
91
+
92
+ ## 2. Design goals
93
+
94
+ eyelang is designed to be:
95
+
96
+ - small enough to embed and audit;
97
+ - deterministic in textual output order after duplicate suppression;
98
+ - useful for relation-style `p(S, O)` output through ordinary predicate names;
99
+ - practical for examples involving recursion, lists, arithmetic, strings, aggregation, finite search, and formula-valued data.
100
+
101
+ Non-goals include complete ISO Prolog compatibility, operator declarations, module systems, dynamic database updates, cut-based control, and full bottom-up closure semantics.
102
+
103
+ ## 3. Lexical structure
104
+
105
+ ### 3.1 Character stream
106
+
107
+ Input is Unicode text. Whitespace separates tokens and is otherwise insignificant outside quoted strings and quoted atom constants.
108
+
109
+ ### 3.2 Comments
110
+
111
+ A percent sign starts a line comment outside quoted strings and quoted atom constants. The comment extends to the end of the line.
112
+
113
+ ```prolog
114
+ parent(pat, jan). % this is a comment
115
+ ```
116
+
117
+ ### 3.3 Punctuation tokens
118
+
119
+ The punctuation tokens are:
120
+
121
+ ```text
122
+ ( ) [ ] , | . :-
123
+ ```
124
+
125
+ A colon outside `:-` is not part of the language. Namespace-like names SHOULD be written as plain atom constants such as `person_type` or `odrl_permission`.
126
+
127
+ ### 3.4 Variables
128
+
129
+ A variable starts with an uppercase ASCII letter or underscore, followed by zero or more ASCII letters, digits, or underscores.
130
+
131
+ Examples:
132
+
133
+ ```prolog
134
+ X
135
+ Person
136
+ _Thing
137
+ _
138
+ ```
139
+
140
+ Each `_` anonymous variable occurrence is fresh.
141
+
142
+ ### 3.5 Atom constants
143
+
144
+ A plain atom constant starts with a lowercase ASCII letter and is followed by zero or more ASCII letters, digits, or underscores:
145
+
146
+ ```prolog
147
+ pat
148
+ type
149
+ case_123
150
+ ```
151
+
152
+ A quoted atom constant is enclosed in single quotes. A single quote inside a quoted atom constant is represented by doubling it:
153
+
154
+ ```prolog
155
+ 'atom with spaces'
156
+ 'needs''quote'
157
+ ''
158
+ ```
159
+
160
+ A graphic atom constant is one or more graphic characters from this set:
161
+
162
+ ```text
163
+ #$&*+-/<=>?@^~\
164
+ ```
165
+
166
+ ### 3.6 Strings
167
+
168
+ A string is enclosed in double quotes. The implementation supports common escapes such as `\n`, `\t`, `\"`, and `\\`.
169
+
170
+ ### 3.7 Numbers
171
+
172
+ Numbers are scalar terms. Integers, decimal numbers, and scientific notation are accepted:
173
+
174
+ ```prolog
175
+ 0
176
+ -42
177
+ 0.25
178
+ 1.25e-3
179
+ 1.25e+3
180
+ ```
181
+
182
+ Integer arithmetic built-ins use arbitrary-precision decimal strings where possible. Floating operations use the host implementation's IEEE-754 double-precision behavior.
183
+
184
+ ## 4. Surface grammar
185
+
186
+ This grammar is descriptive. Implementations MAY reject programs that exceed implementation limits.
187
+
188
+ ```text
189
+ program ::= clause*
190
+ clause ::= term "." | term ":-" goal_list "."
191
+ goal_list ::= term ("," term)*
192
+ term ::= variable
193
+ | atom_constant
194
+ | string
195
+ | number
196
+ | atom_constant "(" [term ("," term)*] ")"
197
+ | "[" [list_items] "]"
198
+ | "(" term ("," term)+ ")"
199
+ list_items ::= term ("," term)* ["|" term]
200
+ ```
201
+
202
+ Here `atom_constant` is a lexical class for symbolic scalar terms, not an atomic formula. Atomic formulas are represented by the grammar alternative `atom_constant "(" ... ")"` when such a compound appears in a clause head, rule body, or selected goal.
203
+
204
+ A clause head SHOULD be a compound term. Non-compound heads are parsed but are not useful in the current predicate index.
205
+
206
+ Zero-arity compounds are written with parentheses:
207
+
208
+ ```prolog
209
+ nil().
210
+ value(example, nil()).
211
+ ```
212
+
213
+ ## 5. Terms
214
+
215
+ ### 5.1 Variables
216
+
217
+ Variables are scoped to a single clause or selected goal. A variable in a rule head and body denotes the same logical variable within that clause.
218
+
219
+ ### 5.2 Atom constants, strings, and numbers
220
+
221
+ Atom constants, strings, and numbers are distinct scalar term kinds. Two scalar terms unify only when their type and lexical value match, except where a built-in explicitly interprets lexical values.
222
+
223
+ ### 5.3 Compound terms and atomic formulas
224
+
225
+ A compound term has a functor name and arity:
226
+
227
+ ```prolog
228
+ parent(pat, jan)
229
+ pair(3, nested(atom, [x, y]))
230
+ ```
231
+
232
+ The same concrete syntax is used for atomic formulas when the compound appears as a fact, rule head, or goal. In `parent(pat, jan).`, `parent/2` is a predicate symbol and the whole expression is an atomic formula. In `value(x, parent(pat, jan)).`, the inner `parent(pat, jan)` is ordinary compound data.
233
+
234
+ The functor or predicate name is fixed syntactically and is written as an atom constant. eyelang does not support variables in predicate or functor position.
235
+
236
+ ### 5.4 Lists
237
+
238
+ Lists use Prolog surface syntax and are represented internally with `./2` and `[]`:
239
+
240
+ ```prolog
241
+ []
242
+ [a, b, c]
243
+ [a, b | tail]
244
+ ```
245
+
246
+ ### 5.5 Comma terms
247
+
248
+ Parenthesized comma terms may be goals or data:
249
+
250
+ ```prolog
251
+ (parent(pat, jan), parent(jan, emma))
252
+ (name(alice, "Alice"), knows(alice, bob))
253
+ ```
254
+
255
+ When a comma term appears as a goal, it is evaluated as conjunction. When it appears as data, it remains a term. `formula_atom/2` and `formula_binary/4` enumerate members inside such formula terms.
256
+
257
+ ## 6. Clauses and predicates
258
+
259
+ A fact has no body:
260
+
261
+ ```prolog
262
+ parent(pat, jan).
263
+ ```
264
+
265
+ A rule has a head and a body:
266
+
267
+ ```prolog
268
+ ancestor(X, Y) :-
269
+ parent(X, Y).
270
+
271
+ ancestor(X, Z) :-
272
+ parent(X, Y),
273
+ ancestor(Y, Z).
274
+ ```
275
+
276
+ Clauses with the same predicate name and arity define one predicate group. Predicate name and arity are both significant: `p/1` and `p/2` are different predicates.
277
+
278
+ ## 7. Goals and proof search
279
+
280
+ Goals are solved left-to-right. For a user-defined atomic-formula goal, eyelang selects candidate clauses by predicate name, arity, and available indexes. A candidate clause is freshened, its head is unified with the goal, and then its body is solved.
281
+
282
+ A conjunction goal succeeds when all conjunct goals succeed in order. An answer is printed as the resolved answer term followed by a period.
283
+
284
+ ### 7.1 Unification
285
+
286
+ Unification follows the ordinary first-order term structure used by the language. The implementation does not perform an occurs check.
287
+
288
+ ### 7.2 Failure
289
+
290
+ A goal fails when no built-in case or user clause can prove it. eyelang has no exception term language; parse errors and resource failures are implementation errors reported to the host.
291
+
292
+ ### 7.3 Finite search expectation
293
+
294
+ Programs and selected output goals SHOULD be written so the relevant search space is finite. eyelang includes recursion guards and memoization support, but it is not required to terminate for arbitrary recursive logic programs.
295
+
296
+ ## 8. Logical reading: Herbrand semantics
297
+
298
+ The pure eyelang language is interpreted over the **Herbrand universe** and **Herbrand base**. The Herbrand universe is the first-order universe made only of the ground terms that can be built from the program's atom constants, strings, numbers, list constructors, and compound functors. There are no hidden domain elements: a term denotes itself. For example, the atom constant `pat` denotes the Herbrand constant `pat`, and the number `3` denotes the numeric Herbrand constant written `3`. The Herbrand base is separate from the universe: it contains ground atomic formulas such as `parent(pat, jan)`, whose predicate symbol is `parent/2` and whose arguments are Herbrand terms.
299
+
300
+ An atom constant by itself is not true or false. For example, `pat` is a term, not a proposition. Truth applies to atomic formulas: `person(pat)` may be true or false in a Herbrand interpretation, while `pat` is simply one possible argument term.
301
+
302
+ A **Herbrand interpretation** for a program is a set of ground atomic formulas that are considered true. A source fact such as:
303
+
304
+ ```prolog
305
+ parent(pat, jan).
306
+ ```
307
+
308
+ places the ground atomic formula `parent(pat, jan)` in the interpretation. A rule such as:
309
+
310
+ ```prolog
311
+ ancestor(X, Z) :- parent(X, Y), ancestor(Y, Z).
312
+ ```
313
+
314
+ is read universally over Herbrand terms: for every substitution of `X`, `Y`, and `Z` by ground Herbrand terms, if both ground body atomic formulas are true, then the ground head atomic formula is true. The declarative meaning of a pure program is the **least Herbrand model**: the smallest set of ground atomic formulas that contains all facts and is closed under all rules.
315
+
316
+ Equivalently, the least Herbrand model is obtained by repeatedly applying the immediate-consequence operation: start with the source facts, add every ground rule head whose ground body is already true, and continue to the least fixed point. This definition is mathematical; an implementation does not have to compute the model bottom-up.
317
+
318
+ ### 8.1 Variables and quantification
319
+
320
+ Variables do not range over external objects, records, pointers, or host-language values. In the logical reading, variables range over Herbrand terms. A rule is implicitly universally quantified over its variables. A selected goal is existential in the usual logic-programming sense: eyelang searches for substitutions of its variables by Herbrand terms that make the goal true with respect to the program.
321
+
322
+ ### 8.2 Equality, identity, and unification
323
+
324
+ Because the domain is Herbrand, equality in the pure language is syntactic identity of terms after substitution. Two distinct atom constants are distinct. Two compound terms are equal only when they have the same functor, the same arity, and pairwise equal arguments. Lists follow the same rule through their `[]` and `./2` representation.
325
+
326
+ Operationally, eyelang uses first-order unification to find substitutions. The implementation does not perform an occurs check, so cyclic terms are not part of the portable Herbrand reading even if a particular implementation can temporarily construct recursive bindings internally. Portable programs SHOULD avoid relying on occurs-check-sensitive cases such as `eq(X, f(X))`.
327
+
328
+ ### 8.3 Goal-directed execution versus model-theoretic meaning
329
+
330
+ eyelang's CLI and library evaluator are goal-directed. They try to prove requested goals by resolving them against facts, rules, and built-ins, using clause order, goal order, indexing, memoization, and deterministic built-in execution. This operational strategy is intended to enumerate answers that are true in the least Herbrand model for the pure Horn-clause fragment, but it is not a complete bottom-up model enumerator. Non-terminating recursion or infinite generators can prevent an answer from being found even when the answer belongs to the least Herbrand model.
331
+
332
+ Default CLI output is also a host behavior, not a separate semantics. It asks broad materialization goals, suppresses duplicates, excludes source facts, keeps ground answers, and prints selected consequences. Embedders can still access the goal-directed solver directly through the implementation API.
333
+
334
+ ### 8.4 Built-ins and operational extensions
335
+
336
+ Built-ins are specified relations or operations added to the Herbrand core. A built-in call in a goal has the syntax of an atomic formula, but its success relation is specified procedurally here rather than by source clauses. Some built-ins, such as `eq/2`, `append/3`, `member/2`, and `length/2`, can be understood as relations over Herbrand terms. Others, such as arithmetic, string matching, date/time predicates, aggregation, `once/1`, and negation-as-failure, are operational extensions whose behavior is defined by this specification rather than by pure least-Herbrand-model semantics alone.
337
+
338
+ Arithmetic and string built-ins do not introduce a separate semantic universe. They inspect the lexical values of already represented Herbrand constants and, when they succeed, bind output arguments to eyelang terms such as numbers, strings, or atom constants. For example, `add(2, 3, X)` may bind `X` to the number term `5`; it does not mean that variables range over host-language numbers outside the Herbrand universe.
339
+
340
+ Negation-as-failure `not(Goal)` is especially operational: it succeeds when the current goal-directed search finds no solution for `Goal`. It is not classical negation and should not be read as adding negative facts to the Herbrand model. Programs using negation SHOULD keep the negated goal sufficiently ground and finite.
341
+
342
+ ## 9. Standard built-in predicates
343
+
344
+ This section specifies the **standard built-ins** of the eyelang language. An implementation that claims support for this standard built-in profile MUST implement the predicates in this section with the meanings described here.
345
+
346
+ A built-in call is still written as an atomic formula, but the relation is provided by the host implementation rather than by source clauses. Several built-ins are mode-sensitive: they are intended to run when their input arguments are sufficiently ground, and implementations may leave user-defined clauses visible when that mode is not yet satisfied.
347
+
348
+ Implementations MAY provide additional built-ins, but such built-ins are extensions and are not part of this normative catalog. Extension built-ins are discussed separately in section 10.
349
+
350
+ ### 9.1 Equality and unification
351
+
352
+ | Built-in | Meaning |
353
+ |---|---|
354
+ | `eq(A, B)` | Succeeds when `A` and `B` unify. |
355
+ | `neq(A, B)` | Succeeds when `A` and `B` do not unify. |
356
+
357
+ ### 9.2 Arithmetic
358
+
359
+ | Built-in | Meaning |
360
+ |---|---|
361
+ | `neg(A, B)` | `B` is the numeric negation of `A`. |
362
+ | `abs(A, B)` | `B` is the absolute value of `A`. |
363
+ | `sin(A, B)`, `cos(A, B)`, `asin(A, B)`, `acos(A, B)`, `log(A, B)` | Floating functions. |
364
+ | `rounded(A, B)` | `B` is `A` rounded to the nearest integer. |
365
+ | `add(A, B, C)` | `C = A + B`. |
366
+ | `sub(A, B, C)` | `C = A - B`. |
367
+ | `mul(A, B, C)` | `C = A * B`. |
368
+ | `div(A, B, C)` | `C = A / B`; integer inputs use integer division. |
369
+ | `mod(A, B, C)` | Integer remainder. |
370
+ | `pow(A, B, C)` | `C = A^B`. |
371
+ | `max(A, B, C)`, `min(A, B, C)` | Numeric maximum or minimum. |
372
+
373
+ ### 9.3 Comparison
374
+
375
+ | Built-in | Meaning |
376
+ |---|---|
377
+ | `lt(A, B)` | `A < B`. |
378
+ | `gt(A, B)` | `A > B`. |
379
+ | `le(A, B)` | `A =< B`. |
380
+ | `ge(A, B)` | `A >= B`. |
381
+
382
+ Comparisons interpret numeric-looking terms numerically. Other scalar terms are compared lexically.
383
+
384
+ ### 9.4 Dates and durations
385
+
386
+ | Built-in | Meaning |
387
+ |---|---|
388
+ | `local_time(T)` | Binds `T` to the local date string. For deterministic runs, `EYELANG_LOCAL_TIME=YYYY-MM-DD` overrides the current date. |
389
+ | `difference(A, B, D)` | Computes an ISO-like date/duration difference. |
390
+
391
+ ### 9.5 Generators
392
+
393
+ | Built-in | Meaning |
394
+ |---|---|
395
+ | `between(Low, High, X)` | Enumerates integers from `Low` through `High`. |
396
+ | `smallest_divisor_from(N, Start, D)` | Finds a divisor of `N` starting at `Start`. |
397
+
398
+ ### 9.6 Strings and atom constants
399
+
400
+ | Built-in | Meaning |
401
+ |---|---|
402
+ | `atom_concat(A, B, C)` | Atom-constant concatenation. |
403
+ | `str_concat(A, B, C)` | String concatenation. |
404
+ | `contains(Text, Needle)` | Text contains `Needle`. |
405
+ | `not_contains(Text, Needle)` | Text does not contain `Needle`. |
406
+ | `matches(Text, Pattern)` | Text matches a simple implementation regex/search pattern. |
407
+ | `not_matches(Text, Pattern)` | Negation of `matches/2`. |
408
+
409
+ ### 9.7 Lists
410
+
411
+ | Built-in | Meaning |
412
+ |---|---|
413
+ | `append(A, B, C)` | List append/split relation. |
414
+ | `nth0(Index, List, Value)` | Zero-based list lookup. |
415
+ | `set_nth0(Index, List, Value, Out)` | Functional list update. |
416
+ | `rest(List, Tail)` | Tail of a non-empty list. |
417
+ | `member(X, List)` | Member generator. |
418
+ | `select(X, List, Rest)` | Selects one occurrence. |
419
+ | `not_member(X, List)` | Succeeds when `X` is not a member. |
420
+ | `reverse(A, B)` | Reverses a proper list. |
421
+ | `length(List, N)` | Proper-list length. |
422
+ | `is_list(X)` | Succeeds when `X` is a proper list. |
423
+
424
+ ### 9.8 Aggregation and ordering
425
+
426
+ | Built-in | Meaning |
427
+ |---|---|
428
+ | `findall(Template, Goal, Bag)` | Collects all templates for solutions of `Goal`. |
429
+ | `countall(Goal, Count)` | Counts solutions of `Goal`; empty solution sets produce `0`. |
430
+ | `sumall(Template, Goal, Sum)` | Sums numeric `Template` values over solutions of `Goal`; empty solution sets produce `0`. |
431
+ | `aggregate_min(Key, Template, Goal, BestKey, BestTemplate)` | Selects the solution of `Goal` with the smallest resolved `Key`, returning that key and the corresponding resolved `Template`. Fails when `Goal` has no solutions. |
432
+ | `aggregate_max(Key, Template, Goal, BestKey, BestTemplate)` | Selects the solution of `Goal` with the largest resolved `Key`, returning that key and the corresponding resolved `Template`. Fails when `Goal` has no solutions. |
433
+ | `sort(Input, Output)` | Sorts and deduplicates a proper list. |
434
+
435
+ ### 9.9 Formula terms
436
+
437
+ Formula terms are data representations of atomic formulas and comma conjunctions. `formula_atom/2` uses "atom" in the logic-programming sense of atomic formula; it MUST NOT be confused with atom constants such as `alice` or `name`.
438
+
439
+ | Built-in | Meaning |
440
+ |---|---|
441
+ | `formula_atom(Formula, Atom)` | Enumerates atomic-formula members inside comma formula data. The second argument denotes an atomic formula term, not necessarily an atom constant. |
442
+ | `formula_binary(Formula, S, P, O)` | Enumerates binary formula members `P(S, O)`, exposing the functor as atom constant `P`. |
443
+
444
+ Example:
445
+
446
+ ```prolog
447
+ formula_binary((name(alice, "Alice"), knows(alice, bob)), S, P, O).
448
+ ```
449
+
450
+ This can yield `formula_binary((name(alice, "Alice"), knows(alice, bob)), alice, name, "Alice").` and `formula_binary((name(alice, "Alice"), knows(alice, bob)), alice, knows, bob).`
451
+
452
+ ### 9.10 Search control
453
+
454
+ | Built-in | Meaning |
455
+ |---|---|
456
+ | `not(Goal)` | Negation as failure. Succeeds when `Goal` has no solution. |
457
+ | `once(Goal)` | Succeeds with at most the first solution of `Goal`. |
458
+
459
+ ## 10. Extension built-ins
460
+
461
+ Implementations MAY provide additional built-ins beyond the standard predicates listed above. Such built-ins are **extension built-ins**. They are useful for embedding eyelang in particular host environments, exposing efficient finite-domain solvers, or providing domain-specific relations for examples and applications.
462
+
463
+ Extension built-ins are not required for conformance to this specification. A portable eyelang program SHOULD NOT depend on an extension built-in unless the target implementation explicitly documents that extension.
464
+
465
+ An extension built-in SHOULD obey the same surface-language discipline as standard built-ins:
466
+
467
+ - it is called using ordinary atomic-formula syntax, for example `some_extension(A, B)`;
468
+ - its arguments and results are eyelang terms from the Herbrand universe;
469
+ - it succeeds, fails, and binds variables as a relation over eyelang terms;
470
+ - it SHOULD document its intended modes, especially which arguments must be ground before it runs deterministically;
471
+ - it MUST NOT change the meaning of ordinary facts, rules, unification, or standard built-ins.
472
+
473
+ For example, an implementation may include extension modules for Sudoku solving, portfolio selection, number-theory algorithms, graph search, matrix operations, alphametic puzzles, or a non-normative RDF/Notation3 reader that lowers RDF triples to ordinary eyelang predicates such as `rdf/3` and lowers selected Notation3 built-in predicates to extension built-ins such as `n3_math_sum/2` or `n3_string_contains/2`. Those modules may be valuable and may make example programs much faster, but their predicate names, arities, algorithms, syntax accepted by non-eyelang readers, and modes are implementation-defined unless they are separately standardized.
474
+
475
+ An implementation that provides explanation output SHOULD make extension built-ins explainable at least as opaque successful or failed built-in calls, so that proof traces do not incorrectly report "no clauses" for a host-provided relation.
476
+
477
+ ## 11. Declarations
478
+
479
+ Declarations are written as ordinary facts, but the host treats them specially.
480
+
481
+ ### 11.1 Memoization
482
+
483
+ ```prolog
484
+ memoize(Name, Arity).
485
+ ```
486
+
487
+ `Name` MUST be an atom constant and `Arity` MUST be a non-negative integer. The declaration asks the solver to table answers for the named predicate group when applicable.
488
+
489
+ Example:
490
+
491
+ ```prolog
492
+ memoize(path, 2).
493
+ ```
494
+
495
+ ### 11.2 Default-output materialization
496
+
497
+ ```prolog
498
+ materialize(Name, Arity).
499
+ ```
500
+
501
+ `Name` MUST be an atom constant and `Arity` MUST be a non-negative integer. If a program contains one or more `materialize/2` declarations, default CLI output is restricted to those predicate groups. Source facts are still excluded from printed output.
502
+
503
+ Example:
504
+
505
+ ```prolog
506
+ materialize(status, 2).
507
+ materialize(reason, 2).
508
+ ```
509
+
510
+ `materialize/2` affects host output selection only; it does not change the logical meaning of the program.
511
+
512
+ ## 12. eyelang Sockets
513
+
514
+ A **eyelang Socket** is a declared semantic opening in a eyelang program where facts, rules, tools, datasets, or agents can plug in knowledge through an explicit contract while preserving eyelang-readable reasoning and explanations.
515
+
516
+ The term follows the ordinary socket pattern: a socket defines a place where a matching provider can connect. In eyelang, the matching part is knowledge. A socket identifies what shape of knowledge a program expects; a plug identifies which provider supplies it. This separates reasoning logic from knowledge providers and makes composition boundaries visible as eyelang data.
517
+
518
+ In this specification, sockets are a portable **programming pattern** expressed with ordinary facts. The core solver does not give `socket/2`, `plug/2`, `provides/1`, or `requires/1` special proof-search behavior unless a host explicitly documents such an extension. Because they are ordinary facts, socket declarations remain readable, inspectable, explainable, and safe to ignore by hosts that do not validate them.
519
+
520
+ ### 12.1 Socket vocabulary
521
+
522
+ The minimal socket vocabulary is:
523
+
524
+ ```prolog
525
+ socket(Name, Contract).
526
+ plug(Provider, Name).
527
+ provides(Signature).
528
+ requires(Signature).
529
+ ```
530
+
531
+ `Name` and `Provider` are ordinary eyelang terms, usually atom constants. `Contract` is an ordinary eyelang term that describes the expected or offered knowledge. A portable signature form is:
532
+
533
+ ```prolog
534
+ predicate(PredicateName, Arity)
535
+ ```
536
+
537
+ For example:
538
+
539
+ ```prolog
540
+ socket(family_source, provides(predicate(parent, 2))).
541
+ plug(family_file, family_source).
542
+ ```
543
+
544
+ This says that `family_source` is a named opening for knowledge of the shape `parent/2`, and that `family_file` is the provider plugged into that opening.
545
+
546
+ ### 12.2 Socket example
547
+
548
+ A rule module can declare the knowledge it expects:
549
+
550
+ ```prolog
551
+ materialize(ancestor, 2).
552
+
553
+ socket(family_source, provides(predicate(parent, 2))).
554
+ plug(family_file, family_source).
555
+
556
+ parent(pat, jan).
557
+ parent(jan, emma).
558
+
559
+ ancestor(X, Y) :-
560
+ parent(X, Y).
561
+
562
+ ancestor(X, Z) :-
563
+ parent(X, Y),
564
+ ancestor(Y, Z).
565
+ ```
566
+
567
+ The `ancestor/2` rules do not depend on a particular storage mechanism for `parent/2`. In a small test, the provider may be the same file. In an embedded host, it may be a database adapter, a document extractor, a remote service, or another eyelang module. The socket facts make that boundary explicit without changing the logical meaning of the rules.
568
+
569
+ When eyelang derives `ancestor(pat, emma)`, the answer explanation can still refer to the source clauses that were actually used, for example facts for `parent/2` and rules for `ancestor/2`. The socket facts add an inspectable description of where such knowledge is intended to enter.
570
+
571
+ ### 12.3 Sockets and AI agents
572
+
573
+ eyelang Sockets are especially useful for AI-facing systems. An AI agent can extract or propose candidate claims, but those claims should enter a reasoning program as explicit eyelang facts or rules through a declared socket rather than as opaque text. eyelang can then check the claims against other facts and rules, derive consequences, and optionally return ordinary `why/2` explanations.
574
+
575
+ This gives a clear division of labor: AI can help generate, translate, and connect knowledge; eyelang can represent, check, and explain the reasoning; sockets define the boundary between them.
576
+
577
+ ## 13. Output and read-back profile
578
+
579
+ Normal answer output prints one resolved answer term followed by a period. Strings are double-quoted; atom constants are quoted when needed; lists use list syntax; compound terms use functor notation. Host interfaces MAY provide an option such as `--proof` to add `why/2` explanation facts; this option MUST NOT change the answers found.
580
+
581
+ Output SHOULD be accepted as eyelang input when it contains only supported term syntax. Explanations are ordinary eyelang facts, so answer output can be read back and processed by eyelang.
582
+
583
+ Default host output behavior is:
584
+
585
+ 1. parse all inputs into one program;
586
+ 2. collect source fact lines for duplicate suppression;
587
+ 3. if `materialize/2` declarations exist, solve those predicate groups; otherwise solve all binary predicate groups with at least one rule;
588
+ 4. keep only ground answers;
589
+ 5. remove answers identical to source facts;
590
+ 6. suppress duplicates;
591
+ 7. print each answer, followed by its `why/2` explanation only if the host interface was explicitly asked to emit proof output.
592
+
593
+ ### 13.1 Explanation output
594
+
595
+ When proof output is enabled, each answer SHOULD be followed by a machine-readable `why/2` fact. Explanation output is ordinary eyelang syntax whose second argument is a nested abstract proof term such as `proof(goal(G), by(Method), bindings(Bindings), uses(Proofs))`; implementations SHOULD print `goal(...)` and `by(...)` on separate lines for readability. A proof term preserves the answer goal, derivation method, relevant bindings, and nested uses while omitting proof IDs. User clauses SHOULD be referenced explicitly as `fact(Filename, clause(N))` or `rule(Filename, clause(N))`, where `N` is the 1-based clause number within that source. Built-ins SHOULD be referenced as `builtin(Name, Arity)` because they do not come from source clauses. Explanation output is outside the logical semantics of the input program and MUST NOT change the set of answers.
596
+
597
+ ## 14. Conformance profiles
598
+
599
+ ### 14.1 Core language profile
600
+
601
+ A conforming core language implementation supports:
602
+
603
+ - lexical syntax described above;
604
+ - facts and definite clauses;
605
+ - first-order unification without occurs check;
606
+ - left-to-right goal-directed proof search;
607
+ - lists and comma conjunctions;
608
+ - answer printing.
609
+
610
+ ### 14.2 Standard built-in profile
611
+
612
+ A conforming standard built-in implementation supports the built-ins listed in section 9. These are the portable built-ins independent implementations should implement when they claim standard built-in compatibility.
613
+
614
+ ### 14.3 Standard host profile
615
+
616
+ A conforming standard host also supports:
617
+
618
+ - `memoize/2` declarations;
619
+ - `materialize/2` declarations;
620
+ - default derived output;
621
+ - explanation output;
622
+ - stdin, file, and URL inputs in the CLI.
623
+
624
+ Browser execution, package layout, and any extension built-ins described in implementation documentation are outside this specification unless separately standardized.
625
+
626
+
627
+ Conformance cases for these profiles live in the repository under `conformance/`. They are run by `npm test` before the example suite, and can be run alone with `npm run test:conformance`. The cases use exact expected standard output files so independent implementations can compare behavior case by case.
628
+
629
+ ## 15. Relationship to ISO Prolog
630
+
631
+ eyelang borrows familiar Prolog syntax and Horn-clause execution but is not ISO Prolog. Notable differences include:
632
+
633
+ - no operators or operator declarations;
634
+ - no cut;
635
+ - no modules;
636
+ - no dynamic database update;
637
+ - no DCGs;
638
+ - no full ISO term ordering or standard library;
639
+ - no variables in functor or predicate position;
640
+ - no occurs check in unification.
641
+
642
+ Programs intended to be portable to eyelang SHOULD avoid ISO-specific syntax and keep terms explicit.
643
+
644
+ ## 16. Examples
645
+
646
+ ### 16.1 Transitive closure
647
+
648
+ ```prolog
649
+ parent(pat, jan).
650
+ parent(jan, emma).
651
+
652
+ ancestor(X, Y) :- parent(X, Y).
653
+ ancestor(X, Z) :- parent(X, Y), ancestor(Y, Z).
654
+ ```
655
+
656
+ ### 16.2 Arithmetic
657
+
658
+ ```prolog
659
+ square(X, Y) :- mul(X, X, Y).
660
+ answer(three, Y) :- square(3, Y).
661
+ ```
662
+
663
+ ### 16.3 Lists
664
+
665
+ ```prolog
666
+ first([X | _Rest], X).
667
+ answer(example, X) :- first([a, b, c], X).
668
+ ```
669
+
670
+ ### 16.4 Negation as failure
671
+
672
+ ```prolog
673
+ closed(b).
674
+ open(X) :- not(closed(X)).
675
+ status(a, open) :- open(a).
676
+ ```
677
+
678
+ ## 17. Security and portability considerations
679
+
680
+ URL input uses host networking support when available. Hosts SHOULD treat downloaded programs as untrusted code because they can trigger expensive search.
681
+
682
+ Programs SHOULD be written with finite search in mind. Broad default materialization can be expensive for helper predicates; use `materialize/2` declarations and concise output predicates when needed.
683
+
684
+ Compatibility readers for external syntaxes such as RDF 1.2 Turtle, N-Triples, or Notation3 SHOULD be treated as front-end translations into eyelang clauses. Such readers may support N3 implication syntaxes such as `=>` and `<=`, empty `true` rule bodies, N3 equality as `owl:sameAs`, and common N3/SWAP built-in namespaces mapped to host extension built-ins, including exact integer arithmetic where the host provides it. Unless a host explicitly claims a separate RDF or N3 conformance profile, such readers are not part of core eyelang conformance and may accept only the subset that maps cleanly to finite Horn-clause reasoning.