occam-verify-cli 1.0.457 → 1.0.473

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 (161) hide show
  1. package/lib/constants.js +13 -1
  2. package/lib/context/ephemeral.js +270 -0
  3. package/lib/context/file.js +102 -66
  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 +66 -7
  8. package/lib/context/scoped.js +48 -40
  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 +5 -8
  15. package/lib/element/conclusion.js +14 -13
  16. package/lib/element/constructor.js +2 -2
  17. package/lib/element/deduction.js +14 -13
  18. package/lib/element/derivation.js +3 -3
  19. package/lib/element/equality.js +5 -5
  20. package/lib/element/equivalence.js +112 -107
  21. package/lib/element/equivalences.js +24 -10
  22. package/lib/element/error.js +3 -3
  23. package/lib/element/frame.js +38 -21
  24. package/lib/element/hypothesis.js +2 -2
  25. package/lib/element/judgement.js +6 -5
  26. package/lib/element/metaType.js +1 -2
  27. package/lib/element/metavariable.js +46 -35
  28. package/lib/element/parameter.js +13 -5
  29. package/lib/element/procedureCall.js +16 -16
  30. package/lib/element/proof.js +14 -13
  31. package/lib/element/proofAssertion/premise.js +41 -30
  32. package/lib/element/proofAssertion/step.js +39 -35
  33. package/lib/element/proofAssertion/supposition.js +43 -32
  34. package/lib/element/proofAssertion.js +19 -5
  35. package/lib/element/propertyRelation.js +2 -2
  36. package/lib/element/reference.js +50 -9
  37. package/lib/element/rule.js +26 -28
  38. package/lib/element/section.js +2 -2
  39. package/lib/element/signature.js +9 -6
  40. package/lib/element/statement.js +44 -31
  41. package/lib/element/subproof.js +18 -17
  42. package/lib/element/substitution/frame.js +83 -46
  43. package/lib/element/substitution/reference.js +101 -19
  44. package/lib/element/substitution/statement.js +122 -75
  45. package/lib/element/substitution/term.js +93 -57
  46. package/lib/element/substitution.js +20 -69
  47. package/lib/element/substitutions.js +49 -34
  48. package/lib/element/term.js +30 -21
  49. package/lib/element/topLevelAssertion/axiom.js +8 -6
  50. package/lib/element/topLevelAssertion/conjecture.js +4 -4
  51. package/lib/element/topLevelAssertion/lemma.js +4 -4
  52. package/lib/element/topLevelAssertion/theorem.js +2 -2
  53. package/lib/element/topLevelAssertion.js +30 -23
  54. package/lib/element/topLevelMetaAssertion/metaLemma.js +2 -2
  55. package/lib/element/topLevelMetaAssertion/metatheorem.js +2 -2
  56. package/lib/element/topLevelMetaAssertion.js +16 -12
  57. package/lib/element/variable.js +30 -22
  58. package/lib/index.js +3 -3
  59. package/lib/main.js +3 -3
  60. package/lib/node/frame.js +2 -2
  61. package/lib/node/metavariable.js +4 -4
  62. package/lib/node/parameter.js +28 -7
  63. package/lib/node/substitution/frame.js +9 -31
  64. package/lib/node/substitution/reference.js +137 -0
  65. package/lib/node/substitution/statement.js +9 -31
  66. package/lib/node/substitution/term.js +9 -23
  67. package/lib/nonTerminalNodeMap.js +3 -2
  68. package/lib/process/instantiate.js +2 -14
  69. package/lib/process/unify.js +5 -5
  70. package/lib/tokenTypes.js +22 -0
  71. package/lib/utilities/context.js +54 -19
  72. package/lib/utilities/element.js +161 -336
  73. package/lib/utilities/instance.js +4 -4
  74. package/lib/utilities/string.js +18 -4
  75. package/lib/utilities/unification.js +24 -18
  76. package/lib/utilities/validation.js +31 -31
  77. package/package.json +2 -2
  78. package/src/constants.js +12 -0
  79. package/src/context/{transient.js → ephemeral.js} +15 -112
  80. package/src/context/file.js +66 -67
  81. package/src/context/liminal.js +67 -0
  82. package/src/context/{fragment.js → literal.js} +17 -4
  83. package/src/context/nominal.js +12 -0
  84. package/src/context/release.js +44 -6
  85. package/src/context/scoped.js +41 -31
  86. package/src/context/synthetic.js +60 -0
  87. package/src/element/assertion/contained.js +49 -47
  88. package/src/element/assertion/defined.js +29 -27
  89. package/src/element/assertion/property.js +35 -35
  90. package/src/element/assertion/satisfies.js +19 -18
  91. package/src/element/assumption.js +4 -10
  92. package/src/element/conclusion.js +16 -19
  93. package/src/element/constructor.js +1 -1
  94. package/src/element/deduction.js +16 -21
  95. package/src/element/derivation.js +2 -2
  96. package/src/element/equality.js +4 -4
  97. package/src/element/equivalence.js +115 -135
  98. package/src/element/equivalences.js +9 -7
  99. package/src/element/error.js +4 -2
  100. package/src/element/frame.js +50 -23
  101. package/src/element/hypothesis.js +1 -1
  102. package/src/element/judgement.js +9 -4
  103. package/src/element/metaType.js +0 -1
  104. package/src/element/metavariable.js +54 -53
  105. package/src/element/parameter.js +10 -5
  106. package/src/element/procedureCall.js +20 -18
  107. package/src/element/proof.js +14 -16
  108. package/src/element/proofAssertion/premise.js +46 -42
  109. package/src/element/proofAssertion/step.js +45 -40
  110. package/src/element/proofAssertion/supposition.js +56 -45
  111. package/src/element/proofAssertion.js +23 -5
  112. package/src/element/propertyRelation.js +1 -1
  113. package/src/element/reference.js +64 -16
  114. package/src/element/rule.js +31 -37
  115. package/src/element/section.js +1 -1
  116. package/src/element/signature.js +8 -8
  117. package/src/element/statement.js +51 -40
  118. package/src/element/subproof.js +16 -18
  119. package/src/element/substitution/frame.js +99 -42
  120. package/src/element/substitution/reference.js +120 -20
  121. package/src/element/substitution/statement.js +160 -89
  122. package/src/element/substitution/term.js +104 -63
  123. package/src/element/substitution.js +16 -58
  124. package/src/element/substitutions.js +43 -41
  125. package/src/element/term.js +37 -32
  126. package/src/element/topLevelAssertion/axiom.js +8 -6
  127. package/src/element/topLevelAssertion/conjecture.js +1 -2
  128. package/src/element/topLevelAssertion/lemma.js +2 -3
  129. package/src/element/topLevelAssertion/theorem.js +1 -1
  130. package/src/element/topLevelAssertion.js +31 -27
  131. package/src/element/topLevelMetaAssertion/metaLemma.js +1 -2
  132. package/src/element/topLevelMetaAssertion/metatheorem.js +1 -2
  133. package/src/element/topLevelMetaAssertion.js +15 -13
  134. package/src/element/variable.js +30 -31
  135. package/src/index.js +2 -1
  136. package/src/main.js +2 -1
  137. package/src/node/frame.js +1 -1
  138. package/src/node/metavariable.js +3 -3
  139. package/src/node/parameter.js +32 -5
  140. package/src/node/substitution/frame.js +6 -32
  141. package/src/node/substitution/reference.js +38 -0
  142. package/src/node/substitution/statement.js +6 -32
  143. package/src/node/substitution/term.js +6 -22
  144. package/src/nonTerminalNodeMap.js +3 -0
  145. package/src/process/instantiate.js +0 -8
  146. package/src/process/unify.js +4 -4
  147. package/src/tokenTypes.js +4 -0
  148. package/src/utilities/context.js +43 -17
  149. package/src/utilities/element.js +187 -401
  150. package/src/utilities/instance.js +3 -3
  151. package/src/utilities/string.js +21 -5
  152. package/src/utilities/unification.js +26 -23
  153. package/src/utilities/validation.js +47 -47
  154. package/lib/context/fragment.js +0 -77
  155. package/lib/context/transient.js +0 -371
  156. package/lib/log.js +0 -150
  157. package/lib/utilities/fragment.js +0 -23
  158. package/lib/utilities/node.js +0 -71
  159. package/src/log.js +0 -118
  160. package/src/utilities/fragment.js +0 -11
  161. package/src/utilities/node.js +0 -85
@@ -2,7 +2,7 @@
2
2
 
3
3
  import nominalContext from "../context/nominal";
4
4
 
5
- import { withinFragment } from "../utilities/fragment";
5
+ import { literally } from "../utilities/context";
6
6
  import { BASE_TYPE_SYMBOL } from "../constants";
7
7
  import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
8
8
  import { instantiateCombinator, instantiateConstructor } from "../process/instantiate";
@@ -15,7 +15,7 @@ export function bracketedCombinatorFromNothing() {
15
15
  if (bracketedCombinator === null) {
16
16
  const context = nominalContext; ///
17
17
 
18
- bracketedCombinator = withinFragment((context) => {
18
+ bracketedCombinator = literally((context) => {
19
19
  const bracketedCombinatorString = `(${STATEMENT_META_TYPE_NAME})`,
20
20
  string = bracketedCombinatorString, ///
21
21
  combinatorNode = instantiateCombinator(string, context),
@@ -33,7 +33,7 @@ export function bracketedConstructorFromNothing() {
33
33
  if (bracketedConstructor === null) {
34
34
  const context = nominalContext; ///
35
35
 
36
- bracketedConstructor = withinFragment((context) => {
36
+ bracketedConstructor = literally((context) => {
37
37
  const bracketedConstructorString = `(${BASE_TYPE_SYMBOL})`,
38
38
  string = bracketedConstructorString, ///
39
39
  constructorNode = instantiateConstructor(string, context),
@@ -44,7 +44,7 @@ export function premisesStringFromPremises(premises) {
44
44
  return premisesString;
45
45
  }
46
46
 
47
- export function hypothesesStringFromHypotheses(hypotheses, context) {
47
+ export function hypothesesStringFromHypotheses(hypotheses) {
48
48
  const hypothesesString = hypotheses.reduce((hypothesesString, hypothesis) => {
49
49
  const hypothesisString = hypothesis.getString();
50
50
 
@@ -94,8 +94,8 @@ export function assumptionsStringFromAssumptions(assumptions) {
94
94
  const assumptionString = assumption.getString();
95
95
 
96
96
  assumptionsString = (assumptionsString === null) ?
97
- assumptionString :
98
- `${assumptionsString}, ${assumptionString}`;
97
+ assumptionString: ///
98
+ `${assumptionsString}, ${assumptionString}`;
99
99
 
100
100
  return assumptionsString;
101
101
  }, null);
@@ -145,6 +145,14 @@ export function equivalenceStringFromTerms(terms) {
145
145
  return equivalenceString;
146
146
  }
147
147
 
148
+ export function termSubstitutionStringFromTermAndVariable(term, variable) {
149
+ const termString = term.getString(),
150
+ variableString = variable.getString(),
151
+ termSubstitutionString = `[${termString} for ${variableString}]`;
152
+
153
+ return termSubstitutionString;
154
+ }
155
+
148
156
  export function rulsStringFromLabelsPremisesAndConclusion(labels, premises, conclusion) {
149
157
  const premisesString = premisesStringFromPremises(premises),
150
158
  conclusionString = conclusion.getString(),
@@ -156,10 +164,10 @@ export function rulsStringFromLabelsPremisesAndConclusion(labels, premises, conc
156
164
  return ruleString;
157
165
  }
158
166
 
159
- export function sectionStringFromHypothesesTopLevelAssertion(hypotheses, axiom, lemma, theorem, conjecture, context) {
167
+ export function sectionStringFromHypothesesTopLevelAssertion(hypotheses, axiom, lemma, theorem, conjecture) {
160
168
  const topLevelAssertion = (axiom || lemma || theorem || conjecture),
161
169
  topLevelAssertionString = topLevelAssertion.getString(),
162
- hypothesesString = hypothesesStringFromHypotheses(hypotheses, context),
170
+ hypothesesString = hypothesesStringFromHypotheses(hypotheses),
163
171
  sectionString = (topLevelAssertionString !== null) ?
164
172
  `[${hypothesesString}]::: ${topLevelAssertionString}` :
165
173
  `[${hypothesesString}]::: `;
@@ -216,6 +224,14 @@ export function statementSubstitutionStringFromStatementAndMetavariable(statemen
216
224
  return statementSubstitutionString;
217
225
  }
218
226
 
227
+ export function referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable) {
228
+ const referenceString = reference.getString(),
229
+ metavariableString = metavariable.getString(),
230
+ referenceSubstitutionString = `[${referenceString} for ${metavariableString}]`;
231
+
232
+ return referenceSubstitutionString;
233
+ }
234
+
219
235
  export function topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction) {
220
236
  let topLevelAssertionString;
221
237
 
@@ -4,6 +4,7 @@ import { arrayUtilities } from "necessary";
4
4
 
5
5
  import elements from "../elements";
6
6
 
7
+ import { synthetically } from "../utilities/context";
7
8
  import { equalityFromStatement,
8
9
  judgementFromStatement,
9
10
  typeAssertionFromStatement,
@@ -12,7 +13,7 @@ import { equalityFromStatement,
12
13
 
13
14
  const { backwardsSome } = arrayUtilities;
14
15
 
15
- function unifyStatementWithRule(statement, reference, satisfiesAssertion, substitutions, context) {
16
+ function unifyStatementWithRule(statement, reference, satisfiesAssertion, context) {
16
17
  let statementUnifiesWithRule = false;
17
18
 
18
19
  if (reference !== null) {
@@ -40,7 +41,7 @@ function unifyStatementWithRule(statement, reference, satisfiesAssertion, substi
40
41
  return statementUnifiesWithRule;
41
42
  }
42
43
 
43
- function unifyStatementWithReference(statement, reference, satisfiesAssertion, substitutions, context) {
44
+ function unifyStatementWithReference(statement, reference, satisfiesAssertion, context) {
44
45
  let statementUnifiesWithReference = false;
45
46
 
46
47
  if (reference !== null) {
@@ -52,12 +53,14 @@ function unifyStatementWithReference(statement, reference, satisfiesAssertion, s
52
53
  const metavariableValidates = reference.validateMetavariable(context);
53
54
 
54
55
  if (metavariableValidates) {
55
- const { StatementSubstitution } = elements,
56
- metavariable = reference.getMetavariable(),
57
- statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
58
- substitution = statementSubstitution; ///
56
+ const metavariable = reference.getMetavariable();
59
57
 
60
- substitutions.addSubstitution(substitution, context);
58
+ synthetically((context) => {
59
+ const { StatementSubstitution } = elements;
60
+
61
+ StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
62
+
63
+ }, generalContext, specificContext);
61
64
 
62
65
  statementUnifiesWithReference = true;
63
66
  }
@@ -70,7 +73,7 @@ function unifyStatementWithReference(statement, reference, satisfiesAssertion, s
70
73
  return statementUnifiesWithReference;
71
74
  }
72
75
 
73
- function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAssertion, substitutions, context) {
76
+ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAssertion, context) {
74
77
  let statementUnifiesAsSatisfiesAssertion = false;
75
78
 
76
79
  satisfiesAssertion = satisfiesAssertionFromStatement(statement, context);
@@ -108,7 +111,7 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
108
111
 
109
112
  if (satisfiable) {
110
113
  const { Substitutions } = elements,
111
- substitutions = Substitutions.fromNothing(),
114
+ substitutions = Substitutions.fromNothing(context),
112
115
  topLevelAssertionUnifies = axiom.unifyTopLevelAssertion(topLevelAssertion, substitutions, context);
113
116
 
114
117
  if (topLevelAssertionUnifies) {
@@ -135,7 +138,7 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
135
138
  return statementUnifiesAsSatisfiesAssertion;
136
139
  }
137
140
 
138
- function unifyStatementWithTopLevelAssertion(statement, reference, satisfiesAssertion, substitutions, context) {
141
+ function unifyStatementWithTopLevelAssertion(statement, reference, satisfiesAssertion, context) {
139
142
  let statementUnifiesWithTopLevelAssertion = false;
140
143
 
141
144
  if (reference !== null) {
@@ -151,19 +154,19 @@ function unifyStatementWithTopLevelAssertion(statement, reference, satisfiesAsse
151
154
 
152
155
  const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
153
156
 
154
- substitutions = Substitutions.fromNothing();
157
+ substitutions = Substitutions.fromNothing(context);
155
158
 
156
159
  const statementAndSubproofOrProofAssertionsUnify = topLevelAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, substitutions, context);
157
160
 
158
161
  if (statementAndSubproofOrProofAssertionsUnify) {
159
- const { StatementSubstitution } = elements,
160
- metavariable = reference.getMetavariable(),
161
- statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
162
- substitution = statementSubstitution; ///
162
+ const metavariable = reference.getMetavariable();
163
+
164
+ synthetically((context) => {
165
+ const { StatementSubstitution } = elements;
163
166
 
164
- substitutions = generalSubstitutions; ///
167
+ StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
165
168
 
166
- substitutions.addSubstitution(substitution, context);
169
+ }, generalContext, specificContext);
167
170
 
168
171
  statementUnifiesWithTopLevelAssertion = true;
169
172
  }
@@ -177,7 +180,7 @@ function unifyStatementWithTopLevelAssertion(statement, reference, satisfiesAsse
177
180
  return statementUnifiesWithTopLevelAssertion;
178
181
  }
179
182
 
180
- function unifyStatementAEquality(statement, reference, satisfiesAssertion, substitutions, context) {
183
+ function unifyStatementAEquality(statement, reference, satisfiesAssertion, context) {
181
184
  let statementUnifiesAEquality = false;
182
185
 
183
186
  if (reference === null) {
@@ -203,7 +206,7 @@ function unifyStatementAEquality(statement, reference, satisfiesAssertion, subst
203
206
  return statementUnifiesAEquality;
204
207
  }
205
208
 
206
- function unifyStatementAsJudgement(statement, reference, satisfiesAssertion, substitutions, context) {
209
+ function unifyStatementAsJudgement(statement, reference, satisfiesAssertion, context) {
207
210
  let statementUnifiesAsJudgement = false;
208
211
 
209
212
  if (reference === null) {
@@ -225,7 +228,7 @@ function unifyStatementAsJudgement(statement, reference, satisfiesAssertion, sub
225
228
  return statementUnifiesAsJudgement;
226
229
  }
227
230
 
228
- function unifyStatementAsTypeAssertion(statement, reference, satisfiesAssertion, substitutions, context) {
231
+ function unifyStatementAsTypeAssertion(statement, reference, satisfiesAssertion, context) {
229
232
  let statementUnifiesAsTypeAssertion = false;
230
233
 
231
234
  if (reference === null) {
@@ -245,7 +248,7 @@ function unifyStatementAsTypeAssertion(statement, reference, satisfiesAssertion,
245
248
  return statementUnifiesAsTypeAssertion;
246
249
  }
247
250
 
248
- function unifyStatementAsPropertyAssertion(statement, reference, satisfiesAssertion, substitutions, context) {
251
+ function unifyStatementAsPropertyAssertion(statement, reference, satisfiesAssertion, context) {
249
252
  let statementUnifiesAsPropertyAssertion = false;
250
253
 
251
254
  if (reference === null) {
@@ -283,7 +286,7 @@ function unifyStatementAsPropertyAssertion(statement, reference, satisfiesAssert
283
286
  return statementUnifiesAsPropertyAssertion;
284
287
  }
285
288
 
286
- function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAssertion, substitutions, context) {
289
+ function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAssertion, context) {
287
290
  let statementUnifiesWithSatisfiesAssertion = false;
288
291
 
289
292
  if (satisfiesAssertion !== null) {
@@ -307,7 +310,7 @@ function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAss
307
310
  return statementUnifiesWithSatisfiesAssertion;
308
311
  }
309
312
 
310
- function compareStatementWithSubproofOrProofAssertions(statement, reference, satisfiesAssertion, substitutions, context) {
313
+ function compareStatementWithSubproofOrProofAssertions(statement, reference, satisfiesAssertion, context) {
311
314
  let statementEquatesWithStepOrSubproofs = false;
312
315
 
313
316
  if (reference === null) {
@@ -12,32 +12,6 @@ import { equalityFromStatement,
12
12
  containedAssertionFromStatement,
13
13
  satisfiesAssertionFromStatement } from "../utilities/statement";
14
14
 
15
- function unifyTermWithBracketedConstructor(term, context, validateAhead) {
16
- let termUnifiesWithBracketedConstructor;
17
-
18
- const bracketedConstructor = bracketedConstructorFromNothing();
19
-
20
- termUnifiesWithBracketedConstructor = bracketedConstructor.unifyTerm(term, context, validateAhead);
21
-
22
- return termUnifiesWithBracketedConstructor;
23
- }
24
-
25
- function unifyTermWithConstructors(term, context, validateAhead) {
26
- let termUnifiesWithConstructors;
27
-
28
- const constructors = context.getConstructors();
29
-
30
- termUnifiesWithConstructors = constructors.some((constructor) => {
31
- const unifiesWithConstructor = constructor.unifyTerm(term, context, validateAhead);
32
-
33
- if (unifiesWithConstructor) {
34
- return true;
35
- }
36
- });
37
-
38
- return termUnifiesWithConstructors;
39
- }
40
-
41
15
  function validateTermAsVariable(term, context, validateAhead) {
42
16
  let termValidatesAsVariable = false;
43
17
 
@@ -72,7 +46,33 @@ function validateTermAsVariable(term, context, validateAhead) {
72
46
  return termValidatesAsVariable;
73
47
  }
74
48
 
75
- function validateStatementAsMetavariableAndSubstitution(statement, assignments, stated, context) {
49
+ function unifyTermWithConstructors(term, context, validateAhead) {
50
+ let termUnifiesWithConstructors;
51
+
52
+ const constructors = context.getConstructors();
53
+
54
+ termUnifiesWithConstructors = constructors.some((constructor) => {
55
+ const unifiesWithConstructor = constructor.unifyTerm(term, context, validateAhead);
56
+
57
+ if (unifiesWithConstructor) {
58
+ return true;
59
+ }
60
+ });
61
+
62
+ return termUnifiesWithConstructors;
63
+ }
64
+
65
+ function unifyTermWithBracketedConstructor(term, context, validateAhead) {
66
+ let termUnifiesWithBracketedConstructor;
67
+
68
+ const bracketedConstructor = bracketedConstructorFromNothing();
69
+
70
+ termUnifiesWithBracketedConstructor = bracketedConstructor.unifyTerm(term, context, validateAhead);
71
+
72
+ return termUnifiesWithBracketedConstructor;
73
+ }
74
+
75
+ function validateStatementAsMetavariable(statement, assignments, stated, context) {
76
76
  let statementValidatesAsMetavariableAndSubstitution = false;
77
77
 
78
78
  const statementNode = statement.getNode(),
@@ -81,7 +81,7 @@ function validateStatementAsMetavariableAndSubstitution(statement, assignments,
81
81
  if (metavariableNode !== null) {
82
82
  const statementString = statement.getString();
83
83
 
84
- context.trace(`Validating the '${statementString}' statement as a metavariable and substitution...`);
84
+ context.trace(`Validating the '${statementString}' statement as a metavariable...`);
85
85
 
86
86
  const metavariableName = metavariableNode.getMetavariableName(),
87
87
  metavariable = context.findMetavariableByMetavariableName(metavariableName);
@@ -104,39 +104,39 @@ function validateStatementAsMetavariableAndSubstitution(statement, assignments,
104
104
  }
105
105
 
106
106
  if (statementValidatesAsMetavariableAndSubstitution) {
107
- context.debug(`...validated the '${statementString}' statement as a metavariable and substitution.`);
107
+ context.debug(`...validated the '${statementString}' statement as a metavariable.`);
108
108
  }
109
109
  }
110
110
 
111
111
  return statementValidatesAsMetavariableAndSubstitution;
112
112
  }
113
113
 
114
- function unifyStatementWithBracketedCombinator(statement, assignments, stated, context) {
114
+ function unifyStatementWithCombinators(statement, assignments, stated, context) {
115
115
  stated = true; ///
116
116
 
117
117
  assignments = null; ///
118
118
 
119
- const bracketedCombinator = bracketedCombinatorFromNothing(),
120
- statementUnifiesWithBracketedCombinator = bracketedCombinator.unifyStatement(statement, assignments, stated, context);
119
+ const combinators = context.getCombinators(),
120
+ statementUnifiesWithCombinators = combinators.some((combinator) => {
121
+ const unifiesWithCombinator = combinator.unifyStatement(statement, assignments, stated, context);
121
122
 
122
- return statementUnifiesWithBracketedCombinator;
123
+ if (unifiesWithCombinator) {
124
+ return true;
125
+ }
126
+ });
127
+
128
+ return statementUnifiesWithCombinators;
123
129
  }
124
130
 
125
- function unifyStatementWithCombinators(statement, assignments, stated, context) {
131
+ function unifyStatementWithBracketedCombinator(statement, assignments, stated, context) {
126
132
  stated = true; ///
127
133
 
128
134
  assignments = null; ///
129
135
 
130
- const combinators = context.getCombinators(),
131
- statementUnifiesWithCombinators = combinators.some((combinator) => {
132
- const unifiesWithCombinator = combinator.unifyStatement(statement, assignments, stated, context);
133
-
134
- if (unifiesWithCombinator) {
135
- return true;
136
- }
137
- });
136
+ const bracketedCombinator = bracketedCombinatorFromNothing(),
137
+ statementUnifiesWithBracketedCombinator = bracketedCombinator.unifyStatement(statement, assignments, stated, context);
138
138
 
139
- return statementUnifiesWithCombinators;
139
+ return statementUnifiesWithBracketedCombinator;
140
140
  }
141
141
 
142
142
  function validateStatementAsEquality(statement, assignments, stated, context) {
@@ -340,15 +340,15 @@ function validateStatementAsSatisfiesAssertion(statement, assignments, stated, c
340
340
  }
341
341
 
342
342
  export const validateTerms = [
343
- unifyTermWithBracketedConstructor,
343
+ validateTermAsVariable,
344
344
  unifyTermWithConstructors,
345
- validateTermAsVariable
345
+ unifyTermWithBracketedConstructor
346
346
  ];
347
347
 
348
348
  export const validateStatements = [
349
- validateStatementAsMetavariableAndSubstitution,
350
- unifyStatementWithBracketedCombinator,
349
+ validateStatementAsMetavariable,
351
350
  unifyStatementWithCombinators,
351
+ unifyStatementWithBracketedCombinator,
352
352
  validateStatementAsEquality,
353
353
  validateStatementAsJudgement,
354
354
  validateStatementAsTypeAssertion,
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
8
- return FragmentContext;
9
- }
10
- });
11
- var _node = require("../utilities/node");
12
- var _context = require("../utilities/context");
13
- function _class_call_check(instance, Constructor) {
14
- if (!(instance instanceof Constructor)) {
15
- throw new TypeError("Cannot call a class as a function");
16
- }
17
- }
18
- function _defineProperties(target, props) {
19
- for(var i = 0; i < props.length; i++){
20
- var descriptor = props[i];
21
- descriptor.enumerable = descriptor.enumerable || false;
22
- descriptor.configurable = true;
23
- if ("value" in descriptor) descriptor.writable = true;
24
- Object.defineProperty(target, descriptor.key, descriptor);
25
- }
26
- }
27
- function _create_class(Constructor, protoProps, staticProps) {
28
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
29
- if (staticProps) _defineProperties(Constructor, staticProps);
30
- return Constructor;
31
- }
32
- var FragmentContext = /*#__PURE__*/ function() {
33
- function FragmentContext(context, tokens) {
34
- _class_call_check(this, FragmentContext);
35
- this.context = context;
36
- this.tokens = tokens;
37
- return (0, _context.chainContext)(this);
38
- }
39
- _create_class(FragmentContext, [
40
- {
41
- key: "getContext",
42
- value: function getContext() {
43
- return this.context;
44
- }
45
- },
46
- {
47
- key: "getTokens",
48
- value: function getTokens() {
49
- return this.tokens;
50
- }
51
- },
52
- {
53
- key: "setTokens",
54
- value: function setTokens(tokens) {
55
- this.tokens = tokens;
56
- }
57
- },
58
- {
59
- key: "nodeAsString",
60
- value: function nodeAsString(node) {
61
- var string = (0, _node.nodeAsString)(node, this.tokens);
62
- return string;
63
- }
64
- }
65
- ], [
66
- {
67
- key: "fromNothing",
68
- value: function fromNothing(context) {
69
- var tokens = null, fragmentContext = new FragmentContext(context, tokens);
70
- return fragmentContext;
71
- }
72
- }
73
- ]);
74
- return FragmentContext;
75
- }();
76
-
77
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250ZXh0L2ZyYWdtZW50LmpzIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5pbXBvcnQgeyBub2RlQXNTdHJpbmcgfSBmcm9tIFwiLi4vdXRpbGl0aWVzL25vZGVcIjtcbmltcG9ydCB7IGNoYWluQ29udGV4dCB9IGZyb20gXCIuLi91dGlsaXRpZXMvY29udGV4dFwiO1xuXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBGcmFnbWVudENvbnRleHQge1xuICBjb25zdHJ1Y3Rvcihjb250ZXh0LCB0b2tlbnMpIHtcbiAgICB0aGlzLmNvbnRleHQgPSBjb250ZXh0O1xuICAgIHRoaXMudG9rZW5zID0gdG9rZW5zO1xuXG4gICAgcmV0dXJuIGNoYWluQ29udGV4dCh0aGlzKTtcbiAgfVxuXG4gIGdldENvbnRleHQoKSB7XG4gICAgcmV0dXJuIHRoaXMuY29udGV4dDtcbiAgfVxuXG4gIGdldFRva2VucygpIHt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