occam-verify-cli 1.0.300 → 1.0.302
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/lib/context/file.js +25 -33
- package/lib/dom/assertion/property.js +4 -4
- package/lib/dom/conclusion.js +3 -3
- package/lib/dom/declaration.js +98 -35
- package/lib/dom/deduction.js +3 -3
- package/lib/dom/frame.js +34 -73
- package/lib/dom/metavariable.js +1 -70
- package/lib/dom/premise.js +5 -5
- package/lib/dom/procedureCall.js +3 -3
- package/lib/dom/statement.js +12 -9
- package/lib/dom/supposition.js +5 -5
- package/lib/index.js +1 -2
- package/lib/node/declaration.js +8 -1
- package/lib/node/statement.js +1 -8
- package/lib/nonTerminalNodeMap.js +2 -3
- package/lib/ruleNames.js +1 -5
- package/lib/unifier/metaLevel.js +4 -4
- package/package.json +2 -2
- package/src/context/file.js +25 -33
- package/src/dom/assertion/property.js +3 -3
- package/src/dom/conclusion.js +2 -2
- package/src/dom/declaration.js +111 -42
- package/src/dom/deduction.js +2 -2
- package/src/dom/frame.js +36 -92
- package/src/dom/metavariable.js +0 -103
- package/src/dom/premise.js +4 -4
- package/src/dom/procedureCall.js +2 -2
- package/src/dom/statement.js +12 -8
- package/src/dom/supposition.js +4 -4
- package/src/index.js +0 -1
- package/src/node/declaration.js +7 -0
- package/src/node/statement.js +0 -8
- package/src/nonTerminalNodeMap.js +0 -3
- package/src/ruleNames.js +0 -1
- package/src/unifier/metaLevel.js +3 -3
- package/lib/context/partial/substitution/reference.js +0 -158
- package/lib/dom/substitution/reference.js +0 -203
- package/lib/node/substitution/reference.js +0 -123
- package/src/context/partial/substitution/reference.js +0 -18
- package/src/dom/substitution/reference.js +0 -75
- package/src/node/substitution/reference.js +0 -23
package/src/dom/declaration.js
CHANGED
|
@@ -7,8 +7,9 @@ import { domAssigned } from "../dom";
|
|
|
7
7
|
import { unifyStatementIntrinsically } from "../utilities/unification";
|
|
8
8
|
|
|
9
9
|
export default domAssigned(class Declaration {
|
|
10
|
-
constructor(string, reference, statement) {
|
|
10
|
+
constructor(string, node, reference, statement) {
|
|
11
11
|
this.string = string;
|
|
12
|
+
this.node = node;
|
|
12
13
|
this.reference = reference;
|
|
13
14
|
this.statement = statement;
|
|
14
15
|
}
|
|
@@ -17,6 +18,10 @@ export default domAssigned(class Declaration {
|
|
|
17
18
|
return this.string;
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
getNode() {
|
|
22
|
+
return this.node;
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
getReference() {
|
|
21
26
|
return this.reference;
|
|
22
27
|
}
|
|
@@ -25,23 +30,52 @@ export default domAssigned(class Declaration {
|
|
|
25
30
|
return this.statement;
|
|
26
31
|
}
|
|
27
32
|
|
|
33
|
+
isSimple() { return this.node.isSimple(); }
|
|
34
|
+
|
|
35
|
+
getMetavariable() {
|
|
36
|
+
let metavariable = null;
|
|
37
|
+
|
|
38
|
+
const simple = this.isSimple();
|
|
39
|
+
|
|
40
|
+
if (simple) {
|
|
41
|
+
metavariable = this.reference.getMetavariable();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return metavariable;
|
|
45
|
+
}
|
|
46
|
+
|
|
28
47
|
matchSubstitution(substitution, context) {
|
|
29
|
-
let substitutionMatches;
|
|
48
|
+
let substitutionMatches = false;
|
|
30
49
|
|
|
31
50
|
const declarationString = this.string, ///
|
|
32
51
|
substitutionString = substitution.getString();
|
|
33
52
|
|
|
34
53
|
context.trace(`Matching the '${substitutionString}' substitution against the '${declarationString}' declaration...`);
|
|
35
54
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
const simple = this.isSimple();
|
|
56
|
+
|
|
57
|
+
if (simple) {
|
|
58
|
+
const metavariable = this.reference.getMetavariable(),
|
|
59
|
+
judgement = context.findJudgementByMetavariable(metavariable);
|
|
40
60
|
|
|
41
|
-
|
|
61
|
+
if (judgement !== null) {
|
|
62
|
+
const declaration = judgement.getDeclaration();
|
|
63
|
+
|
|
64
|
+
substitutionMatches = declaration.matchSubstitution(substitution, context);
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
const statement = substitution.getStatement(),
|
|
68
|
+
metavariable = substitution.getMetavariable(),
|
|
69
|
+
statementEqualToStatement = this.statement.isEqualTo(statement),
|
|
70
|
+
referenceMetavariableEqualToMetavariable = this.reference.isMetavariableEqualTo(metavariable);
|
|
71
|
+
|
|
72
|
+
if (referenceMetavariableEqualToMetavariable && statementEqualToStatement) {
|
|
73
|
+
substitutionMatches = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
42
76
|
|
|
43
77
|
if (substitutionMatches) {
|
|
44
|
-
context.debug(`...
|
|
78
|
+
context.debug(`...matches the '${declarationString}' substitution against the '${substitutionString}' declaration.`);
|
|
45
79
|
}
|
|
46
80
|
|
|
47
81
|
return substitutionMatches;
|
|
@@ -54,29 +88,37 @@ export default domAssigned(class Declaration {
|
|
|
54
88
|
|
|
55
89
|
context.trace(`Verifying the '${declarationString}' declaration...`);
|
|
56
90
|
|
|
57
|
-
const
|
|
91
|
+
const simple = this.isSimple();
|
|
58
92
|
|
|
59
|
-
if (
|
|
60
|
-
const
|
|
93
|
+
if (simple) {
|
|
94
|
+
const referenceVerifiesAsMetavariable = this.verifyReferenceAsMetavariable(assignments, stated, context);
|
|
61
95
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
96
|
+
verifies = referenceVerifiesAsMetavariable; ///
|
|
97
|
+
} else {
|
|
98
|
+
const referenceVerifies = this.verifyReference(assignments, stated, context);
|
|
65
99
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} else {
|
|
69
|
-
verifiesWhenDerived = this.verifyWhenDerived(context);
|
|
70
|
-
}
|
|
100
|
+
if (referenceVerifies) {
|
|
101
|
+
const statementVerifies = this.verifyStatement(assignments, stated, context);
|
|
71
102
|
|
|
72
|
-
if (
|
|
73
|
-
|
|
103
|
+
if (statementVerifies) {
|
|
104
|
+
let verifiesWhenStated = false,
|
|
105
|
+
verifiesWhenDerived = false;
|
|
106
|
+
|
|
107
|
+
if (stated) {
|
|
108
|
+
verifiesWhenStated = this.verifyWhenStated(assignments, context);
|
|
109
|
+
} else {
|
|
110
|
+
verifiesWhenDerived = this.verifyWhenDerived(context);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (verifiesWhenStated || verifiesWhenDerived) {
|
|
114
|
+
verifies = true;
|
|
115
|
+
}
|
|
74
116
|
}
|
|
75
117
|
}
|
|
76
|
-
}
|
|
77
118
|
|
|
78
|
-
|
|
79
|
-
|
|
119
|
+
if (verifies) {
|
|
120
|
+
context.debug(`...verified the '${declarationString}' declaration.`);
|
|
121
|
+
}
|
|
80
122
|
}
|
|
81
123
|
|
|
82
124
|
return verifies;
|
|
@@ -101,23 +143,46 @@ export default domAssigned(class Declaration {
|
|
|
101
143
|
verifyStatement(assignments, stated, context) {
|
|
102
144
|
let statementVerifies;
|
|
103
145
|
|
|
104
|
-
|
|
146
|
+
if (this.statement === null) {
|
|
147
|
+
statementVerifies = true;
|
|
148
|
+
} else {
|
|
149
|
+
const statementString = this.statement.getString();
|
|
105
150
|
|
|
106
|
-
|
|
151
|
+
context.trace(`Verifying the '${statementString}' statement...`);
|
|
107
152
|
|
|
108
|
-
|
|
153
|
+
stated = true; ///
|
|
109
154
|
|
|
110
|
-
|
|
155
|
+
assignments = null; ///
|
|
111
156
|
|
|
112
|
-
|
|
157
|
+
statementVerifies = this.statement.verify(assignments, stated, context);
|
|
113
158
|
|
|
114
|
-
|
|
115
|
-
|
|
159
|
+
if (statementVerifies) {
|
|
160
|
+
context.debug(`...verified the '${statementString}' statement.`);
|
|
161
|
+
}
|
|
116
162
|
}
|
|
117
163
|
|
|
118
164
|
return statementVerifies;
|
|
119
165
|
}
|
|
120
166
|
|
|
167
|
+
verifyReferenceAsMetavariable(assignments, stated, context) {
|
|
168
|
+
let referenceVerifiesAsMetavariable;
|
|
169
|
+
|
|
170
|
+
const referenceString = this.reference.getString();
|
|
171
|
+
|
|
172
|
+
context.trace(`Verifying the '${referenceString}' reference as a metavariable...`);
|
|
173
|
+
|
|
174
|
+
const metavariable = this.reference.getMetavariable(),
|
|
175
|
+
metavariableVerifies = metavariable.verify(context);
|
|
176
|
+
|
|
177
|
+
referenceVerifiesAsMetavariable = metavariableVerifies; ///
|
|
178
|
+
|
|
179
|
+
if (referenceVerifiesAsMetavariable) {
|
|
180
|
+
context.debug(`...verified the '${referenceString}' reference as a metavariable.`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return referenceVerifiesAsMetavariable;
|
|
184
|
+
}
|
|
185
|
+
|
|
121
186
|
verifyWhenStated(assignments, context) {
|
|
122
187
|
let verifiesWhenStated;
|
|
123
188
|
|
|
@@ -170,20 +235,24 @@ export default domAssigned(class Declaration {
|
|
|
170
235
|
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
171
236
|
let statementUnifies;
|
|
172
237
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
238
|
+
if (this.statement === null) {
|
|
239
|
+
statementUnifies = false;
|
|
240
|
+
} else {
|
|
241
|
+
const context = generalContext, ///
|
|
242
|
+
statementString = statement.getString(),
|
|
243
|
+
declarationStatementString = this.statement.getString();
|
|
176
244
|
|
|
177
|
-
|
|
245
|
+
context.trace(`Unifying the '${statementString}' statement with the '${declarationStatementString}' statement...`);
|
|
178
246
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
247
|
+
const generalStatement = this.statement,
|
|
248
|
+
specificStatement = statement, ///
|
|
249
|
+
statementUUnifiesIntrinsically = unifyStatementIntrinsically(generalStatement, specificStatement, substitutions, generalContext, specificContext);
|
|
182
250
|
|
|
183
|
-
|
|
251
|
+
statementUnifies = statementUUnifiesIntrinsically; ///
|
|
184
252
|
|
|
185
|
-
|
|
186
|
-
|
|
253
|
+
if (statementUnifies) {
|
|
254
|
+
context.debug(`...unified the '${statementString}' statement with the '${declarationStatementString}' statement.`);
|
|
255
|
+
}
|
|
187
256
|
}
|
|
188
257
|
|
|
189
258
|
return statementUnifies;
|
|
@@ -271,7 +340,7 @@ function declarationFromDeclarationNode(declarationNode, context) {
|
|
|
271
340
|
string = context.nodeAsString(node),
|
|
272
341
|
reference = Reference.fromDeclarationNode(declarationNode, context),
|
|
273
342
|
statement = Statement.fromDeclarationNode(declarationNode, context),
|
|
274
|
-
declaration = new Declaration(string, reference, statement);
|
|
343
|
+
declaration = new Declaration(string, node, reference, statement);
|
|
275
344
|
|
|
276
345
|
return declaration;
|
|
277
346
|
}
|
package/src/dom/deduction.js
CHANGED
|
@@ -55,12 +55,12 @@ export default domAssigned(class Deduction {
|
|
|
55
55
|
statementString = statement.getString(),
|
|
56
56
|
deductionString = deduction.getString();
|
|
57
57
|
|
|
58
|
-
specificContext.trace(`Unifying the '${statementString}' statement with the '${deductionString}' deduction
|
|
58
|
+
specificContext.trace(`Unifying the '${statementString}' statement with the '${deductionString}' deduction...`);
|
|
59
59
|
|
|
60
60
|
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
61
61
|
|
|
62
62
|
if (statementUnifies) {
|
|
63
|
-
specificContext.debug(`...unified the '${statementString}' statement with the '${deductionString}' deduction
|
|
63
|
+
specificContext.debug(`...unified the '${statementString}' statement with the '${deductionString}' deduction.`);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
return statementUnifies;
|
package/src/dom/frame.js
CHANGED
|
@@ -11,12 +11,11 @@ import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
|
|
|
11
11
|
const { first } = arrayUtilities;
|
|
12
12
|
|
|
13
13
|
export default domAssigned(class Frame {
|
|
14
|
-
constructor(string, node, tokens, declarations
|
|
14
|
+
constructor(string, node, tokens, declarations) {
|
|
15
15
|
this.string = string;
|
|
16
16
|
this.node = node;
|
|
17
17
|
this.tokens = tokens;
|
|
18
18
|
this.declarations = declarations;
|
|
19
|
-
this.metavariables = metavariables;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
getString() {
|
|
@@ -35,9 +34,7 @@ export default domAssigned(class Frame {
|
|
|
35
34
|
return this.declarations;
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
return this.metavariables;
|
|
40
|
-
}
|
|
37
|
+
getLength() { return this.declarations.length; }
|
|
41
38
|
|
|
42
39
|
getMetavariable() {
|
|
43
40
|
let metavariable = null;
|
|
@@ -45,14 +42,30 @@ export default domAssigned(class Frame {
|
|
|
45
42
|
const simple = this.isSimple();
|
|
46
43
|
|
|
47
44
|
if (simple) {
|
|
48
|
-
const
|
|
45
|
+
const firstDeclaration = first(this.declarations),
|
|
46
|
+
declaration = firstDeclaration; ///
|
|
49
47
|
|
|
50
|
-
metavariable =
|
|
48
|
+
metavariable = declaration.getMetavariable();
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
return metavariable;
|
|
54
52
|
}
|
|
55
53
|
|
|
54
|
+
isSimple() {
|
|
55
|
+
let simple = false;
|
|
56
|
+
|
|
57
|
+
const length = this.getLength();
|
|
58
|
+
|
|
59
|
+
if (length === 1) {
|
|
60
|
+
const firstDeclaration = first(this.declarations),
|
|
61
|
+
declaration = firstDeclaration; ///
|
|
62
|
+
|
|
63
|
+
simple = declaration.isSimple();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return simple;
|
|
67
|
+
}
|
|
68
|
+
|
|
56
69
|
isEqualTo(frame) {
|
|
57
70
|
const frameString = frame.getString(),
|
|
58
71
|
equalTo = (frameString === this.string);
|
|
@@ -60,14 +73,6 @@ export default domAssigned(class Frame {
|
|
|
60
73
|
return equalTo;
|
|
61
74
|
}
|
|
62
75
|
|
|
63
|
-
isSimple() {
|
|
64
|
-
const metavariablesLength = this.metavariables.length,
|
|
65
|
-
declarationsLength = this.declarations.length,
|
|
66
|
-
simple = ((metavariablesLength === 1) && (declarationsLength === 0));
|
|
67
|
-
|
|
68
|
-
return simple;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
76
|
matchSubstitution(substitution, context) {
|
|
72
77
|
let substitutionMatches = false;
|
|
73
78
|
|
|
@@ -86,16 +91,6 @@ export default domAssigned(class Frame {
|
|
|
86
91
|
});
|
|
87
92
|
}
|
|
88
93
|
|
|
89
|
-
if (!substitutionMatches) {
|
|
90
|
-
substitutionMatches = this.metavariables.some((metavariable) => {
|
|
91
|
-
const substitutionMatchesMetavariable = metavariable.matchSubstitution(substitution, context);
|
|
92
|
-
|
|
93
|
-
if (substitutionMatchesMetavariable) {
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
94
|
if (substitutionMatches) {
|
|
100
95
|
context.debug(`...matched the '${substitutionString}' substitutions against the '${frameString}' frame.`);
|
|
101
96
|
}
|
|
@@ -136,21 +131,17 @@ export default domAssigned(class Frame {
|
|
|
136
131
|
const declarationsVerify = this.verifyDeclarations(assignments, stated, context);
|
|
137
132
|
|
|
138
133
|
if (declarationsVerify) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (metavariablesVerify) {
|
|
142
|
-
let verifiesWhenStated = false,
|
|
143
|
-
verifiesWhenDerived = false;
|
|
134
|
+
let verifiesWhenStated = false,
|
|
135
|
+
verifiesWhenDerived = false;
|
|
144
136
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
137
|
+
if (stated) {
|
|
138
|
+
verifiesWhenStated = this.verifyWhenStated(assignments, context);
|
|
139
|
+
} else {
|
|
140
|
+
verifiesWhenDerived = this.verifyWhenDerived(context);
|
|
141
|
+
}
|
|
150
142
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
143
|
+
if (verifiesWhenStated || verifiesWhenDerived) {
|
|
144
|
+
verifies = true;
|
|
154
145
|
}
|
|
155
146
|
}
|
|
156
147
|
|
|
@@ -168,18 +159,12 @@ export default domAssigned(class Frame {
|
|
|
168
159
|
|
|
169
160
|
context.trace(`Verifying the '${frameString}' stated frame...`);
|
|
170
161
|
|
|
171
|
-
const
|
|
162
|
+
const simple = this.isSimple();
|
|
172
163
|
|
|
173
|
-
if (
|
|
174
|
-
context.trace(`The '${frameString}' stated frame
|
|
164
|
+
if (!simple) {
|
|
165
|
+
context.trace(`The '${frameString}' stated frame must be simple.`);
|
|
175
166
|
} else {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (metavariablesLength > 1) {
|
|
179
|
-
context.trace(`The '${frameString}' stated frame cannot have more than one metavariable.`);
|
|
180
|
-
} else {
|
|
181
|
-
verifiesWhenStated = true;
|
|
182
|
-
}
|
|
167
|
+
verifiesWhenStated = true;
|
|
183
168
|
}
|
|
184
169
|
|
|
185
170
|
if (verifiesWhenStated) {
|
|
@@ -208,10 +193,10 @@ export default domAssigned(class Frame {
|
|
|
208
193
|
verifyDeclarations(assignments, stated, context) {
|
|
209
194
|
let declarationsVerify = true; ///
|
|
210
195
|
|
|
211
|
-
const
|
|
196
|
+
const length = this.getLength();
|
|
212
197
|
|
|
213
|
-
if (
|
|
214
|
-
const sOrNothing = (
|
|
198
|
+
if (length > 0) {
|
|
199
|
+
const sOrNothing = (length > 1) ?
|
|
215
200
|
S :
|
|
216
201
|
NOTHING,
|
|
217
202
|
declarationsString = declarationsStringFromDeclarations(this.declarations);
|
|
@@ -236,33 +221,6 @@ export default domAssigned(class Frame {
|
|
|
236
221
|
return declarationsVerify;
|
|
237
222
|
}
|
|
238
223
|
|
|
239
|
-
verifyMetavariables(assignments, stated, context) {
|
|
240
|
-
let metavariablesVerify = true;
|
|
241
|
-
|
|
242
|
-
const metavariablesLength = this.metavariables.length;
|
|
243
|
-
|
|
244
|
-
if (metavariablesLength > 0) {
|
|
245
|
-
const sOrNothing = (metavariablesLength > 1) ?
|
|
246
|
-
S :
|
|
247
|
-
NOTHING,
|
|
248
|
-
metavariablesString = metavariablesStringFromMetavariables(this.metavariables);
|
|
249
|
-
|
|
250
|
-
context.trace(`Verifying the '${metavariablesString}' metavariable${sOrNothing}...`);
|
|
251
|
-
|
|
252
|
-
metavariablesVerify = this.metavariables.every((metavariable) => {
|
|
253
|
-
const metavariableVerifies = metavariable.verify(context);
|
|
254
|
-
|
|
255
|
-
return metavariableVerifies;
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
if (metavariablesVerify) {
|
|
259
|
-
context.debug(`...verified the '${metavariablesString}' metavariable${sOrNothing}.`);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return metavariablesVerify;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
224
|
verifyGivenMetaType(metaType, assignments, stated, context) {
|
|
267
225
|
let verifiesGivenMetaType = false;
|
|
268
226
|
|
|
@@ -379,17 +337,3 @@ function declarationsStringFromDeclarations(declarations) {
|
|
|
379
337
|
|
|
380
338
|
return declarationsString;
|
|
381
339
|
}
|
|
382
|
-
|
|
383
|
-
function metavariablesStringFromMetavariables(metavariable) {
|
|
384
|
-
const metavariablesString = metavariable.reduce((metavariablesString, metavariable) => {
|
|
385
|
-
const metavariableString = metavariable.getString();
|
|
386
|
-
|
|
387
|
-
metavariablesString = (metavariablesString === null) ?
|
|
388
|
-
metavariableString :
|
|
389
|
-
`${metavariablesString}, ${metavariableString}`;
|
|
390
|
-
|
|
391
|
-
return metavariablesString;
|
|
392
|
-
}, null);
|
|
393
|
-
|
|
394
|
-
return metavariablesString;
|
|
395
|
-
}
|
package/src/dom/metavariable.js
CHANGED
|
@@ -87,32 +87,6 @@ export default domAssigned(class Metavariable {
|
|
|
87
87
|
return equalTo;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
matchSubstitution(substitution, context) {
|
|
91
|
-
let substitutionMatched = false;
|
|
92
|
-
|
|
93
|
-
const metavariableString = this.string, ///
|
|
94
|
-
substitutionString = substitution.getString();
|
|
95
|
-
|
|
96
|
-
context.trace(`Matching the '${substitutionString}' substitution against the '${metavariableString}' metavariable...`);
|
|
97
|
-
|
|
98
|
-
const metavariable = this, ///
|
|
99
|
-
judgement = context.findJudgementByMetavariable(metavariable);
|
|
100
|
-
|
|
101
|
-
if (judgement !== null) {
|
|
102
|
-
const declaration = judgement.getDeclaration();
|
|
103
|
-
|
|
104
|
-
substitutionMatched = declaration.matchSubstitution(substitution, context);
|
|
105
|
-
} else {
|
|
106
|
-
context.debug(`The '${metavariableString}' metavariable does not have a judgement.`);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (substitutionMatched) {
|
|
110
|
-
context.debug(`...matched the '${substitutionString}' substitution against the '${metavariableString}' metavariable.`);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return substitutionMatched;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
90
|
verify(context) {
|
|
117
91
|
let verifies;
|
|
118
92
|
|
|
@@ -206,50 +180,6 @@ export default domAssigned(class Metavariable {
|
|
|
206
180
|
return frameUnifies;
|
|
207
181
|
}
|
|
208
182
|
|
|
209
|
-
unifyReference(reference, substitutions, generalContext, specificContext) {
|
|
210
|
-
let referenceUnifies = false;
|
|
211
|
-
|
|
212
|
-
const referenceString = reference.getString(),
|
|
213
|
-
metavariableString = this.string; ///
|
|
214
|
-
|
|
215
|
-
specificContext.trace(`Unifying the '${referenceString}' reference with the '${metavariableString}' metavariable...`);
|
|
216
|
-
|
|
217
|
-
const referenceMetavariableUnifies = this.unifyReferenceMetavariable(reference, substitutions, generalContext, specificContext);
|
|
218
|
-
|
|
219
|
-
if (referenceMetavariableUnifies) {
|
|
220
|
-
referenceUnifies = true;
|
|
221
|
-
} else {
|
|
222
|
-
const metavariable = this, ///
|
|
223
|
-
simpleSubstitutionPresent = substitutions.isSimpleSubstitutionPresentByMetavariable(metavariable);
|
|
224
|
-
|
|
225
|
-
if (simpleSubstitutionPresent) {
|
|
226
|
-
const simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariable(metavariable),
|
|
227
|
-
substitution = simpleSubstitution, ///
|
|
228
|
-
substitutionReferenceEqualToReference = substitution.isReferenceEqualTo(reference);
|
|
229
|
-
|
|
230
|
-
if (substitutionReferenceEqualToReference) {
|
|
231
|
-
referenceUnifies = true;
|
|
232
|
-
}
|
|
233
|
-
} else {
|
|
234
|
-
const { ReferenceSubstitution } = dom,
|
|
235
|
-
context = specificContext, ///
|
|
236
|
-
metavariable = this, ///
|
|
237
|
-
referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context),
|
|
238
|
-
substitution = referenceSubstitution; ///
|
|
239
|
-
|
|
240
|
-
substitutions.addSubstitution(substitution, specificContext);
|
|
241
|
-
|
|
242
|
-
referenceUnifies = true;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (referenceUnifies) {
|
|
247
|
-
specificContext.debug(`...unified the '${referenceString}' reference with the '${metavariableString}' metavariable.`);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
return referenceUnifies;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
183
|
unifyStatement(statement, substitution, substitutions, generalContext, specificContext) {
|
|
254
184
|
let statementUnifies = false;
|
|
255
185
|
|
|
@@ -355,39 +285,6 @@ export default domAssigned(class Metavariable {
|
|
|
355
285
|
return frameMetavariableUnifies;
|
|
356
286
|
}
|
|
357
287
|
|
|
358
|
-
unifyReferenceMetavariable(reference, substitutions, generalContext, specificContext) {
|
|
359
|
-
let referenceMetavariableUnifies = false;
|
|
360
|
-
|
|
361
|
-
const generalContextFilePath = generalContext.getFilePath(),
|
|
362
|
-
specificContextFilePath = specificContext.getFilePath();
|
|
363
|
-
|
|
364
|
-
if (generalContextFilePath === specificContextFilePath) {
|
|
365
|
-
const referenceString = reference.getString();
|
|
366
|
-
|
|
367
|
-
if (referenceString === this.string) {
|
|
368
|
-
referenceMetavariableUnifies = true;
|
|
369
|
-
} else {
|
|
370
|
-
const metavariableString = this.string, ///
|
|
371
|
-
referenceMetavariable = reference.getMetavariable(),
|
|
372
|
-
referenceMetavariableString = referenceMetavariable.getString();
|
|
373
|
-
|
|
374
|
-
specificContext.trace(`Unifying the reference's ${referenceMetavariableString}' metavariable with the '${metavariableString}' metavariable...`);
|
|
375
|
-
|
|
376
|
-
const specificMetavariable = referenceMetavariable, ///
|
|
377
|
-
generalMetavariable = this, ///
|
|
378
|
-
metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
|
|
379
|
-
|
|
380
|
-
referenceMetavariableUnifies = metavariableUnifiesIntrinsically; ///
|
|
381
|
-
|
|
382
|
-
if (referenceMetavariableUnifies) {
|
|
383
|
-
specificContext.debug(`...unified the reference's '${referenceMetavariableString}' metavariable with the '${metavariableString}' metavariable.`);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
return referenceMetavariableUnifies;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
288
|
unifyStatementMetavariable(statement, substitutions, generalContext, specificContext) {
|
|
392
289
|
let statementMetavariableUnifies = false;
|
|
393
290
|
|
package/src/dom/premise.js
CHANGED
|
@@ -152,7 +152,7 @@ export default domAssigned(class Premise {
|
|
|
152
152
|
premiseStatement = premise.getStatement(),
|
|
153
153
|
premiseStatementString = premiseStatement.getString();
|
|
154
154
|
|
|
155
|
-
specificContext.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement
|
|
155
|
+
specificContext.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement...`);
|
|
156
156
|
|
|
157
157
|
if (this.statement !== null) {
|
|
158
158
|
const context = generalContext,
|
|
@@ -164,7 +164,7 @@ export default domAssigned(class Premise {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
if (subproofUnifies) {
|
|
167
|
-
specificContext.debug(`...unified the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement
|
|
167
|
+
specificContext.debug(`...unified the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement.`);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
return subproofUnifies;
|
|
@@ -177,14 +177,14 @@ export default domAssigned(class Premise {
|
|
|
177
177
|
premiseString = premise.getString(),
|
|
178
178
|
statementString = statement.getString();
|
|
179
179
|
|
|
180
|
-
specificContext.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise
|
|
180
|
+
specificContext.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise...`);
|
|
181
181
|
|
|
182
182
|
if (this.statement !== null) {
|
|
183
183
|
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
if (statementUnifies) {
|
|
187
|
-
specificContext.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise
|
|
187
|
+
specificContext.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
return statementUnifies;
|
package/src/dom/procedureCall.js
CHANGED
|
@@ -75,7 +75,7 @@ export default domAssigned(class ProcedureCall {
|
|
|
75
75
|
|
|
76
76
|
const procedureCallString = this.string; ///
|
|
77
77
|
|
|
78
|
-
context.trace(`Unifying the '${procedureCallString}' procedure call independently
|
|
78
|
+
context.trace(`Unifying the '${procedureCallString}' procedure call independently...`);
|
|
79
79
|
|
|
80
80
|
const procedure = context.findProcedureByReference(this.reference),
|
|
81
81
|
nodes = this.findNodes(substitutions),
|
|
@@ -93,7 +93,7 @@ export default domAssigned(class ProcedureCall {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
if (unifiesIndependently) {
|
|
96
|
-
context.debug(`...unified the '${procedureCallString}' procedure call independently
|
|
96
|
+
context.debug(`...unified the '${procedureCallString}' procedure call independently.`);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
return unifiesIndependently;
|