occam-verify-cli 1.0.906 → 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/context.js +5 -1
- package/lib/element/assertion/contained.js +6 -3
- package/lib/element/assertion/defined.js +6 -3
- package/lib/element/assertion/property.js +6 -3
- package/lib/element/assertion/signature.js +165 -0
- package/lib/element/assertion/subproof.js +5 -3
- package/lib/element/assertion/type.js +6 -3
- package/lib/element/assumption/metaLevel.js +5 -3
- package/lib/element/assumption.js +6 -3
- package/lib/element/equality.js +6 -3
- package/lib/element/frame.js +8 -5
- package/lib/element/judgement.js +6 -3
- package/lib/element/metavariable.js +8 -5
- package/lib/element/proofAssertion/step.js +29 -29
- package/lib/element/property.js +12 -5
- package/lib/element/propertyRelation.js +6 -3
- package/lib/element/reference.js +8 -4
- package/lib/element/signature.js +73 -60
- package/lib/element/statement.js +7 -3
- package/lib/element/subproof.js +11 -11
- package/lib/element/substitution/frame.js +7 -4
- package/lib/element/substitution/reference.js +7 -4
- package/lib/element/substitution/statement.js +7 -4
- package/lib/element/substitution/term.js +6 -4
- package/lib/element/term.js +26 -7
- package/lib/element/topLevelAssertion/axiom.js +14 -16
- package/lib/element/variable.js +2 -2
- 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/process/unify.js +56 -24
- package/lib/ruleNames.js +5 -5
- package/lib/utilities/element.js +43 -54
- 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/context.js +7 -0
- package/src/element/assertion/contained.js +8 -4
- package/src/element/assertion/defined.js +8 -4
- package/src/element/assertion/property.js +8 -4
- package/src/element/assertion/{satisfies.js → signature.js} +68 -43
- package/src/element/assertion/subproof.js +6 -4
- package/src/element/assertion/type.js +8 -4
- package/src/element/assumption/metaLevel.js +6 -4
- package/src/element/assumption.js +8 -4
- package/src/element/equality.js +8 -4
- package/src/element/frame.js +10 -7
- package/src/element/judgement.js +8 -4
- package/src/element/metavariable.js +10 -7
- package/src/element/proofAssertion/step.js +28 -28
- package/src/element/property.js +14 -6
- package/src/element/propertyRelation.js +8 -4
- package/src/element/reference.js +11 -5
- package/src/element/signature.js +118 -37
- package/src/element/statement.js +9 -3
- package/src/element/subproof.js +10 -10
- package/src/element/substitution/frame.js +9 -5
- package/src/element/substitution/reference.js +9 -5
- package/src/element/substitution/statement.js +9 -5
- package/src/element/substitution/term.js +7 -5
- package/src/element/term.js +39 -9
- package/src/element/topLevelAssertion/axiom.js +23 -26
- package/src/element/variable.js +2 -2
- 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/process/unify.js +84 -35
- package/src/ruleNames.js +1 -1
- package/src/utilities/element.js +30 -47
- 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 -148
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/process/unify.js
CHANGED
|
@@ -147,38 +147,6 @@ class StatementPass extends ZipPassBase {
|
|
|
147
147
|
];
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
class IntrinsicPass extends ZipPass {
|
|
151
|
-
static maps = [
|
|
152
|
-
{
|
|
153
|
-
generalNodeQuery: termVariableNodeQuery,
|
|
154
|
-
specificNodeQuery: termNodeQuery,
|
|
155
|
-
run: (generalTermVariableNode, specificTermNode, generalContext, specificContext) => {
|
|
156
|
-
let success = false;
|
|
157
|
-
|
|
158
|
-
const termNode = specificTermNode, ///
|
|
159
|
-
variableNode = generalTermVariableNode; ///
|
|
160
|
-
|
|
161
|
-
let context;
|
|
162
|
-
|
|
163
|
-
context = generalContext; ///
|
|
164
|
-
|
|
165
|
-
const variable = context.findVariableByVariableNode(variableNode);
|
|
166
|
-
|
|
167
|
-
context = specificContext; ///
|
|
168
|
-
|
|
169
|
-
const term = context.findTermByTermNode(termNode),
|
|
170
|
-
termUnifies = variable.unifyTerm(term, generalContext, specificContext);
|
|
171
|
-
|
|
172
|
-
if (termUnifies) {
|
|
173
|
-
success = true;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return success;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
];
|
|
180
|
-
}
|
|
181
|
-
|
|
182
150
|
class CombinatorPass extends ZipPass {
|
|
183
151
|
static maps = [
|
|
184
152
|
{
|
|
@@ -402,12 +370,77 @@ class SubstitutionPass extends ZipPass {
|
|
|
402
370
|
];
|
|
403
371
|
}
|
|
404
372
|
|
|
373
|
+
class IntrinsicTermPass extends ZipPassBase {
|
|
374
|
+
static maps = [
|
|
375
|
+
{
|
|
376
|
+
generalNodeQuery: termVariableNodeQuery,
|
|
377
|
+
specificNodeQuery: termNodeQuery,
|
|
378
|
+
run: (generalTermVariableNode, specificTermNode, generalContext, specificContext) => {
|
|
379
|
+
let success = false;
|
|
380
|
+
|
|
381
|
+
const termNode = specificTermNode, ///
|
|
382
|
+
variableNode = generalTermVariableNode; ///
|
|
383
|
+
|
|
384
|
+
let context;
|
|
385
|
+
|
|
386
|
+
context = generalContext; ///
|
|
387
|
+
|
|
388
|
+
const variable = context.findVariableByVariableNode(variableNode);
|
|
389
|
+
|
|
390
|
+
context = specificContext; ///
|
|
391
|
+
|
|
392
|
+
const term = context.findTermByTermNode(termNode),
|
|
393
|
+
termUnifies = variable.unifyTerm(term, generalContext, specificContext);
|
|
394
|
+
|
|
395
|
+
if (termUnifies) {
|
|
396
|
+
success = true;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return success;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
class IntrinsicMetavariablePass extends ZipPass {
|
|
406
|
+
static maps = [
|
|
407
|
+
{
|
|
408
|
+
generalNodeQuery: termVariableNodeQuery,
|
|
409
|
+
specificNodeQuery: termNodeQuery,
|
|
410
|
+
run: (generalTermVariableNode, specificTermNode, generalContext, specificContext) => {
|
|
411
|
+
let success = false;
|
|
412
|
+
|
|
413
|
+
const termNode = specificTermNode, ///
|
|
414
|
+
variableNode = generalTermVariableNode; ///
|
|
415
|
+
|
|
416
|
+
let context;
|
|
417
|
+
|
|
418
|
+
context = generalContext; ///
|
|
419
|
+
|
|
420
|
+
const variable = context.findVariableByVariableNode(variableNode);
|
|
421
|
+
|
|
422
|
+
context = specificContext; ///
|
|
423
|
+
|
|
424
|
+
const term = context.findTermByTermNode(termNode),
|
|
425
|
+
termUnifies = variable.unifyTerm(term, generalContext, specificContext);
|
|
426
|
+
|
|
427
|
+
if (termUnifies) {
|
|
428
|
+
success = true;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
return success;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
];
|
|
435
|
+
}
|
|
436
|
+
|
|
405
437
|
const statementPass = new StatementPass(),
|
|
406
|
-
intrinsicPass = new IntrinsicPass(),
|
|
407
438
|
combinatorPass = new CombinatorPass(),
|
|
408
439
|
constructorPass = new ConstructorPass(),
|
|
409
440
|
metavariablePass = new MetavariablePass(),
|
|
410
|
-
substitutionPass = new SubstitutionPass()
|
|
441
|
+
substitutionPass = new SubstitutionPass(),
|
|
442
|
+
intrinsicTermPass = new IntrinsicTermPass(),
|
|
443
|
+
intrinsicMetavariablePass = new IntrinsicMetavariablePass();
|
|
411
444
|
|
|
412
445
|
export function unifyStatement(generalStatement, specificStatement, generalContext, specificContext) {
|
|
413
446
|
let statementUnifies = false;
|
|
@@ -485,6 +518,22 @@ export function unifyStatementWithCombinator(statement, combinator, generalConte
|
|
|
485
518
|
return statementUnifiesWithCombinator;
|
|
486
519
|
}
|
|
487
520
|
|
|
521
|
+
export function unifyTermIntrinsically(generalTerm, specificTerm, generalContext, specificContext) {
|
|
522
|
+
let termUnifiesIntrinsically = false;
|
|
523
|
+
|
|
524
|
+
const generalTermNode = generalTerm.getNode(),
|
|
525
|
+
specificTermNode = specificTerm.getNode(),
|
|
526
|
+
generalNode = generalTermNode, ///
|
|
527
|
+
specificNode = specificTermNode, ///
|
|
528
|
+
success = intrinsicTermPass.run(generalNode, specificNode, generalContext, specificContext);
|
|
529
|
+
|
|
530
|
+
if (success) {
|
|
531
|
+
termUnifiesIntrinsically = true;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return termUnifiesIntrinsically;
|
|
535
|
+
}
|
|
536
|
+
|
|
488
537
|
export function unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext) {
|
|
489
538
|
let metavariableUnifiesIntrinsically = false;
|
|
490
539
|
|
|
@@ -492,7 +541,7 @@ export function unifyMetavariableIntrinsically(generalMetavariable, specificMeta
|
|
|
492
541
|
specificMetavariableNode = specificMetavariable.getNode(),
|
|
493
542
|
generalNode = generalMetavariableNode, ///
|
|
494
543
|
specificNode = specificMetavariableNode, ///
|
|
495
|
-
success =
|
|
544
|
+
success = intrinsicMetavariablePass.run(generalNode, specificNode, generalContext, specificContext);
|
|
496
545
|
|
|
497
546
|
if (success) {
|
|
498
547
|
metavariableUnifiesIntrinsically = true;
|
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
|
}
|
|
@@ -331,11 +331,8 @@ export function signatureFromSignatureNode(signatureNode, context) {
|
|
|
331
331
|
node = signatureNode, ///
|
|
332
332
|
string = context.nodeAsString(node),
|
|
333
333
|
lineIndex = null,
|
|
334
|
-
terms = termsFromSignatureNode(signatureNode, context)
|
|
335
|
-
|
|
336
|
-
context = null;
|
|
337
|
-
|
|
338
|
-
const signature = new Signature(context, string, node, lineIndex, terms);
|
|
334
|
+
terms = termsFromSignatureNode(signatureNode, context),
|
|
335
|
+
signature = new Signature(context, string, node, lineIndex, terms);
|
|
339
336
|
|
|
340
337
|
return signature;
|
|
341
338
|
}
|
|
@@ -402,20 +399,6 @@ export function parameterFromParameterNode(parameterNode, context) {
|
|
|
402
399
|
return parameter;
|
|
403
400
|
}
|
|
404
401
|
|
|
405
|
-
export function signatureFromJSignatureNode(signatureNode, context) {
|
|
406
|
-
const { Signature } = elements,
|
|
407
|
-
node = signatureNode,
|
|
408
|
-
string = context.nodeAsString(node),
|
|
409
|
-
lineIndex = null,
|
|
410
|
-
terms = termsFromSignatureNode(signatureNode, context);
|
|
411
|
-
|
|
412
|
-
context = null;
|
|
413
|
-
|
|
414
|
-
const signature = new Signature(context, string, node, lineIndex, terms);
|
|
415
|
-
|
|
416
|
-
return signature;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
402
|
export function hypothesisFromHypothesisNode(hypotheseNode, context) {
|
|
420
403
|
const { Hypothsis } = elements,
|
|
421
404
|
node = hypotheseNode, ///
|
|
@@ -760,19 +743,19 @@ export function containedAssertionFromContainedAssertionNode(containedAssertionN
|
|
|
760
743
|
return containedAssertion;
|
|
761
744
|
}
|
|
762
745
|
|
|
763
|
-
export function
|
|
764
|
-
const {
|
|
765
|
-
node =
|
|
746
|
+
export function signatureAssertionFromSignatureAssertionNode(signatureAssertionNode, context) {
|
|
747
|
+
const { SignatureAssertion } = elements,
|
|
748
|
+
node = signatureAssertionNode, ///
|
|
766
749
|
string = context.nodeAsString(node),
|
|
767
750
|
lineIndex = null,
|
|
768
|
-
signature =
|
|
769
|
-
reference =
|
|
751
|
+
signature = signatureFromSignatureAssertionNode(signatureAssertionNode, context),
|
|
752
|
+
reference = referenceFromSignatureAssertionNode(signatureAssertionNode, context);
|
|
770
753
|
|
|
771
754
|
context = null;
|
|
772
755
|
|
|
773
|
-
const
|
|
756
|
+
const signatureAssertion = new SignatureAssertion(context, string, node, lineIndex, signature, reference);
|
|
774
757
|
|
|
775
|
-
return
|
|
758
|
+
return signatureAssertion;
|
|
776
759
|
}
|
|
777
760
|
|
|
778
761
|
export function procedureReferenceFromProcedureReferenceNode(procedureReferenceNode, context) {
|
|
@@ -1570,16 +1553,16 @@ export function termFromPropertyAssertionNode(propertyAssertionNode, context) {
|
|
|
1570
1553
|
return term;
|
|
1571
1554
|
}
|
|
1572
1555
|
|
|
1573
|
-
export function
|
|
1574
|
-
let
|
|
1556
|
+
export function signatureAssertionFromStepNode(stepNode, context) {
|
|
1557
|
+
let signatureAssertion = null;
|
|
1575
1558
|
|
|
1576
|
-
const
|
|
1559
|
+
const signatureAssertionNode = stepNode.getSatisfiedAssertionNode();
|
|
1577
1560
|
|
|
1578
|
-
if (
|
|
1579
|
-
|
|
1561
|
+
if (signatureAssertionNode !== null) {
|
|
1562
|
+
signatureAssertion = signatureAssertionFromSignatureAssertionNode(signatureAssertionNode, context);
|
|
1580
1563
|
}
|
|
1581
1564
|
|
|
1582
|
-
return
|
|
1565
|
+
return signatureAssertion;
|
|
1583
1566
|
}
|
|
1584
1567
|
|
|
1585
1568
|
export function typeAssertionFromStatementNode(statementNode, context) {
|
|
@@ -1852,16 +1835,16 @@ export function containedAssertionFromStatementNode(statementNode, context) {0
|
|
|
1852
1835
|
return containedAssertion;
|
|
1853
1836
|
}
|
|
1854
1837
|
|
|
1855
|
-
export function
|
|
1856
|
-
let
|
|
1838
|
+
export function signatureAssertionFromStatementNode(statementNode, context) {
|
|
1839
|
+
let signatureAssertion = null;
|
|
1857
1840
|
|
|
1858
|
-
const
|
|
1841
|
+
const signatureAssertionNode = statementNode.getSatisfiedAssertionNode();
|
|
1859
1842
|
|
|
1860
|
-
if (
|
|
1861
|
-
|
|
1843
|
+
if (signatureAssertionNode !== null) {
|
|
1844
|
+
signatureAssertion = signatureAssertionFromSignatureAssertionNode(signatureAssertionNode, context);
|
|
1862
1845
|
}
|
|
1863
1846
|
|
|
1864
|
-
return
|
|
1847
|
+
return signatureAssertion;
|
|
1865
1848
|
}
|
|
1866
1849
|
|
|
1867
1850
|
export function statementsFromSubproofAssertionNode(subproofAssertionNode, context) {
|
|
@@ -1878,15 +1861,15 @@ export function statementFromContainedAssertionNode(containedAssertionNode, cont
|
|
|
1878
1861
|
return statement;
|
|
1879
1862
|
}
|
|
1880
1863
|
|
|
1881
|
-
export function
|
|
1882
|
-
const signatureNode =
|
|
1864
|
+
export function signatureFromSignatureAssertionNode(signatureAssertionNode, context) {
|
|
1865
|
+
const signatureNode = signatureAssertionNode.getSignatureNode(),
|
|
1883
1866
|
signature = signatureFromSignatureNode(signatureNode, context);
|
|
1884
1867
|
|
|
1885
1868
|
return signature;
|
|
1886
1869
|
}
|
|
1887
1870
|
|
|
1888
|
-
export function
|
|
1889
|
-
const metavariableNode =
|
|
1871
|
+
export function referenceFromSignatureAssertionNode(signatureAssertionNode, context) {
|
|
1872
|
+
const metavariableNode = signatureAssertionNode.getMetavariableNode(),
|
|
1890
1873
|
reference = referenceFromMetavariableNode(metavariableNode, context);
|
|
1891
1874
|
|
|
1892
1875
|
return reference;
|
|
@@ -1919,14 +1902,14 @@ export function statementFromBracketedCombinatorNode(bracketedCombinatorNode, co
|
|
|
1919
1902
|
return statement;
|
|
1920
1903
|
}
|
|
1921
1904
|
|
|
1922
|
-
export function
|
|
1905
|
+
export function signatureFromJSignatureAssertionNode(sasisfiesAssertionNode, context) {
|
|
1923
1906
|
const signatureNode = sasisfiesAssertionNode.getSignatureNode(),
|
|
1924
|
-
signature =
|
|
1907
|
+
signature = signatureFromSignatureNode(signatureNode, context);
|
|
1925
1908
|
|
|
1926
1909
|
return signature;
|
|
1927
1910
|
}
|
|
1928
1911
|
|
|
1929
|
-
export function
|
|
1912
|
+
export function referenceFromJSignatureAssertionNode(sasisfiesAssertionNode, context) {
|
|
1930
1913
|
const { Reference } = elements,
|
|
1931
1914
|
referenceNode = sasisfiesAssertionNode.getReferenceNode(),
|
|
1932
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
|
];
|