occam-verify-cli 0.0.269 → 0.0.270
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/metaAssertion.js +8 -0
- package/bin/rule.js +18 -15
- package/bin/verify/conditinalInference.js +5 -0
- package/bin/verify/metaDerivation.js +1 -0
- package/bin/verify/metaproof.js +1 -3
- package/bin/verify/metastatement/qualified.js +0 -2
- package/bin/verify/rule.js +0 -5
- package/bin/verify/unconditionalInference.js +23 -7
- package/package.json +3 -3
package/bin/metaAssertion.js
CHANGED
|
@@ -10,6 +10,14 @@ class MetaAssertion {
|
|
|
10
10
|
this.metastatementNode = metastatementNode;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
getNonTerminalNode() {
|
|
14
|
+
const nonTerminalNode = (this.metastatementNode !== null) ?
|
|
15
|
+
this.metastatementNode :
|
|
16
|
+
null;
|
|
17
|
+
|
|
18
|
+
return nonTerminalNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
13
21
|
getMetaSubproofNode() {
|
|
14
22
|
return this.metaSubproofNode;
|
|
15
23
|
}
|
package/bin/rule.js
CHANGED
|
@@ -23,15 +23,15 @@ class Rule {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
matchMetastatement(metastatementNode, context) {
|
|
26
|
-
let
|
|
26
|
+
let metaAssertions = context.getMetaAssertions();
|
|
27
27
|
|
|
28
28
|
const premisesLength = this.premises.length,
|
|
29
29
|
start = -premisesLength;
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
metaAssertions = metaAssertions.slice(start); ///
|
|
32
32
|
|
|
33
|
-
const matchesMetastatement = someCombination(
|
|
34
|
-
const premisesMatchConclusion = matchPremisesAndConclusion(this.premises, this.conclusion,
|
|
33
|
+
const matchesMetastatement = someCombination(metaAssertions, (metaAssertions) => {
|
|
34
|
+
const premisesMatchConclusion = matchPremisesAndConclusion(this.premises, this.conclusion, metaAssertions, metastatementNode);
|
|
35
35
|
|
|
36
36
|
if (premisesMatchConclusion) {
|
|
37
37
|
return true;
|
|
@@ -56,24 +56,27 @@ class Rule {
|
|
|
56
56
|
|
|
57
57
|
module.exports = Rule;
|
|
58
58
|
|
|
59
|
-
function matchPremise(premise,
|
|
60
|
-
const
|
|
61
|
-
const nonTerminalNode =
|
|
62
|
-
nonTerminalNodeMatches = premise.matchNonTerminalNode(nonTerminalNode, metaSubstitutions);
|
|
59
|
+
function matchPremise(premise, metaAssertions, metaSubstitutions) {
|
|
60
|
+
const metaAssertion = prune(metaAssertions, (metaAssertion) => {
|
|
61
|
+
const nonTerminalNode = metaAssertion.getNonTerminalNode();
|
|
63
62
|
|
|
64
|
-
if (
|
|
65
|
-
|
|
63
|
+
if (nonTerminalNode !== null) {
|
|
64
|
+
const nonTerminalNodeMatches = premise.matchNonTerminalNode(nonTerminalNode, metaSubstitutions);
|
|
65
|
+
|
|
66
|
+
if (!nonTerminalNodeMatches) { ///
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
66
69
|
}
|
|
67
70
|
}) || null;
|
|
68
71
|
|
|
69
|
-
const premiseMatches = (
|
|
72
|
+
const premiseMatches = (metaAssertion !== null);
|
|
70
73
|
|
|
71
74
|
return premiseMatches;
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
function matchPremises(premise,
|
|
77
|
+
function matchPremises(premise, metaAssertions, metaSubstitutions) {
|
|
75
78
|
const premisesMatches = premise.every((premise) => {
|
|
76
|
-
const premiseMatches = matchPremise(premise,
|
|
79
|
+
const premiseMatches = matchPremise(premise, metaAssertions, metaSubstitutions);
|
|
77
80
|
|
|
78
81
|
if (premiseMatches) {
|
|
79
82
|
return true;
|
|
@@ -91,11 +94,11 @@ function matchConclusion(conclusion, metastatementNode, metaSubstitutions) {
|
|
|
91
94
|
return conclusionMatches;
|
|
92
95
|
}
|
|
93
96
|
|
|
94
|
-
function matchPremisesAndConclusion(premises, conclusion,
|
|
97
|
+
function matchPremisesAndConclusion(premises, conclusion, metaAssertions, metastatementNode) {
|
|
95
98
|
let premisesMatchConclusion = false;
|
|
96
99
|
|
|
97
100
|
const metaSubstitutions = [],
|
|
98
|
-
premisesMatches = matchPremises(premises,
|
|
101
|
+
premisesMatches = matchPremises(premises, metaAssertions, metaSubstitutions);
|
|
99
102
|
|
|
100
103
|
if (premisesMatches) {
|
|
101
104
|
const conclusionMatches = matchConclusion(conclusion, metastatementNode, metaSubstitutions);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const verifyMetaproof = require("../verify/metaproof"),
|
|
4
|
+
MetaproofContext = require("../context/metaproof"),
|
|
4
5
|
verifyConclusion = require("../verify/conclusion"),
|
|
5
6
|
verifyPremiseOrPremises = require("../verify/premiseOrPremises");
|
|
6
7
|
|
|
@@ -13,6 +14,10 @@ const metaproofNodeQuery = nodeQuery("/conditionalInference/metaproof!"),
|
|
|
13
14
|
function verifyConditionalInference(conditionalInferenceNode, premises, conclusions, context) {
|
|
14
15
|
let conditionalInferenceVerified = false;
|
|
15
16
|
|
|
17
|
+
const metaproofContext = MetaproofContext.fromContext(context);
|
|
18
|
+
|
|
19
|
+
context = metaproofContext; ///
|
|
20
|
+
|
|
16
21
|
const premiseOrPremisesNode = premiseOrPremisesNodeQuery(conditionalInferenceNode),
|
|
17
22
|
premiseOrPremisesVerified = verifyPremiseOrPremises(premiseOrPremisesNode, premises, context);
|
|
18
23
|
|
package/bin/verify/metaproof.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
const verifyMetaDerivation = require("../verify/metaDerivation"),
|
|
4
4
|
verifyQualifiedMetastatement = require("../verify/metastatement/qualified");
|
|
5
5
|
|
|
6
|
-
const {
|
|
7
|
-
{ nodeQuery } = require("../utilities/query"),
|
|
8
|
-
{ nodeAsString } = require("../utilities/string");
|
|
6
|
+
const { nodeQuery } = require("../utilities/query");
|
|
9
7
|
|
|
10
8
|
const metastatementNodeQuery = nodeQuery("/qualifiedMetastatement!/metastatement!"),
|
|
11
9
|
metaDerivationNodeQuery = nodeQuery("/metaproof/metaDerivation!"),
|
package/bin/verify/rule.js
CHANGED
|
@@ -4,7 +4,6 @@ const { loggingUtilities } = require("necessary");
|
|
|
4
4
|
|
|
5
5
|
const Rule = require("../rule"),
|
|
6
6
|
verifyLabels = require("../verify/labels"),
|
|
7
|
-
MetaproofContext = require("../context/metaproof"),
|
|
8
7
|
verifyConditionalInference = require("../verify/conditinalInference"),
|
|
9
8
|
verifyUnconditionalInference = require("../verify/unconditionalInference");
|
|
10
9
|
|
|
@@ -30,10 +29,6 @@ function verifyRule(ruleNode, context) {
|
|
|
30
29
|
labelsVerified = verifyLabels(labelNodes, labels, context);
|
|
31
30
|
|
|
32
31
|
if (labelsVerified) {
|
|
33
|
-
const metaproofContext = MetaproofContext.fromContext(context);
|
|
34
|
-
|
|
35
|
-
context = metaproofContext; ///
|
|
36
|
-
|
|
37
32
|
const premises = [],
|
|
38
33
|
conclusions = [],
|
|
39
34
|
conditionalInferenceNode = conditionalInferenceNodeQuery(ruleNode),
|
|
@@ -1,27 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const Conclusion = require("../conclusion"),
|
|
4
|
+
verifyMetaproof = require("../verify/metaproof"),
|
|
5
|
+
MetaproofContext = require("../context/metaproof"),
|
|
4
6
|
verifyUnqualifiedMetastatement = require("../verify/metastatement/unqualified");
|
|
5
7
|
|
|
6
8
|
const { nodeQuery } = require("../utilities/query");
|
|
7
9
|
|
|
8
|
-
const
|
|
10
|
+
const metaproofNodeQuery = nodeQuery("/unconditionalInference/metaproof!"),
|
|
11
|
+
metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!"),
|
|
9
12
|
unqualifiedMetastatementNodeQuery = nodeQuery("/unconditionalInference/unqualifiedMetastatement!");
|
|
10
13
|
|
|
11
14
|
function verifyUnconditionalInference(unconditionalInferenceNode, premises, conclusions, context) {
|
|
12
15
|
let unconditionalInferenceVerified = false;
|
|
13
16
|
|
|
14
|
-
const
|
|
17
|
+
const metaproofContext = MetaproofContext.fromContext(context);
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
context = metaproofContext; ///
|
|
20
|
+
|
|
21
|
+
const unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(unconditionalInferenceNode),
|
|
22
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, context);
|
|
17
23
|
|
|
18
24
|
if (unqualifiedMetastatementVerified) {
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
let metaproofVerified = true;
|
|
26
|
+
|
|
27
|
+
const metaproofNode = metaproofNodeQuery(unconditionalInferenceNode);
|
|
28
|
+
|
|
29
|
+
if (metaproofNode !== null) {
|
|
30
|
+
metaproofVerified = verifyMetaproof(metaproofNode, context);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (metaproofVerified) {
|
|
34
|
+
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
|
35
|
+
conclusion = Conclusion.fromMetastatementNode(metastatementNode);
|
|
21
36
|
|
|
22
|
-
|
|
37
|
+
conclusions.push(conclusion);
|
|
23
38
|
|
|
24
|
-
|
|
39
|
+
unconditionalInferenceVerified = true;
|
|
40
|
+
}
|
|
25
41
|
}
|
|
26
42
|
|
|
27
43
|
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.270",
|
|
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.351",
|
|
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.318",
|
|
19
19
|
"occam-open-cli": "^5.0.37",
|
|
20
20
|
"occam-parsers": "^16.0.122"
|
|
21
21
|
},
|