occam-verify-cli 1.0.126 → 1.0.127
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/context/file.js +4 -4
- package/lib/context/local.js +4 -4
- package/lib/dom/assertion/contained.js +22 -12
- package/lib/dom/assertion/defined.js +22 -12
- package/lib/dom/assertion/property.js +3 -3
- package/lib/dom/assertion/subproof.js +3 -26
- package/lib/dom/assertion/type.js +4 -8
- package/lib/dom/axiom.js +13 -5
- package/lib/dom/combinator.js +2 -10
- package/lib/dom/conjecture.js +4 -4
- package/lib/dom/constructor/bracketed.js +3 -3
- package/lib/dom/constructor.js +17 -21
- package/lib/dom/declaration.js +14 -8
- package/lib/dom/derivation.js +10 -2
- package/lib/dom/frame.js +29 -25
- package/lib/dom/judgement.js +9 -11
- package/lib/dom/lemma.js +4 -4
- package/lib/dom/metaLemma.js +4 -4
- package/lib/dom/metaType.js +14 -4
- package/lib/dom/metatheorem.js +4 -4
- package/lib/dom/metavariable.js +39 -7
- package/lib/dom/procedureCall.js +9 -5
- package/lib/dom/property.js +30 -18
- package/lib/dom/propertyRelation.js +212 -0
- package/lib/dom/reference.js +8 -8
- package/lib/dom/statement.js +40 -16
- package/lib/dom/term.js +52 -14
- package/lib/dom/theorem.js +4 -4
- package/lib/dom/type.js +33 -29
- package/lib/dom/variable.js +19 -8
- package/lib/index.js +3 -3
- package/lib/verifier/topLevel.js +6 -6
- package/package.json +1 -1
- package/src/context/file.js +4 -3
- package/src/context/local.js +4 -3
- package/src/dom/assertion/contained.js +23 -11
- package/src/dom/assertion/defined.js +23 -11
- package/src/dom/assertion/property.js +3 -7
- package/src/dom/assertion/subproof.js +3 -44
- package/src/dom/assertion/type.js +6 -17
- package/src/dom/axiom.js +3 -3
- package/src/dom/combinator.js +1 -8
- package/src/dom/conjecture.js +1 -1
- package/src/dom/constructor/bracketed.js +3 -4
- package/src/dom/constructor.js +17 -17
- package/src/dom/declaration.js +20 -14
- package/src/dom/derivation.js +12 -3
- package/src/dom/frame.js +33 -36
- package/src/dom/judgement.js +7 -22
- package/src/dom/lemma.js +1 -1
- package/src/dom/metaLemma.js +1 -1
- package/src/dom/metaType.js +16 -6
- package/src/dom/metatheorem.js +1 -1
- package/src/dom/metavariable.js +35 -15
- package/src/dom/procedureCall.js +15 -13
- package/src/dom/property.js +49 -32
- package/src/dom/{relation/property.js → propertyRelation.js} +9 -10
- package/src/dom/reference.js +6 -6
- package/src/dom/statement.js +50 -15
- package/src/dom/term.js +69 -24
- package/src/dom/theorem.js +1 -1
- package/src/dom/type.js +48 -51
- package/src/dom/variable.js +33 -35
- package/src/index.js +1 -1
- package/src/verifier/topLevel.js +10 -5
- package/lib/dom/relation/property.js +0 -212
|
@@ -7,9 +7,7 @@ import { nodeQuery } from "../../utilities/query";
|
|
|
7
7
|
import { objectType } from "../type";
|
|
8
8
|
import { domAssigned } from "../../dom";
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
typeNodeQuery = nodeQuery("/typeAssertion/type"),
|
|
12
|
-
variableNodeQuery = nodeQuery("/term/variable!"),
|
|
10
|
+
const variableNodeQuery = nodeQuery("/term/variable!"),
|
|
13
11
|
typeAssertionNodeQuery = nodeQuery("/statement/typeAssertion");
|
|
14
12
|
|
|
15
13
|
export default domAssigned(class TypeAssertion {
|
|
@@ -175,7 +173,7 @@ export default domAssigned(class TypeAssertion {
|
|
|
175
173
|
} else {
|
|
176
174
|
provisional = false;
|
|
177
175
|
|
|
178
|
-
type = Type.fromTypeAndProvisional(this.type, provisional
|
|
176
|
+
type = Type.fromTypeAndProvisional(this.type, provisional);
|
|
179
177
|
}
|
|
180
178
|
|
|
181
179
|
const variable = Variable.fromVariableNodeAndType(variableNode, type, context);
|
|
@@ -197,11 +195,10 @@ export default domAssigned(class TypeAssertion {
|
|
|
197
195
|
|
|
198
196
|
if (typeAssertionNode !== null) {
|
|
199
197
|
const { Term, Type } = dom,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
term = Term.
|
|
203
|
-
type = Type.
|
|
204
|
-
string = stringFromTermAndType(term, type);
|
|
198
|
+
node = typeAssertionNode, ///
|
|
199
|
+
string = context.nodeAsString(node),
|
|
200
|
+
term = Term.fromTypeAssertionNode(typeAssertionNode, context),
|
|
201
|
+
type = Type.fromTypeAssertionNode(typeAssertionNode, context);
|
|
205
202
|
|
|
206
203
|
typeAssertion = new TypeAssertion(string, term, type);
|
|
207
204
|
}
|
|
@@ -209,11 +206,3 @@ export default domAssigned(class TypeAssertion {
|
|
|
209
206
|
return typeAssertion;
|
|
210
207
|
}
|
|
211
208
|
});
|
|
212
|
-
|
|
213
|
-
function stringFromTermAndType(term, type) {
|
|
214
|
-
const termString = term.getString(),
|
|
215
|
-
typeName = type.getName(),
|
|
216
|
-
string = `${termString}:${typeName}`;
|
|
217
|
-
|
|
218
|
-
return string;
|
|
219
|
-
}
|
package/src/dom/axiom.js
CHANGED
|
@@ -229,11 +229,11 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
229
229
|
|
|
230
230
|
static fromAxiomNode(axiomNode, fileContext) {
|
|
231
231
|
const node = axiomNode, ///
|
|
232
|
+
proof = proofFromNode(node, fileContext),
|
|
232
233
|
labels = labelsFromNode(node, fileContext),
|
|
233
|
-
suppositions = suppositionsFromNode(node, fileContext),
|
|
234
234
|
deduction = deductionFromNode(node, fileContext),
|
|
235
|
-
proof = proofFromNode(node, fileContext),
|
|
236
235
|
satisfiable = satisfiableFromNode(node, fileContext),
|
|
236
|
+
suppositions = suppositionsFromNode(node, fileContext),
|
|
237
237
|
string = stringFromLabelsAndDeduction(labels, deduction),
|
|
238
238
|
topLevelAssertion = new Axiom(fileContext, string, labels, suppositions, deduction, proof, satisfiable);
|
|
239
239
|
|
|
@@ -241,7 +241,7 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
241
241
|
}
|
|
242
242
|
});
|
|
243
243
|
|
|
244
|
-
function satisfiableFromNode(node, fileContext) {
|
|
244
|
+
export function satisfiableFromNode(node, fileContext) {
|
|
245
245
|
const firstPrimaryKeywordTerminalNode = firstPrimaryKeywordTerminalNodeQuery(node),
|
|
246
246
|
content = firstPrimaryKeywordTerminalNode.getContent(),
|
|
247
247
|
contentSatisfiable = (content === SATISFIABLE),
|
package/src/dom/combinator.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import dom from "../dom";
|
|
4
|
-
import LocalContext from "../context/local";
|
|
5
4
|
|
|
6
|
-
import { nodeQuery } from "../utilities/query";
|
|
7
5
|
import { domAssigned } from "../dom";
|
|
8
6
|
import { unifyStatementWithCombinator } from "../utilities/unification";
|
|
9
7
|
import { statementFromJSON, statementToStatementJSON } from "../utilities/json";
|
|
10
8
|
|
|
11
|
-
const statementNodeQuery = nodeQuery("/combinatorDeclaration/statement");
|
|
12
|
-
|
|
13
9
|
export default domAssigned(class Combinator {
|
|
14
10
|
constructor(statement) {
|
|
15
11
|
this.statement = statement;
|
|
@@ -66,10 +62,7 @@ export default domAssigned(class Combinator {
|
|
|
66
62
|
|
|
67
63
|
static fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext) {
|
|
68
64
|
const { Statement } = dom,
|
|
69
|
-
|
|
70
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
71
|
-
context = localContext, ///
|
|
72
|
-
statement = Statement.fromStatementNode(statementNode, context),
|
|
65
|
+
statement = Statement.fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext),
|
|
73
66
|
combinator = new Combinator(statement);
|
|
74
67
|
|
|
75
68
|
return combinator;
|
package/src/dom/conjecture.js
CHANGED
|
@@ -31,5 +31,5 @@ export default domAssigned(class Conjecture extends TopLevelAssertion {
|
|
|
31
31
|
|
|
32
32
|
static fromJSON(json, fileContext) { return TopLevelAssertion.fromJSON(Conjecture, json, fileContext); }
|
|
33
33
|
|
|
34
|
-
static
|
|
34
|
+
static fromNode(node, fileContext) { return TopLevelAssertion.fromNode(Conjecture, node, fileContext); }
|
|
35
35
|
});
|
|
@@ -6,7 +6,6 @@ import constructorBracketedContext from "../../context/bracketed/constructor";
|
|
|
6
6
|
|
|
7
7
|
import { nodeQuery } from "../../utilities/query";
|
|
8
8
|
import { domAssigned } from "../../dom";
|
|
9
|
-
import { stringFromTermAndType } from "../constructor";
|
|
10
9
|
|
|
11
10
|
const termNodeQuery = nodeQuery("/term/argument/term");
|
|
12
11
|
|
|
@@ -60,9 +59,9 @@ export default domAssigned(class BracketedConstructor extends Constructor {
|
|
|
60
59
|
termNode = bracketedTermNode, ///
|
|
61
60
|
context = constructorBracketedContext, ///
|
|
62
61
|
term = Term.fromTermNode(termNode, context),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
bracketedConstructor = new BracketedConstructor(string, term);
|
|
62
|
+
string = term.getString(),
|
|
63
|
+
provisional = null,
|
|
64
|
+
bracketedConstructor = new BracketedConstructor(string, term, provisional);
|
|
66
65
|
|
|
67
66
|
return bracketedConstructor;
|
|
68
67
|
}
|
package/src/dom/constructor.js
CHANGED
|
@@ -4,14 +4,13 @@ import dom from "../dom";
|
|
|
4
4
|
import LocalContext from "../context/local";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
|
+
import { objectType } from "./type";
|
|
7
8
|
import { domAssigned } from "../dom";
|
|
8
9
|
import { PROVISIONALLY } from "../constants";
|
|
9
10
|
import { unifyTermWithConstructor } from "../utilities/unification";
|
|
10
11
|
import { termFromJSON, termToTermJSON } from "../utilities/json";
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
-
typeNodeQuery = nodeQuery("/constructorDeclaration/type"),
|
|
14
|
-
lastSecondaryKeywordTerminalNodeQuery = nodeQuery("/constructorDeclaration/@secondary-keyword[-1]");
|
|
13
|
+
const lastSecondaryKeywordTerminalNodeQuery = nodeQuery("/constructorDeclaration/@secondary-keyword[-1]");
|
|
15
14
|
|
|
16
15
|
export default domAssigned(class Constructor {
|
|
17
16
|
constructor(string, term, provisional) {
|
|
@@ -81,40 +80,41 @@ export default domAssigned(class Constructor {
|
|
|
81
80
|
static fromJSON(json, fileContext) {
|
|
82
81
|
const { provisional } = json,
|
|
83
82
|
term = termFromJSON(json, fileContext),
|
|
84
|
-
|
|
85
|
-
string = stringFromTermAndType(term, type),
|
|
83
|
+
string = stringFromTermAndProvisional(term, provisional),
|
|
86
84
|
constructor = new Constructor(string, term, provisional);
|
|
87
85
|
|
|
88
86
|
return constructor;
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
static fromConstructorDeclarationNode(constructorDeclarationNode, fileContext) {
|
|
92
|
-
const { Term
|
|
93
|
-
termNode = termNodeQuery(constructorDeclarationNode),
|
|
94
|
-
typeNode = typeNodeQuery(constructorDeclarationNode),
|
|
90
|
+
const { Term } = dom,
|
|
95
91
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
96
92
|
context = localContext, ///
|
|
97
|
-
|
|
98
|
-
term = Term.fromTermNodeAndType(termNode, type, context),
|
|
99
|
-
string = stringFromTermAndType(term, type),
|
|
93
|
+
term = Term.fromConstructorDeclarationNode(constructorDeclarationNode, context),
|
|
100
94
|
provisional = provisionalFromConstructorDeclarationNode(constructorDeclarationNode, fileContext),
|
|
95
|
+
string = stringFromTermAndProvisional(term, provisional),
|
|
101
96
|
constructor = new Constructor(string, term, provisional);
|
|
102
97
|
|
|
103
98
|
return constructor;
|
|
104
99
|
}
|
|
105
100
|
});
|
|
106
101
|
|
|
107
|
-
|
|
102
|
+
function stringFromTermAndProvisional(term, provisional) {
|
|
108
103
|
let string;
|
|
109
104
|
|
|
110
|
-
const
|
|
105
|
+
const type = term.getType(),
|
|
106
|
+
termString = term.getString();
|
|
111
107
|
|
|
112
|
-
if (type ===
|
|
113
|
-
string =
|
|
108
|
+
if (type === objectType) {
|
|
109
|
+
string = termString; ///
|
|
114
110
|
} else {
|
|
115
|
-
const
|
|
111
|
+
const typeString = type.getString();
|
|
116
112
|
|
|
117
|
-
string = `${termString}:${
|
|
113
|
+
string = `${termString}:${typeString}`;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (provisional) {
|
|
117
|
+
string = `${string} ${PROVISIONALLY}`;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
return string;
|
package/src/dom/declaration.js
CHANGED
|
@@ -6,9 +6,8 @@ import Substitutions from "../substitutions";
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
import { domAssigned } from "../dom";
|
|
8
8
|
import { unifyStatementIntrinsically } from "../utilities/unification";
|
|
9
|
-
import { stripBracketsFromStatementNode } from "../utilities/brackets";
|
|
10
9
|
|
|
11
|
-
const
|
|
10
|
+
const judgementDeclarationNodeQuery = nodeQuery("/judgement/declaration");
|
|
12
11
|
|
|
13
12
|
export default domAssigned(class Declaration {
|
|
14
13
|
constructor(string, reference, statement) {
|
|
@@ -255,21 +254,28 @@ export default domAssigned(class Declaration {
|
|
|
255
254
|
|
|
256
255
|
static name = "Declaration";
|
|
257
256
|
|
|
258
|
-
static
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
let statementNode;
|
|
257
|
+
static fromJudgementNode(judgementNode, context) {
|
|
258
|
+
const judgementDeclarationNode = judgementDeclarationNodeQuery(judgementNode),
|
|
259
|
+
declarationNode = judgementDeclarationNode, ///
|
|
260
|
+
declaration = declarationFromDeclarationNode(declarationNode, context);
|
|
264
261
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
statementNode = stripBracketsFromStatementNode(statementNode); ///
|
|
262
|
+
return declaration;
|
|
263
|
+
}
|
|
268
264
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
declaration = new Declaration(string, reference, statement);
|
|
265
|
+
static fromDeclarationNode(declarationNode, context) {
|
|
266
|
+
const declaration = declarationFromDeclarationNode(declarationNode, context);
|
|
272
267
|
|
|
273
268
|
return declaration;
|
|
274
269
|
}
|
|
275
270
|
});
|
|
271
|
+
|
|
272
|
+
function declarationFromDeclarationNode(declarationNode, context) {
|
|
273
|
+
const { Declaration, Reference, Statement } = dom,
|
|
274
|
+
node = declarationNode, ///
|
|
275
|
+
string = context.nodeAsString(node),
|
|
276
|
+
reference = Reference.fromDeclarationNode(declarationNode, context),
|
|
277
|
+
statement = Statement.fromDeclarationNode(declarationNode, context),
|
|
278
|
+
declaration = new Declaration(string, reference, statement);
|
|
279
|
+
|
|
280
|
+
return declaration;
|
|
281
|
+
}
|
package/src/dom/derivation.js
CHANGED
|
@@ -67,9 +67,18 @@ function stepsOrSubproofsFromDerivationNode(derivationNode, fileContext) {
|
|
|
67
67
|
const { Step, Subproof } = dom,
|
|
68
68
|
stepOrSubproofNodes = stepOrSubproofNodesQuery(derivationNode),
|
|
69
69
|
stepsOrSubproofs = stepOrSubproofNodes.map((stepOrSubproofNode) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
let stepOrSubproof;
|
|
71
|
+
|
|
72
|
+
const step = Step.fromStepOrSubproofNode(stepOrSubproofNode, fileContext),
|
|
73
|
+
subproof = Subproof.fromStepOrSubproofNode(stepOrSubproofNode, fileContext);
|
|
74
|
+
|
|
75
|
+
if (false) {
|
|
76
|
+
///
|
|
77
|
+
} else if (step !== null) {
|
|
78
|
+
stepOrSubproof = step; ///
|
|
79
|
+
} else if (subproof !== null) {
|
|
80
|
+
stepOrSubproof = subproof; ///
|
|
81
|
+
}
|
|
73
82
|
|
|
74
83
|
return stepOrSubproof;
|
|
75
84
|
});
|
package/src/dom/frame.js
CHANGED
|
@@ -10,8 +10,8 @@ import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
|
|
|
10
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
11
11
|
|
|
12
12
|
const declarationNodesQuery = nodesQuery("/frame/declaration"),
|
|
13
|
-
metavariableNodeQuery = nodeQuery("/frame/metavariable!"),
|
|
14
13
|
metavariableNodesQuery = nodesQuery("/frame/metavariable"),
|
|
14
|
+
judgementFrameNodeQuery = nodeQuery("/judgement/frame"),
|
|
15
15
|
definedAssertionFrameNodeQuery = nodeQuery("/definedAssertion/frame"),
|
|
16
16
|
containedAssertionFrameNodeQuery = nodeQuery("/containedAssertion/frame");
|
|
17
17
|
|
|
@@ -49,16 +49,12 @@ export default domAssigned(class Frame {
|
|
|
49
49
|
getMetavariable() {
|
|
50
50
|
let metavariable = null;
|
|
51
51
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
if (declarationsLength === 0) {
|
|
55
|
-
const metavariablesLength = this.metavariables.length;
|
|
52
|
+
const simple = this.isSimple();
|
|
56
53
|
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
if (simple) {
|
|
55
|
+
const firstMetavariable = first(this.metavariables);
|
|
59
56
|
|
|
60
|
-
|
|
61
|
-
}
|
|
57
|
+
metavariable = firstMetavariable; ///
|
|
62
58
|
}
|
|
63
59
|
|
|
64
60
|
return metavariable;
|
|
@@ -71,6 +67,14 @@ export default domAssigned(class Frame {
|
|
|
71
67
|
return equalTo;
|
|
72
68
|
}
|
|
73
69
|
|
|
70
|
+
isSimple() {
|
|
71
|
+
const metavariablesLength = this.metavariables.length,
|
|
72
|
+
declarationsLength = this.declarations.length,
|
|
73
|
+
simple = ((metavariablesLength === 1) && (declarationsLength === 0));
|
|
74
|
+
|
|
75
|
+
return simple;
|
|
76
|
+
}
|
|
77
|
+
|
|
74
78
|
matchSubstitution(substitution, context) {
|
|
75
79
|
let substitutionMatches = false;
|
|
76
80
|
|
|
@@ -250,7 +254,7 @@ export default domAssigned(class Frame {
|
|
|
250
254
|
S :
|
|
251
255
|
NOTHING,
|
|
252
256
|
frameString = this.string, ///
|
|
253
|
-
metavariablesString =
|
|
257
|
+
metavariablesString = metavariablesStringFromMetavariables(this.metavariables);
|
|
254
258
|
|
|
255
259
|
context.trace(`Verifying the '${frameString}' frame's '${metavariablesString}' metavariable${sOrNothing}...`);
|
|
256
260
|
|
|
@@ -297,30 +301,29 @@ export default domAssigned(class Frame {
|
|
|
297
301
|
let frame = null;
|
|
298
302
|
|
|
299
303
|
if (frameNode !== null) {
|
|
300
|
-
|
|
301
|
-
string = context.nodeAsString(node),
|
|
302
|
-
tokens = context.nodeAsTokens(node),
|
|
303
|
-
declarations = declarationsFromFrameNode(frameNode, context),
|
|
304
|
-
metavariables = metavariablesFromFrameNode(frameNode, context);
|
|
305
|
-
|
|
306
|
-
frame = new Frame(string, node, tokens, declarations, metavariables);
|
|
304
|
+
frame = frameFromFrameNode(frameNode, context);
|
|
307
305
|
}
|
|
308
306
|
|
|
309
307
|
return frame;
|
|
310
308
|
}
|
|
311
309
|
|
|
310
|
+
static fromJudgementNode(judgementNode, context) {
|
|
311
|
+
const judgementFrameNode = judgementFrameNodeQuery(judgementNode),
|
|
312
|
+
frameNode = judgementFrameNode,
|
|
313
|
+
frame = frameFromFrameNode(frameNode, context);
|
|
314
|
+
|
|
315
|
+
return frame;
|
|
316
|
+
}
|
|
317
|
+
|
|
312
318
|
static fromDefinedAssertionNode(definedAssertionNode, context) {
|
|
313
319
|
let frame = null;
|
|
314
320
|
|
|
315
321
|
const definedAssertionFrameNode = definedAssertionFrameNodeQuery(definedAssertionNode);
|
|
316
322
|
|
|
317
323
|
if (definedAssertionFrameNode !== null) {
|
|
318
|
-
const frameNode = definedAssertionFrameNode
|
|
319
|
-
metavariableNode = metavariableNodeQuery(frameNode);
|
|
324
|
+
const frameNode = definedAssertionFrameNode; ///
|
|
320
325
|
|
|
321
|
-
|
|
322
|
-
frame = frameFromFrameNodeAndMetavariableNode(frameNode, metavariableNode, context)
|
|
323
|
-
}
|
|
326
|
+
frame = frameFromFrameNode(frameNode, context);
|
|
324
327
|
}
|
|
325
328
|
|
|
326
329
|
return frame;
|
|
@@ -332,28 +335,22 @@ export default domAssigned(class Frame {
|
|
|
332
335
|
const containedAssertionFrameNode = containedAssertionFrameNodeQuery(containedAssertionNode);
|
|
333
336
|
|
|
334
337
|
if (containedAssertionFrameNode !== null) {
|
|
335
|
-
const frameNode = containedAssertionFrameNode
|
|
336
|
-
metavariableNode = metavariableNodeQuery(frameNode);
|
|
338
|
+
const frameNode = containedAssertionFrameNode; ///
|
|
337
339
|
|
|
338
|
-
|
|
339
|
-
frame = frameFromFrameNodeAndMetavariableNode(frameNode, metavariableNode, context)
|
|
340
|
-
}
|
|
340
|
+
frame = frameFromFrameNode(frameNode, context)
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
return frame;
|
|
344
344
|
}
|
|
345
345
|
});
|
|
346
346
|
|
|
347
|
-
function
|
|
348
|
-
const { Frame
|
|
349
|
-
|
|
350
|
-
declarations = [],
|
|
351
|
-
metavariables = [
|
|
352
|
-
metavariable
|
|
353
|
-
],
|
|
354
|
-
node = frameNode, ///
|
|
347
|
+
function frameFromFrameNode(frameNode, context) {
|
|
348
|
+
const { Frame } = dom,
|
|
349
|
+
node = frameNode, ///
|
|
355
350
|
string = context.nodeAsString(node),
|
|
356
351
|
tokens = context.nodeAsTokens(node),
|
|
352
|
+
declarations = declarationsFromFrameNode(frameNode, context),
|
|
353
|
+
metavariables = metavariablesFromFrameNode(frameNode, context),
|
|
357
354
|
frame = new Frame(string, node, tokens, declarations, metavariables);
|
|
358
355
|
|
|
359
356
|
return frame;
|
|
@@ -397,7 +394,7 @@ function declarationsStringFromDeclarations(declarations) {
|
|
|
397
394
|
return declarationsString;
|
|
398
395
|
}
|
|
399
396
|
|
|
400
|
-
function
|
|
397
|
+
function metavariablesStringFromMetavariables(metavariable) {
|
|
401
398
|
const metavariablesString = metavariable.reduce((metavariablesString, metavariable) => {
|
|
402
399
|
const metavariableString = metavariable.getString();
|
|
403
400
|
|
package/src/dom/judgement.js
CHANGED
|
@@ -6,9 +6,7 @@ import JudgementAssignment from "../assignment/judgement";
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
import { domAssigned } from "../dom";
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
judgementNodeQuery = nodeQuery("/statement/judgement"),
|
|
11
|
-
declarationNodeQuery = nodeQuery("/judgement/declaration");
|
|
9
|
+
const judgementNodeQuery = nodeQuery("/statement/judgement");
|
|
12
10
|
|
|
13
11
|
export default domAssigned(class Judgement {
|
|
14
12
|
constructor(string, frame, declaration) {
|
|
@@ -29,6 +27,8 @@ export default domAssigned(class Judgement {
|
|
|
29
27
|
return this.declaration;
|
|
30
28
|
}
|
|
31
29
|
|
|
30
|
+
isSimple() { return this.frame.isSimple(); }
|
|
31
|
+
|
|
32
32
|
getMetavariable() { return this.frame.getMetavariable(); }
|
|
33
33
|
|
|
34
34
|
verify(assignments, stated, context) {
|
|
@@ -161,10 +161,11 @@ export default domAssigned(class Judgement {
|
|
|
161
161
|
const judgementNode = judgementNodeQuery(statementNode);
|
|
162
162
|
|
|
163
163
|
if (judgementNode !== null) {
|
|
164
|
-
const
|
|
164
|
+
const { Frame, Declaration} = dom,
|
|
165
|
+
node = judgementNode, ///
|
|
165
166
|
string = context.nodeAsString(node),
|
|
166
|
-
frame =
|
|
167
|
-
declaration =
|
|
167
|
+
frame = Frame.fromJudgementNode(judgementNode, context),
|
|
168
|
+
declaration = Declaration.fromJudgementNode(judgementNode, context);
|
|
168
169
|
|
|
169
170
|
judgement = new Judgement(string, frame, declaration);
|
|
170
171
|
}
|
|
@@ -172,19 +173,3 @@ export default domAssigned(class Judgement {
|
|
|
172
173
|
return judgement;
|
|
173
174
|
}
|
|
174
175
|
});
|
|
175
|
-
|
|
176
|
-
function frameFromJudgementNode(judgementNode, context) {
|
|
177
|
-
const { Frame } = dom,
|
|
178
|
-
frameNode = frameNodeQuery(judgementNode),
|
|
179
|
-
frame = Frame.fromFrameNode(frameNode, context);
|
|
180
|
-
|
|
181
|
-
return frame;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function declarationFromJudgementNode(judgementNode, context) {
|
|
185
|
-
const { Declaration } = dom,
|
|
186
|
-
declarationNode = declarationNodeQuery(judgementNode),
|
|
187
|
-
declaration = Declaration.fromDeclarationNode(declarationNode, context);
|
|
188
|
-
|
|
189
|
-
return declaration;
|
|
190
|
-
}
|
package/src/dom/lemma.js
CHANGED
|
@@ -33,5 +33,5 @@ export default domAssigned(class Lemma extends TopLevelAssertion {
|
|
|
33
33
|
|
|
34
34
|
static name = "Lemma";
|
|
35
35
|
|
|
36
|
-
static
|
|
36
|
+
static fromNode(node, fileContext) { return TopLevelAssertion.fromNode(Lemma, node, fileContext); }
|
|
37
37
|
});
|
package/src/dom/metaLemma.js
CHANGED
|
@@ -31,5 +31,5 @@ export default domAssigned(class MetaLemma extends TopLevelMetaAssertion {
|
|
|
31
31
|
|
|
32
32
|
static fromJSON(json, fileContext) { return TopLevelMetaAssertion.fromJSON(MetaLemma, json, fileContext); }
|
|
33
33
|
|
|
34
|
-
static
|
|
34
|
+
static fromNode(node, fileContext) { return TopLevelMetaAssertion.fromNode(MetaLemma, node, fileContext); }
|
|
35
35
|
});
|
package/src/dom/metaType.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import LocalContext from "../context/local";
|
|
4
|
+
|
|
3
5
|
import { nodeQuery } from "../utilities/query";
|
|
4
6
|
import { domAssigned } from "../dom";
|
|
5
7
|
import { metaTypeNameFromMetaTypeNode } from "../utilities/name";
|
|
6
8
|
import { FRAME_META_TYPE_NAME, REFERENCE_META_TYPE_NAME, STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
7
9
|
|
|
8
|
-
const
|
|
10
|
+
const metavariableDeclarationMetaTypeNodeQuery = nodeQuery("/metavariableDeclaration/metaType");
|
|
9
11
|
|
|
10
12
|
class MetaType {
|
|
11
13
|
constructor(name) {
|
|
@@ -54,21 +56,29 @@ class MetaType {
|
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
static fromMetaTypeNode(metaTypeNode, context) {
|
|
57
|
-
const
|
|
58
|
-
metaType = metaTypeFromMetaTypeName(metaTypeName);
|
|
59
|
+
const metaType = metaTypeFromMetaTypeNode(metaTypeNode, context);
|
|
59
60
|
|
|
60
61
|
return metaType;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
static fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
const metavariableDeclarationMetaTypeNode = metavariableDeclarationMetaTypeNodeQuery(metavariableDeclarationNode),
|
|
66
|
+
metaTypeNode = metavariableDeclarationMetaTypeNode, ///
|
|
67
|
+
localContext = LocalContext.fromFileContext(fileContext),
|
|
68
|
+
context = localContext, ///
|
|
69
|
+
metaType = metaTypeFromMetaTypeNode(metaTypeNode, context);
|
|
67
70
|
|
|
68
71
|
return metaType;
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
|
|
75
|
+
function metaTypeFromMetaTypeNode(metaTypeNode, context) {
|
|
76
|
+
const metaTypeName = metaTypeNameFromMetaTypeNode(metaTypeNode),
|
|
77
|
+
metaType = metaTypeFromMetaTypeName(metaTypeName);
|
|
78
|
+
|
|
79
|
+
return metaType;
|
|
80
|
+
}
|
|
81
|
+
|
|
72
82
|
export default domAssigned(MetaType);
|
|
73
83
|
|
|
74
84
|
class FrameMetaType extends MetaType {
|
package/src/dom/metatheorem.js
CHANGED
|
@@ -31,5 +31,5 @@ export default domAssigned(class Metatheorem extends TopLevelMetaAssertion {
|
|
|
31
31
|
|
|
32
32
|
static fromJSON(json, fileContext) { return TopLevelMetaAssertion.fromJSON(Metatheorem, json, fileContext); }
|
|
33
33
|
|
|
34
|
-
static
|
|
34
|
+
static fromNode(node, fileContext) { return TopLevelMetaAssertion.fromNode(Metatheorem, node, fileContext); }
|
|
35
35
|
});
|
package/src/dom/metavariable.js
CHANGED
|
@@ -16,12 +16,12 @@ import { metavariableFromFrame, metavariableFromStatement } from "../utilities/c
|
|
|
16
16
|
import { unifyMetavariable, unifyMetavariableIntrinsically } from "../utilities/unification";
|
|
17
17
|
import { typeNameFromTypeNode, metavariableNameFromMetavariableNode } from "../utilities/name";
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
frameMetavariableNodeQuery = nodeQuery("/frame/metavariable!"),
|
|
19
|
+
const frameMetavariableNodeQuery = nodeQuery("/frame/metavariable!"),
|
|
21
20
|
labelMetavariableNodeQuery = nodeQuery("/label/metavariable"),
|
|
22
21
|
referenceMetavariableNodeQuery = nodeQuery("/reference/metavariable"),
|
|
23
22
|
statementMetavariableNodeQuery = nodeQuery("/statement/metavariable"),
|
|
24
|
-
|
|
23
|
+
metavariableDeclarationMetavariableNodeQuery = nodeQuery("/metavariableDeclaration/metavariable"),
|
|
24
|
+
metavariableDeclarationMetavariableTypeNodeQuery = nodeQuery("/metavariableDeclaration/metavariable/type");
|
|
25
25
|
|
|
26
26
|
export default domAssigned(class Metavariable {
|
|
27
27
|
constructor(string, node, tokens, name, type, metaType) {
|
|
@@ -57,6 +57,26 @@ export default domAssigned(class Metavariable {
|
|
|
57
57
|
return this.metaType;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
setNode(node) {
|
|
61
|
+
this.node = node;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
setTokens(tokens) {
|
|
65
|
+
this.tokens = tokens;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
setName(name) {
|
|
69
|
+
this.name = name;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
setType(type) {
|
|
73
|
+
this.type = type;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
setMetaType(metaType) {
|
|
77
|
+
this.metaType = metaType;
|
|
78
|
+
}
|
|
79
|
+
|
|
60
80
|
matchName(name) {
|
|
61
81
|
const nameMatches = (name === this.name);
|
|
62
82
|
|
|
@@ -504,18 +524,18 @@ export default domAssigned(class Metavariable {
|
|
|
504
524
|
}
|
|
505
525
|
|
|
506
526
|
static fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
|
|
507
|
-
const {
|
|
527
|
+
const { MetaType } = dom,
|
|
528
|
+
metavariableDeclarationMetavariableNode = metavariableDeclarationMetavariableNodeQuery(metavariableDeclarationNode),
|
|
529
|
+
metavariableNode = metavariableDeclarationMetavariableNode, ///
|
|
508
530
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
509
531
|
context = localContext, ///
|
|
510
|
-
metavariableNode = metavariableNodeQuery(metavariableDeclarationNode),
|
|
511
|
-
node = metavariableNode, ///
|
|
512
|
-
string = fileContext.nodeAsString(node),
|
|
513
|
-
tokens = fileContext.nodeAsTokens(node),
|
|
514
|
-
metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
515
|
-
name = metavariableName, ///
|
|
516
532
|
type = typeFromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext),
|
|
517
533
|
metaType = MetaType.fromMetavariableDeclarationNode(metavariableDeclarationNode, context),
|
|
518
|
-
metavariable =
|
|
534
|
+
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
535
|
+
|
|
536
|
+
metavariable.setType(type);
|
|
537
|
+
|
|
538
|
+
metavariable.setMetaType(metaType);
|
|
519
539
|
|
|
520
540
|
return metavariable;
|
|
521
541
|
}
|
|
@@ -524,11 +544,11 @@ export default domAssigned(class Metavariable {
|
|
|
524
544
|
function metavariableFromMetavariableNode(metavariableNode, context) {
|
|
525
545
|
const { Metavariable } = dom,
|
|
526
546
|
metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
547
|
+
type = null,
|
|
527
548
|
name = metavariableName, ///
|
|
528
549
|
node = metavariableNode, ///
|
|
529
550
|
string = context.nodeAsString(node),
|
|
530
551
|
tokens = context.nodeAsTokens(node),
|
|
531
|
-
type = null,
|
|
532
552
|
metaType = null,
|
|
533
553
|
metavariable = new Metavariable(string, node, tokens, name, type, metaType);
|
|
534
554
|
|
|
@@ -538,10 +558,10 @@ function metavariableFromMetavariableNode(metavariableNode, context) {
|
|
|
538
558
|
function typeFromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
|
|
539
559
|
let type = null;
|
|
540
560
|
|
|
541
|
-
const
|
|
561
|
+
const metavariableDeclarationMetavariableTypeNode = metavariableDeclarationMetavariableTypeNodeQuery(metavariableDeclarationNode);
|
|
542
562
|
|
|
543
|
-
if (
|
|
544
|
-
const typeNode =
|
|
563
|
+
if (metavariableDeclarationMetavariableTypeNode !== null) {
|
|
564
|
+
const typeNode = metavariableDeclarationMetavariableTypeNode, ///
|
|
545
565
|
typeName = typeNameFromTypeNode(typeNode);
|
|
546
566
|
|
|
547
567
|
type = fileContext.findTypeByTypeName(typeName);
|