occam-verify-cli 1.0.747 → 1.0.757
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/context/branching.js +56 -0
- package/lib/context/ephemeral.js +10 -1
- package/lib/context/file/nominal.js +5 -10
- package/lib/context/scoped.js +6 -5
- package/lib/context/synthetic.js +7 -3
- package/lib/context.js +9 -1
- package/lib/element/assertion/contained.js +7 -7
- package/lib/element/assertion/defined.js +7 -7
- package/lib/element/assertion/property.js +3 -3
- package/lib/element/assertion/satisfies.js +2 -2
- package/lib/element/assertion/subproof.js +111 -14
- package/lib/element/assertion/type.js +7 -7
- package/lib/element/assumption.js +21 -33
- package/lib/element/combinator.js +4 -4
- package/lib/element/conclusion.js +3 -7
- package/lib/element/constructor/bracketed.js +9 -8
- package/lib/element/constructor.js +9 -5
- package/lib/element/deduction.js +17 -20
- package/lib/element/derivation.js +4 -4
- package/lib/element/equality.js +12 -11
- package/lib/element/equivalence.js +3 -3
- package/lib/element/frame.js +2 -2
- package/lib/element/hypothesis.js +2 -2
- package/lib/element/judgement.js +2 -2
- package/lib/element/label.js +4 -4
- package/lib/element/metavariable.js +65 -25
- package/lib/element/parameter.js +2 -2
- package/lib/element/procedureCall.js +2 -2
- package/lib/element/procedureReference.js +2 -2
- package/lib/element/proof.js +7 -7
- package/lib/element/proofAssertion/premise.js +12 -18
- package/lib/element/proofAssertion/step.js +3 -3
- package/lib/element/proofAssertion/supposition.js +13 -19
- package/lib/element/property.js +2 -2
- package/lib/element/propertyRelation.js +3 -3
- package/lib/element/reference.js +11 -9
- package/lib/element/rule.js +2 -2
- package/lib/element/signature.js +3 -3
- package/lib/element/statement.js +100 -59
- package/lib/element/subDerivation.js +4 -4
- package/lib/element/subproof.js +7 -7
- package/lib/element/substitution/frame.js +8 -8
- package/lib/element/substitution/metaLevel.js +7 -7
- package/lib/element/substitution/reference.js +7 -7
- package/lib/element/substitution/statement.js +73 -60
- package/lib/element/substitution/term.js +10 -10
- package/lib/element/term.js +17 -14
- package/lib/element/topLevelAssertion/axiom.js +15 -13
- package/lib/element/topLevelAssertion.js +2 -5
- package/lib/element/topLevelMetaAssertion.js +27 -3
- package/lib/element/type.js +2 -2
- package/lib/element/typePrefix.js +2 -2
- package/lib/element/variable.js +6 -3
- package/lib/process/unify.js +51 -9
- package/lib/process/validate.js +5 -5
- package/lib/utilities/context.js +28 -20
- package/lib/utilities/element.js +2 -2
- package/lib/utilities/instance.js +3 -3
- package/lib/utilities/releaseContext.js +3 -3
- package/lib/utilities/string.js +2 -2
- package/lib/utilities/validation.js +13 -5
- package/package.json +3 -3
- package/src/context/branching.js +59 -0
- package/src/context/ephemeral.js +12 -0
- package/src/context/file/nominal.js +4 -12
- package/src/context/scoped.js +6 -4
- package/src/context/synthetic.js +9 -2
- package/src/context.js +14 -0
- package/src/element/assertion/contained.js +8 -8
- package/src/element/assertion/defined.js +7 -7
- package/src/element/assertion/property.js +4 -4
- package/src/element/assertion/satisfies.js +2 -2
- package/src/element/assertion/subproof.js +191 -18
- package/src/element/assertion/type.js +7 -7
- package/src/element/assumption.js +21 -52
- package/src/element/combinator.js +4 -4
- package/src/element/conclusion.js +3 -10
- package/src/element/constructor/bracketed.js +9 -7
- package/src/element/constructor.js +11 -5
- package/src/element/deduction.js +17 -23
- package/src/element/derivation.js +4 -3
- package/src/element/equality.js +16 -14
- package/src/element/equivalence.js +3 -3
- package/src/element/frame.js +2 -2
- package/src/element/hypothesis.js +2 -2
- package/src/element/judgement.js +2 -2
- package/src/element/label.js +4 -4
- package/src/element/metavariable.js +96 -32
- package/src/element/parameter.js +2 -2
- package/src/element/procedureCall.js +2 -2
- package/src/element/procedureReference.js +2 -2
- package/src/element/proof.js +8 -8
- package/src/element/proofAssertion/premise.js +22 -32
- package/src/element/proofAssertion/step.js +3 -3
- package/src/element/proofAssertion/supposition.js +27 -36
- package/src/element/property.js +2 -2
- package/src/element/propertyRelation.js +3 -3
- package/src/element/reference.js +11 -9
- package/src/element/rule.js +2 -2
- package/src/element/signature.js +3 -3
- package/src/element/statement.js +154 -88
- package/src/element/subDerivation.js +4 -3
- package/src/element/subproof.js +6 -6
- package/src/element/substitution/frame.js +8 -8
- package/src/element/substitution/metaLevel.js +7 -7
- package/src/element/substitution/reference.js +7 -7
- package/src/element/substitution/statement.js +99 -76
- package/src/element/substitution/term.js +10 -10
- package/src/element/term.js +22 -16
- package/src/element/topLevelAssertion/axiom.js +20 -16
- package/src/element/topLevelAssertion.js +2 -4
- package/src/element/topLevelMetaAssertion.js +42 -3
- package/src/element/type.js +3 -2
- package/src/element/typePrefix.js +2 -2
- package/src/element/variable.js +12 -3
- package/src/process/unify.js +78 -9
- package/src/process/validate.js +4 -4
- package/src/utilities/context.js +20 -12
- package/src/utilities/element.js +2 -2
- package/src/utilities/instance.js +3 -3
- package/src/utilities/releaseContext.js +1 -1
- package/src/utilities/string.js +3 -3
- package/src/utilities/validation.js +16 -4
|
@@ -4,7 +4,7 @@ import { Element } from "occam-languages";
|
|
|
4
4
|
import { termsUtilities } from "occam-furtle";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import {
|
|
7
|
+
import { instantiate } from "../utilities/context";
|
|
8
8
|
import { instantiateProcedureCall } from "../process/instantiate";
|
|
9
9
|
import { parametersFromProcedureCallNode, procedureReferenceFromProcedureCallNode } from "../utilities/element";
|
|
10
10
|
|
|
@@ -125,7 +125,7 @@ export default define(class ProcedureCall extends Element {
|
|
|
125
125
|
static name = "ProcedureCall";
|
|
126
126
|
|
|
127
127
|
static fromJSON(json, context) {
|
|
128
|
-
const procedureCall =
|
|
128
|
+
const procedureCall = instantiate((context) => {
|
|
129
129
|
const { string } = json,
|
|
130
130
|
procedureCallNode = instantiateProcedureCall(string, context),
|
|
131
131
|
node = procedureCallNode, ///
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../utilities/context";
|
|
7
7
|
import { instantiateProcedureReference } from "../process/instantiate";
|
|
8
8
|
import { nameFromProcedureReferenceNode } from "../utilities/element";
|
|
9
9
|
|
|
@@ -43,7 +43,7 @@ export default define(class ProcedureReference extends Element {
|
|
|
43
43
|
static name = "ProcedureReference";
|
|
44
44
|
|
|
45
45
|
static fromJSON(json, context) {
|
|
46
|
-
const procedureReference =
|
|
46
|
+
const procedureReference = instantiate((context) => {
|
|
47
47
|
const { string } = json,
|
|
48
48
|
procedureReferenceNode = instantiateProcedureReference(string, context),
|
|
49
49
|
node = procedureReferenceNode, ///
|
package/src/element/proof.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { asyncRestrict } from "../utilities/context";
|
|
7
7
|
|
|
8
8
|
export default define(class Proof extends Element {
|
|
9
9
|
constructor(context, string, node, derivation) {
|
|
@@ -23,12 +23,12 @@ export default define(class Proof extends Element {
|
|
|
23
23
|
return proofNode;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
getLastStep() { return this.derivation.getLastStep(); }
|
|
27
27
|
|
|
28
28
|
getStatement() {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
statement =
|
|
29
|
+
const lastStep = this.getLastStep(),
|
|
30
|
+
lastStepStatement = lastStep.getStatement(),
|
|
31
|
+
statement = lastStepStatement; ///
|
|
32
32
|
|
|
33
33
|
return statement;
|
|
34
34
|
}
|
|
@@ -36,13 +36,13 @@ export default define(class Proof extends Element {
|
|
|
36
36
|
async verify(statement, context) {
|
|
37
37
|
let verifies = false;
|
|
38
38
|
|
|
39
|
-
await
|
|
39
|
+
await asyncRestrict(async (context) => {
|
|
40
40
|
const derivationVerifies = await this.derivation.verify(context);
|
|
41
41
|
|
|
42
42
|
if (derivationVerifies) {
|
|
43
|
-
const
|
|
43
|
+
const lastStep = context.getLastStep();
|
|
44
44
|
|
|
45
|
-
if (
|
|
45
|
+
if (lastStep !== null) {
|
|
46
46
|
const proof = this, ///
|
|
47
47
|
proofStatement = proof.getStatement(),
|
|
48
48
|
proofStatementEqualToStatement = proofStatement.isEqualTo(statement);
|
|
@@ -5,7 +5,7 @@ import ProofAssertion from "../proofAssertion";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiatePremise } from "../../process/instantiate";
|
|
7
7
|
import { procedureCallFromPremiseNode } from "../../utilities/element";
|
|
8
|
-
import { attempt,
|
|
8
|
+
import { attempt, reconcile, instantiate } from "../../utilities/context";
|
|
9
9
|
import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../../utilities/json";
|
|
10
10
|
|
|
11
11
|
export default define(class Premise extends ProofAssertion {
|
|
@@ -72,7 +72,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
72
72
|
const statementValidates = this.validateStatement(context);
|
|
73
73
|
|
|
74
74
|
if (statementValidates) {
|
|
75
|
-
|
|
75
|
+
context.commit(this);
|
|
76
76
|
|
|
77
77
|
validates = true;
|
|
78
78
|
}
|
|
@@ -82,7 +82,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
82
82
|
const procedureCallValidates = this.validateProcedureCall(context);
|
|
83
83
|
|
|
84
84
|
if (procedureCallValidates) {
|
|
85
|
-
|
|
85
|
+
context.commit(this);
|
|
86
86
|
|
|
87
87
|
validates = true;
|
|
88
88
|
}
|
|
@@ -167,21 +167,18 @@ export default define(class Premise extends ProofAssertion {
|
|
|
167
167
|
const proofAssertionContext = proofAssertion.getContext(),
|
|
168
168
|
premiseContext = this.getContext(), ///
|
|
169
169
|
generalContext = premiseContext, ///
|
|
170
|
-
specificContext = proofAssertionContext
|
|
171
|
-
statementUnifies = liminally((specificContext) => {
|
|
172
|
-
const statement = proofAssertion.getStatement(),
|
|
173
|
-
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
170
|
+
specificContext = proofAssertionContext; ///
|
|
174
171
|
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
reconcile((specificContext) => {
|
|
173
|
+
const statement = proofAssertion.getStatement(),
|
|
174
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
177
175
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}, specificContext);
|
|
176
|
+
if (statementUnifies) {
|
|
177
|
+
specificContext.commit(context);
|
|
181
178
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
179
|
+
proofAssertionUnifies = true;
|
|
180
|
+
}
|
|
181
|
+
}, specificContext);
|
|
185
182
|
|
|
186
183
|
if (proofAssertionUnifies) {
|
|
187
184
|
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`);
|
|
@@ -193,19 +190,11 @@ export default define(class Premise extends ProofAssertion {
|
|
|
193
190
|
unifySubproof(subproof, context) {
|
|
194
191
|
let subproofUnifies = false;
|
|
195
192
|
|
|
196
|
-
const premiseString = this.getString(),
|
|
193
|
+
const premiseString = this.getString(), ///
|
|
197
194
|
subproofString = subproof.getString();
|
|
198
195
|
|
|
199
196
|
context.trace(`Unifying the '${subproofString}' subproof with the '${premiseString}' premise...`);
|
|
200
197
|
|
|
201
|
-
const specificContext = context; ///
|
|
202
|
-
|
|
203
|
-
context = this.getContext();
|
|
204
|
-
|
|
205
|
-
const generalContext = context; ///
|
|
206
|
-
|
|
207
|
-
context = specificContext; ///
|
|
208
|
-
|
|
209
198
|
const statement = this.getStatement();
|
|
210
199
|
|
|
211
200
|
if (statement !== null) {
|
|
@@ -213,15 +202,16 @@ export default define(class Premise extends ProofAssertion {
|
|
|
213
202
|
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
214
203
|
|
|
215
204
|
if (subproofAssertionNode !== null) {
|
|
216
|
-
const
|
|
217
|
-
assertionNode = subproofAssertionNode, ///
|
|
218
|
-
assertion = context.findAssertionByAssertionNode(assertionNode)
|
|
205
|
+
const specificContext = context; ///
|
|
219
206
|
|
|
220
|
-
|
|
221
|
-
const subproofAssertion = assertion; ///
|
|
207
|
+
context = this.getContext();
|
|
222
208
|
|
|
223
|
-
|
|
224
|
-
|
|
209
|
+
const generalContext = context, ///
|
|
210
|
+
subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
211
|
+
|
|
212
|
+
context = specificContext; ///
|
|
213
|
+
|
|
214
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, generalContext, specificContext);
|
|
225
215
|
}
|
|
226
216
|
}
|
|
227
217
|
|
|
@@ -300,7 +290,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
300
290
|
|
|
301
291
|
context = ephemeralContext; ///
|
|
302
292
|
|
|
303
|
-
const premise =
|
|
293
|
+
const premise = instantiate((context) => {
|
|
304
294
|
const { string } = json,
|
|
305
295
|
premiseNode = instantiatePremise(string, context),
|
|
306
296
|
node = premiseNode, ///
|
|
@@ -6,7 +6,7 @@ import ProofAssertion from "../proofAssertion";
|
|
|
6
6
|
|
|
7
7
|
import { define } from "../../elements";
|
|
8
8
|
import { unifyStatements } from "../../utilities/unification";
|
|
9
|
-
import { attempt,
|
|
9
|
+
import { attempt, asyncReconcile } from "../../utilities/context";
|
|
10
10
|
import { propertyAssertionFromStatement } from "../../utilities/statement";
|
|
11
11
|
|
|
12
12
|
const { asyncSome } = asynchronousUtilities;
|
|
@@ -117,7 +117,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
117
117
|
const satisfiesAssertioValidates = this.validateSatisfiesAssertion(context);
|
|
118
118
|
|
|
119
119
|
if (satisfiesAssertioValidates) {
|
|
120
|
-
|
|
120
|
+
context.commit(this);
|
|
121
121
|
|
|
122
122
|
validates = true;
|
|
123
123
|
}
|
|
@@ -190,7 +190,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
190
190
|
reference = this.getReference(),
|
|
191
191
|
satisfiesAssertion = this.getSatisfiesAssertion();
|
|
192
192
|
|
|
193
|
-
await
|
|
193
|
+
await asyncReconcile(async (context) => {
|
|
194
194
|
await asyncSome(unifyStatements, async (unifyStatement) => {
|
|
195
195
|
const statementUnifies = await unifyStatement(statement, reference, satisfiesAssertion, context);
|
|
196
196
|
|
|
@@ -4,7 +4,7 @@ import ProofAssertion from "../proofAssertion";
|
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiateSupposition} from "../../process/instantiate";
|
|
7
|
-
import { attempt,
|
|
7
|
+
import { attempt, reconcile, instantiate } from "../../utilities/context";
|
|
8
8
|
import { statementFromSuppositionNode, procedureCallFromSuppositionNode } from "../../utilities/element";
|
|
9
9
|
import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../../utilities/json";
|
|
10
10
|
|
|
@@ -72,7 +72,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
72
72
|
const statementValidates = this.validateStatement(context);
|
|
73
73
|
|
|
74
74
|
if (statementValidates) {
|
|
75
|
-
|
|
75
|
+
context.commit(this);
|
|
76
76
|
|
|
77
77
|
validates = true;
|
|
78
78
|
}
|
|
@@ -82,7 +82,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
82
82
|
const procedureCallValidates = this.validateProcedureCall(context);
|
|
83
83
|
|
|
84
84
|
if (procedureCallValidates) {
|
|
85
|
-
|
|
85
|
+
context.commit(this);
|
|
86
86
|
|
|
87
87
|
validates = true;
|
|
88
88
|
}
|
|
@@ -121,14 +121,14 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
121
121
|
let suppositionUnifies;
|
|
122
122
|
|
|
123
123
|
const context = specificContext, ///
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
specificSupposition = supposition, ///
|
|
125
|
+
generalSuppositionString = this.getString(), ///
|
|
126
|
+
specificSuppositionString = specificSupposition.getString();
|
|
127
127
|
|
|
128
128
|
context.trace(`Unifying the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition...`);
|
|
129
129
|
|
|
130
130
|
const statement = specificSupposition.getStatement(),
|
|
131
|
-
|
|
131
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
132
132
|
|
|
133
133
|
suppositionUnifies = statementUnifies; ///
|
|
134
134
|
|
|
@@ -189,20 +189,18 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
189
189
|
const proofAssertionContext = proofAssertion.getContext(),
|
|
190
190
|
suppositionContext = this.getContext(),
|
|
191
191
|
generalContext = suppositionContext, ///
|
|
192
|
-
specificContext = proofAssertionContext
|
|
193
|
-
statementUnifies = liminally((specificContext) => {
|
|
194
|
-
const statement = proofAssertion.getStatement(),
|
|
195
|
-
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
192
|
+
specificContext = proofAssertionContext;
|
|
196
193
|
|
|
197
|
-
|
|
194
|
+
reconcile((specificContext) => {
|
|
195
|
+
const statement = proofAssertion.getStatement(),
|
|
196
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
198
197
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}, specificContext);
|
|
198
|
+
if (statementUnifies) {
|
|
199
|
+
specificContext.commit(context);
|
|
202
200
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
201
|
+
proofAssertionUnifies = true;
|
|
202
|
+
}
|
|
203
|
+
}, specificContext);
|
|
206
204
|
|
|
207
205
|
if (proofAssertionUnifies) {
|
|
208
206
|
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`);
|
|
@@ -214,19 +212,11 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
214
212
|
unifySubproof(subproof, context) {
|
|
215
213
|
let subproofUnifies = false;
|
|
216
214
|
|
|
217
|
-
const
|
|
218
|
-
|
|
215
|
+
const subproofString = subproof.getString(),
|
|
216
|
+
suppositionString = this.getString();
|
|
219
217
|
|
|
220
218
|
context.trace(`Unifying the '${subproofString}' subproof with the '${suppositionString}' supposition...`);
|
|
221
219
|
|
|
222
|
-
const specificContext = context; ///
|
|
223
|
-
|
|
224
|
-
context = this.getContext();
|
|
225
|
-
|
|
226
|
-
const generalContext = context; ///
|
|
227
|
-
|
|
228
|
-
context = specificContext; ///
|
|
229
|
-
|
|
230
220
|
const statement = this.getStatement();
|
|
231
221
|
|
|
232
222
|
if (statement !== null) {
|
|
@@ -234,15 +224,16 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
234
224
|
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
235
225
|
|
|
236
226
|
if (subproofAssertionNode !== null) {
|
|
237
|
-
const
|
|
238
|
-
assertionNode = subproofAssertionNode, ///
|
|
239
|
-
assertion = context.findAssertionByAssertionNode(assertionNode)
|
|
227
|
+
const specificContext = context; ///
|
|
240
228
|
|
|
241
|
-
|
|
242
|
-
const subproofAssertion = assertion; ///
|
|
229
|
+
context = this.getContext();
|
|
243
230
|
|
|
244
|
-
|
|
245
|
-
|
|
231
|
+
const generalContext = context, ///
|
|
232
|
+
subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
233
|
+
|
|
234
|
+
context = specificContext; ///
|
|
235
|
+
|
|
236
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, generalContext, specificContext);
|
|
246
237
|
}
|
|
247
238
|
}
|
|
248
239
|
|
|
@@ -321,7 +312,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
321
312
|
|
|
322
313
|
context = ephemeralContext; ///
|
|
323
314
|
|
|
324
|
-
const supposition =
|
|
315
|
+
const supposition = instantiate((context) => {
|
|
325
316
|
const { string } = json,
|
|
326
317
|
suppositionNode = instantiateSupposition(string, context),
|
|
327
318
|
node = suppositionNode, ///
|
package/src/element/property.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../utilities/context";
|
|
7
7
|
import { instantiateProperty } from "../process/instantiate";
|
|
8
8
|
import { nameFromPropertyNode } from "../utilities/element";
|
|
9
9
|
import { nominalTypeNameFromJSON, nominalTypeNameToNominalTypeNameJSON } from "../utilities/json";
|
|
@@ -58,7 +58,7 @@ export default define(class Property extends Element {
|
|
|
58
58
|
static name = "Property";
|
|
59
59
|
|
|
60
60
|
static fromJSON(json, context) {
|
|
61
|
-
const property =
|
|
61
|
+
const property = instantiate((context) => {
|
|
62
62
|
const { string } = json,
|
|
63
63
|
propertyNode = instantiateProperty(string, context),
|
|
64
64
|
node = propertyNode, ///
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../utilities/context";
|
|
7
7
|
import { instantiatePropertyRelation } from "../process/instantiate";
|
|
8
8
|
import { propertyFromPropertyRelationNode } from "../utilities/element";
|
|
9
9
|
|
|
@@ -59,7 +59,7 @@ export default define(class PropertyRelation extends Element {
|
|
|
59
59
|
|
|
60
60
|
context.trace(`Validating the '${termString}' term...`);
|
|
61
61
|
|
|
62
|
-
const term = this.term.validate(context, () => {
|
|
62
|
+
const term = this.term.validate(context, (term) => {
|
|
63
63
|
const validatesForwards = true;
|
|
64
64
|
|
|
65
65
|
return validatesForwards;
|
|
@@ -124,7 +124,7 @@ export default define(class PropertyRelation extends Element {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
static fromJSON(json, context) {
|
|
127
|
-
const propertyRelation =
|
|
127
|
+
const propertyRelation = instantiate((context) => {
|
|
128
128
|
const { string } = json,
|
|
129
129
|
propertyRelationNode = instantiatePropertyRelation(string, context),
|
|
130
130
|
node = propertyRelationNode, ///
|
package/src/element/reference.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { instantiate } from "../utilities/context";
|
|
7
7
|
import { instantiateReference } from "../process/instantiate";
|
|
8
8
|
import { REFERENCE_META_TYPE_NAME } from "../metaTypeNames";
|
|
9
9
|
import { metavariableFromReferenceNode } from "../utilities/element";
|
|
@@ -249,25 +249,27 @@ export default define(class Reference extends Element {
|
|
|
249
249
|
return metavariableUnifies;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
|
|
253
|
-
let
|
|
252
|
+
compareTopLevelMetaAssertion(topLevelMetaAssertion, context) {
|
|
253
|
+
let topLevelMetaAssertionCompares = false;
|
|
254
254
|
|
|
255
255
|
const reference = this, ///
|
|
256
256
|
referenceString = reference.getString(),
|
|
257
257
|
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
258
258
|
|
|
259
|
-
context.trace(`
|
|
259
|
+
context.trace(`Comparing the '${topLevelMetaAssertionString}' top level meta-assertion to the '${referenceString}' reference...`);
|
|
260
260
|
|
|
261
261
|
const label = topLevelMetaAssertion.getLabel(),
|
|
262
262
|
labelUnifies = this.unifyLabel(label, context);
|
|
263
263
|
|
|
264
|
-
|
|
264
|
+
if (labelUnifies) {
|
|
265
|
+
topLevelMetaAssertionCompares = true;
|
|
266
|
+
}
|
|
265
267
|
|
|
266
|
-
if (
|
|
267
|
-
context.trace(`...
|
|
268
|
+
if (topLevelMetaAssertionCompares) {
|
|
269
|
+
context.trace(`...compared the '${topLevelMetaAssertionString}' top level meta-assertion to the '${referenceString}' reference.`);
|
|
268
270
|
}
|
|
269
271
|
|
|
270
|
-
return
|
|
272
|
+
return topLevelMetaAssertionCompares;
|
|
271
273
|
}
|
|
272
274
|
|
|
273
275
|
toJSON() {
|
|
@@ -282,7 +284,7 @@ export default define(class Reference extends Element {
|
|
|
282
284
|
static name = "Reference";
|
|
283
285
|
|
|
284
286
|
static fromJSON(json, context) {
|
|
285
|
-
const reference =
|
|
287
|
+
const reference = instantiate((context) => {
|
|
286
288
|
const { string } = json,
|
|
287
289
|
referenceNode = instantiateReference(string, context),
|
|
288
290
|
node = referenceNode, ///
|
package/src/element/rule.js
CHANGED
|
@@ -4,7 +4,7 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
import { Element, asynchronousUtilities } from "occam-languages";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import {
|
|
7
|
+
import { asyncRestrict } from "../utilities/context";
|
|
8
8
|
import { labelsFromJSON, premisesFromJSON, conclusionFromJSON, labelsToLabelsJSON, premisesToPremisesJSON, conclusionToConclusionJSON } from "../utilities/json";
|
|
9
9
|
|
|
10
10
|
const { reverse, extract } = arrayUtilities,
|
|
@@ -88,7 +88,7 @@ export default define(class Rule extends Element {
|
|
|
88
88
|
|
|
89
89
|
context.trace(`Verifying the '${ruleString}' rule...`);
|
|
90
90
|
|
|
91
|
-
await
|
|
91
|
+
await asyncRestrict(async (context) => {
|
|
92
92
|
const labelsVerify = this.verifyLabels();
|
|
93
93
|
|
|
94
94
|
if (labelsVerify) {
|
package/src/element/signature.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Element } from "occam-languages";
|
|
|
4
4
|
import { arrayUtilities } from "necessary";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import {
|
|
7
|
+
import { instantiate } from "../utilities/context";
|
|
8
8
|
import { instantiateSignature } from "../process/instantiate";
|
|
9
9
|
import { termsFromSignatureNode } from "../utilities/element";
|
|
10
10
|
|
|
@@ -79,7 +79,7 @@ export default define(class Signature extends Element {
|
|
|
79
79
|
|
|
80
80
|
context.trace(`Validating the '${signatureString}' signature's '${termString}' term...`);
|
|
81
81
|
|
|
82
|
-
term = term.validate(context, () => { ///
|
|
82
|
+
term = term.validate(context, (term) => { ///
|
|
83
83
|
const validatesForwards = true;
|
|
84
84
|
|
|
85
85
|
return validatesForwards;
|
|
@@ -225,7 +225,7 @@ export default define(class Signature extends Element {
|
|
|
225
225
|
static name = "Signature";
|
|
226
226
|
|
|
227
227
|
static fromJSON(json, context) {
|
|
228
|
-
const signature =
|
|
228
|
+
const signature = instantiate((context) => {
|
|
229
229
|
const { string } = json,
|
|
230
230
|
signatureNode = instantiateSignature(string, context),
|
|
231
231
|
node = signatureNode, ///
|