occam-verify-cli 0.0.1246 → 0.0.1248
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 +170 -209
- package/lib/context/local.js +95 -125
- package/lib/dom/assertion/contained.js +44 -22
- package/lib/dom/assertion/defined.js +34 -17
- package/lib/dom/combinator/bracketed.js +167 -0
- package/lib/dom/combinator.js +163 -0
- package/lib/{constructor → dom/constructor}/bracketed.js +7 -7
- package/lib/dom/constructor.js +190 -0
- package/lib/dom/declaration/combinator.js +2 -8
- package/lib/dom/declaration/constructor.js +42 -7
- package/lib/dom/declaration.js +141 -149
- package/lib/dom/equality.js +3 -3
- package/lib/dom/frame.js +111 -76
- package/lib/dom/judgement.js +29 -3
- package/lib/dom/label.js +22 -15
- package/lib/dom/metaLemma.js +13 -58
- package/lib/dom/metatheorem.js +11 -117
- package/lib/dom/metavariable.js +7 -7
- package/lib/dom/reference.js +60 -18
- package/lib/dom/rule.js +6 -7
- package/lib/dom/statement.js +2 -2
- package/lib/dom/term.js +2 -2
- package/lib/dom/topLevelAssertion.js +78 -99
- package/lib/dom/topLevelMetaAssertion.js +253 -0
- package/lib/dom/type.js +3 -3
- package/lib/dom/variable.js +5 -5
- package/lib/equivalence.js +2 -2
- package/lib/index.js +7 -3
- package/lib/mixins/statement/verify.js +3 -3
- package/lib/mixins/term/verify.js +2 -3
- package/lib/substitution/statement.js +2 -2
- package/lib/unifier/{label.js → reference.js} +14 -14
- package/lib/utilities/json.js +5 -7
- package/lib/utilities/string.js +3 -3
- package/lib/utilities/unification.js +25 -6
- package/lib/verifier/combinator.js +3 -3
- package/lib/verifier/constructor.js +3 -3
- package/package.json +5 -5
- package/src/context/file.js +161 -205
- package/src/context/local.js +73 -83
- package/src/dom/assertion/contained.js +60 -27
- package/src/dom/assertion/defined.js +44 -20
- package/src/{combinator → dom/combinator}/bracketed.js +6 -5
- package/src/{combinator.js → dom/combinator.js} +8 -7
- package/src/{constructor → dom/constructor}/bracketed.js +6 -5
- package/src/{constructor.js → dom/constructor.js} +28 -27
- package/src/dom/declaration/combinator.js +2 -3
- package/src/dom/declaration/constructor.js +3 -2
- package/src/dom/declaration.js +163 -199
- package/src/dom/equality.js +2 -2
- package/src/dom/frame.js +151 -95
- package/src/dom/judgement.js +36 -2
- package/src/dom/label.js +18 -13
- package/src/dom/metaLemma.js +5 -78
- package/src/dom/metatheorem.js +8 -121
- package/src/dom/metavariable.js +6 -6
- package/src/dom/reference.js +85 -25
- package/src/dom/rule.js +7 -5
- package/src/dom/statement.js +1 -1
- package/src/dom/term.js +1 -1
- package/src/dom/topLevelAssertion.js +86 -128
- package/src/dom/topLevelMetaAssertion.js +154 -0
- package/src/dom/type.js +2 -2
- package/src/dom/variable.js +4 -4
- package/src/equivalence.js +1 -1
- package/src/index.js +4 -0
- package/src/mixins/statement/verify.js +3 -2
- package/src/mixins/term/verify.js +2 -3
- package/src/substitution/statement.js +1 -1
- package/src/unifier/{label.js → reference.js} +6 -6
- package/src/utilities/json.js +4 -4
- package/src/utilities/string.js +2 -2
- package/src/utilities/unification.js +44 -5
- package/src/verifier/combinator.js +2 -2
- package/src/verifier/constructor.js +2 -2
- package/lib/combinator/bracketed.js +0 -126
- package/lib/combinator.js +0 -122
- package/lib/constructor.js +0 -149
package/src/dom/frame.js
CHANGED
|
@@ -70,93 +70,6 @@ export default domAssigned(class Frame {
|
|
|
70
70
|
return equalTo;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
unifySubstitution(substitution, context) {
|
|
74
|
-
let substitutionUnified = false;
|
|
75
|
-
|
|
76
|
-
const frameString = this.string, ///
|
|
77
|
-
substitutionString = substitution.getString();
|
|
78
|
-
|
|
79
|
-
context.trace(`Unifying the '${substitutionString}' substitution with the '${frameString}' frame...`)
|
|
80
|
-
|
|
81
|
-
if (!substitutionUnified) {
|
|
82
|
-
substitutionUnified = this.declarations.some((declaration) => {
|
|
83
|
-
const substitutionUnified = declaration.unifySubstitution(substitution, context);
|
|
84
|
-
|
|
85
|
-
if (substitutionUnified) {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (!substitutionUnified) {
|
|
92
|
-
substitutionUnified = this.metavariables.some((metavariable) => {
|
|
93
|
-
const substitutionUnified = metavariable.unifySubstitution(substitution, context);
|
|
94
|
-
|
|
95
|
-
if (substitutionUnified) {
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (substitutionUnified) {
|
|
102
|
-
context.debug(`...unified the '${substitutionString}' substitution with the '${frameString}' frame...`)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return substitutionUnified;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
|
|
109
|
-
let metaLemmaMetatheoremUnified;
|
|
110
|
-
|
|
111
|
-
const frameString = this.string, ///
|
|
112
|
-
metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
|
|
113
|
-
|
|
114
|
-
context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${frameString}' frame...`);
|
|
115
|
-
|
|
116
|
-
const substitutions = metaLemmaMetatheorem.getSubstitutions(),
|
|
117
|
-
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
118
|
-
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
119
|
-
|
|
120
|
-
if (substitutionUnified) {
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
metaLemmaMetatheoremUnified = substitutionsUnified; ///
|
|
126
|
-
|
|
127
|
-
if (metaLemmaMetatheoremUnified) {
|
|
128
|
-
context.debug(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${frameString}' frame.`);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return metaLemmaMetatheoremUnified;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, context) {
|
|
135
|
-
let axiomLemmaTheoremOrConjectureUnified;
|
|
136
|
-
|
|
137
|
-
const frameString = this.string, ///
|
|
138
|
-
axiomLemmaTheoremStringOrConjecture = axiomLemmaTheoremOrConjecture.getString();
|
|
139
|
-
|
|
140
|
-
context.trace(`Unifying the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture with the '${frameString}' frame...`);
|
|
141
|
-
|
|
142
|
-
const substitutions = axiomLemmaTheoremOrConjecture.getSubstitutions(),
|
|
143
|
-
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
144
|
-
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
145
|
-
|
|
146
|
-
if (substitutionUnified) {
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
axiomLemmaTheoremOrConjectureUnified = substitutionsUnified; ///
|
|
152
|
-
|
|
153
|
-
if (axiomLemmaTheoremOrConjectureUnified) {
|
|
154
|
-
context.debug(`...unified the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture with the '${frameString}' frame.`);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return axiomLemmaTheoremOrConjectureUnified;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
73
|
verify(assignments, stated, context) {
|
|
161
74
|
let verified = false;
|
|
162
75
|
|
|
@@ -164,14 +77,10 @@ export default domAssigned(class Frame {
|
|
|
164
77
|
|
|
165
78
|
context.trace(`Verifying the '${frameString}' frame...`);
|
|
166
79
|
|
|
167
|
-
const declarationsVerified = this.verifyDeclarations(
|
|
80
|
+
const declarationsVerified = this.verifyDeclarations(assignments, stated, context);
|
|
168
81
|
|
|
169
82
|
if (declarationsVerified) {
|
|
170
|
-
const metavariablesVerified = this.
|
|
171
|
-
const metavariableVerified = metavariable.verify(context);
|
|
172
|
-
|
|
173
|
-
return metavariableVerified;
|
|
174
|
-
});
|
|
83
|
+
const metavariablesVerified = this.verifyMetavariables(assignments, stated, context);
|
|
175
84
|
|
|
176
85
|
if (metavariablesVerified) {
|
|
177
86
|
let verifiedWhenStated = false,
|
|
@@ -196,21 +105,53 @@ export default domAssigned(class Frame {
|
|
|
196
105
|
return verified;
|
|
197
106
|
}
|
|
198
107
|
|
|
199
|
-
verifyDeclarations(
|
|
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
|
+
|
|
200
116
|
stated = true; ///
|
|
201
117
|
|
|
202
118
|
assignments = null; ///
|
|
203
119
|
|
|
204
|
-
|
|
120
|
+
declarationsVerified = this.declarations.every((declaration) => {
|
|
205
121
|
const frame = null, ///
|
|
206
122
|
declarationVerified = declaration.verify(frame, assignments, stated, context);
|
|
207
123
|
|
|
208
124
|
return declarationVerified;
|
|
209
125
|
});
|
|
210
126
|
|
|
127
|
+
if (declarationsVerified) {
|
|
128
|
+
context.debug(`...verified the '${frameString}' frame's '${declarationsString}' declarations.`);
|
|
129
|
+
}
|
|
130
|
+
|
|
211
131
|
return declarationsVerified;
|
|
212
132
|
}
|
|
213
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
|
+
|
|
214
155
|
verifyWhenStated(assignments, context) {
|
|
215
156
|
let verifiedWhenStated = false;
|
|
216
157
|
|
|
@@ -278,6 +219,93 @@ export default domAssigned(class Frame {
|
|
|
278
219
|
return verifiedGivenMetaType;
|
|
279
220
|
}
|
|
280
221
|
|
|
222
|
+
unifySubstitution(substitution, context) {
|
|
223
|
+
let substitutionUnified = false;
|
|
224
|
+
|
|
225
|
+
const frameString = this.string, ///
|
|
226
|
+
substitutionString = substitution.getString();
|
|
227
|
+
|
|
228
|
+
context.trace(`Unifying the '${substitutionString}' substitution with the '${frameString}' frame...`)
|
|
229
|
+
|
|
230
|
+
if (!substitutionUnified) {
|
|
231
|
+
substitutionUnified = this.declarations.some((declaration) => {
|
|
232
|
+
const substitutionUnified = declaration.unifySubstitution(substitution, context);
|
|
233
|
+
|
|
234
|
+
if (substitutionUnified) {
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (!substitutionUnified) {
|
|
241
|
+
substitutionUnified = this.metavariables.some((metavariable) => {
|
|
242
|
+
const substitutionUnified = metavariable.unifySubstitution(substitution, context);
|
|
243
|
+
|
|
244
|
+
if (substitutionUnified) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (substitutionUnified) {
|
|
251
|
+
context.debug(`...unified the '${substitutionString}' substitution with the '${frameString}' frame...`)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return substitutionUnified;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
|
|
258
|
+
let metaLemmaMetatheoremUnified;
|
|
259
|
+
|
|
260
|
+
const frameString = this.string, ///
|
|
261
|
+
metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
|
|
262
|
+
|
|
263
|
+
context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${frameString}' frame...`);
|
|
264
|
+
|
|
265
|
+
const substitutions = metaLemmaMetatheorem.getSubstitutions(),
|
|
266
|
+
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
267
|
+
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
268
|
+
|
|
269
|
+
if (substitutionUnified) {
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
metaLemmaMetatheoremUnified = substitutionsUnified; ///
|
|
275
|
+
|
|
276
|
+
if (metaLemmaMetatheoremUnified) {
|
|
277
|
+
context.debug(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${frameString}' frame.`);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return metaLemmaMetatheoremUnified;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, context) {
|
|
284
|
+
let axiomLemmaTheoremOrConjectureUnified;
|
|
285
|
+
|
|
286
|
+
const frameString = this.string, ///
|
|
287
|
+
axiomLemmaTheoremStringOrConjecture = axiomLemmaTheoremOrConjecture.getString();
|
|
288
|
+
|
|
289
|
+
context.trace(`Unifying the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture with the '${frameString}' frame...`);
|
|
290
|
+
|
|
291
|
+
const substitutions = axiomLemmaTheoremOrConjecture.getSubstitutions(),
|
|
292
|
+
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
293
|
+
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
294
|
+
|
|
295
|
+
if (substitutionUnified) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
axiomLemmaTheoremOrConjectureUnified = substitutionsUnified; ///
|
|
301
|
+
|
|
302
|
+
if (axiomLemmaTheoremOrConjectureUnified) {
|
|
303
|
+
context.debug(`...unified the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture with the '${frameString}' frame.`);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return axiomLemmaTheoremOrConjectureUnified;
|
|
307
|
+
}
|
|
308
|
+
|
|
281
309
|
static name = "Frame";
|
|
282
310
|
|
|
283
311
|
static fromFrameNode(frameNode, context) {
|
|
@@ -369,3 +397,31 @@ function metavariablesFromFrameNode(frameNode, context) {
|
|
|
369
397
|
|
|
370
398
|
return metavariables;
|
|
371
399
|
}
|
|
400
|
+
|
|
401
|
+
function declarationsStringFromDeclarations(declarations) {
|
|
402
|
+
const declarationsString = declarations.reduce((declarationsString, declaration) => {
|
|
403
|
+
const declarationString = declaration.getString();
|
|
404
|
+
|
|
405
|
+
declarationsString = (declarationsString === null) ?
|
|
406
|
+
declarationString :
|
|
407
|
+
`${declarationsString}, ${declarationString}`;
|
|
408
|
+
|
|
409
|
+
return declarationsString;
|
|
410
|
+
}, null);
|
|
411
|
+
|
|
412
|
+
return declarationsString;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function metavariablesStringFromDeclarations(metavariable) {
|
|
416
|
+
const metavariablesString = metavariable.reduce((metavariablesString, metavariable) => {
|
|
417
|
+
const metavariableString = metavariable.getString();
|
|
418
|
+
|
|
419
|
+
metavariablesString = (metavariablesString === null) ?
|
|
420
|
+
metavariableString :
|
|
421
|
+
`${metavariablesString}, ${metavariableString}`;
|
|
422
|
+
|
|
423
|
+
return metavariablesString;
|
|
424
|
+
}, null);
|
|
425
|
+
|
|
426
|
+
return metavariablesString;
|
|
427
|
+
}
|
package/src/dom/judgement.js
CHANGED
|
@@ -38,10 +38,10 @@ export default domAssigned(class Judgement {
|
|
|
38
38
|
|
|
39
39
|
context.trace(`Verifying the '${judgementString}' judgement...`);
|
|
40
40
|
|
|
41
|
-
const frameVerified = this.
|
|
41
|
+
const frameVerified = this.verifyFrame(assignments, stated, context);
|
|
42
42
|
|
|
43
43
|
if (frameVerified) {
|
|
44
|
-
const declarationVerified = this.
|
|
44
|
+
const declarationVerified = this.verifyDeclaration(assignments, stated, context);
|
|
45
45
|
|
|
46
46
|
if (declarationVerified) {
|
|
47
47
|
let verifiedWhenStated = false,
|
|
@@ -64,6 +64,40 @@ export default domAssigned(class Judgement {
|
|
|
64
64
|
return verified;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
verifyFrame(assignments, stated, context) {
|
|
68
|
+
let frameVerified;
|
|
69
|
+
|
|
70
|
+
const frameString = this.frame.getString(),
|
|
71
|
+
judgementString = this.string; ///
|
|
72
|
+
|
|
73
|
+
context.trace(`Verifying the '${judgementString}' judgement's '${frameString}' frame...`);
|
|
74
|
+
|
|
75
|
+
frameVerified = this.frame.verify(assignments, stated, context);
|
|
76
|
+
|
|
77
|
+
if (frameVerified) {
|
|
78
|
+
context.debug(`...verified the '${judgementString}' judgement's '${frameString}' frame.`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return frameVerified;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
verifyDeclaration(assignments, stated, context) {
|
|
85
|
+
let declarationVerified;
|
|
86
|
+
|
|
87
|
+
const judgementString = this.string, ///
|
|
88
|
+
declarationString = this.declaration.getString();
|
|
89
|
+
|
|
90
|
+
context.trace(`Verifying the '${judgementString}' judgement's '${declarationString}' declaration...`);
|
|
91
|
+
|
|
92
|
+
declarationVerified = this.declaration.verify(this.frame, assignments, stated, context);
|
|
93
|
+
|
|
94
|
+
if (declarationVerified) {
|
|
95
|
+
context.debug(`...verified the '${judgementString}' judgement's '${declarationString}' declaration.`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return declarationVerified;
|
|
99
|
+
}
|
|
100
|
+
|
|
67
101
|
verifyWhenStated(assignments, context) {
|
|
68
102
|
let verifiedWhenStated;
|
|
69
103
|
|
package/src/dom/label.js
CHANGED
|
@@ -7,14 +7,19 @@ import { domAssigned } from "../dom";
|
|
|
7
7
|
import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
8
8
|
|
|
9
9
|
export default domAssigned(class Label {
|
|
10
|
-
constructor(metavariable) {
|
|
10
|
+
constructor(metavariable, fileContext) {
|
|
11
11
|
this.metavariable = metavariable;
|
|
12
|
+
this.fileContext = fileContext;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
getMetavariable() {
|
|
15
16
|
return this.metavariable;
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
getFileContext() {
|
|
20
|
+
return this.fileContext;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
getString() { return this.metavariable.getString(); }
|
|
19
24
|
|
|
20
25
|
getMetavariableName() {
|
|
@@ -33,36 +38,36 @@ export default domAssigned(class Label {
|
|
|
33
38
|
|
|
34
39
|
matchMetavariableNode(metavariableNode) { return this.metavariable.matchMetavariableNode(metavariableNode); }
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
let
|
|
41
|
+
verify(nameOnly) {
|
|
42
|
+
let verified = false;
|
|
38
43
|
|
|
39
44
|
const labelString = this.getString(); ///
|
|
40
45
|
|
|
41
|
-
fileContext.trace(`Verifying the '${labelString}' label
|
|
46
|
+
this.fileContext.trace(`Verifying the '${labelString}' label...`);
|
|
42
47
|
|
|
43
48
|
let labelPresent;
|
|
44
49
|
|
|
45
50
|
if (nameOnly) {
|
|
46
51
|
const metavariableName = this.getMetavariableName();
|
|
47
52
|
|
|
48
|
-
labelPresent = fileContext.isLabelPresentByMetavariableName(metavariableName);
|
|
53
|
+
labelPresent = this.fileContext.isLabelPresentByMetavariableName(metavariableName);
|
|
49
54
|
} else {
|
|
50
55
|
const metavariableNode = this.getMetavariableNode();
|
|
51
56
|
|
|
52
|
-
labelPresent = fileContext.isLabelPresentByMetavariableNode(metavariableNode);
|
|
57
|
+
labelPresent = this.fileContext.isLabelPresentByMetavariableNode(metavariableNode);
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
if (labelPresent) {
|
|
56
|
-
fileContext.debug(`The '${labelString}' label is already present.`);
|
|
61
|
+
this.fileContext.debug(`The '${labelString}' label is already present.`);
|
|
57
62
|
} else {
|
|
58
|
-
|
|
63
|
+
verified = true;
|
|
59
64
|
}
|
|
60
65
|
|
|
61
|
-
if (
|
|
62
|
-
fileContext.debug(`...verified the '${labelString}' label
|
|
66
|
+
if (verified) {
|
|
67
|
+
this.fileContext.debug(`...verified the '${labelString}' label.`);
|
|
63
68
|
}
|
|
64
69
|
|
|
65
|
-
return
|
|
70
|
+
return verified;
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
toJSON() {
|
|
@@ -79,7 +84,7 @@ export default domAssigned(class Label {
|
|
|
79
84
|
|
|
80
85
|
static fromJSON(json, fileContext) {
|
|
81
86
|
const metavariable = metavariableFromJSON(json, fileContext),
|
|
82
|
-
label = new Label(metavariable);
|
|
87
|
+
label = new Label(metavariable, fileContext);
|
|
83
88
|
|
|
84
89
|
return label;
|
|
85
90
|
}
|
|
@@ -88,7 +93,7 @@ export default domAssigned(class Label {
|
|
|
88
93
|
const { Metavariable } = dom,
|
|
89
94
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
90
95
|
metavariable = Metavariable.fromLabelNode(labelNode, localContext),
|
|
91
|
-
label = new Label(metavariable);
|
|
96
|
+
label = new Label(metavariable, fileContext);
|
|
92
97
|
|
|
93
98
|
return label;
|
|
94
99
|
}
|
package/src/dom/metaLemma.js
CHANGED
|
@@ -1,72 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import TopLevelAssertion from "./topLevelAssertion";
|
|
3
|
+
import TopLevelMetaAssertion from "./topLevelMetaAssertion";
|
|
5
4
|
|
|
6
5
|
import { domAssigned } from "../dom";
|
|
7
6
|
|
|
8
|
-
export default domAssigned(class MetaLemma extends
|
|
9
|
-
unifyReference(reference, substitutions, context) {
|
|
10
|
-
let referenceUnified;
|
|
11
|
-
|
|
12
|
-
const metaLemma = this, ///
|
|
13
|
-
referenceString = reference.getString(),
|
|
14
|
-
metaLemmaString = metaLemma.getString();
|
|
15
|
-
|
|
16
|
-
context.trace(`Unifying the '${referenceString}' reference with the '${metaLemmaString}' meta-lemma...`);
|
|
17
|
-
|
|
18
|
-
const fileContext = this.getFileContext(),
|
|
19
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
20
|
-
generalContext = localContext, ///
|
|
21
|
-
specificContext = context, ///
|
|
22
|
-
labelUnified = this.labels.some((label) => {
|
|
23
|
-
substitutions.clear();
|
|
24
|
-
|
|
25
|
-
const referenceUnified = reference.unifyLabel(label, substitutions, generalContext, specificContext);
|
|
26
|
-
|
|
27
|
-
if (referenceUnified) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
referenceUnified = labelUnified; ///
|
|
33
|
-
|
|
34
|
-
if (referenceUnified) {
|
|
35
|
-
context.debug(`...unified the '${referenceString}' reference with the '${metaLemmaString}' meta-lemma.`);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return referenceUnified;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
unifyStatement(statement, substitutions, context) {
|
|
42
|
-
let statementUnified;
|
|
43
|
-
|
|
44
|
-
const metaLemma = this, ///
|
|
45
|
-
statementString = statement.getString(),
|
|
46
|
-
metaLemmaString = metaLemma.getString();
|
|
47
|
-
|
|
48
|
-
context.trace(`Unifying the '${statementString}' statement with the '${metaLemmaString}' meta-lemma...`);
|
|
49
|
-
|
|
50
|
-
const suppositions = this.getSuppositions(),
|
|
51
|
-
suppositionsLength = suppositions.length;
|
|
52
|
-
|
|
53
|
-
if (suppositionsLength === 0) {
|
|
54
|
-
const fileContext = this.getFileContext(),
|
|
55
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
56
|
-
generalContext = localContext, ///
|
|
57
|
-
specificContext = context, ///
|
|
58
|
-
statementUnifiedWithConsequent = this.unifyStatementWithConsequent(statement, substitutions, generalContext, specificContext);
|
|
59
|
-
|
|
60
|
-
statementUnified = statementUnifiedWithConsequent; ///
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (statementUnified) {
|
|
64
|
-
context.debug(`...unified the '${statementString}' statement with the '${metaLemmaString}' meta-lemma.`);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return statementUnified;
|
|
68
|
-
}
|
|
69
|
-
|
|
7
|
+
export default domAssigned(class MetaLemma extends TopLevelMetaAssertion {
|
|
70
8
|
verify() {
|
|
71
9
|
let verified;
|
|
72
10
|
|
|
@@ -89,20 +27,9 @@ export default domAssigned(class MetaLemma extends TopLevelAssertion {
|
|
|
89
27
|
return verified;
|
|
90
28
|
}
|
|
91
29
|
|
|
92
|
-
verifyLabels() {
|
|
93
|
-
const labelsVerified = this.labels.every((label) => {
|
|
94
|
-
const nameOnly = false,
|
|
95
|
-
labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext, nameOnly);
|
|
96
|
-
|
|
97
|
-
if (labelVVerifiedWhenDeclared) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
return labelsVerified;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
30
|
static name = "MetaLemma";
|
|
106
31
|
|
|
107
|
-
static
|
|
32
|
+
static fromJSON(json, fileContext) { return TopLevelMetaAssertion.fromJSON(MetaLemma, json, fileContext); }
|
|
33
|
+
|
|
34
|
+
static fromMetaLemmaNode(axiomNode, fileContext) { return TopLevelMetaAssertion.fromNode(MetaLemma, axiomNode, fileContext); }
|
|
108
35
|
});
|
package/src/dom/metatheorem.js
CHANGED
|
@@ -1,89 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import TopLevelAssertion from "./topLevelAssertion";
|
|
3
|
+
import TopLevelMetaAssertion from "./topLevelMetaAssertion";
|
|
5
4
|
|
|
6
5
|
import { domAssigned } from "../dom";
|
|
7
|
-
import { stringFromLabels } from "./topLevelAssertion";
|
|
8
|
-
import { labelsFromJSON,
|
|
9
|
-
labelsToLabelsJSON,
|
|
10
|
-
consequentFromJSON,
|
|
11
|
-
suppositionsFromJSON,
|
|
12
|
-
substitutionsFromJSON,
|
|
13
|
-
consequentToConsequentJSON,
|
|
14
|
-
suppositionsToSuppositionsJSON,
|
|
15
|
-
substitutionsToSubstitutionsJSON } from "../utilities/json";
|
|
16
|
-
|
|
17
|
-
export default domAssigned(class Metatheorem extends TopLevelAssertion {
|
|
18
|
-
unifyReference(reference, substitutions, context) {
|
|
19
|
-
let referenceUnified;
|
|
20
|
-
|
|
21
|
-
const metatheorem = this, ///
|
|
22
|
-
referenceString = reference.getString(),
|
|
23
|
-
metatheoremString = metatheorem.getString();
|
|
24
|
-
|
|
25
|
-
context.trace(`Unifying the '${referenceString}' reference with the '${metatheoremString}' metatheorem...`);
|
|
26
|
-
|
|
27
|
-
const fileContext = this.getFileContext(),
|
|
28
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
29
|
-
generalContext = localContext, ///
|
|
30
|
-
specificContext = context, ///
|
|
31
|
-
labelUnified = this.labels.some((label) => {
|
|
32
|
-
substitutions.clear();
|
|
33
|
-
|
|
34
|
-
const referenceUnified = reference.unifyLabel(label, substitutions, generalContext, specificContext);
|
|
35
|
-
|
|
36
|
-
if (referenceUnified) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
referenceUnified = labelUnified; ///
|
|
42
|
-
|
|
43
|
-
if (referenceUnified) {
|
|
44
|
-
context.debug(`...unified the '${referenceString}' reference with the '${metatheoremString}' metatheorem.`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return referenceUnified;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
unifyStatement(statement, substitutions, context) {
|
|
51
|
-
let statementUnified;
|
|
52
|
-
|
|
53
|
-
const metatheorem = this, ///
|
|
54
|
-
statementString = statement.getString(),
|
|
55
|
-
metatheoremString = metatheorem.getString();
|
|
56
|
-
|
|
57
|
-
context.trace(`Unifying the '${statementString}' statement with the '${metatheoremString}' metatheorem...`);
|
|
58
|
-
|
|
59
|
-
const suppositions = this.getSuppositions(),
|
|
60
|
-
suppositionsLength = suppositions.length;
|
|
61
|
-
|
|
62
|
-
if (suppositionsLength === 0) {
|
|
63
|
-
const fileContext = this.getFileContext(),
|
|
64
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
65
|
-
generalContext = localContext, ///
|
|
66
|
-
specificContext = context, ///
|
|
67
|
-
statementUnifiedWithConsequent = this.unifyStatementWithConsequent(statement, substitutions, generalContext, specificContext);
|
|
68
|
-
|
|
69
|
-
statementUnified = statementUnifiedWithConsequent; ///
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (statementUnified) {
|
|
73
|
-
context.debug(`...unified the '${statementString}' statement with the '${metatheoremString}' metatheorem.`);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return statementUnified;
|
|
77
|
-
}
|
|
78
6
|
|
|
7
|
+
export default domAssigned(class Metatheorem extends TopLevelMetaAssertion {
|
|
79
8
|
verify() {
|
|
80
9
|
let verified;
|
|
81
10
|
|
|
82
|
-
const
|
|
11
|
+
const metaLemma = this, ///
|
|
83
12
|
fileContext = this.getFileContext(),
|
|
84
|
-
|
|
13
|
+
metaLemmaString = metaLemma.getString();
|
|
85
14
|
|
|
86
|
-
fileContext.trace(`Verifying the '${
|
|
15
|
+
fileContext.trace(`Verifying the '${metaLemmaString}' metatheorem...`);
|
|
87
16
|
|
|
88
17
|
verified = super.verify();
|
|
89
18
|
|
|
@@ -92,57 +21,15 @@ export default domAssigned(class Metatheorem extends TopLevelAssertion {
|
|
|
92
21
|
|
|
93
22
|
fileContext.addMetatheorem(metaTheorem);
|
|
94
23
|
|
|
95
|
-
fileContext.debug(`...verified the '${
|
|
24
|
+
fileContext.debug(`...verified the '${metaLemmaString}' metatheorem.`);
|
|
96
25
|
}
|
|
97
26
|
|
|
98
27
|
return verified;
|
|
99
28
|
}
|
|
100
29
|
|
|
101
|
-
verifyLabels() {
|
|
102
|
-
const labelsVerified = this.labels.every((label) => {
|
|
103
|
-
const nameOnly = false,
|
|
104
|
-
labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext, nameOnly);
|
|
105
|
-
|
|
106
|
-
if (labelVVerifiedWhenDeclared) {
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
return labelsVerified;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
toJSON() {
|
|
115
|
-
const labelsJSON = labelsToLabelsJSON(this.labels),
|
|
116
|
-
consequentJSON = consequentToConsequentJSON(this.consequent),
|
|
117
|
-
suppositionsJSON = suppositionsToSuppositionsJSON(this.suppositions),
|
|
118
|
-
substitutionsJSON = substitutionsToSubstitutionsJSON(this.substitutions),
|
|
119
|
-
labels = labelsJSON, ///
|
|
120
|
-
consequent = consequentJSON, ///
|
|
121
|
-
suppositions = suppositionsJSON, ///
|
|
122
|
-
substitutions = substitutionsJSON, ///
|
|
123
|
-
json = {
|
|
124
|
-
labels,
|
|
125
|
-
consequent,
|
|
126
|
-
suppositions,
|
|
127
|
-
substitutions
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
return json;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
30
|
static name = "Metatheorem";
|
|
134
31
|
|
|
135
|
-
static fromJSON(json, fileContext) {
|
|
136
|
-
const labels = labelsFromJSON(json, fileContext),
|
|
137
|
-
consequent = consequentFromJSON(json, fileContext),
|
|
138
|
-
suppositions = suppositionsFromJSON(json, fileContext),
|
|
139
|
-
substitutions = substitutionsFromJSON(json, fileContext),
|
|
140
|
-
string = stringFromLabels(labels),
|
|
141
|
-
proof = null,
|
|
142
|
-
topLevelAssertion = new Metatheorem(fileContext, string, labels, substitutions, suppositions, consequent, proof);
|
|
143
|
-
|
|
144
|
-
return topLevelAssertion;
|
|
145
|
-
}
|
|
32
|
+
static fromJSON(json, fileContext) { return TopLevelMetaAssertion.fromJSON(Metatheorem, json, fileContext); }
|
|
146
33
|
|
|
147
|
-
static fromMetatheoremNode(
|
|
34
|
+
static fromMetatheoremNode(axiomNode, fileContext) { return TopLevelMetaAssertion.fromNode(Metatheorem, axiomNode, fileContext); }
|
|
148
35
|
});
|