occam-verify-cli 1.0.448 → 1.0.472

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/constants.js +13 -5
  2. package/lib/context/ephemeral.js +270 -0
  3. package/lib/context/file.js +136 -128
  4. package/lib/context/liminal.js +120 -0
  5. package/lib/context/literal.js +92 -0
  6. package/lib/context/nominal.js +15 -1
  7. package/lib/context/release.js +68 -9
  8. package/lib/context/scoped.js +322 -0
  9. package/lib/context/synthetic.js +133 -0
  10. package/lib/element/assertion/contained.js +66 -66
  11. package/lib/element/assertion/defined.js +32 -32
  12. package/lib/element/assertion/property.js +39 -39
  13. package/lib/element/assertion/satisfies.js +22 -22
  14. package/lib/element/assumption.js +71 -87
  15. package/lib/element/combinator/bracketed.js +1 -10
  16. package/lib/element/conclusion.js +19 -15
  17. package/lib/element/constructor/bracketed.js +1 -10
  18. package/lib/element/constructor.js +2 -2
  19. package/lib/element/declaration/combinator.js +1 -2
  20. package/lib/element/declaration/metavariable.js +3 -3
  21. package/lib/element/declaration/variable.js +3 -3
  22. package/lib/element/deduction.js +26 -20
  23. package/lib/element/derivation.js +3 -3
  24. package/lib/element/equality.js +5 -5
  25. package/lib/element/equivalence.js +112 -107
  26. package/lib/element/equivalences.js +24 -10
  27. package/lib/element/error.js +3 -3
  28. package/lib/element/frame.js +73 -62
  29. package/lib/element/hypothesis.js +2 -2
  30. package/lib/element/judgement.js +40 -60
  31. package/lib/element/metaType.js +4 -4
  32. package/lib/element/metavariable.js +49 -38
  33. package/lib/element/parameter.js +13 -5
  34. package/lib/element/procedureCall.js +16 -16
  35. package/lib/element/proof.js +14 -13
  36. package/lib/element/proofAssertion/premise.js +319 -0
  37. package/lib/element/proofAssertion/step.js +309 -0
  38. package/lib/element/proofAssertion/supposition.js +333 -0
  39. package/lib/element/proofAssertion.js +20 -10
  40. package/lib/element/propertyRelation.js +2 -2
  41. package/lib/element/reference.js +72 -30
  42. package/lib/element/rule.js +26 -28
  43. package/lib/element/section.js +5 -5
  44. package/lib/element/signature.js +9 -6
  45. package/lib/element/statement.js +44 -36
  46. package/lib/element/subproof.js +18 -17
  47. package/lib/element/substitution/frame.js +86 -49
  48. package/lib/element/substitution/reference.js +101 -19
  49. package/lib/element/substitution/statement.js +128 -105
  50. package/lib/element/substitution/term.js +93 -57
  51. package/lib/element/substitution.js +20 -69
  52. package/lib/element/substitutions.js +49 -34
  53. package/lib/element/term.js +41 -30
  54. package/lib/element/topLevelAssertion/axiom.js +331 -0
  55. package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +10 -10
  56. package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +9 -9
  57. package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +8 -8
  58. package/lib/element/topLevelAssertion.js +434 -0
  59. package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +8 -8
  60. package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +8 -8
  61. package/lib/element/topLevelMetaAssertion.js +293 -0
  62. package/lib/element/type.js +4 -4
  63. package/lib/element/variable.js +48 -40
  64. package/lib/index.js +3 -3
  65. package/lib/main.js +3 -3
  66. package/lib/metaTypes.js +18 -15
  67. package/lib/node/frame.js +2 -2
  68. package/lib/node/metavariable.js +4 -4
  69. package/lib/node/parameter.js +28 -7
  70. package/lib/node/proofAssertion/premise.js +116 -0
  71. package/lib/node/proofAssertion/step.js +152 -0
  72. package/lib/node/proofAssertion/supposition.js +116 -0
  73. package/lib/node/{premise.js → proofAssertion.js} +11 -18
  74. package/lib/node/statement.js +2 -2
  75. package/lib/node/substitution/frame.js +9 -31
  76. package/lib/node/substitution/reference.js +137 -0
  77. package/lib/node/substitution/statement.js +9 -31
  78. package/lib/node/substitution/term.js +9 -23
  79. package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
  80. package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
  81. package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
  82. package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
  83. package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
  84. package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
  85. package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
  86. package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
  87. package/lib/nonTerminalNodeMap.js +15 -14
  88. package/lib/preamble.js +10 -10
  89. package/lib/process/instantiate.js +6 -21
  90. package/lib/process/unify.js +11 -10
  91. package/lib/tokenTypes.js +22 -0
  92. package/lib/types.js +3 -3
  93. package/lib/utilities/bnf.js +5 -5
  94. package/lib/utilities/context.js +63 -0
  95. package/lib/utilities/element.js +235 -408
  96. package/lib/utilities/instance.js +12 -34
  97. package/lib/utilities/json.js +3 -2
  98. package/lib/utilities/string.js +56 -21
  99. package/lib/utilities/unification.js +38 -32
  100. package/lib/utilities/validation.js +47 -50
  101. package/package.json +2 -2
  102. package/src/constants.js +12 -1
  103. package/src/context/ephemeral.js +257 -0
  104. package/src/context/file.js +108 -116
  105. package/src/context/liminal.js +67 -0
  106. package/src/context/literal.js +51 -0
  107. package/src/context/nominal.js +12 -0
  108. package/src/context/release.js +48 -8
  109. package/src/context/{local.js → scoped.js} +43 -125
  110. package/src/context/synthetic.js +60 -0
  111. package/src/element/assertion/contained.js +49 -47
  112. package/src/element/assertion/defined.js +29 -27
  113. package/src/element/assertion/property.js +35 -35
  114. package/src/element/assertion/satisfies.js +19 -18
  115. package/src/element/assumption.js +71 -93
  116. package/src/element/combinator/bracketed.js +0 -7
  117. package/src/element/conclusion.js +25 -24
  118. package/src/element/constructor/bracketed.js +0 -7
  119. package/src/element/constructor.js +1 -1
  120. package/src/element/declaration/combinator.js +0 -1
  121. package/src/element/declaration/metavariable.js +2 -2
  122. package/src/element/declaration/variable.js +5 -5
  123. package/src/element/deduction.js +33 -31
  124. package/src/element/derivation.js +2 -2
  125. package/src/element/equality.js +4 -4
  126. package/src/element/equivalence.js +115 -135
  127. package/src/element/equivalences.js +9 -7
  128. package/src/element/error.js +4 -2
  129. package/src/element/frame.js +80 -65
  130. package/src/element/hypothesis.js +1 -1
  131. package/src/element/judgement.js +42 -62
  132. package/src/element/metaType.js +3 -4
  133. package/src/element/metavariable.js +59 -56
  134. package/src/element/parameter.js +10 -5
  135. package/src/element/procedureCall.js +20 -18
  136. package/src/element/proof.js +14 -16
  137. package/src/element/{premise.js → proofAssertion/premise.js} +57 -53
  138. package/src/element/{step.js → proofAssertion/step.js} +59 -62
  139. package/src/element/{supposition.js → proofAssertion/supposition.js} +67 -56
  140. package/src/element/proofAssertion.js +24 -13
  141. package/src/element/propertyRelation.js +1 -1
  142. package/src/element/reference.js +87 -37
  143. package/src/element/rule.js +31 -37
  144. package/src/element/section.js +5 -5
  145. package/src/element/signature.js +8 -8
  146. package/src/element/statement.js +52 -48
  147. package/src/element/subproof.js +16 -18
  148. package/src/element/substitution/frame.js +104 -50
  149. package/src/element/substitution/reference.js +120 -20
  150. package/src/element/substitution/statement.js +169 -130
  151. package/src/element/substitution/term.js +104 -63
  152. package/src/element/substitution.js +16 -58
  153. package/src/element/substitutions.js +43 -41
  154. package/src/element/term.js +47 -41
  155. package/src/element/{axiom.js → topLevelAssertion/axiom.js} +22 -20
  156. package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +5 -6
  157. package/src/element/{lemma.js → topLevelAssertion/lemma.js} +5 -6
  158. package/src/element/{theorem.js → topLevelAssertion/theorem.js} +5 -5
  159. package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +37 -33
  160. package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +5 -6
  161. package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +5 -6
  162. package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +19 -17
  163. package/src/element/type.js +2 -4
  164. package/src/element/variable.js +47 -48
  165. package/src/index.js +2 -1
  166. package/src/main.js +2 -1
  167. package/src/metaTypes.js +25 -9
  168. package/src/node/frame.js +1 -1
  169. package/src/node/metavariable.js +3 -3
  170. package/src/node/parameter.js +32 -5
  171. package/src/node/proofAssertion/premise.js +16 -0
  172. package/src/node/{step.js → proofAssertion/step.js} +4 -18
  173. package/src/node/proofAssertion/supposition.js +16 -0
  174. package/src/node/proofAssertion.js +23 -0
  175. package/src/node/statement.js +1 -1
  176. package/src/node/substitution/frame.js +6 -32
  177. package/src/node/substitution/reference.js +38 -0
  178. package/src/node/substitution/statement.js +6 -32
  179. package/src/node/substitution/term.js +6 -22
  180. package/src/node/topLevelAssertion/axiom.js +13 -0
  181. package/src/node/topLevelAssertion/conjecture.js +13 -0
  182. package/src/node/topLevelAssertion/lemma.js +13 -0
  183. package/src/node/topLevelAssertion/theorem.js +13 -0
  184. package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
  185. package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
  186. package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
  187. package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
  188. package/src/nonTerminalNodeMap.js +15 -12
  189. package/src/preamble.js +9 -9
  190. package/src/process/instantiate.js +27 -36
  191. package/src/process/unify.js +10 -9
  192. package/src/tokenTypes.js +4 -0
  193. package/src/types.js +4 -2
  194. package/src/utilities/bnf.js +3 -2
  195. package/src/utilities/context.js +46 -0
  196. package/src/utilities/element.js +302 -509
  197. package/src/utilities/instance.js +19 -42
  198. package/src/utilities/json.js +3 -1
  199. package/src/utilities/string.js +69 -28
  200. package/src/utilities/unification.js +41 -38
  201. package/src/utilities/validation.js +66 -75
  202. package/lib/context/local.js +0 -605
  203. package/lib/context/temporary.js +0 -752
  204. package/lib/element/axiom.js +0 -329
  205. package/lib/element/axiomLemmaTheoremConjecture.js +0 -427
  206. package/lib/element/metaLemmaMetatheorem.js +0 -289
  207. package/lib/element/premise.js +0 -307
  208. package/lib/element/step.js +0 -311
  209. package/lib/element/supposition.js +0 -320
  210. package/lib/log.js +0 -150
  211. package/lib/node/step.js +0 -166
  212. package/lib/node/supposition.js +0 -130
  213. package/src/context/temporary.js +0 -476
  214. package/src/log.js +0 -118
  215. package/src/node/axiom.js +0 -13
  216. package/src/node/conjecture.js +0 -13
  217. package/src/node/lemma.js +0 -13
  218. package/src/node/metaLemma.js +0 -13
  219. package/src/node/metatheorem.js +0 -13
  220. package/src/node/premise.js +0 -30
  221. package/src/node/supposition.js +0 -30
  222. package/src/node/theorem.js +0 -13
@@ -22,114 +22,94 @@ export default define(class Judgement extends Element {
22
22
  return this.assumption;
23
23
  }
24
24
 
25
- isSingular() { return this.node.isSingular(); }
25
+ isSingular() {
26
+ const node = this.getNode(),
27
+ singular = node.isSingular();
28
+
29
+ return singular;
30
+ }
26
31
 
27
32
  getMetavariable() { return this.frame.getMetavariable(); }
28
33
 
29
- verify(assignments, stated, context) {
30
- let verifies = false;
34
+ validate(assignments, stated, context) {
35
+ let validates = false;
31
36
 
32
- const judgementString = this.string; ///
37
+ const judgementString = this.getString(); ///
33
38
 
34
- context.trace(`Verifying the '${judgementString}' judgement...`);
39
+ context.trace(`Validating the '${judgementString}' judgement...`);
35
40
 
36
- const frameVerifies = this.verifyFrame(assignments, stated, context);
41
+ const frameValidates = this.frame.validate(assignments, stated, context);
37
42
 
38
- if (frameVerifies) {
39
- const declarationVerifies = this.verifyDeclaration(assignments, stated, context);
43
+ if (frameValidates) {
44
+ const assumptionValidates = this.assumption.validate(assignments, stated, context);
40
45
 
41
- if (declarationVerifies) {
42
- let verifiesWhenStated = false,
43
- verifiesWhenDerived = false;
46
+ if (assumptionValidates) {
47
+ let validatesWhenStated = false,
48
+ validatesWhenDerived = false;
44
49
 
45
50
  if (stated) {
46
- verifiesWhenStated = this.verifyWhenStated(assignments, context);
51
+ validatesWhenStated = this.validateWhenStated(assignments, context);
47
52
  } else {
48
- verifiesWhenDerived = this.verifyWhenDerived(context);
53
+ validatesWhenDerived = this.validateWhenDerived(context);
49
54
  }
50
55
 
51
- if (verifiesWhenStated || verifiesWhenDerived) {
52
- verifies = true;
56
+ if (validatesWhenStated || validatesWhenDerived) {
57
+ validates = true;
53
58
  }
54
59
  }
55
60
  }
56
61
 
57
- if (verifies) {
62
+ if (validates) {
58
63
  if (stated) {
59
64
  this.assign(assignments, context);
60
65
  }
61
66
  }
62
67
 
63
- if (verifies) {
64
- context.debug(`...verified the '${judgementString}' judgement.`);
68
+ if (validates) {
69
+ context.debug(`...validated the '${judgementString}' judgement.`);
65
70
  }
66
71
 
67
- return verifies;
72
+ return validates;
68
73
  }
69
74
 
70
- verifyFrame(assignments, stated, context) {
71
- let frameVerifies;
75
+ validateWhenStated(assignments, context) {
76
+ let validatesWhenStated;
72
77
 
73
- const frameString = this.frame.getString();
78
+ const judgementString = this.getString(); ///
74
79
 
75
- context.trace(`Verifying the '${frameString}' frame...`);
80
+ context.trace(`Validating the '${judgementString}' stated judgement...`);
76
81
 
77
- frameVerifies = this.frame.verify(assignments, stated, context);
82
+ validatesWhenStated = true;
78
83
 
79
- if (frameVerifies) {
80
- context.debug(`...verified the '${frameString}' frame.`);
84
+ if (validatesWhenStated) {
85
+ context.debug(`...validated the '${judgementString}' stated judgement.`);
81
86
  }
82
87
 
83
- return frameVerifies;
84
- }
85
-
86
- verifyDeclaration(assignments, stated, context) {
87
- let declarationVerifies;
88
-
89
- declarationVerifies = this.assumption.verify(assignments, stated, context);
90
-
91
- return declarationVerifies;
88
+ return validatesWhenStated;
92
89
  }
93
90
 
94
- verifyWhenStated(assignments, context) {
95
- let verifiesWhenStated;
91
+ validateWhenDerived(context) {
92
+ let validatesWhenDerived = false;
96
93
 
97
- const judgementString = this.string; ///
94
+ const judgementString = this.getString(); ///
98
95
 
99
- context.trace(`Verifying the '${judgementString}' stated judgement...`);
100
-
101
- verifiesWhenStated = true;
102
-
103
- if (verifiesWhenStated) {
104
- context.debug(`...verified the '${judgementString}' stated judgement.`);
105
- }
106
-
107
- return verifiesWhenStated;
108
- }
109
-
110
- verifyWhenDerived(context) {
111
- let verifiesWhenDerived = false;
112
-
113
- const judgementString = this.string; ///
114
-
115
- context.trace(`Verifying the '${judgementString}' derived judgement...`);
96
+ context.trace(`Validating the '${judgementString}' derived judgement...`);
116
97
 
117
98
  const metavariable = this.assumption.getMetavariable(),
118
99
  reference = referenceFromMetavariable(metavariable, context),
119
- metaLemmaMetatheorem = context.findMetaLemmaMetatheoremByReference(reference),
120
- substitutions = metaLemmaMetatheorem.getSubstitutions(),
100
+ topLevelMetaAssertion = context.findTopLevelMetaAssertionByReference(reference),
101
+ substitutions = topLevelMetaAssertion.getSubstitutions(),
121
102
  frameComparesToSubstitutions = this.frame.compareSubstitutions(substitutions, context);
122
103
 
123
104
  if (frameComparesToSubstitutions) {
124
- verifiesWhenDerived = true;
125
-
105
+ validatesWhenDerived = true;
126
106
  }
127
107
 
128
- if (verifiesWhenDerived) {
129
- context.debug(`...verified the '${judgementString}' derived judgement.`);
108
+ if (validatesWhenDerived) {
109
+ context.debug(`...validated the '${judgementString}' derived judgement.`);
130
110
  }
131
111
 
132
- return verifiesWhenDerived;
112
+ return validatesWhenDerived;
133
113
  }
134
114
 
135
115
  assign(assignments, context) {
@@ -41,14 +41,13 @@ export default define(class MetaType extends Element {
41
41
  static fromJSON(json, context) {
42
42
  const { name } = json,
43
43
  metaTypeName = name, ///
44
- metaType = metaTypeFromMetaTypeName(metaTypeName);
44
+ metaType = findMetaTypeByMetaTypeName(metaTypeName);
45
45
 
46
46
  return metaType;
47
47
  }
48
48
 
49
- static fromName(name) {
50
- const context = null,
51
- string = name,
49
+ static fromName(name, context) {
50
+ const string = name,
52
51
  node = null,
53
52
  metaType = new MetaType(context, string, node, name);
54
53
 
@@ -5,9 +5,9 @@ import elements from "../elements";
5
5
 
6
6
  import { define } from "../elements";
7
7
  import { EMPTY_STRING } from "../constants";
8
- import { instantiateMetavariable } from "../process/instantiate";
9
- import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
10
- import { metaTypeFromJSON, metaTypeToMetaTypeJSON } from "../utilities/json";
8
+ import { synthetically } from "../utilities/context";
9
+ import { typeToTypeJSON } from "../utilities/json";
10
+ import { metaTypeToMetaTypeJSON } from "../utilities/json";
11
11
  import { unifyMetavariable, unifyMetavariableIntrinsically } from "../process/unify";
12
12
 
13
13
  export default define(class Metavariable extends Element {
@@ -45,6 +45,8 @@ export default define(class Metavariable extends Element {
45
45
  return nameEqualTo;
46
46
  }
47
47
 
48
+ isMetaTypeEqualTo(metaType) { return this.metaType.isEqualTo(metaType); }
49
+
48
50
  compareMetavariableName(metavariableName) {
49
51
  const nameMetavariableName = (this.name === metavariableName),
50
52
  comparesToMetavariableName = nameMetavariableName; ///
@@ -52,8 +54,6 @@ export default define(class Metavariable extends Element {
52
54
  return comparesToMetavariableName;
53
55
  }
54
56
 
55
- isMetaTypeEqualTo(metaType) { return this.metaType.isEqualTo(metaType); }
56
-
57
57
  validate(context) {
58
58
  let validates = false;
59
59
 
@@ -78,8 +78,8 @@ export default define(class Metavariable extends Element {
78
78
  validateGivenMetaType(metaType, context) {
79
79
  let validatesGivenMetaType = false;
80
80
 
81
- const metavariableString = this.getString(), ///
82
- metaTypeString = metaType.getString();
81
+ const metaTypeString = metaType.getString(),
82
+ metavariableString = this.getString(); ///
83
83
 
84
84
  context.trace(`Validating the '${metavariableString}' metavariable given the '${metaTypeString}' meta-type...`);
85
85
 
@@ -105,10 +105,11 @@ export default define(class Metavariable extends Element {
105
105
  unifyFrame(frame, substitutions, generalContext, specificContext) {
106
106
  let frameUnifies = false;
107
107
 
108
- const frameString = frame.getString(),
108
+ const context = specificContext, ///
109
+ frameString = frame.getString(),
109
110
  metavariableString = this.getString(); ///
110
111
 
111
- specificContext.trace(`Unifying the '${frameString}' frame with the '${metavariableString}' metavariable...`);
112
+ context.trace(`Unifying the '${frameString}' frame with the '${metavariableString}' metavariable...`);
112
113
 
113
114
  const frameMetavariableUnifies = this.unifyFrameMetavariable(frame, substitutions, generalContext, specificContext);
114
115
 
@@ -127,20 +128,20 @@ export default define(class Metavariable extends Element {
127
128
  frameUnifies = true;
128
129
  }
129
130
  } else {
130
- const { FrameSubstitution } = elements,
131
- context = specificContext, ///
132
- metavariable = this, ///
133
- frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context),
134
- substitution = frameSubstitution; ///
131
+ const metavariable = this; ///
135
132
 
136
- substitutions.addSubstitution(substitution, context);
133
+ synthetically((context) => {
134
+ const { FrameSubstitution } = elements;
135
+
136
+ FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context);
137
+ }, generalContext, specificContext);
137
138
 
138
139
  frameUnifies = true;
139
140
  }
140
141
  }
141
142
 
142
143
  if (frameUnifies) {
143
- specificContext.debug(`...unified the '${frameString}' frame with the '${metavariableString}' metavariable.`);
144
+ context.debug(`...unified the '${frameString}' frame with the '${metavariableString}' metavariable.`);
144
145
  }
145
146
 
146
147
  return frameUnifies;
@@ -149,13 +150,14 @@ export default define(class Metavariable extends Element {
149
150
  unifyStatement(statement, substitution, substitutions, generalContext, specificContext) {
150
151
  let statementUnifies = false;
151
152
 
152
- const statementString = statement.getString(),
153
+ const context = specificContext, ///
154
+ statementString = statement.getString(),
153
155
  metavariableString = this.getString(), ///
154
156
  substitutionString = (substitution !== null) ?
155
157
  substitution.getString() :
156
158
  EMPTY_STRING;
157
159
 
158
- specificContext.trace(`Unifying the '${statementString}' statement with the '${metavariableString}${substitutionString}' metavariable...`);
160
+ context.trace(`Unifying the '${statementString}' statement with the '${metavariableString}${substitutionString}' metavariable...`);
159
161
 
160
162
  const statementMetavariableUnifies = this.unifyStatementMetavariable(statement, substitutions, generalContext, specificContext);
161
163
 
@@ -169,26 +171,29 @@ export default define(class Metavariable extends Element {
169
171
  if (substitutionPresent) {
170
172
  substitution = substitutions.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution); ///
171
173
 
172
- const substitutionStatementEqualToStatement = substitution.isStatementEqualToStatement(statement, context);
174
+ const substitutionComparesToStatement = substitution.compareStatement(statement, context);
173
175
 
174
- if (substitutionStatementEqualToStatement) {
176
+ if (substitutionComparesToStatement) {
175
177
  statementUnifies = true;
176
178
  }
177
179
  } else {
178
- const { StatementSubstitution } = elements,
179
- metavariable = this,
180
- statementSubstitution = StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context);
180
+ const metavariable = this; ///
181
181
 
182
- substitution = statementSubstitution; ///
182
+ synthetically((context) => {
183
+ const { StatementSubstitution } = elements;
183
184
 
184
- substitutions.addSubstitution(substitution, context);
185
+ (substitution !== null) ?
186
+ StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) :
187
+ StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
188
+
189
+ }, generalContext, specificContext);
185
190
 
186
191
  statementUnifies = true;
187
192
  }
188
193
  }
189
194
 
190
195
  if (statementUnifies) {
191
- specificContext.debug(`...unified the '${statementString}' statement with the '${metavariableString}${substitutionString}' metavariable.`);
196
+ context.debug(`...unified the '${statementString}' statement with the '${metavariableString}${substitutionString}' metavariable.`);
192
197
  }
193
198
 
194
199
  return statementUnifies;
@@ -197,42 +202,43 @@ export default define(class Metavariable extends Element {
197
202
  unifyReference(reference, substitutions, generalContext, specificContext) {
198
203
  let referenceUnifies = false;
199
204
 
200
- const referenceString = reference.getString(),
205
+ const context = specificContext, ///
206
+ referenceString = reference.getString(),
201
207
  metavariableString = this.getString(); ///
202
208
 
203
- specificContext.trace(`Unifying the '${referenceString}' reference with the '${metavariableString}' metavariable...`);
209
+ context.trace(`Unifying the '${referenceString}' reference with the '${metavariableString}' metavariable...`);
204
210
 
205
211
  const referenceMetavariableUnifies = this.unifyReferenceMetavariable(reference, substitutions, generalContext, specificContext);
206
212
 
207
213
  if (referenceMetavariableUnifies) {
208
214
  referenceUnifies = true;
209
215
  } else {
210
- const context = specificContext, ///
211
- metavariable = this, ///
216
+ const metavariable = this, ///
212
217
  simpleSubstitutionPresent = substitutions.isSimpleSubstitutionPresentByMetavariable(metavariable);
213
218
 
214
219
  if (simpleSubstitutionPresent) {
215
220
  const simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariable(metavariable), ///
216
221
  substitution = simpleSubstitution, ///
217
- substitutionReferenceEqualToReference = substitution.isReferenceEqualToReference(reference, context);
222
+ substitutionReferenceEqualToReference = substitution.isReferenceEqualToReference(reference);
218
223
 
219
224
  if (substitutionReferenceEqualToReference) {
220
225
  referenceUnifies = true;
221
226
  }
222
227
  } else {
223
- const { ReferenceSubstitution } = elements,
224
- metavariable = this,
225
- referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context),
226
- substitution = referenceSubstitution; ///
228
+ const metavariable = this; ///
227
229
 
228
- substitutions.addSubstitution(substitution, context);
230
+ synthetically((context) => {
231
+ const { ReferenceSubstitution } = elements;
232
+
233
+ ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context);
234
+ }, generalContext, specificContext);
229
235
 
230
236
  referenceUnifies = true;
231
237
  }
232
238
  }
233
239
 
234
240
  if (referenceUnifies) {
235
- specificContext.debug(`...unified the '${referenceString}' reference with the '${metavariableString}' metavariable.`);
241
+ context.debug(`...unified the '${referenceString}' reference with the '${metavariableString}' metavariable.`);
236
242
  }
237
243
 
238
244
  return referenceUnifies;
@@ -241,19 +247,25 @@ export default define(class Metavariable extends Element {
241
247
  unifyMetavariable(metavariable, context) {
242
248
  let metavariableUnifies;
243
249
 
244
- const generalContext = context, ///
245
- specificContext = context, ///
246
- generalMetavariable = this, ///
250
+ const specificContext = context; ///
251
+
252
+ context = this.getContext();
253
+
254
+ const generalContext = context; ///
255
+
256
+ context = specificContext; ///
257
+
258
+ const generalMetavariable = this, ///
247
259
  specificMetavariable = metavariable, ///
248
260
  generalMetavariableString = generalMetavariable.getString(),
249
261
  specificMetavariableString = specificMetavariable.getString();
250
262
 
251
- specificContext.trace(`Unifying the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable...`);
263
+ context.trace(`Unifying the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable...`);
252
264
 
253
265
  metavariableUnifies = unifyMetavariable(generalMetavariable, specificMetavariable, generalContext, specificContext);
254
266
 
255
267
  if (metavariableUnifies) {
256
- specificContext.debug(`...unified the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable.`);
268
+ context.debug(`...unified the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable.`);
257
269
  }
258
270
 
259
271
  return metavariableUnifies;
@@ -267,8 +279,8 @@ export default define(class Metavariable extends Element {
267
279
  specificContextFilePath = specificContext.getFilePath();
268
280
 
269
281
  if (generalContextFilePath === specificContextFilePath) {
270
- const metavariable = this,
271
- metavariableString = this.getString(), ///
282
+ const metavariable = this, ///
283
+ metavariableString = metavariable.getString(),
272
284
  frameMetavariableEqualToMetvariable = frame.isMetavariableEqualToMetavariable(metavariable, context);
273
285
 
274
286
  if (frameMetavariableEqualToMetvariable) {
@@ -308,7 +320,7 @@ export default define(class Metavariable extends Element {
308
320
 
309
321
  if (generalContextFilePath === specificContextFilePath) {
310
322
  const metavariable = this, ///
311
- metavariableString = this.getString(), ///
323
+ metavariableString = metavariable.getString(),
312
324
  statementMetavariableEqualToMetvariable = statement.isMetavariableEqualToMetavariable(metavariable, context);
313
325
 
314
326
  if (statementMetavariableEqualToMetvariable) {
@@ -348,7 +360,7 @@ export default define(class Metavariable extends Element {
348
360
 
349
361
  if (generalContextFilePath === specificContextFilePath) {
350
362
  const metavariable = this, ///
351
- metavariableString = this.getString(), ///
363
+ metavariableString = metavariable.getString(),
352
364
  referenceMetavariableEqualToMetvariable = reference.isMetavariableEqualToMetavariable(metavariable);
353
365
 
354
366
  if (referenceMetavariableEqualToMetvariable) {
@@ -392,15 +404,6 @@ export default define(class Metavariable extends Element {
392
404
  static name = "Metavariable";
393
405
 
394
406
  static fromJSON(json, context) {
395
- const { string } = json,
396
- metavariableNode = instantiateMetavariable(string, context),
397
- metavariableName = metavariableNode.getMetavariableName(),
398
- name = metavariableName, ///
399
- node = metavariableNode, ///
400
- type = typeFromJSON(json, context),
401
- metaType = metaTypeFromJSON(json, context),
402
- metavariable = new Metavariable(context, string, node, name, type, metaType);
403
-
404
- return metavariable;
407
+ ///
405
408
  }
406
409
  });
@@ -5,16 +5,21 @@ import Element from "../element";
5
5
  import { define } from "../elements";
6
6
 
7
7
  export default define(class Parameter extends Element {
8
- constructor(context, string, node, name) {
9
- super(context, string, node);
8
+ constructor(context, string, node, name, identifier) {
9
+ super(context, string, node, identifier);
10
10
 
11
11
  this.name = name;
12
+ this.identifier = identifier;
12
13
  }
13
14
 
14
15
  getName() {
15
16
  return this.name;
16
17
  }
17
18
 
19
+ getIdentifier() {
20
+ return this.identifier;
21
+ }
22
+
18
23
  findReplacementNode(substitutions) {
19
24
  let replacementNode = null;
20
25
 
@@ -25,7 +30,7 @@ export default define(class Parameter extends Element {
25
30
  if (substitutionComparesToParamter) {
26
31
  return true;
27
32
  }
28
- });
33
+ }) || null;
29
34
 
30
35
  if (substitution !== null) {
31
36
  replacementNode = substitution.getReplacementNode();
@@ -46,10 +51,10 @@ export default define(class Parameter extends Element {
46
51
  static name = "Parameter";
47
52
 
48
53
  static fromJSON(json, context) {
49
- const { name } = json,
54
+ const { name, identifier } = json,
50
55
  string = null,
51
56
  node = null,
52
- parameter = new Parameter(context, string, node, name);
57
+ parameter = new Parameter(context, string, node, name, identifier);
53
58
 
54
59
  return parameter;
55
60
  }
@@ -10,6 +10,7 @@ import { parametersFromJSON, procedureReferenceFromJSON, parametersToParametersJ
10
10
  export default define(class ProcedureCall extends Element {
11
11
  constructor(context, string, node, parameters, procedureReference) {
12
12
  super(context, string, node);
13
+
13
14
  this.parameters = parameters;
14
15
  this.procedureReference = procedureReference;
15
16
  }
@@ -24,23 +25,24 @@ export default define(class ProcedureCall extends Element {
24
25
 
25
26
  getName() { return this.procedureReference.getName(); }
26
27
 
27
- findNodes(substitutions) {
28
- const nodes = this.parameters.map((parameter) => {
29
- const replacementNode = parameter.findReplacementNode(substitutions),
30
- node = replacementNode; ///
28
+ findNodes(context) {
29
+ const substitutions = context.getSubstitutions(),
30
+ nodes = this.parameters.map((parameter) => {
31
+ const replacementNode = parameter.findReplacementNode(substitutions),
32
+ node = replacementNode; ///
31
33
 
32
- return node;
33
- });
34
+ return node;
35
+ });
34
36
 
35
37
  return nodes;
36
38
  }
37
39
 
38
- verify(assignments, stated, context) {
39
- let verifies = false;
40
+ validate(context) {
41
+ let validates = false;
40
42
 
41
- const procedureCallString = this.string; ///
43
+ const procedureCallString = this.getString(); ///
42
44
 
43
- context.trace(`Verifying the '${procedureCallString}' procedure call...`, this.node);
45
+ context.trace(`Validating the '${procedureCallString}' procedure call...`);
44
46
 
45
47
  const name = this.getName(),
46
48
  procedure = context.findProcedureByName(name);
@@ -49,30 +51,30 @@ export default define(class ProcedureCall extends Element {
49
51
  const procedureBoolean = procedure.isBoolean();
50
52
 
51
53
  if (procedureBoolean) {
52
- verifies = true;
54
+ validates = true;
53
55
  } else {
54
- context.trace(`The '${procedureCallString}' procedure is not boolean.`, this.node);
56
+ context.trace(`The '${procedureCallString}' procedure is not boolean.`);
55
57
  }
56
58
  } else {
57
- context.trace(`The '${procedureCallString}' procedure is not present.`, this.node);
59
+ context.trace(`The '${procedureCallString}' procedure is not present.`);
58
60
  }
59
61
 
60
- if (verifies) {
61
- context.debug(`...verified the '${procedureCallString}' procedure call.`, this.node);
62
+ if (validates) {
63
+ context.debug(`...validated the '${procedureCallString}' procedure call.`);
62
64
  }
63
65
 
64
- return verifies;
66
+ return validates;
65
67
  }
66
68
 
67
69
  unifyIndependently(substitutions, context) {
68
70
  let unifiesIndependently = false;
69
71
 
70
- const procedureCallString = this.string; ///
72
+ const procedureCallString = this.getString(); ///
71
73
 
72
74
  context.trace(`Unifying the '${procedureCallString}' procedure call independently...`);
73
75
 
74
76
  const name = this.getName(),
75
- nodes = this.findNodes(substitutions),
77
+ nodes = this.findNodes(context),
76
78
  procedure = context.findProcedureByName(name),
77
79
  expressions = Expressions.fromNodes(nodes, context);
78
80
 
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import LocalContext from "../context/local";
5
4
 
5
+ import { scope } from "../utilities/context";
6
6
  import { define } from "../elements";
7
7
 
8
8
  export default define(class Proof extends Element {
@@ -26,28 +26,26 @@ export default define(class Proof extends Element {
26
26
  return statement;
27
27
  }
28
28
 
29
- verify(substitutions, conclusion, context) {
29
+ verify(conclusion, context) {
30
30
  let verifies = false;
31
31
 
32
- const localContext = LocalContext.fromNothing(context); ///
32
+ scope((context) => {
33
+ const derivationVerifies = this.derivation.verify(context);
33
34
 
34
- context = localContext; ///
35
+ if (derivationVerifies) {
36
+ const lastProofAssertion = context.getLastProofAssertion();
35
37
 
36
- const derivationVerifies = this.derivation.verify(substitutions, context);
38
+ if (lastProofAssertion !== null) {
39
+ const statement = this.getStatement(),
40
+ conclusionStatement = conclusion.getStatement(),
41
+ conclusionStatementEqualToStatement = conclusionStatement.isEqualTo(statement);
37
42
 
38
- if (derivationVerifies) {
39
- const lastProofAssertion = context.getLastProofAssertion();
40
-
41
- if (lastProofAssertion !== null) {
42
- const statement = this.getStatement(),
43
- conclusionStatement = conclusion.getStatement(),
44
- conclusionStatementEqualToStatement = conclusionStatement.isEqualTo(statement);
45
-
46
- if (conclusionStatementEqualToStatement) {
47
- verifies = true;
43
+ if (conclusionStatementEqualToStatement) {
44
+ verifies = true;
45
+ }
48
46
  }
49
47
  }
50
- }
48
+ }, context);
51
49
 
52
50
  return verifies;
53
51
  }