occam-verify-cli 0.0.271 → 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.
package/bin/axiom.js CHANGED
@@ -3,9 +3,9 @@
3
3
  const { labelsAsString } = require("./utilities/string");
4
4
 
5
5
  class Axiom {
6
- constructor(labels, antecedent, consequent, statementNode) {
6
+ constructor(labels, supposition, consequent, statementNode) {
7
7
  this.labels = labels;
8
- this.antecedent = antecedent;
8
+ this.supposition = supposition;
9
9
  this.consequent = consequent;
10
10
  this.statementNode = statementNode;
11
11
  }
@@ -14,8 +14,8 @@ class Axiom {
14
14
  return this.labels;
15
15
  }
16
16
 
17
- getAntecedent() {
18
- return this.antecedent;
17
+ getSupposition() {
18
+ return this.supposition;
19
19
  }
20
20
 
21
21
  getConsequent() {
@@ -33,16 +33,16 @@ class Axiom {
33
33
  }
34
34
 
35
35
  static fromStatementNodeAndLabels(statementNode, labels) {
36
- const antecedent = null,
36
+ const supposition = null,
37
37
  consequent = null,
38
- axiom = new Axiom(labels, antecedent, consequent, statementNode);
38
+ axiom = new Axiom(labels, supposition, consequent, statementNode);
39
39
 
40
40
  return axiom;
41
41
  }
42
42
 
43
- static fromAntecedentConsequentAndLabels(antecedent, consequent, labels) {
43
+ static fromSuppositionConsequentAndLabels(supposition, consequent, labels) {
44
44
  const statementNode = null,
45
- axiom = new Axiom(labels, antecedent, consequent, statementNode);
45
+ axiom = new Axiom(labels, supposition, consequent, statementNode);
46
46
 
47
47
  return axiom;
48
48
  }
@@ -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
- verifyAntecedent = 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 = verifyAntecedent(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 firstAntecedent = first(antecedents),
37
+ const firstSupposition = first(suppositions),
38
38
  firstConsequent = first(consequents),
39
- antecedent = firstAntecedent, ///
39
+ supposition = firstSupposition, ///
40
40
  consequent = firstConsequent, ///
41
- axiom = Axiom.fromAntecedentConsequentAndLabels(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),
@@ -2,15 +2,15 @@
2
2
 
3
3
  const MetaAssertion = require("../metaAssertion"),
4
4
  MetaproofContext = require("../context/metaproof"),
5
- verifyMetaAntecedent = require("../verify/metaAntecedent"),
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 metaAntecedentNodeQuery = nodeQuery("/metaSubproof/metaAntecedent!"),
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!");
@@ -89,10 +89,10 @@ function verifyMetaSubproof(metaSubproofNode, context) {
89
89
 
90
90
  context = metaproofContext; ///
91
91
 
92
- const metaAntecedentNode = metaAntecedentNodeQuery(metaSubproofNode),
93
- metaAntecedentVerified = verifyMetaAntecedent(metaAntecedentNode, context);
92
+ const metaSuppositionNode = metaSuppositionNodeQuery(metaSubproofNode),
93
+ metaSuppositionVerified = verifyMetaSupposition(metaSuppositionNode, context);
94
94
 
95
- if (metaAntecedentVerified) {
95
+ if (metaSuppositionVerified) {
96
96
  let metaDerivationVerified = true;
97
97
 
98
98
  const metaDerivationNode = metaDerivationNodeQuery(metaSubproofNode);
@@ -5,20 +5,20 @@ const MetaAssertion = require("../metaAssertion"),
5
5
 
6
6
  const { nodeQuery } = require("../utilities/query");
7
7
 
8
- const unqualifiedMetastatementNodeQuery = nodeQuery("/metaAntecedent/unqualifiedMetastatement!");
8
+ const unqualifiedMetastatementNodeQuery = nodeQuery("/metaSupposition/unqualifiedMetastatement!");
9
9
 
10
- function verifyMetaAntecedent(metaAntecedentNode, context) {
11
- const unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(metaAntecedentNode),
10
+ function verifyMetaSupposition(metaSuppositionNode, context) {
11
+ const unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(metaSuppositionNode),
12
12
  unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, context),
13
- metaAntecedentVerified = unqualifiedMetastatementVerified; ///
13
+ metaSuppositionVerified = unqualifiedMetastatementVerified; ///
14
14
 
15
- if (metaAntecedentVerified) {
15
+ if (metaSuppositionVerified) {
16
16
  const metaAssertion = MetaAssertion.fromUnqualifiedMetastatementNode(unqualifiedMetastatementNode);
17
17
 
18
18
  context.addMetaAssertion(metaAssertion);
19
19
  }
20
20
 
21
- return metaAntecedentVerified;
21
+ return metaSuppositionVerified;
22
22
  }
23
23
 
24
- module.exports = verifyMetaAntecedent;
24
+ module.exports = verifyMetaSupposition;
@@ -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 = [],
@@ -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,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.271",
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.352",
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.319",
18
+ "occam-grammars": "^1.0.321",
19
19
  "occam-open-cli": "^5.0.37",
20
20
  "occam-parsers": "^16.0.122"
21
21
  },
@@ -1,24 +0,0 @@
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("/antecedent/unqualifiedStatement!");
9
-
10
- function verifyAntecedent(antecedentNode, antecedents, context) {
11
- const unqualifiedStatementNode = unqualifiedStatementNodeQuery(antecedentNode),
12
- unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, context),
13
- antecedentVerified = unqualifiedStatementVerified;
14
-
15
- if (antecedentVerified) {
16
- const antecedent = Assertion.fromUnqualifiedStatementNode(unqualifiedStatementNode);
17
-
18
- antecedents.push(antecedent);
19
- }
20
-
21
- return antecedentVerified;
22
- }
23
-
24
- module.exports = verifyAntecedent;
@@ -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;