occam-verify-cli 0.0.1238 → 0.0.1241
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/constants.js +5 -1
- package/lib/dom/assertion/contained.js +296 -0
- package/lib/dom/assertion/defined.js +5 -5
- package/lib/dom/frame.js +16 -2
- package/lib/dom/metavariable.js +2 -2
- package/lib/dom/procedureCall.js +9 -4
- package/lib/dom/statement.js +20 -17
- package/lib/dom/term.js +17 -2
- package/lib/index.js +2 -1
- package/lib/mixins/statement/verify.js +16 -1
- package/lib/utilities/verification.js +9 -1
- package/package.json +2 -2
- package/src/constants.js +1 -0
- package/src/dom/assertion/contained.js +246 -0
- package/src/dom/assertion/defined.js +5 -5
- package/src/dom/frame.js +19 -1
- package/src/dom/metavariable.js +1 -1
- package/src/dom/procedureCall.js +9 -3
- package/src/dom/statement.js +16 -10
- package/src/dom/term.js +23 -1
- package/src/index.js +1 -0
- package/src/mixins/statement/verify.js +24 -0
- package/src/utilities/verification.js +10 -0
package/src/dom/frame.js
CHANGED
|
@@ -11,7 +11,8 @@ import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
|
11
11
|
const declarationNodesQuery = nodesQuery("/frame/declaration"),
|
|
12
12
|
metavariableNodeQuery = nodeQuery("/frame/metavariable!"),
|
|
13
13
|
metavariableNodesQuery = nodesQuery("/frame/metavariable"),
|
|
14
|
-
definedAssertionFrameNodeQuery = nodeQuery("/definedAssertion/frame")
|
|
14
|
+
definedAssertionFrameNodeQuery = nodeQuery("/definedAssertion/frame"),
|
|
15
|
+
containedAssertionFrameNodeQuery = nodeQuery("/containedAssertion/frame");
|
|
15
16
|
|
|
16
17
|
const { first } = arrayUtilities;
|
|
17
18
|
|
|
@@ -311,6 +312,23 @@ export default domAssigned(class Frame {
|
|
|
311
312
|
|
|
312
313
|
return frame;
|
|
313
314
|
}
|
|
315
|
+
|
|
316
|
+
static fromContainedAssertionNode(containedAssertionNode, context) {
|
|
317
|
+
let frame = null;
|
|
318
|
+
|
|
319
|
+
const containedAssertionFrameNode = containedAssertionFrameNodeQuery(containedAssertionNode);
|
|
320
|
+
|
|
321
|
+
if (containedAssertionFrameNode !== null) {
|
|
322
|
+
const frameNode = containedAssertionFrameNode, ///
|
|
323
|
+
metavariableNode = metavariableNodeQuery(frameNode);
|
|
324
|
+
|
|
325
|
+
if (metavariableNode !== null) {
|
|
326
|
+
frame = frameFromFrameNodeAndMetavariableNode(frameNode, metavariableNode, context)
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return frame;
|
|
331
|
+
}
|
|
314
332
|
});
|
|
315
333
|
|
|
316
334
|
function frameFromFrameNodeAndMetavariableNode(frameNode, metavariableNode, context) {
|
package/src/dom/metavariable.js
CHANGED
|
@@ -281,7 +281,7 @@ export default domAssigned(class Metavariable {
|
|
|
281
281
|
metavariableString = this.string, ///
|
|
282
282
|
frameMetavariableString = frameMetavariable.getString();
|
|
283
283
|
|
|
284
|
-
specificContext.trace(`Unifying the frame's ${frameMetavariableString}' metavariable with the '${metavariableString}' metavariable...`);
|
|
284
|
+
specificContext.trace(`Unifying the frame's '${frameMetavariableString}' metavariable with the '${metavariableString}' metavariable...`);
|
|
285
285
|
|
|
286
286
|
const specificMetavariable = frameMetavariable, ///
|
|
287
287
|
generalMetavariable = this, ///
|
package/src/dom/procedureCall.js
CHANGED
|
@@ -49,10 +49,16 @@ export default domAssigned(class ProcedureCall {
|
|
|
49
49
|
|
|
50
50
|
context.trace(`Verifying the '${procedureCallString}' procedure call...`);
|
|
51
51
|
|
|
52
|
-
const
|
|
52
|
+
const procedure = context.findProcedureByReference(this.reference);
|
|
53
53
|
|
|
54
|
-
if (
|
|
55
|
-
|
|
54
|
+
if (procedure !== null) {
|
|
55
|
+
const procedureBoolean = procedure.isBoolean();
|
|
56
|
+
|
|
57
|
+
if (procedureBoolean) {
|
|
58
|
+
verified = true;
|
|
59
|
+
} else {
|
|
60
|
+
context.trace(`The '${procedureCallString}' procedure is not boolean.`);
|
|
61
|
+
}
|
|
56
62
|
} else {
|
|
57
63
|
context.trace(`The '${procedureCallString}' procedure is not present.`);
|
|
58
64
|
}
|
package/src/dom/statement.js
CHANGED
|
@@ -12,7 +12,7 @@ import { nodeQuery } from "../utilities/query";
|
|
|
12
12
|
import { domAssigned } from "../dom";
|
|
13
13
|
import { unifyStatement } from "../utilities/unification";
|
|
14
14
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
15
|
-
import { definedAssertionFromStatement, subproofAssertionFromStatement } from "../utilities/verification";
|
|
15
|
+
import { definedAssertionFromStatement, containedAssertionFromStatement, subproofAssertionFromStatement } from "../utilities/verification";
|
|
16
16
|
|
|
17
17
|
const { match, backwardsSome } = arrayUtilities;
|
|
18
18
|
|
|
@@ -110,22 +110,28 @@ export default domAssigned(class Statement {
|
|
|
110
110
|
unifyIndependently(substitutions, context) {
|
|
111
111
|
let unifiedIndependently = false;
|
|
112
112
|
|
|
113
|
-
const statement = this
|
|
113
|
+
const statement = this, ///
|
|
114
|
+
statementString = this.string;
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
context.trace(`Unifying the '${statementString}' statement independently...`);
|
|
116
117
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
context.trace(`Unifying the '${statementString}' statement independently...`);
|
|
118
|
+
const definedAssertion = definedAssertionFromStatement(statement, context),
|
|
119
|
+
containedAssertion = containedAssertionFromStatement(statement, context);
|
|
121
120
|
|
|
121
|
+
if (definedAssertion !== null) {
|
|
122
122
|
const definedAssertionUnifiedIndependently = definedAssertion.unifyIndependently(substitutions, context);
|
|
123
123
|
|
|
124
124
|
unifiedIndependently = definedAssertionUnifiedIndependently; ///
|
|
125
|
+
}
|
|
125
126
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
if (containedAssertion !== null) {
|
|
128
|
+
const containedAssertionUnifiedIndependently = containedAssertion.unifyIndependently(substitutions, context);
|
|
129
|
+
|
|
130
|
+
unifiedIndependently = containedAssertionUnifiedIndependently; ///
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (unifiedIndependently) {
|
|
134
|
+
context.debug(`...unified the '${statementString}' statement independently.`);
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
return unifiedIndependently;
|
package/src/dom/term.js
CHANGED
|
@@ -17,7 +17,8 @@ const { filter, compress } = arrayUtilities;
|
|
|
17
17
|
|
|
18
18
|
const variableNodesQuery = nodesQuery("//variable"),
|
|
19
19
|
termVariableNodeQuery = nodeQuery("/term/variable!"),
|
|
20
|
-
definedAssertionTermNodeQuery = nodeQuery("/definedAssertion/term")
|
|
20
|
+
definedAssertionTermNodeQuery = nodeQuery("/definedAssertion/term"),
|
|
21
|
+
containedAssertionTermNodeQuery = nodeQuery("/containedAssertion/term");
|
|
21
22
|
|
|
22
23
|
export default domAssigned(class Term {
|
|
23
24
|
constructor(string, node, type) {
|
|
@@ -298,4 +299,25 @@ export default domAssigned(class Term {
|
|
|
298
299
|
|
|
299
300
|
return term;
|
|
300
301
|
}
|
|
302
|
+
|
|
303
|
+
static fromContainedAssertionNode(containedAssertionNode, context) {
|
|
304
|
+
let term = null;
|
|
305
|
+
|
|
306
|
+
const containedAssertionTermNode = containedAssertionTermNodeQuery(containedAssertionNode);
|
|
307
|
+
|
|
308
|
+
if (containedAssertionTermNode !== null) {
|
|
309
|
+
const termNode = containedAssertionTermNode, ///
|
|
310
|
+
termVariableNode = termVariableNodeQuery(termNode);
|
|
311
|
+
|
|
312
|
+
if (termVariableNode !== null) {
|
|
313
|
+
const node = termNode, ///
|
|
314
|
+
string = context.nodeAsString(node),
|
|
315
|
+
type = null;
|
|
316
|
+
|
|
317
|
+
term = new Term(string, node, type);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return term;
|
|
322
|
+
}
|
|
301
323
|
});
|
package/src/index.js
CHANGED
|
@@ -35,6 +35,7 @@ import TypeAssertion from "./dom/assertion/type";
|
|
|
35
35
|
import TypeDeclaration from "./dom/declaration/type";
|
|
36
36
|
import DefinedAssertion from "./dom/assertion/defined";
|
|
37
37
|
import SubproofAssertion from "./dom/assertion/subproof";
|
|
38
|
+
import ContainedAssertion from "./dom/assertion/contained";
|
|
38
39
|
import VariableDeclaration from "./dom/declaration/variable";
|
|
39
40
|
import CombinatorDeclaration from "./dom/declaration/combinator";
|
|
40
41
|
import ConstructorDeclaration from "./dom/declaration/constructor";
|
|
@@ -7,6 +7,7 @@ import { equalityFromStatement,
|
|
|
7
7
|
metavariableFromStatement,
|
|
8
8
|
typeAssertionFromStatement,
|
|
9
9
|
definedAssertionFromStatement,
|
|
10
|
+
containedAssertionFromStatement,
|
|
10
11
|
subproofAssertionFromStatement } from "../../utilities/verification";
|
|
11
12
|
|
|
12
13
|
function verifyAsMetavariable(statement, assignments, stated, context) {
|
|
@@ -119,6 +120,28 @@ function verifyAsDefinedAssertion(statement, assignments, stated, context) {
|
|
|
119
120
|
return verifiedAsDefinedAssertion;
|
|
120
121
|
}
|
|
121
122
|
|
|
123
|
+
function verifyAsContainedAssertion(statement, assignments, stated, context) {
|
|
124
|
+
let verifiedAsContainedAssertion = false;
|
|
125
|
+
|
|
126
|
+
const containedAssertion = containedAssertionFromStatement(statement, context);
|
|
127
|
+
|
|
128
|
+
if (containedAssertion !== null) {
|
|
129
|
+
const statementString = statement.getString();
|
|
130
|
+
|
|
131
|
+
context.trace(`Verifying the '${statementString}' statement as a contained assertion...`);
|
|
132
|
+
|
|
133
|
+
const containedAssertionVerified = containedAssertion.verify(assignments, stated, context);
|
|
134
|
+
|
|
135
|
+
verifiedAsContainedAssertion = containedAssertionVerified; ///
|
|
136
|
+
|
|
137
|
+
if (verifiedAsContainedAssertion) {
|
|
138
|
+
context.debug(`...verified the '${statementString}' statement as a defined assertion.`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return verifiedAsContainedAssertion;
|
|
143
|
+
}
|
|
144
|
+
|
|
122
145
|
function verifyAsSubproofAssertion(statement, assignments, stated, context) {
|
|
123
146
|
let verifiedAsSubproofAssertion = false;
|
|
124
147
|
|
|
@@ -175,6 +198,7 @@ const verifyMixins = [
|
|
|
175
198
|
verifyAsJudgement,
|
|
176
199
|
verifyAsTypeAssertion,
|
|
177
200
|
verifyAsDefinedAssertion,
|
|
201
|
+
verifyAsContainedAssertion,
|
|
178
202
|
verifyAsSubproofAssertion,
|
|
179
203
|
unifyWithBracketedCombinator,
|
|
180
204
|
unifyWithCombinators
|
|
@@ -63,6 +63,16 @@ export function definedAssertionFromStatement(statement, context) {
|
|
|
63
63
|
return definedAssertion;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
export function containedAssertionFromStatement(statement, context) {
|
|
67
|
+
context = contextFromStatement(statement, context); ///
|
|
68
|
+
|
|
69
|
+
const { ContainedAssertion } = dom,
|
|
70
|
+
statementNode = statement.getNode(),
|
|
71
|
+
containedAssertion = ContainedAssertion.fromStatementNode(statementNode, context);
|
|
72
|
+
|
|
73
|
+
return containedAssertion;
|
|
74
|
+
}
|
|
75
|
+
|
|
66
76
|
export function subproofAssertionFromStatement(statement, context) {
|
|
67
77
|
context = contextFromStatement(statement, context); ///
|
|
68
78
|
|