occam-nominal 1.0.430 → 1.0.431

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.
@@ -7,7 +7,6 @@ import { ContinuationZipPass as AsynchronousContinuationZipPass } from "occam-la
7
7
  import ContinuationZipPassBase from "../pass/continuationZip"; ///
8
8
 
9
9
  import { declare } from "../utilities/state";
10
- import { reconcile } from "../utilities/context";
11
10
  import { FRAME_META_TYPE_NAME, STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
12
11
  import { termFromTermNode, frameFromFrameNode, statementFromStatementNode } from "../utilities/element";
13
12
 
@@ -36,39 +35,39 @@ class ContinuationZipPass extends ContinuationZipPassBase {
36
35
 
37
36
  class UnifyStatementPass extends AsynchronousContinuationZipPass {
38
37
  static maps = [
39
- {
40
- generalNodeQuery: assumptionMetavariableNodeQuery,
41
- specificNodeQuery: assumptionMetavariableNodeQuery,
42
- run: (generalAssumptionMetavariableNode, specificAssumptionMetavariableNode, generalContext, specificContext, continuation) => {
43
- let context,
44
- reference,
45
- metavariableNode;
46
-
47
- context = generalContext; ///
48
-
49
- metavariableNode = generalAssumptionMetavariableNode; ///
50
-
51
- reference = context.findReferenceByMetavariableNode(metavariableNode);
52
-
53
- const metavariable = reference.getMetavariable();
54
-
55
- context = specificContext; ///
56
-
57
- metavariableNode = specificAssumptionMetavariableNode; ///
58
-
59
- reference = context.findReferenceByMetavariableNode(metavariableNode);
60
-
61
- return metavariable.unifyReference(reference, generalContext, specificContext, (referenceUnifies) => {
62
- let success = false;
63
-
64
- if (referenceUnifies) {
65
- success = true;
66
- }
67
-
68
- return continuation(success, generalContext, specificContext);
69
- });
70
- }
71
- },
38
+ // {
39
+ // generalNodeQuery: assumptionMetavariableNodeQuery,
40
+ // specificNodeQuery: assumptionMetavariableNodeQuery,
41
+ // run: (generalAssumptionMetavariableNode, specificAssumptionMetavariableNode, generalContext, specificContext, continuation) => {
42
+ // let context,
43
+ // reference,
44
+ // metavariableNode;
45
+ //
46
+ // context = generalContext; ///
47
+ //
48
+ // metavariableNode = generalAssumptionMetavariableNode; ///
49
+ //
50
+ // reference = context.findReferenceByMetavariableNode(metavariableNode);
51
+ //
52
+ // const metavariable = reference.getMetavariable();
53
+ //
54
+ // context = specificContext; ///
55
+ //
56
+ // metavariableNode = specificAssumptionMetavariableNode; ///
57
+ //
58
+ // reference = context.findReferenceByMetavariableNode(metavariableNode);
59
+ //
60
+ // return metavariable.unifyReference(reference, generalContext, specificContext, (referenceUnifies) => {
61
+ // let success = false;
62
+ //
63
+ // if (referenceUnifies) {
64
+ // success = true;
65
+ // }
66
+ //
67
+ // return continuation(success, generalContext, specificContext);
68
+ // });
69
+ // }
70
+ // },
72
71
  {
73
72
  generalNodeQuery: statementMetavariableNodeQuery,
74
73
  specificNodeQuery: statementNodeQuery,
@@ -155,33 +154,33 @@ class UnifyStatementPass extends AsynchronousContinuationZipPass {
155
154
  });
156
155
  }
157
156
  },
158
- {
159
- generalNodeQuery: signatureNodeQuery,
160
- specificNodeQuery: signatureNodeQuery,
161
- run: (generalSignatureNode, specificSignatureNode, generalContext, specificContext, continuation) => {
162
- let context;
163
-
164
- context = generalContext; ///
165
-
166
- const generalSignature = context.findSignatureBySignatureNode(generalSignatureNode);
167
-
168
- context = specificContext; ///
169
-
170
- const specificSignature = context.findSignatureBySignatureNode(specificSignatureNode);
171
-
172
- return reconcile((context) => {
173
- return generalSignature.unifySignature(specificSignature, context, (signatureUnifies) => {
174
- let success = false;
175
-
176
- if (signatureUnifies) {
177
- success = true;
178
- }
179
-
180
- return continuation(success, generalContext, specificContext);
181
- });
182
- }, context);
183
- }
184
- }
157
+ // {
158
+ // generalNodeQuery: signatureNodeQuery,
159
+ // specificNodeQuery: signatureNodeQuery,
160
+ // run: (generalSignatureNode, specificSignatureNode, generalContext, specificContext, continuation) => {
161
+ // let context;
162
+ //
163
+ // context = generalContext; ///
164
+ //
165
+ // const generalSignature = context.findSignatureBySignatureNode(generalSignatureNode);
166
+ //
167
+ // context = specificContext; ///
168
+ //
169
+ // const specificSignature = context.findSignatureBySignatureNode(specificSignatureNode);
170
+ //
171
+ // return reconcile((context) => {
172
+ // return generalSignature.unifySignature(specificSignature, context, (signatureUnifies) => {
173
+ // let success = false;
174
+ //
175
+ // if (signatureUnifies) {
176
+ // success = true;
177
+ // }
178
+ //
179
+ // return continuation(success, generalContext, specificContext);
180
+ // });
181
+ // }, context);
182
+ // }
183
+ // }
185
184
  ];
186
185
  }
187
186
 
@@ -223,14 +222,12 @@ class UnifyMetavariablePass extends ContinuationZipPass {
223
222
  ];
224
223
  }
225
224
 
226
- class UnifyTermIntrinsicallyPass extends ContinuationZipPassBase {
225
+ class UnifyTermIntrinsicallyPass extends AsynchronousContinuationZipPass {
227
226
  static maps = [
228
227
  {
229
228
  generalNodeQuery: termVariableNodeQuery,
230
229
  specificNodeQuery: termNodeQuery,
231
230
  run: (generalTermVariableNode, specificTermNode, generalContext, specificContext, continuation) => {
232
- let success = false;
233
-
234
231
  const termNode = specificTermNode, ///
235
232
  variableNode = generalTermVariableNode; ///
236
233
 
@@ -244,20 +241,17 @@ class UnifyTermIntrinsicallyPass extends ContinuationZipPassBase {
244
241
 
245
242
  context = specificContext; ///
246
243
 
247
- const term = context.findTermByTermNode(termNode),
248
- termUnifies = variable.unifyTerm(term, generalContext, specificContext, (context) => {
249
- let termUnifies;
250
-
251
- termUnifies = continuation(context);
244
+ const term = context.findTermByTermNode(termNode);
252
245
 
253
- return termUnifies;
254
- });
246
+ return variable.unifyTerm(term, generalContext, specificContext, (termUnifies) => {
247
+ let success = false;
255
248
 
256
- if (termUnifies) {
257
- success = true;
258
- }
249
+ if (termUnifies) {
250
+ success = true;
251
+ }
259
252
 
260
- return success;
253
+ return continuation(success);
254
+ });
261
255
  }
262
256
  }
263
257
  ];
@@ -561,12 +555,20 @@ const unifyStatementPass = new UnifyStatementPass(),
561
555
  unifyStatementWithCombinatorPass = new UnifyStatementWithCombinatorPass();
562
556
 
563
557
  export function unifyStatement(generalStatement, specificStatement, generalContext, specificContext, continuation) {
558
+ let statementUnifies = false;
559
+
564
560
  const generalStatementNode = generalStatement.getNode(),
565
561
  specificStatementNode = specificStatement.getNode(),
566
562
  generalNode = generalStatementNode, ///
567
563
  specificNode = specificStatementNode; ///
568
564
 
569
- return unifyStatementPass.run(generalNode, specificNode, generalContext, specificContext, continuation);
565
+ return unifyStatementPass.run(generalNode, specificNode, generalContext, specificContext, (success) => {
566
+ if (success) {
567
+ statementUnifies = true;
568
+ }
569
+
570
+ return continuation(statementUnifies);
571
+ });
570
572
  }
571
573
 
572
574
  export function unifyMetavariable(generalMetavariable, specificMetavariable, generalContext, specificContext, continuation) {
@@ -589,23 +591,32 @@ export function unifyTermIntrinsically(generalTerm, specificTerm, generalContext
589
591
  const generalTermNode = generalTerm.getNode(),
590
592
  specificTermNode = specificTerm.getNode(),
591
593
  generalNode = generalTermNode, ///
592
- specificNode = specificTermNode, ///
593
- success = unifyTermInstrinsicallyPass.run(generalNode, specificNode, generalContext, specificContext, continuation);
594
+ specificNode = specificTermNode; ///
594
595
 
595
- if (success) {
596
- termUnifiesIntrinsically = true;
597
- }
596
+ return unifyTermInstrinsicallyPass.run(generalNode, specificNode, generalContext, specificContext, (success) => {
597
+ if (success) {
598
+ termUnifiesIntrinsically = true;
599
+ }
598
600
 
599
- return termUnifiesIntrinsically;
601
+ return continuation(termUnifiesIntrinsically);
602
+ });
600
603
  }
601
604
 
602
605
  export function unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext, continuation) {
606
+ let metavaraibleUnifiesIntrinsically = false;
607
+
603
608
  const generalMetavariableNode = generalMetavariable.getNode(),
604
609
  specificMetavariableNode = specificMetavariable.getNode(),
605
610
  generalNode = generalMetavariableNode, ///
606
611
  specificNode = specificMetavariableNode;
607
612
 
608
- return unifyMetavariableIntrisicallyPass.run(generalNode, specificNode, generalContext, specificContext, continuation);
613
+ return unifyMetavariableIntrisicallyPass.run(generalNode, specificNode, generalContext, specificContext, (success) => {
614
+ if (success) {
615
+ metavaraibleUnifiesIntrinsically = true;
616
+
617
+ return continuation(metavaraibleUnifiesIntrinsically);
618
+ }
619
+ });
609
620
  }
610
621
 
611
622
  export function unifyTermWithProperty(term, property, generalContext, specificContext, continuation) {
@@ -3,9 +3,15 @@
3
3
  import { baseTypeFromNothing } from "../utilities/type";
4
4
  import { EMPTY_STRING, PROVISIONAL, PROVISIONALLY } from "../constants";
5
5
 
6
- export function termsStringFromTerms(terms) {
6
+ export function termsStringFromTerms(terms, quoted = false) {
7
7
  const termsString = terms.reduce((termsString, term) => {
8
- const termString = term.getString();
8
+ let termString;
9
+
10
+ termString = term.getString();
11
+
12
+ if (quoted) {
13
+ termString = `'${termString}'`;
14
+ }
9
15
 
10
16
  termsString = (termsString !== null) ?
11
17
  `${termsString}, ${termString}` :