eyeprolog 0.5.13 → 0.5.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/conformance-report.md +2 -2
- package/examples/auroracare.pl +26 -0
- package/examples/bmi.pl +20 -1
- package/examples/cdcl-sat-solver.pl +6 -6
- package/examples/composition-of-injective-functions-is-injective.pl +4 -1
- package/examples/deep-taxonomy-10.pl +2 -0
- package/examples/deep-taxonomy-100.pl +2 -0
- package/examples/deep-taxonomy-1000.pl +2 -0
- package/examples/deep-taxonomy-10000.pl +2 -0
- package/examples/exoplanet-validation-worlds.pl +3 -0
- package/examples/family-cousins.pl +2 -0
- package/examples/fastpow.pl +6 -6
- package/examples/flandor.pl +14 -0
- package/examples/gd-step-certified.pl +3 -0
- package/examples/group-inverse-uniqueness.pl +9 -9
- package/examples/illegitimate-reasoning.pl +6 -0
- package/examples/input/odrl-dpv-fpv-trust-flow-rules.pl +3 -9
- package/examples/list-collection.pl +6 -6
- package/examples/lldm.pl +2 -0
- package/examples/odrl-dpv-fpv-trust-flow.pl +3 -9
- package/examples/output/aliases-and-namespaces.pl +1 -1
- package/examples/output/bmi.pl +9 -0
- package/examples/output/dijkstra-findall-sort.pl +1 -1
- package/examples/output/dijkstra.pl +16 -16
- package/examples/output/drone-corridor-planner.pl +17 -17
- package/examples/output/iso-atomic-conversion.pl +1 -1
- package/examples/output/list-collection.pl +6 -6
- package/examples/pointer-analysis.pl +3 -0
- package/examples/proof/aliases-and-namespaces.pl +5 -5
- package/examples/proof/composition-of-injective-functions-is-injective.pl +80 -97
- package/examples/proof/graph-reachability.pl +22 -22
- package/examples/proof/group-inverse-uniqueness.pl +4 -4
- package/examples/proof/list-collection.pl +73 -29
- package/examples/proof/spacecraft-battery-diagnosis.pl +8 -8
- package/examples/proof/term-tools.pl +1 -1
- package/examples/relational-cube-lookup.pl +2002 -2000
- package/examples/riemann-hypothesis.pl +5 -0
- package/examples/spacecraft-battery-diagnosis.pl +8 -8
- package/examples/vulnerability-impact.pl +4 -0
- package/index.d.ts +5 -2
- package/package.json +1 -1
- package/src/cli.js +17 -9
- package/src/index.js +15 -5
- package/src/iso.js +1 -0
- package/src/parser.js +57 -12
- package/src/program.js +8 -5
- package/src/solver.js +11 -3
- package/src/term.js +41 -10
- package/src/write.js +6 -0
- package/test/conformance/README.md +1 -1
- package/test/conformance/cases/arithmetic/082_comparison_semantics.pl +2 -2
- package/test/conformance/cases/arithmetic/extra_le_equal_string.pl +1 -1
- package/test/conformance/cases/context/extra_context_ignores_string_parts.pl +1 -1
- package/test/conformance/cases/iso/double_quoted_lists.pl +27 -0
- package/test/conformance/cases/strings/023_quoted_escapes_readback.pl +2 -3
- package/test/conformance/cases/terms/003_terms_and_readback.pl +1 -1
- package/test/conformance/cases/terms/073_term_introspection_edges.pl +1 -1
- package/test/conformance/cases/terms/096_functor_scalar_edges.pl +2 -2
- package/test/conformance/cases/terms/extra_functor_string_scalar.pl +1 -1
- package/test/conformance/cases/terms/functor_number_and_string.pl +1 -1
- package/test/conformance/cases/unification/extra_eq_scalar_string_number.pl +1 -1
- package/test/conformance/cases/unification/scalar_cross_type_same_lexical_value.pl +2 -2
- package/test/conformance/expected/aggregation/044_findall_user_goal.pl +1 -1
- package/test/conformance/expected/arithmetic/082_comparison_semantics.pl +1 -1
- package/test/conformance/expected/arithmetic/extra_le_equal_string.pl +1 -1
- package/test/conformance/expected/context/extra_context_atom_parts.pl +1 -1
- package/test/conformance/expected/context/extra_context_ignores_string_parts.pl +1 -0
- package/test/conformance/expected/context/extra_context_list_parts.pl +1 -1
- package/test/conformance/expected/iso/atomic_term_processing.pl +1 -1
- package/test/conformance/expected/iso/double_quoted_lists.pl +8 -0
- package/test/conformance/expected/iso/exceptions_and_flags.pl +1 -1
- package/test/conformance/expected/iso/grouped_solutions_and_clauses.pl +1 -1
- package/test/conformance/expected/iso/logtalk_atom_chars.pl +1 -1
- package/test/conformance/expected/iso/logtalk_number_chars.pl +1 -1
- package/test/conformance/expected/iso/logtalk_prolog_flags.pl +1 -1
- package/test/conformance/expected/iso/logtalk_univ.pl +1 -1
- package/test/conformance/expected/iso/scryer_lexical_terms.pl +1 -1
- package/test/conformance/expected/lists/005_list_deconstruction.pl +1 -1
- package/test/conformance/expected/lists/031_lists_aggregation_ordering.pl +4 -4
- package/test/conformance/expected/lists/035_list_relations.pl +3 -3
- package/test/conformance/expected/lists/036_append_splits.pl +3 -3
- package/test/conformance/expected/lists/045_sort_deduplicates_atoms.pl +1 -1
- package/test/conformance/expected/lists/046_append_bound_prefix_suffix.pl +2 -2
- package/test/conformance/expected/lists/048_set_nth0_edges.pl +2 -2
- package/test/conformance/expected/lists/049_select_duplicate_occurrences.pl +2 -2
- package/test/conformance/expected/lists/067_list_edges.pl +1 -1
- package/test/conformance/expected/lists/068_list_generation_order.pl +6 -6
- package/test/conformance/expected/lists/084_append_and_select_composition.pl +9 -9
- package/test/conformance/expected/lists/085_nth_and_update_edges.pl +1 -1
- package/test/conformance/expected/lists/087_sort_reverse_length.pl +2 -2
- package/test/conformance/expected/lists/extra_append_all_splits_three.pl +4 -4
- package/test/conformance/expected/lists/extra_list_to_set_stable_order.pl +1 -1
- package/test/conformance/expected/lists/extra_reverse_nested_terms.pl +1 -1
- package/test/conformance/expected/lists/extra_slice_end.pl +1 -1
- package/test/conformance/expected/lists/extra_take_all.pl +1 -1
- package/test/conformance/expected/lists/list_pattern_last.pl +1 -1
- package/test/conformance/expected/lists/select_all_occurrences.pl +3 -3
- package/test/conformance/expected/lists/set_nth0_middle.pl +1 -1
- package/test/conformance/expected/rules/077_recursive_path_with_lists.pl +3 -3
- package/test/conformance/expected/strings/023_quoted_escapes_readback.pl +1 -1
- package/test/conformance/expected/strings/071_string_edges.pl +1 -1
- package/test/conformance/expected/strings/extra_split_empty_separator.pl +1 -1
- package/test/conformance/expected/terms/003_terms_and_readback.pl +3 -3
- package/test/conformance/expected/terms/065_reusable_term_control_builtins.pl +1 -1
- package/test/conformance/expected/terms/073_term_introspection_edges.pl +2 -2
- package/test/conformance/expected/terms/095_term_introspection_roundtrip.pl +1 -1
- package/test/conformance/expected/terms/096_functor_scalar_edges.pl +1 -1
- package/test/conformance/expected/terms/extra_compound_name_arguments_decompose_list.pl +1 -1
- package/test/conformance/expected/terms/extra_functor_string_scalar.pl +1 -1
- package/test/conformance/expected/terms/functor_number_and_string.pl +1 -1
- package/test/conformance/expected/unification/012_nested_compound_unification.pl +1 -1
- package/test/conformance/expected/unification/034_equality_and_inequality.pl +1 -1
- package/test/conformance/expected/unification/extra_eq_list_tail_binding.pl +1 -1
- package/test/conformance/expected/unification/list_tail_binding.pl +1 -1
- package/test/conformance/expected-proofs/proofs/bindings_nested_term.pl +5 -5
- package/test/conformance/expected-proofs/proofs/extra_compound_name_arguments.pl +4 -4
- package/test/conformance/expected-proofs/proofs/extra_findall_builtin.pl +5 -5
- package/test/conformance/expected-proofs/proofs/extra_nested_list_binding.pl +5 -5
- package/test/conformance/expected-proofs/proofs/extra_once_member.pl +2 -2
- package/test/conformance/expected-proofs/proofs/list_builtin.pl +1 -1
- package/test/run-playground.mjs +2 -2
- package/test/run-regression.mjs +69 -11
- package/the-art-of-eyeprolog.md +297 -38
package/README.md
CHANGED
|
@@ -28,6 +28,8 @@ eyeprolog --goal 'type(socrates, mortal)' examples/socrates.pl
|
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
Programs may declare their default queries with `%% goal:` comments.
|
|
31
|
+
Double-quoted text follows the ISO `double_quotes` flag and defaults to a
|
|
32
|
+
proper list of one-character atoms (`chars`), matching Trealla and Scryer.
|
|
31
33
|
|
|
32
34
|
## Portable library
|
|
33
35
|
|
package/conformance-report.md
CHANGED
|
@@ -11,7 +11,7 @@ This report summarizes the file-based conformance corpus under `test/conformance
|
|
|
11
11
|
| builtins | 11 | 0 | 0 | 0 | 11 |
|
|
12
12
|
| context | 11 | 0 | 0 | 0 | 11 |
|
|
13
13
|
| control | 15 | 0 | 0 | 0 | 15 |
|
|
14
|
-
| iso |
|
|
14
|
+
| iso | 121 | 159 | 0 | 0 | 280 |
|
|
15
15
|
| lists | 52 | 3 | 0 | 0 | 55 |
|
|
16
16
|
| negation | 8 | 0 | 19 | 0 | 27 |
|
|
17
17
|
| proofs | 0 | 0 | 0 | 21 | 21 |
|
|
@@ -22,4 +22,4 @@ This report summarizes the file-based conformance corpus under `test/conformance
|
|
|
22
22
|
| terms | 26 | 3 | 0 | 0 | 29 |
|
|
23
23
|
| unification | 18 | 0 | 0 | 0 | 18 |
|
|
24
24
|
| variables | 16 | 9 | 0 | 0 | 25 |
|
|
25
|
-
| **Total** | **
|
|
25
|
+
| **Total** | **434** | **212** | **19** | **21** | **686** |
|
package/examples/auroracare.pl
CHANGED
|
@@ -45,6 +45,32 @@
|
|
|
45
45
|
%% goal: checkC10Text(X0, X1)
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
:- discontiguous(policyUid/2).
|
|
49
|
+
:- discontiguous(purposeAllowed/2).
|
|
50
|
+
:- discontiguous(requireEnvironment/2).
|
|
51
|
+
:- discontiguous(allowAnyCategory/2).
|
|
52
|
+
:- discontiguous(duty/2).
|
|
53
|
+
:- discontiguous(scenario/1).
|
|
54
|
+
:- discontiguous(outputKey/2).
|
|
55
|
+
:- discontiguous(scenario_label/2).
|
|
56
|
+
:- discontiguous(scenario_description/2).
|
|
57
|
+
:- discontiguous(requester/2).
|
|
58
|
+
:- discontiguous(requesterRole/2).
|
|
59
|
+
:- discontiguous(subject/2).
|
|
60
|
+
:- discontiguous(purpose/2).
|
|
61
|
+
:- discontiguous(environment/2).
|
|
62
|
+
:- discontiguous(category/2).
|
|
63
|
+
:- discontiguous(checkC1/2).
|
|
64
|
+
:- discontiguous(checkC2/2).
|
|
65
|
+
:- discontiguous(checkC3/2).
|
|
66
|
+
:- discontiguous(checkC4/2).
|
|
67
|
+
:- discontiguous(checkC5/2).
|
|
68
|
+
:- discontiguous(checkC6/2).
|
|
69
|
+
:- discontiguous(checkC7/2).
|
|
70
|
+
:- discontiguous(checkC8/2).
|
|
71
|
+
:- discontiguous(checkC9/2).
|
|
72
|
+
:- discontiguous(checkC10Text/2).
|
|
73
|
+
|
|
48
74
|
% Program structure: facts set up the scenario, and rules derive the queried conclusions.
|
|
49
75
|
caseName(case, "auroracare").
|
|
50
76
|
question(case, "For each AuroraCare scenario, should the PDP permit or deny the requested use of health data, and why?").
|
package/examples/bmi.pl
CHANGED
|
@@ -71,6 +71,15 @@
|
|
|
71
71
|
%% goal: checkPassed(X0, X1)
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
:- discontiguous(weightKg/2).
|
|
75
|
+
:- discontiguous(heightM/2).
|
|
76
|
+
:- discontiguous(units/2).
|
|
77
|
+
:- discontiguous(bmi/2).
|
|
78
|
+
:- discontiguous(category/2).
|
|
79
|
+
:- discontiguous(healthyMinKg/2).
|
|
80
|
+
:- discontiguous(healthyMaxKg/2).
|
|
81
|
+
:- discontiguous(heightCm/2).
|
|
82
|
+
|
|
74
83
|
% Program structure: facts set up the scenario, and rules derive the queried conclusions.
|
|
75
84
|
unitSystem(input, metric).
|
|
76
85
|
weight(input, 72.0).
|
|
@@ -260,4 +269,14 @@ heightCm(report, Height) :-
|
|
|
260
269
|
heightCm(answer, Height).
|
|
261
270
|
|
|
262
271
|
checkPassed(report, Check) :-
|
|
263
|
-
statement(check, Check,
|
|
272
|
+
statement(check, Check, _Message).
|
|
273
|
+
|
|
274
|
+
statement(check, c1, Message) :- c1(check, Message).
|
|
275
|
+
statement(check, c2, Message) :- c2(check, Message).
|
|
276
|
+
statement(check, c3, Message) :- c3(check, Message).
|
|
277
|
+
statement(check, c4, Message) :- c4(check, Message).
|
|
278
|
+
statement(check, c5, Message) :- c5(check, Message).
|
|
279
|
+
statement(check, c6, Message) :- c6(check, Message).
|
|
280
|
+
statement(check, c7, Message) :- c7(check, Message).
|
|
281
|
+
statement(check, c8, Message) :- c8(check, Message).
|
|
282
|
+
statement(check, c9, Message) :- c9(check, Message).
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
%% goal: cdclAnswer(X0, X1)
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
sat_clause(c1, [neg(a), pos(c)]).
|
|
21
|
+
sat_clause(c2, [neg(c)]).
|
|
22
|
+
sat_clause(c3, [pos(a), pos(b)]).
|
|
23
23
|
|
|
24
24
|
% Initial trail before conflict analysis.
|
|
25
25
|
initial_value(a, true, decision(level1)).
|
|
@@ -38,7 +38,7 @@ call_value(final, Var, Value, Reason) :- final_value(Var, Value, Reason).
|
|
|
38
38
|
|
|
39
39
|
% A clause is conflicting when all of its literals are false under a trail.
|
|
40
40
|
conflict(Trail, Clause) :-
|
|
41
|
-
|
|
41
|
+
sat_clause(Clause, Literals),
|
|
42
42
|
\+ nonfalse_literal(Trail, Literals).
|
|
43
43
|
nonfalse_literal(Trail, Literals) :-
|
|
44
44
|
member(Literal, Literals),
|
|
@@ -56,13 +56,13 @@ final_value(c, false, unit(c2)).
|
|
|
56
56
|
final_value(b, true, unit(c3)).
|
|
57
57
|
|
|
58
58
|
model_satisfies_clause(Trail, Clause) :-
|
|
59
|
-
|
|
59
|
+
sat_clause(Clause, Literals),
|
|
60
60
|
member(Literal, Literals),
|
|
61
61
|
lit_true(Literal, Trail).
|
|
62
62
|
|
|
63
63
|
final_model_ok(ok) :- \+ unsatisfied_final_clause.
|
|
64
64
|
unsatisfied_final_clause :-
|
|
65
|
-
|
|
65
|
+
sat_clause(Name, _),
|
|
66
66
|
\+ model_satisfies_clause(final, Name).
|
|
67
67
|
|
|
68
68
|
cdclAnswer(conflict_clause, Clause) :- conflict(initial, Clause).
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
%% goal: sameInputByCompositeInjectivity(X0, X1, X2)
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
:- discontiguous(app/3).
|
|
12
|
+
:- discontiguous(sameTerm/2).
|
|
13
|
+
|
|
11
14
|
% Program structure: facts set up the scenario, and rules derive the queried conclusions.
|
|
12
15
|
inX(a).
|
|
13
16
|
inX(b).
|
|
@@ -19,7 +22,7 @@ inZ(e).
|
|
|
19
22
|
sameTerm(X, X) :- inX(X).
|
|
20
23
|
sameTerm(X, X) :- inY(X).
|
|
21
24
|
sameTerm(X, X) :- inZ(X).
|
|
22
|
-
sameTerm(Y, X) :- sameTerm(X, Y).
|
|
25
|
+
sameTerm(Y, X) :- Y @< X, sameTerm(X, Y).
|
|
23
26
|
|
|
24
27
|
app(f, a, c).
|
|
25
28
|
app(f, b, d).
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
%% goal: reason(X0, X1)
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
:- discontiguous(confirms_in_world/2).
|
|
22
|
+
:- discontiguous(rejects_in_world/2).
|
|
23
|
+
|
|
21
24
|
% candidate/4 stores occurrence rate, sensitivity, and specificity. world/2
|
|
22
25
|
% names the alternative validation policies applied to the same signals.
|
|
23
26
|
candidate(rare_wide_orbit, 0.001, 0.99, 0.99).
|
package/examples/fastpow.pl
CHANGED
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
|
|
21
21
|
% Base case and parity split for exponentiation by squaring. Even exponents
|
|
22
22
|
% square the half-power; odd exponents peel off one base factor.
|
|
23
|
-
(
|
|
23
|
+
fast_power(_Base, 0, 1).
|
|
24
24
|
% Recursive even/odd clauses reduce the exponent quickly rather than counting
|
|
25
25
|
% down one multiplication at a time.
|
|
26
|
-
(
|
|
26
|
+
fast_power(Base, Exp, Value) :-
|
|
27
27
|
(Exp > 0),
|
|
28
28
|
(0 is Exp mod 2),
|
|
29
29
|
(Half is Exp // 2),
|
|
30
|
-
(
|
|
30
|
+
fast_power(Base, Half, Halfvalue),
|
|
31
31
|
(Value is Halfvalue * Halfvalue).
|
|
32
|
-
(
|
|
32
|
+
fast_power(Base, Exp, Value) :-
|
|
33
33
|
(Exp > 0),
|
|
34
34
|
(1 is Exp mod 2),
|
|
35
35
|
(Evenexp is Exp - 1),
|
|
36
|
-
(
|
|
36
|
+
fast_power(Base, Evenexp, Evenvalue),
|
|
37
37
|
(Value is Base * Evenvalue).
|
|
38
38
|
|
|
39
39
|
% pow_mod/4 applies the modulus at each multiplication to keep values small.
|
|
@@ -58,7 +58,7 @@ pow_mod(Base, Exp, Mod, Value) :-
|
|
|
58
58
|
tower(2, 4, 65536).
|
|
59
59
|
tower_mod(2, 5, 1000000, 156736).
|
|
60
60
|
|
|
61
|
-
pow([2, 10], Value) :- (Value is
|
|
61
|
+
pow([2, 10], Value) :- fast_power(2, 10, Power), (Value is Power + 0.0).
|
|
62
62
|
powSlow([2, 10], Value) :- (Value is 2 ** 10).
|
|
63
63
|
powMod1e6([2, 10000], Value) :- pow_mod(2, 10000, 1000000, Value).
|
|
64
64
|
powMod1e6([3, 10000], Value) :- pow_mod(3, 10000, 1000000, Value).
|
package/examples/flandor.pl
CHANGED
|
@@ -81,6 +81,20 @@
|
|
|
81
81
|
%% goal: lowestCostEligiblePackageChosen(X0, X1)
|
|
82
82
|
|
|
83
83
|
|
|
84
|
+
:- discontiguous(industrialCluster/1).
|
|
85
|
+
:- discontiguous(clusterName/2).
|
|
86
|
+
:- discontiguous(exportOrdersIndex/2).
|
|
87
|
+
:- discontiguous(energyIntensity/2).
|
|
88
|
+
:- discontiguous(policyPackage/1).
|
|
89
|
+
:- discontiguous(packageId/2).
|
|
90
|
+
:- discontiguous(packageName/2).
|
|
91
|
+
:- discontiguous(costMEUR/2).
|
|
92
|
+
:- discontiguous(worker_coverage/2).
|
|
93
|
+
:- discontiguous(grid_relief_mw/2).
|
|
94
|
+
:- discontiguous(coversExportWeakness/2).
|
|
95
|
+
:- discontiguous(coversSkillsStrain/2).
|
|
96
|
+
:- discontiguous(coversGridStress/2).
|
|
97
|
+
|
|
84
98
|
% Program structure: facts set up the scenario, and rules derive the queried conclusions.
|
|
85
99
|
% Case metadata describes the request, audit window, and expected file writes.
|
|
86
100
|
case_name(case, "flandor").
|
|
@@ -14,21 +14,21 @@ element(x).
|
|
|
14
14
|
element(i).
|
|
15
15
|
element(j).
|
|
16
16
|
|
|
17
|
-
% leftInverse/2 and rightInverse/2 are proved from
|
|
17
|
+
% leftInverse/2 and rightInverse/2 are proved from group_op/3. sameInverse/3
|
|
18
18
|
% then derives uniqueness by combining both inverse directions with sameTerm/2.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
group_op(e, X, X) :- element(X).
|
|
20
|
+
group_op(X, e, X) :- element(X).
|
|
21
|
+
group_op(i, x, e).
|
|
22
|
+
group_op(x, j, e).
|
|
23
|
+
group_op(j, x, e).
|
|
24
|
+
group_op(x, i, e).
|
|
25
25
|
|
|
26
26
|
sameTerm(X, X) :- element(X).
|
|
27
27
|
sameTerm(i, j).
|
|
28
28
|
sameTerm(j, i).
|
|
29
29
|
|
|
30
|
-
leftInverse(A, B) :-
|
|
31
|
-
rightInverse(A, B) :-
|
|
30
|
+
leftInverse(A, B) :- group_op(B, A, e).
|
|
31
|
+
rightInverse(A, B) :- group_op(A, B, e).
|
|
32
32
|
|
|
33
33
|
sameInverse(A, B, C) :-
|
|
34
34
|
leftInverse(A, B),
|
|
@@ -23,6 +23,12 @@
|
|
|
23
23
|
%% goal: omittedAlternative(X0, X1)
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
:- discontiguous(argument/1).
|
|
27
|
+
:- discontiguous(implication/3).
|
|
28
|
+
:- discontiguous(observed/2).
|
|
29
|
+
:- discontiguous(concludes/2).
|
|
30
|
+
:- discontiguous(reason/2).
|
|
31
|
+
|
|
26
32
|
% Program structure: facts set up the scenario, and rules derive the queried conclusions.
|
|
27
33
|
argument(arg_affirming_consequent).
|
|
28
34
|
implication(arg_affirming_consequent, rain, street_wet).
|
|
@@ -65,16 +65,10 @@ rdf_number(Subject, Predicate, Number) :-
|
|
|
65
65
|
iri_term(Subject, SubjectIri),
|
|
66
66
|
iri_term(Predicate, PredicateIri),
|
|
67
67
|
rdf(iri(SubjectIri), iri(PredicateIri), literal(Text, datatype(_Datatype)), default_graph),
|
|
68
|
-
|
|
68
|
+
atom_chars(Text, Chars),
|
|
69
|
+
number_chars(Number, Chars).
|
|
69
70
|
|
|
70
71
|
iri_term(ex(Name), Iri) :- namespace_iri('https://example.org/', Name, Iri).
|
|
71
72
|
iri_term(odrl(Name), Iri) :- namespace_iri('http://www.w3.org/ns/odrl/2/', Name, Iri).
|
|
72
73
|
|
|
73
|
-
namespace_iri(Prefix, Name, Iri) :-
|
|
74
|
-
atom(Name),
|
|
75
|
-
!,
|
|
76
|
-
atom_string(Name, Local),
|
|
77
|
-
string_concat(Prefix, Local, Iri).
|
|
78
|
-
namespace_iri(Prefix, Name, Iri) :-
|
|
79
|
-
string_concat(Prefix, Local, Iri),
|
|
80
|
-
atom_string(Name, Local).
|
|
74
|
+
namespace_iri(Prefix, Name, Iri) :- atom_concat(Prefix, Name, Iri).
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
% Demonstrates list literals, member/2, length/2, append/3, and [Head|Tail].
|
|
3
3
|
% Each queried relation demonstrates one list operation.
|
|
4
4
|
% Output declarations: host-supplied goals select the relations written to this example's golden output.
|
|
5
|
-
%% goal:
|
|
5
|
+
%% goal: collectionLength(X0, X1)
|
|
6
6
|
|
|
7
|
-
%% goal:
|
|
7
|
+
%% goal: collectionMember(X0, X1)
|
|
8
8
|
|
|
9
|
-
%% goal:
|
|
9
|
+
%% goal: collectionAppend(X0, X1)
|
|
10
10
|
|
|
11
11
|
%% goal: head(X0, X1)
|
|
12
12
|
|
|
@@ -21,15 +21,15 @@ collection(letters, [a, b]).
|
|
|
21
21
|
|
|
22
22
|
% The derived predicates show list length, membership, append, and pattern
|
|
23
23
|
% matching with [Head|Tail] in the smallest possible setting.
|
|
24
|
-
|
|
24
|
+
collectionLength(numbers, N) :-
|
|
25
25
|
collection(numbers, List),
|
|
26
26
|
length(List, N).
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
collectionMember(numbers, X) :-
|
|
29
29
|
collection(numbers, List),
|
|
30
30
|
member(X, List).
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
collectionAppend(letters, Extended) :-
|
|
33
33
|
collection(letters, List),
|
|
34
34
|
append(List, [c], Extended).
|
|
35
35
|
|
package/examples/lldm.pl
CHANGED
|
@@ -100,16 +100,10 @@ rdf_number(Subject, Predicate, Number) :-
|
|
|
100
100
|
iri_term(Subject, SubjectIri),
|
|
101
101
|
iri_term(Predicate, PredicateIri),
|
|
102
102
|
rdf(iri(SubjectIri), iri(PredicateIri), literal(Text, datatype(_Datatype)), default_graph),
|
|
103
|
-
|
|
103
|
+
atom_chars(Text, Chars),
|
|
104
|
+
number_chars(Number, Chars).
|
|
104
105
|
|
|
105
106
|
iri_term(ex(Name), Iri) :- namespace_iri('https://example.org/', Name, Iri).
|
|
106
107
|
iri_term(odrl(Name), Iri) :- namespace_iri('http://www.w3.org/ns/odrl/2/', Name, Iri).
|
|
107
108
|
|
|
108
|
-
namespace_iri(Prefix, Name, Iri) :-
|
|
109
|
-
atom(Name),
|
|
110
|
-
!,
|
|
111
|
-
atom_string(Name, Local),
|
|
112
|
-
string_concat(Prefix, Local, Iri).
|
|
113
|
-
namespace_iri(Prefix, Name, Iri) :-
|
|
114
|
-
string_concat(Prefix, Local, Iri),
|
|
115
|
-
atom_string(Name, Local).
|
|
109
|
+
namespace_iri(Prefix, Name, Iri) :- atom_concat(Prefix, Name, Iri).
|
package/examples/output/bmi.pl
CHANGED
|
@@ -30,3 +30,12 @@ c8(check, "OK - classification behavior is monotonic across representative BMI v
|
|
|
30
30
|
c9(check, "OK - the healthy-weight band was reconstructed from BMI 18.5 to 24.9 at the same height.").
|
|
31
31
|
result(report, bmi(22.72, "Normal")).
|
|
32
32
|
healthyWeightRangeKg(report, range(58.6, 78.9)).
|
|
33
|
+
checkPassed(report, c1).
|
|
34
|
+
checkPassed(report, c2).
|
|
35
|
+
checkPassed(report, c3).
|
|
36
|
+
checkPassed(report, c4).
|
|
37
|
+
checkPassed(report, c5).
|
|
38
|
+
checkPassed(report, c6).
|
|
39
|
+
checkPassed(report, c7).
|
|
40
|
+
checkPassed(report, c8).
|
|
41
|
+
checkPassed(report, c9).
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
shortestPath(dijkstra_findall_sort,
|
|
1
|
+
shortestPath(dijkstra_findall_sort, "acbdef").
|
|
2
2
|
cost(dijkstra_findall_sort, 13).
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
edge(
|
|
2
|
-
edge(
|
|
3
|
-
edge(
|
|
4
|
-
edge(
|
|
5
|
-
edge(
|
|
6
|
-
edge(
|
|
7
|
-
edge(
|
|
8
|
-
edge(
|
|
9
|
-
edge(
|
|
10
|
-
path(
|
|
11
|
-
path(
|
|
12
|
-
path(
|
|
13
|
-
path(
|
|
14
|
-
path(
|
|
15
|
-
path(
|
|
16
|
-
path(
|
|
1
|
+
edge("ba", 4).
|
|
2
|
+
edge("ca", 2).
|
|
3
|
+
edge("cb", 1).
|
|
4
|
+
edge("db", 5).
|
|
5
|
+
edge("dc", 8).
|
|
6
|
+
edge("ec", 10).
|
|
7
|
+
edge("ed", 2).
|
|
8
|
+
edge("fd", 6).
|
|
9
|
+
edge("fe", 3).
|
|
10
|
+
path("af", ["abdef", 14]).
|
|
11
|
+
path("af", ["abdf", 15]).
|
|
12
|
+
path("af", ["acdef", 15]).
|
|
13
|
+
path("af", ["acdf", 16]).
|
|
14
|
+
path("af", ["acef", 15]).
|
|
15
|
+
path("af", ["acbdef", 13]).
|
|
16
|
+
path("af", ["acbdf", 14]).
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
gps_plan(d1, plan([fly_gent_brugge, public_coastline_brugge_oostende], 2800.0, 0.012, 0.96029999999999993, 0.95039999999999991, low, none,
|
|
2
|
-
gps_plan(d1, plan([fly_gent_brugge, buy_permit_brugge, public_coastline_brugge_oostende], 3250.0, 0.014, 0.94109399999999999, 0.95039999999999991, low, yes,
|
|
3
|
-
gps_plan(d1, plan([fly_gent_brugge, buy_permit_brugge, topup_brugge, cross_corridor_brugge_oostende], 3250.0, 0.015000000000000001, 0.94984520399999994, 0.97019999999999995, mid, yes,
|
|
4
|
-
gps_plan(d1, plan([fly_gent_brugge, buy_permit_brugge, topup_brugge, public_coastline_brugge_oostende], 3550.0, 0.017000000000000001, 0.94499905500000003, 0.931392, mid, yes,
|
|
5
|
-
gps_plan(d1, plan([fly_gent_brugge, topup_brugge, public_coastline_brugge_oostende], 3100.0, 0.015000000000000001, 0.96428475000000002, 0.931392, mid, none,
|
|
6
|
-
gps_plan(d1, plan([fly_gent_brugge, topup_brugge, buy_permit_brugge, cross_corridor_brugge_oostende], 3250.0, 0.015000000000000001, 0.94984520399999994, 0.97019999999999995, mid, yes,
|
|
7
|
-
gps_plan(d1, plan([fly_gent_brugge, topup_brugge, buy_permit_brugge, public_coastline_brugge_oostende], 3550.0, 0.017000000000000001, 0.94499905500000003, 0.931392, mid, yes,
|
|
8
|
-
gps_plan(d1, plan([train_gent_brugge, public_coastline_brugge_oostende], 2900.0, 0.018000000000000002, 0.97402500000000003, 0.95519999999999994, mid, none,
|
|
9
|
-
gps_plan(d1, plan([train_gent_brugge, buy_permit_brugge, cross_corridor_brugge_oostende], 3050.0, 0.018000000000000002, 0.95943959999999995, 0.995, mid, yes,
|
|
10
|
-
gps_plan(d1, plan([train_gent_brugge, buy_permit_brugge, public_coastline_brugge_oostende], 3350.0, 0.02, 0.95454450000000002, 0.95519999999999994, mid, yes,
|
|
11
|
-
gps_plan(d1, plan([fly_gent_kortrijk, fly_kortrijk_brugge, buy_permit_brugge, quick_charge_brugge, cross_corridor_brugge_oostende], 5150.0, 0.024, 0.94034675195999995, 0.9506969999999999, mid, yes,
|
|
12
|
-
gps_plan(d1, plan([fly_gent_kortrijk, fly_kortrijk_brugge, quick_charge_brugge, public_coastline_brugge_oostende], 5000.0, 0.024, 0.95464190250000003, 0.91266911999999989, mid, none,
|
|
13
|
-
gps_plan(d1, plan([fly_gent_kortrijk, fly_kortrijk_brugge, quick_charge_brugge, buy_permit_brugge, cross_corridor_brugge_oostende], 5150.0, 0.024, 0.94034675195999995, 0.9506969999999999, mid, yes,
|
|
14
|
-
gps_plan(d1, plan([fly_gent_kortrijk, get_zone_permit_kortrijk, fly_kortrijk_brugge, quick_charge_brugge, cross_corridor_brugge_oostende], 5000.0, 0.023, 0.95857796449800003, 0.9506969999999999, mid, yes,
|
|
15
|
-
gps_plan(d1, plan([fly_gent_kortrijk, get_zone_permit_kortrijk, fly_kortrijk_brugge, quick_charge_brugge, public_coastline_brugge_oostende], 5300.0, 0.025000000000000001, 0.95368726059749998, 0.91266911999999989, mid, yes,
|
|
16
|
-
gps_plan(d1, plan([fly_gent_kortrijk, get_zone_permit_kortrijk, emergency_charge_kortrijk, direct_corridor_kortrijk_oostende], 3500.0, 0.02, 0.94356004544999994, 0.86526000000000003, mid, yes,
|
|
17
|
-
gps_plan(d1, plan([fly_gent_kortrijk, emergency_charge_kortrijk, get_zone_permit_kortrijk, direct_corridor_kortrijk_oostende], 3500.0, 0.019999999999999997, 0.94356004544999994, 0.86526000000000003, mid, yes,
|
|
1
|
+
gps_plan(d1, plan([fly_gent_brugge, public_coastline_brugge_oostende], 2800.0, 0.012, 0.96029999999999993, 0.95039999999999991, low, none, "ttttt")).
|
|
2
|
+
gps_plan(d1, plan([fly_gent_brugge, buy_permit_brugge, public_coastline_brugge_oostende], 3250.0, 0.014, 0.94109399999999999, 0.95039999999999991, low, yes, "tttt")).
|
|
3
|
+
gps_plan(d1, plan([fly_gent_brugge, buy_permit_brugge, topup_brugge, cross_corridor_brugge_oostende], 3250.0, 0.015000000000000001, 0.94984520399999994, 0.97019999999999995, mid, yes, "ttt")).
|
|
4
|
+
gps_plan(d1, plan([fly_gent_brugge, buy_permit_brugge, topup_brugge, public_coastline_brugge_oostende], 3550.0, 0.017000000000000001, 0.94499905500000003, 0.931392, mid, yes, "ttt")).
|
|
5
|
+
gps_plan(d1, plan([fly_gent_brugge, topup_brugge, public_coastline_brugge_oostende], 3100.0, 0.015000000000000001, 0.96428475000000002, 0.931392, mid, none, "tttt")).
|
|
6
|
+
gps_plan(d1, plan([fly_gent_brugge, topup_brugge, buy_permit_brugge, cross_corridor_brugge_oostende], 3250.0, 0.015000000000000001, 0.94984520399999994, 0.97019999999999995, mid, yes, "ttt")).
|
|
7
|
+
gps_plan(d1, plan([fly_gent_brugge, topup_brugge, buy_permit_brugge, public_coastline_brugge_oostende], 3550.0, 0.017000000000000001, 0.94499905500000003, 0.931392, mid, yes, "ttt")).
|
|
8
|
+
gps_plan(d1, plan([train_gent_brugge, public_coastline_brugge_oostende], 2900.0, 0.018000000000000002, 0.97402500000000003, 0.95519999999999994, mid, none, "ttttt")).
|
|
9
|
+
gps_plan(d1, plan([train_gent_brugge, buy_permit_brugge, cross_corridor_brugge_oostende], 3050.0, 0.018000000000000002, 0.95943959999999995, 0.995, mid, yes, "tttt")).
|
|
10
|
+
gps_plan(d1, plan([train_gent_brugge, buy_permit_brugge, public_coastline_brugge_oostende], 3350.0, 0.02, 0.95454450000000002, 0.95519999999999994, mid, yes, "tttt")).
|
|
11
|
+
gps_plan(d1, plan([fly_gent_kortrijk, fly_kortrijk_brugge, buy_permit_brugge, quick_charge_brugge, cross_corridor_brugge_oostende], 5150.0, 0.024, 0.94034675195999995, 0.9506969999999999, mid, yes, "tt")).
|
|
12
|
+
gps_plan(d1, plan([fly_gent_kortrijk, fly_kortrijk_brugge, quick_charge_brugge, public_coastline_brugge_oostende], 5000.0, 0.024, 0.95464190250000003, 0.91266911999999989, mid, none, "ttt")).
|
|
13
|
+
gps_plan(d1, plan([fly_gent_kortrijk, fly_kortrijk_brugge, quick_charge_brugge, buy_permit_brugge, cross_corridor_brugge_oostende], 5150.0, 0.024, 0.94034675195999995, 0.9506969999999999, mid, yes, "tt")).
|
|
14
|
+
gps_plan(d1, plan([fly_gent_kortrijk, get_zone_permit_kortrijk, fly_kortrijk_brugge, quick_charge_brugge, cross_corridor_brugge_oostende], 5000.0, 0.023, 0.95857796449800003, 0.9506969999999999, mid, yes, "tt")).
|
|
15
|
+
gps_plan(d1, plan([fly_gent_kortrijk, get_zone_permit_kortrijk, fly_kortrijk_brugge, quick_charge_brugge, public_coastline_brugge_oostende], 5300.0, 0.025000000000000001, 0.95368726059749998, 0.91266911999999989, mid, yes, "tt")).
|
|
16
|
+
gps_plan(d1, plan([fly_gent_kortrijk, get_zone_permit_kortrijk, emergency_charge_kortrijk, direct_corridor_kortrijk_oostende], 3500.0, 0.02, 0.94356004544999994, 0.86526000000000003, mid, yes, "ttt")).
|
|
17
|
+
gps_plan(d1, plan([fly_gent_kortrijk, emergency_charge_kortrijk, get_zone_permit_kortrijk, direct_corridor_kortrijk_oostende], 3500.0, 0.019999999999999997, 0.94356004544999994, 0.86526000000000003, mid, yes, "ttt")).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
collectionLength(numbers, 3).
|
|
2
|
+
collectionMember(numbers, 1).
|
|
3
|
+
collectionMember(numbers, 2).
|
|
4
|
+
collectionMember(numbers, 3).
|
|
5
|
+
collectionAppend(letters, "abc").
|
|
6
6
|
head(letters, a).
|
|
7
|
-
tail(letters,
|
|
7
|
+
tail(letters, "b").
|
|
@@ -44,16 +44,16 @@ why(
|
|
|
44
44
|
)
|
|
45
45
|
).
|
|
46
46
|
|
|
47
|
-
tail(nativeList,
|
|
47
|
+
tail(nativeList, "bc").
|
|
48
48
|
why(
|
|
49
|
-
tail(nativeList,
|
|
49
|
+
tail(nativeList, "bc"),
|
|
50
50
|
proof(
|
|
51
|
-
goal(tail(nativeList,
|
|
51
|
+
goal(tail(nativeList, "bc")),
|
|
52
52
|
by(rule("aliases-and-namespaces.pl", clause(4))),
|
|
53
|
-
bindings([binding("Tail",
|
|
53
|
+
bindings([binding("Tail", "bc"), binding("_head", a)]),
|
|
54
54
|
uses([
|
|
55
55
|
proof(
|
|
56
|
-
goal(=(
|
|
56
|
+
goal(=("abc", "abc")),
|
|
57
57
|
by(builtin(=, 2))
|
|
58
58
|
)
|
|
59
59
|
])
|