occam-verify-cli 0.0.1089 → 0.0.1091
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 +2 -2
- package/lib/assertion/contained.js +35 -41
- package/lib/assertion/defined.js +24 -24
- package/lib/assertion/subproof.js +24 -24
- package/lib/assertion/type.js +23 -23
- package/lib/assignment/equality.js +4 -10
- package/lib/assignment/judgement.js +4 -4
- package/lib/assignment/variable.js +4 -4
- package/lib/combinator/bracketed.js +3 -3
- package/lib/conclusion.js +11 -13
- package/lib/consequent.js +11 -13
- package/lib/constructor/bracketed.js +3 -3
- package/lib/constructor.js +2 -2
- package/lib/context/file.js +28 -27
- package/lib/context/local.js +31 -32
- package/lib/context/release.js +6 -3
- package/lib/declaration.js +18 -18
- package/lib/derivation.js +3 -3
- package/lib/equality.js +24 -24
- package/lib/equivalence.js +13 -13
- package/lib/frame.js +43 -43
- package/lib/index.js +2 -1
- package/lib/judgement.js +20 -20
- package/lib/label.js +9 -1
- package/lib/metaType.js +2 -2
- package/lib/metavariable.js +40 -39
- package/lib/mixins/statement/qualified/unify.js +19 -19
- package/lib/mixins/statement/resolve.js +11 -11
- package/lib/mixins/statement/unify.js +12 -12
- package/lib/mixins/statement/verify.js +36 -36
- package/lib/mixins/term/verify.js +2 -2
- package/lib/premise.js +31 -40
- package/lib/proof.js +6 -5
- package/lib/proofStep.js +17 -17
- package/lib/reference.js +8 -8
- package/lib/rule.js +21 -21
- package/lib/statement/qualified.js +17 -17
- package/lib/statement/unqualified.js +19 -19
- package/lib/statement.js +52 -54
- package/lib/subDerivation.js +3 -3
- package/lib/subproof.js +6 -5
- package/lib/substitution/frameForMetavariable.js +16 -39
- package/lib/substitution/statementForMetavariable.js +88 -74
- package/lib/substitution/termForVariable.js +15 -41
- package/lib/substitution.js +20 -6
- package/lib/substitutions.js +13 -13
- package/lib/supposition.js +31 -40
- package/lib/term.js +28 -28
- package/lib/topLevelAssertion.js +33 -21
- package/lib/unifier/equality.js +8 -8
- package/lib/unifier/intrinsicLevel.js +149 -0
- package/lib/unifier/metaLevel.js +41 -31
- package/lib/unifier/metavariable.js +14 -8
- package/lib/unifier/statementWithCombinator.js +16 -16
- package/lib/unifier/termWithConstructor.js +6 -6
- package/lib/unifier.js +47 -47
- package/lib/utilities/assignments.js +3 -3
- package/lib/utilities/equivalences.js +14 -14
- package/lib/utilities/json.js +22 -21
- package/lib/utilities/unifier.js +7 -8
- package/lib/variable.js +33 -33
- package/lib/verifier/statementAsCombinator.js +2 -2
- package/lib/verifier/termAsConstructor.js +2 -2
- package/package.json +2 -2
- package/src/assertion/contained.js +37 -45
- package/src/assertion/defined.js +25 -25
- package/src/assertion/subproof.js +25 -28
- package/src/assertion/type.js +23 -23
- package/src/assignment/equality.js +4 -6
- package/src/assignment/judgement.js +4 -4
- package/src/assignment/variable.js +4 -4
- package/src/combinator/bracketed.js +2 -2
- package/src/conclusion.js +14 -15
- package/src/consequent.js +14 -15
- package/src/constructor/bracketed.js +2 -2
- package/src/constructor.js +3 -2
- package/src/context/file.js +26 -25
- package/src/context/local.js +21 -23
- package/src/context/release.js +5 -3
- package/src/declaration.js +20 -20
- package/src/derivation.js +2 -2
- package/src/equality.js +26 -26
- package/src/equivalence.js +12 -12
- package/src/frame.js +42 -42
- package/src/index.js +1 -0
- package/src/judgement.js +25 -25
- package/src/label.js +14 -0
- package/src/metaType.js +1 -1
- package/src/metavariable.js +51 -43
- package/src/mixins/statement/qualified/unify.js +21 -21
- package/src/mixins/statement/resolve.js +12 -12
- package/src/mixins/statement/unify.js +11 -11
- package/src/mixins/statement/verify.js +35 -35
- package/src/mixins/term/verify.js +1 -1
- package/src/premise.js +42 -53
- package/src/proof.js +6 -4
- package/src/proofStep.js +21 -21
- package/src/reference.js +12 -11
- package/src/rule.js +20 -20
- package/src/statement/qualified.js +18 -17
- package/src/statement/unqualified.js +19 -18
- package/src/statement.js +63 -66
- package/src/subDerivation.js +2 -3
- package/src/subproof.js +6 -4
- package/src/substitution/frameForMetavariable.js +29 -45
- package/src/substitution/statementForMetavariable.js +136 -86
- package/src/substitution/termForVariable.js +28 -49
- package/src/substitution.js +15 -5
- package/src/substitutions.js +12 -12
- package/src/supposition.js +41 -53
- package/src/term.js +27 -27
- package/src/topLevelAssertion.js +32 -19
- package/src/unifier/equality.js +7 -7
- package/src/unifier/intrinsicLevel.js +61 -0
- package/src/unifier/metaLevel.js +60 -46
- package/src/unifier/metavariable.js +22 -13
- package/src/unifier/statementWithCombinator.js +28 -28
- package/src/unifier/termWithConstructor.js +8 -8
- package/src/unifier.js +55 -55
- package/src/utilities/assignments.js +2 -2
- package/src/utilities/equivalences.js +13 -13
- package/src/utilities/json.js +76 -66
- package/src/utilities/unifier.js +10 -12
- package/src/variable.js +43 -40
- package/src/verifier/statementAsCombinator.js +2 -1
- package/src/verifier/termAsConstructor.js +2 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import BracketedCombinator from "../../combinator/bracketed";
|
|
4
4
|
import statementWithCombinatorUnifier from "../../unifier/statementWithCombinator";
|
|
5
5
|
|
|
6
|
-
function unifyWithBracketedCombinator(statement, assignments, stated,
|
|
6
|
+
function unifyWithBracketedCombinator(statement, assignments, stated, context) {
|
|
7
7
|
let unifiedWithBracketedCombinator;
|
|
8
8
|
|
|
9
9
|
const statementNode = statement.getNode(),
|
|
@@ -12,28 +12,28 @@ function unifyWithBracketedCombinator(statement, assignments, stated, localConte
|
|
|
12
12
|
bracketedCombinatorStatementNode = bracketedCombinator.getStatementNode(),
|
|
13
13
|
combinatorStatementNode = bracketedCombinatorStatementNode; ///
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
context.trace(`Unifying the '${statementString}' statement with the bracketed combinator...`);
|
|
16
16
|
|
|
17
|
-
unifiedWithBracketedCombinator = statementWithCombinatorUnifier.unify(combinatorStatementNode, statementNode, assignments, stated,
|
|
17
|
+
unifiedWithBracketedCombinator = statementWithCombinatorUnifier.unify(combinatorStatementNode, statementNode, assignments, stated, context);
|
|
18
18
|
|
|
19
19
|
if (unifiedWithBracketedCombinator) {
|
|
20
|
-
|
|
20
|
+
context.debug(`...unified the '${statementString}' statement with the bracketed combinator.`);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
return unifiedWithBracketedCombinator;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function unifyWithCombinators(statement, assignments, stated,
|
|
26
|
+
function unifyWithCombinators(statement, assignments, stated, context) {
|
|
27
27
|
let unifiedWithCombinators;
|
|
28
28
|
|
|
29
|
-
const combinators =
|
|
29
|
+
const combinators = context.getCombinators();
|
|
30
30
|
|
|
31
31
|
stated = true; ///
|
|
32
32
|
|
|
33
33
|
assignments = null; ///
|
|
34
34
|
|
|
35
35
|
unifiedWithCombinators = combinators.some((combinator) => {
|
|
36
|
-
const unifiedWithCombinator = unifyStatementWithCombinator(statement, combinator, assignments, stated,
|
|
36
|
+
const unifiedWithCombinator = unifyStatementWithCombinator(statement, combinator, assignments, stated, context);
|
|
37
37
|
|
|
38
38
|
if (unifiedWithCombinator) {
|
|
39
39
|
return true;
|
|
@@ -51,7 +51,7 @@ const unifyMixins = [
|
|
|
51
51
|
|
|
52
52
|
export default unifyMixins;
|
|
53
53
|
|
|
54
|
-
function unifyStatementWithCombinator(statement, combinator, assignments, stated,
|
|
54
|
+
function unifyStatementWithCombinator(statement, combinator, assignments, stated, context) {
|
|
55
55
|
let unifiedWithCombinator;
|
|
56
56
|
|
|
57
57
|
const statementNode = statement.getNode(),
|
|
@@ -59,12 +59,12 @@ function unifyStatementWithCombinator(statement, combinator, assignments, stated
|
|
|
59
59
|
combinatorString = combinator.getString(),
|
|
60
60
|
combinatorStatementNode = combinator.getStatementNode();
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
context.trace(`Unifying the '${statementString}' statement with the '${combinatorString}' combinator...`);
|
|
63
63
|
|
|
64
|
-
unifiedWithCombinator = statementWithCombinatorUnifier.unify(combinatorStatementNode, statementNode, assignments, stated,
|
|
64
|
+
unifiedWithCombinator = statementWithCombinatorUnifier.unify(combinatorStatementNode, statementNode, assignments, stated, context);
|
|
65
65
|
|
|
66
66
|
if (unifiedWithCombinator) {
|
|
67
|
-
|
|
67
|
+
context.debug(`...unified the '${statementString}' statement with the '${combinatorString}' combinator.`);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
return unifiedWithCombinator;
|
|
@@ -16,171 +16,171 @@ const equalityNodeQuery = nodeQuery("/statement/equality"),
|
|
|
16
16
|
subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion"),
|
|
17
17
|
containedAssertionNodeQuery = nodeQuery("/statement/containedAssertion");
|
|
18
18
|
|
|
19
|
-
function verifyAsMetavariable(statement, assignments, stated,
|
|
19
|
+
function verifyAsMetavariable(statement, assignments, stated, context) {
|
|
20
20
|
let verifiedAsMetavariable = false;
|
|
21
21
|
|
|
22
22
|
const { Metavariable } = shim,
|
|
23
23
|
statementNode = statement.getNode(),
|
|
24
24
|
metavariableNode = metavariableNodeQuery(statementNode),
|
|
25
|
-
metavariable = Metavariable.fromMetavariableNode(metavariableNode,
|
|
25
|
+
metavariable = Metavariable.fromMetavariableNode(metavariableNode, context);
|
|
26
26
|
|
|
27
27
|
if (metavariable !== null) {
|
|
28
28
|
const statementString = statement.getString();
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
context.trace(`Verifying the '${statementString}' statement as a metavariable...`);
|
|
31
31
|
|
|
32
|
-
const metavariableVerified = metavariable.verify(
|
|
32
|
+
const metavariableVerified = metavariable.verify(context);
|
|
33
33
|
|
|
34
34
|
verifiedAsMetavariable = metavariableVerified; ///
|
|
35
35
|
|
|
36
36
|
if (verifiedAsMetavariable) {
|
|
37
|
-
|
|
37
|
+
context.debug(`...verified the '${statementString}' statement as a metavariable.`);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
return verifiedAsMetavariable;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function verifyAsEquality(statement, assignments, stated,
|
|
44
|
+
function verifyAsEquality(statement, assignments, stated, context) {
|
|
45
45
|
let verifiedAsEquality = false;
|
|
46
46
|
|
|
47
47
|
const { Equality } = shim,
|
|
48
48
|
statementNode = statement.getNode(),
|
|
49
49
|
equalityNode = equalityNodeQuery(statementNode),
|
|
50
|
-
equality = Equality.fromEqualityNode(equalityNode,
|
|
50
|
+
equality = Equality.fromEqualityNode(equalityNode, context);
|
|
51
51
|
|
|
52
52
|
if (equality !== null) {
|
|
53
53
|
const statementString = statement.getString();
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
context.trace(`Verifying the '${statementString}' statement as an equality...`);
|
|
56
56
|
|
|
57
|
-
const equalityVerified = equality.verify(assignments, stated,
|
|
57
|
+
const equalityVerified = equality.verify(assignments, stated, context);
|
|
58
58
|
|
|
59
59
|
verifiedAsEquality = equalityVerified; ///
|
|
60
60
|
|
|
61
61
|
if (verifiedAsEquality) {
|
|
62
|
-
|
|
62
|
+
context.debug(`...verified the '${statementString}' statement as an equality.`);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
return verifiedAsEquality;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
function verifyAsJudgement(statement, assignments, stated,
|
|
69
|
+
function verifyAsJudgement(statement, assignments, stated, context) {
|
|
70
70
|
let verifiedAsJudgement = false;
|
|
71
71
|
|
|
72
72
|
const { Judgement } = shim,
|
|
73
73
|
statementNode = statement.getNode(),
|
|
74
74
|
judgementNode = judgementNodeQuery(statementNode),
|
|
75
|
-
judgement = Judgement.fromJudgementNode(judgementNode,
|
|
75
|
+
judgement = Judgement.fromJudgementNode(judgementNode, context);
|
|
76
76
|
|
|
77
77
|
if (judgement !== null) {
|
|
78
78
|
const statementString = statement.getString();
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
context.trace(`Verifying the '${statementString}' statement as a judgement...`);
|
|
81
81
|
|
|
82
|
-
const judgementVerified = judgement.verify(assignments, stated,
|
|
82
|
+
const judgementVerified = judgement.verify(assignments, stated, context);
|
|
83
83
|
|
|
84
84
|
verifiedAsJudgement = judgementVerified; ///
|
|
85
85
|
|
|
86
86
|
if (verifiedAsJudgement) {
|
|
87
|
-
|
|
87
|
+
context.debug(`...verified the '${statementString}' statement as a judgement.`);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
return verifiedAsJudgement;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
function verifyAsTypeAssertion(statement, assignments, stated,
|
|
94
|
+
function verifyAsTypeAssertion(statement, assignments, stated, context) {
|
|
95
95
|
let verifiedAsTypeAssertion = false;
|
|
96
96
|
|
|
97
97
|
const statementNode = statement.getNode(),
|
|
98
98
|
typeAssertionNode = typeAssertionNodeQuery(statementNode),
|
|
99
|
-
typeAssertion = TypeAssertion.fromTypeAssertionNode(typeAssertionNode,
|
|
99
|
+
typeAssertion = TypeAssertion.fromTypeAssertionNode(typeAssertionNode, context);
|
|
100
100
|
|
|
101
101
|
if (typeAssertion !== null) {
|
|
102
102
|
const statementString = statement.getString();
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
context.trace(`Verifying the '${statementString}' statement as a type assertion...`);
|
|
105
105
|
|
|
106
|
-
const typeAssertionVerified = typeAssertion.verify(assignments, stated,
|
|
106
|
+
const typeAssertionVerified = typeAssertion.verify(assignments, stated, context);
|
|
107
107
|
|
|
108
108
|
verifiedAsTypeAssertion = typeAssertionVerified; ///
|
|
109
109
|
|
|
110
110
|
if (verifiedAsTypeAssertion) {
|
|
111
|
-
|
|
111
|
+
context.debug(`...verified the '${statementString}' statement as a type assertion.`);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
return verifiedAsTypeAssertion;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
function verifyAsDefinedAssertion(statement, assignments, stated,
|
|
118
|
+
function verifyAsDefinedAssertion(statement, assignments, stated, context) {
|
|
119
119
|
let verifiedAsDefinedAssertion = false;
|
|
120
120
|
|
|
121
121
|
const statementNode = statement.getNode(),
|
|
122
122
|
definedAssertionNode = definedAssertionNodeQuery(statementNode),
|
|
123
|
-
definedAssertion = DefinedAssertion.fromDefinedAssertionNode(definedAssertionNode,
|
|
123
|
+
definedAssertion = DefinedAssertion.fromDefinedAssertionNode(definedAssertionNode, context);
|
|
124
124
|
|
|
125
125
|
if (definedAssertion !== null) {
|
|
126
126
|
const statementString = statement.getString();
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
context.trace(`Verifying the '${statementString}' statement as a defined assertion...`);
|
|
129
129
|
|
|
130
|
-
const definedAssertionVerified = definedAssertion.verify(assignments, stated,
|
|
130
|
+
const definedAssertionVerified = definedAssertion.verify(assignments, stated, context);
|
|
131
131
|
|
|
132
132
|
verifiedAsDefinedAssertion = definedAssertionVerified; ///
|
|
133
133
|
|
|
134
134
|
if (verifiedAsDefinedAssertion) {
|
|
135
|
-
|
|
135
|
+
context.debug(`...verified the '${statementString}' statement as a defined assertion.`);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
return verifiedAsDefinedAssertion;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
function verifyAsContainedAssertion(statement, assignments, stated,
|
|
142
|
+
function verifyAsContainedAssertion(statement, assignments, stated, context) {
|
|
143
143
|
let verifiedAsContainedAssertion = false;
|
|
144
144
|
|
|
145
145
|
const statementNode = statement.getNode(),
|
|
146
146
|
containedAssertionNode = containedAssertionNodeQuery(statementNode),
|
|
147
|
-
containedAssertion = ContainedAssertion.fromContainedAssertionNode(containedAssertionNode,
|
|
147
|
+
containedAssertion = ContainedAssertion.fromContainedAssertionNode(containedAssertionNode, context);
|
|
148
148
|
|
|
149
149
|
if (containedAssertion !== null) {
|
|
150
150
|
const statementString = statement.getString();
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
context.trace(`Verifying the '${statementString}' statement as a contained assertion...`);
|
|
153
153
|
|
|
154
|
-
const containedAssertionVerified = containedAssertion.verify(assignments, stated,
|
|
154
|
+
const containedAssertionVerified = containedAssertion.verify(assignments, stated, context);
|
|
155
155
|
|
|
156
156
|
verifiedAsContainedAssertion = containedAssertionVerified; ///
|
|
157
157
|
|
|
158
158
|
if (verifiedAsContainedAssertion) {
|
|
159
|
-
|
|
159
|
+
context.debug(`...verified the '${statementString}' statement as a contained assertion.`);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
return verifiedAsContainedAssertion;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
function verifyAsSubproofAssertion(statement, assignments, stated,
|
|
166
|
+
function verifyAsSubproofAssertion(statement, assignments, stated, context) {
|
|
167
167
|
let verifiedAsSubproofAssertion = false;
|
|
168
168
|
|
|
169
169
|
const statementNode = statement.getNode(),
|
|
170
170
|
subproofAssertionNode = subproofAssertionNodeQuery(statementNode),
|
|
171
|
-
subproofAssertion = SubproofAssertion.fromSubproofAssertionNode(subproofAssertionNode,
|
|
171
|
+
subproofAssertion = SubproofAssertion.fromSubproofAssertionNode(subproofAssertionNode, context);
|
|
172
172
|
|
|
173
173
|
if (subproofAssertionNode !== null) {
|
|
174
174
|
const statementString = statement.getString();
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
context.trace(`Verifying the '${statementString}' statement as a subproof assertion...`);
|
|
177
177
|
|
|
178
|
-
const subproofAssertionVerified = subproofAssertion.verify(assignments, stated,
|
|
178
|
+
const subproofAssertionVerified = subproofAssertion.verify(assignments, stated, context);
|
|
179
179
|
|
|
180
180
|
verifiedAsSubproofAssertion = subproofAssertionVerified; ///
|
|
181
181
|
|
|
182
182
|
if (verifiedAsSubproofAssertion) {
|
|
183
|
-
|
|
183
|
+
context.debug(`...verified the '${statementString}' statement as a subproof assertion.`);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
@@ -15,7 +15,7 @@ function verifyTermAsVariable(term, localContext, verifyAhead) {
|
|
|
15
15
|
variable = Variable.fromVariableNode(variableNode, localContext);
|
|
16
16
|
|
|
17
17
|
if (variable !== null) {
|
|
18
|
-
const termString =
|
|
18
|
+
const termString = term.getString();
|
|
19
19
|
|
|
20
20
|
localContext.trace(`Verifying the '${termString}' term as a variable...`);
|
|
21
21
|
|
package/src/premise.js
CHANGED
|
@@ -7,6 +7,7 @@ import SubproofAssertion from "./assertion/subproof";
|
|
|
7
7
|
import { nodeQuery } from "./utilities/query";
|
|
8
8
|
import { assignAssignments } from "./utilities/assignments";
|
|
9
9
|
import { unqualifiedStatementFromJSON, unqualifiedStatementToUnqualifiedStatementJSON } from "./utilities/json";
|
|
10
|
+
import local from "./context/local";
|
|
10
11
|
|
|
11
12
|
const unqualifiedStatementNodeQuery = nodeQuery("/premise/unqualifiedStatement");
|
|
12
13
|
|
|
@@ -28,33 +29,36 @@ class Premise {
|
|
|
28
29
|
|
|
29
30
|
getStatement() { return this.unqualifiedStatement.getStatement(); }
|
|
30
31
|
|
|
31
|
-
resolveIndependently(substitutions,
|
|
32
|
+
resolveIndependently(substitutions, context) {
|
|
32
33
|
let resolvedIndependently;
|
|
33
34
|
|
|
34
|
-
const
|
|
35
|
+
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
36
|
+
generalContext = localContext, ///
|
|
37
|
+
specificContext = context; ///
|
|
35
38
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
localContext = LocalContext.fromFileContext(this.fileContext);
|
|
39
|
-
|
|
40
|
-
const localContextA = localContext; ///
|
|
39
|
+
const premise = this, ///
|
|
40
|
+
premiseString = premise.getString();
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
specificContext.trace(`Resolving the '${premiseString}' premise independently...`);
|
|
43
43
|
|
|
44
|
-
const unqualifiedStatementResolvedIndependently = this.unqualifiedStatement.resolveIndependently(substitutions,
|
|
44
|
+
const unqualifiedStatementResolvedIndependently = this.unqualifiedStatement.resolveIndependently(substitutions, generalContext, specificContext);
|
|
45
45
|
|
|
46
46
|
resolvedIndependently = unqualifiedStatementResolvedIndependently; ///
|
|
47
47
|
|
|
48
48
|
if (resolvedIndependently) {
|
|
49
|
-
|
|
49
|
+
specificContext.trace(`...resolved the '${premiseString}' premise independently.`);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
return resolvedIndependently;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
unifyProofStep(proofStep, substitutions,
|
|
55
|
+
unifyProofStep(proofStep, substitutions, context) {
|
|
56
56
|
let proofStepUnified = false;
|
|
57
57
|
|
|
58
|
+
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
59
|
+
generalContext = localContext, ///
|
|
60
|
+
specificContext = context; ///
|
|
61
|
+
|
|
58
62
|
const subproof = proofStep.getSubproof(),
|
|
59
63
|
statement = proofStep.getStatement();
|
|
60
64
|
|
|
@@ -66,54 +70,47 @@ class Premise {
|
|
|
66
70
|
if (false) {
|
|
67
71
|
///
|
|
68
72
|
} else if (subproof !== null) {
|
|
69
|
-
subproofUnified = this.unifySubproof(subproof, substitutions,
|
|
73
|
+
subproofUnified = this.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
70
74
|
} else if (statement !== null) {
|
|
71
|
-
statementUnified = this.unifyStatement(statement, substitutions,
|
|
75
|
+
statementUnified = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
if (subproofUnified || statementUnified) {
|
|
75
|
-
const
|
|
79
|
+
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
80
|
+
generalContext = localContext, ///
|
|
81
|
+
specificContext = context; ///
|
|
76
82
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const localContextA = localContext; ///
|
|
80
|
-
|
|
81
|
-
substitutions.resolve(localContextA, localContextB);
|
|
83
|
+
substitutions.resolve(generalContext, specificContext);
|
|
82
84
|
|
|
83
85
|
proofStepUnified = true;
|
|
84
86
|
}
|
|
85
87
|
|
|
86
88
|
proofStepUnified ?
|
|
87
89
|
substitutions.continue() :
|
|
88
|
-
substitutions.rollback(
|
|
90
|
+
substitutions.rollback(context);
|
|
89
91
|
|
|
90
92
|
return proofStepUnified;
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
unifyStatement(statement, substitutions,
|
|
95
|
+
unifyStatement(statement, substitutions, generalContext, specificContext) {
|
|
94
96
|
let statementUnified;
|
|
95
97
|
|
|
96
|
-
const
|
|
97
|
-
premiseString =
|
|
98
|
-
|
|
99
|
-
const localContextB = localContext; ///
|
|
100
|
-
|
|
101
|
-
localContext = LocalContext.fromFileContext(this.fileContext);
|
|
102
|
-
|
|
103
|
-
const localContextA = localContext; ///
|
|
98
|
+
const premise = this, ///
|
|
99
|
+
premiseString = premise.getString(),
|
|
100
|
+
statementString = statement.getString();
|
|
104
101
|
|
|
105
|
-
|
|
102
|
+
specificContext.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise...`);
|
|
106
103
|
|
|
107
|
-
statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions,
|
|
104
|
+
statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
108
105
|
|
|
109
106
|
if (statementUnified) {
|
|
110
|
-
|
|
107
|
+
specificContext.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`);
|
|
111
108
|
}
|
|
112
109
|
|
|
113
110
|
return statementUnified;
|
|
114
111
|
}
|
|
115
112
|
|
|
116
|
-
unifySubproof(subproof, substitutions,
|
|
113
|
+
unifySubproof(subproof, substitutions, generalContext, specificContext) {
|
|
117
114
|
let subproofUnified = false;
|
|
118
115
|
|
|
119
116
|
const premise = this, ///
|
|
@@ -121,59 +118,51 @@ class Premise {
|
|
|
121
118
|
premiseStatement = premise.getStatement(),
|
|
122
119
|
premiseStatementString = premiseStatement.getString();
|
|
123
120
|
|
|
124
|
-
const localContextB = localContext; ///
|
|
125
|
-
|
|
126
121
|
const statement = this.unqualifiedStatement.getStatement(),
|
|
127
|
-
|
|
128
|
-
context = this.fileContext, ///
|
|
129
|
-
tokens = statementTokens; ///
|
|
130
|
-
|
|
131
|
-
localContext = LocalContext.fromContextAndTokens(context, tokens); ///
|
|
132
|
-
|
|
133
|
-
const localContextA = localContext; ///
|
|
122
|
+
statementNode = statement.getNode();
|
|
134
123
|
|
|
135
|
-
|
|
124
|
+
specificContext.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement...`);
|
|
136
125
|
|
|
137
|
-
const
|
|
138
|
-
subproofAssertion = SubproofAssertion.fromStatementNode(statementNode,
|
|
126
|
+
const context = specificContext, ///
|
|
127
|
+
subproofAssertion = SubproofAssertion.fromStatementNode(statementNode, context);
|
|
139
128
|
|
|
140
129
|
if (subproofAssertion !== null) {
|
|
141
|
-
subproofUnified = subproofAssertion.unifySubproof(subproof, substitutions,
|
|
130
|
+
subproofUnified = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
142
131
|
}
|
|
143
132
|
|
|
144
133
|
if (subproofUnified) {
|
|
145
|
-
|
|
134
|
+
specificContext.debug(`...unified the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement.`);
|
|
146
135
|
}
|
|
147
136
|
|
|
148
137
|
return subproofUnified;
|
|
149
138
|
}
|
|
150
139
|
|
|
151
|
-
verify(
|
|
140
|
+
verify(context) {
|
|
152
141
|
let verified = false;
|
|
153
142
|
|
|
154
143
|
const premiseString = this.getString(); ///
|
|
155
144
|
|
|
156
|
-
|
|
145
|
+
context.trace(`Verifying the '${premiseString}' premise...`);
|
|
157
146
|
|
|
158
147
|
const stated = true,
|
|
159
148
|
assignments = [],
|
|
160
|
-
unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated,
|
|
149
|
+
unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated, context);
|
|
161
150
|
|
|
162
151
|
if (unqualifiedStatementVerified) {
|
|
163
|
-
const assignmentsAssigned = assignAssignments(assignments,
|
|
152
|
+
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
164
153
|
|
|
165
154
|
if (assignmentsAssigned) {
|
|
166
155
|
const { ProofStep } = shim,
|
|
167
156
|
proofStep = ProofStep.fromUnqualifiedStatement(this.unqualifiedStatement);
|
|
168
157
|
|
|
169
|
-
|
|
158
|
+
context.addProofStep(proofStep);
|
|
170
159
|
|
|
171
160
|
verified = true;
|
|
172
161
|
}
|
|
173
162
|
}
|
|
174
163
|
|
|
175
164
|
if (verified) {
|
|
176
|
-
|
|
165
|
+
context.debug(`...verified the '${premiseString}' premise.`);
|
|
177
166
|
}
|
|
178
167
|
|
|
179
168
|
return verified;
|
package/src/proof.js
CHANGED
|
@@ -26,15 +26,17 @@ class Proof {
|
|
|
26
26
|
return statement;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
verify(substitutions, conclusion,
|
|
29
|
+
verify(substitutions, conclusion, context) {
|
|
30
30
|
let verified = false;
|
|
31
31
|
|
|
32
|
-
localContext = LocalContext.
|
|
32
|
+
const localContext = LocalContext.fromContext(context); ///
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
context = localContext; ///
|
|
35
|
+
|
|
36
|
+
const derivationVerified = this.derivation.verify(substitutions, context);
|
|
35
37
|
|
|
36
38
|
if (derivationVerified) {
|
|
37
|
-
const lastProofStep =
|
|
39
|
+
const lastProofStep = context.getLastProofStep();
|
|
38
40
|
|
|
39
41
|
if (lastProofStep !== null) {
|
|
40
42
|
const statement = this.getStatement(),
|
package/src/proofStep.js
CHANGED
|
@@ -47,25 +47,25 @@ class ProofStep {
|
|
|
47
47
|
return statement;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
unifyStatement(statement,
|
|
50
|
+
unifyStatement(statement, context) {
|
|
51
51
|
let statementUnified = false;
|
|
52
52
|
|
|
53
53
|
if ((this.qualifiedStatement !== null) || (this.unqualifiedStatement !== null !== null)) {
|
|
54
54
|
const statementString = statement.getString();
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
context.trace(`Unifying the '${statementString}' statement...`);
|
|
57
57
|
|
|
58
58
|
const { Substitutions } = shim,
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
specificContext = context, ///
|
|
60
|
+
generalContext = context, ///
|
|
61
61
|
substitutions = Substitutions.fromNothing();
|
|
62
62
|
|
|
63
63
|
if (this.qualifiedStatement !== null) {
|
|
64
|
-
statementUnified = this.qualifiedStatement.unifyStatement(statement, substitutions,
|
|
64
|
+
statementUnified = this.qualifiedStatement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if (this.unqualifiedStatement !== null) {
|
|
68
|
-
statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions,
|
|
68
|
+
statementUnified = this.unqualifiedStatement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
const substitutionsLength = substitutions.getLength();
|
|
@@ -75,21 +75,21 @@ class ProofStep {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
if (statementUnified) {
|
|
78
|
-
|
|
78
|
+
context.debug(`...unified the '${statementString}' statement.`);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
return statementUnified;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
unifySubproofAssertion(subproofAssertion,
|
|
85
|
+
unifySubproofAssertion(subproofAssertion, context) {
|
|
86
86
|
let subproofAssertionUnified = false;
|
|
87
87
|
|
|
88
88
|
if (this.subproof !== null) {
|
|
89
89
|
const subproofString = this.subproof.getString(),
|
|
90
90
|
subproofAssertionString = subproofAssertion.getString();
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
context.trace(`Unifying the '${subproofAssertionString}' subproof assertion with the '${subproofString}' subproof...`);
|
|
93
93
|
|
|
94
94
|
const { Substitutions } = shim,
|
|
95
95
|
substitutions = Substitutions.fromNothing(),
|
|
@@ -99,11 +99,11 @@ class ProofStep {
|
|
|
99
99
|
subproofAssertionUnified = match(subproofAssertionStatements, subproofStatements, (subproofAssertionStatement, subproofStatement) => {
|
|
100
100
|
const subproofAssertionStatementNode = subproofAssertionStatement.getNode(),
|
|
101
101
|
subproofStatementNode = subproofStatement.getNode(),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
unifiedAtMetaLevel = metaLevelUnifier.unify(
|
|
102
|
+
generalNode = subproofAssertionStatementNode, ///
|
|
103
|
+
specificNode = subproofStatementNode, ///
|
|
104
|
+
generalContext = context, ///
|
|
105
|
+
specificContext = context, ///
|
|
106
|
+
unifiedAtMetaLevel = metaLevelUnifier.unify(generalNode, specificNode, substitutions, generalContext, specificContext);
|
|
107
107
|
|
|
108
108
|
if (unifiedAtMetaLevel) {
|
|
109
109
|
return true;
|
|
@@ -119,14 +119,14 @@ class ProofStep {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
if (subproofAssertionUnified) {
|
|
122
|
-
|
|
122
|
+
context.trace(`...unified the '${subproofAssertionString}' subproof assertion with the '${subproofString}' subproof.`);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
return subproofAssertionUnified;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
verify(substitutions,
|
|
129
|
+
verify(substitutions, context) {
|
|
130
130
|
let verified = false;
|
|
131
131
|
|
|
132
132
|
let stated = false;
|
|
@@ -138,23 +138,23 @@ class ProofStep {
|
|
|
138
138
|
unqualifiedStatementVerified = false;
|
|
139
139
|
|
|
140
140
|
if (this.subproof !== null) {
|
|
141
|
-
subproofVerified = this.subproof.verify(substitutions,
|
|
141
|
+
subproofVerified = this.subproof.verify(substitutions, context);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
if (this.qualifiedStatement !== null) {
|
|
145
145
|
stated = true;
|
|
146
146
|
|
|
147
|
-
qualifiedStatementVerified = this.qualifiedStatement.verify(substitutions, assignments, stated,
|
|
147
|
+
qualifiedStatementVerified = this.qualifiedStatement.verify(substitutions, assignments, stated, context);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
if (this.unqualifiedStatement !== null) {
|
|
151
151
|
stated = false;
|
|
152
152
|
|
|
153
|
-
unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated,
|
|
153
|
+
unqualifiedStatementVerified = this.unqualifiedStatement.verify(assignments, stated, context);
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
if (subproofVerified || qualifiedStatementVerified || unqualifiedStatementVerified) {
|
|
157
|
-
const assignmentsAssigned = assignAssignments(assignments,
|
|
157
|
+
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
158
158
|
|
|
159
159
|
if (assignmentsAssigned) {
|
|
160
160
|
verified = true;
|
|
@@ -164,7 +164,7 @@ class ProofStep {
|
|
|
164
164
|
if (verified) {
|
|
165
165
|
const proofStep = this; ///
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
context.addProofStep(proofStep);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
return verified;
|