occam-verify-cli 0.0.1245 → 0.0.1247
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/file.js +172 -210
- package/lib/context/local.js +95 -125
- package/lib/dom/assertion/contained.js +44 -22
- package/lib/dom/assertion/defined.js +34 -17
- package/lib/dom/combinator/bracketed.js +167 -0
- package/lib/dom/combinator.js +163 -0
- package/lib/{constructor → dom/constructor}/bracketed.js +7 -7
- package/lib/dom/constructor.js +190 -0
- package/lib/dom/declaration/combinator.js +2 -8
- package/lib/dom/declaration/constructor.js +42 -7
- package/lib/dom/declaration.js +113 -71
- package/lib/dom/equality.js +3 -3
- package/lib/dom/frame.js +111 -76
- package/lib/dom/judgement.js +29 -3
- package/lib/dom/label.js +22 -15
- package/lib/dom/metaLemma.js +20 -41
- package/lib/dom/metatheorem.js +20 -41
- package/lib/dom/metavariable.js +7 -7
- package/lib/dom/reference.js +32 -18
- package/lib/dom/rule.js +3 -4
- package/lib/dom/statement.js +2 -2
- package/lib/dom/term.js +2 -2
- package/lib/dom/topLevelAssertion.js +50 -71
- package/lib/dom/type.js +3 -3
- package/lib/dom/variable.js +5 -5
- package/lib/equivalence.js +2 -2
- package/lib/index.js +7 -3
- package/lib/mixins/statement/verify.js +3 -3
- package/lib/mixins/term/verify.js +2 -3
- package/lib/substitution/statement.js +2 -2
- package/lib/unifier/{label.js → reference.js} +14 -14
- package/lib/utilities/json.js +5 -7
- package/lib/utilities/unification.js +25 -6
- package/lib/verifier/combinator.js +3 -3
- package/lib/verifier/constructor.js +3 -3
- package/package.json +5 -5
- package/src/context/file.js +166 -206
- package/src/context/local.js +73 -83
- package/src/dom/assertion/contained.js +60 -27
- package/src/dom/assertion/defined.js +44 -20
- package/src/{combinator → dom/combinator}/bracketed.js +6 -5
- package/src/{combinator.js → dom/combinator.js} +8 -7
- package/src/{constructor → dom/constructor}/bracketed.js +6 -5
- package/src/{constructor.js → dom/constructor.js} +8 -7
- package/src/dom/declaration/combinator.js +2 -3
- package/src/dom/declaration/constructor.js +3 -2
- package/src/dom/declaration.js +133 -101
- package/src/dom/equality.js +2 -2
- package/src/dom/frame.js +151 -95
- package/src/dom/judgement.js +36 -2
- package/src/dom/label.js +18 -13
- package/src/dom/metaLemma.js +23 -55
- package/src/dom/metatheorem.js +23 -55
- package/src/dom/metavariable.js +6 -6
- package/src/dom/reference.js +43 -25
- package/src/dom/rule.js +2 -2
- package/src/dom/statement.js +1 -1
- package/src/dom/term.js +1 -1
- package/src/dom/topLevelAssertion.js +53 -86
- package/src/dom/type.js +2 -2
- package/src/dom/variable.js +4 -4
- package/src/equivalence.js +1 -1
- package/src/index.js +4 -0
- package/src/mixins/statement/verify.js +3 -2
- package/src/mixins/term/verify.js +2 -3
- package/src/substitution/statement.js +1 -1
- package/src/unifier/{label.js → reference.js} +6 -6
- package/src/utilities/json.js +4 -4
- package/src/utilities/unification.js +43 -5
- package/src/verifier/combinator.js +2 -2
- package/src/verifier/constructor.js +2 -2
- package/lib/combinator/bracketed.js +0 -126
- package/lib/combinator.js +0 -122
- package/lib/constructor.js +0 -149
package/src/dom/declaration.js
CHANGED
|
@@ -150,19 +150,29 @@ export default domAssigned(class Declaration {
|
|
|
150
150
|
|
|
151
151
|
context.trace(`Verifying the '${declarationString}' declaration...`);
|
|
152
152
|
|
|
153
|
-
const
|
|
153
|
+
const referenceVerified = this.verifyReference(assignments, stated, context);
|
|
154
154
|
|
|
155
|
-
if (
|
|
156
|
-
|
|
157
|
-
verifiedWhenDerived = false;
|
|
155
|
+
if (referenceVerified) {
|
|
156
|
+
const statementVerified = this.verifyStatement(assignments, stated, context);
|
|
158
157
|
|
|
159
|
-
if (
|
|
160
|
-
verifiedWhenStated =
|
|
161
|
-
|
|
162
|
-
verifiedWhenDerived = this.verifyWhenDerived(frame, context);
|
|
163
|
-
}
|
|
158
|
+
if (statementVerified) {
|
|
159
|
+
let verifiedWhenStated = false,
|
|
160
|
+
verifiedWhenDerived = false;
|
|
164
161
|
|
|
165
|
-
|
|
162
|
+
if (stated) {
|
|
163
|
+
verifiedWhenStated = this.verifyWhenStated(frame, assignments, context);
|
|
164
|
+
|
|
165
|
+
verified = verifiedWhenStated; ///
|
|
166
|
+
} else {
|
|
167
|
+
verifiedWhenDerived = this.verifyWhenDerived(context);
|
|
168
|
+
|
|
169
|
+
verified = verifiedWhenDerived; ///
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (verifiedWhenStated || verifiedWhenDerived) {
|
|
173
|
+
verified = true;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
166
176
|
}
|
|
167
177
|
|
|
168
178
|
if (verified) {
|
|
@@ -172,26 +182,54 @@ export default domAssigned(class Declaration {
|
|
|
172
182
|
return verified;
|
|
173
183
|
}
|
|
174
184
|
|
|
175
|
-
|
|
185
|
+
verifyReference(assignments, stated, context) {
|
|
186
|
+
let referenceVerified;
|
|
187
|
+
|
|
188
|
+
const referenceString = this.reference.getString(),
|
|
189
|
+
declarationString = this.string; ///
|
|
190
|
+
|
|
191
|
+
context.trace(`Verifying the '${declarationString}' declaration's '${referenceString}' reference...`);
|
|
192
|
+
|
|
193
|
+
referenceVerified = this.reference.verify(context);
|
|
194
|
+
|
|
195
|
+
if (referenceVerified) {
|
|
196
|
+
context.debug(`...verified the '${declarationString}' declaration's '${referenceString}' reference.`);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return referenceVerified;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
verifyStatement(assignments, stated, context) {
|
|
203
|
+
let statementVerified;
|
|
204
|
+
|
|
205
|
+
const statementString = this.statement.getString(),
|
|
206
|
+
declarationString = this.string; ///
|
|
207
|
+
|
|
208
|
+
context.trace(`Verifying the '${declarationString}' declaration's '${statementString}' statement...`);
|
|
209
|
+
|
|
176
210
|
stated = true; ///
|
|
177
211
|
|
|
178
212
|
assignments = null; ///
|
|
179
213
|
|
|
180
|
-
|
|
214
|
+
statementVerified = this.statement.verify(assignments, stated, context);
|
|
215
|
+
|
|
216
|
+
if (statementVerified) {
|
|
217
|
+
context.debug(`...verified the '${declarationString}' declaration's '${statementString}' statement.`);
|
|
218
|
+
}
|
|
181
219
|
|
|
182
220
|
return statementVerified;
|
|
183
221
|
}
|
|
184
222
|
|
|
185
|
-
verifyWhenStated(context) {
|
|
223
|
+
verifyWhenStated(frame, assignments, context) {
|
|
186
224
|
let verifiedWhenStated;
|
|
187
225
|
|
|
188
226
|
const declarationString = this.string; ///
|
|
189
227
|
|
|
190
228
|
context.trace(`Verifying the '${declarationString}' stated declaration...`);
|
|
191
229
|
|
|
192
|
-
const
|
|
230
|
+
const metavariablePresent = context.isMetavariablePresentByReference(this.reference);
|
|
193
231
|
|
|
194
|
-
if (
|
|
232
|
+
if (metavariablePresent) {
|
|
195
233
|
verifiedWhenStated = true;
|
|
196
234
|
} else {
|
|
197
235
|
const metaLemmas = context.findMetaLemmasByReference(this.reference),
|
|
@@ -199,36 +237,38 @@ export default domAssigned(class Declaration {
|
|
|
199
237
|
metaLemmaMetatheorems = [
|
|
200
238
|
...metaLemmas,
|
|
201
239
|
...metatheorems
|
|
202
|
-
]
|
|
203
|
-
metaLemmaMetatheoremUnified = metaLemmaMetatheorems.some((metaLemmaMetatheorem) => {
|
|
204
|
-
const metaLemmaMetatheoremUnified = this.unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context);
|
|
205
|
-
|
|
206
|
-
if (metaLemmaMetatheoremUnified) {
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
if (metaLemmaMetatheoremUnified) {
|
|
212
|
-
verifiedWhenStated = true;
|
|
213
|
-
} else {
|
|
214
|
-
const axiom = context.findAxiomByReference(this.reference),
|
|
215
|
-
lemma = context.findLemmaByReference(this.reference),
|
|
216
|
-
theorem = context.findTheoremByReference(this.reference),
|
|
217
|
-
conjecture = context.findConjectureByReference(this.reference),
|
|
218
|
-
axiomLemmaTheoremConjecture = (axiom || lemma || theorem || conjecture);
|
|
219
|
-
|
|
220
|
-
if (axiomLemmaTheoremConjecture !== null) {
|
|
221
|
-
const axiomLemmaTheoremConjectureUnified = this.unifyAxiomLemmaTheoremConjecture(axiomLemmaTheoremConjecture, context);
|
|
222
|
-
|
|
223
|
-
if (axiomLemmaTheoremConjectureUnified) {
|
|
224
|
-
verifiedWhenStated = true;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
240
|
+
];
|
|
228
241
|
}
|
|
229
242
|
|
|
243
|
+
|
|
244
|
+
// metaLemmaMetatheoremUnified = metaLemmaMetatheorems.some((metaLemmaMetatheorem) => {
|
|
245
|
+
// const metaLemmaMetatheoremUnified = this.unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context);
|
|
246
|
+
//
|
|
247
|
+
// if (metaLemmaMetatheoremUnified) {
|
|
248
|
+
// return true;
|
|
249
|
+
// }
|
|
250
|
+
// });
|
|
251
|
+
//
|
|
252
|
+
// if (metaLemmaMetatheoremUnified) {
|
|
253
|
+
// verifiedWhenStated = true;
|
|
254
|
+
// } else {
|
|
255
|
+
// const axiom = context.findAxiomByReference(this.reference),
|
|
256
|
+
// lemma = context.findLemmaByReference(this.reference),
|
|
257
|
+
// theorem = context.findTheoremByReference(this.reference),
|
|
258
|
+
// conjecture = context.findConjectureByReference(this.reference),
|
|
259
|
+
// axiomLemmaTheoremConjecture = (axiom || lemma || theorem || conjecture);
|
|
260
|
+
//
|
|
261
|
+
// if (axiomLemmaTheoremConjecture !== null) {
|
|
262
|
+
// const axiomLemmaTheoremConjectureUnified = this.unifyAxiomLemmaTheoremConjecture(axiomLemmaTheoremConjecture, context);
|
|
263
|
+
//
|
|
264
|
+
// if (axiomLemmaTheoremConjectureUnified) {
|
|
265
|
+
// verifiedWhenStated = true;
|
|
266
|
+
// }
|
|
267
|
+
// }
|
|
268
|
+
// }
|
|
269
|
+
|
|
230
270
|
if (verifiedWhenStated) {
|
|
231
|
-
context.
|
|
271
|
+
context.trace(`...verified the '${declarationString}' stated declaration.`);
|
|
232
272
|
}
|
|
233
273
|
|
|
234
274
|
return verifiedWhenStated;
|
|
@@ -241,54 +281,50 @@ export default domAssigned(class Declaration {
|
|
|
241
281
|
|
|
242
282
|
context.trace(`Verifying the '${declarationString}' derived declaration...`);
|
|
243
283
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
284
|
+
debugger
|
|
285
|
+
|
|
286
|
+
// const metaLemmas = context.findMetaLemmasByReference(this.reference),
|
|
287
|
+
// metatheorems = context.findMetatheoremsByReference(this.reference),
|
|
288
|
+
// metaLemmaMetatheorems = [
|
|
289
|
+
// ...metaLemmas,
|
|
290
|
+
// ...metatheorems
|
|
291
|
+
// ],
|
|
292
|
+
// metaLemmaMetatheoremUnified = metaLemmaMetatheorems.some((metaLemmaMetatheorem) => {
|
|
293
|
+
// let metaLemmaMetatheoremUnified = true;
|
|
294
|
+
//
|
|
295
|
+
// if (metaLemmaMetatheoremUnified) {
|
|
296
|
+
// metaLemmaMetatheoremUnified = frame.unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context);
|
|
297
|
+
// }
|
|
298
|
+
//
|
|
299
|
+
// if (metaLemmaMetatheoremUnified) {
|
|
300
|
+
// metaLemmaMetatheoremUnified = this.unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context);
|
|
301
|
+
// }
|
|
302
|
+
//
|
|
303
|
+
// if (metaLemmaMetatheoremUnified) {
|
|
304
|
+
// return true;
|
|
305
|
+
// }
|
|
306
|
+
// });
|
|
307
|
+
//
|
|
308
|
+
// if (metaLemmaMetatheoremUnified) {
|
|
309
|
+
// verifiedWhenDerived = true;
|
|
310
|
+
// } else {
|
|
311
|
+
// const axiom = context.findAxiomByReference(this.reference),
|
|
312
|
+
// lemma = context.findLemmaByReference(this.reference),
|
|
313
|
+
// theorem = context.findTheoremByReference(this.reference),
|
|
314
|
+
// conjecture = context.findConjectureByReference(this.reference),
|
|
315
|
+
// axiomLemmaTheoremConjecture = (axiom || lemma || theorem || conjecture);
|
|
316
|
+
//
|
|
317
|
+
// if (axiomLemmaTheoremConjecture !== null) {
|
|
318
|
+
// const axiomLemmaTheoremConjectureUnified = this.unifyAxiomLemmaTheoremConjecture(axiomLemmaTheoremConjecture, context);
|
|
319
|
+
//
|
|
320
|
+
// if (axiomLemmaTheoremConjectureUnified) {
|
|
321
|
+
// verifiedWhenDerived = true;
|
|
322
|
+
// }
|
|
323
|
+
// }
|
|
324
|
+
// }
|
|
289
325
|
|
|
290
326
|
if (verifiedWhenDerived) {
|
|
291
|
-
context.
|
|
327
|
+
context.trace(`...verified the '${declarationString}' derived declaration.`);
|
|
292
328
|
}
|
|
293
329
|
|
|
294
330
|
return verifiedWhenDerived;
|
|
@@ -297,23 +333,19 @@ export default domAssigned(class Declaration {
|
|
|
297
333
|
static name = "Declaration";
|
|
298
334
|
|
|
299
335
|
static fromDeclarationNode(declarationNode, context) {
|
|
300
|
-
|
|
336
|
+
const { Reference, Statement } = dom,
|
|
337
|
+
node = declarationNode, ///
|
|
338
|
+
string = context.nodeAsString(node);
|
|
301
339
|
|
|
302
|
-
|
|
303
|
-
const { Statement } = dom;
|
|
340
|
+
let statementNode;
|
|
304
341
|
|
|
305
|
-
|
|
342
|
+
statementNode = statementNodeQuery(declarationNode);
|
|
306
343
|
|
|
307
|
-
|
|
344
|
+
statementNode = stripBracketsFromStatementNode(statementNode); ///
|
|
308
345
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
node = declarationNode, ///
|
|
313
|
-
string = context.nodeAsString(node);
|
|
314
|
-
|
|
315
|
-
declaration = new Declaration(string, reference, statement);
|
|
316
|
-
}
|
|
346
|
+
const reference = Reference.fromDeclarationNode(declarationNode, context),
|
|
347
|
+
statement = Statement.fromStatementNode(statementNode, context),
|
|
348
|
+
declaration = new Declaration(string, reference, statement);
|
|
317
349
|
|
|
318
350
|
return declaration;
|
|
319
351
|
}
|
package/src/dom/equality.js
CHANGED
|
@@ -81,7 +81,7 @@ export default domAssigned(class Equality {
|
|
|
81
81
|
verifiedWhenDerived = false;
|
|
82
82
|
|
|
83
83
|
if (stated) {
|
|
84
|
-
verifiedWhenStated = this.verifyWhenStated(context);
|
|
84
|
+
verifiedWhenStated = this.verifyWhenStated(assignments, context);
|
|
85
85
|
} else {
|
|
86
86
|
verifiedWhenDerived = this.verifyWhenDerived(context);
|
|
87
87
|
}
|
|
@@ -170,7 +170,7 @@ export default domAssigned(class Equality {
|
|
|
170
170
|
return termsVerified;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
verifyWhenStated(context) {
|
|
173
|
+
verifyWhenStated(assignments, context) {
|
|
174
174
|
let verifiedWhenStated;
|
|
175
175
|
|
|
176
176
|
const equalityString = this.string; ///
|
package/src/dom/frame.js
CHANGED
|
@@ -70,93 +70,6 @@ export default domAssigned(class Frame {
|
|
|
70
70
|
return equalTo;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
unifySubstitution(substitution, context) {
|
|
74
|
-
let substitutionUnified = false;
|
|
75
|
-
|
|
76
|
-
const frameString = this.string, ///
|
|
77
|
-
substitutionString = substitution.getString();
|
|
78
|
-
|
|
79
|
-
context.trace(`Unifying the '${substitutionString}' substitution with the '${frameString}' frame...`)
|
|
80
|
-
|
|
81
|
-
if (!substitutionUnified) {
|
|
82
|
-
substitutionUnified = this.declarations.some((declaration) => {
|
|
83
|
-
const substitutionUnified = declaration.unifySubstitution(substitution, context);
|
|
84
|
-
|
|
85
|
-
if (substitutionUnified) {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (!substitutionUnified) {
|
|
92
|
-
substitutionUnified = this.metavariables.some((metavariable) => {
|
|
93
|
-
const substitutionUnified = metavariable.unifySubstitution(substitution, context);
|
|
94
|
-
|
|
95
|
-
if (substitutionUnified) {
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (substitutionUnified) {
|
|
102
|
-
context.debug(`...unified the '${substitutionString}' substitution with the '${frameString}' frame...`)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return substitutionUnified;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
|
|
109
|
-
let metaLemmaMetatheoremUnified;
|
|
110
|
-
|
|
111
|
-
const frameString = this.string, ///
|
|
112
|
-
metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
|
|
113
|
-
|
|
114
|
-
context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${frameString}' frame...`);
|
|
115
|
-
|
|
116
|
-
const substitutions = metaLemmaMetatheorem.getSubstitutions(),
|
|
117
|
-
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
118
|
-
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
119
|
-
|
|
120
|
-
if (substitutionUnified) {
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
metaLemmaMetatheoremUnified = substitutionsUnified; ///
|
|
126
|
-
|
|
127
|
-
if (metaLemmaMetatheoremUnified) {
|
|
128
|
-
context.debug(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${frameString}' frame.`);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return metaLemmaMetatheoremUnified;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, context) {
|
|
135
|
-
let axiomLemmaTheoremOrConjectureUnified;
|
|
136
|
-
|
|
137
|
-
const frameString = this.string, ///
|
|
138
|
-
axiomLemmaTheoremStringOrConjecture = axiomLemmaTheoremOrConjecture.getString();
|
|
139
|
-
|
|
140
|
-
context.trace(`Unifying the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture with the '${frameString}' frame...`);
|
|
141
|
-
|
|
142
|
-
const substitutions = axiomLemmaTheoremOrConjecture.getSubstitutions(),
|
|
143
|
-
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
144
|
-
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
145
|
-
|
|
146
|
-
if (substitutionUnified) {
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
axiomLemmaTheoremOrConjectureUnified = substitutionsUnified; ///
|
|
152
|
-
|
|
153
|
-
if (axiomLemmaTheoremOrConjectureUnified) {
|
|
154
|
-
context.debug(`...unified the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture with the '${frameString}' frame.`);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return axiomLemmaTheoremOrConjectureUnified;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
73
|
verify(assignments, stated, context) {
|
|
161
74
|
let verified = false;
|
|
162
75
|
|
|
@@ -164,14 +77,10 @@ export default domAssigned(class Frame {
|
|
|
164
77
|
|
|
165
78
|
context.trace(`Verifying the '${frameString}' frame...`);
|
|
166
79
|
|
|
167
|
-
const declarationsVerified = this.verifyDeclarations(
|
|
80
|
+
const declarationsVerified = this.verifyDeclarations(assignments, stated, context);
|
|
168
81
|
|
|
169
82
|
if (declarationsVerified) {
|
|
170
|
-
const metavariablesVerified = this.
|
|
171
|
-
const metavariableVerified = metavariable.verify(context);
|
|
172
|
-
|
|
173
|
-
return metavariableVerified;
|
|
174
|
-
});
|
|
83
|
+
const metavariablesVerified = this.verifyMetavariables(assignments, stated, context);
|
|
175
84
|
|
|
176
85
|
if (metavariablesVerified) {
|
|
177
86
|
let verifiedWhenStated = false,
|
|
@@ -196,21 +105,53 @@ export default domAssigned(class Frame {
|
|
|
196
105
|
return verified;
|
|
197
106
|
}
|
|
198
107
|
|
|
199
|
-
verifyDeclarations(
|
|
108
|
+
verifyDeclarations(assignments, stated, context) {
|
|
109
|
+
let declarationsVerified;
|
|
110
|
+
|
|
111
|
+
const frameString = this.string, ///
|
|
112
|
+
declarationsString = declarationsStringFromDeclarations(this.declarations);
|
|
113
|
+
|
|
114
|
+
context.trace(`Verifying the '${frameString}' frame's '${declarationsString}' declarations...`);
|
|
115
|
+
|
|
200
116
|
stated = true; ///
|
|
201
117
|
|
|
202
118
|
assignments = null; ///
|
|
203
119
|
|
|
204
|
-
|
|
120
|
+
declarationsVerified = this.declarations.every((declaration) => {
|
|
205
121
|
const frame = null, ///
|
|
206
122
|
declarationVerified = declaration.verify(frame, assignments, stated, context);
|
|
207
123
|
|
|
208
124
|
return declarationVerified;
|
|
209
125
|
});
|
|
210
126
|
|
|
127
|
+
if (declarationsVerified) {
|
|
128
|
+
context.debug(`...verified the '${frameString}' frame's '${declarationsString}' declarations.`);
|
|
129
|
+
}
|
|
130
|
+
|
|
211
131
|
return declarationsVerified;
|
|
212
132
|
}
|
|
213
133
|
|
|
134
|
+
verifyMetavariables(assignments, stated, context) {
|
|
135
|
+
let metavariablesVerified;
|
|
136
|
+
|
|
137
|
+
const frameString = this.string, ///
|
|
138
|
+
metavariablesString = metavariablesStringFromDeclarations(this.metavariables);
|
|
139
|
+
|
|
140
|
+
context.trace(`Verifying the '${frameString}' frame's '${metavariablesString}' metavariables...`);
|
|
141
|
+
|
|
142
|
+
metavariablesVerified = this.metavariables.every((metavariable) => {
|
|
143
|
+
const metavariableVerified = metavariable.verify(context);
|
|
144
|
+
|
|
145
|
+
return metavariableVerified;
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
if (metavariablesVerified) {
|
|
149
|
+
context.debug(`...verified the '${frameString}' frame's '${metavariablesString}' metavariables.`);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return metavariablesVerified;
|
|
153
|
+
}
|
|
154
|
+
|
|
214
155
|
verifyWhenStated(assignments, context) {
|
|
215
156
|
let verifiedWhenStated = false;
|
|
216
157
|
|
|
@@ -278,6 +219,93 @@ export default domAssigned(class Frame {
|
|
|
278
219
|
return verifiedGivenMetaType;
|
|
279
220
|
}
|
|
280
221
|
|
|
222
|
+
unifySubstitution(substitution, context) {
|
|
223
|
+
let substitutionUnified = false;
|
|
224
|
+
|
|
225
|
+
const frameString = this.string, ///
|
|
226
|
+
substitutionString = substitution.getString();
|
|
227
|
+
|
|
228
|
+
context.trace(`Unifying the '${substitutionString}' substitution with the '${frameString}' frame...`)
|
|
229
|
+
|
|
230
|
+
if (!substitutionUnified) {
|
|
231
|
+
substitutionUnified = this.declarations.some((declaration) => {
|
|
232
|
+
const substitutionUnified = declaration.unifySubstitution(substitution, context);
|
|
233
|
+
|
|
234
|
+
if (substitutionUnified) {
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (!substitutionUnified) {
|
|
241
|
+
substitutionUnified = this.metavariables.some((metavariable) => {
|
|
242
|
+
const substitutionUnified = metavariable.unifySubstitution(substitution, context);
|
|
243
|
+
|
|
244
|
+
if (substitutionUnified) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (substitutionUnified) {
|
|
251
|
+
context.debug(`...unified the '${substitutionString}' substitution with the '${frameString}' frame...`)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return substitutionUnified;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
|
|
258
|
+
let metaLemmaMetatheoremUnified;
|
|
259
|
+
|
|
260
|
+
const frameString = this.string, ///
|
|
261
|
+
metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
|
|
262
|
+
|
|
263
|
+
context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${frameString}' frame...`);
|
|
264
|
+
|
|
265
|
+
const substitutions = metaLemmaMetatheorem.getSubstitutions(),
|
|
266
|
+
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
267
|
+
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
268
|
+
|
|
269
|
+
if (substitutionUnified) {
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
metaLemmaMetatheoremUnified = substitutionsUnified; ///
|
|
275
|
+
|
|
276
|
+
if (metaLemmaMetatheoremUnified) {
|
|
277
|
+
context.debug(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${frameString}' frame.`);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return metaLemmaMetatheoremUnified;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, context) {
|
|
284
|
+
let axiomLemmaTheoremOrConjectureUnified;
|
|
285
|
+
|
|
286
|
+
const frameString = this.string, ///
|
|
287
|
+
axiomLemmaTheoremStringOrConjecture = axiomLemmaTheoremOrConjecture.getString();
|
|
288
|
+
|
|
289
|
+
context.trace(`Unifying the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture with the '${frameString}' frame...`);
|
|
290
|
+
|
|
291
|
+
const substitutions = axiomLemmaTheoremOrConjecture.getSubstitutions(),
|
|
292
|
+
substitutionsUnified = substitutions.everySubstitution((substitution) => {
|
|
293
|
+
const substitutionUnified = this.unifySubstitution(substitution, context);
|
|
294
|
+
|
|
295
|
+
if (substitutionUnified) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
axiomLemmaTheoremOrConjectureUnified = substitutionsUnified; ///
|
|
301
|
+
|
|
302
|
+
if (axiomLemmaTheoremOrConjectureUnified) {
|
|
303
|
+
context.debug(`...unified the '${axiomLemmaTheoremStringOrConjecture}' axiom, lemma, theorem or conjecture with the '${frameString}' frame.`);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return axiomLemmaTheoremOrConjectureUnified;
|
|
307
|
+
}
|
|
308
|
+
|
|
281
309
|
static name = "Frame";
|
|
282
310
|
|
|
283
311
|
static fromFrameNode(frameNode, context) {
|
|
@@ -369,3 +397,31 @@ function metavariablesFromFrameNode(frameNode, context) {
|
|
|
369
397
|
|
|
370
398
|
return metavariables;
|
|
371
399
|
}
|
|
400
|
+
|
|
401
|
+
function declarationsStringFromDeclarations(declarations) {
|
|
402
|
+
const declarationsString = declarations.reduce((declarationsString, declaration) => {
|
|
403
|
+
const declarationString = declaration.getString();
|
|
404
|
+
|
|
405
|
+
declarationsString = (declarationsString === null) ?
|
|
406
|
+
declarationString :
|
|
407
|
+
`${declarationsString}, ${declarationString}`;
|
|
408
|
+
|
|
409
|
+
return declarationsString;
|
|
410
|
+
}, null);
|
|
411
|
+
|
|
412
|
+
return declarationsString;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
function metavariablesStringFromDeclarations(metavariable) {
|
|
416
|
+
const metavariablesString = metavariable.reduce((metavariablesString, metavariable) => {
|
|
417
|
+
const metavariableString = metavariable.getString();
|
|
418
|
+
|
|
419
|
+
metavariablesString = (metavariablesString === null) ?
|
|
420
|
+
metavariableString :
|
|
421
|
+
`${metavariablesString}, ${metavariableString}`;
|
|
422
|
+
|
|
423
|
+
return metavariablesString;
|
|
424
|
+
}, null);
|
|
425
|
+
|
|
426
|
+
return metavariablesString;
|
|
427
|
+
}
|
package/src/dom/judgement.js
CHANGED
|
@@ -38,10 +38,10 @@ export default domAssigned(class Judgement {
|
|
|
38
38
|
|
|
39
39
|
context.trace(`Verifying the '${judgementString}' judgement...`);
|
|
40
40
|
|
|
41
|
-
const frameVerified = this.
|
|
41
|
+
const frameVerified = this.verifyFrame(assignments, stated, context);
|
|
42
42
|
|
|
43
43
|
if (frameVerified) {
|
|
44
|
-
const declarationVerified = this.
|
|
44
|
+
const declarationVerified = this.verifyDeclaration(assignments, stated, context);
|
|
45
45
|
|
|
46
46
|
if (declarationVerified) {
|
|
47
47
|
let verifiedWhenStated = false,
|
|
@@ -64,6 +64,40 @@ export default domAssigned(class Judgement {
|
|
|
64
64
|
return verified;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
verifyFrame(assignments, stated, context) {
|
|
68
|
+
let frameVerified;
|
|
69
|
+
|
|
70
|
+
const frameString = this.frame.getString(),
|
|
71
|
+
judgementString = this.string; ///
|
|
72
|
+
|
|
73
|
+
context.trace(`Verifying the '${judgementString}' judgement's '${frameString}' frame...`);
|
|
74
|
+
|
|
75
|
+
frameVerified = this.frame.verify(assignments, stated, context);
|
|
76
|
+
|
|
77
|
+
if (frameVerified) {
|
|
78
|
+
context.debug(`...verified the '${judgementString}' judgement's '${frameString}' frame.`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return frameVerified;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
verifyDeclaration(assignments, stated, context) {
|
|
85
|
+
let declarationVerified;
|
|
86
|
+
|
|
87
|
+
const judgementString = this.string, ///
|
|
88
|
+
declarationString = this.declaration.getString();
|
|
89
|
+
|
|
90
|
+
context.trace(`Verifying the '${judgementString}' judgement's '${declarationString}' declaration...`);
|
|
91
|
+
|
|
92
|
+
declarationVerified = this.declaration.verify(this.frame, assignments, stated, context);
|
|
93
|
+
|
|
94
|
+
if (declarationVerified) {
|
|
95
|
+
context.debug(`...verified the '${judgementString}' judgement's '${declarationString}' declaration.`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return declarationVerified;
|
|
99
|
+
}
|
|
100
|
+
|
|
67
101
|
verifyWhenStated(assignments, context) {
|
|
68
102
|
let verifiedWhenStated;
|
|
69
103
|
|