occam-verify-cli 1.0.906 → 1.0.911

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 (80) hide show
  1. package/lib/context.js +5 -1
  2. package/lib/element/assertion/contained.js +6 -3
  3. package/lib/element/assertion/defined.js +6 -3
  4. package/lib/element/assertion/property.js +6 -3
  5. package/lib/element/assertion/signature.js +165 -0
  6. package/lib/element/assertion/subproof.js +5 -3
  7. package/lib/element/assertion/type.js +6 -3
  8. package/lib/element/assumption/metaLevel.js +5 -3
  9. package/lib/element/assumption.js +6 -3
  10. package/lib/element/equality.js +6 -3
  11. package/lib/element/frame.js +8 -5
  12. package/lib/element/judgement.js +6 -3
  13. package/lib/element/metavariable.js +8 -5
  14. package/lib/element/proofAssertion/step.js +29 -29
  15. package/lib/element/property.js +12 -5
  16. package/lib/element/propertyRelation.js +6 -3
  17. package/lib/element/reference.js +8 -4
  18. package/lib/element/signature.js +73 -60
  19. package/lib/element/statement.js +7 -3
  20. package/lib/element/subproof.js +11 -11
  21. package/lib/element/substitution/frame.js +7 -4
  22. package/lib/element/substitution/reference.js +7 -4
  23. package/lib/element/substitution/statement.js +7 -4
  24. package/lib/element/substitution/term.js +6 -4
  25. package/lib/element/term.js +26 -7
  26. package/lib/element/topLevelAssertion/axiom.js +14 -16
  27. package/lib/element/variable.js +2 -2
  28. package/lib/node/assertion/{satisfies.js → signature.js} +4 -4
  29. package/lib/node/qualification.js +2 -2
  30. package/lib/node/statement.js +2 -2
  31. package/lib/nonTerminalNodeMap.js +3 -3
  32. package/lib/preamble.js +2 -2
  33. package/lib/process/instantiate.js +6 -6
  34. package/lib/process/unify.js +56 -24
  35. package/lib/ruleNames.js +5 -5
  36. package/lib/utilities/element.js +43 -54
  37. package/lib/utilities/json.js +3 -3
  38. package/lib/utilities/unification.js +30 -30
  39. package/lib/utilities/validation.js +15 -15
  40. package/package.json +4 -4
  41. package/src/context.js +7 -0
  42. package/src/element/assertion/contained.js +8 -4
  43. package/src/element/assertion/defined.js +8 -4
  44. package/src/element/assertion/property.js +8 -4
  45. package/src/element/assertion/{satisfies.js → signature.js} +68 -43
  46. package/src/element/assertion/subproof.js +6 -4
  47. package/src/element/assertion/type.js +8 -4
  48. package/src/element/assumption/metaLevel.js +6 -4
  49. package/src/element/assumption.js +8 -4
  50. package/src/element/equality.js +8 -4
  51. package/src/element/frame.js +10 -7
  52. package/src/element/judgement.js +8 -4
  53. package/src/element/metavariable.js +10 -7
  54. package/src/element/proofAssertion/step.js +28 -28
  55. package/src/element/property.js +14 -6
  56. package/src/element/propertyRelation.js +8 -4
  57. package/src/element/reference.js +11 -5
  58. package/src/element/signature.js +118 -37
  59. package/src/element/statement.js +9 -3
  60. package/src/element/subproof.js +10 -10
  61. package/src/element/substitution/frame.js +9 -5
  62. package/src/element/substitution/reference.js +9 -5
  63. package/src/element/substitution/statement.js +9 -5
  64. package/src/element/substitution/term.js +7 -5
  65. package/src/element/term.js +39 -9
  66. package/src/element/topLevelAssertion/axiom.js +23 -26
  67. package/src/element/variable.js +2 -2
  68. package/src/node/assertion/{satisfies.js → signature.js} +2 -2
  69. package/src/node/qualification.js +2 -2
  70. package/src/node/statement.js +2 -2
  71. package/src/nonTerminalNodeMap.js +3 -3
  72. package/src/preamble.js +1 -1
  73. package/src/process/instantiate.js +3 -3
  74. package/src/process/unify.js +84 -35
  75. package/src/ruleNames.js +1 -1
  76. package/src/utilities/element.js +30 -47
  77. package/src/utilities/json.js +2 -2
  78. package/src/utilities/unification.js +29 -29
  79. package/src/utilities/validation.js +14 -14
  80. package/lib/element/assertion/satisfies.js +0 -148
@@ -63,15 +63,17 @@ export default define(class PropertyRelation extends Element {
63
63
 
64
64
  context.trace(`Validating the '${propertyRelationString}' property relation...`);
65
65
 
66
+ let validates = false;
67
+
66
68
  const validPropertyRelation = this.findValidPropertyRelation(context);
67
69
 
68
70
  if (validPropertyRelation) {
71
+ validates = true;
72
+
69
73
  propertyRelation = validPropertyRelation; ///
70
74
 
71
75
  context.debug(`...the '${propertyRelationString}' property relation is already valid.`);
72
76
  } else {
73
- let validates = false;
74
-
75
77
  const termValidates = this.validateTerm(context);
76
78
 
77
79
  if (termValidates) {
@@ -84,11 +86,13 @@ export default define(class PropertyRelation extends Element {
84
86
  propertyRelation = this; ///
85
87
 
86
88
  context.addPropertyRelation(propertyRelation);
87
-
88
- context.debug(`...validated the '${propertyRelationString}' property relation.`);
89
89
  }
90
90
  }
91
91
 
92
+ if (validates) {
93
+ context.debug(`...validated the '${propertyRelationString}' property relation.`);
94
+ }
95
+
92
96
  return propertyRelation;
93
97
  }
94
98
 
@@ -123,7 +123,9 @@ export default define(class Reference extends Element {
123
123
 
124
124
  context.debug(`...the '${referenceString}' reference is already valid.`);
125
125
  } else {
126
- const context = this.getContext();
126
+ const specificContext = context; ///
127
+
128
+ context = this.getContext();
127
129
 
128
130
  attempt((context) => {
129
131
  const metavariableValidates = this.validateMetavariable(context);
@@ -161,13 +163,17 @@ export default define(class Reference extends Element {
161
163
  this.commit(context);
162
164
  }
163
165
  }, context);
164
- }
165
166
 
166
- if (validates) {
167
- reference = this; ///
167
+ context = specificContext; ///
168
168
 
169
- context.addReference(reference);
169
+ if (validates) {
170
+ reference = this; ///
170
171
 
172
+ context.addReference(reference);
173
+ }
174
+ }
175
+
176
+ if (validates) {
171
177
  context.debug(`...validated the '${referenceString}' reference.`);
172
178
  }
173
179
 
@@ -3,12 +3,10 @@
3
3
  import { Element } from "occam-languages";
4
4
  import { arrayUtilities } from "necessary";
5
5
 
6
- import elements from "../elements";
7
-
8
6
  import { define } from "../elements";
9
7
  import { instantiateSignature } from "../process/instantiate";
10
8
  import { termsFromSignatureNode } from "../utilities/element";
11
- import { attempt, serialise, unserialise, instantiate } from "../utilities/context";
9
+ import { attempt, reconcile, serialise, unserialise, instantiate } from "../utilities/context";
12
10
 
13
11
  const { match, compare, correlate } = arrayUtilities;
14
12
 
@@ -30,6 +28,27 @@ export default define(class Signature extends Element {
30
28
  return signatureNode;
31
29
  }
32
30
 
31
+ getLength() {
32
+ const termsLength = this.terms.length,
33
+ length = termsLength; ///
34
+
35
+ return length;
36
+ }
37
+
38
+ getTerm(index) {
39
+ const term = this.terms[index];
40
+
41
+ return term;
42
+ }
43
+
44
+ findValidSignature(context) {
45
+ const signatureNode = this.getSignatureNode(),
46
+ signature = context.findSignatureBySignatureNode(signatureNode),
47
+ validSignature = signature; ///
48
+
49
+ return validSignature;
50
+ }
51
+
33
52
  verify(context) {
34
53
  let verifies = false;
35
54
 
@@ -50,12 +69,60 @@ export default define(class Signature extends Element {
50
69
  }, context);
51
70
 
52
71
  if (verifies) {
53
- context.debug(`...verified the '${signatureString}' signature.`);
72
+ context.debug(`...validated the '${signatureString}' signature.`);
54
73
  }
55
74
 
56
75
  return verifies;
57
76
  }
58
77
 
78
+ validate(context) {
79
+ let signature = null;
80
+
81
+ const signatureString = this.getString(); ///
82
+
83
+ context.trace(`Validating the '${signatureString}' signature...`);
84
+
85
+ let validates = false;
86
+
87
+ const validSignature = this.findValidSignature(context);
88
+
89
+ if (validSignature) {
90
+ signature = validSignature; ///
91
+
92
+ context.debug(`...the '${signatureString}' signature is already valid.`);
93
+ } else {
94
+ const specificContext = context; ///
95
+
96
+ context = this.getContext();
97
+
98
+ attempt((context) => {
99
+ const termsValidate = this.validateTerms(context);
100
+
101
+ if (termsValidate !== null) {
102
+ validates = true;
103
+ }
104
+
105
+ if (validates) {
106
+ this.commit(context);
107
+ }
108
+ }, context);
109
+
110
+ context = specificContext; ///
111
+
112
+ if (validates) {
113
+ signature = this; ///
114
+
115
+ context.addSignature(signature);
116
+ }
117
+ }
118
+
119
+ if (validates) {
120
+ context.debug(`...validated the '${signatureString}' signature.`);
121
+ }
122
+
123
+ return signature;
124
+ }
125
+
59
126
  validateTerms(context) {
60
127
  let termsValidate;
61
128
 
@@ -90,40 +157,54 @@ export default define(class Signature extends Element {
90
157
  return termsValidate
91
158
  }
92
159
 
93
- compareSignature(signature, substitutions, generalContext, specificContext) {
94
- const terms = signature.getTerms(),
95
- termsA = this.terms, ///
96
- termsB = terms, ///
97
- matches = match(termsA, termsB, (termA, termB) => {
98
- const { Variable } = elements,
99
- term = termB, ///
100
- context = generalContext, ///
101
- variable = Variable.fromTerm(term, context);
102
-
103
- if (variable !== null) {
104
- const term = termA, ///
105
- termType = term.getType(),
106
- variableType = variable.getType(),
107
- termTypeEqualToOrSubTypeOfVariableType = termType.isEqualToOrSubTypeOf(variableType);
108
-
109
- if (termTypeEqualToOrSubTypeOfVariableType) {
110
- debugger
111
-
112
- // synthetically((context) => {
113
- // const { TermSubstitution } = elements;
114
- //
115
- // TermSubstitution.fromTermAndVariable(term, variable, context);
116
-
117
- // validates...
118
- // });
119
-
120
- return true;
121
- }
122
- }
123
- }),
124
- comparesToSignature = matches; ///
160
+ unifySignature(signature, context) {
161
+ let signatureUnifies = false;
162
+
163
+ const generalSignature = this,
164
+ specificSignature = signature, ///
165
+ generalSignatureString = generalSignature.getString(),
166
+ specificSignatureString = specificSignature.getString();
167
+
168
+ context.trace(`Unifying the '${specificSignatureString}' signature with the '${generalSignatureString}' signature...`);
169
+
170
+ context = specificSignature.getContext();
171
+
172
+ const specificContext = context; ///
173
+
174
+ context = this.getContext();
175
+
176
+ const generalContext = context; ///
177
+
178
+ context = specificContext; ///
179
+
180
+ reconcile((specificContext) => {
181
+ const generalSignatureTerms = generalSignature.getTerms(),
182
+ specificSignatureTerms = specificSignature.getTerms(),
183
+ generalTerms = generalSignatureTerms, ///
184
+ specificTerms = specificSignatureTerms; ///
185
+
186
+ signatureUnifies = match(generalTerms, specificTerms, (generalTerm, specificTerm) => {
187
+ let termUnifies;
188
+
189
+ reconcile((specificContext) => {
190
+ termUnifies = generalTerm.unifyTerm(specificTerm, generalContext, specificContext);
191
+
192
+ if (termUnifies) {
193
+ specificContext.commit();
194
+ }
195
+ }, specificContext);
196
+
197
+ if (termUnifies) {
198
+ return true;
199
+ }
200
+ });
201
+ }, specificContext);
202
+
203
+ if (signatureUnifies) {
204
+ context.debug(`...unified the '${specificSignatureString}' signature with the '${generalSignatureString}' signature.`);
205
+ }
125
206
 
126
- return comparesToSignature;
207
+ return signatureUnifies;
127
208
  }
128
209
 
129
210
  compareSubstitutions(substitutions, context) {
@@ -192,14 +192,18 @@ export default define(class Statement extends Element {
192
192
 
193
193
  context.trace(`Validating the '${statementString}' statement...`);
194
194
 
195
+ let validates;
196
+
195
197
  const validStatement = this.findValidStatment(context);
196
198
 
197
199
  if (validStatement !== null) {
200
+ validates = true;
201
+
198
202
  statement = validStatement; ///
199
203
 
200
204
  context.debug(`...the '${statementString}' statement is already valid.`);
201
205
  } else {
202
- const validates = validateStatements.some((validateStatement) => {
206
+ validates = validateStatements.some((validateStatement) => {
203
207
  const statement = this, ///
204
208
  statementValidates = validateStatement(statement, context);
205
209
 
@@ -212,11 +216,13 @@ export default define(class Statement extends Element {
212
216
  statement = this; ///
213
217
 
214
218
  context.addStatement(statement);
215
-
216
- context.debug(`...validated the '${statementString}' statement.`);
217
219
  }
218
220
  }
219
221
 
222
+ if (validates) {
223
+ context.debug(`...validated the '${statementString}' statement.`);
224
+ }
225
+
220
226
  return statement;
221
227
  }
222
228
 
@@ -112,15 +112,15 @@ export default define(class Subproof extends Element {
112
112
  return subDerivationVerifies;
113
113
  }
114
114
 
115
- unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
116
- let unifiesWithSatisfiesAssertion = false;
115
+ unifyWithSignatureAssertion(signatureAssertion, context) {
116
+ let unifiesWithSignatureAssertion = false;
117
117
 
118
118
  const subproofString = this.getString(), ///
119
- satisfiesAssertionString = satisfiesAssertion.getString();
119
+ signatureAssertionString = signatureAssertion.getString();
120
120
 
121
- context.trace(`Unifying the '${subproofString}' subproof with the '${satisfiesAssertionString}' satisfies assertion...`)
121
+ context.trace(`Unifying the '${subproofString}' subproof with the '${signatureAssertionString}' signature assertion...`)
122
122
 
123
- const reference = satisfiesAssertion.getReference(),
123
+ const reference = signatureAssertion.getReference(),
124
124
  axiom = context.findAxiomByReference(reference);
125
125
 
126
126
  if (axiom !== null) {
@@ -131,20 +131,20 @@ export default define(class Subproof extends Element {
131
131
  statementUnifies = axiom.unifySubproof(subproof, context);
132
132
 
133
133
  if (statementUnifies) {
134
- const substitutionsCompare = satisfiesAssertion.compareSubstitutions(substitutions, context);
134
+ const substitutionsCompare = signatureAssertion.compareSubstitutions(substitutions, context);
135
135
 
136
136
  if (substitutionsCompare) {
137
- unifiesWithSatisfiesAssertion = true;
137
+ unifiesWithSignatureAssertion = true;
138
138
  }
139
139
  }
140
140
  }
141
141
  }
142
142
 
143
- if (unifiesWithSatisfiesAssertion) {
144
- context.debug(`...unified the '${subproofString}' subproof with the '${satisfiesAssertionString}' satisfies assertion.`)
143
+ if (unifiesWithSignatureAssertion) {
144
+ context.debug(`...unified the '${subproofString}' subproof with the '${signatureAssertionString}' signature assertion.`)
145
145
  }
146
146
 
147
- return unifiesWithSatisfiesAssertion;
147
+ return unifiesWithSignatureAssertion;
148
148
  }
149
149
 
150
150
  static name = "Subproof";
@@ -82,6 +82,8 @@ export default define(class FrameSubstitution extends Substitution {
82
82
  const validSubstitution = this.findValidSubstitution(context);
83
83
 
84
84
  if (validSubstitution) {
85
+ validates = true;
86
+
85
87
  frameSubstitution = validSubstitution; ///
86
88
 
87
89
  context.debug(`...the '${frameSubstitutionString}' frame substitution is already valid.`);
@@ -104,15 +106,17 @@ export default define(class FrameSubstitution extends Substitution {
104
106
  this.commit(generalContext, specificContext);
105
107
  }
106
108
  }, generalContext, specificContext);
107
- }
108
109
 
109
- if (validates) {
110
- const substitution = this; ///
110
+ if (validates) {
111
+ const substitution = this; ///
111
112
 
112
- frameSubstitution = substitution; ///
113
+ frameSubstitution = substitution; ///
113
114
 
114
- context.addSubstitution(substitution);
115
+ context.addSubstitution(substitution);
116
+ }
117
+ }
115
118
 
119
+ if (validates) {
116
120
  context.debug(`...validated the '${frameSubstitutionString}' frame substitution.`);
117
121
  }
118
122
 
@@ -99,6 +99,8 @@ export default define(class ReferenceSubstitution extends Substitution {
99
99
  const validSubstitution = this.findValidSubstitution(context);
100
100
 
101
101
  if (validSubstitution) {
102
+ validates = true;
103
+
102
104
  referenceSubstitution = validSubstitution; ///
103
105
 
104
106
  context.debug(`...the '${referenceSubstitutionString}' reference substitution is already valid.`);
@@ -121,15 +123,17 @@ export default define(class ReferenceSubstitution extends Substitution {
121
123
  this.commit(generalContext, specificContext);
122
124
  }
123
125
  }, generalContext, specificContext);
124
- }
125
126
 
126
- if (validates) {
127
- const substitution = this; ///
127
+ if (validates) {
128
+ const substitution = this; ///
128
129
 
129
- referenceSubstitution = substitution; ///
130
+ referenceSubstitution = substitution; ///
130
131
 
131
- context.addSubstitution(substitution);
132
+ context.addSubstitution(substitution);
133
+ }
134
+ }
132
135
 
136
+ if (validates) {
133
137
  context.debug(`...validated the '${referenceSubstitutionString}' reference substitution.`);
134
138
  }
135
139
 
@@ -95,6 +95,8 @@ export default define(class StatementSubstitution extends Substitution {
95
95
  const validSubstitution = this.findValidSubstitution(context);
96
96
 
97
97
  if (validSubstitution) {
98
+ validates = true;
99
+
98
100
  statementSubstitution = validSubstitution; ///
99
101
 
100
102
  context.debug(`...the '${statementSubstitutionString}' statement substitution is already valid.`);
@@ -121,15 +123,17 @@ export default define(class StatementSubstitution extends Substitution {
121
123
  this.commit(generalContext, specificContext);
122
124
  }
123
125
  }, generalContext, specificContext);
124
- }
125
126
 
126
- if (validates) {
127
- const substitution = this; ///
127
+ if (validates) {
128
+ const substitution = this; ///
128
129
 
129
- statementSubstitution = substitution; ///
130
+ statementSubstitution = substitution; ///
130
131
 
131
- context.addSubstitution(substitution);
132
+ context.addSubstitution(substitution);
133
+ }
134
+ }
132
135
 
136
+ if (validates) {
133
137
  context.debug(`...validated the '${statementSubstitutionString}' statement substitution.`);
134
138
  }
135
139
 
@@ -107,15 +107,17 @@ export default define(class TermSubstitution extends Substitution {
107
107
  this.commit(generalContext, specificContext);
108
108
  }
109
109
  }, generalContext, specificContext);
110
- }
111
110
 
112
- if (validates) {
113
- const substitution = this; ///
111
+ if (validates) {
112
+ const substitution = this; ///
114
113
 
115
- termSubstitution = substitution; ///
114
+ termSubstitution = substitution; ///
116
115
 
117
- context.addSubstitution(substitution);
116
+ context.addSubstitution(substitution);
117
+ }
118
+ }
118
119
 
120
+ if (validates) {
119
121
  context.debug(`...validated the '${termSubstitutionString}' term substitution.`);
120
122
  }
121
123
 
@@ -8,6 +8,7 @@ import { instantiate } from "../utilities/context";
8
8
  import { validateTerms } from "../utilities/validation";
9
9
  import { instantiateTerm } from "../process/instantiate";
10
10
  import { variablesFromTerm } from "../utilities/equivalence";
11
+ import { unifyTermIntrinsically } from "../process/unify";
11
12
  import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
12
13
 
13
14
  const { filter } = arrayUtilities;
@@ -172,21 +173,24 @@ export default define(class Term extends Element {
172
173
 
173
174
  context.trace(`Validating the '${termString}' term...`);
174
175
 
175
- const validTerm = this.findValidTerm(context),
176
- valid = (validTerm !== null);
176
+ let validates = false;
177
177
 
178
- if (valid) {
179
- term = validTerm; ///
178
+ const validTerm = this.findValidTerm(context);
180
179
 
181
- context.debug(`...the '${termString}' term is already valid.`);
180
+ if (validTerm !== null) {
181
+ term = validTerm; ///
182
182
 
183
183
  const validatesForward = validateForwards(term);
184
184
 
185
- if (!validatesForward) {
185
+ if (validatesForward) {
186
+ validates = true;
187
+
188
+ context.debug(`...the '${termString}' term is already valid.`);
189
+ } else {
186
190
  term = null;
187
191
  }
188
192
  } else {
189
- const validates = validateTerms.some((validateTerm) => { ///
193
+ validates = validateTerms.some((validateTerm) => { ///
190
194
  const term = this, ///
191
195
  termValidates = validateTerm(term, context, validateForwards);
192
196
 
@@ -199,11 +203,13 @@ export default define(class Term extends Element {
199
203
  term = this; ///
200
204
 
201
205
  context.addTerm(term);
202
-
203
- context.debug(`...validated the '${termString}' term.`);
204
206
  }
205
207
  }
206
208
 
209
+ if (validates) {
210
+ context.debug(`...validated the '${termString}' term.`);
211
+ }
212
+
207
213
  return term;
208
214
  }
209
215
 
@@ -241,6 +247,30 @@ export default define(class Term extends Element {
241
247
  return term;
242
248
  }
243
249
 
250
+ unifyTerm(term, generalContext, specificContext) {
251
+ let termUnifies = false;
252
+
253
+ const context = specificContext, ///
254
+ generalTerm = this,
255
+ specificTerm = term,
256
+ generalTermString = generalTerm.getString(),
257
+ specifixTermString = specificTerm.getString();
258
+
259
+ context.trace(`Unifying the '${specifixTermString}' term with the '${generalTermString}' term...`);
260
+
261
+ const termUnifiesIntrinsically = unifyTermIntrinsically(generalTerm, specificTerm, generalContext, specificContext);
262
+
263
+ if (termUnifiesIntrinsically) {
264
+ termUnifies = true;
265
+ }
266
+
267
+ if (termUnifies) {
268
+ context.debug(`...unified the '${specifixTermString}' term with the '${generalTermString}' term.`);
269
+ }
270
+
271
+ return termUnifies;
272
+ }
273
+
244
274
  toJSON() {
245
275
  const typeJSON = typeToTypeJSON(this.type),
246
276
  string = this.getString(), ///
@@ -23,32 +23,6 @@ export default define(class Axiom extends TopLevelAssertion {
23
23
  return satisfiable;
24
24
  }
25
25
 
26
- compareSignature(signature, context) {
27
- let comparesToSignature = false;
28
-
29
- const satisfiable = this.isSatisfiable();
30
-
31
- if (satisfiable) {
32
- const signatureA = signature; ///
33
-
34
- signature = this.getSignature()
35
-
36
- const signatureB = signature, ///
37
- specificContext = context; ///
38
-
39
- context = this.getContext();
40
-
41
- const generalContext = context, ///
42
- signatureAComparesToSignatureB = signatureA.compareSignature(signatureB, generalContext, specificContext);
43
-
44
- if (signatureAComparesToSignatureB) {
45
- comparesToSignature = true;
46
- }
47
- }
48
-
49
- return comparesToSignature;
50
- }
51
-
52
26
  async verify(context) {
53
27
  let verifies;
54
28
 
@@ -242,6 +216,29 @@ export default define(class Axiom extends TopLevelAssertion {
242
216
  return lastStepUnifies;
243
217
  }
244
218
 
219
+ unifySignature(signature, context) {
220
+ let signatureUnifies;
221
+
222
+ const axiomString = this.getString(), ///
223
+ signatureString = signature.getString();
224
+
225
+ context.trace(`Unifying the '${signatureString}' signature with the '${axiomString}' axiom...`);
226
+
227
+ const specificSignature = signature; ///
228
+
229
+ signature = this.getSignature();
230
+
231
+ const generalSignature = signature; ///
232
+
233
+ signatureUnifies = generalSignature.unifySignature(specificSignature, context);
234
+
235
+ if (signatureUnifies) {
236
+ context.debug(`...unified the '${signatureString}' signature with the '${axiomString}' axiom.`);
237
+ }
238
+
239
+ return signatureUnifies;
240
+ }
241
+
245
242
  unifyTopLevelAssertion(topLevelAssertion, context) {
246
243
  let topLevelAssertionUnifies = false;
247
244
 
@@ -89,14 +89,14 @@ export default define(class Variable extends Element {
89
89
 
90
90
  this.type = type;
91
91
 
92
+ variable = this;
93
+
92
94
  validates = true;
93
95
  } else {
94
96
  context.debug(`The '${variableString}' variable is not present.`);
95
97
  }
96
98
 
97
99
  if (validates) {
98
- variable = this; ///
99
-
100
100
  context.debug(`...validated the '${variableString}' variable.`);
101
101
  }
102
102
 
@@ -4,7 +4,7 @@ import AssertionNode from "../../node/assertion";
4
4
 
5
5
  import { SIGNATURE_RULE_NAME, METAVARIABLE_RULE_NAME } from "../../ruleNames";
6
6
 
7
- export default class SatisfiesAssertionNode extends AssertionNode {
7
+ export default class SignatureAssertionNode extends AssertionNode {
8
8
  getSignatureNode() {
9
9
  const ruleName = SIGNATURE_RULE_NAME,
10
10
  signatureNode = this.getNodeByRuleName(ruleName);
@@ -19,5 +19,5 @@ export default class SatisfiesAssertionNode extends AssertionNode {
19
19
  return metavariableNode;
20
20
  }
21
21
 
22
- static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return AssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(SatisfiesAssertionNode, ruleName, childNodes, opacity, precedence); }
22
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return AssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(SignatureAssertionNode, ruleName, childNodes, opacity, precedence); }
23
23
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { NonTerminalNode } from "occam-languages";
4
4
 
5
- import { REFERENCE_RULE_NAME, SATISFIES_ASSERTION_RULE_NAME } from "../ruleNames";
5
+ import { REFERENCE_RULE_NAME, SIGNATURE_ASSERTION_RULE_NAME } from "../ruleNames";
6
6
 
7
7
  export default class QualificationNode extends NonTerminalNode {
8
8
  getReferenceNode() {
@@ -13,7 +13,7 @@ export default class QualificationNode extends NonTerminalNode {
13
13
  }
14
14
 
15
15
  getSatisfiedAssertionNode() {
16
- const ruleName = SATISFIES_ASSERTION_RULE_NAME,
16
+ const ruleName = SIGNATURE_ASSERTION_RULE_NAME,
17
17
  satisfiedAssertionNode = this.getNodeByRuleName(ruleName);
18
18
 
19
19
  return satisfiedAssertionNode;