occam-verify-cli 1.0.448 → 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 +50 -78
- package/lib/context/fragment.js +77 -0
- package/lib/context/release.js +3 -3
- 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/frame.js +40 -46
- package/lib/element/judgement.js +35 -56
- package/lib/element/metaType.js +5 -4
- package/lib/element/metavariable.js +6 -6
- package/lib/element/proof.js +4 -4
- 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 +5 -9
- package/lib/element/reference.js +24 -23
- package/lib/element/rule.js +4 -4
- package/lib/element/section.js +4 -4
- package/lib/element/statement.js +2 -7
- package/lib/element/subproof.js +4 -4
- 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 +18 -15
- 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/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/context.js +28 -0
- package/lib/utilities/element.js +101 -99
- package/lib/utilities/fragment.js +23 -0
- package/lib/utilities/instance.js +12 -34
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +42 -21
- package/lib/utilities/unification.js +17 -17
- package/lib/utilities/validation.js +22 -25
- package/package.json +2 -2
- package/src/constants.js +0 -1
- package/src/context/file.js +48 -55
- package/src/context/fragment.js +38 -0
- package/src/context/release.js +4 -2
- package/src/context/{local.js → scoped.js} +8 -100
- 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/frame.js +36 -48
- package/src/element/judgement.js +33 -58
- package/src/element/metaType.js +4 -4
- package/src/element/metavariable.js +8 -6
- package/src/element/proof.js +3 -3
- package/src/element/{premise.js → proofAssertion/premise.js} +23 -23
- package/src/element/{step.js → proofAssertion/step.js} +32 -40
- package/src/element/{supposition.js → proofAssertion/supposition.js} +24 -24
- package/src/element/proofAssertion.js +6 -13
- package/src/element/reference.js +23 -21
- package/src/element/rule.js +3 -3
- package/src/element/section.js +4 -4
- package/src/element/statement.js +2 -9
- package/src/element/subproof.js +3 -3
- 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} +15 -15
- 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} +9 -9
- 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 -7
- package/src/element/type.js +2 -4
- package/src/element/variable.js +17 -17
- package/src/metaTypes.js +25 -9
- 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/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/context.js +20 -0
- package/src/utilities/element.js +169 -162
- package/src/utilities/fragment.js +11 -0
- package/src/utilities/instance.js +19 -42
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +53 -28
- package/src/utilities/unification.js +16 -16
- 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 -427
- package/lib/element/metaLemmaMetatheorem.js +0 -289
- package/lib/element/premise.js +0 -307
- package/lib/element/step.js +0 -311
- package/lib/element/supposition.js +0 -320
- 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
package/src/element/term.js
CHANGED
|
@@ -112,16 +112,15 @@ export default define(class Term extends Element {
|
|
|
112
112
|
return validates;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
let
|
|
115
|
+
validateGivenType(type, context) {
|
|
116
|
+
let validatesGivenType = false;
|
|
117
117
|
|
|
118
118
|
const typeString = type.getString(),
|
|
119
119
|
termString = this.getString(); ///
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
context.trace(`Validating the '${termString}' term given the '${typeString}' type...`);
|
|
122
122
|
|
|
123
|
-
const
|
|
124
|
-
validates = this.validate(context, () => {
|
|
123
|
+
const validates = this.validate(context, () => {
|
|
125
124
|
let verifiesAhead;
|
|
126
125
|
|
|
127
126
|
const typeEqualToOrSubTypeOfGivenTypeType = this.type.isEqualToOrSubTypeOf(type);
|
|
@@ -133,13 +132,15 @@ export default define(class Term extends Element {
|
|
|
133
132
|
return verifiesAhead;
|
|
134
133
|
});
|
|
135
134
|
|
|
136
|
-
|
|
135
|
+
if (validates) {
|
|
136
|
+
validatesGivenType = true;
|
|
137
|
+
}
|
|
137
138
|
|
|
138
|
-
if (
|
|
139
|
-
|
|
139
|
+
if (validatesGivenType) {
|
|
140
|
+
context.debug(`...validated the '${termString}' term given the '${typeString}' type.`);
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
return
|
|
143
|
+
return validatesGivenType;
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
toJSON() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "../../node/topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
import { define } from "
|
|
5
|
+
import { define } from "../../elements";
|
|
6
6
|
|
|
7
|
-
export default define(class Axiom extends
|
|
7
|
+
export default define(class Axiom extends TopLevelAssertion {
|
|
8
8
|
isSatisfiable() {
|
|
9
9
|
const signature = this.getSignature(),
|
|
10
10
|
satisfiable = (signature !== null);
|
|
@@ -225,19 +225,19 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
225
225
|
return lastProofAssertionUnifies;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
let
|
|
228
|
+
unifyTopLevelAssertion(topLevelAssertion, substitutions, context) {
|
|
229
|
+
let topLevelAssertionUnifies = false;
|
|
230
230
|
|
|
231
231
|
const node = this.getNode(),
|
|
232
232
|
axiomString = this.getString(),
|
|
233
|
-
|
|
233
|
+
topLevelAssertionString = topLevelAssertion.getString();
|
|
234
234
|
|
|
235
|
-
context.trace(`Unifying the '${
|
|
235
|
+
context.trace(`Unifying the '${topLevelAssertionString}' top level assertion with the '${axiomString}' axiom...`, node);
|
|
236
236
|
|
|
237
|
-
const hypothesesCorrelate =
|
|
237
|
+
const hypothesesCorrelate = topLevelAssertion.correlateHypotheses(context);
|
|
238
238
|
|
|
239
239
|
if (hypothesesCorrelate) {
|
|
240
|
-
const deduction =
|
|
240
|
+
const deduction = topLevelAssertion.getDeduction(), ///
|
|
241
241
|
specificContext = context; ///
|
|
242
242
|
|
|
243
243
|
context = this.getContext();
|
|
@@ -246,21 +246,21 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
246
246
|
deductionUnifies = this.unifyDeduction(deduction, substitutions, generalContext, specificContext);
|
|
247
247
|
|
|
248
248
|
if (deductionUnifies) {
|
|
249
|
-
const suppositions =
|
|
249
|
+
const suppositions = topLevelAssertion.getSuppositions(),
|
|
250
250
|
suppositionsUnify = this.unifySuppositions(suppositions, substitutions, generalContext, specificContext);
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
topLevelAssertionUnifies = suppositionsUnify; ///
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
if (
|
|
257
|
-
context.debug(`...unified the '${
|
|
256
|
+
if (topLevelAssertionUnifies) {
|
|
257
|
+
context.debug(`...unified the '${topLevelAssertionString}' top level assertion with the '${axiomString}' axiom.`, node);
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
return
|
|
260
|
+
return topLevelAssertionUnifies;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
static name = "Axiom";
|
|
264
264
|
|
|
265
|
-
static fromJSON(json, context) { return
|
|
265
|
+
static fromJSON(json, context) { return TopLevelAssertion.fromJSON(Axiom, json, context); }
|
|
266
266
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "../topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
import { define } from "
|
|
5
|
+
import { define } from "../../elements";
|
|
6
6
|
|
|
7
|
-
export default define(class Conjecture extends
|
|
7
|
+
export default define(class Conjecture extends TopLevelAssertion {
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
@@ -30,5 +30,5 @@ export default define(class Conjecture extends AxiomLemmaTheoremConjecture {
|
|
|
30
30
|
|
|
31
31
|
static name = "Conjecture";
|
|
32
32
|
|
|
33
|
-
static fromJSON(json, context) { return
|
|
33
|
+
static fromJSON(json, context) { return TopLevelAssertion.fromJSON(Conjecture, json, context); }
|
|
34
34
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "../topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
import { define } from "
|
|
5
|
+
import { define } from "../../elements";
|
|
6
6
|
|
|
7
|
-
export default define(class Lemma extends
|
|
7
|
+
export default define(class Lemma extends TopLevelAssertion {
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import TopLevelAssertion from "../topLevelAssertion";
|
|
4
4
|
|
|
5
|
-
import { define } from "
|
|
5
|
+
import { define } from "../../elements";
|
|
6
6
|
|
|
7
|
-
export default define(class Theorem extends
|
|
7
|
+
export default define(class Theorem extends TopLevelAssertion {
|
|
8
8
|
verify() {
|
|
9
9
|
let verifies;
|
|
10
10
|
|
|
@@ -29,5 +29,5 @@ export default define(class Theorem extends AxiomLemmaTheoremConjecture {
|
|
|
29
29
|
|
|
30
30
|
static name = "Theorem";
|
|
31
31
|
|
|
32
|
-
static fromJSON(json, context) { return
|
|
32
|
+
static fromJSON(json, context) { return TopLevelAssertion.fromJSON(Theorem, json, context); }
|
|
33
33
|
});
|
|
@@ -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
|
|
|
@@ -100,9 +100,9 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
100
100
|
|
|
101
101
|
if (hypothetical) {
|
|
102
102
|
const proofAssertions = context.getProofAssertions(),
|
|
103
|
-
|
|
103
|
+
topLevelAssertionString = this.getString(); ///
|
|
104
104
|
|
|
105
|
-
context.trace(`Correlating the hypotheses of the '${
|
|
105
|
+
context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}' top level assertion...`, this.node);
|
|
106
106
|
|
|
107
107
|
correlatesToHypotheses = correlate(this.hypotheses, proofAssertions, (hypothesis, proofAssertion) => {
|
|
108
108
|
const hypothesesComparesToStep = hypothesis.compareProofAssertion(proofAssertion, context);
|
|
@@ -113,7 +113,7 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
if (correlatesToHypotheses) {
|
|
116
|
-
context.debug(`...correlated the hypotheses of the '${
|
|
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) {
|
|
@@ -306,8 +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
|
|
311
|
+
return topLevelAssertion;
|
|
312
312
|
}
|
|
313
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,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Element from "../element";
|
|
4
|
-
import
|
|
4
|
+
import ScopedContext from "../context/scoped";
|
|
5
5
|
|
|
6
6
|
import { labelFromJSON,
|
|
7
7
|
labelToLabelJSON,
|
|
@@ -12,7 +12,7 @@ import { labelFromJSON,
|
|
|
12
12
|
suppositionsToSuppositionsJSON,
|
|
13
13
|
substitutionsToSubstitutionsJSON } from "../utilities/json";
|
|
14
14
|
|
|
15
|
-
export default class
|
|
15
|
+
export default class TopLevelMetaAssertion extends Element {
|
|
16
16
|
constructor(context, string, node, label, suppositions, deduction, proof, substitutions) {
|
|
17
17
|
super(context, string, node);
|
|
18
18
|
|
|
@@ -59,8 +59,8 @@ export default class MetaLemmaMetatheorem extends Element {
|
|
|
59
59
|
const labelVerifies = this.verifyLabel();
|
|
60
60
|
|
|
61
61
|
if (labelVerifies) {
|
|
62
|
-
const
|
|
63
|
-
context =
|
|
62
|
+
const scopedContext = ScopedContext.fromNothing(this.context),
|
|
63
|
+
context = scopedContext, ///
|
|
64
64
|
suppositionsVerify = this.verifySuppositions(context);
|
|
65
65
|
|
|
66
66
|
if (suppositionsVerify) {
|
|
@@ -148,9 +148,9 @@ export default class MetaLemmaMetatheorem extends Element {
|
|
|
148
148
|
substitutions = substitutionsFromJSON(json, context),
|
|
149
149
|
node = null,
|
|
150
150
|
proof = null,
|
|
151
|
-
string =
|
|
152
|
-
|
|
151
|
+
string = topLevelMetaAssertionStringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
|
|
152
|
+
topLevelMetaAssertion = new Class(context, string, node, label, suppositions, deduction, proof, substitutions);
|
|
153
153
|
|
|
154
|
-
return
|
|
154
|
+
return topLevelMetaAssertion;
|
|
155
155
|
}
|
|
156
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
|
@@ -21,34 +21,50 @@ export function getMetaTypes() {
|
|
|
21
21
|
return metaTypes;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export function
|
|
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() {
|
|
25
38
|
if (frameMetaType === null) {
|
|
26
39
|
const { MetaType } = elements,
|
|
27
|
-
name = FRAME_META_TYPE_NAME
|
|
40
|
+
name = FRAME_META_TYPE_NAME, ///
|
|
41
|
+
context = null;
|
|
28
42
|
|
|
29
|
-
frameMetaType = MetaType.fromName(name);
|
|
43
|
+
frameMetaType = MetaType.fromName(name, context);
|
|
30
44
|
}
|
|
31
45
|
|
|
32
46
|
return frameMetaType;
|
|
33
47
|
}
|
|
34
48
|
|
|
35
|
-
|
|
49
|
+
function statementMetaTypeFromNothing() {
|
|
36
50
|
if (statementMetaType === null) {
|
|
37
51
|
const { MetaType } = elements,
|
|
38
|
-
name = STATEMENT_META_TYPE_NAME
|
|
52
|
+
name = STATEMENT_META_TYPE_NAME, ///
|
|
53
|
+
context = null;
|
|
39
54
|
|
|
40
|
-
statementMetaType = MetaType.fromName(name);
|
|
55
|
+
statementMetaType = MetaType.fromName(name, context);
|
|
41
56
|
}
|
|
42
57
|
|
|
43
58
|
return statementMetaType;
|
|
44
59
|
}
|
|
45
60
|
|
|
46
|
-
|
|
61
|
+
function referenceMetaTypeFromNothing() {
|
|
47
62
|
if (referenceMetaType === null) {
|
|
48
63
|
const { MetaType } = elements,
|
|
49
|
-
name = REFERENCE_META_TYPE_NAME
|
|
64
|
+
name = REFERENCE_META_TYPE_NAME, ///
|
|
65
|
+
context = null;
|
|
50
66
|
|
|
51
|
-
referenceMetaType = MetaType.fromName(name);
|
|
67
|
+
referenceMetaType = MetaType.fromName(name, context);
|
|
52
68
|
}
|
|
53
69
|
|
|
54
70
|
return referenceMetaType;
|
|
@@ -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
|
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TopLevelAssertionNode from "../../node/topLevelAssertion";
|
|
4
|
+
|
|
5
|
+
import { CONJECTURE_BODY_RULE_NAME, CONJECTURE_HEADER_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class ConjectureNode extends TopLevelAssertionNode {
|
|
8
|
+
static bodyRuleName = CONJECTURE_BODY_RULE_NAME;
|
|
9
|
+
|
|
10
|
+
static headerRuleName = CONJECTURE_HEADER_RULE_NAME;
|
|
11
|
+
|
|
12
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return TopLevelAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(ConjectureNode, ruleName, childNodes, opacity, precedence); }
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TopLevelAssertionNode from "../../node/topLevelAssertion";
|
|
4
|
+
|
|
5
|
+
import { LEMMA_BODY_RULE_NAME, LEMMA_HEADER_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class LemmaNode extends TopLevelAssertionNode {
|
|
8
|
+
static bodyRuleName = LEMMA_BODY_RULE_NAME;
|
|
9
|
+
|
|
10
|
+
static headerRuleName = LEMMA_HEADER_RULE_NAME;
|
|
11
|
+
|
|
12
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return TopLevelAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(LemmaNode, ruleName, childNodes, opacity, precedence); }
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TopLevelAssertionNode from "../../node/topLevelAssertion";
|
|
4
|
+
|
|
5
|
+
import { THEOREM_BODY_RULE_NAME, THEOREM_HEADER_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class TheoremNode extends TopLevelAssertionNode {
|
|
8
|
+
static bodyRuleName = THEOREM_BODY_RULE_NAME;
|
|
9
|
+
|
|
10
|
+
static headerRuleName = THEOREM_HEADER_RULE_NAME;
|
|
11
|
+
|
|
12
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return TopLevelAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(TheoremNode, ruleName, childNodes, opacity, precedence); }
|
|
13
|
+
}
|