occam-verify-cli 1.0.438 → 1.0.448

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 (222) hide show
  1. package/lib/context/file.js +42 -39
  2. package/lib/context/local.js +34 -34
  3. package/lib/context/release.js +3 -7
  4. package/lib/context/temporary.js +26 -26
  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 +27 -30
  14. package/lib/element/axiomLemmaTheoremConjecture.js +50 -57
  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 +17 -20
  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 +16 -57
  32. package/lib/element/judgement.js +6 -4
  33. package/lib/element/label.js +8 -8
  34. package/lib/element/metaLemmaMetatheorem.js +6 -39
  35. package/lib/element/metaType.js +17 -80
  36. package/lib/element/metavariable.js +38 -34
  37. package/lib/element/parameter.js +3 -3
  38. package/lib/element/premise.js +92 -174
  39. package/lib/element/proof.js +7 -7
  40. package/lib/element/proofAssertion.js +203 -0
  41. package/lib/element/property.js +9 -9
  42. package/lib/element/propertyRelation.js +13 -13
  43. package/lib/element/reference.js +16 -17
  44. package/lib/element/rule.js +46 -46
  45. package/lib/element/signature.js +11 -11
  46. package/lib/element/statement.js +18 -18
  47. package/lib/element/step.js +73 -124
  48. package/lib/element/subDerivation.js +17 -20
  49. package/lib/element/subproof.js +16 -24
  50. package/lib/element/substitution/frame.js +1 -7
  51. package/lib/element/substitution/reference.js +2 -3
  52. package/lib/element/substitution/statement.js +44 -15
  53. package/lib/element/substitution/term.js +10 -57
  54. package/lib/element/substitution.js +5 -11
  55. package/lib/element/substitutions.js +29 -29
  56. package/lib/element/supposition.js +95 -177
  57. package/lib/element/term.js +21 -34
  58. package/lib/element/type.js +47 -60
  59. package/lib/element/typePrefix.js +5 -5
  60. package/lib/element/variable.js +9 -9
  61. package/lib/element.js +9 -3
  62. package/lib/metaTypes.js +63 -0
  63. package/lib/node/axiomLemmaTheoremConjecture.js +9 -9
  64. package/lib/node/body/axiom.js +2 -25
  65. package/lib/node/body/conjecture.js +2 -25
  66. package/lib/node/body/lemma.js +2 -25
  67. package/lib/node/body/metaLemma.js +2 -25
  68. package/lib/node/body/metatheorem.js +2 -25
  69. package/lib/node/body/rule.js +15 -1
  70. package/lib/node/body/theorem.js +2 -25
  71. package/lib/node/body.js +25 -2
  72. package/lib/node/combinator.js +11 -2
  73. package/lib/node/constructor.js +11 -2
  74. package/lib/node/declaration/combinator.js +5 -5
  75. package/lib/node/declaration/constructor.js +8 -8
  76. package/lib/node/declaration/property.js +15 -15
  77. package/lib/node/declaration/simpleType.js +31 -31
  78. package/lib/node/declaration/variable.js +8 -8
  79. package/lib/node/equality.js +8 -8
  80. package/lib/node/frame.js +20 -20
  81. package/lib/node/header.js +22 -22
  82. package/lib/node/metaLemmaMetaTheorem.js +16 -16
  83. package/lib/node/metavariable.js +15 -15
  84. package/lib/node/property.js +8 -8
  85. package/lib/node/propertyRelation.js +8 -8
  86. package/lib/node/rule.js +16 -16
  87. package/lib/node/statement.js +12 -12
  88. package/lib/node/step.js +22 -22
  89. package/lib/node/subDerivation.js +1 -8
  90. package/lib/node/subproof.js +5 -12
  91. package/lib/node/substitution/frame.js +19 -19
  92. package/lib/node/substitution/statement.js +19 -19
  93. package/lib/node/substitution/term.js +19 -19
  94. package/lib/node/term.js +35 -35
  95. package/lib/preamble.js +5 -5
  96. package/lib/process/instantiate.js +20 -2
  97. package/lib/process/unify.js +39 -42
  98. package/lib/process/validate.js +431 -0
  99. package/lib/process/verify.js +44 -135
  100. package/lib/types.js +27 -0
  101. package/lib/utilities/brackets.js +9 -14
  102. package/lib/utilities/element.js +91 -55
  103. package/lib/utilities/instance.js +41 -28
  104. package/lib/utilities/statement.js +2 -2
  105. package/lib/utilities/string.js +25 -14
  106. package/lib/utilities/unification.js +237 -0
  107. package/lib/utilities/validation.js +251 -0
  108. package/package.json +6 -6
  109. package/src/context/file.js +40 -34
  110. package/src/context/local.js +34 -34
  111. package/src/context/release.js +2 -6
  112. package/src/context/temporary.js +15 -15
  113. package/src/element/assertion/contained.js +19 -20
  114. package/src/element/assertion/defined.js +11 -12
  115. package/src/element/assertion/property.js +20 -20
  116. package/src/element/assertion/satisfies.js +6 -6
  117. package/src/element/assertion/subproof.js +17 -15
  118. package/src/element/assertion/type.js +2 -2
  119. package/src/element/assertion.js +0 -2
  120. package/src/element/assumption.js +22 -19
  121. package/src/element/axiom.js +33 -37
  122. package/src/element/axiomLemmaTheoremConjecture.js +54 -73
  123. package/src/element/{statement/combinator → combinator}/bracketed.js +7 -7
  124. package/src/element/combinator.js +90 -0
  125. package/src/element/conclusion.js +12 -10
  126. package/src/element/{term/constructor → constructor}/bracketed.js +5 -5
  127. package/src/element/{term/constructor.js → constructor.js} +17 -25
  128. package/src/element/declaration/combinator.js +1 -22
  129. package/src/element/declaration/complexType.js +11 -11
  130. package/src/element/declaration/constructor.js +13 -10
  131. package/src/element/declaration/simpleType.js +3 -3
  132. package/src/element/declaration/typePrefix.js +1 -1
  133. package/src/element/declaration/variable.js +2 -2
  134. package/src/element/deduction.js +12 -9
  135. package/src/element/derivation.js +15 -19
  136. package/src/element/equivalence.js +8 -8
  137. package/src/element/equivalences.js +4 -4
  138. package/src/element/frame.js +28 -30
  139. package/src/element/hypothesis.js +16 -18
  140. package/src/element/judgement.js +6 -3
  141. package/src/element/label.js +4 -4
  142. package/src/element/metaLemmaMetatheorem.js +5 -69
  143. package/src/element/metaType.js +9 -45
  144. package/src/element/metavariable.js +34 -31
  145. package/src/element/parameter.js +2 -2
  146. package/src/element/premise.js +124 -99
  147. package/src/element/proof.js +6 -6
  148. package/src/element/proofAssertion.js +76 -0
  149. package/src/element/property.js +6 -6
  150. package/src/element/propertyRelation.js +11 -11
  151. package/src/element/reference.js +14 -21
  152. package/src/element/rule.js +39 -38
  153. package/src/element/signature.js +10 -9
  154. package/src/element/statement.js +16 -18
  155. package/src/element/step.js +78 -78
  156. package/src/element/subDerivation.js +15 -19
  157. package/src/element/subproof.js +11 -19
  158. package/src/element/substitution/frame.js +0 -2
  159. package/src/element/substitution/reference.js +1 -5
  160. package/src/element/substitution/statement.js +44 -14
  161. package/src/element/substitution/term.js +10 -13
  162. package/src/element/substitution.js +3 -5
  163. package/src/element/substitutions.js +48 -30
  164. package/src/element/supposition.js +127 -108
  165. package/src/element/term.js +18 -28
  166. package/src/element/type.js +42 -36
  167. package/src/element/typePrefix.js +3 -3
  168. package/src/element/variable.js +7 -7
  169. package/src/element.js +3 -1
  170. package/src/metaTypes.js +55 -0
  171. package/src/node/axiomLemmaTheoremConjecture.js +6 -6
  172. package/src/node/body/axiom.js +0 -21
  173. package/src/node/body/conjecture.js +0 -23
  174. package/src/node/body/lemma.js +0 -23
  175. package/src/node/body/metaLemma.js +0 -23
  176. package/src/node/body/metatheorem.js +0 -23
  177. package/src/node/body/rule.js +12 -0
  178. package/src/node/body/theorem.js +0 -23
  179. package/src/node/body.js +23 -0
  180. package/src/node/combinator.js +9 -0
  181. package/src/node/constructor.js +9 -0
  182. package/src/node/declaration/combinator.js +5 -5
  183. package/src/node/declaration/constructor.js +8 -8
  184. package/src/node/declaration/property.js +14 -14
  185. package/src/node/declaration/simpleType.js +31 -31
  186. package/src/node/declaration/variable.js +7 -7
  187. package/src/node/equality.js +7 -7
  188. package/src/node/frame.js +21 -21
  189. package/src/node/header.js +22 -22
  190. package/src/node/metaLemmaMetaTheorem.js +14 -14
  191. package/src/node/metavariable.js +14 -14
  192. package/src/node/property.js +7 -7
  193. package/src/node/propertyRelation.js +7 -7
  194. package/src/node/rule.js +15 -15
  195. package/src/node/statement.js +12 -12
  196. package/src/node/step.js +21 -21
  197. package/src/node/subDerivation.js +0 -7
  198. package/src/node/subproof.js +4 -11
  199. package/src/node/substitution/frame.js +18 -18
  200. package/src/node/substitution/statement.js +18 -18
  201. package/src/node/substitution/term.js +18 -18
  202. package/src/node/term.js +34 -34
  203. package/src/preamble.js +4 -4
  204. package/src/process/instantiate.js +12 -0
  205. package/src/process/unify.js +53 -57
  206. package/src/process/validate.js +316 -0
  207. package/src/process/verify.js +50 -138
  208. package/src/types.js +18 -0
  209. package/src/utilities/brackets.js +15 -14
  210. package/src/utilities/element.js +125 -82
  211. package/src/utilities/instance.js +42 -24
  212. package/src/utilities/statement.js +2 -2
  213. package/src/utilities/string.js +38 -24
  214. package/src/{mixins/step/unify.js → utilities/unification.js} +99 -85
  215. package/src/{mixins/statement/validate.js → utilities/validation.js} +143 -69
  216. package/lib/element/statement/combinator.js +0 -105
  217. package/lib/element/term/constructor.js +0 -172
  218. package/lib/mixins/statement/validate.js +0 -198
  219. package/lib/mixins/step/unify.js +0 -228
  220. package/lib/mixins/term/verify.js +0 -65
  221. package/src/element/statement/combinator.js +0 -59
  222. package/src/mixins/term/verify.js +0 -81
@@ -87,54 +87,52 @@ export default define(class Frame extends Element {
87
87
  return metavariableEqualToMetavariable;
88
88
  }
89
89
 
90
- matchFrameNode(frameNode) { return this.node.match(frameNode); }
90
+ compareSubstitution(substitution, context) {
91
+ let comparesToSubstitution = false;
91
92
 
92
- matchSubstitution(substitution, context) {
93
- let substitutionMatches = false;
94
-
95
- const frameString = this.string, ///
93
+ const frameString = this.getString(), ///
96
94
  substitutionString = substitution.getString();
97
95
 
98
- context.trace(`Matching the '${substitutionString}' substitution against the '${frameString}' frame...`);
96
+ context.trace(`Comparing the '${frameString}' frame to the '${substitutionString}' substitution...`);
99
97
 
100
- if (!substitutionMatches) {
101
- substitutionMatches = this.assumptions.some((assumption) => {
102
- const substitutionMatchesAssumption = assumption.matchSubstitution(substitution, context);
98
+ if (!comparesToSubstitution) {
99
+ comparesToSubstitution = this.assumptions.some((assumption) => {
100
+ const assumptionComparesToSubstitution = assumption.compareSubstitution(substitution, context);
103
101
 
104
- if (substitutionMatchesAssumption) {
102
+ if (assumptionComparesToSubstitution) {
105
103
  return true;
106
104
  }
107
105
  });
108
106
  }
109
107
 
110
- if (substitutionMatches) {
111
- context.debug(`...matched the '${substitutionString}' substitutions against the '${frameString}' frame.`);
108
+ if (comparesToSubstitution) {
109
+ context.debug(`...compared the the '${frameString}' frame to the '${substitutionString}' substitutions.`);
112
110
  }
113
111
 
114
- return substitutionMatches;
112
+ return comparesToSubstitution;
115
113
  }
116
114
 
117
- matchSubstitutions(substitutions, context) {
118
- let substitutionsMatch;
115
+ compareSubstitutions(substitutions, context) {
116
+ let comparesToSubstitutions;
119
117
 
120
118
  const frameString = this.string, ///
121
119
  substitutionsString = substitutions.asString();
122
120
 
123
- context.trace(`Matching the '${substitutionsString}' substitutions against the '${frameString}' frame...`);
121
+ context.trace(`Comparing the '${frameString}' frame to the '${substitutionsString}' substitutions...`);
124
122
 
125
- substitutionsMatch = substitutions.everySubstitution((substitution) => {
126
- const substitutionMatches = this.matchSubstitution(substitution, context);
123
+ comparesToSubstitutions = substitutions.everySubstitution((substitution) => {
124
+ const compaaresToSubstitution = this.compareSubstitution(substitution, context);
127
125
 
128
- if (substitutionMatches) {
126
+ if (compaaresToSubstitution) {
129
127
  return true;
130
128
  }
131
129
  });
132
130
 
133
- if (substitutionsMatch) {
134
- context.debug(`...matched the '${substitutionsString}' substitutions against the '${frameString}' frame.`);
131
+ if (comparesToSubstitutions) {
132
+ context.debug(`...compared the '${frameString}' frame to the '${substitutionsString}' substitutions.`);
135
133
  }
136
134
 
137
- return substitutionsMatch;
135
+ return comparesToSubstitutions;
138
136
  }
139
137
 
140
138
  verify(assignments, stated, context) {
@@ -241,27 +239,27 @@ export default define(class Frame extends Element {
241
239
  return assumptionsVerify;
242
240
  }
243
241
 
244
- verifyGivenMetaType(metaType, assignments, stated, context) {
245
- let verifiesGivenMetaType = false;
242
+ validateGivenMetaType(metaType, assignments, stated, context) {
243
+ let validatesGivenMetaType = false;
246
244
 
247
245
  const frameString = this.string, ///
248
246
  metaTypeString = metaType.getString();
249
247
 
250
- context.trace(`Verifying the '${frameString}' frame given the '${metaTypeString}' meta-type...`);
248
+ context.trace(`Validatin the '${frameString}' frame given the '${metaTypeString}' meta-type...`);
251
249
 
252
250
  const metaTypeName = metaType.getName();
253
251
 
254
252
  if (metaTypeName === FRAME_META_TYPE_NAME) {
255
- const verifies = this.verify(assignments, stated, context)
253
+ const validates = this.validate(assignments, stated, context)
256
254
 
257
- verifiesGivenMetaType = verifies; ///
255
+ validatesGivenMetaType = validates; ///
258
256
  }
259
257
 
260
- if (verifiesGivenMetaType) {
261
- context.debug(`...verified the '${frameString}' frame given the '${metaTypeString}' meta-type.`);
258
+ if (validatesGivenMetaType) {
259
+ context.debug(`...validated the '${frameString}' frame given the '${metaTypeString}' meta-type.`);
262
260
  }
263
261
 
264
- return verifiesGivenMetaType;
262
+ return validatesGivenMetaType;
265
263
  }
266
264
 
267
265
  toJSON() {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import elements from "../elements";
5
4
  import assignAssignments from "../process/assign";
6
5
 
7
6
  import { define } from "../elements";
@@ -30,17 +29,15 @@ export default define(class Hypothesis extends Element {
30
29
  } else if (this.statement !== null) {
31
30
  const stated = true,
32
31
  assignments = [],
33
- statementVerifies = this.statement.verify(assignments, stated, context);
32
+ statementValidates = this.statement.validate(assignments, stated, context);
34
33
 
35
- if (statementVerifies) {
34
+ if (statementValidates) {
36
35
  const assignmentsAssigned = assignAssignments(assignments, context);
37
36
 
38
37
  if (assignmentsAssigned) {
39
- const { Step } = elements,
40
- step = Step.fromStatement(this.statement, context),
41
- stepOrSubproof = step; ///
38
+ const subproofOrProofAssertion = this; ///
42
39
 
43
- context.addStepOrSubproof(stepOrSubproof);
40
+ context.addSubproofOrProofAssertion(subproofOrProofAssertion);
44
41
 
45
42
  verifies = true;
46
43
  }
@@ -56,26 +53,27 @@ export default define(class Hypothesis extends Element {
56
53
  return verifies;
57
54
  }
58
55
 
59
- isEqualToStep(step, context) {
60
- let equalToStep = false;
56
+ compareProofAssertion(proofAssertion, context) {
57
+ let comparesToProofAssertion = false;
61
58
 
62
- const stepString = step.getString(),
63
- hypothesisString = this.string; ///
59
+ const node = this.getNode(),
60
+ hypothesisString = this.getString(), ///
61
+ proofAssertionString = proofAssertion.getString();
64
62
 
65
- context.trace(`Is the '${hypothesisString}' hypothesis equal to the '${stepString}' step...`, this.node);
63
+ context.trace(`Is the '${hypothesisString}' hypothesis equal to the '${proofAssertionString}' proof assertion...`, node);
66
64
 
67
- const stepStatement = step.getStatement(),
68
- statementEqualToStepStatement = this.statement.isEqualTo(stepStatement);
65
+ const proofAssertionStatement = proofAssertion.getStatement(),
66
+ statementEqualToStepStatement = this.statement.isEqualTo(proofAssertionStatement);
69
67
 
70
68
  if (statementEqualToStepStatement) {
71
- equalToStep = true;
69
+ comparesToProofAssertion = true;
72
70
  }
73
71
 
74
- if (equalToStep) {
75
- context.trace(`...the '${hypothesisString}' hypothesis is equal to the '${stepString}' step.`, this.node);
72
+ if (comparesToProofAssertion) {
73
+ context.trace(`...the '${hypothesisString}' hypothesis is equal to the '${proofAssertionString}' proof assertion.`, node);
76
74
  }
77
75
 
78
- return equalToStep;
76
+ return comparesToProofAssertion;
79
77
  }
80
78
 
81
79
  toJSON() {
@@ -108,7 +108,7 @@ export default define(class Judgement extends Element {
108
108
  }
109
109
 
110
110
  verifyWhenDerived(context) {
111
- let verifiesWhenDerived;
111
+ let verifiesWhenDerived = false;
112
112
 
113
113
  const judgementString = this.string; ///
114
114
 
@@ -118,9 +118,12 @@ export default define(class Judgement extends Element {
118
118
  reference = referenceFromMetavariable(metavariable, context),
119
119
  metaLemmaMetatheorem = context.findMetaLemmaMetatheoremByReference(reference),
120
120
  substitutions = metaLemmaMetatheorem.getSubstitutions(),
121
- substitutionsMatch = this.frame.matchSubstitutions(substitutions, context);
121
+ frameComparesToSubstitutions = this.frame.compareSubstitutions(substitutions, context);
122
122
 
123
- verifiesWhenDerived = substitutionsMatch;
123
+ if (frameComparesToSubstitutions) {
124
+ verifiesWhenDerived = true;
125
+
126
+ }
124
127
 
125
128
  if (verifiesWhenDerived) {
126
129
  context.debug(`...verified the '${judgementString}' derived judgement.`);
@@ -20,16 +20,16 @@ export default define(class Label extends Element {
20
20
 
21
21
  getMetavariableNode() { return this.metavariable.getNode(); }
22
22
 
23
- matchMetavariableName(metavariableName) { return this.metavariable.matchMetavariableName(metavariableName); }
23
+ compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
24
24
 
25
25
  isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
26
26
 
27
- matchReference(reference) {
27
+ compareReference(reference) {
28
28
  const metavariable = reference.getMetavariable(),
29
29
  metavariableEqualToMetavariable = this.isMetavariableEqualToMetavariable(metavariable),
30
- referenceMatches = metavariableEqualToMetavariable; ///
30
+ comparesToReference = metavariableEqualToMetavariable; ///
31
31
 
32
- return referenceMatches;
32
+ return comparesToReference;
33
33
  }
34
34
 
35
35
  verify(nameOnly) {
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import elements from "../elements";
5
4
  import LocalContext from "../context/local";
6
5
 
7
- import { proofFromProofNode, deductionFromDeductionNode, suppositionsFromSuppositionNodes } from "./axiomLemmaTheoremConjecture";
8
6
  import { labelFromJSON,
9
7
  labelToLabelJSON,
10
8
  deductionFromJSON,
@@ -47,11 +45,12 @@ export default class MetaLemmaMetatheorem extends Element {
47
45
 
48
46
  getStatement() { return this.deduction.getStatement(); }
49
47
 
50
- matchReference(reference) {
48
+ compareReference(reference) {
51
49
  const label = this.getLabel(),
52
- referenceMatches = label.matchReference(reference);
50
+ labelComparesToRefference = label.compareReference(reference),
51
+ comparesToReference = labelComparesToRefference; ///
53
52
 
54
- return referenceMatches;
53
+ return comparesToReference;
55
54
  }
56
55
 
57
56
  verify() {
@@ -149,72 +148,9 @@ export default class MetaLemmaMetatheorem extends Element {
149
148
  substitutions = substitutionsFromJSON(json, context),
150
149
  node = null,
151
150
  proof = null,
152
- string = stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
151
+ string = metaLemmaMetatheoremStringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
153
152
  metaLemmaMetatheorem = new Class(context, string, node, label, suppositions, deduction, proof, substitutions);
154
153
 
155
154
  return metaLemmaMetatheorem;
156
155
  }
157
-
158
- static fromNode(Class, node, context) {
159
- const { Substitutions } = elements,
160
- topLevelAssertionNode = node, ///
161
- proofNode = topLevelAssertionNode.getProofNode(),
162
- labelNode = topLevelAssertionNode.getLabelNode(),
163
- deductionNode = topLevelAssertionNode.getDeductionNode(),
164
- suppositionNodes = topLevelAssertionNode.getSuppositionNodes(),
165
- proof = proofFromProofNode(proofNode, context),
166
- label = labelFromLabelNode(labelNode, context),
167
- deduction = deductionFromDeductionNode(deductionNode, context),
168
- suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context),
169
- substitutions = Substitutions.fromNothing(),
170
- string = stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
171
- metaLemmaMetatheorem = new Class(context, string, node, label, suppositions, deduction, proof, substitutions);
172
-
173
- return metaLemmaMetatheorem;
174
- }
175
- }
176
-
177
- function labelFromLabelNode(labelNode, context) {
178
- let label = null;
179
-
180
- const { Label } = elements;
181
-
182
- if (labelNode !== null) {
183
- label = Label.fromLabelNode(labelNode, context);
184
- }
185
-
186
- return label;
187
- }
188
-
189
- function labelStringFromLabel(label) {
190
- const labelsString = (label !== null) ?
191
- label.getString() :
192
- null;
193
-
194
- return labelsString;
195
- }
196
-
197
- function suppositionsStringFromSuppositions(suppositions) {
198
- const suppositionsString = suppositions.reduce((suppositionsString, supposition) => {
199
- const suppositionString = supposition.getString();
200
-
201
- suppositionsString = (suppositionsString !== null) ?
202
- `${suppositionsString}, ${suppositionString}` :
203
- suppositionString; ///
204
-
205
- return suppositionsString;
206
- }, null);
207
-
208
- return suppositionsString;
209
- }
210
-
211
- function stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction) {
212
- const suppositionsString = suppositionsStringFromSuppositions(suppositions),
213
- deductionString = deduction.getString(),
214
- labelString = labelStringFromLabel(label),
215
- string = (labelString === null) ?
216
- deductionString : ///
217
- `${labelString} :: [${suppositionsString}] ... ${deductionString}`;
218
-
219
- return string;
220
156
  }
@@ -3,9 +3,8 @@
3
3
  import Element from "../element";
4
4
 
5
5
  import { define } from "../elements";
6
- import { FRAME_META_TYPE_NAME, REFERENCE_META_TYPE_NAME, STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
7
6
 
8
- class MetaType extends Element {
7
+ export default define(class MetaType extends Element {
9
8
  constructor(context, string, node, name) {
10
9
  super(context, string, node);
11
10
 
@@ -22,10 +21,10 @@ class MetaType extends Element {
22
21
  return equalTo;
23
22
  }
24
23
 
25
- matchMetaTypeName(metaTypeName) {
26
- const metaTypeNameMatches = (metaTypeName === this.name);
24
+ compareMetaTypeName(metaTypeName) {
25
+ const comparesToMetaTypeName = (metaTypeName === this.name);
27
26
 
28
- return metaTypeNameMatches;
27
+ return comparesToMetaTypeName;
29
28
  }
30
29
 
31
30
  toJSON() {
@@ -46,48 +45,13 @@ class MetaType extends Element {
46
45
 
47
46
  return metaType;
48
47
  }
49
- }
50
48
 
51
- export default define(MetaType);
52
-
53
- class FrameMetaType extends MetaType {
54
- static fromNothing() {
55
- const context = null,
56
- string = null,
57
- node = null,
58
- name = FRAME_META_TYPE_NAME,
59
- frameMetaType = new FrameMetaType(context, string, node, name);
60
-
61
- return frameMetaType;
62
- }
63
- }
64
-
65
- class ReferenceMetaType extends MetaType {
66
- static fromNothing() {
49
+ static fromName(name) {
67
50
  const context = null,
68
- string = null,
51
+ string = name,
69
52
  node = null,
70
- name = REFERENCE_META_TYPE_NAME,
71
- referenceMetaType = new ReferenceMetaType(context, string, node, name);
72
-
73
- return referenceMetaType;
74
- }
75
- }
53
+ metaType = new MetaType(context, string, node, name);
76
54
 
77
- class StatementMetaType extends MetaType {
78
- static fromNothing() {
79
- const context = null,
80
- string = null,
81
- node = null,
82
- name = STATEMENT_META_TYPE_NAME,
83
- statementMetaType = new StatementMetaType(context, string, node, name);
84
-
85
- return statementMetaType;
55
+ return metaType;
86
56
  }
87
- }
88
-
89
- export const frameMetaType = FrameMetaType.fromNothing();
90
-
91
- export const referenceMetaType = ReferenceMetaType.fromNothing();
92
-
93
- export const statementMetaType = StatementMetaType.fromNothing();
57
+ });
@@ -39,48 +39,49 @@ export default define(class Metavariable extends Element {
39
39
  this.metaType = metaType;
40
40
  }
41
41
 
42
- matchParameter(parameter) {
43
- const name = parameter.getName(),
44
- nameMatches = (name === this.name),
45
- parameterMatches = nameMatches; ///
42
+ isNameEqualTo(name) {
43
+ const nameEqualTo = (name === this.name);
46
44
 
47
- return parameterMatches;
45
+ return nameEqualTo;
48
46
  }
49
47
 
50
- matchMetavariableName(metavariableName) {
51
- const metavariableNameMatches = (metavariableName === this.name);
48
+ compareMetavariableName(metavariableName) {
49
+ const nameMetavariableName = (this.name === metavariableName),
50
+ comparesToMetavariableName = nameMetavariableName; ///
52
51
 
53
- return metavariableNameMatches;
52
+ return comparesToMetavariableName;
54
53
  }
55
54
 
56
55
  isMetaTypeEqualTo(metaType) { return this.metaType.isEqualTo(metaType); }
57
56
 
58
- verify(context) {
59
- let verifies;
57
+ validate(context) {
58
+ let validates = false;
60
59
 
61
- const metavariableString = this.string; ///
60
+ const metavariableString = this.getString(); ///
62
61
 
63
- context.trace(`Verifying the '${metavariableString}' metavariable...`);
62
+ context.trace(`Validating the '${metavariableString}' metavariable...`);
64
63
 
65
64
  const metavariable = this, ///
66
65
  metavariablePresent = context.isMetavariablePresent(metavariable);
67
66
 
68
- verifies = metavariablePresent; ///
67
+ if (metavariablePresent) {
68
+ validates = true;
69
+ }
69
70
 
70
- if (verifies) {
71
- context.debug(`...verified the '${metavariableString}' metavariable.`);
71
+ if (validates) {
72
+ context.debug(`...va;idated the '${metavariableString}' metavariable.`);
72
73
  }
73
74
 
74
- return verifies;
75
+ return validates;
75
76
  }
76
77
 
77
- verifyGivenMetaType(metaType, context) {
78
- let verifiesGivenMetaType = false;
78
+ validateGivenMetaType(metaType, context) {
79
+ let validatesGivenMetaType = false;
79
80
 
80
- const metavariableString = this.string, ///
81
+ const metavariableString = this.getString(), ///
81
82
  metaTypeString = metaType.getString();
82
83
 
83
- context.trace(`Verifying the '${metavariableString}' metavariable given the '${metaTypeString}' meta-type...`);
84
+ context.trace(`Validating the '${metavariableString}' metavariable given the '${metaTypeString}' meta-type...`);
84
85
 
85
86
  let metavariable = this; ///
86
87
 
@@ -89,21 +90,23 @@ export default define(class Metavariable extends Element {
89
90
  if (metavariable !== null) {
90
91
  const metavariableMetaTypeEqualToMetaType = metavariable.isMetaTypeEqualTo(metaType);
91
92
 
92
- verifiesGivenMetaType = metavariableMetaTypeEqualToMetaType; ///
93
+ if (metavariableMetaTypeEqualToMetaType) {
94
+ validatesGivenMetaType = true;
95
+ }
93
96
  }
94
97
 
95
- if (verifiesGivenMetaType) {
96
- context.debug(`...verified the '${metavariableString}' metavariable given the '${metaTypeString}' meta-type.`);
98
+ if (validatesGivenMetaType) {
99
+ context.debug(`...validated the '${metavariableString}' metavariable given the '${metaTypeString}' meta-type.`);
97
100
  }
98
101
 
99
- return verifiesGivenMetaType;
102
+ return validatesGivenMetaType;
100
103
  }
101
104
 
102
105
  unifyFrame(frame, substitutions, generalContext, specificContext) {
103
106
  let frameUnifies = false;
104
107
 
105
108
  const frameString = frame.getString(),
106
- metavariableString = this.string; ///
109
+ metavariableString = this.getString(); ///
107
110
 
108
111
  specificContext.trace(`Unifying the '${frameString}' frame with the '${metavariableString}' metavariable...`);
109
112
 
@@ -147,7 +150,7 @@ export default define(class Metavariable extends Element {
147
150
  let statementUnifies = false;
148
151
 
149
152
  const statementString = statement.getString(),
150
- metavariableString = this.string, ///
153
+ metavariableString = this.getString(), ///
151
154
  substitutionString = (substitution !== null) ?
152
155
  substitution.getString() :
153
156
  EMPTY_STRING;
@@ -195,7 +198,7 @@ export default define(class Metavariable extends Element {
195
198
  let referenceUnifies = false;
196
199
 
197
200
  const referenceString = reference.getString(),
198
- metavariableString = this.string; ///
201
+ metavariableString = this.getString(); ///
199
202
 
200
203
  specificContext.trace(`Unifying the '${referenceString}' reference with the '${metavariableString}' metavariable...`);
201
204
 
@@ -265,7 +268,7 @@ export default define(class Metavariable extends Element {
265
268
 
266
269
  if (generalContextFilePath === specificContextFilePath) {
267
270
  const metavariable = this,
268
- metavariableString = this.string, ///
271
+ metavariableString = this.getString(), ///
269
272
  frameMetavariableEqualToMetvariable = frame.isMetavariableEqualToMetavariable(metavariable, context);
270
273
 
271
274
  if (frameMetavariableEqualToMetvariable) {
@@ -305,7 +308,7 @@ export default define(class Metavariable extends Element {
305
308
 
306
309
  if (generalContextFilePath === specificContextFilePath) {
307
310
  const metavariable = this, ///
308
- metavariableString = this.string, ///
311
+ metavariableString = this.getString(), ///
309
312
  statementMetavariableEqualToMetvariable = statement.isMetavariableEqualToMetavariable(metavariable, context);
310
313
 
311
314
  if (statementMetavariableEqualToMetvariable) {
@@ -345,7 +348,7 @@ export default define(class Metavariable extends Element {
345
348
 
346
349
  if (generalContextFilePath === specificContextFilePath) {
347
350
  const metavariable = this, ///
348
- metavariableString = this.string, ///
351
+ metavariableString = this.getString(), ///
349
352
  referenceMetavariableEqualToMetvariable = reference.isMetavariableEqualToMetavariable(metavariable);
350
353
 
351
354
  if (referenceMetavariableEqualToMetvariable) {
@@ -376,7 +379,7 @@ export default define(class Metavariable extends Element {
376
379
  typeJSON = typeToTypeJSON(this.type),
377
380
  type = typeJSON, ///
378
381
  metaType = metaTypeJSON, ///
379
- string = this.string, ///
382
+ string = this.getString(), ///
380
383
  json = {
381
384
  string,
382
385
  type,
@@ -20,9 +20,9 @@ export default define(class Parameter extends Element {
20
20
 
21
21
  const parameter = this, ///
22
22
  substitution = substitutions.findSubstitution((substitution) => {
23
- const nameMatches = substitution.matchParameter(parameter);
23
+ const substitutionComparesToParamter = substitution.compareParameter(parameter);
24
24
 
25
- if (nameMatches) {
25
+ if (substitutionComparesToParamter) {
26
26
  return true;
27
27
  }
28
28
  });