occam-verify-cli 1.0.910 → 1.0.913
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/element/assertion/signature.js +165 -0
- package/lib/element/proofAssertion/step.js +29 -29
- package/lib/element/signature.js +27 -2
- package/lib/element/subproof.js +11 -11
- package/lib/node/assertion/{satisfies.js → signature.js} +4 -4
- package/lib/node/qualification.js +2 -2
- package/lib/node/statement.js +2 -2
- package/lib/nonTerminalNodeMap.js +3 -3
- package/lib/preamble.js +2 -2
- package/lib/process/instantiate.js +12 -6
- package/lib/ruleNames.js +5 -5
- package/lib/utilities/element.js +37 -50
- package/lib/utilities/json.js +3 -3
- package/lib/utilities/unification.js +30 -30
- package/lib/utilities/validation.js +15 -15
- package/package.json +7 -7
- package/src/element/assertion/{satisfies.js → signature.js} +35 -35
- package/src/element/proofAssertion/step.js +28 -28
- package/src/element/signature.js +44 -2
- package/src/element/subproof.js +10 -10
- package/src/node/assertion/{satisfies.js → signature.js} +2 -2
- package/src/node/qualification.js +2 -2
- package/src/node/statement.js +2 -2
- package/src/nonTerminalNodeMap.js +3 -3
- package/src/preamble.js +1 -1
- package/src/process/instantiate.js +7 -3
- package/src/ruleNames.js +1 -1
- package/src/utilities/element.js +32 -43
- package/src/utilities/json.js +2 -2
- package/src/utilities/unification.js +29 -29
- package/src/utilities/validation.js +14 -14
- package/lib/element/assertion/satisfies.js +0 -165
|
@@ -14,19 +14,19 @@ const { asyncSome } = asynchronousUtilities,
|
|
|
14
14
|
{ backwardsSome } = arrayUtilities;
|
|
15
15
|
|
|
16
16
|
export default define(class Step extends ProofAssertion {
|
|
17
|
-
constructor(context, string, node, lineIndex, statement, reference,
|
|
17
|
+
constructor(context, string, node, lineIndex, statement, reference, signatureAssertion) {
|
|
18
18
|
super(context, string, node, lineIndex, statement);
|
|
19
19
|
|
|
20
20
|
this.reference = reference;
|
|
21
|
-
this.
|
|
21
|
+
this.signatureAssertion = signatureAssertion;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
getReference() {
|
|
25
25
|
return this.reference;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
return this.
|
|
28
|
+
getSignatureAssertion() {
|
|
29
|
+
return this.signatureAssertion;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
getStepNode() {
|
|
@@ -44,7 +44,7 @@ export default define(class Step extends ProofAssertion {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
isSatisfied() {
|
|
47
|
-
const satisfied = (this.
|
|
47
|
+
const satisfied = (this.signatureAssertion !== null);
|
|
48
48
|
|
|
49
49
|
return satisfied;
|
|
50
50
|
}
|
|
@@ -143,9 +143,9 @@ export default define(class Step extends ProofAssertion {
|
|
|
143
143
|
const referenceValidates = this.validateReference(context);
|
|
144
144
|
|
|
145
145
|
if (referenceValidates) {
|
|
146
|
-
const
|
|
146
|
+
const signatureAssertionValidates = this.validateSignatureAssertion(context);
|
|
147
147
|
|
|
148
|
-
if (
|
|
148
|
+
if (signatureAssertionValidates) {
|
|
149
149
|
validates = true;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
@@ -211,27 +211,27 @@ export default define(class Step extends ProofAssertion {
|
|
|
211
211
|
return statementValidates;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
|
|
215
|
-
let
|
|
214
|
+
validateSignatureAssertion(context) {
|
|
215
|
+
let signatureAssertionValidates = true; ///
|
|
216
216
|
|
|
217
|
-
if (this.
|
|
217
|
+
if (this.signatureAssertion !== null) {
|
|
218
218
|
const stepString = this.getString(), ///
|
|
219
|
-
|
|
219
|
+
signatureAssertionString = this.signatureAssertion.getString();
|
|
220
220
|
|
|
221
|
-
context.trace(`Validating the '${stepString}' step's '${
|
|
221
|
+
context.trace(`Validating the '${stepString}' step's '${signatureAssertionString}' signature assertion... `);
|
|
222
222
|
|
|
223
|
-
const
|
|
223
|
+
const signatureAssertion = this.signatureAssertion.validate(context);
|
|
224
224
|
|
|
225
|
-
if (
|
|
226
|
-
|
|
225
|
+
if (signatureAssertion === null) {
|
|
226
|
+
signatureAssertionValidates = false;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
if (
|
|
230
|
-
context.debug(`...validating the '${stepString}' step's '${
|
|
229
|
+
if (signatureAssertionValidates) {
|
|
230
|
+
context.debug(`...validating the '${stepString}' step's '${signatureAssertionString}' signature assertion. `);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
return
|
|
234
|
+
return signatureAssertionValidates;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
async unify(context) {
|
|
@@ -264,15 +264,15 @@ export default define(class Step extends ProofAssertion {
|
|
|
264
264
|
return unifies;
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
|
|
268
|
-
let
|
|
267
|
+
unifyWithSignatureAssertion(signatureAssertion, context) {
|
|
268
|
+
let unifiesWithSignatureAssertion = false;
|
|
269
269
|
|
|
270
270
|
const stepString = this.getString(), ///
|
|
271
|
-
|
|
271
|
+
signatureAssertionString = signatureAssertion.getString();
|
|
272
272
|
|
|
273
|
-
context.trace(`Unifying the '${stepString}' step with the '${
|
|
273
|
+
context.trace(`Unifying the '${stepString}' step with the '${signatureAssertionString}' signature assertion...`);
|
|
274
274
|
|
|
275
|
-
const reference =
|
|
275
|
+
const reference = signatureAssertion.getReference(),
|
|
276
276
|
axiom = context.findAxiomByReference(reference);
|
|
277
277
|
|
|
278
278
|
if (axiom !== null) {
|
|
@@ -280,19 +280,19 @@ export default define(class Step extends ProofAssertion {
|
|
|
280
280
|
stepUnifies = axiom.unifyStep(step, context);
|
|
281
281
|
|
|
282
282
|
if (stepUnifies) {
|
|
283
|
-
const substitutionsCompare =
|
|
283
|
+
const substitutionsCompare = signatureAssertion.compareSubstitutions(context);
|
|
284
284
|
|
|
285
285
|
if (substitutionsCompare) {
|
|
286
|
-
|
|
286
|
+
unifiesWithSignatureAssertion = true;
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
if (
|
|
292
|
-
context.debug(`...unified the '${stepString}' step with the '${
|
|
291
|
+
if (unifiesWithSignatureAssertion) {
|
|
292
|
+
context.debug(`...unified the '${stepString}' step with the '${signatureAssertionString}' signature assertion.`);
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
return
|
|
295
|
+
return unifiesWithSignatureAssertion;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
static name = "Step";
|
package/src/element/signature.js
CHANGED
|
@@ -5,8 +5,8 @@ import { arrayUtilities } from "necessary";
|
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
7
|
import { instantiateSignature } from "../process/instantiate";
|
|
8
|
-
import {
|
|
9
|
-
import { attempt, reconcile, serialise, unserialise, instantiate } from "../utilities/context";
|
|
8
|
+
import { signatureFromSignatureNode } from "../utilities/element";
|
|
9
|
+
import { attempt, reconcile, serialise, unserialise, instantiate, ablate } from "../utilities/context";
|
|
10
10
|
|
|
11
11
|
const { match, compare, correlate } = arrayUtilities;
|
|
12
12
|
|
|
@@ -41,6 +41,22 @@ export default define(class Signature extends Element {
|
|
|
41
41
|
return term;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
isEqualTo(signature) {
|
|
45
|
+
const signatureNode = signature.getNode(),
|
|
46
|
+
signatureNodeMatches = this.matchSignatureNode(signatureNode),
|
|
47
|
+
equalTo = signatureNodeMatches; ///
|
|
48
|
+
|
|
49
|
+
return equalTo;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
matchSignatureNode(signatureNode) {
|
|
53
|
+
const node = signatureNode, ///
|
|
54
|
+
nodeMatches = this.matchNode(node),
|
|
55
|
+
signatureNodeMatches = nodeMatches; ///
|
|
56
|
+
|
|
57
|
+
return signatureNodeMatches;
|
|
58
|
+
}
|
|
59
|
+
|
|
44
60
|
findValidSignature(context) {
|
|
45
61
|
const signatureNode = this.getSignatureNode(),
|
|
46
62
|
signature = context.findSignatureBySignatureNode(signatureNode),
|
|
@@ -299,4 +315,30 @@ export default define(class Signature extends Element {
|
|
|
299
315
|
|
|
300
316
|
return signature;
|
|
301
317
|
}
|
|
318
|
+
|
|
319
|
+
static fromSignatureString(signatureString, context) {
|
|
320
|
+
let signature;
|
|
321
|
+
|
|
322
|
+
ablate((context) => {
|
|
323
|
+
instantiate((context) => {
|
|
324
|
+
const string = signatureString, ///
|
|
325
|
+
signatureNode = instantiateSignature(string, context);
|
|
326
|
+
|
|
327
|
+
signature = signatureFromSignatureNode(signatureNode, context);
|
|
328
|
+
}, context);
|
|
329
|
+
}, context);
|
|
330
|
+
|
|
331
|
+
return signature;
|
|
332
|
+
}
|
|
302
333
|
});
|
|
334
|
+
|
|
335
|
+
function termsFromSignatureNode(signatureNode, context) {
|
|
336
|
+
const termNodes = signatureNode.getTermNodes(),
|
|
337
|
+
terms = termNodes.map((termNode) => {
|
|
338
|
+
const term = context.findTermByTermNode(termNode);
|
|
339
|
+
|
|
340
|
+
return term;
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
return terms;
|
|
344
|
+
}
|
package/src/element/subproof.js
CHANGED
|
@@ -112,15 +112,15 @@ export default define(class Subproof extends Element {
|
|
|
112
112
|
return subDerivationVerifies;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
let
|
|
115
|
+
unifyWithSignatureAssertion(signatureAssertion, context) {
|
|
116
|
+
let unifiesWithSignatureAssertion = false;
|
|
117
117
|
|
|
118
118
|
const subproofString = this.getString(), ///
|
|
119
|
-
|
|
119
|
+
signatureAssertionString = signatureAssertion.getString();
|
|
120
120
|
|
|
121
|
-
context.trace(`Unifying the '${subproofString}' subproof with the '${
|
|
121
|
+
context.trace(`Unifying the '${subproofString}' subproof with the '${signatureAssertionString}' signature assertion...`)
|
|
122
122
|
|
|
123
|
-
const reference =
|
|
123
|
+
const reference = signatureAssertion.getReference(),
|
|
124
124
|
axiom = context.findAxiomByReference(reference);
|
|
125
125
|
|
|
126
126
|
if (axiom !== null) {
|
|
@@ -131,20 +131,20 @@ export default define(class Subproof extends Element {
|
|
|
131
131
|
statementUnifies = axiom.unifySubproof(subproof, context);
|
|
132
132
|
|
|
133
133
|
if (statementUnifies) {
|
|
134
|
-
const substitutionsCompare =
|
|
134
|
+
const substitutionsCompare = signatureAssertion.compareSubstitutions(substitutions, context);
|
|
135
135
|
|
|
136
136
|
if (substitutionsCompare) {
|
|
137
|
-
|
|
137
|
+
unifiesWithSignatureAssertion = true;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
if (
|
|
144
|
-
context.debug(`...unified the '${subproofString}' subproof with the '${
|
|
143
|
+
if (unifiesWithSignatureAssertion) {
|
|
144
|
+
context.debug(`...unified the '${subproofString}' subproof with the '${signatureAssertionString}' signature assertion.`)
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
return
|
|
147
|
+
return unifiesWithSignatureAssertion;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
static name = "Subproof";
|
|
@@ -4,7 +4,7 @@ import AssertionNode from "../../node/assertion";
|
|
|
4
4
|
|
|
5
5
|
import { SIGNATURE_RULE_NAME, METAVARIABLE_RULE_NAME } from "../../ruleNames";
|
|
6
6
|
|
|
7
|
-
export default class
|
|
7
|
+
export default class SignatureAssertionNode extends AssertionNode {
|
|
8
8
|
getSignatureNode() {
|
|
9
9
|
const ruleName = SIGNATURE_RULE_NAME,
|
|
10
10
|
signatureNode = this.getNodeByRuleName(ruleName);
|
|
@@ -19,5 +19,5 @@ export default class SatisfiesAssertionNode extends AssertionNode {
|
|
|
19
19
|
return metavariableNode;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return AssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(
|
|
22
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return AssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(SignatureAssertionNode, ruleName, childNodes, opacity, precedence); }
|
|
23
23
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { NonTerminalNode } from "occam-languages";
|
|
4
4
|
|
|
5
|
-
import { REFERENCE_RULE_NAME,
|
|
5
|
+
import { REFERENCE_RULE_NAME, SIGNATURE_ASSERTION_RULE_NAME } from "../ruleNames";
|
|
6
6
|
|
|
7
7
|
export default class QualificationNode extends NonTerminalNode {
|
|
8
8
|
getReferenceNode() {
|
|
@@ -13,7 +13,7 @@ export default class QualificationNode extends NonTerminalNode {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
getSatisfiedAssertionNode() {
|
|
16
|
-
const ruleName =
|
|
16
|
+
const ruleName = SIGNATURE_ASSERTION_RULE_NAME,
|
|
17
17
|
satisfiedAssertionNode = this.getNodeByRuleName(ruleName);
|
|
18
18
|
|
|
19
19
|
return satisfiedAssertionNode;
|
package/src/node/statement.js
CHANGED
|
@@ -14,7 +14,7 @@ import { TERM_RULE_NAME,
|
|
|
14
14
|
PROPERTY_ASSERTION_RULE_NAME,
|
|
15
15
|
SUBPROOF_ASSERTION_RULE_NAME,
|
|
16
16
|
FRAME_SUBSTITUTION_RULE_NAME,
|
|
17
|
-
|
|
17
|
+
SIGNATURE_ASSERTION_RULE_NAME,
|
|
18
18
|
CONTAINED_ASSERTION_RULE_NAME,
|
|
19
19
|
STATEMENT_SUBSTITUTION_RULE_NAME } from "../ruleNames";
|
|
20
20
|
|
|
@@ -136,7 +136,7 @@ export default class StatementNode extends NonTerminalNode {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
getSatisfiedAssertionNode() {
|
|
139
|
-
const ruleName =
|
|
139
|
+
const ruleName = SIGNATURE_ASSERTION_RULE_NAME,
|
|
140
140
|
satisfiedAssertionNode = this.getNodeByRuleName(ruleName);
|
|
141
141
|
|
|
142
142
|
return satisfiedAssertionNode;
|
|
@@ -71,7 +71,7 @@ import FrameSubstitutionNode from "./node/substitution/frame";
|
|
|
71
71
|
import ParenthesisedLabelNode from "./node/parenthesisedLabel";
|
|
72
72
|
import ProcedureReferenceNode from "./node/procedureReference";
|
|
73
73
|
import ContainedAssertionNode from "./node/assertion/contained";
|
|
74
|
-
import
|
|
74
|
+
import SignatureAssertionNode from "./node/assertion/signature";
|
|
75
75
|
import ParenthesisedLabelsNode from "./node/parenthesisedLabels"
|
|
76
76
|
import PropertyDeclarationNode from "./node/declaration/property";
|
|
77
77
|
import VariableDeclarationNode from "./node/declaration/variable";
|
|
@@ -156,7 +156,7 @@ import {
|
|
|
156
156
|
FRAME_SUBSTITUTION_RULE_NAME,
|
|
157
157
|
PROCEDURE_REFERENCE_RULE_NAME,
|
|
158
158
|
CONTAINED_ASSERTION_RULE_NAME,
|
|
159
|
-
|
|
159
|
+
SIGNATURE_ASSERTION_RULE_NAME,
|
|
160
160
|
PARENTHESISED_LABEL_RULE_NAME,
|
|
161
161
|
PARENTHESISED_LABELS_RULE_NAME,
|
|
162
162
|
PROPERTY_DECLARATION_RULE_NAME,
|
|
@@ -242,7 +242,7 @@ const NonTerminalNodeMap = {
|
|
|
242
242
|
[FRAME_SUBSTITUTION_RULE_NAME]: FrameSubstitutionNode,
|
|
243
243
|
[PROCEDURE_REFERENCE_RULE_NAME]: ProcedureReferenceNode,
|
|
244
244
|
[PARENTHESISED_LABEL_RULE_NAME]: ParenthesisedLabelNode,
|
|
245
|
-
[
|
|
245
|
+
[SIGNATURE_ASSERTION_RULE_NAME]: SignatureAssertionNode,
|
|
246
246
|
[CONTAINED_ASSERTION_RULE_NAME]: ContainedAssertionNode,
|
|
247
247
|
[PARENTHESISED_LABELS_RULE_NAME]: ParenthesisedLabelsNode,
|
|
248
248
|
[VARIABLE_DECLARATION_RULE_NAME]: VariableDeclarationNode,
|
package/src/preamble.js
CHANGED
|
@@ -48,7 +48,7 @@ import SubproofAssertion from "./element/assertion/subproof";
|
|
|
48
48
|
import PropertyAssertion from "./element/assertion/property";
|
|
49
49
|
import ProcedureReference from "./element/procedureReference";
|
|
50
50
|
import ContainedAssertion from "./element/assertion/contained";
|
|
51
|
-
import
|
|
51
|
+
import signatureAssertion from "./element/assertion/signature";
|
|
52
52
|
import MetaLevelAssumption from "./element/assumption/metaLevel";
|
|
53
53
|
import PropertyDeclaration from "./element/declaration/property";
|
|
54
54
|
import VariableDeclaration from "./element/declaration/variable";
|
|
@@ -14,6 +14,7 @@ import { TERM_RULE_NAME,
|
|
|
14
14
|
PARAMETER_RULE_NAME,
|
|
15
15
|
STATEMENT_RULE_NAME,
|
|
16
16
|
REFERENCE_RULE_NAME,
|
|
17
|
+
SIGNATURE_RULE_NAME,
|
|
17
18
|
COMBINATOR_RULE_NAME,
|
|
18
19
|
CONCLUSION_RULE_NAME,
|
|
19
20
|
HYPOTHESIS_RULE_NAME,
|
|
@@ -33,7 +34,7 @@ import { TERM_RULE_NAME,
|
|
|
33
34
|
FRAME_SUBSTITUTION_RULE_NAME,
|
|
34
35
|
PROCEDURE_REFERENCE_RULE_NAME,
|
|
35
36
|
CONTAINED_ASSERTION_RULE_NAME,
|
|
36
|
-
|
|
37
|
+
SIGNATURE_ASSERTION_RULE_NAME,
|
|
37
38
|
META_LEVEL_ASSUMPTION_RULE_NAME,
|
|
38
39
|
STATEMENT_SUBSTITUTION_RULE_NAME,
|
|
39
40
|
REFERENCE_SUBSTITUTION_RULE_NAME } from "../ruleNames";
|
|
@@ -51,6 +52,7 @@ const termPlaceholderRule = ruleFromRuleName(TERM_RULE_NAME),
|
|
|
51
52
|
parameterPlaceholderRule = ruleFromRuleName(PARAMETER_RULE_NAME),
|
|
52
53
|
statementPlaceholderRule = ruleFromRuleName(STATEMENT_RULE_NAME),
|
|
53
54
|
referencePlaceholderRule = ruleFromRuleName(REFERENCE_RULE_NAME),
|
|
55
|
+
signaturePlaceholderRule = ruleFromRuleName(SIGNATURE_RULE_NAME),
|
|
54
56
|
combinatorPlaceholderRule = ruleFromRuleName(COMBINATOR_RULE_NAME),
|
|
55
57
|
conclusionPlaceholderRule = ruleFromRuleName(CONCLUSION_RULE_NAME),
|
|
56
58
|
hypothesisPlaceholderRule = ruleFromRuleName(HYPOTHESIS_RULE_NAME),
|
|
@@ -70,7 +72,7 @@ const termPlaceholderRule = ruleFromRuleName(TERM_RULE_NAME),
|
|
|
70
72
|
frameSubstitutionPlaceholderRule = ruleFromRuleName(FRAME_SUBSTITUTION_RULE_NAME),
|
|
71
73
|
procedureReferencelaceholderRule = ruleFromRuleName(PROCEDURE_REFERENCE_RULE_NAME),
|
|
72
74
|
containedAssertionPlaceholderRule = ruleFromRuleName(CONTAINED_ASSERTION_RULE_NAME),
|
|
73
|
-
|
|
75
|
+
signatureAssertionPlaceholderRule = ruleFromRuleName(SIGNATURE_ASSERTION_RULE_NAME),
|
|
74
76
|
metaLevelAssumptionPlaceholderRule = ruleFromRuleName(META_LEVEL_ASSUMPTION_RULE_NAME),
|
|
75
77
|
statementSubstitutionPlaceholderRule = ruleFromRuleName(STATEMENT_SUBSTITUTION_RULE_NAME),
|
|
76
78
|
referenceSubstitutionPlaceholderRule = ruleFromRuleName(REFERENCE_SUBSTITUTION_RULE_NAME);
|
|
@@ -125,6 +127,8 @@ export function instantiateStatement(string, context) { return instantiate(state
|
|
|
125
127
|
|
|
126
128
|
export function instantiateReference(string, context) { return instantiate(referencePlaceholderRule, string, context); }
|
|
127
129
|
|
|
130
|
+
export function instantiateSignature(string, context) { return instantiate(signaturePlaceholderRule, string, context); }
|
|
131
|
+
|
|
128
132
|
export function instantiateCombinator(string, context) { return instantiate(combinatorPlaceholderRule, string, context); }
|
|
129
133
|
|
|
130
134
|
export function instantiateHypothesis(string, context) { return instantiate(hypothesisPlaceholderRule, string, context); }
|
|
@@ -159,7 +163,7 @@ export function instantiateProcedureReference(string, context) { return instanti
|
|
|
159
163
|
|
|
160
164
|
export function instantiateContainedAssertion(string, context) { return instantiate(containedAssertionPlaceholderRule, string, context); }
|
|
161
165
|
|
|
162
|
-
export function
|
|
166
|
+
export function instantiateSignatureAssertion(string, context) { return instantiate(signatureAssertionPlaceholderRule, string, context); }
|
|
163
167
|
|
|
164
168
|
export function instantiateMetaLevelAssumption(string, context) { return instantiate(metaLevelAssumptionPlaceholderRule, string, context); }
|
|
165
169
|
|
package/src/ruleNames.js
CHANGED
|
@@ -71,7 +71,7 @@ export const FRAME_SUBSTITUTION_RULE_NAME = "frameSubstitution";
|
|
|
71
71
|
export const PARENTHESISED_LABEL_RULE_NAME = "parenthesisedLabel";
|
|
72
72
|
export const PROCEDURE_REFERENCE_RULE_NAME = "procedureReference";
|
|
73
73
|
export const CONTAINED_ASSERTION_RULE_NAME = "containedAssertion";
|
|
74
|
-
export const
|
|
74
|
+
export const SIGNATURE_ASSERTION_RULE_NAME = "signatureAssertion";
|
|
75
75
|
export const PARENTHESISED_LABELS_RULE_NAME = "parenthesisedLabels";
|
|
76
76
|
export const PROPERTY_DECLARATION_RULE_NAME = "propertyDeclaration";
|
|
77
77
|
export const VARIABLE_DECLARATION_RULE_NAME = "variableDeclaration";
|
package/src/utilities/element.js
CHANGED
|
@@ -62,11 +62,11 @@ export function stepFromStepNode(stepNode, context) {
|
|
|
62
62
|
lineIndex = null,
|
|
63
63
|
statement = statementFromStepNode(stepNode, context),
|
|
64
64
|
reference = referenceFromStepNode(stepNode, context),
|
|
65
|
-
|
|
65
|
+
signatureAssertion = signatureAssertionFromStepNode(stepNode, context);
|
|
66
66
|
|
|
67
67
|
context = null;
|
|
68
68
|
|
|
69
|
-
const step = new Step(context, string, node, lineIndex, statement, reference,
|
|
69
|
+
const step = new Step(context, string, node, lineIndex, statement, reference, signatureAssertion);
|
|
70
70
|
|
|
71
71
|
return step;
|
|
72
72
|
}
|
|
@@ -743,19 +743,19 @@ export function containedAssertionFromContainedAssertionNode(containedAssertionN
|
|
|
743
743
|
return containedAssertion;
|
|
744
744
|
}
|
|
745
745
|
|
|
746
|
-
export function
|
|
747
|
-
const {
|
|
748
|
-
node =
|
|
746
|
+
export function signatureAssertionFromSignatureAssertionNode(signatureAssertionNode, context) {
|
|
747
|
+
const { SignatureAssertion } = elements,
|
|
748
|
+
node = signatureAssertionNode, ///
|
|
749
749
|
string = context.nodeAsString(node),
|
|
750
750
|
lineIndex = null,
|
|
751
|
-
signature =
|
|
752
|
-
reference =
|
|
751
|
+
signature = signatureFromSignatureAssertionNode(signatureAssertionNode, context),
|
|
752
|
+
reference = referenceFromSignatureAssertionNode(signatureAssertionNode, context);
|
|
753
753
|
|
|
754
754
|
context = null;
|
|
755
755
|
|
|
756
|
-
const
|
|
756
|
+
const signatureAssertion = new SignatureAssertion(context, string, node, lineIndex, signature, reference);
|
|
757
757
|
|
|
758
|
-
return
|
|
758
|
+
return signatureAssertion;
|
|
759
759
|
}
|
|
760
760
|
|
|
761
761
|
export function procedureReferenceFromProcedureReferenceNode(procedureReferenceNode, context) {
|
|
@@ -1553,16 +1553,16 @@ export function termFromPropertyAssertionNode(propertyAssertionNode, context) {
|
|
|
1553
1553
|
return term;
|
|
1554
1554
|
}
|
|
1555
1555
|
|
|
1556
|
-
export function
|
|
1557
|
-
let
|
|
1556
|
+
export function signatureAssertionFromStepNode(stepNode, context) {
|
|
1557
|
+
let signatureAssertion = null;
|
|
1558
1558
|
|
|
1559
|
-
const
|
|
1559
|
+
const signatureAssertionNode = stepNode.getSatisfiedAssertionNode();
|
|
1560
1560
|
|
|
1561
|
-
if (
|
|
1562
|
-
|
|
1561
|
+
if (signatureAssertionNode !== null) {
|
|
1562
|
+
signatureAssertion = signatureAssertionFromSignatureAssertionNode(signatureAssertionNode, context);
|
|
1563
1563
|
}
|
|
1564
1564
|
|
|
1565
|
-
return
|
|
1565
|
+
return signatureAssertion;
|
|
1566
1566
|
}
|
|
1567
1567
|
|
|
1568
1568
|
export function typeAssertionFromStatementNode(statementNode, context) {
|
|
@@ -1763,7 +1763,10 @@ export function signatureFromTopLevelAssertionNode(topLevelAsssertionNode, conte
|
|
|
1763
1763
|
const signatureNode = topLevelAsssertionNode.getSignatureNode();
|
|
1764
1764
|
|
|
1765
1765
|
if (signatureNode !== null) {
|
|
1766
|
-
|
|
1766
|
+
const { Signature } = elements,
|
|
1767
|
+
signatureString = context.nodeAsString(signatureNode);
|
|
1768
|
+
|
|
1769
|
+
signature = Signature.fromSignatureString(signatureString, context);
|
|
1767
1770
|
}
|
|
1768
1771
|
|
|
1769
1772
|
return signature;
|
|
@@ -1835,16 +1838,16 @@ export function containedAssertionFromStatementNode(statementNode, context) {0
|
|
|
1835
1838
|
return containedAssertion;
|
|
1836
1839
|
}
|
|
1837
1840
|
|
|
1838
|
-
export function
|
|
1839
|
-
let
|
|
1841
|
+
export function signatureAssertionFromStatementNode(statementNode, context) {
|
|
1842
|
+
let signatureAssertion = null;
|
|
1840
1843
|
|
|
1841
|
-
const
|
|
1844
|
+
const signatureAssertionNode = statementNode.getSatisfiedAssertionNode();
|
|
1842
1845
|
|
|
1843
|
-
if (
|
|
1844
|
-
|
|
1846
|
+
if (signatureAssertionNode !== null) {
|
|
1847
|
+
signatureAssertion = signatureAssertionFromSignatureAssertionNode(signatureAssertionNode, context);
|
|
1845
1848
|
}
|
|
1846
1849
|
|
|
1847
|
-
return
|
|
1850
|
+
return signatureAssertion;
|
|
1848
1851
|
}
|
|
1849
1852
|
|
|
1850
1853
|
export function statementsFromSubproofAssertionNode(subproofAssertionNode, context) {
|
|
@@ -1861,15 +1864,17 @@ export function statementFromContainedAssertionNode(containedAssertionNode, cont
|
|
|
1861
1864
|
return statement;
|
|
1862
1865
|
}
|
|
1863
1866
|
|
|
1864
|
-
export function
|
|
1865
|
-
const
|
|
1866
|
-
|
|
1867
|
+
export function signatureFromSignatureAssertionNode(signatureAssertionNode, context) {
|
|
1868
|
+
const { Signature } = elements,
|
|
1869
|
+
signatureNode = signatureAssertionNode.getSignatureNode(),
|
|
1870
|
+
signatureString = context.nodeAsString(signatureNode),
|
|
1871
|
+
signature = Signature.fromSignatureString(signatureString, context);
|
|
1867
1872
|
|
|
1868
1873
|
return signature;
|
|
1869
1874
|
}
|
|
1870
1875
|
|
|
1871
|
-
export function
|
|
1872
|
-
const metavariableNode =
|
|
1876
|
+
export function referenceFromSignatureAssertionNode(signatureAssertionNode, context) {
|
|
1877
|
+
const metavariableNode = signatureAssertionNode.getMetavariableNode(),
|
|
1873
1878
|
reference = referenceFromMetavariableNode(metavariableNode, context);
|
|
1874
1879
|
|
|
1875
1880
|
return reference;
|
|
@@ -1902,22 +1907,6 @@ export function statementFromBracketedCombinatorNode(bracketedCombinatorNode, co
|
|
|
1902
1907
|
return statement;
|
|
1903
1908
|
}
|
|
1904
1909
|
|
|
1905
|
-
export function signatureFromJSatisfiesAssertionNode(sasisfiesAssertionNode, context) {
|
|
1906
|
-
const signatureNode = sasisfiesAssertionNode.getSignatureNode(),
|
|
1907
|
-
signature = signatureFromSignatureNode(signatureNode, context);
|
|
1908
|
-
|
|
1909
|
-
return signature;
|
|
1910
|
-
}
|
|
1911
|
-
|
|
1912
|
-
export function referenceFromJSatisfiesAssertionNode(sasisfiesAssertionNode, context) {
|
|
1913
|
-
const { Reference } = elements,
|
|
1914
|
-
referenceNode = sasisfiesAssertionNode.getReferenceNode(),
|
|
1915
|
-
referenceString = context.nodeAsString(referenceNode),
|
|
1916
|
-
reference = Reference.fromReferenceString(referenceString, context);
|
|
1917
|
-
|
|
1918
|
-
return reference;
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1921
1910
|
export function targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, context) {
|
|
1922
1911
|
const targetFrameNode = frameSubstitutionNode.getTargetFrameNode(),
|
|
1923
1912
|
targetFrame = frameFromFrameNode(targetFrameNode, context);
|
package/src/utilities/json.js
CHANGED
|
@@ -496,7 +496,7 @@ export function statementsFromJSON(json, context) {
|
|
|
496
496
|
export function assertionsFromJSON(json, context) {
|
|
497
497
|
let { assertions } = json;
|
|
498
498
|
|
|
499
|
-
const { TypeAssertion, DefinedAssertion, PropertyAssertion, SubproofAssertion,
|
|
499
|
+
const { TypeAssertion, DefinedAssertion, PropertyAssertion, SubproofAssertion, SignatureAssertion, ContainedAssertion } = elements,
|
|
500
500
|
assertionsJSON = assertions; ///
|
|
501
501
|
|
|
502
502
|
assertions = assertionsJSON.map((assertionJSON) => {
|
|
@@ -505,7 +505,7 @@ export function assertionsFromJSON(json, context) {
|
|
|
505
505
|
DefinedAssertion.fromJSON(json, context) ||
|
|
506
506
|
PropertyAssertion.fromJSON(json, context) ||
|
|
507
507
|
SubproofAssertion.fromJSON(json, context) ||
|
|
508
|
-
|
|
508
|
+
SignatureAssertion.fromJSON(json, context) ||
|
|
509
509
|
ContainedAssertion.fromJSON(json, context);
|
|
510
510
|
|
|
511
511
|
return assertion;
|