occam-verify-cli 0.0.879 → 0.0.881
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/assignment/judgement.js +62 -0
- package/lib/context/file.js +8 -8
- package/lib/context/local.js +16 -10
- package/lib/context/localMeta.js +33 -33
- package/lib/frame.js +66 -0
- package/lib/judgement.js +68 -0
- package/lib/metaLemma.js +4 -4
- package/lib/metaLemmaMetatheorem.js +25 -9
- package/lib/metaType/{label.js → frame.js} +12 -12
- package/lib/metaType/{context.js → reference.js} +12 -12
- package/lib/metaTypeNames.js +7 -7
- package/lib/metaTypes.js +5 -5
- package/lib/metatheorem.js +4 -4
- package/lib/substitution/metastatementForMetavariable.js +20 -1
- package/lib/utilities/name.js +3 -11
- package/lib/verifier/nodes/metaLevel.js +2 -2
- package/lib/verify/declaration.js +5 -5
- package/lib/verify/frame.js +34 -0
- package/lib/verify/judgement.js +80 -21
- package/lib/verify/metaConsequent.js +2 -2
- package/lib/verify/metaDerivation.js +12 -12
- package/lib/verify/metaLemma.js +5 -5
- package/lib/verify/metaSuppositions.js +2 -2
- package/lib/verify/metaproof.js +3 -3
- package/lib/verify/metastatement/qualified.js +11 -4
- package/lib/verify/metastatement.js +5 -21
- package/lib/verify/metatheorem.js +5 -5
- package/lib/verify/metavariable.js +3 -3
- package/lib/verify/metavariableAgainstMetastatement.js +2 -2
- package/lib/verify/ruleDerivation.js +3 -3
- package/package.json +4 -4
- package/src/assignment/judgement.js +30 -0
- package/src/context/file.js +6 -6
- package/src/context/local.js +5 -3
- package/src/context/localMeta.js +33 -37
- package/src/frame.js +27 -0
- package/src/judgement.js +28 -0
- package/src/metaLemma.js +1 -1
- package/src/metaLemmaMetatheorem.js +27 -5
- package/src/metaType/frame.js +18 -0
- package/src/metaType/reference.js +18 -0
- package/src/metaTypeNames.js +2 -2
- package/src/metaTypes.js +4 -4
- package/src/metatheorem.js +1 -1
- package/src/substitution/metastatementForMetavariable.js +28 -0
- package/src/utilities/name.js +5 -15
- package/src/verifier/nodes/metaLevel.js +1 -1
- package/src/verify/declaration.js +5 -5
- package/src/verify/frame.js +30 -0
- package/src/verify/judgement.js +96 -26
- package/src/verify/metaConsequent.js +1 -1
- package/src/verify/metaDerivation.js +10 -11
- package/src/verify/metaLemma.js +6 -5
- package/src/verify/metaSuppositions.js +1 -1
- package/src/verify/metaproof.js +2 -2
- package/src/verify/metastatement/qualified.js +15 -6
- package/src/verify/metastatement.js +4 -30
- package/src/verify/metatheorem.js +6 -5
- package/src/verify/metavariable.js +2 -2
- package/src/verify/metavariableAgainstMetastatement.js +1 -1
- package/src/verify/ruleDerivation.js +2 -2
- package/lib/assignment/metaEquality.js +0 -62
- package/lib/metaEquality.js +0 -101
- package/lib/utilities/metaEquivalences.js +0 -15
- package/lib/verify/context.js +0 -34
- package/lib/verify/metaEquality.js +0 -69
- package/src/assignment/metaEquality.js +0 -30
- package/src/metaEquality.js +0 -84
- package/src/metaType/context.js +0 -18
- package/src/metaType/label.js +0 -18
- package/src/utilities/metaEquivalences.js +0 -5
- package/src/verify/context.js +0 -30
- package/src/verify/metaEquality.js +0 -83
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import verifyDeclaration from "../verify/declaration";
|
|
4
|
+
|
|
5
|
+
import { nodesQuery } from "../utilities/query";
|
|
6
|
+
|
|
7
|
+
const declarationNodesQuery = nodesQuery("/frame/declaration");
|
|
8
|
+
|
|
9
|
+
export default function verifyFrame(frameNode, derived, localMetaContext) {
|
|
10
|
+
let frameVerified;
|
|
11
|
+
|
|
12
|
+
const frameString = localMetaContext.nodeAsString(frameNode);
|
|
13
|
+
|
|
14
|
+
localMetaContext.trace(`Verifying the '${frameString}' frame...`, frameNode);
|
|
15
|
+
|
|
16
|
+
const declarationNodes = declarationNodesQuery(frameNode),
|
|
17
|
+
declarationsVerified = declarationNodes.every((declarationNode) => {
|
|
18
|
+
const declarationVerified = verifyDeclaration(declarationNode, derived, localMetaContext);
|
|
19
|
+
|
|
20
|
+
return declarationVerified;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
frameVerified = declarationsVerified; ///
|
|
24
|
+
|
|
25
|
+
if (frameVerified) {
|
|
26
|
+
localMetaContext.debug(`...verified the '${frameString}' frame.`, frameNode);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return frameVerified;
|
|
30
|
+
}
|
package/src/verify/judgement.js
CHANGED
|
@@ -1,44 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import verifyFrame from "../verify/frame";
|
|
4
|
+
import frameMetaType from "../metaType/frame";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const frameNodeQuery = nodeQuery("/judgement/frame!"),
|
|
9
9
|
metavariableNodeQuery = nodeQuery("/judgement/metavariable!");
|
|
10
10
|
|
|
11
|
-
export default function verifyJudgement(judgementNode, derived, localMetaContext) {
|
|
12
|
-
let judgementVerified
|
|
11
|
+
export default function verifyJudgement(judgementNode, assignments, derived, localMetaContext) {
|
|
12
|
+
let judgementVerified;
|
|
13
13
|
|
|
14
14
|
const judgementString = localMetaContext.nodeAsString(judgementNode);
|
|
15
15
|
|
|
16
16
|
localMetaContext.trace(`Verifying the '${judgementString}' judgement...`, judgementNode);
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const verifyJudgementFunctions = [
|
|
19
|
+
verifyDerivedJudgement,
|
|
20
|
+
verifyStatedJudgement
|
|
21
|
+
];
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
+
judgementVerified = verifyJudgementFunctions.some((verifyJudgementFunction) => {
|
|
24
|
+
const judgementVerified = verifyJudgementFunction(judgementNode, assignments, derived, localMetaContext);
|
|
23
25
|
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (contextNode !== null) {
|
|
28
|
-
const contextVerified = verifyContext(contextNode, derived, localMetaContext);
|
|
29
|
-
|
|
30
|
-
judgementVerified = contextVerified; ///
|
|
31
|
-
} else {
|
|
32
|
-
localMetaContext.debug(`The right hand side of the '${judgementString}' judgement must be a context.`, judgementNode);
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
const contextMetaTypeName = contextMetaType.getName(),
|
|
36
|
-
metavariableString = localMetaContext.nodeAsString(metavariableNode),
|
|
37
|
-
metaTypeString = metaType.asString();
|
|
38
|
-
|
|
39
|
-
localMetaContext.debug(`The '${metavariableString}' metavariable's meta-type is '${metaTypeString}' when it should be '${contextMetaTypeName}'.`, judgementNode);
|
|
26
|
+
if (judgementVerified) {
|
|
27
|
+
return true;
|
|
40
28
|
}
|
|
41
|
-
}
|
|
29
|
+
});
|
|
42
30
|
|
|
43
31
|
if (judgementVerified) {
|
|
44
32
|
localMetaContext.debug(`...verified the '${judgementString}' judgement.`, judgementNode);
|
|
@@ -46,3 +34,85 @@ export default function verifyJudgement(judgementNode, derived, localMetaContext
|
|
|
46
34
|
|
|
47
35
|
return judgementVerified;
|
|
48
36
|
}
|
|
37
|
+
|
|
38
|
+
function verifyDerivedJudgement(judgementNode, assignments, derived, localMetaContext) {
|
|
39
|
+
let derivedJudgementVerified = false;
|
|
40
|
+
|
|
41
|
+
if (derived) {
|
|
42
|
+
// const judgementString = localMetaContext.nodeAsString(judgementNode);
|
|
43
|
+
//
|
|
44
|
+
// localMetaContext.trace(`Verifying the '${judgementString}' derived judgement...`, judgementNode);
|
|
45
|
+
//
|
|
46
|
+
// const metavariableNode = metavariableNodeQuery(judgementNode),
|
|
47
|
+
// metavariable = localMetaContext.findMetavariableByMetavariableNode(metavariableNode, localMetaContext);
|
|
48
|
+
//
|
|
49
|
+
// if (metavariable !== null) {
|
|
50
|
+
// const metaType = metavariable.getMetaType();
|
|
51
|
+
//
|
|
52
|
+
// if (metaType === frameMetaType) {
|
|
53
|
+
// const frameNode = frameNodeQuery(judgementNode);
|
|
54
|
+
//
|
|
55
|
+
// if (frameNode !== null) {
|
|
56
|
+
// const frameVerified = verifyFrame(frameNode, derived, localMetaContext);
|
|
57
|
+
//
|
|
58
|
+
// derivedJudgementVerified = frameVerified; ///
|
|
59
|
+
// } else {
|
|
60
|
+
// localMetaContext.debug(`The right hand side of the '${judgementString}' judgement must be a frame.`, judgementNode);
|
|
61
|
+
// }
|
|
62
|
+
// } else {
|
|
63
|
+
// const frameMetaTypeName = frameMetaType.getName(),
|
|
64
|
+
// metavariableString = localMetaContext.nodeAsString(metavariableNode),
|
|
65
|
+
// metaTypeString = metaType.asString();
|
|
66
|
+
//
|
|
67
|
+
// localMetaContext.debug(`The '${metavariableString}' metavariable's meta-type is '${metaTypeString}' when it should be '${frameMetaTypeName}'.`, judgementNode);
|
|
68
|
+
// }
|
|
69
|
+
// }
|
|
70
|
+
//
|
|
71
|
+
// if (derivedJudgementVerified) {
|
|
72
|
+
// localMetaContext.debug(`...verified the '${judgementString}' derived judgement.`, judgementNode);
|
|
73
|
+
// }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return derivedJudgementVerified;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function verifyStatedJudgement(judgementNode, assignments, derived, localMetaContext) {
|
|
80
|
+
let statedJudgementVerified = false;
|
|
81
|
+
|
|
82
|
+
if (!derived) {
|
|
83
|
+
const judgementString = localMetaContext.nodeAsString(judgementNode);
|
|
84
|
+
|
|
85
|
+
localMetaContext.trace(`Verifying the '${judgementString}' stated judgement...`, judgementNode);
|
|
86
|
+
|
|
87
|
+
const metavariableNode = metavariableNodeQuery(judgementNode),
|
|
88
|
+
metavariable = localMetaContext.findMetavariableByMetavariableNode(metavariableNode, localMetaContext);
|
|
89
|
+
|
|
90
|
+
if (metavariable !== null) {
|
|
91
|
+
const metaType = metavariable.getMetaType();
|
|
92
|
+
|
|
93
|
+
if (metaType === frameMetaType) {
|
|
94
|
+
const frameNode = frameNodeQuery(judgementNode);
|
|
95
|
+
|
|
96
|
+
if (frameNode !== null) {
|
|
97
|
+
const frameVerified = verifyFrame(frameNode, derived, localMetaContext);
|
|
98
|
+
|
|
99
|
+
statedJudgementVerified = frameVerified; ///
|
|
100
|
+
} else {
|
|
101
|
+
localMetaContext.debug(`The right hand side of the '${judgementString}' judgement must be a frame.`, judgementNode);
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
const frameMetaTypeName = frameMetaType.getName(),
|
|
105
|
+
metavariableString = localMetaContext.nodeAsString(metavariableNode),
|
|
106
|
+
metaTypeString = metaType.asString();
|
|
107
|
+
|
|
108
|
+
localMetaContext.debug(`The '${metavariableString}' metavariable's meta-type is '${metaTypeString}' when it should be '${frameMetaTypeName}'.`, judgementNode);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (statedJudgementVerified) {
|
|
113
|
+
localMetaContext.debug(`...verified the '${judgementString}' stated judgement.`, judgementNode);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return statedJudgementVerified;
|
|
118
|
+
}
|
|
@@ -8,7 +8,7 @@ import { nodeQuery } from "../utilities/query";
|
|
|
8
8
|
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!"),
|
|
9
9
|
unqualifiedMetastatementNodeQuery = nodeQuery("/metaConsequent/unqualifiedMetastatement!");
|
|
10
10
|
|
|
11
|
-
export default function verifyMetaConsequent(metaConsequentNode, metaConsequents, localMetaContext) {
|
|
11
|
+
export default function verifyMetaConsequent(metaConsequentNode, metaConsequents, substitutions, localMetaContext) {
|
|
12
12
|
let metaConsequentVerified = false;
|
|
13
13
|
|
|
14
14
|
const metaConsequentString = localMetaContext.nodeAsString(metaConsequentNode);
|
|
@@ -15,13 +15,13 @@ const childNodesQuery = nodesQuery("/metaDerivation|metaSubDerivation/*"),
|
|
|
15
15
|
metaSuppositionNodesQuery = nodesQuery("/metaSubproof/metaSupposition"),
|
|
16
16
|
metaSubDerivationNodeQuery = nodeQuery("/metaSubproof/metaSubDerivation");
|
|
17
17
|
|
|
18
|
-
export default function verifyMetaDerivation(metaDerivationNode, localMetaContext) {
|
|
18
|
+
export default function verifyMetaDerivation(metaDerivationNode, substitutions, localMetaContext) {
|
|
19
19
|
let metaDerivationVerified;
|
|
20
20
|
|
|
21
21
|
const childNodes = childNodesQuery(metaDerivationNode);
|
|
22
22
|
|
|
23
23
|
metaDerivationVerified = childNodes.every((childNode) => {
|
|
24
|
-
const childVerified = verifyChild(childNode, localMetaContext);
|
|
24
|
+
const childVerified = verifyChild(childNode, substitutions, localMetaContext);
|
|
25
25
|
|
|
26
26
|
if (childVerified) {
|
|
27
27
|
return true;
|
|
@@ -31,13 +31,13 @@ export default function verifyMetaDerivation(metaDerivationNode, localMetaContex
|
|
|
31
31
|
return metaDerivationVerified;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function verifyMetaSubDerivation(metaSubDerivationNode, localMetaContext) {
|
|
34
|
+
function verifyMetaSubDerivation(metaSubDerivationNode, substitutions, localMetaContext) {
|
|
35
35
|
let metaSubDerivationVerified;
|
|
36
36
|
|
|
37
37
|
const childNodes = childNodesQuery(metaSubDerivationNode);
|
|
38
38
|
|
|
39
39
|
metaSubDerivationVerified = childNodes.every((childNode) => {
|
|
40
|
-
const childVerified = verifyChild(childNode, localMetaContext);
|
|
40
|
+
const childVerified = verifyChild(childNode, substitutions, localMetaContext);
|
|
41
41
|
|
|
42
42
|
if (childVerified) {
|
|
43
43
|
return true;
|
|
@@ -47,18 +47,18 @@ function verifyMetaSubDerivation(metaSubDerivationNode, localMetaContext) {
|
|
|
47
47
|
return metaSubDerivationVerified;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function verifyMetaSubproof(metaSubproofNode, localMetaContext) {
|
|
50
|
+
function verifyMetaSubproof(metaSubproofNode, substitutions, localMetaContext) {
|
|
51
51
|
let metaSubproofVerified = false;
|
|
52
52
|
|
|
53
53
|
localMetaContext = LocalMetaContext.fromLocalMetaContext(localMetaContext); ///
|
|
54
54
|
|
|
55
55
|
const metaSuppositions = [],
|
|
56
56
|
metaSuppositionNodes = metaSuppositionNodesQuery(metaSubproofNode),
|
|
57
|
-
metaSuppositionsVerified = verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, localMetaContext);
|
|
57
|
+
metaSuppositionsVerified = verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, substitutions, localMetaContext);
|
|
58
58
|
|
|
59
59
|
if (metaSuppositionsVerified) {
|
|
60
60
|
const metaSubDerivationNode = metaSubDerivationNodeQuery(metaSubproofNode),
|
|
61
|
-
metaSubDerivationVerified = verifyMetaSubDerivation(metaSubDerivationNode, localMetaContext);
|
|
61
|
+
metaSubDerivationVerified = verifyMetaSubDerivation(metaSubDerivationNode, substitutions, localMetaContext);
|
|
62
62
|
|
|
63
63
|
if (metaSubDerivationVerified) {
|
|
64
64
|
metaSubproofVerified = true;
|
|
@@ -68,7 +68,7 @@ function verifyMetaSubproof(metaSubproofNode, localMetaContext) {
|
|
|
68
68
|
return metaSubproofVerified;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
function verifyChild(childNode, localMetaContext) {
|
|
71
|
+
function verifyChild(childNode, substitutions, localMetaContext) {
|
|
72
72
|
let childVerified = false;
|
|
73
73
|
|
|
74
74
|
const childNodeRuleName = childNode.getRuleName();
|
|
@@ -79,7 +79,7 @@ function verifyChild(childNode, localMetaContext) {
|
|
|
79
79
|
|
|
80
80
|
const metaSubproofNode = childNode; ///
|
|
81
81
|
|
|
82
|
-
metaSubproofVerified = verifyMetaSubproof(metaSubproofNode, localMetaContext);
|
|
82
|
+
metaSubproofVerified = verifyMetaSubproof(metaSubproofNode, substitutions, localMetaContext);
|
|
83
83
|
|
|
84
84
|
if (metaSubproofVerified) {
|
|
85
85
|
const metaproofStep = MetaproofStep.fromMetaSubproofNode(metaSubproofNode);
|
|
@@ -97,10 +97,9 @@ function verifyChild(childNode, localMetaContext) {
|
|
|
97
97
|
|
|
98
98
|
const derived = true,
|
|
99
99
|
assignments = [],
|
|
100
|
-
metavariableReferences = true,
|
|
101
100
|
qualifiedMetastatementNode = childNode; ///
|
|
102
101
|
|
|
103
|
-
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
102
|
+
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, substitutions, assignments, derived, localMetaContext);
|
|
104
103
|
|
|
105
104
|
if (qualifiedMetastatementVerified) {
|
|
106
105
|
const assignmentAssigned = assignAssignment(assignments, localMetaContext);
|
package/src/verify/metaLemma.js
CHANGED
|
@@ -31,23 +31,24 @@ export default function verifyMetaLemma(metaLemmaNode, fileContext) {
|
|
|
31
31
|
labelsVerified = verifyLabels(labelsNode, labels, fileContext);
|
|
32
32
|
|
|
33
33
|
if (labelsVerified) {
|
|
34
|
-
const
|
|
34
|
+
const substitutions = [],
|
|
35
|
+
metaSuppositions = [],
|
|
35
36
|
metaSuppositionNodes = metaSuppositionsNodeQuery(metaLemmaNode),
|
|
36
|
-
metaSuppositionsVerified = verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, localMetaContext);
|
|
37
|
+
metaSuppositionsVerified = verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, substitutions, localMetaContext);
|
|
37
38
|
|
|
38
39
|
if (metaSuppositionsVerified) {
|
|
39
40
|
const metaConsequents = [],
|
|
40
41
|
metaConsequentNode = metaConsequentNodeQuery(metaLemmaNode),
|
|
41
|
-
metaConsequentVerified = verifyMetaConsequent(metaConsequentNode, metaConsequents, localMetaContext);
|
|
42
|
+
metaConsequentVerified = verifyMetaConsequent(metaConsequentNode, metaConsequents, substitutions, localMetaContext);
|
|
42
43
|
|
|
43
44
|
if (metaConsequentVerified) {
|
|
44
45
|
const metaproofNode = metaproofNodeQuery(metaLemmaNode),
|
|
45
46
|
firstMetaConsequent = first(metaConsequents),
|
|
46
47
|
metaConsequent = firstMetaConsequent, ///
|
|
47
|
-
metaproofVerified = verifyMetaproof(metaproofNode, metaConsequent, localMetaContext);
|
|
48
|
+
metaproofVerified = verifyMetaproof(metaproofNode, metaConsequent, substitutions, localMetaContext);
|
|
48
49
|
|
|
49
50
|
if (metaproofVerified) {
|
|
50
|
-
const metaLemma = MetaLemma.
|
|
51
|
+
const metaLemma = MetaLemma.fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(labels, metaSuppositions, metaConsequent, substitutions, fileContext);
|
|
51
52
|
|
|
52
53
|
fileContext.addMetaLemma(metaLemma);
|
|
53
54
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import verifyMetaSupposition from "../verify/metaSupposition";
|
|
4
4
|
|
|
5
|
-
export default function verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, localMetaContext) {
|
|
5
|
+
export default function verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, substitutions, localMetaContext) {
|
|
6
6
|
let metaSuppositionsVerified;
|
|
7
7
|
|
|
8
8
|
metaSuppositionsVerified = metaSuppositionNodes.every((metaSuppositionNode) => {
|
package/src/verify/metaproof.js
CHANGED
|
@@ -6,11 +6,11 @@ import { nodeQuery } from "../utilities/query";
|
|
|
6
6
|
|
|
7
7
|
const metaDerivationNodeQuery = nodeQuery("/metaproof/metaDerivation!");
|
|
8
8
|
|
|
9
|
-
export default function verifyMetaproof(metaproofNode, conclusion, localMetaproof) {
|
|
9
|
+
export default function verifyMetaproof(metaproofNode, conclusion, substitutions, localMetaproof) {
|
|
10
10
|
let metaproofVerified = false;
|
|
11
11
|
|
|
12
12
|
const metaDerivationNode = metaDerivationNodeQuery(metaproofNode),
|
|
13
|
-
metaDerivationVerified = verifyMetaDerivation(metaDerivationNode, localMetaproof);
|
|
13
|
+
metaDerivationVerified = verifyMetaDerivation(metaDerivationNode, substitutions, localMetaproof);
|
|
14
14
|
|
|
15
15
|
if (metaDerivationVerified) {
|
|
16
16
|
const lastMetaproofStep = localMetaproof.getLastMetaproofStep();
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import verifyMetastatement from "../metastatement";
|
|
4
|
+
import verifyMetavariableAgainstMetastatement from "../../verify/metavariableAgainstMetastatement";
|
|
4
5
|
|
|
5
6
|
import { nodeQuery } from "../../utilities/query";
|
|
6
7
|
|
|
7
8
|
const metastatementNodeQuery = nodeQuery("/qualifiedMetastatement/metastatement!"),
|
|
8
9
|
referenceMetavariableNodeQuery = nodeQuery("/qualifiedMetastatement/reference!/metavariable!");
|
|
9
10
|
|
|
10
|
-
export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
11
|
+
export default function verifyQualifiedMetastatement(qualifiedMetastatementNode, substitutions, assignments, derived, localMetaContext) {
|
|
11
12
|
let qualifiedMetastatementVerified = false;
|
|
12
13
|
|
|
13
14
|
const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode);
|
|
@@ -27,18 +28,26 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
27
28
|
|
|
28
29
|
qualifiedMetastatementVerified = ruleMatchesMetastatement; ///
|
|
29
30
|
} else {
|
|
30
|
-
if (
|
|
31
|
+
if (substitutions !== null) {
|
|
31
32
|
const metavariableNode = referenceMetavariableNode, ///
|
|
32
33
|
metavariablePresent = localMetaContext.isMetavariablePresentByMetavariableNode(metavariableNode, localMetaContext);
|
|
33
34
|
|
|
34
35
|
if (metavariablePresent) {
|
|
35
36
|
const metastatementVerified = verifyMetastatement(metastatementNode, assignments, derived, localMetaContext, () => {
|
|
36
|
-
|
|
37
|
+
const verifiedAhead = true;
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
return verifiedAhead;
|
|
40
|
+
});
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
if (metastatementVerified) {
|
|
43
|
+
const metavariableVerifiedAgainstMetastatement = verifyMetavariableAgainstMetastatement(metavariableNode, metastatementNode, substitutions, () => {
|
|
44
|
+
const verifiedAhead = true;
|
|
45
|
+
|
|
46
|
+
return verifiedAhead;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
qualifiedMetastatementVerified = metavariableVerifiedAgainstMetastatement; ///
|
|
50
|
+
}
|
|
42
51
|
}
|
|
43
52
|
}
|
|
44
53
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import verifyJudgement from "../verify/judgement";
|
|
4
|
-
import verifyMetaEquality from "../verify/metaEquality";
|
|
5
4
|
import metastatementNodeVerifier from "../verifier/node/metastatement";
|
|
6
5
|
|
|
7
6
|
import { nodeQuery } from "../utilities/query";
|
|
8
7
|
|
|
9
|
-
const judgementNodeQuery = nodeQuery("/metastatement/judgement!")
|
|
10
|
-
metaEqualityNodeQuery = nodeQuery("/metastatement/metaEquality!");
|
|
8
|
+
const judgementNodeQuery = nodeQuery("/metastatement/judgement!");
|
|
11
9
|
|
|
12
10
|
function verifyMetastatement(metastatementNode, assignments, derived, localMetaContext) {
|
|
13
11
|
let metastatementVerified;
|
|
@@ -17,7 +15,6 @@ function verifyMetastatement(metastatementNode, assignments, derived, localMetaC
|
|
|
17
15
|
localMetaContext.trace(`Verifying the '${metastatementString}' metastatement...`, metastatementNode);
|
|
18
16
|
|
|
19
17
|
const verifyMetaStatementFunctions = [
|
|
20
|
-
verifyMetastatementAsMetaEquality,
|
|
21
18
|
verifyMetastatementAsJudgement,
|
|
22
19
|
verifyMetastatementAsIs
|
|
23
20
|
];
|
|
@@ -43,28 +40,6 @@ Object.assign(metastatementNodeVerifier, {
|
|
|
43
40
|
|
|
44
41
|
export default verifyMetastatement;
|
|
45
42
|
|
|
46
|
-
function verifyMetastatementAsMetaEquality(metastatementNode, assignments, derived, localMetaContext) {
|
|
47
|
-
let metastatementVerifiedAsMetaEquality = false;
|
|
48
|
-
|
|
49
|
-
const metaEqualityNode = metaEqualityNodeQuery(metastatementNode);
|
|
50
|
-
|
|
51
|
-
if (metaEqualityNode !== null) {
|
|
52
|
-
const metastatementString = localMetaContext.nodeAsString(metastatementNode);
|
|
53
|
-
|
|
54
|
-
localMetaContext.trace(`Verifying the '${metastatementString}' metastatement as a meta-equality...`, metastatementNode);
|
|
55
|
-
|
|
56
|
-
const metaEqualityVerified = verifyMetaEquality(metaEqualityNode, assignments, derived, localMetaContext);
|
|
57
|
-
|
|
58
|
-
metastatementVerifiedAsMetaEquality = metaEqualityVerified; ///
|
|
59
|
-
|
|
60
|
-
if (metastatementVerifiedAsMetaEquality) {
|
|
61
|
-
localMetaContext.debug(`...verified the '${metastatementString}' metastatement as a meta-equality.`, metastatementNode);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return metastatementVerifiedAsMetaEquality;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
43
|
function verifyMetastatementAsJudgement(metastatementNode, assignments, derived, localMetaContext) {
|
|
69
44
|
let metastatementVerifiedAsJudgement = false;
|
|
70
45
|
|
|
@@ -75,7 +50,7 @@ function verifyMetastatementAsJudgement(metastatementNode, assignments, derived,
|
|
|
75
50
|
|
|
76
51
|
localMetaContext.trace(`Verifying the '${metastatementString}' metastatement as a judgement...`, metastatementNode);
|
|
77
52
|
|
|
78
|
-
const judgementVerified = verifyJudgement(judgementNode, derived, localMetaContext);
|
|
53
|
+
const judgementVerified = verifyJudgement(judgementNode, assignments, derived, localMetaContext);
|
|
79
54
|
|
|
80
55
|
metastatementVerifiedAsJudgement = judgementVerified; ///
|
|
81
56
|
|
|
@@ -90,10 +65,9 @@ function verifyMetastatementAsJudgement(metastatementNode, assignments, derived,
|
|
|
90
65
|
function verifyMetastatementAsIs(metastatementNode, assignments, derived, localMetaContext) {
|
|
91
66
|
let metastatementVerifiedAsIs = false;
|
|
92
67
|
|
|
93
|
-
const judgementNode = judgementNodeQuery(metastatementNode)
|
|
94
|
-
metaEqualityNode = metaEqualityNodeQuery(metastatementNode);
|
|
68
|
+
const judgementNode = judgementNodeQuery(metastatementNode);
|
|
95
69
|
|
|
96
|
-
if (
|
|
70
|
+
if (judgementNode === null) {
|
|
97
71
|
const metastatementString = localMetaContext.nodeAsString(metastatementNode);
|
|
98
72
|
|
|
99
73
|
localMetaContext.trace(`Verifying the '${metastatementString}' metastatement as is...`, metastatementNode);
|
|
@@ -28,23 +28,24 @@ export default function verifyMetatheorem(metatheoremNode, fileContext) {
|
|
|
28
28
|
labelsVerified = verifyLabels(labelsNode, labels, fileContext);
|
|
29
29
|
|
|
30
30
|
if (labelsVerified) {
|
|
31
|
-
const
|
|
31
|
+
const substitutions = [],
|
|
32
|
+
metaSuppositions = [],
|
|
32
33
|
metaSuppositionNodes = metaSuppositionsNodeQuery(metatheoremNode),
|
|
33
|
-
metaSuppositionsVerified = verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, localMetaContext);
|
|
34
|
+
metaSuppositionsVerified = verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, substitutions, localMetaContext);
|
|
34
35
|
|
|
35
36
|
if (metaSuppositionsVerified) {
|
|
36
37
|
const metaConsequents = [],
|
|
37
38
|
metaConsequentNode = metaConsequentNodeQuery(metatheoremNode),
|
|
38
|
-
metaConsequentVerified = verifyMetaConsequent(metaConsequentNode, metaConsequents, localMetaContext);
|
|
39
|
+
metaConsequentVerified = verifyMetaConsequent(metaConsequentNode, metaConsequents, substitutions, localMetaContext);
|
|
39
40
|
|
|
40
41
|
if (metaConsequentVerified) {
|
|
41
42
|
const metaproofNode = metaproofNodeQuery(metatheoremNode),
|
|
42
43
|
firstMetaConsequent = first(metaConsequents),
|
|
43
44
|
metaConsequent = firstMetaConsequent, ///
|
|
44
|
-
metaproofVerified = verifyMetaproof(metaproofNode, metaConsequent, localMetaContext);
|
|
45
|
+
metaproofVerified = verifyMetaproof(metaproofNode, metaConsequent, substitutions, localMetaContext);
|
|
45
46
|
|
|
46
47
|
if (metaproofVerified) {
|
|
47
|
-
const metatheorem = Metatheorem.
|
|
48
|
+
const metatheorem = Metatheorem.fromLabelsMetaSuppositionsMetaConsequentSubstitutionsAndFileContext(labels, metaSuppositions, metaConsequent, substitutions, fileContext);
|
|
48
49
|
|
|
49
50
|
fileContext.addMetatheorem(metatheorem);
|
|
50
51
|
|
|
@@ -18,8 +18,7 @@ export default function verifyMetavariable(metavariableNode, metaTypeNode, fileC
|
|
|
18
18
|
|
|
19
19
|
fileContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
metavariablePresent = fileContext.isMetavariablePresentByName(name);
|
|
21
|
+
const metavariablePresent = fileContext.isMetavariablePresentByMetavariableNode(metavariableNode);
|
|
23
22
|
|
|
24
23
|
if (metavariablePresent) {
|
|
25
24
|
fileContext.debug(`The metavariable '${metavariableString}' is already present.`, metavariableNode);
|
|
@@ -49,6 +48,7 @@ export default function verifyMetavariable(metavariableNode, metaTypeNode, fileC
|
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
const node = metavariableNode, ///
|
|
51
|
+
name = nameFromMetavariableNode(metavariableNode),
|
|
52
52
|
metavariable = Metavariable.fromNodeNameTermTypeAndMetaType(node, name, termType, metaType),
|
|
53
53
|
metavariableAssignment = MetavariableAssignment.fromMetavariable(metavariable),
|
|
54
54
|
metavariableAssigned = metavariableAssignment.assign(fileContext);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import MetastatementForMetavariableSubstitution from "../substitution/metastatementForMetavariable";
|
|
4
4
|
|
|
5
|
-
export default function verifyMetavariableAgainstMetastatement(metavariableNode, metastatementNode, substitutions,
|
|
5
|
+
export default function verifyMetavariableAgainstMetastatement(metavariableNode, metastatementNode, substitutions, verifyAhead) {
|
|
6
6
|
let metavariableVerifiedAgainstMetastatement = false;
|
|
7
7
|
|
|
8
8
|
const substitution = substitutions.find((substitution) => {
|
|
@@ -94,10 +94,10 @@ function verifyChild(childNode, localMetaContext) {
|
|
|
94
94
|
|
|
95
95
|
const derived = true,
|
|
96
96
|
assignments = [],
|
|
97
|
-
|
|
97
|
+
substitutions = null,
|
|
98
98
|
qualifiedMetastatementNode = childNode; ///
|
|
99
99
|
|
|
100
|
-
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
100
|
+
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, substitutions, assignments, derived, localMetaContext);
|
|
101
101
|
|
|
102
102
|
if (qualifiedMetastatementVerified) {
|
|
103
103
|
const assignmentAssigned = assignAssignment(assignments, localMetaContext);
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return MetaEqualityAssignment;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
function _class_call_check(instance, Constructor) {
|
|
12
|
-
if (!(instance instanceof Constructor)) {
|
|
13
|
-
throw new TypeError("Cannot call a class as a function");
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
function _defineProperties(target, props) {
|
|
17
|
-
for(var i = 0; i < props.length; i++){
|
|
18
|
-
var descriptor = props[i];
|
|
19
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
20
|
-
descriptor.configurable = true;
|
|
21
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
22
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
26
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
27
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
28
|
-
return Constructor;
|
|
29
|
-
}
|
|
30
|
-
var MetaEqualityAssignment = /*#__PURE__*/ function() {
|
|
31
|
-
function MetaEqualityAssignment(metaEquality) {
|
|
32
|
-
_class_call_check(this, MetaEqualityAssignment);
|
|
33
|
-
this.metaEquality = metaEquality;
|
|
34
|
-
}
|
|
35
|
-
_create_class(MetaEqualityAssignment, [
|
|
36
|
-
{
|
|
37
|
-
key: "getMetaEquality",
|
|
38
|
-
value: function getMetaEquality() {
|
|
39
|
-
return this.metaEquality;
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
key: "assign",
|
|
44
|
-
value: function assign(localMetaContext) {
|
|
45
|
-
var metaEqualityAdded = localMetaContext.addMetaEquality(this.metaEquality), metaEqualityNode = this.metaEquality.getNode(), metaEqualityString = localMetaContext.nodeAsString(metaEqualityNode), metaEqualityAssigned = metaEqualityAdded; ///
|
|
46
|
-
metaEqualityAssigned ? localMetaContext.trace("Assigned the '".concat(metaEqualityString, "' meta-equality."), metaEqualityNode) : localMetaContext.debug("Unable to assign the '".concat(metaEqualityString, "' meta-equality."), metaEqualityNode);
|
|
47
|
-
return metaEqualityAssigned;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
], [
|
|
51
|
-
{
|
|
52
|
-
key: "fromMetaEquality",
|
|
53
|
-
value: function fromMetaEquality(metaEquality) {
|
|
54
|
-
var metaEqualityAssignment = new MetaEqualityAssignment(metaEquality);
|
|
55
|
-
return metaEqualityAssignment;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
]);
|
|
59
|
-
return MetaEqualityAssignment;
|
|
60
|
-
}();
|
|
61
|
-
|
|
62
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9hc3NpZ25tZW50L21ldGFFcXVhbGl0eS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuZXhwb3J0IGRlZmF1bHQgY2xhc3MgTWV0YUVxdWFsaXR5QXNzaWdubWVudCB7XG4gIGNvbnN0cnVjdG9yKG1ldGFFcXVhbGl0eSkge1x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