occam-verify-cli 1.0.185 → 1.0.192
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/constants.js +5 -1
- package/lib/dom/assertion/property.js +2 -4
- package/lib/dom/assertion/subproof.js +3 -5
- package/lib/dom/assertion/type.js +6 -8
- package/lib/dom/axiom.js +15 -100
- package/lib/dom/conjecture.js +5 -4
- package/lib/dom/constructor/bracketed.js +6 -7
- package/lib/dom/declaration/complexType.js +6 -6
- package/lib/dom/declaration/metavariable.js +3 -5
- package/lib/dom/declaration/type.js +2 -2
- package/lib/dom/declaration.js +2 -4
- package/lib/dom/derivation.js +2 -4
- package/lib/dom/equality.js +9 -11
- package/lib/dom/frame.js +8 -12
- package/lib/dom/judgement.js +2 -4
- package/lib/dom/lemma.js +5 -4
- package/lib/dom/metaLemma.js +5 -4
- package/lib/dom/metaType.js +2 -4
- package/lib/dom/metatheorem.js +5 -4
- package/lib/dom/metavariable.js +12 -15
- package/lib/dom/parameter.js +2 -4
- package/lib/dom/procedureCall.js +6 -10
- package/lib/dom/proof.js +2 -4
- package/lib/dom/property.js +16 -51
- package/lib/dom/propertyRelation.js +8 -10
- package/lib/dom/reference.js +7 -11
- package/lib/dom/rule.js +6 -8
- package/lib/dom/statement.js +27 -31
- package/lib/dom/step.js +4 -6
- package/lib/dom/subDerivation.js +2 -4
- package/lib/dom/subproof.js +6 -8
- package/lib/dom/term.js +14 -20
- package/lib/dom/theorem.js +5 -4
- package/lib/dom/topLevelAssertion.js +30 -24
- package/lib/dom/topLevelMetaAssertion.js +5 -15
- package/lib/dom/type.js +8 -25
- package/lib/dom/variable.js +5 -11
- package/lib/node/assertion/contained.js +45 -58
- package/lib/node/assertion/defined.js +33 -58
- package/lib/node/assertion/property.js +33 -58
- package/lib/node/assertion/satisfies.js +21 -58
- package/lib/node/assertion/subproof.js +21 -58
- package/lib/node/assertion/type.js +33 -58
- package/lib/node/axiom.js +6 -52
- package/lib/node/combinator.js +6 -57
- package/lib/node/conclusion.js +21 -58
- package/lib/node/conjecture.js +6 -52
- package/lib/node/constructor.js +6 -57
- package/lib/node/declaration/combinator.js +13 -61
- package/lib/node/declaration/complexType.js +27 -75
- package/lib/node/declaration/constructor.js +24 -70
- package/lib/node/declaration/metavariable.js +40 -58
- package/lib/node/declaration/property.js +27 -72
- package/lib/node/declaration/type.js +23 -69
- package/lib/node/declaration/variable.js +28 -83
- package/lib/node/declaration.js +33 -58
- package/lib/node/deduction.js +21 -58
- package/lib/node/derivation.js +21 -58
- package/lib/node/equality.js +34 -58
- package/lib/node/error.js +6 -57
- package/lib/node/frame.js +52 -58
- package/lib/node/judgement.js +33 -58
- package/lib/node/label.js +21 -58
- package/lib/{node.js → node/labels.js} +25 -27
- package/lib/node/lemma.js +6 -52
- package/lib/node/metaLemma.js +6 -52
- package/lib/node/metaType.js +18 -60
- package/lib/node/metatheorem.js +6 -52
- package/lib/node/metavariable.js +40 -61
- package/lib/node/parameter.js +22 -58
- package/lib/node/parenthesisedLabels.js +123 -0
- package/lib/node/premise.js +33 -58
- package/lib/node/procedureCall.js +33 -58
- package/lib/node/proof.js +21 -58
- package/lib/node/property.js +18 -62
- package/lib/node/propertyRelation.js +40 -58
- package/lib/node/reference.js +21 -58
- package/lib/node/rule.js +6 -52
- package/lib/node/statement.js +105 -58
- package/lib/node/step.js +47 -58
- package/lib/node/subDerivation.js +21 -58
- package/lib/node/subproof.js +47 -58
- package/lib/node/supposition.js +33 -58
- package/lib/node/term.js +57 -58
- package/lib/node/theorem.js +6 -52
- package/lib/node/topLevelAssertion.js +86 -59
- package/lib/node/topLevelMetaAssertion.js +65 -59
- package/lib/node/type.js +14 -60
- package/lib/node/variable.js +14 -60
- package/lib/nominal/parser.js +3 -3
- package/lib/nonTerminalNodeMap.js +5 -3
- package/lib/ruleNames.js +10 -2
- package/lib/utilities/node.js +283 -7
- package/lib/utilities/type.js +16 -4
- package/lib/verifier/topLevel.js +6 -6
- package/package.json +2 -2
- package/src/constants.js +1 -0
- package/src/dom/assertion/property.js +1 -4
- package/src/dom/assertion/subproof.js +2 -6
- package/src/dom/assertion/type.js +7 -10
- package/src/dom/axiom.js +7 -77
- package/src/dom/conjecture.js +6 -1
- package/src/dom/constructor/bracketed.js +6 -8
- package/src/dom/declaration/complexType.js +7 -6
- package/src/dom/declaration/metavariable.js +2 -6
- package/src/dom/declaration/type.js +4 -2
- package/src/dom/declaration.js +1 -5
- package/src/dom/derivation.js +1 -4
- package/src/dom/equality.js +13 -17
- package/src/dom/frame.js +7 -19
- package/src/dom/judgement.js +1 -4
- package/src/dom/lemma.js +6 -1
- package/src/dom/metaLemma.js +6 -1
- package/src/dom/metaType.js +1 -5
- package/src/dom/metatheorem.js +6 -1
- package/src/dom/metavariable.js +11 -25
- package/src/dom/parameter.js +2 -6
- package/src/dom/procedureCall.js +5 -14
- package/src/dom/proof.js +1 -4
- package/src/dom/property.js +21 -78
- package/src/dom/propertyRelation.js +10 -14
- package/src/dom/reference.js +6 -18
- package/src/dom/rule.js +6 -12
- package/src/dom/statement.js +26 -46
- package/src/dom/step.js +3 -5
- package/src/dom/subDerivation.js +1 -4
- package/src/dom/subproof.js +8 -12
- package/src/dom/term.js +16 -32
- package/src/dom/theorem.js +6 -1
- package/src/dom/topLevelAssertion.js +30 -25
- package/src/dom/topLevelMetaAssertion.js +16 -28
- package/src/dom/type.js +9 -35
- package/src/dom/variable.js +4 -12
- package/src/node/assertion/contained.js +41 -3
- package/src/node/assertion/defined.js +29 -3
- package/src/node/assertion/property.js +29 -3
- package/src/node/assertion/satisfies.js +17 -3
- package/src/node/assertion/subproof.js +17 -3
- package/src/node/assertion/type.js +29 -3
- package/src/node/axiom.js +3 -3
- package/src/node/combinator.js +3 -3
- package/src/node/conclusion.js +17 -3
- package/src/node/conjecture.js +3 -3
- package/src/node/constructor.js +3 -3
- package/src/node/declaration/combinator.js +11 -7
- package/src/node/declaration/complexType.js +25 -24
- package/src/node/declaration/constructor.js +22 -17
- package/src/node/declaration/metavariable.js +36 -3
- package/src/node/declaration/property.js +21 -17
- package/src/node/declaration/type.js +22 -17
- package/src/node/declaration/variable.js +24 -32
- package/src/node/declaration.js +29 -3
- package/src/node/deduction.js +17 -3
- package/src/node/derivation.js +18 -3
- package/src/node/equality.js +31 -3
- package/src/node/error.js +3 -3
- package/src/node/frame.js +53 -3
- package/src/node/judgement.js +29 -3
- package/src/node/label.js +17 -3
- package/src/node/labels.js +21 -0
- package/src/node/lemma.js +3 -3
- package/src/node/metaLemma.js +3 -3
- package/src/node/metaType.js +19 -8
- package/src/node/metatheorem.js +3 -3
- package/src/node/metavariable.js +42 -9
- package/src/node/parameter.js +20 -3
- package/src/node/parenthesisedLabels.js +28 -0
- package/src/node/premise.js +29 -3
- package/src/node/procedureCall.js +29 -3
- package/src/node/proof.js +17 -3
- package/src/node/property.js +18 -12
- package/src/node/propertyRelation.js +35 -3
- package/src/node/reference.js +17 -3
- package/src/node/rule.js +3 -3
- package/src/node/statement.js +108 -3
- package/src/node/step.js +41 -3
- package/src/node/subDerivation.js +18 -3
- package/src/node/subproof.js +41 -3
- package/src/node/supposition.js +29 -3
- package/src/node/term.js +62 -3
- package/src/node/theorem.js +3 -3
- package/src/node/topLevelAssertion.js +89 -3
- package/src/node/topLevelMetaAssertion.js +59 -3
- package/src/node/type.js +15 -8
- package/src/node/variable.js +15 -8
- package/src/nominal/parser.js +1 -1
- package/src/nonTerminalNodeMap.js +9 -3
- package/src/ruleNames.js +3 -1
- package/src/utilities/node.js +147 -6
- package/src/utilities/type.js +9 -0
- package/src/verifier/topLevel.js +5 -10
- package/lib/defaultTerminalNode.js +0 -20
- package/lib/mixins/node.js +0 -145
- package/src/defaultTerminalNode.js +0 -7
- package/src/mixins/node.js +0 -201
- package/src/node.js +0 -29
package/src/dom/statement.js
CHANGED
|
@@ -8,7 +8,6 @@ import StatementPartialContext from "../context/partial/statement";
|
|
|
8
8
|
|
|
9
9
|
import { domAssigned } from "../dom";
|
|
10
10
|
import { unifyStatement } from "../utilities/unification";
|
|
11
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
11
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
13
12
|
import { statementFromStatementNode } from "../utilities/node";
|
|
14
13
|
import { stripBracketsFromStatementNode } from "../utilities/brackets";
|
|
@@ -16,16 +15,6 @@ import { definedAssertionFromStatement, containedAssertionFromStatement, subproo
|
|
|
16
15
|
|
|
17
16
|
const { match, backwardsSome } = arrayUtilities;
|
|
18
17
|
|
|
19
|
-
const stepStatementNodeQuery = nodeQuery("/step/statement"),
|
|
20
|
-
statementTermNodesQuery = nodesQuery("/statement//term"),
|
|
21
|
-
statementFrameNodesQuery = nodesQuery("/statement//frame"),
|
|
22
|
-
premiseStatementNodeQuery = nodeQuery("/premise/statement"),
|
|
23
|
-
deductionStatementNodeQuery = nodeQuery("/deduction/statement"),
|
|
24
|
-
conclusionStatementNodeQuery = nodeQuery("/conclusion/statement"),
|
|
25
|
-
suppositionStatementNodeQuery = nodeQuery("/supposition/statement"),
|
|
26
|
-
declarationStatementNodeQuery = nodeQuery("/declaration/statement"),
|
|
27
|
-
containedAssertionStatementNodeQuery = nodeQuery("/containedAssertion/statement");
|
|
28
|
-
|
|
29
18
|
export default domAssigned(class Statement {
|
|
30
19
|
constructor(string, node, tokens) {
|
|
31
20
|
this.string = string;
|
|
@@ -62,12 +51,12 @@ export default domAssigned(class Statement {
|
|
|
62
51
|
|
|
63
52
|
const termNode = term.getNode(),
|
|
64
53
|
statementNode = this.node,
|
|
65
|
-
|
|
54
|
+
statementNodeTermNodes = statementNode.getTermNodes();
|
|
66
55
|
|
|
67
|
-
termContained =
|
|
68
|
-
const
|
|
56
|
+
termContained = statementNodeTermNodes.some((statementNodeTermNode) => { ///
|
|
57
|
+
const termNodeMatchesStatementNodeTermNode = termNode.match(statementNodeTermNode);
|
|
69
58
|
|
|
70
|
-
if (
|
|
59
|
+
if (termNodeMatchesStatementNodeTermNode) {
|
|
71
60
|
return true;
|
|
72
61
|
}
|
|
73
62
|
});
|
|
@@ -89,12 +78,12 @@ export default domAssigned(class Statement {
|
|
|
89
78
|
|
|
90
79
|
const frameNode = frame.getNode(),
|
|
91
80
|
statementNode = this.node,
|
|
92
|
-
|
|
81
|
+
statementNodeFrameNodes = statementNode.getFrameNodes();
|
|
93
82
|
|
|
94
|
-
frameContained =
|
|
95
|
-
const
|
|
83
|
+
frameContained = statementNodeFrameNodes.some((statementNodeFrameNode) => { ///
|
|
84
|
+
const frameNodeMatchesStatementNodeFrameNode = frameNode.match(statementNodeFrameNode);
|
|
96
85
|
|
|
97
|
-
if (
|
|
86
|
+
if (frameNodeMatchesStatementNodeFrameNode) {
|
|
98
87
|
return true;
|
|
99
88
|
}
|
|
100
89
|
});
|
|
@@ -276,11 +265,9 @@ export default domAssigned(class Statement {
|
|
|
276
265
|
static fromStepNode(stepNode, fileContext) {
|
|
277
266
|
let statement = null;
|
|
278
267
|
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
if (stepStatementNode !== null) {
|
|
282
|
-
const statementNode = stepStatementNode; ///
|
|
268
|
+
const statementNode = stepNode.getStatementNode();
|
|
283
269
|
|
|
270
|
+
if (statementNode !== null) {
|
|
284
271
|
statement = statementFromStatementNode(statementNode, fileContext);
|
|
285
272
|
}
|
|
286
273
|
|
|
@@ -290,11 +277,10 @@ export default domAssigned(class Statement {
|
|
|
290
277
|
static fromPremiseNode(premiseNode, fileContext) {
|
|
291
278
|
let statement = null;
|
|
292
279
|
|
|
293
|
-
const
|
|
280
|
+
const statementNode = premiseNode.getStatementNode();
|
|
294
281
|
|
|
295
|
-
if (
|
|
296
|
-
const
|
|
297
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
282
|
+
if (statementNode !== null) {
|
|
283
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
298
284
|
context = localContext; ///
|
|
299
285
|
|
|
300
286
|
statement = statementFromStatementNode(statementNode, context);
|
|
@@ -312,11 +298,10 @@ export default domAssigned(class Statement {
|
|
|
312
298
|
static fromDeductionNode(deductionNode, fileContext) {
|
|
313
299
|
let statement = null;
|
|
314
300
|
|
|
315
|
-
const
|
|
301
|
+
const statementNode = deductionNode.getStatementNode();
|
|
316
302
|
|
|
317
|
-
if (
|
|
318
|
-
const
|
|
319
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
303
|
+
if (statementNode !== null) {
|
|
304
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
320
305
|
context = localContext; ///
|
|
321
306
|
|
|
322
307
|
statement = statementFromStatementNode(statementNode, context);
|
|
@@ -328,11 +313,10 @@ export default domAssigned(class Statement {
|
|
|
328
313
|
static fromConclusionNode(conclusionNode, fileContext) {
|
|
329
314
|
let statement = null;
|
|
330
315
|
|
|
331
|
-
const
|
|
316
|
+
const statementNode = conclusionNode.getStatementNode();
|
|
332
317
|
|
|
333
|
-
if (
|
|
334
|
-
const
|
|
335
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
318
|
+
if (statementNode !== null) {
|
|
319
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
336
320
|
context = localContext; ///
|
|
337
321
|
|
|
338
322
|
statement = statementFromStatementNode(statementNode, context);
|
|
@@ -344,11 +328,10 @@ export default domAssigned(class Statement {
|
|
|
344
328
|
static fromSuppositionNode(suppositionNode, fileContext) {
|
|
345
329
|
let statement = null;
|
|
346
330
|
|
|
347
|
-
const
|
|
331
|
+
const statementNode = suppositionNode.getStatementNode();
|
|
348
332
|
|
|
349
|
-
if (
|
|
350
|
-
const
|
|
351
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
333
|
+
if (statementNode !== null) {
|
|
334
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
352
335
|
context = localContext; ///
|
|
353
336
|
|
|
354
337
|
statement = statementFromStatementNode(statementNode, context);
|
|
@@ -360,9 +343,7 @@ export default domAssigned(class Statement {
|
|
|
360
343
|
static fromDeclarationNode(declarationNode, fileContext) {
|
|
361
344
|
let statementNode;
|
|
362
345
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
statementNode = declarationStatementNode; ///
|
|
346
|
+
statementNode = declarationNode.getStatementNode(); ///
|
|
366
347
|
|
|
367
348
|
statementNode = stripBracketsFromStatementNode(statementNode); ///
|
|
368
349
|
|
|
@@ -376,11 +357,10 @@ export default domAssigned(class Statement {
|
|
|
376
357
|
static fromContainedAssertionNode(containedAssertionNode, fileContext) {
|
|
377
358
|
let statement = null;
|
|
378
359
|
|
|
379
|
-
const
|
|
360
|
+
const statementNode = containedAssertionNode.getStatementNode();
|
|
380
361
|
|
|
381
|
-
if (
|
|
382
|
-
const
|
|
383
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
362
|
+
if (statementNode !== null) {
|
|
363
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
384
364
|
context = localContext; ///
|
|
385
365
|
|
|
386
366
|
statement = statementFromStatementNode(statementNode, context);
|
package/src/dom/step.js
CHANGED
|
@@ -4,12 +4,9 @@ import dom from "../dom";
|
|
|
4
4
|
import unifyMixins from "../mixins/step/unify";
|
|
5
5
|
import Substitutions from "../substitutions";
|
|
6
6
|
|
|
7
|
-
import { nodeQuery } from "../utilities/query";
|
|
8
7
|
import { domAssigned } from "../dom";
|
|
9
8
|
import { propertyAssertionFromStatement } from "../utilities/context";
|
|
10
9
|
|
|
11
|
-
const stepNodeQuery = nodeQuery("/step");
|
|
12
|
-
|
|
13
10
|
export default domAssigned(class Step {
|
|
14
11
|
constructor(string, statement, reference) {
|
|
15
12
|
this.string = string;
|
|
@@ -140,10 +137,11 @@ export default domAssigned(class Step {
|
|
|
140
137
|
static fromStepOrSubproofNode(stepOrSubproofNode, fileContext) {
|
|
141
138
|
let step = null;
|
|
142
139
|
|
|
143
|
-
const stepNode =
|
|
140
|
+
const stepNode = stepOrSubproofNode.isStepNode();
|
|
144
141
|
|
|
145
|
-
if (stepNode
|
|
142
|
+
if (stepNode) {
|
|
146
143
|
const { Statement, Reference } = dom,
|
|
144
|
+
stepNode = stepOrSubproofNode, ///
|
|
147
145
|
node = stepNode, ///
|
|
148
146
|
string = fileContext.nodeAsString(node),
|
|
149
147
|
statement = Statement.fromStepNode(stepNode, fileContext),
|
package/src/dom/subDerivation.js
CHANGED
|
@@ -4,14 +4,11 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import dom from "../dom";
|
|
6
6
|
|
|
7
|
-
import { nodesQuery } from "../utilities/query";
|
|
8
7
|
import { domAssigned } from "../dom";
|
|
9
8
|
import { assignAssignments } from "../utilities/assignments";
|
|
10
9
|
|
|
11
10
|
const { last } = arrayUtilities;
|
|
12
11
|
|
|
13
|
-
const stepOrSubproofNodesQuery = nodesQuery("/subDerivation/step|subproof");
|
|
14
|
-
|
|
15
12
|
export default domAssigned(class SubDerivation {
|
|
16
13
|
constructor(stepsOrSubproofs) {
|
|
17
14
|
this.stepsOrSubproofs = stepsOrSubproofs;
|
|
@@ -65,7 +62,7 @@ export default domAssigned(class SubDerivation {
|
|
|
65
62
|
|
|
66
63
|
function stepOrSubproofFromSubDerivationNode(subDerivationNode, fileContext) {
|
|
67
64
|
const { Step, Subproof } = dom,
|
|
68
|
-
stepOrSubproofNodes =
|
|
65
|
+
stepOrSubproofNodes = subDerivationNode.getStepOrSubproofNodes(),
|
|
69
66
|
stepsOrSubproofs = stepOrSubproofNodes.map((stepOrSubproofNode) => {
|
|
70
67
|
const subproof = Subproof.fromStepOrSubproofNode(stepOrSubproofNode, fileContext),
|
|
71
68
|
step = Step.fromStepOrSubproofNode(stepOrSubproofNode, fileContext),
|
package/src/dom/subproof.js
CHANGED
|
@@ -5,13 +5,8 @@ import LocalContext from "../context/local";
|
|
|
5
5
|
import Substitutions from "../substitutions";
|
|
6
6
|
|
|
7
7
|
import { domAssigned } from "../dom";
|
|
8
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
9
8
|
import { subproofStringFromSubproofNode } from "../utilities/subproof";
|
|
10
9
|
|
|
11
|
-
const subproofNodeQuery = nodeQuery("/subproof"),
|
|
12
|
-
suppositionNodesQuery = nodesQuery("/subproof/supposition"),
|
|
13
|
-
subDerivationNodeQuery = nodeQuery("/subproof/subDerivation");
|
|
14
|
-
|
|
15
10
|
export default domAssigned(class Subproof {
|
|
16
11
|
constructor(string, suppositions, subDerivation) {
|
|
17
12
|
this.string = string;
|
|
@@ -120,13 +115,14 @@ export default domAssigned(class Subproof {
|
|
|
120
115
|
static fromStepOrSubproofNode(sStepOrSubproofNode, fileContext) {
|
|
121
116
|
let subproof = null;
|
|
122
117
|
|
|
123
|
-
const subproofNode =
|
|
118
|
+
const subproofNode = sStepOrSubproofNode.isSubproofNode();
|
|
124
119
|
|
|
125
|
-
if (subproofNode
|
|
126
|
-
const
|
|
127
|
-
string = subproofString, ///
|
|
120
|
+
if (subproofNode) {
|
|
121
|
+
const subproofNode = sStepOrSubproofNode, ///
|
|
128
122
|
suppositions = suppositionsFromSubproofNode(subproofNode, fileContext),
|
|
129
|
-
subDerivation = subDerivationFromSubproofNode(subproofNode, fileContext)
|
|
123
|
+
subDerivation = subDerivationFromSubproofNode(subproofNode, fileContext),
|
|
124
|
+
subproofString = subproofStringFromSubproofNode(subproofNode, fileContext),
|
|
125
|
+
string = subproofString; ///
|
|
130
126
|
|
|
131
127
|
subproof = new Subproof(string, suppositions, subDerivation);
|
|
132
128
|
}
|
|
@@ -137,7 +133,7 @@ export default domAssigned(class Subproof {
|
|
|
137
133
|
|
|
138
134
|
function suppositionsFromSubproofNode(subproofNode, fileContext) {
|
|
139
135
|
const { Supposition } = dom,
|
|
140
|
-
suppositionNodes =
|
|
136
|
+
suppositionNodes = subproofNode.getSuppositionNodes(),
|
|
141
137
|
suppositions = suppositionNodes.map((suppositionNode) => {
|
|
142
138
|
const supposition = Supposition.fromSuppositionNode(suppositionNode, fileContext);
|
|
143
139
|
|
|
@@ -149,7 +145,7 @@ function suppositionsFromSubproofNode(subproofNode, fileContext) {
|
|
|
149
145
|
|
|
150
146
|
function subDerivationFromSubproofNode(subproofNode, fileContext) {
|
|
151
147
|
const { SubDerivation } = dom,
|
|
152
|
-
subDerivationNode =
|
|
148
|
+
subDerivationNode = subproofNode.getSubDerivationNode(),
|
|
153
149
|
subDerivation = SubDerivation.fromSubDerivationNode(subDerivationNode, fileContext);
|
|
154
150
|
|
|
155
151
|
return subDerivation;
|
package/src/dom/term.js
CHANGED
|
@@ -6,21 +6,15 @@ import dom from "../dom";
|
|
|
6
6
|
import LocalContext from "../context/local";
|
|
7
7
|
import verifyMixins from "../mixins/term/verify";
|
|
8
8
|
|
|
9
|
+
import { nodeQuery } from "../utilities/query"
|
|
9
10
|
import { domAssigned } from "../dom";
|
|
10
11
|
import { termFromTermNode } from "../utilities/node";
|
|
11
|
-
import { nodeQuery, nodesQuery } from "../utilities/query"
|
|
12
12
|
import { termNodeFromTermString } from "../context/partial/term";
|
|
13
13
|
import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
14
14
|
|
|
15
15
|
const { filter, compress } = arrayUtilities;
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
termVariableNodeQuery = nodeQuery("/term/variable!"),
|
|
19
|
-
typeAssertionTermNodeQuery = nodeQuery("/typeAssertion/term"),
|
|
20
|
-
definedAssertionTermNodeQuery = nodeQuery("/definedAssertion/term"),
|
|
21
|
-
propertyRelationTermNodeQuery = nodeQuery("/propertyRelation/term"),
|
|
22
|
-
propertyAssertionTermNodeQuery = nodeQuery("/propertyAssertion/term"),
|
|
23
|
-
containedAssertionTermNodeQuery = nodeQuery("/containedAssertion/term");
|
|
17
|
+
const containedAssertionTermNodeQuery = nodeQuery("/containedAssertion/term");
|
|
24
18
|
|
|
25
19
|
export default domAssigned(class Term {
|
|
26
20
|
constructor(string, node, type) {
|
|
@@ -54,7 +48,8 @@ export default domAssigned(class Term {
|
|
|
54
48
|
}
|
|
55
49
|
|
|
56
50
|
getVariables(context) {
|
|
57
|
-
const
|
|
51
|
+
const termNode = this.node,
|
|
52
|
+
variableNodes = termNode.getVariableNodes(),
|
|
58
53
|
variables = variableNodes.map((variableNode) => {
|
|
59
54
|
const { Variable } = dom,
|
|
60
55
|
variable = Variable.fromVariableNode(variableNode, context);
|
|
@@ -89,8 +84,9 @@ export default domAssigned(class Term {
|
|
|
89
84
|
}
|
|
90
85
|
|
|
91
86
|
isSimple() {
|
|
92
|
-
const
|
|
93
|
-
|
|
87
|
+
const termNode = this.node,
|
|
88
|
+
singularVariableNode = termNode.getSingularVariableNode(),
|
|
89
|
+
simple = (singularVariableNode !== null);
|
|
94
90
|
|
|
95
91
|
return simple;
|
|
96
92
|
}
|
|
@@ -209,11 +205,7 @@ export default domAssigned(class Term {
|
|
|
209
205
|
}
|
|
210
206
|
|
|
211
207
|
static fromTermNode(termNode, context) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (termNode !== null) {
|
|
215
|
-
term = termFromTermNode(termNode, context);
|
|
216
|
-
}
|
|
208
|
+
const term = termFromTermNode(termNode, context);
|
|
217
209
|
|
|
218
210
|
return term;
|
|
219
211
|
}
|
|
@@ -229,11 +221,9 @@ export default domAssigned(class Term {
|
|
|
229
221
|
static fromTypeAssertionNode(typeAssertionNode, context) {
|
|
230
222
|
let term = null;
|
|
231
223
|
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
if (typeAssertionTermNode !== null) {
|
|
235
|
-
const termNode = typeAssertionTermNode; ///
|
|
224
|
+
const termNode = typeAssertionNode.getTermNode();
|
|
236
225
|
|
|
226
|
+
if (termNode !== null) {
|
|
237
227
|
term = termFromTermNode(termNode, context);
|
|
238
228
|
}
|
|
239
229
|
|
|
@@ -243,11 +233,9 @@ export default domAssigned(class Term {
|
|
|
243
233
|
static fromDefinedAssertionNode(definedAssertionNode, context) {
|
|
244
234
|
let term = null;
|
|
245
235
|
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
if (definedAssertionTermNode !== null) {
|
|
249
|
-
const termNode = definedAssertionTermNode; ///
|
|
236
|
+
const termNode = definedAssertionNode.getTermNode();
|
|
250
237
|
|
|
238
|
+
if (termNode !== null) {
|
|
251
239
|
term = termFromTermNode(termNode, context);
|
|
252
240
|
}
|
|
253
241
|
|
|
@@ -255,16 +243,14 @@ export default domAssigned(class Term {
|
|
|
255
243
|
}
|
|
256
244
|
|
|
257
245
|
static fromPropertyRelationNode(propertyRelationNode, context) {
|
|
258
|
-
const
|
|
259
|
-
termNode = propertyRelationTermNode, ///
|
|
246
|
+
const termNode = propertyRelationNode.getTermNode(),
|
|
260
247
|
term = termFromTermNode(termNode, context);
|
|
261
248
|
|
|
262
249
|
return term;
|
|
263
250
|
}
|
|
264
251
|
|
|
265
252
|
static fromPropertyAssertionNode(propertyAssertionNode, context) {
|
|
266
|
-
const
|
|
267
|
-
termNode = propertyAssertionTermNode,
|
|
253
|
+
const termNode = propertyAssertionNode.getTermNode(),
|
|
268
254
|
term = termFromTermNode(termNode, context);
|
|
269
255
|
|
|
270
256
|
return term;
|
|
@@ -273,11 +259,9 @@ export default domAssigned(class Term {
|
|
|
273
259
|
static fromContainedAssertionNode(containedAssertionNode, context) {
|
|
274
260
|
let term = null;
|
|
275
261
|
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
if (containedAssertionTermNode !== null) {
|
|
279
|
-
const termNode = containedAssertionTermNode;
|
|
262
|
+
const termNode = containedAssertionNode.getTermNode();
|
|
280
263
|
|
|
264
|
+
if (termNode !== null) {
|
|
281
265
|
term = termFromTermNode(termNode, context);
|
|
282
266
|
}
|
|
283
267
|
|
package/src/dom/theorem.js
CHANGED
|
@@ -30,5 +30,10 @@ export default domAssigned(class Theorem extends TopLevelAssertion {
|
|
|
30
30
|
|
|
31
31
|
static fromJSON(json, fileContext) { return TopLevelAssertion.fromJSON(Theorem, json, fileContext); }
|
|
32
32
|
|
|
33
|
-
static
|
|
33
|
+
static fromTheoremNode(theoremNode, fileContext) {
|
|
34
|
+
const node = theoremNode, ///
|
|
35
|
+
theorem = TopLevelAssertion.fromNode(Theorem, node, fileContext);
|
|
36
|
+
|
|
37
|
+
return theorem;
|
|
38
|
+
}
|
|
34
39
|
});
|
|
@@ -6,29 +6,25 @@ import dom from "../dom";
|
|
|
6
6
|
import LocalContext from "../context/local";
|
|
7
7
|
import Substitutions from "../substitutions";
|
|
8
8
|
|
|
9
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
10
9
|
import { labelsFromJSON,
|
|
11
|
-
labelsToLabelsJSON,
|
|
12
10
|
deductionFromJSON,
|
|
11
|
+
labelsToLabelsJSON,
|
|
12
|
+
satisfiableFromJSON,
|
|
13
13
|
suppositionsFromJSON,
|
|
14
14
|
deductionToDeductionJSON,
|
|
15
15
|
suppositionsToSuppositionsJSON } from "../utilities/json";
|
|
16
16
|
|
|
17
17
|
const { reverse, extract, backwardsEvery } = arrayUtilities;
|
|
18
18
|
|
|
19
|
-
const proofNodeQuery = nodeQuery("/*/proof"),
|
|
20
|
-
labelNodesQuery = nodesQuery("/*/parenthesisedLabels/labels/label"),
|
|
21
|
-
deductionNodeQuery = nodeQuery("/*/deduction"),
|
|
22
|
-
suppositionNodesQuery = nodesQuery("/*/supposition");
|
|
23
|
-
|
|
24
19
|
export default class TopLevelAssertion {
|
|
25
|
-
constructor(fileContext, string, labels, suppositions, deduction, proof) {
|
|
20
|
+
constructor(fileContext, string, labels, suppositions, deduction, proof, satisfiable) {
|
|
26
21
|
this.fileContext = fileContext;
|
|
27
22
|
this.string = string;
|
|
28
23
|
this.labels = labels;
|
|
29
24
|
this.suppositions = suppositions;
|
|
30
25
|
this.deduction = deduction;
|
|
31
26
|
this.proof = proof;
|
|
27
|
+
this.satisfiable = satisfiable;
|
|
32
28
|
}
|
|
33
29
|
|
|
34
30
|
getFileContext() {
|
|
@@ -55,6 +51,10 @@ export default class TopLevelAssertion {
|
|
|
55
51
|
return this.proof;
|
|
56
52
|
}
|
|
57
53
|
|
|
54
|
+
isSatisfiable() {
|
|
55
|
+
return this.satisfiable;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
58
|
getStatement() { return this.deduction.getStatement(); }
|
|
59
59
|
|
|
60
60
|
matchMetavariableName(metavariableName) {
|
|
@@ -223,10 +223,12 @@ export default class TopLevelAssertion {
|
|
|
223
223
|
labels = labelsJSON, ///
|
|
224
224
|
deduction = deductionJSON, ///
|
|
225
225
|
suppositions = suppositionsJSON, ///
|
|
226
|
+
satisfiable = this.satisfiable,
|
|
226
227
|
json = {
|
|
227
228
|
labels,
|
|
228
229
|
deduction,
|
|
229
|
-
suppositions
|
|
230
|
+
suppositions,
|
|
231
|
+
satisfiable
|
|
230
232
|
};
|
|
231
233
|
|
|
232
234
|
return json;
|
|
@@ -234,38 +236,43 @@ export default class TopLevelAssertion {
|
|
|
234
236
|
|
|
235
237
|
static fromJSON(Class, json, fileContext) {
|
|
236
238
|
const labels = labelsFromJSON(json, fileContext),
|
|
237
|
-
suppositions = suppositionsFromJSON(json, fileContext),
|
|
238
239
|
deduction = deductionFromJSON(json, fileContext),
|
|
240
|
+
satisfiable = satisfiableFromJSON(json, fileContext),
|
|
241
|
+
suppositions = suppositionsFromJSON(json, fileContext),
|
|
239
242
|
proof = null,
|
|
240
243
|
string = stringFromLabelsAndDeduction(labels, deduction),
|
|
241
|
-
topLevelAssertion = new Class(fileContext, string, labels, suppositions, deduction, proof);
|
|
244
|
+
topLevelAssertion = new Class(fileContext, string, labels, suppositions, deduction, proof, satisfiable);
|
|
242
245
|
|
|
243
246
|
return topLevelAssertion;
|
|
244
247
|
}
|
|
245
248
|
|
|
246
249
|
static fromNode(Class, node, fileContext) {
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
250
|
+
const topLevelAssertionNode = node, ///
|
|
251
|
+
satisfiable = topLevelAssertionNode.isSatisfiable(),
|
|
252
|
+
proofNode = topLevelAssertionNode.getProofNode(),
|
|
253
|
+
labelNodes = topLevelAssertionNode.getLabelNodes(),
|
|
254
|
+
deductionNode = topLevelAssertionNode.getDeductionNode(),
|
|
255
|
+
suppositionNodes = topLevelAssertionNode.getSuppositionNodes(),
|
|
256
|
+
proof = proofFromProofNode(proofNode, fileContext),
|
|
257
|
+
labels = labelsFromLabelNodes(labelNodes, fileContext),
|
|
258
|
+
deduction = deductionFromDeductionNode(deductionNode, fileContext),
|
|
259
|
+
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, fileContext),
|
|
251
260
|
string = stringFromLabelsAndDeduction(labels, deduction),
|
|
252
|
-
topLevelAssertion = new Class(fileContext, string, labels, suppositions, deduction, proof);
|
|
261
|
+
topLevelAssertion = new Class(fileContext, string, labels, suppositions, deduction, proof, satisfiable);
|
|
253
262
|
|
|
254
263
|
return topLevelAssertion;
|
|
255
264
|
}
|
|
256
265
|
}
|
|
257
266
|
|
|
258
|
-
export function
|
|
267
|
+
export function proofFromProofNode(proofNode, fileContext) {
|
|
259
268
|
const { Proof } = dom,
|
|
260
|
-
proofNode = proofNodeQuery(node),
|
|
261
269
|
proof = Proof.fromProofNode(proofNode, fileContext);
|
|
262
270
|
|
|
263
271
|
return proof;
|
|
264
272
|
}
|
|
265
273
|
|
|
266
|
-
export function
|
|
274
|
+
export function labelsFromLabelNodes(labelNodes, fileContext) {
|
|
267
275
|
const { Label } = dom,
|
|
268
|
-
labelNodes = labelNodesQuery(node),
|
|
269
276
|
labels = labelNodes.map((labelNode) => {
|
|
270
277
|
const label = Label.fromLabelNode(labelNode, fileContext);
|
|
271
278
|
|
|
@@ -275,24 +282,22 @@ export function labelsFromNode(node, fileContext) {
|
|
|
275
282
|
return labels;
|
|
276
283
|
}
|
|
277
284
|
|
|
278
|
-
export function
|
|
285
|
+
export function deductionFromDeductionNode(deductionNode, fileContext) {
|
|
279
286
|
const { Deduction } = dom,
|
|
280
|
-
deductionNode = deductionNodeQuery(node),
|
|
281
287
|
deduction = Deduction.fromDeductionNode(deductionNode, fileContext);
|
|
282
288
|
|
|
283
289
|
return deduction;
|
|
284
290
|
}
|
|
285
291
|
|
|
286
|
-
export function
|
|
292
|
+
export function suppositionsFromSuppositionNodes(suppositionNodes, fileContext) {
|
|
287
293
|
const { Supposition } = dom,
|
|
288
|
-
suppositionNodes = suppositionNodesQuery(node),
|
|
289
294
|
suppositions = suppositionNodes.map((suppositionNode) => {
|
|
290
295
|
const supposition = Supposition.fromSuppositionNode(suppositionNode, fileContext);
|
|
291
296
|
|
|
292
297
|
return supposition;
|
|
293
298
|
});
|
|
294
299
|
|
|
295
|
-
|
|
300
|
+
return suppositions;
|
|
296
301
|
}
|
|
297
302
|
|
|
298
303
|
export function labelsStringFromLabels(labels) {
|
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
import dom from "../dom";
|
|
6
5
|
import LocalContext from "../context/local";
|
|
7
|
-
import Substitutions from "../substitutions";
|
|
8
6
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
9
7
|
|
|
10
|
-
import {
|
|
11
|
-
import { proofFromNode, deductionFromNode, suppositionsFromNode, stringFromLabelsAndDeduction } from "./topLevelAssertion";
|
|
8
|
+
import { proofFromProofNode, labelsFromLabelNodes, deductionFromDeductionNode, suppositionsFromSuppositionNodes, stringFromLabelsAndDeduction } from "./topLevelAssertion";
|
|
12
9
|
import { labelsFromJSON,
|
|
13
10
|
labelsToLabelsJSON,
|
|
14
11
|
deductionFromJSON,
|
|
@@ -20,8 +17,6 @@ import { labelsFromJSON,
|
|
|
20
17
|
|
|
21
18
|
const { first } = arrayUtilities;
|
|
22
19
|
|
|
23
|
-
const labelNodeQuery = nodeQuery("/*/parenthesisedLabel/label");
|
|
24
|
-
|
|
25
20
|
export default class TopLevelMetaAssertion extends TopLevelAssertion {
|
|
26
21
|
constructor(fileContext, string, labels, suppositions, deduction, proof, substitutions) {
|
|
27
22
|
super(fileContext, string, labels, suppositions, deduction, proof);
|
|
@@ -116,36 +111,29 @@ export default class TopLevelMetaAssertion extends TopLevelAssertion {
|
|
|
116
111
|
|
|
117
112
|
static fromJSON(Class, json, fileContext) {
|
|
118
113
|
const labels = labelsFromJSON(json, fileContext),
|
|
119
|
-
substitutions = substitutionsFromJSON(json, fileContext),
|
|
120
|
-
suppositions = suppositionsFromJSON(json, fileContext),
|
|
121
114
|
deduction = deductionFromJSON(json, fileContext),
|
|
115
|
+
suppositions = suppositionsFromJSON(json, fileContext),
|
|
116
|
+
substitutions = substitutionsFromJSON(json, fileContext),
|
|
122
117
|
proof = null,
|
|
123
118
|
string = stringFromLabelsAndDeduction(labels, deduction),
|
|
124
|
-
|
|
119
|
+
topLevelMetaAssertion = new Class(fileContext, string, labels, suppositions, deduction, proof, substitutions);
|
|
125
120
|
|
|
126
|
-
return
|
|
121
|
+
return topLevelMetaAssertion;
|
|
127
122
|
}
|
|
128
123
|
|
|
129
124
|
static fromNode(Class, node, fileContext) {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
const topLevelAssertionNode = node, ///
|
|
126
|
+
proofNode = topLevelAssertionNode.getProofNode(),
|
|
127
|
+
labelNodes = topLevelAssertionNode.getLabelNodes(),
|
|
128
|
+
deductionNode = topLevelAssertionNode.getDeductionNode(),
|
|
129
|
+
suppositionNodes = topLevelAssertionNode.getSuppositionNodes(),
|
|
130
|
+
proof = proofFromProofNode(proofNode, fileContext),
|
|
131
|
+
labels = labelsFromLabelNodes(labelNodes, fileContext),
|
|
132
|
+
deduction = deductionFromDeductionNode(deductionNode, fileContext),
|
|
133
|
+
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, fileContext),
|
|
135
134
|
string = stringFromLabelsAndDeduction(labels, deduction),
|
|
136
|
-
|
|
135
|
+
topLevelMetaAssertion = new Class(fileContext, string, labels, suppositions, deduction, proof);
|
|
137
136
|
|
|
138
|
-
return
|
|
137
|
+
return topLevelMetaAssertion;
|
|
139
138
|
}
|
|
140
139
|
}
|
|
141
|
-
|
|
142
|
-
function labelsFromNode(node, fileContext) {
|
|
143
|
-
const { Label } = dom,
|
|
144
|
-
labelNode = labelNodeQuery(node),
|
|
145
|
-
label = Label.fromLabelNode(labelNode, fileContext),
|
|
146
|
-
labels = [
|
|
147
|
-
label
|
|
148
|
-
];
|
|
149
|
-
|
|
150
|
-
return labels;
|
|
151
|
-
}
|