occam-verify-cli 1.0.768 → 1.0.781
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 +11 -11
- package/lib/context/illative.js +28 -0
- package/lib/context/nested.js +31 -0
- package/lib/context/proof.js +242 -0
- package/lib/context/thetic.js +28 -0
- package/lib/context.js +19 -21
- package/lib/element/assertion/contained.js +32 -24
- package/lib/element/assertion/defined.js +47 -40
- package/lib/element/assertion/property.js +18 -13
- package/lib/element/assertion/satisfies.js +12 -9
- package/lib/element/assertion/subproof.js +28 -26
- package/lib/element/assertion/type.js +14 -12
- package/lib/element/assumption.js +40 -50
- package/lib/element/combinator/bracketed.js +3 -3
- package/lib/element/combinator.js +20 -20
- package/lib/element/conclusion.js +33 -29
- package/lib/element/constructor.js +19 -18
- package/lib/element/deduction.js +33 -29
- package/lib/element/equality.js +13 -15
- package/lib/element/equivalence.js +59 -52
- package/lib/element/equivalences.js +4 -2
- package/lib/element/frame.js +74 -53
- package/lib/element/hypothesis.js +7 -5
- package/lib/element/judgement.js +41 -74
- package/lib/element/label.js +22 -22
- package/lib/element/metavariable.js +31 -11
- package/lib/element/proofAssertion/premise.js +48 -35
- package/lib/element/proofAssertion/step.js +77 -22
- package/lib/element/proofAssertion/supposition.js +48 -34
- package/lib/element/proofAssertion.js +1 -14
- package/lib/element/reference.js +80 -53
- package/lib/element/signature.js +44 -3
- package/lib/element/statement.js +28 -29
- package/lib/element/subproof.js +2 -2
- package/lib/element/substitution/frame.js +24 -19
- package/lib/element/substitution/metaLevel.js +31 -27
- package/lib/element/substitution/reference.js +11 -10
- package/lib/element/substitution/statement.js +30 -23
- package/lib/element/substitution/term.js +11 -10
- package/lib/element/term.js +24 -20
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/element/variable.js +6 -2
- package/lib/process/assign.js +10 -4
- package/lib/process/unify.js +8 -8
- package/lib/process/validate.js +10 -8
- package/lib/utilities/context.js +68 -23
- package/lib/utilities/element.js +55 -27
- package/lib/utilities/json.js +8 -8
- package/lib/utilities/string.js +12 -1
- package/lib/utilities/unification.js +14 -12
- package/lib/utilities/validation.js +55 -40
- package/package.json +4 -4
- package/src/context/file/nominal.js +14 -16
- package/src/context/illative.js +17 -0
- package/src/context/nested.js +21 -0
- package/src/context/{scoped.js → proof.js} +65 -51
- package/src/context/thetic.js +17 -0
- package/src/context.js +30 -36
- package/src/element/assertion/contained.js +44 -31
- package/src/element/assertion/defined.js +55 -46
- package/src/element/assertion/property.js +23 -15
- package/src/element/assertion/satisfies.js +15 -10
- package/src/element/assertion/subproof.js +34 -31
- package/src/element/assertion/type.js +18 -13
- package/src/element/assumption.js +40 -69
- package/src/element/combinator/bracketed.js +2 -2
- package/src/element/combinator.js +23 -29
- package/src/element/conclusion.js +37 -40
- package/src/element/constructor.js +29 -34
- package/src/element/deduction.js +36 -39
- package/src/element/equality.js +16 -18
- package/src/element/equivalence.js +76 -67
- package/src/element/equivalences.js +5 -2
- package/src/element/frame.js +96 -65
- package/src/element/hypothesis.js +7 -6
- package/src/element/judgement.js +45 -45
- package/src/element/label.js +25 -31
- package/src/element/metavariable.js +48 -21
- package/src/element/proofAssertion/premise.js +63 -49
- package/src/element/proofAssertion/step.js +47 -26
- package/src/element/proofAssertion/supposition.js +64 -50
- package/src/element/proofAssertion.js +0 -22
- package/src/element/reference.js +119 -80
- package/src/element/signature.js +5 -2
- package/src/element/statement.js +30 -35
- package/src/element/subproof.js +1 -1
- package/src/element/substitution/frame.js +27 -26
- package/src/element/substitution/metaLevel.js +38 -42
- package/src/element/substitution/reference.js +13 -14
- package/src/element/substitution/statement.js +35 -33
- package/src/element/substitution/term.js +13 -14
- package/src/element/term.js +42 -34
- package/src/element/topLevelMetaAssertion.js +1 -1
- package/src/element/variable.js +8 -1
- package/src/process/assign.js +9 -3
- package/src/process/unify.js +7 -7
- package/src/process/validate.js +9 -8
- package/src/utilities/context.js +82 -31
- package/src/utilities/element.js +68 -31
- package/src/utilities/json.js +13 -13
- package/src/utilities/string.js +16 -2
- package/src/utilities/unification.js +18 -16
- package/src/utilities/validation.js +73 -53
- package/lib/context/scoped.js +0 -232
- package/lib/utilities/statement.js +0 -78
- package/lib/utilities/term.js +0 -17
- package/src/utilities/statement.js +0 -74
- package/src/utilities/term.js +0 -10
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import { instantiate } from "../../utilities/context";
|
|
6
|
+
import { descend, instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateDefinedAssertion } from "../../process/instantiate";
|
|
8
8
|
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions } from "../../utilities/substitutions";
|
|
9
|
-
import { termFromJDefinedAssertionNode, frameFromJDefinedAssertionNode, negatedFromJDefinedAssertionNode } from "../../utilities/element";
|
|
9
|
+
import { termFromJDefinedAssertionNode, frameFromJDefinedAssertionNode, negatedFromJDefinedAssertionNode, definedAssertionFromStatementNode } from "../../utilities/element";
|
|
10
10
|
|
|
11
11
|
export default define(class DefinedAssertion extends Assertion {
|
|
12
12
|
constructor(context, string, node, term, frame, negated) {
|
|
@@ -36,7 +36,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
36
36
|
return definedAssertionNode;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
validate(
|
|
39
|
+
validate(context) {
|
|
40
40
|
let definedAssertion = null;
|
|
41
41
|
|
|
42
42
|
const definedAssertionString = this.getString(); ///
|
|
@@ -52,20 +52,22 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
52
52
|
} else {
|
|
53
53
|
let validates = false;
|
|
54
54
|
|
|
55
|
-
const termValidates = this.validateTerm(
|
|
56
|
-
frameValidates = this.validateFrame(
|
|
55
|
+
const termValidates = this.validateTerm(context),
|
|
56
|
+
frameValidates = this.validateFrame(context);
|
|
57
57
|
|
|
58
58
|
if (termValidates || frameValidates) {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const stated = context.isStated();
|
|
60
|
+
|
|
61
|
+
let validatesWhenStated = false,
|
|
62
|
+
validatesWhenDerived = false;
|
|
61
63
|
|
|
62
64
|
if (stated) {
|
|
63
|
-
|
|
65
|
+
validatesWhenStated = this.validateWhenStated(context);
|
|
64
66
|
} else {
|
|
65
|
-
|
|
67
|
+
validatesWhenDerived = this.validateWhenDerived(context);
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
if (
|
|
70
|
+
if (validatesWhenStated || validatesWhenDerived) {
|
|
69
71
|
validates = true;
|
|
70
72
|
}
|
|
71
73
|
}
|
|
@@ -84,7 +86,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
84
86
|
return definedAssertion;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
validateTerm(
|
|
89
|
+
validateTerm(context) {
|
|
88
90
|
let termValidates = false;
|
|
89
91
|
|
|
90
92
|
if (this.term !== null) {
|
|
@@ -119,7 +121,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
119
121
|
return termValidates;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
validateFrame(
|
|
124
|
+
validateFrame(context) {
|
|
123
125
|
let frameValidates = false;
|
|
124
126
|
|
|
125
127
|
if (this.frame !== null) {
|
|
@@ -130,22 +132,22 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
130
132
|
|
|
131
133
|
const frameSingular = this.frame.isSingular();
|
|
132
134
|
|
|
133
|
-
if (
|
|
134
|
-
context
|
|
135
|
-
|
|
136
|
-
stated = true; ///
|
|
137
|
-
|
|
138
|
-
const frame = this.frame.validate(stated, context);
|
|
135
|
+
if (frameSingular) {
|
|
136
|
+
descend((context) => {
|
|
137
|
+
const frame = this.frame.validate(context);
|
|
139
138
|
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
if (frame !== null) {
|
|
140
|
+
this.frame = frame;
|
|
142
141
|
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
frameValidates = true;
|
|
143
|
+
}
|
|
144
|
+
}, context);
|
|
145
|
+
} else {
|
|
146
|
+
context.debug(`The '${frameString}' frame is not singular.`);
|
|
147
|
+
}
|
|
145
148
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
+
if (frameValidates) {
|
|
150
|
+
context.debug(`...validates the'${definedAssertionString}' defined assertion's '${frameString}' frame.`);
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
|
|
@@ -153,23 +155,23 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
validateWhenStated(context) {
|
|
156
|
-
let
|
|
158
|
+
let validatesWhenStated;
|
|
157
159
|
|
|
158
160
|
const definedAssertionString = this.getString(); ///
|
|
159
161
|
|
|
160
162
|
context.trace(`Validating the '${definedAssertionString}' stated defined assertion...`);
|
|
161
163
|
|
|
162
|
-
|
|
164
|
+
validatesWhenStated = true;
|
|
163
165
|
|
|
164
|
-
if (
|
|
166
|
+
if (validatesWhenStated) {
|
|
165
167
|
context.debug(`...validates the '${definedAssertionString}' stated defined assertion.`);
|
|
166
168
|
}
|
|
167
169
|
|
|
168
|
-
return
|
|
170
|
+
return validatesWhenStated;
|
|
169
171
|
}
|
|
170
172
|
|
|
171
173
|
validateWhenDerived(context) {
|
|
172
|
-
let
|
|
174
|
+
let validatesWhenDerived;
|
|
173
175
|
|
|
174
176
|
const definedAssertionString = this.getString(); ///
|
|
175
177
|
|
|
@@ -178,17 +180,17 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
178
180
|
const generalContext = null,
|
|
179
181
|
specificContext = context; ///
|
|
180
182
|
|
|
181
|
-
|
|
183
|
+
validatesWhenDerived = validateWhenDerived(this.term, this.frame, this.negated, generalContext, specificContext);
|
|
182
184
|
|
|
183
|
-
if (
|
|
185
|
+
if (validatesWhenDerived) {
|
|
184
186
|
context.debug(`...validates the '${definedAssertionString}' derived defined assertion.`);
|
|
185
187
|
}
|
|
186
188
|
|
|
187
|
-
return
|
|
189
|
+
return validatesWhenDerived;
|
|
188
190
|
}
|
|
189
191
|
|
|
190
192
|
unifyIndependently(generalContext, specificContext) {
|
|
191
|
-
let unifiesIndependently;
|
|
193
|
+
let unifiesIndependently = false;
|
|
192
194
|
|
|
193
195
|
const context = specificContext, ///
|
|
194
196
|
definedAssertionString = this.getString(); ///
|
|
@@ -197,9 +199,11 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
197
199
|
|
|
198
200
|
const term = termFromTermAndSubstitutions(this.term, generalContext, specificContext),
|
|
199
201
|
frame = frameFromFrameAndSubstitutions(this.frame, generalContext, specificContext),
|
|
200
|
-
|
|
202
|
+
validatesWhenDerived = validateWhenDerived(term, frame, this.negated, generalContext, specificContext);
|
|
201
203
|
|
|
202
|
-
|
|
204
|
+
if (validatesWhenDerived) {
|
|
205
|
+
unifiesIndependently = true;
|
|
206
|
+
}
|
|
203
207
|
|
|
204
208
|
if (unifiesIndependently) {
|
|
205
209
|
context.debug(`...unified the '${definedAssertionString}' defined assertion independently.`);
|
|
@@ -216,7 +220,7 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
216
220
|
const { name } = json;
|
|
217
221
|
|
|
218
222
|
if (this.name === name) {
|
|
219
|
-
|
|
223
|
+
instantiate((context) => {
|
|
220
224
|
const { string } = json,
|
|
221
225
|
definedAssertionNode = instantiateDefinedAssertion(string, context),
|
|
222
226
|
node = definedAssertionNode, ///
|
|
@@ -226,18 +230,23 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
226
230
|
|
|
227
231
|
context = null;
|
|
228
232
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return definedAssertion;
|
|
233
|
+
definedAssertion = new DefinedAssertion(context, string, node, term, frame, negated);
|
|
232
234
|
}, context);
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
return definedAssertion;
|
|
236
238
|
}
|
|
239
|
+
|
|
240
|
+
static fromStatement(statement, context) {
|
|
241
|
+
const statementNode = statement.getNode(),
|
|
242
|
+
definedAssertion = definedAssertionFromStatementNode(statementNode, context);
|
|
243
|
+
|
|
244
|
+
return definedAssertion;
|
|
245
|
+
}
|
|
237
246
|
});
|
|
238
247
|
|
|
239
248
|
function validateWhenDerived(term, frame, negated, generalContext, specificContext) {
|
|
240
|
-
let
|
|
249
|
+
let validatesWhenDerived = false;
|
|
241
250
|
|
|
242
251
|
const context = specificContext; ///
|
|
243
252
|
|
|
@@ -247,11 +256,11 @@ function validateWhenDerived(term, frame, negated, generalContext, specificConte
|
|
|
247
256
|
variableDefined = isVariableDefined(variable, context);
|
|
248
257
|
|
|
249
258
|
if (!negated && variableDefined) {
|
|
250
|
-
|
|
259
|
+
validatesWhenDerived = true;
|
|
251
260
|
}
|
|
252
261
|
|
|
253
262
|
if (negated && !variableDefined) {
|
|
254
|
-
|
|
263
|
+
validatesWhenDerived = true;
|
|
255
264
|
}
|
|
256
265
|
}
|
|
257
266
|
|
|
@@ -261,15 +270,15 @@ function validateWhenDerived(term, frame, negated, generalContext, specificConte
|
|
|
261
270
|
metavariableDefined = isMetavariableDefined(metavariable, context);
|
|
262
271
|
|
|
263
272
|
if (!negated && metavariableDefined) {
|
|
264
|
-
|
|
273
|
+
validatesWhenDerived = true;
|
|
265
274
|
}
|
|
266
275
|
|
|
267
276
|
if (negated && !metavariableDefined) {
|
|
268
|
-
|
|
277
|
+
validatesWhenDerived = true;
|
|
269
278
|
}
|
|
270
279
|
}
|
|
271
280
|
|
|
272
|
-
return
|
|
281
|
+
return validatesWhenDerived;
|
|
273
282
|
}
|
|
274
283
|
|
|
275
284
|
function isVariableDefined(variable, context) {
|
|
@@ -6,7 +6,7 @@ import { define } from "../../elements";
|
|
|
6
6
|
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiatePropertyAssertion } from "../../process/instantiate";
|
|
8
8
|
import { variableAssignmentFromPrepertyAssertion } from "../../process/assign";
|
|
9
|
-
import { termFromPropertyAssertionNode, propertyRelationFromPropertyAssertionNode } from "../../utilities/element";
|
|
9
|
+
import { termFromPropertyAssertionNode, propertyAssertionFromStatementNode, propertyRelationFromPropertyAssertionNode } from "../../utilities/element";
|
|
10
10
|
|
|
11
11
|
export default define(class PropertyAssertion extends Assertion {
|
|
12
12
|
constructor(context, string, node, term, propertyRelation) {
|
|
@@ -57,7 +57,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
57
57
|
return comparesToTermAndPropertyRelation;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
validate(
|
|
60
|
+
validate(context) {
|
|
61
61
|
let propertyAssertion = null;
|
|
62
62
|
|
|
63
63
|
const propertyAssertionString = this.getString(); ///
|
|
@@ -73,12 +73,14 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
73
73
|
} else {
|
|
74
74
|
let validates = false;
|
|
75
75
|
|
|
76
|
-
const termValidates = this.validateTerm(
|
|
76
|
+
const termValidates = this.validateTerm(context);
|
|
77
77
|
|
|
78
78
|
if (termValidates) {
|
|
79
|
-
const propertyRelationVerifies = this.validatePropertyRelation(
|
|
79
|
+
const propertyRelationVerifies = this.validatePropertyRelation(context);
|
|
80
80
|
|
|
81
81
|
if (propertyRelationVerifies) {
|
|
82
|
+
const stated = context.isStated();
|
|
83
|
+
|
|
82
84
|
let validatesWhenStated = false,
|
|
83
85
|
validatesWhenDerived = false;
|
|
84
86
|
|
|
@@ -99,7 +101,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
99
101
|
|
|
100
102
|
propertyAssertion = assertion; ///
|
|
101
103
|
|
|
102
|
-
this.assign(
|
|
104
|
+
this.assign(context);
|
|
103
105
|
|
|
104
106
|
context.addAssertion(assertion);
|
|
105
107
|
|
|
@@ -110,7 +112,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
110
112
|
return propertyAssertion;
|
|
111
113
|
}
|
|
112
114
|
|
|
113
|
-
validateTerm(
|
|
115
|
+
validateTerm(context) {
|
|
114
116
|
let termValidates = false;
|
|
115
117
|
|
|
116
118
|
const termString = this.term.getString();
|
|
@@ -136,7 +138,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
136
138
|
return termValidates;
|
|
137
139
|
}
|
|
138
140
|
|
|
139
|
-
validatePropertyRelation(
|
|
141
|
+
validatePropertyRelation(context) {
|
|
140
142
|
let propertyRelationValidates = false;
|
|
141
143
|
|
|
142
144
|
const propertyRelationString = this.propertyRelation.getString();
|
|
@@ -188,16 +190,17 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
188
190
|
return validatesWhenDerived;
|
|
189
191
|
}
|
|
190
192
|
|
|
191
|
-
assign(
|
|
193
|
+
assign(context) {
|
|
194
|
+
const stated = context.isStated();
|
|
195
|
+
|
|
192
196
|
if (!stated) {
|
|
193
197
|
return;
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
const propertyAssertion = this, ///
|
|
197
|
-
variableAssigment = variableAssignmentFromPrepertyAssertion(propertyAssertion, context)
|
|
198
|
-
assignment = variableAssigment; ///
|
|
201
|
+
variableAssigment = variableAssignmentFromPrepertyAssertion(propertyAssertion, context);
|
|
199
202
|
|
|
200
|
-
context.addAssignment(
|
|
203
|
+
context.addAssignment(variableAssigment);
|
|
201
204
|
}
|
|
202
205
|
|
|
203
206
|
static name = "PropertyAssertion";
|
|
@@ -208,7 +211,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
208
211
|
const { name } = json;
|
|
209
212
|
|
|
210
213
|
if (this.name === name) {
|
|
211
|
-
|
|
214
|
+
instantiate((context) => {
|
|
212
215
|
const { string } = json,
|
|
213
216
|
propertyAssertionNode = instantiatePropertyAssertion(string, context),
|
|
214
217
|
node = propertyAssertionNode, ///
|
|
@@ -217,12 +220,17 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
217
220
|
|
|
218
221
|
context = null;
|
|
219
222
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return propertyAssertion;
|
|
223
|
+
propertyAssertion = new PropertyAssertion(context, string, node, term, propertyRelation);
|
|
223
224
|
}, context);
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
return propertyAssertion;
|
|
227
228
|
}
|
|
229
|
+
|
|
230
|
+
static fromStatement(statement, context) {
|
|
231
|
+
const statementNode = statement.getNode(),
|
|
232
|
+
propertyAssertion = propertyAssertionFromStatementNode(statementNode, context);
|
|
233
|
+
|
|
234
|
+
return propertyAssertion;
|
|
235
|
+
}
|
|
228
236
|
});
|
|
@@ -5,7 +5,7 @@ import Assertion from "../assertion";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateSatisfiesAssertion } from "../../process/instantiate";
|
|
8
|
-
import { signatureFromJSatisfiesAssertionNode, referenceFromJSatisfiesAssertionNode } from "../../utilities/element";
|
|
8
|
+
import { signatureFromJSatisfiesAssertionNode, referenceFromJSatisfiesAssertionNode, satisfiesAssertionFromStatementNode } from "../../utilities/element";
|
|
9
9
|
|
|
10
10
|
export default define(class SatisfiesAssertion extends Assertion {
|
|
11
11
|
constructor(context, string, node, signature, reference) {
|
|
@@ -34,7 +34,7 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
34
34
|
|
|
35
35
|
correlateSubstitutions(substitutions, context) { return this.signature.correlateSubstitutions(substitutions, context); }
|
|
36
36
|
|
|
37
|
-
validate(
|
|
37
|
+
validate(context) {
|
|
38
38
|
let satisfiesAssertion = null;
|
|
39
39
|
|
|
40
40
|
const satisfiesAssertionString = this.getString(); ///
|
|
@@ -50,10 +50,10 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
50
50
|
} else {
|
|
51
51
|
let validates = true;
|
|
52
52
|
|
|
53
|
-
const signatureVerifies = this.validateSignature(
|
|
53
|
+
const signatureVerifies = this.validateSignature(context);
|
|
54
54
|
|
|
55
55
|
if (signatureVerifies) {
|
|
56
|
-
const referenceVerifies = this.validateReference(
|
|
56
|
+
const referenceVerifies = this.validateReference(context);
|
|
57
57
|
|
|
58
58
|
if (referenceVerifies) {
|
|
59
59
|
validates = true;
|
|
@@ -76,7 +76,7 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
76
76
|
return satisfiesAssertion;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
validateSignature(
|
|
79
|
+
validateSignature(context) {
|
|
80
80
|
let signatureValidates = false;
|
|
81
81
|
|
|
82
82
|
const signature = this.signature.validate(context);
|
|
@@ -88,7 +88,7 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
88
88
|
return signatureValidates;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
validateReference(
|
|
91
|
+
validateReference(context) {
|
|
92
92
|
let referenceVerifies = false;
|
|
93
93
|
|
|
94
94
|
const referenceString = this.reference.getString(),
|
|
@@ -165,7 +165,7 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
165
165
|
const { name } = json;
|
|
166
166
|
|
|
167
167
|
if (this.name === name) {
|
|
168
|
-
|
|
168
|
+
instantiate((context) => {const { string } = json,
|
|
169
169
|
definedAssertionNode = instantiateSatisfiesAssertion(string, context),
|
|
170
170
|
node = definedAssertionNode, ///
|
|
171
171
|
signature = signatureFromJSatisfiesAssertionNode(definedAssertionNode, context),
|
|
@@ -173,12 +173,17 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
173
173
|
|
|
174
174
|
context = null;
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return satisfiesAssertion;
|
|
176
|
+
satisfiesAssertion = new SatisfiesAssertion(context, string, node, signature, reference);
|
|
179
177
|
}, context);
|
|
180
178
|
}
|
|
181
179
|
|
|
182
180
|
return satisfiesAssertion;
|
|
183
181
|
}
|
|
182
|
+
|
|
183
|
+
static fromStatement(statement, context) {
|
|
184
|
+
const statementNode = statement.getNode(),
|
|
185
|
+
satisfiesAssertion = satisfiesAssertionFromStatementNode(statementNode, context);
|
|
186
|
+
|
|
187
|
+
return satisfiesAssertion;
|
|
188
|
+
}
|
|
184
189
|
});
|
|
@@ -6,8 +6,9 @@ import Assertion from "../assertion";
|
|
|
6
6
|
|
|
7
7
|
import { define } from "../../elements";
|
|
8
8
|
import { reconcile } from "../../utilities/context";
|
|
9
|
-
import { join, instantiate } from "../../utilities/context";
|
|
9
|
+
import { join, descend, instantiate } from "../../utilities/context";
|
|
10
10
|
import { instantiateSubproofAssertion } from "../../process/instantiate";
|
|
11
|
+
import { subproofAssertionFromStatementNode } from "../../utilities/element";
|
|
11
12
|
|
|
12
13
|
const { last, front, backwardsEvery } = arrayUtilities;
|
|
13
14
|
|
|
@@ -49,7 +50,7 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
49
50
|
return subproofAssertionNode;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
validate(
|
|
53
|
+
validate(context) {
|
|
53
54
|
let subproofAssertion = null;
|
|
54
55
|
|
|
55
56
|
const subproofAssertionString = this.getString(); ///
|
|
@@ -65,7 +66,7 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
65
66
|
} else {
|
|
66
67
|
let validates = false;
|
|
67
68
|
|
|
68
|
-
const statementsValidate = this.validateStatements(
|
|
69
|
+
const statementsValidate = this.validateStatements(context);
|
|
69
70
|
|
|
70
71
|
if (statementsValidate) {
|
|
71
72
|
validates = true;
|
|
@@ -85,17 +86,17 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
85
86
|
return subproofAssertion;
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
validateStatements(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const statementsValidate = this.statements.map((statement) => {
|
|
89
|
+
validateStatements(context) {
|
|
90
|
+
const statementsValidate = this.statements.every((statement) => {
|
|
92
91
|
let statementValidates = false;
|
|
93
92
|
|
|
94
|
-
|
|
93
|
+
descend((context) => {
|
|
94
|
+
statement = statement.validate(context); ///
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
if (statement !== null) {
|
|
97
|
+
statementValidates = true;
|
|
98
|
+
}
|
|
99
|
+
}, context);
|
|
99
100
|
|
|
100
101
|
if (statementValidates) {
|
|
101
102
|
return true;
|
|
@@ -239,7 +240,7 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
239
240
|
return suppositionUnifies;
|
|
240
241
|
}
|
|
241
242
|
|
|
242
|
-
unifySuppositions(suppositions,
|
|
243
|
+
unifySuppositions(suppositions, generalContxt, spsecificContext) {
|
|
243
244
|
let suppositionsUnify = false;
|
|
244
245
|
|
|
245
246
|
const supposedStatements = this.getSupposedStatements(),
|
|
@@ -248,7 +249,7 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
248
249
|
|
|
249
250
|
if (suppositionsLength === supposedStatementsLength) {
|
|
250
251
|
suppositionsUnify = backwardsEvery(suppositions, (supposition, index) => {
|
|
251
|
-
const suppositionUnifies = this.unifySupposition(supposition, index,
|
|
252
|
+
const suppositionUnifies = this.unifySupposition(supposition, index, generalContxt, spsecificContext);
|
|
252
253
|
|
|
253
254
|
if (suppositionUnifies) {
|
|
254
255
|
return true;
|
|
@@ -259,30 +260,27 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
259
260
|
return suppositionsUnify;
|
|
260
261
|
}
|
|
261
262
|
|
|
262
|
-
unifyTopLevelMetaAssertion(topLevelMetaAssertion,
|
|
263
|
+
unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
|
|
263
264
|
let topLevelMetaAssertionUnifies = false;
|
|
264
265
|
|
|
265
|
-
const
|
|
266
|
+
const generalContext = context, ///
|
|
267
|
+
specificContext = context, ///
|
|
266
268
|
subproofAssertionString = this.getString(), ///
|
|
267
269
|
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
268
270
|
|
|
269
271
|
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion...`);
|
|
270
272
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
|
|
274
|
-
|
|
275
|
-
if (deductionUnifies) {
|
|
276
|
-
const suppositions = topLevelMetaAssertion.getSuppositions(),
|
|
277
|
-
suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
|
|
273
|
+
const deduction = topLevelMetaAssertion.getDeduction(),
|
|
274
|
+
deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
|
|
278
275
|
|
|
279
|
-
|
|
280
|
-
|
|
276
|
+
if (deductionUnifies) {
|
|
277
|
+
const suppositions = topLevelMetaAssertion.getSuppositions(),
|
|
278
|
+
suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
|
|
281
279
|
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
if (suppositionsUnify) {
|
|
281
|
+
topLevelMetaAssertionUnifies = true;
|
|
284
282
|
}
|
|
285
|
-
}
|
|
283
|
+
}
|
|
286
284
|
|
|
287
285
|
if (topLevelMetaAssertionUnifies) {
|
|
288
286
|
context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion.`);
|
|
@@ -299,7 +297,7 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
299
297
|
const { name } = json;
|
|
300
298
|
|
|
301
299
|
if (this.name === name) {
|
|
302
|
-
|
|
300
|
+
instantiate((context) => {
|
|
303
301
|
const { string } = json,
|
|
304
302
|
subproofAssertionNode = instantiateSubproofAssertion(string, context),
|
|
305
303
|
statements = statementsFromSubproofAssertionNode(subproofAssertionNode, context),
|
|
@@ -307,14 +305,19 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
307
305
|
|
|
308
306
|
context = null;
|
|
309
307
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
return subproorAssertion;
|
|
308
|
+
subproorAssertion = new SubproofAssertion(context, string, node, statements);
|
|
313
309
|
}, context);
|
|
314
310
|
}
|
|
315
311
|
|
|
316
312
|
return subproorAssertion;
|
|
317
313
|
}
|
|
314
|
+
|
|
315
|
+
static fromStatement(statement, context) {
|
|
316
|
+
const statementNode = statement.getNode(),
|
|
317
|
+
subproofAssertion = subproofAssertionFromStatementNode(statementNode, context);
|
|
318
|
+
|
|
319
|
+
return subproofAssertion;
|
|
320
|
+
}
|
|
318
321
|
});
|
|
319
322
|
|
|
320
323
|
function statementsFromSubproofAssertionNode(subproofAssertionNode, context) {
|
|
@@ -5,9 +5,9 @@ import Assertion from "../assertion";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateTypeAssertion } from "../../process/instantiate";
|
|
8
|
-
import { termFromTypeAssertionNode } from "../../utilities/element";
|
|
9
8
|
import { typeFromJSON, typeToTypeJSON } from "../../utilities/json";
|
|
10
9
|
import { variableAssignmentFromTypeAssertion } from "../../process/assign";
|
|
10
|
+
import { termFromTypeAssertionNode, typeAssertionFromStatementNode } from "../../utilities/element";
|
|
11
11
|
|
|
12
12
|
export default define(class TypeAssertion extends Assertion {
|
|
13
13
|
constructor(context, string, node, term, type) {
|
|
@@ -32,7 +32,7 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
32
32
|
return typeAssertionNode;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
validate(
|
|
35
|
+
validate(context) {
|
|
36
36
|
let typeAssertion = null;
|
|
37
37
|
|
|
38
38
|
const typeAssertionString = this.getString(); ///
|
|
@@ -51,6 +51,8 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
51
51
|
const typeValidates = this.validateType(context);
|
|
52
52
|
|
|
53
53
|
if (typeValidates) {
|
|
54
|
+
const stated = context.isStated();
|
|
55
|
+
|
|
54
56
|
let validatesWhenStated = false,
|
|
55
57
|
validatesWhenDerived = false;
|
|
56
58
|
|
|
@@ -70,7 +72,7 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
70
72
|
|
|
71
73
|
typeAssertion = assertion; ///
|
|
72
74
|
|
|
73
|
-
this.assign(
|
|
75
|
+
this.assign(context);
|
|
74
76
|
|
|
75
77
|
context.addAssertion(assertion);
|
|
76
78
|
|
|
@@ -177,7 +179,9 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
177
179
|
return validatesWhenDerived;
|
|
178
180
|
}
|
|
179
181
|
|
|
180
|
-
assign(
|
|
182
|
+
assign(context) {
|
|
183
|
+
const stated = context.isStated();
|
|
184
|
+
|
|
181
185
|
if (!stated) {
|
|
182
186
|
return;
|
|
183
187
|
}
|
|
@@ -185,11 +189,7 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
185
189
|
const typeAssertion = this, ///
|
|
186
190
|
variableAssigment = variableAssignmentFromTypeAssertion(typeAssertion, context);
|
|
187
191
|
|
|
188
|
-
|
|
189
|
-
const assignment = variableAssigment; ///
|
|
190
|
-
|
|
191
|
-
context.addAssignment(assignment);
|
|
192
|
-
}
|
|
192
|
+
context.addAssignment(variableAssigment);
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
toJSON() {
|
|
@@ -214,7 +214,7 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
214
214
|
const { name } = json;
|
|
215
215
|
|
|
216
216
|
if (this.name === name) {
|
|
217
|
-
|
|
217
|
+
instantiate((context) => {
|
|
218
218
|
const { string } = json,
|
|
219
219
|
typeAssertionNode = instantiateTypeAssertion(string, context),
|
|
220
220
|
term = termFromTypeAssertionNode(typeAssertionNode, context),
|
|
@@ -223,12 +223,17 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
223
223
|
|
|
224
224
|
context = null;
|
|
225
225
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return typeAssertion;
|
|
226
|
+
typeAssertion = new TypeAssertion(context, string, node, term, type);
|
|
229
227
|
}, context);
|
|
230
228
|
}
|
|
231
229
|
|
|
232
230
|
return typeAssertion;
|
|
233
231
|
}
|
|
232
|
+
|
|
233
|
+
static fromStatement(statement, context) {
|
|
234
|
+
const statementNode = statement.getNode(),
|
|
235
|
+
typeAssertion = typeAssertionFromStatementNode(statementNode, context);
|
|
236
|
+
|
|
237
|
+
return typeAssertion;
|
|
238
|
+
}
|
|
234
239
|
});
|