occam-verify-cli 0.0.270 → 0.0.272
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/bin/assertion.js +145 -0
- package/bin/axiom.js +8 -8
- package/bin/conclusion.js +67 -41
- package/bin/constants.js +11 -1
- package/bin/context/file.js +9 -3
- package/bin/context/metaproof.js +17 -8
- package/bin/metaAssertion.js +130 -28
- package/bin/metaSubstitution.js +45 -30
- package/bin/permutations.js +3 -0
- package/bin/permutationsMatrix.js +6 -0
- package/bin/premise.js +110 -48
- package/bin/rule.js +26 -21
- package/bin/ruleNames.js +4 -0
- package/bin/utilities/array.js +54 -71
- package/bin/utilities/metastatement.js +44 -0
- package/bin/utilities/permutations.js +148 -0
- package/bin/verify/{typeAssertion.js → assertion/type.js} +4 -4
- package/bin/verify/axiom/IndicativeConditional.js +5 -5
- package/bin/verify/conditinalInference.js +10 -12
- package/bin/verify/metaDerivation.js +5 -5
- package/bin/verify/metaSupposition.js +24 -0
- package/bin/verify/metaproof.js +89 -17
- package/bin/verify/metastatement/qualified.js +2 -4
- package/bin/verify/metastatement/unqualified.js +4 -4
- package/bin/verify/rule.js +28 -11
- package/bin/verify/statement.js +1 -1
- package/bin/verify/supposition.js +24 -0
- package/bin/verify/unconditionalInference.js +6 -18
- package/package.json +3 -3
- package/bin/antecedent.js +0 -19
- package/bin/verify/antecedent.js +0 -35
- package/bin/verify/metaAntecedent.js +0 -31
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const Axiom = require("../../axiom"),
|
|
4
4
|
verifyLabels = require("../../verify/labels"),
|
|
5
|
-
|
|
5
|
+
verifySupposition = require("../../verify/antecedent"),
|
|
6
6
|
verifyConsequent = require("../../verify/consequent");
|
|
7
7
|
|
|
8
8
|
const { first } = require("../../utilities/array"),
|
|
@@ -26,7 +26,7 @@ function verifyIndicativeConditionalAxiom(axiomNode, context) {
|
|
|
26
26
|
if (labelsVerified) {
|
|
27
27
|
const antecedents = [],
|
|
28
28
|
antecedentNode = antecedentNodeQuery(indicativeConditionalNode),
|
|
29
|
-
antecedentVerified =
|
|
29
|
+
antecedentVerified = verifySupposition(antecedentNode, antecedents, context);
|
|
30
30
|
|
|
31
31
|
if (antecedentVerified) {
|
|
32
32
|
const consequents = [],
|
|
@@ -34,11 +34,11 @@ function verifyIndicativeConditionalAxiom(axiomNode, context) {
|
|
|
34
34
|
consequentVerified = verifyConsequent(consequentNode, consequents, context);
|
|
35
35
|
|
|
36
36
|
if (consequentVerified) {
|
|
37
|
-
const
|
|
37
|
+
const firstSupposition = first(antecedents),
|
|
38
38
|
firstConsequent = first(consequents),
|
|
39
|
-
antecedent =
|
|
39
|
+
antecedent = firstSupposition, ///
|
|
40
40
|
consequent = firstConsequent, ///
|
|
41
|
-
axiom = Axiom.
|
|
41
|
+
axiom = Axiom.fromSuppositionConsequentAndLabels(antecedent, consequent, labels);
|
|
42
42
|
|
|
43
43
|
context.addAxiom(axiom);
|
|
44
44
|
|
|
@@ -6,9 +6,10 @@ const verifyMetaproof = require("../verify/metaproof"),
|
|
|
6
6
|
verifyPremiseOrPremises = require("../verify/premiseOrPremises");
|
|
7
7
|
|
|
8
8
|
const { nodeQuery } = require("../utilities/query");
|
|
9
|
+
const Conclusion = require("../conclusion");
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
|
|
11
|
+
const conclusionNodeQuery = nodeQuery("/conditionalInference/conclusion!"),
|
|
12
|
+
metastatementNodeQuery = nodeQuery("/conditionalInference/conclusion!/unqualifiedMetastatement!/metastatement!"),
|
|
12
13
|
premiseOrPremisesNodeQuery = nodeQuery("/conditionalInference/premise|premises!");
|
|
13
14
|
|
|
14
15
|
function verifyConditionalInference(conditionalInferenceNode, premises, conclusions, context) {
|
|
@@ -18,23 +19,20 @@ function verifyConditionalInference(conditionalInferenceNode, premises, conclusi
|
|
|
18
19
|
|
|
19
20
|
context = metaproofContext; ///
|
|
20
21
|
|
|
21
|
-
const
|
|
22
|
+
const conclusionNode = conclusionNodeQuery(conditionalInferenceNode),
|
|
23
|
+
metastatementNode = metastatementNodeQuery(conditionalInferenceNode),
|
|
24
|
+
premiseOrPremisesNode = premiseOrPremisesNodeQuery(conditionalInferenceNode),
|
|
22
25
|
premiseOrPremisesVerified = verifyPremiseOrPremises(premiseOrPremisesNode, premises, context);
|
|
23
26
|
|
|
24
27
|
if (premiseOrPremisesVerified) {
|
|
25
|
-
const
|
|
26
|
-
conclusionVerified = verifyConclusion(conclusionNode, conclusions, context);
|
|
28
|
+
const conclusionVerified = verifyConclusion(conclusionNode, conclusions, context);
|
|
27
29
|
|
|
28
30
|
if (conclusionVerified) {
|
|
29
|
-
|
|
31
|
+
const conclusion = Conclusion.fromMetastatementNode(metastatementNode);
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
conclusions.push(conclusion);
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
metaproofVerified = verifyMetaproof(metaproofNode, context);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
conditionalInferenceVerified = metaproofVerified; ///
|
|
35
|
+
conditionalInferenceVerified = true;
|
|
38
36
|
}
|
|
39
37
|
}
|
|
40
38
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
const MetaAssertion = require("../metaAssertion"),
|
|
4
4
|
MetaproofContext = require("../context/metaproof"),
|
|
5
|
-
|
|
5
|
+
verifyMetaSupposition = require("../verify/metaSupposition"),
|
|
6
6
|
verifyQualifiedMetastatement = require("../verify/metastatement/qualified"),
|
|
7
7
|
verifyUnqualifiedMetastatement = require("../verify/metastatement/unqualified");
|
|
8
8
|
|
|
9
9
|
const { nodeQuery, nodesQuery } = require("../utilities/query"),
|
|
10
10
|
{ META_SUBPROOF_RULE_NAME, QUALIFIED_METASTATEMENT_RULE_NAME, UNQUALIFIED_METASTATEMENT_RULE_NAME } = require("../ruleNames");
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const metaSuppositionNodeQuery = nodeQuery("/metaSubproof/metaSupposition!"),
|
|
13
13
|
metaDerivationNodeQuery = nodeQuery("/metaSubproof/metaDerivation!"),
|
|
14
14
|
metaDerivationChildNodesQuery = nodesQuery("/metaDerivation/*"),
|
|
15
15
|
qualifiedMetastatementNodeQuery = nodeQuery("/metaSubproof/qualifiedMetastatement!"),
|
|
@@ -89,10 +89,10 @@ function verifyMetaSubproof(metaSubproofNode, context) {
|
|
|
89
89
|
|
|
90
90
|
context = metaproofContext; ///
|
|
91
91
|
|
|
92
|
-
const
|
|
93
|
-
|
|
92
|
+
const metaSuppositionNode = metaSuppositionNodeQuery(metaSubproofNode),
|
|
93
|
+
metaSuppositionVerified = verifyMetaSupposition(metaSuppositionNode, context);
|
|
94
94
|
|
|
95
|
-
if (
|
|
95
|
+
if (metaSuppositionVerified) {
|
|
96
96
|
let metaDerivationVerified = true;
|
|
97
97
|
|
|
98
98
|
const metaDerivationNode = metaDerivationNodeQuery(metaSubproofNode);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const MetaAssertion = require("../metaAssertion"),
|
|
4
|
+
verifyUnqualifiedMetastatement = require("../verify/metastatement/unqualified");
|
|
5
|
+
|
|
6
|
+
const { nodeQuery } = require("../utilities/query");
|
|
7
|
+
|
|
8
|
+
const unqualifiedMetastatementNodeQuery = nodeQuery("/metaSupposition/unqualifiedMetastatement!");
|
|
9
|
+
|
|
10
|
+
function verifyMetaSupposition(metaSuppositionNode, context) {
|
|
11
|
+
const unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(metaSuppositionNode),
|
|
12
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, context),
|
|
13
|
+
metaSuppositionVerified = unqualifiedMetastatementVerified; ///
|
|
14
|
+
|
|
15
|
+
if (metaSuppositionVerified) {
|
|
16
|
+
const metaAssertion = MetaAssertion.fromUnqualifiedMetastatementNode(unqualifiedMetastatementNode);
|
|
17
|
+
|
|
18
|
+
context.addMetaAssertion(metaAssertion);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return metaSuppositionVerified;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = verifyMetaSupposition;
|
package/bin/verify/metaproof.js
CHANGED
|
@@ -5,16 +5,16 @@ const verifyMetaDerivation = require("../verify/metaDerivation"),
|
|
|
5
5
|
|
|
6
6
|
const { nodeQuery } = require("../utilities/query");
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const metaDerivationNodeQuery = nodeQuery("/metaproof/metaDerivation!"),
|
|
9
|
+
qualifiedStatementNodeQuery = nodeQuery("/metaproof/qualifiedMetastatement!"),
|
|
10
|
+
metaProofMetastatementNodeQuery = nodeQuery("/metaproof/qualifiedMetastatement/metastatement!");
|
|
11
11
|
|
|
12
|
-
function verifyMetaproof(metaproofNode, context) {
|
|
12
|
+
function verifyMetaproof(metaproofNode, metastatementNode, context) {
|
|
13
13
|
let metaproofVerified = false;
|
|
14
14
|
|
|
15
15
|
const metaDerivationNode = metaDerivationNodeQuery(metaproofNode);
|
|
16
16
|
|
|
17
|
-
let metaDerivationVerified =
|
|
17
|
+
let metaDerivationVerified = true;
|
|
18
18
|
|
|
19
19
|
if (metaDerivationNode !== null) {
|
|
20
20
|
metaDerivationVerified = verifyMetaDerivation(metaDerivationNode, context);
|
|
@@ -25,18 +25,10 @@ function verifyMetaproof(metaproofNode, context) {
|
|
|
25
25
|
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, context);
|
|
26
26
|
|
|
27
27
|
if (qualifiedMetastatementVerified) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// rule = firstRule, ///
|
|
33
|
-
// metastatementString = nodeAsString(metastatementNode),
|
|
34
|
-
// conclusionMetastatementNode = rule.getConclusionMetastatementNode(),
|
|
35
|
-
// conclusionMetastatementString = nodeAsString(conclusionMetastatementNode);
|
|
36
|
-
//
|
|
37
|
-
// if (metastatementString === conclusionMetastatementString) {
|
|
38
|
-
// metaproofVerified = true;
|
|
39
|
-
// }
|
|
28
|
+
const metaProofMetastatementNode = metaProofMetastatementNodeQuery(metaproofNode),
|
|
29
|
+
metaProofMetastatementNodeMatches = matchMetaProofMetastatementNode(metaProofMetastatementNode, metastatementNode);
|
|
30
|
+
|
|
31
|
+
metaproofVerified = metaProofMetastatementNodeMatches; ///
|
|
40
32
|
}
|
|
41
33
|
}
|
|
42
34
|
|
|
@@ -44,3 +36,83 @@ function verifyMetaproof(metaproofNode, context) {
|
|
|
44
36
|
}
|
|
45
37
|
|
|
46
38
|
module.exports = verifyMetaproof;
|
|
39
|
+
|
|
40
|
+
function matchMetaProofMetastatementNode(metaProofMetastatementNode, metastatementNode) {
|
|
41
|
+
const metaProofNonTerminalNode = metaProofMetastatementNode, ///
|
|
42
|
+
nonTerminalNode = metastatementNode, ///
|
|
43
|
+
metaProofNonTerminalNodeMatches = matchMetaProofNonTerminalNode(metaProofNonTerminalNode, nonTerminalNode),
|
|
44
|
+
metaProofMetastatementNodeMatches = metaProofNonTerminalNodeMatches; ///
|
|
45
|
+
|
|
46
|
+
return metaProofMetastatementNodeMatches;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function matchMetaProofNode(metaProofNode, node) {
|
|
50
|
+
let metaProofNodeMatches = false;
|
|
51
|
+
|
|
52
|
+
const nodeTerminalNode = node.isTerminalNode(),
|
|
53
|
+
ruleNodeTerminalNode = metaProofNode.isTerminalNode();
|
|
54
|
+
|
|
55
|
+
if (nodeTerminalNode === ruleNodeTerminalNode) {
|
|
56
|
+
if (nodeTerminalNode) {
|
|
57
|
+
const terminalNode = node, ///
|
|
58
|
+
metaProofTerminalNode = metaProofNode, ///
|
|
59
|
+
metaProofTerminalNodeMatches = matchMetaProofTerminalNode(metaProofTerminalNode, terminalNode);
|
|
60
|
+
|
|
61
|
+
metaProofNodeMatches = metaProofTerminalNodeMatches; ///
|
|
62
|
+
} else {
|
|
63
|
+
const nonTerminalNode = node, ///
|
|
64
|
+
metaProofNonTerminalNode = metaProofNode, ///
|
|
65
|
+
metaProofNonTerminalNodeMatches = matchMetaProofNonTerminalNode(metaProofNonTerminalNode, nonTerminalNode);
|
|
66
|
+
|
|
67
|
+
metaProofNodeMatches = metaProofNonTerminalNodeMatches; ///
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return metaProofNodeMatches;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function matchMetaProofNodes(metaProofNodes, nodes) {
|
|
75
|
+
let metaProofNodesMatches = false;
|
|
76
|
+
|
|
77
|
+
const nodesLength = nodes.length,
|
|
78
|
+
metaProofNodesLength = metaProofNodes.length;
|
|
79
|
+
|
|
80
|
+
if (nodesLength === metaProofNodesLength) {
|
|
81
|
+
metaProofNodesMatches = nodes.every((node, index) => {
|
|
82
|
+
const metaProofNode = metaProofNodes[index],
|
|
83
|
+
metaProofNodeMatches = matchMetaProofNode(metaProofNode, node);
|
|
84
|
+
|
|
85
|
+
if (metaProofNodeMatches) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return metaProofNodesMatches;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function matchMetaProofTerminalNode(metaProofTerminalNode, terminalNode) {
|
|
95
|
+
const matches = metaProofTerminalNode.match(terminalNode),
|
|
96
|
+
metaProofTerminalNodeMatches = matches; ///
|
|
97
|
+
|
|
98
|
+
return metaProofTerminalNodeMatches;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function matchMetaProofNonTerminalNode(metaProofNonTerminalNode, nonTerminalNode) {
|
|
102
|
+
let metaProofNonTerminalNodeMatches = false;
|
|
103
|
+
|
|
104
|
+
const ruleName = nonTerminalNode.getRuleName(),
|
|
105
|
+
metaProofRuleName = metaProofNonTerminalNode.getRuleName(); ///
|
|
106
|
+
|
|
107
|
+
if (ruleName === metaProofRuleName) {
|
|
108
|
+
const childNodes = nonTerminalNode.getChildNodes(),
|
|
109
|
+
metaProofChildNodes = metaProofNonTerminalNode.getChildNodes(),
|
|
110
|
+
nodes = childNodes, ///
|
|
111
|
+
metaProofNodes = metaProofChildNodes, ///
|
|
112
|
+
metaProofNodesMatches = matchMetaProofNodes(metaProofNodes, nodes);
|
|
113
|
+
|
|
114
|
+
metaProofNonTerminalNodeMatches = metaProofNodesMatches; ///
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return metaProofNonTerminalNodeMatches;
|
|
118
|
+
}
|
|
@@ -23,16 +23,14 @@ function verifyQualifiedMetastatement(qualifiedMetastatementNode, context) {
|
|
|
23
23
|
if (rule !== null) {
|
|
24
24
|
const ruleMatchesMetastatement = rule.matchMetastatement(metastatementNode, context);
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
qualifiedMetastatementVerified = true;
|
|
28
|
-
}
|
|
26
|
+
qualifiedMetastatementVerified = ruleMatchesMetastatement; ///
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
if (qualifiedMetastatementVerified) {
|
|
33
31
|
const metastatementString = nodeAsString(metastatementNode);
|
|
34
32
|
|
|
35
|
-
log.
|
|
33
|
+
log.debug(`Verified the '${metastatementString}' qualified metastatement.`);
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
return qualifiedMetastatementVerified;
|
|
@@ -20,10 +20,10 @@ function verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, context) {
|
|
|
20
20
|
const derived = context.isDerived();
|
|
21
21
|
|
|
22
22
|
if (derived) {
|
|
23
|
-
const metaAssertion = MetaAssertion.
|
|
24
|
-
|
|
23
|
+
const metaAssertion = MetaAssertion.fromMetastatementNode(metastatementNode),
|
|
24
|
+
metaAssertionMatches = context.matchMetaAssertion(metaAssertion);
|
|
25
25
|
|
|
26
|
-
unqualifiedMetastatementVerified =
|
|
26
|
+
unqualifiedMetastatementVerified = metaAssertionMatches; ///
|
|
27
27
|
} else {
|
|
28
28
|
unqualifiedMetastatementVerified = true;
|
|
29
29
|
}
|
|
@@ -32,7 +32,7 @@ function verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, context) {
|
|
|
32
32
|
if (unqualifiedMetastatementVerified) {
|
|
33
33
|
const metastatementString = nodeAsString(metastatementNode);
|
|
34
34
|
|
|
35
|
-
log.
|
|
35
|
+
log.debug(`Verified the '${metastatementString}' unqualified metastatement.`);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
return unqualifiedMetastatementVerified;
|
package/bin/verify/rule.js
CHANGED
|
@@ -4,6 +4,7 @@ const { loggingUtilities } = require("necessary");
|
|
|
4
4
|
|
|
5
5
|
const Rule = require("../rule"),
|
|
6
6
|
verifyLabels = require("../verify/labels"),
|
|
7
|
+
verifyMetaproof = require("../verify/metaproof"),
|
|
7
8
|
verifyConditionalInference = require("../verify/conditinalInference"),
|
|
8
9
|
verifyUnconditionalInference = require("../verify/unconditionalInference");
|
|
9
10
|
|
|
@@ -14,6 +15,7 @@ const { first } = require("../utilities/array"),
|
|
|
14
15
|
const { log } = loggingUtilities;
|
|
15
16
|
|
|
16
17
|
const labelNodesQuery = nodesQuery("/rule/label"),
|
|
18
|
+
metaproofNodeQuery = nodeQuery("/rule/metaproof!"),
|
|
17
19
|
conditionalInferenceNodeQuery = nodeQuery("/rule/conditionalInference!"),
|
|
18
20
|
unconditionalInferenceNodeQuery = nodeQuery("/rule/unconditionalInference!");
|
|
19
21
|
|
|
@@ -34,25 +36,40 @@ function verifyRule(ruleNode, context) {
|
|
|
34
36
|
conditionalInferenceNode = conditionalInferenceNodeQuery(ruleNode),
|
|
35
37
|
unconditionalInferenceNode = unconditionalInferenceNodeQuery(ruleNode);
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
let conditionalInferenceVerified = false,
|
|
40
|
+
unconditionalInferenceVerified = false;
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
if (conditionalInferenceNode !== null) {
|
|
43
|
+
conditionalInferenceVerified = verifyConditionalInference(conditionalInferenceNode, premises, conclusions, context);
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
if (unconditionalInferenceNode !== null) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
ruleVerified = unconditionalInferenceVerified; ///
|
|
47
|
+
unconditionalInferenceVerified = verifyUnconditionalInference(unconditionalInferenceNode, premises, conclusions, context);
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
if (conditionalInferenceVerified || unconditionalInferenceVerified) {
|
|
51
|
+
const metaproofNode = metaproofNodeQuery(ruleNode),
|
|
52
|
+
firstConclusion = first(conclusions),
|
|
53
|
+
conclusion = firstConclusion; ///
|
|
54
|
+
|
|
55
|
+
let metaproofVerified = true;
|
|
56
|
+
|
|
57
|
+
if (metaproofNode !== null) {
|
|
58
|
+
const metastatementNode = conclusion.getMetastatementNode();
|
|
53
59
|
|
|
54
|
-
|
|
60
|
+
metaproofVerified = verifyMetaproof(metaproofNode, metastatementNode, context);
|
|
61
|
+
}
|
|
55
62
|
|
|
63
|
+
if (metaproofVerified) {
|
|
64
|
+
const rule = Rule.fromPremisesConclusionAndLabels(premises, conclusion, labels);
|
|
65
|
+
|
|
66
|
+
context.addRule(rule);
|
|
67
|
+
|
|
68
|
+
ruleVerified = true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (ruleVerified) {
|
|
56
73
|
log.info(`Verified the '${labelsString}' rule.`);
|
|
57
74
|
}
|
|
58
75
|
}
|
package/bin/verify/statement.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { loggingUtilities } = require("necessary");
|
|
4
4
|
|
|
5
5
|
const verifyEquality = require("../verify/equality"),
|
|
6
|
-
verifyTypeAssertion = require("../verify/
|
|
6
|
+
verifyTypeAssertion = require("../verify/assertion/type");
|
|
7
7
|
|
|
8
8
|
const { nodeQuery } = require("../utilities/query"),
|
|
9
9
|
{ nodeAsString } = require("../utilities/string");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const Assertion = require("../assertion"),
|
|
4
|
+
verifyUnqualifiedStatement = require("../verify/statement/unqualified");
|
|
5
|
+
|
|
6
|
+
const { nodeQuery } = require("../utilities/query");
|
|
7
|
+
|
|
8
|
+
const unqualifiedStatementNodeQuery = nodeQuery("/supposition/unqualifiedStatement!");
|
|
9
|
+
|
|
10
|
+
function verifySupposition(suppositionNode, suppositions, context) {
|
|
11
|
+
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(suppositionNode),
|
|
12
|
+
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, context),
|
|
13
|
+
suppositionVerified = unqualifiedStatementVerified;
|
|
14
|
+
|
|
15
|
+
if (suppositionVerified) {
|
|
16
|
+
const supposition = Assertion.fromUnqualifiedStatementNode(unqualifiedStatementNode);
|
|
17
|
+
|
|
18
|
+
suppositions.push(supposition);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return suppositionVerified;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = verifySupposition;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const Conclusion = require("../conclusion"),
|
|
4
|
-
verifyMetaproof = require("../verify/metaproof"),
|
|
5
4
|
MetaproofContext = require("../context/metaproof"),
|
|
6
5
|
verifyUnqualifiedMetastatement = require("../verify/metastatement/unqualified");
|
|
7
6
|
|
|
8
7
|
const { nodeQuery } = require("../utilities/query");
|
|
9
8
|
|
|
10
|
-
const
|
|
11
|
-
metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!"),
|
|
9
|
+
const metastatementNodeQuery = nodeQuery("/unconditionalInference/unqualifiedMetastatement!/metastatement!"),
|
|
12
10
|
unqualifiedMetastatementNodeQuery = nodeQuery("/unconditionalInference/unqualifiedMetastatement!");
|
|
13
11
|
|
|
14
12
|
function verifyUnconditionalInference(unconditionalInferenceNode, premises, conclusions, context) {
|
|
@@ -18,26 +16,16 @@ function verifyUnconditionalInference(unconditionalInferenceNode, premises, conc
|
|
|
18
16
|
|
|
19
17
|
context = metaproofContext; ///
|
|
20
18
|
|
|
21
|
-
const
|
|
19
|
+
const metastatementNode = metastatementNodeQuery(unconditionalInferenceNode),
|
|
20
|
+
unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(unconditionalInferenceNode),
|
|
22
21
|
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, context);
|
|
23
22
|
|
|
24
23
|
if (unqualifiedMetastatementVerified) {
|
|
25
|
-
|
|
24
|
+
const conclusion = Conclusion.fromMetastatementNode(metastatementNode);
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
conclusions.push(conclusion);
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
metaproofVerified = verifyMetaproof(metaproofNode, context);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (metaproofVerified) {
|
|
34
|
-
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
|
35
|
-
conclusion = Conclusion.fromMetastatementNode(metastatementNode);
|
|
36
|
-
|
|
37
|
-
conclusions.push(conclusion);
|
|
38
|
-
|
|
39
|
-
unconditionalInferenceVerified = true;
|
|
40
|
-
}
|
|
28
|
+
unconditionalInferenceVerified = true;
|
|
41
29
|
}
|
|
42
30
|
|
|
43
31
|
return unconditionalInferenceVerified;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "occam-verify-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.272",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-verify-cli",
|
|
7
7
|
"description": "Occam's Verifier",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.15",
|
|
14
14
|
"necessary": "^11.0.40",
|
|
15
|
-
"occam-custom-grammars": "^5.0.
|
|
15
|
+
"occam-custom-grammars": "^5.0.353",
|
|
16
16
|
"occam-dom": "^3.0.171",
|
|
17
17
|
"occam-grammar-utilities": "^7.0.66",
|
|
18
|
-
"occam-grammars": "^1.0.
|
|
18
|
+
"occam-grammars": "^1.0.320",
|
|
19
19
|
"occam-open-cli": "^5.0.37",
|
|
20
20
|
"occam-parsers": "^16.0.122"
|
|
21
21
|
},
|
package/bin/antecedent.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
class Antecedent {
|
|
4
|
-
constructor(statementNodes) {
|
|
5
|
-
this.statementNodes = statementNodes;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
getStatementNodes() {
|
|
9
|
-
return this.statementNodes;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
static fromStatementNodes(statementNodes) {
|
|
13
|
-
const antecedent = new Antecedent(statementNodes);
|
|
14
|
-
|
|
15
|
-
return antecedent;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = Antecedent;
|
package/bin/verify/antecedent.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const Antecedent = require("../antecedent"),
|
|
4
|
-
verifyUnqualifiedStatement = require("../verify/statement/unqualified");
|
|
5
|
-
|
|
6
|
-
const { nodeQuery, nodesQuery } = require("../utilities/query");
|
|
7
|
-
|
|
8
|
-
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement"),
|
|
9
|
-
unqualifiedStatementNodesQuery = nodesQuery("/antecedent/unqualifiedStatement");
|
|
10
|
-
|
|
11
|
-
function verifyAntecedent(antecedentNode, antecedents, context) {
|
|
12
|
-
const unqualifiedStatementNodes = unqualifiedStatementNodesQuery(antecedentNode),
|
|
13
|
-
antecedentVerified = unqualifiedStatementNodes.every((unqualifiedStatementNode) => {
|
|
14
|
-
const unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, context);
|
|
15
|
-
|
|
16
|
-
if (unqualifiedStatementVerified) {
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
if (antecedentVerified) {
|
|
22
|
-
const statementNodes = unqualifiedStatementNodes.map((unqualifiedStatementNode) => {
|
|
23
|
-
const statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
24
|
-
|
|
25
|
-
return statementNode;
|
|
26
|
-
}),
|
|
27
|
-
antecedent = Antecedent.fromStatementNodes(statementNodes);
|
|
28
|
-
|
|
29
|
-
antecedents.push(antecedent);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return antecedentVerified;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
module.exports = verifyAntecedent;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const MetaAssertion = require("../metaAssertion"),
|
|
4
|
-
verifyUnqualifiedMetastatement = require("../verify/metastatement/unqualified");
|
|
5
|
-
|
|
6
|
-
const { nodesQuery } = require("../utilities/query");
|
|
7
|
-
|
|
8
|
-
const unqualifiedMetastatementNodesQuery = nodesQuery("/metaAntecedent/unqualifiedMetastatement");
|
|
9
|
-
|
|
10
|
-
function verifyMetaAntecedent(metaAntecedentNode, context) {
|
|
11
|
-
const unqualifiedMetastatementNodes = unqualifiedMetastatementNodesQuery(metaAntecedentNode),
|
|
12
|
-
metaAntecedentVerified = unqualifiedMetastatementNodes.every((unqualifiedMetastatementNode) => {
|
|
13
|
-
const unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, context);
|
|
14
|
-
|
|
15
|
-
if (unqualifiedMetastatementVerified) {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
if (metaAntecedentVerified) {
|
|
21
|
-
unqualifiedMetastatementNodes.forEach((unqualifiedMetastatementNode) => {
|
|
22
|
-
const metaAssertion = MetaAssertion.fromUnqualifiedMetastatementNode(unqualifiedMetastatementNode);
|
|
23
|
-
|
|
24
|
-
context.addMetaAssertion(metaAssertion);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return metaAntecedentVerified;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
module.exports = verifyMetaAntecedent;
|