occam-verify-cli 0.0.682 → 0.0.684

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.
Files changed (130) hide show
  1. package/lib/assignment/equality.js +60 -0
  2. package/lib/assignment/variable.js +60 -0
  3. package/lib/axiom.js +4 -4
  4. package/lib/axiomLemmaTheoremConjecture.js +29 -29
  5. package/lib/collection.js +154 -0
  6. package/lib/combinator.js +1 -1
  7. package/lib/conclusion.js +5 -5
  8. package/lib/conjecture.js +4 -4
  9. package/lib/consequent.js +3 -3
  10. package/lib/constructor.js +1 -1
  11. package/lib/context/file.js +9 -2
  12. package/lib/context/local.js +330 -0
  13. package/lib/context/localMeta.js +192 -0
  14. package/lib/context/release.js +1 -1
  15. package/lib/equality.js +19 -87
  16. package/lib/label.js +1 -1
  17. package/lib/lemma.js +4 -4
  18. package/lib/log.js +1 -1
  19. package/lib/metaType.js +1 -1
  20. package/lib/metavariable.js +1 -1
  21. package/lib/ocmbinator/bracketed.js +1 -1
  22. package/lib/premise.js +9 -9
  23. package/lib/rule.js +25 -25
  24. package/lib/step/metaproof.js +1 -1
  25. package/lib/step/proof.js +1 -1
  26. package/lib/substitution/metastatementForMetavariable.js +1 -1
  27. package/lib/substitution/statementForMetavariable.js +1 -1
  28. package/lib/substitution/termForVariable.js +1 -1
  29. package/lib/supposition.js +5 -5
  30. package/lib/term.js +68 -0
  31. package/lib/theorem.js +4 -4
  32. package/lib/type.js +5 -5
  33. package/lib/utilities/array.js +4 -4
  34. package/lib/utilities/collection.js +107 -0
  35. package/lib/variable.js +1 -1
  36. package/lib/verifier/node/metastatement.js +9 -9
  37. package/lib/verifier/node/statementAsCombinator.js +1 -1
  38. package/lib/verifier/node/termAsConstructor.js +2 -2
  39. package/lib/verifier/node.js +1 -1
  40. package/lib/verifier/nodes/metastatementForMetavariable/conclusion.js +1 -1
  41. package/lib/verifier/nodes/metastatementForMetavariable/premise.js +1 -1
  42. package/lib/verifier/nodes/metastatementForMetavariable.js +8 -8
  43. package/lib/verifier/nodes/statement.js +1 -1
  44. package/lib/verifier/nodes/statementForMetavariable/conclusion.js +1 -1
  45. package/lib/verifier/nodes/statementForMetavariable/premise.js +1 -1
  46. package/lib/verifier/nodes/statementForMetavariable.js +9 -9
  47. package/lib/verifier/nodes/term.js +3 -3
  48. package/lib/verifier/nodes/termForVariable/consequent.js +1 -1
  49. package/lib/verifier/nodes/termForVariable/supposition.js +1 -1
  50. package/lib/verifier/nodes/termForVariable.js +11 -11
  51. package/lib/verifier/nodes.js +1 -1
  52. package/lib/verify/axiom.js +6 -6
  53. package/lib/verify/conclusion.js +6 -6
  54. package/lib/verify/conjecture.js +7 -7
  55. package/lib/verify/consequent.js +6 -6
  56. package/lib/verify/derivation.js +17 -17
  57. package/lib/verify/equality.js +50 -18
  58. package/lib/verify/lemma.js +7 -7
  59. package/lib/verify/metastatement/qualified.js +7 -7
  60. package/lib/verify/metastatement/unqualified.js +7 -7
  61. package/lib/verify/metastatement.js +12 -12
  62. package/lib/verify/premise.js +7 -7
  63. package/lib/verify/proof.js +10 -7
  64. package/lib/verify/rule.js +6 -6
  65. package/lib/verify/ruleDerivation.js +17 -17
  66. package/lib/verify/ruleProof.js +6 -6
  67. package/lib/verify/statement/qualified.js +15 -15
  68. package/lib/verify/statement/unqualified.js +7 -7
  69. package/lib/verify/supposition.js +8 -8
  70. package/lib/verify/term.js +32 -31
  71. package/lib/verify/terms.js +11 -17
  72. package/lib/verify/theorem.js +7 -7
  73. package/lib/verify/typeAssertion.js +3 -3
  74. package/package.json +2 -2
  75. package/src/assignment/equality.js +21 -0
  76. package/src/assignment/variable.js +21 -0
  77. package/src/axiom.js +1 -1
  78. package/src/axiomLemmaTheoremConjecture.js +26 -26
  79. package/src/collection.js +101 -0
  80. package/src/conclusion.js +6 -6
  81. package/src/conjecture.js +1 -1
  82. package/src/consequent.js +4 -4
  83. package/src/context/file.js +9 -1
  84. package/src/context/local.js +311 -0
  85. package/src/context/{metaproof.js → localMeta.js} +16 -17
  86. package/src/equality.js +17 -111
  87. package/src/lemma.js +1 -1
  88. package/src/premise.js +12 -12
  89. package/src/rule.js +24 -24
  90. package/src/supposition.js +8 -8
  91. package/src/term.js +30 -0
  92. package/src/theorem.js +1 -1
  93. package/src/type.js +3 -3
  94. package/src/utilities/array.js +1 -1
  95. package/src/utilities/collection.js +83 -0
  96. package/src/verifier/node/metastatement.js +8 -8
  97. package/src/verifier/node/termAsConstructor.js +2 -2
  98. package/src/verifier/nodes/metastatementForMetavariable.js +7 -7
  99. package/src/verifier/nodes/statementForMetavariable.js +8 -8
  100. package/src/verifier/nodes/term.js +5 -4
  101. package/src/verifier/nodes/termForVariable.js +15 -14
  102. package/src/verify/axiom.js +5 -5
  103. package/src/verify/conclusion.js +5 -5
  104. package/src/verify/conjecture.js +6 -6
  105. package/src/verify/consequent.js +5 -5
  106. package/src/verify/derivation.js +16 -16
  107. package/src/verify/equality.js +81 -24
  108. package/src/verify/lemma.js +6 -6
  109. package/src/verify/metastatement/qualified.js +7 -7
  110. package/src/verify/metastatement/unqualified.js +6 -6
  111. package/src/verify/metastatement.js +11 -11
  112. package/src/verify/premise.js +6 -6
  113. package/src/verify/proof.js +13 -10
  114. package/src/verify/rule.js +5 -5
  115. package/src/verify/ruleDerivation.js +16 -16
  116. package/src/verify/ruleProof.js +5 -5
  117. package/src/verify/statement/qualified.js +15 -15
  118. package/src/verify/statement/unqualified.js +6 -6
  119. package/src/verify/supposition.js +7 -7
  120. package/src/verify/term.js +38 -35
  121. package/src/verify/terms.js +14 -28
  122. package/src/verify/theorem.js +6 -6
  123. package/src/verify/typeAssertion.js +3 -2
  124. package/lib/assignment.js +0 -74
  125. package/lib/context/metaproof.js +0 -192
  126. package/lib/context/proof.js +0 -245
  127. package/lib/verifier/nodes/equality.js +0 -155
  128. package/src/assignment.js +0 -36
  129. package/src/context/proof.js +0 -205
  130. package/src/verifier/nodes/equality.js +0 -68
@@ -1,28 +1,31 @@
1
1
  "use strict";
2
2
 
3
- import ProofContext from "../context/proof";
3
+ import LocalContext from "../context/local";
4
4
  import verifyDerivation from "../verify/derivation";
5
5
 
6
6
  import { nodeQuery } from "../utilities/query";
7
7
 
8
8
  const derivationNodeQuery = nodeQuery("/proof/derivation!");
9
9
 
10
- export default function verifyProof(proofNode, conclusion, proofContext) {
10
+ export default function verifyProof(proofNode, conclusion, localContext) {
11
11
  let proofVerified = false;
12
12
 
13
- proofContext = ProofContext.fromProofContext(proofContext); ///
13
+ localContext = LocalContext.fromLocalContext(localContext); ///
14
14
 
15
15
  const derivationNode = derivationNodeQuery(proofNode),
16
- derivationVerified = verifyDerivation(derivationNode, proofContext);
16
+ derivationVerified = verifyDerivation(derivationNode, localContext);
17
17
 
18
18
  if (derivationVerified) {
19
- const lastProofStep = proofContext.getLastProofStep(),
20
- proofStep = lastProofStep, ///
21
- statementNode = proofStep.getStatementNode(),
22
- conclusionStatementNode = conclusion.getStatementNode(),
23
- statementNodeMatchConclusionStatementNode = statementNode.match(conclusionStatementNode);
19
+ const lastProofStep = localContext.getLastProofStep();
24
20
 
25
- proofVerified = statementNodeMatchConclusionStatementNode; ///
21
+ if (lastProofStep !== null) {
22
+ const proofStep = lastProofStep, ///
23
+ statementNode = proofStep.getStatementNode(),
24
+ conclusionStatementNode = conclusion.getStatementNode(),
25
+ statementNodeMatchConclusionStatementNode = statementNode.match(conclusionStatementNode);
26
+
27
+ proofVerified = statementNodeMatchConclusionStatementNode; ///
28
+ }
26
29
  }
27
30
 
28
31
  return proofVerified;
@@ -4,7 +4,7 @@ import Rule from "../rule";
4
4
  import verifyLabels from "../verify/labels";
5
5
  import verifyPremise from "../verify/premise";
6
6
  import verifyRuleProof from "../verify/ruleProof";
7
- import MetaproofContext from "../context/metaproof";
7
+ import LocalMetaContext from "../context/localMeta";
8
8
  import verifyConclusion from "../verify/conclusion";
9
9
 
10
10
  import { first } from "../utilities/array";
@@ -20,7 +20,7 @@ export default function verifyRule(ruleNode, fileContext) {
20
20
 
21
21
  const labelNodes = labelNodesQuery(ruleNode),
22
22
  labelsString = fileContext.nodesAsString(labelNodes),
23
- metaProofContext = MetaproofContext.fromFileContext(fileContext);
23
+ localMetaContext = LocalMetaContext.fromFileContext(fileContext);
24
24
 
25
25
  fileContext.trace(`Verifying the '${labelsString}' rule...`, ruleNode);
26
26
 
@@ -31,7 +31,7 @@ export default function verifyRule(ruleNode, fileContext) {
31
31
  const premises = [],
32
32
  premiseNodes = premisesNodeQuery(ruleNode),
33
33
  premisesVerified = premiseNodes.every((premiseNode) => {
34
- const premiseVerified = verifyPremise(premiseNode, premises, metaProofContext);
34
+ const premiseVerified = verifyPremise(premiseNode, premises, localMetaContext);
35
35
 
36
36
  if (premiseVerified) {
37
37
  return true;
@@ -41,7 +41,7 @@ export default function verifyRule(ruleNode, fileContext) {
41
41
  if (premisesVerified) {
42
42
  const conclusions = [],
43
43
  conclusionNode = conclusionNodeQuery(ruleNode),
44
- conclusionVerified = verifyConclusion(conclusionNode, conclusions, metaProofContext);
44
+ conclusionVerified = verifyConclusion(conclusionNode, conclusions, localMetaContext);
45
45
 
46
46
  if (conclusionVerified) {
47
47
  const ruleProofNode = ruleProofNodeQuery(ruleNode),
@@ -51,7 +51,7 @@ export default function verifyRule(ruleNode, fileContext) {
51
51
  let ruleProofVerified = true; ///
52
52
 
53
53
  if (ruleProofNode !== null) {
54
- ruleProofVerified = verifyRuleProof(ruleProofNode, conclusion, metaProofContext);
54
+ ruleProofVerified = verifyRuleProof(ruleProofNode, conclusion, localMetaContext);
55
55
  }
56
56
 
57
57
  if (ruleProofVerified) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import MetaproofStep from "../step/metaproof";
4
4
  import verifyPremise from "../verify/premise";
5
- import MetaproofContext from "../context/metaproof";
5
+ import LocalMetaContext from "../context/localMeta";
6
6
  import verifyQualifiedMetastatement from "../verify/metastatement/qualified";
7
7
  import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
8
8
 
@@ -14,13 +14,13 @@ const childNodesQuery = nodesQuery("/ruleDerivation|ruleSubDerivation/*"),
14
14
  metastatementNodeQuery = nodeQuery("/qualifiedMetastatement|unqualifiedMetastatement/metastatement!"),
15
15
  ruleSubDerivationNodeQuery = nodeQuery("/ruleSubproof/ruleSubDerivation");
16
16
 
17
- export default function verifyRuleDerivation(ruleDerivationNode, metaproofContext) {
17
+ export default function verifyRuleDerivation(ruleDerivationNode, localMetaContext) {
18
18
  let ruleDerivationVerified;
19
19
 
20
20
  const childNodes = childNodesQuery(ruleDerivationNode);
21
21
 
22
22
  ruleDerivationVerified = childNodes.every((childNode) => {
23
- const childVerified = verifyChild(childNode, metaproofContext);
23
+ const childVerified = verifyChild(childNode, localMetaContext);
24
24
 
25
25
  if (childVerified) {
26
26
  return true;
@@ -30,13 +30,13 @@ export default function verifyRuleDerivation(ruleDerivationNode, metaproofContex
30
30
  return ruleDerivationVerified;
31
31
  }
32
32
 
33
- function verifyRuleSubDerivation(ruleSubDerivationNode, metaproofContext) {
33
+ function verifyRuleSubDerivation(ruleSubDerivationNode, localMetaContext) {
34
34
  let ruleSubDerivationVerified;
35
35
 
36
36
  const childNodes = childNodesQuery(ruleSubDerivationNode);
37
37
 
38
38
  ruleSubDerivationVerified = childNodes.every((childNode) => {
39
- const childVerified = verifyChild(childNode, metaproofContext);
39
+ const childVerified = verifyChild(childNode, localMetaContext);
40
40
 
41
41
  if (childVerified) {
42
42
  return true;
@@ -46,15 +46,15 @@ function verifyRuleSubDerivation(ruleSubDerivationNode, metaproofContext) {
46
46
  return ruleSubDerivationVerified;
47
47
  }
48
48
 
49
- function verifyRuleSubproof(ruleSubproofNode, metaproofContext) {
49
+ function verifyRuleSubproof(ruleSubproofNode, localMetaContext) {
50
50
  let ruleSubproofVerified = false;
51
51
 
52
- metaproofContext = MetaproofContext.fromMetaproofContext(metaproofContext); ///
52
+ localMetaContext = LocalMetaContext.fromLocalMetaContext(localMetaContext); ///
53
53
 
54
54
  const premises = [],
55
55
  premiseNodes = premiseNodesQuery(ruleSubproofNode),
56
56
  premisesVerified = premiseNodes.every((premiseNode) => {
57
- const premiseVerified = verifyPremise(premiseNode, premises, metaproofContext);
57
+ const premiseVerified = verifyPremise(premiseNode, premises, localMetaContext);
58
58
 
59
59
  if (premiseVerified) {
60
60
  return true;
@@ -63,7 +63,7 @@ function verifyRuleSubproof(ruleSubproofNode, metaproofContext) {
63
63
 
64
64
  if (premisesVerified) {
65
65
  const ruleSubDerivationNode = ruleSubDerivationNodeQuery(ruleSubproofNode),
66
- ruleSubDerivationVerified = verifyRuleSubDerivation(ruleSubDerivationNode, metaproofContext);
66
+ ruleSubDerivationVerified = verifyRuleSubDerivation(ruleSubDerivationNode, localMetaContext);
67
67
 
68
68
  if (ruleSubDerivationVerified) {
69
69
  ruleSubproofVerified = true;
@@ -73,7 +73,7 @@ function verifyRuleSubproof(ruleSubproofNode, metaproofContext) {
73
73
  return ruleSubproofVerified;
74
74
  }
75
75
 
76
- function verifyChild(childNode, metaproofContext) {
76
+ function verifyChild(childNode, localMetaContext) {
77
77
  let childVerified;
78
78
 
79
79
  const childNodeRuleName = childNode.getRuleName();
@@ -81,12 +81,12 @@ function verifyChild(childNode, metaproofContext) {
81
81
  switch (childNodeRuleName) {
82
82
  case RULE_SUBPROOF_RULE_NAME: {
83
83
  const ruleSubproofNode = childNode, ///
84
- ruleSubproofVerified = verifyRuleSubproof(ruleSubproofNode, metaproofContext);
84
+ ruleSubproofVerified = verifyRuleSubproof(ruleSubproofNode, localMetaContext);
85
85
 
86
86
  if (ruleSubproofVerified) {
87
87
  const metaproofStep = MetaproofStep.fromRuleSubproofNode(ruleSubproofNode);
88
88
 
89
- metaproofContext.addMetaproofStep(metaproofStep);
89
+ localMetaContext.addMetaproofStep(metaproofStep);
90
90
 
91
91
  childVerified = true;
92
92
  }
@@ -98,13 +98,13 @@ function verifyChild(childNode, metaproofContext) {
98
98
  const derived = true,
99
99
  assignments = [],
100
100
  qualifiedMetastatementNode = childNode, ///
101
- qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, assignments, derived, metaproofContext);
101
+ qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, assignments, derived, localMetaContext);
102
102
 
103
103
  if (qualifiedMetastatementVerified) {
104
104
  const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode),
105
105
  metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode);
106
106
 
107
- metaproofContext.addMetaproofStep(metaproofStep);
107
+ localMetaContext.addMetaproofStep(metaproofStep);
108
108
 
109
109
  childVerified = qualifiedMetastatementVerified; ///
110
110
  }
@@ -115,13 +115,13 @@ function verifyChild(childNode, metaproofContext) {
115
115
  case UNQUALIFIED_METASTATEMENT_RULE_NAME: {
116
116
  const derived = true,
117
117
  unqualifiedMetastatementNode = childNode, ///
118
- unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, derived, metaproofContext);
118
+ unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, derived, localMetaContext);
119
119
 
120
120
  if (unqualifiedMetastatementVerified) {
121
121
  const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
122
122
  metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode);
123
123
 
124
- metaproofContext.addMetaproofStep(metaproofStep);
124
+ localMetaContext.addMetaproofStep(metaproofStep);
125
125
 
126
126
  childVerified = true;
127
127
  }
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
 
3
- import MetaproofContext from "../context/metaproof";
3
+ import LocalMetaContext from "../context/localMeta";
4
4
  import verifyRuleDerivation from "../verify/ruleDerivation";
5
5
 
6
6
  import { nodeQuery } from "../utilities/query";
7
7
 
8
8
  const ruleDerivationNodeQuery = nodeQuery("/ruleProof/ruleDerivation!");
9
9
 
10
- export default function verifyRuleProof(ruleProofNode, conclusion, metaproofContext) {
10
+ export default function verifyRuleProof(ruleProofNode, conclusion, localMetaContext) {
11
11
  let ruleProofVerified = false;
12
12
 
13
- metaproofContext = MetaproofContext.fromMetaproofContext(metaproofContext); ///
13
+ localMetaContext = LocalMetaContext.fromLocalMetaContext(localMetaContext); ///
14
14
 
15
15
  const ruleDerivationNode = ruleDerivationNodeQuery(ruleProofNode),
16
- ruleDerivationVerified = verifyRuleDerivation(ruleDerivationNode, metaproofContext);
16
+ ruleDerivationVerified = verifyRuleDerivation(ruleDerivationNode, localMetaContext);
17
17
 
18
18
  if (ruleDerivationVerified) {
19
- const lastMetaproofStep = metaproofContext.getLastMetaproofStep(),
19
+ const lastMetaproofStep = localMetaContext.getLastMetaproofStep(),
20
20
  metaproofStep = lastMetaproofStep, ///
21
21
  metastatementNode = metaproofStep.getMetastatementNode(),
22
22
  conclusionMetastatementNode = conclusion.getMetastatementNode(),
@@ -5,72 +5,72 @@ import { nodeQuery, referenceNameFromReferenceNode } from "../../utilities/query
5
5
  const referenceNodeQuery = nodeQuery("/qualifiedStatement/qualification!/reference!"),
6
6
  statementNodeQuery = nodeQuery("/qualifiedStatement/statement!");
7
7
 
8
- export default function verifyQualifiedStatement(qualifiedStatementNode, assignments, derived, proofContext) {
8
+ export default function verifyQualifiedStatement(qualifiedStatementNode, assignments, derived, localContext) {
9
9
  let qualifiedStatementVerified = false;
10
10
 
11
11
  const statementNode = statementNodeQuery(qualifiedStatementNode);
12
12
 
13
13
  if (statementNode !== null) {
14
- const statementString = proofContext.nodeAsString(statementNode),
15
- statementProofContext = proofContext; ///
14
+ const statementString = localContext.nodeAsString(statementNode),
15
+ statementLocalContext = localContext; ///
16
16
 
17
- proofContext.trace(`Verifying the '${statementString}' qualified statement...`, qualifiedStatementNode);
17
+ localContext.trace(`Verifying the '${statementString}' qualified statement...`, qualifiedStatementNode);
18
18
 
19
19
  const referenceNode = referenceNodeQuery(qualifiedStatementNode),
20
20
  referenceName = referenceNameFromReferenceNode(referenceNode);
21
21
 
22
22
  if (!qualifiedStatementVerified) {
23
- const rule = proofContext.findRuleByReferenceName(referenceName);
23
+ const rule = localContext.findRuleByReferenceName(referenceName);
24
24
 
25
25
  if (rule !== null) {
26
- const ruleMatchesStatement = rule.matchStatement(statementNode, statementProofContext);
26
+ const ruleMatchesStatement = rule.matchStatement(statementNode, statementLocalContext);
27
27
 
28
28
  qualifiedStatementVerified = ruleMatchesStatement; ///
29
29
  }
30
30
  }
31
31
 
32
32
  if (!qualifiedStatementVerified) {
33
- const axiom = proofContext.findAxiomByReferenceName(referenceName);
33
+ const axiom = localContext.findAxiomByReferenceName(referenceName);
34
34
 
35
35
  if (axiom !== null) {
36
- const axiomMatchesStatement = axiom.matchStatement(statementNode, statementProofContext);
36
+ const axiomMatchesStatement = axiom.matchStatement(statementNode, statementLocalContext);
37
37
 
38
38
  qualifiedStatementVerified = axiomMatchesStatement; ///
39
39
  }
40
40
  }
41
41
 
42
42
  if (!qualifiedStatementVerified) {
43
- const lemma = proofContext.findLemmaByReferenceName(referenceName);
43
+ const lemma = localContext.findLemmaByReferenceName(referenceName);
44
44
 
45
45
  if (lemma !== null) {
46
- const lemmaMatchesStatement = lemma.matchStatement(statementNode, statementProofContext);
46
+ const lemmaMatchesStatement = lemma.matchStatement(statementNode, statementLocalContext);
47
47
 
48
48
  qualifiedStatementVerified = lemmaMatchesStatement; ///
49
49
  }
50
50
  }
51
51
 
52
52
  if (!qualifiedStatementVerified) {
53
- const theorem = proofContext.findTheoremByReferenceName(referenceName);
53
+ const theorem = localContext.findTheoremByReferenceName(referenceName);
54
54
 
55
55
  if (theorem !== null) {
56
- const theoremMatchesStatement = theorem.matchStatement(statementNode, statementProofContext);
56
+ const theoremMatchesStatement = theorem.matchStatement(statementNode, statementLocalContext);
57
57
 
58
58
  qualifiedStatementVerified = theoremMatchesStatement; ///
59
59
  }
60
60
  }
61
61
 
62
62
  if (!qualifiedStatementVerified) {
63
- const conjecture = proofContext.findConjectureByReferenceName(referenceName);
63
+ const conjecture = localContext.findConjectureByReferenceName(referenceName);
64
64
 
65
65
  if (conjecture !== null) {
66
- const conjectureMatchesStatement = conjecture.matchStatement(statementNode, statementProofContext);
66
+ const conjectureMatchesStatement = conjecture.matchStatement(statementNode, statementLocalContext);
67
67
 
68
68
  qualifiedStatementVerified = conjectureMatchesStatement; ///
69
69
  }
70
70
  }
71
71
 
72
72
  if (qualifiedStatementVerified) {
73
- proofContext.debug(`...verified the '${statementString}' qualified statement.`, qualifiedStatementNode);
73
+ localContext.debug(`...verified the '${statementString}' qualified statement.`, qualifiedStatementNode);
74
74
  }
75
75
  }
76
76
 
@@ -6,24 +6,24 @@ import { nodeQuery } from "../../utilities/query";
6
6
 
7
7
  const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!");
8
8
 
9
- export default function verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, proofContext) {
9
+ export default function verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext) {
10
10
  let unqualifiedStatementVerified = false;
11
11
 
12
12
  const statementNode = statementNodeQuery(unqualifiedStatementNode);
13
13
 
14
14
  if (statementNode !== null) {
15
- const statementString = proofContext.nodeAsString(statementNode);
15
+ const statementString = localContext.nodeAsString(statementNode);
16
16
 
17
- proofContext.trace(`Verifying the '${statementString}' unqualified statement...`, unqualifiedStatementNode);
17
+ localContext.trace(`Verifying the '${statementString}' unqualified statement...`, unqualifiedStatementNode);
18
18
 
19
19
  if (derived) {
20
- const statementMatches = proofContext.matchStatement(statementNode);
20
+ const statementMatches = localContext.matchStatement(statementNode);
21
21
 
22
22
  unqualifiedStatementVerified = statementMatches; ///
23
23
  }
24
24
 
25
25
  if (!unqualifiedStatementVerified) {
26
- const context = proofContext, ///
26
+ const context = localContext, ///
27
27
  statementVerified = verifyStatement(statementNode, assignments, derived, context, () => {
28
28
  const verifiedAhead = true;
29
29
 
@@ -34,7 +34,7 @@ export default function verifyUnqualifiedStatement(unqualifiedStatementNode, ass
34
34
  }
35
35
 
36
36
  if (unqualifiedStatementVerified) {
37
- proofContext.debug(`...verified the '${statementString}' unqualified statement.`, unqualifiedStatementNode);
37
+ localContext.debug(`...verified the '${statementString}' unqualified statement.`, unqualifiedStatementNode);
38
38
  }
39
39
  }
40
40
 
@@ -9,17 +9,17 @@ import { nodeQuery } from "../utilities/query";
9
9
  const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
10
10
  unqualifiedStatementNodeQuery = nodeQuery("/supposition/unqualifiedStatement!");
11
11
 
12
- export default function verifySupposition(suppositionNode, suppositions, proofContext) {
12
+ export default function verifySupposition(suppositionNode, suppositions, localContext) {
13
13
  let suppositionVerified;
14
14
 
15
- const suppositionString = proofContext.nodeAsString(suppositionNode);
15
+ const suppositionString = localContext.nodeAsString(suppositionNode);
16
16
 
17
- proofContext.trace(`Verifying the '${suppositionString}' supposition...`, suppositionNode);
17
+ localContext.trace(`Verifying the '${suppositionString}' supposition...`, suppositionNode);
18
18
 
19
19
  const derived = false,
20
20
  assignments = [],
21
21
  unqualifiedStatementNode = unqualifiedStatementNodeQuery(suppositionNode),
22
- unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, proofContext);
22
+ unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext);
23
23
 
24
24
  if (unqualifiedStatementVerified) {
25
25
  const statementNode = statementNodeQuery(unqualifiedStatementNode),
@@ -28,17 +28,17 @@ export default function verifySupposition(suppositionNode, suppositions, proofCo
28
28
 
29
29
  suppositions.push(supposition);
30
30
 
31
- proofContext.addProofStep(proofStep);
31
+ localContext.addProofStep(proofStep);
32
32
 
33
33
  assignments.forEach((assignment) => {
34
- assignment.assign(proofContext);
34
+ assignment.assign(localContext);
35
35
  });
36
36
 
37
37
  suppositionVerified = true;
38
38
  }
39
39
 
40
40
  if (suppositionVerified) {
41
- proofContext.debug(`...verified the '${suppositionString}' supposition.`, suppositionNode);
41
+ localContext.debug(`...verified the '${suppositionString}' supposition.`, suppositionNode);
42
42
  }
43
43
 
44
44
  return suppositionVerified;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ import Term from "../term";
3
4
  import termNodesVerifier from "../verifier/nodes/term";
4
5
 
5
6
  import { first } from "../utilities/array";
@@ -7,7 +8,7 @@ import { nodeQuery, variableNameFromVariableNode } from "../utilities/query";
7
8
 
8
9
  const variableNodeQuery = nodeQuery("/term/variable!");
9
10
 
10
- function verifyTerm(termNode, types, context, verifyAhead) {
11
+ function verifyTerm(termNode, terms, context, verifyAhead) {
11
12
  let termVerified;
12
13
 
13
14
  const termString = context.nodeAsString(termNode);
@@ -20,7 +21,7 @@ function verifyTerm(termNode, types, context, verifyAhead) {
20
21
  ];
21
22
 
22
23
  termVerified = verifyTermFunctions.some((verifyTermFunction) => {
23
- const termVerified = verifyTermFunction(termNode, types, context, verifyAhead);
24
+ const termVerified = verifyTermFunction(termNode, terms, context, verifyAhead);
24
25
 
25
26
  if (termVerified) {
26
27
  return true;
@@ -40,13 +41,13 @@ Object.assign(termNodesVerifier, {
40
41
 
41
42
  export default verifyTerm;
42
43
 
43
- export function verifyTermAgainstConstructors(termNode, types, context, verifyAhead) {
44
+ export function verifyTermAgainstConstructors(termNode, terms, context, verifyAhead) {
44
45
  let termVerifiedAgainstConstructors;
45
46
 
46
47
  const constructors = context.getConstructors();
47
48
 
48
49
  termVerifiedAgainstConstructors = constructors.some((constructor) => {
49
- const termVerifiedAgainstConstructor = verifyTermAgainstConstructor(termNode, types, constructor, context, verifyAhead);
50
+ const termVerifiedAgainstConstructor = verifyTermAgainstConstructor(termNode, terms, constructor, context, verifyAhead);
50
51
 
51
52
  if (termVerifiedAgainstConstructor) {
52
53
  return true;
@@ -93,73 +94,75 @@ export function verifyTermAsVariable(termNode, variables, context, verifyAhead)
93
94
  return termVerifiedAsVariable;
94
95
  }
95
96
 
96
- function verifyTermAgainstConstructor(termNode, types, constructor, context, verifyAhead) {
97
- let termVerifiedAgainstConstructor;
97
+ function verifyTermAsStandaloneVariable(termNode, terms, context, verifyAhead) {
98
+ let termVerifiedAsStandaloneVariable;
98
99
 
99
- const termString = context.nodeAsString(termNode),
100
- constructorString = constructor.getString();
100
+ const termString = context.nodeAsString(termNode);
101
101
 
102
- context.trace(`Verifying the '${termString}' term against the '${constructorString}' constructor...`, termNode);
102
+ context.trace(`Verifying the '${termString}' term as a standalone variable...`, termNode);
103
103
 
104
- const constructorTermNode = constructor.getTermNode(),
105
- nonTerminalNNdeA = termNode, ///
106
- nonTerminalNodeB = constructorTermNode, ///
107
- nodeVerified = termNodesVerifier.verifyNonTerminalNode(nonTerminalNNdeA, nonTerminalNodeB, context, () => {
104
+ const variables = [],
105
+ termVerifiedAsVariable = verifyTermAsVariable(termNode, variables, context, () => {
108
106
  let verifiedAhead;
109
107
 
110
- const type = constructor.getType();
108
+ const firstVariable = first(variables),
109
+ variable = firstVariable, ///
110
+ type = variable.getType(),
111
+ term = Term.fromTermNodeAndType(termNode, type);
111
112
 
112
- types.push(type);
113
+ terms.push(term);
113
114
 
114
115
  verifiedAhead = verifyAhead();
115
116
 
116
117
  if (!verifiedAhead) {
117
- types.pop();
118
+ terms.pop();
118
119
  }
119
120
 
120
121
  return verifiedAhead;
121
122
  });
122
123
 
123
- termVerifiedAgainstConstructor = nodeVerified; ///
124
+ termVerifiedAsStandaloneVariable = termVerifiedAsVariable; ///
124
125
 
125
- if (termVerifiedAgainstConstructor) {
126
- context.debug(`...verified the '${termString}' term against the '${constructorString}' constructor.`, termNode);
126
+ if (termVerifiedAsStandaloneVariable) {
127
+ context.debug(`...verified the '${termString}' term as a standalone variable.`, termNode);
127
128
  }
128
129
 
129
- return termVerifiedAgainstConstructor;
130
+ return termVerifiedAsStandaloneVariable;
130
131
  }
131
132
 
132
- function verifyTermAsStandaloneVariable(termNode, types, context, verifyAhead) {
133
- let termVerifiedAsStandaloneVariable;
133
+ function verifyTermAgainstConstructor(termNode, terms, constructor, context, verifyAhead) {
134
+ let termVerifiedAgainstConstructor;
134
135
 
135
- const termString = context.nodeAsString(termNode);
136
+ const termString = context.nodeAsString(termNode),
137
+ constructorString = constructor.getString();
136
138
 
137
- context.trace(`Verifying the '${termString}' term as a standalone variable...`, termNode);
139
+ context.trace(`Verifying the '${termString}' term against the '${constructorString}' constructor...`, termNode);
138
140
 
139
- const variables = [],
140
- termVerifiedAsVariable = verifyTermAsVariable(termNode, variables, context, () => {
141
+ const constructorTermNode = constructor.getTermNode(),
142
+ nonTerminalNNdeA = termNode, ///
143
+ nonTerminalNodeB = constructorTermNode, ///
144
+ nodeVerified = termNodesVerifier.verifyNonTerminalNode(nonTerminalNNdeA, nonTerminalNodeB, context, () => {
141
145
  let verifiedAhead;
142
146
 
143
- const firstVariable = first(variables),
144
- variable = firstVariable, ///
145
- type = variable.getType();
147
+ const type = constructor.getType(),
148
+ term = Term.fromTermNodeAndType(termNode, type);
146
149
 
147
- types.push(type);
150
+ terms.push(term);
148
151
 
149
152
  verifiedAhead = verifyAhead();
150
153
 
151
154
  if (!verifiedAhead) {
152
- types.pop();
155
+ terms.pop();
153
156
  }
154
157
 
155
158
  return verifiedAhead;
156
159
  });
157
160
 
158
- termVerifiedAsStandaloneVariable = termVerifiedAsVariable; ///
161
+ termVerifiedAgainstConstructor = nodeVerified; ///
159
162
 
160
- if (termVerifiedAsStandaloneVariable) {
161
- context.debug(`...verified the '${termString}' term as a standalone variable.`, termNode);
163
+ if (termVerifiedAgainstConstructor) {
164
+ context.debug(`...verified the '${termString}' term against the '${constructorString}' constructor.`, termNode);
162
165
  }
163
166
 
164
- return termVerifiedAsStandaloneVariable;
167
+ return termVerifiedAgainstConstructor;
165
168
  }
@@ -4,51 +4,37 @@ import verifyTerm from "../verify/term";
4
4
 
5
5
  import { first, second } from "../utilities/array";
6
6
 
7
- export default function verifyTerms(leftTermNode, rightTermNode, context, verifyAhead) {
7
+ export default function verifyTerms(termNodes, terms, context, verifyAhead) {
8
8
  let termsVerified;
9
9
 
10
- const leftTermString = context.nodeAsString(leftTermNode),
11
- rightTermString = context.nodeAsString(rightTermNode);
10
+ const firstTermNode = first(termNodes),
11
+ secondTermNode = second(termNodes),
12
+ firstTermString = context.nodeAsString(firstTermNode),
13
+ secondTermString = context.nodeAsString(secondTermNode);
12
14
 
13
- context.trace(`Verifying the '${leftTermString}' and '${rightTermString}' terms...`, leftTermNode);
15
+ context.trace(`Verifying the '${firstTermString}' and '${secondTermString}' terms...`, firstTermNode);
14
16
 
15
- const types = [],
16
- leftTermVerified = verifyTerm(leftTermNode, types, context, () => {
17
+ const firstTermVerified = verifyTerm(firstTermNode, terms, context, () => {
17
18
  let verifiedAhead;
18
19
 
19
- const rightTermVerified = verifyTerm(rightTermNode, types, context, () => {
20
- let verifiedAhead = false;
20
+ const secondTermVerified = verifyTerm(secondTermNode, terms, context, () => {
21
+ let verifiedAhead;
21
22
 
22
- const firstType = first(types),
23
- secondType = second(types),
24
- leftType = firstType, ///
25
- rightType = secondType, ///
26
- leftTypeEqualToOrSubTypeOfOfSuperTypeOfRightType = leftType.isEqualToOrSubTypeOfOfSuperTypeOf(rightType);
27
-
28
- if (!leftTypeEqualToOrSubTypeOfOfSuperTypeOfRightType) {
29
- const leftTypeName = leftType.getName(),
30
- rightTypeName = rightType.getName(),
31
- leftTermString = context.nodeAsString(leftTermNode),
32
- rightTermString = context.nodeAsString(rightTermNode);
33
-
34
- context.debug(`The left '${leftTermString}' term's '${leftTypeName}' type is not equal to, a sub-type of nor a super-type of the right '${rightTermString}' term's '${rightTypeName}' type.`, statementNode);
35
- } else {
36
- verifiedAhead = verifyAhead();
37
- }
23
+ verifiedAhead = verifyAhead();
38
24
 
39
25
  return verifiedAhead;
40
26
  });
41
27
 
42
- verifiedAhead = rightTermVerified; ///
28
+ verifiedAhead = secondTermVerified; ///
43
29
 
44
30
  return verifiedAhead;
45
31
  });
46
32
 
33
+ termsVerified = firstTermVerified; ///
34
+
47
35
  if (termsVerified) {
48
- context.debug(`...verified the '${leftTermString}' and '${rightTermString}' terms.`, leftTermNode);
36
+ context.debug(`...verified the '${firstTermString}' and '${secondTermString}' terms.`, firstTermNode);
49
37
  }
50
38
 
51
- termsVerified = leftTermVerified; ///
52
-
53
39
  return termsVerified
54
40
  }