occam-verify-cli 0.0.1067 → 0.0.1068
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assertion/contained.js +2 -2
- package/lib/assertion/defined.js +2 -2
- package/lib/assignment/judgement.js +3 -3
- package/lib/conclusion.js +4 -4
- package/lib/consequent.js +4 -4
- package/lib/declaration.js +90 -3
- package/lib/frame.js +109 -48
- package/lib/judgement.js +84 -5
- package/lib/metaType.js +24 -3
- package/lib/metavariable.js +93 -25
- package/lib/mixins/statement/unify.js +2 -17
- package/lib/mixins/statement/verify.js +13 -13
- package/lib/premise.js +10 -6
- package/lib/reference.js +11 -9
- package/lib/rule.js +5 -2
- package/lib/ruleNames.js +5 -1
- package/lib/statement/unqualified.js +26 -2
- package/lib/statement.js +4 -2
- package/lib/substitution/frameForMetavariable.js +61 -60
- package/lib/substitution/statementForMetavariable.js +52 -29
- package/lib/substitution/termForVariable.js +53 -52
- package/lib/substitution.js +28 -28
- package/lib/substitutions.js +46 -40
- package/lib/supposition.js +4 -4
- package/lib/unifier/intrinsicLevel.js +4 -4
- package/lib/unifier/metaLevel.js +11 -7
- package/lib/unifier/statementWithCombinator.js +2 -2
- package/lib/utilities/node.js +24 -10
- package/lib/utilities/tokens.js +8 -1
- package/lib/variable.js +9 -5
- package/package.json +1 -1
- package/src/assertion/contained.js +1 -1
- package/src/assertion/defined.js +1 -1
- package/src/assignment/judgement.js +3 -4
- package/src/conclusion.js +4 -4
- package/src/consequent.js +4 -4
- package/src/declaration.js +57 -4
- package/src/frame.js +149 -90
- package/src/judgement.js +109 -3
- package/src/metaType.js +29 -3
- package/src/metavariable.js +145 -42
- package/src/mixins/statement/unify.js +1 -23
- package/src/mixins/statement/verify.js +15 -13
- package/src/premise.js +13 -6
- package/src/reference.js +11 -7
- package/src/rule.js +7 -1
- package/src/ruleNames.js +1 -0
- package/src/statement/unqualified.js +31 -1
- package/src/statement.js +3 -1
- package/src/substitution/frameForMetavariable.js +65 -84
- package/src/substitution/statementForMetavariable.js +63 -32
- package/src/substitution/termForVariable.js +56 -77
- package/src/substitution.js +21 -21
- package/src/substitutions.js +51 -46
- package/src/supposition.js +4 -4
- package/src/unifier/intrinsicLevel.js +4 -3
- package/src/unifier/metaLevel.js +19 -7
- package/src/unifier/statementWithCombinator.js +1 -1
- package/src/utilities/node.js +26 -10
- package/src/utilities/tokens.js +7 -0
- package/src/variable.js +14 -5
- package/lib/unify/metavariableWithFrame.js +0 -40
- package/lib/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +0 -31
- package/lib/verify/declaration.js +0 -83
- package/lib/verify/frame.js +0 -120
- package/lib/verify/judgement.js +0 -88
- package/lib/verify/metavariableGivenMetaType.js +0 -44
- package/src/unify/metavariableWithFrame.js +0 -40
- package/src/unify/simpleSubstitutionStatementWithComplexSubstitutionStatement.js +0 -27
- package/src/verify/declaration.js +0 -113
- package/src/verify/frame.js +0 -157
- package/src/verify/judgement.js +0 -127
- package/src/verify/metavariableGivenMetaType.js +0 -45
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
|
-
}
|
|
@@ -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
|
-
}
|