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.
Files changed (99) hide show
  1. package/lib/context/file/nominal.js +1 -1
  2. package/lib/context/liminal.js +3 -3
  3. package/lib/context/scoped.js +25 -3
  4. package/lib/context.js +8 -1
  5. package/lib/element/assertion/contained.js +34 -23
  6. package/lib/element/assertion/defined.js +30 -21
  7. package/lib/element/assertion/property.js +24 -21
  8. package/lib/element/assertion/satisfies.js +19 -14
  9. package/lib/element/assertion/subproof.js +18 -13
  10. package/lib/element/assertion/type.js +23 -20
  11. package/lib/element/assertion.js +5 -5
  12. package/lib/element/assumption.js +31 -25
  13. package/lib/element/combinator/bracketed.js +3 -3
  14. package/lib/element/combinator.js +3 -3
  15. package/lib/element/conclusion.js +6 -2
  16. package/lib/element/constructor/bracketed.js +5 -3
  17. package/lib/element/deduction.js +6 -2
  18. package/lib/element/derivation.js +4 -5
  19. package/lib/element/equality.js +32 -27
  20. package/lib/element/frame.js +26 -21
  21. package/lib/element/hypothesis.js +8 -10
  22. package/lib/element/judgement.js +54 -22
  23. package/lib/element/metavariable.js +18 -10
  24. package/lib/element/proofAssertion/premise.js +8 -8
  25. package/lib/element/proofAssertion/step.js +16 -11
  26. package/lib/element/proofAssertion/supposition.js +7 -7
  27. package/lib/element/proofAssertion.js +7 -5
  28. package/lib/element/propertyRelation.js +7 -3
  29. package/lib/element/reference.js +28 -21
  30. package/lib/element/rule.js +4 -11
  31. package/lib/element/signature.js +10 -4
  32. package/lib/element/statement.js +17 -17
  33. package/lib/element/subDerivation.js +4 -11
  34. package/lib/element/subproof.js +37 -29
  35. package/lib/element/substitution/frame.js +18 -10
  36. package/lib/element/substitution/reference.js +17 -9
  37. package/lib/element/substitution/statement.js +16 -10
  38. package/lib/element/substitution/term.js +19 -9
  39. package/lib/element/substitution.js +5 -5
  40. package/lib/element/term.js +14 -14
  41. package/lib/element/topLevelAssertion.js +4 -11
  42. package/lib/element/topLevelMetaAssertion.js +4 -11
  43. package/lib/element/variable.js +6 -3
  44. package/lib/process/assign.js +1 -9
  45. package/lib/process/unify.js +8 -8
  46. package/lib/process/validate.js +14 -7
  47. package/lib/process/verify.js +14 -7
  48. package/lib/utilities/unification.js +6 -6
  49. package/lib/utilities/validation.js +68 -55
  50. package/package.json +1 -1
  51. package/src/context/file/nominal.js +2 -2
  52. package/src/context/liminal.js +2 -2
  53. package/src/context/scoped.js +20 -2
  54. package/src/context.js +6 -0
  55. package/src/element/assertion/contained.js +40 -24
  56. package/src/element/assertion/defined.js +38 -24
  57. package/src/element/assertion/property.js +28 -22
  58. package/src/element/assertion/satisfies.js +21 -13
  59. package/src/element/assertion/subproof.js +21 -13
  60. package/src/element/assertion/type.js +28 -22
  61. package/src/element/assertion.js +4 -4
  62. package/src/element/assumption.js +31 -23
  63. package/src/element/combinator/bracketed.js +2 -2
  64. package/src/element/combinator.js +2 -2
  65. package/src/element/conclusion.js +7 -2
  66. package/src/element/constructor/bracketed.js +4 -2
  67. package/src/element/deduction.js +7 -2
  68. package/src/element/derivation.js +2 -3
  69. package/src/element/equality.js +45 -34
  70. package/src/element/frame.js +31 -21
  71. package/src/element/hypothesis.js +9 -6
  72. package/src/element/judgement.js +64 -20
  73. package/src/element/metavariable.js +31 -16
  74. package/src/element/proofAssertion/premise.js +7 -7
  75. package/src/element/proofAssertion/step.js +16 -10
  76. package/src/element/proofAssertion/supposition.js +6 -6
  77. package/src/element/proofAssertion.js +7 -4
  78. package/src/element/propertyRelation.js +8 -2
  79. package/src/element/reference.js +31 -21
  80. package/src/element/rule.js +3 -6
  81. package/src/element/signature.js +21 -10
  82. package/src/element/statement.js +14 -14
  83. package/src/element/subDerivation.js +2 -5
  84. package/src/element/subproof.js +9 -3
  85. package/src/element/substitution/frame.js +21 -9
  86. package/src/element/substitution/reference.js +20 -8
  87. package/src/element/substitution/statement.js +17 -9
  88. package/src/element/substitution/term.js +24 -8
  89. package/src/element/substitution.js +4 -4
  90. package/src/element/term.js +13 -13
  91. package/src/element/topLevelAssertion.js +3 -6
  92. package/src/element/topLevelMetaAssertion.js +3 -6
  93. package/src/element/variable.js +8 -4
  94. package/src/process/assign.js +0 -6
  95. package/src/process/unify.js +7 -7
  96. package/src/process/validate.js +23 -14
  97. package/src/process/verify.js +26 -17
  98. package/src/utilities/unification.js +4 -5
  99. package/src/utilities/validation.js +83 -75
@@ -72,7 +72,7 @@ function unifyTermWithBracketedConstructor(term, context, validateForwards) {
72
72
  return termUnifiesWithBracketedConstructor;
73
73
  }
74
74
 
75
- function validateStatementAsMetavariable(statement, assignments, stated, context) {
75
+ function validateStatementAsMetavariable(statement, stated, context) {
76
76
  let statementValidatesAsMetavariableAndSubstitution = false;
77
77
 
78
78
  const statementNode = statement.getNode(),
@@ -91,15 +91,19 @@ function validateStatementAsMetavariable(statement, assignments, stated, context
91
91
 
92
92
  const { TermSubstitution, FrameSubstitution } = elements,
93
93
  frameSubstitution = FrameSubstitution.fromStatement(statement, context),
94
- termSubstitution = TermSubstitution.fromStatement(statement, context),
95
- substitution = (termSubstitution || frameSubstitution);
94
+ termSubstitution = TermSubstitution.fromStatement(statement, context);
95
+
96
+ let substitution;
97
+
98
+ substitution = (termSubstitution || frameSubstitution);
96
99
 
97
100
  if (substitution !== null) {
98
101
  const generalContext = context, ///
99
- specificContext = context, ///
100
- substitutionValidates = substitution.validate(generalContext, specificContext);
102
+ specificContext = context; ///
103
+
104
+ substitution = substitution.validate(generalContext, specificContext);
101
105
 
102
- if (!substitutionValidates) {
106
+ if (substitution === null) {
103
107
  statementValidatesAsMetavariableAndSubstitution = false;
104
108
  }
105
109
  }
@@ -113,47 +117,47 @@ function validateStatementAsMetavariable(statement, assignments, stated, context
113
117
  return statementValidatesAsMetavariableAndSubstitution;
114
118
  }
115
119
 
116
- function unifyStatementWithCombinators(statement, assignments, stated, context) {
120
+ function unifyStatementWithCombinators(statement, stated, context) {
117
121
  stated = true; ///
118
122
 
119
- assignments = null; ///
120
-
121
123
  const combinators = context.getCombinators(),
122
- statementUnifiesWithCombinators = combinators.some((combinator) => {
123
- const unifiesWithCombinator = combinator.unifyStatement(statement, assignments, stated, context);
124
+ statementUnifiesWithCombinators = combinators.some((combinator) => {
125
+ const unifiesWithCombinator = combinator.unifyStatement(statement, stated, context);
124
126
 
125
- if (unifiesWithCombinator) {
126
- return true;
127
- }
128
- });
127
+ if (unifiesWithCombinator) {
128
+ return true;
129
+ }
130
+ });
129
131
 
130
132
  return statementUnifiesWithCombinators;
131
133
  }
132
134
 
133
- function unifyStatementWithBracketedCombinator(statement, assignments, stated, context) {
135
+ function unifyStatementWithBracketedCombinator(statement, stated, context) {
134
136
  stated = true; ///
135
137
 
136
- assignments = null; ///
137
-
138
138
  const bracketedCombinator = bracketedCombinatorFromNothing(),
139
- statementUnifiesWithBracketedCombinator = bracketedCombinator.unifyStatement(statement, assignments, stated, context);
139
+ statementUnifiesWithBracketedCombinator = bracketedCombinator.unifyStatement(statement, stated, context);
140
140
 
141
141
  return statementUnifiesWithBracketedCombinator;
142
142
  }
143
143
 
144
- function validateStatementAsEquality(statement, assignments, stated, context) {
144
+ function validateStatementAsEquality(statement, stated, context) {
145
145
  let statementValidatesAsEquality = false;
146
146
 
147
- const equality = equalityFromStatement(statement, context);
147
+ let equality;
148
+
149
+ equality = equalityFromStatement(statement, context);
148
150
 
149
151
  if (equality !== null) {
150
152
  const statementString = statement.getString();
151
153
 
152
154
  context.trace(`Validating the '${statementString}' statement as an equality...`);
153
155
 
154
- const equalityValidates = equality.validate(assignments, stated, context);
156
+ equality = equality.validate(stated, context); ///
155
157
 
156
- statementValidatesAsEquality = equalityValidates; ///
158
+ if (equality !== null) {
159
+ statementValidatesAsEquality = true;
160
+ }
157
161
 
158
162
  if (statementValidatesAsEquality) {
159
163
  context.debug(`...validated the '${statementString}' statement as an equality.`);
@@ -163,19 +167,23 @@ function validateStatementAsEquality(statement, assignments, stated, context) {
163
167
  return statementValidatesAsEquality;
164
168
  }
165
169
 
166
- function validateStatementAsJudgement(statement, assignments, stated, context) {
170
+ function validateStatementAsJudgement(statement, stated, context) {
167
171
  let validatesStatementAsJudgement = false;
168
172
 
169
- const judgement = judgementFromStatement(statement, context);
173
+ let judgement;
174
+
175
+ judgement = judgementFromStatement(statement, context);
170
176
 
171
177
  if (judgement !== null) {
172
178
  const statementString = statement.getString();
173
179
 
174
180
  context.trace(`Validating the '${statementString}' statement as a judgement...`);
175
181
 
176
- const judgementValidates = judgement.validate(assignments, stated, context);
182
+ judgement = judgement.validate(stated, context); ///
177
183
 
178
- validatesStatementAsJudgement = judgementValidates; ///
184
+ if (judgement !== null) {
185
+ validatesStatementAsJudgement = true;
186
+ }
179
187
 
180
188
  if (validatesStatementAsJudgement) {
181
189
  context.debug(`...validated the '${statementString}' statement as a judgement.`);
@@ -185,25 +193,25 @@ function validateStatementAsJudgement(statement, assignments, stated, context) {
185
193
  return validatesStatementAsJudgement;
186
194
  }
187
195
 
188
- function validateStatementAsTypeAssertion(statement, assignments, stated, context) {
196
+ function validateStatementAsTypeAssertion(statement, stated, context) {
189
197
  let validatesStatementAsTypeAssertion = false;
190
198
 
191
- const typeAssertion = typeAssertionFromStatement(statement, context);
199
+ let typeAssertion;
200
+
201
+ typeAssertion = typeAssertionFromStatement(statement, context);
192
202
 
193
203
  if (typeAssertion !== null) {
194
204
  const statementString = statement.getString();
195
205
 
196
206
  context.trace(`Validating the '${statementString}' statement as a type assertion...`);
197
207
 
198
- const typeAssertionValidates = typeAssertion.validate(assignments, stated, context);
208
+ typeAssertion = typeAssertion.validate(stated, context); ///
199
209
 
200
- validatesStatementAsTypeAssertion = typeAssertionValidates; ///
210
+ if (typeAssertion !== null) {
211
+ validatesStatementAsTypeAssertion = true;
212
+ }
201
213
 
202
214
  if (validatesStatementAsTypeAssertion) {
203
- const assertion = typeAssertion; ///
204
-
205
- context.addAssertion(assertion);
206
-
207
215
  context.debug(`...validated the '${statementString}' statement as a type assertion.`);
208
216
  }
209
217
  }
@@ -211,25 +219,25 @@ function validateStatementAsTypeAssertion(statement, assignments, stated, contex
211
219
  return validatesStatementAsTypeAssertion;
212
220
  }
213
221
 
214
- function validateStatementAsDefinedAssertion(statement, assignments, stated, context) {
222
+ function validateStatementAsDefinedAssertion(statement, stated, context) {
215
223
  let validatesStatementAsDefinedAssertion = false;
216
224
 
217
- const definedAssertion = definedAssertionFromStatement(statement, context);
225
+ let definedAssertion;
226
+
227
+ definedAssertion = definedAssertionFromStatement(statement, context);
218
228
 
219
229
  if (definedAssertion !== null) {
220
230
  const statementString = statement.getString();
221
231
 
222
232
  context.trace(`Validating the '${statementString}' statement as a defined assertion...`);
223
233
 
224
- const definedAssertionValidates = definedAssertion.validate(assignments, stated, context);
234
+ definedAssertion = definedAssertion.validate(stated, context); ///
225
235
 
226
- validatesStatementAsDefinedAssertion = definedAssertionValidates; ///
236
+ if (definedAssertion !== null) {
237
+ validatesStatementAsDefinedAssertion = true;
238
+ }
227
239
 
228
240
  if (validatesStatementAsDefinedAssertion) {
229
- const assertion = definedAssertion; ///
230
-
231
- context.addAssertion(assertion);
232
-
233
241
  context.debug(`...validated the '${statementString}' statement as a defined assertion.`);
234
242
  }
235
243
  }
@@ -237,25 +245,25 @@ function validateStatementAsDefinedAssertion(statement, assignments, stated, con
237
245
  return validatesStatementAsDefinedAssertion;
238
246
  }
239
247
 
240
- function validateStatementAsPropertyAssertion(statement, assignments, stated, context) {
248
+ function validateStatementAsPropertyAssertion(statement, stated, context) {
241
249
  let statementValidatesAsPropertyAssertion = false;
242
250
 
243
- const propertyAssertion = propertyAssertionFromStatement(statement, context);
251
+ let propertyAssertion;
252
+
253
+ propertyAssertion = propertyAssertionFromStatement(statement, context);
244
254
 
245
255
  if (propertyAssertion !== null) {
246
256
  const statementString = statement.getString();
247
257
 
248
258
  context.trace(`Validating the '${statementString}' statement as a property assertion...`);
249
259
 
250
- const propertyAssertionValidates = propertyAssertion.validate(assignments, stated, context);
260
+ propertyAssertion = propertyAssertion.validate(stated, context); ///
251
261
 
252
- statementValidatesAsPropertyAssertion = propertyAssertionValidates; ///
262
+ if (propertyAssertion !== null) {
263
+ statementValidatesAsPropertyAssertion = true;
264
+ }
253
265
 
254
266
  if (statementValidatesAsPropertyAssertion) {
255
- const assertion = propertyAssertion; ///
256
-
257
- context.addAssertion(assertion);
258
-
259
267
  context.debug(`...validated the '${statementString}' statement as a property assertion.`);
260
268
  }
261
269
  }
@@ -263,25 +271,25 @@ function validateStatementAsPropertyAssertion(statement, assignments, stated, co
263
271
  return statementValidatesAsPropertyAssertion;
264
272
  }
265
273
 
266
- function validateStatementAsSubproofAssertion(statement, assignments, stated, context) {
274
+ function validateStatementAsSubproofAssertion(statement, stated, context) {
267
275
  let statementValidatesAsSubproofAssertion = false;
268
276
 
269
- const subproofAssertion = subproofAssertionFromStatement(statement, context);
277
+ let subproofAssertion;
278
+
279
+ subproofAssertion = subproofAssertionFromStatement(statement, context);
270
280
 
271
281
  if (subproofAssertion !== null) {
272
282
  const statementString = statement.getString();
273
283
 
274
284
  context.trace(`Validating the '${statementString}' statement as a subproof assertion...`);
275
285
 
276
- const subproofAssertionValidates = subproofAssertion.validate(assignments, stated, context);
286
+ subproofAssertion = subproofAssertion.validate(stated, context); ///
277
287
 
278
- statementValidatesAsSubproofAssertion = subproofAssertionValidates; ///
288
+ if (subproofAssertion !== null) {
289
+ statementValidatesAsSubproofAssertion = true;
290
+ }
279
291
 
280
292
  if (statementValidatesAsSubproofAssertion) {
281
- const assertion = subproofAssertion; ///
282
-
283
- context.addAssertion(assertion);
284
-
285
293
  context.debug(`...validated the '${statementString}' statement as a subproof assertion.`);
286
294
  }
287
295
  }
@@ -289,25 +297,25 @@ function validateStatementAsSubproofAssertion(statement, assignments, stated, co
289
297
  return statementValidatesAsSubproofAssertion;
290
298
  }
291
299
 
292
- function validateStatementAsContainedAssertion(statement, assignments, stated, context) {
300
+ function validateStatementAsContainedAssertion(statement, stated, context) {
293
301
  let validatesStatementAsContainedAssertion = false;
294
302
 
295
- const containedAssertion = containedAssertionFromStatement(statement, context);
303
+ let containedAssertion;
304
+
305
+ containedAssertion = containedAssertionFromStatement(statement, context);
296
306
 
297
307
  if (containedAssertion !== null) {
298
308
  const statementString = statement.getString();
299
309
 
300
310
  context.trace(`Validating the '${statementString}' statement as a contained assertion...`);
301
311
 
302
- const containedAssertionValidates = containedAssertion.validate(assignments, stated, context);
312
+ containedAssertion = containedAssertion.validate(stated, context); ///
303
313
 
304
- validatesStatementAsContainedAssertion = containedAssertionValidates; ///
314
+ if (containedAssertion !== null) {
315
+ validatesStatementAsContainedAssertion = true;
316
+ }
305
317
 
306
318
  if (validatesStatementAsContainedAssertion) {
307
- const assertion = containedAssertion; ///
308
-
309
- context.addAssertion(assertion);
310
-
311
319
  context.debug(`...validated the '${statementString}' statement as a contained assertion.`);
312
320
  }
313
321
  }
@@ -315,25 +323,25 @@ function validateStatementAsContainedAssertion(statement, assignments, stated, c
315
323
  return validatesStatementAsContainedAssertion;
316
324
  }
317
325
 
318
- function validateStatementAsSatisfiesAssertion(statement, assignments, stated, context) {
326
+ function validateStatementAsSatisfiesAssertion(statement, stated, context) {
319
327
  let validatesAStatementsSatisfiesAssertion = false;
320
328
 
321
- const satisfiesAssertion = satisfiesAssertionFromStatement(statement, context);
329
+ let satisfiesAssertion;
330
+
331
+ satisfiesAssertion = satisfiesAssertionFromStatement(statement, context);
322
332
 
323
333
  if (satisfiesAssertion !== null) {
324
334
  const statementString = statement.getString();
325
335
 
326
336
  context.trace(`Validating the '${statementString}' statement as a satisfies assertion...`);
327
337
 
328
- const satisfiesAssertionValidates = satisfiesAssertion.validate(assignments, stated, context);
338
+ satisfiesAssertion = satisfiesAssertion.validate(stated, context); ///
329
339
 
330
- validatesAStatementsSatisfiesAssertion = satisfiesAssertionValidates; ///
340
+ if (satisfiesAssertion !== null) {
341
+ validatesAStatementsSatisfiesAssertion = true;
342
+ }
331
343
 
332
344
  if (validatesAStatementsSatisfiesAssertion) {
333
- const assertion = satisfiesAssertion; ///
334
-
335
- context.addAssertion(assertion);
336
-
337
345
  context.debug(`...validated the '${statementString}' statement as a satisfies assertion.`);
338
346
  }
339
347
  }