occam-verify-cli 0.0.1229 → 0.0.1232
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/dom/parameter.js +17 -1
- package/lib/dom/premise.js +46 -9
- package/lib/dom/procedureCall.js +37 -7
- package/lib/dom/reference.js +3 -4
- package/lib/dom/statement.js +3 -7
- package/lib/dom/supposition.js +46 -9
- package/lib/mixins/statement/verify.js +1 -16
- package/lib/utilities/json.js +66 -6
- package/lib/utilities/verification.js +1 -9
- package/package.json +5 -5
- package/src/dom/parameter.js +16 -0
- package/src/dom/premise.js +59 -12
- package/src/dom/procedureCall.js +47 -4
- package/src/dom/reference.js +1 -3
- package/src/dom/statement.js +3 -10
- package/src/dom/supposition.js +59 -12
- package/src/mixins/statement/verify.js +0 -24
- package/src/utilities/json.js +78 -6
- package/src/utilities/verification.js +0 -10
package/src/dom/statement.js
CHANGED
|
@@ -12,7 +12,7 @@ import { domAssigned } from "../dom";
|
|
|
12
12
|
import { unifyStatement } from "../utilities/unification";
|
|
13
13
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
14
14
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
15
|
-
import {
|
|
15
|
+
import { definedAssertionFromStatement, subproofAssertionFromStatement, containedAssertionFromStatement } from "../utilities/verification";
|
|
16
16
|
|
|
17
17
|
const { match, backwardsSome } = arrayUtilities;
|
|
18
18
|
|
|
@@ -170,21 +170,14 @@ export default domAssigned(class Statement {
|
|
|
170
170
|
const context = specificContext, ///
|
|
171
171
|
statement = this; ///
|
|
172
172
|
|
|
173
|
-
const
|
|
174
|
-
definedAssertion = definedAssertionFromStatement(statement, context),
|
|
173
|
+
const definedAssertion = definedAssertionFromStatement(statement, context),
|
|
175
174
|
containedAssertion = containedAssertionFromStatement(statement, context);
|
|
176
175
|
|
|
177
|
-
if ((
|
|
176
|
+
if ((definedAssertion !== null) || (containedAssertion !== null)) {
|
|
178
177
|
const statementString = this.string;
|
|
179
178
|
|
|
180
179
|
specificContext.trace(`Unifying the '${statementString}' statement independently...`);
|
|
181
180
|
|
|
182
|
-
if (procedureCall !== null) {
|
|
183
|
-
const procedureCallUnifiedIndependently = procedureCall.unifyIndependently(substitutions, context);
|
|
184
|
-
|
|
185
|
-
unifiedIndependently = procedureCallUnifiedIndependently; ///
|
|
186
|
-
}
|
|
187
|
-
|
|
188
181
|
if (definedAssertion !== null) {
|
|
189
182
|
const definedAssertionUnifiedIndependently = definedAssertion.unifyIndependently(substitutions, context);
|
|
190
183
|
|
package/src/dom/supposition.js
CHANGED
|
@@ -5,12 +5,13 @@ import dom from "../dom";
|
|
|
5
5
|
import { domAssigned } from "../dom";
|
|
6
6
|
import { assignAssignments } from "../utilities/assignments";
|
|
7
7
|
import { subproofAssertionFromStatement } from "../utilities/verification";
|
|
8
|
-
import { statementFromJSON, statementToStatementJSON } from "../utilities/json";
|
|
8
|
+
import { statementFromJSON, procedureCallFromJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../utilities/json";
|
|
9
9
|
|
|
10
10
|
export default domAssigned(class Supposition {
|
|
11
|
-
constructor(string, statement) {
|
|
11
|
+
constructor(string, statement, procedureCall) {
|
|
12
12
|
this.string = string;
|
|
13
13
|
this.statement = statement;
|
|
14
|
+
this.procedureCall = procedureCall;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
getString() {
|
|
@@ -21,12 +22,24 @@ export default domAssigned(class Supposition {
|
|
|
21
22
|
return this.statement;
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
getProcedureCall() {
|
|
26
|
+
return this.procedureCall;
|
|
27
|
+
}
|
|
28
|
+
|
|
24
29
|
unifyIndependently(substitutions, generalContext, specificContext) {
|
|
25
30
|
let unifiedIndependently;
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
if (this.statesment !== null) {
|
|
33
|
+
const statementResolvedIndependently = this.statement.unifyIndependently(substitutions, generalContext, specificContext);
|
|
34
|
+
|
|
35
|
+
unifiedIndependently = statementResolvedIndependently; ///
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (this.procedureCall !== null) {
|
|
39
|
+
const procedureCallResolvedIndependently = this.procedureCall.unifyIndependently(substitutions, generalContext, specificContext);
|
|
28
40
|
|
|
29
|
-
|
|
41
|
+
unifiedIndependently = procedureCallResolvedIndependently; ///
|
|
42
|
+
}
|
|
30
43
|
|
|
31
44
|
return unifiedIndependently;
|
|
32
45
|
}
|
|
@@ -129,7 +142,9 @@ export default domAssigned(class Supposition {
|
|
|
129
142
|
|
|
130
143
|
context.trace(`Verifying the '${suppositionString}' supposition...`);
|
|
131
144
|
|
|
132
|
-
if (
|
|
145
|
+
if (false) {
|
|
146
|
+
///
|
|
147
|
+
} else if (this.statement !== null) {
|
|
133
148
|
const stated = true,
|
|
134
149
|
assignments = [],
|
|
135
150
|
statementVerified = this.statement.verify(assignments, stated, context);
|
|
@@ -147,6 +162,14 @@ export default domAssigned(class Supposition {
|
|
|
147
162
|
verified = true;
|
|
148
163
|
}
|
|
149
164
|
}
|
|
165
|
+
} else if (this.procedureCall !== null) {
|
|
166
|
+
const stated = true,
|
|
167
|
+
assignments = null,
|
|
168
|
+
procedureCallVerified = this.procedureCall.verify(assignments, stated, context);
|
|
169
|
+
|
|
170
|
+
if (procedureCallVerified) {
|
|
171
|
+
verified = true;
|
|
172
|
+
}
|
|
150
173
|
} else {
|
|
151
174
|
context.debug(`Unable to verify the '${suppositionString}' supposition because it is nonsense.`);
|
|
152
175
|
}
|
|
@@ -160,9 +183,12 @@ export default domAssigned(class Supposition {
|
|
|
160
183
|
|
|
161
184
|
toJSON() {
|
|
162
185
|
const statementJSON = statementToStatementJSON(this.statement),
|
|
186
|
+
procedureCallJSON = procedureCallToProcedureCallJSON(this.procedureCall),
|
|
163
187
|
statement = statementJSON, ///
|
|
188
|
+
procedureCall = procedureCallJSON, ///
|
|
164
189
|
json = {
|
|
165
|
-
statement
|
|
190
|
+
statement,
|
|
191
|
+
procedureCall
|
|
166
192
|
};
|
|
167
193
|
|
|
168
194
|
return json;
|
|
@@ -172,18 +198,39 @@ export default domAssigned(class Supposition {
|
|
|
172
198
|
|
|
173
199
|
static fromJSON(json, fileContext) {
|
|
174
200
|
const statement = statementFromJSON(json, fileContext),
|
|
175
|
-
|
|
176
|
-
|
|
201
|
+
procedureCall = procedureCallFromJSON(json, fileContext);
|
|
202
|
+
|
|
203
|
+
let string;
|
|
204
|
+
|
|
205
|
+
if (statement !== null) {
|
|
206
|
+
string = statement.getString();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (procedureCall !== null) {
|
|
210
|
+
string = procedureCall.getString();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const supposition = new Supposition(string, statement, procedureCall);
|
|
177
214
|
|
|
178
215
|
return supposition;
|
|
179
216
|
}
|
|
180
217
|
|
|
181
218
|
static fromSuppositionNode(suppositionNode, fileContext) {
|
|
182
|
-
const { Statement } = dom,
|
|
219
|
+
const { Statement, ProcedureCall } = dom,
|
|
183
220
|
statement = Statement.fromSuppositionNode(suppositionNode, fileContext),
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
221
|
+
procedureCall = ProcedureCall.fromSuppositionNode(suppositionNode, fileContext);
|
|
222
|
+
|
|
223
|
+
let string;
|
|
224
|
+
|
|
225
|
+
if (statement !== null) {
|
|
226
|
+
string = statement.getString();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (procedureCall !== null) {
|
|
230
|
+
string = procedureCall.getString();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const supposition = new Supposition(string, statement, procedureCall);
|
|
187
234
|
|
|
188
235
|
return supposition
|
|
189
236
|
}
|
|
@@ -5,7 +5,6 @@ import BracketedCombinator from "../../combinator/bracketed";
|
|
|
5
5
|
import { equalityFromStatement,
|
|
6
6
|
judgementFromStatement,
|
|
7
7
|
metavariableFromStatement,
|
|
8
|
-
procedureCallFromStatement,
|
|
9
8
|
typeAssertionFromStatement,
|
|
10
9
|
definedAssertionFromStatement,
|
|
11
10
|
subproofAssertionFromStatement,
|
|
@@ -77,28 +76,6 @@ function verifyAsJudgement(statement, assignments, stated, context) {
|
|
|
77
76
|
return verifiedAsJudgement;
|
|
78
77
|
}
|
|
79
78
|
|
|
80
|
-
function verifyAsProcedureCall(statement, assignments, stated, context) {
|
|
81
|
-
let verifiedAsProcedureCall = false;
|
|
82
|
-
|
|
83
|
-
const procedureCall = procedureCallFromStatement(statement, context);
|
|
84
|
-
|
|
85
|
-
if (procedureCall !== null) {
|
|
86
|
-
const statementString = statement.getString();
|
|
87
|
-
|
|
88
|
-
context.trace(`Verifying the '${statementString}' statement as a procedure call...`);
|
|
89
|
-
|
|
90
|
-
const procedureCallVerified = procedureCall.verify(assignments, stated, context);
|
|
91
|
-
|
|
92
|
-
verifiedAsProcedureCall = procedureCallVerified; ///
|
|
93
|
-
|
|
94
|
-
if (verifiedAsProcedureCall) {
|
|
95
|
-
context.debug(`...verified the '${statementString}' statement as a procedure call.`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return verifiedAsProcedureCall;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
79
|
function verifyAsTypeAssertion(statement, assignments, stated, context) {
|
|
103
80
|
let verifiedAsTypeAssertion = false;
|
|
104
81
|
|
|
@@ -220,7 +197,6 @@ const verifyMixins = [
|
|
|
220
197
|
verifyAsEquality,
|
|
221
198
|
verifyAsJudgement,
|
|
222
199
|
verifyAsTypeAssertion,
|
|
223
|
-
verifyAsProcedureCall,
|
|
224
200
|
verifyAsDefinedAssertion,
|
|
225
201
|
verifyAsSubproofAssertion,
|
|
226
202
|
verifyAsContainedAssertion,
|
package/src/utilities/json.js
CHANGED
|
@@ -62,18 +62,33 @@ export function superTypeFromJSON(json, fileContext) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export function statementFromJSON(json, fileContext) {
|
|
65
|
-
let { statement } = json;
|
|
65
|
+
let { statement = null } = json;
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
if (statement !== null) {
|
|
68
|
+
const { Statement } = dom,
|
|
69
|
+
statementJSON = statement; ///
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
json = statementJSON; ///
|
|
71
72
|
|
|
72
|
-
|
|
73
|
+
statement = Statement.fromJSON(json, fileContext);
|
|
74
|
+
}
|
|
73
75
|
|
|
74
76
|
return statement;
|
|
75
77
|
}
|
|
76
78
|
|
|
79
|
+
export function referenceFromJSON(json, fileContext) {
|
|
80
|
+
let { reference } = json;
|
|
81
|
+
|
|
82
|
+
const { Reference } = dom,
|
|
83
|
+
referenceJSON = reference; ///
|
|
84
|
+
|
|
85
|
+
json = referenceJSON; ///
|
|
86
|
+
|
|
87
|
+
reference = Reference.fromJSON(json, fileContext);
|
|
88
|
+
|
|
89
|
+
return reference;
|
|
90
|
+
}
|
|
91
|
+
|
|
77
92
|
export function conclusionFromJSON(json, fileContext) {
|
|
78
93
|
let { conclusion } = json;
|
|
79
94
|
|
|
@@ -113,6 +128,21 @@ export function metavariableFromJSON(json, fileContext) {
|
|
|
113
128
|
return metavariable;
|
|
114
129
|
}
|
|
115
130
|
|
|
131
|
+
export function procedureCallFromJSON(json, fileContext) {
|
|
132
|
+
let { procedureCall = null } = json;
|
|
133
|
+
|
|
134
|
+
if (procedureCall !== null) {
|
|
135
|
+
const { ProcedureCall } = dom,
|
|
136
|
+
procedureCallJSON = procedureCall; ///
|
|
137
|
+
|
|
138
|
+
json = procedureCallJSON; ///
|
|
139
|
+
|
|
140
|
+
procedureCall = ProcedureCall.fromJSON(json, fileContext);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return procedureCall;
|
|
144
|
+
}
|
|
145
|
+
|
|
116
146
|
export function typesFromJSON(json, types, fileContext) {
|
|
117
147
|
const { types: typesJSON } = json;
|
|
118
148
|
|
|
@@ -222,6 +252,22 @@ export function variablesFromJSON(json, fileContext) {
|
|
|
222
252
|
return variables;
|
|
223
253
|
}
|
|
224
254
|
|
|
255
|
+
export function parametersFromJSON(json, fileContext) {
|
|
256
|
+
let { parameters } = json;
|
|
257
|
+
|
|
258
|
+
const { Parameter } = dom,
|
|
259
|
+
parametersJSON = parameters; ///
|
|
260
|
+
|
|
261
|
+
parameters = parametersJSON.map((parameterJSON) => {
|
|
262
|
+
const json = parameterJSON, ///
|
|
263
|
+
parameter = Parameter.fromJSON(json, fileContext);
|
|
264
|
+
|
|
265
|
+
return (parameter);
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
return parameters;
|
|
269
|
+
}
|
|
270
|
+
|
|
225
271
|
export function conjecturesFromJSON(json, fileContext) {
|
|
226
272
|
let { conjectures } = json;
|
|
227
273
|
|
|
@@ -372,7 +418,11 @@ export function superTypeToSuperTypeJSON(superType) {
|
|
|
372
418
|
}
|
|
373
419
|
|
|
374
420
|
export function statementToStatementJSON(statement) {
|
|
375
|
-
|
|
421
|
+
let statementJSON = null;
|
|
422
|
+
|
|
423
|
+
if (statement !== null) {
|
|
424
|
+
statementJSON = statement.toJSON();
|
|
425
|
+
}
|
|
376
426
|
|
|
377
427
|
return statementJSON;
|
|
378
428
|
}
|
|
@@ -395,6 +445,16 @@ export function metavariableToMetavariableJSON(metavariable) {
|
|
|
395
445
|
return metavariableJSON;
|
|
396
446
|
}
|
|
397
447
|
|
|
448
|
+
export function procedureCallToProcedureCallJSON(procedureCall) {
|
|
449
|
+
let procedureCallJSON = null;
|
|
450
|
+
|
|
451
|
+
if (procedureCall !== null) {
|
|
452
|
+
procedureCallJSON = procedureCall.toJSON();
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return procedureCallJSON;
|
|
456
|
+
}
|
|
457
|
+
|
|
398
458
|
export function typesToTypesJSON(types) {
|
|
399
459
|
const typesJSON = types.map((type) => {
|
|
400
460
|
const typeJSON = type.toJSON();
|
|
@@ -475,6 +535,18 @@ export function variablesToVariablesJSON(variables) {
|
|
|
475
535
|
return variablesJSON;
|
|
476
536
|
}
|
|
477
537
|
|
|
538
|
+
export function parametersToParametersJSON(parameters) {
|
|
539
|
+
const parametersJSON = parameters.map((parameter) => {
|
|
540
|
+
const parameterJSON = parameter.toJSON();
|
|
541
|
+
|
|
542
|
+
parameter = parameterJSON; ///
|
|
543
|
+
|
|
544
|
+
return parameter;
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
return parametersJSON;
|
|
548
|
+
}
|
|
549
|
+
|
|
478
550
|
export function conjecturesToConjecturesJSON(conjectures) {
|
|
479
551
|
const conjecturesJSON = conjectures.map((conjecture) => {
|
|
480
552
|
const conjectureJSON = conjecture.toJSON();
|
|
@@ -43,16 +43,6 @@ export function metavariableFromStatement(statement, context) {
|
|
|
43
43
|
return metavariable;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export function procedureCallFromStatement(statement, context) {
|
|
47
|
-
context = contextFromStatement(statement, context); ///
|
|
48
|
-
|
|
49
|
-
const { ProcedureCall } = dom,
|
|
50
|
-
statementNode = statement.getNode(),
|
|
51
|
-
procedureCall = ProcedureCall.fromStatementNode(statementNode, context);
|
|
52
|
-
|
|
53
|
-
return procedureCall;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
46
|
export function typeAssertionFromStatement(statement, context) {
|
|
57
47
|
context = contextFromStatement(statement, context); ///
|
|
58
48
|
|