occam-verify-cli 0.0.1234 → 0.0.1236
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/dom/conclusion.js +2 -2
- package/lib/dom/consequent.js +2 -2
- package/lib/dom/frame.js +2 -16
- package/lib/dom/premise.js +2 -10
- package/lib/dom/statement.js +7 -58
- package/lib/dom/supposition.js +2 -10
- package/lib/dom/term.js +2 -17
- package/lib/index.js +1 -2
- package/lib/mixins/statement/verify.js +1 -16
- package/lib/utilities/verification.js +1 -9
- package/package.json +5 -5
- package/src/dom/conclusion.js +2 -2
- package/src/dom/consequent.js +2 -2
- package/src/dom/frame.js +1 -19
- package/src/dom/premise.js +4 -13
- package/src/dom/statement.js +8 -82
- package/src/dom/supposition.js +4 -13
- package/src/dom/term.js +1 -23
- package/src/index.js +0 -1
- package/src/mixins/statement/verify.js +1 -25
- package/src/utilities/verification.js +0 -10
- package/lib/dom/assertion/contained.js +0 -287
- package/src/dom/assertion/contained.js +0 -233
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import dom from "../../dom";
|
|
4
|
-
import LocalContext from "../../context/local";
|
|
5
|
-
|
|
6
|
-
import { nodeQuery } from "../../utilities/query";
|
|
7
|
-
import { domAssigned } from "../../dom";
|
|
8
|
-
import { isAssertionNegated } from "../../utilities/assertion";
|
|
9
|
-
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions, statementFromStatementAndSubstitutions } from "../../utilities/substitutions";
|
|
10
|
-
|
|
11
|
-
const containedAssertionNodeQuery = nodeQuery("/statement/containedAssertion");
|
|
12
|
-
|
|
13
|
-
export default domAssigned(class ContainedAssertion {
|
|
14
|
-
constructor(string, node, tokens, term, frame, negated, statement) {
|
|
15
|
-
this.string = string;
|
|
16
|
-
this.node = node;
|
|
17
|
-
this.tokens = tokens;
|
|
18
|
-
this.term = term;
|
|
19
|
-
this.frame = frame;
|
|
20
|
-
this.negated = negated;
|
|
21
|
-
this.statement = statement;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getString() {
|
|
25
|
-
return this.string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getNode() {
|
|
29
|
-
return this.node;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getTokens() {
|
|
33
|
-
return this.tokens;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getTerm() {
|
|
37
|
-
return this.term;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
getFrame() {
|
|
41
|
-
return this.frame;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
isNegated() {
|
|
45
|
-
return this.negated;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
getStatement() {
|
|
49
|
-
return this.statement;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
verify(assignments, stated, context) {
|
|
53
|
-
let verified = false;
|
|
54
|
-
|
|
55
|
-
const containedAssertionString = this.string; ///
|
|
56
|
-
|
|
57
|
-
context.trace(`Verifying the '${containedAssertionString}' contained assertion...`);
|
|
58
|
-
|
|
59
|
-
let termVerified = false,
|
|
60
|
-
frameVerified = false,
|
|
61
|
-
statementVerified = false;
|
|
62
|
-
|
|
63
|
-
if (this.term !== null) {
|
|
64
|
-
termVerified = this.term.verify(context, () => {
|
|
65
|
-
const verifiedAhead = true;
|
|
66
|
-
|
|
67
|
-
return verifiedAhead;
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (this.frame !== null) {
|
|
72
|
-
frameVerified = this.verifyFrame(this.frame, assignments, stated, context);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (this.statement !== null) {
|
|
76
|
-
statementVerified = this.verifyStatement(this.statement, assignments, stated, context);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (termVerified || frameVerified || statementVerified) {
|
|
80
|
-
let verifiedWhenStated = false,
|
|
81
|
-
verifiedWhenDerived = false;
|
|
82
|
-
|
|
83
|
-
if (stated) {
|
|
84
|
-
verifiedWhenStated = this.verifyWhenStated(assignments, context);
|
|
85
|
-
} else {
|
|
86
|
-
verifiedWhenDerived = this.verifyWhenDerived(context);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (verifiedWhenStated || verifiedWhenDerived) {
|
|
90
|
-
verified = true;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (verified) {
|
|
95
|
-
context.debug(`...verified the '${containedAssertionString}' contained assertion.`);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return verified;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
verifyFrame(frame, assignments, stated, context) {
|
|
102
|
-
stated = true; ///
|
|
103
|
-
|
|
104
|
-
assignments = null; ///
|
|
105
|
-
|
|
106
|
-
const frameVerified = frame.verify(assignments, stated, context);
|
|
107
|
-
|
|
108
|
-
return frameVerified;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
verifyStatement(statement, assignments, stated, context) {
|
|
112
|
-
stated = true; ///
|
|
113
|
-
|
|
114
|
-
assignments = null; ///
|
|
115
|
-
|
|
116
|
-
const statementVerified = statement.verify(assignments, stated, context);
|
|
117
|
-
|
|
118
|
-
return statementVerified;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
verifyWhenStated(assignments, context) {
|
|
122
|
-
let verifiedWhenStated;
|
|
123
|
-
|
|
124
|
-
const containedAssertionString = this.string; ///
|
|
125
|
-
|
|
126
|
-
context.trace(`Verifying the '${containedAssertionString}' stated contained assertion...`);
|
|
127
|
-
|
|
128
|
-
verifiedWhenStated = true;
|
|
129
|
-
|
|
130
|
-
if (verifiedWhenStated) {
|
|
131
|
-
context.debug(`...verified the '${containedAssertionString}' stated contained assertion.`);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return verifiedWhenStated;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
verifyWhenDerived(context) {
|
|
138
|
-
let verifiedWhenDerived;
|
|
139
|
-
|
|
140
|
-
const containedAssertionString = this.string; ///
|
|
141
|
-
|
|
142
|
-
context.trace(`Verifying the '${containedAssertionString}' derived contained assertion...`);
|
|
143
|
-
|
|
144
|
-
verifiedWhenDerived = verifyWhenDerived(this.term, this.frame, this.statement, this.negated, context);
|
|
145
|
-
|
|
146
|
-
if (verifiedWhenDerived) {
|
|
147
|
-
context.debug(`...verified the '${containedAssertionString}' derived contained assertion.`);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return verifiedWhenDerived;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
unifyIndependently(substitutions, context) {
|
|
154
|
-
let unifiedIndependently;
|
|
155
|
-
|
|
156
|
-
const containedAssertionString = this.string; ///
|
|
157
|
-
|
|
158
|
-
context.trace(`Unifying the '${containedAssertionString}' contained assertion independently...`);
|
|
159
|
-
|
|
160
|
-
const localContext = LocalContext.fromContextAndTokens(context, this.tokens);
|
|
161
|
-
|
|
162
|
-
context = localContext; ///
|
|
163
|
-
|
|
164
|
-
const term = termFromTermAndSubstitutions(this.term, substitutions, context),
|
|
165
|
-
frame = frameFromFrameAndSubstitutions(this.frame, substitutions, context),
|
|
166
|
-
statement = statementFromStatementAndSubstitutions(this.statement, substitutions, context),
|
|
167
|
-
verifiedWhenDerived = verifyWhenDerived(term, frame, statement, this.negated, context);
|
|
168
|
-
|
|
169
|
-
unifiedIndependently = verifiedWhenDerived; ///
|
|
170
|
-
|
|
171
|
-
if (unifiedIndependently) {
|
|
172
|
-
context.debug(`...unified the '${containedAssertionString}' contained assertion independently.`);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return unifiedIndependently;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
static name = "ContainedAssertion";
|
|
179
|
-
|
|
180
|
-
static fromStatementNode(statementNode, context) {
|
|
181
|
-
let containedAssertion = null;
|
|
182
|
-
|
|
183
|
-
const containedAssertionNode = containedAssertionNodeQuery(statementNode);
|
|
184
|
-
|
|
185
|
-
if (containedAssertionNode !== null) {
|
|
186
|
-
const { Term, Frame, Statement } = dom,
|
|
187
|
-
node = containedAssertionNode, ///
|
|
188
|
-
string = context.nodeAsString(node),
|
|
189
|
-
tokens = context.nodeAsTokens(node),
|
|
190
|
-
term = Term.fromContainedAssertionNode(containedAssertionNode, context),
|
|
191
|
-
frame = Frame.fromContainedAssertionNode(containedAssertionNode, context),
|
|
192
|
-
statement = Statement.fromContainedAssertionNode(containedAssertionNode, context),
|
|
193
|
-
containedAssertionNegated = isAssertionNegated(containedAssertionNode),
|
|
194
|
-
negated = containedAssertionNegated; ///
|
|
195
|
-
|
|
196
|
-
containedAssertion = new ContainedAssertion(string, node, tokens, term, frame, negated, statement);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return containedAssertion;
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
function verifyWhenDerived(term, frame, statement, negated, context) {
|
|
204
|
-
let verifiedWhenDerived = false;
|
|
205
|
-
|
|
206
|
-
if (statement !== null) {
|
|
207
|
-
if (term !== null) {
|
|
208
|
-
const termContained = statement.isTermContained(term, context);
|
|
209
|
-
|
|
210
|
-
if (!negated && termContained) {
|
|
211
|
-
verifiedWhenDerived = true;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (negated && !termContained) {
|
|
215
|
-
verifiedWhenDerived = true;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (frame !== null) {
|
|
220
|
-
const frameContained = statement.isFrameContained(frame, context);
|
|
221
|
-
|
|
222
|
-
if (!negated && frameContained) {
|
|
223
|
-
verifiedWhenDerived = true;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (negated && !frameContained) {
|
|
227
|
-
verifiedWhenDerived = true;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return verifiedWhenDerived;
|
|
233
|
-
}
|