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/element/term.js
CHANGED
|
@@ -68,12 +68,12 @@ export default define(class Term extends Element {
|
|
|
68
68
|
return comparesToVariableIdentifier;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
findValidTerm(context) {
|
|
72
72
|
const termNode = this.getTermNode(),
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
term = context.findTermByTermNode(termNode),
|
|
74
|
+
validTerm = term; ///
|
|
75
75
|
|
|
76
|
-
return
|
|
76
|
+
return validTerm;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
isEqualTo(term) {
|
|
@@ -149,23 +149,23 @@ export default define(class Term extends Element {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
validate(context, validateForwards) {
|
|
152
|
-
let
|
|
152
|
+
let term = null;
|
|
153
153
|
|
|
154
154
|
const termString = this.getString(); ///
|
|
155
155
|
|
|
156
156
|
context.trace(`Validating the '${termString}' term...`);
|
|
157
157
|
|
|
158
|
-
const
|
|
158
|
+
const validTerm = this.findValidTerm(context),
|
|
159
|
+
valid = (validTerm !== null);
|
|
159
160
|
|
|
160
161
|
if (valid) {
|
|
161
|
-
|
|
162
|
+
term = validTerm; ///
|
|
162
163
|
|
|
163
164
|
context.debug(`...the '${termString}' term is already valid.`);
|
|
164
165
|
} else {
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const termValidates = validateTerm(term, context, validateForwards);
|
|
166
|
+
const validates = validateTerms.some((validateTerm) => { ///
|
|
167
|
+
const term = this, ///
|
|
168
|
+
termValidates = validateTerm(term, context, validateForwards);
|
|
169
169
|
|
|
170
170
|
if (termValidates) {
|
|
171
171
|
return true;
|
|
@@ -173,7 +173,7 @@ export default define(class Term extends Element {
|
|
|
173
173
|
});
|
|
174
174
|
|
|
175
175
|
if (validates) {
|
|
176
|
-
|
|
176
|
+
term = null; ///
|
|
177
177
|
|
|
178
178
|
context.addTerm(term);
|
|
179
179
|
|
|
@@ -181,7 +181,7 @@ export default define(class Term extends Element {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
return
|
|
184
|
+
return term;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
validateGivenType(type, context) {
|
|
@@ -4,8 +4,6 @@ import { Element } from "occam-languages";
|
|
|
4
4
|
import { arrayUtilities } from "necessary";
|
|
5
5
|
import { asynchronousUtilities } from "occam-languages";
|
|
6
6
|
|
|
7
|
-
import assignAssignments from "../process/assign";
|
|
8
|
-
|
|
9
7
|
import { asyncScope } from "../utilities/context";
|
|
10
8
|
import { labelsFromJSON,
|
|
11
9
|
deductionFromJSON,
|
|
@@ -251,14 +249,13 @@ export default class TopLevelAssertion extends Element {
|
|
|
251
249
|
context.trace(`Verifying the '${topLevelAssertionString}' top level assertion's suppositions...`);
|
|
252
250
|
|
|
253
251
|
suppositionsVerify = await asyncForwardsEvery(this.suppositions, async (supposition) => {
|
|
254
|
-
const
|
|
255
|
-
suppositionVerifies = await supposition.verify(assignments, context)
|
|
252
|
+
const suppositionVerifies = await supposition.verify(context)
|
|
256
253
|
|
|
257
254
|
if (suppositionVerifies) {
|
|
258
|
-
assignAssignments(assignments, context);
|
|
259
|
-
|
|
260
255
|
const subproofOrProofAssertion = supposition; ////
|
|
261
256
|
|
|
257
|
+
context.assignAssignments();
|
|
258
|
+
|
|
262
259
|
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
263
260
|
|
|
264
261
|
return true;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
|
-
import assignAssignments from "../process/assign";
|
|
6
|
-
|
|
7
5
|
import { asyncScope } from "../utilities/context";
|
|
8
6
|
import { labelFromJSON,
|
|
9
7
|
labelToLabelJSON,
|
|
@@ -155,14 +153,13 @@ export default class TopLevelMetaAssertion extends Element {
|
|
|
155
153
|
context.trace(`Verifying the '${topLevelMetaAssertionString}' top level meta assertion's suppositions...`);
|
|
156
154
|
|
|
157
155
|
suppositionsVerify = await asyncForwardsEvery(this.suppositions, async (supposition) => {
|
|
158
|
-
const
|
|
159
|
-
suppositionVerifies = await supposition.verify(assignments, context)
|
|
156
|
+
const suppositionVerifies = await supposition.verify(context)
|
|
160
157
|
|
|
161
158
|
if (suppositionVerifies) {
|
|
162
|
-
assignAssignments(assignments, context);
|
|
163
|
-
|
|
164
159
|
const subproofOrProofAssertion = supposition; ////
|
|
165
160
|
|
|
161
|
+
context.assignAssignments();
|
|
162
|
+
|
|
166
163
|
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
167
164
|
|
|
168
165
|
return true;
|
package/src/element/variable.js
CHANGED
|
@@ -166,11 +166,15 @@ export default define(class Variable extends Element {
|
|
|
166
166
|
termTypeEqualToOrSubTypeOfVariableType = termType.isEqualToOrSubTypeOf(variableType);
|
|
167
167
|
|
|
168
168
|
if (termTypeEqualToOrSubTypeOfVariableType) {
|
|
169
|
-
const { TermSubstitution } = elements
|
|
170
|
-
termSubstitution = TermSubstitution.fromTermAndVariable(term, variable, context),
|
|
171
|
-
termSubstitutionValidates = termSubstitution.validate(generalContext, specificContext);
|
|
169
|
+
const { TermSubstitution } = elements;
|
|
172
170
|
|
|
173
|
-
|
|
171
|
+
let termSubstitution;
|
|
172
|
+
|
|
173
|
+
termSubstitution = TermSubstitution.fromTermAndVariable(term, variable, context);
|
|
174
|
+
|
|
175
|
+
termSubstitution = termSubstitution.validate(generalContext, specificContext); ///
|
|
176
|
+
|
|
177
|
+
if (termSubstitution !== null) {
|
|
174
178
|
termUnifies = true;
|
|
175
179
|
}
|
|
176
180
|
}
|
package/src/process/assign.js
CHANGED
|
@@ -105,12 +105,6 @@ export function variableAssignmentFromPrepertyAssertion(propertyAssertion, conte
|
|
|
105
105
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
export default function assignAssignments(assignments, context) {
|
|
109
|
-
assignments.forEach((assignment) => {
|
|
110
|
-
assignment(context);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
108
|
function variableAssignmentFromVariableNodeAndType(variableNode, type, context) {
|
|
115
109
|
const variable = variableFromVariableNode(variableNode, context);
|
|
116
110
|
|
package/src/process/unify.js
CHANGED
|
@@ -149,7 +149,7 @@ class CombinatorPass extends ZipPass {
|
|
|
149
149
|
{
|
|
150
150
|
generalNodeQuery: metaTypeNodeQuery,
|
|
151
151
|
specificNodeQuery: statementNodeQuery,
|
|
152
|
-
run: (generalMetaTypeNode, specificStatementNode,
|
|
152
|
+
run: (generalMetaTypeNode, specificStatementNode, stated, generalContext, specificContext) => {
|
|
153
153
|
let success = false;
|
|
154
154
|
|
|
155
155
|
const metaTypeNode = generalMetaTypeNode, ///
|
|
@@ -165,7 +165,7 @@ class CombinatorPass extends ZipPass {
|
|
|
165
165
|
context = specificContext; ///
|
|
166
166
|
|
|
167
167
|
const statement = statementFromStatementNode(statementNode, context),
|
|
168
|
-
statementValidatesGivenType = statement.validateGivenMetaType(metaType,
|
|
168
|
+
statementValidatesGivenType = statement.validateGivenMetaType(metaType, stated, context);
|
|
169
169
|
|
|
170
170
|
if (statementValidatesGivenType) {
|
|
171
171
|
success = true;
|
|
@@ -177,7 +177,7 @@ class CombinatorPass extends ZipPass {
|
|
|
177
177
|
{
|
|
178
178
|
generalNodeQuery: metaTypeNodeQuery,
|
|
179
179
|
specificNodeQuery: frameNodeQuery,
|
|
180
|
-
run: (generalMetaTypeNode, specificFrameNode,
|
|
180
|
+
run: (generalMetaTypeNode, specificFrameNode, stated, generalContext, specificContext) => {
|
|
181
181
|
let success = false;
|
|
182
182
|
|
|
183
183
|
const metaTypeNode = generalMetaTypeNode, ///
|
|
@@ -193,7 +193,7 @@ class CombinatorPass extends ZipPass {
|
|
|
193
193
|
context = specificContext; ///
|
|
194
194
|
|
|
195
195
|
const frame = frameFromFrameNode(frameNode, context),
|
|
196
|
-
frameValidatesGivenMetaType = frame.validateGivenMetaType(metaType,
|
|
196
|
+
frameValidatesGivenMetaType = frame.validateGivenMetaType(metaType, stated, context);
|
|
197
197
|
|
|
198
198
|
if (frameValidatesGivenMetaType) {
|
|
199
199
|
success = true;
|
|
@@ -205,7 +205,7 @@ class CombinatorPass extends ZipPass {
|
|
|
205
205
|
{
|
|
206
206
|
generalNodeQuery: typeNodeQuery,
|
|
207
207
|
specificNodeQuery: termNodeQuery,
|
|
208
|
-
run: (generalTypeNode, specificTermNode,
|
|
208
|
+
run: (generalTypeNode, specificTermNode, stated, generalContext, specificContext) => {
|
|
209
209
|
let success = false;
|
|
210
210
|
|
|
211
211
|
const typeNode = generalTypeNode, ///
|
|
@@ -412,13 +412,13 @@ export function unifyStatementIntrinsically(generalStatement, specificStatement,
|
|
|
412
412
|
return statementUnifiesIntrinsically;
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
export function unifyStatementWithCombinator(statement, combinator,
|
|
415
|
+
export function unifyStatementWithCombinator(statement, combinator, stated, generalContext, specificContext) {
|
|
416
416
|
let statementUnifiesWithCombinator = false;
|
|
417
417
|
|
|
418
418
|
const statementNode = statement.getNode(),
|
|
419
419
|
combinatorStatement = combinator.getStatement(),
|
|
420
420
|
combinatorStatementNode = combinatorStatement.getNode(),
|
|
421
|
-
success = combinatorPass.run(combinatorStatementNode, statementNode,
|
|
421
|
+
success = combinatorPass.run(combinatorStatementNode, statementNode, stated, generalContext, specificContext);
|
|
422
422
|
|
|
423
423
|
if (success) {
|
|
424
424
|
statementUnifiesWithCombinator = true;
|
package/src/process/validate.js
CHANGED
|
@@ -32,10 +32,13 @@ class TermPass extends ForwardPass {
|
|
|
32
32
|
run: (termNode, context, validateForwards) => {
|
|
33
33
|
let success = false;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
termValidates = term.validate(context, validateForwards);
|
|
35
|
+
let term;
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
term = termFromTermNode(termNode, context);
|
|
38
|
+
|
|
39
|
+
term = term.validate(context, validateForwards); ///
|
|
40
|
+
|
|
41
|
+
if (term !== null) {
|
|
39
42
|
success = true;
|
|
40
43
|
}
|
|
41
44
|
|
|
@@ -91,12 +94,15 @@ class StatementPass extends SimplePass {
|
|
|
91
94
|
run: (statementNode, context) => {
|
|
92
95
|
let success = false;
|
|
93
96
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
let statement;
|
|
98
|
+
|
|
99
|
+
const stated = true;
|
|
100
|
+
|
|
101
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
98
102
|
|
|
99
|
-
|
|
103
|
+
statement = statement.validate(stated, context); ///
|
|
104
|
+
|
|
105
|
+
if (statement !== null) {
|
|
100
106
|
success = true;
|
|
101
107
|
}
|
|
102
108
|
|
|
@@ -108,14 +114,17 @@ class StatementPass extends SimplePass {
|
|
|
108
114
|
run: (termNode, context) => {
|
|
109
115
|
let success = false;
|
|
110
116
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
let term;
|
|
118
|
+
|
|
119
|
+
term = termFromTermNode(termNode, context);
|
|
120
|
+
|
|
121
|
+
term = term.validate(context, () => { ///
|
|
122
|
+
const validatesForwards = true;
|
|
114
123
|
|
|
115
|
-
|
|
116
|
-
|
|
124
|
+
return validatesForwards;
|
|
125
|
+
});
|
|
117
126
|
|
|
118
|
-
if (
|
|
127
|
+
if (term !== null) {
|
|
119
128
|
success = true;
|
|
120
129
|
}
|
|
121
130
|
|
package/src/process/verify.js
CHANGED
|
@@ -294,12 +294,15 @@ class ConbinatorPass extends SimplePass {
|
|
|
294
294
|
run: (statementNode, context) => {
|
|
295
295
|
let success = false;
|
|
296
296
|
|
|
297
|
-
|
|
298
|
-
stated = false,
|
|
299
|
-
assignments = null,
|
|
300
|
-
statementValidates = statement.validate(assignments, stated, context);
|
|
297
|
+
let statement;
|
|
301
298
|
|
|
302
|
-
|
|
299
|
+
const stated = true;
|
|
300
|
+
|
|
301
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
302
|
+
|
|
303
|
+
statement = statement.validate(stated, context);
|
|
304
|
+
|
|
305
|
+
if (statement !== null) {
|
|
303
306
|
success = true;
|
|
304
307
|
}
|
|
305
308
|
|
|
@@ -311,14 +314,17 @@ class ConbinatorPass extends SimplePass {
|
|
|
311
314
|
run: (termNode, context) => {
|
|
312
315
|
let success = false;
|
|
313
316
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
+
let term;
|
|
318
|
+
|
|
319
|
+
term = termFromTermNode(termNode, context);
|
|
317
320
|
|
|
318
|
-
|
|
319
|
-
|
|
321
|
+
term = term.validate(context, () => { ///
|
|
322
|
+
const validatesForwards = true;
|
|
320
323
|
|
|
321
|
-
|
|
324
|
+
return validatesForwards;
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
if (term !== null) {
|
|
322
328
|
success = true;
|
|
323
329
|
}
|
|
324
330
|
|
|
@@ -350,14 +356,17 @@ class ConstructorPass extends SimplePass {
|
|
|
350
356
|
run: (termNode, context) => {
|
|
351
357
|
let success = false;
|
|
352
358
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
359
|
+
let term;
|
|
360
|
+
|
|
361
|
+
term = termFromTermNode(termNode, context);
|
|
362
|
+
|
|
363
|
+
term = term.validate(context, () => { ///
|
|
364
|
+
const validatesForwards = true;
|
|
356
365
|
|
|
357
|
-
|
|
358
|
-
|
|
366
|
+
return validatesForwards;
|
|
367
|
+
});
|
|
359
368
|
|
|
360
|
-
if (
|
|
369
|
+
if (term !== null) {
|
|
361
370
|
success = true;
|
|
362
371
|
}
|
|
363
372
|
|
|
@@ -86,10 +86,9 @@ async function unifyStatementAsSatisfiesAssertion(statement, reference, satisfie
|
|
|
86
86
|
|
|
87
87
|
context.trace(`Unifying the '${statementString}' statement as a satisfies assertion...`);
|
|
88
88
|
|
|
89
|
-
const stated = true
|
|
90
|
-
assignments = null;
|
|
89
|
+
const stated = true;
|
|
91
90
|
|
|
92
|
-
satisfiesAssertion.verifySignature(
|
|
91
|
+
satisfiesAssertion.verifySignature(stated, context);
|
|
93
92
|
|
|
94
93
|
if (reference === null) {
|
|
95
94
|
const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
|
|
@@ -181,7 +180,7 @@ async function unifyStatementWithTopLevelAssertion(statement, reference, satisfi
|
|
|
181
180
|
return statementUnifiesWithTopLevelAssertion;
|
|
182
181
|
}
|
|
183
182
|
|
|
184
|
-
async function
|
|
183
|
+
async function unifyStatementAsEquality(statement, reference, satisfiesAssertion, context) {
|
|
185
184
|
let statementUnifiesAEquality = false;
|
|
186
185
|
|
|
187
186
|
if (reference === null) {
|
|
@@ -339,7 +338,7 @@ export const unifyStatements = [
|
|
|
339
338
|
unifyStatementWithReference,
|
|
340
339
|
unifyStatementAsSatisfiesAssertion,
|
|
341
340
|
unifyStatementWithTopLevelAssertion,
|
|
342
|
-
|
|
341
|
+
unifyStatementAsEquality,
|
|
343
342
|
unifyStatementAsJudgement,
|
|
344
343
|
unifyStatementAsTypeAssertion,
|
|
345
344
|
unifyStatementAsPropertyAssertion,
|