occam-verify-cli 1.0.727 → 1.0.730
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/ephemeral.js +7 -2
- package/lib/context/file/nominal.js +5 -1
- package/lib/context/liminal.js +11 -2
- package/lib/context/scoped.js +39 -4
- package/lib/context.js +7 -7
- package/lib/element/assumption.js +2 -2
- package/lib/element/declaration/metavariable.js +1 -2
- package/lib/element/metavariable.js +9 -7
- package/lib/element/proofAssertion/premise.js +1 -1
- package/lib/element/proofAssertion/step.js +5 -7
- package/lib/element/proofAssertion/supposition.js +1 -1
- package/lib/element/reference.js +2 -7
- package/lib/element/rule.js +5 -5
- package/lib/element/subproof.js +26 -11
- package/lib/element/substitution/statement.js +32 -30
- package/lib/element/substitution.js +1 -25
- package/lib/element/topLevelAssertion.js +5 -5
- package/lib/element/topLevelMetaAssertion.js +11 -15
- package/lib/utilities/context.js +7 -3
- package/lib/utilities/element.js +9 -2
- package/lib/utilities/json.js +2 -2
- package/lib/utilities/statement.js +1 -1
- package/lib/utilities/unification.js +14 -1
- package/package.json +1 -1
- package/src/context/ephemeral.js +9 -1
- package/src/context/file/nominal.js +6 -0
- package/src/context/liminal.js +16 -1
- package/src/context/scoped.js +55 -3
- package/src/context.js +9 -9
- package/src/element/assumption.js +2 -1
- package/src/element/declaration/metavariable.js +0 -1
- package/src/element/metavariable.js +10 -7
- package/src/element/proofAssertion/premise.js +1 -1
- package/src/element/proofAssertion/step.js +10 -13
- package/src/element/proofAssertion/supposition.js +1 -1
- package/src/element/reference.js +1 -8
- package/src/element/rule.js +5 -4
- package/src/element/subproof.js +36 -14
- package/src/element/substitution/statement.js +34 -32
- package/src/element/substitution.js +0 -36
- package/src/element/topLevelAssertion.js +5 -4
- package/src/element/topLevelMetaAssertion.js +11 -14
- package/src/utilities/context.js +8 -2
- package/src/utilities/element.js +7 -1
- package/src/utilities/json.js +1 -1
- package/src/utilities/statement.js +0 -1
- package/src/utilities/unification.js +16 -0
package/src/context/scoped.js
CHANGED
|
@@ -8,13 +8,14 @@ import elements from "../elements";
|
|
|
8
8
|
const { last } = arrayUtilities;
|
|
9
9
|
|
|
10
10
|
class ScopedContext extends Context {
|
|
11
|
-
constructor(context, variables, judgements, assignments, equivalences, subproofOrProofAssertions) {
|
|
11
|
+
constructor(context, variables, judgements, assignments, equivalences, substitutions, subproofOrProofAssertions) {
|
|
12
12
|
super(context);
|
|
13
13
|
|
|
14
14
|
this.variables = variables;
|
|
15
15
|
this.judgements = judgements;
|
|
16
16
|
this.assignments = assignments;
|
|
17
17
|
this.equivalences = equivalences;
|
|
18
|
+
this.substitutions = substitutions;
|
|
18
19
|
this.subproofOrProofAssertions = subproofOrProofAssertions;
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -68,6 +69,10 @@ class ScopedContext extends Context {
|
|
|
68
69
|
return equivalences;
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
getSubstitutions() {
|
|
73
|
+
return this.substitutions;
|
|
74
|
+
}
|
|
75
|
+
|
|
71
76
|
getSubproofOrProofAssertions() {
|
|
72
77
|
let subproofOrProofAssertions;
|
|
73
78
|
|
|
@@ -109,6 +114,20 @@ class ScopedContext extends Context {
|
|
|
109
114
|
return lastProofAssertion;
|
|
110
115
|
}
|
|
111
116
|
|
|
117
|
+
hasMetaLevelSubstitutions() {
|
|
118
|
+
let metaLevelSubstitutions;
|
|
119
|
+
|
|
120
|
+
if (this.substitutions !== null) {
|
|
121
|
+
metaLevelSubstitutions = true;
|
|
122
|
+
} else {
|
|
123
|
+
const context = this.getContext();
|
|
124
|
+
|
|
125
|
+
metaLevelSubstitutions = context.hasMetaLevelSubstitutions();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return metaLevelSubstitutions;
|
|
129
|
+
}
|
|
130
|
+
|
|
112
131
|
addEquality(equality) {
|
|
113
132
|
const context = this, ///
|
|
114
133
|
equalityString = equality.getString();
|
|
@@ -155,6 +174,39 @@ class ScopedContext extends Context {
|
|
|
155
174
|
this.assignments.push(assignment);
|
|
156
175
|
}
|
|
157
176
|
|
|
177
|
+
addSubstitution(substitution, scoped = true) {
|
|
178
|
+
if (this.substitutions === null) {
|
|
179
|
+
const context = this.getContext();
|
|
180
|
+
|
|
181
|
+
context.addSubstitution(substitution);
|
|
182
|
+
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const context = this, ///
|
|
187
|
+
substitutionA = substitution, ///
|
|
188
|
+
substitutionString = substitution.getString();
|
|
189
|
+
|
|
190
|
+
context.trace(`Adding the '${substitutionString}' substitution to the scoped context...`);
|
|
191
|
+
|
|
192
|
+
const substitutionB = this.substitutions.find((substitution) => {
|
|
193
|
+
const substitutionB = substitution, ///
|
|
194
|
+
substitutionAEqualToSubstitutionB = substitutionA.isEqualTo(substitutionB);
|
|
195
|
+
|
|
196
|
+
if (substitutionAEqualToSubstitutionB) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
}) || null;
|
|
200
|
+
|
|
201
|
+
if (substitutionB !== null) {
|
|
202
|
+
context.debug(`The '${substitutionString}' substitution has already been added to the scoped context.`);
|
|
203
|
+
} else {
|
|
204
|
+
this.substitutions.push(substitution);
|
|
205
|
+
|
|
206
|
+
context.debug(`...added the '${substitutionString}' substitution to the scoped context.`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
158
210
|
assignAssignments() {
|
|
159
211
|
const context = this; ///
|
|
160
212
|
|
|
@@ -251,14 +303,14 @@ class ScopedContext extends Context {
|
|
|
251
303
|
return comparesToTermAndPropertyRelation;
|
|
252
304
|
}
|
|
253
305
|
|
|
254
|
-
static
|
|
306
|
+
static fromSubstitutions(substitutions, context) {
|
|
255
307
|
const { Equivalences } = elements,
|
|
256
308
|
variables = [],
|
|
257
309
|
judgements = [],
|
|
258
310
|
assignments = [],
|
|
259
311
|
equivalences = Equivalences.fromNothing(context),
|
|
260
312
|
subproofOrProofAssertions = [],
|
|
261
|
-
scopedContext = new ScopedContext(context, variables, judgements, assignments, equivalences, subproofOrProofAssertions);
|
|
313
|
+
scopedContext = new ScopedContext(context, variables, judgements, assignments, equivalences, substitutions, subproofOrProofAssertions);
|
|
262
314
|
|
|
263
315
|
return scopedContext;
|
|
264
316
|
}
|
package/src/context.js
CHANGED
|
@@ -290,13 +290,6 @@ export default class Context extends ContextBase {
|
|
|
290
290
|
return labelPresent;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
isMetavariablePresentByReference(reference) {
|
|
294
|
-
const context = this.getContext(),
|
|
295
|
-
metavariablePresent = context.isMetavariablePresentByReference(reference);
|
|
296
|
-
|
|
297
|
-
return metavariablePresent;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
293
|
isTermPresentByTermNode(termNode) {
|
|
301
294
|
const context = this.getContext(),
|
|
302
295
|
termPresent = context.isTermPresentByTermNode(termNode);
|
|
@@ -381,6 +374,13 @@ export default class Context extends ContextBase {
|
|
|
381
374
|
return procedurePresent;
|
|
382
375
|
}
|
|
383
376
|
|
|
377
|
+
hasMetaLevelSubstitutions() {
|
|
378
|
+
const context = this.getContext(),
|
|
379
|
+
metaLevelSubstitutions = context.hasMetaLevelSubstitutions();
|
|
380
|
+
|
|
381
|
+
return metaLevelSubstitutions;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
384
|
addTerm(term) {
|
|
385
385
|
const context = this.getContext();
|
|
386
386
|
|
|
@@ -417,10 +417,10 @@ export default class Context extends ContextBase {
|
|
|
417
417
|
context.addAssignment(assignment);
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
addSubstitution(substitution) {
|
|
420
|
+
addSubstitution(substitution, metaLevel = false) {
|
|
421
421
|
const context = this.getContext();
|
|
422
422
|
|
|
423
|
-
context.addSubstitution(substitution);
|
|
423
|
+
context.addSubstitution(substitution, metaLevel);
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
addSubproofOrProofAssertion(subproofOrProofAssertion) {
|
|
@@ -172,7 +172,8 @@ export default define(class Assumption extends Element {
|
|
|
172
172
|
|
|
173
173
|
context.trace(`Validating the '${assumptionString}' stated assumption...`);
|
|
174
174
|
|
|
175
|
-
const
|
|
175
|
+
const metavariable = this.reference.getMetavariable(),
|
|
176
|
+
metavariablePresent = context.isMetavariablePresent(metavariable, context);
|
|
176
177
|
|
|
177
178
|
if (metavariablePresent) {
|
|
178
179
|
validatesWhenStated = true;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import Declaration from "../declaration";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import { verifyMetavariable } from "../../process/verify";
|
|
7
6
|
|
|
8
7
|
export default define(class MetavariableDeclaration extends Declaration {
|
|
9
8
|
constructor(context, string, node, metaType, metavariable) {
|
|
@@ -161,8 +161,11 @@ export default define(class Metavariable extends Element {
|
|
|
161
161
|
const typeValidates = this.validateType(context);
|
|
162
162
|
|
|
163
163
|
if (typeValidates) {
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
let metavariable;
|
|
165
|
+
|
|
166
|
+
metavariable = this; ///
|
|
167
|
+
|
|
168
|
+
metavariable = context.findMetavariable(metavariable, context); ///
|
|
166
169
|
|
|
167
170
|
if (metavariable !== null) {
|
|
168
171
|
const metaType = metavariable.getMetaType();
|
|
@@ -240,9 +243,9 @@ export default define(class Metavariable extends Element {
|
|
|
240
243
|
|
|
241
244
|
if (simpleSubstitution !== null) {
|
|
242
245
|
const substitution = simpleSubstitution, ///
|
|
243
|
-
|
|
246
|
+
substitutionFrameComparesToFrame = substitution.compareFrame(frame, context);
|
|
244
247
|
|
|
245
|
-
if (
|
|
248
|
+
if (substitutionFrameComparesToFrame) {
|
|
246
249
|
frameUnifies = true;
|
|
247
250
|
}
|
|
248
251
|
} else {
|
|
@@ -291,7 +294,7 @@ export default define(class Metavariable extends Element {
|
|
|
291
294
|
const metavariableName = metavariable.getName(),
|
|
292
295
|
substitutionPresent = (substitution !== null) ?
|
|
293
296
|
context.isSubstitutionPresentByMetavariableNameAndSubstitution(metavariableName, substitution) :
|
|
294
|
-
context.
|
|
297
|
+
context.isSubstitutionPresentByMetavariableName(metavariableName);
|
|
295
298
|
|
|
296
299
|
if (substitutionPresent) {
|
|
297
300
|
substitution = (substitution !== null) ?
|
|
@@ -355,9 +358,9 @@ export default define(class Metavariable extends Element {
|
|
|
355
358
|
if (simpleSubstitutionPresent) {
|
|
356
359
|
const simpleSubstitution = context.findSimpleSubstitutionByMetavariableName(metavariableName),
|
|
357
360
|
substitution = simpleSubstitution, ///
|
|
358
|
-
|
|
361
|
+
substitutionReferenceComparesToReference = substitution.compareReference(reference, context);
|
|
359
362
|
|
|
360
|
-
if (
|
|
363
|
+
if (substitutionReferenceComparesToReference) {
|
|
361
364
|
referenceUnifies = true;
|
|
362
365
|
}
|
|
363
366
|
} else {
|
|
@@ -165,7 +165,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
165
165
|
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise...`);
|
|
166
166
|
|
|
167
167
|
const proofAssertionContext = proofAssertion.getContext(),
|
|
168
|
-
premiseContext = this.getContext(),
|
|
168
|
+
premiseContext = this.getContext(), ///
|
|
169
169
|
generalContext = premiseContext, ///
|
|
170
170
|
specificContext = proofAssertionContext,
|
|
171
171
|
statementUnifies = liminally((specificContext) => {
|
|
@@ -188,22 +188,19 @@ export default define(class Step extends ProofAssertion {
|
|
|
188
188
|
|
|
189
189
|
const statement = this.getStatement(),
|
|
190
190
|
reference = this.getReference(),
|
|
191
|
-
satisfiesAssertion = this.getSatisfiesAssertion()
|
|
192
|
-
statementUnifies = await asyncLiminally(async (context) => {
|
|
193
|
-
const statementUnifies = await asyncSome(unifyStatements, async (unifyStatement) => {
|
|
194
|
-
const statementUnifies = await unifyStatement(statement, reference, satisfiesAssertion, context);
|
|
191
|
+
satisfiesAssertion = this.getSatisfiesAssertion();
|
|
195
192
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
});
|
|
193
|
+
await asyncLiminally(async (context) => {
|
|
194
|
+
await asyncSome(unifyStatements, async (unifyStatement) => {
|
|
195
|
+
const statementUnifies = await unifyStatement(statement, reference, satisfiesAssertion, context);
|
|
200
196
|
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
if (statementUnifies) {
|
|
198
|
+
unifies = true;
|
|
203
199
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}, context);
|
|
207
204
|
|
|
208
205
|
if (unifies) {
|
|
209
206
|
context.debug(`...unified the '${stepString}' step.`);
|
|
@@ -192,7 +192,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
192
192
|
specificContext = proofAssertionContext,
|
|
193
193
|
statementUnifies = liminally((specificContext) => {
|
|
194
194
|
const statement = proofAssertion.getStatement(),
|
|
195
|
-
|
|
195
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
196
196
|
|
|
197
197
|
if (statementUnifies) {
|
|
198
198
|
specificContext.commit(context);
|
package/src/element/reference.js
CHANGED
|
@@ -141,14 +141,7 @@ export default define(class Reference extends Element {
|
|
|
141
141
|
const metavariableMetaTypeEqualToReferenceMetaType = this.metavariable.isMetaTypeEqualTo(referenceMetaType);
|
|
142
142
|
|
|
143
143
|
if (metavariableMetaTypeEqualToReferenceMetaType) {
|
|
144
|
-
|
|
145
|
-
metavariablePresent = context.isMetavariablePresentByReference(reference);
|
|
146
|
-
|
|
147
|
-
if (metavariablePresent) {
|
|
148
|
-
validates = true;
|
|
149
|
-
} else {
|
|
150
|
-
context.debug(`There is no metavariable for the '${referenceString}' reference.`);
|
|
151
|
-
}
|
|
144
|
+
validates = true;
|
|
152
145
|
} else {
|
|
153
146
|
const metaTypeString = metaType.getString(),
|
|
154
147
|
metavariableString = this.metavariable.getString(),
|
package/src/element/rule.js
CHANGED
|
@@ -172,7 +172,7 @@ export default define(class Rule extends Element {
|
|
|
172
172
|
|
|
173
173
|
const statement = this.conclusion.getStatement();
|
|
174
174
|
|
|
175
|
-
proofVerifies = this.proof.verify(statement, context);
|
|
175
|
+
proofVerifies = await this.proof.verify(statement, context);
|
|
176
176
|
|
|
177
177
|
if (proofVerifies) {
|
|
178
178
|
context.debug(`...verified the '${ruleString}' rule's proof.`);
|
|
@@ -232,14 +232,15 @@ export default define(class Rule extends Element {
|
|
|
232
232
|
async verifyConclusion(context) {
|
|
233
233
|
let conclusionVerifies;
|
|
234
234
|
|
|
235
|
-
const ruleString = this.getString()
|
|
235
|
+
const ruleString = this.getString(), ///
|
|
236
|
+
conclusionString = this.conclusion.getString();
|
|
236
237
|
|
|
237
|
-
context.trace(`Verifying the '${ruleString}' rule's conclusion...`);
|
|
238
|
+
context.trace(`Verifying the '${ruleString}' rule's '${conclusionString}' conclusion...`);
|
|
238
239
|
|
|
239
240
|
conclusionVerifies = await this.conclusion.verify(context);
|
|
240
241
|
|
|
241
242
|
if (conclusionVerifies) {
|
|
242
|
-
context.debug(`...verified the '${ruleString}' rule's conclusion.`);
|
|
243
|
+
context.debug(`...verified the '${ruleString}' rule's '${conclusionString}' conclusion.`);
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
return conclusionVerifies;
|
package/src/element/subproof.js
CHANGED
|
@@ -64,22 +64,10 @@ export default define(class Subproof extends Element {
|
|
|
64
64
|
let verifies = false;
|
|
65
65
|
|
|
66
66
|
await asyncScope(async (context) => {
|
|
67
|
-
const suppositionsVerify = await
|
|
68
|
-
const suppositionVerifies = await supposition.verify(context);
|
|
69
|
-
|
|
70
|
-
if (suppositionVerifies) {
|
|
71
|
-
const subproofOrProofAssertion = supposition; ////
|
|
72
|
-
|
|
73
|
-
context.assignAssignments(context);
|
|
74
|
-
|
|
75
|
-
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
76
|
-
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
67
|
+
const suppositionsVerify = await this.verifySuppositions(context);
|
|
80
68
|
|
|
81
69
|
if (suppositionsVerify) {
|
|
82
|
-
const subDerivationVerifies = await this.
|
|
70
|
+
const subDerivationVerifies = await this.verifySubDerivation(context);
|
|
83
71
|
|
|
84
72
|
if (subDerivationVerifies) {
|
|
85
73
|
verifies = true;
|
|
@@ -90,6 +78,40 @@ export default define(class Subproof extends Element {
|
|
|
90
78
|
return verifies;
|
|
91
79
|
}
|
|
92
80
|
|
|
81
|
+
async verifySupposition(supposition, context) {
|
|
82
|
+
const suppositionVerifies = await supposition.verify(context);
|
|
83
|
+
|
|
84
|
+
if (suppositionVerifies) {
|
|
85
|
+
const subproofOrProofAssertion = supposition; ////
|
|
86
|
+
|
|
87
|
+
context.assignAssignments(context);
|
|
88
|
+
|
|
89
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return suppositionVerifies;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async verifySuppositions(context) {
|
|
96
|
+
let suppositionsVerify;
|
|
97
|
+
|
|
98
|
+
suppositionsVerify = await asyncEvery(this.suppositions, async (supposition) => {
|
|
99
|
+
const suppositionVerifies = await this.verifySupposition(supposition, context);
|
|
100
|
+
|
|
101
|
+
if (suppositionVerifies) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return suppositionsVerify;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async verifySubDerivation(context) {
|
|
110
|
+
const subDerivationVerifies = await this.subDerivation.verify(context);
|
|
111
|
+
|
|
112
|
+
return subDerivationVerifies;
|
|
113
|
+
}
|
|
114
|
+
|
|
93
115
|
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
94
116
|
let unifiesWithSatisfiesAssertion = false;
|
|
95
117
|
|
|
@@ -259,59 +259,61 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
259
259
|
|
|
260
260
|
const simpleSubstitution = context.findSimpleSubstitutionByMetavariableName(metavariableName);
|
|
261
261
|
|
|
262
|
-
|
|
262
|
+
if (simpleSubstitution !== null) {
|
|
263
|
+
context = this.getContext();
|
|
263
264
|
|
|
264
|
-
|
|
265
|
-
|
|
265
|
+
const subtitution = liminally((context) => {
|
|
266
|
+
let substitution = null;
|
|
266
267
|
|
|
267
|
-
|
|
268
|
+
const specificContext = context; ///
|
|
268
269
|
|
|
269
|
-
|
|
270
|
+
context = simpleSubstitution.getContext();
|
|
270
271
|
|
|
271
|
-
|
|
272
|
+
const generalContext = context; ///
|
|
272
273
|
|
|
273
|
-
|
|
274
|
+
context = specificContext; ///
|
|
274
275
|
|
|
275
|
-
|
|
276
|
+
const replacementStatementUnifies = simpleSubstitution.unifyReplacementStatement(this.replacementStatement, generalContext, specificContext);
|
|
276
277
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
if (replacementStatementUnifies) {
|
|
279
|
+
const nested = false,
|
|
280
|
+
soleNonTrivialSubstitution = context.getSoleNonTrivialSubstitution(nested);
|
|
280
281
|
|
|
281
|
-
|
|
282
|
-
|
|
282
|
+
substitution = soleNonTrivialSubstitution; ///
|
|
283
|
+
}
|
|
283
284
|
|
|
284
|
-
|
|
285
|
-
|
|
285
|
+
return substitution;
|
|
286
|
+
}, context);
|
|
286
287
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
if (subtitution !== null) {
|
|
289
|
+
liminally((specificContext) => {
|
|
290
|
+
const contexts = [];
|
|
290
291
|
|
|
291
|
-
|
|
292
|
+
context = simpleSubstitution.getContext();
|
|
292
293
|
|
|
293
|
-
|
|
294
|
+
contexts.push(context);
|
|
294
295
|
|
|
295
|
-
|
|
296
|
+
context = this.getContext();
|
|
296
297
|
|
|
297
|
-
|
|
298
|
+
contexts.push(context);
|
|
298
299
|
|
|
299
|
-
|
|
300
|
+
context = specificContext; ///
|
|
300
301
|
|
|
301
|
-
|
|
302
|
-
|
|
302
|
+
synthetically((context) => {
|
|
303
|
+
const specificContext = context; ///
|
|
303
304
|
|
|
304
|
-
|
|
305
|
+
context = this.substitution.getContext();
|
|
305
306
|
|
|
306
|
-
|
|
307
|
+
const generalContext = context; ///
|
|
307
308
|
|
|
308
|
-
|
|
309
|
-
|
|
309
|
+
this.unifySubstitution(subtitution, generalContext, specificContext);
|
|
310
|
+
}, contexts, context);
|
|
310
311
|
|
|
311
|
-
|
|
312
|
-
|
|
312
|
+
specificContext.commit();
|
|
313
|
+
}, specificContext);
|
|
313
314
|
|
|
314
|
-
|
|
315
|
+
this.resolved = true;
|
|
316
|
+
}
|
|
315
317
|
}
|
|
316
318
|
|
|
317
319
|
if (this.resolved) {
|
|
@@ -96,42 +96,6 @@ export default class Substitution extends Element {
|
|
|
96
96
|
return simple;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
isTermEqualToTerm(term) {
|
|
100
|
-
const termEqualToTerm = false;
|
|
101
|
-
|
|
102
|
-
return termEqualToTerm;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
isFrameEqualToFrame(frame) {
|
|
106
|
-
const frameEqualToFrame = false;
|
|
107
|
-
|
|
108
|
-
return frameEqualToFrame;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
isStatementEqualToStatement(statement) {
|
|
112
|
-
const statementEqualToStatement = false;
|
|
113
|
-
|
|
114
|
-
return statementEqualToStatement;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
isReferenceEqualToReference(reference) {
|
|
118
|
-
const referenceEqualToReference = false;
|
|
119
|
-
|
|
120
|
-
return referenceEqualToReference;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
compareTerm(term, context) {
|
|
124
|
-
const comparesToTerm = false;
|
|
125
|
-
|
|
126
|
-
return comparesToTerm;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
compareStatement(statement) {
|
|
130
|
-
const comparesToStatement = false;
|
|
131
|
-
|
|
132
|
-
return comparesToStatement;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
99
|
compareParameter(parameter) {
|
|
136
100
|
const comparesToParameter = false;
|
|
137
101
|
|
|
@@ -232,7 +232,7 @@ export default class TopLevelAssertion extends Element {
|
|
|
232
232
|
|
|
233
233
|
const statement = this.deduction.getStatement();
|
|
234
234
|
|
|
235
|
-
proofVerifies = this.proof.verify(statement, context);
|
|
235
|
+
proofVerifies = await this.proof.verify(statement, context);
|
|
236
236
|
|
|
237
237
|
if (proofVerifies) {
|
|
238
238
|
context.debug(`...verified the '${topLevelAssertionString}' top level assertion's proof.`);
|
|
@@ -245,14 +245,15 @@ export default class TopLevelAssertion extends Element {
|
|
|
245
245
|
async verifyDeduction(context) {
|
|
246
246
|
let deductionVerifies;
|
|
247
247
|
|
|
248
|
-
const
|
|
248
|
+
const deductionString = this.deduction.getString(),
|
|
249
|
+
topLevelAssertionString = this.getString(); ///
|
|
249
250
|
|
|
250
|
-
context.trace(`Verifying the '${topLevelAssertionString}' top level assertion's deduction...`);
|
|
251
|
+
context.trace(`Verifying the '${topLevelAssertionString}' top level assertion's '${deductionString}' deduction...`);
|
|
251
252
|
|
|
252
253
|
deductionVerifies = await this.deduction.verify(context);
|
|
253
254
|
|
|
254
255
|
if (deductionVerifies) {
|
|
255
|
-
context.debug(`...verified the '${topLevelAssertionString}' top level assertion's deduction.`);
|
|
256
|
+
context.debug(`...verified the '${topLevelAssertionString}' top level assertion's '${deductionString}' deduction.`);
|
|
256
257
|
}
|
|
257
258
|
|
|
258
259
|
return deductionVerifies;
|
|
@@ -81,7 +81,7 @@ export default class TopLevelMetaAssertion extends Element {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
}, context);
|
|
84
|
+
}, this.substitutions, context);
|
|
85
85
|
|
|
86
86
|
if (verifies) {
|
|
87
87
|
context.debug(`...verified the '${topLevelMetaAssertionString}' top level meta assertion.`);
|
|
@@ -111,20 +111,16 @@ export default class TopLevelMetaAssertion extends Element {
|
|
|
111
111
|
async verifyProof(context) {
|
|
112
112
|
let proofVerifies;
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
proofVerifies = true;
|
|
116
|
-
} else {
|
|
117
|
-
const topLevelMetaAssertionString = this.getString(); ///
|
|
114
|
+
const topLevelMetaAssertionString = this.getString(); ///
|
|
118
115
|
|
|
119
|
-
|
|
116
|
+
context.trace(`Verifying the '${topLevelMetaAssertionString}' top level meta-assertion's proof...`);
|
|
120
117
|
|
|
121
|
-
|
|
118
|
+
const statement = this.deduction.getStatement();
|
|
122
119
|
|
|
123
|
-
|
|
120
|
+
proofVerifies = await this.proof.verify(statement, context);
|
|
124
121
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
122
|
+
if (proofVerifies) {
|
|
123
|
+
context.debug(`...verified the '${topLevelMetaAssertionString}' top level meta-assertion's proof.`);
|
|
128
124
|
}
|
|
129
125
|
|
|
130
126
|
return proofVerifies;
|
|
@@ -133,14 +129,15 @@ export default class TopLevelMetaAssertion extends Element {
|
|
|
133
129
|
async verifyDeduction(context) {
|
|
134
130
|
let deductionVerifies;
|
|
135
131
|
|
|
136
|
-
const
|
|
132
|
+
const deductionString = this.deduction.getString(),
|
|
133
|
+
topLevelMetaAssertionString = this.getString(); ///
|
|
137
134
|
|
|
138
|
-
context.trace(`Verifying the '${topLevelMetaAssertionString}' top level meta assertion's deduction...`);
|
|
135
|
+
context.trace(`Verifying the '${topLevelMetaAssertionString}' top level meta assertion's '${deductionString}' deduction...`);
|
|
139
136
|
|
|
140
137
|
deductionVerifies = await this.deduction.verify(context);
|
|
141
138
|
|
|
142
139
|
if (deductionVerifies) {
|
|
143
|
-
context.debug(`...verified the '${topLevelMetaAssertionString}' top level meta assertion's deduction.`);
|
|
140
|
+
context.debug(`...verified the '${topLevelMetaAssertionString}' top level meta assertion's '${deductionString}' deduction.`);
|
|
144
141
|
}
|
|
145
142
|
|
|
146
143
|
return deductionVerifies;
|
package/src/utilities/context.js
CHANGED
|
@@ -38,8 +38,14 @@ export function synthetically(innerFunction, contexts, context) {
|
|
|
38
38
|
return innerFunction(context);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export async function asyncScope(innerFunction, context) {
|
|
42
|
-
|
|
41
|
+
export async function asyncScope(innerFunction, substitutions, context) {
|
|
42
|
+
if (context === undefined) {
|
|
43
|
+
context = substitutions; ///
|
|
44
|
+
|
|
45
|
+
substitutions = null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const scopedContext = ScopedContext.fromSubstitutions(substitutions, context);
|
|
43
49
|
|
|
44
50
|
context = scopedContext; ///
|
|
45
51
|
|
package/src/utilities/element.js
CHANGED
|
@@ -529,7 +529,7 @@ export function metatheoremFromMetatheoremNode(metatheoremNode, context) {
|
|
|
529
529
|
topLevelMetaAssertionString = topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction),
|
|
530
530
|
node = metatheoremNode, ///
|
|
531
531
|
string = topLevelMetaAssertionString, ///
|
|
532
|
-
substitutions =
|
|
532
|
+
substitutions = substitutionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context),
|
|
533
533
|
metatheorem = new Metatheorem(context, string, node, label, suppositions, deduction, proof, substitutions);
|
|
534
534
|
|
|
535
535
|
return metatheorem;
|
|
@@ -676,6 +676,12 @@ export function subproofAssertionFromSubproofAssertionNode(subproofAssertionNode
|
|
|
676
676
|
return subproofAssertion;
|
|
677
677
|
}
|
|
678
678
|
|
|
679
|
+
export function substitutionsFromTopLevelMetaAssertionNode(metaLemmaMetathoremNode, context) {
|
|
680
|
+
const substitutions = [];
|
|
681
|
+
|
|
682
|
+
return substitutions;
|
|
683
|
+
}
|
|
684
|
+
|
|
679
685
|
export function containedAssertionFromContainedAssertionNode(containedAssertionNode, context) {
|
|
680
686
|
const { ContainedAssertion } = elements,
|
|
681
687
|
node = containedAssertionNode, ///
|
package/src/utilities/json.js
CHANGED
|
@@ -641,7 +641,7 @@ export function suppositionsFromJSON(json, context) {
|
|
|
641
641
|
}
|
|
642
642
|
|
|
643
643
|
export function substitutionsFromJSON(json, context) {
|
|
644
|
-
let { substitutions
|
|
644
|
+
let { substitutions } = json; ///
|
|
645
645
|
|
|
646
646
|
const { StatementSubstitution } = elements,
|
|
647
647
|
substitutionsJSON = substitutions, ///
|