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
|
@@ -72,7 +72,7 @@ function unifyTermWithBracketedConstructor(term, context, validateForwards) {
|
|
|
72
72
|
return termUnifiesWithBracketedConstructor;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
function validateStatementAsMetavariable(statement,
|
|
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
|
-
|
|
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
|
-
|
|
102
|
+
specificContext = context; ///
|
|
103
|
+
|
|
104
|
+
substitution = substitution.validate(generalContext, specificContext);
|
|
101
105
|
|
|
102
|
-
if (
|
|
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,
|
|
120
|
+
function unifyStatementWithCombinators(statement, stated, context) {
|
|
117
121
|
stated = true; ///
|
|
118
122
|
|
|
119
|
-
assignments = null; ///
|
|
120
|
-
|
|
121
123
|
const combinators = context.getCombinators(),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
statementUnifiesWithCombinators = combinators.some((combinator) => {
|
|
125
|
+
const unifiesWithCombinator = combinator.unifyStatement(statement, stated, context);
|
|
124
126
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
if (unifiesWithCombinator) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
129
131
|
|
|
130
132
|
return statementUnifiesWithCombinators;
|
|
131
133
|
}
|
|
132
134
|
|
|
133
|
-
function unifyStatementWithBracketedCombinator(statement,
|
|
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,
|
|
139
|
+
statementUnifiesWithBracketedCombinator = bracketedCombinator.unifyStatement(statement, stated, context);
|
|
140
140
|
|
|
141
141
|
return statementUnifiesWithBracketedCombinator;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
function validateStatementAsEquality(statement,
|
|
144
|
+
function validateStatementAsEquality(statement, stated, context) {
|
|
145
145
|
let statementValidatesAsEquality = false;
|
|
146
146
|
|
|
147
|
-
|
|
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
|
-
|
|
156
|
+
equality = equality.validate(stated, context); ///
|
|
155
157
|
|
|
156
|
-
|
|
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,
|
|
170
|
+
function validateStatementAsJudgement(statement, stated, context) {
|
|
167
171
|
let validatesStatementAsJudgement = false;
|
|
168
172
|
|
|
169
|
-
|
|
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
|
-
|
|
182
|
+
judgement = judgement.validate(stated, context); ///
|
|
177
183
|
|
|
178
|
-
|
|
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,
|
|
196
|
+
function validateStatementAsTypeAssertion(statement, stated, context) {
|
|
189
197
|
let validatesStatementAsTypeAssertion = false;
|
|
190
198
|
|
|
191
|
-
|
|
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
|
-
|
|
208
|
+
typeAssertion = typeAssertion.validate(stated, context); ///
|
|
199
209
|
|
|
200
|
-
|
|
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,
|
|
222
|
+
function validateStatementAsDefinedAssertion(statement, stated, context) {
|
|
215
223
|
let validatesStatementAsDefinedAssertion = false;
|
|
216
224
|
|
|
217
|
-
|
|
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
|
-
|
|
234
|
+
definedAssertion = definedAssertion.validate(stated, context); ///
|
|
225
235
|
|
|
226
|
-
|
|
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,
|
|
248
|
+
function validateStatementAsPropertyAssertion(statement, stated, context) {
|
|
241
249
|
let statementValidatesAsPropertyAssertion = false;
|
|
242
250
|
|
|
243
|
-
|
|
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
|
-
|
|
260
|
+
propertyAssertion = propertyAssertion.validate(stated, context); ///
|
|
251
261
|
|
|
252
|
-
|
|
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,
|
|
274
|
+
function validateStatementAsSubproofAssertion(statement, stated, context) {
|
|
267
275
|
let statementValidatesAsSubproofAssertion = false;
|
|
268
276
|
|
|
269
|
-
|
|
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
|
-
|
|
286
|
+
subproofAssertion = subproofAssertion.validate(stated, context); ///
|
|
277
287
|
|
|
278
|
-
|
|
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,
|
|
300
|
+
function validateStatementAsContainedAssertion(statement, stated, context) {
|
|
293
301
|
let validatesStatementAsContainedAssertion = false;
|
|
294
302
|
|
|
295
|
-
|
|
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
|
-
|
|
312
|
+
containedAssertion = containedAssertion.validate(stated, context); ///
|
|
303
313
|
|
|
304
|
-
|
|
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,
|
|
326
|
+
function validateStatementAsSatisfiesAssertion(statement, stated, context) {
|
|
319
327
|
let validatesAStatementsSatisfiesAssertion = false;
|
|
320
328
|
|
|
321
|
-
|
|
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
|
-
|
|
338
|
+
satisfiesAssertion = satisfiesAssertion.validate(stated, context); ///
|
|
329
339
|
|
|
330
|
-
|
|
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
|
}
|