occam-verify-cli 0.0.1074 → 0.0.1077
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/assertion/contained.js +6 -4
- package/lib/assertion/defined.js +2 -2
- package/lib/assertion/subproof.js +46 -30
- package/lib/assertion/type.js +4 -5
- package/lib/assignment/variable.js +2 -2
- package/lib/axiom.js +9 -12
- package/lib/combinator/bracketed.js +3 -2
- package/lib/combinator.js +6 -6
- package/lib/conclusion.js +2 -3
- package/lib/conjecture.js +10 -15
- package/lib/consequent.js +2 -3
- package/lib/constructor/bracketed.js +3 -2
- package/lib/constructor.js +6 -6
- package/lib/context/file.js +48 -102
- package/lib/context/local.js +21 -20
- package/lib/declaration/combinator.js +5 -5
- package/lib/declaration/constructor.js +5 -5
- package/lib/declaration/metavariable.js +4 -5
- package/lib/declaration/type.js +3 -3
- package/lib/declaration/variable.js +5 -5
- package/lib/declaration.js +10 -9
- package/lib/derivation.js +6 -2
- package/lib/equality.js +6 -2
- package/lib/frame.js +11 -13
- package/lib/index.js +13 -1
- package/lib/judgement.js +11 -8
- package/lib/label.js +6 -7
- package/lib/lemma.js +10 -15
- package/lib/metaLemma.js +15 -15
- package/lib/metatheorem.js +9 -14
- package/lib/metavariable.js +22 -27
- package/lib/mixins/statement/qualified/unify.js +2 -2
- package/lib/mixins/statement/unify.js +2 -2
- package/lib/mixins/statement/verify.js +20 -54
- package/lib/mixins/term/verify.js +3 -3
- package/lib/premise.js +24 -21
- package/lib/proof.js +8 -4
- package/lib/proofStep.js +62 -28
- package/lib/reference.js +3 -3
- package/lib/rule.js +17 -24
- package/lib/statement/qualified.js +8 -4
- package/lib/statement.js +5 -5
- package/lib/subDerivation.js +6 -2
- package/lib/subproof.js +10 -7
- package/lib/substitution/statementForMetavariable.js +36 -27
- package/lib/substitution.js +13 -13
- package/lib/substitutions.js +73 -49
- package/lib/supposition.js +30 -23
- package/lib/term.js +5 -5
- package/lib/theorem.js +10 -15
- package/lib/topLevelAssertion.js +12 -6
- package/lib/type.js +5 -5
- package/lib/unifier/equality.js +2 -2
- package/lib/unifier/metaLevel.js +6 -6
- package/lib/unifier/metavariable.js +5 -5
- package/lib/unifier/statementWithCombinator.js +2 -2
- package/lib/utilities/brackets.js +2 -2
- package/lib/utilities/node.js +2 -7
- package/lib/utilities/nominal.js +26 -0
- package/lib/utilities/subproof.js +2 -2
- package/lib/utilities/tokens.js +3 -7
- package/lib/variable.js +6 -6
- package/lib/verifier/statementAsCombinator.js +4 -11
- package/lib/verifier/termAsConstructor.js +4 -4
- package/lib/verifier/topLevel.js +9 -15
- package/package.json +1 -1
- package/src/assertion/contained.js +7 -5
- package/src/assertion/defined.js +2 -2
- package/src/assertion/subproof.js +61 -42
- package/src/assertion/type.js +2 -2
- package/src/assignment/variable.js +2 -1
- package/src/axiom.js +6 -8
- package/src/combinator/bracketed.js +6 -3
- package/src/combinator.js +4 -4
- package/src/conclusion.js +2 -2
- package/src/conjecture.js +8 -11
- package/src/consequent.js +2 -2
- package/src/constructor/bracketed.js +6 -3
- package/src/constructor.js +4 -4
- package/src/context/file.js +46 -84
- package/src/context/local.js +15 -17
- package/src/declaration/combinator.js +5 -4
- package/src/declaration/constructor.js +5 -4
- package/src/declaration/metavariable.js +3 -4
- package/src/declaration/type.js +2 -2
- package/src/declaration/variable.js +5 -4
- package/src/declaration.js +12 -9
- package/src/derivation.js +7 -1
- package/src/equality.js +7 -1
- package/src/frame.js +10 -9
- package/src/index.js +12 -0
- package/src/judgement.js +11 -5
- package/src/label.js +5 -5
- package/src/lemma.js +8 -11
- package/src/metaLemma.js +13 -11
- package/src/metatheorem.js +6 -10
- package/src/metavariable.js +23 -42
- package/src/mixins/statement/qualified/unify.js +1 -2
- package/src/mixins/statement/unify.js +2 -2
- package/src/mixins/statement/verify.js +35 -88
- package/src/mixins/term/verify.js +3 -2
- package/src/premise.js +41 -33
- package/src/proof.js +10 -3
- package/src/proofStep.js +91 -32
- package/src/reference.js +3 -2
- package/src/rule.js +17 -24
- package/src/statement/qualified.js +9 -5
- package/src/statement.js +3 -3
- package/src/subDerivation.js +8 -2
- package/src/subproof.js +12 -5
- package/src/substitution/statementForMetavariable.js +45 -30
- package/src/substitution.js +9 -9
- package/src/substitutions.js +75 -45
- package/src/supposition.js +50 -35
- package/src/term.js +3 -3
- package/src/theorem.js +8 -11
- package/src/topLevelAssertion.js +16 -7
- package/src/type.js +3 -3
- package/src/unifier/equality.js +1 -1
- package/src/unifier/metaLevel.js +8 -10
- package/src/unifier/metavariable.js +5 -5
- package/src/unifier/statementWithCombinator.js +5 -5
- package/src/utilities/brackets.js +2 -2
- package/src/utilities/node.js +1 -10
- package/src/utilities/nominal.js +14 -0
- package/src/utilities/subproof.js +2 -2
- package/src/utilities/tokens.js +2 -9
- package/src/variable.js +4 -4
- package/src/verifier/statementAsCombinator.js +4 -18
- package/src/verifier/termAsConstructor.js +4 -4
- package/src/verifier/topLevel.js +15 -14
- package/lib/assignment/metavariable.js +0 -62
- package/lib/unifier/intrinsicLevel.js +0 -144
- package/lib/utilities/unify.js +0 -24
- package/lib/verifier/intrinsicLevel.js +0 -140
- package/lib/verifier/metaLevel.js +0 -147
- package/src/assignment/metavariable.js +0 -30
- package/src/unifier/intrinsicLevel.js +0 -54
- package/src/utilities/unify.js +0 -23
- package/src/verifier/intrinsicLevel.js +0 -42
- package/src/verifier/metaLevel.js +0 -54
package/src/context/local.js
CHANGED
|
@@ -160,11 +160,10 @@ class LocalContext {
|
|
|
160
160
|
return equalityAdded;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
addVariable(variable) {
|
|
163
|
+
addVariable(variable, nested = true) {
|
|
164
164
|
let variableAdded = false;
|
|
165
165
|
|
|
166
|
-
const
|
|
167
|
-
variableName = variable.getNode(),
|
|
166
|
+
const variableName = variable.getNode(),
|
|
168
167
|
variablePresent = this.isVariablePresentByVariableName(variableName, nested);
|
|
169
168
|
|
|
170
169
|
if (!variablePresent) {
|
|
@@ -200,9 +199,8 @@ class LocalContext {
|
|
|
200
199
|
let judgementAdded = false;
|
|
201
200
|
|
|
202
201
|
const metavariableNode = judgement.getMetavariableNode(),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
judgementPresent = metavariableDefinedByMetavariableName; ///
|
|
202
|
+
metavariableDefined = this.isMetavariableDefinedByMetavariableNode(metavariableNode),
|
|
203
|
+
judgementPresent = metavariableDefined; ///
|
|
206
204
|
|
|
207
205
|
if (!judgementPresent) {
|
|
208
206
|
this.judgements.push(judgement);
|
|
@@ -276,7 +274,7 @@ class LocalContext {
|
|
|
276
274
|
|
|
277
275
|
isLabelPresentByMetavariableNode(metavariableNode) { return this.context.isLabelPresentByMetavariableNode(metavariableNode); }
|
|
278
276
|
|
|
279
|
-
|
|
277
|
+
isMetavariablePresentByMetavariableNode(metavariableNode, localContext) { return this.context.isMetavariablePresentByMetavariableNode(metavariableNode, localContext); }
|
|
280
278
|
|
|
281
279
|
isVariablePresentByVariableName(variableName, nested = true) {
|
|
282
280
|
const variable = this.findVariableByVariableName(variableName, nested),
|
|
@@ -285,25 +283,25 @@ class LocalContext {
|
|
|
285
283
|
return variablePresent;
|
|
286
284
|
}
|
|
287
285
|
|
|
288
|
-
|
|
289
|
-
const judgement = this.
|
|
286
|
+
isJudgementPresentByMetavariableNode(metavariableNode) {
|
|
287
|
+
const judgement = this.findJudgementByMetavariableNode(metavariableNode),
|
|
290
288
|
judgementPresent = (judgement !== null);
|
|
291
289
|
|
|
292
290
|
return judgementPresent;
|
|
293
291
|
}
|
|
294
292
|
|
|
295
|
-
|
|
296
|
-
const judgementPresent = this.
|
|
297
|
-
|
|
293
|
+
isMetavariableDefinedByMetavariableNode(metavariableNode) {
|
|
294
|
+
const judgementPresent = this.isJudgementPresentByMetavariableNode(metavariableNode),
|
|
295
|
+
metavariableDefined = judgementPresent; ///
|
|
298
296
|
|
|
299
|
-
return
|
|
297
|
+
return metavariableDefined
|
|
300
298
|
}
|
|
301
299
|
|
|
302
300
|
findMetaTypeByMetaTypeName(metaTypeName) { return this.context.findMetaTypeByMetaTypeName(metaTypeName); }
|
|
303
301
|
|
|
304
302
|
findLabelByMetavariableNode(metavariableNode) { return this.context.findLabelByMetavariableNode(metavariableNode); }
|
|
305
303
|
|
|
306
|
-
|
|
304
|
+
findMetavariableByMetavariableNode(metavariableNode, localContext) { return this.context.findMetavariableByMetavariableNode(metavariableNode, localContext); }
|
|
307
305
|
|
|
308
306
|
findVariableByVariableName(variableName, nested = true) {
|
|
309
307
|
const variables = this.getVariables(nested),
|
|
@@ -318,12 +316,12 @@ class LocalContext {
|
|
|
318
316
|
return variable;
|
|
319
317
|
}
|
|
320
318
|
|
|
321
|
-
|
|
319
|
+
findJudgementByMetavariableNode(metavariableNode) {
|
|
322
320
|
const judgements = this.getJudgements(),
|
|
323
321
|
judgement = judgements.find((judgement) => {
|
|
324
|
-
const
|
|
322
|
+
const judgementMatchesMetavariableNode = judgement.matchMetavariableNode(metavariableNode);
|
|
325
323
|
|
|
326
|
-
if (
|
|
324
|
+
if (judgementMatchesMetavariableNode) {
|
|
327
325
|
return true;
|
|
328
326
|
}
|
|
329
327
|
}) || null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import shim from "../shim";
|
|
4
4
|
|
|
5
5
|
export default class CombinatorDeclaration {
|
|
6
6
|
constructor(fileContext, combinator) {
|
|
@@ -25,9 +25,9 @@ export default class CombinatorDeclaration {
|
|
|
25
25
|
|
|
26
26
|
this.fileContext.trace(`Verifying the '${combinatorDeclarationString}' combinator declaration...`);
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const combinatorVerifiedWhenDeclared = this.combinator.verifyWhenDeclared(this.fileContext);
|
|
29
29
|
|
|
30
|
-
if (
|
|
30
|
+
if (combinatorVerifiedWhenDeclared) {
|
|
31
31
|
this.fileContext.addCombinator(this.combinator);
|
|
32
32
|
|
|
33
33
|
verified = true;
|
|
@@ -41,7 +41,8 @@ export default class CombinatorDeclaration {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
static fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext) {
|
|
44
|
-
const
|
|
44
|
+
const { Combinator } = shim,
|
|
45
|
+
combinator = Combinator.fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext),
|
|
45
46
|
combinatorDeclaration = new CombinatorDeclaration(fileContext, combinator);
|
|
46
47
|
|
|
47
48
|
return combinatorDeclaration;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import shim from "../shim";
|
|
4
4
|
|
|
5
5
|
export default class ConstructorDeclaration {
|
|
6
6
|
constructor(fileContext, constructor) {
|
|
@@ -25,9 +25,9 @@ export default class ConstructorDeclaration {
|
|
|
25
25
|
|
|
26
26
|
this.fileContext.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const constructorVerifiedWhenDeclared = this.constructor.verifyWhenDeclared(this.fileContext);
|
|
29
29
|
|
|
30
|
-
if (
|
|
30
|
+
if (constructorVerifiedWhenDeclared) {
|
|
31
31
|
this.fileContext.addConstructor(this.constructor);
|
|
32
32
|
|
|
33
33
|
verified = true;
|
|
@@ -41,7 +41,8 @@ export default class ConstructorDeclaration {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
static fromConstructorDeclarationNode(constructorDeclarationNode, fileContext) {
|
|
44
|
-
const
|
|
44
|
+
const { Constructor } = shim,
|
|
45
|
+
constructor = Constructor.fromConstructorDeclarationNode(constructorDeclarationNode, fileContext),
|
|
45
46
|
constructorDeclaration = new ConstructorDeclaration(fileContext, constructor);
|
|
46
47
|
|
|
47
48
|
return constructorDeclaration;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import shim from "../shim";
|
|
4
|
-
import Metavariable from "../metavariable";
|
|
5
4
|
|
|
6
5
|
import { nodeQuery } from "../utilities/query";
|
|
7
6
|
|
|
@@ -33,9 +32,9 @@ export default class MetavariableDeclaration {
|
|
|
33
32
|
|
|
34
33
|
this.fileContext.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration...`);
|
|
35
34
|
|
|
36
|
-
const
|
|
35
|
+
const metavariableVerifiedWhenDeclared = this.metavariable.verifyWhenDeclared(this.fileContext);
|
|
37
36
|
|
|
38
|
-
if (
|
|
37
|
+
if (metavariableVerifiedWhenDeclared) {
|
|
39
38
|
this.fileContext.addMetavariable(this.metavariable);
|
|
40
39
|
|
|
41
40
|
verified = true;
|
|
@@ -49,7 +48,7 @@ export default class MetavariableDeclaration {
|
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
static fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
|
|
52
|
-
const { MetaType } = shim,
|
|
51
|
+
const { MetaType, Metavariable } = shim,
|
|
53
52
|
metaTypeNode = metaTypeNodeQuery(metavariableDeclarationNode),
|
|
54
53
|
metaType = MetaType.fromMetaTypeNode(metaTypeNode, fileContext),
|
|
55
54
|
metavariable = Metavariable.fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext),
|
package/src/declaration/type.js
CHANGED
|
@@ -25,9 +25,9 @@ export default class TypeDeclaration {
|
|
|
25
25
|
|
|
26
26
|
this.fileContext.trace(`Verifying the '${typeDeclarationString}' type declaration...`);
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const typeVerifiedWhenDeclared = this.type.verifyWhenDeclared(this.fileContext);
|
|
29
29
|
|
|
30
|
-
if (
|
|
30
|
+
if (typeVerifiedWhenDeclared) {
|
|
31
31
|
this.fileContext.addType(this.type);
|
|
32
32
|
|
|
33
33
|
verified = true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import shim from "../shim";
|
|
4
4
|
|
|
5
5
|
import { nodeQuery } from "../utilities/query";
|
|
6
6
|
import { typeNameFromTypeNode } from "../utilities/name";
|
|
@@ -33,9 +33,9 @@ export default class VariableDeclaration {
|
|
|
33
33
|
|
|
34
34
|
this.fileContext.trace(`Verifying the '${variableDeclarationString}' variable declaration...`);
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const variableVerifiedWhenDeclared = this.variable.verifyWhenDeclared(this.fileContext);
|
|
37
37
|
|
|
38
|
-
if (
|
|
38
|
+
if (variableVerifiedWhenDeclared) {
|
|
39
39
|
this.fileContext.addVariable(this.variable);
|
|
40
40
|
|
|
41
41
|
verified = true;
|
|
@@ -49,7 +49,8 @@ export default class VariableDeclaration {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
static fromVariableDeclarationNode(variableDeclarationNode, fileContext) {
|
|
52
|
-
const
|
|
52
|
+
const { Variable } = shim,
|
|
53
|
+
typeNode = typeNodeQuery(variableDeclarationNode),
|
|
53
54
|
variable = Variable.fromVariableDeclarationNode(variableDeclarationNode, fileContext),
|
|
54
55
|
string = stringFromVariableAndTypeNode(variable, typeNode),
|
|
55
56
|
variableDeclaration = new VariableDeclaration(fileContext, string, variable);
|
package/src/declaration.js
CHANGED
|
@@ -9,7 +9,7 @@ import { stripBracketsFromStatementNode } from "./utilities/brackets";
|
|
|
9
9
|
const referenceNodeQuery = nodeQuery("/declaration/reference"),
|
|
10
10
|
statementNodeQuery = nodeQuery("/declaration/statement");
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
class Declaration {
|
|
13
13
|
constructor(string, reference, statement) {
|
|
14
14
|
this.string = string;
|
|
15
15
|
this.reference = reference;
|
|
@@ -100,17 +100,14 @@ export default class Declaration {
|
|
|
100
100
|
|
|
101
101
|
localContext.trace(`Verifying the '${declarationString}' declaration...`);
|
|
102
102
|
|
|
103
|
-
stated = true;
|
|
103
|
+
stated = true; ///
|
|
104
104
|
|
|
105
|
-
assignments = null;
|
|
105
|
+
assignments = null; ///
|
|
106
106
|
|
|
107
|
-
const referenceVerified = this.reference.verify(localContext)
|
|
107
|
+
const referenceVerified = this.reference.verify(localContext),
|
|
108
|
+
statementVerified = this.statement.verify(assignments, stated, localContext);
|
|
108
109
|
|
|
109
|
-
|
|
110
|
-
const statementVerified = this.statement.verify(assignments, stated, localContext);
|
|
111
|
-
|
|
112
|
-
verified = statementVerified; ///
|
|
113
|
-
}
|
|
110
|
+
verified = (referenceVerified && statementVerified);
|
|
114
111
|
|
|
115
112
|
if (verified) {
|
|
116
113
|
localContext.debug(`...verified the '${declarationString}' declaration.`);
|
|
@@ -141,3 +138,9 @@ export default class Declaration {
|
|
|
141
138
|
return declaration;
|
|
142
139
|
}
|
|
143
140
|
}
|
|
141
|
+
|
|
142
|
+
Object.assign(shim, {
|
|
143
|
+
Declaration
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
export default Declaration;
|
package/src/derivation.js
CHANGED
|
@@ -10,7 +10,7 @@ const { last } = arrayUtilities;
|
|
|
10
10
|
|
|
11
11
|
const proofStepNodesQuery = nodesQuery("/derivation/proofStep|lastProofStep");
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
class Derivation {
|
|
14
14
|
constructor(proofSteps) {
|
|
15
15
|
this.proofSteps = proofSteps;
|
|
16
16
|
}
|
|
@@ -52,3 +52,9 @@ export default class Derivation {
|
|
|
52
52
|
return derivation;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
Object.assign(shim, {
|
|
57
|
+
Derivation
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export default Derivation;
|
package/src/equality.js
CHANGED
|
@@ -11,7 +11,7 @@ const variableNodeQuery = nodeQuery("/term/variable!"),
|
|
|
11
11
|
leftTermNodeQuery = nodeQuery("/equality/term[0]"),
|
|
12
12
|
rightTermNodeQuery = nodeQuery("/equality/term[1]");
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
class Equality {
|
|
15
15
|
constructor(string,leftTerm, rightTerm) {
|
|
16
16
|
this.string = string;
|
|
17
17
|
this.leftTerm = leftTerm;
|
|
@@ -220,3 +220,9 @@ export default class Equality {
|
|
|
220
220
|
return equality;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
+
|
|
224
|
+
Object.assign(shim, {
|
|
225
|
+
Equality
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
export default Equality;
|
package/src/frame.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
import shim from "./shim";
|
|
6
|
-
import Declaration from "./declaration";
|
|
7
|
-
import Metavariable from "./metavariable";
|
|
8
6
|
|
|
9
7
|
import { FRAME_META_TYPE_NAME } from "./metaTypeNames";
|
|
10
8
|
import { nodeQuery, nodesQuery } from "./utilities/query";
|
|
@@ -76,16 +74,16 @@ class Frame {
|
|
|
76
74
|
return frameNodeMatches;
|
|
77
75
|
}
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
let
|
|
77
|
+
matchMetavariableNode(metavariableNode) {
|
|
78
|
+
let metavariableNodeMatches = false;
|
|
81
79
|
|
|
82
80
|
const metavariable = this.getMetavariable();
|
|
83
81
|
|
|
84
82
|
if (metavariable !== null) {
|
|
85
|
-
|
|
83
|
+
metavariableNodeMatches = metavariable.matchMetavariableNode(metavariableNode);
|
|
86
84
|
}
|
|
87
85
|
|
|
88
|
-
return
|
|
86
|
+
return metavariableNodeMatches;
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
unifySubstitution(substitution, localContext) {
|
|
@@ -259,7 +257,8 @@ class Frame {
|
|
|
259
257
|
let frame = null;
|
|
260
258
|
|
|
261
259
|
if (frameNode !== null) {
|
|
262
|
-
const
|
|
260
|
+
const { Declaration, Metavariable } = shim,
|
|
261
|
+
declarationNodes = declarationNodesQuery(frameNode),
|
|
263
262
|
metavariableNodes = metavariableNodesQuery(frameNode),
|
|
264
263
|
declarations = declarationNodes.map((declarationNode) => {
|
|
265
264
|
const declaration = Declaration.fromDeclarationNode(declarationNode, localContext);
|
|
@@ -289,7 +288,8 @@ class Frame {
|
|
|
289
288
|
const metavariableNode = metavariableNodeQuery(frameNode);
|
|
290
289
|
|
|
291
290
|
if (metavariableNode !== null) {
|
|
292
|
-
const
|
|
291
|
+
const { Metavariable } = shim,
|
|
292
|
+
metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
|
|
293
293
|
declarations = [],
|
|
294
294
|
metavariables = [
|
|
295
295
|
metavariable
|
|
@@ -313,7 +313,8 @@ class Frame {
|
|
|
313
313
|
const metavariableNode = metavariableNodeQuery(frameNode);
|
|
314
314
|
|
|
315
315
|
if (metavariableNode !== null) {
|
|
316
|
-
const
|
|
316
|
+
const { Metavariable } = shim,
|
|
317
|
+
metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
|
|
317
318
|
declarations = [],
|
|
318
319
|
metavariables = [
|
|
319
320
|
metavariable
|
package/src/index.js
CHANGED
|
@@ -6,20 +6,32 @@ import Rule from "./rule";
|
|
|
6
6
|
import Label from "./label";
|
|
7
7
|
import Axiom from "./axiom";
|
|
8
8
|
import Lemma from "./lemma";
|
|
9
|
+
import Frame from "./frame";
|
|
10
|
+
import Proof from "./proof";
|
|
9
11
|
import Premise from "./premise";
|
|
10
12
|
import Theorem from "./theorem";
|
|
13
|
+
import Equality from "./equality";
|
|
11
14
|
import MetaType from "./metaType";
|
|
15
|
+
import Subproof from "./subproof";
|
|
12
16
|
import Variable from "./variable";
|
|
13
17
|
import Statement from "./statement";
|
|
14
18
|
import ProofStep from "./proofStep";
|
|
19
|
+
import Judgement from "./judgement";
|
|
20
|
+
import MetaLemma from "./metaLemma";
|
|
15
21
|
import Consequent from "./consequent";
|
|
16
22
|
import Conjecture from "./conjecture";
|
|
17
23
|
import Combinator from "./combinator";
|
|
18
24
|
import Conclusion from "./conclusion";
|
|
25
|
+
import Derivation from "./derivation";
|
|
26
|
+
import Declaration from "./declaration";
|
|
19
27
|
import Constructor from "./constructor";
|
|
20
28
|
import Supposition from "./supposition";
|
|
21
29
|
import Metatheorem from "./metatheorem";
|
|
22
30
|
import Metavariable from "./metavariable";
|
|
31
|
+
import Substitution from "./substitution";
|
|
32
|
+
import Substitutions from "./substitutions";
|
|
33
|
+
import SubDerivation from "./subDerivation";
|
|
34
|
+
import QualifiedStatement from "./statement/qualified";
|
|
23
35
|
import UnqualifiedStatement from "./statement/unqualified";
|
|
24
36
|
|
|
25
37
|
export { default as Log } from "./log";
|
package/src/judgement.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import Declaration from "./declaration";
|
|
3
|
+
import shim from "./shim";
|
|
5
4
|
import JudgementAssignment from "./assignment/judgement";
|
|
6
5
|
|
|
7
6
|
import { nodeQuery } from "./utilities/query";
|
|
@@ -9,7 +8,7 @@ import { nodeQuery } from "./utilities/query";
|
|
|
9
8
|
const frameNodeQuery = nodeQuery("/judgement/frame"),
|
|
10
9
|
declarationNodeQuery = nodeQuery("/judgement/declaration");
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
class Judgement {
|
|
13
12
|
constructor(string, frame, declaration) {
|
|
14
13
|
this.string = string;
|
|
15
14
|
this.frame = frame;
|
|
@@ -30,7 +29,7 @@ export default class Judgement {
|
|
|
30
29
|
|
|
31
30
|
getMetavariableNode() { return this.frame.getMetavariableNode(); }
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
matchMetavariableNode(metavariableNode) { return this.frame.matchMetavariableNode(metavariableNode); }
|
|
34
33
|
|
|
35
34
|
verify(assignments, stated, localContext) {
|
|
36
35
|
let verified;
|
|
@@ -117,7 +116,8 @@ export default class Judgement {
|
|
|
117
116
|
let judgement = null;
|
|
118
117
|
|
|
119
118
|
if (judgementNode !== null) {
|
|
120
|
-
const
|
|
119
|
+
const { Frame, Declaration } = shim,
|
|
120
|
+
frameNode = frameNodeQuery(judgementNode),
|
|
121
121
|
declarationNode = declarationNodeQuery(judgementNode),
|
|
122
122
|
node = judgementNode, ///
|
|
123
123
|
string = localContext.nodeAsString(node),
|
|
@@ -130,3 +130,9 @@ export default class Judgement {
|
|
|
130
130
|
return judgement;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
+
|
|
134
|
+
Object.assign(shim, {
|
|
135
|
+
Judgement
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
export default Judgement;
|
package/src/label.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import shim from "./shim";
|
|
4
4
|
import LocalContext from "./context/local";
|
|
5
|
-
import Metavariable from "./metavariable";
|
|
6
5
|
|
|
7
6
|
import { nodeQuery } from "./utilities/query";
|
|
8
7
|
import { metavariableFromJSON, metavariableToMetavariableJSON } from "./utilities/json";
|
|
@@ -22,12 +21,12 @@ class Label {
|
|
|
22
21
|
|
|
23
22
|
matchMetavariableNode(metavariableNode) { return this.metavariable.matchMetavariableNode(metavariableNode); }
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
verifyWhenDeclared(fileContext) {
|
|
26
25
|
let verifiedAtTopLevel = false;
|
|
27
26
|
|
|
28
27
|
const labelString = this.getString(); ///
|
|
29
28
|
|
|
30
|
-
fileContext.trace(`Verifying the '${labelString}' label
|
|
29
|
+
fileContext.trace(`Verifying the '${labelString}' label when declared...`);
|
|
31
30
|
|
|
32
31
|
const metavariableNode = this.metavariable.getNode(),
|
|
33
32
|
labelPresent = fileContext.isLabelPresentByMetavariableNode(metavariableNode);
|
|
@@ -39,7 +38,7 @@ class Label {
|
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
if (verifiedAtTopLevel) {
|
|
42
|
-
fileContext.debug(`...verified the '${labelString}' label
|
|
41
|
+
fileContext.debug(`...verified the '${labelString}' label when declared.`);
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
return verifiedAtTopLevel;
|
|
@@ -63,7 +62,8 @@ class Label {
|
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
static fromLabelNode(labelNode, fileContext) {
|
|
66
|
-
const
|
|
65
|
+
const { Metavariable } = shim,
|
|
66
|
+
metavariableNode = metavariableNodeQuery(labelNode),
|
|
67
67
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
68
68
|
metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
|
|
69
69
|
label = new Label(metavariable);
|
package/src/lemma.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import shim from "./shim";
|
|
4
|
-
import Label from "./label";
|
|
5
|
-
import Proof from "./proof";
|
|
6
|
-
import Consequent from "./consequent";
|
|
7
|
-
import Supposition from "./supposition";
|
|
8
4
|
import LocalContext from "./context/local";
|
|
9
|
-
import Substitutions from "./substitutions";
|
|
10
5
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
11
6
|
|
|
12
7
|
import { EMPTY_STRING } from "./constants";
|
|
@@ -28,15 +23,15 @@ class Lemma extends TopLevelAssertion {
|
|
|
28
23
|
this.fileContext.trace(`Verifying a lemma...`) :
|
|
29
24
|
this.fileContext.trace(`Verifying the '${lemmaString}' lemma...`);
|
|
30
25
|
|
|
31
|
-
const
|
|
32
|
-
const
|
|
26
|
+
const labelsVerifiedWhenDeclared = this.labels.every((label) => {
|
|
27
|
+
const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
|
|
33
28
|
|
|
34
|
-
if (
|
|
29
|
+
if (labelVVerifiedWhenDeclared) {
|
|
35
30
|
return true;
|
|
36
31
|
}
|
|
37
32
|
});
|
|
38
33
|
|
|
39
|
-
if (
|
|
34
|
+
if (labelsVerifiedWhenDeclared) {
|
|
40
35
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
41
36
|
suppositionsVerified = this.suppositions.every((supposition) => {
|
|
42
37
|
const suppositionVerified = supposition.verify(localContext);
|
|
@@ -50,7 +45,8 @@ class Lemma extends TopLevelAssertion {
|
|
|
50
45
|
const consequentVerified = this.consequent.verify(localContext);
|
|
51
46
|
|
|
52
47
|
if (consequentVerified) {
|
|
53
|
-
const
|
|
48
|
+
const { Substitutions } = shim,
|
|
49
|
+
substitutions = Substitutions.fromNothing(),
|
|
54
50
|
proofVerified = this.proof.verify(substitutions, this.consequent, localContext);
|
|
55
51
|
|
|
56
52
|
if (proofVerified) {
|
|
@@ -74,7 +70,8 @@ class Lemma extends TopLevelAssertion {
|
|
|
74
70
|
}
|
|
75
71
|
|
|
76
72
|
static fromLemmaNode(lemmaNode, fileContext) {
|
|
77
|
-
const
|
|
73
|
+
const { Label, Proof, Supposition, Consequent } = shim,
|
|
74
|
+
proofNode = proofNodeQuery(lemmaNode),
|
|
78
75
|
labelNodes = labelNodesQuery(lemmaNode),
|
|
79
76
|
consequentNode = consequentNodeQuery(lemmaNode),
|
|
80
77
|
suppositionNodes = suppositionNodesQuery(lemmaNode),
|
package/src/metaLemma.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import Proof from "./proof";
|
|
5
|
-
import Consequent from "./consequent";
|
|
6
|
-
import Supposition from "./supposition";
|
|
3
|
+
import shim from "./shim";
|
|
7
4
|
import LocalContext from "./context/local";
|
|
8
|
-
import Substitutions from "./substitutions";
|
|
9
5
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
10
6
|
|
|
11
7
|
import { EMPTY_STRING } from "./constants";
|
|
@@ -17,7 +13,7 @@ const proofNodeQuery = nodeQuery("/metaLemma/proof"),
|
|
|
17
13
|
consequentNodeQuery = nodeQuery("/metaLemma/consequent"),
|
|
18
14
|
suppositionNodesQuery = nodesQuery("/metaLemma/supposition");
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
class MetaLemma extends TopLevelAssertion {
|
|
21
17
|
constructor(fileContext, string, labels, suppositions, consequent, proof, substitutions) {
|
|
22
18
|
super(fileContext, string, labels, suppositions, consequent, proof);
|
|
23
19
|
|
|
@@ -37,15 +33,15 @@ export default class MetaLemma extends TopLevelAssertion {
|
|
|
37
33
|
this.fileContext.trace(`Verifying a meta-lemma...`) :
|
|
38
34
|
this.fileContext.trace(`Verifying the '${metaLemmaString}' meta-lemma...`);
|
|
39
35
|
|
|
40
|
-
const
|
|
41
|
-
const
|
|
36
|
+
const labelsVerifiedWhenDeclared = this.labels.every((label) => {
|
|
37
|
+
const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
|
|
42
38
|
|
|
43
|
-
if (
|
|
39
|
+
if (labelVVerifiedWhenDeclared) {
|
|
44
40
|
return true;
|
|
45
41
|
}
|
|
46
42
|
});
|
|
47
43
|
|
|
48
|
-
if (
|
|
44
|
+
if (labelsVerifiedWhenDeclared) {
|
|
49
45
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
50
46
|
suppositionsVerified = this.suppositions.every((supposition) => {
|
|
51
47
|
const suppositionVerified = supposition.verify(localContext);
|
|
@@ -82,7 +78,8 @@ export default class MetaLemma extends TopLevelAssertion {
|
|
|
82
78
|
}
|
|
83
79
|
|
|
84
80
|
static fromMetaLemmaNode(metaLemmaNode, fileContext) {
|
|
85
|
-
const
|
|
81
|
+
const { Label, Proof, Consequent, Supposition, Substitutions } = shim,
|
|
82
|
+
proofNode = proofNodeQuery(metaLemmaNode),
|
|
86
83
|
labelNodes = labelNodesQuery(metaLemmaNode),
|
|
87
84
|
consequentNode = consequentNodeQuery(metaLemmaNode),
|
|
88
85
|
suppositionNodes = suppositionNodesQuery(metaLemmaNode),
|
|
@@ -106,3 +103,8 @@ export default class MetaLemma extends TopLevelAssertion {
|
|
|
106
103
|
}
|
|
107
104
|
}
|
|
108
105
|
|
|
106
|
+
Object.assign(shim, {
|
|
107
|
+
MetaLemma
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export default MetaLemma;
|
package/src/metatheorem.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import shim from "./shim";
|
|
4
|
-
import Label from "./label";
|
|
5
|
-
import Proof from "./proof";
|
|
6
|
-
import Consequent from "./consequent";
|
|
7
|
-
import Supposition from "./supposition";
|
|
8
4
|
import LocalContext from "./context/local";
|
|
9
|
-
import Substitutions from "./substitutions";
|
|
10
5
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
11
6
|
|
|
12
7
|
import { nodeQuery, nodesQuery } from "./utilities/query";
|
|
@@ -43,15 +38,15 @@ class Metatheorem extends TopLevelAssertion {
|
|
|
43
38
|
|
|
44
39
|
this.fileContext.trace(`Verifying the '${metatheoremString}' metatheorem...`);
|
|
45
40
|
|
|
46
|
-
const
|
|
47
|
-
const
|
|
41
|
+
const labelsVerifiedWhenDeclared = this.labels.every((label) => {
|
|
42
|
+
const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
|
|
48
43
|
|
|
49
|
-
if (
|
|
44
|
+
if (labelVVerifiedWhenDeclared) {
|
|
50
45
|
return true;
|
|
51
46
|
}
|
|
52
47
|
});
|
|
53
48
|
|
|
54
|
-
if (
|
|
49
|
+
if (labelsVerifiedWhenDeclared) {
|
|
55
50
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
56
51
|
suppositionsVerified = this.suppositions.every((supposition) => {
|
|
57
52
|
const suppositionVerified = supposition.verify(localContext);
|
|
@@ -117,7 +112,8 @@ class Metatheorem extends TopLevelAssertion {
|
|
|
117
112
|
}
|
|
118
113
|
|
|
119
114
|
static fromMetatheoremNode(metatheoremNode, fileContext) {
|
|
120
|
-
const
|
|
115
|
+
const { Label, Proof, Consequent, Supposition, Substitutions } = shim,
|
|
116
|
+
proofNode = proofNodeQuery(metatheoremNode),
|
|
121
117
|
labelNodes = labelNodesQuery(metatheoremNode),
|
|
122
118
|
consequentNode = consequentNodeQuery(metatheoremNode),
|
|
123
119
|
suppositionNodes = suppositionNodesQuery(metatheoremNode),
|