eyelang 1.5.4 → 1.5.5

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 (38) hide show
  1. package/conformance/README.md +3 -3
  2. package/conformance/cases/core/021_repeated_variable_head.pl +7 -0
  3. package/conformance/cases/core/022_rule_head_structure.pl +5 -0
  4. package/conformance/cases/core/023_quoted_escapes_readback.pl +5 -0
  5. package/conformance/cases/core/024_numeric_literal_readback.pl +6 -0
  6. package/conformance/cases/core/025_body_parentheses_with_formula_data.pl +5 -0
  7. package/conformance/cases/core/026_underscore_named_variable_reuse.pl +5 -0
  8. package/conformance/cases/extension/035_date_difference.pl +4 -0
  9. package/conformance/cases/extension/036_extended_gcd.pl +3 -0
  10. package/conformance/cases/extension/037_collatz_trajectory.pl +3 -0
  11. package/conformance/cases/extension/038_kaprekar_steps.pl +3 -0
  12. package/conformance/cases/extension/039_goldbach_pair.pl +3 -0
  13. package/conformance/cases/extension/040_matrix_operations.pl +5 -0
  14. package/conformance/cases/extension/041_atom_range_generators.pl +5 -0
  15. package/conformance/cases/extension/042_n_queens_small.pl +3 -0
  16. package/conformance/cases/extension/043_cnf_model.pl +3 -0
  17. package/conformance/cases/extension/044_cover9_filter.pl +6 -0
  18. package/conformance/cases/extension/045_alphametic_sum_small.pl +3 -0
  19. package/conformance/cases/extension/046_bounded_subset.pl +4 -0
  20. package/conformance/expected/core/021_repeated_variable_head.out +2 -0
  21. package/conformance/expected/core/022_rule_head_structure.out +2 -0
  22. package/conformance/expected/core/023_quoted_escapes_readback.out +2 -0
  23. package/conformance/expected/core/024_numeric_literal_readback.out +3 -0
  24. package/conformance/expected/core/025_body_parentheses_with_formula_data.out +1 -0
  25. package/conformance/expected/core/026_underscore_named_variable_reuse.out +1 -0
  26. package/conformance/expected/extension/035_date_difference.out +2 -0
  27. package/conformance/expected/extension/036_extended_gcd.out +1 -0
  28. package/conformance/expected/extension/037_collatz_trajectory.out +1 -0
  29. package/conformance/expected/extension/038_kaprekar_steps.out +1 -0
  30. package/conformance/expected/extension/039_goldbach_pair.out +2 -0
  31. package/conformance/expected/extension/040_matrix_operations.out +3 -0
  32. package/conformance/expected/extension/041_atom_range_generators.out +8 -0
  33. package/conformance/expected/extension/042_n_queens_small.out +2 -0
  34. package/conformance/expected/extension/043_cnf_model.out +1 -0
  35. package/conformance/expected/extension/044_cover9_filter.out +2 -0
  36. package/conformance/expected/extension/045_alphametic_sum_small.out +4 -0
  37. package/conformance/expected/extension/046_bounded_subset.out +5 -0
  38. package/package.json +1 -1
@@ -7,7 +7,7 @@ The suite is intentionally file-based so another implementation can run the same
7
7
  - `conformance/cases/<profile>/<name>.pl` — input program;
8
8
  - `conformance/expected/<profile>/<name>.out` — exact expected standard output.
9
9
 
10
- The current runner compares standard output, including answer facts and their `why/2` explanation facts. Standard error, performance, and resource limits are outside this suite.
10
+ The current runner compares standard output from normal execution. Proof explanations are opt-in in the CLI and are not part of these conformance goldens. Standard error, performance, and resource limits are outside this suite.
11
11
 
12
12
  ## Running the suite
13
13
 
@@ -34,9 +34,9 @@ The runner executes materialized programs in-process through the public JavaScri
34
34
 
35
35
  ## Profiles
36
36
 
37
- `core` covers the portable core language profile from `../SPEC.md`: lexical syntax, facts, definite clauses, first-order terms, lists, conjunction, unification through user predicates, left-to-right goal-directed proof search, and answer printing.
37
+ `core` covers the portable core language profile from `../SPEC.md`: lexical syntax, facts, definite clauses, first-order terms, lists, conjunction, structured unification through user predicates, left-to-right goal-directed proof search, materialized output, and read-back printing.
38
38
 
39
- `extension` covers the standard built-in and host behavior exercised by the current reference implementation: arithmetic, comparison, strings, list relations, aggregation, formula-term helpers, `memoize/2`, `materialize/2`, and default derived output.
39
+ `extension` covers the standard built-in and host behavior exercised by the current reference implementation: arithmetic, comparison, strings, list relations, aggregation, formula-term helpers, number-theory helpers, finite-search helpers, matrix helpers, `memoize/2`, `materialize/2`, and default derived output.
40
40
 
41
41
  The profile name `extension` is a test-suite grouping name. It does not mean that these cases are outside the eyelang specification; most of them correspond to the standard built-in profile and standard host profile in `../SPEC.md`.
42
42
 
@@ -0,0 +1,7 @@
1
+ % SPEC 5.1, 7.1: repeated variables in a rule body require the same term.
2
+ pair(a, a).
3
+ pair(a, b).
4
+ pair(c, c).
5
+ diagonal(X) :- pair(X, X).
6
+ answer(diagonal, X) :- diagonal(X).
7
+ materialize(answer, 2).
@@ -0,0 +1,5 @@
1
+ % SPEC 5.3, 6, 7.1: structured rule heads destructure matching goals.
2
+ unpack(pair(X, Y), X, Y).
3
+ answer(first, A) :- unpack(pair(alpha, beta), A, _).
4
+ answer(second, B) :- unpack(pair(alpha, beta), _, B).
5
+ materialize(answer, 2).
@@ -0,0 +1,5 @@
1
+ % SPEC 3.5, 11: quoted strings and atoms preserve escape sequences at read-back.
2
+ raw(string, "line\nnext\t\\slash").
3
+ raw(atom, 'line\nnext\t\\slash').
4
+ answer(K, V) :- raw(K, V).
5
+ materialize(answer, 2).
@@ -0,0 +1,6 @@
1
+ % SPEC 3.3, 11: signed, decimal, and exponent numeric literals retain lexical form.
2
+ raw(negative_decimal, -3.5).
3
+ raw(positive_exp, 6.02e23).
4
+ raw(negative_exp, -1.0e-3).
5
+ answer(K, V) :- raw(K, V).
6
+ materialize(answer, 2).
@@ -0,0 +1,5 @@
1
+ % SPEC 5.5, 7: formula data can be passed through parenthesized conjunctions.
2
+ record((left(a), right(b))).
3
+ accept((left(a), right(b))).
4
+ answer(ok, F) :- (record(F), accept(F)).
5
+ materialize(answer, 2).
@@ -0,0 +1,5 @@
1
+ % SPEC 3.4, 5.1: variables beginning with underscore are named variables unless exactly _.
2
+ pair(a, a).
3
+ pair(a, b).
4
+ answer(shared, _Value) :- pair(_Value, _Value).
5
+ materialize(answer, 2).
@@ -0,0 +1,4 @@
1
+ % SPEC 9.1: difference/3 computes ISO date durations.
2
+ answer(duration, D) :- difference("2024-03-01", "2020-02-29", D).
3
+ answer(month_borrow, D) :- difference("2024-03-01", "2024-01-31", D).
4
+ materialize(answer, 2).
@@ -0,0 +1,3 @@
1
+ % SPEC 9.2: extended_gcd/5 returns gcd and Bezout coefficients.
2
+ answer(gcd, result(G, S, T)) :- extended_gcd(240, 46, G, S, T).
3
+ materialize(answer, 2).
@@ -0,0 +1,3 @@
1
+ % SPEC 9.2: collatz_trajectory/2 returns the full path to 1.
2
+ answer(path, T) :- collatz_trajectory(6, T).
3
+ materialize(answer, 2).
@@ -0,0 +1,3 @@
1
+ % SPEC 9.2: kaprekar_steps/2 counts iterations to 6174.
2
+ answer(steps, N) :- kaprekar_steps(3524, N).
3
+ materialize(answer, 2).
@@ -0,0 +1,3 @@
1
+ % SPEC 9.2: goldbach_pair/3 enumerates prime decompositions in ascending first prime order.
2
+ answer(pair, pair(P, Q)) :- goldbach_pair(28, P, Q).
3
+ materialize(answer, 2).
@@ -0,0 +1,5 @@
1
+ % SPEC 9.2: matrix helpers handle small ground numeric matrices.
2
+ answer(sum, M) :- matrix_sum([[[1, 2], [3, 4]], [[5, 6], [7, 8]]], M).
3
+ answer(product, M) :- matrix_multiply([[[1, 2], [3, 4]], [[2, 0], [1, 2]]], M).
4
+ answer(determinant, D) :- determinant([[4, 2], [2, 3]], D).
5
+ materialize(answer, 2).
@@ -0,0 +1,5 @@
1
+ % SPEC 9.5: atom range helpers generate prefixed atoms deterministically.
2
+ answer(single, X) :- atom_range(n, 2, 4, X).
3
+ answer(multiple, X) :- atom_ranges([a, b], 1, 2, X).
4
+ answer(bound_check, yes) :- atom_range(n, 2, 4, n3).
5
+ materialize(answer, 2).
@@ -0,0 +1,3 @@
1
+ % SPEC 9.5: n_queens/2 enumerates finite board solutions.
2
+ answer(solution, Qs) :- n_queens(4, Qs).
3
+ materialize(answer, 2).
@@ -0,0 +1,3 @@
1
+ % SPEC 9.5: cnf_model/3 enumerates satisfying truth assignments for a CNF.
2
+ answer(model, M) :- cnf_model([a, b], [[pos(a), pos(b)], [neg(a)]], M).
3
+ materialize(answer, 2).
@@ -0,0 +1,6 @@
1
+ % SPEC 9.5: cover9/1 accepts exactly the digits 1 through 9 once.
2
+ answer(ok, yes) :- cover9([1, 2, 3, 4, 5, 6, 7, 8, 9]).
3
+ answer(candidate, X) :- row(X), cover9(X).
4
+ row([1, 2, 3, 4, 5, 6, 7, 8, 9]).
5
+ row([1, 1, 2, 3, 4, 5, 6, 7, 8]).
6
+ materialize(answer, 2).
@@ -0,0 +1,3 @@
1
+ % SPEC 9.5: alphametic_sum/5 enumerates unique digit assignments for column addition.
2
+ answer(solution, result(Digits, Values)) :- alphametic_sum([a, b], [[a], [a]], [b], Digits, Values).
3
+ materialize(answer, 2).
@@ -0,0 +1,4 @@
1
+ % SPEC 9.5: bounded_subset/7 enumerates subsets within budget and risk caps.
2
+ projects([p(a, 5, 3, 1), p(b, 4, 2, 2), p(c, 7, 5, 3)]).
3
+ answer(selection, result(Names, Value, Cost, Risk)) :- projects(Ps), bounded_subset(Ps, 5, 3, Names, Value, Cost, Risk).
4
+ materialize(answer, 2).
@@ -0,0 +1,2 @@
1
+ answer(diagonal, a).
2
+ answer(diagonal, c).
@@ -0,0 +1,2 @@
1
+ answer(first, alpha).
2
+ answer(second, beta).
@@ -0,0 +1,2 @@
1
+ answer(string, "line\nnext \\slash").
2
+ answer(atom, 'line\nnext\t\\slash').
@@ -0,0 +1,3 @@
1
+ answer(negative_decimal, -3.5).
2
+ answer(positive_exp, 6.02e23).
3
+ answer(negative_exp, -1.0e-3).
@@ -0,0 +1 @@
1
+ answer(ok, (left(a), right(b))).
@@ -0,0 +1,2 @@
1
+ answer(duration, "P4Y1D").
2
+ answer(month_borrow, "P1M-1D").
@@ -0,0 +1 @@
1
+ answer(gcd, result(2, -9, 47)).
@@ -0,0 +1 @@
1
+ answer(path, [6, 3, 10, 5, 16, 8, 4, 2, 1]).
@@ -0,0 +1 @@
1
+ answer(steps, 3).
@@ -0,0 +1,2 @@
1
+ answer(pair, pair(5, 23)).
2
+ answer(pair, pair(11, 17)).
@@ -0,0 +1,3 @@
1
+ answer(sum, [[6, 8], [10, 12]]).
2
+ answer(product, [[4, 4], [10, 8]]).
3
+ answer(determinant, 8.0000000000000018).
@@ -0,0 +1,8 @@
1
+ answer(single, n2).
2
+ answer(single, n3).
3
+ answer(single, n4).
4
+ answer(multiple, a1).
5
+ answer(multiple, a2).
6
+ answer(multiple, b1).
7
+ answer(multiple, b2).
8
+ answer(bound_check, yes).
@@ -0,0 +1,2 @@
1
+ answer(solution, [2, 4, 1, 3]).
2
+ answer(solution, [3, 1, 4, 2]).
@@ -0,0 +1 @@
1
+ answer(model, [value(a, false), value(b, true)]).
@@ -0,0 +1,2 @@
1
+ answer(ok, yes).
2
+ answer(candidate, [1, 2, 3, 4, 5, 6, 7, 8, 9]).
@@ -0,0 +1,4 @@
1
+ answer(solution, result([1, 2], [1, 1, 2])).
2
+ answer(solution, result([2, 4], [2, 2, 4])).
3
+ answer(solution, result([3, 6], [3, 3, 6])).
4
+ answer(solution, result([4, 8], [4, 4, 8])).
@@ -0,0 +1,5 @@
1
+ answer(selection, result([a, b], 9, 5, 3)).
2
+ answer(selection, result([a], 5, 3, 1)).
3
+ answer(selection, result([b], 4, 2, 2)).
4
+ answer(selection, result([c], 7, 5, 3)).
5
+ answer(selection, result([], 0, 0, 0)).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyelang",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "type": "module",
5
5
  "description": "A small rule engine for Prolog-style Horn clauses",
6
6
  "keywords": [