occam-verify-cli 1.0.444 → 1.0.457
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 +1 -5
- package/lib/context/file.js +54 -82
- package/lib/context/fragment.js +77 -0
- package/lib/context/release.js +5 -9
- package/lib/context/scoped.js +314 -0
- package/lib/context/transient.js +371 -0
- package/lib/element/assumption.js +71 -84
- package/lib/element/combinator/bracketed.js +1 -10
- package/lib/element/conclusion.js +11 -8
- package/lib/element/constructor/bracketed.js +1 -10
- package/lib/element/declaration/combinator.js +1 -2
- package/lib/element/declaration/metavariable.js +3 -3
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +18 -13
- package/lib/element/derivation.js +14 -14
- package/lib/element/frame.js +40 -46
- package/lib/element/hypothesis.js +14 -55
- package/lib/element/judgement.js +35 -56
- package/lib/element/metaType.js +5 -4
- package/lib/element/metavariable.js +14 -10
- package/lib/element/proof.js +10 -10
- package/lib/element/proofAssertion/premise.js +308 -0
- package/lib/element/proofAssertion/step.js +305 -0
- package/lib/element/proofAssertion/supposition.js +322 -0
- package/lib/element/proofAssertion.js +199 -0
- package/lib/element/reference.js +28 -25
- package/lib/element/rule.js +29 -29
- package/lib/element/section.js +4 -4
- package/lib/element/statement.js +9 -14
- package/lib/element/subDerivation.js +14 -14
- package/lib/element/subproof.js +14 -14
- package/lib/element/substitution/frame.js +7 -7
- package/lib/element/substitution/statement.js +15 -39
- package/lib/element/substitution.js +5 -5
- package/lib/element/term.js +12 -10
- package/lib/element/topLevelAssertion/axiom.js +329 -0
- package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +6 -6
- package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/element/topLevelAssertion.js +427 -0
- package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/element/topLevelMetaAssertion.js +289 -0
- package/lib/element/type.js +4 -4
- package/lib/element/variable.js +20 -20
- package/lib/metaTypes.js +33 -19
- package/lib/node/proofAssertion/premise.js +116 -0
- package/lib/node/proofAssertion/step.js +152 -0
- package/lib/node/proofAssertion/supposition.js +116 -0
- package/lib/node/{premise.js → proofAssertion.js} +11 -18
- package/lib/node/statement.js +2 -2
- package/lib/node/subDerivation.js +1 -8
- package/lib/node/subproof.js +1 -8
- package/lib/node/substitution/statement.js +2 -2
- package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
- package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
- package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
- package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
- package/lib/nonTerminalNodeMap.js +13 -13
- package/lib/preamble.js +10 -10
- package/lib/process/instantiate.js +6 -9
- package/lib/process/unify.js +7 -6
- package/lib/types.js +3 -3
- package/lib/utilities/bnf.js +5 -5
- package/lib/utilities/brackets.js +6 -11
- package/lib/utilities/context.js +28 -0
- package/lib/utilities/element.js +101 -99
- package/lib/utilities/fragment.js +23 -0
- package/lib/utilities/instance.js +12 -21
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +44 -23
- package/lib/utilities/unification.js +36 -36
- package/lib/utilities/validation.js +22 -25
- package/package.json +6 -6
- package/src/constants.js +0 -1
- package/src/context/file.js +51 -58
- package/src/context/fragment.js +38 -0
- package/src/context/release.js +6 -11
- package/src/context/{local.js → scoped.js} +35 -127
- package/src/context/{temporary.js → transient.js} +9 -131
- package/src/element/assumption.js +69 -85
- package/src/element/combinator/bracketed.js +0 -7
- package/src/element/conclusion.js +14 -10
- package/src/element/constructor/bracketed.js +0 -7
- package/src/element/declaration/combinator.js +0 -1
- package/src/element/declaration/metavariable.js +2 -2
- package/src/element/declaration/variable.js +5 -5
- package/src/element/deduction.js +22 -15
- package/src/element/derivation.js +12 -12
- package/src/element/frame.js +36 -48
- package/src/element/hypothesis.js +14 -16
- package/src/element/judgement.js +33 -58
- package/src/element/metaType.js +4 -4
- package/src/element/metavariable.js +17 -10
- package/src/element/proof.js +9 -9
- package/src/element/{premise.js → proofAssertion/premise.js} +107 -75
- package/src/element/{step.js → proofAssertion/step.js} +43 -89
- package/src/element/{supposition.js → proofAssertion/supposition.js} +89 -88
- package/src/element/proofAssertion.js +69 -0
- package/src/element/reference.js +27 -23
- package/src/element/rule.js +25 -25
- package/src/element/section.js +4 -4
- package/src/element/statement.js +8 -15
- package/src/element/subDerivation.js +12 -12
- package/src/element/subproof.js +10 -10
- package/src/element/substitution/frame.js +10 -13
- package/src/element/substitution/statement.js +20 -52
- package/src/element/substitution.js +3 -3
- package/src/element/term.js +10 -9
- package/src/element/{axiom.js → topLevelAssertion/axiom.js} +41 -41
- package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +4 -4
- package/src/element/{lemma.js → topLevelAssertion/lemma.js} +3 -3
- package/src/element/{theorem.js → topLevelAssertion/theorem.js} +4 -4
- package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +30 -49
- package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +4 -4
- package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +4 -4
- package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +7 -72
- package/src/element/type.js +2 -4
- package/src/element/variable.js +17 -17
- package/src/metaTypes.js +42 -13
- package/src/node/proofAssertion/premise.js +16 -0
- package/src/node/{step.js → proofAssertion/step.js} +4 -18
- package/src/node/proofAssertion/supposition.js +16 -0
- package/src/node/proofAssertion.js +23 -0
- package/src/node/statement.js +1 -1
- package/src/node/subDerivation.js +0 -7
- package/src/node/subproof.js +0 -7
- package/src/node/substitution/statement.js +1 -1
- package/src/node/topLevelAssertion/axiom.js +13 -0
- package/src/node/topLevelAssertion/conjecture.js +13 -0
- package/src/node/topLevelAssertion/lemma.js +13 -0
- package/src/node/topLevelAssertion/theorem.js +13 -0
- package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
- package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
- package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
- package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
- package/src/nonTerminalNodeMap.js +12 -12
- package/src/preamble.js +9 -9
- package/src/process/instantiate.js +31 -32
- package/src/process/unify.js +6 -5
- package/src/types.js +4 -2
- package/src/utilities/bnf.js +3 -2
- package/src/utilities/brackets.js +5 -8
- package/src/utilities/context.js +20 -0
- package/src/utilities/element.js +169 -162
- package/src/utilities/fragment.js +11 -0
- package/src/utilities/instance.js +19 -24
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +57 -32
- package/src/utilities/unification.js +39 -39
- package/src/utilities/validation.js +26 -35
- package/lib/context/local.js +0 -605
- package/lib/context/temporary.js +0 -752
- package/lib/element/axiom.js +0 -329
- package/lib/element/axiomLemmaTheoremConjecture.js +0 -434
- package/lib/element/metaLemmaMetatheorem.js +0 -322
- package/lib/element/premise.js +0 -380
- package/lib/element/step.js +0 -390
- package/lib/element/supposition.js +0 -410
- package/lib/node/step.js +0 -166
- package/lib/node/supposition.js +0 -130
- package/src/node/axiom.js +0 -13
- package/src/node/conjecture.js +0 -13
- package/src/node/lemma.js +0 -13
- package/src/node/metaLemma.js +0 -13
- package/src/node/metatheorem.js +0 -13
- package/src/node/premise.js +0 -30
- package/src/node/supposition.js +0 -30
- package/src/node/theorem.js +0 -13
|
@@ -4,7 +4,7 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import Element from "../element";
|
|
6
6
|
import elements from "../elements";
|
|
7
|
-
import
|
|
7
|
+
import ScopedContext from "../context/scoped";
|
|
8
8
|
|
|
9
9
|
import { labelsFromJSON,
|
|
10
10
|
deductionFromJSON,
|
|
@@ -19,7 +19,7 @@ import { labelsFromJSON,
|
|
|
19
19
|
|
|
20
20
|
const { extract, reverse, correlate, backwardsEvery } = arrayUtilities;
|
|
21
21
|
|
|
22
|
-
export default class
|
|
22
|
+
export default class TopLevelAssertion extends Element {
|
|
23
23
|
constructor(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses) {
|
|
24
24
|
super(context, string, node);
|
|
25
25
|
|
|
@@ -99,21 +99,21 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
99
99
|
const hypothetical = this.isHypothetical();
|
|
100
100
|
|
|
101
101
|
if (hypothetical) {
|
|
102
|
-
const
|
|
102
|
+
const proofAssertions = context.getProofAssertions(),
|
|
103
103
|
topLevelAssertionString = this.getString(); ///
|
|
104
104
|
|
|
105
|
-
context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}'
|
|
105
|
+
context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}' top level assertion...`, this.node);
|
|
106
106
|
|
|
107
|
-
correlatesToHypotheses = correlate(this.hypotheses,
|
|
108
|
-
const
|
|
107
|
+
correlatesToHypotheses = correlate(this.hypotheses, proofAssertions, (hypothesis, proofAssertion) => {
|
|
108
|
+
const hypothesesComparesToStep = hypothesis.compareProofAssertion(proofAssertion, context);
|
|
109
109
|
|
|
110
|
-
if (
|
|
110
|
+
if (hypothesesComparesToStep) {
|
|
111
111
|
return true;
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
if (correlatesToHypotheses) {
|
|
116
|
-
context.debug(`...correlated the hypotheses of the '${topLevelAssertionString}'
|
|
116
|
+
context.debug(`...correlated the hypotheses of the '${topLevelAssertionString}' top level assertion.`, this.node);
|
|
117
117
|
}
|
|
118
118
|
} else {
|
|
119
119
|
correlatesToHypotheses = true
|
|
@@ -128,8 +128,8 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
128
128
|
const labelsVerify = this.verifyLabels();
|
|
129
129
|
|
|
130
130
|
if (labelsVerify) {
|
|
131
|
-
const
|
|
132
|
-
context =
|
|
131
|
+
const scopedContext = ScopedContext.fromNothing(this.context),
|
|
132
|
+
context = scopedContext, ///
|
|
133
133
|
suppositionsVerify = this.verifySuppositions(context);
|
|
134
134
|
|
|
135
135
|
if (suppositionsVerify) {
|
|
@@ -212,7 +212,7 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
212
212
|
return statementUnifiesWithDeduction;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
unifyStatementAndStepsOrSubproofs(statement,
|
|
215
|
+
unifyStatementAndStepsOrSubproofs(statement, subproofOrProofAssertions, substitutions, context) {
|
|
216
216
|
let statementAndStepsOrSubproofsUnifies = false;
|
|
217
217
|
|
|
218
218
|
const correlatesToHypotheses = this.correlateHypotheses(context);
|
|
@@ -221,9 +221,9 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
221
221
|
const statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, context);
|
|
222
222
|
|
|
223
223
|
if (statementUnifiesWithDeduction) {
|
|
224
|
-
const
|
|
224
|
+
const subproofOrProofAssertionsUnifyWithSuppositions = this.unifyStepsOrSubproofsWithSuppositions(subproofOrProofAssertions, substitutions, context);
|
|
225
225
|
|
|
226
|
-
if (
|
|
226
|
+
if (subproofOrProofAssertionsUnifyWithSuppositions) {
|
|
227
227
|
const substitutionsResolved = substitutions.areResolved();
|
|
228
228
|
|
|
229
229
|
if (substitutionsResolved) {
|
|
@@ -236,43 +236,43 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
236
236
|
return statementAndStepsOrSubproofsUnifies;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
unifyStepsOrSubproofsWithSupposition(
|
|
240
|
-
let
|
|
239
|
+
unifyStepsOrSubproofsWithSupposition(subproofOrProofAssertions, supposition, substitutions, generalContext, specificContext) {
|
|
240
|
+
let subproofOrProofAssertionsUnifiesWithSupposition = false;
|
|
241
241
|
|
|
242
242
|
const context = specificContext, ///
|
|
243
243
|
suppositionUnifiesIndependently = supposition.unifyIndependently(substitutions, context);
|
|
244
244
|
|
|
245
245
|
if (suppositionUnifiesIndependently) {
|
|
246
|
-
|
|
246
|
+
subproofOrProofAssertionsUnifiesWithSupposition = true;
|
|
247
247
|
} else {
|
|
248
|
-
const
|
|
249
|
-
const
|
|
248
|
+
const subproofOrProofAssertion = extract(subproofOrProofAssertions, (subproofOrProofAssertion) => {
|
|
249
|
+
const subproofOrProofAssertionUnifies = supposition.unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, generalContext, specificContext);
|
|
250
250
|
|
|
251
|
-
if (
|
|
251
|
+
if (subproofOrProofAssertionUnifies) {
|
|
252
252
|
return true;
|
|
253
253
|
}
|
|
254
254
|
}) || null;
|
|
255
255
|
|
|
256
|
-
if (
|
|
257
|
-
|
|
256
|
+
if (subproofOrProofAssertion !== null) {
|
|
257
|
+
subproofOrProofAssertionsUnifiesWithSupposition = true;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
return
|
|
261
|
+
return subproofOrProofAssertionsUnifiesWithSupposition;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
unifyStepsOrSubproofsWithSuppositions(
|
|
265
|
-
|
|
264
|
+
unifyStepsOrSubproofsWithSuppositions(subproofOrProofAssertions, substitutions, generalContext, specificContext) {
|
|
265
|
+
subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
|
|
266
266
|
|
|
267
|
-
const
|
|
268
|
-
const
|
|
267
|
+
const subproofOrProofAssertionsUnifyWithSuppositions = backwardsEvery(this.suppositions, (supposition) => {
|
|
268
|
+
const subproofOrProofAssertionsUnifiesWithSupposition = this.unifyStepsOrSubproofsWithSupposition(subproofOrProofAssertions, supposition, substitutions, generalContext, specificContext);
|
|
269
269
|
|
|
270
|
-
if (
|
|
270
|
+
if (subproofOrProofAssertionsUnifiesWithSupposition) {
|
|
271
271
|
return true;
|
|
272
272
|
}
|
|
273
273
|
});
|
|
274
274
|
|
|
275
|
-
return
|
|
275
|
+
return subproofOrProofAssertionsUnifyWithSuppositions;
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
toJSON() {
|
|
@@ -306,27 +306,8 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
306
306
|
node = null,
|
|
307
307
|
proof = null,
|
|
308
308
|
string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
309
|
-
|
|
309
|
+
topLevelAssertion = new Class(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
310
310
|
|
|
311
|
-
return
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
static fromNode(Class, node, context) {
|
|
315
|
-
const topLevelAssertionNode = node, ///
|
|
316
|
-
proofNode = topLevelAssertionNode.getProofNode(),
|
|
317
|
-
labelNodes = topLevelAssertionNode.getLabelNodes(),
|
|
318
|
-
deductionNode = topLevelAssertionNode.getDeductionNode(),
|
|
319
|
-
suppositionNodes = topLevelAssertionNode.getSuppositionNodes(),
|
|
320
|
-
signatureNode = topLevelAssertionNode.getSignatureNode(),
|
|
321
|
-
proof = proofFromProofNode(proofNode, context),
|
|
322
|
-
labels = labelsFromLabelNodes(labelNodes, context),
|
|
323
|
-
deduction = deductionFromDeductionNode(deductionNode, context),
|
|
324
|
-
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context),
|
|
325
|
-
signature = signatureFromSignatureNode(signatureNode, context),
|
|
326
|
-
hypotheses = [],
|
|
327
|
-
string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
328
|
-
axiomLemmaTheoremConjecture = new Class(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
329
|
-
|
|
330
|
-
return axiomLemmaTheoremConjecture;
|
|
311
|
+
return topLevelAssertion;
|
|
331
312
|
}
|
|
332
313
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelMetaAssertion from "./../topLevelMetaAssertion";
|
|
4
4
|
|
|
5
|
-
import { define } from "
|
|
5
|
+
import { define } from "../../elements";
|
|
6
6
|
|
|
7
|
-
export default define(class MetaLemma extends
|
|
7
|
+
export default define(class MetaLemma extends TopLevelMetaAssertion {
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
@@ -30,5 +30,5 @@ export default define(class MetaLemma extends MetaLemmaMetatheorem {
|
|
|
30
30
|
|
|
31
31
|
static name = "MetaLemma";
|
|
32
32
|
|
|
33
|
-
static fromJSON(json, context) { return
|
|
33
|
+
static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(MetaLemma, json, context); }
|
|
34
34
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelMetaAssertion from "../topLevelMetaAssertion";
|
|
4
4
|
|
|
5
|
-
import { define } from "
|
|
5
|
+
import { define } from "../../elements";
|
|
6
6
|
|
|
7
|
-
export default define(class Metatheorem extends
|
|
7
|
+
export default define(class Metatheorem extends TopLevelMetaAssertion {
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
@@ -30,5 +30,5 @@ export default define(class Metatheorem extends MetaLemmaMetatheorem {
|
|
|
30
30
|
|
|
31
31
|
static name = "Metatheorem";
|
|
32
32
|
|
|
33
|
-
static fromJSON(json, context) { return
|
|
33
|
+
static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(Metatheorem, json, context); }
|
|
34
34
|
});
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Element from "../element";
|
|
4
|
-
import
|
|
5
|
-
import LocalContext from "../context/local";
|
|
4
|
+
import ScopedContext from "../context/scoped";
|
|
6
5
|
|
|
7
|
-
import { proofFromProofNode, deductionFromDeductionNode, suppositionsFromSuppositionNodes } from "./axiomLemmaTheoremConjecture";
|
|
8
6
|
import { labelFromJSON,
|
|
9
7
|
labelToLabelJSON,
|
|
10
8
|
deductionFromJSON,
|
|
@@ -14,7 +12,7 @@ import { labelFromJSON,
|
|
|
14
12
|
suppositionsToSuppositionsJSON,
|
|
15
13
|
substitutionsToSubstitutionsJSON } from "../utilities/json";
|
|
16
14
|
|
|
17
|
-
export default class
|
|
15
|
+
export default class TopLevelMetaAssertion extends Element {
|
|
18
16
|
constructor(context, string, node, label, suppositions, deduction, proof, substitutions) {
|
|
19
17
|
super(context, string, node);
|
|
20
18
|
|
|
@@ -61,8 +59,8 @@ export default class MetaLemmaMetatheorem extends Element {
|
|
|
61
59
|
const labelVerifies = this.verifyLabel();
|
|
62
60
|
|
|
63
61
|
if (labelVerifies) {
|
|
64
|
-
const
|
|
65
|
-
context =
|
|
62
|
+
const scopedContext = ScopedContext.fromNothing(this.context),
|
|
63
|
+
context = scopedContext, ///
|
|
66
64
|
suppositionsVerify = this.verifySuppositions(context);
|
|
67
65
|
|
|
68
66
|
if (suppositionsVerify) {
|
|
@@ -150,72 +148,9 @@ export default class MetaLemmaMetatheorem extends Element {
|
|
|
150
148
|
substitutions = substitutionsFromJSON(json, context),
|
|
151
149
|
node = null,
|
|
152
150
|
proof = null,
|
|
153
|
-
string =
|
|
154
|
-
|
|
151
|
+
string = topLevelMetaAssertionStringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
|
|
152
|
+
topLevelMetaAssertion = new Class(context, string, node, label, suppositions, deduction, proof, substitutions);
|
|
155
153
|
|
|
156
|
-
return
|
|
154
|
+
return topLevelMetaAssertion;
|
|
157
155
|
}
|
|
158
|
-
|
|
159
|
-
static fromNode(Class, node, context) {
|
|
160
|
-
const { Substitutions } = elements,
|
|
161
|
-
topLevelAssertionNode = node, ///
|
|
162
|
-
proofNode = topLevelAssertionNode.getProofNode(),
|
|
163
|
-
labelNode = topLevelAssertionNode.getLabelNode(),
|
|
164
|
-
deductionNode = topLevelAssertionNode.getDeductionNode(),
|
|
165
|
-
suppositionNodes = topLevelAssertionNode.getSuppositionNodes(),
|
|
166
|
-
proof = proofFromProofNode(proofNode, context),
|
|
167
|
-
label = labelFromLabelNode(labelNode, context),
|
|
168
|
-
deduction = deductionFromDeductionNode(deductionNode, context),
|
|
169
|
-
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context),
|
|
170
|
-
substitutions = Substitutions.fromNothing(),
|
|
171
|
-
string = stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
|
|
172
|
-
metaLemmaMetatheorem = new Class(context, string, node, label, suppositions, deduction, proof, substitutions);
|
|
173
|
-
|
|
174
|
-
return metaLemmaMetatheorem;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function labelFromLabelNode(labelNode, context) {
|
|
179
|
-
let label = null;
|
|
180
|
-
|
|
181
|
-
const { Label } = elements;
|
|
182
|
-
|
|
183
|
-
if (labelNode !== null) {
|
|
184
|
-
label = Label.fromLabelNode(labelNode, context);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return label;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function labelStringFromLabel(label) {
|
|
191
|
-
const labelsString = (label !== null) ?
|
|
192
|
-
label.getString() :
|
|
193
|
-
null;
|
|
194
|
-
|
|
195
|
-
return labelsString;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function suppositionsStringFromSuppositions(suppositions) {
|
|
199
|
-
const suppositionsString = suppositions.reduce((suppositionsString, supposition) => {
|
|
200
|
-
const suppositionString = supposition.getString();
|
|
201
|
-
|
|
202
|
-
suppositionsString = (suppositionsString !== null) ?
|
|
203
|
-
`${suppositionsString}, ${suppositionString}` :
|
|
204
|
-
suppositionString; ///
|
|
205
|
-
|
|
206
|
-
return suppositionsString;
|
|
207
|
-
}, null);
|
|
208
|
-
|
|
209
|
-
return suppositionsString;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction) {
|
|
213
|
-
const suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
214
|
-
deductionString = deduction.getString(),
|
|
215
|
-
labelString = labelStringFromLabel(label),
|
|
216
|
-
string = (labelString === null) ?
|
|
217
|
-
deductionString : ///
|
|
218
|
-
`${labelString} :: [${suppositionsString}] ... ${deductionString}`;
|
|
219
|
-
|
|
220
|
-
return string;
|
|
221
156
|
}
|
package/src/element/type.js
CHANGED
|
@@ -321,14 +321,12 @@ export default define(class Type extends Element {
|
|
|
321
321
|
return type;
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
static
|
|
325
|
-
const
|
|
326
|
-
string = name, ///
|
|
324
|
+
static fromNameAndProvisional(name, provisional, context) {
|
|
325
|
+
const string = name, ///
|
|
327
326
|
node = null,
|
|
328
327
|
prefixName = null,
|
|
329
328
|
superTypes = [],
|
|
330
329
|
properties = [],
|
|
331
|
-
provisional = false,
|
|
332
330
|
type = new Type(context, string, node, name, prefixName, superTypes, properties, provisional);
|
|
333
331
|
|
|
334
332
|
return type;
|
package/src/element/variable.js
CHANGED
|
@@ -48,12 +48,12 @@ export default define(class Variable extends Element {
|
|
|
48
48
|
return comparesToVariablbeIdentifier;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
let
|
|
51
|
+
validate(context) {
|
|
52
|
+
let validates;
|
|
53
53
|
|
|
54
|
-
const variableString = this.
|
|
54
|
+
const variableString = this.getString(); ///
|
|
55
55
|
|
|
56
|
-
context.trace(`
|
|
56
|
+
context.trace(`Validating the '${variableString}' variable...`);
|
|
57
57
|
|
|
58
58
|
const variableIdentifier = this.identifier,
|
|
59
59
|
variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
@@ -63,24 +63,24 @@ export default define(class Variable extends Element {
|
|
|
63
63
|
|
|
64
64
|
this.type = type;
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
validates = true;
|
|
67
67
|
} else {
|
|
68
68
|
context.debug(`The '${variableString}' variable is not present.`);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
if (
|
|
72
|
-
context.debug(`...
|
|
71
|
+
if (validates) {
|
|
72
|
+
context.debug(`...validated the '${variableString}' variable.`);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
return
|
|
75
|
+
return validates;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
let
|
|
78
|
+
validateType(context) {
|
|
79
|
+
let typeValidates = false;
|
|
80
80
|
|
|
81
81
|
const typeString = this.type.getString();
|
|
82
82
|
|
|
83
|
-
context.trace(`
|
|
83
|
+
context.trace(`Validating the '${typeString}' type...`);
|
|
84
84
|
|
|
85
85
|
const prefixedTypeName = this.type.getPrefixedName(),
|
|
86
86
|
type = context.findTypeByPrefixedTypeName(prefixedTypeName);
|
|
@@ -90,21 +90,21 @@ export default define(class Variable extends Element {
|
|
|
90
90
|
} else {
|
|
91
91
|
this.type = type; ///
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
typeValidates = true;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
if (
|
|
97
|
-
context.debug(`...
|
|
96
|
+
if (typeValidates) {
|
|
97
|
+
context.debug(`...validated the '${typeString}' type.`);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
return
|
|
100
|
+
return typeValidates;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
unifyTerm(term, substitutions, generalContext, specificContext) {
|
|
104
104
|
let termUnifies = false;
|
|
105
105
|
|
|
106
106
|
const termString = term.getString(),
|
|
107
|
-
variableString = this.
|
|
107
|
+
variableString = this.getString(); ///
|
|
108
108
|
|
|
109
109
|
specificContext.trace(`Unifying the '${termString}' term with the '${variableString}' variable...`);
|
|
110
110
|
|
|
@@ -160,7 +160,7 @@ export default define(class Variable extends Element {
|
|
|
160
160
|
|
|
161
161
|
toJSON() {
|
|
162
162
|
const typeJSON = typeToTypeJSON(this.type),
|
|
163
|
-
string = this.
|
|
163
|
+
string = this.getString(), ///
|
|
164
164
|
type = typeJSON, ///
|
|
165
165
|
json = {
|
|
166
166
|
type,
|
package/src/metaTypes.js
CHANGED
|
@@ -8,35 +8,64 @@ let frameMetaType = null,
|
|
|
8
8
|
referenceMetaType = null,
|
|
9
9
|
statementMetaType = null;
|
|
10
10
|
|
|
11
|
-
export function
|
|
11
|
+
export function getMetaTypes() {
|
|
12
|
+
const frameMetaType = frameMetaTypeFromNothing(),
|
|
13
|
+
referenceMetaType = referenceMetaTypeFromNothing(),
|
|
14
|
+
statementMetaType = statementMetaTypeFromNothing(),
|
|
15
|
+
metaTypes = [
|
|
16
|
+
frameMetaType,
|
|
17
|
+
referenceMetaType,
|
|
18
|
+
statementMetaType
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
return metaTypes;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function findMetaTypeByMetaTypeName(metaTypeName) {
|
|
25
|
+
const metaTypes = getMetaTypes(),
|
|
26
|
+
metaType = metaTypes.find((metaType) => {
|
|
27
|
+
const metaTypeComparesToMetaTypeName = metaType.compareMetaTypeName(metaTypeName);
|
|
28
|
+
|
|
29
|
+
if (metaTypeComparesToMetaTypeName) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}) || null;
|
|
33
|
+
|
|
34
|
+
return metaType;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function frameMetaTypeFromNothing() {
|
|
12
38
|
if (frameMetaType === null) {
|
|
13
39
|
const { MetaType } = elements,
|
|
14
|
-
name = FRAME_META_TYPE_NAME
|
|
40
|
+
name = FRAME_META_TYPE_NAME, ///
|
|
41
|
+
context = null;
|
|
15
42
|
|
|
16
|
-
frameMetaType = MetaType.fromName(name);
|
|
43
|
+
frameMetaType = MetaType.fromName(name, context);
|
|
17
44
|
}
|
|
18
45
|
|
|
19
46
|
return frameMetaType;
|
|
20
47
|
}
|
|
21
48
|
|
|
22
|
-
|
|
23
|
-
if (
|
|
49
|
+
function statementMetaTypeFromNothing() {
|
|
50
|
+
if (statementMetaType === null) {
|
|
24
51
|
const { MetaType } = elements,
|
|
25
|
-
name =
|
|
52
|
+
name = STATEMENT_META_TYPE_NAME, ///
|
|
53
|
+
context = null;
|
|
26
54
|
|
|
27
|
-
|
|
55
|
+
statementMetaType = MetaType.fromName(name, context);
|
|
28
56
|
}
|
|
29
57
|
|
|
30
|
-
return
|
|
58
|
+
return statementMetaType;
|
|
31
59
|
}
|
|
32
60
|
|
|
33
|
-
|
|
34
|
-
if (
|
|
61
|
+
function referenceMetaTypeFromNothing() {
|
|
62
|
+
if (referenceMetaType === null) {
|
|
35
63
|
const { MetaType } = elements,
|
|
36
|
-
name =
|
|
64
|
+
name = REFERENCE_META_TYPE_NAME, ///
|
|
65
|
+
context = null;
|
|
37
66
|
|
|
38
|
-
|
|
67
|
+
referenceMetaType = MetaType.fromName(name, context);
|
|
39
68
|
}
|
|
40
69
|
|
|
41
|
-
return
|
|
70
|
+
return referenceMetaType;
|
|
42
71
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import ProofAssertionNode from "../../node/proofAssertion";
|
|
4
|
+
|
|
5
|
+
import { PROCEDURE_CALL_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class PremiseNode extends ProofAssertionNode {
|
|
8
|
+
getProcedureCallNode() {
|
|
9
|
+
const ruleName = PROCEDURE_CALL_RULE_NAME,
|
|
10
|
+
procedureCallNode = this.getNodeByRuleName(ruleName);
|
|
11
|
+
|
|
12
|
+
return procedureCallNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return ProofAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(PremiseNode, ruleName, childNodes, opacity, precedence); }
|
|
16
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import ProofAssertionNode from "../../node/proofAssertion";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { QUALIFICATION_RULE_NAME } from "../../ruleNames";
|
|
6
6
|
|
|
7
|
-
export default class StepNode extends
|
|
7
|
+
export default class StepNode extends ProofAssertionNode {
|
|
8
8
|
isStepNode() {
|
|
9
9
|
const stepNode = true;
|
|
10
10
|
|
|
@@ -41,20 +41,6 @@ export default class StepNode extends NonTerminalNode {
|
|
|
41
41
|
return satisfiedAssertionNode;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
getNonsenseNode() {
|
|
45
|
-
const ruleName = NONSENSE_RULE_NAME,
|
|
46
|
-
nonsenseNode = this.getNodeByRuleName(ruleName);
|
|
47
|
-
|
|
48
|
-
return nonsenseNode;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
getStatementNode() {
|
|
52
|
-
const ruleName = STATEMENT_RULE_NAME,
|
|
53
|
-
statementNode = this.getNodeByRuleName(ruleName);
|
|
54
|
-
|
|
55
|
-
return statementNode;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
44
|
getQualificationNode() {
|
|
59
45
|
const ruleName = QUALIFICATION_RULE_NAME,
|
|
60
46
|
qualificationNode = this.getNodeByRuleName(ruleName);
|
|
@@ -62,5 +48,5 @@ export default class StepNode extends NonTerminalNode {
|
|
|
62
48
|
return qualificationNode;
|
|
63
49
|
}
|
|
64
50
|
|
|
65
|
-
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return
|
|
51
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return ProofAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(StepNode, ruleName, childNodes, opacity, precedence); }
|
|
66
52
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import ProofAssertionNode from "../../node/proofAssertion";
|
|
4
|
+
|
|
5
|
+
import { PROCEDURE_CALL_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class SuppositionNode extends ProofAssertionNode {
|
|
8
|
+
getProcedureCallNode() {
|
|
9
|
+
const ruleName = PROCEDURE_CALL_RULE_NAME,
|
|
10
|
+
procedureCallNode = this.getNodeByRuleName(ruleName);
|
|
11
|
+
|
|
12
|
+
return procedureCallNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return ProofAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(SuppositionNode, ruleName, childNodes, opacity, precedence); }
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import NonTerminalNode from "../nonTerminalNode";
|
|
4
|
+
|
|
5
|
+
import { NONSENSE_RULE_NAME, STATEMENT_RULE_NAME } from "../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class ProofAssertionNode extends NonTerminalNode {
|
|
8
|
+
getNonsenseNode() {
|
|
9
|
+
const ruleName = NONSENSE_RULE_NAME,
|
|
10
|
+
nonsenseNode = this.getNodeByRuleName(ruleName);
|
|
11
|
+
|
|
12
|
+
return nonsenseNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getStatementNode() {
|
|
16
|
+
const ruleName = STATEMENT_RULE_NAME,
|
|
17
|
+
statementNode = this.getNodeByRuleName(ruleName);
|
|
18
|
+
|
|
19
|
+
return statementNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(Class, ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(Class, ruleName, childNodes, opacity, precedence); }
|
|
23
|
+
}
|
package/src/node/statement.js
CHANGED
|
@@ -36,7 +36,7 @@ export default class StatementNode extends NonTerminalNode {
|
|
|
36
36
|
|
|
37
37
|
const metavariableNode = this.getMetavariableNode();
|
|
38
38
|
|
|
39
|
-
if (
|
|
39
|
+
if (metavariableNode !== null) {
|
|
40
40
|
metavariableName = metavariableNode.getMetavariableName();
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -5,13 +5,6 @@ import NonTerminalNode from "../nonTerminalNode";
|
|
|
5
5
|
import { STEP_RULE_NAME, SUBPROOF_RULE_NAME } from "../ruleNames";
|
|
6
6
|
|
|
7
7
|
export default class SubDerivationNode extends NonTerminalNode {
|
|
8
|
-
getLastStepNode() {
|
|
9
|
-
const ruleName = STEP_RULE_NAME,
|
|
10
|
-
lastStepNode = this.getLastNodeByRuleName(ruleName);
|
|
11
|
-
|
|
12
|
-
return lastStepNode;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
8
|
getStepOrSubproofNodes() {
|
|
16
9
|
const ruleNames = [
|
|
17
10
|
STEP_RULE_NAME,
|
package/src/node/subproof.js
CHANGED
|
@@ -17,13 +17,6 @@ export default class SubproofNode extends NonTerminalNode {
|
|
|
17
17
|
return subproofNode;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
getLastStepNode() {
|
|
21
|
-
const subDerivationNode = this.getSubDerivationNode(),
|
|
22
|
-
lastStepNode = subDerivationNode.getLastStepNode();
|
|
23
|
-
|
|
24
|
-
return lastStepNode;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
20
|
getSuppositionNodes() {
|
|
28
21
|
const ruleName = SUPPOSITION_RULE_NAME,
|
|
29
22
|
suppositionNodes = this.getNodesByRuleName(ruleName);
|
|
@@ -13,7 +13,7 @@ export default class StatementSubstitutionNode extends SubstitutionNode {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
getMetavariableNode() {
|
|
16
|
-
const lastMetavariableNode = this.
|
|
16
|
+
const lastMetavariableNode = this.getLastMetavariableNode(),
|
|
17
17
|
metavariableNode = lastMetavariableNode; ///
|
|
18
18
|
|
|
19
19
|
return metavariableNode;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TopLevelAssertionNode from "../../node/topLevelAssertion";
|
|
4
|
+
|
|
5
|
+
import { AXIOM_BODY_RULE_NAME, AXIOM_HEADER_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class AxiomNode extends TopLevelAssertionNode {
|
|
8
|
+
static bodyRuleName = AXIOM_BODY_RULE_NAME;
|
|
9
|
+
|
|
10
|
+
static headerRuleName = AXIOM_HEADER_RULE_NAME;
|
|
11
|
+
|
|
12
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return TopLevelAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(AxiomNode, ruleName, childNodes, opacity, precedence); }
|
|
13
|
+
}
|