occam-verify-cli 0.0.1067 → 0.0.1069
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/bin/action/verify.js +3 -2
- package/lib/assertion/contained.js +2 -2
- package/lib/assertion/defined.js +2 -2
- package/lib/assertion/subproof.js +3 -3
- package/lib/assignment/judgement.js +3 -3
- package/lib/axiom.js +11 -6
- package/lib/combinator.js +9 -9
- package/lib/conclusion.js +13 -10
- package/lib/conjecture.js +11 -6
- package/lib/consequent.js +13 -10
- package/lib/constructor.js +9 -9
- package/lib/context/file.js +34 -126
- package/lib/context/local.js +16 -5
- package/lib/context/release.js +2 -3
- package/lib/declaration.js +96 -2
- package/lib/equivalence.js +2 -2
- package/lib/frame.js +179 -98
- package/lib/index.js +22 -6
- package/lib/judgement.js +84 -5
- package/lib/label.js +12 -8
- package/lib/lemma.js +12 -12
- package/lib/metaLemma.js +120 -8
- package/lib/metaType.js +24 -3
- package/lib/metatheorem.js +145 -9
- package/lib/metavariable.js +128 -43
- package/lib/mixins/statement/qualified/unify.js +6 -10
- package/lib/mixins/statement/unify.js +4 -19
- package/lib/mixins/statement/verify.js +13 -13
- package/lib/mixins/term/unify.js +2 -2
- package/lib/premise.js +21 -13
- package/lib/reference.js +17 -17
- package/lib/rule.js +28 -40
- package/lib/statement/unqualified.js +34 -9
- package/lib/statement.js +7 -5
- package/lib/substitution/frameForMetavariable.js +75 -70
- package/lib/substitution/statementForMetavariable.js +83 -42
- package/lib/substitution/termForVariable.js +65 -68
- package/lib/substitution.js +46 -43
- package/lib/substitutions.js +52 -40
- package/lib/supposition.js +15 -11
- package/lib/term.js +6 -11
- package/lib/theorem.js +11 -6
- package/lib/topLevelAssertion.js +24 -42
- package/lib/type.js +5 -12
- package/lib/unifier/intrinsicLevel.js +4 -4
- package/lib/unifier/metaLevel.js +11 -7
- package/lib/unifier/metavariable.js +6 -6
- package/lib/unifier/statementWithCombinator.js +16 -16
- package/lib/unifier/termWithConstructor.js +7 -7
- package/lib/utilities/brackets.js +10 -10
- package/lib/utilities/json.js +493 -0
- package/lib/utilities/node.js +26 -19
- package/lib/utilities/release.js +53 -0
- package/lib/utilities/releaseContext.js +4 -15
- package/lib/utilities/tokens.js +8 -1
- package/lib/variable.js +14 -15
- package/lib/verifier/topLevel.js +5 -5
- package/package.json +1 -1
- package/src/assertion/contained.js +1 -1
- package/src/assertion/defined.js +1 -1
- package/src/assertion/subproof.js +2 -3
- package/src/assignment/judgement.js +3 -4
- package/src/axiom.js +14 -6
- package/src/combinator.js +12 -13
- package/src/conclusion.js +16 -13
- package/src/conjecture.js +14 -6
- package/src/consequent.js +16 -13
- package/src/constructor.js +11 -13
- package/src/context/file.js +94 -202
- package/src/context/local.js +8 -6
- package/src/context/release.js +2 -3
- package/src/declaration.js +126 -45
- package/src/equivalence.js +2 -2
- package/src/frame.js +225 -141
- package/src/index.js +17 -1
- package/src/judgement.js +109 -3
- package/src/label.js +15 -10
- package/src/lemma.js +17 -10
- package/src/metaLemma.js +102 -1
- package/src/metaType.js +29 -3
- package/src/metatheorem.js +143 -2
- package/src/metavariable.js +189 -66
- package/src/mixins/statement/qualified/unify.js +7 -19
- package/src/mixins/statement/unify.js +3 -25
- package/src/mixins/statement/verify.js +15 -13
- package/src/mixins/term/unify.js +1 -1
- package/src/premise.js +31 -16
- package/src/reference.js +18 -18
- package/src/rule.js +40 -58
- package/src/statement/unqualified.js +41 -11
- package/src/statement.js +6 -3
- package/src/substitution/frameForMetavariable.js +85 -98
- package/src/substitution/statementForMetavariable.js +109 -45
- package/src/substitution/termForVariable.js +83 -94
- package/src/substitution.js +36 -34
- package/src/substitutions.js +53 -46
- package/src/supposition.js +22 -14
- package/src/term.js +5 -15
- package/src/theorem.js +14 -6
- package/src/topLevelAssertion.js +38 -64
- package/src/type.js +5 -20
- package/src/unifier/intrinsicLevel.js +4 -3
- package/src/unifier/metaLevel.js +19 -7
- package/src/unifier/metavariable.js +5 -5
- package/src/unifier/statementWithCombinator.js +19 -19
- package/src/unifier/termWithConstructor.js +7 -7
- package/src/utilities/brackets.js +5 -5
- package/src/utilities/json.js +551 -0
- package/src/utilities/node.js +28 -23
- package/src/{verify → utilities}/release.js +5 -1
- package/src/utilities/releaseContext.js +2 -2
- package/src/utilities/tokens.js +10 -0
- package/src/variable.js +18 -19
- package/src/verifier/topLevel.js +6 -4
- package/lib/argument.js +0 -106
- package/lib/metaTypes.js +0 -19
- package/lib/unify/metavariableWithFrame.js +0 -40
- package/lib/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +0 -31
- package/lib/unify/statementWithSttaemetnGivenEquivalences.js +0 -45
- package/lib/verify/declaration.js +0 -83
- package/lib/verify/frame.js +0 -120
- package/lib/verify/judgement.js +0 -88
- package/lib/verify/metaLemma.js +0 -49
- package/lib/verify/metatheorem.js +0 -48
- package/lib/verify/metavariableGivenMetaType.js +0 -44
- package/lib/verify/release.js +0 -50
- package/src/argument.js +0 -79
- package/src/metaTypes.js +0 -11
- package/src/unify/metavariableWithFrame.js +0 -40
- package/src/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +0 -27
- package/src/unify/statementWithSttaemetnGivenEquivalences.js +0 -51
- package/src/verify/declaration.js +0 -113
- package/src/verify/frame.js +0 -157
- package/src/verify/judgement.js +0 -127
- package/src/verify/metaLemma.js +0 -72
- package/src/verify/metatheorem.js +0 -67
- package/src/verify/metavariableGivenMetaType.js +0 -45
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import metaLevelUnifier from "../unifier/metaLevel";
|
|
4
|
-
|
|
5
|
-
export default function unifyComplexSubstitutionStatementWithSimpleSubstitutionStatement(simpleSubstitutionStatementNode, complexSubstitutionStatementNode, substitutions, localContextA, localContextB) {
|
|
6
|
-
let simpleSubstitutionStatementUnifiedWithComplexSubstitutionStatement;
|
|
7
|
-
|
|
8
|
-
const simpleSubstitutionStatementString = localContextB.nodeAsString(simpleSubstitutionStatementNode),
|
|
9
|
-
complexSubstitutionStatementString = localContextB.nodeAsString(complexSubstitutionStatementNode);
|
|
10
|
-
|
|
11
|
-
localContextB.trace(`Unifying the simple substitution's '${simpleSubstitutionStatementString}' statement with the complex substitution's '${complexSubstitutionStatementString}' statement...`, simpleSubstitutionStatementNode);
|
|
12
|
-
|
|
13
|
-
const nodeA = complexSubstitutionStatementNode, ///
|
|
14
|
-
nodeB = simpleSubstitutionStatementNode; ///
|
|
15
|
-
|
|
16
|
-
localContextA = localContextB; ///
|
|
17
|
-
|
|
18
|
-
const unifiedAtMetaLevel = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
19
|
-
|
|
20
|
-
simpleSubstitutionStatementUnifiedWithComplexSubstitutionStatement = unifiedAtMetaLevel; ///
|
|
21
|
-
|
|
22
|
-
if (simpleSubstitutionStatementUnifiedWithComplexSubstitutionStatement) {
|
|
23
|
-
localContextB.trace(`...unified the simple substitution's '${simpleSubstitutionStatementString}' statement with the complex substitution's '${complexSubstitutionStatementString}' statement.`, simpleSubstitutionStatementNode);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return simpleSubstitutionStatementUnifiedWithComplexSubstitutionStatement;
|
|
27
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Substitutions from "../substitutions";
|
|
4
|
-
import intrinsicLevelUnifier from "../unifier/intrinsicLevel";
|
|
5
|
-
|
|
6
|
-
export default function unifyStatementWithStatementGivenEquivalences(statementNodeA, statementNodeB, equivalences, localContextA, localContextB) {
|
|
7
|
-
let statementUnifiedWithStatementGivenEquivalences = false;
|
|
8
|
-
|
|
9
|
-
const statementStringA = localContextA.nodeAsString(statementNodeA),
|
|
10
|
-
statementStringB = localContextB.nodeAsString(statementNodeB);
|
|
11
|
-
|
|
12
|
-
localContextB.trace(`Unifying the '${statementStringB}' statement with the '${statementStringA}' statement given equivalences...`, statementNodeB);
|
|
13
|
-
|
|
14
|
-
if (!statementUnifiedWithStatementGivenEquivalences) {
|
|
15
|
-
const substitutions = Substitutions.fromNothing(),
|
|
16
|
-
nodeA = statementNodeA, ///
|
|
17
|
-
nodeB = statementNodeB, ///
|
|
18
|
-
unifiedAtIntrinsicLevel = intrinsicLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
19
|
-
|
|
20
|
-
if (unifiedAtIntrinsicLevel) {
|
|
21
|
-
const substitutionsUnifiedWithEquivalences = substitutions.unifyWithEquivalences(equivalences, localContextA, localContextB);
|
|
22
|
-
|
|
23
|
-
statementUnifiedWithStatementGivenEquivalences = substitutionsUnifiedWithEquivalences; ///
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (!statementUnifiedWithStatementGivenEquivalences) {
|
|
28
|
-
const localContext = localContextA; ///
|
|
29
|
-
|
|
30
|
-
localContextA = localContextB; ///
|
|
31
|
-
|
|
32
|
-
localContextB = localContext; ///
|
|
33
|
-
|
|
34
|
-
const substitutions = Substitutions.fromNothing(),
|
|
35
|
-
nodeA = statementNodeB, ///
|
|
36
|
-
nodeB = statementNodeA, ///
|
|
37
|
-
unifiedAtIntrinsicLevel = intrinsicLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
38
|
-
|
|
39
|
-
if (unifiedAtIntrinsicLevel) {
|
|
40
|
-
const substitutionsUnifiedWithEquivalences = substitutions.unifyWithEquivalences(equivalences, localContextA, localContextB);
|
|
41
|
-
|
|
42
|
-
statementUnifiedWithStatementGivenEquivalences = substitutionsUnifiedWithEquivalences; ///
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (statementUnifiedWithStatementGivenEquivalences) {
|
|
47
|
-
localContextB.debug(`...unified the '${statementStringB}' statement with the '${statementStringA}' statement given equivalences.`, statementNodeB);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return statementUnifiedWithStatementGivenEquivalences;
|
|
51
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import shim from "../shim";
|
|
4
|
-
import Reference from "../reference";
|
|
5
|
-
import Declaration from "../declaration"
|
|
6
|
-
import verifyMetavariableGivenMetaType from "../verify/metavariableGivenMetaType";
|
|
7
|
-
|
|
8
|
-
import { nodeQuery } from "../utilities/query";
|
|
9
|
-
import { referenceMetaType } from "../metaType";
|
|
10
|
-
|
|
11
|
-
const statementNodeQuery = nodeQuery("/declaration/statement"),
|
|
12
|
-
metavariableNodeQuery = nodeQuery("/declaration/reference/metavariable"); ///
|
|
13
|
-
|
|
14
|
-
const verifyDeclarationFunctions = [
|
|
15
|
-
verifyDerivedDeclaration,
|
|
16
|
-
verifyStatedDeclaration
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
export default function verifyDeclaration(declarationNode, declarations, stated, localContext) {
|
|
20
|
-
let declarationVerified;
|
|
21
|
-
|
|
22
|
-
const declarationString = localContext.nodeAsString(declarationNode);
|
|
23
|
-
|
|
24
|
-
localContext.trace(`Verifying the '${declarationString}' declaration...`, declarationNode);
|
|
25
|
-
|
|
26
|
-
declarationVerified = verifyDeclarationFunctions.some((verifyDeclarationFunction) => {
|
|
27
|
-
const declarationVerified = verifyDeclarationFunction(declarationNode, declarations, stated, localContext);
|
|
28
|
-
|
|
29
|
-
if (declarationVerified) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (declarationVerified) {
|
|
35
|
-
localContext.debug(`...verified the '${declarationString}' declaration.`, declarationNode);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return declarationVerified;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function verifyDerivedDeclaration(declarationNode, declarations, stated, localContext) {
|
|
42
|
-
let derivedDeclarationVerified;
|
|
43
|
-
|
|
44
|
-
if (!stated) {
|
|
45
|
-
const declarationString = localContext.nodeAsString(declarationNode);
|
|
46
|
-
|
|
47
|
-
localContext.trace(`Verifying the '${declarationString}' derived declaration...`, declarationNode);
|
|
48
|
-
|
|
49
|
-
const metaType = referenceMetaType, ///
|
|
50
|
-
metavariableNode = metavariableNodeQuery(declarationNode),
|
|
51
|
-
metavariableVerifiedGivenMetaType = verifyMetavariableGivenMetaType(metavariableNode, metaType, localContext);
|
|
52
|
-
|
|
53
|
-
if (metavariableVerifiedGivenMetaType) {
|
|
54
|
-
const { verifyStatement } = shim,
|
|
55
|
-
stated = true,
|
|
56
|
-
assignments = null,
|
|
57
|
-
statementNode = statementNodeQuery(declarationNode),
|
|
58
|
-
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
59
|
-
|
|
60
|
-
if (statementVerified) {
|
|
61
|
-
const reference = Reference.fromMetavariableNode(metavariableNode),
|
|
62
|
-
declaration = Declaration.fromReferenceAndStatementNode(reference, statementNode);
|
|
63
|
-
|
|
64
|
-
declarations.push(declaration);
|
|
65
|
-
|
|
66
|
-
derivedDeclarationVerified = true;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (derivedDeclarationVerified) {
|
|
71
|
-
localContext.debug(`...verified the '${declarationString}' derived declaration.`, declarationNode);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return derivedDeclarationVerified;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function verifyStatedDeclaration(declarationNode, declarations, stated, localContext) {
|
|
79
|
-
let statedDeclarationVerified = false;
|
|
80
|
-
|
|
81
|
-
if (stated) {
|
|
82
|
-
const declarationString = localContext.nodeAsString(declarationNode);
|
|
83
|
-
|
|
84
|
-
localContext.trace(`Verifying the '${declarationString}' stated declaration...`, declarationNode);
|
|
85
|
-
|
|
86
|
-
const metaType = referenceMetaType, ///
|
|
87
|
-
metavariableNode = metavariableNodeQuery(declarationNode),
|
|
88
|
-
metavariableVerifiedGivenMetaType = verifyMetavariableGivenMetaType(metavariableNode, metaType, localContext);
|
|
89
|
-
|
|
90
|
-
if (metavariableVerifiedGivenMetaType) {
|
|
91
|
-
const { verifyStatement } = shim,
|
|
92
|
-
stated = true,
|
|
93
|
-
assignments = null,
|
|
94
|
-
statementNode = statementNodeQuery(declarationNode),
|
|
95
|
-
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
96
|
-
|
|
97
|
-
if (statementVerified) {
|
|
98
|
-
const reference = Reference.fromMetavariableNode(metavariableNode),
|
|
99
|
-
declaration = Declaration.fromReferenceAndStatementNode(reference, statementNode);
|
|
100
|
-
|
|
101
|
-
declarations.push(declaration);
|
|
102
|
-
|
|
103
|
-
statedDeclarationVerified = true;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (statedDeclarationVerified) {
|
|
108
|
-
localContext.debug(`...verified the '${declarationString}' stated declaration.`, declarationNode);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return statedDeclarationVerified;
|
|
113
|
-
}
|
package/src/verify/frame.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Frame from "../frame";
|
|
4
|
-
import verifyDeclaration from "../verify/declaration";
|
|
5
|
-
import verifyMetavariableGivenMetaType from "./metavariableGivenMetaType";
|
|
6
|
-
|
|
7
|
-
import { frameMetaType } from "../metaType";
|
|
8
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
9
|
-
import { metavariableNameFromMetavariableNode } from "../utilities/name";
|
|
10
|
-
|
|
11
|
-
const metavariableNodeQuery = nodeQuery("/frame/metavariable"),
|
|
12
|
-
declarationNodesQuery = nodesQuery("/frame/declaration"),
|
|
13
|
-
metavariableNodesQuery = nodesQuery("/frame/metavariable");
|
|
14
|
-
|
|
15
|
-
const verifyFrameFunctions = [
|
|
16
|
-
verifyDerivedFrame,
|
|
17
|
-
verifyStatedFrame
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
export default function verifyFrame(frameNode, frames, stated, localContext) {
|
|
21
|
-
let frameVerified;
|
|
22
|
-
|
|
23
|
-
const frameString = localContext.nodeAsString(frameNode);
|
|
24
|
-
|
|
25
|
-
localContext.trace(`Verifying the '${frameString}' frame...`);
|
|
26
|
-
|
|
27
|
-
frameVerified = verifyFrameFunctions.some((verifyFrameFunction) => {
|
|
28
|
-
const frameVerified = verifyFrameFunction(frameNode, frames, stated, localContext);
|
|
29
|
-
|
|
30
|
-
if (frameVerified) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (frameVerified) {
|
|
36
|
-
localContext.debug(`...verified the '${frameString}' frame.`);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return frameVerified;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function verifyDerivedFrame(frameNode, frames, stated, localContext) {
|
|
43
|
-
let derivedFrameVerified;
|
|
44
|
-
|
|
45
|
-
if (!stated) {
|
|
46
|
-
const frameString = localContext.nodeAsString(frameNode);
|
|
47
|
-
|
|
48
|
-
localContext.trace(`Verifying the '${frameString}' derived frame...`);
|
|
49
|
-
|
|
50
|
-
const declarations = [],
|
|
51
|
-
declarationNodes = declarationNodesQuery(frameNode),
|
|
52
|
-
declarationsVerified = declarationNodes.every((declarationNode) => {
|
|
53
|
-
const declarationVerified = verifyDeclaration(declarationNode, declarations, stated, localContext);
|
|
54
|
-
|
|
55
|
-
if (declarationVerified) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
if (declarationsVerified) {
|
|
61
|
-
const metavariableNodes = metavariableNodesQuery(frameNode),
|
|
62
|
-
metavariablesVerified = metavariableNodes.every((metavariableNode) => {
|
|
63
|
-
const metavariableVerified = verifyMetavariable(metavariableNode, declarations, localContext);
|
|
64
|
-
|
|
65
|
-
if (metavariableVerified) {
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
if (metavariablesVerified) {
|
|
71
|
-
const frame = Frame.fromDeclarations(declarations);
|
|
72
|
-
|
|
73
|
-
frames.push(frame);
|
|
74
|
-
|
|
75
|
-
derivedFrameVerified = true; ///
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (derivedFrameVerified) {
|
|
80
|
-
localContext.debug(`...verified the '${frameString}' derived frame.`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return derivedFrameVerified;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function verifyStatedFrame(frameNode, frames, stated, localContext) {
|
|
88
|
-
let statedFrameVerified;
|
|
89
|
-
|
|
90
|
-
if (stated) {
|
|
91
|
-
const frameString = localContext.nodeAsString(frameNode);
|
|
92
|
-
|
|
93
|
-
localContext.trace(`Verifying the '${frameString}' stated frame...`);
|
|
94
|
-
|
|
95
|
-
const declarationNodes = declarationNodesQuery(frameNode),
|
|
96
|
-
declarationNodesLength = declarationNodes.length;
|
|
97
|
-
|
|
98
|
-
if (declarationNodesLength === 0) {
|
|
99
|
-
const metavariableNode = metavariableNodeQuery(frameNode);
|
|
100
|
-
|
|
101
|
-
if (metavariableNode !== null) {
|
|
102
|
-
const metaType = frameMetaType, ///
|
|
103
|
-
metavariableVerifiedGivenMetaType = verifyMetavariableGivenMetaType(metavariableNode, metaType, localContext);
|
|
104
|
-
|
|
105
|
-
if (metavariableVerifiedGivenMetaType) {
|
|
106
|
-
const frame = Frame.fromMetavariableNode(metavariableNode);
|
|
107
|
-
|
|
108
|
-
frames.push(frame);
|
|
109
|
-
|
|
110
|
-
statedFrameVerified = true;
|
|
111
|
-
}
|
|
112
|
-
} else {
|
|
113
|
-
localContext.trace(`The '${frameString}' stated frame cannot have more than one metavariable.`);
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
localContext.trace(`The '${frameString}' stated frame cannot have declarations.`);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (statedFrameVerified) {
|
|
120
|
-
localContext.debug(`...verified the '${frameString}' stated frame.`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return statedFrameVerified;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function verifyMetavariable(metavariableNode, declarations, localContext) {
|
|
128
|
-
let metavariableVerified = false;
|
|
129
|
-
|
|
130
|
-
const metavariableString = localContext.nodeAsString(metavariableNode);
|
|
131
|
-
|
|
132
|
-
localContext.trace(`Verifying the '${metavariableString}' metavariable...`);
|
|
133
|
-
|
|
134
|
-
const metaType = frameMetaType, ///
|
|
135
|
-
metavariableVerifiedGivenMetaType = verifyMetavariableGivenMetaType(metavariableNode, metaType, localContext);
|
|
136
|
-
|
|
137
|
-
if (metavariableVerifiedGivenMetaType) {
|
|
138
|
-
const metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
139
|
-
judgement = localContext.findJudgementByMetavariableName(metavariableName);
|
|
140
|
-
|
|
141
|
-
if (judgement !== null) {
|
|
142
|
-
const declaration = judgement.getDeclaration();
|
|
143
|
-
|
|
144
|
-
declarations.push(declaration);
|
|
145
|
-
|
|
146
|
-
metavariableVerified = true;
|
|
147
|
-
} else {
|
|
148
|
-
localContext.trace(`There is no judgement for the '${metavariableString}' metavariable.`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (metavariableVerified) {
|
|
153
|
-
localContext.debug(`...verified the '${metavariableString}' metavariable.`);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return metavariableVerified;
|
|
157
|
-
}
|
package/src/verify/judgement.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { arrayUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
import Judgement from "../judgement";
|
|
6
|
-
import verifyFrame from "../verify/frame";
|
|
7
|
-
import verifyDeclaration from "./declaration";
|
|
8
|
-
import JudgementAssignment from "../assignment/judgement";
|
|
9
|
-
|
|
10
|
-
import { nodeQuery } from "../utilities/query";
|
|
11
|
-
|
|
12
|
-
const { first } = arrayUtilities;
|
|
13
|
-
|
|
14
|
-
const frameNodeQuery = nodeQuery("/judgement/frame"),
|
|
15
|
-
declarationNodeQuery = nodeQuery("/judgement/declaration");
|
|
16
|
-
|
|
17
|
-
const verifyJudgementFunctions = [
|
|
18
|
-
verifyDerivedJudgement,
|
|
19
|
-
verifyStatedJudgement
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
export default function verifyJudgement(judgementNode, assignments, stated, localContext) {
|
|
23
|
-
let judgementVerified;
|
|
24
|
-
|
|
25
|
-
const judgementString = localContext.nodeAsString(judgementNode);
|
|
26
|
-
|
|
27
|
-
localContext.trace(`Verifying the '${judgementString}' judgement...`, judgementNode);
|
|
28
|
-
|
|
29
|
-
judgementVerified = verifyJudgementFunctions.some((verifyJudgementFunction) => {
|
|
30
|
-
const judgementVerified = verifyJudgementFunction(judgementNode, assignments, stated, localContext);
|
|
31
|
-
|
|
32
|
-
if (judgementVerified) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
if (judgementVerified) {
|
|
38
|
-
localContext.debug(`...verified the '${judgementString}' judgement.`, judgementNode);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return judgementVerified;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function verifyDerivedJudgement(judgementNode, assignments, stated, localContext) {
|
|
45
|
-
let derivedJudgementVerified = false;
|
|
46
|
-
|
|
47
|
-
if (!stated) {
|
|
48
|
-
const judgementString = localContext.nodeAsString(judgementNode);
|
|
49
|
-
|
|
50
|
-
localContext.trace(`Verifying the '${judgementString}' derived judgement...`, judgementNode);
|
|
51
|
-
|
|
52
|
-
const declarations = [],
|
|
53
|
-
declarationNode = declarationNodeQuery(judgementNode),
|
|
54
|
-
declarationVerified = verifyDeclaration(declarationNode, declarations, stated, localContext);
|
|
55
|
-
|
|
56
|
-
if (declarationVerified) {
|
|
57
|
-
const firstDeclaration = first(declarations),
|
|
58
|
-
declaration = firstDeclaration, ///
|
|
59
|
-
metavariableNode = declaration.getMetavariableNode(),
|
|
60
|
-
metatheorem = localContext.findMetatheoremByMetavariableNode(metavariableNode),
|
|
61
|
-
metaLemma = localContext.findMetaLemmaByMetavariableNode(metavariableNode),
|
|
62
|
-
metaLemmaMetatheorem = (metaLemma || metatheorem); ///
|
|
63
|
-
|
|
64
|
-
if (metaLemmaMetatheorem !== null) {
|
|
65
|
-
const frames = [],
|
|
66
|
-
frameNode = frameNodeQuery(judgementNode),
|
|
67
|
-
frameVerified = verifyFrame(frameNode, frames, stated, localContext);
|
|
68
|
-
|
|
69
|
-
if (frameVerified) {
|
|
70
|
-
const firstFrame = first(frames),
|
|
71
|
-
frame = firstFrame, ///
|
|
72
|
-
metaLemmaMetatheoremUnified = frame.unifyMetaLemmaOrMetatheorem(metaLemmaMetatheorem);
|
|
73
|
-
|
|
74
|
-
derivedJudgementVerified = metaLemmaMetatheoremUnified; ///
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (derivedJudgementVerified) {
|
|
80
|
-
localContext.debug(`...verified the '${judgementString}' derived judgement.`, judgementNode);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return derivedJudgementVerified;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function verifyStatedJudgement(judgementNode, assignments, stated, localContext) {
|
|
88
|
-
let statedJudgementVerified = false;
|
|
89
|
-
|
|
90
|
-
if (stated) {
|
|
91
|
-
const judgementString = localContext.nodeAsString(judgementNode);
|
|
92
|
-
|
|
93
|
-
localContext.trace(`Verifying the '${judgementString}' stated judgement...`, judgementNode);
|
|
94
|
-
|
|
95
|
-
const frames = [],
|
|
96
|
-
frameNode = frameNodeQuery(judgementNode),
|
|
97
|
-
frameVerified = verifyFrame(frameNode, frames, stated, localContext);
|
|
98
|
-
|
|
99
|
-
if (frameVerified) {
|
|
100
|
-
const declarations = [],
|
|
101
|
-
declarationNode = declarationNodeQuery(judgementNode),
|
|
102
|
-
declarationVerified = verifyDeclaration(declarationNode, declarations, stated, localContext);
|
|
103
|
-
|
|
104
|
-
if (declarationVerified) {
|
|
105
|
-
if (assignments !== null) {
|
|
106
|
-
const firstDeclaration = first(declarations),
|
|
107
|
-
firstFrame = first(frames),
|
|
108
|
-
frame = firstFrame,
|
|
109
|
-
declaration = firstDeclaration, ///
|
|
110
|
-
judgement = Judgement.fromJudgementNodeFrameAndDeclaration(judgementNode, frame, declaration),
|
|
111
|
-
judgementAssignment = JudgementAssignment.fromJudgement(judgement),
|
|
112
|
-
assignment = judgementAssignment;
|
|
113
|
-
|
|
114
|
-
assignments.push(assignment);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
statedJudgementVerified = true;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (statedJudgementVerified) {
|
|
122
|
-
localContext.debug(`...verified the '${judgementString}' stated judgement.`, judgementNode);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return statedJudgementVerified;
|
|
127
|
-
}
|
package/src/verify/metaLemma.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { arrayUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
import MetaLemma from "../metaLemma";
|
|
6
|
-
// import verifyProof from "../verify/proof";
|
|
7
|
-
import LocalContext from "../context/local";
|
|
8
|
-
import Substitutions from "../substitutions";
|
|
9
|
-
// import verifyConsequent from "../verify/consequent";
|
|
10
|
-
// import verifySuppositions from "../verify/suppositions";
|
|
11
|
-
|
|
12
|
-
import { EMPTY_STRING } from "../constants";
|
|
13
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
14
|
-
|
|
15
|
-
const { first } = arrayUtilities;
|
|
16
|
-
|
|
17
|
-
const proofNodeQuery = nodeQuery("/metaLemma/proof!"),
|
|
18
|
-
labelNodesQuery = nodesQuery("/metaLemma/label"),
|
|
19
|
-
consequentNodeQuery = nodeQuery("/metaLemma/consequent!"),
|
|
20
|
-
suppositionsNodeQuery = nodesQuery("/metaLemma/supposition");
|
|
21
|
-
|
|
22
|
-
export default function verifyMetaLemma(metaLemmaNode, fileContext) {
|
|
23
|
-
let metaLemmaVerified = false;
|
|
24
|
-
|
|
25
|
-
const labelNodes = labelNodesQuery(metaLemmaNode),
|
|
26
|
-
labelsString = fileContext.nodesAsString(labelNodes);
|
|
27
|
-
|
|
28
|
-
(labelsString === EMPTY_STRING) ?
|
|
29
|
-
fileContext.trace(`Verifying a meta-lLemma...`, metaLemmaNode) :
|
|
30
|
-
fileContext.trace(`Verifying the '${labelsString}' meta-lLemma...`, metaLemmaNode);
|
|
31
|
-
|
|
32
|
-
const labels = [],
|
|
33
|
-
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
34
|
-
|
|
35
|
-
if (labelsVerified) {
|
|
36
|
-
const localContext = LocalContext.fromFileContext(fileContext),
|
|
37
|
-
suppositions = [],
|
|
38
|
-
suppositionNodes = suppositionsNodeQuery(metaLemmaNode),
|
|
39
|
-
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
40
|
-
|
|
41
|
-
if (suppositionsVerified) {
|
|
42
|
-
const consequents = [],
|
|
43
|
-
consequentNode = consequentNodeQuery(metaLemmaNode),
|
|
44
|
-
consequentVerified = verifyConsequent(consequentNode, consequents, localContext);
|
|
45
|
-
|
|
46
|
-
if (consequentVerified) {
|
|
47
|
-
const proofNode = proofNodeQuery(metaLemmaNode),
|
|
48
|
-
firstConsequent = first(consequents),
|
|
49
|
-
consequent = firstConsequent, ///
|
|
50
|
-
statementNode = consequent.getStatementNode(),
|
|
51
|
-
substitutions = Substitutions.fromNothing(),
|
|
52
|
-
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
53
|
-
|
|
54
|
-
if (proofVerified) {
|
|
55
|
-
const metaLemma = MetaLemma.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
56
|
-
|
|
57
|
-
fileContext.addMetaLemma(metaLemma);
|
|
58
|
-
|
|
59
|
-
metaLemmaVerified = true;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (metaLemmaVerified) {
|
|
66
|
-
(labelsString === EMPTY_STRING) ?
|
|
67
|
-
fileContext.debug(`...verified the meta-lemma.`, metaLemmaNode) :
|
|
68
|
-
fileContext.debug(`...verified the '${labelsString}' meta-lemma.`, metaLemmaNode);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return metaLemmaVerified;
|
|
72
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { arrayUtilities } from "necessary";
|
|
4
|
-
|
|
5
|
-
// import verifyProof from "../verify/proof";
|
|
6
|
-
import Metatheorem from "../metatheorem";
|
|
7
|
-
import LocalContext from "../context/local";
|
|
8
|
-
import Substitutions from "../substitutions";
|
|
9
|
-
// import verifyConsequent from "../verify/consequent";
|
|
10
|
-
// import verifySuppositions from "../verify/suppositions";
|
|
11
|
-
|
|
12
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
13
|
-
|
|
14
|
-
const { first } = arrayUtilities;
|
|
15
|
-
|
|
16
|
-
const labelNodesQuery = nodesQuery("/metatheorem/label"),
|
|
17
|
-
proofNodeQuery = nodeQuery("/metatheorem/proof!"),
|
|
18
|
-
consequentNodeQuery = nodeQuery("/metatheorem/consequent!"),
|
|
19
|
-
suppositionsNodeQuery = nodesQuery("/metatheorem/supposition");
|
|
20
|
-
|
|
21
|
-
export default function verifyMetatheorem(metatheoremNode, fileContext) {
|
|
22
|
-
let metatheoremVerified = false;
|
|
23
|
-
|
|
24
|
-
const labelNodes = labelNodesQuery(metatheoremNode),
|
|
25
|
-
labelsString = fileContext.nodesAsString(labelNodes);
|
|
26
|
-
|
|
27
|
-
fileContext.trace(`Verifying the '${labelsString}' metatheorem...`, metatheoremNode);
|
|
28
|
-
|
|
29
|
-
const labels = [],
|
|
30
|
-
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
31
|
-
|
|
32
|
-
if (labelsVerified) {
|
|
33
|
-
const localContext = LocalContext.fromFileContext(fileContext),
|
|
34
|
-
suppositions = [],
|
|
35
|
-
suppositionNodes = suppositionsNodeQuery(metatheoremNode),
|
|
36
|
-
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
37
|
-
|
|
38
|
-
if (suppositionsVerified) {
|
|
39
|
-
const consequents = [],
|
|
40
|
-
consequentNode = consequentNodeQuery(metatheoremNode),
|
|
41
|
-
consequentVerified = verifyConsequent(consequentNode, consequents, localContext);
|
|
42
|
-
|
|
43
|
-
if (consequentVerified) {
|
|
44
|
-
const proofNode = proofNodeQuery(metatheoremNode),
|
|
45
|
-
firstConsequent = first(consequents),
|
|
46
|
-
consequent = firstConsequent, ///
|
|
47
|
-
substitutions = Substitutions.fromNothing(),
|
|
48
|
-
statementNode = consequent.getStatementNode(),
|
|
49
|
-
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
50
|
-
|
|
51
|
-
if (proofVerified) {
|
|
52
|
-
const metatheorem = Metatheorem.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
53
|
-
|
|
54
|
-
fileContext.addMetatheorem(metatheorem);
|
|
55
|
-
|
|
56
|
-
metatheoremVerified = true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (metatheoremVerified) {
|
|
63
|
-
fileContext.debug(`...verified the '${labelsString}' metatheorem.`, metatheoremNode);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return metatheoremVerified;
|
|
67
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import metavariableUnifier from "../unifier/metavariable";
|
|
4
|
-
|
|
5
|
-
import { metavariableNameFromMetavariableNode } from "../utilities/name";
|
|
6
|
-
|
|
7
|
-
export default function verifyMetavariableGivenMetaType(metavariableNode, metaType, localContext) {
|
|
8
|
-
let metavariableVerifiedGivenMetaType = false;
|
|
9
|
-
|
|
10
|
-
const metaTypeName = metaType.getName(),
|
|
11
|
-
metavariableString = localContext.nodeAsString(metavariableNode);
|
|
12
|
-
|
|
13
|
-
localContext.trace(`Verifying the '${metavariableString}' metavariable given the '${metaTypeName}' meta-type...`, metavariableNode);
|
|
14
|
-
|
|
15
|
-
const metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
16
|
-
metavariable = localContext.findMetavariableByMetavariableName(metavariableName);
|
|
17
|
-
|
|
18
|
-
if (metavariable !== null) {
|
|
19
|
-
const metavariableMetaType = metavariable.getMetaType();
|
|
20
|
-
|
|
21
|
-
if (metavariableMetaType === metaType) {
|
|
22
|
-
const metavariableNodeA = metavariableNode; ///
|
|
23
|
-
|
|
24
|
-
metavariableNode = metavariable.getNode();
|
|
25
|
-
|
|
26
|
-
const metavariableNodeB = metavariableNode; ///
|
|
27
|
-
|
|
28
|
-
const metavariableUnified = metavariableUnifier.unify(metavariableNodeA, metavariableNodeB, localContext);
|
|
29
|
-
|
|
30
|
-
metavariableVerifiedGivenMetaType = metavariableUnified; ///
|
|
31
|
-
} else {
|
|
32
|
-
const metavariableMetaTypeName = metavariableMetaType.getName();
|
|
33
|
-
|
|
34
|
-
localContext.debug(`The '${metavariableString}' metavariable's meta-type is '${metavariableMetaTypeName}' when it should be '${metaTypeName}'.`, metavariableNode);
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
localContext.debug(`The '${metavariableString}' metavariable is not present'.`, metavariableNode);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (metavariableVerifiedGivenMetaType) {
|
|
41
|
-
localContext.debug(`...verified the '${metavariableString}' metavariable given the '${metaTypeName}' meta-type.`, metavariableNode);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return metavariableVerifiedGivenMetaType;
|
|
45
|
-
}
|