occam-verify-cli 0.0.1248 → 0.0.1249
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/constants.js +9 -1
- package/lib/context/file.js +76 -12
- package/lib/context/local.js +16 -4
- package/lib/dom/conclusion.js +1 -7
- package/lib/dom/consequent.js +1 -7
- package/lib/dom/declaration.js +59 -102
- package/lib/dom/frame.js +91 -105
- package/lib/dom/judgement.js +4 -2
- package/lib/dom/label.js +17 -9
- package/lib/dom/metavariable.js +18 -16
- package/lib/dom/reference.js +29 -41
- package/lib/dom/rule.js +7 -9
- package/lib/dom/statement.js +54 -54
- package/lib/dom/topLevelAssertion.js +13 -6
- package/lib/dom/topLevelMetaAssertion.js +10 -11
- package/lib/dom/variable.js +6 -6
- package/lib/equivalence.js +3 -3
- package/lib/equivalences.js +2 -2
- package/lib/substitution/term.js +8 -1
- package/lib/substitution.js +15 -1
- package/lib/substitutions.js +27 -11
- package/lib/unifier/intrinsicLevel.js +6 -6
- package/lib/unifier/metaLevel.js +3 -3
- package/lib/utilities/unification.js +17 -36
- package/package.json +1 -1
- package/src/constants.js +2 -0
- package/src/context/file.js +59 -10
- package/src/context/local.js +5 -1
- package/src/dom/conclusion.js +0 -2
- package/src/dom/consequent.js +0 -2
- package/src/dom/declaration.js +88 -92
- package/src/dom/frame.js +111 -125
- package/src/dom/judgement.js +3 -1
- package/src/dom/label.js +17 -4
- package/src/dom/metavariable.js +17 -13
- package/src/dom/reference.js +45 -47
- package/src/dom/rule.js +11 -7
- package/src/dom/statement.js +68 -66
- package/src/dom/topLevelAssertion.js +11 -5
- package/src/dom/topLevelMetaAssertion.js +10 -13
- package/src/dom/variable.js +7 -7
- package/src/equivalence.js +1 -1
- package/src/equivalences.js +1 -1
- package/src/substitution/term.js +8 -0
- package/src/substitution.js +13 -0
- package/src/substitutions.js +31 -11
- package/src/unifier/intrinsicLevel.js +5 -7
- package/src/unifier/metaLevel.js +2 -4
- package/src/utilities/unification.js +29 -67
- package/lib/unifier/reference.js +0 -145
- package/src/unifier/reference.js +0 -56
package/src/dom/frame.js
CHANGED
|
@@ -4,6 +4,7 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import dom from "../dom";
|
|
6
6
|
|
|
7
|
+
import { S, NOTHING } from "../constants";
|
|
7
8
|
import { domAssigned } from "../dom";
|
|
8
9
|
import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
|
|
9
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -70,6 +71,64 @@ export default domAssigned(class Frame {
|
|
|
70
71
|
return equalTo;
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
matchSubstitution(substitution, context) {
|
|
75
|
+
let substitutionMatches = false;
|
|
76
|
+
|
|
77
|
+
const frameString = this.string, ///
|
|
78
|
+
substitutionString = substitution.getString();
|
|
79
|
+
|
|
80
|
+
context.trace(`Matching the '${substitutionString}' substitution with the '${frameString}' frame...`);
|
|
81
|
+
|
|
82
|
+
if (!substitutionMatches) {
|
|
83
|
+
substitutionMatches = this.declarations.some((declaration) => {
|
|
84
|
+
const substitutionMatchesDeclaration = declaration.matchSubstitution(substitution, context);
|
|
85
|
+
|
|
86
|
+
if (substitutionMatchesDeclaration) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!substitutionMatches) {
|
|
93
|
+
substitutionMatches = this.metavariables.some((metavariable) => {
|
|
94
|
+
const substitutionMatchesMetavariable = metavariable.matchSubstitution(substitution, context);
|
|
95
|
+
|
|
96
|
+
if (substitutionMatchesMetavariable) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (substitutionMatches) {
|
|
103
|
+
context.debug(`...matched the '${substitutionString}' substitutions with the '${frameString}' frame.`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return substitutionMatches;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
matchSubstitutions(substitutions, context) {
|
|
110
|
+
let substitutionsMatch;
|
|
111
|
+
|
|
112
|
+
const frameString = this.string, ///
|
|
113
|
+
substitutionsString = substitutions.asString();
|
|
114
|
+
|
|
115
|
+
context.trace(`Matching the '${substitutionsString}' substitutions with the '${frameString}' frame...`);
|
|
116
|
+
|
|
117
|
+
substitutionsMatch = substitutions.everySubstitution((substitution) => {
|
|
118
|
+
const substitutionMatches = this.matchSubstitution(substitution, context);
|
|
119
|
+
|
|
120
|
+
if (substitutionMatches) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
if (substitutionsMatch) {
|
|
126
|
+
context.debug(`...matched the '${substitutionsString}' substitutions with the '${frameString}' frame.`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return substitutionsMatch;
|
|
130
|
+
}
|
|
131
|
+
|
|
73
132
|
verify(assignments, stated, context) {
|
|
74
133
|
let verified = false;
|
|
75
134
|
|
|
@@ -89,7 +148,7 @@ export default domAssigned(class Frame {
|
|
|
89
148
|
if (stated) {
|
|
90
149
|
verifiedWhenStated = this.verifyWhenStated(assignments, context);
|
|
91
150
|
} else {
|
|
92
|
-
verifiedWhenDerived = this.verifyWhenDerived(
|
|
151
|
+
verifiedWhenDerived = this.verifyWhenDerived(context);
|
|
93
152
|
}
|
|
94
153
|
|
|
95
154
|
if (verifiedWhenStated || verifiedWhenDerived) {
|
|
@@ -105,53 +164,6 @@ export default domAssigned(class Frame {
|
|
|
105
164
|
return verified;
|
|
106
165
|
}
|
|
107
166
|
|
|
108
|
-
verifyDeclarations(assignments, stated, context) {
|
|
109
|
-
let declarationsVerified;
|
|
110
|
-
|
|
111
|
-
const frameString = this.string, ///
|
|
112
|
-
declarationsString = declarationsStringFromDeclarations(this.declarations);
|
|
113
|
-
|
|
114
|
-
context.trace(`Verifying the '${frameString}' frame's '${declarationsString}' declarations...`);
|
|
115
|
-
|
|
116
|
-
stated = true; ///
|
|
117
|
-
|
|
118
|
-
assignments = null; ///
|
|
119
|
-
|
|
120
|
-
declarationsVerified = this.declarations.every((declaration) => {
|
|
121
|
-
const frame = null, ///
|
|
122
|
-
declarationVerified = declaration.verify(frame, assignments, stated, context);
|
|
123
|
-
|
|
124
|
-
return declarationVerified;
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
if (declarationsVerified) {
|
|
128
|
-
context.debug(`...verified the '${frameString}' frame's '${declarationsString}' declarations.`);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return declarationsVerified;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
verifyMetavariables(assignments, stated, context) {
|
|
135
|
-
let metavariablesVerified;
|
|
136
|
-
|
|
137
|
-
const frameString = this.string, ///
|
|
138
|
-
metavariablesString = metavariablesStringFromDeclarations(this.metavariables);
|
|
139
|
-
|
|
140
|
-
context.trace(`Verifying the '${frameString}' frame's '${metavariablesString}' metavariables...`);
|
|
141
|
-
|
|
142
|
-
metavariablesVerified = this.metavariables.every((metavariable) => {
|
|
143
|
-
const metavariableVerified = metavariable.verify(context);
|
|
144
|
-
|
|
145
|
-
return metavariableVerified;
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
if (metavariablesVerified) {
|
|
149
|
-
context.debug(`...verified the '${frameString}' frame's '${metavariablesString}' metavariables.`);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return metavariablesVerified;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
167
|
verifyWhenStated(assignments, context) {
|
|
156
168
|
let verifiedWhenStated = false;
|
|
157
169
|
|
|
@@ -180,7 +192,7 @@ export default domAssigned(class Frame {
|
|
|
180
192
|
return verifiedWhenStated;
|
|
181
193
|
}
|
|
182
194
|
|
|
183
|
-
verifyWhenDerived(
|
|
195
|
+
verifyWhenDerived(context) {
|
|
184
196
|
let verifiedWhenDerived;
|
|
185
197
|
|
|
186
198
|
const frameString = this.string; ///
|
|
@@ -196,114 +208,88 @@ export default domAssigned(class Frame {
|
|
|
196
208
|
return verifiedWhenDerived;
|
|
197
209
|
}
|
|
198
210
|
|
|
199
|
-
|
|
200
|
-
let
|
|
201
|
-
|
|
202
|
-
const frameString = this.string, ///
|
|
203
|
-
metaTypeString = metaType.getString();
|
|
204
|
-
|
|
205
|
-
context.trace(`Verifying the '${frameString}' frame given the '${metaTypeString}' meta-type...`);
|
|
206
|
-
|
|
207
|
-
const metaTypeName = metaType.getName();
|
|
208
|
-
|
|
209
|
-
if (metaTypeName === FRAME_META_TYPE_NAME) {
|
|
210
|
-
const verified = this.verify(assignments, stated, context)
|
|
211
|
-
|
|
212
|
-
verifiedGivenMetaType = verified; ///
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (verifiedGivenMetaType) {
|
|
216
|
-
context.debug(`...verified the '${frameString}' frame given the '${metaTypeString}' meta-type.`);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return verifiedGivenMetaType;
|
|
220
|
-
}
|
|
211
|
+
verifyDeclarations(assignments, stated, context) {
|
|
212
|
+
let declarationsVerified = true; ///
|
|
221
213
|
|
|
222
|
-
|
|
223
|
-
let substitutionUnified = false;
|
|
214
|
+
const declarationsLength = this.declarations.length;
|
|
224
215
|
|
|
225
|
-
|
|
226
|
-
|
|
216
|
+
if (declarationsLength > 0) {
|
|
217
|
+
const sOrNothing = (declarationsLength > 1) ?
|
|
218
|
+
S :
|
|
219
|
+
NOTHING,
|
|
220
|
+
frameString = this.string, ///
|
|
221
|
+
declarationsString = declarationsStringFromDeclarations(this.declarations);
|
|
227
222
|
|
|
228
|
-
|
|
223
|
+
context.trace(`Verifying the '${frameString}' frame's '${declarationsString}' declaration${sOrNothing}...`);
|
|
229
224
|
|
|
230
|
-
|
|
231
|
-
substitutionUnified = this.declarations.some((declaration) => {
|
|
232
|
-
const substitutionUnified = declaration.unifySubstitution(substitution, context);
|
|
225
|
+
stated = true; ///
|
|
233
226
|
|
|
234
|
-
|
|
235
|
-
return true;
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
227
|
+
assignments = null; ///
|
|
239
228
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
229
|
+
declarationsVerified = this.declarations.every((declaration) => {
|
|
230
|
+
const frame = null, ///
|
|
231
|
+
declarationVerified = declaration.verify(frame, assignments, stated, context);
|
|
243
232
|
|
|
244
|
-
|
|
245
|
-
return true;
|
|
246
|
-
}
|
|
233
|
+
return declarationVerified;
|
|
247
234
|
});
|
|
248
|
-
}
|
|
249
235
|
|
|
250
|
-
|
|
251
|
-
|
|
236
|
+
if (declarationsVerified) {
|
|
237
|
+
context.debug(`...verified the '${frameString}' frame's '${declarationsString}' declaration${sOrNothing}.`);
|
|
238
|
+
}
|
|
252
239
|
}
|
|
253
240
|
|
|
254
|
-
return
|
|
241
|
+
return declarationsVerified;
|
|
255
242
|
}
|
|
256
243
|
|
|
257
|
-
|
|
258
|
-
let
|
|
244
|
+
verifyMetavariables(assignments, stated, context) {
|
|
245
|
+
let metavariablesVerified = true;
|
|
259
246
|
|
|
260
|
-
const
|
|
261
|
-
metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
|
|
247
|
+
const metavariablesLength = this.metavariables.length;
|
|
262
248
|
|
|
263
|
-
|
|
249
|
+
if (metavariablesLength > 0) {
|
|
250
|
+
const sOrNothing = (metavariablesLength > 1) ?
|
|
251
|
+
S :
|
|
252
|
+
NOTHING,
|
|
253
|
+
frameString = this.string, ///
|
|
254
|
+
metavariablesString = metavariablesStringFromDeclarations(this.metavariables);
|
|
264
255
|
|
|
265
|
-
|
|
266
|
-
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
267
|
-
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
256
|
+
context.trace(`Verifying the '${frameString}' frame's '${metavariablesString}' metavariable${sOrNothing}...`);
|
|
268
257
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
});
|
|
258
|
+
metavariablesVerified = this.metavariables.every((metavariable) => {
|
|
259
|
+
const metavariableVerified = metavariable.verify(context);
|
|
273
260
|
|
|
274
|
-
|
|
261
|
+
return metavariableVerified;
|
|
262
|
+
});
|
|
275
263
|
|
|
276
|
-
|
|
277
|
-
|
|
264
|
+
if (metavariablesVerified) {
|
|
265
|
+
context.debug(`...verified the '${frameString}' frame's '${metavariablesString}' metavariable${sOrNothing}.`);
|
|
266
|
+
}
|
|
278
267
|
}
|
|
279
268
|
|
|
280
|
-
return
|
|
269
|
+
return metavariablesVerified;
|
|
281
270
|
}
|
|
282
271
|
|
|
283
|
-
|
|
284
|
-
let
|
|
272
|
+
verifyGivenMetaType(metaType, assignments, stated, context) {
|
|
273
|
+
let verifiedGivenMetaType = false;
|
|
285
274
|
|
|
286
275
|
const frameString = this.string, ///
|
|
287
|
-
|
|
276
|
+
metaTypeString = metaType.getString();
|
|
288
277
|
|
|
289
|
-
context.trace(`
|
|
278
|
+
context.trace(`Verifying the '${frameString}' frame given the '${metaTypeString}' meta-type...`);
|
|
290
279
|
|
|
291
|
-
const
|
|
292
|
-
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
293
|
-
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
280
|
+
const metaTypeName = metaType.getName();
|
|
294
281
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
});
|
|
282
|
+
if (metaTypeName === FRAME_META_TYPE_NAME) {
|
|
283
|
+
const verified = this.verify(assignments, stated, context)
|
|
299
284
|
|
|
300
|
-
|
|
285
|
+
verifiedGivenMetaType = verified; ///
|
|
286
|
+
}
|
|
301
287
|
|
|
302
|
-
if (
|
|
303
|
-
context.debug(`...
|
|
288
|
+
if (verifiedGivenMetaType) {
|
|
289
|
+
context.debug(`...verified the '${frameString}' frame given the '${metaTypeString}' meta-type.`);
|
|
304
290
|
}
|
|
305
291
|
|
|
306
|
-
return
|
|
292
|
+
return verifiedGivenMetaType;
|
|
307
293
|
}
|
|
308
294
|
|
|
309
295
|
static name = "Frame";
|
package/src/dom/judgement.js
CHANGED
|
@@ -53,7 +53,9 @@ export default domAssigned(class Judgement {
|
|
|
53
53
|
verifiedWhenDerived = this.verifyWhenDerived(context);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
if (verifiedWhenStated || verifiedWhenDerived) {
|
|
57
|
+
verified = true;
|
|
58
|
+
}
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
|
package/src/dom/label.js
CHANGED
|
@@ -34,9 +34,22 @@ export default domAssigned(class Label {
|
|
|
34
34
|
return metavariableNode;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
matchReference(reference) {
|
|
38
|
+
const metavariable = reference.getMetavariable(),
|
|
39
|
+
metavariableMatches = this.matchMetavariable(metavariable),
|
|
40
|
+
referenceMatches = metavariableMatches; ///
|
|
41
|
+
|
|
42
|
+
return referenceMatches;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
matchMetavariable(metavariable) {
|
|
46
|
+
const matches = this.metavariable.match(metavariable),
|
|
47
|
+
metavariableMatches = matches; ///
|
|
38
48
|
|
|
39
|
-
|
|
49
|
+
return metavariableMatches;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
matchMetavariableName(metavariableName) { return this.metavariable.matchMetavariableName(metavariableName); }
|
|
40
53
|
|
|
41
54
|
verify(nameOnly) {
|
|
42
55
|
let verified = false;
|
|
@@ -52,9 +65,9 @@ export default domAssigned(class Label {
|
|
|
52
65
|
|
|
53
66
|
labelPresent = this.fileContext.isLabelPresentByMetavariableName(metavariableName);
|
|
54
67
|
} else {
|
|
55
|
-
const
|
|
68
|
+
const metavariable = this.getMetavariable();
|
|
56
69
|
|
|
57
|
-
labelPresent = this.fileContext.
|
|
70
|
+
labelPresent = this.fileContext.isLabelPresentByMetavariable(metavariable);
|
|
58
71
|
}
|
|
59
72
|
|
|
60
73
|
if (labelPresent) {
|
package/src/dom/metavariable.js
CHANGED
|
@@ -70,12 +70,6 @@ export default domAssigned(class Metavariable {
|
|
|
70
70
|
return metavariableNameMatches;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
matchMetavariableNode(metavariableNode) {
|
|
74
|
-
const metavariableNodeMatches = metavariableNode.match(this.node);
|
|
75
|
-
|
|
76
|
-
return metavariableNodeMatches;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
73
|
isMetaTypeEqualTo(metaType) { return this.metaType.isEqualTo(metaType); }
|
|
80
74
|
|
|
81
75
|
isEqualTo(metavariable) {
|
|
@@ -85,13 +79,21 @@ export default domAssigned(class Metavariable {
|
|
|
85
79
|
return equalTo;
|
|
86
80
|
}
|
|
87
81
|
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
match(metavariable) {
|
|
83
|
+
const metavariableNode = metavariable.getNode(),
|
|
84
|
+
metavariableNodeMatchesNode = this.node.match(metavariableNode),
|
|
85
|
+
matches = metavariableNodeMatchesNode; ///
|
|
86
|
+
|
|
87
|
+
return matches;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
matchSubstitution(substitution, context) {
|
|
91
|
+
let substitutionMatched = false;
|
|
90
92
|
|
|
91
93
|
const metavariableString = this.string, ///
|
|
92
94
|
substitutionString = substitution.getString();
|
|
93
95
|
|
|
94
|
-
context.trace(`
|
|
96
|
+
context.trace(`Matching the '${substitutionString}' substitution with the '${metavariableString}' metavariable...`);
|
|
95
97
|
|
|
96
98
|
const metavariable = this, ///
|
|
97
99
|
judgement = context.findJudgementByMetavariable(metavariable);
|
|
@@ -99,14 +101,16 @@ export default domAssigned(class Metavariable {
|
|
|
99
101
|
if (judgement !== null) {
|
|
100
102
|
const declaration = judgement.getDeclaration();
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
substitutionMatched = declaration.matchSubstitution(substitution, context);
|
|
105
|
+
} else {
|
|
106
|
+
context.debug(`The '${metavariableString}' metavariable does not have a judgement.`);
|
|
103
107
|
}
|
|
104
108
|
|
|
105
|
-
if (
|
|
106
|
-
context.debug(`...
|
|
109
|
+
if (substitutionMatched) {
|
|
110
|
+
context.debug(`...matched the '${substitutionString}' substitution with the '${metavariableString}' metavariable.`);
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
return
|
|
113
|
+
return substitutionMatched;
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
unifyFrame(frame, substitutions, generalContext, specificContext) {
|
package/src/dom/reference.js
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import dom from "../dom";
|
|
4
4
|
import LocalContext from "../context/local";
|
|
5
|
+
import Substitutions from "../substitutions";
|
|
5
6
|
|
|
6
7
|
import { nodeQuery } from "../utilities/query";
|
|
7
8
|
import { domAssigned } from "../dom";
|
|
8
9
|
import { referenceMetaType } from "../dom/metaType";
|
|
10
|
+
import { unifyMetavariableIntrinsically } from "../utilities/unification";
|
|
9
11
|
import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
10
|
-
import { unifyLabelWithReference, unifyMetavariableWithReference } from "../utilities/unification";
|
|
11
12
|
|
|
12
13
|
const proofStepReferenceNodeQuery = nodeQuery("/proofStep/reference"),
|
|
13
14
|
procedureCallReferenceNodeQuery = nodeQuery("/procedureCall/reference"),
|
|
@@ -38,9 +39,14 @@ export default domAssigned(class Reference {
|
|
|
38
39
|
return metavariableNode;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
matchMetavariable(metavariable) {
|
|
43
|
+
const matches = this.metavariable.match(metavariable),
|
|
44
|
+
metavariableMatches = matches; ///
|
|
45
|
+
|
|
46
|
+
return metavariableMatches;
|
|
47
|
+
}
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
matchMetavariableName(metavariableName) { return this.metavariable.matchMetavariableName(metavariableName); }
|
|
44
50
|
|
|
45
51
|
verify(context) {
|
|
46
52
|
let verified = false;
|
|
@@ -80,7 +86,7 @@ export default domAssigned(class Reference {
|
|
|
80
86
|
return metavariableVerified;
|
|
81
87
|
}
|
|
82
88
|
|
|
83
|
-
unifyLabel(label, context) {
|
|
89
|
+
unifyLabel(label, substitutions, context) {
|
|
84
90
|
let labelUnified;
|
|
85
91
|
|
|
86
92
|
const reference = this, ///
|
|
@@ -89,9 +95,15 @@ export default domAssigned(class Reference {
|
|
|
89
95
|
|
|
90
96
|
context.trace(`Unifying the '${labelString}' label with the '${referenceString}' reference...`);
|
|
91
97
|
|
|
92
|
-
const
|
|
98
|
+
const fileContext = label.getFileContext(),
|
|
99
|
+
generalContext = context, ///
|
|
100
|
+
specificContext = fileContext, ///
|
|
101
|
+
labelMetavariable = label.getMetavariable(),
|
|
102
|
+
generalMetavariable = this.metavariable, ///
|
|
103
|
+
specificMetavariable = labelMetavariable, ///
|
|
104
|
+
metavariableUnifiedIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
|
|
93
105
|
|
|
94
|
-
labelUnified =
|
|
106
|
+
labelUnified = metavariableUnifiedIntrinsically; ///
|
|
95
107
|
|
|
96
108
|
if (labelUnified) {
|
|
97
109
|
context.debug(`...unified the '${labelString}' label with the '${referenceString}' reference.`);
|
|
@@ -100,66 +112,52 @@ export default domAssigned(class Reference {
|
|
|
100
112
|
return labelUnified;
|
|
101
113
|
}
|
|
102
114
|
|
|
103
|
-
|
|
104
|
-
let
|
|
115
|
+
unifyMetavariable(metavariable, context) {
|
|
116
|
+
let metavariableUnified;
|
|
105
117
|
|
|
106
118
|
const reference = this, ///
|
|
107
|
-
|
|
108
|
-
|
|
119
|
+
metavariableString = metavariable.getString(),
|
|
120
|
+
referenceString = reference.getString();
|
|
109
121
|
|
|
110
|
-
context.trace(`Unifying the '${
|
|
122
|
+
context.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
|
|
111
123
|
|
|
112
|
-
const
|
|
113
|
-
|
|
124
|
+
const fileContext = context.getFileContext(),
|
|
125
|
+
substitutions = Substitutions.fromNothing(),
|
|
126
|
+
generalContext = context, ///
|
|
127
|
+
specificContext = fileContext, ///
|
|
128
|
+
generalMetavariable = this.metavariable, ///
|
|
129
|
+
specificMetavariable = metavariable, ///
|
|
130
|
+
metavariableUnifiedIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
|
|
114
131
|
|
|
115
|
-
|
|
132
|
+
metavariableUnified = metavariableUnifiedIntrinsically; ///
|
|
116
133
|
|
|
117
|
-
if (
|
|
118
|
-
context.
|
|
134
|
+
if (metavariableUnified) {
|
|
135
|
+
context.debug(`...unified the '${metavariableString}' metavariable with the '${referenceString}' reference.`);
|
|
119
136
|
}
|
|
120
137
|
|
|
121
|
-
return
|
|
138
|
+
return metavariableUnified;
|
|
122
139
|
}
|
|
123
140
|
|
|
124
|
-
|
|
125
|
-
let
|
|
141
|
+
unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
|
|
142
|
+
let metaLemmaMetatheoremUnified;
|
|
126
143
|
|
|
127
144
|
const reference = this, ///
|
|
128
145
|
referenceString = reference.getString(),
|
|
129
|
-
|
|
146
|
+
metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
|
|
130
147
|
|
|
131
|
-
context.trace(`Unifying the '${
|
|
148
|
+
context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${referenceString}' reference...`);
|
|
132
149
|
|
|
133
|
-
const label =
|
|
134
|
-
|
|
150
|
+
const label = metaLemmaMetatheorem.getLabel(),
|
|
151
|
+
substitutions = Substitutions.fromNothing(),
|
|
152
|
+
labelUnified = this.unifyLabel(label, substitutions, context);
|
|
135
153
|
|
|
136
|
-
|
|
154
|
+
metaLemmaMetatheoremUnified = labelUnified; ///
|
|
137
155
|
|
|
138
|
-
if (
|
|
139
|
-
context.trace(`...unified the '${
|
|
156
|
+
if (metaLemmaMetatheoremUnified) {
|
|
157
|
+
context.trace(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${referenceString}' reference.`);
|
|
140
158
|
}
|
|
141
159
|
|
|
142
|
-
return
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
unifyMetavariable(metavariable, context) {
|
|
146
|
-
let metavariableUnified;
|
|
147
|
-
|
|
148
|
-
const reference = this, ///
|
|
149
|
-
metavariableString = metavariable.getString(),
|
|
150
|
-
referenceString = reference.getString();
|
|
151
|
-
|
|
152
|
-
context.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
|
|
153
|
-
|
|
154
|
-
const metavariableUnifiedWithReference = unifyMetavariableWithReference(metavariable, reference, context);
|
|
155
|
-
|
|
156
|
-
metavariableUnified = metavariableUnifiedWithReference; ///
|
|
157
|
-
|
|
158
|
-
if (metavariableUnified) {
|
|
159
|
-
context.debug(`...unified the '${metavariableString}' metavariable with the '${referenceString}' reference.`);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return metavariableUnified;
|
|
160
|
+
return metaLemmaMetatheoremUnified;
|
|
163
161
|
}
|
|
164
162
|
|
|
165
163
|
toJSON() {
|
package/src/dom/rule.js
CHANGED
|
@@ -57,8 +57,6 @@ export default domAssigned(class Rule {
|
|
|
57
57
|
return this.proof;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
matchStatementNode(statementNode) { return this.conclusion.matchStatementNode(statementNode); }
|
|
61
|
-
|
|
62
60
|
matchMetavariableName(metavariableName) {
|
|
63
61
|
const metavariableNameMatches = this.labels.some((label) => {
|
|
64
62
|
const metavariableNameMatches = label.matchMetavariableName(metavariableName);
|
|
@@ -230,8 +228,7 @@ export default domAssigned(class Rule {
|
|
|
230
228
|
labels = labelsFromJSON(json, fileContext),
|
|
231
229
|
premises = premisesFromJSON(json, fileContext),
|
|
232
230
|
conclusion = conclusionFromJSON(json, fileContext),
|
|
233
|
-
|
|
234
|
-
string = labelsString; ///
|
|
231
|
+
string = stringFromLabelsAndConclusion(labels, conclusion);
|
|
235
232
|
|
|
236
233
|
rule = new Rule(fileContext, string, labels, premises, conclusion, proof);
|
|
237
234
|
|
|
@@ -243,8 +240,7 @@ export default domAssigned(class Rule {
|
|
|
243
240
|
premises = premisesFromRuleNode(ruleNode, fileContext),
|
|
244
241
|
conclusion = conclusionFromRuleNode(ruleNode, fileContext),
|
|
245
242
|
proof = proofFromRuleNode(ruleNode, fileContext),
|
|
246
|
-
|
|
247
|
-
string = labelsString, ///
|
|
243
|
+
string = stringFromLabelsAndConclusion(labels, conclusion),
|
|
248
244
|
rule = new Rule(fileContext, string, labels, premises, conclusion, proof);
|
|
249
245
|
|
|
250
246
|
return rule;
|
|
@@ -289,4 +285,12 @@ function conclusionFromRuleNode(ruleNode, fileContext) {
|
|
|
289
285
|
conclusion = Conclusion.fromConclusionNode(conclusionNode, fileContext);
|
|
290
286
|
|
|
291
287
|
return conclusion;
|
|
292
|
-
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function stringFromLabelsAndConclusion(labels, conclusion) {
|
|
291
|
+
const conclusionString = conclusion.getString(),
|
|
292
|
+
labelsString = labelsStringFromLabels(labels),
|
|
293
|
+
string = `${labelsString} :: ${conclusionString}`;
|
|
294
|
+
|
|
295
|
+
return string;
|
|
296
|
+
}
|