occam-verify-cli 1.0.448 → 1.0.472
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 +13 -5
- package/lib/context/ephemeral.js +270 -0
- package/lib/context/file.js +136 -128
- package/lib/context/liminal.js +120 -0
- package/lib/context/literal.js +92 -0
- package/lib/context/nominal.js +15 -1
- package/lib/context/release.js +68 -9
- package/lib/context/scoped.js +322 -0
- package/lib/context/synthetic.js +133 -0
- package/lib/element/assertion/contained.js +66 -66
- package/lib/element/assertion/defined.js +32 -32
- package/lib/element/assertion/property.js +39 -39
- package/lib/element/assertion/satisfies.js +22 -22
- package/lib/element/assumption.js +71 -87
- package/lib/element/combinator/bracketed.js +1 -10
- package/lib/element/conclusion.js +19 -15
- package/lib/element/constructor/bracketed.js +1 -10
- package/lib/element/constructor.js +2 -2
- 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 +26 -20
- package/lib/element/derivation.js +3 -3
- package/lib/element/equality.js +5 -5
- package/lib/element/equivalence.js +112 -107
- package/lib/element/equivalences.js +24 -10
- package/lib/element/error.js +3 -3
- package/lib/element/frame.js +73 -62
- package/lib/element/hypothesis.js +2 -2
- package/lib/element/judgement.js +40 -60
- package/lib/element/metaType.js +4 -4
- package/lib/element/metavariable.js +49 -38
- package/lib/element/parameter.js +13 -5
- package/lib/element/procedureCall.js +16 -16
- package/lib/element/proof.js +14 -13
- package/lib/element/proofAssertion/premise.js +319 -0
- package/lib/element/proofAssertion/step.js +309 -0
- package/lib/element/proofAssertion/supposition.js +333 -0
- package/lib/element/proofAssertion.js +20 -10
- package/lib/element/propertyRelation.js +2 -2
- package/lib/element/reference.js +72 -30
- package/lib/element/rule.js +26 -28
- package/lib/element/section.js +5 -5
- package/lib/element/signature.js +9 -6
- package/lib/element/statement.js +44 -36
- package/lib/element/subproof.js +18 -17
- package/lib/element/substitution/frame.js +86 -49
- package/lib/element/substitution/reference.js +101 -19
- package/lib/element/substitution/statement.js +128 -105
- package/lib/element/substitution/term.js +93 -57
- package/lib/element/substitution.js +20 -69
- package/lib/element/substitutions.js +49 -34
- package/lib/element/term.js +41 -30
- package/lib/element/topLevelAssertion/axiom.js +331 -0
- package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +10 -10
- package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +9 -9
- package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +8 -8
- package/lib/element/topLevelAssertion.js +434 -0
- package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +8 -8
- package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +8 -8
- package/lib/element/topLevelMetaAssertion.js +293 -0
- package/lib/element/type.js +4 -4
- package/lib/element/variable.js +48 -40
- package/lib/index.js +3 -3
- package/lib/main.js +3 -3
- package/lib/metaTypes.js +18 -15
- package/lib/node/frame.js +2 -2
- package/lib/node/metavariable.js +4 -4
- package/lib/node/parameter.js +28 -7
- 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/frame.js +9 -31
- package/lib/node/substitution/reference.js +137 -0
- package/lib/node/substitution/statement.js +9 -31
- package/lib/node/substitution/term.js +9 -23
- 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 +15 -14
- package/lib/preamble.js +10 -10
- package/lib/process/instantiate.js +6 -21
- package/lib/process/unify.js +11 -10
- package/lib/tokenTypes.js +22 -0
- package/lib/types.js +3 -3
- package/lib/utilities/bnf.js +5 -5
- package/lib/utilities/context.js +63 -0
- package/lib/utilities/element.js +235 -408
- package/lib/utilities/instance.js +12 -34
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +56 -21
- package/lib/utilities/unification.js +38 -32
- package/lib/utilities/validation.js +47 -50
- package/package.json +2 -2
- package/src/constants.js +12 -1
- package/src/context/ephemeral.js +257 -0
- package/src/context/file.js +108 -116
- package/src/context/liminal.js +67 -0
- package/src/context/literal.js +51 -0
- package/src/context/nominal.js +12 -0
- package/src/context/release.js +48 -8
- package/src/context/{local.js → scoped.js} +43 -125
- package/src/context/synthetic.js +60 -0
- package/src/element/assertion/contained.js +49 -47
- package/src/element/assertion/defined.js +29 -27
- package/src/element/assertion/property.js +35 -35
- package/src/element/assertion/satisfies.js +19 -18
- package/src/element/assumption.js +71 -93
- package/src/element/combinator/bracketed.js +0 -7
- package/src/element/conclusion.js +25 -24
- package/src/element/constructor/bracketed.js +0 -7
- package/src/element/constructor.js +1 -1
- 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 +33 -31
- package/src/element/derivation.js +2 -2
- package/src/element/equality.js +4 -4
- package/src/element/equivalence.js +115 -135
- package/src/element/equivalences.js +9 -7
- package/src/element/error.js +4 -2
- package/src/element/frame.js +80 -65
- package/src/element/hypothesis.js +1 -1
- package/src/element/judgement.js +42 -62
- package/src/element/metaType.js +3 -4
- package/src/element/metavariable.js +59 -56
- package/src/element/parameter.js +10 -5
- package/src/element/procedureCall.js +20 -18
- package/src/element/proof.js +14 -16
- package/src/element/{premise.js → proofAssertion/premise.js} +57 -53
- package/src/element/{step.js → proofAssertion/step.js} +59 -62
- package/src/element/{supposition.js → proofAssertion/supposition.js} +67 -56
- package/src/element/proofAssertion.js +24 -13
- package/src/element/propertyRelation.js +1 -1
- package/src/element/reference.js +87 -37
- package/src/element/rule.js +31 -37
- package/src/element/section.js +5 -5
- package/src/element/signature.js +8 -8
- package/src/element/statement.js +52 -48
- package/src/element/subproof.js +16 -18
- package/src/element/substitution/frame.js +104 -50
- package/src/element/substitution/reference.js +120 -20
- package/src/element/substitution/statement.js +169 -130
- package/src/element/substitution/term.js +104 -63
- package/src/element/substitution.js +16 -58
- package/src/element/substitutions.js +43 -41
- package/src/element/term.js +47 -41
- package/src/element/{axiom.js → topLevelAssertion/axiom.js} +22 -20
- package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +5 -6
- package/src/element/{lemma.js → topLevelAssertion/lemma.js} +5 -6
- package/src/element/{theorem.js → topLevelAssertion/theorem.js} +5 -5
- package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +37 -33
- package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +5 -6
- package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +5 -6
- package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +19 -17
- package/src/element/type.js +2 -4
- package/src/element/variable.js +47 -48
- package/src/index.js +2 -1
- package/src/main.js +2 -1
- package/src/metaTypes.js +25 -9
- package/src/node/frame.js +1 -1
- package/src/node/metavariable.js +3 -3
- package/src/node/parameter.js +32 -5
- 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/frame.js +6 -32
- package/src/node/substitution/reference.js +38 -0
- package/src/node/substitution/statement.js +6 -32
- package/src/node/substitution/term.js +6 -22
- 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 +15 -12
- package/src/preamble.js +9 -9
- package/src/process/instantiate.js +27 -36
- package/src/process/unify.js +10 -9
- package/src/tokenTypes.js +4 -0
- package/src/types.js +4 -2
- package/src/utilities/bnf.js +3 -2
- package/src/utilities/context.js +46 -0
- package/src/utilities/element.js +302 -509
- package/src/utilities/instance.js +19 -42
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +69 -28
- package/src/utilities/unification.js +41 -38
- package/src/utilities/validation.js +66 -75
- 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/log.js +0 -150
- package/lib/node/step.js +0 -166
- package/lib/node/supposition.js +0 -130
- package/src/context/temporary.js +0 -476
- package/src/log.js +0 -118
- 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
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
import Element from "../element";
|
|
6
|
-
import elements from "../elements";
|
|
7
|
-
import LocalContext from "../context/local";
|
|
8
6
|
|
|
7
|
+
import { scope, attempt } from "../utilities/context";
|
|
9
8
|
import { labelsFromJSON,
|
|
10
9
|
deductionFromJSON,
|
|
11
10
|
signatureFromJSON,
|
|
@@ -19,7 +18,7 @@ import { labelsFromJSON,
|
|
|
19
18
|
|
|
20
19
|
const { extract, reverse, correlate, backwardsEvery } = arrayUtilities;
|
|
21
20
|
|
|
22
|
-
export default class
|
|
21
|
+
export default class TopLevelAssertion extends Element {
|
|
23
22
|
constructor(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses) {
|
|
24
23
|
super(context, string, node);
|
|
25
24
|
|
|
@@ -100,9 +99,9 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
100
99
|
|
|
101
100
|
if (hypothetical) {
|
|
102
101
|
const proofAssertions = context.getProofAssertions(),
|
|
103
|
-
|
|
102
|
+
topLevelAssertionString = this.getString(); ///
|
|
104
103
|
|
|
105
|
-
context.trace(`Correlating the hypotheses of the '${
|
|
104
|
+
context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}' top level assertion...`, this.node);
|
|
106
105
|
|
|
107
106
|
correlatesToHypotheses = correlate(this.hypotheses, proofAssertions, (hypothesis, proofAssertion) => {
|
|
108
107
|
const hypothesesComparesToStep = hypothesis.compareProofAssertion(proofAssertion, context);
|
|
@@ -113,7 +112,7 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
113
112
|
});
|
|
114
113
|
|
|
115
114
|
if (correlatesToHypotheses) {
|
|
116
|
-
context.debug(`...correlated the hypotheses of the '${
|
|
115
|
+
context.debug(`...correlated the hypotheses of the '${topLevelAssertionString}' top level assertion.`, this.node);
|
|
117
116
|
}
|
|
118
117
|
} else {
|
|
119
118
|
correlatesToHypotheses = true
|
|
@@ -125,25 +124,27 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
125
124
|
verify() {
|
|
126
125
|
let verifies = false;
|
|
127
126
|
|
|
128
|
-
const
|
|
127
|
+
const context = this.getContext();
|
|
129
128
|
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
context = localContext, ///
|
|
133
|
-
suppositionsVerify = this.verifySuppositions(context);
|
|
129
|
+
scope((context) => {
|
|
130
|
+
const labelsVerify = this.verifyLabels();
|
|
134
131
|
|
|
135
|
-
if (
|
|
136
|
-
const
|
|
132
|
+
if (labelsVerify) {
|
|
133
|
+
const suppositionsVerify = this.verifySuppositions(context);
|
|
137
134
|
|
|
138
|
-
if (
|
|
139
|
-
const
|
|
135
|
+
if (suppositionsVerify) {
|
|
136
|
+
const deductionVerifies = this.verifyDeduction(context);
|
|
140
137
|
|
|
141
|
-
if (
|
|
142
|
-
|
|
138
|
+
if (deductionVerifies) {
|
|
139
|
+
const proofVerifies = this.verifyProof(context);
|
|
140
|
+
|
|
141
|
+
if (proofVerifies) {
|
|
142
|
+
verifies = true;
|
|
143
|
+
}
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
|
-
}
|
|
147
|
+
}, context);
|
|
147
148
|
|
|
148
149
|
return verifies;
|
|
149
150
|
}
|
|
@@ -186,15 +187,14 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
verifyProof(context) {
|
|
189
|
-
let proofVerifies;
|
|
190
|
+
let proofVerifies = true; ///
|
|
190
191
|
|
|
191
|
-
if (this.proof
|
|
192
|
-
proofVerifies =
|
|
193
|
-
|
|
194
|
-
const { Substitutions } = elements,
|
|
195
|
-
substitutions = Substitutions.fromNothing();
|
|
192
|
+
if (this.proof !== null) {
|
|
193
|
+
proofVerifies = attempt((context) => {
|
|
194
|
+
const proofVerifies = this.proof.verify(this.deduction, context);
|
|
196
195
|
|
|
197
|
-
|
|
196
|
+
return proofVerifies;
|
|
197
|
+
}, context);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
return proofVerifies;
|
|
@@ -239,12 +239,7 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
239
239
|
unifyStepsOrSubproofsWithSupposition(subproofOrProofAssertions, supposition, substitutions, generalContext, specificContext) {
|
|
240
240
|
let subproofOrProofAssertionsUnifiesWithSupposition = false;
|
|
241
241
|
|
|
242
|
-
|
|
243
|
-
suppositionUnifiesIndependently = supposition.unifyIndependently(substitutions, context);
|
|
244
|
-
|
|
245
|
-
if (suppositionUnifiesIndependently) {
|
|
246
|
-
subproofOrProofAssertionsUnifiesWithSupposition = true;
|
|
247
|
-
} else {
|
|
242
|
+
if (!subproofOrProofAssertionsUnifiesWithSupposition) {
|
|
248
243
|
const subproofOrProofAssertion = extract(subproofOrProofAssertions, (subproofOrProofAssertion) => {
|
|
249
244
|
const subproofOrProofAssertionUnifies = supposition.unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, generalContext, specificContext);
|
|
250
245
|
|
|
@@ -258,6 +253,15 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
258
253
|
}
|
|
259
254
|
}
|
|
260
255
|
|
|
256
|
+
if (!subproofOrProofAssertionsUnifiesWithSupposition) {
|
|
257
|
+
const context = specificContext, ///
|
|
258
|
+
suppositionUnifiesIndependently = supposition.unifyIndependently(substitutions, context);
|
|
259
|
+
|
|
260
|
+
if (suppositionUnifiesIndependently) {
|
|
261
|
+
subproofOrProofAssertionsUnifiesWithSupposition = true;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
261
265
|
return subproofOrProofAssertionsUnifiesWithSupposition;
|
|
262
266
|
}
|
|
263
267
|
|
|
@@ -306,8 +310,8 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
306
310
|
node = null,
|
|
307
311
|
proof = null,
|
|
308
312
|
string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
309
|
-
|
|
313
|
+
topLevelAssertion = new Class(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
310
314
|
|
|
311
|
-
return
|
|
315
|
+
return topLevelAssertion;
|
|
312
316
|
}
|
|
313
317
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
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
|
|
|
11
11
|
const node = this.getNode(),
|
|
12
12
|
context = this.getContext(),
|
|
13
|
-
|
|
14
|
-
metaLemmaString = metaLemma.getString();
|
|
13
|
+
metaLemmaString = this.getString(); ///
|
|
15
14
|
|
|
16
15
|
context.trace(`Verifying the '${metaLemmaString}' meta-lemma...`, node);
|
|
17
16
|
|
|
@@ -30,5 +29,5 @@ export default define(class MetaLemma extends MetaLemmaMetatheorem {
|
|
|
30
29
|
|
|
31
30
|
static name = "MetaLemma";
|
|
32
31
|
|
|
33
|
-
static fromJSON(json, context) { return
|
|
32
|
+
static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(MetaLemma, json, context); }
|
|
34
33
|
});
|
|
@@ -1,17 +1,16 @@
|
|
|
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
|
|
|
11
11
|
const node = this.getNode(),
|
|
12
12
|
context = this.getContext(),
|
|
13
|
-
|
|
14
|
-
metaLemmaString = metaLemma.getString();
|
|
13
|
+
metaLemmaString = this.getString(); ///
|
|
15
14
|
|
|
16
15
|
context.trace(`Verifying the '${metaLemmaString}' metatheorem...`, node);
|
|
17
16
|
|
|
@@ -30,5 +29,5 @@ export default define(class Metatheorem extends MetaLemmaMetatheorem {
|
|
|
30
29
|
|
|
31
30
|
static name = "Metatheorem";
|
|
32
31
|
|
|
33
|
-
static fromJSON(json, context) { return
|
|
32
|
+
static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(Metatheorem, json, context); }
|
|
34
33
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Element from "../element";
|
|
4
|
-
import LocalContext from "../context/local";
|
|
5
4
|
|
|
5
|
+
import { scope } from "../utilities/context";
|
|
6
6
|
import { labelFromJSON,
|
|
7
7
|
labelToLabelJSON,
|
|
8
8
|
deductionFromJSON,
|
|
@@ -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
|
|
|
@@ -56,25 +56,27 @@ export default class MetaLemmaMetatheorem extends Element {
|
|
|
56
56
|
verify() {
|
|
57
57
|
let verifies = false;
|
|
58
58
|
|
|
59
|
-
const
|
|
59
|
+
const context = this.getContext();
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
context = localContext, ///
|
|
64
|
-
suppositionsVerify = this.verifySuppositions(context);
|
|
61
|
+
scope((context) => {
|
|
62
|
+
const labelVerifies = this.verifyLabel();
|
|
65
63
|
|
|
66
|
-
if (
|
|
67
|
-
const
|
|
64
|
+
if (labelVerifies) {
|
|
65
|
+
const suppositionsVerify = this.verifySuppositions(context);
|
|
68
66
|
|
|
69
|
-
if (
|
|
70
|
-
const
|
|
67
|
+
if (suppositionsVerify) {
|
|
68
|
+
const deductionVerifies = this.verifyDeduction(context);
|
|
71
69
|
|
|
72
|
-
if (
|
|
73
|
-
|
|
70
|
+
if (deductionVerifies) {
|
|
71
|
+
const proofVerifies = this.verifyProof(context);
|
|
72
|
+
|
|
73
|
+
if (proofVerifies) {
|
|
74
|
+
verifies = true;
|
|
75
|
+
}
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
|
-
}
|
|
79
|
+
}, context);
|
|
78
80
|
|
|
79
81
|
return verifies;
|
|
80
82
|
}
|
|
@@ -148,9 +150,9 @@ export default class MetaLemmaMetatheorem extends Element {
|
|
|
148
150
|
substitutions = substitutionsFromJSON(json, context),
|
|
149
151
|
node = null,
|
|
150
152
|
proof = null,
|
|
151
|
-
string =
|
|
152
|
-
|
|
153
|
+
string = topLevelMetaAssertionStringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
|
|
154
|
+
topLevelMetaAssertion = new Class(context, string, node, label, suppositions, deduction, proof, substitutions);
|
|
153
155
|
|
|
154
|
-
return
|
|
156
|
+
return topLevelMetaAssertion;
|
|
155
157
|
}
|
|
156
158
|
}
|
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
|
@@ -4,8 +4,8 @@ import Element from "../element";
|
|
|
4
4
|
import elements from "../elements";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { synthetically } from "../utilities/context";
|
|
8
|
+
import { typeToTypeJSON } from "../utilities/json";
|
|
9
9
|
|
|
10
10
|
export default define(class Variable extends Element {
|
|
11
11
|
constructor(context, string, node, type, identifier, propertyRelations) {
|
|
@@ -34,26 +34,34 @@ export default define(class Variable extends Element {
|
|
|
34
34
|
|
|
35
35
|
getTypeString() { return this.type.getString(); }
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
isIdentifierEqualTo(identifier) {
|
|
38
|
+
const identifierEqualTo = (this.identifier === identifier);
|
|
39
|
+
|
|
40
|
+
return identifierEqualTo;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
compareParamter(parameter) {
|
|
44
|
+
const identifier = parameter.getIdentifier(),
|
|
45
|
+
identifierEqualTo = this.isIdentifierEqualTo(identifier),
|
|
46
|
+
comparesToParamter = identifierEqualTo; ///
|
|
41
47
|
|
|
42
48
|
return comparesToParamter;
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
compareVariableIdentifier(variableIdentifier) {
|
|
46
|
-
const
|
|
52
|
+
const identifier = variableIdentifier, ///
|
|
53
|
+
identifierEqualTo = this.isIdentifierEqualTo(identifier),
|
|
54
|
+
comparesToVariableIdentifier = identifierEqualTo; ///
|
|
47
55
|
|
|
48
|
-
return
|
|
56
|
+
return comparesToVariableIdentifier;
|
|
49
57
|
}
|
|
50
58
|
|
|
51
|
-
|
|
52
|
-
let
|
|
59
|
+
validate(context) {
|
|
60
|
+
let validates;
|
|
53
61
|
|
|
54
|
-
const variableString = this.
|
|
62
|
+
const variableString = this.getString(); ///
|
|
55
63
|
|
|
56
|
-
context.trace(`
|
|
64
|
+
context.trace(`Validating the '${variableString}' variable...`);
|
|
57
65
|
|
|
58
66
|
const variableIdentifier = this.identifier,
|
|
59
67
|
variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
@@ -63,24 +71,24 @@ export default define(class Variable extends Element {
|
|
|
63
71
|
|
|
64
72
|
this.type = type;
|
|
65
73
|
|
|
66
|
-
|
|
74
|
+
validates = true;
|
|
67
75
|
} else {
|
|
68
76
|
context.debug(`The '${variableString}' variable is not present.`);
|
|
69
77
|
}
|
|
70
78
|
|
|
71
|
-
if (
|
|
72
|
-
context.debug(`...
|
|
79
|
+
if (validates) {
|
|
80
|
+
context.debug(`...validated the '${variableString}' variable.`);
|
|
73
81
|
}
|
|
74
82
|
|
|
75
|
-
return
|
|
83
|
+
return validates;
|
|
76
84
|
}
|
|
77
85
|
|
|
78
|
-
|
|
79
|
-
let
|
|
86
|
+
validateType(context) {
|
|
87
|
+
let typeValidates = false;
|
|
80
88
|
|
|
81
89
|
const typeString = this.type.getString();
|
|
82
90
|
|
|
83
|
-
context.trace(`
|
|
91
|
+
context.trace(`Validating the '${typeString}' type...`);
|
|
84
92
|
|
|
85
93
|
const prefixedTypeName = this.type.getPrefixedName(),
|
|
86
94
|
type = context.findTypeByPrefixedTypeName(prefixedTypeName);
|
|
@@ -90,40 +98,40 @@ export default define(class Variable extends Element {
|
|
|
90
98
|
} else {
|
|
91
99
|
this.type = type; ///
|
|
92
100
|
|
|
93
|
-
|
|
101
|
+
typeValidates = true;
|
|
94
102
|
}
|
|
95
103
|
|
|
96
|
-
if (
|
|
97
|
-
context.debug(`...
|
|
104
|
+
if (typeValidates) {
|
|
105
|
+
context.debug(`...validated the '${typeString}' type.`);
|
|
98
106
|
}
|
|
99
107
|
|
|
100
|
-
return
|
|
108
|
+
return typeValidates;
|
|
101
109
|
}
|
|
102
110
|
|
|
103
111
|
unifyTerm(term, substitutions, generalContext, specificContext) {
|
|
104
112
|
let termUnifies = false;
|
|
105
113
|
|
|
106
|
-
const
|
|
107
|
-
|
|
114
|
+
const context = specificContext, ///
|
|
115
|
+
termString = term.getString(),
|
|
116
|
+
variableString = this.getString(); ///
|
|
108
117
|
|
|
109
|
-
|
|
118
|
+
context.trace(`Unifying the '${termString}' term with the '${variableString}' variable...`);
|
|
110
119
|
|
|
111
|
-
let
|
|
112
|
-
variable;
|
|
120
|
+
let variable;
|
|
113
121
|
|
|
114
122
|
variable = this; ///
|
|
115
123
|
|
|
116
124
|
const substitution = substitutions.findSubstitutionByVariable(variable);
|
|
117
125
|
|
|
118
126
|
if (substitution !== null) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const substitutionTermEqualToTerm = substitution.isTermEqualToTerm(term, context);
|
|
127
|
+
const substitutionComparesToTerm = substitution.compareTerm(term, context);
|
|
122
128
|
|
|
123
|
-
if (
|
|
129
|
+
if (substitutionComparesToTerm) {
|
|
124
130
|
termUnifies = true;
|
|
125
131
|
}
|
|
126
132
|
} else {
|
|
133
|
+
let context;
|
|
134
|
+
|
|
127
135
|
context = generalContext; ///
|
|
128
136
|
|
|
129
137
|
const variableIdentifier = variable.getIdentifier();
|
|
@@ -141,18 +149,18 @@ export default define(class Variable extends Element {
|
|
|
141
149
|
termTypeEqualToOrSubTypeOfVariableType = termType.isEqualToOrSubTypeOf(variableType);
|
|
142
150
|
|
|
143
151
|
if (termTypeEqualToOrSubTypeOfVariableType) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
substitution = termSubstitution; ///
|
|
152
|
+
synthetically((context) => {
|
|
153
|
+
const { TermSubstitution } = elements;
|
|
147
154
|
|
|
148
|
-
|
|
155
|
+
TermSubstitution.fromTermAndVariable(term, variable, context);
|
|
156
|
+
}, generalContext, specificContext);
|
|
149
157
|
|
|
150
158
|
termUnifies = true;
|
|
151
159
|
}
|
|
152
160
|
}
|
|
153
161
|
|
|
154
162
|
if (termUnifies) {
|
|
155
|
-
|
|
163
|
+
context.debug(`...unified the '${termString}' term with the '${variableString}' variable.`);
|
|
156
164
|
}
|
|
157
165
|
|
|
158
166
|
return termUnifies;
|
|
@@ -160,7 +168,7 @@ export default define(class Variable extends Element {
|
|
|
160
168
|
|
|
161
169
|
toJSON() {
|
|
162
170
|
const typeJSON = typeToTypeJSON(this.type),
|
|
163
|
-
string = this.
|
|
171
|
+
string = this.getString(), ///
|
|
164
172
|
type = typeJSON, ///
|
|
165
173
|
json = {
|
|
166
174
|
type,
|
|
@@ -173,15 +181,6 @@ export default define(class Variable extends Element {
|
|
|
173
181
|
static name = "Variable";
|
|
174
182
|
|
|
175
183
|
static fromJSON(json, context) {
|
|
176
|
-
|
|
177
|
-
variableNode = instantiateVariable(string, context),
|
|
178
|
-
variableIdentifier = variableNode.getVariableIdentifier(),
|
|
179
|
-
node = variableNode,
|
|
180
|
-
identifier = variableIdentifier, ///
|
|
181
|
-
type = typeFromJSON(json, context),
|
|
182
|
-
propertyRelations = [],
|
|
183
|
-
variable = new Variable(context, string, node, type, identifier, propertyRelations);
|
|
184
|
-
|
|
185
|
-
return variable;
|
|
184
|
+
///
|
|
186
185
|
}
|
|
187
186
|
});
|
package/src/index.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import "./preamble";
|
|
4
4
|
|
|
5
|
-
export {
|
|
5
|
+
export { Log } from "occam-furtle";
|
|
6
|
+
|
|
6
7
|
export { default as FileContext } from "./context/file";
|
|
7
8
|
export { default as ReleaseContext } from "./context/release";
|
|
8
9
|
export { default as releaseUtilities } from "./utilities/release";
|
package/src/main.js
CHANGED
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;
|
package/src/node/frame.js
CHANGED
|
@@ -22,7 +22,7 @@ export default class FrameNode extends NonTerminalNode {
|
|
|
22
22
|
|
|
23
23
|
const metavariableNode = this.getMetavariableNode();
|
|
24
24
|
|
|
25
|
-
if (
|
|
25
|
+
if (metavariableNode !== null) {
|
|
26
26
|
metavariableName = metavariableNode.getMetavariableName();
|
|
27
27
|
}
|
|
28
28
|
|
package/src/node/metavariable.js
CHANGED
|
@@ -6,7 +6,7 @@ import { TERM_RULE_NAME, TYPE_RULE_NAME } from "../ruleNames";
|
|
|
6
6
|
|
|
7
7
|
export default class MetavariableNode extends NonTerminalNode {
|
|
8
8
|
getMetavariableName() {
|
|
9
|
-
let
|
|
9
|
+
let metavariableName;
|
|
10
10
|
|
|
11
11
|
this.someChildNode((childNode) => {
|
|
12
12
|
const childNodeTerminalNode = childNode.isTerminalNode();
|
|
@@ -15,13 +15,13 @@ export default class MetavariableNode extends NonTerminalNode {
|
|
|
15
15
|
const terminalNode = childNode, ///
|
|
16
16
|
content = terminalNode.getContent();
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
metavariableName = content; ///
|
|
19
19
|
|
|
20
20
|
return true;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
return
|
|
24
|
+
return metavariableName;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
getTermNode() {
|
package/src/node/parameter.js
CHANGED
|
@@ -2,22 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
import NonTerminalNode from "../nonTerminalNode";
|
|
4
4
|
|
|
5
|
+
import { NAME_TOKEN_TYPE, IDENTIFIER_TOKEN_TYPE } from "../tokenTypes";
|
|
6
|
+
|
|
5
7
|
export default class ParameterNode extends NonTerminalNode {
|
|
6
|
-
|
|
7
|
-
let
|
|
8
|
+
getName() {
|
|
9
|
+
let name = null;
|
|
8
10
|
|
|
9
11
|
this.someChildNode((childNode, index) => {
|
|
10
12
|
const terminalNode = childNode, ///
|
|
11
|
-
|
|
13
|
+
type = terminalNode.getType();
|
|
14
|
+
|
|
15
|
+
if (type === NAME_TOKEN_TYPE) {
|
|
16
|
+
const content = terminalNode.getContent();
|
|
17
|
+
|
|
18
|
+
name = content; ///
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (index === 0) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
12
25
|
|
|
13
|
-
|
|
26
|
+
return name;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
getIdentifier() {
|
|
30
|
+
let identifier = null;
|
|
31
|
+
|
|
32
|
+
this.someChildNode((childNode, index) => {
|
|
33
|
+
const terminalNode = childNode, ///
|
|
34
|
+
type = terminalNode.getType();
|
|
35
|
+
|
|
36
|
+
if (type === IDENTIFIER_TOKEN_TYPE) {
|
|
37
|
+
const content = terminalNode.getContent();
|
|
38
|
+
|
|
39
|
+
identifier = content; ///
|
|
40
|
+
}
|
|
14
41
|
|
|
15
42
|
if (index === 0) {
|
|
16
43
|
return true;
|
|
17
44
|
}
|
|
18
45
|
});
|
|
19
46
|
|
|
20
|
-
return
|
|
47
|
+
return identifier;
|
|
21
48
|
}
|
|
22
49
|
|
|
23
50
|
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(ParameterNode, ruleName, childNodes, opacity, precedence); }
|
|
@@ -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
|
+
}
|