eyeprolog 1.2.24 → 1.2.26
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/access-control-policy.pl +2 -0
- package/examples/output/d3-group.pl +2 -2
- package/examples/output/map-four-color-search.pl +1 -0
- package/examples/output/partial-evaluator.pl +3 -0
- package/examples/output/weighted-interval-scheduling.pl +4 -0
- package/examples/proof/access-control-policy.pl +158 -0
- package/examples/proof/d3-group.pl +17 -17
- package/examples/proof/partial-evaluator.pl +359 -0
- package/examples/proof/weighted-interval-scheduling.pl +8388 -0
- package/package.json +3 -1
- package/src/iso.js +31 -30
- package/src/parser.js +238 -77
- package/src/program.js +2 -1
- package/src/repl.js +10 -32
- package/src/syntax-scan.js +54 -0
- package/src/write.js +19 -2
- package/test/conformance/ISO-COMPLIANCE.md +6 -5
- package/test/conformance/WG17-SYNTAX-STATUS.md +42 -0
- package/test/conformance/cases/iso/wg17_syntax_high_risk.pl +5 -1
- package/test/conformance/expected/iso/wg17_syntax_high_risk.pl +1 -0
- package/test/conformance/wg17-syntax-cases.json +5564 -0
- package/test/conformance/wg17-syntax-coverage.json +18 -0
- package/test/run-all.mjs +2 -0
- package/test/run-regression.mjs +96 -1
- package/test/run-wg17-syntax.mjs +106 -0
- package/tools/report-wg17-syntax-coverage.mjs +141 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
subgroups(d3_group, []).
|
|
2
|
-
subgroupCount(d3_group,
|
|
1
|
+
subgroups(d3_group, [[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]]).
|
|
2
|
+
subgroupCount(d3_group, 6).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
four_color_answer(european_union, [[belgium, yellow], [netherlands, green], [luxemburg, green], [france, blue], [germany, red], [italy, red], [denmark, green], [ireland, red], [greece, red], [spain, green], [portugal, red], [austria, yellow], [sweden, green], [finland, red], [cyprus, red], [malta, red], [poland, blue], [hungary, blue], [czech_republic, green], [slovakia, red], [slovenia, green], [estonia, red], [latvia, green], [lithuania, red], [bulgaria, green], [romania, red], [croatia, red]]).
|
|
@@ -1 +1,4 @@
|
|
|
1
|
+
partialEvalAnswer(residual(poly_y), add(mul(const(10), var(y)), const(13))).
|
|
1
2
|
partialEvalAnswer(residual(static_branch), const(11)).
|
|
3
|
+
partialEvalAnswer(residual(dynamic_branch), if(var(flag), const(11), mul(var(y), const(2)))).
|
|
4
|
+
partialEvalAnswer(note, "static inputs are folded while dynamic variables remain as residual code").
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
weighted_interval_answer(best_value, 13).
|
|
2
|
+
weighted_interval_answer(chosen_interval, interval(1, 1, 4, 5)).
|
|
3
|
+
weighted_interval_answer(chosen_interval, interval(4, 4, 7, 4)).
|
|
4
|
+
weighted_interval_answer(chosen_interval, interval(8, 8, 11, 4)).
|
|
1
5
|
weighted_interval_answer(candidate_count, 8).
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
status(test1, policy_passed).
|
|
2
|
+
why(
|
|
3
|
+
status(test1, policy_passed),
|
|
4
|
+
proof(
|
|
5
|
+
goal(status(test1, policy_passed)),
|
|
6
|
+
by(rule("access-control-policy.pl", clause(15))),
|
|
7
|
+
uses([
|
|
8
|
+
proof(
|
|
9
|
+
goal(passes_policy(test1, policy_x)),
|
|
10
|
+
by(rule("access-control-policy.pl", clause(13))),
|
|
11
|
+
bindings([binding("Request", test1), binding("Policy", policy_x)]),
|
|
12
|
+
uses([
|
|
13
|
+
proof(
|
|
14
|
+
goal(passes_all_of(test1, policy_x)),
|
|
15
|
+
by(rule("access-control-policy.pl", clause(10))),
|
|
16
|
+
bindings([binding("Request", test1), binding("Policy", policy_x)]),
|
|
17
|
+
uses([
|
|
18
|
+
proof(
|
|
19
|
+
goal(policy_request(test1, policy_x)),
|
|
20
|
+
by(fact("access-control-policy.pl", clause(1)))
|
|
21
|
+
),
|
|
22
|
+
proof(
|
|
23
|
+
goal(policy(policy_x)),
|
|
24
|
+
by(fact("access-control-policy.pl", clause(5)))
|
|
25
|
+
),
|
|
26
|
+
proof(
|
|
27
|
+
goal('\\+'((allOf(policy_x, Claim), '\\+'(has(test1, Claim))))),
|
|
28
|
+
by(builtin('\\+', 1))
|
|
29
|
+
)
|
|
30
|
+
])
|
|
31
|
+
),
|
|
32
|
+
proof(
|
|
33
|
+
goal(passes_any_of(test1, policy_x)),
|
|
34
|
+
by(rule("access-control-policy.pl", clause(11))),
|
|
35
|
+
bindings([binding("Request", test1), binding("Policy", policy_x), binding("Claim", claim_c)]),
|
|
36
|
+
uses([
|
|
37
|
+
proof(
|
|
38
|
+
goal(policy_request(test1, policy_x)),
|
|
39
|
+
by(fact("access-control-policy.pl", clause(1)))
|
|
40
|
+
),
|
|
41
|
+
proof(
|
|
42
|
+
goal(policy(policy_x)),
|
|
43
|
+
by(fact("access-control-policy.pl", clause(5)))
|
|
44
|
+
),
|
|
45
|
+
proof(
|
|
46
|
+
goal(anyOf(policy_x, claim_c)),
|
|
47
|
+
by(fact("access-control-policy.pl", clause(8)))
|
|
48
|
+
),
|
|
49
|
+
proof(
|
|
50
|
+
goal(has(test1, claim_c)),
|
|
51
|
+
by(fact("access-control-policy.pl", clause(4)))
|
|
52
|
+
)
|
|
53
|
+
])
|
|
54
|
+
),
|
|
55
|
+
proof(
|
|
56
|
+
goal(passes_none_of(test1, policy_x)),
|
|
57
|
+
by(rule("access-control-policy.pl", clause(12))),
|
|
58
|
+
bindings([binding("Request", test1), binding("Policy", policy_x)]),
|
|
59
|
+
uses([
|
|
60
|
+
proof(
|
|
61
|
+
goal(policy_request(test1, policy_x)),
|
|
62
|
+
by(fact("access-control-policy.pl", clause(1)))
|
|
63
|
+
),
|
|
64
|
+
proof(
|
|
65
|
+
goal(policy(policy_x)),
|
|
66
|
+
by(fact("access-control-policy.pl", clause(5)))
|
|
67
|
+
),
|
|
68
|
+
proof(
|
|
69
|
+
goal('\\+'((noneOf(policy_x, Claim), has(test1, Claim)))),
|
|
70
|
+
by(builtin('\\+', 1))
|
|
71
|
+
)
|
|
72
|
+
])
|
|
73
|
+
)
|
|
74
|
+
])
|
|
75
|
+
)
|
|
76
|
+
])
|
|
77
|
+
)
|
|
78
|
+
).
|
|
79
|
+
|
|
80
|
+
reason(test1, "all required claims are present, one allowed claim is present, and no forbidden claim is present").
|
|
81
|
+
why(
|
|
82
|
+
reason(test1, "all required claims are present, one allowed claim is present, and no forbidden claim is present"),
|
|
83
|
+
proof(
|
|
84
|
+
goal(reason(test1, "all required claims are present, one allowed claim is present, and no forbidden claim is present")),
|
|
85
|
+
by(rule("access-control-policy.pl", clause(16))),
|
|
86
|
+
uses([
|
|
87
|
+
proof(
|
|
88
|
+
goal(passes_policy(test1, policy_x)),
|
|
89
|
+
by(rule("access-control-policy.pl", clause(13))),
|
|
90
|
+
bindings([binding("Request", test1), binding("Policy", policy_x)]),
|
|
91
|
+
uses([
|
|
92
|
+
proof(
|
|
93
|
+
goal(passes_all_of(test1, policy_x)),
|
|
94
|
+
by(rule("access-control-policy.pl", clause(10))),
|
|
95
|
+
bindings([binding("Request", test1), binding("Policy", policy_x)]),
|
|
96
|
+
uses([
|
|
97
|
+
proof(
|
|
98
|
+
goal(policy_request(test1, policy_x)),
|
|
99
|
+
by(fact("access-control-policy.pl", clause(1)))
|
|
100
|
+
),
|
|
101
|
+
proof(
|
|
102
|
+
goal(policy(policy_x)),
|
|
103
|
+
by(fact("access-control-policy.pl", clause(5)))
|
|
104
|
+
),
|
|
105
|
+
proof(
|
|
106
|
+
goal('\\+'((allOf(policy_x, Claim), '\\+'(has(test1, Claim))))),
|
|
107
|
+
by(builtin('\\+', 1))
|
|
108
|
+
)
|
|
109
|
+
])
|
|
110
|
+
),
|
|
111
|
+
proof(
|
|
112
|
+
goal(passes_any_of(test1, policy_x)),
|
|
113
|
+
by(rule("access-control-policy.pl", clause(11))),
|
|
114
|
+
bindings([binding("Request", test1), binding("Policy", policy_x), binding("Claim", claim_c)]),
|
|
115
|
+
uses([
|
|
116
|
+
proof(
|
|
117
|
+
goal(policy_request(test1, policy_x)),
|
|
118
|
+
by(fact("access-control-policy.pl", clause(1)))
|
|
119
|
+
),
|
|
120
|
+
proof(
|
|
121
|
+
goal(policy(policy_x)),
|
|
122
|
+
by(fact("access-control-policy.pl", clause(5)))
|
|
123
|
+
),
|
|
124
|
+
proof(
|
|
125
|
+
goal(anyOf(policy_x, claim_c)),
|
|
126
|
+
by(fact("access-control-policy.pl", clause(8)))
|
|
127
|
+
),
|
|
128
|
+
proof(
|
|
129
|
+
goal(has(test1, claim_c)),
|
|
130
|
+
by(fact("access-control-policy.pl", clause(4)))
|
|
131
|
+
)
|
|
132
|
+
])
|
|
133
|
+
),
|
|
134
|
+
proof(
|
|
135
|
+
goal(passes_none_of(test1, policy_x)),
|
|
136
|
+
by(rule("access-control-policy.pl", clause(12))),
|
|
137
|
+
bindings([binding("Request", test1), binding("Policy", policy_x)]),
|
|
138
|
+
uses([
|
|
139
|
+
proof(
|
|
140
|
+
goal(policy_request(test1, policy_x)),
|
|
141
|
+
by(fact("access-control-policy.pl", clause(1)))
|
|
142
|
+
),
|
|
143
|
+
proof(
|
|
144
|
+
goal(policy(policy_x)),
|
|
145
|
+
by(fact("access-control-policy.pl", clause(5)))
|
|
146
|
+
),
|
|
147
|
+
proof(
|
|
148
|
+
goal('\\+'((noneOf(policy_x, Claim), has(test1, Claim)))),
|
|
149
|
+
by(builtin('\\+', 1))
|
|
150
|
+
)
|
|
151
|
+
])
|
|
152
|
+
)
|
|
153
|
+
])
|
|
154
|
+
)
|
|
155
|
+
])
|
|
156
|
+
)
|
|
157
|
+
).
|
|
158
|
+
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
subgroups(d3_group, []).
|
|
1
|
+
subgroups(d3_group, [[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]]).
|
|
2
2
|
why(
|
|
3
|
-
subgroups(d3_group, []),
|
|
3
|
+
subgroups(d3_group, [[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]]),
|
|
4
4
|
proof(
|
|
5
|
-
goal(subgroups(d3_group, [])),
|
|
5
|
+
goal(subgroups(d3_group, [[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]])),
|
|
6
6
|
by(rule("d3-group.pl", clause(57))),
|
|
7
|
-
bindings([binding("Groups", [])]),
|
|
7
|
+
bindings([binding("Groups", [[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]])]),
|
|
8
8
|
uses([
|
|
9
9
|
proof(
|
|
10
|
-
goal(all_subgroups([])),
|
|
10
|
+
goal(all_subgroups([[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]])),
|
|
11
11
|
by(rule("d3-group.pl", clause(56))),
|
|
12
|
-
bindings([binding("Groups", []), binding("Raw", [])]),
|
|
12
|
+
bindings([binding("Groups", [[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]]), binding("Raw", [[identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_a], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240], [identity]])]),
|
|
13
13
|
uses([
|
|
14
14
|
proof(
|
|
15
|
-
goal(findall(G, valid_group(G), [])),
|
|
15
|
+
goal(findall(G, valid_group(G), [[identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_a], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240], [identity]])),
|
|
16
16
|
by(builtin(findall, 3))
|
|
17
17
|
),
|
|
18
18
|
proof(
|
|
19
|
-
goal(sort([], [])),
|
|
19
|
+
goal(sort([[identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_a], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240], [identity]], [[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]])),
|
|
20
20
|
by(builtin(sort, 2))
|
|
21
21
|
)
|
|
22
22
|
])
|
|
@@ -25,31 +25,31 @@ why(
|
|
|
25
25
|
)
|
|
26
26
|
).
|
|
27
27
|
|
|
28
|
-
subgroupCount(d3_group,
|
|
28
|
+
subgroupCount(d3_group, 6).
|
|
29
29
|
why(
|
|
30
|
-
subgroupCount(d3_group,
|
|
30
|
+
subgroupCount(d3_group, 6),
|
|
31
31
|
proof(
|
|
32
|
-
goal(subgroupCount(d3_group,
|
|
32
|
+
goal(subgroupCount(d3_group, 6)),
|
|
33
33
|
by(rule("d3-group.pl", clause(58))),
|
|
34
|
-
bindings([binding("Count",
|
|
34
|
+
bindings([binding("Count", 6), binding("Groups", [[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]])]),
|
|
35
35
|
uses([
|
|
36
36
|
proof(
|
|
37
|
-
goal(all_subgroups([])),
|
|
37
|
+
goal(all_subgroups([[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]])),
|
|
38
38
|
by(rule("d3-group.pl", clause(56))),
|
|
39
|
-
bindings([binding("Groups", []), binding("Raw", [])]),
|
|
39
|
+
bindings([binding("Groups", [[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]]), binding("Raw", [[identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_a], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240], [identity]])]),
|
|
40
40
|
uses([
|
|
41
41
|
proof(
|
|
42
|
-
goal(findall(G, valid_group(G), [])),
|
|
42
|
+
goal(findall(G, valid_group(G), [[identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_a], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240], [identity]])),
|
|
43
43
|
by(builtin(findall, 3))
|
|
44
44
|
),
|
|
45
45
|
proof(
|
|
46
|
-
goal(sort([], [])),
|
|
46
|
+
goal(sort([[identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_a], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240], [identity]], [[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]])),
|
|
47
47
|
by(builtin(sort, 2))
|
|
48
48
|
)
|
|
49
49
|
])
|
|
50
50
|
),
|
|
51
51
|
proof(
|
|
52
|
-
goal(length([],
|
|
52
|
+
goal(length([[identity], [identity, reflection_a], [identity, reflection_a, reflection_b, reflection_c, rotation_120, rotation_240], [identity, reflection_b], [identity, reflection_c], [identity, rotation_120, rotation_240]], 6)),
|
|
53
53
|
by(library(length, 2))
|
|
54
54
|
)
|
|
55
55
|
])
|
|
@@ -1,3 +1,120 @@
|
|
|
1
|
+
partialEvalAnswer(residual(poly_y), add(mul(const(10), var(y)), const(13))).
|
|
2
|
+
why(
|
|
3
|
+
partialEvalAnswer(residual(poly_y), add(mul(const(10), var(y)), const(13))),
|
|
4
|
+
proof(
|
|
5
|
+
goal(partialEvalAnswer(residual(poly_y), add(mul(const(10), var(y)), const(13)))),
|
|
6
|
+
by(rule("partial-evaluator.pl", clause(20))),
|
|
7
|
+
bindings([binding("Name", poly_y), binding("Residual", add(mul(const(10), var(y)), const(13)))]),
|
|
8
|
+
uses([
|
|
9
|
+
proof(
|
|
10
|
+
goal(residual_program(poly_y, add(mul(const(10), var(y)), const(13)))),
|
|
11
|
+
by(rule("partial-evaluator.pl", clause(19))),
|
|
12
|
+
bindings([binding("Name", poly_y), binding("Residual", add(mul(const(10), var(y)), const(13))), binding("Expr", add(mul(var(x), var(y)), add(var(x), const(3)))), binding("Env", [bind(x, const(10))])]),
|
|
13
|
+
uses([
|
|
14
|
+
proof(
|
|
15
|
+
goal(program(poly_y, add(mul(var(x), var(y)), add(var(x), const(3))), [bind(x, const(10))])),
|
|
16
|
+
by(fact("partial-evaluator.pl", clause(1)))
|
|
17
|
+
),
|
|
18
|
+
proof(
|
|
19
|
+
goal(pe([bind(x, const(10))], add(mul(var(x), var(y)), add(var(x), const(3))), add(mul(const(10), var(y)), const(13)))),
|
|
20
|
+
by(rule("partial-evaluator.pl", clause(14))),
|
|
21
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Left", mul(var(x), var(y))), binding("Right", add(var(x), const(3))), binding("Left_residual", mul(const(10), var(y))), binding("Right_residual", const(13))]),
|
|
22
|
+
uses([
|
|
23
|
+
proof(
|
|
24
|
+
goal(pe([bind(x, const(10))], mul(var(x), var(y)), mul(const(10), var(y)))),
|
|
25
|
+
by(rule("partial-evaluator.pl", clause(15))),
|
|
26
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Left", var(x)), binding("Right", var(y)), binding("Left_residual", const(10)), binding("Right_residual", var(y))]),
|
|
27
|
+
uses([
|
|
28
|
+
proof(
|
|
29
|
+
goal(pe([bind(x, const(10))], var(x), const(10))),
|
|
30
|
+
by(rule("partial-evaluator.pl", clause(10))),
|
|
31
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", x), binding("Value", const(10))]),
|
|
32
|
+
uses([
|
|
33
|
+
proof(
|
|
34
|
+
goal(known_var([bind(x, const(10))], x, const(10))),
|
|
35
|
+
by(rule("partial-evaluator.pl", clause(6))),
|
|
36
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", x), binding("Value", const(10))]),
|
|
37
|
+
uses([
|
|
38
|
+
proof(
|
|
39
|
+
goal(lookup(x, [bind(x, const(10))], const(10))),
|
|
40
|
+
by(fact("partial-evaluator.pl", clause(4))),
|
|
41
|
+
bindings([binding("Name", x), binding("Value", const(10)), binding("__anon0", [])])
|
|
42
|
+
)
|
|
43
|
+
])
|
|
44
|
+
)
|
|
45
|
+
])
|
|
46
|
+
),
|
|
47
|
+
proof(
|
|
48
|
+
goal(pe([bind(x, const(10))], var(y), var(y))),
|
|
49
|
+
by(rule("partial-evaluator.pl", clause(11))),
|
|
50
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", y)]),
|
|
51
|
+
uses([
|
|
52
|
+
proof(
|
|
53
|
+
goal(unknown_var([bind(x, const(10))], y)),
|
|
54
|
+
by(rule("partial-evaluator.pl", clause(7))),
|
|
55
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", y)]),
|
|
56
|
+
uses([
|
|
57
|
+
proof(
|
|
58
|
+
goal('\\+'(known_var([bind(x, const(10))], y, __anon3))),
|
|
59
|
+
by(builtin('\\+', 1))
|
|
60
|
+
)
|
|
61
|
+
])
|
|
62
|
+
)
|
|
63
|
+
])
|
|
64
|
+
),
|
|
65
|
+
proof(
|
|
66
|
+
goal('\\+'((=(const(10), const(A)), =(var(y), const(B))))),
|
|
67
|
+
by(builtin('\\+', 1))
|
|
68
|
+
)
|
|
69
|
+
])
|
|
70
|
+
),
|
|
71
|
+
proof(
|
|
72
|
+
goal(pe([bind(x, const(10))], add(var(x), const(3)), const(13))),
|
|
73
|
+
by(rule("partial-evaluator.pl", clause(12))),
|
|
74
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Left", var(x)), binding("Right", const(3)), binding("Sum", 13), binding("A", 10), binding("B", 3)]),
|
|
75
|
+
uses([
|
|
76
|
+
proof(
|
|
77
|
+
goal(pe([bind(x, const(10))], var(x), const(10))),
|
|
78
|
+
by(rule("partial-evaluator.pl", clause(10))),
|
|
79
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", x), binding("Value", const(10))]),
|
|
80
|
+
uses([
|
|
81
|
+
proof(
|
|
82
|
+
goal(known_var([bind(x, const(10))], x, const(10))),
|
|
83
|
+
by(rule("partial-evaluator.pl", clause(6))),
|
|
84
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", x), binding("Value", const(10))]),
|
|
85
|
+
uses([
|
|
86
|
+
proof(
|
|
87
|
+
goal(lookup(x, [bind(x, const(10))], const(10))),
|
|
88
|
+
by(fact("partial-evaluator.pl", clause(4))),
|
|
89
|
+
bindings([binding("Name", x), binding("Value", const(10)), binding("__anon0", [])])
|
|
90
|
+
)
|
|
91
|
+
])
|
|
92
|
+
)
|
|
93
|
+
])
|
|
94
|
+
),
|
|
95
|
+
proof(
|
|
96
|
+
goal(pe([bind(x, const(10))], const(3), const(3))),
|
|
97
|
+
by(fact("partial-evaluator.pl", clause(8))),
|
|
98
|
+
bindings([binding("__anon4", [bind(x, const(10))]), binding("N", 3)])
|
|
99
|
+
),
|
|
100
|
+
proof(
|
|
101
|
+
goal(is(13, '+'(10, 3))),
|
|
102
|
+
by(builtin(is, 2))
|
|
103
|
+
)
|
|
104
|
+
])
|
|
105
|
+
),
|
|
106
|
+
proof(
|
|
107
|
+
goal('\\+'((=(mul(const(10), var(y)), const(A)), =(const(13), const(B))))),
|
|
108
|
+
by(builtin('\\+', 1))
|
|
109
|
+
)
|
|
110
|
+
])
|
|
111
|
+
)
|
|
112
|
+
])
|
|
113
|
+
)
|
|
114
|
+
])
|
|
115
|
+
)
|
|
116
|
+
).
|
|
117
|
+
|
|
1
118
|
partialEvalAnswer(residual(static_branch), const(11)).
|
|
2
119
|
why(
|
|
3
120
|
partialEvalAnswer(residual(static_branch), const(11)),
|
|
@@ -68,3 +185,245 @@ why(
|
|
|
68
185
|
)
|
|
69
186
|
).
|
|
70
187
|
|
|
188
|
+
partialEvalAnswer(residual(dynamic_branch), if(var(flag), const(11), mul(var(y), const(2)))).
|
|
189
|
+
why(
|
|
190
|
+
partialEvalAnswer(residual(dynamic_branch), if(var(flag), const(11), mul(var(y), const(2)))),
|
|
191
|
+
proof(
|
|
192
|
+
goal(partialEvalAnswer(residual(dynamic_branch), if(var(flag), const(11), mul(var(y), const(2))))),
|
|
193
|
+
by(rule("partial-evaluator.pl", clause(20))),
|
|
194
|
+
bindings([binding("Name", dynamic_branch), binding("Residual", if(var(flag), const(11), mul(var(y), const(2))))]),
|
|
195
|
+
uses([
|
|
196
|
+
proof(
|
|
197
|
+
goal(residual_program(dynamic_branch, if(var(flag), const(11), mul(var(y), const(2))))),
|
|
198
|
+
by(rule("partial-evaluator.pl", clause(19))),
|
|
199
|
+
bindings([binding("Name", dynamic_branch), binding("Residual", if(var(flag), const(11), mul(var(y), const(2)))), binding("Expr", if(var(flag), add(var(x), const(1)), mul(var(y), const(2)))), binding("Env", [bind(x, const(10))])]),
|
|
200
|
+
uses([
|
|
201
|
+
proof(
|
|
202
|
+
goal(program(dynamic_branch, if(var(flag), add(var(x), const(1)), mul(var(y), const(2))), [bind(x, const(10))])),
|
|
203
|
+
by(fact("partial-evaluator.pl", clause(3)))
|
|
204
|
+
),
|
|
205
|
+
proof(
|
|
206
|
+
goal(pe([bind(x, const(10))], if(var(flag), add(var(x), const(1)), mul(var(y), const(2))), if(var(flag), const(11), mul(var(y), const(2))))),
|
|
207
|
+
by(rule("partial-evaluator.pl", clause(18))),
|
|
208
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Cond", var(flag)), binding("Then", add(var(x), const(1))), binding("Else", mul(var(y), const(2))), binding("Cond_residual", var(flag)), binding("Then_residual", const(11)), binding("Else_residual", mul(var(y), const(2)))]),
|
|
209
|
+
uses([
|
|
210
|
+
proof(
|
|
211
|
+
goal(pe([bind(x, const(10))], var(flag), var(flag))),
|
|
212
|
+
by(rule("partial-evaluator.pl", clause(11))),
|
|
213
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", flag)]),
|
|
214
|
+
uses([
|
|
215
|
+
proof(
|
|
216
|
+
goal(unknown_var([bind(x, const(10))], flag)),
|
|
217
|
+
by(rule("partial-evaluator.pl", clause(7))),
|
|
218
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", flag)]),
|
|
219
|
+
uses([
|
|
220
|
+
proof(
|
|
221
|
+
goal('\\+'(known_var([bind(x, const(10))], flag, __anon3))),
|
|
222
|
+
by(builtin('\\+', 1))
|
|
223
|
+
)
|
|
224
|
+
])
|
|
225
|
+
)
|
|
226
|
+
])
|
|
227
|
+
),
|
|
228
|
+
proof(
|
|
229
|
+
goal('\\+'(=(var(flag), bool(true)))),
|
|
230
|
+
by(builtin('\\+', 1))
|
|
231
|
+
),
|
|
232
|
+
proof(
|
|
233
|
+
goal('\\+'(=(var(flag), bool(false)))),
|
|
234
|
+
by(builtin('\\+', 1))
|
|
235
|
+
),
|
|
236
|
+
proof(
|
|
237
|
+
goal(pe([bind(x, const(10))], add(var(x), const(1)), const(11))),
|
|
238
|
+
by(rule("partial-evaluator.pl", clause(12))),
|
|
239
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Left", var(x)), binding("Right", const(1)), binding("Sum", 11), binding("A", 10), binding("B", 1)]),
|
|
240
|
+
uses([
|
|
241
|
+
proof(
|
|
242
|
+
goal(pe([bind(x, const(10))], var(x), const(10))),
|
|
243
|
+
by(rule("partial-evaluator.pl", clause(10))),
|
|
244
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", x), binding("Value", const(10))]),
|
|
245
|
+
uses([
|
|
246
|
+
proof(
|
|
247
|
+
goal(known_var([bind(x, const(10))], x, const(10))),
|
|
248
|
+
by(rule("partial-evaluator.pl", clause(6))),
|
|
249
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", x), binding("Value", const(10))]),
|
|
250
|
+
uses([
|
|
251
|
+
proof(
|
|
252
|
+
goal(lookup(x, [bind(x, const(10))], const(10))),
|
|
253
|
+
by(fact("partial-evaluator.pl", clause(4))),
|
|
254
|
+
bindings([binding("Name", x), binding("Value", const(10)), binding("__anon0", [])])
|
|
255
|
+
)
|
|
256
|
+
])
|
|
257
|
+
)
|
|
258
|
+
])
|
|
259
|
+
),
|
|
260
|
+
proof(
|
|
261
|
+
goal(pe([bind(x, const(10))], const(1), const(1))),
|
|
262
|
+
by(fact("partial-evaluator.pl", clause(8))),
|
|
263
|
+
bindings([binding("__anon4", [bind(x, const(10))]), binding("N", 1)])
|
|
264
|
+
),
|
|
265
|
+
proof(
|
|
266
|
+
goal(is(11, '+'(10, 1))),
|
|
267
|
+
by(builtin(is, 2))
|
|
268
|
+
)
|
|
269
|
+
])
|
|
270
|
+
),
|
|
271
|
+
proof(
|
|
272
|
+
goal(pe([bind(x, const(10))], mul(var(y), const(2)), mul(var(y), const(2)))),
|
|
273
|
+
by(rule("partial-evaluator.pl", clause(15))),
|
|
274
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Left", var(y)), binding("Right", const(2)), binding("Left_residual", var(y)), binding("Right_residual", const(2))]),
|
|
275
|
+
uses([
|
|
276
|
+
proof(
|
|
277
|
+
goal(pe([bind(x, const(10))], var(y), var(y))),
|
|
278
|
+
by(rule("partial-evaluator.pl", clause(11))),
|
|
279
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", y)]),
|
|
280
|
+
uses([
|
|
281
|
+
proof(
|
|
282
|
+
goal(unknown_var([bind(x, const(10))], y)),
|
|
283
|
+
by(rule("partial-evaluator.pl", clause(7))),
|
|
284
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", y)]),
|
|
285
|
+
uses([
|
|
286
|
+
proof(
|
|
287
|
+
goal('\\+'(known_var([bind(x, const(10))], y, __anon3))),
|
|
288
|
+
by(builtin('\\+', 1))
|
|
289
|
+
)
|
|
290
|
+
])
|
|
291
|
+
)
|
|
292
|
+
])
|
|
293
|
+
),
|
|
294
|
+
proof(
|
|
295
|
+
goal(pe([bind(x, const(10))], const(2), const(2))),
|
|
296
|
+
by(fact("partial-evaluator.pl", clause(8))),
|
|
297
|
+
bindings([binding("__anon4", [bind(x, const(10))]), binding("N", 2)])
|
|
298
|
+
),
|
|
299
|
+
proof(
|
|
300
|
+
goal('\\+'((=(var(y), const(A)), =(const(2), const(B))))),
|
|
301
|
+
by(builtin('\\+', 1))
|
|
302
|
+
)
|
|
303
|
+
])
|
|
304
|
+
)
|
|
305
|
+
])
|
|
306
|
+
)
|
|
307
|
+
])
|
|
308
|
+
)
|
|
309
|
+
])
|
|
310
|
+
)
|
|
311
|
+
).
|
|
312
|
+
|
|
313
|
+
partialEvalAnswer(note, "static inputs are folded while dynamic variables remain as residual code").
|
|
314
|
+
why(
|
|
315
|
+
partialEvalAnswer(note, "static inputs are folded while dynamic variables remain as residual code"),
|
|
316
|
+
proof(
|
|
317
|
+
goal(partialEvalAnswer(note, "static inputs are folded while dynamic variables remain as residual code")),
|
|
318
|
+
by(rule("partial-evaluator.pl", clause(21))),
|
|
319
|
+
bindings([binding("__anon6", add(mul(const(10), var(y)), const(13)))]),
|
|
320
|
+
uses([
|
|
321
|
+
proof(
|
|
322
|
+
goal(residual_program(poly_y, add(mul(const(10), var(y)), const(13)))),
|
|
323
|
+
by(rule("partial-evaluator.pl", clause(19))),
|
|
324
|
+
bindings([binding("Name", poly_y), binding("Residual", add(mul(const(10), var(y)), const(13))), binding("Expr", add(mul(var(x), var(y)), add(var(x), const(3)))), binding("Env", [bind(x, const(10))])]),
|
|
325
|
+
uses([
|
|
326
|
+
proof(
|
|
327
|
+
goal(program(poly_y, add(mul(var(x), var(y)), add(var(x), const(3))), [bind(x, const(10))])),
|
|
328
|
+
by(fact("partial-evaluator.pl", clause(1)))
|
|
329
|
+
),
|
|
330
|
+
proof(
|
|
331
|
+
goal(pe([bind(x, const(10))], add(mul(var(x), var(y)), add(var(x), const(3))), add(mul(const(10), var(y)), const(13)))),
|
|
332
|
+
by(rule("partial-evaluator.pl", clause(14))),
|
|
333
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Left", mul(var(x), var(y))), binding("Right", add(var(x), const(3))), binding("Left_residual", mul(const(10), var(y))), binding("Right_residual", const(13))]),
|
|
334
|
+
uses([
|
|
335
|
+
proof(
|
|
336
|
+
goal(pe([bind(x, const(10))], mul(var(x), var(y)), mul(const(10), var(y)))),
|
|
337
|
+
by(rule("partial-evaluator.pl", clause(15))),
|
|
338
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Left", var(x)), binding("Right", var(y)), binding("Left_residual", const(10)), binding("Right_residual", var(y))]),
|
|
339
|
+
uses([
|
|
340
|
+
proof(
|
|
341
|
+
goal(pe([bind(x, const(10))], var(x), const(10))),
|
|
342
|
+
by(rule("partial-evaluator.pl", clause(10))),
|
|
343
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", x), binding("Value", const(10))]),
|
|
344
|
+
uses([
|
|
345
|
+
proof(
|
|
346
|
+
goal(known_var([bind(x, const(10))], x, const(10))),
|
|
347
|
+
by(rule("partial-evaluator.pl", clause(6))),
|
|
348
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", x), binding("Value", const(10))]),
|
|
349
|
+
uses([
|
|
350
|
+
proof(
|
|
351
|
+
goal(lookup(x, [bind(x, const(10))], const(10))),
|
|
352
|
+
by(fact("partial-evaluator.pl", clause(4))),
|
|
353
|
+
bindings([binding("Name", x), binding("Value", const(10)), binding("__anon0", [])])
|
|
354
|
+
)
|
|
355
|
+
])
|
|
356
|
+
)
|
|
357
|
+
])
|
|
358
|
+
),
|
|
359
|
+
proof(
|
|
360
|
+
goal(pe([bind(x, const(10))], var(y), var(y))),
|
|
361
|
+
by(rule("partial-evaluator.pl", clause(11))),
|
|
362
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", y)]),
|
|
363
|
+
uses([
|
|
364
|
+
proof(
|
|
365
|
+
goal(unknown_var([bind(x, const(10))], y)),
|
|
366
|
+
by(rule("partial-evaluator.pl", clause(7))),
|
|
367
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", y)]),
|
|
368
|
+
uses([
|
|
369
|
+
proof(
|
|
370
|
+
goal('\\+'(known_var([bind(x, const(10))], y, __anon3))),
|
|
371
|
+
by(builtin('\\+', 1))
|
|
372
|
+
)
|
|
373
|
+
])
|
|
374
|
+
)
|
|
375
|
+
])
|
|
376
|
+
),
|
|
377
|
+
proof(
|
|
378
|
+
goal('\\+'((=(const(10), const(A)), =(var(y), const(B))))),
|
|
379
|
+
by(builtin('\\+', 1))
|
|
380
|
+
)
|
|
381
|
+
])
|
|
382
|
+
),
|
|
383
|
+
proof(
|
|
384
|
+
goal(pe([bind(x, const(10))], add(var(x), const(3)), const(13))),
|
|
385
|
+
by(rule("partial-evaluator.pl", clause(12))),
|
|
386
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Left", var(x)), binding("Right", const(3)), binding("Sum", 13), binding("A", 10), binding("B", 3)]),
|
|
387
|
+
uses([
|
|
388
|
+
proof(
|
|
389
|
+
goal(pe([bind(x, const(10))], var(x), const(10))),
|
|
390
|
+
by(rule("partial-evaluator.pl", clause(10))),
|
|
391
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", x), binding("Value", const(10))]),
|
|
392
|
+
uses([
|
|
393
|
+
proof(
|
|
394
|
+
goal(known_var([bind(x, const(10))], x, const(10))),
|
|
395
|
+
by(rule("partial-evaluator.pl", clause(6))),
|
|
396
|
+
bindings([binding("Env", [bind(x, const(10))]), binding("Name", x), binding("Value", const(10))]),
|
|
397
|
+
uses([
|
|
398
|
+
proof(
|
|
399
|
+
goal(lookup(x, [bind(x, const(10))], const(10))),
|
|
400
|
+
by(fact("partial-evaluator.pl", clause(4))),
|
|
401
|
+
bindings([binding("Name", x), binding("Value", const(10)), binding("__anon0", [])])
|
|
402
|
+
)
|
|
403
|
+
])
|
|
404
|
+
)
|
|
405
|
+
])
|
|
406
|
+
),
|
|
407
|
+
proof(
|
|
408
|
+
goal(pe([bind(x, const(10))], const(3), const(3))),
|
|
409
|
+
by(fact("partial-evaluator.pl", clause(8))),
|
|
410
|
+
bindings([binding("__anon4", [bind(x, const(10))]), binding("N", 3)])
|
|
411
|
+
),
|
|
412
|
+
proof(
|
|
413
|
+
goal(is(13, '+'(10, 3))),
|
|
414
|
+
by(builtin(is, 2))
|
|
415
|
+
)
|
|
416
|
+
])
|
|
417
|
+
),
|
|
418
|
+
proof(
|
|
419
|
+
goal('\\+'((=(mul(const(10), var(y)), const(A)), =(const(13), const(B))))),
|
|
420
|
+
by(builtin('\\+', 1))
|
|
421
|
+
)
|
|
422
|
+
])
|
|
423
|
+
)
|
|
424
|
+
])
|
|
425
|
+
)
|
|
426
|
+
])
|
|
427
|
+
)
|
|
428
|
+
).
|
|
429
|
+
|