eyemind 0.1.33 → 0.1.34
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/SPEC.md +176 -7
- package/package.json +1 -1
- package/src/version.js +1 -1
package/SPEC.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
```text
|
|
4
4
|
Title: The eyemind Rule Language and Proof Format
|
|
5
|
-
Version: eyemind 0.1.
|
|
5
|
+
Version: eyemind 0.1.34
|
|
6
6
|
Status: Informational
|
|
7
7
|
Author: Jos De Roo, KNoWS office of IDLab, Ghent University - imec
|
|
8
8
|
Repository: https://github.com/eyereasoner/eyemind
|
|
@@ -13,8 +13,8 @@ Repository: https://github.com/eyereasoner/eyemind
|
|
|
13
13
|
eyemind is a rule language written in JavaScript, with forward and backward
|
|
14
14
|
reasoning, and a proof format whose documents a separate checker verifies
|
|
15
15
|
against the program that produced them. This document specifies the terms
|
|
16
|
-
the language reasons over, how a program is stated in JavaScript,
|
|
17
|
-
|
|
16
|
+
the language reasons over, how a program is stated in JavaScript, its semantics
|
|
17
|
+
and conclusions, the canonical text in which terms, conclusions, proofs and
|
|
18
18
|
check reports are written and read back, the proof document, the eight
|
|
19
19
|
conditions (C1-C8) a proof checker establishes, the check report, and the
|
|
20
20
|
command line.
|
|
@@ -22,7 +22,7 @@ command line.
|
|
|
22
22
|
## Status of This Memo
|
|
23
23
|
|
|
24
24
|
This document is not an Internet Standards Track specification. It describes
|
|
25
|
-
the language and formats as implemented by eyemind 0.1.
|
|
25
|
+
the language and formats as implemented by eyemind 0.1.34, for readers who want
|
|
26
26
|
to write programs, produce or consume proofs and reports, or implement a
|
|
27
27
|
compatible reasoner or checker. Where this document and the implementation
|
|
28
28
|
disagree, that is a defect in one of them.
|
|
@@ -45,6 +45,13 @@ disagree, that is a defect in one of them.
|
|
|
45
45
|
14. [Command Line](#14-command-line)
|
|
46
46
|
15. [Security Considerations](#15-security-considerations)
|
|
47
47
|
16. [Conformance](#16-conformance)
|
|
48
|
+
17. [Semantics](#17-semantics)
|
|
49
|
+
1. [Herbrand interpretation](#171-herbrand-interpretation)
|
|
50
|
+
2. [Variables and witnesses](#172-variables-and-witnesses)
|
|
51
|
+
3. [Positive least model](#173-positive-least-model)
|
|
52
|
+
4. [Negation and collection](#174-negation-and-collection)
|
|
53
|
+
5. [Sets, solutions and operational behavior](#175-sets-solutions-and-operational-behavior)
|
|
54
|
+
6. [Termination and proofs](#176-termination-and-proofs)
|
|
48
55
|
- [Appendix A. Document Grammar](#appendix-a-document-grammar)
|
|
49
56
|
- [Appendix B. Example](#appendix-b-example)
|
|
50
57
|
|
|
@@ -1050,12 +1057,13 @@ obligations holds only conditional on them.
|
|
|
1050
1057
|
|
|
1051
1058
|
## 16. Conformance
|
|
1052
1059
|
|
|
1053
|
-
A conforming **reasoner** implements Sections 3 to 10
|
|
1054
|
-
conclusions and proof documents in the canonical text,
|
|
1060
|
+
A conforming **reasoner** implements Sections 3 to 10 with the semantics of
|
|
1061
|
+
Section 17, produces conclusions and proof documents in the canonical text,
|
|
1062
|
+
and checks every proof
|
|
1055
1063
|
it produces as Section 11 describes. A conforming **checker** implements
|
|
1056
1064
|
Sections 9, 11 and 12 and does not depend on a reasoner. For the same
|
|
1057
1065
|
program, a conforming reasoner and checker MUST produce the same
|
|
1058
|
-
conclusions, proof documents and reports as eyemind 0.1.
|
|
1066
|
+
conclusions, proof documents and reports as eyemind 0.1.34, byte for byte,
|
|
1059
1067
|
except for comments and the `Detail` texts of failures (Section 12), the internal names of
|
|
1060
1068
|
variables where Section 3 says so, and where the host's floating-point
|
|
1061
1069
|
library functions (`exp`, `log`, the trigonometric and hyperbolic functions,
|
|
@@ -1068,6 +1076,167 @@ to run it against any implementation. The repository's examples, with their
|
|
|
1068
1076
|
saved conclusions (`examples/output/`), proofs (`examples/proof/`) and reports
|
|
1069
1077
|
(`examples/check/`), test the same on larger programs.
|
|
1070
1078
|
|
|
1079
|
+
## 17. Semantics
|
|
1080
|
+
|
|
1081
|
+
This section gives the model-theoretic reading of ordinary relations and its
|
|
1082
|
+
limits. Section 7 defines the evaluation and output of every accepted program,
|
|
1083
|
+
including controls and primitives whose behavior depends on current bindings.
|
|
1084
|
+
|
|
1085
|
+
### 17.1 Herbrand interpretation
|
|
1086
|
+
|
|
1087
|
+
Ordinary predicates have a **Herbrand interpretation**: they relate terms,
|
|
1088
|
+
and ground terms denote themselves. The **Herbrand universe** is the set of
|
|
1089
|
+
finite ground terms built from the atoms, integers, finite floats and compound
|
|
1090
|
+
constructors of Section 3, including lists and the Skolem terms of Section 7.2.
|
|
1091
|
+
It includes values constructed during reasoning, even when they do not occur
|
|
1092
|
+
literally in the source. For example, `implies(is(X, add(1, 2)), p(X))`
|
|
1093
|
+
concludes `p(3)`.
|
|
1094
|
+
|
|
1095
|
+
The **Herbrand base** is the set of ground ordinary predicate applications
|
|
1096
|
+
over this universe, including atoms used as predicates of arity 0. A Herbrand
|
|
1097
|
+
interpretation is a subset of this base. Controls, primitives and source rule
|
|
1098
|
+
inspection have the interpretations of Sections 4.7, 5 and 6; their meaning
|
|
1099
|
+
is not supplied by ordinary clauses.
|
|
1100
|
+
|
|
1101
|
+
Asserting `equal('a', 'b')` adds a relation between two atoms; it does not make
|
|
1102
|
+
them the same term. `unify` performs the finite-tree matching of Section 3,
|
|
1103
|
+
and `is` evaluates an arithmetic expression. An ordinary argument such as
|
|
1104
|
+
`add(1, 2)` remains a compound until an arithmetic primitive evaluates it.
|
|
1105
|
+
Integers and floats remain distinct. Section 3's signed-zero convention also
|
|
1106
|
+
applies: `0.0` and `-0.0` unify, although canonical identity distinguishes
|
|
1107
|
+
them. Thus matching a ground goal against an interpretation uses unification,
|
|
1108
|
+
while storage and output use the identity rules of Section 7.
|
|
1109
|
+
|
|
1110
|
+
### 17.2 Variables and witnesses
|
|
1111
|
+
|
|
1112
|
+
Variables used only inside a collection's template and goal are local to
|
|
1113
|
+
that search (Section 17.4); template variables have the scope of Section 4.6.
|
|
1114
|
+
Other variables of a source fact or a backward clause are universally
|
|
1115
|
+
quantified within that clause. For example, `fact(p(X))` states every ground
|
|
1116
|
+
instance of `p(X)`; a backward clause with a head-only variable likewise leaves that
|
|
1117
|
+
variable universal. Resolution uses fresh variables for each clause attempt
|
|
1118
|
+
and MAY return an answer containing variables. It does not enumerate all
|
|
1119
|
+
ground instances of a universal answer.
|
|
1120
|
+
|
|
1121
|
+
A forward rule instead introduces a witness for each head variable left
|
|
1122
|
+
unbound by a body solution, except for scoped inspection variables
|
|
1123
|
+
(Section 4.7). A head-only variable has an existential reading: for each
|
|
1124
|
+
successful body instance there exists a value making the heads hold. For
|
|
1125
|
+
example, `implies(person(X), has_token(X, T))` supplies a witness for `T`.
|
|
1126
|
+
Section 7.2 chooses the deterministic Skolem term for it. Witnesses depend
|
|
1127
|
+
on the rule number and the resolved head context, including captures for an
|
|
1128
|
+
appended template clause; body variables absent from that context do not
|
|
1129
|
+
distinguish witnesses. Shared variables in several heads share one witness.
|
|
1130
|
+
|
|
1131
|
+
This is a specified Skolemized interpretation of existential conclusions.
|
|
1132
|
+
It does not claim that the original existential rule has a least model over
|
|
1133
|
+
its original vocabulary, or that its witnesses denote different real-world
|
|
1134
|
+
objects. A witness is an ordinary compound term in subsequent reasoning.
|
|
1135
|
+
Inline templates first become the fixed clauses and activation predicates
|
|
1136
|
+
of Section 4.6. Source inspection reads its fixed catalogue and can supply
|
|
1137
|
+
universal patterns; it does not assert the inspected rule's head.
|
|
1138
|
+
|
|
1139
|
+
### 17.3 Positive least model
|
|
1140
|
+
|
|
1141
|
+
Consider the positive relational fragment: ground facts and rules whose
|
|
1142
|
+
bodies contain ordinary calls and conjunction or disjunction, with every
|
|
1143
|
+
head variable bound by the body. There is no negation, collection, `once`,
|
|
1144
|
+
source inspection or test of an unbound variable's current state. Primitives
|
|
1145
|
+
MAY be included when earlier goals supply their required inputs and their
|
|
1146
|
+
solutions agree with their ground interpretation under further substitution.
|
|
1147
|
+
|
|
1148
|
+
For this fragment, a ground instance of a rule's body holding requires its
|
|
1149
|
+
head, or every head of a conjunction, to hold. The meaning is the **least
|
|
1150
|
+
Herbrand model**: the smallest interpretation containing the source facts
|
|
1151
|
+
and closed under the rules, with matching as in Section 17.1 and primitives
|
|
1152
|
+
interpreted as specified. Equivalently, start with the facts and repeatedly
|
|
1153
|
+
add the heads of satisfied rule instances until no new ground atom follows;
|
|
1154
|
+
the closure can be infinite. Existential forward rules extend this reading
|
|
1155
|
+
with the specified Skolem witnesses rather than arbitrary witness choices.
|
|
1156
|
+
|
|
1157
|
+
Forward and backward clauses express implication in this fragment. Their
|
|
1158
|
+
directions determine how consequences are obtained: forward rules store
|
|
1159
|
+
derived facts, while backward rules are searched on demand. A completed
|
|
1160
|
+
search for an ordinary goal returns its instances that hold in the model.
|
|
1161
|
+
The model includes source facts and consequences available only by backward
|
|
1162
|
+
search; it is not just the list of materialized facts or printed conclusions
|
|
1163
|
+
(Section 7.6).
|
|
1164
|
+
|
|
1165
|
+
For example, `fact(human('socrates'))` and
|
|
1166
|
+
`implies(human(X), mortal(X))` give a model containing
|
|
1167
|
+
`human('socrates')` and `mortal('socrates')`. With no query or explicit goal,
|
|
1168
|
+
only the newly derived `mortal('socrates')` is printed.
|
|
1169
|
+
|
|
1170
|
+
### 17.4 Negation and collection
|
|
1171
|
+
|
|
1172
|
+
Negation and collection use the completed dependencies required by the clause
|
|
1173
|
+
ranks of Section 4.5. The strata are interpreted in increasing order, with
|
|
1174
|
+
lower strata fixed before a higher stratum uses their absence or solutions.
|
|
1175
|
+
Dependencies compare whole terms, so a stratum need not contain every clause
|
|
1176
|
+
with the same predicate name and arity.
|
|
1177
|
+
|
|
1178
|
+
`not(G)` succeeds when searching `G` has no solution. Named variables must
|
|
1179
|
+
already be bound; anonymous variables stand for any value. Thus
|
|
1180
|
+
`not(p('a', _))` requires that no `p('a', T)` succeeds for any `T`.
|
|
1181
|
+
This is absence relative to the program's completed dependencies, not a
|
|
1182
|
+
claim that the relation is false in the world. For goals in the relational
|
|
1183
|
+
fragment, this gives the stratified least-model reading; a goal containing
|
|
1184
|
+
binding-sensitive controls or tests retains their operational meaning.
|
|
1185
|
+
|
|
1186
|
+
`findall(T, G, L)` collects the search solutions of `G`, in order, including
|
|
1187
|
+
repeated derivations, and copies each instance of `T` with fresh variables.
|
|
1188
|
+
Bindings made inside the search do not escape except through the resulting
|
|
1189
|
+
list. An empty search gives `[]`. This ordered collection of solutions is
|
|
1190
|
+
not determined by a set of ground atoms alone: duplicate source clauses,
|
|
1191
|
+
alternative derivations and clause order can affect its result even when
|
|
1192
|
+
they leave that set unchanged.
|
|
1193
|
+
|
|
1194
|
+
### 17.5 Sets, solutions and operational behavior
|
|
1195
|
+
|
|
1196
|
+
Ground forward conclusions are stored once by canonical identity, including
|
|
1197
|
+
comparison with ground source facts. Scoped inspection patterns are stored
|
|
1198
|
+
once up to variable renaming. Reported goal answers are also suppressed up
|
|
1199
|
+
to variable renaming; query-rule reports follow Section 7.2. These rules do
|
|
1200
|
+
not remove alternative derivations during backward search, so a `findall`
|
|
1201
|
+
can contain the same term more than once. Nonground answers and inspection
|
|
1202
|
+
patterns represent universally scoped terms, not existential witnesses.
|
|
1203
|
+
|
|
1204
|
+
The unrestricted least-model reading does not specify every accepted
|
|
1205
|
+
program's answers. `once` selects the first solution. `is_var`, `identical`,
|
|
1206
|
+
`not_unify` and other tests can observe current bindings, and primitives can
|
|
1207
|
+
require inputs that a ground rule instance alone would supply. For example:
|
|
1208
|
+
|
|
1209
|
+
```js
|
|
1210
|
+
fact(q('b'))
|
|
1211
|
+
implied_by(p(X), [not_unify(X, 'a'), q(X)])
|
|
1212
|
+
```
|
|
1213
|
+
|
|
1214
|
+
An explicit goal `p(X)` has no answer: the initial unbound `X` unifies with
|
|
1215
|
+
`'a'`, so `not_unify` fails. The goal `p('b')` succeeds. A forward rule that
|
|
1216
|
+
calls such a backward rule can inherit this dependence on call bindings.
|
|
1217
|
+
Section 7's goal order and search strategy therefore remain part of the
|
|
1218
|
+
meaning of these programs. Output order, first proofs and witness spellings
|
|
1219
|
+
can also depend on clause order even in programs whose relational answer
|
|
1220
|
+
sets agree.
|
|
1221
|
+
|
|
1222
|
+
### 17.6 Termination and proofs
|
|
1223
|
+
|
|
1224
|
+
A least model need not be finite. Arithmetic, term construction and repeated
|
|
1225
|
+
witness introduction can generate infinitely many facts. A finite model
|
|
1226
|
+
does not ensure that depth-first backward search terminates: for example,
|
|
1227
|
+
`implied_by(p(X), p(X))` has an empty least model but searching `p('a')`
|
|
1228
|
+
keeps recurring. Backward search is not tabled. Successful completion without
|
|
1229
|
+
a contradiction requires terminating searches and forward rounds that reach
|
|
1230
|
+
a fixed point within Section 7.3's bounds. Exceeding a bound raises an error
|
|
1231
|
+
rather than certifying completion.
|
|
1232
|
+
A contradiction halts immediately as Section 7.5 specifies, so its output
|
|
1233
|
+
does not claim a completed closure, and it does not entail arbitrary terms.
|
|
1234
|
+
|
|
1235
|
+
A valid proof certifies its recorded claims subject to any trusted absence
|
|
1236
|
+
or collection boundaries (Section 11.11). It does not certify that the
|
|
1237
|
+
entire least model was computed, that all answers were returned, or that no
|
|
1238
|
+
contradiction follows.
|
|
1239
|
+
|
|
1071
1240
|
---
|
|
1072
1241
|
|
|
1073
1242
|
## Appendix A. Document Grammar
|
package/package.json
CHANGED
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// The release this checkout is; ./release keeps it in step with package.json.
|
|
2
|
-
export const VERSION = '0.1.
|
|
2
|
+
export const VERSION = '0.1.34';
|