eyeprolog 1.6.13 → 1.6.14
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/examples/output/takeuchi.pl +1 -1
- package/examples/proof/iso-reflective-terms.pl +80 -0
- package/examples/proof/iso-term-io.pl +87 -0
- package/examples/proof/sbom-vulnerability-response.pl +570 -0
- package/examples/proof/takeuchi.pl +1738 -0
- package/examples/takeuchi.pl +6 -1
- package/package.json +1 -1
- package/src/cli.js +1 -1
- package/src/explain.js +15 -1
- package/src/parser.js +18 -4
- package/src/result-format.js +44 -7
- package/test/regression/support.mjs +1 -1
- package/test/run-proof-checking.mjs +3 -14
- package/the-art-of-eyeprolog.md +1 -1
- package/why-eyeprolog.md +83 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
tak([
|
|
1
|
+
tak([16, 11, 6], 11).
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
report(shape, shape(event, 2)).
|
|
2
|
+
report(payload, reading(temperature, 21)).
|
|
3
|
+
report(parts, [event, sensor_7, reading(temperature, 21)]).
|
|
4
|
+
report(rebuilt, alert(sensor_7, high)).
|
|
5
|
+
report(variable_count, 3).
|
|
6
|
+
report(copied_shape, same_but_fresh).
|
|
7
|
+
report(order, <).
|
|
8
|
+
|
|
9
|
+
clause(1, sample(event(sensor_7, reading(temperature, 21))), true).
|
|
10
|
+
clause(2,
|
|
11
|
+
report(shape, shape(var('Name'), var('Arity'))),
|
|
12
|
+
(sample(var('Term')), functor(var('Term'), var('Name'), var('Arity')))).
|
|
13
|
+
clause(3,
|
|
14
|
+
report(payload, var('Payload')),
|
|
15
|
+
(sample(var('Term')), arg(2, var('Term'), var('Payload')))).
|
|
16
|
+
clause(4, report(parts, var('Parts')), (sample(var('Term')), var('Term') =.. var('Parts'))).
|
|
17
|
+
clause(5, report(rebuilt, var('Term')), var('Term') =.. [alert, sensor_7, high]).
|
|
18
|
+
clause(6,
|
|
19
|
+
report(variable_count, var('Count')),
|
|
20
|
+
(term_variables(rule(var('X'), pair(var('X'), anonymous(1)), anonymous(2)), var('Variables')),
|
|
21
|
+
var('Variables') = [anonymous(3), anonymous(4), anonymous(5)],
|
|
22
|
+
var('Count') = 3)).
|
|
23
|
+
clause(7,
|
|
24
|
+
report(copied_shape, same_but_fresh),
|
|
25
|
+
(copy_term(pair(var('X'), var('X')), pair(var('A'), var('B'))),
|
|
26
|
+
var('A') == var('B'),
|
|
27
|
+
var('X') \== var('A'))).
|
|
28
|
+
clause(8, report(order, var('Order')), compare(var('Order'), alpha, beta)).
|
|
29
|
+
|
|
30
|
+
step(report(shape, shape(event, 2)),
|
|
31
|
+
rule(2),
|
|
32
|
+
['Name' = event, 'Arity' = 2, 'Term' = event(sensor_7, reading(temperature, 21))],
|
|
33
|
+
[sample(event(sensor_7, reading(temperature, 21))),
|
|
34
|
+
functor(event(sensor_7, reading(temperature, 21)), event, 2)]).
|
|
35
|
+
step(sample(event(sensor_7, reading(temperature, 21))), fact(1), [], []).
|
|
36
|
+
step(functor(event(sensor_7, reading(temperature, 21)), event, 2), builtin, [], []).
|
|
37
|
+
step(report(payload, reading(temperature, 21)),
|
|
38
|
+
rule(3),
|
|
39
|
+
['Payload' = reading(temperature, 21), 'Term' = event(sensor_7, reading(temperature, 21))],
|
|
40
|
+
[sample(event(sensor_7, reading(temperature, 21))),
|
|
41
|
+
arg(2, event(sensor_7, reading(temperature, 21)), reading(temperature, 21))]).
|
|
42
|
+
step(arg(2, event(sensor_7, reading(temperature, 21)), reading(temperature, 21)),
|
|
43
|
+
builtin,
|
|
44
|
+
[],
|
|
45
|
+
[]).
|
|
46
|
+
step(report(parts, [event, sensor_7, reading(temperature, 21)]),
|
|
47
|
+
rule(4),
|
|
48
|
+
['Parts' = [event, sensor_7, reading(temperature, 21)],
|
|
49
|
+
'Term' = event(sensor_7, reading(temperature, 21))],
|
|
50
|
+
[sample(event(sensor_7, reading(temperature, 21))),
|
|
51
|
+
event(sensor_7, reading(temperature, 21)) =.. [event, sensor_7, reading(temperature, 21)]]).
|
|
52
|
+
step(event(sensor_7, reading(temperature, 21)) =.. [event, sensor_7, reading(temperature, 21)],
|
|
53
|
+
builtin,
|
|
54
|
+
[],
|
|
55
|
+
[]).
|
|
56
|
+
step(report(rebuilt, alert(sensor_7, high)),
|
|
57
|
+
rule(5),
|
|
58
|
+
['Term' = alert(sensor_7, high)],
|
|
59
|
+
[alert(sensor_7, high) =.. [alert, sensor_7, high]]).
|
|
60
|
+
step(alert(sensor_7, high) =.. [alert, sensor_7, high], builtin, [], []).
|
|
61
|
+
step(report(variable_count, 3),
|
|
62
|
+
rule(6),
|
|
63
|
+
['Count' = 3, 'Variables' = [__anon0, __anon1, __anon2]],
|
|
64
|
+
[term_variables(rule(X, pair(X, _Y), _Z), [X, _Y, _Z]),
|
|
65
|
+
[__anon0, __anon1, __anon2] = [__anon0, __anon1, __anon2],
|
|
66
|
+
3 = 3]).
|
|
67
|
+
step(term_variables(rule(X, pair(X, _Y), _Z), [X, _Y, _Z]), builtin, [], []).
|
|
68
|
+
step([__anon0, __anon1, __anon2] = [__anon0, __anon1, __anon2], builtin, [], []).
|
|
69
|
+
step(3 = 3, builtin, [], []).
|
|
70
|
+
step(report(copied_shape, same_but_fresh),
|
|
71
|
+
rule(7),
|
|
72
|
+
[],
|
|
73
|
+
[copy_term(pair(X, X), pair(__copy1_0, __copy1_0)),
|
|
74
|
+
__copy1_0 == __copy1_0,
|
|
75
|
+
X \== __copy1_0]).
|
|
76
|
+
step(copy_term(pair(X, X), pair(__copy1_0, __copy1_0)), builtin, [], []).
|
|
77
|
+
step(__copy1_0 == __copy1_0, builtin, [], []).
|
|
78
|
+
step(X \== __copy1_0, builtin, [], []).
|
|
79
|
+
step(report(order, <), rule(8), ['Order' = (<)], [compare(<, alpha, beta)]).
|
|
80
|
+
step(compare(<, alpha, beta), builtin, [], []).
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
report(first_term, event(sensor_7, online)).
|
|
2
|
+
report(variable_metadata, checked).
|
|
3
|
+
report(reached_end, yes).
|
|
4
|
+
|
|
5
|
+
clause(2, fixture_path('/tmp/eyeprolog-iso-term-io-example.pl'), true).
|
|
6
|
+
clause(4,
|
|
7
|
+
report(first_term, var('Term')),
|
|
8
|
+
(fixture_path(var('Path')),
|
|
9
|
+
open(var('Path'), read, var('Stream'), []),
|
|
10
|
+
read(var('Stream'), var('Term')),
|
|
11
|
+
close(var('Stream')))).
|
|
12
|
+
clause(5,
|
|
13
|
+
report(variable_metadata, checked),
|
|
14
|
+
(fixture_path(var('Path')),
|
|
15
|
+
open(var('Path'), read, var('Stream'), []),
|
|
16
|
+
read(var('Stream'), anonymous(1)),
|
|
17
|
+
read_term(var('Stream'), rule(var('A'), var('A'), var('B')), [variables([var('A'), var('B')]), variable_names([var('NameA') = var('A'), var('NameB') = var('B')]), singletons([var('NameB') = var('B')])]),
|
|
18
|
+
atom(var('NameA')),
|
|
19
|
+
atom(var('NameB')),
|
|
20
|
+
var('NameA') \== var('NameB'),
|
|
21
|
+
close(var('Stream')))).
|
|
22
|
+
clause(6,
|
|
23
|
+
report(reached_end, yes),
|
|
24
|
+
(fixture_path(var('Path')),
|
|
25
|
+
open(var('Path'), read, var('Stream'), [eof_action(eof_code)]),
|
|
26
|
+
read(var('Stream'), anonymous(1)),
|
|
27
|
+
read(var('Stream'), anonymous(2)),
|
|
28
|
+
read(var('Stream'), end_of_file),
|
|
29
|
+
at_end_of_stream(var('Stream')),
|
|
30
|
+
close(var('Stream')))).
|
|
31
|
+
|
|
32
|
+
step(report(first_term, event(sensor_7, online)),
|
|
33
|
+
rule(4),
|
|
34
|
+
['Term' = event(sensor_7, online),
|
|
35
|
+
'Path' = '/tmp/eyeprolog-iso-term-io-example.pl',
|
|
36
|
+
'Stream' = '$stream'(1)],
|
|
37
|
+
[fixture_path('/tmp/eyeprolog-iso-term-io-example.pl'),
|
|
38
|
+
open('/tmp/eyeprolog-iso-term-io-example.pl', read, '$stream'(1), []),
|
|
39
|
+
read('$stream'(1), event(sensor_7, online)),
|
|
40
|
+
close('$stream'(1))]).
|
|
41
|
+
step(fixture_path('/tmp/eyeprolog-iso-term-io-example.pl'), fact(2), [], []).
|
|
42
|
+
step(open('/tmp/eyeprolog-iso-term-io-example.pl', read, '$stream'(1), []), builtin, [], []).
|
|
43
|
+
step(read('$stream'(1), event(sensor_7, online)), builtin, [], []).
|
|
44
|
+
step(close('$stream'(1)), builtin, [], []).
|
|
45
|
+
step(report(variable_metadata, checked),
|
|
46
|
+
rule(5),
|
|
47
|
+
['Path' = '/tmp/eyeprolog-iso-term-io-example.pl',
|
|
48
|
+
'Stream' = '$stream'(2),
|
|
49
|
+
'NameA' = '_A',
|
|
50
|
+
'NameB' = '_B'],
|
|
51
|
+
[fixture_path('/tmp/eyeprolog-iso-term-io-example.pl'),
|
|
52
|
+
open('/tmp/eyeprolog-iso-term-io-example.pl', read, '$stream'(2), []),
|
|
53
|
+
read('$stream'(2), event(sensor_7, online)),
|
|
54
|
+
read_term('$stream'(2), rule(_read_3_0, _read_3_0, _read_3_1), [variables([_read_3_0, _read_3_1]), variable_names(['_A' = _read_3_0, '_B' = _read_3_1]), singletons(['_B' = _read_3_1])]),
|
|
55
|
+
atom('_A'),
|
|
56
|
+
atom('_B'),
|
|
57
|
+
'_A' \== '_B',
|
|
58
|
+
close('$stream'(2))]).
|
|
59
|
+
step(open('/tmp/eyeprolog-iso-term-io-example.pl', read, '$stream'(2), []), builtin, [], []).
|
|
60
|
+
step(read('$stream'(2), event(sensor_7, online)), builtin, [], []).
|
|
61
|
+
step(read_term('$stream'(2), rule(_read_3_0, _read_3_0, _read_3_1), [variables([_read_3_0, _read_3_1]), variable_names(['_A' = _read_3_0, '_B' = _read_3_1]), singletons(['_B' = _read_3_1])]),
|
|
62
|
+
builtin,
|
|
63
|
+
[],
|
|
64
|
+
[]).
|
|
65
|
+
step(atom('_A'), builtin, [], []).
|
|
66
|
+
step(atom('_B'), builtin, [], []).
|
|
67
|
+
step('_A' \== '_B', builtin, [], []).
|
|
68
|
+
step(close('$stream'(2)), builtin, [], []).
|
|
69
|
+
step(report(reached_end, yes),
|
|
70
|
+
rule(6),
|
|
71
|
+
['Path' = '/tmp/eyeprolog-iso-term-io-example.pl', 'Stream' = '$stream'(4)],
|
|
72
|
+
[fixture_path('/tmp/eyeprolog-iso-term-io-example.pl'),
|
|
73
|
+
open('/tmp/eyeprolog-iso-term-io-example.pl', read, '$stream'(4), [eof_action(eof_code)]),
|
|
74
|
+
read('$stream'(4), event(sensor_7, online)),
|
|
75
|
+
read('$stream'(4), rule(_read_5_0, _read_5_0, _read_5_1)),
|
|
76
|
+
read('$stream'(4), end_of_file),
|
|
77
|
+
at_end_of_stream('$stream'(4)),
|
|
78
|
+
close('$stream'(4))]).
|
|
79
|
+
step(open('/tmp/eyeprolog-iso-term-io-example.pl', read, '$stream'(4), [eof_action(eof_code)]),
|
|
80
|
+
builtin,
|
|
81
|
+
[],
|
|
82
|
+
[]).
|
|
83
|
+
step(read('$stream'(4), event(sensor_7, online)), builtin, [], []).
|
|
84
|
+
step(read('$stream'(4), rule(_read_5_0, _read_5_0, _read_5_1)), builtin, [], []).
|
|
85
|
+
step(read('$stream'(4), end_of_file), builtin, [], []).
|
|
86
|
+
step(at_end_of_stream('$stream'(4)), builtin, [], []).
|
|
87
|
+
step(close('$stream'(4)), builtin, [], []).
|