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
package/bin/metaSubstitution.js
CHANGED
|
@@ -1,29 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
const { matchBracketedMetastatementChildNode } = require("./utilities/metastatement");
|
|
4
|
+
|
|
3
5
|
class MetaSubstitution {
|
|
4
|
-
constructor(metavariableName,
|
|
6
|
+
constructor(metavariableName, nodes) {
|
|
5
7
|
this.metavariableName = metavariableName;
|
|
6
|
-
this.
|
|
8
|
+
this.nodes = nodes;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
getMetavariableName() {
|
|
10
12
|
return this.metavariableName;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
return this.
|
|
15
|
+
getNodes() {
|
|
16
|
+
return this.nodes;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
matchNodes(nodes) {
|
|
20
|
+
let matches;
|
|
21
|
+
|
|
22
|
+
const metaSubstitutionNodes = this.nodes, ///
|
|
23
|
+
metaSubstitutionNonTerminalNodeMatches = matchMetaSubstitutionNodes(metaSubstitutionNodes, nodes);
|
|
24
|
+
|
|
25
|
+
matches = metaSubstitutionNonTerminalNodeMatches; ///
|
|
26
|
+
|
|
27
|
+
if (!matches) {
|
|
28
|
+
const childNodes = nodes, ///
|
|
29
|
+
bracketedMetastatementChildNodeMatches = matchBracketedMetastatementChildNode(childNodes, (bracketedMetastatementChildNode) => {
|
|
30
|
+
const nonTerminalNode = bracketedMetastatementChildNode, ///
|
|
31
|
+
childNodes = nonTerminalNode.getChildNodes(),
|
|
32
|
+
nodes = childNodes, ///
|
|
33
|
+
metaAssertionNonTerminalNodeMatches = matchMetaSubstitutionNodes(metaSubstitutionNodes, nodes),
|
|
34
|
+
bracketedMetastatementChildNodeMatches = metaAssertionNonTerminalNodeMatches; ///
|
|
35
|
+
|
|
36
|
+
return bracketedMetastatementChildNodeMatches;
|
|
37
|
+
});
|
|
21
38
|
|
|
22
|
-
|
|
39
|
+
matches = bracketedMetastatementChildNodeMatches; ///
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return matches;
|
|
23
43
|
}
|
|
24
44
|
|
|
25
|
-
static
|
|
26
|
-
const metaSubstitution = new MetaSubstitution(metavariableName,
|
|
45
|
+
static fromMetavariableNameAndNodes(metavariableName, nodes) {
|
|
46
|
+
const metaSubstitution = new MetaSubstitution(metavariableName, nodes);
|
|
27
47
|
|
|
28
48
|
return metaSubstitution;
|
|
29
49
|
}
|
|
@@ -56,17 +76,15 @@ function matchMetaSubstitutionNode(metaSubstitutionNode, node) {
|
|
|
56
76
|
return metaSubstitutionNodeMatches;
|
|
57
77
|
}
|
|
58
78
|
|
|
59
|
-
function
|
|
60
|
-
let
|
|
79
|
+
function matchMetaSubstitutionNodes(metaSubstitutionNodes, nodes) {
|
|
80
|
+
let metaSubstitutionNodesMatches = false;
|
|
61
81
|
|
|
62
|
-
const
|
|
63
|
-
|
|
82
|
+
const nodesLength = nodes.length,
|
|
83
|
+
metaSubstitutionNodesLength = metaSubstitutionNodes.length;
|
|
64
84
|
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
metaSubstitutionNode = metaSubstitutionChildNode, ///
|
|
69
|
-
node = childNode, ///
|
|
85
|
+
if (nodesLength === metaSubstitutionNodesLength) {
|
|
86
|
+
metaSubstitutionNodesMatches = nodes.every((node, index) => {
|
|
87
|
+
const metaSubstitutionNode = metaSubstitutionNodes[index],
|
|
70
88
|
metaSubstitutionNodeMatches = matchMetaSubstitutionNode(metaSubstitutionNode, node);
|
|
71
89
|
|
|
72
90
|
if (metaSubstitutionNodeMatches) {
|
|
@@ -75,17 +93,12 @@ function matchMetaSubstitutionChildNodes(metaSubstitutionChildNodes, childNodes)
|
|
|
75
93
|
})
|
|
76
94
|
}
|
|
77
95
|
|
|
78
|
-
return
|
|
96
|
+
return metaSubstitutionNodesMatches;
|
|
79
97
|
}
|
|
80
98
|
|
|
81
99
|
function matchMetaSubstitutionTerminalNode(metaSubstitutionTerminalNode, terminalNode) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const matches = metaSubstitutionTerminalNode.match(terminalNode);
|
|
85
|
-
|
|
86
|
-
if (matches) {
|
|
87
|
-
metaSubstitutionTerminalNodeMatches = true;
|
|
88
|
-
}
|
|
100
|
+
const matches = metaSubstitutionTerminalNode.match(terminalNode),
|
|
101
|
+
metaSubstitutionTerminalNodeMatches = matches; ///
|
|
89
102
|
|
|
90
103
|
return metaSubstitutionTerminalNodeMatches;
|
|
91
104
|
}
|
|
@@ -99,9 +112,11 @@ function matchMetaSubstitutionNonTerminalNode(metaSubstitutionNonTerminalNode, n
|
|
|
99
112
|
if (ruleName === metaSubstitutionRuleName) {
|
|
100
113
|
const childNodes = nonTerminalNode.getChildNodes(),
|
|
101
114
|
metaSubstitutionChildNodes = metaSubstitutionNonTerminalNode.getChildNodes(),
|
|
102
|
-
|
|
115
|
+
nodes = childNodes, ///
|
|
116
|
+
metaSubstitutionNodes = metaSubstitutionChildNodes, ///
|
|
117
|
+
metaSubstitutionNodesMatches = matchMetaSubstitutionNodes(metaSubstitutionNodes, nodes);
|
|
103
118
|
|
|
104
|
-
metaSubstitutionNonTerminalNodeMatches =
|
|
119
|
+
metaSubstitutionNonTerminalNodeMatches = metaSubstitutionNodesMatches; ///
|
|
105
120
|
}
|
|
106
121
|
|
|
107
122
|
return metaSubstitutionNonTerminalNodeMatches;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
[[0,1,2],[1,0,2],[1,2,0],[0,2,1],[2,0,1],[2,1,0],[0,1,3],[1,0,3],[1,3,0],[0,3,1],[3,0,1],[3,1,0],[0,1,4],[1,0,4],[1,4,0],[0,4,1],[4,0,1],[4,1,0],[0,2,3],[2,0,3],[2,3,0],[0,3,2],[3,0,2],[3,2,0],[0,2,4],[2,0,4],[2,4,0],[0,4,2],[4,0,2],[4,2,0],[0,3,4],[3,0,4],[3,4,0],[0,4,3],[4,0,3],[4,3,0],[1,2,3],[2,1,3],[2,3,1],[1,3,2],[3,1,2],[3,2,1],[1,2,4],[2,1,4],[2,4,1],[1,4,2],[4,1,2],[4,2,1],[1,3,4],[3,1,4],[3,4,1],[1,4,3],[4,1,3],[4,3,1],[2,3,4],[3,2,4],[3,4,2],[2,4,3],[4,2,3],[4,3,2]]
|