occam-verify-cli 1.0.910 → 1.0.911
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/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 +6 -6
- package/lib/ruleNames.js +5 -5
- package/lib/utilities/element.js +41 -41
- package/lib/utilities/json.js +3 -3
- package/lib/utilities/unification.js +30 -30
- package/lib/utilities/validation.js +15 -15
- package/package.json +4 -4
- package/src/element/assertion/{satisfies.js → signature.js} +35 -35
- package/src/element/proofAssertion/step.js +28 -28
- 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 +3 -3
- package/src/ruleNames.js +1 -1
- package/src/utilities/element.js +27 -27
- 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/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";
|
|
@@ -33,7 +33,7 @@ import { TERM_RULE_NAME,
|
|
|
33
33
|
FRAME_SUBSTITUTION_RULE_NAME,
|
|
34
34
|
PROCEDURE_REFERENCE_RULE_NAME,
|
|
35
35
|
CONTAINED_ASSERTION_RULE_NAME,
|
|
36
|
-
|
|
36
|
+
SIGNATURE_ASSERTION_RULE_NAME,
|
|
37
37
|
META_LEVEL_ASSUMPTION_RULE_NAME,
|
|
38
38
|
STATEMENT_SUBSTITUTION_RULE_NAME,
|
|
39
39
|
REFERENCE_SUBSTITUTION_RULE_NAME } from "../ruleNames";
|
|
@@ -70,7 +70,7 @@ const termPlaceholderRule = ruleFromRuleName(TERM_RULE_NAME),
|
|
|
70
70
|
frameSubstitutionPlaceholderRule = ruleFromRuleName(FRAME_SUBSTITUTION_RULE_NAME),
|
|
71
71
|
procedureReferencelaceholderRule = ruleFromRuleName(PROCEDURE_REFERENCE_RULE_NAME),
|
|
72
72
|
containedAssertionPlaceholderRule = ruleFromRuleName(CONTAINED_ASSERTION_RULE_NAME),
|
|
73
|
-
|
|
73
|
+
signatureAssertionPlaceholderRule = ruleFromRuleName(SIGNATURE_ASSERTION_RULE_NAME),
|
|
74
74
|
metaLevelAssumptionPlaceholderRule = ruleFromRuleName(META_LEVEL_ASSUMPTION_RULE_NAME),
|
|
75
75
|
statementSubstitutionPlaceholderRule = ruleFromRuleName(STATEMENT_SUBSTITUTION_RULE_NAME),
|
|
76
76
|
referenceSubstitutionPlaceholderRule = ruleFromRuleName(REFERENCE_SUBSTITUTION_RULE_NAME);
|
|
@@ -159,7 +159,7 @@ export function instantiateProcedureReference(string, context) { return instanti
|
|
|
159
159
|
|
|
160
160
|
export function instantiateContainedAssertion(string, context) { return instantiate(containedAssertionPlaceholderRule, string, context); }
|
|
161
161
|
|
|
162
|
-
export function
|
|
162
|
+
export function instantiateSignatureAssertion(string, context) { return instantiate(signatureAssertionPlaceholderRule, string, context); }
|
|
163
163
|
|
|
164
164
|
export function instantiateMetaLevelAssumption(string, context) { return instantiate(metaLevelAssumptionPlaceholderRule, string, context); }
|
|
165
165
|
|
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) {
|
|
@@ -1835,16 +1835,16 @@ export function containedAssertionFromStatementNode(statementNode, context) {0
|
|
|
1835
1835
|
return containedAssertion;
|
|
1836
1836
|
}
|
|
1837
1837
|
|
|
1838
|
-
export function
|
|
1839
|
-
let
|
|
1838
|
+
export function signatureAssertionFromStatementNode(statementNode, context) {
|
|
1839
|
+
let signatureAssertion = null;
|
|
1840
1840
|
|
|
1841
|
-
const
|
|
1841
|
+
const signatureAssertionNode = statementNode.getSatisfiedAssertionNode();
|
|
1842
1842
|
|
|
1843
|
-
if (
|
|
1844
|
-
|
|
1843
|
+
if (signatureAssertionNode !== null) {
|
|
1844
|
+
signatureAssertion = signatureAssertionFromSignatureAssertionNode(signatureAssertionNode, context);
|
|
1845
1845
|
}
|
|
1846
1846
|
|
|
1847
|
-
return
|
|
1847
|
+
return signatureAssertion;
|
|
1848
1848
|
}
|
|
1849
1849
|
|
|
1850
1850
|
export function statementsFromSubproofAssertionNode(subproofAssertionNode, context) {
|
|
@@ -1861,15 +1861,15 @@ export function statementFromContainedAssertionNode(containedAssertionNode, cont
|
|
|
1861
1861
|
return statement;
|
|
1862
1862
|
}
|
|
1863
1863
|
|
|
1864
|
-
export function
|
|
1865
|
-
const signatureNode =
|
|
1864
|
+
export function signatureFromSignatureAssertionNode(signatureAssertionNode, context) {
|
|
1865
|
+
const signatureNode = signatureAssertionNode.getSignatureNode(),
|
|
1866
1866
|
signature = signatureFromSignatureNode(signatureNode, context);
|
|
1867
1867
|
|
|
1868
1868
|
return signature;
|
|
1869
1869
|
}
|
|
1870
1870
|
|
|
1871
|
-
export function
|
|
1872
|
-
const metavariableNode =
|
|
1871
|
+
export function referenceFromSignatureAssertionNode(signatureAssertionNode, context) {
|
|
1872
|
+
const metavariableNode = signatureAssertionNode.getMetavariableNode(),
|
|
1873
1873
|
reference = referenceFromMetavariableNode(metavariableNode, context);
|
|
1874
1874
|
|
|
1875
1875
|
return reference;
|
|
@@ -1902,14 +1902,14 @@ export function statementFromBracketedCombinatorNode(bracketedCombinatorNode, co
|
|
|
1902
1902
|
return statement;
|
|
1903
1903
|
}
|
|
1904
1904
|
|
|
1905
|
-
export function
|
|
1905
|
+
export function signatureFromJSignatureAssertionNode(sasisfiesAssertionNode, context) {
|
|
1906
1906
|
const signatureNode = sasisfiesAssertionNode.getSignatureNode(),
|
|
1907
1907
|
signature = signatureFromSignatureNode(signatureNode, context);
|
|
1908
1908
|
|
|
1909
1909
|
return signature;
|
|
1910
1910
|
}
|
|
1911
1911
|
|
|
1912
|
-
export function
|
|
1912
|
+
export function referenceFromJSignatureAssertionNode(sasisfiesAssertionNode, context) {
|
|
1913
1913
|
const { Reference } = elements,
|
|
1914
1914
|
referenceNode = sasisfiesAssertionNode.getReferenceNode(),
|
|
1915
1915
|
referenceString = context.nodeAsString(referenceNode),
|
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;
|
|
@@ -83,20 +83,20 @@ async function unifyStepWithReference(step, context) {
|
|
|
83
83
|
return stepUnifiesWithReference;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
async function
|
|
87
|
-
let
|
|
86
|
+
async function unifyStepAsSignatureAssertion(step, context) {
|
|
87
|
+
let stepUnifiesAsSignatureAssertion = false;
|
|
88
88
|
|
|
89
|
-
const {
|
|
89
|
+
const { SignatureAssertion } = elements;
|
|
90
90
|
|
|
91
|
-
const
|
|
91
|
+
const signatureAssertion = SignatureAssertion.fromStep(step, context);
|
|
92
92
|
|
|
93
|
-
if (
|
|
93
|
+
if (signatureAssertion !== null) {
|
|
94
94
|
const stepString = step.getString();
|
|
95
95
|
|
|
96
|
-
context.trace(`Unifying the '${stepString}' step as a
|
|
96
|
+
context.trace(`Unifying the '${stepString}' step as a signature assertion...`);
|
|
97
97
|
|
|
98
98
|
descend((context) => {
|
|
99
|
-
|
|
99
|
+
signatureAssertion.verifySignature(context);
|
|
100
100
|
}, context);
|
|
101
101
|
|
|
102
102
|
const unqualified = step.isUnqualified();
|
|
@@ -104,15 +104,15 @@ async function unifyStepAsSatisfiesAssertion(step, context) {
|
|
|
104
104
|
if (unqualified) {
|
|
105
105
|
const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
const
|
|
107
|
+
stepUnifiesAsSignatureAssertion = backwardsSome(subproofOrProofAssertions, (stepsOrSubproof) => {
|
|
108
|
+
const stepOrSubProofUnifiesWIthSignatureAssertion = stepsOrSubproof.unifyWithSignatureAssertion(signatureAssertion, context);
|
|
109
109
|
|
|
110
|
-
if (
|
|
110
|
+
if (stepOrSubProofUnifiesWIthSignatureAssertion) {
|
|
111
111
|
return true;
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
} else {
|
|
115
|
-
const reference =
|
|
115
|
+
const reference = signatureAssertion.getReference(),
|
|
116
116
|
topLevelAssertion = context.findTopLevelAssertionByReference(reference);
|
|
117
117
|
|
|
118
118
|
if (topLevelAssertion !== null) {
|
|
@@ -125,10 +125,10 @@ async function unifyStepAsSatisfiesAssertion(step, context) {
|
|
|
125
125
|
const topLevelAssertionUnifies = axiom.unifyTopLevelAssertion(topLevelAssertion, context);
|
|
126
126
|
|
|
127
127
|
if (topLevelAssertionUnifies) {
|
|
128
|
-
const substitutionsCorrelates =
|
|
128
|
+
const substitutionsCorrelates = signatureAssertion.correlateSubstitutions(substitutions, context);
|
|
129
129
|
|
|
130
130
|
if (substitutionsCorrelates) {
|
|
131
|
-
|
|
131
|
+
stepUnifiesAsSignatureAssertion = true;
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
} else {
|
|
@@ -140,12 +140,12 @@ async function unifyStepAsSatisfiesAssertion(step, context) {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
if (
|
|
144
|
-
context.debug(`...unified the '${stepString}' step as a
|
|
143
|
+
if (stepUnifiesAsSignatureAssertion) {
|
|
144
|
+
context.debug(`...unified the '${stepString}' step as a signature assertion.`);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
return
|
|
148
|
+
return stepUnifiesAsSignatureAssertion;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
async function unifyStepWithTopLevelAssertion(step, context) {
|
|
@@ -301,30 +301,30 @@ async function unifyStepAsPropertyAssertion(step, context) {
|
|
|
301
301
|
return stepUnifiesAsPropertyAssertion;
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
async function
|
|
305
|
-
let
|
|
304
|
+
async function unifyStepWithSignatureAssertion(step, context) {
|
|
305
|
+
let stepUnifiesWithSignatureAssertion = false;
|
|
306
306
|
|
|
307
|
-
const
|
|
307
|
+
const signatureAssertion = step.getSignatureAssertion();
|
|
308
308
|
|
|
309
|
-
if (
|
|
309
|
+
if (signatureAssertion !== null) {
|
|
310
310
|
const stepString = step.getString(),
|
|
311
|
-
|
|
311
|
+
signatureAssertionString = signatureAssertion.getString();
|
|
312
312
|
|
|
313
|
-
context.trace(`Unifying the '${stepString}' step with the '${
|
|
313
|
+
context.trace(`Unifying the '${stepString}' step with the '${signatureAssertionString}' signature assertion...`);
|
|
314
314
|
|
|
315
315
|
const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
|
|
316
|
-
stepUnifies =
|
|
316
|
+
stepUnifies = signatureAssertion.unifyStepAndSubproofOrProofAssertions(step, subproofOrProofAssertions, context);
|
|
317
317
|
|
|
318
318
|
if (stepUnifies) {
|
|
319
|
-
|
|
319
|
+
stepUnifiesWithSignatureAssertion = true;
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
if (
|
|
323
|
-
context.debug(`...unified the '${stepString}' step with the '${
|
|
322
|
+
if (stepUnifiesWithSignatureAssertion) {
|
|
323
|
+
context.debug(`...unified the '${stepString}' step with the '${signatureAssertionString}' signature assertion.`);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
return
|
|
327
|
+
return stepUnifiesWithSignatureAssertion;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
async function compareStepWithSubproofOrProofAssertions(step, context) {
|
|
@@ -355,12 +355,12 @@ async function compareStepWithSubproofOrProofAssertions(step, context) {
|
|
|
355
355
|
export const unifySteps = [
|
|
356
356
|
unifyStepWithRule,
|
|
357
357
|
unifyStepWithReference,
|
|
358
|
-
|
|
358
|
+
unifyStepAsSignatureAssertion,
|
|
359
359
|
unifyStepWithTopLevelAssertion,
|
|
360
360
|
unifyStepAsEquality,
|
|
361
361
|
unifyStepAsJudgement,
|
|
362
362
|
unifyStepAsTypeAssertion,
|
|
363
363
|
unifyStepAsPropertyAssertion,
|
|
364
|
-
|
|
364
|
+
unifyStepWithSignatureAssertion,
|
|
365
365
|
compareStepWithSubproofOrProofAssertions
|
|
366
366
|
];
|
|
@@ -356,32 +356,32 @@ function validateStatementAsContainedAssertion(statement, context) {
|
|
|
356
356
|
return validatesStatementAsContainedAssertion;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
function
|
|
360
|
-
let
|
|
359
|
+
function validateStatementAsSignatureAssertion(statement, context) {
|
|
360
|
+
let validatesAStatementsSignatureAssertion = false;
|
|
361
361
|
|
|
362
|
-
const {
|
|
362
|
+
const { SignatureAssertion } = elements;
|
|
363
363
|
|
|
364
|
-
let
|
|
364
|
+
let signatureAssertion;
|
|
365
365
|
|
|
366
|
-
|
|
366
|
+
signatureAssertion = SignatureAssertion.fromStatement(statement, context);
|
|
367
367
|
|
|
368
|
-
if (
|
|
368
|
+
if (signatureAssertion !== null) {
|
|
369
369
|
const statementString = statement.getString();
|
|
370
370
|
|
|
371
|
-
context.trace(`Validating the '${statementString}' statement as a
|
|
371
|
+
context.trace(`Validating the '${statementString}' statement as a signature assertion...`);
|
|
372
372
|
|
|
373
|
-
|
|
373
|
+
signatureAssertion = signatureAssertion.validate(context); ///
|
|
374
374
|
|
|
375
|
-
if (
|
|
376
|
-
|
|
375
|
+
if (signatureAssertion !== null) {
|
|
376
|
+
validatesAStatementsSignatureAssertion = true;
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
-
if (
|
|
380
|
-
context.debug(`...validated the '${statementString}' statement as a
|
|
379
|
+
if (validatesAStatementsSignatureAssertion) {
|
|
380
|
+
context.debug(`...validated the '${statementString}' statement as a signature assertion.`);
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
return
|
|
384
|
+
return validatesAStatementsSignatureAssertion;
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
export const validateTerms = [
|
|
@@ -401,5 +401,5 @@ export const validateStatements = [
|
|
|
401
401
|
validateStatementAsPropertyAssertion,
|
|
402
402
|
validateStatementAsSubproofAssertion,
|
|
403
403
|
validateStatementAsContainedAssertion,
|
|
404
|
-
|
|
404
|
+
validateStatementAsSignatureAssertion
|
|
405
405
|
];
|