occam-verify-cli 0.0.1003 → 0.0.1006

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 (183) hide show
  1. package/README.md +0 -2
  2. package/bin/abbreviations.js +1 -3
  3. package/bin/action/help.js +0 -2
  4. package/bin/action/verify.js +4 -24
  5. package/bin/defaults.js +0 -2
  6. package/bin/main.js +3 -4
  7. package/bin/options.js +0 -2
  8. package/bin/utilities/releaseContext.js +9 -2
  9. package/lib/assertion/subproof.js +106 -0
  10. package/lib/assignment/metavariable.js +2 -2
  11. package/lib/combinator.js +50 -16
  12. package/lib/conclusion.js +74 -14
  13. package/lib/context/file.js +191 -31
  14. package/lib/context/local.js +37 -49
  15. package/lib/context/release.js +25 -81
  16. package/lib/declaration/combinator.js +83 -0
  17. package/lib/derivation.js +86 -0
  18. package/lib/equality.js +3 -11
  19. package/lib/index.js +1 -1
  20. package/lib/judgement.js +3 -10
  21. package/lib/label.js +58 -16
  22. package/lib/log.js +3 -11
  23. package/lib/metaType.js +31 -19
  24. package/lib/metavariable.js +39 -12
  25. package/lib/mixins/statement/qualified/unify.js +118 -0
  26. package/lib/mixins/statement/unify.js +57 -0
  27. package/lib/mixins/statement/verify.js +184 -0
  28. package/lib/node/statement/combinator/bracketed.js +15 -11
  29. package/lib/ocmbinator/bracketed.js +52 -8
  30. package/lib/premise.js +109 -55
  31. package/lib/proof.js +91 -0
  32. package/lib/proofStep.js +78 -25
  33. package/lib/reference.js +62 -16
  34. package/lib/rule.js +146 -26
  35. package/lib/ruleNames.js +5 -5
  36. package/lib/statement/qualified.js +127 -0
  37. package/lib/statement/unqualified.js +89 -0
  38. package/lib/statement.js +176 -0
  39. package/lib/subDerivation.js +86 -0
  40. package/lib/subproof.js +155 -0
  41. package/lib/substitution/frameForMetavariable.js +14 -15
  42. package/lib/substitution/statementForMetavariable.js +23 -24
  43. package/lib/substitution/termForVariable.js +11 -12
  44. package/lib/substitution.js +9 -2
  45. package/lib/substitutions.js +14 -14
  46. package/lib/supposition.js +92 -61
  47. package/lib/unifier/statementWithCombinator.js +3 -3
  48. package/lib/unify/metavariableWithFrame.js +2 -2
  49. package/lib/unify/metavariableWithStatement.js +2 -2
  50. package/lib/unify/metavariableWithStatementGivenSubstitution.js +2 -2
  51. package/lib/unify/variableWithTerm.js +2 -2
  52. package/lib/utilities/node.js +13 -11
  53. package/lib/utilities/releaseContext.js +5 -6
  54. package/lib/utilities/string.js +8 -2
  55. package/lib/utilities/subproof.js +5 -5
  56. package/lib/utilities/tokens.js +10 -10
  57. package/lib/variable.js +1 -10
  58. package/lib/verifier/metaLevel.js +2 -2
  59. package/lib/verifier/topLevel.js +5 -5
  60. package/lib/verify/axiom.js +3 -5
  61. package/lib/verify/conjecture.js +4 -7
  62. package/lib/verify/consequent.js +2 -3
  63. package/lib/verify/declaration/combinator.js +2 -14
  64. package/lib/verify/declaration/metavariable.js +9 -10
  65. package/lib/verify/files.js +4 -4
  66. package/lib/verify/frame.js +12 -12
  67. package/lib/verify/lemma.js +4 -7
  68. package/lib/verify/metaLemma.js +4 -7
  69. package/lib/verify/metatheorem.js +4 -7
  70. package/lib/verify/proofStep.js +2 -31
  71. package/lib/verify/theorem.js +4 -7
  72. package/package.json +1 -1
  73. package/src/assertion/subproof.js +84 -0
  74. package/src/assignment/metavariable.js +2 -2
  75. package/src/combinator.js +45 -15
  76. package/src/conclusion.js +85 -13
  77. package/src/context/file.js +223 -11
  78. package/src/context/local.js +12 -16
  79. package/src/context/release.js +31 -100
  80. package/src/declaration/combinator.js +44 -0
  81. package/src/derivation.js +50 -0
  82. package/src/equality.js +2 -9
  83. package/src/index.js +0 -1
  84. package/src/judgement.js +2 -8
  85. package/src/label.js +56 -13
  86. package/src/log.js +2 -9
  87. package/src/metaType.js +26 -14
  88. package/src/metavariable.js +57 -9
  89. package/src/mixins/statement/qualified/unify.js +186 -0
  90. package/src/mixins/statement/unify.js +70 -0
  91. package/src/mixins/statement/verify.js +274 -0
  92. package/src/node/statement/combinator/bracketed.js +4 -3
  93. package/src/ocmbinator/bracketed.js +15 -12
  94. package/src/premise.js +138 -44
  95. package/src/proof.js +58 -0
  96. package/src/proofStep.js +92 -22
  97. package/src/reference.js +58 -12
  98. package/src/rule.js +199 -30
  99. package/src/ruleNames.js +1 -1
  100. package/src/statement/qualified.js +104 -0
  101. package/src/statement/unqualified.js +60 -0
  102. package/src/statement.js +179 -0
  103. package/src/subDerivation.js +52 -0
  104. package/src/subproof.js +99 -0
  105. package/src/substitution/frameForMetavariable.js +20 -17
  106. package/src/substitution/statementForMetavariable.js +31 -29
  107. package/src/substitution/termForVariable.js +15 -14
  108. package/src/substitution.js +8 -0
  109. package/src/substitutions.js +12 -13
  110. package/src/supposition.js +96 -51
  111. package/src/unifier/statementWithCombinator.js +6 -3
  112. package/src/unify/metavariableWithFrame.js +1 -1
  113. package/src/unify/metavariableWithStatement.js +1 -1
  114. package/src/unify/metavariableWithStatementGivenSubstitution.js +1 -1
  115. package/src/unify/variableWithTerm.js +1 -1
  116. package/src/utilities/node.js +18 -12
  117. package/src/utilities/releaseContext.js +5 -8
  118. package/src/utilities/string.js +6 -2
  119. package/src/utilities/subproof.js +2 -2
  120. package/src/utilities/tokens.js +7 -7
  121. package/src/variable.js +0 -10
  122. package/src/verifier/metaLevel.js +3 -2
  123. package/src/verifier/topLevel.js +6 -4
  124. package/src/verify/axiom.js +1 -2
  125. package/src/verify/conjecture.js +2 -3
  126. package/src/verify/consequent.js +1 -1
  127. package/src/verify/declaration/combinator.js +0 -20
  128. package/src/verify/declaration/metavariable.js +8 -12
  129. package/src/verify/files.js +3 -3
  130. package/src/verify/frame.js +11 -11
  131. package/src/verify/lemma.js +2 -3
  132. package/src/verify/metaLemma.js +2 -3
  133. package/src/verify/metatheorem.js +2 -3
  134. package/src/verify/proofStep.js +0 -41
  135. package/src/verify/theorem.js +2 -3
  136. package/lib/tokens/combinatorStatement/bracketed.js +0 -17
  137. package/lib/unify/premiseWithProofStep.js +0 -41
  138. package/lib/unify/premisesWithProofSteps.js +0 -31
  139. package/lib/unify/qualifiedStatement.js +0 -136
  140. package/lib/unify/statementWithBracketedCombinator.js +0 -30
  141. package/lib/unify/statementWithCombinator.js +0 -29
  142. package/lib/unify/statementWithCombinators.js +0 -31
  143. package/lib/unify/statementWithMetaType.js +0 -24
  144. package/lib/verify/conclusion.js +0 -39
  145. package/lib/verify/derivation.js +0 -31
  146. package/lib/verify/label.js +0 -37
  147. package/lib/verify/labels.js +0 -28
  148. package/lib/verify/premise.js +0 -45
  149. package/lib/verify/premises.js +0 -28
  150. package/lib/verify/proof.js +0 -34
  151. package/lib/verify/rule.js +0 -56
  152. package/lib/verify/statement/qualified.js +0 -41
  153. package/lib/verify/statement/unqualified.js +0 -45
  154. package/lib/verify/statement.js +0 -219
  155. package/lib/verify/statementAsCombinator.js +0 -33
  156. package/lib/verify/statementGivenMetaType.js +0 -52
  157. package/lib/verify/subproof.js +0 -34
  158. package/lib/verify/supposition.js +0 -45
  159. package/lib/verify/suppositions.js +0 -28
  160. package/src/tokens/combinatorStatement/bracketed.js +0 -10
  161. package/src/unify/premiseWithProofStep.js +0 -54
  162. package/src/unify/premisesWithProofSteps.js +0 -23
  163. package/src/unify/qualifiedStatement.js +0 -208
  164. package/src/unify/statementWithBracketedCombinator.js +0 -22
  165. package/src/unify/statementWithCombinator.js +0 -22
  166. package/src/unify/statementWithCombinators.js +0 -23
  167. package/src/unify/statementWithMetaType.js +0 -14
  168. package/src/verify/conclusion.js +0 -40
  169. package/src/verify/derivation.js +0 -23
  170. package/src/verify/label.js +0 -34
  171. package/src/verify/labels.js +0 -17
  172. package/src/verify/premise.js +0 -49
  173. package/src/verify/premises.js +0 -17
  174. package/src/verify/proof.js +0 -31
  175. package/src/verify/rule.js +0 -71
  176. package/src/verify/statement/qualified.js +0 -40
  177. package/src/verify/statement/unqualified.js +0 -49
  178. package/src/verify/statement.js +0 -312
  179. package/src/verify/statementAsCombinator.js +0 -27
  180. package/src/verify/statementGivenMetaType.js +0 -52
  181. package/src/verify/subproof.js +0 -32
  182. package/src/verify/supposition.js +0 -49
  183. package/src/verify/suppositions.js +0 -17
@@ -9,12 +9,9 @@ Object.defineProperty(exports, "default", {
9
9
  }
10
10
  });
11
11
  var _theorem = /*#__PURE__*/ _interop_require_default(require("../theorem"));
12
- var _proof = /*#__PURE__*/ _interop_require_default(require("../verify/proof"));
13
- var _labels = /*#__PURE__*/ _interop_require_default(require("../verify/labels"));
14
12
  var _local = /*#__PURE__*/ _interop_require_default(require("../context/local"));
15
13
  var _substitutions = /*#__PURE__*/ _interop_require_default(require("../substitutions"));
16
14
  var _consequent = /*#__PURE__*/ _interop_require_default(require("../verify/consequent"));
17
- var _suppositions = /*#__PURE__*/ _interop_require_default(require("../verify/suppositions"));
18
15
  var _array = require("../utilities/array");
19
16
  var _query = require("../utilities/query");
20
17
  function _interop_require_default(obj) {
@@ -27,13 +24,13 @@ function verifyTheorem(theoremNode, fileContext) {
27
24
  var theoremVerified = false;
28
25
  var labelNodes = labelNodesQuery(theoremNode), labelsString = fileContext.nodesAsString(labelNodes);
29
26
  fileContext.trace("Verifying the '".concat(labelsString, "' theorem..."), theoremNode);
30
- var labels = [], labelsVerified = (0, _labels.default)(labelNodes, labels, fileContext);
27
+ var labels = [], labelsVerified = verifyLabels(labelNodes, labels, fileContext);
31
28
  if (labelsVerified) {
32
- var localContext = _local.default.fromFileContext(fileContext), suppositions = [], suppositionNodes = suppositionsNodeQuery(theoremNode), suppositionsVerified = (0, _suppositions.default)(suppositionNodes, suppositions, localContext);
29
+ var localContext = _local.default.fromFileContext(fileContext), suppositions = [], suppositionNodes = suppositionsNodeQuery(theoremNode), suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
33
30
  if (suppositionsVerified) {
34
31
  var consequents = [], consequentNode = consequentNodeQuery(theoremNode), consequentVerified = (0, _consequent.default)(consequentNode, consequents, localContext);
35
32
  if (consequentVerified) {
36
- var proofNode = proofNodeQuery(theoremNode), firstConsequent = (0, _array.first)(consequents), consequent = firstConsequent, statementNode = consequent.getStatementNode(), substitutions = _substitutions.default.fromNothing(), proofVerified = (0, _proof.default)(proofNode, statementNode, substitutions, localContext);
33
+ var proofNode = proofNodeQuery(theoremNode), firstConsequent = (0, _array.first)(consequents), consequent = firstConsequent, statementNode = consequent.getStatementNode(), substitutions = _substitutions.default.fromNothing(), proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
37
34
  if (proofVerified) {
38
35
  var substitutions1 = _substitutions.default.fromNothing(), theorem = _theorem.default.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions1, fileContext);
39
36
  fileContext.addTheorem(theorem);
@@ -48,4 +45,4 @@ function verifyTheorem(theoremNode, fileContext) {
48
45
  return theoremVerified;
49
46
  }
50
47
 
51
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy92ZXJpZnkvdGhlb3JlbS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IFRoZW9yZW0gZnJvbSBcIi4uL3RoZW9yZW1cIjtcbmltcG9ydCB2ZXJpZnlQcm9vZiBmcm9tIFwiLi4vdmVyaWZ5L3Byb29mXCI7XG5pbXBvcnQgdmVyaWZ5TGFiZWxzIGZyb20gXCIuLi92ZXJpZnkvbGFiZWxzXCI7XG5pbXBvcnQgTG9jYWxDb250ZXh0IGZyb20gXCIuLi9jb250ZXh0L2xvY2FsXCI7XG5pbXBvcnQgU3Vic3RpdHV0aW9ucyBmcm9tIFwiLi4vc3Vic3RpdHV0aW9uc1wiO1xuaW1wb3J0IHZlcmlmeUNvbnNlcXVlbnQgZnJvbSBcIi4uL3ZlcmlmeS9jb25zZXF1ZW50XCI7XG5pbXBvcnQgdmVyaWZ5U3VwcG9zaXRpb25zIGZyb20gXCIuLi92ZXJpZnkvc3VwcG9zaXRpb25zXCI7XG5cbmltcG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WUsRUFBRSxFQUNqQkMsbUJBQW1CZixzQkFBc0JDLGNBQ3pDZSx1QkFBdUJDLG1CQUFtQkYsa0JBQWtCRCxjQUFjSDtRQUVoRixJQUFJSyxzQkFBc0I7WUFDeEIsSUFBTUUsY0FBYyxFQUFFLEVBQ2hCQyxpQkFBaUJwQixvQkFBb0JFLGNBQ3JDbUIscUJBQXFCQyxJQUFBQSxtQkFBZ0IsRUFBQ0YsZ0JBQWdCRCxhQUFhUDtZQUV6RSxJQUFJUyxvQkFBb0I7Z0JBQ3RCLElBQU1FLFlBQVkzQixlQUFlTSxjQUMzQnNCLGtCQUFrQkMsSUFBQUEsWUFBSyxFQUFDTixjQUN4Qk8sYUFBYUYsaUJBQ2JHLGdCQUFnQkQsV0FBV0UsZ0JBQWdCLElBQzNDQyxnQkFBZ0JDLHNCQUFhLENBQUNDLFdBQVcsSUFDekNDLGdCQUFnQkMsWUFBWVYsV0FBV0ksZUFBZUUsZUFBZWpCO2dCQUUzRSxJQUFJb0IsZUFBZTtvQkFDakIsSUFBTUgsaUJBQWdCQyxzQkFBYSxDQUFDQyxXQUFXLElBQ3pDRyxVQUFVQyxnQkFBTyxDQUFDQywyREFBMkQsQ0FBQzNCLFFBQVFNLGNBQWNXLFlBQVlHLGdCQUFlMUI7b0JBRXJJQSxZQUFZa0MsVUFBVSxDQUFDSDtvQkFFdkI5QixrQkFBa0I7Z0JBQ3BCO1lBQ0Y7UUFDRjtJQUNGO0lBRUEsSUFBSUEsaUJBQWlCO1FBQ25CRCxZQUFZbUMsS0FBSyxDQUFDLEFBQUMsb0JBQWdDLE9BQWJoQyxjQUFhLGVBQWFKO0lBQ2xFO0lBRUEsT0FBT0U7QUFDVCJ9
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.1003",
4
+ "version": "0.0.1006",
5
5
  "license": "MIT, Anti-996",
6
6
  "homepage": "https://github.com/djalbat/occam-verify-cli",
7
7
  "description": "Occam's Verifier",
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ import Statement from "../statement";
4
+ import LocalContext from "../context/local";
5
+ import metaLevelUnifier from "../unifier/metaLevel";
6
+
7
+ import { match } from "../utilities/array";
8
+ import { nodeQuery, nodesQuery } from "../utilities/query";
9
+
10
+ const statementNodesQuery = nodesQuery("/subproofAssertion/statement"),
11
+ subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion");
12
+
13
+ export default class SubproofAssertion {
14
+ constructor(fileContext, string, statements) {
15
+ this.fileContext = fileContext;
16
+ this.string = string;
17
+ this.statements = statements;
18
+ }
19
+
20
+ getFileContext() {
21
+ return this.fileContext;
22
+ }
23
+
24
+ getString() {
25
+ return this.string;
26
+ }
27
+
28
+ getStatements() {
29
+ return this.statements;
30
+ }
31
+
32
+ unifySubproof(subproof, substitutions, localContext) {
33
+ let subproofUnified;
34
+
35
+ const subproofString = subproof.getString(),
36
+ subproofStatements = subproof.getStatements(),
37
+ subproofAssertionString = this.string; ///
38
+
39
+ localContext.trace(`Unifying the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion...`);
40
+
41
+ subproofUnified = match(this.statements, subproofStatements, (statement, subproofStatement) => {
42
+ const statementNode = statement.getNode(),
43
+ subproofStatementNode = subproofStatement.getNode(),
44
+ nodeA = statementNode, ///
45
+ nodeB = subproofStatementNode, ///
46
+ fileContextA = this.fileContext, ///
47
+ localContextA = LocalContext.fromFileContext(fileContextA),
48
+ localContextB = localContext, ///
49
+ unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
50
+
51
+ if (unified) {
52
+ return true;
53
+ }
54
+ });
55
+
56
+ if (subproofUnified) {
57
+ localContext.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
58
+ }
59
+
60
+ return subproofUnified;
61
+ }
62
+
63
+ static fromStatementNode(statementNode, fileContext) {
64
+ let subproofAssertion = null;
65
+
66
+ const subproofAssertionNode = subproofAssertionNodeQuery(statementNode);
67
+
68
+ if (subproofAssertionNode !== null) {
69
+ const node = subproofAssertionNode, ///
70
+ string = fileContext.nodeAsString(node),
71
+ localContext = LocalContext.fromFileContext(fileContext),
72
+ statementNodes = statementNodesQuery(subproofAssertionNode),
73
+ statements = statementNodes.map((statementNode) => {
74
+ const statement = Statement.fromStatementNode(statementNode, localContext);
75
+
76
+ return statement;
77
+ });
78
+
79
+ subproofAssertion = new SubproofAssertion(fileContext, string, statements);
80
+ }
81
+
82
+ return subproofAssertion;
83
+ }
84
+ }
@@ -16,8 +16,8 @@ export default class MetavariableAssignment {
16
16
  metavariableAssigned = metavariableAdded; ///
17
17
 
18
18
  metavariableAssigned ?
19
- fileContext.trace(`Assigned the '${metavariableString}' metavariable.`, metavariableNode) :
20
- fileContext.debug(`Unable to assign the '${metavariableString}' metavariable.`, metavariableNode);
19
+ fileContext.trace(`Assigned the '${metavariableString}' metavariable.`) :
20
+ fileContext.debug(`Unable to assign the '${metavariableString}' metavariable.`);
21
21
 
22
22
  return metavariableAssigned;
23
23
  }
package/src/combinator.js CHANGED
@@ -1,32 +1,62 @@
1
1
  "use strict";
2
2
 
3
- import { nodeAsString } from "./utilities/string";
3
+ import shim from "./shim";
4
+ import LocalContext from "./context/local";
5
+
6
+ import { nodeQuery } from "./utilities/query";
7
+
8
+ const statementNodeQuery = nodeQuery("/combinatorDeclaration/statement");
4
9
 
5
10
  export default class Combinator {
6
- constructor(statementNode, string) {
7
- this.statementNode = statementNode;
8
- this.string = string;
11
+ constructor(statement) {
12
+ this.statement = statement;
13
+ }
14
+
15
+ getStatement() {
16
+ return this.statement;
9
17
  }
10
18
 
19
+ getString() { return this.statement.getString(); }
20
+
11
21
  getStatementNode() {
12
- return this.statementNode;
22
+ const statementNode = this.statement.getNode();
23
+
24
+ return statementNode;
25
+ }
26
+
27
+ verify(fileContext) {
28
+ const localContext = LocalContext.fromFileContext(fileContext),
29
+ statementVerifiedAsCombinator = this.statement.verifyAsCombinator(localContext),
30
+ verified = statementVerifiedAsCombinator; ///
31
+
32
+ return verified;
13
33
  }
14
34
 
15
- getString() {
16
- return this.string;
35
+ toJSON() {
36
+ const statementString = this.statement.getString(),
37
+ statement = statementString, ///
38
+ json = {
39
+ statement
40
+ };
41
+
42
+ return json;
17
43
  }
18
44
 
19
- static fromStatementNodeAndTokens(statementNode, tokens) {
20
- const string = stringFromStatementNodeAndTokens(statementNode, tokens),
21
- combinator = new Combinator(statementNode, string);
45
+ static fromJSON(json, fileContext) {
46
+ let combinator = null;
47
+
48
+ debugger
22
49
 
23
50
  return combinator;
24
51
  }
25
- }
26
52
 
27
- function stringFromStatementNodeAndTokens(statementNode, tokens) {
28
- const statementString = nodeAsString(statementNode, tokens),
29
- string = statementString; ///
53
+ static fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext) {
54
+ const { Statement } = shim,
55
+ statementNode = statementNodeQuery(combinatorDeclarationNode),
56
+ localContext = LocalContext.fromFileContext(fileContext),
57
+ statement = Statement.fromStatementNode(statementNode, localContext),
58
+ combinator = new Combinator(statement);
30
59
 
31
- return string;
60
+ return combinator;
61
+ }
32
62
  }
package/src/conclusion.js CHANGED
@@ -1,32 +1,104 @@
1
1
  "use strict";
2
2
 
3
+ import LocalContext from "./context/local";
3
4
  import metaLevelUnifier from "./unifier/metaLevel";
5
+ import UnqualifiedStatement from "./statement/unqualified";
6
+
7
+ import { trim } from "./utilities/string";
8
+ import { nodeQuery } from "./utilities/query";
9
+
10
+ const unqualifiedStatementNodeQuery = nodeQuery("/conclusion/unqualifiedStatement");
4
11
 
5
12
  export default class Conclusion {
6
- constructor(statementNode) {
7
- this.statementNode = statementNode;
13
+ constructor(fileContext, unqualifiedStatement) {
14
+ this.fileContext = fileContext;
15
+ this.unqualifiedStatement = unqualifiedStatement;
16
+ }
17
+
18
+ getFileContext() {
19
+ return this.fileContext;
8
20
  }
9
21
 
10
- getStatementNode() {
11
- return this.statementNode;
22
+ getUnqualifiedStatement() {
23
+ return this.unqualifiedStatement;
12
24
  }
13
25
 
14
- unifyStatement(statementNodeB, substitutions, localContextA, localContextB) {
15
- let statementUnified = false;
26
+ getString() { return this.unqualifiedStatement.getString(); }
27
+
28
+ getStatement() { return this.unqualifiedStatement.getStatement(); }
29
+
30
+ unifyStatement(statement, substitutions, localContext) {
31
+ let statementUnified;
32
+
33
+ const conclusion = this, ///
34
+ statementString = statement.getString(),
35
+ conclusionStatement = conclusion.getStatement(),
36
+ conclusionStatementString = conclusionStatement.getString();
16
37
 
17
- if (this.statementNode !== null) {
18
- const nodeA = this.statementNode, ///
19
- nodeB = statementNodeB, ///
20
- unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
38
+ localContext.trace(`Unifying the '${statementString}' statement with the conclusion's '${conclusionStatementString}' statement...`);
21
39
 
22
- statementUnified = unified; ///
40
+ const statementNode = statement.getNode(),
41
+ conclusionStatementNode = conclusionStatement.getNode(),
42
+ nodeA = conclusionStatementNode, ///
43
+ nodeB = statementNode, ///
44
+ fileContextA = this.fileContext, ///
45
+ localContextA = LocalContext.fromFileContext(fileContextA),
46
+ localContextB = localContext, ///
47
+ unified = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
48
+
49
+ statementUnified = unified; ///
50
+
51
+ if (statementUnified) {
52
+ localContext.debug(`...unified the '${statementString}' statement with the conclusion's '${conclusionStatementString}' statement.`);
23
53
  }
24
54
 
25
55
  return statementUnified;
26
56
  }
27
57
 
28
- static fromStatementNode(statementNode) {
29
- const conclusion = new Conclusion(statementNode);
58
+ verify(localContext) {
59
+ let verified = false,
60
+ conclusionString = this.getString(); ///
61
+
62
+ conclusionString = trim(conclusionString); ///
63
+
64
+ localContext.trace(`Verifying the '${conclusionString}' conclusion...`);
65
+
66
+ const stated = true,
67
+ assignments = [],
68
+ unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated, localContext);
69
+
70
+ if (unqualifiedStatementVerified) {
71
+ verified = true;
72
+ }
73
+
74
+ if (verified) {
75
+ localContext.debug(`...verified the '${conclusionString}' conclusion.`);
76
+ }
77
+
78
+ return verified;
79
+ }
80
+
81
+ toJSON() {
82
+ const unqualifiedStatementString = this.unqualifiedStatement.getString(),
83
+ unqualifiedStatement = unqualifiedStatementString, ///
84
+ json = {
85
+ unqualifiedStatement
86
+ };
87
+
88
+ return json;
89
+ }
90
+
91
+ static fromJSON(json, fileContext) {
92
+ let conclusion = null;
93
+
94
+ debugger
95
+
96
+ return conclusion;
97
+ }
98
+ static fromConclusionNode(conclusionNode, fileContext) {
99
+ const unqualifiedStatementNode = unqualifiedStatementNodeQuery(conclusionNode),
100
+ unqualifiedStatement = UnqualifiedStatement.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext),
101
+ conclusion = new Conclusion(fileContext, unqualifiedStatement);
30
102
 
31
103
  return conclusion;
32
104
  }
@@ -1,6 +1,18 @@
1
1
  "use strict";
2
2
 
3
+ import Type from "../type";
4
+ import Rule from "../rule";
5
+ import Axiom from "../axiom";
6
+ import Lemma from "../lemma";
7
+ import Theorem from "../theorem";
8
+ import Variable from "../variable";
3
9
  import metaTypes from "../metaTypes";
10
+ import MetaLemma from "../metaLemma";
11
+ import Conjecture from "../conjecture";
12
+ import Combinator from "../combinator";
13
+ import Constructor from "../constructor";
14
+ import Metatheorem from "../metatheorem";
15
+ import Metavariable from "../metavariable";
4
16
  import topLevelVerifier from "../verifier/topLevel";
5
17
 
6
18
  import { push } from "../utilities/array";
@@ -348,8 +360,9 @@ export default class FileContext {
348
360
  return label;
349
361
  }
350
362
 
351
- findRuleByMetavariableNode(metavariableNode) {
363
+ findRuleByReference(reference) {
352
364
  const rules = this.getRules(),
365
+ metavariableNode = reference.getMetavariableNode(),
353
366
  rule = rules.find((rule) => {
354
367
  const metavariableNodeMatches = rule.matchMetavariableNode(metavariableNode);
355
368
 
@@ -361,8 +374,9 @@ export default class FileContext {
361
374
  return rule;
362
375
  }
363
376
 
364
- findAxiomByMetavariableNode(metavariableNode) {
377
+ findAxiomByReference(reference) {
365
378
  const axioms = this.getAxioms(),
379
+ metavariableNode = reference.getMetavariableNode(),
366
380
  axiom = axioms.find((axiom) => {
367
381
  const metavariableNodeMatches = axiom.matchMetavariableNode(metavariableNode);
368
382
 
@@ -374,8 +388,9 @@ export default class FileContext {
374
388
  return axiom;
375
389
  }
376
390
 
377
- findLemmaByMetavariableNode(metavariableNode) {
391
+ findLemmaByReference(reference) {
378
392
  const lemmas = this.getLemmas(),
393
+ metavariableNode = reference.getMetavariableNode(),
379
394
  lemma = lemmas.find((lemma) => {
380
395
  const metavariableNodeMatches = lemma.matchMetavariableNode(metavariableNode);
381
396
 
@@ -387,8 +402,9 @@ export default class FileContext {
387
402
  return lemma;
388
403
  }
389
404
 
390
- findTheoremByMetavariableNode(metavariableNode) {
405
+ findTheoremByReference(reference) {
391
406
  const theorems = this.getTheorems(),
407
+ metavariableNode = reference.getMetavariableNode(),
392
408
  theorem = theorems.find((theorem) => {
393
409
  const metavariableNodeMatches = theorem.matchMetavariableNode(metavariableNode);
394
410
 
@@ -400,8 +416,9 @@ export default class FileContext {
400
416
  return theorem;
401
417
  }
402
418
 
403
- findMetaLemmaByMetavariableNode(metavariableNode) {
419
+ findMetaLemmaByReference(reference) {
404
420
  const metaLemmas = this.getMetaLemmas(),
421
+ metavariableNode = reference.getMetavariableNode(),
405
422
  metaLemma = metaLemmas.find((metaLemma) => {
406
423
  const metavariableNodeMatches = metaLemma.matchMetavariableNode(metavariableNode);
407
424
 
@@ -413,8 +430,9 @@ export default class FileContext {
413
430
  return metaLemma;
414
431
  }
415
432
 
416
- findConjectureByMetavariableNode(metavariableNode) {
433
+ findConjectureByReference(reference) {
417
434
  const conjectures = this.getConjectures(),
435
+ metavariableNode = reference.getMetavariableNode(),
418
436
  conjecture = conjectures.find((conjecture) => {
419
437
  const metavariableNodeMatches = conjecture.matchMetavariableNode(metavariableNode);
420
438
 
@@ -426,8 +444,9 @@ export default class FileContext {
426
444
  return conjecture;
427
445
  }
428
446
 
429
- findMetatheoremByMetavariableNode(metavariableNode) {
447
+ findMetatheoremByReference(reference) {
430
448
  const metatheorems = this.getMetatheorems(),
449
+ metavariableNode = reference.getMetavariableNode(),
431
450
  metatheorem = metatheorems.find((metatheorem) => {
432
451
  const metavariableNodeMatches = metatheorem.matchMetavariableNode(metavariableNode);
433
452
 
@@ -606,8 +625,6 @@ export default class FileContext {
606
625
 
607
626
  error(message, node) { this.releaseContext.error(message, node, this.tokens, this.filePath); }
608
627
 
609
- fatal(message, node) { this.releaseContext.fatal(message, node, this.tokens, this.filePath); }
610
-
611
628
  reset() {
612
629
  this.types = [];
613
630
  this.rules = [];
@@ -649,15 +666,210 @@ export default class FileContext {
649
666
 
650
667
  toJSON() {
651
668
  const filePath = this.filePath,
652
- fileContent = this.fileContent,
669
+ types = this.types.map((type) => {
670
+ const typeJSON = type.toJSON();
671
+
672
+ type = typeJSON; ///
673
+
674
+ return type;
675
+ }),
676
+ rules = this.rules.map((rule) => {
677
+ const ruleJSON = rule.toJSON();
678
+
679
+ rule = ruleJSON; ///
680
+
681
+ return rule;
682
+ }),
683
+ axioms = this.axioms.map((axiom) => {
684
+ const axiomJSON = axiom.toJSON();
685
+
686
+ axiom = axiomJSON; ///
687
+
688
+ return axiom;
689
+ }),
690
+ lemmas = this.lemmas.map((lemma) => {
691
+ const lemmaJSON = lemma.toJSON();
692
+
693
+ lemma = lemmaJSON; ///
694
+
695
+ return lemma;
696
+ }),
697
+ theorems = this.theorems.map((theorem) => {
698
+ const theoremJSON = theorem.toJSON();
699
+
700
+ theorem = theoremJSON; ///
701
+
702
+ return theorem;
703
+ }),
704
+ variables = this.variables.map((variable) => {
705
+ const variableJSON = variable.toJSON();
706
+
707
+ variable = variableJSON; ///
708
+
709
+ return variable;
710
+ }),
711
+ metaLemmas = this.metaLemmas.map((metaLemma) => {
712
+ const metaLemmaJSON = metaLemma.toJSON();
713
+
714
+ metaLemma = metaLemmaJSON; ///
715
+
716
+ return metaLemma;
717
+ }),
718
+ conjectures = this.conjectures.map((conjecture) => {
719
+ const conjectureJSON = conjecture.toJSON();
720
+
721
+ conjecture = conjectureJSON; ///
722
+
723
+ return conjecture;
724
+ }),
725
+ combinators = this.combinators.map((combinator) => {
726
+ const combinatorJSON = combinator.toJSON();
727
+
728
+ combinator = combinatorJSON; ///
729
+
730
+ return combinator;
731
+ }),
732
+ constructors = this.constructors.map((constructor) => {
733
+ const constructorJSON = constructor.toJSON();
734
+
735
+ constructor = constructorJSON; ///
736
+
737
+ return constructor;
738
+ }),
739
+ metatheorems = this.metatheorems.map((metatheorem) => {
740
+ const metatheoremJSON = metatheorem.toJSON();
741
+
742
+ metatheorem = metatheoremJSON; ///
743
+
744
+ return metatheorem;
745
+ }),
746
+ metavariables = this.metavariables.map((metavariable) => {
747
+ const metavariableJSON = metavariable.toJSON();
748
+
749
+ metavariable = metavariableJSON; ///
750
+
751
+ return metavariable;
752
+ }),
653
753
  json = {
654
754
  filePath,
655
- fileContent
755
+ types,
756
+ rules,
757
+ axioms,
758
+ lemmas,
759
+ theorems,
760
+ variables,
761
+ metaLemmas,
762
+ conjectures,
763
+ combinators,
764
+ constructors,
765
+ metatheorems,
766
+ metavariables
656
767
  };
657
768
 
658
769
  return json;
659
770
  }
660
771
 
772
+ static fromJSON(json) {
773
+ const { types, rules, axioms, lemmas, theorems, metaLemmas, variables, conjectures, combinators, constructors, metatheorems, metavariables } = json,
774
+ fileContext = this, ///
775
+ typesJSON = types, ///
776
+ rulesJSON = rules, ///
777
+ axiomsJSON = axioms, ///
778
+ lemmasJSON = lemmas, ///
779
+ theoremsJSON = theorems, ///
780
+ variablesJSON = variables, ///
781
+ metaLemmasJSON = metaLemmas, ///
782
+ conjecturesJSON = conjectures, ///
783
+ combinatorsJSON = combinators, ///
784
+ constructorsJSON = constructors, ///
785
+ metatheoremsJSON = metatheorems, ///
786
+ metavariablesJSON = metavariables; ///
787
+
788
+ typesJSON.forEach((typeJSON) => {
789
+ const json = typeJSON, ///
790
+ type = Type.fromJSON(json, fileContext);
791
+
792
+ this.types.push(type);
793
+ });
794
+
795
+ rulesJSON.forEach((ruleJSON) => {
796
+ const json = ruleJSON, ///
797
+ rule = Rule.fromJSON(json, fileContext);
798
+
799
+ this.rules.push(rule);
800
+ });
801
+
802
+ axiomsJSON.forEach((axiomJSON) => {
803
+ const json = axiomJSON, ///
804
+ axiom = Axiom.fromJSON(json, fileContext);
805
+
806
+ this.axioms.push(axiom);
807
+ });
808
+
809
+ lemmasJSON.forEach((lemmaJSON) => {
810
+ const json = lemmaJSON, ///
811
+ lemma = Lemma.fromJSON(json, fileContext);
812
+
813
+ this.lemmas.push(lemma);
814
+ });
815
+
816
+ theoremsJSON.forEach((theoremJSON) => {
817
+ const json = theoremJSON, ///
818
+ theorem = Theorem.fromJSON(json, fileContext);
819
+
820
+ this.theorems.push(theorem);
821
+ });
822
+
823
+ variablesJSON.forEach((variableJSON) => {
824
+ const json = variableJSON, ///
825
+ variable = Variable.fromJSON(json, fileContext);
826
+
827
+ this.variables.push(variable);
828
+ });
829
+
830
+ metaLemmasJSON.forEach((metaLemmaJSON) => {
831
+ const json = metaLemmaJSON, ///
832
+ metaLemma = MetaLemma.fromJSON(json, fileContext);
833
+
834
+ this.metaLemmas.push(metaLemma);
835
+ });
836
+
837
+ conjecturesJSON.forEach((conjectureJSON) => {
838
+ const json = conjectureJSON, ///
839
+ conjecture = Conjecture.fromJSON(json, fileContext);
840
+
841
+ this.conjectures.push(conjecture);
842
+ });
843
+
844
+ combinatorsJSON.forEach((combinatorJSON) => {
845
+ const json = combinatorJSON, ///
846
+ combinator = Combinator.fromJSON(json, fileContext);
847
+
848
+ this.combinators.push(combinator);
849
+ });
850
+
851
+ constructorsJSON.forEach((constructorJSON) => {
852
+ const json = constructorJSON, ///
853
+ constructor = Constructor.fromJSON(json, fileContext);
854
+
855
+ this.constructors.push(constructor);
856
+ });
857
+
858
+ metatheoremsJSON.forEach((metatheoremJSON) => {
859
+ const json = metatheoremJSON, ///
860
+ metatheorem = Metatheorem.fromJSON(json, fileContext);
861
+
862
+ this.metatheorems.push(metatheorem);
863
+ });
864
+
865
+ metavariablesJSON.forEach((metavariableJSON) => {
866
+ const json = metavariableJSON, ///
867
+ metavariable = Metavariable.fromJSON(json, fileContext);
868
+
869
+ this.metavariables.push(metavariable);
870
+ });
871
+ }
872
+
661
873
  static fromFileAndReleaseContext(file, releaseContext) {
662
874
  const fileContent = file.getContent(),
663
875
  filePath = file.getPath(),