occam-verify-cli 1.0.437 → 1.0.444

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 (217) hide show
  1. package/lib/context/file.js +38 -35
  2. package/lib/context/local.js +10 -10
  3. package/lib/context/release.js +6 -6
  4. package/lib/context/temporary.js +14 -14
  5. package/lib/element/assertion/contained.js +45 -45
  6. package/lib/element/assertion/defined.js +13 -13
  7. package/lib/element/assertion/property.js +23 -22
  8. package/lib/element/assertion/satisfies.js +7 -6
  9. package/lib/element/assertion/subproof.js +20 -17
  10. package/lib/element/assertion/type.js +3 -2
  11. package/lib/element/assertion.js +1 -23
  12. package/lib/element/assumption.js +24 -22
  13. package/lib/element/axiom.js +9 -12
  14. package/lib/element/axiomLemmaTheoremConjecture.js +32 -32
  15. package/lib/element/{statement/combinator → combinator}/bracketed.js +16 -16
  16. package/lib/element/combinator.js +229 -0
  17. package/lib/element/conclusion.js +11 -9
  18. package/lib/element/{term/constructor → constructor}/bracketed.js +5 -5
  19. package/lib/element/constructor.js +232 -0
  20. package/lib/element/declaration/combinator.js +2 -16
  21. package/lib/element/declaration/complexType.js +12 -12
  22. package/lib/element/declaration/constructor.js +13 -11
  23. package/lib/element/declaration/simpleType.js +4 -4
  24. package/lib/element/declaration/typePrefix.js +2 -2
  25. package/lib/element/declaration/variable.js +3 -3
  26. package/lib/element/deduction.js +11 -9
  27. package/lib/element/derivation.js +5 -8
  28. package/lib/element/equivalence.js +10 -10
  29. package/lib/element/equivalences.js +5 -5
  30. package/lib/element/frame.js +32 -38
  31. package/lib/element/hypothesis.js +3 -3
  32. package/lib/element/judgement.js +6 -4
  33. package/lib/element/label.js +16 -18
  34. package/lib/element/metaLemmaMetatheorem.js +5 -5
  35. package/lib/element/metaType.js +17 -80
  36. package/lib/element/metavariable.js +34 -34
  37. package/lib/element/parameter.js +3 -3
  38. package/lib/element/premise.js +43 -52
  39. package/lib/element/property.js +9 -9
  40. package/lib/element/propertyRelation.js +13 -13
  41. package/lib/element/reference.js +14 -17
  42. package/lib/element/rule.js +26 -50
  43. package/lib/element/signature.js +11 -11
  44. package/lib/element/statement.js +54 -56
  45. package/lib/element/step.js +79 -51
  46. package/lib/element/subDerivation.js +7 -10
  47. package/lib/element/subproof.js +6 -14
  48. package/lib/element/substitution/frame.js +1 -7
  49. package/lib/element/substitution/reference.js +2 -3
  50. package/lib/element/substitution/statement.js +44 -15
  51. package/lib/element/substitution/term.js +10 -57
  52. package/lib/element/substitution.js +5 -11
  53. package/lib/element/substitutions.js +29 -29
  54. package/lib/element/supposition.js +63 -55
  55. package/lib/element/term.js +21 -34
  56. package/lib/element/type.js +47 -60
  57. package/lib/element/typePrefix.js +5 -5
  58. package/lib/element/variable.js +9 -9
  59. package/lib/element.js +27 -3
  60. package/lib/metaTypes.js +52 -0
  61. package/lib/node/axiomLemmaTheoremConjecture.js +9 -9
  62. package/lib/node/body/axiom.js +2 -25
  63. package/lib/node/body/conjecture.js +2 -25
  64. package/lib/node/body/lemma.js +2 -25
  65. package/lib/node/body/metaLemma.js +2 -25
  66. package/lib/node/body/metatheorem.js +2 -25
  67. package/lib/node/body/rule.js +15 -1
  68. package/lib/node/body/theorem.js +2 -25
  69. package/lib/node/body.js +25 -2
  70. package/lib/node/combinator.js +11 -2
  71. package/lib/node/constructor.js +11 -2
  72. package/lib/node/declaration/combinator.js +5 -5
  73. package/lib/node/declaration/constructor.js +8 -8
  74. package/lib/node/declaration/property.js +15 -15
  75. package/lib/node/declaration/simpleType.js +31 -31
  76. package/lib/node/declaration/variable.js +8 -8
  77. package/lib/node/equality.js +8 -8
  78. package/lib/node/frame.js +20 -20
  79. package/lib/node/header.js +22 -22
  80. package/lib/node/metaLemmaMetaTheorem.js +16 -16
  81. package/lib/node/metavariable.js +15 -15
  82. package/lib/node/property.js +8 -8
  83. package/lib/node/propertyRelation.js +8 -8
  84. package/lib/node/rule.js +16 -16
  85. package/lib/node/statement.js +12 -12
  86. package/lib/node/step.js +22 -22
  87. package/lib/node/subproof.js +8 -8
  88. package/lib/node/substitution/frame.js +19 -19
  89. package/lib/node/substitution/statement.js +19 -19
  90. package/lib/node/substitution/term.js +19 -19
  91. package/lib/node/term.js +35 -35
  92. package/lib/preamble.js +5 -5
  93. package/lib/process/instantiate.js +20 -2
  94. package/lib/process/unify.js +39 -42
  95. package/lib/process/validate.js +431 -0
  96. package/lib/process/verify.js +44 -135
  97. package/lib/types.js +27 -0
  98. package/lib/utilities/brackets.js +4 -4
  99. package/lib/utilities/element.js +100 -61
  100. package/lib/utilities/instance.js +18 -18
  101. package/lib/utilities/statement.js +11 -16
  102. package/lib/utilities/string.js +21 -10
  103. package/lib/utilities/unification.js +237 -0
  104. package/lib/utilities/validation.js +251 -0
  105. package/package.json +6 -6
  106. package/src/context/file.js +37 -31
  107. package/src/context/local.js +8 -8
  108. package/src/context/release.js +9 -6
  109. package/src/context/temporary.js +11 -11
  110. package/src/element/assertion/contained.js +19 -20
  111. package/src/element/assertion/defined.js +11 -12
  112. package/src/element/assertion/property.js +20 -20
  113. package/src/element/assertion/satisfies.js +6 -6
  114. package/src/element/assertion/subproof.js +17 -15
  115. package/src/element/assertion/type.js +2 -2
  116. package/src/element/assertion.js +0 -2
  117. package/src/element/assumption.js +22 -19
  118. package/src/element/axiom.js +7 -11
  119. package/src/element/axiomLemmaTheoremConjecture.js +36 -36
  120. package/src/element/{statement/combinator → combinator}/bracketed.js +7 -7
  121. package/src/element/combinator.js +90 -0
  122. package/src/element/conclusion.js +12 -10
  123. package/src/element/{term/constructor → constructor}/bracketed.js +5 -5
  124. package/src/element/{term/constructor.js → constructor.js} +17 -25
  125. package/src/element/declaration/combinator.js +1 -22
  126. package/src/element/declaration/complexType.js +11 -11
  127. package/src/element/declaration/constructor.js +13 -10
  128. package/src/element/declaration/simpleType.js +3 -3
  129. package/src/element/declaration/typePrefix.js +1 -1
  130. package/src/element/declaration/variable.js +2 -2
  131. package/src/element/deduction.js +12 -9
  132. package/src/element/derivation.js +4 -8
  133. package/src/element/equivalence.js +8 -8
  134. package/src/element/equivalences.js +4 -4
  135. package/src/element/frame.js +28 -30
  136. package/src/element/hypothesis.js +2 -2
  137. package/src/element/judgement.js +6 -3
  138. package/src/element/label.js +14 -21
  139. package/src/element/metaLemmaMetatheorem.js +4 -3
  140. package/src/element/metaType.js +9 -45
  141. package/src/element/metavariable.js +29 -31
  142. package/src/element/parameter.js +2 -2
  143. package/src/element/premise.js +56 -62
  144. package/src/element/property.js +6 -6
  145. package/src/element/propertyRelation.js +11 -11
  146. package/src/element/reference.js +12 -21
  147. package/src/element/rule.js +28 -72
  148. package/src/element/signature.js +10 -9
  149. package/src/element/statement.js +69 -56
  150. package/src/element/step.js +89 -51
  151. package/src/element/subDerivation.js +6 -10
  152. package/src/element/subproof.js +4 -12
  153. package/src/element/substitution/frame.js +0 -2
  154. package/src/element/substitution/reference.js +1 -5
  155. package/src/element/substitution/statement.js +44 -14
  156. package/src/element/substitution/term.js +10 -13
  157. package/src/element/substitution.js +3 -5
  158. package/src/element/substitutions.js +48 -30
  159. package/src/element/supposition.js +88 -70
  160. package/src/element/term.js +18 -28
  161. package/src/element/type.js +42 -36
  162. package/src/element/typePrefix.js +3 -3
  163. package/src/element/variable.js +7 -7
  164. package/src/element.js +15 -1
  165. package/src/metaTypes.js +42 -0
  166. package/src/node/axiomLemmaTheoremConjecture.js +6 -6
  167. package/src/node/body/axiom.js +0 -21
  168. package/src/node/body/conjecture.js +0 -23
  169. package/src/node/body/lemma.js +0 -23
  170. package/src/node/body/metaLemma.js +0 -23
  171. package/src/node/body/metatheorem.js +0 -23
  172. package/src/node/body/rule.js +12 -0
  173. package/src/node/body/theorem.js +0 -23
  174. package/src/node/body.js +23 -0
  175. package/src/node/combinator.js +9 -0
  176. package/src/node/constructor.js +9 -0
  177. package/src/node/declaration/combinator.js +5 -5
  178. package/src/node/declaration/constructor.js +8 -8
  179. package/src/node/declaration/property.js +14 -14
  180. package/src/node/declaration/simpleType.js +31 -31
  181. package/src/node/declaration/variable.js +7 -7
  182. package/src/node/equality.js +7 -7
  183. package/src/node/frame.js +21 -21
  184. package/src/node/header.js +22 -22
  185. package/src/node/metaLemmaMetaTheorem.js +14 -14
  186. package/src/node/metavariable.js +14 -14
  187. package/src/node/property.js +7 -7
  188. package/src/node/propertyRelation.js +7 -7
  189. package/src/node/rule.js +15 -15
  190. package/src/node/statement.js +12 -12
  191. package/src/node/step.js +21 -21
  192. package/src/node/subproof.js +7 -7
  193. package/src/node/substitution/frame.js +18 -18
  194. package/src/node/substitution/statement.js +18 -18
  195. package/src/node/substitution/term.js +18 -18
  196. package/src/node/term.js +34 -34
  197. package/src/preamble.js +4 -4
  198. package/src/process/instantiate.js +12 -0
  199. package/src/process/unify.js +53 -57
  200. package/src/process/validate.js +316 -0
  201. package/src/process/verify.js +50 -138
  202. package/src/types.js +18 -0
  203. package/src/utilities/brackets.js +10 -6
  204. package/src/utilities/element.js +138 -91
  205. package/src/utilities/instance.js +18 -18
  206. package/src/utilities/statement.js +27 -28
  207. package/src/utilities/string.js +34 -20
  208. package/src/{mixins/step/unify.js → utilities/unification.js} +82 -68
  209. package/src/utilities/validation.js +369 -0
  210. package/lib/element/statement/combinator.js +0 -105
  211. package/lib/element/term/constructor.js +0 -172
  212. package/lib/mixins/statement/verify.js +0 -198
  213. package/lib/mixins/step/unify.js +0 -228
  214. package/lib/mixins/term/verify.js +0 -65
  215. package/src/element/statement/combinator.js +0 -59
  216. package/src/mixins/statement/verify.js +0 -295
  217. package/src/mixins/term/verify.js +0 -81
@@ -6,7 +6,6 @@ import TemporaryContext from "../context/temporary";
6
6
  import assignAssignments from "../process/assign";
7
7
 
8
8
  import { define } from "../elements";
9
- import { subproofAssertionFromStatement } from "../utilities/statement";
10
9
  import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../utilities/json";
11
10
 
12
11
  export default define(class Premise extends Element {
@@ -32,46 +31,49 @@ export default define(class Premise extends Element {
32
31
 
33
32
  context = temporaryContext; ///
34
33
 
35
- const premiseString = this.string; ///
34
+ const node = this.getNode(),
35
+ premiseString = this.getString(); ///
36
36
 
37
- context.trace(`Verifying the '${premiseString}' premise...`, this.node);
37
+ context.trace(`Verifying the '${premiseString}' premise...`, node);
38
38
 
39
- if (false) {
40
- ///
41
- } else if (this.statement !== null) {
42
- const stated = true,
43
- assignments = [],
44
- statementVerifies = this.statement.verify(assignments, stated, context);
39
+ if ((this.statement === null) && (this.procedureCall === null)) {
40
+ context.debug(`Unable to verify the '${premiseString}' premise because it is nonsense.`, node);
41
+ } else {
42
+ if (this.statement !== null) {
43
+ const stated = true,
44
+ assignments = [],
45
+ statementValidates = this.statement.validate(assignments, stated, context);
45
46
 
46
- if (statementVerifies) {
47
- const assignmentsAssigned = assignAssignments(assignments, context);
47
+ if (statementValidates) {
48
+ const assignmentsAssigned = assignAssignments(assignments, context);
48
49
 
49
- if (assignmentsAssigned) {
50
- const { Step } = elements,
51
- step = Step.fromStatement(this.statement, context),
52
- stepOrSubproof = step; ///
50
+ if (assignmentsAssigned) {
51
+ const { Step } = elements,
52
+ step = Step.fromStatement(this.statement, context),
53
+ stepOrSubproof = step; ///
53
54
 
54
- context.addStepOrSubproof(stepOrSubproof);
55
+ context.addStepOrSubproof(stepOrSubproof);
55
56
 
56
- verifies = true;
57
+ verifies = true;
58
+ }
57
59
  }
58
60
  }
59
- } else if (this.procedureCall !== null) {
60
- const stated = true,
61
- assignments = null,
62
- procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
63
61
 
64
- if (procedureCallVerifies) {
65
- verifies = true;
62
+ if (this.procedureCall !== null) {
63
+ const stated = true,
64
+ assignments = null,
65
+ procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
66
+
67
+ if (procedureCallVerifies) {
68
+ verifies = true;
69
+ }
66
70
  }
67
- } else {
68
- context.debug(`Unable to verify the '${premiseString}' premise because it is nonsense.`, this.node);
69
71
  }
70
72
 
71
73
  if (verifies) {
72
- this.context = context;
74
+ this.setContext(context);
73
75
 
74
- context.debug(`...verified the '${premiseString}' premise.`, this.node);
76
+ context.debug(`...verified the '${premiseString}' premise.`, node);
75
77
  }
76
78
 
77
79
  return verifies;
@@ -80,11 +82,12 @@ export default define(class Premise extends Element {
80
82
  unifyIndependently(substitutions, context) {
81
83
  let unifiesIndependently = false;
82
84
 
83
- const premiseString = this.string, ///
85
+ const node = this.getNode(),
86
+ premiseString = this.getString(), ///
84
87
  generalContext = this.context, ///
85
88
  specificContext = context; ///
86
89
 
87
- context.trace(`Unifying the '${premiseString}' premise independently...`, this.node);
90
+ context.trace(`Unifying the '${premiseString}' premise independently...`, node);
88
91
 
89
92
  if (this.statement !== null) {
90
93
  const statementUnifiesIndependently = this.statement.unifyIndependently(substitutions, generalContext, specificContext);
@@ -103,7 +106,7 @@ export default define(class Premise extends Element {
103
106
  }
104
107
 
105
108
  if (unifiesIndependently) {
106
- context.debug(`...unified the '${premiseString}' premise independenly.`, this.node);
109
+ context.debug(`...unified the '${premiseString}' premise independenly.`, node);
107
110
  }
108
111
 
109
112
  return unifiesIndependently;
@@ -145,22 +148,7 @@ export default define(class Premise extends Element {
145
148
  return stepOrSubproofUnifies;
146
149
  }
147
150
 
148
- unifyStep(step, substitutions, context) {
149
- let stepUnifies = false;
150
-
151
- context = step.getContext();
152
-
153
- const statement = step.getStatement(),
154
- statementUnifies = this.unifyStatement(statement, substitutions, context);
155
-
156
- if (statementUnifies) {
157
- stepUnifies = true;
158
- }
159
-
160
- return stepUnifies;
161
- }
162
-
163
- unifySubproof(subproof, substitutions, generalContext, specificContext) {
151
+ unifySubproof(subproof, substitutions, context) {
164
152
  let subproofUnifies = false;
165
153
 
166
154
  const premise = this, ///
@@ -168,10 +156,18 @@ export default define(class Premise extends Element {
168
156
  premiseStatement = premise.getStatement(),
169
157
  premiseStatementString = premiseStatement.getString();
170
158
 
171
- specificContext.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement...`);
159
+ context.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement...`);
160
+
161
+ const specificContext = context; ///
162
+
163
+ context = this.getContext();
164
+
165
+ const generalContext = context; ///
166
+
167
+ context = specificContext; ///
172
168
 
173
169
  if (this.statement !== null) {
174
- const context = generalContext,
170
+ const context = generalContext, ///
175
171
  subproofAssertion = subproofAssertionFromStatement(this.statement, context);
176
172
 
177
173
  if (subproofAssertion !== null) {
@@ -180,33 +176,31 @@ export default define(class Premise extends Element {
180
176
  }
181
177
 
182
178
  if (subproofUnifies) {
183
- specificContext.debug(`...unified the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement.`);
179
+ context.debug(`...unified the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement.`);
184
180
  }
185
181
 
186
182
  return subproofUnifies;
187
183
  }
188
184
 
189
- unifyStatement(statement, substitutions, context) {
190
- let statementUnifies;
185
+ unifyStep(step, substitutions, context) {
186
+ let stepUnifies = false;
187
+
188
+ const specificContext = context; ///
191
189
 
192
- const premise = this, ///
193
- premiseString = premise.getString(),
194
- statementString = statement.getString();
190
+ context = this.getContext();
195
191
 
196
- context.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise...`);
192
+ const generalContext = context; ///
197
193
 
198
- if (this.statement !== null) {
199
- const generalContext = this.context, ///
200
- specificContext = context; ///
194
+ context = specificContext; ///
201
195
 
202
- statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
203
- }
196
+ const statement = step.getStatement(),
197
+ statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
204
198
 
205
199
  if (statementUnifies) {
206
- context.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`);
200
+ stepUnifies = true;
207
201
  }
208
202
 
209
- return statementUnifies;
203
+ return stepUnifies;
210
204
  }
211
205
 
212
206
  toJSON() {
@@ -20,16 +20,16 @@ export default define(class Property extends Element {
20
20
  return this.nominalTypeName;
21
21
  }
22
22
 
23
- matchPropertyName(propertyName) {
24
- const propertyNameMatches = (this.name === propertyName);
23
+ comparePropertyName(propertyName) {
24
+ const comparesToPropertyName = (this.name === propertyName);
25
25
 
26
- return propertyNameMatches;
26
+ return comparesToPropertyName;
27
27
  }
28
28
 
29
- matchNominalTypeName(nominalTypeName) {
30
- const nominalTypeNameMatches = (this.nominalTypeName === nominalTypeName);
29
+ compareNominalTypeName(nominalTypeName) {
30
+ const comparesToNominalTypeName = (this.nominalTypeName === nominalTypeName);
31
31
 
32
- return nominalTypeNameMatches;
32
+ return comparesToNominalTypeName;
33
33
  }
34
34
 
35
35
  toJSON() {
@@ -27,9 +27,9 @@ export default define(class PropertyRelation extends Element {
27
27
 
28
28
  context.trace(`Verifying the '${propertyRelationString}' property relation...`);
29
29
 
30
- const termVerifies = this.verifyTerm(context);
30
+ const termValidates = this.validateTerm(context);
31
31
 
32
- if (termVerifies) {
32
+ if (termValidates) {
33
33
  const propertyVerifies = this.verifyProperty(context);
34
34
 
35
35
  verifies = propertyVerifies;
@@ -42,24 +42,24 @@ export default define(class PropertyRelation extends Element {
42
42
  return verifies;
43
43
  }
44
44
 
45
- verifyTerm(context) {
46
- let termVerifies;
45
+ validateTerm(context) {
46
+ let termValidates;
47
47
 
48
48
  const termString = this.term.getString();
49
49
 
50
- context.trace(`Verifying the '${termString}' term...`);
50
+ context.trace(`Validating the '${termString}' term...`);
51
51
 
52
- termVerifies = this.term.verify(context, () => {
52
+ termValidates = this.term.validate(context, () => {
53
53
  const verifiesAhead = true;
54
54
 
55
55
  return verifiesAhead;
56
56
  });
57
57
 
58
- if (termVerifies) {
59
- context.debug(`...verified the '${termString}' term.`);
58
+ if (termValidates) {
59
+ context.debug(`...validated the '${termString}' term.`);
60
60
  }
61
61
 
62
- return termVerifies;
62
+ return termValidates;
63
63
  }
64
64
 
65
65
  verifyProperty(context) {
@@ -73,9 +73,9 @@ export default define(class PropertyRelation extends Element {
73
73
  propertyName = this.property.getName(),
74
74
  termTypeProperties = termType.getProperties(),
75
75
  variableTypeProperty = termTypeProperties.find((termTypeProperty) => {
76
- const propertyNameMatches = termTypeProperty.matchPropertyName(propertyName);
76
+ const termTypePropertyComparesToPropertyName = termTypeProperty.comparePropertyName(propertyName);
77
77
 
78
- if (propertyNameMatches) {
78
+ if (termTypePropertyComparesToPropertyName) {
79
79
  return true;
80
80
  }
81
81
  }) || null;
@@ -4,7 +4,7 @@ import Element from "../element";
4
4
  import elements from "../elements";
5
5
 
6
6
  import { define } from "../elements";
7
- import { referenceMetaType } from ".//metaType";
7
+ import { referenceMetaTypeFromNothing } from "../metaTypes";
8
8
  import { unifyMetavariableIntrinsically } from "../process/unify";
9
9
  import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
10
10
 
@@ -35,19 +35,9 @@ export default define(class Reference extends Element {
35
35
 
36
36
  isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
37
37
 
38
- matchMetavariableName(metavariableName) { return this.metavariable.matchMetavariableName(metavariableName); }
38
+ compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
39
39
 
40
- matchMetavariableNode(metavariableNode) {
41
- const metavariableNodeA = metavariableNode; ///
42
-
43
- metavariableNode = this.metavariable.getNode();
44
-
45
- const metavariableNodeB = metavariableNode, ///
46
- matches = metavariableNodeA.match(metavariableNodeB),
47
- metavariableNodeMatches = matches; ///
48
-
49
- return metavariableNodeMatches; ///
50
- }
40
+ matchMetavariableNode(metavariableNode) { return this.metavariable.matchNode(metavariableNode); }
51
41
 
52
42
  verify(context) {
53
43
  let verifies = false;
@@ -57,9 +47,9 @@ export default define(class Reference extends Element {
57
47
  context.trace(`Verifying the '${referenceString}' reference...`);
58
48
 
59
49
  if (!verifies) {
60
- const metavariableVerifies = this.verifyMetavariable(context);
50
+ const metavariableValidates = this.validateMetavariable(context);
61
51
 
62
- verifies = metavariableVerifies; ///
52
+ verifies = metavariableValidates; ///
63
53
  }
64
54
 
65
55
  if (!verifies) {
@@ -80,15 +70,16 @@ export default define(class Reference extends Element {
80
70
  return verifies;
81
71
  }
82
72
 
83
- verifyMetavariable(context) {
84
- let metavariableVerifies;
73
+ validateMetavariable(context) {
74
+ let metavariableValidates;
85
75
 
86
- const metaType = referenceMetaType, ///
87
- metavariableVerifiesGivenMetaType = this.metavariable.verifyGivenMetaType(metaType, context);
76
+ const referenceMetaType = referenceMetaTypeFromNothing(),
77
+ metaType = referenceMetaType, ///
78
+ metavariableValidatesGivenMetaType = this.metavariable.validateGivenMetaType(metaType, context);
88
79
 
89
- metavariableVerifies = metavariableVerifiesGivenMetaType; ///
80
+ metavariableValidates = metavariableValidatesGivenMetaType; ///
90
81
 
91
- return metavariableVerifies;
82
+ return metavariableValidates;
92
83
  }
93
84
 
94
85
  unifyLabel(label, substitutions, context) {
@@ -17,13 +17,13 @@ import { labelsFromJSON,
17
17
  const { reverse, extract, backwardsEvery } = arrayUtilities;
18
18
 
19
19
  export default define(class Rule extends Element {
20
- constructor(context, string, node, labels, premises, conclusion, proof) {
20
+ constructor(context, string, node, proof, labels, premises, conclusion) {
21
21
  super(context, string, node);
22
22
 
23
+ this.proof = proof;
23
24
  this.labels = labels;
24
25
  this.premises = premises;
25
26
  this.conclusion = conclusion;
26
- this.proof = proof;
27
27
  }
28
28
 
29
29
  getLabels() {
@@ -34,39 +34,47 @@ export default define(class Rule extends Element {
34
34
  return this.premises;
35
35
  }
36
36
 
37
- getConclusion() {
38
- return this.conclusion;
39
- }
40
-
41
37
  getProof() {
42
38
  return this.proof;
43
39
  }
44
40
 
45
- matchMetavariableName(metavariableName) {
46
- const metavariableNameMatches = this.labels.some((label) => {
47
- const metavariableNameMatches = label.matchMetavariableName(metavariableName);
41
+ getConclusion() {
42
+ return this.conclusion;
43
+ }
44
+
45
+ compareMetavariableName(metavariableName) {
46
+ const comparesToMetavariableName = this.labels.some((label) => {
47
+ const labelComparesToMetavariableName = label.compareMetavariableName(metavariableName);
48
48
 
49
- if (metavariableNameMatches) {
49
+ if (labelComparesToMetavariableName) {
50
50
  return true;
51
51
  }
52
52
  });
53
53
 
54
- return metavariableNameMatches;
54
+ return comparesToMetavariableName;
55
55
  }
56
56
 
57
57
  verify() {
58
58
  let verifies = false;
59
59
 
60
- const ruleString = this.string; ///
60
+ let context;
61
+
62
+ const node = this.getNode();
63
+
64
+ context = this.getContext();
61
65
 
62
- this.context.trace(`Verifying the '${ruleString}' rule...`, this.node);
66
+ const ruleString = this.getString(); ///
67
+
68
+ context.trace(`Verifying the '${ruleString}' rule...`, node);
63
69
 
64
70
  const labelsVerify = this.verifyLabels();
65
71
 
66
72
  if (labelsVerify) {
67
- const localContext = LocalContext.fromNothing(this.context),
68
- context = localContext, ///
69
- premisesVerify = this.verifyPremises(context);
73
+ const localContext = LocalContext.fromNothing(context);
74
+
75
+ context = localContext; ///
76
+
77
+ const premisesVerify = this.verifyPremises(context);
70
78
 
71
79
  if (premisesVerify) {
72
80
  const conclusionVerifies = this.verifyConclusion(context);
@@ -75,9 +83,10 @@ export default define(class Rule extends Element {
75
83
  const proofVerifies = this.verifyProof(context);
76
84
 
77
85
  if (proofVerifies) {
78
- const rule = this; ///
86
+ const rule = this, ///
87
+ context = this.getContext();
79
88
 
80
- this.context.addRule(rule);
89
+ context.addRule(rule);
81
90
 
82
91
  verifies = true;
83
92
  }
@@ -86,7 +95,7 @@ export default define(class Rule extends Element {
86
95
  }
87
96
 
88
97
  if (verifies) {
89
- this.context.debug(`...verified the '${ruleString}' rule.`, this.node);
98
+ context.debug(`...verified the '${ruleString}' rule.`, node);
90
99
  }
91
100
 
92
101
  return verifies;
@@ -252,57 +261,4 @@ export default define(class Rule extends Element {
252
261
 
253
262
  return rule;
254
263
  }
255
-
256
- static fromRuleNode(ruleNode, context) {
257
- const node = ruleNode, ///
258
- proof = proofFromRuleNode(ruleNode, context),
259
- labels = labelsFromRuleNode(ruleNode, context),
260
- premises = premisesFromRuleNode(ruleNode, context),
261
- conclusion = conclusionFromRuleNode(ruleNode, context),
262
- string = stringFromLabelsPremisesAndConclusion(labels, premises, conclusion),
263
- rule = new Rule(context, string, node, labels, premises, conclusion, proof);
264
-
265
- return rule;
266
- }
267
264
  });
268
-
269
- function proofFromRuleNode(ruleNode, context) {
270
- const { Proof } = elements,
271
- proofNode = ruleNode.getProofNode(),
272
- proof = Proof.fromProofNode(proofNode, context);
273
-
274
- return proof;
275
- }
276
-
277
- function labelsFromRuleNode(ruleNode, context) {
278
- const { Label } = elements,
279
- labelNodes = ruleNode.getLabelNodes(),
280
- labels = labelNodes.map((labelNode) => {
281
- const label = Label.fromLabelNode(labelNode, context);
282
-
283
- return label;
284
- });
285
-
286
- return labels;
287
- }
288
-
289
- function premisesFromRuleNode(ruleNode, context) {
290
- const { Premise } = elements,
291
- premiseNodes = ruleNode.getPremiseNodes(),
292
- premises = premiseNodes.map((premiseNode) => {
293
- const premise = Premise.fromPremiseNode(premiseNode, context);
294
-
295
- return premise;
296
- });
297
-
298
- return premises;
299
- }
300
-
301
- function conclusionFromRuleNode(ruleNode, context) {
302
- const { Conclusion } = elements,
303
- conclusionNode = ruleNode.getConclusionNode(),
304
- conclusion = Conclusion.fromConclusionNode(conclusionNode, context);
305
-
306
- return conclusion;
307
- }
308
-
@@ -27,7 +27,7 @@ export default define(class Signature extends Element {
27
27
 
28
28
  const signatureString = this.string; ///
29
29
 
30
- context.trace(`Verifying the ${signatureString} signature...`);
30
+ context.trace(`Verifying the '${signatureString}' signature...`);
31
31
 
32
32
  verifies = this.terms.every((term) => {
33
33
  const termVerifies = term.verify(context, () => {
@@ -42,13 +42,13 @@ export default define(class Signature extends Element {
42
42
  });
43
43
 
44
44
  if (verifies) {
45
- context.debug(`...verified the ${signatureString} signature.`);
45
+ context.debug(`...verified the '${signatureString}' signature.`);
46
46
  }
47
47
 
48
48
  return verifies;
49
49
  }
50
50
 
51
- match(signature, substitutions, generalContext, specificContext) {
51
+ compare(signature, substitutions, generalContext, specificContext) {
52
52
  const terms = signature.getTerms(),
53
53
  termsA = this.terms, ///
54
54
  termsB = terms, ///
@@ -74,9 +74,10 @@ export default define(class Signature extends Element {
74
74
  return true;
75
75
  }
76
76
  }
77
- });
77
+ }),
78
+ compares = matches; ///
78
79
 
79
- return matches;
80
+ return compares;
80
81
  }
81
82
 
82
83
  compareSubstitutions(substitutions, context) {
@@ -85,7 +86,7 @@ export default define(class Signature extends Element {
85
86
  const signatureString = this.string, ///
86
87
  substitutionsString = substitutions.asString();
87
88
 
88
- context.trace(`Comparing the '${substitutionsString}' substitutions against the ${signatureString} signature...`);
89
+ context.trace(`Comparing the '${substitutionsString}' substitutions against the '${signatureString}' signature...`);
89
90
 
90
91
  const array = substitutions.getArray(),
91
92
  compares = compare(this.terms, array, (term, substitution) => {
@@ -102,7 +103,7 @@ export default define(class Signature extends Element {
102
103
  }
103
104
 
104
105
  if (substitutionsCompares) {
105
- context.debug(`...compared the '${substitutionsString}' substitutions against the ${signatureString} signature.`);
106
+ context.debug(`...compared the '${substitutionsString}' substitutions against the '${signatureString}' signature.`);
106
107
  }
107
108
 
108
109
  return substitutionsCompares;
@@ -114,7 +115,7 @@ export default define(class Signature extends Element {
114
115
  const signatureString = this.string, ///
115
116
  substitutionsString = substitutions.asString();
116
117
 
117
- context.trace(`Correlating the '${substitutionsString}' substitutions against the ${signatureString} signature...`);
118
+ context.trace(`Correlating the '${substitutionsString}' substitutions against the '${signatureString}' signature...`);
118
119
 
119
120
  const array = substitutions.getArray(),
120
121
  correlates = correlate(this.terms, array, (term, substitution) => {
@@ -131,7 +132,7 @@ export default define(class Signature extends Element {
131
132
  }
132
133
 
133
134
  if (substitutionsCorrelates) {
134
- context.debug(`...correlated the '${substitutionsString}' substitutions against the ${signatureString} signature.`);
135
+ context.debug(`...correlated the '${substitutionsString}' substitutions against the '${signatureString}' signature.`);
135
136
  }
136
137
 
137
138
  return substitutionsCorrelates;