occam-verify-cli 1.0.760 → 1.0.764

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 (83) hide show
  1. package/lib/context/file/nominal.js +2 -3
  2. package/lib/context/literal.js +1 -1
  3. package/lib/context/nominal.js +2 -3
  4. package/lib/element/assertion/contained.js +4 -3
  5. package/lib/element/assertion/defined.js +4 -3
  6. package/lib/element/assertion/property.js +5 -4
  7. package/lib/element/assertion/satisfies.js +4 -3
  8. package/lib/element/assertion/subproof.js +4 -3
  9. package/lib/element/assertion/type.js +4 -3
  10. package/lib/element/combinator.js +2 -3
  11. package/lib/element/conclusion.js +7 -5
  12. package/lib/element/constructor.js +2 -3
  13. package/lib/element/deduction.js +7 -5
  14. package/lib/element/equality.js +2 -3
  15. package/lib/element/frame.js +2 -3
  16. package/lib/element/hypothesis.js +2 -3
  17. package/lib/element/judgement.js +2 -3
  18. package/lib/element/label.js +3 -4
  19. package/lib/element/metavariable.js +11 -26
  20. package/lib/element/parameter.js +2 -3
  21. package/lib/element/procedureCall.js +2 -3
  22. package/lib/element/procedureReference.js +2 -3
  23. package/lib/element/proofAssertion/premise.js +2 -3
  24. package/lib/element/proofAssertion/supposition.js +8 -5
  25. package/lib/element/property.js +2 -3
  26. package/lib/element/propertyRelation.js +2 -3
  27. package/lib/element/reference.js +2 -3
  28. package/lib/element/signature.js +2 -3
  29. package/lib/element/statement.js +2 -3
  30. package/lib/element/substitution/frame.js +4 -3
  31. package/lib/element/substitution/metaLevel.js +3 -4
  32. package/lib/element/substitution/reference.js +4 -3
  33. package/lib/element/substitution/statement.js +4 -3
  34. package/lib/element/substitution/term.js +4 -3
  35. package/lib/element/term.js +2 -3
  36. package/lib/element/type.js +2 -3
  37. package/lib/element/typePrefix.js +2 -3
  38. package/lib/element/variable.js +5 -10
  39. package/lib/utilities/context.js +29 -15
  40. package/lib/utilities/unification.js +4 -9
  41. package/lib/utilities/validation.js +14 -8
  42. package/package.json +4 -4
  43. package/src/context/file/nominal.js +1 -5
  44. package/src/context/literal.js +1 -1
  45. package/src/context/nominal.js +1 -5
  46. package/src/element/assertion/contained.js +4 -2
  47. package/src/element/assertion/defined.js +4 -2
  48. package/src/element/assertion/property.js +5 -3
  49. package/src/element/assertion/satisfies.js +4 -2
  50. package/src/element/assertion/subproof.js +4 -2
  51. package/src/element/assertion/type.js +4 -2
  52. package/src/element/combinator.js +1 -3
  53. package/src/element/conclusion.js +8 -4
  54. package/src/element/constructor.js +1 -3
  55. package/src/element/deduction.js +8 -4
  56. package/src/element/equality.js +1 -3
  57. package/src/element/frame.js +1 -3
  58. package/src/element/hypothesis.js +1 -3
  59. package/src/element/judgement.js +1 -3
  60. package/src/element/label.js +2 -4
  61. package/src/element/metavariable.js +17 -36
  62. package/src/element/parameter.js +1 -3
  63. package/src/element/procedureCall.js +1 -3
  64. package/src/element/procedureReference.js +1 -3
  65. package/src/element/proofAssertion/premise.js +1 -3
  66. package/src/element/proofAssertion/supposition.js +8 -4
  67. package/src/element/property.js +1 -3
  68. package/src/element/propertyRelation.js +1 -3
  69. package/src/element/reference.js +1 -3
  70. package/src/element/signature.js +1 -3
  71. package/src/element/statement.js +1 -3
  72. package/src/element/substitution/frame.js +4 -2
  73. package/src/element/substitution/metaLevel.js +2 -4
  74. package/src/element/substitution/reference.js +4 -2
  75. package/src/element/substitution/statement.js +4 -2
  76. package/src/element/substitution/term.js +4 -2
  77. package/src/element/term.js +1 -3
  78. package/src/element/type.js +1 -3
  79. package/src/element/typePrefix.js +2 -3
  80. package/src/element/variable.js +5 -12
  81. package/src/utilities/context.js +42 -17
  82. package/src/utilities/unification.js +5 -11
  83. package/src/utilities/validation.js +17 -9
@@ -187,7 +187,7 @@ export default define(class TermSubstitution extends Substitution {
187
187
  const { name } = json;
188
188
 
189
189
  if (this.name === name) {
190
- instantiate((context) => {
190
+ termSubstitutionn = instantiate((context) => {
191
191
  const { string } = json,
192
192
  termSubstitutionNode = instantiateTermSubstitution(string, context),
193
193
  node = termSubstitutionNode, ///
@@ -196,7 +196,9 @@ export default define(class TermSubstitution extends Substitution {
196
196
 
197
197
  context = null;
198
198
 
199
- termSubstitutionn = new TermSubstitution(context, string, node, targetTerm, replacementTerm);
199
+ const termSubstitutionn = new TermSubstitution(context, string, node, targetTerm, replacementTerm);
200
+
201
+ return termSubstitutionn;
200
202
  }, context);
201
203
  }
202
204
 
@@ -238,7 +238,7 @@ export default define(class Term extends Element {
238
238
  static name = "Term";
239
239
 
240
240
  static fromJSON(json, context) {
241
- const term = instantiate((context) => {
241
+ return instantiate((context) => {
242
242
  const { string } = json,
243
243
  termNode = instantiateTerm(string, context),
244
244
  node = termNode, ///
@@ -250,7 +250,5 @@ export default define(class Term extends Element {
250
250
 
251
251
  return term;
252
252
  }, context);
253
-
254
- return term;
255
253
  }
256
254
  });
@@ -316,7 +316,7 @@ export default define(class Type extends Element {
316
316
  static name = "Type";
317
317
 
318
318
  static fromJSON(json, context) {
319
- const type = instantiate((context) => {
319
+ return instantiate((context) => {
320
320
  const { string } = json,
321
321
  typeNode = instantiateType(string, context),
322
322
  node = typeNode, ///
@@ -332,8 +332,6 @@ export default define(class Type extends Element {
332
332
 
333
333
  return type;
334
334
  }, context);
335
-
336
- return type;
337
335
  }
338
336
 
339
337
  static fromName(name, context) {
@@ -43,7 +43,8 @@ export default define(class TypePrefix extends Element {
43
43
  static name = "TypePrefix";
44
44
 
45
45
  static fromJSON(json, context) {
46
- const typePrefix = instantiate((context) => {const { string } = json,
46
+ return instantiate((context) => {
47
+ const { string } = json,
47
48
  typePrefixNode = instantiateTypePrefix(string, context),
48
49
  node = typePrefixNode, ///
49
50
  name = nameFromTypePrefixNode(typePrefixNode, context);
@@ -54,7 +55,5 @@ export default define(class TypePrefix extends Element {
54
55
 
55
56
  return typePrefix;
56
57
  }, context);
57
-
58
- return typePrefix;
59
58
  }
60
59
  });
@@ -153,17 +153,12 @@ export default define(class Variable extends Element {
153
153
  termTypeEqualToOrSubTypeOfVariableType = termType.isEqualToOrSubTypeOf(variableType);
154
154
 
155
155
  if (termTypeEqualToOrSubTypeOfVariableType) {
156
- const { TermSubstitution } = elements;
156
+ const { TermSubstitution } = elements,
157
+ termSubstitution = TermSubstitution.fromTermAndVariable(term, variable, context);
157
158
 
158
- let termSubstitution;
159
+ termSubstitution.validate(generalContext, specificContext);
159
160
 
160
- termSubstitution = TermSubstitution.fromTermAndVariable(term, variable, context);
161
-
162
- termSubstitution = termSubstitution.validate(generalContext, specificContext); ///
163
-
164
- if (termSubstitution !== null) {
165
- termUnifies = true;
166
- }
161
+ termUnifies = true;
167
162
  }
168
163
  }
169
164
 
@@ -189,7 +184,7 @@ export default define(class Variable extends Element {
189
184
  static name = "Variable";
190
185
 
191
186
  static fromJSON(json, context) {
192
- const variable = instantiate((context) => {
187
+ return instantiate((context) => {
193
188
  const { string } = json,
194
189
  variableNode = instantiateVariable(string, context),
195
190
  node = variableNode, ///
@@ -202,7 +197,5 @@ export default define(class Variable extends Element {
202
197
 
203
198
  return variable;
204
199
  }, context);
205
-
206
- return variable;
207
200
  }
208
201
  });
@@ -1,13 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  import ScopedContext from "../context/scoped";
4
- import LiminalContext from "../context/liminal";
5
- import LiteralContext from "../context/literal";
6
4
  import nominalContext from "../context/nominal";
5
+ import LiteralContext from "../context/literal";
6
+ import LiminalContext from "../context/liminal";
7
7
  import EphemeralContext from "../context/ephemeral";
8
8
  import BranchingContext from "../context/branching";
9
9
  import SyntheticContext from "../context/synthetic";
10
10
 
11
+ export function nominally(innerFunction) {
12
+ let context;
13
+
14
+ context = nominalContext; ///
15
+
16
+ const literalContext = LiteralContext.fromNothing(context);
17
+
18
+ context = literalContext; ///
19
+
20
+ return innerFunction(context);
21
+ }
22
+
11
23
  export function join(innerFunction, ...contexts) {
12
24
  const syntheticContext = SyntheticContext.fromContexts(...contexts),
13
25
  context = syntheticContext; ///
@@ -39,26 +51,22 @@ export function reconcile(innerFunction, context) {
39
51
  return innerFunction(context);
40
52
  }
41
53
 
42
- export function nominally(innerFunction) {
43
- let context;
44
-
45
- context = nominalContext; ///
46
-
54
+ export function instantiate(innerFunction, context) {
47
55
  const literalContext = LiteralContext.fromNothing(context);
48
56
 
49
57
  context = literalContext; ///
50
58
 
51
- return innerFunction(context);
52
- }
59
+ const element = innerFunction(context);
53
60
 
54
- export function instantiate(innerFunction, context) {
55
- const literalContext = LiteralContext.fromNothing(context);
61
+ context = element.getContext();
56
62
 
57
- steriiseLiteralContext(literalContext);
63
+ if (context !== null) {
64
+ context = context.getContext();
58
65
 
59
- context = literalContext; ///
66
+ element.setContext(context);
67
+ }
60
68
 
61
- return innerFunction(context);
69
+ return element;
62
70
  }
63
71
 
64
72
  export async function asyncRestrict(innerFunction, metaLevelSubstitutions, context) {
@@ -83,10 +91,27 @@ export async function asyncReconcile(innerFunction, context) {
83
91
  return await innerFunction(context);
84
92
  }
85
93
 
86
- function steriiseLiteralContext(literalContext) {
87
- let context;
94
+ function sanitisedContextFromContext(context) {
95
+ let contextExtraneousContext = isContextExtraneousContext(context);
96
+
97
+ while (contextExtraneousContext) {
98
+ context = context.getContext();
88
99
 
89
- context = literalContext.getContext();
100
+ contextExtraneousContext = isContextExtraneousContext(context);
101
+ }
102
+
103
+ const ephemeralContext = EphemeralContext.fromNothing(context),
104
+ sanitisedContext = ephemeralContext; ///
105
+
106
+ return sanitisedContext;
107
+ }
90
108
 
109
+ function isContextExtraneousContext(context) {
110
+ const contextLiminalContext = (context instanceof LiminalContext),
111
+ contextEphemeralContext = (context instanceof EphemeralContext),
112
+ contextBranchingContext = (context instanceof BranchingContext),
113
+ contextSyntheticContext = (context instanceof SyntheticContext),
114
+ contextExtraneousContext = (contextLiminalContext || contextEphemeralContext || contextBranchingContext || contextSyntheticContext);
91
115
 
116
+ return contextExtraneousContext;
92
117
  }
@@ -62,20 +62,14 @@ async function unifyStatementWithReference(statement, reference, satisfiesAssert
62
62
  const metaLevelSubstitutions = context.hasMetaLevelSubstitutions();
63
63
 
64
64
  if (metaLevelSubstitutions) {
65
- const { MetaLevelSubstitution } = elements;
66
-
67
- let metaLevelSubstitution;
68
-
69
- metaLevelSubstitution = MetaLevelSubstitution.fromStatementAndReference(statement, reference, context);
70
-
71
- const generalContext = context, ///
65
+ const { MetaLevelSubstitution } = elements,
66
+ metaLevelSubstitution = MetaLevelSubstitution.fromStatementAndReference(statement, reference, context),
67
+ generalContext = context, ///
72
68
  specificContext = context; ///
73
69
 
74
- metaLevelSubstitution = metaLevelSubstitution.validate(generalContext, specificContext); ///
70
+ metaLevelSubstitution.validate(generalContext, specificContext);
75
71
 
76
- if (metaLevelSubstitution !== null) {
77
- statementUnifiesWithReference = true;
78
- }
72
+ statementUnifiesWithReference = true;
79
73
  }
80
74
  }
81
75
 
@@ -104,20 +104,28 @@ function validateStatementAsMetavariable(statement, stated, context) {
104
104
  statementValidatesAsMetavariable = true;
105
105
 
106
106
  const { TermSubstitution, FrameSubstitution } = elements,
107
- frameSubstitution = FrameSubstitution.fromStatement(statement, context),
108
- termSubstitution = TermSubstitution.fromStatement(statement, context);
107
+ generalContext = context, ///
108
+ specificContext = context; ///
109
109
 
110
- let substitution;
110
+ let termSubstitution,
111
+ frameSubstitution;
111
112
 
112
- substitution = (termSubstitution || frameSubstitution);
113
+ termSubstitution = TermSubstitution.fromStatement(statement, context);
113
114
 
114
- if (substitution !== null) {
115
- const generalContext = context, ///
116
- specificContext = context; ///
115
+ if (termSubstitution !== null) {
116
+ termSubstitution = termSubstitution.validate(generalContext, specificContext); ///
117
117
 
118
- substitution = substitution.validate(generalContext, specificContext);
118
+ if (termSubstitution === null) {
119
+ statementValidatesAsMetavariable = false;
120
+ }
121
+ }
122
+
123
+ frameSubstitution = FrameSubstitution.fromStatement(statement, context);
124
+
125
+ if (frameSubstitution !== null) {
126
+ frameSubstitution = frameSubstitution.validate(generalContext, specificContext); ///
119
127
 
120
- if (substitution === null) {
128
+ if (frameSubstitution === null) {
121
129
  statementValidatesAsMetavariable = false;
122
130
  }
123
131
  }