occam-verify-cli 0.0.1190 → 0.0.1192
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/combinator.js +2 -2
- package/lib/dom/frame.js +30 -16
- package/lib/dom/parameter.js +141 -0
- package/lib/dom/procedureCall.js +52 -3
- package/lib/dom/statement.js +47 -18
- package/lib/dom/term.js +16 -3
- package/lib/index.js +2 -1
- package/package.json +2 -2
- package/src/combinator.js +2 -1
- package/src/dom/frame.js +46 -31
- package/src/dom/parameter.js +58 -0
- package/src/dom/procedureCall.js +18 -2
- package/src/dom/statement.js +83 -36
- package/src/dom/term.js +21 -2
- package/src/index.js +1 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import dom from "../dom";
|
|
4
|
+
|
|
5
|
+
import { domAssigned } from "../dom";
|
|
6
|
+
|
|
7
|
+
export default domAssigned(class Parameter {
|
|
8
|
+
constructor(term, frame, statement) {
|
|
9
|
+
this.term = term;
|
|
10
|
+
this.frame = frame;
|
|
11
|
+
this.statement = statement;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getTerm() {
|
|
15
|
+
return this.term;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getFrame() {
|
|
19
|
+
return this.frame;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
getStatement() {
|
|
23
|
+
return this.statement;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
verify(assignments, stated, context) {
|
|
27
|
+
let verified = false;
|
|
28
|
+
|
|
29
|
+
const parameterString = this.string; ///
|
|
30
|
+
|
|
31
|
+
context.trace(`Verifying the '${parameterString}' parameter...`);
|
|
32
|
+
|
|
33
|
+
debugger
|
|
34
|
+
|
|
35
|
+
if (verified) {
|
|
36
|
+
context.debug(`...verified the '${parameterString}' parameter.`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return verified;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static name = "Parameter";
|
|
43
|
+
|
|
44
|
+
static fromParameterNode(parameterNode, context) {
|
|
45
|
+
let parameter = null;
|
|
46
|
+
|
|
47
|
+
if (parameterNode !== null) {
|
|
48
|
+
const { Term, Frame, Statement } = dom,
|
|
49
|
+
term = Term.fromParameterNode(parameterNode, context),
|
|
50
|
+
frame = Frame.fromParameterNode(parameterNode, context),
|
|
51
|
+
statement = Statement.fromParameterNode(parameterNode, context);
|
|
52
|
+
|
|
53
|
+
parameter = new Parameter(term, frame, statement);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return parameter;
|
|
57
|
+
}
|
|
58
|
+
});
|
package/src/dom/procedureCall.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import dom from "../dom";
|
|
4
|
+
|
|
4
5
|
import { domAssigned } from "../dom";
|
|
6
|
+
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
5
7
|
|
|
6
8
|
const parameterNodesQuery = nodesQuery("/procedureCall/parameter"),
|
|
7
9
|
procedureCallNodeQuery = nodeQuery("/statement/procedureCall");
|
|
@@ -44,9 +46,23 @@ export default domAssigned(class ProcedureCall {
|
|
|
44
46
|
const procedureCallNode = procedureCallNodeQuery(statementNode);
|
|
45
47
|
|
|
46
48
|
if (procedureCallNode !== null) {
|
|
47
|
-
|
|
49
|
+
const parameters = parametersFromProcedureCallNode(procedureCallNode, context);
|
|
50
|
+
|
|
51
|
+
procedureCall = new ProcedureCall(parameters);
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
return procedureCall;
|
|
51
55
|
}
|
|
52
56
|
});
|
|
57
|
+
|
|
58
|
+
function parametersFromProcedureCallNode(procedureCallNode, context) {
|
|
59
|
+
const { Parameter } = dom,
|
|
60
|
+
parameterNodes = parameterNodesQuery(procedureCallNode),
|
|
61
|
+
parameters = parameterNodes.map((parameterNode) => {
|
|
62
|
+
const parameter = Parameter.fromParameterNode(parameterNode, context);
|
|
63
|
+
|
|
64
|
+
return parameter;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return parameters;
|
|
68
|
+
}
|
package/src/dom/statement.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
import dom from "../dom";
|
|
6
|
+
import LocalContext from "../context/local";
|
|
6
7
|
import verifyMixins from "../mixins/statement/verify";
|
|
7
8
|
import combinatorVerifier from "../verifier/combinator";
|
|
8
9
|
import StatementPartialContext from "../context/partial/statement";
|
|
@@ -15,9 +16,15 @@ import { definedAssertionFromStatement, subproofAssertionFromStatement, containe
|
|
|
15
16
|
|
|
16
17
|
const { match, backwardsSome } = arrayUtilities;
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const statementTermNodesQuery = nodesQuery("/statement//term"),
|
|
20
|
+
statementFrameNodesQuery = nodesQuery("/statement//frame"),
|
|
21
|
+
premiseStatementNodeQuery = nodeQuery("/premise/statement"),
|
|
22
|
+
parameterStatementNodeQuery = nodeQuery("/parameter/statement"),
|
|
23
|
+
proofStepStatementNodeQuery = nodeQuery("/proofStep/statement"),
|
|
24
|
+
conclusionStatementNodeQuery = nodeQuery("/conclusion/statement"),
|
|
25
|
+
consequentStatementNodeQuery = nodeQuery("/consequent/statement"),
|
|
26
|
+
suppositionStatementNodeQuery = nodeQuery("/supposition/statement"),
|
|
27
|
+
containedAssertionStatementNodeQuery = nodeQuery("/containedAssertion/statement");
|
|
21
28
|
|
|
22
29
|
export default domAssigned(class Statement {
|
|
23
30
|
constructor(string, node, tokens) {
|
|
@@ -294,78 +301,118 @@ export default domAssigned(class Statement {
|
|
|
294
301
|
}
|
|
295
302
|
|
|
296
303
|
static fromPremiseNode(premiseNode, fileContext) {
|
|
297
|
-
|
|
298
|
-
|
|
304
|
+
let statement = null;
|
|
305
|
+
|
|
306
|
+
const premiseStatementNode = premiseStatementNodeQuery(premiseNode);
|
|
307
|
+
|
|
308
|
+
if (premiseStatementNode !== null) {
|
|
309
|
+
const statementNode = premiseStatementNode, ///
|
|
310
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
311
|
+
context = localContext; ///
|
|
312
|
+
|
|
313
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
314
|
+
}
|
|
299
315
|
|
|
300
316
|
return statement;
|
|
301
317
|
}
|
|
302
318
|
|
|
303
319
|
static fromProofStepNode(proofStepNode, fileContext) {
|
|
304
|
-
|
|
305
|
-
|
|
320
|
+
let statement = null;
|
|
321
|
+
|
|
322
|
+
const proofStepStatementNode = proofStepStatementNodeQuery(proofStepNode);
|
|
323
|
+
|
|
324
|
+
if (proofStepStatementNode !== null) {
|
|
325
|
+
const statementNode = proofStepStatementNode; ///
|
|
326
|
+
|
|
327
|
+
statement = statementFromStatementNode(statementNode, fileContext);
|
|
328
|
+
}
|
|
306
329
|
|
|
307
330
|
return statement;
|
|
308
331
|
}
|
|
309
332
|
|
|
310
333
|
static fromStatementNode(statementNode, context) {
|
|
334
|
+
const statement = statementFromStatementNode(statementNode, context);
|
|
335
|
+
|
|
336
|
+
return statement;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
static fromParameterNode(parameterNode, context) {
|
|
311
340
|
let statement = null;
|
|
312
341
|
|
|
313
|
-
|
|
314
|
-
const node = statementNode, ///
|
|
315
|
-
tokens = context.nodeAsTokens(node),
|
|
316
|
-
string = context.tokensAsString(tokens);
|
|
342
|
+
const parameterStatementNode = parameterStatementNodeQuery(parameterNode);
|
|
317
343
|
|
|
318
|
-
|
|
344
|
+
if (parameterStatementNode !== null) {
|
|
345
|
+
const statementNode = parameterStatementNode; ///
|
|
346
|
+
|
|
347
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
319
348
|
}
|
|
320
349
|
|
|
321
350
|
return statement;
|
|
322
351
|
}
|
|
323
352
|
|
|
324
353
|
static fromConclusionNode(conclusionNode, fileContext) {
|
|
325
|
-
|
|
326
|
-
|
|
354
|
+
let statement = null;
|
|
355
|
+
|
|
356
|
+
const conclusionStatementNode = conclusionStatementNodeQuery(conclusionNode);
|
|
357
|
+
|
|
358
|
+
if (conclusionStatementNode !== null) {
|
|
359
|
+
const statementNode = conclusionStatementNode, ///
|
|
360
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
361
|
+
context = localContext; ///
|
|
362
|
+
|
|
363
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
364
|
+
}
|
|
327
365
|
|
|
328
366
|
return statement;
|
|
329
367
|
}
|
|
330
368
|
|
|
331
369
|
static fromConsequentNode(consequentNode, fileContext) {
|
|
332
|
-
|
|
333
|
-
|
|
370
|
+
let statement = null;
|
|
371
|
+
|
|
372
|
+
const consequentStatementNode = consequentStatementNodeQuery(consequentNode);
|
|
373
|
+
|
|
374
|
+
if (consequentStatementNode !== null) {
|
|
375
|
+
const statementNode = consequentStatementNode, ///
|
|
376
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
377
|
+
context = localContext; ///
|
|
378
|
+
|
|
379
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
380
|
+
}
|
|
334
381
|
|
|
335
382
|
return statement;
|
|
336
383
|
}
|
|
337
384
|
|
|
338
385
|
static fromSuppositionNode(suppositionNode, fileContext) {
|
|
339
|
-
|
|
340
|
-
|
|
386
|
+
let statement = null;
|
|
387
|
+
|
|
388
|
+
const suppositionStatementNode = suppositionStatementNodeQuery(suppositionNode);
|
|
389
|
+
|
|
390
|
+
if (suppositionStatementNode !== null) {
|
|
391
|
+
const statementNode = suppositionStatementNode, ///
|
|
392
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
393
|
+
context = localContext; ///
|
|
394
|
+
|
|
395
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
396
|
+
}
|
|
341
397
|
|
|
342
398
|
return statement;
|
|
343
399
|
}
|
|
344
400
|
|
|
345
401
|
static fromContainedAssertionNode(containedAssertionNode, context) {
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
string = context.tokensAsString(tokens),
|
|
350
|
-
statement = new Statement(string, node, tokens);
|
|
402
|
+
const containedAssertionStatementNode = containedAssertionStatementNodeQuery(containedAssertionNode),
|
|
403
|
+
statementNode = containedAssertionStatementNode, ///
|
|
404
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
351
405
|
|
|
352
406
|
return statement;
|
|
353
407
|
}
|
|
354
408
|
});
|
|
355
409
|
|
|
356
|
-
function
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
const { Statement } = dom,
|
|
363
|
-
node = statementNode, ///
|
|
364
|
-
tokens = fileContext.nodeAsTokens(node),
|
|
365
|
-
string = fileContext.tokensAsString(tokens);
|
|
366
|
-
|
|
367
|
-
statement = new Statement(string, node, tokens);
|
|
368
|
-
}
|
|
410
|
+
function statementFromStatementNode(statementNode, context) {
|
|
411
|
+
const { Statement } = dom,
|
|
412
|
+
node = statementNode, ///
|
|
413
|
+
tokens = context.nodeAsTokens(node),
|
|
414
|
+
string = context.tokensAsString(tokens),
|
|
415
|
+
statement = new Statement(string, node, tokens);
|
|
369
416
|
|
|
370
417
|
return statement;
|
|
371
418
|
}
|
package/src/dom/term.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
import dom from "../dom";
|
|
6
|
+
import LocalContext from "../context/local";
|
|
6
7
|
import verifyMixins from "../mixins/term/verify";
|
|
7
8
|
import constructorVerifier from "../verifier/constructor";
|
|
8
9
|
|
|
@@ -15,7 +16,8 @@ import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
|
15
16
|
const { filter, compress } = arrayUtilities;
|
|
16
17
|
|
|
17
18
|
const variableNodesQuery = nodesQuery("//variable"),
|
|
18
|
-
termVariableNodeQuery = nodeQuery("/*/term[0]/variable!")
|
|
19
|
+
termVariableNodeQuery = nodeQuery("/*/term[0]/variable!"),
|
|
20
|
+
parameterTermNodeQuery = nodeQuery("/parameter/term");
|
|
19
21
|
|
|
20
22
|
export default domAssigned(class Term {
|
|
21
23
|
constructor(string, node, type) {
|
|
@@ -243,7 +245,8 @@ export default domAssigned(class Term {
|
|
|
243
245
|
|
|
244
246
|
static fromJSON(json, fileContext) {
|
|
245
247
|
const { string } = json,
|
|
246
|
-
|
|
248
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
249
|
+
context = localContext, ///
|
|
247
250
|
termString = string, ///
|
|
248
251
|
termNode = termNodeFromTermString(termString, context),
|
|
249
252
|
node = termNode, ///
|
|
@@ -267,6 +270,22 @@ export default domAssigned(class Term {
|
|
|
267
270
|
return term;
|
|
268
271
|
}
|
|
269
272
|
|
|
273
|
+
static fromParameterNode(parameterNode, context) {
|
|
274
|
+
let term = null;
|
|
275
|
+
|
|
276
|
+
const parameterTermNode = parameterTermNodeQuery(parameterNode);
|
|
277
|
+
|
|
278
|
+
if (parameterTermNode !== null) {
|
|
279
|
+
const node = parameterTermNode, ///
|
|
280
|
+
string = context.nodeAsString(node),
|
|
281
|
+
type = null;
|
|
282
|
+
|
|
283
|
+
term = new Term(string, node, type);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return term;
|
|
287
|
+
}
|
|
288
|
+
|
|
270
289
|
static fromTermNodeAndType(termNode, type, context) {
|
|
271
290
|
const node = termNode, ///
|
|
272
291
|
string = context.nodeAsString(node),
|
package/src/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import Equality from "./dom/equality";
|
|
|
15
15
|
import MetaType from "./dom/metaType";
|
|
16
16
|
import Subproof from "./dom/subproof";
|
|
17
17
|
import Variable from "./dom/variable";
|
|
18
|
+
import Parameter from "./dom/parameter";
|
|
18
19
|
import ProofStep from "./dom/proofStep";
|
|
19
20
|
import Reference from "./dom/reference";
|
|
20
21
|
import Statement from "./dom/statement";
|