occam-verify-cli 0.0.1089 → 0.0.1091

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 (126) hide show
  1. package/bin/action/verify.js +2 -2
  2. package/lib/assertion/contained.js +35 -41
  3. package/lib/assertion/defined.js +24 -24
  4. package/lib/assertion/subproof.js +24 -24
  5. package/lib/assertion/type.js +23 -23
  6. package/lib/assignment/equality.js +4 -10
  7. package/lib/assignment/judgement.js +4 -4
  8. package/lib/assignment/variable.js +4 -4
  9. package/lib/combinator/bracketed.js +3 -3
  10. package/lib/conclusion.js +11 -13
  11. package/lib/consequent.js +11 -13
  12. package/lib/constructor/bracketed.js +3 -3
  13. package/lib/constructor.js +2 -2
  14. package/lib/context/file.js +28 -27
  15. package/lib/context/local.js +31 -32
  16. package/lib/context/release.js +6 -3
  17. package/lib/declaration.js +18 -18
  18. package/lib/derivation.js +3 -3
  19. package/lib/equality.js +24 -24
  20. package/lib/equivalence.js +13 -13
  21. package/lib/frame.js +43 -43
  22. package/lib/index.js +2 -1
  23. package/lib/judgement.js +20 -20
  24. package/lib/label.js +9 -1
  25. package/lib/metaType.js +2 -2
  26. package/lib/metavariable.js +40 -39
  27. package/lib/mixins/statement/qualified/unify.js +19 -19
  28. package/lib/mixins/statement/resolve.js +11 -11
  29. package/lib/mixins/statement/unify.js +12 -12
  30. package/lib/mixins/statement/verify.js +36 -36
  31. package/lib/mixins/term/verify.js +2 -2
  32. package/lib/premise.js +31 -40
  33. package/lib/proof.js +6 -5
  34. package/lib/proofStep.js +17 -17
  35. package/lib/reference.js +8 -8
  36. package/lib/rule.js +21 -21
  37. package/lib/statement/qualified.js +17 -17
  38. package/lib/statement/unqualified.js +19 -19
  39. package/lib/statement.js +52 -54
  40. package/lib/subDerivation.js +3 -3
  41. package/lib/subproof.js +6 -5
  42. package/lib/substitution/frameForMetavariable.js +16 -39
  43. package/lib/substitution/statementForMetavariable.js +88 -74
  44. package/lib/substitution/termForVariable.js +15 -41
  45. package/lib/substitution.js +20 -6
  46. package/lib/substitutions.js +13 -13
  47. package/lib/supposition.js +31 -40
  48. package/lib/term.js +28 -28
  49. package/lib/topLevelAssertion.js +33 -21
  50. package/lib/unifier/equality.js +8 -8
  51. package/lib/unifier/intrinsicLevel.js +149 -0
  52. package/lib/unifier/metaLevel.js +41 -31
  53. package/lib/unifier/metavariable.js +14 -8
  54. package/lib/unifier/statementWithCombinator.js +16 -16
  55. package/lib/unifier/termWithConstructor.js +6 -6
  56. package/lib/unifier.js +47 -47
  57. package/lib/utilities/assignments.js +3 -3
  58. package/lib/utilities/equivalences.js +14 -14
  59. package/lib/utilities/json.js +22 -21
  60. package/lib/utilities/unifier.js +7 -8
  61. package/lib/variable.js +33 -33
  62. package/lib/verifier/statementAsCombinator.js +2 -2
  63. package/lib/verifier/termAsConstructor.js +2 -2
  64. package/package.json +2 -2
  65. package/src/assertion/contained.js +37 -45
  66. package/src/assertion/defined.js +25 -25
  67. package/src/assertion/subproof.js +25 -28
  68. package/src/assertion/type.js +23 -23
  69. package/src/assignment/equality.js +4 -6
  70. package/src/assignment/judgement.js +4 -4
  71. package/src/assignment/variable.js +4 -4
  72. package/src/combinator/bracketed.js +2 -2
  73. package/src/conclusion.js +14 -15
  74. package/src/consequent.js +14 -15
  75. package/src/constructor/bracketed.js +2 -2
  76. package/src/constructor.js +3 -2
  77. package/src/context/file.js +26 -25
  78. package/src/context/local.js +21 -23
  79. package/src/context/release.js +5 -3
  80. package/src/declaration.js +20 -20
  81. package/src/derivation.js +2 -2
  82. package/src/equality.js +26 -26
  83. package/src/equivalence.js +12 -12
  84. package/src/frame.js +42 -42
  85. package/src/index.js +1 -0
  86. package/src/judgement.js +25 -25
  87. package/src/label.js +14 -0
  88. package/src/metaType.js +1 -1
  89. package/src/metavariable.js +51 -43
  90. package/src/mixins/statement/qualified/unify.js +21 -21
  91. package/src/mixins/statement/resolve.js +12 -12
  92. package/src/mixins/statement/unify.js +11 -11
  93. package/src/mixins/statement/verify.js +35 -35
  94. package/src/mixins/term/verify.js +1 -1
  95. package/src/premise.js +42 -53
  96. package/src/proof.js +6 -4
  97. package/src/proofStep.js +21 -21
  98. package/src/reference.js +12 -11
  99. package/src/rule.js +20 -20
  100. package/src/statement/qualified.js +18 -17
  101. package/src/statement/unqualified.js +19 -18
  102. package/src/statement.js +63 -66
  103. package/src/subDerivation.js +2 -3
  104. package/src/subproof.js +6 -4
  105. package/src/substitution/frameForMetavariable.js +29 -45
  106. package/src/substitution/statementForMetavariable.js +136 -86
  107. package/src/substitution/termForVariable.js +28 -49
  108. package/src/substitution.js +15 -5
  109. package/src/substitutions.js +12 -12
  110. package/src/supposition.js +41 -53
  111. package/src/term.js +27 -27
  112. package/src/topLevelAssertion.js +32 -19
  113. package/src/unifier/equality.js +7 -7
  114. package/src/unifier/intrinsicLevel.js +61 -0
  115. package/src/unifier/metaLevel.js +60 -46
  116. package/src/unifier/metavariable.js +22 -13
  117. package/src/unifier/statementWithCombinator.js +28 -28
  118. package/src/unifier/termWithConstructor.js +8 -8
  119. package/src/unifier.js +55 -55
  120. package/src/utilities/assignments.js +2 -2
  121. package/src/utilities/equivalences.js +13 -13
  122. package/src/utilities/json.js +76 -66
  123. package/src/utilities/unifier.js +10 -12
  124. package/src/variable.js +43 -40
  125. package/src/verifier/statementAsCombinator.js +2 -1
  126. package/src/verifier/termAsConstructor.js +2 -1
@@ -28,13 +28,13 @@ class Declaration {
28
28
  return this.statement;
29
29
  }
30
30
 
31
- unifyStatement(statement, localContext) {
31
+ unifyStatement(statement, context) {
32
32
  let statementUnified;
33
33
 
34
34
  const statementString = statement.getString(),
35
35
  declarationStatementString = this.statement.getString(); ///
36
36
 
37
- localContext.trace(`Unifying the '${statementString}' statement with the '${declarationStatementString}' statement...`);
37
+ context.trace(`Unifying the '${statementString}' statement with the '${declarationStatementString}' statement...`);
38
38
 
39
39
  let statementNode = statement.getNode();
40
40
 
@@ -45,19 +45,19 @@ class Declaration {
45
45
  statementUnified = statementNodeMatches; ///
46
46
 
47
47
  if (statementUnified) {
48
- localContext.debug(`...unified the '${statementString}' statement with the '${declarationStatementString}' statement.`);
48
+ context.debug(`...unified the '${statementString}' statement with the '${declarationStatementString}' statement.`);
49
49
  }
50
50
 
51
51
  return statementUnified;
52
52
  }
53
53
 
54
- unifyMetavariable(metavariable, localContext) {
54
+ unifyMetavariable(metavariable, context) {
55
55
  let metavariableUnified;
56
56
 
57
57
  const referenceString = this.reference.getString(),
58
58
  metavariableString = metavariable.getString();
59
59
 
60
- localContext.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
60
+ context.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
61
61
 
62
62
  const metavariableNode = metavariable.getNode(),
63
63
  metavariableNodeMatches = this.reference.matchMetavariableNode(metavariableNode);
@@ -65,61 +65,61 @@ class Declaration {
65
65
  metavariableUnified = metavariableNodeMatches; ///
66
66
 
67
67
  if (metavariableUnified) {
68
- localContext.debug(`...unified the '${metavariableString}' metavariable with the '${referenceString}' reference.`);
68
+ context.debug(`...unified the '${metavariableString}' metavariable with the '${referenceString}' reference.`);
69
69
  }
70
70
 
71
71
  return metavariableUnified;
72
72
  }
73
73
 
74
- unifySubstitution(substitution, localContext) {
74
+ unifySubstitution(substitution, context) {
75
75
  let substitutionUnified;
76
76
 
77
77
  const declarationString = this.string, ///
78
78
  substitutionString = substitution.getString();
79
79
 
80
- localContext.trace(`Unifying the '${substitutionString}' substitution with the '${declarationString}' declaration...`);
80
+ context.trace(`Unifying the '${substitutionString}' substitution with the '${declarationString}' declaration...`);
81
81
 
82
82
  const statement = substitution.getStatement(),
83
83
  metavariable = substitution.getMetavariable(),
84
- statementUnified = this.unifyStatement(statement, localContext),
85
- metavariableUnified = this.unifyMetavariable(metavariable, localContext);
84
+ statementUnified = this.unifyStatement(statement, context),
85
+ metavariableUnified = this.unifyMetavariable(metavariable, context);
86
86
 
87
87
  substitutionUnified = (metavariableUnified && statementUnified);
88
88
 
89
89
  if (substitutionUnified) {
90
- localContext.debug(`...unified the '${declarationString}' substitution with the '${substitutionString}' declaration.`);
90
+ context.debug(`...unified the '${declarationString}' substitution with the '${substitutionString}' declaration.`);
91
91
  }
92
92
 
93
93
  return substitutionUnified;
94
94
  }
95
95
 
96
- verify(assignments, stated, localContext) {
96
+ verify(assignments, stated, context) {
97
97
  let verified = false;
98
98
 
99
99
  const declarationString = this.string; ///
100
100
 
101
- localContext.trace(`Verifying the '${declarationString}' declaration...`);
101
+ context.trace(`Verifying the '${declarationString}' declaration...`);
102
102
 
103
103
  stated = true; ///
104
104
 
105
105
  assignments = null; ///
106
106
 
107
- const referenceVerified = this.reference.verify(localContext);
107
+ const referenceVerified = this.reference.verify(context);
108
108
 
109
109
  if (referenceVerified) {
110
- const statementVerified = this.statement.verify(assignments, stated, localContext);
110
+ const statementVerified = this.statement.verify(assignments, stated, context);
111
111
 
112
112
  verified = statementVerified; ///
113
113
  }
114
114
 
115
115
  if (verified) {
116
- localContext.debug(`...verified the '${declarationString}' declaration.`);
116
+ context.debug(`...verified the '${declarationString}' declaration.`);
117
117
  }
118
118
 
119
119
  return verified;
120
120
  }
121
121
 
122
- static fromDeclarationNode(declarationNode, localContext) {
122
+ static fromDeclarationNode(declarationNode, context) {
123
123
  let declaration = null;
124
124
 
125
125
  if (declarationNode !== null) {
@@ -130,10 +130,10 @@ class Declaration {
130
130
 
131
131
  statementNode = stripBracketsFromStatementNode(statementNode); ///
132
132
 
133
- const reference = Reference.fromReferenceNode(referenceNode, localContext),
134
- statement = Statement.fromStatementNode(statementNode, localContext),
133
+ const reference = Reference.fromReferenceNode(referenceNode, context),
134
+ statement = Statement.fromStatementNode(statementNode, context),
135
135
  node = declarationNode, ///
136
- string = localContext.nodeAsString(node);
136
+ string = context.nodeAsString(node);
137
137
 
138
138
  declaration = new Declaration(string, reference, statement);
139
139
  }
package/src/derivation.js CHANGED
@@ -25,11 +25,11 @@ class Derivation {
25
25
  return lastProofStep;
26
26
  }
27
27
 
28
- verify(substitutions, localContext) {
28
+ verify(substitutions, context) {
29
29
  let verified;
30
30
 
31
31
  verified = this.proofSteps.every((proofStep) => { ///
32
- const proofStepVerified = proofStep.verify(substitutions, localContext);
32
+ const proofStepVerified = proofStep.verify(substitutions, context);
33
33
 
34
34
  if (proofStepVerified) {
35
35
  return true;
package/src/equality.js CHANGED
@@ -57,32 +57,32 @@ class Equality {
57
57
  return reflexive;
58
58
  }
59
59
 
60
- isEqual(localContext) {
60
+ isEqual(context) {
61
61
  const leftTermNode = this.leftTerm.getNode(),
62
62
  rightTermNode = this.rightTerm.getNode(),
63
- equalityUnified = equalityUnifier.unify(leftTermNode, rightTermNode, localContext),
63
+ equalityUnified = equalityUnifier.unify(leftTermNode, rightTermNode, context),
64
64
  equal = equalityUnified; ///
65
65
 
66
66
  return equal;
67
67
  }
68
68
 
69
- verify(assignments, stated, localContext) {
69
+ verify(assignments, stated, context) {
70
70
  let verified = false;
71
71
 
72
72
  const equalityString = this.string; ///
73
73
 
74
- localContext.trace(`Verifying the '${equalityString}' equality...`);
74
+ context.trace(`Verifying the '${equalityString}' equality...`);
75
75
 
76
- const termsVerified = this.verifyTerms(localContext);
76
+ const termsVerified = this.verifyTerms(context);
77
77
 
78
78
  if (termsVerified) {
79
79
  let verifiedWhenStated = false,
80
80
  verifiedWhenDerived = false;
81
81
 
82
82
  if (stated) {
83
- verifiedWhenStated = this.verifyWhenStated(localContext);
83
+ verifiedWhenStated = this.verifyWhenStated(context);
84
84
  } else {
85
- verifiedWhenDerived = this.verifyWhenDerived(localContext);
85
+ verifiedWhenDerived = this.verifyWhenDerived(context);
86
86
  }
87
87
 
88
88
  if (verifiedWhenStated || verifiedWhenDerived) {
@@ -93,8 +93,8 @@ class Equality {
93
93
  rightTermNode = this.rightTerm.getNode(),
94
94
  leftVariableNode = variableNodeQuery(leftTermNode),
95
95
  rightVariableNode = variableNodeQuery(rightTermNode),
96
- leftVariable = Variable.fromVariableNodeAndType(leftVariableNode, type, localContext),
97
- rightVariable = Variable.fromVariableNodeAndType(rightVariableNode, type, localContext);
96
+ leftVariable = Variable.fromVariableNodeAndType(leftVariableNode, type, context),
97
+ rightVariable = Variable.fromVariableNodeAndType(rightVariableNode, type, context);
98
98
 
99
99
  let assignment;
100
100
 
@@ -127,23 +127,23 @@ class Equality {
127
127
  }
128
128
 
129
129
  if (verified) {
130
- localContext.debug(`...verified the '${equalityString}' equality.`);
130
+ context.debug(`...verified the '${equalityString}' equality.`);
131
131
  }
132
132
 
133
133
  return verified;
134
134
  }
135
135
 
136
- verifyTerms(localContext) {
136
+ verifyTerms(context) {
137
137
  let termsVerified;
138
138
 
139
139
  const equalityString = this.string; ///
140
140
 
141
- localContext.trace(`Verifying the '${equalityString}' equality's terms...`);
141
+ context.trace(`Verifying the '${equalityString}' equality's terms...`);
142
142
 
143
- const leftTermVerified = this.leftTerm.verify(localContext, () => {
143
+ const leftTermVerified = this.leftTerm.verify(context, () => {
144
144
  let verifiedAhead;
145
145
 
146
- const rightTermVerified = this.rightTerm.verify(localContext, () => {
146
+ const rightTermVerified = this.rightTerm.verify(context, () => {
147
147
  let verifiedAhead;
148
148
 
149
149
  const leftTermType = this.leftTerm.getType(),
@@ -163,57 +163,57 @@ class Equality {
163
163
  termsVerified = leftTermVerified; ///
164
164
 
165
165
  if (termsVerified) {
166
- localContext.debug(`...verified the '${equalityString}' equality's terms.`);
166
+ context.debug(`...verified the '${equalityString}' equality's terms.`);
167
167
  }
168
168
 
169
169
  return termsVerified;
170
170
  }
171
171
 
172
- verifyWhenStated(localContext) {
172
+ verifyWhenStated(context) {
173
173
  let verifiedWhenStated;
174
174
 
175
175
  const equalityString = this.string; ///
176
176
 
177
- localContext.trace(`Verifying the '${equalityString}' stated equality...`);
177
+ context.trace(`Verifying the '${equalityString}' stated equality...`);
178
178
 
179
179
  verifiedWhenStated = true;
180
180
 
181
181
  if (verifiedWhenStated) {
182
- localContext.debug(`...verified the '${equalityString}' stated equality.`);
182
+ context.debug(`...verified the '${equalityString}' stated equality.`);
183
183
  }
184
184
 
185
185
  return verifiedWhenStated;
186
186
  }
187
187
 
188
- verifyWhenDerived(localContext) {
188
+ verifyWhenDerived(context) {
189
189
  let verifiedWhenDerived;
190
190
 
191
191
  const equalityString = this.string; ///
192
192
 
193
- localContext.trace(`Verifying the '${equalityString}' derived equality...`);
193
+ context.trace(`Verifying the '${equalityString}' derived equality...`);
194
194
 
195
- const equal = this.isEqual(localContext);
195
+ const equal = this.isEqual(context);
196
196
 
197
197
  verifiedWhenDerived = equal; ///
198
198
 
199
199
  if (verifiedWhenDerived) {
200
- localContext.debug(`...verified the '${equalityString}' derived equality.`);
200
+ context.debug(`...verified the '${equalityString}' derived equality.`);
201
201
  }
202
202
 
203
203
  return verifiedWhenDerived;
204
204
  }
205
205
 
206
- static fromEqualityNode(equalityNode, localContext) {
206
+ static fromEqualityNode(equalityNode, context) {
207
207
  let equality = null;
208
208
 
209
209
  if (equalityNode !== null) {
210
210
  const { Term } = shim,
211
211
  leftTermNode = leftTermNodeQuery(equalityNode),
212
212
  rightTermNode = rightTermNodeQuery(equalityNode),
213
- leftTerm = Term.fromTermNode(leftTermNode, localContext),
214
- rightTerm = Term.fromTermNode(rightTermNode, localContext),
213
+ leftTerm = Term.fromTermNode(leftTermNode, context),
214
+ rightTerm = Term.fromTermNode(rightTermNode, context),
215
215
  node = equalityNode, ///
216
- string = localContext.nodeAsString(node);
216
+ string = context.nodeAsString(node);
217
217
 
218
218
  equality = new Equality(string, leftTerm, rightTerm);
219
219
  }
@@ -14,11 +14,11 @@ export default class Equivalence {
14
14
  return this.terms;
15
15
  }
16
16
 
17
- addTerm(term, localContext) {
17
+ addTerm(term, context) {
18
18
  const termString = term.getString(),
19
19
  equivalenceString = this.asString(); ///
20
20
 
21
- localContext.trace(`Adding the '${termString}' term to the '${equivalenceString}' equivalence.`);
21
+ context.trace(`Adding the '${termString}' term to the '${equivalenceString}' equivalence.`);
22
22
 
23
23
  this.terms.push(term);
24
24
  }
@@ -115,9 +115,9 @@ export default class Equivalence {
115
115
  return termNodesMatch;
116
116
  }
117
117
 
118
- getGroundedTerms(definedVariables, groundedTerms, localContext) {
118
+ getGroundedTerms(definedVariables, groundedTerms, context) {
119
119
  this.terms.forEach((term) => {
120
- const termGrounded = term.isGrounded(definedVariables, localContext);
120
+ const termGrounded = term.isGrounded(definedVariables, context);
121
121
 
122
122
  if (termGrounded) {
123
123
  const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
@@ -138,25 +138,25 @@ export default class Equivalence {
138
138
  });
139
139
  }
140
140
 
141
- isInitiallyGrounded(localContext) {
142
- const initiallyGroundedTerms = this.getInitiallyGroundedTerms(localContext),
141
+ isInitiallyGrounded(context) {
142
+ const initiallyGroundedTerms = this.getInitiallyGroundedTerms(context),
143
143
  initiallyGroundedTermsLength = initiallyGroundedTerms.length,
144
144
  initiallyGrounded = (initiallyGroundedTermsLength > 0);
145
145
 
146
146
  return initiallyGrounded;
147
147
  }
148
148
 
149
- isImplicitlyGrounded(definedVariables, localContext) {
150
- const implicitlyGroundedTerms = this.getImplicitlyGroundedTerms(definedVariables, localContext),
149
+ isImplicitlyGrounded(definedVariables, context) {
150
+ const implicitlyGroundedTerms = this.getImplicitlyGroundedTerms(definedVariables, context),
151
151
  implicitlyGroundedTermsLength = implicitlyGroundedTerms.length,
152
152
  implicitlyGrounded = (implicitlyGroundedTermsLength > 0);
153
153
 
154
154
  return implicitlyGrounded;
155
155
  }
156
156
 
157
- getInitiallyGroundedTerms(localContext) {
157
+ getInitiallyGroundedTerms(context) {
158
158
  const initiallyGroundedTerms = this.terms.reduce((initiallyGroundedTerms, term) => {
159
- const termInitiallyGrounded = term.isInitiallyGrounded(localContext);
159
+ const termInitiallyGrounded = term.isInitiallyGrounded(context);
160
160
 
161
161
  if (termInitiallyGrounded) {
162
162
  const initiallyGroundedTerm = term; ///
@@ -170,9 +170,9 @@ export default class Equivalence {
170
170
  return initiallyGroundedTerms;
171
171
  }
172
172
 
173
- getImplicitlyGroundedTerms(definedVariables, localContext) {
173
+ getImplicitlyGroundedTerms(definedVariables, context) {
174
174
  const implicitlyGroundedTerms = this.terms.reduce((implicitlyGroundedTerms, term) => {
175
- const termImplicitlyGrounded = term.isImplicitlyGrounded(definedVariables, localContext);
175
+ const termImplicitlyGrounded = term.isImplicitlyGrounded(definedVariables, context);
176
176
 
177
177
  if (termImplicitlyGrounded) {
178
178
  const implicitlyGroundedTerm = term; ///
package/src/frame.js CHANGED
@@ -86,16 +86,16 @@ class Frame {
86
86
  return metavariableNodeMatches;
87
87
  }
88
88
 
89
- unifySubstitution(substitution, localContext) {
89
+ unifySubstitution(substitution, context) {
90
90
  let substitutionUnified = false;
91
91
 
92
92
  const substitutionString = substitution.getString();
93
93
 
94
- localContext.trace(`Unifying the '${substitutionString}' substitution...`)
94
+ context.trace(`Unifying the '${substitutionString}' substitution...`)
95
95
 
96
96
  if (!substitutionUnified) {
97
97
  substitutionUnified = this.declarations.some((declaration) => {
98
- const substitutionUnified = declaration.unifySubstitution(substitution, localContext);
98
+ const substitutionUnified = declaration.unifySubstitution(substitution, context);
99
99
 
100
100
  if (substitutionUnified) {
101
101
  return true;
@@ -105,7 +105,7 @@ class Frame {
105
105
 
106
106
  if (!substitutionUnified) {
107
107
  substitutionUnified = this.metavariables.some((metavariable) => {
108
- const substitutionUnified = metavariable.unifySubstitution(substitution, localContext);
108
+ const substitutionUnified = metavariable.unifySubstitution(substitution, context);
109
109
 
110
110
  if (substitutionUnified) {
111
111
  return true;
@@ -114,22 +114,22 @@ class Frame {
114
114
  }
115
115
 
116
116
  if (substitutionUnified) {
117
- localContext.debug(`...unified the '${substitutionString}' substitution...`)
117
+ context.debug(`...unified the '${substitutionString}' substitution...`)
118
118
  }
119
119
 
120
120
  return substitutionUnified;
121
121
  }
122
122
 
123
- unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem, localContext) {
123
+ unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem, context) {
124
124
  let metaLemmaMetatheoremUnified;
125
125
 
126
126
  const metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
127
127
 
128
- localContext.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem...`);
128
+ context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem...`);
129
129
 
130
130
  const substitutions = metaLemmaMetatheorem.getSubstitutions(),
131
131
  substitutionsUnified = substitutions.everySubstitution((substitution) => {
132
- const substitutionUnified = this.unifySubstitution(substitution, localContext);
132
+ const substitutionUnified = this.unifySubstitution(substitution, context);
133
133
 
134
134
  if (substitutionUnified) {
135
135
  return true;
@@ -139,22 +139,22 @@ class Frame {
139
139
  metaLemmaMetatheoremUnified = substitutionsUnified; ///
140
140
 
141
141
  if (metaLemmaMetatheoremUnified) {
142
- localContext.debug(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem.`);
142
+ context.debug(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem.`);
143
143
  }
144
144
 
145
145
  return metaLemmaMetatheoremUnified;
146
146
  }
147
147
 
148
- unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, localContext) {
148
+ unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, context) {
149
149
  let axiomLemmaTheoremOrConjectureUnified;
150
150
 
151
151
  const axiomLemmaTheoremStringOrConjecture = axiomLemmaTheoremOrConjecture.getString();
152
152
 
153
- localContext.trace(`Unifying the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture...`);
153
+ context.trace(`Unifying the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture...`);
154
154
 
155
155
  const substitutions = axiomLemmaTheoremOrConjecture.getSubstitutions(),
156
156
  substitutionsUnified = substitutions.everySubstitution((substitution) => {
157
- const substitutionUnified = this.unifySubstitution(substitution, localContext);
157
+ const substitutionUnified = this.unifySubstitution(substitution, context);
158
158
 
159
159
  if (substitutionUnified) {
160
160
  return true;
@@ -164,28 +164,28 @@ class Frame {
164
164
  axiomLemmaTheoremOrConjectureUnified = substitutionsUnified; ///
165
165
 
166
166
  if (axiomLemmaTheoremOrConjectureUnified) {
167
- localContext.debug(`...unified the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture.`);
167
+ context.debug(`...unified the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture.`);
168
168
  }
169
169
 
170
170
  return axiomLemmaTheoremOrConjectureUnified;
171
171
  }
172
172
 
173
- verify(assignments, stated, localContext) {
173
+ verify(assignments, stated, context) {
174
174
  let verified = false;
175
175
 
176
176
  const frameString = this.string; ///
177
177
 
178
- localContext.trace(`Verifying the '${frameString}' frame...`);
178
+ context.trace(`Verifying the '${frameString}' frame...`);
179
179
 
180
180
  const declarationsVerified = this.declarations.every((declaration) => {
181
- const declarationVerified = declaration.verify(assignments, stated, localContext);
181
+ const declarationVerified = declaration.verify(assignments, stated, context);
182
182
 
183
183
  return declarationVerified;
184
184
  });
185
185
 
186
186
  if (declarationsVerified) {
187
187
  const metavariablesVerified = this.metavariables.every((metavariable) => {
188
- const metavariableVerified = metavariable.verify(localContext);
188
+ const metavariableVerified = metavariable.verify(context);
189
189
 
190
190
  return metavariableVerified;
191
191
  });
@@ -195,9 +195,9 @@ class Frame {
195
195
  verifiedWhenDerived = false;
196
196
 
197
197
  if (stated) {
198
- verifiedWhenStated = this.verifyWhenStated(assignments, localContext);
198
+ verifiedWhenStated = this.verifyWhenStated(assignments, context);
199
199
  } else {
200
- verifiedWhenDerived = this.verifyWhenDerived(assignments, localContext);
200
+ verifiedWhenDerived = this.verifyWhenDerived(assignments, context);
201
201
  }
202
202
 
203
203
  if (verifiedWhenStated || verifiedWhenDerived) {
@@ -207,80 +207,80 @@ class Frame {
207
207
  }
208
208
 
209
209
  if (verified) {
210
- localContext.debug(`...verified the '${frameString}' frame.`);
210
+ context.debug(`...verified the '${frameString}' frame.`);
211
211
  }
212
212
 
213
213
  return verified;
214
214
  }
215
215
 
216
- verifyWhenStated(assignments, localContext) {
216
+ verifyWhenStated(assignments, context) {
217
217
  let verifiedWhenStated = false;
218
218
 
219
219
  const frameString = this.string; ///
220
220
 
221
- localContext.trace(`Verifying the '${frameString}' frame when stated...`);
221
+ context.trace(`Verifying the '${frameString}' frame when stated...`);
222
222
 
223
223
  const declarationsLength = this.declarations.length;
224
224
 
225
225
  if (declarationsLength > 0) {
226
- localContext.trace(`The '${frameString}' stated frame cannot have declarations.`);
226
+ context.trace(`The '${frameString}' stated frame cannot have declarations.`);
227
227
  } else {
228
228
  const metavariablesLength = this.metavariables.length;
229
229
 
230
230
  if (metavariablesLength > 1) {
231
- localContext.trace(`The '${frameString}' stated frame cannot have more than one metavariable.`);
231
+ context.trace(`The '${frameString}' stated frame cannot have more than one metavariable.`);
232
232
  } else {
233
233
  verifiedWhenStated = true;
234
234
  }
235
235
  }
236
236
 
237
237
  if (verifiedWhenStated) {
238
- localContext.debug(`...verified the '${frameString}' frame when stated.`);
238
+ context.debug(`...verified the '${frameString}' frame when stated.`);
239
239
  }
240
240
 
241
241
  return verifiedWhenStated;
242
242
  }
243
243
 
244
- verifyWhenDerived(assignments, localContext) {
244
+ verifyWhenDerived(assignments, context) {
245
245
  let verifiedWhenDerived;
246
246
 
247
247
  const frameString = this.string; ///
248
248
 
249
- localContext.trace(`Verifying the '${frameString}' frame when derived...`);
249
+ context.trace(`Verifying the '${frameString}' frame when derived...`);
250
250
 
251
251
  verifiedWhenDerived = true;
252
252
 
253
253
  if (verifiedWhenDerived) {
254
- localContext.debug(`...verified the '${frameString}' frame when derived.`);
254
+ context.debug(`...verified the '${frameString}' frame when derived.`);
255
255
  }
256
256
 
257
257
  return verifiedWhenDerived;
258
258
  }
259
259
 
260
- verifyGivenMetaType(metaType, assignments, stated, localContext) {
260
+ verifyGivenMetaType(metaType, assignments, stated, context) {
261
261
  let verifiedGivenMetaType = false;
262
262
 
263
263
  const frameString = this.string, ///
264
264
  metaTypeString = metaType.getString();
265
265
 
266
- localContext.trace(`Verifying the '${frameString}' frame given the '${metaTypeString}' meta-type...`);
266
+ context.trace(`Verifying the '${frameString}' frame given the '${metaTypeString}' meta-type...`);
267
267
 
268
268
  const metaTypeName = metaType.getName();
269
269
 
270
270
  if (metaTypeName === FRAME_META_TYPE_NAME) {
271
- const verified = this.verify(assignments, stated, localContext)
271
+ const verified = this.verify(assignments, stated, context)
272
272
 
273
273
  verifiedGivenMetaType = verified; ///
274
274
  }
275
275
 
276
276
  if (verifiedGivenMetaType) {
277
- localContext.debug(`...verified the '${frameString}' frame given the '${metaTypeString}' meta-type.`);
277
+ context.debug(`...verified the '${frameString}' frame given the '${metaTypeString}' meta-type.`);
278
278
  }
279
279
 
280
280
  return verifiedGivenMetaType;
281
281
  }
282
282
 
283
- static fromFrameNode(frameNode, localContext) {
283
+ static fromFrameNode(frameNode, context) {
284
284
  let frame = null;
285
285
 
286
286
  if (frameNode !== null) {
@@ -288,17 +288,17 @@ class Frame {
288
288
  declarationNodes = declarationNodesQuery(frameNode),
289
289
  metavariableNodes = metavariableNodesQuery(frameNode),
290
290
  declarations = declarationNodes.map((declarationNode) => {
291
- const declaration = Declaration.fromDeclarationNode(declarationNode, localContext);
291
+ const declaration = Declaration.fromDeclarationNode(declarationNode, context);
292
292
 
293
293
  return declaration;
294
294
  }),
295
295
  metavariables = metavariableNodes.map((metavariableNode) => {
296
- const metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext);
296
+ const metavariable = Metavariable.fromMetavariableNode(metavariableNode, context);
297
297
 
298
298
  return metavariable;
299
299
  }),
300
300
  node = frameNode, ///
301
- string = localContext.nodeAsString(node);
301
+ string = context.nodeAsString(node);
302
302
 
303
303
  frame = new Frame(string, node, declarations, metavariables);
304
304
  }
@@ -306,7 +306,7 @@ class Frame {
306
306
  return frame;
307
307
  }
308
308
 
309
- static fromDefinedAssertionNode(definedAssertionNode, localContext) {
309
+ static fromDefinedAssertionNode(definedAssertionNode, context) {
310
310
  let frame = null;
311
311
 
312
312
  const frameNode = frameNodeQuery(definedAssertionNode);
@@ -316,13 +316,13 @@ class Frame {
316
316
 
317
317
  if (metavariableNode !== null) {
318
318
  const { Metavariable } = shim,
319
- metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
319
+ metavariable = Metavariable.fromMetavariableNode(metavariableNode, context),
320
320
  declarations = [],
321
321
  metavariables = [
322
322
  metavariable
323
323
  ],
324
324
  node = frameNode, ///
325
- string = localContext.nodeAsString(node);
325
+ string = context.nodeAsString(node);
326
326
 
327
327
  frame = new Frame(string, node, declarations, metavariables);
328
328
  }
@@ -331,7 +331,7 @@ class Frame {
331
331
  return frame;
332
332
  }
333
333
 
334
- static fromContainedAssertionNode(containedAssertionNode, localContext) {
334
+ static fromContainedAssertionNode(containedAssertionNode, context) {
335
335
  let frame = null;
336
336
 
337
337
  const frameNode = frameNodeQuery(containedAssertionNode);
@@ -341,13 +341,13 @@ class Frame {
341
341
 
342
342
  if (metavariableNode !== null) {
343
343
  const { Metavariable } = shim,
344
- metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
344
+ metavariable = Metavariable.fromMetavariableNode(metavariableNode, context),
345
345
  declarations = [],
346
346
  metavariables = [
347
347
  metavariable
348
348
  ],
349
349
  node = frameNode, ///
350
- string = localContext.nodeAsString(node);
350
+ string = context.nodeAsString(node);
351
351
 
352
352
  frame = new Frame(string, node, declarations, metavariables);
353
353
  }
package/src/index.js CHANGED
@@ -33,6 +33,7 @@ import Substitutions from "./substitutions";
33
33
  import SubDerivation from "./subDerivation";
34
34
  import QualifiedStatement from "./statement/qualified";
35
35
  import UnqualifiedStatement from "./statement/unqualified";
36
+ import StatementForMetavariableSubstitution from "./substitution/statementForMetavariable";
36
37
 
37
38
  export { default as Log } from "./log";
38
39
  export { default as ReleaseContext } from "./context/release";