occam-verify-cli 1.0.635 → 1.0.638
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/file/nominal.js +1 -1
- package/lib/context/liminal.js +3 -3
- package/lib/context/scoped.js +25 -3
- package/lib/context.js +8 -1
- package/lib/element/assertion/contained.js +34 -23
- package/lib/element/assertion/defined.js +30 -21
- package/lib/element/assertion/property.js +24 -21
- package/lib/element/assertion/satisfies.js +19 -14
- package/lib/element/assertion/subproof.js +18 -13
- package/lib/element/assertion/type.js +23 -20
- package/lib/element/assertion.js +5 -5
- package/lib/element/assumption.js +31 -25
- package/lib/element/combinator/bracketed.js +3 -3
- package/lib/element/combinator.js +3 -3
- package/lib/element/conclusion.js +6 -2
- package/lib/element/constructor/bracketed.js +5 -3
- package/lib/element/deduction.js +6 -2
- package/lib/element/derivation.js +4 -5
- package/lib/element/equality.js +32 -27
- package/lib/element/frame.js +26 -21
- package/lib/element/hypothesis.js +8 -10
- package/lib/element/judgement.js +54 -22
- package/lib/element/metavariable.js +18 -10
- package/lib/element/proofAssertion/premise.js +8 -8
- package/lib/element/proofAssertion/step.js +16 -11
- package/lib/element/proofAssertion/supposition.js +7 -7
- package/lib/element/proofAssertion.js +7 -5
- package/lib/element/propertyRelation.js +7 -3
- package/lib/element/reference.js +28 -21
- package/lib/element/rule.js +4 -11
- package/lib/element/signature.js +10 -4
- package/lib/element/statement.js +17 -17
- package/lib/element/subDerivation.js +4 -11
- package/lib/element/subproof.js +37 -29
- package/lib/element/substitution/frame.js +18 -10
- package/lib/element/substitution/reference.js +17 -9
- package/lib/element/substitution/statement.js +16 -10
- package/lib/element/substitution/term.js +19 -9
- package/lib/element/substitution.js +5 -5
- package/lib/element/term.js +14 -14
- package/lib/element/topLevelAssertion.js +4 -11
- package/lib/element/topLevelMetaAssertion.js +4 -11
- package/lib/element/variable.js +6 -3
- package/lib/process/assign.js +1 -9
- package/lib/process/unify.js +8 -8
- package/lib/process/validate.js +14 -7
- package/lib/process/verify.js +14 -7
- package/lib/utilities/unification.js +6 -6
- package/lib/utilities/validation.js +68 -55
- package/package.json +1 -1
- package/src/context/file/nominal.js +2 -2
- package/src/context/liminal.js +2 -2
- package/src/context/scoped.js +20 -2
- package/src/context.js +6 -0
- package/src/element/assertion/contained.js +40 -24
- package/src/element/assertion/defined.js +38 -24
- package/src/element/assertion/property.js +28 -22
- package/src/element/assertion/satisfies.js +21 -13
- package/src/element/assertion/subproof.js +21 -13
- package/src/element/assertion/type.js +28 -22
- package/src/element/assertion.js +4 -4
- package/src/element/assumption.js +31 -23
- package/src/element/combinator/bracketed.js +2 -2
- package/src/element/combinator.js +2 -2
- package/src/element/conclusion.js +7 -2
- package/src/element/constructor/bracketed.js +4 -2
- package/src/element/deduction.js +7 -2
- package/src/element/derivation.js +2 -3
- package/src/element/equality.js +45 -34
- package/src/element/frame.js +31 -21
- package/src/element/hypothesis.js +9 -6
- package/src/element/judgement.js +64 -20
- package/src/element/metavariable.js +31 -16
- package/src/element/proofAssertion/premise.js +7 -7
- package/src/element/proofAssertion/step.js +16 -10
- package/src/element/proofAssertion/supposition.js +6 -6
- package/src/element/proofAssertion.js +7 -4
- package/src/element/propertyRelation.js +8 -2
- package/src/element/reference.js +31 -21
- package/src/element/rule.js +3 -6
- package/src/element/signature.js +21 -10
- package/src/element/statement.js +14 -14
- package/src/element/subDerivation.js +2 -5
- package/src/element/subproof.js +9 -3
- package/src/element/substitution/frame.js +21 -9
- package/src/element/substitution/reference.js +20 -8
- package/src/element/substitution/statement.js +17 -9
- package/src/element/substitution/term.js +24 -8
- package/src/element/substitution.js +4 -4
- package/src/element/term.js +13 -13
- package/src/element/topLevelAssertion.js +3 -6
- package/src/element/topLevelMetaAssertion.js +3 -6
- package/src/element/variable.js +8 -4
- package/src/process/assign.js +0 -6
- package/src/process/unify.js +7 -7
- package/src/process/validate.js +23 -14
- package/src/process/verify.js +26 -17
- package/src/utilities/unification.js +4 -5
- package/src/utilities/validation.js +83 -75
package/src/context.js
CHANGED
|
@@ -358,6 +358,12 @@ export default class Context extends ContextBase {
|
|
|
358
358
|
context.addJudgement(judgement);
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
addAssignment(assignment) {
|
|
362
|
+
const context = this.getContext();
|
|
363
|
+
|
|
364
|
+
context.addAssignment(assignment);
|
|
365
|
+
}
|
|
366
|
+
|
|
361
367
|
addSubstitution(substitution) {
|
|
362
368
|
const context = this.getContext();
|
|
363
369
|
|
|
@@ -38,30 +38,32 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
38
38
|
return containedAssertionNode;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
validate(
|
|
42
|
-
let
|
|
41
|
+
validate(stated, context) {
|
|
42
|
+
let containedAssertion = null;
|
|
43
43
|
|
|
44
44
|
const containedAssertionString = this.getString(); ///
|
|
45
45
|
|
|
46
46
|
context.trace(`Validating the '${containedAssertionString}' contained assertion...`);
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const validAssertion = this.findValidAssertion(context);
|
|
49
49
|
|
|
50
|
-
if (
|
|
51
|
-
|
|
50
|
+
if (validAssertion !== null) {
|
|
51
|
+
containedAssertion = validAssertion; ///
|
|
52
52
|
|
|
53
53
|
context.debug(`...the '${containedAssertionString}' contained assertion is already valid.`);
|
|
54
54
|
} else {
|
|
55
|
-
|
|
56
|
-
frameVerifies = this.validateFrame(assignments, stated, context),
|
|
57
|
-
statementValidates = this.validateStatement(assignments, stated, context)
|
|
55
|
+
let validates = false;
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
const termValidates = this.validateTerm(stated, context),
|
|
58
|
+
frameValidates = this.validateFrame(stated, context),
|
|
59
|
+
statementValidates = this.validateStatement(stated, context)
|
|
60
|
+
|
|
61
|
+
if (termValidates || frameValidates || statementValidates) {
|
|
60
62
|
let validatesWhenStated = false,
|
|
61
63
|
validatesWhenDerived = false;
|
|
62
64
|
|
|
63
65
|
if (stated) {
|
|
64
|
-
validatesWhenStated = this.validateWhenStated(
|
|
66
|
+
validatesWhenStated = this.validateWhenStated(context);
|
|
65
67
|
} else {
|
|
66
68
|
validatesWhenDerived = this.validateWhenDerived(context);
|
|
67
69
|
}
|
|
@@ -74,16 +76,18 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
74
76
|
if (validates) {
|
|
75
77
|
const assertion = this; ///
|
|
76
78
|
|
|
79
|
+
containedAssertion = assertion; ///
|
|
80
|
+
|
|
77
81
|
context.addAssertion(assertion);
|
|
78
82
|
|
|
79
83
|
context.debug(`...validated the '${containedAssertionString}' contained assertion.`);
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
return
|
|
87
|
+
return containedAssertion;
|
|
84
88
|
}
|
|
85
89
|
|
|
86
|
-
validateTerm(
|
|
90
|
+
validateTerm(stated, context) {
|
|
87
91
|
let termValidates = false;
|
|
88
92
|
|
|
89
93
|
if (this.term !== null) {
|
|
@@ -97,12 +101,18 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
97
101
|
if (!termSingular) {
|
|
98
102
|
context.debug(`The '${termString}' term is not singular.`);
|
|
99
103
|
} else {
|
|
100
|
-
|
|
104
|
+
const term = this.term.validate(context, () => {
|
|
101
105
|
const validatesForwards = true;
|
|
102
106
|
|
|
103
107
|
return validatesForwards;
|
|
104
108
|
});
|
|
105
109
|
|
|
110
|
+
if (term !== null) {
|
|
111
|
+
this.term = term;
|
|
112
|
+
|
|
113
|
+
termValidates = true;
|
|
114
|
+
}
|
|
115
|
+
|
|
106
116
|
if (termValidates) {
|
|
107
117
|
context.debug(`...validated the '${containedAssertionString}' contained assertino's '${termString}' term.`);
|
|
108
118
|
}
|
|
@@ -112,8 +122,8 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
112
122
|
return termValidates;
|
|
113
123
|
}
|
|
114
124
|
|
|
115
|
-
validateFrame(
|
|
116
|
-
let
|
|
125
|
+
validateFrame(stated, context) {
|
|
126
|
+
let frameValidates = false;
|
|
117
127
|
|
|
118
128
|
if (this.frame !== null) {
|
|
119
129
|
const frameString = this.frame.getString(),
|
|
@@ -128,20 +138,24 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
128
138
|
} else {
|
|
129
139
|
stated = true; ///
|
|
130
140
|
|
|
131
|
-
|
|
141
|
+
const frame = this.frame.validate(stated, context);
|
|
132
142
|
|
|
133
|
-
|
|
143
|
+
if (frame !== null) {
|
|
144
|
+
this.frame = frame;
|
|
134
145
|
|
|
135
|
-
|
|
136
|
-
context.debug(`...validated the '${containedAssertionString}' contained assertino's '${frameString}' frame.`);
|
|
146
|
+
frameValidates = true;
|
|
137
147
|
}
|
|
138
148
|
}
|
|
149
|
+
|
|
150
|
+
if (frameValidates) {
|
|
151
|
+
context.debug(`...validated the '${containedAssertionString}' contained assertino's '${frameString}' frame.`);
|
|
152
|
+
}
|
|
139
153
|
}
|
|
140
154
|
|
|
141
|
-
return
|
|
155
|
+
return frameValidates;
|
|
142
156
|
}
|
|
143
157
|
|
|
144
|
-
validateStatement(
|
|
158
|
+
validateStatement(stated, context) {
|
|
145
159
|
let statementValidates = false;
|
|
146
160
|
|
|
147
161
|
if (this.statement !== null) {
|
|
@@ -151,9 +165,11 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
151
165
|
|
|
152
166
|
stated = true; ///
|
|
153
167
|
|
|
154
|
-
|
|
168
|
+
const statement = this.statement.validate(stated, context);
|
|
155
169
|
|
|
156
|
-
|
|
170
|
+
if (statement !== null) {
|
|
171
|
+
statementValidates = true;
|
|
172
|
+
}
|
|
157
173
|
|
|
158
174
|
if (statementValidates) {
|
|
159
175
|
context.debug(`...validated the '${statementString}' statement.`);
|
|
@@ -163,7 +179,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
163
179
|
return statementValidates;
|
|
164
180
|
}
|
|
165
181
|
|
|
166
|
-
validateWhenStated(
|
|
182
|
+
validateWhenStated(context) {
|
|
167
183
|
let validatesWhenStated;
|
|
168
184
|
|
|
169
185
|
const containedAssertionString = this.getString(); ///
|
|
@@ -33,29 +33,31 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
33
33
|
return definedAssertionNode;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
validate(
|
|
37
|
-
let
|
|
36
|
+
validate(stated, context) {
|
|
37
|
+
let definedAssertion = null;
|
|
38
38
|
|
|
39
39
|
const definedAssertionString = this.getString(); ///
|
|
40
40
|
|
|
41
41
|
context.trace(`Validating the '${definedAssertionString}' defined assertion...`);
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const validAssertion = this.findValidAssertion(context);
|
|
44
44
|
|
|
45
|
-
if (
|
|
46
|
-
|
|
45
|
+
if (validAssertion !== null) {
|
|
46
|
+
definedAssertion = validAssertion; ///
|
|
47
47
|
|
|
48
|
-
context.debug(`...the '${definedAssertionString}' defined
|
|
48
|
+
context.debug(`...the '${definedAssertionString}' defined definedAssertion is already valid.`);
|
|
49
49
|
} else {
|
|
50
|
-
|
|
51
|
-
frameVerifies = this.validateFrame(assignments, stated, context);
|
|
50
|
+
let validates = false;
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
const termValidates = this.validateTerm(stated, context),
|
|
53
|
+
frameValidates = this.validateFrame(stated, context);
|
|
54
|
+
|
|
55
|
+
if (termValidates || frameValidates) {
|
|
54
56
|
let verifiesWhenStated = false,
|
|
55
57
|
verifiesWhenDerived = false;
|
|
56
58
|
|
|
57
59
|
if (stated) {
|
|
58
|
-
verifiesWhenStated = this.validateWhenStated(
|
|
60
|
+
verifiesWhenStated = this.validateWhenStated(context);
|
|
59
61
|
} else {
|
|
60
62
|
verifiesWhenDerived = this.validateWhenDerived(context);
|
|
61
63
|
}
|
|
@@ -68,16 +70,18 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
68
70
|
if (validates) {
|
|
69
71
|
const assertion = this; ///
|
|
70
72
|
|
|
73
|
+
definedAssertion = assertion; ///
|
|
74
|
+
|
|
71
75
|
context.addAssertion(assertion);
|
|
72
76
|
|
|
73
|
-
context.debug(`...
|
|
77
|
+
context.debug(`...validated the '${definedAssertionString}' defined assertion.`);
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
|
|
77
|
-
return
|
|
81
|
+
return definedAssertion;
|
|
78
82
|
}
|
|
79
83
|
|
|
80
|
-
validateTerm(
|
|
84
|
+
validateTerm(stated, context) {
|
|
81
85
|
let termValidates = false;
|
|
82
86
|
|
|
83
87
|
if (this.term !== null) {
|
|
@@ -91,11 +95,17 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
91
95
|
if (!termSingular) {
|
|
92
96
|
context.debug(`The '${termString}' term is not singular.`);
|
|
93
97
|
} else {
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
const term = this.term.validate(context, () => {
|
|
99
|
+
const validatesForwards = true;
|
|
96
100
|
|
|
97
|
-
|
|
98
|
-
|
|
101
|
+
return validatesForwards;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
if (term !== null) {
|
|
105
|
+
this.term = term; ///
|
|
106
|
+
|
|
107
|
+
termValidates = true;
|
|
108
|
+
}
|
|
99
109
|
|
|
100
110
|
if (termValidates) {
|
|
101
111
|
context.debug(`...validates the'${definedAssertionString}' defined assertino's '${termString}' term.`);
|
|
@@ -106,8 +116,8 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
106
116
|
return termValidates;
|
|
107
117
|
}
|
|
108
118
|
|
|
109
|
-
validateFrame(
|
|
110
|
-
let
|
|
119
|
+
validateFrame(stated, context) {
|
|
120
|
+
let frameValidates = false;
|
|
111
121
|
|
|
112
122
|
if (this.frame !== null) {
|
|
113
123
|
const frameString = this.frame.getString(), ///
|
|
@@ -122,20 +132,24 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
122
132
|
} else {
|
|
123
133
|
stated = true; ///
|
|
124
134
|
|
|
125
|
-
|
|
135
|
+
const frame = this.frame.validate(stated, context);
|
|
136
|
+
|
|
137
|
+
if (frame !== null) {
|
|
138
|
+
this.frame = frame;
|
|
126
139
|
|
|
127
|
-
|
|
140
|
+
frameValidates = true;
|
|
141
|
+
}
|
|
128
142
|
|
|
129
|
-
if (
|
|
143
|
+
if (frameValidates) {
|
|
130
144
|
context.debug(`...validates the'${definedAssertionString}' defined assertino's '${frameString}' frame.`);
|
|
131
145
|
}
|
|
132
146
|
}
|
|
133
147
|
}
|
|
134
148
|
|
|
135
|
-
return
|
|
149
|
+
return frameValidates;
|
|
136
150
|
}
|
|
137
151
|
|
|
138
|
-
validateWhenStated(
|
|
152
|
+
validateWhenStated(context) {
|
|
139
153
|
let verifiesWhenStated;
|
|
140
154
|
|
|
141
155
|
const definedAssertionString = this.getString(); ///
|
|
@@ -54,31 +54,33 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
54
54
|
return comparesToTermAndPropertyRelation;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
validate(
|
|
58
|
-
let
|
|
57
|
+
validate(stated, context) {
|
|
58
|
+
let propertyAssertion = null;
|
|
59
59
|
|
|
60
60
|
const propertyAssertionString = this.getString(); ///
|
|
61
61
|
|
|
62
62
|
context.trace(`Validating the '${propertyAssertionString}' property assertion...`);
|
|
63
63
|
|
|
64
|
-
const
|
|
64
|
+
const validAssertion = this.findValidAssertion(context);
|
|
65
65
|
|
|
66
|
-
if (
|
|
67
|
-
|
|
66
|
+
if (validAssertion) {
|
|
67
|
+
propertyAssertion = validAssertion; ///
|
|
68
68
|
|
|
69
69
|
context.debug(`...the '${propertyAssertionString}' property assertion is already valid.`);
|
|
70
70
|
} else {
|
|
71
|
-
|
|
71
|
+
let validates = false;
|
|
72
|
+
|
|
73
|
+
const termValidates = this.validateTerm(stated, context);
|
|
72
74
|
|
|
73
75
|
if (termValidates) {
|
|
74
|
-
const propertyRelationVerifies = this.validatePropertyRelation(
|
|
76
|
+
const propertyRelationVerifies = this.validatePropertyRelation(stated, context);
|
|
75
77
|
|
|
76
78
|
if (propertyRelationVerifies) {
|
|
77
79
|
let validatesWhenStated = false,
|
|
78
80
|
validatesWhenDerived = false;
|
|
79
81
|
|
|
80
82
|
if (stated) {
|
|
81
|
-
validatesWhenStated = this.validateWhenStated(
|
|
83
|
+
validatesWhenStated = this.validateWhenStated(context);
|
|
82
84
|
} else {
|
|
83
85
|
validatesWhenDerived = this.validateWhenDerived(context);
|
|
84
86
|
}
|
|
@@ -92,30 +94,38 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
92
94
|
if (validates) {
|
|
93
95
|
const assertion = this; ///
|
|
94
96
|
|
|
95
|
-
|
|
97
|
+
propertyAssertion = assertion; ///
|
|
96
98
|
|
|
97
|
-
this.assign(
|
|
99
|
+
this.assign(stated, context);
|
|
100
|
+
|
|
101
|
+
context.addAssertion(assertion);
|
|
98
102
|
|
|
99
103
|
context.debug(`...validated the '${propertyAssertionString}' property assertion.`);
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
|
|
103
|
-
return
|
|
107
|
+
return propertyAssertion;
|
|
104
108
|
}
|
|
105
109
|
|
|
106
|
-
validateTerm(
|
|
107
|
-
let termValidates;
|
|
110
|
+
validateTerm(stated, context) {
|
|
111
|
+
let termValidates = false;
|
|
108
112
|
|
|
109
113
|
const termString = this.term.getString();
|
|
110
114
|
|
|
111
115
|
context.trace(`Validating the '${termString}' term...`);
|
|
112
116
|
|
|
113
|
-
|
|
117
|
+
const term = this.term.validate(context, () => {
|
|
114
118
|
const validatesForwards = true;
|
|
115
119
|
|
|
116
120
|
return validatesForwards;
|
|
117
121
|
});
|
|
118
122
|
|
|
123
|
+
if ((term !== null)) {
|
|
124
|
+
this.term = term;
|
|
125
|
+
|
|
126
|
+
termValidates = true;
|
|
127
|
+
}
|
|
128
|
+
|
|
119
129
|
if (termValidates) {
|
|
120
130
|
context.debug(`...validated the '${termString}' term.`);
|
|
121
131
|
}
|
|
@@ -123,7 +133,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
123
133
|
return termValidates;
|
|
124
134
|
}
|
|
125
135
|
|
|
126
|
-
validatePropertyRelation(
|
|
136
|
+
validatePropertyRelation(stated, context) {
|
|
127
137
|
let propertyRelationVerifies;
|
|
128
138
|
|
|
129
139
|
const propertyRelationString = this.propertyRelation.getString();
|
|
@@ -139,7 +149,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
139
149
|
return propertyRelationVerifies;
|
|
140
150
|
}
|
|
141
151
|
|
|
142
|
-
validateWhenStated(
|
|
152
|
+
validateWhenStated(context) {
|
|
143
153
|
let validatesWhenStated;
|
|
144
154
|
|
|
145
155
|
const propertyAssertionString = this.getString(); ///
|
|
@@ -171,11 +181,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
171
181
|
return validatesWhenDerived;
|
|
172
182
|
}
|
|
173
183
|
|
|
174
|
-
assign(
|
|
175
|
-
if (assignments === null) {
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
|
|
184
|
+
assign(stated, context) {
|
|
179
185
|
if (!stated) {
|
|
180
186
|
return;
|
|
181
187
|
}
|
|
@@ -184,7 +190,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
184
190
|
variableAssigment = variableAssignmentFromPrepertyAssertion(propertyAssertion, context),
|
|
185
191
|
assignment = variableAssigment; ///
|
|
186
192
|
|
|
187
|
-
|
|
193
|
+
context.addAssignment(assignment);
|
|
188
194
|
}
|
|
189
195
|
|
|
190
196
|
static name = "PropertyAssertion";
|
|
@@ -31,47 +31,55 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
31
31
|
|
|
32
32
|
correlateSubstitutions(substitutions, context) { return this.signature.correlateSubstitutions(substitutions, context); }
|
|
33
33
|
|
|
34
|
-
validate(
|
|
35
|
-
let
|
|
34
|
+
validate(stated, context) {
|
|
35
|
+
let satisfiesAssertion = null;
|
|
36
36
|
|
|
37
37
|
const satisfiesAssertionString = this.getString(); ///
|
|
38
38
|
|
|
39
39
|
context.trace(`Validating the '${satisfiesAssertionString}' satisfies assertion...`);
|
|
40
40
|
|
|
41
|
-
const
|
|
41
|
+
const validAssertion = this.findValidAssertion(context);
|
|
42
42
|
|
|
43
|
-
if (
|
|
44
|
-
|
|
43
|
+
if (validAssertion) {
|
|
44
|
+
satisfiesAssertion = validAssertion; ///
|
|
45
45
|
|
|
46
|
-
context.debug(`...the '${satisfiesAssertionString}' satisfies
|
|
46
|
+
context.debug(`...the '${satisfiesAssertionString}' satisfies satisfiesAssertion is already valid.`);
|
|
47
47
|
} else {
|
|
48
|
-
|
|
48
|
+
let validates = true;
|
|
49
|
+
|
|
50
|
+
const signatureVerifies = this.validateSignature(stated, context);
|
|
49
51
|
|
|
50
52
|
if (signatureVerifies) {
|
|
51
|
-
const referenceVerifies = this.validateReference(
|
|
53
|
+
const referenceVerifies = this.validateReference(stated, context);
|
|
54
|
+
|
|
55
|
+
if (referenceVerifies) {
|
|
56
|
+
validates = true;
|
|
57
|
+
}
|
|
52
58
|
|
|
53
|
-
validates =
|
|
59
|
+
validates = true;
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
if (validates) {
|
|
57
63
|
const assertion = this; ///
|
|
58
64
|
|
|
59
|
-
|
|
65
|
+
satisfiesAssertion = assertion; ///
|
|
66
|
+
|
|
67
|
+
context.addAssertion(satisfiesAssertion);
|
|
60
68
|
|
|
61
69
|
context.debug(`...validated the '${satisfiesAssertionString}' satisfies assertion.`);
|
|
62
70
|
}
|
|
63
71
|
}
|
|
64
72
|
|
|
65
|
-
return
|
|
73
|
+
return satisfiesAssertion;
|
|
66
74
|
}
|
|
67
75
|
|
|
68
|
-
validateSignature(
|
|
76
|
+
validateSignature(stated, context) {
|
|
69
77
|
const signatureVerifies = this.signature.validate(context);
|
|
70
78
|
|
|
71
79
|
return signatureVerifies;
|
|
72
80
|
}
|
|
73
81
|
|
|
74
|
-
validateReference(
|
|
82
|
+
validateReference(stated, context) {
|
|
75
83
|
let referenceVerifies = false;
|
|
76
84
|
|
|
77
85
|
const referenceString = this.reference.getString(),
|
|
@@ -27,21 +27,23 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
27
27
|
return subproofAssertionNode;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
validate(
|
|
31
|
-
let
|
|
30
|
+
validate(stated, context) {
|
|
31
|
+
let subproofAssertion = null;
|
|
32
32
|
|
|
33
33
|
const subproofAssertionString = this.getString(); ///
|
|
34
34
|
|
|
35
35
|
context.trace(`Validating the '${subproofAssertionString}' subproof assertion...`);
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const validAssertion = this.findValidAssertion(context);
|
|
38
38
|
|
|
39
|
-
if (
|
|
40
|
-
|
|
39
|
+
if (validAssertion) {
|
|
40
|
+
subproofAssertion = validAssertion; ///
|
|
41
41
|
|
|
42
42
|
context.debug(`...the '${subproofAssertionString}' subproof assertion is already valid.`);
|
|
43
43
|
} else {
|
|
44
|
-
|
|
44
|
+
let validates = false;
|
|
45
|
+
|
|
46
|
+
const statementsValidate = this.validateStatements(stated, context);
|
|
45
47
|
|
|
46
48
|
if (statementsValidate) {
|
|
47
49
|
validates = true;
|
|
@@ -50,22 +52,28 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
50
52
|
if (validates) {
|
|
51
53
|
const assertion = this; ///
|
|
52
54
|
|
|
55
|
+
subproofAssertion = assertion; ///
|
|
56
|
+
|
|
53
57
|
context.addAssertion(assertion);
|
|
54
58
|
|
|
55
59
|
context.debug(`...validated the '${subproofAssertionString}' subproof assertion.`);
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
|
|
59
|
-
return
|
|
63
|
+
return subproofAssertion;
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
validateStatements(
|
|
66
|
+
validateStatements(stated, context) {
|
|
63
67
|
stated = true; ///
|
|
64
68
|
|
|
65
|
-
assignments = null; ///
|
|
66
|
-
|
|
67
69
|
const statementsValidate = this.statements.map((statement) => {
|
|
68
|
-
|
|
70
|
+
let statementValidates = false;
|
|
71
|
+
|
|
72
|
+
statement = statement.validate(stated, context); ///
|
|
73
|
+
|
|
74
|
+
if (statement !== null) {
|
|
75
|
+
statementValidates = true;
|
|
76
|
+
}
|
|
69
77
|
|
|
70
78
|
if (statementValidates) {
|
|
71
79
|
return true;
|
|
@@ -75,7 +83,7 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
75
83
|
return statementsValidate;
|
|
76
84
|
}
|
|
77
85
|
|
|
78
|
-
unifySubproof(subproof,
|
|
86
|
+
unifySubproof(subproof, generalContext, specificContext) {
|
|
79
87
|
let subproofUnifies;
|
|
80
88
|
|
|
81
89
|
const subproofString = subproof.getString(),
|
|
@@ -89,7 +97,7 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
89
97
|
subproofUnifies = match(subproofAssertionStatements, subproofStatements, (subproofAssertionStatement, subproofStatement) => {
|
|
90
98
|
const generalStatement = subproofAssertionStatement, ///
|
|
91
99
|
specificStatement = subproofStatement, ///
|
|
92
|
-
statementUnifies = unifyStatement(generalStatement, specificStatement,
|
|
100
|
+
statementUnifies = unifyStatement(generalStatement, specificStatement, generalContext, specificContext);
|
|
93
101
|
|
|
94
102
|
if (statementUnifies) {
|
|
95
103
|
return true;
|