occam-verify-cli 0.0.1074 → 0.0.1075
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/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 +6 -2
- 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 +17 -23
- package/lib/mixins/statement/qualified/unify.js +2 -2
- package/lib/mixins/statement/verify.js +8 -12
- package/lib/mixins/term/verify.js +3 -3
- package/lib/premise.js +2 -3
- package/lib/proof.js +8 -4
- package/lib/proofStep.js +3 -7
- package/lib/reference.js +3 -3
- package/lib/rule.js +11 -16
- package/lib/statement/qualified.js +6 -2
- package/lib/statement.js +5 -5
- package/lib/subDerivation.js +6 -2
- package/lib/subproof.js +10 -7
- package/lib/substitution/statementForMetavariable.js +14 -15
- package/lib/substitution.js +13 -13
- package/lib/substitutions.js +51 -47
- package/lib/supposition.js +2 -3
- package/lib/term.js +5 -5
- package/lib/theorem.js +10 -15
- package/lib/topLevelAssertion.js +3 -3
- 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 +5 -5
- package/lib/verifier/metaLevel.js +2 -2
- package/lib/verifier/statementAsCombinator.js +2 -2
- package/lib/verifier/termAsConstructor.js +2 -2
- package/lib/verifier/topLevel.js +9 -15
- package/package.json +1 -1
- 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 +7 -1
- 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 +18 -34
- package/src/mixins/statement/qualified/unify.js +1 -2
- package/src/mixins/statement/verify.js +19 -18
- package/src/mixins/term/verify.js +3 -2
- package/src/premise.js +2 -2
- package/src/proof.js +10 -3
- package/src/proofStep.js +4 -6
- package/src/reference.js +3 -2
- package/src/rule.js +10 -12
- package/src/statement/qualified.js +7 -1
- package/src/statement.js +3 -3
- package/src/subDerivation.js +8 -2
- package/src/subproof.js +12 -5
- package/src/substitution/statementForMetavariable.js +12 -12
- package/src/substitution.js +9 -9
- package/src/substitutions.js +42 -34
- package/src/supposition.js +2 -2
- package/src/term.js +3 -3
- package/src/theorem.js +8 -11
- package/src/topLevelAssertion.js +3 -2
- 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 +3 -3
- package/src/verifier/metaLevel.js +2 -2
- package/src/verifier/statementAsCombinator.js +3 -3
- package/src/verifier/termAsConstructor.js +2 -2
- 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/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/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),
|
package/src/metavariable.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import shim from "./shim";
|
|
4
4
|
import LocalContext from "./context/local";
|
|
5
|
-
import metavariableUnifier from "./unifier/metavariable";
|
|
6
5
|
import FrameForMetavariableSubstitution from "./substitution/frameForMetavariable";
|
|
7
6
|
import StatementForMetavariableSubstitution from "./substitution/statementForMetavariable";
|
|
8
7
|
|
|
@@ -80,11 +79,11 @@ class Metavariable {
|
|
|
80
79
|
|
|
81
80
|
localContext.trace(`Unifying the '${frameString}' frame with the '${metavariableString}' metavariable...`);
|
|
82
81
|
|
|
83
|
-
const
|
|
84
|
-
simpleSubstitutionPresent = substitutions.
|
|
82
|
+
const metavariableNode = this.node, ///
|
|
83
|
+
simpleSubstitutionPresent = substitutions.isSimpleSubstitutionPresentByMetavariableNode(metavariableNode);
|
|
85
84
|
|
|
86
85
|
if (simpleSubstitutionPresent) {
|
|
87
|
-
const simpleSubstitution = substitutions.
|
|
86
|
+
const simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariableNode(metavariableNode),
|
|
88
87
|
substitution = simpleSubstitution, ///
|
|
89
88
|
frameNodeMatches = substitution.matchFrameNode(frameNode);
|
|
90
89
|
|
|
@@ -131,14 +130,13 @@ class Metavariable {
|
|
|
131
130
|
|
|
132
131
|
const statementNode = statement.getNode(),
|
|
133
132
|
metavariableNode = this.node, ///
|
|
134
|
-
metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
135
133
|
substitutionNode = (substitution !== null) ?
|
|
136
134
|
substitution.getSubstitutionNode() :
|
|
137
135
|
null,
|
|
138
|
-
substitutionPresent = substitutions.
|
|
136
|
+
substitutionPresent = substitutions.isSubstitutionPresentByMetavariableNodeAndSubstitutionNode(metavariableNode, substitutionNode);
|
|
139
137
|
|
|
140
138
|
if (substitutionPresent) {
|
|
141
|
-
const substitution = substitutions.
|
|
139
|
+
const substitution = substitutions.findSubstitutionByMetavariableNodeAndSubstitutionNode(metavariableNode, substitutionNode),
|
|
142
140
|
statementNodeMatches = substitution.matchStatementNode(statementNode);
|
|
143
141
|
|
|
144
142
|
if (statementNodeMatches) {
|
|
@@ -180,8 +178,8 @@ class Metavariable {
|
|
|
180
178
|
|
|
181
179
|
localContext.trace(`Unifying the '${substitutionString}' substitution with the '${metavariableString}' metavariable...`);
|
|
182
180
|
|
|
183
|
-
const
|
|
184
|
-
judgement = localContext.
|
|
181
|
+
const metavariableNode = this.node, ///
|
|
182
|
+
judgement = localContext.findJudgementByMetavariableNode(metavariableNode);
|
|
185
183
|
|
|
186
184
|
if (judgement !== null){
|
|
187
185
|
const declaration = judgement.getDeclaration();
|
|
@@ -203,18 +201,10 @@ class Metavariable {
|
|
|
203
201
|
|
|
204
202
|
localContext.trace(`Verifying the '${metavariableString}' metavariable...`);
|
|
205
203
|
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (metavariable !== null) {
|
|
210
|
-
const metavariableA = metavariable, ///
|
|
211
|
-
metavariableB = this,
|
|
212
|
-
metavariableNodeA = metavariableA.getNode(), ///
|
|
213
|
-
metavariableNodeB = metavariableB.getNode(),
|
|
214
|
-
metavariableUnified = metavariableUnifier.unify(metavariableNodeA, metavariableNodeB, localContext);
|
|
204
|
+
const metavariableNode = this.node,
|
|
205
|
+
metavariablePresent = localContext.isMetavariablePresentByMetavariableNode(metavariableNode, localContext);
|
|
215
206
|
|
|
216
|
-
|
|
217
|
-
}
|
|
207
|
+
verified = metavariablePresent; ///
|
|
218
208
|
|
|
219
209
|
if (verified) {
|
|
220
210
|
localContext.debug(`...verified the '${metavariableString}' metavariable.`);
|
|
@@ -223,12 +213,12 @@ class Metavariable {
|
|
|
223
213
|
return verified;
|
|
224
214
|
}
|
|
225
215
|
|
|
226
|
-
|
|
216
|
+
verifyWhenDeclared(fileContext) {
|
|
227
217
|
let verifiedAtTopLevel = false;
|
|
228
218
|
|
|
229
219
|
const metavariableString = this.string; ///
|
|
230
220
|
|
|
231
|
-
fileContext.trace(`Verifying the '${metavariableString}' metavariable
|
|
221
|
+
fileContext.trace(`Verifying the '${metavariableString}' metavariable when declared...`);
|
|
232
222
|
|
|
233
223
|
const metavariableNode = this.node, ///
|
|
234
224
|
metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
@@ -262,7 +252,7 @@ class Metavariable {
|
|
|
262
252
|
}
|
|
263
253
|
|
|
264
254
|
if (verifiedAtTopLevel) {
|
|
265
|
-
fileContext.debug(`...verified the '${metavariableString}' metavariable
|
|
255
|
+
fileContext.debug(`...verified the '${metavariableString}' metavariable when declared.`);
|
|
266
256
|
}
|
|
267
257
|
|
|
268
258
|
return verifiedAtTopLevel;
|
|
@@ -276,9 +266,8 @@ class Metavariable {
|
|
|
276
266
|
|
|
277
267
|
localContext.trace(`Verifying the '${metavariableString}' metavariable given the '${metaTypeString}' meta-type...`);
|
|
278
268
|
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
metavariable = localContext.findMetavariableByMetavariableName(metavariableName);
|
|
269
|
+
const metavariableNode = this.node, ///
|
|
270
|
+
metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode, localContext);
|
|
282
271
|
|
|
283
272
|
if (metavariable !== null) {
|
|
284
273
|
const metaTypeMatches = metavariable.matchMetaType(metaType);
|
|
@@ -360,8 +349,7 @@ Object.assign(shim, {
|
|
|
360
349
|
export default Metavariable;
|
|
361
350
|
|
|
362
351
|
function metavariableFromMetavariableNode(metavariableNode, localContext) {
|
|
363
|
-
const
|
|
364
|
-
metavariable = localContext.findMetavariableByMetavariableName(metavariableName);
|
|
352
|
+
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode, localContext);
|
|
365
353
|
|
|
366
354
|
return metavariable;
|
|
367
355
|
}
|
|
@@ -372,9 +360,7 @@ function frameMetavariableFromStatementNode(frameNode, localContext) {
|
|
|
372
360
|
const frameMetavariableNode = frameMetavariableNodeQuery(frameNode);
|
|
373
361
|
|
|
374
362
|
if (frameMetavariableNode !== null) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
frameMetavariable = localContext.findMetavariableByMetavariableName(frameMetavariableName);
|
|
363
|
+
frameMetavariable = localContext.findMetavariableByMetavariableNode(frameMetavariableNode, localContext);
|
|
378
364
|
}
|
|
379
365
|
|
|
380
366
|
return frameMetavariable;
|
|
@@ -386,9 +372,7 @@ function statementMetavariableFromStatementNode(statementNode, localContext) {
|
|
|
386
372
|
const statementMetavariableNode = statementMetavariableNodeQuery(statementNode);
|
|
387
373
|
|
|
388
374
|
if (statementMetavariableNode !== null) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
statementMetavariable = localContext.findMetavariableByMetavariableName(statementMetavariableName);
|
|
375
|
+
statementMetavariable = localContext.findMetavariableByMetavariableNode(statementMetavariableNode, localContext);
|
|
392
376
|
}
|
|
393
377
|
|
|
394
378
|
return statementMetavariable;
|
|
@@ -135,8 +135,7 @@ function unifyAWithReference(qualifiedStatement, substitutions, localContext) {
|
|
|
135
135
|
|
|
136
136
|
const reference = qualifiedStatement.getReference(),
|
|
137
137
|
metavariableNode = reference.getMetavariableNode(),
|
|
138
|
-
|
|
139
|
-
metavariablePresent = localContext.isMetavariablePresentByMetavariableName(metavariableName);
|
|
138
|
+
metavariablePresent = localContext.isMetavariablePresentByMetavariableNode(metavariableNode, localContext);
|
|
140
139
|
|
|
141
140
|
if (metavariablePresent) {
|
|
142
141
|
const statement = qualifiedStatement.getStatement(),
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import Equality from "../../equality";
|
|
5
|
-
import Judgement from "../../judgement";
|
|
6
|
-
import Declaration from "../../declaration";
|
|
7
|
-
import Metavariable from "../../metavariable";
|
|
3
|
+
import shim from "../../shim";
|
|
8
4
|
import TypeAssertion from "../../assertion/type";
|
|
9
5
|
import DefinedAssertion from "../../assertion/defined";
|
|
10
6
|
import SubproofAssertion from "../../assertion/subproof";
|
|
@@ -12,20 +8,21 @@ import ContainedAssertion from "../../assertion/contained";
|
|
|
12
8
|
|
|
13
9
|
import { nodeQuery } from "../../utilities/query";
|
|
14
10
|
|
|
15
|
-
const frameNodeQuery = nodeQuery("/statement/frame
|
|
16
|
-
equalityNodeQuery = nodeQuery("/statement/equality
|
|
17
|
-
judgementNodeQuery = nodeQuery("/statement/judgement
|
|
18
|
-
declarationNodeQuery = nodeQuery("/statement/declaration
|
|
11
|
+
const frameNodeQuery = nodeQuery("/statement/frame"),
|
|
12
|
+
equalityNodeQuery = nodeQuery("/statement/equality"),
|
|
13
|
+
judgementNodeQuery = nodeQuery("/statement/judgement"),
|
|
14
|
+
declarationNodeQuery = nodeQuery("/statement/declaration"),
|
|
19
15
|
metavariableNodeQuery = nodeQuery("/statement/metavariable!"),
|
|
20
|
-
typeAssertionNodeQuery = nodeQuery("/statement/typeAssertion
|
|
21
|
-
definedAssertionNodeQuery = nodeQuery("/statement/definedAssertion
|
|
22
|
-
subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion
|
|
23
|
-
containedAssertionNodeQuery = nodeQuery("/statement/containedAssertion
|
|
16
|
+
typeAssertionNodeQuery = nodeQuery("/statement/typeAssertion"),
|
|
17
|
+
definedAssertionNodeQuery = nodeQuery("/statement/definedAssertion"),
|
|
18
|
+
subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion"),
|
|
19
|
+
containedAssertionNodeQuery = nodeQuery("/statement/containedAssertion");
|
|
24
20
|
|
|
25
21
|
function verifyAsMetavariable(statement, assignments, stated, localContext) {
|
|
26
22
|
let verifiedAsMetavariable = false;
|
|
27
23
|
|
|
28
|
-
const
|
|
24
|
+
const { Metavariable } = shim,
|
|
25
|
+
statementNode = statement.getNode(),
|
|
29
26
|
metavariableNode = metavariableNodeQuery(statementNode),
|
|
30
27
|
metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext);
|
|
31
28
|
|
|
@@ -49,7 +46,8 @@ function verifyAsMetavariable(statement, assignments, stated, localContext) {
|
|
|
49
46
|
function verifyAsEquality(statement, assignments, stated, localContext) {
|
|
50
47
|
let verifiedAsEquality = false;
|
|
51
48
|
|
|
52
|
-
const
|
|
49
|
+
const { Equality } = shim,
|
|
50
|
+
statementNode = statement.getNode(),
|
|
53
51
|
equalityNode = equalityNodeQuery(statementNode),
|
|
54
52
|
equality = Equality.fromEqualityNode(equalityNode, localContext);
|
|
55
53
|
|
|
@@ -73,7 +71,8 @@ function verifyAsEquality(statement, assignments, stated, localContext) {
|
|
|
73
71
|
function verifyAsFrame(statement, assignments, stated, localContext) {
|
|
74
72
|
let verifiedAsFrame = false;
|
|
75
73
|
|
|
76
|
-
const
|
|
74
|
+
const { Frame } = shim,
|
|
75
|
+
statementNode = statement.getNode(),
|
|
77
76
|
frameNode = frameNodeQuery(statementNode),
|
|
78
77
|
frame = Frame.fromFrameNode(frameNode, localContext);
|
|
79
78
|
|
|
@@ -97,7 +96,8 @@ function verifyAsFrame(statement, assignments, stated, localContext) {
|
|
|
97
96
|
function verifyAsJudgement(statement, assignments, stated, localContext) {
|
|
98
97
|
let verifiedAsJudgement = false;
|
|
99
98
|
|
|
100
|
-
const
|
|
99
|
+
const { Judgement } = shim,
|
|
100
|
+
statementNode = statement.getNode(),
|
|
101
101
|
judgementNode = judgementNodeQuery(statementNode),
|
|
102
102
|
judgement = Judgement.fromJudgementNode(judgementNode, localContext);
|
|
103
103
|
|
|
@@ -121,7 +121,8 @@ function verifyAsJudgement(statement, assignments, stated, localContext) {
|
|
|
121
121
|
function verifyAsDeclaration(statement, assignments, stated, localContext) {
|
|
122
122
|
let verifiedAsDeclaration = false;
|
|
123
123
|
|
|
124
|
-
const
|
|
124
|
+
const { Declaration } = shim,
|
|
125
|
+
statementNode = statement.getNode(),
|
|
125
126
|
declarationNode = declarationNodeQuery(statementNode),
|
|
126
127
|
declaration = Declaration.fromDeclarationNode(declarationNode, localContext);
|
|
127
128
|
|
|
@@ -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
|
|
|
@@ -9,7 +9,8 @@ const variableNodeQuery = nodeQuery("/term/variable!");
|
|
|
9
9
|
function verifyTermAsVariable(term, localContext, verifyAhead) {
|
|
10
10
|
let termVerifiedAsVariable = false;
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const { Variable } = shim,
|
|
13
|
+
termNode = term.getNode(),
|
|
13
14
|
variableNode = variableNodeQuery(termNode),
|
|
14
15
|
variable = Variable.fromVariableNode(variableNode, localContext);
|
|
15
16
|
|
package/src/premise.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import shim from "./shim";
|
|
4
4
|
import LocalContext from "./context/local";
|
|
5
5
|
import SubproofAssertion from "./assertion/subproof";
|
|
6
|
-
import UnqualifiedStatement from "./statement/unqualified";
|
|
7
6
|
|
|
8
7
|
import { nodeQuery } from "./utilities/query";
|
|
9
8
|
import { assignAssignments } from "./utilities/assignments";
|
|
@@ -162,7 +161,8 @@ class Premise {
|
|
|
162
161
|
}
|
|
163
162
|
|
|
164
163
|
static fromPremiseNode(suppositionNode, fileContext) {
|
|
165
|
-
const
|
|
164
|
+
const { UnqualifiedStatement } = shim,
|
|
165
|
+
unqualifiedStatementNode = unqualifiedStatementNodeQuery(suppositionNode),
|
|
166
166
|
unqualifiedStatement = UnqualifiedStatement.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext),
|
|
167
167
|
premise = new Premise(fileContext, unqualifiedStatement);
|
|
168
168
|
|
package/src/proof.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import shim from "./shim";
|
|
4
4
|
import LocalContext from "./context/local";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "./utilities/query";
|
|
7
7
|
|
|
8
8
|
const derivationNodeQuery = nodeQuery("/proof/derivation");
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
class Proof {
|
|
11
11
|
constructor(derivation) {
|
|
12
12
|
this.derivation = derivation;
|
|
13
13
|
}
|
|
@@ -47,7 +47,8 @@ export default class Proof {
|
|
|
47
47
|
let proof = null;
|
|
48
48
|
|
|
49
49
|
if (proofNode !== null) {
|
|
50
|
-
const
|
|
50
|
+
const { Derivation } = shim,
|
|
51
|
+
derivationNode = derivationNodeQuery(proofNode),
|
|
51
52
|
derivation = Derivation.fromDerivationNode(derivationNode, fileContext);
|
|
52
53
|
|
|
53
54
|
proof = new Proof(derivation);
|
|
@@ -56,3 +57,9 @@ export default class Proof {
|
|
|
56
57
|
return proof;
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
|
|
61
|
+
Object.assign(shim, {
|
|
62
|
+
Proof
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export default Proof;
|
package/src/proofStep.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import shim from "./shim";
|
|
4
|
-
import Subproof from "./subproof";
|
|
5
|
-
import Substitutions from "./substitutions";
|
|
6
|
-
import QualifiedStatement from "./statement/qualified";
|
|
7
|
-
import UnqualifiedStatement from "./statement/unqualified";
|
|
8
4
|
|
|
9
5
|
import { nodeQuery } from "./utilities/query";
|
|
10
6
|
import { assignAssignments } from "./utilities/assignments";
|
|
@@ -49,7 +45,8 @@ class ProofStep {
|
|
|
49
45
|
unifyStatement(statement, localContext) {
|
|
50
46
|
let statementUnified = false;
|
|
51
47
|
|
|
52
|
-
const
|
|
48
|
+
const { Substitutions } = shim,
|
|
49
|
+
substitutions = Substitutions.fromNothing();
|
|
53
50
|
|
|
54
51
|
if (this.qualifiedStatement !== null) {
|
|
55
52
|
const localContextA = localContext, ///
|
|
@@ -111,7 +108,8 @@ class ProofStep {
|
|
|
111
108
|
}
|
|
112
109
|
|
|
113
110
|
static fromProofStepNode(proofStepNode, fileContext) {
|
|
114
|
-
const
|
|
111
|
+
const { Subproof, QualifiedStatement, UnqualifiedStatement } = shim,
|
|
112
|
+
subproofNode = subproofNodeQuery(proofStepNode),
|
|
115
113
|
qualifiedStatementNode = qualifiedStatementNodeQuery(proofStepNode),
|
|
116
114
|
unqualifiedStatementNode = unqualifiedStatementNodeQuery(proofStepNode),
|
|
117
115
|
subproof = Subproof.fromSubproofNode(subproofNode, fileContext),
|
package/src/reference.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import shim from "./shim";
|
|
4
4
|
import LocalContext from "./context/local";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "./utilities/query";
|
|
@@ -67,7 +67,8 @@ export default class Reference {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
static fromReferenceNode(referenceNode, fileContext) {
|
|
70
|
-
const
|
|
70
|
+
const { Metavariable } = shim,
|
|
71
|
+
metavariableNode = metavariableNodeQuery(referenceNode),
|
|
71
72
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
72
73
|
metavariable = Metavariable.fromMetavariableNode(metavariableNode, localContext),
|
|
73
74
|
reference = new Reference(metavariable);
|
package/src/rule.js
CHANGED
|
@@ -3,12 +3,7 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
import shim from "./shim";
|
|
6
|
-
import Label from "./label";
|
|
7
|
-
import Proof from "./proof";
|
|
8
|
-
import Premise from "./premise";
|
|
9
|
-
import Conclusion from "./conclusion";
|
|
10
6
|
import LocalContext from "./context/local";
|
|
11
|
-
import Substitutions from "./substitutions";
|
|
12
7
|
|
|
13
8
|
import { stringFromLabels } from "./topLevelAssertion";
|
|
14
9
|
import { nodeQuery, nodesQuery } from "./utilities/query";
|
|
@@ -75,7 +70,8 @@ class Rule {
|
|
|
75
70
|
unifyStatement(statement, localContext) {
|
|
76
71
|
let statementUnified = false;
|
|
77
72
|
|
|
78
|
-
const
|
|
73
|
+
const { Substitutions } = shim,
|
|
74
|
+
proofSteps = localContext.getProofSteps(),
|
|
79
75
|
substitutions = Substitutions.fromNothing(),
|
|
80
76
|
proofStepsUnified = this.unifyProofSteps(proofSteps, substitutions, localContext);
|
|
81
77
|
|
|
@@ -125,15 +121,15 @@ class Rule {
|
|
|
125
121
|
|
|
126
122
|
this.fileContext.trace(`Verifying the '${ruleString}' rule...`);
|
|
127
123
|
|
|
128
|
-
const
|
|
129
|
-
const
|
|
124
|
+
const labelsVerifiedWhenDeclared = this.labels.every((label) => {
|
|
125
|
+
const labelVVerifiedWhenDeclared = label.verifyWhenDeclared(this.fileContext);
|
|
130
126
|
|
|
131
|
-
if (
|
|
127
|
+
if (labelVVerifiedWhenDeclared) {
|
|
132
128
|
return true;
|
|
133
129
|
}
|
|
134
130
|
});
|
|
135
131
|
|
|
136
|
-
if (
|
|
132
|
+
if (labelsVerifiedWhenDeclared) {
|
|
137
133
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
138
134
|
premisesVerified = this.premises.every((premise) => {
|
|
139
135
|
const premiseVerified = premise.verify(localContext);
|
|
@@ -150,7 +146,8 @@ class Rule {
|
|
|
150
146
|
let proofVerified = true; ///
|
|
151
147
|
|
|
152
148
|
if (this.proof !== null) {
|
|
153
|
-
const
|
|
149
|
+
const { Substitutions } = shim,
|
|
150
|
+
substitutions = Substitutions.fromNothing();
|
|
154
151
|
|
|
155
152
|
proofVerified = this.proof.verify(substitutions, this.conclusion, localContext);
|
|
156
153
|
}
|
|
@@ -204,7 +201,8 @@ class Rule {
|
|
|
204
201
|
}
|
|
205
202
|
|
|
206
203
|
static fromRuleNode(ruleNode, fileContext) {
|
|
207
|
-
const
|
|
204
|
+
const { Label, Proof, Premise, Conclusion } = shim,
|
|
205
|
+
proofNode = proofNodeQuery(ruleNode),
|
|
208
206
|
labelNodes = labelNodesQuery(ruleNode),
|
|
209
207
|
premiseNodes = premiseNodesQuery(ruleNode),
|
|
210
208
|
conclusionNode = conclusionNodeQuery(ruleNode),
|
|
@@ -12,7 +12,7 @@ import { assignAssignments } from "../utilities/assignments";
|
|
|
12
12
|
const statementNodeQuery = nodeQuery("/qualifiedStatement/statement"),
|
|
13
13
|
referenceNodeQuery = nodeQuery("/qualifiedStatement/reference");
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
class QualifiedStatement {
|
|
16
16
|
constructor(string, statement, reference) {
|
|
17
17
|
this.string = string;
|
|
18
18
|
this.statement = statement;
|
|
@@ -127,3 +127,9 @@ export default class QualifiedStatement {
|
|
|
127
127
|
return qualifiedStatement;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
+
|
|
131
|
+
Object.assign(shim, {
|
|
132
|
+
QualifiedStatement
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export default QualifiedStatement;
|
package/src/statement.js
CHANGED
|
@@ -171,18 +171,18 @@ class Statement {
|
|
|
171
171
|
return verified;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
verifyWhenDeclared(fileContext) {
|
|
175
175
|
let verifiedAtTopLevel;
|
|
176
176
|
|
|
177
177
|
const statementNode = this.node, ///
|
|
178
178
|
statementString = this.string; ///
|
|
179
179
|
|
|
180
|
-
fileContext.trace(`Verifying the '${statementString}' statement
|
|
180
|
+
fileContext.trace(`Verifying the '${statementString}' statement when declared...`);
|
|
181
181
|
|
|
182
182
|
verifiedAtTopLevel = statementAsCombinatorVerifier.verifyStatement(statementNode, fileContext);
|
|
183
183
|
|
|
184
184
|
if (verifiedAtTopLevel) {
|
|
185
|
-
fileContext.debug(`...verified the '${statementString}' statement
|
|
185
|
+
fileContext.debug(`...verified the '${statementString}' statement when declared.`);
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
return verifiedAtTopLevel;
|
package/src/subDerivation.js
CHANGED
|
@@ -10,7 +10,7 @@ const { last } = arrayUtilities;
|
|
|
10
10
|
|
|
11
11
|
const proofStepNodesQuery = nodesQuery("/subDerivation/proofStep|lastProofStep");
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
class SubDerivation {
|
|
14
14
|
constructor(proofSteps) {
|
|
15
15
|
this.proofSteps = proofSteps;
|
|
16
16
|
}
|
|
@@ -52,4 +52,10 @@ export default class SubDerivation {
|
|
|
52
52
|
return subDerivation;
|
|
53
53
|
|
|
54
54
|
}
|
|
55
|
-
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
Object.assign(shim, {
|
|
58
|
+
SubDerivation
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export default SubDerivation;
|