eyelang 1.3.8 → 1.4.0

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 (219) hide show
  1. package/README.md +19 -14
  2. package/SPEC.md +4 -4
  3. package/conformance/expected/core/001_fact_query.out +0 -8
  4. package/conformance/expected/core/002_rule_recursion.out +0 -41
  5. package/conformance/expected/core/003_terms_and_readback.out +0 -104
  6. package/conformance/expected/core/004_conjunction_and_parentheses.out +0 -25
  7. package/conformance/expected/core/005_list_deconstruction.out +0 -32
  8. package/conformance/expected/core/006_comma_formula_data.out +0 -15
  9. package/conformance/expected/core/007_anonymous_variables.out +0 -19
  10. package/conformance/expected/core/008_graphic_atoms.out +0 -24
  11. package/conformance/expected/core/009_comments_and_whitespace.out +0 -30
  12. package/conformance/expected/core/010_variable_scope_and_reuse.out +0 -52
  13. package/conformance/expected/core/011_predicate_arity.out +0 -30
  14. package/conformance/expected/core/012_nested_compound_unification.out +0 -30
  15. package/conformance/expected/core/013_multiple_clauses_order.out +0 -44
  16. package/conformance/expected/core/014_failure_filters_answers.out +0 -19
  17. package/conformance/expected/core/015_improper_list_unification.out +0 -45
  18. package/conformance/expected/core/016_zero_arity_compound.out +0 -15
  19. package/conformance/expected/core/017_three_step_recursion.out +0 -99
  20. package/conformance/expected/core/018_quoted_atom_readback.out +0 -45
  21. package/conformance/expected/core/019_parenthesized_three_conjuncts.out +0 -36
  22. package/conformance/expected/core/020_nested_list_terms.out +0 -30
  23. package/conformance/expected/extension/001_default_derived_output.out +0 -56
  24. package/conformance/expected/extension/002_materialize_focus.out +0 -22
  25. package/conformance/expected/extension/003_arithmetic_and_comparison.out +0 -148
  26. package/conformance/expected/extension/004_strings_and_atoms.out +0 -58
  27. package/conformance/expected/extension/005_lists_aggregation_ordering.out +0 -135
  28. package/conformance/expected/extension/006_formula_terms.out +0 -76
  29. package/conformance/expected/extension/007_negation_once_generators.out +0 -40
  30. package/conformance/expected/extension/008_equality_and_inequality.out +0 -58
  31. package/conformance/expected/extension/009_list_relations.out +0 -73
  32. package/conformance/expected/extension/010_append_splits.out +0 -45
  33. package/conformance/expected/extension/011_matching_and_comparison.out +0 -70
  34. package/conformance/expected/extension/012_memoize_declaration.out +0 -41
  35. package/conformance/expected/extension/013_numeric_functions.out +0 -105
  36. package/conformance/expected/extension/014_between_enumeration.out +0 -45
  37. package/conformance/expected/extension/015_smallest_divisor.out +0 -15
  38. package/conformance/expected/extension/016_negation_filter.out +0 -38
  39. package/conformance/expected/extension/017_once_user_predicate.out +0 -21
  40. package/conformance/expected/extension/018_findall_user_goal.out +0 -15
  41. package/conformance/expected/extension/019_sort_deduplicates_atoms.out +0 -15
  42. package/conformance/expected/extension/020_append_bound_prefix_suffix.out +0 -30
  43. package/conformance/expected/extension/021_nth0_index_generation.out +0 -15
  44. package/conformance/expected/extension/022_set_nth0_edges.out +0 -30
  45. package/conformance/expected/extension/023_select_duplicate_occurrences.out +0 -30
  46. package/conformance/expected/extension/024_not_member_filter.out +0 -19
  47. package/conformance/expected/extension/025_is_list_filter.out +0 -19
  48. package/conformance/expected/extension/026_nested_formula_terms.out +0 -114
  49. package/conformance/expected/extension/027_materialize_excludes_source_fact.out +0 -14
  50. package/conformance/expected/extension/028_numeric_and_lexical_comparison.out +0 -42
  51. package/conformance/expected/extension/029_string_matching_filters.out +0 -38
  52. package/conformance/expected/extension/030_string_and_atom_concat.out +0 -30
  53. package/conformance/expected/extension/031_countall_empty_and_nonempty.out +0 -18
  54. package/conformance/expected/extension/032_sumall_numeric_template.out +0 -8
  55. package/conformance/expected/extension/033_aggregate_min_template.out +0 -8
  56. package/conformance/expected/extension/034_aggregate_max_compound_key.out +0 -8
  57. package/examples/output/access-control-policy.pl +0 -156
  58. package/examples/output/ackermann.pl +0 -1240
  59. package/examples/output/age.pl +0 -69
  60. package/examples/output/aliases-and-namespaces.pl +0 -73
  61. package/examples/output/alignment-demo.pl +0 -862
  62. package/examples/output/allen-interval-calculus.pl +0 -9169
  63. package/examples/output/ancestor.pl +0 -134
  64. package/examples/output/animal.pl +0 -64
  65. package/examples/output/annotation.pl +0 -76
  66. package/examples/output/backward.pl +0 -21
  67. package/examples/output/basic-monadic.pl +0 -22770
  68. package/examples/output/bayes-diagnosis.pl +0 -195
  69. package/examples/output/bayes-therapy.pl +0 -34873
  70. package/examples/output/beam-deflection.pl +0 -222
  71. package/examples/output/blocks-world-planning.pl +0 -1339
  72. package/examples/output/bmi.pl +0 -1903
  73. package/examples/output/braking-safety-worlds.pl +0 -2452
  74. package/examples/output/buck-converter-design.pl +0 -663
  75. package/examples/output/cache-performance.pl +0 -306
  76. package/examples/output/canary-release.pl +0 -167
  77. package/examples/output/cat-koko.pl +0 -83
  78. package/examples/output/clinical-trial-screening.pl +0 -380
  79. package/examples/output/collatz-1000.pl +0 -19000
  80. package/examples/output/combinatorics-findall-sort.pl +0 -56
  81. package/examples/output/competitive-enzyme-kinetics.pl +0 -563
  82. package/examples/output/complex-matrix-stability.pl +0 -250
  83. package/examples/output/complex.pl +0 -653
  84. package/examples/output/composition-of-injective-functions-is-injective.pl +0 -256
  85. package/examples/output/context-association.pl +0 -75
  86. package/examples/output/control-system.pl +0 -328
  87. package/examples/output/cryptarithmetic-send-more-money.pl +0 -168
  88. package/examples/output/cyclic-path.pl +0 -504
  89. package/examples/output/d3-group.pl +0 -56
  90. package/examples/output/dairy-energy-balance.pl +0 -1034
  91. package/examples/output/data-negotiation.pl +0 -75
  92. package/examples/output/deep-taxonomy-10.pl +0 -1235
  93. package/examples/output/deep-taxonomy-100.pl +0 -1235
  94. package/examples/output/deep-taxonomy-1000.pl +0 -1235
  95. package/examples/output/deep-taxonomy-10000.pl +0 -2915
  96. package/examples/output/deep-taxonomy-100000.pl +0 -20240
  97. package/examples/output/delfour.pl +0 -2829
  98. package/examples/output/dense-hamiltonian-cycle.pl +0 -207
  99. package/examples/output/deontic-logic.pl +0 -105
  100. package/examples/output/derived-rule.pl +0 -41
  101. package/examples/output/diamond-property.pl +0 -303
  102. package/examples/output/dijkstra-findall-sort.pl +0 -484
  103. package/examples/output/dijkstra-risk-path.pl +0 -4841
  104. package/examples/output/dijkstra.pl +0 -1336
  105. package/examples/output/dining-philosophers.pl +0 -21646
  106. package/examples/output/dog.pl +0 -30
  107. package/examples/output/drone-corridor-planner.pl +0 -2466
  108. package/examples/output/easter-computus.pl +0 -5690
  109. package/examples/output/electrical-rc-filter.pl +0 -102
  110. package/examples/output/epidemic-policy.pl +0 -760
  111. package/examples/output/equivalence-classes-overlap-implies-same-class.pl +0 -1080
  112. package/examples/output/eulerian-path.pl +0 -383
  113. package/examples/output/ev-range-worlds.pl +0 -2294
  114. package/examples/output/exact-cover-sudoku.pl +0 -396
  115. package/examples/output/existential-rule.pl +0 -38
  116. package/examples/output/exoplanet-validation-worlds.pl +0 -1904
  117. package/examples/output/expression-eval.pl +0 -104
  118. package/examples/output/family-cousins.pl +0 -3852
  119. package/examples/output/fastpow.pl +0 -1064
  120. package/examples/output/fft8-numeric.pl +0 -2556
  121. package/examples/output/fibonacci.pl +0 -2060
  122. package/examples/output/field-nitrogen-balance.pl +0 -1452
  123. package/examples/output/floating-point.pl +0 -151
  124. package/examples/output/four-color-map.pl +0 -191
  125. package/examples/output/fundamental-theorem-arithmetic.pl +0 -1610
  126. package/examples/output/gcd-bezout-identity.pl +0 -1842
  127. package/examples/output/gd-step-certified.pl +0 -32354
  128. package/examples/output/gdpr-compliance.pl +0 -193
  129. package/examples/output/goldbach-1000.pl +0 -17490
  130. package/examples/output/good-cobbler.pl +0 -15
  131. package/examples/output/gps.pl +0 -4166
  132. package/examples/output/graph-reachability.pl +0 -148
  133. package/examples/output/gray-code-counter.pl +0 -835
  134. package/examples/output/greatest-lower-bound-uniqueness.pl +0 -148
  135. package/examples/output/group-inverse-uniqueness.pl +0 -82
  136. package/examples/output/hamiltonian-cycle.pl +0 -102
  137. package/examples/output/hamiltonian-path.pl +0 -14157
  138. package/examples/output/hamming-code.pl +0 -2665
  139. package/examples/output/hanoi.pl +0 -184
  140. package/examples/output/heat-loss.pl +0 -223
  141. package/examples/output/heron-theorem.pl +0 -253
  142. package/examples/output/ideal-gas-law.pl +0 -148
  143. package/examples/output/illegitimate-reasoning.pl +0 -530
  144. package/examples/output/kaprekar.pl +0 -208
  145. package/examples/output/law-of-cosines.pl +0 -165
  146. package/examples/output/least-squares-regression.pl +0 -1447
  147. package/examples/output/list-collection.pl +0 -49
  148. package/examples/output/lldm.pl +0 -17298
  149. package/examples/output/manufacturing-quality-control.pl +0 -562
  150. package/examples/output/matrix.pl +0 -206
  151. package/examples/output/microgrid-dispatch.pl +0 -787
  152. package/examples/output/monkey-bananas.pl +0 -575
  153. package/examples/output/n-queens.pl +0 -2046
  154. package/examples/output/network-sla.pl +0 -282
  155. package/examples/output/newton-raphson.pl +0 -756
  156. package/examples/output/nixon-diamond.pl +0 -176
  157. package/examples/output/odrl-dpv-healthcare-risk-ranked.pl +0 -6148
  158. package/examples/output/odrl-dpv-risk-ranked.pl +0 -12961
  159. package/examples/output/orbital-transfer-design.pl +0 -961
  160. package/examples/output/path-discovery.pl +0 -333
  161. package/examples/output/peano-arithmetic.pl +0 -1432
  162. package/examples/output/peasant.pl +0 -190
  163. package/examples/output/pendulum-period.pl +0 -271
  164. package/examples/output/polynomial.pl +0 -7952
  165. package/examples/output/project-portfolio-optimization.pl +0 -93
  166. package/examples/output/proof-contrapositive.pl +0 -75
  167. package/examples/output/quadratic-formula.pl +0 -454
  168. package/examples/output/quine-mccluskey.pl +0 -188
  169. package/examples/output/radioactive-decay.pl +0 -299
  170. package/examples/output/sat-dpll.pl +0 -121
  171. package/examples/output/security-incident-correlation.pl +0 -267
  172. package/examples/output/service-impact.pl +0 -457
  173. package/examples/output/sieve.pl +0 -19
  174. package/examples/output/skolem-functions.pl +0 -264
  175. package/examples/output/socket-age.pl +0 -31
  176. package/examples/output/socket-family.pl +0 -56
  177. package/examples/output/socrates.pl +0 -36
  178. package/examples/output/statistics-summary.pl +0 -741
  179. package/examples/output/sudoku.pl +0 -38
  180. package/examples/output/superdense-coding.pl +0 -476
  181. package/examples/output/traveling-salesman.pl +0 -284
  182. package/examples/output/turing.pl +0 -2144
  183. package/examples/output/vector-similarity.pl +0 -421
  184. package/examples/output/witch.pl +0 -209
  185. package/examples/output/wolf-goat-cabbage.pl +0 -900
  186. package/examples/output/zebra.pl +0 -401
  187. package/examples/proof/age.pl +71 -0
  188. package/examples/proof/aliases-and-namespaces.pl +78 -0
  189. package/examples/proof/ancestor.pl +140 -0
  190. package/examples/proof/animal.pl +68 -0
  191. package/examples/proof/annotation.pl +80 -0
  192. package/examples/proof/backward.pl +22 -0
  193. package/examples/proof/cat-koko.pl +86 -0
  194. package/examples/proof/data-negotiation.pl +76 -0
  195. package/examples/proof/derived-rule.pl +43 -0
  196. package/examples/proof/dog.pl +31 -0
  197. package/examples/proof/electrical-rc-filter.pl +105 -0
  198. package/examples/proof/existential-rule.pl +40 -0
  199. package/examples/proof/floating-point.pl +160 -0
  200. package/examples/proof/good-cobbler.pl +16 -0
  201. package/examples/proof/group-inverse-uniqueness.pl +84 -0
  202. package/examples/proof/list-collection.pl +52 -0
  203. package/examples/proof/proof-contrapositive.pl +78 -0
  204. package/examples/proof/socket-age.pl +32 -0
  205. package/examples/proof/socket-family.pl +59 -0
  206. package/examples/proof/socrates.pl +38 -0
  207. package/examples/socket-age.pl +4 -4
  208. package/examples/socket-family.pl +4 -4
  209. package/package.json +1 -1
  210. package/playground-worker.mjs +4 -4
  211. package/playground.html +15 -15
  212. package/src/cli.js +10 -10
  213. package/src/index.js +3 -2
  214. package/src/parser.js +130 -1
  215. package/src/program.js +33 -27
  216. package/test/run-all.js +0 -0
  217. package/test/run-conformance.js +0 -0
  218. package/test/run-examples.js +38 -8
  219. package/test/run-regression.js +29 -28
@@ -1,425 +1,4 @@
1
1
  dotProduct(pair1, 12.0).
2
- why(
3
- dotProduct(pair1, 12.0),
4
- proof(
5
- goal(dotProduct(pair1, 12.0)),
6
- by(rule("vector-similarity.pl", clause(13))),
7
- bindings([binding("Case", pair1), binding("Dot", 12.0), binding("A", [1.0, 2.0, 3.0]), binding("B", [4.0, -5.0, 6.0])]),
8
- uses([
9
- proof(
10
- goal(vector(pair1, a, [1.0, 2.0, 3.0])),
11
- by(fact("vector-similarity.pl", clause(5)))
12
- ),
13
- proof(
14
- goal(vector(pair1, b, [4.0, -5.0, 6.0])),
15
- by(fact("vector-similarity.pl", clause(6)))
16
- ),
17
- proof(
18
- goal(dot([1.0, 2.0, 3.0], [4.0, -5.0, 6.0], 12.0)),
19
- by(rule("vector-similarity.pl", clause(8))),
20
- bindings([binding("A", 1.0), binding("As", [2.0, 3.0]), binding("B", 4.0), binding("Bs", [-5.0, 6.0]), binding("Dot", 12.0), binding("Product", 4.0), binding("Rest", 8.0)]),
21
- uses([
22
- proof(
23
- goal(mul(1.0, 4.0, 4.0)),
24
- by(builtin(mul, 3))
25
- ),
26
- proof(
27
- goal(dot([2.0, 3.0], [-5.0, 6.0], 8.0)),
28
- by(rule("vector-similarity.pl", clause(8))),
29
- bindings([binding("A", 2.0), binding("As", [3.0]), binding("B", -5.0), binding("Bs", [6.0]), binding("Dot", 8.0), binding("Product", -10.0), binding("Rest", 18.0)]),
30
- uses([
31
- proof(
32
- goal(mul(2.0, -5.0, -10.0)),
33
- by(builtin(mul, 3))
34
- ),
35
- proof(
36
- goal(dot([3.0], [6.0], 18.0)),
37
- by(rule("vector-similarity.pl", clause(8))),
38
- bindings([binding("A", 3.0), binding("As", []), binding("B", 6.0), binding("Bs", []), binding("Dot", 18.0), binding("Product", 18.0), binding("Rest", 0.0)]),
39
- uses([
40
- proof(
41
- goal(mul(3.0, 6.0, 18.0)),
42
- by(builtin(mul, 3))
43
- ),
44
- proof(
45
- goal(dot([], [], 0.0)),
46
- by(fact("vector-similarity.pl", clause(7)))
47
- ),
48
- proof(
49
- goal(add(18.0, 0.0, 18.0)),
50
- by(builtin(add, 3))
51
- )
52
- ])
53
- ),
54
- proof(
55
- goal(add(-10.0, 18.0, 8.0)),
56
- by(builtin(add, 3))
57
- )
58
- ])
59
- ),
60
- proof(
61
- goal(add(4.0, 8.0, 12.0)),
62
- by(builtin(add, 3))
63
- )
64
- ])
65
- )
66
- ])
67
- )
68
- ).
69
-
70
2
  normA(pair1, 3.7416573867739413).
71
- why(
72
- normA(pair1, 3.7416573867739413),
73
- proof(
74
- goal(normA(pair1, 3.7416573867739413)),
75
- by(rule("vector-similarity.pl", clause(14))),
76
- bindings([binding("Case", pair1), binding("NormA", 3.7416573867739413), binding("A", [1.0, 2.0, 3.0])]),
77
- uses([
78
- proof(
79
- goal(vector(pair1, a, [1.0, 2.0, 3.0])),
80
- by(fact("vector-similarity.pl", clause(5)))
81
- ),
82
- proof(
83
- goal(norm([1.0, 2.0, 3.0], 3.7416573867739413)),
84
- by(rule("vector-similarity.pl", clause(11))),
85
- bindings([binding("Vector", [1.0, 2.0, 3.0]), binding("Norm", 3.7416573867739413), binding("SumSquares", 14.0)]),
86
- uses([
87
- proof(
88
- goal(sum_squares([1.0, 2.0, 3.0], 14.0)),
89
- by(rule("vector-similarity.pl", clause(10))),
90
- bindings([binding("X", 1.0), binding("Xs", [2.0, 3.0]), binding("Total", 14.0), binding("Squared", 1.0), binding("Rest", 13.0)]),
91
- uses([
92
- proof(
93
- goal(pow(1.0, 2.0, 1.0)),
94
- by(builtin(pow, 3))
95
- ),
96
- proof(
97
- goal(sum_squares([2.0, 3.0], 13.0)),
98
- by(rule("vector-similarity.pl", clause(10))),
99
- bindings([binding("X", 2.0), binding("Xs", [3.0]), binding("Total", 13.0), binding("Squared", 4.0), binding("Rest", 9.0)]),
100
- uses([
101
- proof(
102
- goal(pow(2.0, 2.0, 4.0)),
103
- by(builtin(pow, 3))
104
- ),
105
- proof(
106
- goal(sum_squares([3.0], 9.0)),
107
- by(rule("vector-similarity.pl", clause(10))),
108
- bindings([binding("X", 3.0), binding("Xs", []), binding("Total", 9.0), binding("Squared", 9.0), binding("Rest", 0.0)]),
109
- uses([
110
- proof(
111
- goal(pow(3.0, 2.0, 9.0)),
112
- by(builtin(pow, 3))
113
- ),
114
- proof(
115
- goal(sum_squares([], 0.0)),
116
- by(fact("vector-similarity.pl", clause(9)))
117
- ),
118
- proof(
119
- goal(add(9.0, 0.0, 9.0)),
120
- by(builtin(add, 3))
121
- )
122
- ])
123
- ),
124
- proof(
125
- goal(add(4.0, 9.0, 13.0)),
126
- by(builtin(add, 3))
127
- )
128
- ])
129
- ),
130
- proof(
131
- goal(add(1.0, 13.0, 14.0)),
132
- by(builtin(add, 3))
133
- )
134
- ])
135
- ),
136
- proof(
137
- goal(pow(14.0, 0.5, 3.7416573867739413)),
138
- by(builtin(pow, 3))
139
- )
140
- ])
141
- )
142
- ])
143
- )
144
- ).
145
-
146
3
  normB(pair1, 8.7749643873921226).
147
- why(
148
- normB(pair1, 8.7749643873921226),
149
- proof(
150
- goal(normB(pair1, 8.7749643873921226)),
151
- by(rule("vector-similarity.pl", clause(15))),
152
- bindings([binding("Case", pair1), binding("NormB", 8.7749643873921226), binding("B", [4.0, -5.0, 6.0])]),
153
- uses([
154
- proof(
155
- goal(vector(pair1, b, [4.0, -5.0, 6.0])),
156
- by(fact("vector-similarity.pl", clause(6)))
157
- ),
158
- proof(
159
- goal(norm([4.0, -5.0, 6.0], 8.7749643873921226)),
160
- by(rule("vector-similarity.pl", clause(11))),
161
- bindings([binding("Vector", [4.0, -5.0, 6.0]), binding("Norm", 8.7749643873921226), binding("SumSquares", 77.0)]),
162
- uses([
163
- proof(
164
- goal(sum_squares([4.0, -5.0, 6.0], 77.0)),
165
- by(rule("vector-similarity.pl", clause(10))),
166
- bindings([binding("X", 4.0), binding("Xs", [-5.0, 6.0]), binding("Total", 77.0), binding("Squared", 16.0), binding("Rest", 61.0)]),
167
- uses([
168
- proof(
169
- goal(pow(4.0, 2.0, 16.0)),
170
- by(builtin(pow, 3))
171
- ),
172
- proof(
173
- goal(sum_squares([-5.0, 6.0], 61.0)),
174
- by(rule("vector-similarity.pl", clause(10))),
175
- bindings([binding("X", -5.0), binding("Xs", [6.0]), binding("Total", 61.0), binding("Squared", 25.0), binding("Rest", 36.0)]),
176
- uses([
177
- proof(
178
- goal(pow(-5.0, 2.0, 25.0)),
179
- by(builtin(pow, 3))
180
- ),
181
- proof(
182
- goal(sum_squares([6.0], 36.0)),
183
- by(rule("vector-similarity.pl", clause(10))),
184
- bindings([binding("X", 6.0), binding("Xs", []), binding("Total", 36.0), binding("Squared", 36.0), binding("Rest", 0.0)]),
185
- uses([
186
- proof(
187
- goal(pow(6.0, 2.0, 36.0)),
188
- by(builtin(pow, 3))
189
- ),
190
- proof(
191
- goal(sum_squares([], 0.0)),
192
- by(fact("vector-similarity.pl", clause(9)))
193
- ),
194
- proof(
195
- goal(add(36.0, 0.0, 36.0)),
196
- by(builtin(add, 3))
197
- )
198
- ])
199
- ),
200
- proof(
201
- goal(add(25.0, 36.0, 61.0)),
202
- by(builtin(add, 3))
203
- )
204
- ])
205
- ),
206
- proof(
207
- goal(add(16.0, 61.0, 77.0)),
208
- by(builtin(add, 3))
209
- )
210
- ])
211
- ),
212
- proof(
213
- goal(pow(77.0, 0.5, 8.7749643873921226)),
214
- by(builtin(pow, 3))
215
- )
216
- ])
217
- )
218
- ])
219
- )
220
- ).
221
-
222
4
  cosineSimilarity(pair1, 0.36548694232390361).
223
- why(
224
- cosineSimilarity(pair1, 0.36548694232390361),
225
- proof(
226
- goal(cosineSimilarity(pair1, 0.36548694232390361)),
227
- by(rule("vector-similarity.pl", clause(16))),
228
- bindings([binding("Case", pair1), binding("Similarity", 0.36548694232390361)]),
229
- uses([
230
- proof(
231
- goal(cosine_similarity(pair1, 0.36548694232390361)),
232
- by(rule("vector-similarity.pl", clause(12))),
233
- bindings([binding("Case", pair1), binding("Similarity", 0.36548694232390361), binding("A", [1.0, 2.0, 3.0]), binding("B", [4.0, -5.0, 6.0]), binding("Dot", 12.0), binding("NormA", 3.7416573867739413), binding("NormB", 8.7749643873921226), binding("Denominator", 32.832910318764007)]),
234
- uses([
235
- proof(
236
- goal(vector(pair1, a, [1.0, 2.0, 3.0])),
237
- by(fact("vector-similarity.pl", clause(5)))
238
- ),
239
- proof(
240
- goal(vector(pair1, b, [4.0, -5.0, 6.0])),
241
- by(fact("vector-similarity.pl", clause(6)))
242
- ),
243
- proof(
244
- goal(dot([1.0, 2.0, 3.0], [4.0, -5.0, 6.0], 12.0)),
245
- by(rule("vector-similarity.pl", clause(8))),
246
- bindings([binding("A", 1.0), binding("As", [2.0, 3.0]), binding("B", 4.0), binding("Bs", [-5.0, 6.0]), binding("Dot", 12.0), binding("Product", 4.0), binding("Rest", 8.0)]),
247
- uses([
248
- proof(
249
- goal(mul(1.0, 4.0, 4.0)),
250
- by(builtin(mul, 3))
251
- ),
252
- proof(
253
- goal(dot([2.0, 3.0], [-5.0, 6.0], 8.0)),
254
- by(rule("vector-similarity.pl", clause(8))),
255
- bindings([binding("A", 2.0), binding("As", [3.0]), binding("B", -5.0), binding("Bs", [6.0]), binding("Dot", 8.0), binding("Product", -10.0), binding("Rest", 18.0)]),
256
- uses([
257
- proof(
258
- goal(mul(2.0, -5.0, -10.0)),
259
- by(builtin(mul, 3))
260
- ),
261
- proof(
262
- goal(dot([3.0], [6.0], 18.0)),
263
- by(rule("vector-similarity.pl", clause(8))),
264
- bindings([binding("A", 3.0), binding("As", []), binding("B", 6.0), binding("Bs", []), binding("Dot", 18.0), binding("Product", 18.0), binding("Rest", 0.0)]),
265
- uses([
266
- proof(
267
- goal(mul(3.0, 6.0, 18.0)),
268
- by(builtin(mul, 3))
269
- ),
270
- proof(
271
- goal(dot([], [], 0.0)),
272
- by(fact("vector-similarity.pl", clause(7)))
273
- ),
274
- proof(
275
- goal(add(18.0, 0.0, 18.0)),
276
- by(builtin(add, 3))
277
- )
278
- ])
279
- ),
280
- proof(
281
- goal(add(-10.0, 18.0, 8.0)),
282
- by(builtin(add, 3))
283
- )
284
- ])
285
- ),
286
- proof(
287
- goal(add(4.0, 8.0, 12.0)),
288
- by(builtin(add, 3))
289
- )
290
- ])
291
- ),
292
- proof(
293
- goal(norm([1.0, 2.0, 3.0], 3.7416573867739413)),
294
- by(rule("vector-similarity.pl", clause(11))),
295
- bindings([binding("Vector", [1.0, 2.0, 3.0]), binding("Norm", 3.7416573867739413), binding("SumSquares", 14.0)]),
296
- uses([
297
- proof(
298
- goal(sum_squares([1.0, 2.0, 3.0], 14.0)),
299
- by(rule("vector-similarity.pl", clause(10))),
300
- bindings([binding("X", 1.0), binding("Xs", [2.0, 3.0]), binding("Total", 14.0), binding("Squared", 1.0), binding("Rest", 13.0)]),
301
- uses([
302
- proof(
303
- goal(pow(1.0, 2.0, 1.0)),
304
- by(builtin(pow, 3))
305
- ),
306
- proof(
307
- goal(sum_squares([2.0, 3.0], 13.0)),
308
- by(rule("vector-similarity.pl", clause(10))),
309
- bindings([binding("X", 2.0), binding("Xs", [3.0]), binding("Total", 13.0), binding("Squared", 4.0), binding("Rest", 9.0)]),
310
- uses([
311
- proof(
312
- goal(pow(2.0, 2.0, 4.0)),
313
- by(builtin(pow, 3))
314
- ),
315
- proof(
316
- goal(sum_squares([3.0], 9.0)),
317
- by(rule("vector-similarity.pl", clause(10))),
318
- bindings([binding("X", 3.0), binding("Xs", []), binding("Total", 9.0), binding("Squared", 9.0), binding("Rest", 0.0)]),
319
- uses([
320
- proof(
321
- goal(pow(3.0, 2.0, 9.0)),
322
- by(builtin(pow, 3))
323
- ),
324
- proof(
325
- goal(sum_squares([], 0.0)),
326
- by(fact("vector-similarity.pl", clause(9)))
327
- ),
328
- proof(
329
- goal(add(9.0, 0.0, 9.0)),
330
- by(builtin(add, 3))
331
- )
332
- ])
333
- ),
334
- proof(
335
- goal(add(4.0, 9.0, 13.0)),
336
- by(builtin(add, 3))
337
- )
338
- ])
339
- ),
340
- proof(
341
- goal(add(1.0, 13.0, 14.0)),
342
- by(builtin(add, 3))
343
- )
344
- ])
345
- ),
346
- proof(
347
- goal(pow(14.0, 0.5, 3.7416573867739413)),
348
- by(builtin(pow, 3))
349
- )
350
- ])
351
- ),
352
- proof(
353
- goal(norm([4.0, -5.0, 6.0], 8.7749643873921226)),
354
- by(rule("vector-similarity.pl", clause(11))),
355
- bindings([binding("Vector", [4.0, -5.0, 6.0]), binding("Norm", 8.7749643873921226), binding("SumSquares", 77.0)]),
356
- uses([
357
- proof(
358
- goal(sum_squares([4.0, -5.0, 6.0], 77.0)),
359
- by(rule("vector-similarity.pl", clause(10))),
360
- bindings([binding("X", 4.0), binding("Xs", [-5.0, 6.0]), binding("Total", 77.0), binding("Squared", 16.0), binding("Rest", 61.0)]),
361
- uses([
362
- proof(
363
- goal(pow(4.0, 2.0, 16.0)),
364
- by(builtin(pow, 3))
365
- ),
366
- proof(
367
- goal(sum_squares([-5.0, 6.0], 61.0)),
368
- by(rule("vector-similarity.pl", clause(10))),
369
- bindings([binding("X", -5.0), binding("Xs", [6.0]), binding("Total", 61.0), binding("Squared", 25.0), binding("Rest", 36.0)]),
370
- uses([
371
- proof(
372
- goal(pow(-5.0, 2.0, 25.0)),
373
- by(builtin(pow, 3))
374
- ),
375
- proof(
376
- goal(sum_squares([6.0], 36.0)),
377
- by(rule("vector-similarity.pl", clause(10))),
378
- bindings([binding("X", 6.0), binding("Xs", []), binding("Total", 36.0), binding("Squared", 36.0), binding("Rest", 0.0)]),
379
- uses([
380
- proof(
381
- goal(pow(6.0, 2.0, 36.0)),
382
- by(builtin(pow, 3))
383
- ),
384
- proof(
385
- goal(sum_squares([], 0.0)),
386
- by(fact("vector-similarity.pl", clause(9)))
387
- ),
388
- proof(
389
- goal(add(36.0, 0.0, 36.0)),
390
- by(builtin(add, 3))
391
- )
392
- ])
393
- ),
394
- proof(
395
- goal(add(25.0, 36.0, 61.0)),
396
- by(builtin(add, 3))
397
- )
398
- ])
399
- ),
400
- proof(
401
- goal(add(16.0, 61.0, 77.0)),
402
- by(builtin(add, 3))
403
- )
404
- ])
405
- ),
406
- proof(
407
- goal(pow(77.0, 0.5, 8.7749643873921226)),
408
- by(builtin(pow, 3))
409
- )
410
- ])
411
- ),
412
- proof(
413
- goal(mul(3.7416573867739413, 8.7749643873921226, 32.832910318764007)),
414
- by(builtin(mul, 3))
415
- ),
416
- proof(
417
- goal(div(12.0, 32.832910318764007, 0.36548694232390361)),
418
- by(builtin(div, 3))
419
- )
420
- ])
421
- )
422
- ])
423
- )
424
- ).
425
-
@@ -1,216 +1,7 @@
1
1
  witch(girl).
2
- why(
3
- witch(girl),
4
- proof(
5
- goal(witch(girl)),
6
- by(rule("witch.pl", clause(6))),
7
- bindings([binding("X", girl)]),
8
- uses([
9
- proof(
10
- goal(burns(girl)),
11
- by(rule("witch.pl", clause(8))),
12
- bindings([binding("X", girl)]),
13
- uses([
14
- proof(
15
- goal(madeOfWood(girl)),
16
- by(rule("witch.pl", clause(9))),
17
- bindings([binding("X", girl)]),
18
- uses([
19
- proof(
20
- goal(floats(girl)),
21
- by(rule("witch.pl", clause(11))),
22
- bindings([binding("Y", girl), binding("X", duck)]),
23
- uses([
24
- proof(
25
- goal(sameWeight(duck, girl)),
26
- by(fact("witch.pl", clause(12)))
27
- ),
28
- proof(
29
- goal(floats(duck)),
30
- by(fact("witch.pl", clause(10)))
31
- )
32
- ])
33
- )
34
- ])
35
- )
36
- ])
37
- ),
38
- proof(
39
- goal(woman(girl)),
40
- by(fact("witch.pl", clause(7)))
41
- )
42
- ])
43
- )
44
- ).
45
-
46
2
  burns(duck).
47
- why(
48
- burns(duck),
49
- proof(
50
- goal(burns(duck)),
51
- by(rule("witch.pl", clause(8))),
52
- bindings([binding("X", duck)]),
53
- uses([
54
- proof(
55
- goal(madeOfWood(duck)),
56
- by(rule("witch.pl", clause(9))),
57
- bindings([binding("X", duck)]),
58
- uses([
59
- proof(
60
- goal(floats(duck)),
61
- by(fact("witch.pl", clause(10)))
62
- )
63
- ])
64
- )
65
- ])
66
- )
67
- ).
68
-
69
3
  burns(girl).
70
- why(
71
- burns(girl),
72
- proof(
73
- goal(burns(girl)),
74
- by(rule("witch.pl", clause(8))),
75
- bindings([binding("X", girl)]),
76
- uses([
77
- proof(
78
- goal(madeOfWood(girl)),
79
- by(rule("witch.pl", clause(9))),
80
- bindings([binding("X", girl)]),
81
- uses([
82
- proof(
83
- goal(floats(girl)),
84
- by(rule("witch.pl", clause(11))),
85
- bindings([binding("Y", girl), binding("X", duck)]),
86
- uses([
87
- proof(
88
- goal(sameWeight(duck, girl)),
89
- by(fact("witch.pl", clause(12)))
90
- ),
91
- proof(
92
- goal(floats(duck)),
93
- by(fact("witch.pl", clause(10)))
94
- )
95
- ])
96
- )
97
- ])
98
- )
99
- ])
100
- )
101
- ).
102
-
103
4
  madeOfWood(duck).
104
- why(
105
- madeOfWood(duck),
106
- proof(
107
- goal(madeOfWood(duck)),
108
- by(rule("witch.pl", clause(9))),
109
- bindings([binding("X", duck)]),
110
- uses([
111
- proof(
112
- goal(floats(duck)),
113
- by(fact("witch.pl", clause(10)))
114
- )
115
- ])
116
- )
117
- ).
118
-
119
5
  madeOfWood(girl).
120
- why(
121
- madeOfWood(girl),
122
- proof(
123
- goal(madeOfWood(girl)),
124
- by(rule("witch.pl", clause(9))),
125
- bindings([binding("X", girl)]),
126
- uses([
127
- proof(
128
- goal(floats(girl)),
129
- by(rule("witch.pl", clause(11))),
130
- bindings([binding("Y", girl), binding("X", duck)]),
131
- uses([
132
- proof(
133
- goal(sameWeight(duck, girl)),
134
- by(fact("witch.pl", clause(12)))
135
- ),
136
- proof(
137
- goal(floats(duck)),
138
- by(fact("witch.pl", clause(10)))
139
- )
140
- ])
141
- )
142
- ])
143
- )
144
- ).
145
-
146
6
  floats(girl).
147
- why(
148
- floats(girl),
149
- proof(
150
- goal(floats(girl)),
151
- by(rule("witch.pl", clause(11))),
152
- bindings([binding("Y", girl), binding("X", duck)]),
153
- uses([
154
- proof(
155
- goal(sameWeight(duck, girl)),
156
- by(fact("witch.pl", clause(12)))
157
- ),
158
- proof(
159
- goal(floats(duck)),
160
- by(fact("witch.pl", clause(10)))
161
- )
162
- ])
163
- )
164
- ).
165
-
166
7
  is(witchExample, true).
167
- why(
168
- is(witchExample, true),
169
- proof(
170
- goal(is(witchExample, true)),
171
- by(rule("witch.pl", clause(13))),
172
- uses([
173
- proof(
174
- goal(witch(girl)),
175
- by(rule("witch.pl", clause(6))),
176
- bindings([binding("X", girl)]),
177
- uses([
178
- proof(
179
- goal(burns(girl)),
180
- by(rule("witch.pl", clause(8))),
181
- bindings([binding("X", girl)]),
182
- uses([
183
- proof(
184
- goal(madeOfWood(girl)),
185
- by(rule("witch.pl", clause(9))),
186
- bindings([binding("X", girl)]),
187
- uses([
188
- proof(
189
- goal(floats(girl)),
190
- by(rule("witch.pl", clause(11))),
191
- bindings([binding("Y", girl), binding("X", duck)]),
192
- uses([
193
- proof(
194
- goal(sameWeight(duck, girl)),
195
- by(fact("witch.pl", clause(12)))
196
- ),
197
- proof(
198
- goal(floats(duck)),
199
- by(fact("witch.pl", clause(10)))
200
- )
201
- ])
202
- )
203
- ])
204
- )
205
- ])
206
- ),
207
- proof(
208
- goal(woman(girl)),
209
- by(fact("witch.pl", clause(7)))
210
- )
211
- ])
212
- )
213
- ])
214
- )
215
- ).
216
-