occam-verify-cli 1.0.913 → 1.0.920
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.
- package/lib/context/bounded.js +1 -4
- package/lib/element/assertion/signature.js +37 -31
- package/lib/element/deduction.js +1 -14
- package/lib/element/proofAssertion/step.js +27 -40
- package/lib/element/signature.js +26 -59
- package/lib/element/subproof.js +1 -23
- package/lib/element/topLevelAssertion/axiom.js +71 -100
- package/lib/element/topLevelAssertion.js +13 -36
- package/lib/node/proofAssertion/step.js +5 -5
- package/lib/node/qualification.js +4 -4
- package/lib/node/statement.js +4 -4
- package/lib/process/unify.js +21 -5
- package/lib/utilities/context.js +6 -1
- package/lib/utilities/element.js +3 -3
- package/lib/utilities/equivalences.js +1 -13
- package/lib/utilities/unification.js +95 -116
- package/package.json +4 -4
- package/src/context/bounded.js +1 -3
- package/src/element/assertion/signature.js +47 -34
- package/src/element/deduction.js +0 -25
- package/src/element/proofAssertion/step.js +36 -59
- package/src/element/signature.js +37 -91
- package/src/element/subproof.js +0 -35
- package/src/element/topLevelAssertion/axiom.js +95 -131
- package/src/element/topLevelAssertion.js +11 -45
- package/src/node/proofAssertion/step.js +4 -4
- package/src/node/qualification.js +3 -3
- package/src/node/statement.js +3 -3
- package/src/process/unify.js +28 -3
- package/src/utilities/context.js +6 -0
- package/src/utilities/element.js +2 -2
- package/src/utilities/equivalences.js +0 -12
- package/src/utilities/unification.js +117 -145
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { asynchronousUtilities } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import TopLevelAssertion from "../topLevelAssertion";
|
|
6
6
|
|
|
7
7
|
import { define } from "../../elements";
|
|
8
|
+
import { join, reconcile } from "../../utilities/context";
|
|
8
9
|
|
|
9
|
-
const {
|
|
10
|
+
const { asyncMatch } = asynchronousUtilities;
|
|
10
11
|
|
|
11
12
|
export default define(class Axiom extends TopLevelAssertion {
|
|
12
13
|
getAxiomNode() {
|
|
@@ -73,173 +74,146 @@ export default define(class Axiom extends TopLevelAssertion {
|
|
|
73
74
|
return signatureVerifies;
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
let
|
|
77
|
+
unifySignature(signature, context) {
|
|
78
|
+
let signatureUnifies;
|
|
78
79
|
|
|
79
|
-
|
|
80
|
+
const axiomString = this.getString(), ///
|
|
81
|
+
signatureString = signature.getString();
|
|
80
82
|
|
|
81
|
-
|
|
82
|
-
axiomString = this.getString();
|
|
83
|
+
context.trace(`Unifying the '${signatureString}' signature with the '${axiomString}' axiom...`);
|
|
83
84
|
|
|
84
|
-
|
|
85
|
+
const specificSignature = signature; ///
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
signature = this.getSignature();
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const statement = step.getStatement(),
|
|
92
|
-
statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, context);
|
|
89
|
+
const generalSignature = signature, ///
|
|
90
|
+
specificContext = context, ///
|
|
91
|
+
generalContext = null;
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
stepUnifies = true;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
93
|
+
signatureUnifies = generalSignature.unifySignature(specificSignature, generalContext, specificContext);
|
|
98
94
|
|
|
99
|
-
if (
|
|
100
|
-
context.debug(`...unified the '${
|
|
95
|
+
if (signatureUnifies) {
|
|
96
|
+
context.debug(`...unified the '${signatureString}' signature with the '${axiomString}' axiom.`);
|
|
101
97
|
}
|
|
102
98
|
|
|
103
|
-
return
|
|
99
|
+
return signatureUnifies;
|
|
104
100
|
}
|
|
105
101
|
|
|
106
|
-
|
|
107
|
-
let
|
|
108
|
-
|
|
109
|
-
const axiomString = this.getString(), ///
|
|
110
|
-
subproofString = subproof.getString();
|
|
111
|
-
|
|
112
|
-
context.trace(`Unifying the '${subproofString}' subproof with the '${axiomString}' axiom...`);
|
|
102
|
+
async unifyDeduction(deduction, context) {
|
|
103
|
+
let deductionUnifies;
|
|
113
104
|
|
|
114
|
-
|
|
105
|
+
await this.break(context);
|
|
115
106
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
107
|
+
const axiomString = this.getString(), ///
|
|
108
|
+
generalDeduction = this.deduction, ///
|
|
109
|
+
specificDeduction = deduction, ///
|
|
110
|
+
generalDeductionString = generalDeduction.getString(),
|
|
111
|
+
specificDeductionString = specificDeduction.getString();
|
|
121
112
|
|
|
122
|
-
|
|
123
|
-
const suppositions = subproof.getSuppositions(),
|
|
124
|
-
suppositionsUnify = this.unifySuppositions(suppositions, context);
|
|
113
|
+
context.trace(`Unifying the '${specificDeductionString}' deduction with the '${axiomString}' axiom's '${generalDeductionString}' deduction...`);
|
|
125
114
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
115
|
+
const specificDeductionContext = specificDeduction.getContext(),
|
|
116
|
+
generalDeductionContext = generalDeduction.getContext(),
|
|
117
|
+
specificContext = specificDeductionContext, ///
|
|
118
|
+
generalContext = generalDeductionContext; ///
|
|
131
119
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
120
|
+
join((specificContext) => {
|
|
121
|
+
reconcile((specificContext) => {
|
|
122
|
+
let statement;
|
|
135
123
|
|
|
136
|
-
|
|
137
|
-
}
|
|
124
|
+
statement = specificDeduction.getStatement();
|
|
138
125
|
|
|
139
|
-
|
|
140
|
-
let deductionUnifies;
|
|
126
|
+
const specificStatement = statement; ///
|
|
141
127
|
|
|
142
|
-
|
|
128
|
+
statement = generalDeduction.getStatement();
|
|
143
129
|
|
|
144
|
-
|
|
130
|
+
const generalStatement = statement, ///
|
|
131
|
+
statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
|
|
145
132
|
|
|
146
|
-
|
|
133
|
+
if (statementUnifies) {
|
|
134
|
+
specificContext.commit();
|
|
147
135
|
|
|
148
|
-
|
|
136
|
+
deductionUnifies = true;
|
|
137
|
+
}
|
|
138
|
+
}, specificContext);
|
|
139
|
+
}, specificContext, context);
|
|
149
140
|
|
|
150
|
-
|
|
141
|
+
if (deductionUnifies) {
|
|
142
|
+
context.debug(`...unified the '${specificDeductionString}' deduction with the '${axiomString}' axiom's '${generalDeductionString}' deduction.`);
|
|
143
|
+
}
|
|
151
144
|
|
|
152
145
|
return deductionUnifies;
|
|
153
146
|
}
|
|
154
147
|
|
|
155
|
-
unifySupposition(supposition, index,
|
|
156
|
-
let suppositionUnifies;
|
|
148
|
+
async unifySupposition(supposition, index, context) {
|
|
149
|
+
let suppositionUnifies = false;
|
|
157
150
|
|
|
158
151
|
const specificSupposition = supposition; ///
|
|
159
152
|
|
|
160
153
|
supposition = this.getSupposition(index);
|
|
161
154
|
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
155
|
+
const axiomString = this.getString(), ///
|
|
156
|
+
generalSupposition = supposition, ///
|
|
157
|
+
generalSuppositionString = generalSupposition.getString(),
|
|
158
|
+
specificSuppositionString = specificSupposition.getString();
|
|
165
159
|
|
|
166
|
-
|
|
160
|
+
context.trace(`Unifying the '${specificSuppositionString}' supposition with the '${axiomString}' axiom's '${generalSuppositionString}' supposition...`);
|
|
167
161
|
|
|
168
|
-
|
|
169
|
-
|
|
162
|
+
const specificSuppositionContext = specificSupposition.getContext(),
|
|
163
|
+
generalSuppositionContext = generalSupposition.getContext(),
|
|
164
|
+
specificContext = specificSuppositionContext, ///
|
|
165
|
+
generalContext = generalSuppositionContext; ///
|
|
170
166
|
|
|
171
|
-
|
|
172
|
-
|
|
167
|
+
join((specificContext) => {
|
|
168
|
+
reconcile((specificContext) => {
|
|
169
|
+
let statement;
|
|
173
170
|
|
|
174
|
-
|
|
171
|
+
statement = specificSupposition.getStatement();
|
|
175
172
|
|
|
176
|
-
|
|
173
|
+
const specificStatement = statement; ///
|
|
177
174
|
|
|
178
|
-
|
|
179
|
-
generalSuppositionsLength = generalSuppositions.length,
|
|
180
|
-
specificSuppositionsLength = specificSuppositions.length;
|
|
175
|
+
statement = generalSupposition.getStatement();
|
|
181
176
|
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
const generalStatement = statement, ///
|
|
178
|
+
statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
|
|
184
179
|
|
|
185
|
-
|
|
186
|
-
|
|
180
|
+
if (statementUnifies) {
|
|
181
|
+
specificContext.commit();
|
|
187
182
|
|
|
188
|
-
|
|
189
|
-
return true;
|
|
183
|
+
suppositionUnifies = true;
|
|
190
184
|
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return suppositionsUnify;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
unifyLastStep(lastStep, context) {
|
|
198
|
-
let lastStepUnifies = false;
|
|
199
|
-
|
|
200
|
-
const axiomString = this.getString(), ///
|
|
201
|
-
lastStepString = lastStep.getString();
|
|
202
|
-
|
|
203
|
-
context.trace(`Unifying the '${lastStepString}' last step with the '${axiomString}' axiom...`);
|
|
204
|
-
|
|
205
|
-
const statement = lastStep.getStatement(),
|
|
206
|
-
statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, context);
|
|
185
|
+
}, specificContext);
|
|
186
|
+
}, specificContext, context);
|
|
207
187
|
|
|
208
|
-
if (
|
|
209
|
-
|
|
188
|
+
if (suppositionUnifies) {
|
|
189
|
+
context.debug(`...unified the '${specificSuppositionString}' supposition with the '${axiomString}' axiom's '${generalSuppositionString}' supposition...`);
|
|
210
190
|
}
|
|
211
191
|
|
|
212
|
-
|
|
213
|
-
context.debug(`...unified the '${lastStepString}' last step with the '${axiomString}' axiom.`);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return lastStepUnifies;
|
|
192
|
+
return suppositionUnifies;
|
|
217
193
|
}
|
|
218
194
|
|
|
219
|
-
|
|
220
|
-
let
|
|
221
|
-
|
|
222
|
-
const axiomString = this.getString(), ///
|
|
223
|
-
signatureString = signature.getString();
|
|
224
|
-
|
|
225
|
-
context.trace(`Unifying the '${signatureString}' signature with the '${axiomString}' axiom...`);
|
|
195
|
+
async unifySuppositions(suppositions, context) {
|
|
196
|
+
let suppositionsUnify;
|
|
226
197
|
|
|
227
|
-
const
|
|
198
|
+
const specificSuppositions = suppositions; ///
|
|
228
199
|
|
|
229
|
-
|
|
200
|
+
suppositions = this.getSuppositions();
|
|
230
201
|
|
|
231
|
-
const
|
|
202
|
+
const generalSuppositions = suppositions; ///
|
|
232
203
|
|
|
233
|
-
|
|
204
|
+
suppositionsUnify = await asyncMatch(generalSuppositions, specificSuppositions, async (generalSupposition, specificSupposition, index) => {
|
|
205
|
+
const supposition = specificSupposition, ///
|
|
206
|
+
suppositionUnifies = await this.unifySupposition(supposition, index, context);
|
|
234
207
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
208
|
+
if (suppositionUnifies) {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
238
212
|
|
|
239
|
-
return
|
|
213
|
+
return suppositionsUnify;
|
|
240
214
|
}
|
|
241
215
|
|
|
242
|
-
unifyTopLevelAssertion(topLevelAssertion, context) {
|
|
216
|
+
async unifyTopLevelAssertion(topLevelAssertion, context) {
|
|
243
217
|
let topLevelAssertionUnifies = false;
|
|
244
218
|
|
|
245
219
|
const axiomString = this.getString(), ///
|
|
@@ -247,25 +221,15 @@ export default define(class Axiom extends TopLevelAssertion {
|
|
|
247
221
|
|
|
248
222
|
context.trace(`Unifying the '${topLevelAssertionString}' top level assertion with the '${axiomString}' axiom...`);
|
|
249
223
|
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
if (hypothesesCorrelate) {
|
|
253
|
-
const specificContext = context; ///
|
|
254
|
-
|
|
255
|
-
context = this.getContext();
|
|
256
|
-
|
|
257
|
-
const generalContext = context; ///
|
|
258
|
-
|
|
259
|
-
context = specificContext; ///
|
|
260
|
-
|
|
261
|
-
const deduction = topLevelAssertion.getDeduction(),
|
|
262
|
-
deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
|
|
224
|
+
const deduction = topLevelAssertion.getDeduction(),
|
|
225
|
+
deductionUnifies = await this.unifyDeduction(deduction, context);
|
|
263
226
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
227
|
+
if (deductionUnifies) {
|
|
228
|
+
const suppositions = topLevelAssertion.getSuppositions(),
|
|
229
|
+
suppositionsUnify = await this.unifySuppositions(suppositions, context);
|
|
267
230
|
|
|
268
|
-
|
|
231
|
+
if (suppositionsUnify) {
|
|
232
|
+
topLevelAssertionUnifies = true;
|
|
269
233
|
}
|
|
270
234
|
}
|
|
271
235
|
|
|
@@ -16,7 +16,7 @@ import { labelsFromJSON,
|
|
|
16
16
|
hypothesesToHypothesesJSON,
|
|
17
17
|
suppositionsToSuppositionsJSON } from "../utilities/json";
|
|
18
18
|
|
|
19
|
-
const { reverse
|
|
19
|
+
const { reverse } = arrayUtilities,
|
|
20
20
|
{ asyncExtract, asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
|
|
21
21
|
|
|
22
22
|
export default class TopLevelAssertion extends Element {
|
|
@@ -91,35 +91,6 @@ export default class TopLevelAssertion extends Element {
|
|
|
91
91
|
return metavariableNodeMatches;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
correlateHypotheses(context) {
|
|
95
|
-
let correlatesToHypotheses;
|
|
96
|
-
|
|
97
|
-
const hypothetical = this.isHypothetical();
|
|
98
|
-
|
|
99
|
-
if (hypothetical) {
|
|
100
|
-
const proofAssertions = context.getProofAssertions(),
|
|
101
|
-
topLevelAssertionString = this.getString(); ///
|
|
102
|
-
|
|
103
|
-
context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}' top level assertion...`);
|
|
104
|
-
|
|
105
|
-
correlatesToHypotheses = correlate(this.hypotheses, proofAssertions, (hypothesis, proofAssertion) => {
|
|
106
|
-
const hypothesesComparesToStep = hypothesis.compareProofAssertion(proofAssertion, context);
|
|
107
|
-
|
|
108
|
-
if (hypothesesComparesToStep) {
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
if (correlatesToHypotheses) {
|
|
114
|
-
context.debug(`...correlated the hypotheses of the '${topLevelAssertionString}' top level assertion.`);
|
|
115
|
-
}
|
|
116
|
-
} else {
|
|
117
|
-
correlatesToHypotheses = true
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return correlatesToHypotheses;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
94
|
async verify(context) {
|
|
124
95
|
let verifies = false;
|
|
125
96
|
|
|
@@ -285,19 +256,18 @@ export default class TopLevelAssertion extends Element {
|
|
|
285
256
|
await this.break(context);
|
|
286
257
|
|
|
287
258
|
const stepString = step.getString(),
|
|
288
|
-
deductionString = this.deduction.getString(),
|
|
289
259
|
topLevelAssertionString = this.getString(); ///
|
|
290
260
|
|
|
291
|
-
context.trace(`Unifying the '${stepString}' step with the '${topLevelAssertionString}' top level assertion's
|
|
261
|
+
context.trace(`Unifying the '${stepString}' step with the '${topLevelAssertionString}' top level assertion's deduction...`);
|
|
292
262
|
|
|
293
|
-
const stepUnifies =
|
|
263
|
+
const stepUnifies = this.deduction.unifyStep(step, context);
|
|
294
264
|
|
|
295
265
|
if (stepUnifies) {
|
|
296
266
|
stepUnifiesWithDeduction = true;
|
|
297
267
|
}
|
|
298
268
|
|
|
299
269
|
if (stepUnifiesWithDeduction) {
|
|
300
|
-
context.debug(`...unified the '${stepString}' step with the '${topLevelAssertionString}' top level assertion's
|
|
270
|
+
context.debug(`...unified the '${stepString}' step with the '${topLevelAssertionString}' top level assertion's deduction.`);
|
|
301
271
|
}
|
|
302
272
|
|
|
303
273
|
return stepUnifiesWithDeduction;
|
|
@@ -306,20 +276,16 @@ export default class TopLevelAssertion extends Element {
|
|
|
306
276
|
async unifyStepAndSubproofOrProofAssertions(step, subproofOrProofAssertions, context) {
|
|
307
277
|
let stepAndSubproofOrProofAssertionsUnify = false;
|
|
308
278
|
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
if (correlatesToHypotheses) {
|
|
312
|
-
const stepUnifiesWithDeduction = await this.unifyStepWithDeduction(step, context);
|
|
279
|
+
const stepUnifiesWithDeduction = await this.unifyStepWithDeduction(step, context);
|
|
313
280
|
|
|
314
|
-
|
|
315
|
-
|
|
281
|
+
if (stepUnifiesWithDeduction) {
|
|
282
|
+
const subproofOrProofAssertionsUnifiesWithSuppositions = await this.unifySubproofOrProofAssertionsWithSuppositions(subproofOrProofAssertions, context);
|
|
316
283
|
|
|
317
|
-
|
|
318
|
-
|
|
284
|
+
if (subproofOrProofAssertionsUnifiesWithSuppositions) {
|
|
285
|
+
const derivedSubstitutionsResolved = context.areDerivedSubstitutionsResolved();
|
|
319
286
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}
|
|
287
|
+
if (derivedSubstitutionsResolved) {
|
|
288
|
+
stepAndSubproofOrProofAssertionsUnify = true;
|
|
323
289
|
}
|
|
324
290
|
}
|
|
325
291
|
}
|
|
@@ -29,16 +29,16 @@ export default class StepNode extends ProofAssertionNode {
|
|
|
29
29
|
return referenceNode;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
let
|
|
32
|
+
getSignatureAssertionNode() {
|
|
33
|
+
let signatureAssertionNode = null;
|
|
34
34
|
|
|
35
35
|
const qualificationNode = this.getQualificationNode();
|
|
36
36
|
|
|
37
37
|
if (qualificationNode !== null) {
|
|
38
|
-
|
|
38
|
+
signatureAssertionNode = qualificationNode.getSignatureAssertionNode();
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
return
|
|
41
|
+
return signatureAssertionNode;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
getQualificationNode() {
|
|
@@ -12,11 +12,11 @@ export default class QualificationNode extends NonTerminalNode {
|
|
|
12
12
|
return referenceNode;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
getSignatureAssertionNode() {
|
|
16
16
|
const ruleName = SIGNATURE_ASSERTION_RULE_NAME,
|
|
17
|
-
|
|
17
|
+
signatureAssertionNode = this.getNodeByRuleName(ruleName);
|
|
18
18
|
|
|
19
|
-
return
|
|
19
|
+
return signatureAssertionNode;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(QualificationNode, ruleName, childNodes, opacity, precedence); }
|
package/src/node/statement.js
CHANGED
|
@@ -135,11 +135,11 @@ export default class StatementNode extends NonTerminalNode {
|
|
|
135
135
|
return containedAssertionNode;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
getSignatureAssertionNode() {
|
|
139
139
|
const ruleName = SIGNATURE_ASSERTION_RULE_NAME,
|
|
140
|
-
|
|
140
|
+
signatureAssertionNode = this.getNodeByRuleName(ruleName);
|
|
141
141
|
|
|
142
|
-
return
|
|
142
|
+
return signatureAssertionNode;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
getSingularMetavariableNode() {
|
package/src/process/unify.js
CHANGED
|
@@ -13,13 +13,14 @@ const typeNodeQuery = nodeQuery("/type"),
|
|
|
13
13
|
termNodeQuery = nodeQuery("/term"),
|
|
14
14
|
frameNodeQuery = nodeQuery("/frame"),
|
|
15
15
|
metaTypeNodeQuery = nodeQuery("/metaType"),
|
|
16
|
+
signatureNodeQuery = nodeQuery("/signature"),
|
|
16
17
|
statementNodeQuery = nodeQuery("/statement"),
|
|
17
18
|
termVariableNodeQuery = nodeQuery("/term/variable!"),
|
|
18
19
|
frameMetavariableNodeQuery = nodeQuery("/frame/metavariable!"),
|
|
19
20
|
statementMetavariableNodeQuery = nodeQuery("/statement/metavariable!"),
|
|
20
21
|
assumptionMetavariableNodeQuery = nodeQuery("/assumption/metavariable!");
|
|
21
22
|
|
|
22
|
-
class
|
|
23
|
+
class MetaLevelPass extends ZipPassBase {
|
|
23
24
|
static maps = [
|
|
24
25
|
{
|
|
25
26
|
generalNodeQuery: assumptionMetavariableNodeQuery,
|
|
@@ -141,6 +142,30 @@ class StatementPass extends ZipPassBase {
|
|
|
141
142
|
success = true;
|
|
142
143
|
}
|
|
143
144
|
|
|
145
|
+
return success;
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
generalNodeQuery: signatureNodeQuery,
|
|
150
|
+
specificNodeQuery: signatureNodeQuery,
|
|
151
|
+
run: (generalSignatureNode, specificSignatureNode, generalContext, specificContext) => {
|
|
152
|
+
let success = false;
|
|
153
|
+
|
|
154
|
+
let context;
|
|
155
|
+
|
|
156
|
+
context = generalContext; ///
|
|
157
|
+
|
|
158
|
+
const generalSignature = context.findSignatureBySignatureNode(generalSignatureNode);
|
|
159
|
+
|
|
160
|
+
context = specificContext; ///
|
|
161
|
+
|
|
162
|
+
const specificSignature = context.findSignatureBySignatureNode(specificSignatureNode),
|
|
163
|
+
signatureUnifies = generalSignature.unifySignature(specificSignature, generalContext, specificContext);
|
|
164
|
+
|
|
165
|
+
if (signatureUnifies) {
|
|
166
|
+
success = true;
|
|
167
|
+
}
|
|
168
|
+
|
|
144
169
|
return success;
|
|
145
170
|
}
|
|
146
171
|
}
|
|
@@ -434,7 +459,7 @@ class IntrinsicMetavariablePass extends ZipPass {
|
|
|
434
459
|
];
|
|
435
460
|
}
|
|
436
461
|
|
|
437
|
-
const
|
|
462
|
+
const metaLevelPass = new MetaLevelPass(),
|
|
438
463
|
combinatorPass = new CombinatorPass(),
|
|
439
464
|
constructorPass = new ConstructorPass(),
|
|
440
465
|
metavariablePass = new MetavariablePass(),
|
|
@@ -449,7 +474,7 @@ export function unifyStatement(generalStatement, specificStatement, generalConte
|
|
|
449
474
|
specificStatementNode = specificStatement.getNode(),
|
|
450
475
|
generalNode = generalStatementNode, ///
|
|
451
476
|
specificNode = specificStatementNode, ///
|
|
452
|
-
success =
|
|
477
|
+
success = metaLevelPass.run(generalNode, specificNode, generalContext, specificContext);
|
|
453
478
|
|
|
454
479
|
if (success) {
|
|
455
480
|
statementUnifies = true;
|
package/src/utilities/context.js
CHANGED
|
@@ -16,6 +16,12 @@ import NominalFileContext from "../context/file/nominal";
|
|
|
16
16
|
import { mnemicContextFromJSON, mnemicContextsFromJSON, mnemicContextToMnemicContextJSON, mnemicContextsToMnemicContextsJSON } from "../utilities/json";
|
|
17
17
|
|
|
18
18
|
export function join(innerFunction, ...contexts) {
|
|
19
|
+
contexts = contexts.filter((context) => {
|
|
20
|
+
if (context !== null) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
19
25
|
const synopticContext = SynopticContext.fromContexts(contexts),
|
|
20
26
|
context = synopticContext; ///
|
|
21
27
|
|
package/src/utilities/element.js
CHANGED
|
@@ -1556,7 +1556,7 @@ export function termFromPropertyAssertionNode(propertyAssertionNode, context) {
|
|
|
1556
1556
|
export function signatureAssertionFromStepNode(stepNode, context) {
|
|
1557
1557
|
let signatureAssertion = null;
|
|
1558
1558
|
|
|
1559
|
-
const signatureAssertionNode = stepNode.
|
|
1559
|
+
const signatureAssertionNode = stepNode.getSignatureAssertionNode();
|
|
1560
1560
|
|
|
1561
1561
|
if (signatureAssertionNode !== null) {
|
|
1562
1562
|
signatureAssertion = signatureAssertionFromSignatureAssertionNode(signatureAssertionNode, context);
|
|
@@ -1841,7 +1841,7 @@ export function containedAssertionFromStatementNode(statementNode, context) {0
|
|
|
1841
1841
|
export function signatureAssertionFromStatementNode(statementNode, context) {
|
|
1842
1842
|
let signatureAssertion = null;
|
|
1843
1843
|
|
|
1844
|
-
const signatureAssertionNode = statementNode.
|
|
1844
|
+
const signatureAssertionNode = statementNode.getSignatureAssertionNode();
|
|
1845
1845
|
|
|
1846
1846
|
if (signatureAssertionNode !== null) {
|
|
1847
1847
|
signatureAssertion = signatureAssertionFromSignatureAssertionNode(signatureAssertionNode, context);
|
|
@@ -20,18 +20,6 @@ export function mergeEquivalences(equivalencesA, equivalencesB, context) {
|
|
|
20
20
|
return equivalencesA;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export function findEquivalenceByTerm(equivalences, term) {
|
|
24
|
-
const equivalence = equivalences.find((equivalence) => {
|
|
25
|
-
const equivalenceEqualToTerm = equivalence.isEqualTo(term);
|
|
26
|
-
|
|
27
|
-
if (equivalenceEqualToTerm) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
}) || null;
|
|
31
|
-
|
|
32
|
-
return equivalence;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
23
|
export function equivalencesFromEquality(equality, context) {
|
|
36
24
|
const { Equivalence } = elements,
|
|
37
25
|
eaulivalence = Equivalence.fromEquality(equality, context),
|