occam-verify-cli 1.0.809 → 1.0.814
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 +6 -6
- package/lib/context/branching.js +3 -3
- package/lib/context/ephemeral.js +3 -3
- package/lib/context/file/nominal.js +16 -16
- package/lib/context/liminal.js +26 -30
- package/lib/context/synoptic.js +62 -2
- package/lib/context.js +66 -54
- package/lib/element/assertion/defined.js +8 -8
- package/lib/element/assertion/satisfies.js +15 -11
- package/lib/element/assertion.js +5 -5
- package/lib/element/assumption/metaLevel.js +3 -3
- package/lib/element/conclusion.js +11 -8
- package/lib/element/deduction.js +11 -8
- package/lib/element/frame.js +6 -14
- package/lib/element/label.js +5 -8
- package/lib/element/metavariable.js +17 -17
- package/lib/element/procedureCall.js +10 -6
- package/lib/element/proofAssertion/premise.js +27 -27
- package/lib/element/proofAssertion/step.js +25 -5
- package/lib/element/proofAssertion/supposition.js +27 -27
- package/lib/element/proofAssertion.js +10 -10
- package/lib/element/reference.js +9 -13
- package/lib/element/rule.js +41 -43
- package/lib/element/signature.js +4 -4
- package/lib/element/statement.js +35 -45
- package/lib/element/subproof.js +4 -4
- package/lib/element/substitution/frame.js +16 -11
- package/lib/element/substitution/reference.js +15 -10
- package/lib/element/substitution/statement.js +55 -51
- package/lib/element/substitution/term.js +15 -10
- package/lib/element/substitution.js +29 -31
- package/lib/element/term.js +1 -16
- package/lib/element/topLevelAssertion/axiom.js +5 -3
- package/lib/element/topLevelAssertion.js +36 -38
- package/lib/element/variable.js +6 -6
- package/lib/node/frame.js +1 -9
- package/lib/node/statement.js +1 -9
- package/lib/node/term.js +1 -19
- package/lib/process/assign.js +23 -31
- package/lib/utilities/element.js +33 -5
- package/lib/utilities/equivalence.js +4 -4
- package/lib/utilities/equivalences.js +28 -13
- package/lib/utilities/string.js +2 -2
- package/lib/utilities/substitutions.js +16 -15
- package/lib/utilities/unification.js +133 -124
- package/package.json +1 -1
- package/src/context/bounded.js +5 -5
- package/src/context/branching.js +2 -2
- package/src/context/ephemeral.js +2 -2
- package/src/context/file/nominal.js +15 -15
- package/src/context/liminal.js +29 -35
- package/src/context/synoptic.js +81 -1
- package/src/context.js +88 -69
- package/src/element/assertion/defined.js +8 -8
- package/src/element/assertion/satisfies.js +17 -10
- package/src/element/assertion.js +8 -8
- package/src/element/assumption/metaLevel.js +4 -2
- package/src/element/conclusion.js +12 -7
- package/src/element/deduction.js +12 -7
- package/src/element/frame.js +7 -20
- package/src/element/label.js +3 -5
- package/src/element/metavariable.js +27 -27
- package/src/element/procedureCall.js +14 -9
- package/src/element/proofAssertion/premise.js +41 -41
- package/src/element/proofAssertion/step.js +37 -7
- package/src/element/proofAssertion/supposition.js +41 -41
- package/src/element/proofAssertion.js +10 -9
- package/src/element/reference.js +9 -13
- package/src/element/rule.js +57 -61
- package/src/element/signature.js +3 -3
- package/src/element/statement.js +54 -68
- package/src/element/subproof.js +3 -3
- package/src/element/substitution/frame.js +18 -8
- package/src/element/substitution/reference.js +16 -7
- package/src/element/substitution/statement.js +78 -67
- package/src/element/substitution/term.js +15 -6
- package/src/element/substitution.js +38 -41
- package/src/element/term.js +0 -26
- package/src/element/topLevelAssertion/axiom.js +5 -2
- package/src/element/topLevelAssertion.js +49 -53
- package/src/element/variable.js +5 -5
- package/src/node/frame.js +0 -12
- package/src/node/statement.js +0 -12
- package/src/node/term.js +0 -28
- package/src/process/assign.js +35 -46
- package/src/utilities/element.js +32 -4
- package/src/utilities/equivalence.js +3 -4
- package/src/utilities/equivalences.js +29 -17
- package/src/utilities/string.js +2 -2
- package/src/utilities/substitutions.js +17 -15
- package/src/utilities/unification.js +145 -119
|
@@ -158,6 +158,47 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
158
158
|
return suppositionUnifies;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
async unifyIndependently(context) {
|
|
162
|
+
let unifiesIndependently = false;
|
|
163
|
+
|
|
164
|
+
const suppositionString = this.getString(); ///
|
|
165
|
+
|
|
166
|
+
context.trace(`Unifying the '${suppositionString}' supposition independently...`);
|
|
167
|
+
|
|
168
|
+
const statement = this.getStatement(),
|
|
169
|
+
procedureCall = this.getProcedureCall();
|
|
170
|
+
|
|
171
|
+
if (statement !== null) {
|
|
172
|
+
const specificContext = context; ///
|
|
173
|
+
|
|
174
|
+
context = this.getContext();
|
|
175
|
+
|
|
176
|
+
const generalContext = context; ///
|
|
177
|
+
|
|
178
|
+
context = specificContext; ///
|
|
179
|
+
|
|
180
|
+
const statementUnifiesIndependently = statement.unifyIndependently(generalContext, specificContext);
|
|
181
|
+
|
|
182
|
+
if (statementUnifiesIndependently) {
|
|
183
|
+
unifiesIndependently = true;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (procedureCall !== null) {
|
|
188
|
+
const procedureCallResolvedIndependently = await procedureCall.unifyIndependently(context);
|
|
189
|
+
|
|
190
|
+
if (procedureCallResolvedIndependently) {
|
|
191
|
+
unifiesIndependently = true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (unifiesIndependently) {
|
|
196
|
+
context.debug(`...unified the '${suppositionString}' supposition independenly.`);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return unifiesIndependently;
|
|
200
|
+
}
|
|
201
|
+
|
|
161
202
|
unifySubproofOrProofAssertion(subproofOrProofAssertion, context) {
|
|
162
203
|
let subproofOrProofAssertionUnifies;
|
|
163
204
|
|
|
@@ -265,47 +306,6 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
265
306
|
return subproofUnifies;
|
|
266
307
|
}
|
|
267
308
|
|
|
268
|
-
async unifyIndependently(context) {
|
|
269
|
-
let unifiesIndependently = false;
|
|
270
|
-
|
|
271
|
-
const suppositionString = this.getString(); ///
|
|
272
|
-
|
|
273
|
-
context.trace(`Unifying the '${suppositionString}' supposition independently...`);
|
|
274
|
-
|
|
275
|
-
const statement = this.getStatement(),
|
|
276
|
-
procedureCall = this.getProcedureCall();
|
|
277
|
-
|
|
278
|
-
if (statement !== null) {
|
|
279
|
-
const specificContext = context; ///
|
|
280
|
-
|
|
281
|
-
context = this.getContext();
|
|
282
|
-
|
|
283
|
-
const generalContext = context; ///
|
|
284
|
-
|
|
285
|
-
context = specificContext; ///
|
|
286
|
-
|
|
287
|
-
const statementUnifiesIndependently = statement.unifyIndependently(generalContext, specificContext);
|
|
288
|
-
|
|
289
|
-
if (statementUnifiesIndependently) {
|
|
290
|
-
unifiesIndependently = true;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
if (procedureCall !== null) {
|
|
295
|
-
const procedureCallResolvedIndependently = await procedureCall.unifyIndependently(context);
|
|
296
|
-
|
|
297
|
-
if (procedureCallResolvedIndependently) {
|
|
298
|
-
unifiesIndependently = true;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
if (unifiesIndependently) {
|
|
303
|
-
context.debug(`...unified the '${suppositionString}' supposition independenly.`);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
return unifiesIndependently;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
309
|
toJSON() {
|
|
310
310
|
const context = this.getContext();
|
|
311
311
|
|
|
@@ -28,27 +28,28 @@ export default class ProofAssertion extends Element {
|
|
|
28
28
|
return proofAssertion;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
let
|
|
31
|
+
compareStep(step, context) {
|
|
32
|
+
let comparesToStep = false;
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const stepString = step.getString(),
|
|
35
35
|
proofAssertionString = this.getString(); ///
|
|
36
36
|
|
|
37
|
-
context.trace(`Comparing the '${
|
|
37
|
+
context.trace(`Comparing the '${stepString}' step to the '${proofAssertionString}' proof assertion...`);
|
|
38
38
|
|
|
39
|
-
const
|
|
39
|
+
const statement = step.getStatement(),
|
|
40
|
+
leftStatement = statement, ///
|
|
40
41
|
rightStatement = this.statement, ///
|
|
41
42
|
statementsEquate = equateStatements(leftStatement, rightStatement, context);
|
|
42
43
|
|
|
43
44
|
if (statementsEquate) {
|
|
44
|
-
|
|
45
|
+
comparesToStep = true;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
if (
|
|
48
|
-
context.debug(`...compared the '${
|
|
48
|
+
if (comparesToStep) {
|
|
49
|
+
context.debug(`...compared the '${stepString}' step to the '${proofAssertionString}' proof assertion.`);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
return
|
|
52
|
+
return comparesToStep;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
unifyStatement(statement, generalContext, specificContext) {
|
package/src/element/reference.js
CHANGED
|
@@ -32,12 +32,6 @@ export default define(class Reference extends Element {
|
|
|
32
32
|
return referenceNode;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
getMetavariableName() {
|
|
36
|
-
const metavariableName = this.metavariable.getName();
|
|
37
|
-
|
|
38
|
-
return metavariableName;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
35
|
getMetavariableNode() {
|
|
42
36
|
const metavariableNode = this.metavariable.getNode();
|
|
43
37
|
|
|
@@ -65,13 +59,17 @@ export default define(class Reference extends Element {
|
|
|
65
59
|
compareParameter(parameter) {
|
|
66
60
|
let comparesToParamter = false;
|
|
67
61
|
|
|
68
|
-
const
|
|
62
|
+
const singular = this.isSingular();
|
|
69
63
|
|
|
70
|
-
if (
|
|
71
|
-
const
|
|
64
|
+
if (singular) {
|
|
65
|
+
const parameterName = parameter.getName();
|
|
72
66
|
|
|
73
|
-
if (parameterName
|
|
74
|
-
|
|
67
|
+
if (parameterName !== null) {
|
|
68
|
+
const metavariableName = this.getMetavariableName();
|
|
69
|
+
|
|
70
|
+
if (parameterName === metavariableName) {
|
|
71
|
+
comparesToParamter = true;
|
|
72
|
+
}
|
|
75
73
|
}
|
|
76
74
|
}
|
|
77
75
|
|
|
@@ -98,8 +96,6 @@ export default define(class Reference extends Element {
|
|
|
98
96
|
return comparesToMetavariable;
|
|
99
97
|
}
|
|
100
98
|
|
|
101
|
-
compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
|
|
102
|
-
|
|
103
99
|
compareTopLevelMetaAssertion(topLevelMetaAssertion) {
|
|
104
100
|
let topLevelMetaAssertionCompares = false;
|
|
105
101
|
|
package/src/element/rule.js
CHANGED
|
@@ -7,8 +7,8 @@ import { define } from "../elements";
|
|
|
7
7
|
import { enclose } from "../utilities/context";
|
|
8
8
|
import { labelsFromJSON, premisesFromJSON, conclusionFromJSON, labelsToLabelsJSON, premisesToPremisesJSON, conclusionToConclusionJSON } from "../utilities/json";
|
|
9
9
|
|
|
10
|
-
const { reverse
|
|
11
|
-
{ asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
|
|
10
|
+
const { reverse } = arrayUtilities,
|
|
11
|
+
{ asyncExtract, asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
|
|
12
12
|
|
|
13
13
|
export default define(class Rule extends Element {
|
|
14
14
|
constructor(context, string, node, proof, labels, premises, conclusion) {
|
|
@@ -43,38 +43,16 @@ export default define(class Rule extends Element {
|
|
|
43
43
|
return ruleNode;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
const
|
|
46
|
+
matchMetavariableNode(metavariableNode) {
|
|
47
|
+
const metavariableNodeMatches = this.labels.some((label) => {
|
|
48
|
+
const metavariableNodeMatches = label.matchMetavariableNode(metavariableNode);
|
|
49
49
|
|
|
50
|
-
if (
|
|
50
|
+
if (metavariableNodeMatches) {
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
unifyStatementWithConclusion(statement, context) {
|
|
59
|
-
let statementUnifiesWithConclusion = false;
|
|
60
|
-
|
|
61
|
-
const ruleString = this.getString(),
|
|
62
|
-
statementString = statement.getString(),
|
|
63
|
-
conclusionString = this.conclusion.getString();
|
|
64
|
-
|
|
65
|
-
context.trace(`Unifying the '${statementString}' statement with the '${ruleString}' rule's '${conclusionString}' conclusion...`);
|
|
66
|
-
|
|
67
|
-
const statementUnifies = this.conclusion.unifyStatement(statement, context);
|
|
68
|
-
|
|
69
|
-
if (statementUnifies) {
|
|
70
|
-
statementUnifiesWithConclusion = true;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (statementUnifiesWithConclusion) {
|
|
74
|
-
context.debug(`...unified the '${statementString}' statement with the '${ruleString}' rule's '${conclusionString}' conclusion.`);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return statementUnifiesWithConclusion;
|
|
55
|
+
return metavariableNodeMatches;
|
|
78
56
|
}
|
|
79
57
|
|
|
80
58
|
async verify() {
|
|
@@ -246,59 +224,61 @@ export default define(class Rule extends Element {
|
|
|
246
224
|
return conclusionVerifies;
|
|
247
225
|
}
|
|
248
226
|
|
|
249
|
-
async
|
|
250
|
-
let
|
|
227
|
+
async unifyStepWithConclusion(step, context) {
|
|
228
|
+
let stepUnifiesWithConclusion = false;
|
|
251
229
|
|
|
252
|
-
|
|
230
|
+
await this.break(context);
|
|
253
231
|
|
|
254
|
-
|
|
255
|
-
|
|
232
|
+
const ruleString = this.getString(),
|
|
233
|
+
stepString = step.getString(),
|
|
234
|
+
conclusionString = this.conclusion.getString();
|
|
256
235
|
|
|
257
|
-
|
|
258
|
-
const substitutionsResolved = context.areSubstitutionsResolved();
|
|
236
|
+
context.trace(`Unifying the '${stepString}' step with the '${ruleString}' rule's '${conclusionString}' conclusion...`);
|
|
259
237
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
238
|
+
const stepUnifies = this.conclusion.unifyStep(step, context);
|
|
239
|
+
|
|
240
|
+
if (stepUnifies) {
|
|
241
|
+
stepUnifiesWithConclusion = true;
|
|
264
242
|
}
|
|
265
243
|
|
|
266
|
-
|
|
244
|
+
if (stepUnifiesWithConclusion) {
|
|
245
|
+
context.debug(`...unified the '${stepString}' step with the '${ruleString}' rule's '${conclusionString}' conclusion.`);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return stepUnifiesWithConclusion;
|
|
267
249
|
}
|
|
268
250
|
|
|
269
|
-
async
|
|
270
|
-
let
|
|
251
|
+
async unifyStepAndSubproofOrProofAssertions(step, subproofOrProofAssertions, context) {
|
|
252
|
+
let stepAndSubproofOrProofAssertionsUnify = false;
|
|
271
253
|
|
|
272
|
-
|
|
254
|
+
const statementUnifiesWithConclusion = await this.unifyStepWithConclusion(step, context);
|
|
273
255
|
|
|
274
|
-
|
|
275
|
-
const
|
|
256
|
+
if (statementUnifiesWithConclusion) {
|
|
257
|
+
const subproofOrProofAssertionsUnifiesWithPremises = await this.unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context);
|
|
276
258
|
|
|
277
|
-
if (
|
|
278
|
-
|
|
259
|
+
if (subproofOrProofAssertionsUnifiesWithPremises) {
|
|
260
|
+
const substitutionsResolved = context.areSubstitutionsResolved();
|
|
261
|
+
|
|
262
|
+
if (substitutionsResolved) {
|
|
263
|
+
stepAndSubproofOrProofAssertionsUnify = true;
|
|
264
|
+
}
|
|
279
265
|
}
|
|
280
|
-
}
|
|
266
|
+
}
|
|
281
267
|
|
|
282
|
-
return
|
|
268
|
+
return stepAndSubproofOrProofAssertionsUnify;
|
|
283
269
|
}
|
|
284
270
|
|
|
285
271
|
async unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context) {
|
|
286
272
|
let subproofOrProofAssertionsUnifiesWithPremise = false;
|
|
287
273
|
|
|
274
|
+
await this.break(context);
|
|
275
|
+
|
|
288
276
|
if (!subproofOrProofAssertionsUnifiesWithPremise) {
|
|
289
|
-
const subproofOrProofAssertion =
|
|
290
|
-
const subproofOrProofAssertionUnifies = premise.unifySubproofOrProofAssertion(subproofOrProofAssertion, context);
|
|
277
|
+
const subproofOrProofAssertion = await asyncExtract(subproofOrProofAssertions, async (subproofOrProofAssertion) => {
|
|
278
|
+
const subproofOrProofAssertionUnifies = await premise.unifySubproofOrProofAssertion(subproofOrProofAssertion, context);
|
|
291
279
|
|
|
292
280
|
if (subproofOrProofAssertionUnifies) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
context = this.getContext();
|
|
296
|
-
|
|
297
|
-
const generalContext = context; ///
|
|
298
|
-
|
|
299
|
-
context = specificContext; ///
|
|
300
|
-
|
|
301
|
-
context.resolveSubstitutions(generalContext, specificContext);
|
|
281
|
+
context.resolveSubstitutions();
|
|
302
282
|
|
|
303
283
|
return true;
|
|
304
284
|
}
|
|
@@ -320,6 +300,22 @@ export default define(class Rule extends Element {
|
|
|
320
300
|
return subproofOrProofAssertionsUnifiesWithPremise;
|
|
321
301
|
}
|
|
322
302
|
|
|
303
|
+
async unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context) {
|
|
304
|
+
let subproofOrProofAssertionsUnifiesWithPremises;
|
|
305
|
+
|
|
306
|
+
subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
|
|
307
|
+
|
|
308
|
+
subproofOrProofAssertionsUnifiesWithPremises = await asyncBackwardsEvery(this.premises, async (premise) => {
|
|
309
|
+
const stepUnifiesWithPremise = await this.unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context);
|
|
310
|
+
|
|
311
|
+
if (stepUnifiesWithPremise) {
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
return subproofOrProofAssertionsUnifiesWithPremises;
|
|
317
|
+
}
|
|
318
|
+
|
|
323
319
|
toJSON() {
|
|
324
320
|
const labelsJSON = labelsToLabelsJSON(this.labels),
|
|
325
321
|
premisesJSON = premisesToPremisesJSON(this.premises),
|
package/src/element/signature.js
CHANGED
|
@@ -122,7 +122,7 @@ export default define(class Signature extends Element {
|
|
|
122
122
|
return termsValidate
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
compareSignature(signature, substitutions, generalContext, specificContext) {
|
|
126
126
|
const terms = signature.getTerms(),
|
|
127
127
|
termsA = this.terms, ///
|
|
128
128
|
termsB = terms, ///
|
|
@@ -153,9 +153,9 @@ export default define(class Signature extends Element {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}),
|
|
156
|
-
|
|
156
|
+
comparesToSignature = matches; ///
|
|
157
157
|
|
|
158
|
-
return
|
|
158
|
+
return comparesToSignature;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
compareSubstitutions(substitutions, context) {
|
package/src/element/statement.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
|
-
import { arrayUtilities } from "necessary";
|
|
5
4
|
|
|
6
5
|
import { define } from "../elements";
|
|
7
6
|
import { unifyStatement } from "../process/unify";
|
|
@@ -9,8 +8,6 @@ import { validateStatements } from "../utilities/validation";
|
|
|
9
8
|
import { instantiateStatement } from "../process/instantiate";
|
|
10
9
|
import { join, reconcile, instantiate } from "../utilities/context";
|
|
11
10
|
|
|
12
|
-
const { backwardsSome } = arrayUtilities;
|
|
13
|
-
|
|
14
11
|
export default define(class Statement extends Element {
|
|
15
12
|
getStatementNode() {
|
|
16
13
|
const node = this.getNode(),
|
|
@@ -19,13 +16,6 @@ export default define(class Statement extends Element {
|
|
|
19
16
|
return statementNode;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
getMetavariableName() {
|
|
23
|
-
const sttaementNode = this.getStatementNode(),
|
|
24
|
-
metavariableName = sttaementNode.getMetavariableName();
|
|
25
|
-
|
|
26
|
-
return metavariableName;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
19
|
getTermSubstitutionNode() {
|
|
30
20
|
const statementNode = this.getNode(),
|
|
31
21
|
termSubstitutionNode = statementNode.getTermSubstitutionNode();
|
|
@@ -40,11 +30,33 @@ export default define(class Statement extends Element {
|
|
|
40
30
|
return frameSubstitutionNode;
|
|
41
31
|
}
|
|
42
32
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
singular = statementNode.isSingular();
|
|
33
|
+
getMetavariableNode() {
|
|
34
|
+
let metavariableNode = null;
|
|
46
35
|
|
|
47
|
-
|
|
36
|
+
const singular = this.isSingular();
|
|
37
|
+
|
|
38
|
+
if (singular) {
|
|
39
|
+
const statementNode = this.getStatementNode();
|
|
40
|
+
|
|
41
|
+
metavariableNode = statementNode.getMetavariableNode();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return metavariableNode;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
getMetavariableName() {
|
|
48
|
+
let metavariableName = null;
|
|
49
|
+
|
|
50
|
+
const singular = this.isSingular();
|
|
51
|
+
|
|
52
|
+
if (singular) {
|
|
53
|
+
const statementNode = this.getStatementNode(),
|
|
54
|
+
metavariableNode = statementNode.getMetavariableNode();
|
|
55
|
+
|
|
56
|
+
metavariableName = metavariableNode.getMetavariableName();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return metavariableName;
|
|
48
60
|
}
|
|
49
61
|
|
|
50
62
|
isEqualTo(statement) {
|
|
@@ -55,6 +67,13 @@ export default define(class Statement extends Element {
|
|
|
55
67
|
return equalTo;
|
|
56
68
|
}
|
|
57
69
|
|
|
70
|
+
isSingular() {
|
|
71
|
+
const statementNode = this.getStatementNode(),
|
|
72
|
+
singular = statementNode.isSingular();
|
|
73
|
+
|
|
74
|
+
return singular;
|
|
75
|
+
}
|
|
76
|
+
|
|
58
77
|
matchStatementNode(statementNode) {
|
|
59
78
|
const node = statementNode, ///
|
|
60
79
|
nodeMatches = this.matchNode(node),
|
|
@@ -63,79 +82,46 @@ export default define(class Statement extends Element {
|
|
|
63
82
|
return statementNodeMatches;
|
|
64
83
|
}
|
|
65
84
|
|
|
66
|
-
|
|
67
|
-
let
|
|
85
|
+
matchMetavariableNode(metavariableNode) {
|
|
86
|
+
let metavariableNodeMatches = false;
|
|
68
87
|
|
|
69
88
|
const singular = this.isSingular();
|
|
70
89
|
|
|
71
90
|
if (singular) {
|
|
72
|
-
const
|
|
91
|
+
const metavariableNodeA = metavariableNode, ///
|
|
92
|
+
statementNode = this.getStatementNode();
|
|
73
93
|
|
|
74
|
-
|
|
75
|
-
const metavariableName = this.getMetavariableName();
|
|
76
|
-
|
|
77
|
-
if (parameterName === metavariableName) {
|
|
78
|
-
comparesToParamter = true;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return comparesToParamter;
|
|
84
|
-
}
|
|
94
|
+
metavariableNode = statementNode.getMetavariableNode();
|
|
85
95
|
|
|
86
|
-
|
|
87
|
-
|
|
96
|
+
const metavariableNodeB = metavariableNode, ///
|
|
97
|
+
metavariableNodeAMatchesMetavariableNodeB = metavariableNodeA.match(metavariableNodeB);
|
|
88
98
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
let metavariableName;
|
|
93
|
-
|
|
94
|
-
metavariableName = metavariable.getName();
|
|
95
|
-
|
|
96
|
-
const metavariableNameA = metavariableName; ///
|
|
97
|
-
|
|
98
|
-
metavariableName = this.getMetavariableName();
|
|
99
|
-
|
|
100
|
-
const metavariableNameB = metavariableName; ///
|
|
101
|
-
|
|
102
|
-
comparesToMetavariableName = (metavariableNameA === metavariableNameB);
|
|
99
|
+
if (metavariableNodeAMatchesMetavariableNodeB) {
|
|
100
|
+
metavariableNodeMatches = true;
|
|
101
|
+
}
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
return
|
|
104
|
+
return metavariableNodeMatches;
|
|
106
105
|
}
|
|
107
106
|
|
|
108
|
-
|
|
109
|
-
let
|
|
107
|
+
compareParameter(parameter) {
|
|
108
|
+
let comparesToParamter = false;
|
|
110
109
|
|
|
111
110
|
const singular = this.isSingular();
|
|
112
111
|
|
|
113
112
|
if (singular) {
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
metavariableName = this.getMetavariableName();
|
|
117
|
-
|
|
118
|
-
const metavariableNameB = metavariableName; ///
|
|
119
|
-
|
|
120
|
-
comparesToMetavariableName = (metavariableNameA === metavariableNameB);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return comparesToMetavariableName;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
compareSubproofOrProofAssertions(subproofOrProofAssertions, context) {
|
|
127
|
-
let comparesToSubproofOrProofAssertions;
|
|
113
|
+
const parameterName = parameter.getName();
|
|
128
114
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
subproofOrProofAssertionComparesToStatement = subproofOrProofAssertion.compareStatement(statement, context);
|
|
115
|
+
if (parameterName !== null) {
|
|
116
|
+
const metavariableName = this.getMetavariableName();
|
|
132
117
|
|
|
133
|
-
|
|
134
|
-
|
|
118
|
+
if (parameterName === metavariableName) {
|
|
119
|
+
comparesToParamter = true;
|
|
120
|
+
}
|
|
135
121
|
}
|
|
136
|
-
}
|
|
122
|
+
}
|
|
137
123
|
|
|
138
|
-
return
|
|
124
|
+
return comparesToParamter;
|
|
139
125
|
}
|
|
140
126
|
|
|
141
127
|
findValidStatment(context) {
|
package/src/element/subproof.js
CHANGED
|
@@ -54,10 +54,10 @@ export default define(class Subproof extends Element {
|
|
|
54
54
|
return proofAssertion;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
const
|
|
57
|
+
compareStep(step, context) {
|
|
58
|
+
const comparesToStep = false;
|
|
59
59
|
|
|
60
|
-
return
|
|
60
|
+
return comparesToStep;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
async verify(context) {
|
|
@@ -9,8 +9,8 @@ import { join, ablate, descend, attempt, instantiate } from "../../utilities/con
|
|
|
9
9
|
import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
|
|
10
10
|
|
|
11
11
|
export default define(class FrameSubstitution extends Substitution {
|
|
12
|
-
constructor(context, string, node, targetFrame, replacementFrame) {
|
|
13
|
-
super(context, string, node);
|
|
12
|
+
constructor(context, string, node, generalContext, targetFrame, replacementFrame) {
|
|
13
|
+
super(context, string, node, generalContext);
|
|
14
14
|
|
|
15
15
|
this.targetFrame = targetFrame;
|
|
16
16
|
this.replacementFrame = replacementFrame;
|
|
@@ -31,6 +31,8 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
31
31
|
return frameSubstitutionNode;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
getMetavariableNode() { return this.targetFrame.getMetavariableNode(); }
|
|
35
|
+
|
|
34
36
|
getTargetNode() {
|
|
35
37
|
const targetFrameNode = this.targetFrame.getNode(),
|
|
36
38
|
tergetNode = targetFrameNode; ///
|
|
@@ -45,10 +47,6 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
45
47
|
return replacementNode;
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
compareMetavariableName(metavariableName) { return this.targetFrame.compareMetavariableName(metavariableName); }
|
|
49
|
-
|
|
50
|
-
getMetavariableName() { return this.targetFrame.getMetavariableName(); }
|
|
51
|
-
|
|
52
50
|
isTrivial() {
|
|
53
51
|
const targetFrameEqualToReplacementFrame = this.targetFrame.isEqualTo(this.replacementFrame),
|
|
54
52
|
trivial = targetFrameEqualToReplacementFrame; ///
|
|
@@ -56,6 +54,8 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
56
54
|
return trivial;
|
|
57
55
|
}
|
|
58
56
|
|
|
57
|
+
matchMetavariableNode(metavariableNode) { return this.targetFrame.matchMetavariableNode(metavariableNode); }
|
|
58
|
+
|
|
59
59
|
compareFrame(frame, context) {
|
|
60
60
|
const frameEqualToReplacementFrame = this.replacementFrame.isEqualTo(frame),
|
|
61
61
|
comparedToFrame = frameEqualToReplacementFrame; ///
|
|
@@ -116,6 +116,8 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
116
116
|
|
|
117
117
|
context.addSubstitution(substitution);
|
|
118
118
|
|
|
119
|
+
this.setGeneralContext(generalContext);
|
|
120
|
+
|
|
119
121
|
context.debug(`...validated the '${frameSubstitutionString}' frame substitution.`);
|
|
120
122
|
}
|
|
121
123
|
|
|
@@ -191,11 +193,12 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
191
193
|
instantiate((context) => {
|
|
192
194
|
const { string } = json,
|
|
193
195
|
frameSubstitutionNode = instantiateFrameSubstitution(string, context),
|
|
194
|
-
node = frameSubstitutionNode,
|
|
196
|
+
node = frameSubstitutionNode, ///
|
|
197
|
+
generalContext = generalContextFromFrameSubstitutionNode(frameSubstitutionNode, context),
|
|
195
198
|
targetFrame = targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, context),
|
|
196
199
|
replacementFrame = replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, context);
|
|
197
200
|
|
|
198
|
-
frameSubstitutionn = new FrameSubstitution(context, string, node, targetFrame, replacementFrame);
|
|
201
|
+
frameSubstitutionn = new FrameSubstitution(context, string, node, generalContext, targetFrame, replacementFrame);
|
|
199
202
|
}, context);
|
|
200
203
|
}
|
|
201
204
|
|
|
@@ -246,3 +249,10 @@ function replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, contex
|
|
|
246
249
|
|
|
247
250
|
return replacementFrame;
|
|
248
251
|
}
|
|
252
|
+
|
|
253
|
+
function generalContextFromFrameSubstitutionNode(frameSubstitutionNode, context) {
|
|
254
|
+
const generalContext = context; ///
|
|
255
|
+
|
|
256
|
+
return generalContext;
|
|
257
|
+
}
|
|
258
|
+
|