occam-verify-cli 0.0.272 → 0.0.273

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- const { matchBracketedMetastatementChildNode } = require("./utilities/metastatement");
3
+ const { matchBracketedMetastatementChildNode, bracketedMetastatementChildNodeFromChildNodes } = require("./utilities/metastatement");
4
4
 
5
5
  class MetaSubstitution {
6
6
  constructor(metavariableName, nodes) {
@@ -43,6 +43,15 @@ class MetaSubstitution {
43
43
  }
44
44
 
45
45
  static fromMetavariableNameAndNodes(metavariableName, nodes) {
46
+ const bracketedMetastatementChildNode = bracketedMetastatementChildNodeFromChildNodes(nodes);
47
+
48
+ if (bracketedMetastatementChildNode !== null) {
49
+ const nonTerminalNode = bracketedMetastatementChildNode, ///
50
+ childNodes = nonTerminalNode.getChildNodes();
51
+
52
+ nodes = childNodes; ///
53
+ }
54
+
46
55
  const metaSubstitution = new MetaSubstitution(metavariableName, nodes);
47
56
 
48
57
  return metaSubstitution;
@@ -4,8 +4,8 @@ const { first, second, third } = require("../utilities/array"),
4
4
  { METASTATEMENT_RULE_NAME } = require("../ruleNames"),
5
5
  { LEFT_BRACKET, RIGHT_BRACKET, BRACKETED_METASTATEMENT_CHILD_NODES_LENGTH } = require("../constants");
6
6
 
7
- function matchBracketedMetastatementChildNode(childNodes, callback) {
8
- let bracketedMetastatementChildNodeMatches = false;
7
+ function bracketedMetastatementChildNodeFromChildNodes(childNodes) {
8
+ let bracketedMetastatementChildNode = null;
9
9
 
10
10
  const childNodesLength = childNodes.length;
11
11
 
@@ -29,16 +29,27 @@ function matchBracketedMetastatementChildNode(childNodes, callback) {
29
29
  nonTerminalNodeRuleNameMetastatementRuleName = (nonTerminalNodeRuleName === METASTATEMENT_RULE_NAME);
30
30
 
31
31
  if (firstTerminalNodeContentLeftBracket && nonTerminalNodeRuleNameMetastatementRuleName && secondTerminalNodeContentRightBracket) {
32
- const bracketedMetastatementChildNode = nonTerminalNode; ///
33
-
34
- bracketedMetastatementChildNodeMatches = callback(bracketedMetastatementChildNode);
32
+ bracketedMetastatementChildNode = nonTerminalNode; ///
35
33
  }
36
34
  }
37
35
  }
38
36
 
37
+ return bracketedMetastatementChildNode;
38
+ }
39
+
40
+ function matchBracketedMetastatementChildNode(childNodes, callback) {
41
+ let bracketedMetastatementChildNodeMatches = false;
42
+
43
+ const bracketedMetastatementChildNode = bracketedMetastatementChildNodeFromChildNodes(childNodes);
44
+
45
+ if (bracketedMetastatementChildNode !== null) {
46
+ bracketedMetastatementChildNodeMatches = callback(bracketedMetastatementChildNode);
47
+ }
48
+
39
49
  return bracketedMetastatementChildNodeMatches;
40
50
  }
41
51
 
42
52
  module.exports = {
43
- matchBracketedMetastatementChildNode
53
+ matchBracketedMetastatementChildNode,
54
+ bracketedMetastatementChildNodeFromChildNodes
44
55
  };
@@ -2,15 +2,15 @@
2
2
 
3
3
  const Axiom = require("../../axiom"),
4
4
  verifyLabels = require("../../verify/labels"),
5
- verifySupposition = require("../../verify/antecedent"),
6
- verifyConsequent = require("../../verify/consequent");
5
+ verifyConsequent = require("../../verify/consequent"),
6
+ verifySupposition = require("../../verify/supposition");
7
7
 
8
8
  const { first } = require("../../utilities/array"),
9
9
  { nodeQuery, nodesQuery } = require("../../utilities/query");
10
10
 
11
11
  const labelNodesQuery = nodesQuery("/axiom/label"),
12
- antecedentNodeQuery = nodeQuery("/indicativeConditional/antecedent!"),
13
12
  consequentNodeQuery = nodeQuery("/indicativeConditional/consequent!"),
13
+ suppositionNodeQuery = nodeQuery("/indicativeConditional/supposition!"),
14
14
  indicativeConditionalNodeQuery = nodeQuery("/axiom/indicativeConditional!");
15
15
 
16
16
  function verifyIndicativeConditionalAxiom(axiomNode, context) {
@@ -24,21 +24,21 @@ function verifyIndicativeConditionalAxiom(axiomNode, context) {
24
24
  labelsVerified = verifyLabels(labelNodes, labels, context);
25
25
 
26
26
  if (labelsVerified) {
27
- const antecedents = [],
28
- antecedentNode = antecedentNodeQuery(indicativeConditionalNode),
29
- antecedentVerified = verifySupposition(antecedentNode, antecedents, context);
27
+ const suppositions = [],
28
+ suppositionNode = suppositionNodeQuery(indicativeConditionalNode),
29
+ suppositionVerified = verifySupposition(suppositionNode, suppositions, context);
30
30
 
31
- if (antecedentVerified) {
31
+ if (suppositionVerified) {
32
32
  const consequents = [],
33
33
  consequentNode = consequentNodeQuery(indicativeConditionalNode),
34
34
  consequentVerified = verifyConsequent(consequentNode, consequents, context);
35
35
 
36
36
  if (consequentVerified) {
37
- const firstSupposition = first(antecedents),
37
+ const firstSupposition = first(suppositions),
38
38
  firstConsequent = first(consequents),
39
- antecedent = firstSupposition, ///
39
+ supposition = firstSupposition, ///
40
40
  consequent = firstConsequent, ///
41
- axiom = Axiom.fromSuppositionConsequentAndLabels(antecedent, consequent, labels);
41
+ axiom = Axiom.fromSuppositionConsequentAndLabels(supposition, consequent, labels);
42
42
 
43
43
  context.addAxiom(axiom);
44
44
 
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
 
3
- const verifyMetaproof = require("../verify/metaproof"),
4
- MetaproofContext = require("../context/metaproof"),
5
- verifyConclusion = require("../verify/conclusion"),
3
+ const verifyConclusion = require("../verify/conclusion"),
6
4
  verifyPremiseOrPremises = require("../verify/premiseOrPremises");
7
5
 
8
6
  const { nodeQuery } = require("../utilities/query");
@@ -15,10 +13,6 @@ const conclusionNodeQuery = nodeQuery("/conditionalInference/conclusion!"),
15
13
  function verifyConditionalInference(conditionalInferenceNode, premises, conclusions, context) {
16
14
  let conditionalInferenceVerified = false;
17
15
 
18
- const metaproofContext = MetaproofContext.fromContext(context);
19
-
20
- context = metaproofContext; ///
21
-
22
16
  const conclusionNode = conclusionNodeQuery(conditionalInferenceNode),
23
17
  metastatementNode = metastatementNodeQuery(conditionalInferenceNode),
24
18
  premiseOrPremisesNode = premiseOrPremisesNodeQuery(conditionalInferenceNode),
@@ -9,8 +9,8 @@ const MetaAssertion = require("../metaAssertion"),
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 metaSuppositionNodeQuery = nodeQuery("/metaSubproof/metaSupposition!"),
13
- metaDerivationNodeQuery = nodeQuery("/metaSubproof/metaDerivation!"),
12
+ const metaDerivationNodeQuery = nodeQuery("/metaSubproof/metaDerivation!"),
13
+ metaSuppositionNodeQuery = nodeQuery("/metaSubproof/metaSupposition!"),
14
14
  metaDerivationChildNodesQuery = nodesQuery("/metaDerivation/*"),
15
15
  qualifiedMetastatementNodeQuery = nodeQuery("/metaSubproof/qualifiedMetastatement!"),
16
16
  unqualifiedMetastatementNodeQuery = nodeQuery("/metaSubproof/unqualifiedMetastatement!");
@@ -5,6 +5,7 @@ const { loggingUtilities } = require("necessary");
5
5
  const Rule = require("../rule"),
6
6
  verifyLabels = require("../verify/labels"),
7
7
  verifyMetaproof = require("../verify/metaproof"),
8
+ MetaproofContext = require("../context/metaproof"),
8
9
  verifyConditionalInference = require("../verify/conditinalInference"),
9
10
  verifyUnconditionalInference = require("../verify/unconditionalInference");
10
11
 
@@ -25,6 +26,10 @@ function verifyRule(ruleNode, context) {
25
26
  const labelNodes = labelNodesQuery(ruleNode),
26
27
  labelsString = nodesAsString(labelNodes);
27
28
 
29
+ const metaproofContext = MetaproofContext.fromContext(context);
30
+
31
+ context = metaproofContext; ///
32
+
28
33
  log.debug(`Verifying the '${labelsString}' rule...`);
29
34
 
30
35
  const labels = [],
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  const Conclusion = require("../conclusion"),
4
- MetaproofContext = require("../context/metaproof"),
5
4
  verifyUnqualifiedMetastatement = require("../verify/metastatement/unqualified");
6
5
 
7
6
  const { nodeQuery } = require("../utilities/query");
@@ -12,10 +11,6 @@ const metastatementNodeQuery = nodeQuery("/unconditionalInference/unqualifiedMet
12
11
  function verifyUnconditionalInference(unconditionalInferenceNode, premises, conclusions, context) {
13
12
  let unconditionalInferenceVerified = false;
14
13
 
15
- const metaproofContext = MetaproofContext.fromContext(context);
16
-
17
- context = metaproofContext; ///
18
-
19
14
  const metastatementNode = metastatementNodeQuery(unconditionalInferenceNode),
20
15
  unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(unconditionalInferenceNode),
21
16
  unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, context);
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.272",
4
+ "version": "0.0.273",
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.353",
15
+ "occam-custom-grammars": "^5.0.354",
16
16
  "occam-dom": "^3.0.171",
17
17
  "occam-grammar-utilities": "^7.0.66",
18
- "occam-grammars": "^1.0.320",
18
+ "occam-grammars": "^1.0.321",
19
19
  "occam-open-cli": "^5.0.37",
20
20
  "occam-parsers": "^16.0.122"
21
21
  },
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- const verifyUnqualifiedMetaStatement = require("../verify/metastatement/unqualified");
4
-
5
- const { nodeQuery } = require("../utilities/query");
6
-
7
- const unqualifiedMetaStatementNodeQuery = nodeQuery("/metaConsequent/unqualifiedMetaStatement!");
8
-
9
- function verifyMetaConsequent(metaConsequentNode, metaConsequents, context) {
10
- let metaConsequentVerified = false;
11
-
12
- const unqualifiedMetaStatementNode = unqualifiedMetaStatementNodeQuery(metaConsequentNode);
13
-
14
- if (unqualifiedMetaStatementNode !== null) {
15
- const unqualifiedMetaStatementVerified = verifyUnqualifiedMetaStatement(unqualifiedMetaStatementNode, context);
16
-
17
- metaConsequentVerified = unqualifiedMetaStatementVerified;
18
- }
19
-
20
- return metaConsequentVerified;
21
- }
22
-
23
- module.exports = verifyMetaConsequent;