occam-verify-cli 1.0.185 → 1.0.198
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/context/file.js +3 -3
- package/lib/dom/assertion/contained.js +12 -24
- package/lib/dom/assertion/defined.js +9 -21
- package/lib/dom/assertion/property.js +8 -10
- package/lib/dom/assertion/satisfies.js +6 -8
- 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/constructor.js +6 -6
- package/lib/dom/declaration/metavariable.js +3 -5
- package/lib/dom/declaration/type.js +2 -2
- package/lib/dom/declaration/variable.js +6 -6
- package/lib/dom/declaration.js +14 -16
- package/lib/dom/derivation.js +2 -4
- package/lib/dom/equality.js +9 -11
- package/lib/dom/frame.js +14 -18
- package/lib/dom/judgement.js +8 -10
- 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 +14 -16
- 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 +12 -20
- package/lib/dom/theorem.js +5 -4
- package/lib/dom/topLevelAssertion.js +30 -24
- package/lib/dom/topLevelMetaAssertion.js +76 -140
- package/lib/dom/type.js +8 -25
- package/lib/dom/variable.js +5 -11
- package/lib/equivalence.js +4 -6
- package/lib/mixins/term/verify.js +4 -8
- package/lib/node/argument.js +116 -0
- package/lib/node/assertion/contained.js +48 -53
- package/lib/node/assertion/defined.js +41 -53
- package/lib/node/assertion/property.js +23 -53
- package/lib/node/assertion/satisfies.js +23 -53
- package/lib/node/assertion/subproof.js +16 -53
- package/lib/node/assertion/type.js +23 -53
- package/lib/node/axiom.js +6 -52
- package/lib/node/combinator.js +6 -52
- package/lib/node/conclusion.js +16 -53
- package/lib/node/conjecture.js +6 -52
- package/lib/node/constructor.js +6 -52
- package/lib/node/declaration/combinator.js +8 -56
- package/lib/node/declaration/complexType.js +42 -86
- package/lib/node/declaration/constructor.js +26 -77
- package/lib/node/declaration/metavariable.js +30 -53
- package/lib/node/declaration/property.js +19 -69
- package/lib/node/declaration/type.js +45 -78
- package/lib/node/declaration/variable.js +21 -81
- package/lib/node/declaration.js +23 -53
- package/lib/node/deduction.js +16 -53
- package/lib/node/derivation.js +42 -51
- package/lib/node/equality.js +32 -53
- package/lib/node/error.js +6 -52
- package/lib/node/frame.js +30 -53
- package/lib/node/judgement.js +23 -53
- package/lib/node/label.js +16 -53
- package/lib/node/labels.js +116 -0
- package/lib/node/lemma.js +6 -52
- package/lib/node/metaArgument.js +116 -0
- package/lib/node/metaLemma.js +6 -52
- package/lib/node/metaType.js +14 -55
- package/lib/node/metatheorem.js +6 -52
- package/lib/node/metavariable.js +30 -56
- package/lib/node/nonTerminal.js +200 -0
- package/lib/node/parameter.js +22 -53
- package/lib/node/parenthesisedLabel.js +116 -0
- package/lib/node/parenthesisedLabels.js +123 -0
- package/lib/node/premise.js +23 -53
- package/lib/node/procedureCall.js +23 -53
- package/lib/node/proof.js +16 -53
- package/lib/node/property.js +18 -57
- package/lib/node/propertyRelation.js +30 -53
- package/lib/node/reference.js +16 -53
- package/lib/node/rule.js +44 -53
- package/lib/node/statement.js +139 -53
- package/lib/node/step.js +37 -53
- package/lib/node/subDerivation.js +49 -51
- package/lib/node/subproof.js +44 -53
- package/lib/node/substitution/frame.js +123 -0
- package/lib/node/substitution/reference.js +123 -0
- package/lib/node/substitution/statement.js +123 -0
- package/lib/node/substitution/term.js +123 -0
- package/lib/node/supposition.js +23 -53
- package/lib/node/term.js +41 -53
- package/lib/node/theorem.js +6 -52
- package/lib/node/topLevelAssertion.js +66 -54
- package/lib/node/topLevelMetaAssertion.js +45 -54
- package/lib/node/type.js +14 -55
- package/lib/{node.js → node/types.js} +22 -24
- package/lib/node/variable.js +14 -55
- package/lib/nominal/parser.js +3 -3
- package/lib/nonTerminalNodeMap.js +14 -4
- package/lib/ruleNames.js +42 -2
- package/lib/substitution/frame.js +5 -7
- package/lib/substitution/reference.js +5 -7
- package/lib/substitution/term.js +5 -7
- package/lib/unifier/metaLevel.js +4 -4
- package/lib/utilities/brackets.js +5 -5
- package/lib/utilities/json.js +18 -1
- package/lib/utilities/node.js +1 -37
- package/lib/utilities/subproof.js +13 -4
- 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/context/file.js +2 -2
- package/src/dom/assertion/contained.js +12 -34
- package/src/dom/assertion/defined.js +9 -30
- package/src/dom/assertion/property.js +7 -12
- package/src/dom/assertion/satisfies.js +5 -10
- 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 +8 -7
- package/src/dom/declaration/constructor.js +6 -7
- package/src/dom/declaration/metavariable.js +2 -6
- package/src/dom/declaration/type.js +4 -2
- package/src/dom/declaration/variable.js +6 -7
- package/src/dom/declaration.js +12 -20
- package/src/dom/derivation.js +1 -4
- package/src/dom/equality.js +13 -17
- package/src/dom/frame.js +11 -25
- package/src/dom/judgement.js +7 -12
- 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 +16 -22
- 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 +14 -33
- package/src/dom/theorem.js +6 -1
- package/src/dom/topLevelAssertion.js +30 -25
- package/src/dom/topLevelMetaAssertion.js +87 -55
- package/src/dom/type.js +11 -37
- package/src/dom/variable.js +4 -12
- package/src/equivalence.js +3 -6
- package/src/mixins/term/verify.js +5 -11
- package/src/node/argument.js +16 -0
- package/src/node/assertion/contained.js +49 -3
- package/src/node/assertion/defined.js +42 -3
- package/src/node/assertion/property.js +19 -3
- package/src/node/assertion/satisfies.js +19 -3
- package/src/node/assertion/subproof.js +12 -3
- package/src/node/assertion/type.js +19 -3
- package/src/node/axiom.js +3 -3
- package/src/node/combinator.js +3 -3
- package/src/node/conclusion.js +12 -3
- package/src/node/conjecture.js +3 -3
- package/src/node/constructor.js +3 -3
- package/src/node/declaration/combinator.js +7 -8
- package/src/node/declaration/complexType.js +40 -43
- package/src/node/declaration/constructor.js +25 -30
- package/src/node/declaration/metavariable.js +26 -3
- package/src/node/declaration/property.js +17 -23
- package/src/node/declaration/type.js +43 -32
- package/src/node/declaration/variable.js +19 -37
- package/src/node/declaration.js +19 -3
- package/src/node/deduction.js +12 -3
- package/src/node/derivation.js +15 -3
- package/src/node/equality.js +32 -3
- package/src/node/error.js +3 -3
- package/src/node/frame.js +26 -3
- package/src/node/judgement.js +19 -3
- package/src/node/label.js +12 -3
- package/src/node/labels.js +16 -0
- package/src/node/lemma.js +3 -3
- package/src/node/metaArgument.js +16 -0
- package/src/node/metaLemma.js +3 -3
- package/src/node/metaType.js +15 -8
- package/src/node/metatheorem.js +3 -3
- package/src/node/metavariable.js +32 -9
- package/src/node/nonTerminal.js +112 -0
- package/src/node/parameter.js +20 -3
- package/src/node/parenthesisedLabel.js +16 -0
- package/src/node/parenthesisedLabels.js +23 -0
- package/src/node/premise.js +19 -3
- package/src/node/procedureCall.js +19 -3
- package/src/node/proof.js +12 -3
- package/src/node/property.js +18 -12
- package/src/node/propertyRelation.js +26 -3
- package/src/node/reference.js +12 -3
- package/src/node/rule.js +40 -3
- package/src/node/statement.js +151 -3
- package/src/node/step.js +31 -3
- package/src/node/subDerivation.js +22 -3
- package/src/node/subproof.js +38 -3
- package/src/node/substitution/frame.js +23 -0
- package/src/node/substitution/reference.js +23 -0
- package/src/node/substitution/statement.js +23 -0
- package/src/node/substitution/term.js +23 -0
- package/src/node/supposition.js +19 -3
- package/src/node/term.js +38 -3
- package/src/node/theorem.js +3 -3
- package/src/node/topLevelAssertion.js +69 -3
- package/src/node/topLevelMetaAssertion.js +40 -3
- package/src/node/type.js +15 -8
- package/src/node/types.js +16 -0
- package/src/node/variable.js +15 -8
- package/src/nominal/parser.js +1 -1
- package/src/nonTerminalNodeMap.js +67 -37
- package/src/ruleNames.js +11 -1
- package/src/substitution/frame.js +7 -10
- package/src/substitution/reference.js +7 -10
- package/src/substitution/term.js +7 -9
- package/src/unifier/metaLevel.js +2 -3
- package/src/utilities/brackets.js +8 -8
- package/src/utilities/json.js +19 -0
- package/src/utilities/node.js +0 -27
- package/src/utilities/subproof.js +22 -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/rule.js
CHANGED
|
@@ -7,7 +7,6 @@ import LocalContext from "../context/local";
|
|
|
7
7
|
import Substitutions from "../substitutions";
|
|
8
8
|
|
|
9
9
|
import { domAssigned } from "../dom";
|
|
10
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
11
10
|
import { labelsStringFromLabels } from "./topLevelAssertion";
|
|
12
11
|
import { labelsFromJSON,
|
|
13
12
|
premisesFromJSON,
|
|
@@ -18,11 +17,6 @@ import { labelsFromJSON,
|
|
|
18
17
|
|
|
19
18
|
const { reverse, extract, backwardsEvery } = arrayUtilities;
|
|
20
19
|
|
|
21
|
-
const proofNodeQuery = nodeQuery("/rule/proof"),
|
|
22
|
-
labelNodesQuery = nodesQuery("/rule/parenthesisedLabels/labels/label"),
|
|
23
|
-
premiseNodesQuery = nodesQuery("/rule/premise"),
|
|
24
|
-
conclusionNodeQuery = nodeQuery("/rule/conclusion");
|
|
25
|
-
|
|
26
20
|
export default domAssigned(class Rule {
|
|
27
21
|
constructor(fileContext, string, labels, premises, conclusion, proof) {
|
|
28
22
|
this.fileContext = fileContext;
|
|
@@ -236,10 +230,10 @@ export default domAssigned(class Rule {
|
|
|
236
230
|
}
|
|
237
231
|
|
|
238
232
|
static fromRuleNode(ruleNode, fileContext) {
|
|
239
|
-
const
|
|
233
|
+
const proof = proofFromRuleNode(ruleNode, fileContext),
|
|
234
|
+
labels = labelsFromRuleNode(ruleNode, fileContext),
|
|
240
235
|
premises = premisesFromRuleNode(ruleNode, fileContext),
|
|
241
236
|
conclusion = conclusionFromRuleNode(ruleNode, fileContext),
|
|
242
|
-
proof = proofFromRuleNode(ruleNode, fileContext),
|
|
243
237
|
string = stringFromLabelsAndConclusion(labels, conclusion),
|
|
244
238
|
rule = new Rule(fileContext, string, labels, premises, conclusion, proof);
|
|
245
239
|
|
|
@@ -249,7 +243,7 @@ export default domAssigned(class Rule {
|
|
|
249
243
|
|
|
250
244
|
function proofFromRuleNode(ruleNode, fileContext) {
|
|
251
245
|
const { Proof } = dom,
|
|
252
|
-
proofNode =
|
|
246
|
+
proofNode = ruleNode.getProofNode(),
|
|
253
247
|
proof = Proof.fromProofNode(proofNode, fileContext);
|
|
254
248
|
|
|
255
249
|
return proof;
|
|
@@ -257,7 +251,7 @@ function proofFromRuleNode(ruleNode, fileContext) {
|
|
|
257
251
|
|
|
258
252
|
function labelsFromRuleNode(ruleNode, fileContext) {
|
|
259
253
|
const { Label } = dom,
|
|
260
|
-
labelNodes =
|
|
254
|
+
labelNodes = ruleNode.getLabelNodes(),
|
|
261
255
|
labels = labelNodes.map((labelNode) => {
|
|
262
256
|
const label = Label.fromLabelNode(labelNode, fileContext);
|
|
263
257
|
|
|
@@ -269,7 +263,7 @@ function labelsFromRuleNode(ruleNode, fileContext) {
|
|
|
269
263
|
|
|
270
264
|
function premisesFromRuleNode(ruleNode, fileContext) {
|
|
271
265
|
const { Premise } = dom,
|
|
272
|
-
premiseNodes =
|
|
266
|
+
premiseNodes = ruleNode.getPremiseNodes(),
|
|
273
267
|
premises = premiseNodes.map((premiseNode) => {
|
|
274
268
|
const premise = Premise.fromPremiseNode(premiseNode, fileContext);
|
|
275
269
|
|
|
@@ -281,7 +275,7 @@ function premisesFromRuleNode(ruleNode, fileContext) {
|
|
|
281
275
|
|
|
282
276
|
function conclusionFromRuleNode(ruleNode, fileContext) {
|
|
283
277
|
const { Conclusion } = dom,
|
|
284
|
-
conclusionNode =
|
|
278
|
+
conclusionNode = ruleNode.getConclusionNode(),
|
|
285
279
|
conclusion = Conclusion.fromConclusionNode(conclusionNode, fileContext);
|
|
286
280
|
|
|
287
281
|
return conclusion;
|
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
|
@@ -8,20 +8,11 @@ import verifyMixins from "../mixins/term/verify";
|
|
|
8
8
|
|
|
9
9
|
import { domAssigned } from "../dom";
|
|
10
10
|
import { termFromTermNode } from "../utilities/node";
|
|
11
|
-
import { nodeQuery, nodesQuery } from "../utilities/query"
|
|
12
11
|
import { termNodeFromTermString } from "../context/partial/term";
|
|
13
12
|
import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
14
13
|
|
|
15
14
|
const { filter, compress } = arrayUtilities;
|
|
16
15
|
|
|
17
|
-
const variableNodesQuery = nodesQuery("//variable"),
|
|
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");
|
|
24
|
-
|
|
25
16
|
export default domAssigned(class Term {
|
|
26
17
|
constructor(string, node, type) {
|
|
27
18
|
this.string = string;
|
|
@@ -54,7 +45,8 @@ export default domAssigned(class Term {
|
|
|
54
45
|
}
|
|
55
46
|
|
|
56
47
|
getVariables(context) {
|
|
57
|
-
const
|
|
48
|
+
const termNode = this.node,
|
|
49
|
+
variableNodes = termNode.getVariableNodes(),
|
|
58
50
|
variables = variableNodes.map((variableNode) => {
|
|
59
51
|
const { Variable } = dom,
|
|
60
52
|
variable = Variable.fromVariableNode(variableNode, context);
|
|
@@ -89,8 +81,9 @@ export default domAssigned(class Term {
|
|
|
89
81
|
}
|
|
90
82
|
|
|
91
83
|
isSimple() {
|
|
92
|
-
const
|
|
93
|
-
|
|
84
|
+
const termNode = this.node,
|
|
85
|
+
singularVariableNode = termNode.getSingularVariableNode(),
|
|
86
|
+
simple = (singularVariableNode !== null);
|
|
94
87
|
|
|
95
88
|
return simple;
|
|
96
89
|
}
|
|
@@ -209,11 +202,7 @@ export default domAssigned(class Term {
|
|
|
209
202
|
}
|
|
210
203
|
|
|
211
204
|
static fromTermNode(termNode, context) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (termNode !== null) {
|
|
215
|
-
term = termFromTermNode(termNode, context);
|
|
216
|
-
}
|
|
205
|
+
const term = termFromTermNode(termNode, context);
|
|
217
206
|
|
|
218
207
|
return term;
|
|
219
208
|
}
|
|
@@ -229,11 +218,9 @@ export default domAssigned(class Term {
|
|
|
229
218
|
static fromTypeAssertionNode(typeAssertionNode, context) {
|
|
230
219
|
let term = null;
|
|
231
220
|
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
if (typeAssertionTermNode !== null) {
|
|
235
|
-
const termNode = typeAssertionTermNode; ///
|
|
221
|
+
const termNode = typeAssertionNode.getTermNode();
|
|
236
222
|
|
|
223
|
+
if (termNode !== null) {
|
|
237
224
|
term = termFromTermNode(termNode, context);
|
|
238
225
|
}
|
|
239
226
|
|
|
@@ -243,11 +230,9 @@ export default domAssigned(class Term {
|
|
|
243
230
|
static fromDefinedAssertionNode(definedAssertionNode, context) {
|
|
244
231
|
let term = null;
|
|
245
232
|
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
if (definedAssertionTermNode !== null) {
|
|
249
|
-
const termNode = definedAssertionTermNode; ///
|
|
233
|
+
const termNode = definedAssertionNode.getTermNode();
|
|
250
234
|
|
|
235
|
+
if (termNode !== null) {
|
|
251
236
|
term = termFromTermNode(termNode, context);
|
|
252
237
|
}
|
|
253
238
|
|
|
@@ -255,16 +240,14 @@ export default domAssigned(class Term {
|
|
|
255
240
|
}
|
|
256
241
|
|
|
257
242
|
static fromPropertyRelationNode(propertyRelationNode, context) {
|
|
258
|
-
const
|
|
259
|
-
termNode = propertyRelationTermNode, ///
|
|
243
|
+
const termNode = propertyRelationNode.getTermNode(),
|
|
260
244
|
term = termFromTermNode(termNode, context);
|
|
261
245
|
|
|
262
246
|
return term;
|
|
263
247
|
}
|
|
264
248
|
|
|
265
249
|
static fromPropertyAssertionNode(propertyAssertionNode, context) {
|
|
266
|
-
const
|
|
267
|
-
termNode = propertyAssertionTermNode,
|
|
250
|
+
const termNode = propertyAssertionNode.getTermNode(),
|
|
268
251
|
term = termFromTermNode(termNode, context);
|
|
269
252
|
|
|
270
253
|
return term;
|
|
@@ -273,11 +256,9 @@ export default domAssigned(class Term {
|
|
|
273
256
|
static fromContainedAssertionNode(containedAssertionNode, context) {
|
|
274
257
|
let term = null;
|
|
275
258
|
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
if (containedAssertionTermNode !== null) {
|
|
279
|
-
const termNode = containedAssertionTermNode;
|
|
259
|
+
const termNode = containedAssertionNode.getTermNode();
|
|
280
260
|
|
|
261
|
+
if (termNode !== null) {
|
|
281
262
|
term = termFromTermNode(termNode, context);
|
|
282
263
|
}
|
|
283
264
|
|
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) {
|