occam-verify-cli 0.0.921 → 0.0.922
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/axiomLemmaTheoremConjecture.js +3 -4
- package/lib/conclusion.js +4 -4
- package/lib/context/local.js +426 -0
- package/lib/metaConsequent.js +3 -3
- package/lib/metaSupposition.js +5 -5
- package/lib/mixins/context.js +17 -13
- package/lib/premise.js +8 -9
- package/lib/verify/axiom.js +3 -3
- package/lib/verify/conjecture.js +3 -3
- package/lib/verify/lemma.js +3 -3
- package/lib/verify/metaLemma.js +3 -3
- package/lib/verify/metaSubproof.js +3 -4
- package/lib/verify/metaproof.js +3 -4
- package/lib/verify/metatheorem.js +3 -3
- package/lib/verify/proof.js +3 -4
- package/lib/verify/rule.js +3 -3
- package/lib/verify/subproof.js +3 -4
- package/lib/verify/termAsConstructor.js +3 -3
- package/lib/verify/theorem.js +3 -3
- package/package.json +4 -4
- package/src/axiomLemmaTheoremConjecture.js +2 -4
- package/src/conclusion.js +3 -3
- package/src/context/{local/intrinsicLevel.js → local.js} +223 -91
- package/src/metaConsequent.js +3 -3
- package/src/metaSupposition.js +5 -5
- package/src/mixins/context.js +12 -9
- package/src/premise.js +11 -12
- package/src/verify/axiom.js +3 -4
- package/src/verify/conjecture.js +3 -4
- package/src/verify/lemma.js +3 -4
- package/src/verify/metaLemma.js +2 -3
- package/src/verify/metaSubproof.js +2 -4
- package/src/verify/metaproof.js +2 -4
- package/src/verify/metatheorem.js +2 -3
- package/src/verify/proof.js +2 -4
- package/src/verify/rule.js +3 -4
- package/src/verify/subproof.js +2 -4
- package/src/verify/termAsConstructor.js +3 -4
- package/src/verify/theorem.js +3 -4
- package/lib/context/local/intrinsicLevel.js +0 -326
- package/lib/context/local/metaLevel.js +0 -282
- package/src/context/local/metaLevel.js +0 -191
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import Variable from "
|
|
4
|
-
import Equivalence from "
|
|
5
|
-
import contextMixins from "
|
|
3
|
+
import Variable from "../variable";
|
|
4
|
+
import Equivalence from "../equivalence";
|
|
5
|
+
import contextMixins from "../mixins/context";
|
|
6
6
|
|
|
7
|
-
import { last, reverse } from "
|
|
8
|
-
import { mergeEquivalences, findEquivalenceByTerm, groundedTermsAndDefinedVariablesFromFromEquivalences } from "
|
|
7
|
+
import { last, reverse } from "../utilities/array";
|
|
8
|
+
import { mergeEquivalences, findEquivalenceByTerm, groundedTermsAndDefinedVariablesFromFromEquivalences } from "../utilities/equivalences";
|
|
9
9
|
|
|
10
|
-
class
|
|
11
|
-
constructor(context, variables, proofSteps, equivalences) {
|
|
10
|
+
class LocalContext {
|
|
11
|
+
constructor(context, variables, proofSteps, equivalences, judgements, metavariables, metaproofSteps) {
|
|
12
12
|
this.context = context;
|
|
13
13
|
this.variables = variables;
|
|
14
14
|
this.proofSteps = proofSteps;
|
|
15
15
|
this.equivalences = equivalences;
|
|
16
|
+
this.judgements = judgements;
|
|
17
|
+
this.metavariables = metavariables;
|
|
18
|
+
this.metaproofSteps = metaproofSteps;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
getContext() {
|
|
@@ -46,87 +49,68 @@ class IntrinsicLevelLocalContext {
|
|
|
46
49
|
|
|
47
50
|
const equivalencesA = this.equivalences, ///
|
|
48
51
|
equivalencesB = equivalences,
|
|
49
|
-
|
|
52
|
+
LocalContext = this; ///
|
|
50
53
|
|
|
51
|
-
equivalences = mergeEquivalences(equivalencesA, equivalencesB,
|
|
54
|
+
equivalences = mergeEquivalences(equivalencesA, equivalencesB, LocalContext); ///
|
|
52
55
|
|
|
53
56
|
return equivalences;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
getJudgements() {
|
|
60
|
+
let judgements = this.context.getJudgements();
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
judgements = [ ///
|
|
63
|
+
...this.judgements,
|
|
64
|
+
...judgements
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
return judgements;
|
|
60
68
|
}
|
|
61
69
|
|
|
62
|
-
|
|
63
|
-
let
|
|
70
|
+
getMetavariables() {
|
|
71
|
+
let metavariables = this.context.getMetavariables();
|
|
64
72
|
|
|
65
|
-
|
|
73
|
+
metavariables = [ ///
|
|
74
|
+
...this.metavariables,
|
|
75
|
+
...metavariables
|
|
76
|
+
]
|
|
66
77
|
|
|
67
|
-
|
|
68
|
-
lastProofStep = last(this.proofSteps);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return lastProofStep;
|
|
78
|
+
return metavariables;
|
|
72
79
|
}
|
|
73
80
|
|
|
74
|
-
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
const equivalences = this.getEquivalences(),
|
|
78
|
-
equivalence = findEquivalenceByTerm(equivalences, term);
|
|
79
|
-
|
|
80
|
-
if (equivalence !== null) {
|
|
81
|
-
const intrinsicLevelLocalContext = this, ///
|
|
82
|
-
equivalenceType = equivalence.getType(intrinsicLevelLocalContext);
|
|
81
|
+
getMetaproofSteps() {
|
|
82
|
+
let metaproofSteps = this.context.getMetaproofSteps();
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
metaproofSteps = [ ///
|
|
85
|
+
...metaproofSteps,
|
|
86
|
+
...this.metaproofSteps
|
|
87
|
+
];
|
|
88
88
|
|
|
89
|
-
return
|
|
89
|
+
return metaproofSteps;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
equivalences = this.getEquivalences(),
|
|
95
|
-
groundedTerms = [],
|
|
96
|
-
definedVariables = [];
|
|
97
|
-
|
|
98
|
-
groundedTermsAndDefinedVariablesFromFromEquivalences(equivalences, groundedTerms, definedVariables, context);
|
|
92
|
+
getLastProofStep() {
|
|
93
|
+
let lastProofStep = null;
|
|
99
94
|
|
|
100
|
-
const
|
|
101
|
-
const termMatchesGroundedTerm = term.match(groundedTerm);
|
|
95
|
+
const proofStepsLength = this.proofSteps.length;
|
|
102
96
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}),
|
|
107
|
-
termGrounded = termMatchesGroundedTerm; ///
|
|
97
|
+
if (proofStepsLength > 0) {
|
|
98
|
+
lastProofStep = last(this.proofSteps);
|
|
99
|
+
}
|
|
108
100
|
|
|
109
|
-
return
|
|
101
|
+
return lastProofStep;
|
|
110
102
|
}
|
|
111
103
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
equivalences = this.getEquivalences(),
|
|
115
|
-
groundedTerms = [],
|
|
116
|
-
definedVariables = [];
|
|
104
|
+
getLastMetaproofStep() {
|
|
105
|
+
let lastMetaproofStep = null;
|
|
117
106
|
|
|
118
|
-
|
|
107
|
+
const metaproofStepsLength = this.metaproofSteps.length;
|
|
119
108
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
if (variableMatchesDefinedVariable) {
|
|
124
|
-
return true;
|
|
125
|
-
}
|
|
126
|
-
}),
|
|
127
|
-
variableDefined = variableMatchesDefinedVariable; ///
|
|
109
|
+
if (metaproofStepsLength > 0) {
|
|
110
|
+
lastMetaproofStep = last(this.metaproofSteps);
|
|
111
|
+
}
|
|
128
112
|
|
|
129
|
-
return
|
|
113
|
+
return lastMetaproofStep;
|
|
130
114
|
}
|
|
131
115
|
|
|
132
116
|
addEquality(equality) {
|
|
@@ -221,6 +205,46 @@ class IntrinsicLevelLocalContext {
|
|
|
221
205
|
this.equivalences.splice(start, deleteCount);
|
|
222
206
|
}
|
|
223
207
|
|
|
208
|
+
addJudgement(judgement) {
|
|
209
|
+
let judgementAdded = false;
|
|
210
|
+
|
|
211
|
+
const metavariableNode = judgement.getMetavariableNode(),
|
|
212
|
+
judgementPresent = this.isJudgementPresentByMetavariableNode(metavariableNode);
|
|
213
|
+
|
|
214
|
+
if (!judgementPresent) {
|
|
215
|
+
this.judgements.push(judgement);
|
|
216
|
+
|
|
217
|
+
judgementAdded = true;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return judgementAdded;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
addMetavariable(metavariable) {
|
|
224
|
+
let metavariableAdded = false;
|
|
225
|
+
|
|
226
|
+
const node = metavariable.getName(),
|
|
227
|
+
metavariablePresent = this.metavariables.some((metavariable) => {
|
|
228
|
+
const metavariableMatchesNode = metavariable.matchNode(node);
|
|
229
|
+
|
|
230
|
+
if (metavariableMatchesNode) {
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
if (!metavariablePresent) {
|
|
236
|
+
this.metavariables.push(metavariable);
|
|
237
|
+
|
|
238
|
+
metavariableAdded = true;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return metavariableAdded;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
addMetaproofStep(metaproofStep) {
|
|
245
|
+
this.metaproofSteps.push(metaproofStep);
|
|
246
|
+
}
|
|
247
|
+
|
|
224
248
|
matchStatementNode(statementNode) {
|
|
225
249
|
let proofSteps = this.getProofSteps();
|
|
226
250
|
|
|
@@ -237,21 +261,79 @@ class IntrinsicLevelLocalContext {
|
|
|
237
261
|
return matchesStatementNode;
|
|
238
262
|
}
|
|
239
263
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
variables = this.getVariables(),
|
|
243
|
-
variable = variables.find((variable) => {
|
|
244
|
-
const matches = variable.matchNode(node);
|
|
264
|
+
matchMetastatementNode(metastatementNode) {
|
|
265
|
+
let metaproofSteps = this.getMetaproofSteps();
|
|
245
266
|
|
|
246
|
-
|
|
267
|
+
metaproofSteps = reverse(metaproofSteps); ///
|
|
268
|
+
|
|
269
|
+
const matchesMetastatementNode = metaproofSteps.some((metaproofStep) => {
|
|
270
|
+
const metaproofStepMatchesMetastatementNode = metaproofStep.matchMetastatementNode(metastatementNode);
|
|
271
|
+
|
|
272
|
+
if (metaproofStepMatchesMetastatementNode) {
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
return matchesMetastatementNode;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
getTermType(term) {
|
|
281
|
+
let termType;
|
|
282
|
+
|
|
283
|
+
const equivalences = this.getEquivalences(),
|
|
284
|
+
equivalence = findEquivalenceByTerm(equivalences, term);
|
|
285
|
+
|
|
286
|
+
if (equivalence !== null) {
|
|
287
|
+
const LocalContext = this, ///
|
|
288
|
+
equivalenceType = equivalence.getType(LocalContext);
|
|
289
|
+
|
|
290
|
+
termType = equivalenceType; ///
|
|
291
|
+
} else {
|
|
292
|
+
termType = term.getType();
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return termType;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
isTermGrounded(term) {
|
|
299
|
+
const context = this,
|
|
300
|
+
equivalences = this.getEquivalences(),
|
|
301
|
+
groundedTerms = [],
|
|
302
|
+
definedVariables = [];
|
|
303
|
+
|
|
304
|
+
groundedTermsAndDefinedVariablesFromFromEquivalences(equivalences, groundedTerms, definedVariables, context);
|
|
305
|
+
|
|
306
|
+
const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
|
|
307
|
+
const termMatchesGroundedTerm = term.match(groundedTerm);
|
|
308
|
+
|
|
309
|
+
if (termMatchesGroundedTerm) {
|
|
247
310
|
return true;
|
|
248
311
|
}
|
|
249
|
-
})
|
|
312
|
+
}),
|
|
313
|
+
termGrounded = termMatchesGroundedTerm; ///
|
|
250
314
|
|
|
251
|
-
return
|
|
315
|
+
return termGrounded;
|
|
252
316
|
}
|
|
253
317
|
|
|
254
|
-
|
|
318
|
+
isVariableDefined(variable) {
|
|
319
|
+
const context = this,
|
|
320
|
+
equivalences = this.getEquivalences(),
|
|
321
|
+
groundedTerms = [],
|
|
322
|
+
definedVariables = [];
|
|
323
|
+
|
|
324
|
+
groundedTermsAndDefinedVariablesFromFromEquivalences(equivalences, groundedTerms, definedVariables, context);
|
|
325
|
+
|
|
326
|
+
const variableMatchesDefinedVariable = definedVariables.some((definedVariable) => {
|
|
327
|
+
const variableMatchesDefinedVariable = variable.match(definedVariable);
|
|
328
|
+
|
|
329
|
+
if (variableMatchesDefinedVariable) {
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
}),
|
|
333
|
+
variableDefined = variableMatchesDefinedVariable; ///
|
|
334
|
+
|
|
335
|
+
return variableDefined;
|
|
336
|
+
}
|
|
255
337
|
|
|
256
338
|
isVariablePresentByVariableNode(variableNode) {
|
|
257
339
|
const variable = this.findVariableByVariableNode(variableNode),
|
|
@@ -260,19 +342,59 @@ class IntrinsicLevelLocalContext {
|
|
|
260
342
|
return variablePresent;
|
|
261
343
|
}
|
|
262
344
|
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
|
|
345
|
+
isJudgementPresentByMetavariableNode(metavariableNode) {
|
|
346
|
+
const judgement = this.findJudgementByMetavariableNode(metavariableNode),
|
|
347
|
+
judgementPresent = (judgement !== null);
|
|
266
348
|
|
|
267
|
-
|
|
349
|
+
return judgementPresent;
|
|
350
|
+
}
|
|
268
351
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
352
|
+
isMetavariablePresentByMetavariableNode(metavariableNode, localContext) {
|
|
353
|
+
const metavariable = this.findMetavariableByMetavariableNode(metavariableNode, localContext),
|
|
354
|
+
metavariablePresent = (metavariable !== null);
|
|
355
|
+
|
|
356
|
+
return metavariablePresent;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
findVariableByVariableNode(variableNode) {
|
|
360
|
+
const node = variableNode, ///
|
|
361
|
+
variables = this.getVariables(),
|
|
362
|
+
variable = variables.find((variable) => {
|
|
363
|
+
const matches = variable.matchNode(node);
|
|
364
|
+
|
|
365
|
+
if (matches) {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
368
|
+
}) || null;
|
|
274
369
|
|
|
275
|
-
return
|
|
370
|
+
return variable;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
findJudgementByMetavariableNode(metavariableNode) {
|
|
374
|
+
const judgements = this.getJudgements(),
|
|
375
|
+
judgement = judgements.find((judgement) => {
|
|
376
|
+
const judgementMatchesMetavariableNode = judgement.matchMetavariableNode(metavariableNode);
|
|
377
|
+
|
|
378
|
+
if (judgementMatchesMetavariableNode) {
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
}) || null;
|
|
382
|
+
|
|
383
|
+
return judgement;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
findMetavariableByMetavariableNode(metavariableNode, localContext) {
|
|
387
|
+
const node = metavariableNode, ///
|
|
388
|
+
metavariables = this.getMetavariables(),
|
|
389
|
+
metavariable = metavariables.find((metavariable) => {
|
|
390
|
+
const matches = metavariable.matchNode(node, localContext);
|
|
391
|
+
|
|
392
|
+
if (matches) {
|
|
393
|
+
return true;
|
|
394
|
+
}
|
|
395
|
+
}) || null;
|
|
396
|
+
|
|
397
|
+
return metavariable;
|
|
276
398
|
}
|
|
277
399
|
|
|
278
400
|
static fromFileContext(fileContext) {
|
|
@@ -280,9 +402,12 @@ class IntrinsicLevelLocalContext {
|
|
|
280
402
|
variables = [],
|
|
281
403
|
proofSteps = [],
|
|
282
404
|
equivalences = [],
|
|
283
|
-
|
|
405
|
+
judgements = [],
|
|
406
|
+
metavariables = [],
|
|
407
|
+
metaproofSteps = [],
|
|
408
|
+
localContext = new LocalContext(context, variables, proofSteps, equivalences, judgements, metavariables, metaproofSteps);
|
|
284
409
|
|
|
285
|
-
return
|
|
410
|
+
return localContext;
|
|
286
411
|
}
|
|
287
412
|
|
|
288
413
|
static fromLocalContext(localContext) {
|
|
@@ -290,9 +415,13 @@ class IntrinsicLevelLocalContext {
|
|
|
290
415
|
variables = [],
|
|
291
416
|
proofSteps = [],
|
|
292
417
|
equivalences = [],
|
|
293
|
-
|
|
418
|
+
judgements = [],
|
|
419
|
+
metavariables = [],
|
|
420
|
+
metaproofSteps = [];
|
|
421
|
+
|
|
422
|
+
localContext = new LocalContext(context, variables, proofSteps, equivalences, judgements, metavariables, metaproofSteps); ///
|
|
294
423
|
|
|
295
|
-
return
|
|
424
|
+
return localContext;
|
|
296
425
|
}
|
|
297
426
|
|
|
298
427
|
static fromJSONAndFileContext(json, fileContext) {
|
|
@@ -310,12 +439,15 @@ class IntrinsicLevelLocalContext {
|
|
|
310
439
|
const context = fileContext, ///
|
|
311
440
|
proofSteps = [],
|
|
312
441
|
equivalences = [],
|
|
313
|
-
|
|
442
|
+
judgements = [],
|
|
443
|
+
metavariables = [],
|
|
444
|
+
metaproofSteps = [],
|
|
445
|
+
localContext = new LocalContext(context, variables, proofSteps, equivalences, judgements, metavariables, metaproofSteps); ///
|
|
314
446
|
|
|
315
|
-
return
|
|
447
|
+
return localContext;
|
|
316
448
|
}
|
|
317
449
|
}
|
|
318
450
|
|
|
319
|
-
Object.assign(
|
|
451
|
+
Object.assign(LocalContext.prototype, contextMixins);
|
|
320
452
|
|
|
321
|
-
export default
|
|
453
|
+
export default LocalContext;
|
package/src/metaConsequent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import LocalContext from "./context/local";
|
|
3
4
|
import metaLevelNodesVerifier from "./verifier/nodes/metaLevel";
|
|
4
|
-
import MetaLevelLocalContext from "./context/local/metaLevel";
|
|
5
5
|
|
|
6
6
|
import { nodeAsString } from "./utilities/string";
|
|
7
7
|
import { statementNodeFromStatementString, metastatementNodeFromMetastatementString } from "./utilities/node";
|
|
@@ -24,10 +24,10 @@ export default class MetaConsequent {
|
|
|
24
24
|
let matchesMetastatementNode = false;
|
|
25
25
|
|
|
26
26
|
if (this.metastatementNode !== null) {
|
|
27
|
-
const
|
|
27
|
+
const fileContextA = fileContext, ///
|
|
28
28
|
nonTerminalNodeA = this.metastatementNode, ///
|
|
29
29
|
nonTerminalNodeB = metastatementNode, ///
|
|
30
|
-
localContextA =
|
|
30
|
+
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
31
31
|
localContextB = localContext, ///
|
|
32
32
|
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
33
33
|
const verifiedAhead = true;
|
package/src/metaSupposition.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import LocalContext from "./context/local";
|
|
4
4
|
import metaLevelNodesVerifier from "./verifier/nodes/metaLevel";
|
|
5
5
|
|
|
6
6
|
import { match } from "./utilities/array";
|
|
@@ -43,10 +43,10 @@ export default class MetaSupposition {
|
|
|
43
43
|
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
44
44
|
|
|
45
45
|
matchesMetaSubproofNode = match(subproofAssertionMetastatementNodes, metaSubproofMetastatementNodes, (subproofAssertionMetastatementNode, ruleSubproofMetastatementNode) => {
|
|
46
|
-
const
|
|
46
|
+
const fileContextA = fileContext, ///
|
|
47
47
|
nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
48
48
|
nonTerminalNodeB = ruleSubproofMetastatementNode, ///
|
|
49
|
-
localContextA =
|
|
49
|
+
localContextA = LocalContext.fromFileContext(fileContextA), ///
|
|
50
50
|
localContextB = localContext, ///
|
|
51
51
|
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
52
52
|
const verifiedAhead = true;
|
|
@@ -68,10 +68,10 @@ export default class MetaSupposition {
|
|
|
68
68
|
let matchesMetastatementNode = false;
|
|
69
69
|
|
|
70
70
|
if (this.metastatementNode !== null) {
|
|
71
|
-
const
|
|
71
|
+
const fileContextA = fileContext, ///
|
|
72
72
|
nonTerminalNodeA = this.metastatementNode, ///
|
|
73
73
|
nonTerminalNodeB = metastatementNode, ///
|
|
74
|
-
localContextA =
|
|
74
|
+
localContextA = LocalContext.fromFileContext(fileContextA), ///
|
|
75
75
|
localContextB = localContext, ///
|
|
76
76
|
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
77
77
|
const verifiedAhead = true;
|
package/src/mixins/context.js
CHANGED
|
@@ -24,12 +24,6 @@ function getCombinators() { return this.context.getCombinators(); }
|
|
|
24
24
|
|
|
25
25
|
function getConstructors() { return this.context.getConstructors(); }
|
|
26
26
|
|
|
27
|
-
function findTypeByTypeName(typeName) { return this.context.findTypeByTypeName(typeName); }
|
|
28
|
-
|
|
29
|
-
function findTypeByTypeNode(typeNode) { return this.context.findTypeByTypeNode(typeNode); }
|
|
30
|
-
|
|
31
|
-
function findMetavariableByName(name) { return this.context.findMetavariableByName(name); }
|
|
32
|
-
|
|
33
27
|
function isTypePresentByTypeName(typeName) { return this.context.isTypePresentByTypeName(typeName); }
|
|
34
28
|
|
|
35
29
|
function isTypePresentByTypeNode(typeNode) { return this.context.isTypePresentByTypeNode(typeNode); }
|
|
@@ -38,8 +32,16 @@ function isMetavariablePresentByName(name) { return this.context.isMetavariableP
|
|
|
38
32
|
|
|
39
33
|
function isLabelPresentByMetavariableNode(metavariableNode) { return this.context.isLabelPresentByMetavariableNode(metavariableNode); }
|
|
40
34
|
|
|
35
|
+
function findTypeByTypeName(typeName) { return this.context.findTypeByTypeName(typeName); }
|
|
36
|
+
|
|
37
|
+
function findTypeByTypeNode(typeNode) { return this.context.findTypeByTypeNode(typeNode); }
|
|
38
|
+
|
|
39
|
+
function findMetavariableByName(name) { return this.context.findMetavariableByName(name); }
|
|
40
|
+
|
|
41
41
|
function findLabelByMetavariableNode(metavariableNode) { return this.context.findLabelByMetavariableNode(metavariableNode); }
|
|
42
42
|
|
|
43
|
+
function findMetaTypeByMetaTypeNode(metaTypeNode) { return this.context.findMetaTypeByMetaTypeNode(metaTypeNode); }
|
|
44
|
+
|
|
43
45
|
function findRuleByMetavariableNode(metavariableNode) { return this.context.findRuleByMetavariableNode(metavariableNode); }
|
|
44
46
|
|
|
45
47
|
function findAxiomByMetavariableNode(metavariableNode) { return this.context.findAxiomByMetavariableNode(metavariableNode); }
|
|
@@ -71,14 +73,15 @@ const contextMixins = {
|
|
|
71
73
|
getConjectures,
|
|
72
74
|
getCombinators,
|
|
73
75
|
getConstructors,
|
|
74
|
-
findTypeByTypeName,
|
|
75
|
-
findTypeByTypeNode,
|
|
76
|
-
findMetavariableByName,
|
|
77
76
|
isTypePresentByTypeName,
|
|
78
77
|
isTypePresentByTypeNode,
|
|
79
78
|
isMetavariablePresentByName,
|
|
80
79
|
isLabelPresentByMetavariableNode,
|
|
80
|
+
findTypeByTypeName,
|
|
81
|
+
findTypeByTypeNode,
|
|
82
|
+
findMetavariableByName,
|
|
81
83
|
findLabelByMetavariableNode,
|
|
84
|
+
findMetaTypeByMetaTypeNode,
|
|
82
85
|
findRuleByMetavariableNode,
|
|
83
86
|
findAxiomByMetavariableNode,
|
|
84
87
|
findLemmaByMetavariableNode,
|
package/src/premise.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import LocalContext from "./context/local";
|
|
4
4
|
import metaLevelNodesVerifier from "./verifier/nodes/metaLevel";
|
|
5
|
-
import IntrinsicLevelLocalContext from "./context/local/intrinsicLevel";
|
|
6
5
|
import intrinsicLevelAgainstMetaLevelNodesVerifier from "./verifier/nodes/intrinsicLevelAgainstMetaLevel";
|
|
7
6
|
|
|
8
7
|
import { match } from "./utilities/array";
|
|
@@ -37,10 +36,10 @@ export default class Premise {
|
|
|
37
36
|
let matchesStatementNode = false;
|
|
38
37
|
|
|
39
38
|
if (this.metastatementNode !== null) {
|
|
40
|
-
const
|
|
39
|
+
const fileContextA = fileContext, ///
|
|
41
40
|
nonTerminalNodeA = this.metastatementNode, ///
|
|
42
41
|
nonTerminalNodeB = statementNode, ///
|
|
43
|
-
localContextA =
|
|
42
|
+
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
44
43
|
localContextB = localContext, ///
|
|
45
44
|
nonTerminalNodeVerified = intrinsicLevelAgainstMetaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
46
45
|
const verifiedAhead = true;
|
|
@@ -70,10 +69,10 @@ export default class Premise {
|
|
|
70
69
|
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
71
70
|
|
|
72
71
|
matchesSubproofNode = match(subproofAssertionMetastatementNodes, subproofStatementNodes, (subproofAssertionMetastatementNode, subproofStatementNode) => {
|
|
73
|
-
const
|
|
72
|
+
const fileContextA = fileContext, ///
|
|
74
73
|
nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
75
74
|
nonTerminalNodeB = subproofStatementNode, ///
|
|
76
|
-
localContextA =
|
|
75
|
+
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
77
76
|
localContextB = localContext, ///
|
|
78
77
|
nonTerminalNodeVerified = intrinsicLevelAgainstMetaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
79
78
|
const verifiedAhead = true;
|
|
@@ -107,10 +106,10 @@ export default class Premise {
|
|
|
107
106
|
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
108
107
|
|
|
109
108
|
matchesRuleSubproofNode = match(subproofAssertionMetastatementNodes, ruleSubproofMetastatementNodes, (subproofAssertionMetastatementNode, ruleSubproofMetastatementNode) => {
|
|
110
|
-
const
|
|
109
|
+
const fileContextA = fileContext, ///
|
|
111
110
|
nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
112
111
|
nonTerminalNodeB = ruleSubproofMetastatementNode, ///
|
|
113
|
-
localContextA =
|
|
112
|
+
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
114
113
|
localContextB = localContext, ///
|
|
115
114
|
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
116
115
|
const verifiedAhead = true;
|
|
@@ -144,10 +143,10 @@ export default class Premise {
|
|
|
144
143
|
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
145
144
|
|
|
146
145
|
matchesMetaSubproofNode = match(subproofAssertionMetastatementNodes, metaSubproofMetastatementNodes, (subproofAssertionMetastatementNode, ruleSubproofMetastatementNode) => {
|
|
147
|
-
const
|
|
146
|
+
const fileContextA = fileContext, ///
|
|
148
147
|
nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
149
148
|
nonTerminalNodeB = ruleSubproofMetastatementNode, ///
|
|
150
|
-
localContextA =
|
|
149
|
+
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
151
150
|
localContextB = localContext, ///
|
|
152
151
|
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
153
152
|
const verifiedAhead = true;
|
|
@@ -169,10 +168,10 @@ export default class Premise {
|
|
|
169
168
|
let matchesMetastatementNode = false;
|
|
170
169
|
|
|
171
170
|
if (this.metastatementNode !== null) {
|
|
172
|
-
const
|
|
171
|
+
const fileContextA = fileContext, ///
|
|
173
172
|
nonTerminalNodeA = this.metastatementNode, ///
|
|
174
173
|
nonTerminalNodeB = metastatementNode, ///
|
|
175
|
-
localContextA =
|
|
174
|
+
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
176
175
|
localContextB = localContext, ///
|
|
177
176
|
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
178
177
|
const verifiedAhead = true;
|
package/src/verify/axiom.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Axiom from "../axiom";
|
|
4
|
+
import LocalContext from "../context/local";
|
|
4
5
|
import verifyLabels from "../verify/labels";
|
|
5
6
|
import verifyConsequent from "../verify/consequent";
|
|
6
7
|
import verifySuppositions from "../verify/suppositions";
|
|
7
|
-
import IntrinsicLevelLocalContext from "../context/local/intrinsicLevel";
|
|
8
8
|
|
|
9
9
|
import { first } from "../utilities/array";
|
|
10
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -16,10 +16,9 @@ const labelNodesQuery = nodesQuery("/axiom/label"),
|
|
|
16
16
|
export default function verifyAxiom(axiomNode, fileContext) {
|
|
17
17
|
let axiomVerified = false;
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
labelNodes = labelNodesQuery(axiomNode),
|
|
19
|
+
const labelNodes = labelNodesQuery(axiomNode),
|
|
21
20
|
labelsString = fileContext.nodesAsString(labelNodes),
|
|
22
|
-
localContext =
|
|
21
|
+
localContext = LocalContext.fromFileContext(fileContext);
|
|
23
22
|
|
|
24
23
|
fileContext.trace(`Verifying the '${labelsString}' axiom...`, axiomNode);
|
|
25
24
|
|
package/src/verify/conjecture.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import Conjecture from "../conjecture";
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import verifyLabels from "../verify/labels";
|
|
6
|
+
import LocalContext from "../context/local";
|
|
6
7
|
import verifyConsequent from "../verify/consequent";
|
|
7
8
|
import verifySuppositions from "../verify/suppositions";
|
|
8
|
-
import IntrinsicLevelLocalContext from "../context/local/intrinsicLevel";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -18,10 +18,9 @@ const proofNodeQuery = nodeQuery("/conjecture/proof!"),
|
|
|
18
18
|
export default function verifyConjecture(conjectureNode, fileContext) {
|
|
19
19
|
let conjectureVerified = false;
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
labelNodes = labelNodesQuery(conjectureNode),
|
|
21
|
+
const labelNodes = labelNodesQuery(conjectureNode),
|
|
23
22
|
labelsString = fileContext.nodesAsString(labelNodes),
|
|
24
|
-
localContext =
|
|
23
|
+
localContext = LocalContext.fromFileContext(fileContext); ///
|
|
25
24
|
|
|
26
25
|
fileContext.trace(`Verifying the '${labelsString}' conjecture...`, conjectureNode);
|
|
27
26
|
|
package/src/verify/lemma.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import Lemma from "../lemma";
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import verifyLabels from "../verify/labels";
|
|
6
|
+
import LocalContext from "../context/local";
|
|
6
7
|
import verifyConsequent from "../verify/consequent";
|
|
7
8
|
import verifySuppositions from "../verify/suppositions";
|
|
8
|
-
import IntrinsicLevelLocalContext from "../context/local/intrinsicLevel";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { EMPTY_STRING } from "../constants";
|
|
@@ -19,10 +19,9 @@ const proofNodeQuery = nodeQuery("/lemma/proof!"),
|
|
|
19
19
|
export default function verifyLemma(lemmaNode, fileContext) {
|
|
20
20
|
let lemmaVerified = false;
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
labelNodes = labelNodesQuery(lemmaNode),
|
|
22
|
+
const labelNodes = labelNodesQuery(lemmaNode),
|
|
24
23
|
labelsString = fileContext.nodesAsString(labelNodes),
|
|
25
|
-
localContext =
|
|
24
|
+
localContext = LocalContext.fromFileContext(fileContext);
|
|
26
25
|
|
|
27
26
|
(labelsString === EMPTY_STRING) ?
|
|
28
27
|
fileContext.trace(`Verifying a lemma...`, lemmaNode) :
|