occam-verify-cli 1.0.184 → 1.0.192
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/property.js +2 -4
- package/lib/dom/assertion/subproof.js +3 -5
- package/lib/dom/assertion/type.js +6 -8
- package/lib/dom/axiom.js +15 -100
- package/lib/dom/conjecture.js +5 -4
- package/lib/dom/constructor/bracketed.js +6 -7
- package/lib/dom/declaration/complexType.js +6 -6
- package/lib/dom/declaration/metavariable.js +3 -5
- package/lib/dom/declaration/type.js +2 -2
- package/lib/dom/declaration.js +2 -4
- package/lib/dom/derivation.js +2 -4
- package/lib/dom/equality.js +9 -11
- package/lib/dom/frame.js +8 -12
- package/lib/dom/judgement.js +2 -4
- package/lib/dom/lemma.js +5 -4
- package/lib/dom/metaLemma.js +5 -4
- package/lib/dom/metaType.js +2 -4
- package/lib/dom/metatheorem.js +5 -4
- package/lib/dom/metavariable.js +12 -15
- package/lib/dom/parameter.js +2 -4
- package/lib/dom/procedureCall.js +6 -10
- package/lib/dom/proof.js +2 -4
- package/lib/dom/property.js +16 -51
- package/lib/dom/propertyRelation.js +8 -10
- package/lib/dom/reference.js +7 -11
- package/lib/dom/rule.js +6 -8
- package/lib/dom/statement.js +27 -31
- package/lib/dom/step.js +4 -6
- package/lib/dom/subDerivation.js +2 -4
- package/lib/dom/subproof.js +6 -8
- package/lib/dom/term.js +14 -20
- package/lib/dom/theorem.js +5 -4
- package/lib/dom/topLevelAssertion.js +30 -24
- package/lib/dom/topLevelMetaAssertion.js +5 -15
- package/lib/dom/type.js +8 -25
- package/lib/dom/variable.js +5 -11
- package/lib/node/assertion/contained.js +45 -58
- package/lib/node/assertion/defined.js +33 -58
- package/lib/node/assertion/property.js +33 -58
- package/lib/node/assertion/satisfies.js +21 -58
- package/lib/node/assertion/subproof.js +21 -58
- package/lib/node/assertion/type.js +33 -58
- package/lib/node/axiom.js +6 -52
- package/lib/node/combinator.js +6 -57
- package/lib/node/conclusion.js +21 -58
- package/lib/node/conjecture.js +6 -52
- package/lib/node/constructor.js +6 -57
- package/lib/node/declaration/combinator.js +13 -61
- package/lib/node/declaration/complexType.js +27 -75
- package/lib/node/declaration/constructor.js +24 -70
- package/lib/node/declaration/metavariable.js +40 -58
- package/lib/node/declaration/property.js +27 -72
- package/lib/node/declaration/type.js +23 -69
- package/lib/node/declaration/variable.js +28 -83
- package/lib/node/declaration.js +33 -58
- package/lib/node/deduction.js +21 -58
- package/lib/node/derivation.js +21 -58
- package/lib/node/equality.js +34 -58
- package/lib/node/error.js +6 -57
- package/lib/node/frame.js +52 -58
- package/lib/node/judgement.js +33 -58
- package/lib/node/label.js +21 -58
- package/lib/{node.js → node/labels.js} +25 -27
- package/lib/node/lemma.js +6 -52
- package/lib/node/metaLemma.js +6 -52
- package/lib/node/metaType.js +18 -60
- package/lib/node/metatheorem.js +6 -52
- package/lib/node/metavariable.js +40 -61
- package/lib/node/parameter.js +22 -58
- package/lib/node/parenthesisedLabels.js +123 -0
- package/lib/node/premise.js +33 -58
- package/lib/node/procedureCall.js +33 -58
- package/lib/node/proof.js +21 -58
- package/lib/node/property.js +18 -62
- package/lib/node/propertyRelation.js +40 -58
- package/lib/node/reference.js +21 -58
- package/lib/node/rule.js +6 -52
- package/lib/node/statement.js +105 -58
- package/lib/node/step.js +47 -58
- package/lib/node/subDerivation.js +21 -58
- package/lib/node/subproof.js +47 -58
- package/lib/node/supposition.js +33 -58
- package/lib/node/term.js +57 -58
- package/lib/node/theorem.js +6 -52
- package/lib/node/topLevelAssertion.js +86 -59
- package/lib/node/topLevelMetaAssertion.js +65 -59
- package/lib/node/type.js +14 -60
- package/lib/node/variable.js +14 -60
- package/lib/nominal/parser.js +3 -3
- package/lib/nonTerminalNodeMap.js +5 -3
- package/lib/ruleNames.js +10 -2
- package/lib/utilities/node.js +283 -7
- package/lib/utilities/type.js +16 -4
- package/lib/verifier/topLevel.js +6 -6
- package/package.json +8 -8
- package/src/constants.js +1 -0
- package/src/dom/assertion/property.js +1 -4
- package/src/dom/assertion/subproof.js +2 -6
- package/src/dom/assertion/type.js +7 -10
- package/src/dom/axiom.js +7 -77
- package/src/dom/conjecture.js +6 -1
- package/src/dom/constructor/bracketed.js +6 -8
- package/src/dom/declaration/complexType.js +7 -6
- package/src/dom/declaration/metavariable.js +2 -6
- package/src/dom/declaration/type.js +4 -2
- package/src/dom/declaration.js +1 -5
- package/src/dom/derivation.js +1 -4
- package/src/dom/equality.js +13 -17
- package/src/dom/frame.js +7 -19
- package/src/dom/judgement.js +1 -4
- package/src/dom/lemma.js +6 -1
- package/src/dom/metaLemma.js +6 -1
- package/src/dom/metaType.js +1 -5
- package/src/dom/metatheorem.js +6 -1
- package/src/dom/metavariable.js +11 -25
- package/src/dom/parameter.js +2 -6
- package/src/dom/procedureCall.js +5 -14
- package/src/dom/proof.js +1 -4
- package/src/dom/property.js +21 -78
- package/src/dom/propertyRelation.js +10 -14
- package/src/dom/reference.js +6 -18
- package/src/dom/rule.js +6 -12
- package/src/dom/statement.js +26 -46
- package/src/dom/step.js +3 -5
- package/src/dom/subDerivation.js +1 -4
- package/src/dom/subproof.js +8 -12
- package/src/dom/term.js +16 -32
- package/src/dom/theorem.js +6 -1
- package/src/dom/topLevelAssertion.js +30 -25
- package/src/dom/topLevelMetaAssertion.js +16 -28
- package/src/dom/type.js +9 -35
- package/src/dom/variable.js +4 -12
- package/src/node/assertion/contained.js +41 -3
- package/src/node/assertion/defined.js +29 -3
- package/src/node/assertion/property.js +29 -3
- package/src/node/assertion/satisfies.js +17 -3
- package/src/node/assertion/subproof.js +17 -3
- package/src/node/assertion/type.js +29 -3
- package/src/node/axiom.js +3 -3
- package/src/node/combinator.js +3 -3
- package/src/node/conclusion.js +17 -3
- package/src/node/conjecture.js +3 -3
- package/src/node/constructor.js +3 -3
- package/src/node/declaration/combinator.js +11 -7
- package/src/node/declaration/complexType.js +25 -24
- package/src/node/declaration/constructor.js +22 -17
- package/src/node/declaration/metavariable.js +36 -3
- package/src/node/declaration/property.js +21 -17
- package/src/node/declaration/type.js +22 -17
- package/src/node/declaration/variable.js +24 -32
- package/src/node/declaration.js +29 -3
- package/src/node/deduction.js +17 -3
- package/src/node/derivation.js +18 -3
- package/src/node/equality.js +31 -3
- package/src/node/error.js +3 -3
- package/src/node/frame.js +53 -3
- package/src/node/judgement.js +29 -3
- package/src/node/label.js +17 -3
- package/src/node/labels.js +21 -0
- package/src/node/lemma.js +3 -3
- package/src/node/metaLemma.js +3 -3
- package/src/node/metaType.js +19 -8
- package/src/node/metatheorem.js +3 -3
- package/src/node/metavariable.js +42 -9
- package/src/node/parameter.js +20 -3
- package/src/node/parenthesisedLabels.js +28 -0
- package/src/node/premise.js +29 -3
- package/src/node/procedureCall.js +29 -3
- package/src/node/proof.js +17 -3
- package/src/node/property.js +18 -12
- package/src/node/propertyRelation.js +35 -3
- package/src/node/reference.js +17 -3
- package/src/node/rule.js +3 -3
- package/src/node/statement.js +108 -3
- package/src/node/step.js +41 -3
- package/src/node/subDerivation.js +18 -3
- package/src/node/subproof.js +41 -3
- package/src/node/supposition.js +29 -3
- package/src/node/term.js +62 -3
- package/src/node/theorem.js +3 -3
- package/src/node/topLevelAssertion.js +89 -3
- package/src/node/topLevelMetaAssertion.js +59 -3
- package/src/node/type.js +15 -8
- package/src/node/variable.js +15 -8
- package/src/nominal/parser.js +1 -1
- package/src/nonTerminalNodeMap.js +9 -3
- package/src/ruleNames.js +3 -1
- package/src/utilities/node.js +147 -6
- package/src/utilities/type.js +9 -0
- package/src/verifier/topLevel.js +5 -10
- package/lib/defaultTerminalNode.js +0 -20
- package/lib/mixins/node.js +0 -145
- package/src/defaultTerminalNode.js +0 -7
- package/src/mixins/node.js +0 -201
- package/src/node.js +0 -29
|
@@ -3,12 +3,8 @@
|
|
|
3
3
|
import dom from "../../dom";
|
|
4
4
|
import VariableAssignment from "../../assignment/variable";
|
|
5
5
|
|
|
6
|
-
import { nodeQuery } from "../../utilities/query";
|
|
7
6
|
import { domAssigned } from "../../dom";
|
|
8
7
|
|
|
9
|
-
const variableNodeQuery = nodeQuery("/term/variable!"),
|
|
10
|
-
typeAssertionNodeQuery = nodeQuery("/statement/typeAssertion");
|
|
11
|
-
|
|
12
8
|
export default domAssigned(class TypeAssertion {
|
|
13
9
|
constructor(string, term, type) {
|
|
14
10
|
this.string = string;
|
|
@@ -155,8 +151,7 @@ export default domAssigned(class TypeAssertion {
|
|
|
155
151
|
}
|
|
156
152
|
|
|
157
153
|
const { Type, Variable } = dom,
|
|
158
|
-
termNode = this.term.getNode()
|
|
159
|
-
variableNode = variableNodeQuery(termNode);
|
|
154
|
+
termNode = this.term.getNode();
|
|
160
155
|
|
|
161
156
|
let type,
|
|
162
157
|
provisional;
|
|
@@ -171,10 +166,12 @@ export default domAssigned(class TypeAssertion {
|
|
|
171
166
|
type = Type.fromTypeAndProvisional(this.type, provisional);
|
|
172
167
|
}
|
|
173
168
|
|
|
174
|
-
const
|
|
169
|
+
const singularVariableNode = termNode.getSingularVariableNode();
|
|
175
170
|
|
|
176
|
-
if (
|
|
177
|
-
const
|
|
171
|
+
if (singularVariableNode !== null) {
|
|
172
|
+
const variableNode = singularVariableNode, ///
|
|
173
|
+
variable = Variable.fromVariableNodeAndType(variableNode, type, context),
|
|
174
|
+
variableAssignment = VariableAssignment.fromVariable(variable),
|
|
178
175
|
assignment = variableAssignment; ///
|
|
179
176
|
|
|
180
177
|
assignments.push(assignment);
|
|
@@ -186,7 +183,7 @@ export default domAssigned(class TypeAssertion {
|
|
|
186
183
|
static fromStatementNode(statementNode, context) {
|
|
187
184
|
let typeAssertion = null;
|
|
188
185
|
|
|
189
|
-
const typeAssertionNode =
|
|
186
|
+
const typeAssertionNode = statementNode.getTypeAssertionNode();
|
|
190
187
|
|
|
191
188
|
if (typeAssertionNode !== null) {
|
|
192
189
|
const { Term, Type } = dom,
|
package/src/dom/axiom.js
CHANGED
|
@@ -4,34 +4,12 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import TopLevelAssertion from "./topLevelAssertion";
|
|
6
6
|
|
|
7
|
-
import { nodeQuery } from "../utilities/query";
|
|
8
|
-
import { SATISFIABLE } from "../constants";
|
|
9
7
|
import { domAssigned } from "../dom";
|
|
10
|
-
import { labelsFromJSON,
|
|
11
|
-
deductionFromJSON,
|
|
12
|
-
satisfiableFromJSON,
|
|
13
|
-
labelsToLabelsJSON,
|
|
14
|
-
suppositionsFromJSON,
|
|
15
|
-
deductionToDeductionJSON,
|
|
16
|
-
suppositionsToSuppositionsJSON } from "../utilities/json";
|
|
17
8
|
import { satisfiesAssertionFromStatement } from "../utilities/context";
|
|
18
|
-
import { proofFromNode, labelsFromNode, deductionFromNode, suppositionsFromNode, stringFromLabelsAndDeduction } from "./topLevelAssertion";
|
|
19
9
|
|
|
20
10
|
const { match, backwardsSome } = arrayUtilities;
|
|
21
11
|
|
|
22
|
-
const firstPrimaryKeywordTerminalNodeQuery = nodeQuery("/axiom/@primary-keyword[0]");
|
|
23
|
-
|
|
24
12
|
export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
25
|
-
constructor(fileContext, string, labels, suppositions, deduction, proof, satisfiable) {
|
|
26
|
-
super(fileContext, string, labels, suppositions, deduction, proof);
|
|
27
|
-
|
|
28
|
-
this.satisfiable = satisfiable;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
isSatisfiable() {
|
|
32
|
-
return this.satisfiable;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
13
|
verify() {
|
|
36
14
|
let verified;
|
|
37
15
|
|
|
@@ -163,7 +141,9 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
163
141
|
statementAndStepsOrSubproofsUnified = super.unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, substitutions, context);
|
|
164
142
|
|
|
165
143
|
if (statementAndStepsOrSubproofsUnified) {
|
|
166
|
-
|
|
144
|
+
const satisfiable = this.isSatisfiable();
|
|
145
|
+
|
|
146
|
+
if (satisfiable) {
|
|
167
147
|
const substitutionsMatch = backwardsSome(stepsOrSubproofs, (stepOrSubproof) => {
|
|
168
148
|
const stepSubstep = stepOrSubproof.isStep();
|
|
169
149
|
|
|
@@ -189,64 +169,14 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
|
|
|
189
169
|
return statementAndStepsOrSubproofsUnified;
|
|
190
170
|
}
|
|
191
171
|
|
|
192
|
-
toJSON() {
|
|
193
|
-
let labels = this.getLabels(),
|
|
194
|
-
deduction = this.getDeduction(),
|
|
195
|
-
suppositions = this.getSuppositions();
|
|
196
|
-
|
|
197
|
-
const labelsJSON = labelsToLabelsJSON(labels),
|
|
198
|
-
deductionJSON = deductionToDeductionJSON(deduction),
|
|
199
|
-
suppositionsJSON = suppositionsToSuppositionsJSON(suppositions);
|
|
200
|
-
|
|
201
|
-
labels = labelsJSON; ///
|
|
202
|
-
deduction = deductionJSON; ///
|
|
203
|
-
suppositions = suppositionsJSON; ///
|
|
204
|
-
|
|
205
|
-
const satisfiable = this.satisfiable,
|
|
206
|
-
json = {
|
|
207
|
-
labels,
|
|
208
|
-
deduction,
|
|
209
|
-
suppositions,
|
|
210
|
-
satisfiable
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
return json;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
172
|
static name = "Axiom";
|
|
217
173
|
|
|
218
|
-
static fromJSON(json, fileContext) {
|
|
219
|
-
const labels = labelsFromJSON(json, fileContext),
|
|
220
|
-
suppositions = suppositionsFromJSON(json, fileContext),
|
|
221
|
-
deduction = deductionFromJSON(json, fileContext),
|
|
222
|
-
proof = null,
|
|
223
|
-
satisfiable = satisfiableFromJSON(json, fileContext),
|
|
224
|
-
string = stringFromLabelsAndDeduction(labels, deduction),
|
|
225
|
-
topLevelAssertion = new Axiom(fileContext, string, labels, suppositions, deduction, proof, satisfiable);
|
|
226
|
-
|
|
227
|
-
return topLevelAssertion;
|
|
228
|
-
}
|
|
174
|
+
static fromJSON(json, fileContext) { return TopLevelAssertion.fromJSON(Axiom, json, fileContext); }
|
|
229
175
|
|
|
230
176
|
static fromAxiomNode(axiomNode, fileContext) {
|
|
231
177
|
const node = axiomNode, ///
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
satisfiable = satisfiableFromNode(node, fileContext),
|
|
236
|
-
suppositions = suppositionsFromNode(node, fileContext),
|
|
237
|
-
string = stringFromLabelsAndDeduction(labels, deduction),
|
|
238
|
-
topLevelAssertion = new Axiom(fileContext, string, labels, suppositions, deduction, proof, satisfiable);
|
|
239
|
-
|
|
240
|
-
return topLevelAssertion;
|
|
178
|
+
axiom = TopLevelAssertion.fromNode(Axiom, node, fileContext);
|
|
179
|
+
|
|
180
|
+
return axiom;
|
|
241
181
|
}
|
|
242
182
|
});
|
|
243
|
-
|
|
244
|
-
export function satisfiableFromNode(node, fileContext) {
|
|
245
|
-
const firstPrimaryKeywordTerminalNode = firstPrimaryKeywordTerminalNodeQuery(node),
|
|
246
|
-
content = firstPrimaryKeywordTerminalNode.getContent(),
|
|
247
|
-
contentSatisfiable = (content === SATISFIABLE),
|
|
248
|
-
satisfiable = contentSatisfiable; ///
|
|
249
|
-
|
|
250
|
-
return satisfiable;
|
|
251
|
-
}
|
|
252
|
-
|
package/src/dom/conjecture.js
CHANGED
|
@@ -31,5 +31,10 @@ 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 fromConjectureNode(conjectureNode, fileContext) {
|
|
35
|
+
const node = conjectureNode, ///
|
|
36
|
+
conjecture = TopLevelAssertion.fromNode(Conjecture, node, fileContext);
|
|
37
|
+
|
|
38
|
+
return conjecture;
|
|
39
|
+
}
|
|
35
40
|
});
|
|
@@ -4,11 +4,8 @@ import dom from "../../dom";
|
|
|
4
4
|
import Constructor from "../constructor";
|
|
5
5
|
import constructorBracketedContext from "../../context/bracketed/constructor";
|
|
6
6
|
|
|
7
|
-
import { nodeQuery } from "../../utilities/query";
|
|
8
7
|
import { domAssigned } from "../../dom";
|
|
9
8
|
|
|
10
|
-
const termNodeQuery = nodeQuery("/term/argument/term");
|
|
11
|
-
|
|
12
9
|
export default domAssigned(class BracketedConstructor extends Constructor {
|
|
13
10
|
unifyTerm(term, context, verifyAhead) {
|
|
14
11
|
let termUnified;
|
|
@@ -23,11 +20,13 @@ export default domAssigned(class BracketedConstructor extends Constructor {
|
|
|
23
20
|
const { Term } = dom,
|
|
24
21
|
bracketedTerm = term, ///
|
|
25
22
|
bracketedTermNode = bracketedTerm.getNode(),
|
|
26
|
-
|
|
23
|
+
singularTermNode = bracketedTermNode.getSingularTermNode();
|
|
24
|
+
|
|
25
|
+
if (singularTermNode !== null) {
|
|
26
|
+
const termNode = singularTermNode; ///
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
term = Term.fromTermNode(termNode, context);
|
|
29
29
|
|
|
30
|
-
if (term !== null) {
|
|
31
30
|
const termVVerified = term.verify(context, () => {
|
|
32
31
|
let verifiedAhead;
|
|
33
32
|
|
|
@@ -60,8 +59,7 @@ export default domAssigned(class BracketedConstructor extends Constructor {
|
|
|
60
59
|
context = constructorBracketedContext, ///
|
|
61
60
|
term = Term.fromTermNode(termNode, context),
|
|
62
61
|
string = term.getString(),
|
|
63
|
-
|
|
64
|
-
bracketedConstructor = new BracketedConstructor(string, term, provisional);
|
|
62
|
+
bracketedConstructor = new BracketedConstructor(string, term);
|
|
65
63
|
|
|
66
64
|
return bracketedConstructor;
|
|
67
65
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import dom from "../../dom";
|
|
4
4
|
|
|
5
5
|
import { domAssigned } from "../../dom";
|
|
6
|
-
import {
|
|
6
|
+
import { stringFromTypeNameNameAndSuperTypes } from "../../utilities/type";
|
|
7
7
|
|
|
8
8
|
export default domAssigned(class ComplexTypeDeclaration {
|
|
9
9
|
constructor(fileContext, string, type) {
|
|
@@ -145,11 +145,11 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
145
145
|
|
|
146
146
|
this.fileContext.trace(`Verifying the '${propertyString}' property...`);
|
|
147
147
|
|
|
148
|
-
const
|
|
148
|
+
const propertyName = property.getName(),
|
|
149
149
|
count = properties.reduce((count, property) => {
|
|
150
|
-
const
|
|
150
|
+
const propertyNameMatches = property.matchPropertyName(propertyName);
|
|
151
151
|
|
|
152
|
-
if (
|
|
152
|
+
if (propertyNameMatches) {
|
|
153
153
|
count++;
|
|
154
154
|
}
|
|
155
155
|
|
|
@@ -259,9 +259,10 @@ export default domAssigned(class ComplexTypeDeclaration {
|
|
|
259
259
|
|
|
260
260
|
static fromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext) {
|
|
261
261
|
const { Type } = dom,
|
|
262
|
-
node = complexTypeDeclarationNode, ///
|
|
263
|
-
string = fileContext.nodeAsString(node),
|
|
264
262
|
type = Type.fromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext),
|
|
263
|
+
typeName = type.getName(),
|
|
264
|
+
superTypes = type.getSuperTypes(),
|
|
265
|
+
string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes),
|
|
265
266
|
complexTypeDeclaration = new ComplexTypeDeclaration(fileContext, string, type);
|
|
266
267
|
|
|
267
268
|
return complexTypeDeclaration;
|
|
@@ -2,12 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import dom from "../../dom";
|
|
4
4
|
|
|
5
|
-
import { nodeQuery } from "../../utilities/query";
|
|
6
5
|
import { domAssigned } from "../../dom";
|
|
7
6
|
|
|
8
|
-
const termNodeQuery = nodeQuery("/metavariable/argument/term"),
|
|
9
|
-
metaTypeNodeQuery = nodeQuery("/metavariableDeclaration/metaType");
|
|
10
|
-
|
|
11
7
|
export default domAssigned(class MetavariableDeclaration {
|
|
12
8
|
constructor(fileContext, string, metavariable) {
|
|
13
9
|
this.fileContext = fileContext;
|
|
@@ -84,7 +80,7 @@ export default domAssigned(class MetavariableDeclaration {
|
|
|
84
80
|
this.fileContext.trace(`Verifying the '${metavariableString}' metavariable when declared...`);
|
|
85
81
|
|
|
86
82
|
const metavariableNode = metavariable.getNode(), ///
|
|
87
|
-
termNode =
|
|
83
|
+
termNode = metavariableNode.getTermNode();
|
|
88
84
|
|
|
89
85
|
if (termNode !== null) {
|
|
90
86
|
this.fileContext.debug(`A term was found in the '${metavariableString}' metavariable when a type should have been present.`);
|
|
@@ -140,7 +136,7 @@ function stringFromMetavariableAndMetaType(metavariable, metaType) {
|
|
|
140
136
|
|
|
141
137
|
function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
|
|
142
138
|
const { MetaType } = dom,
|
|
143
|
-
metaTypeNode =
|
|
139
|
+
metaTypeNode = metavariableDeclarationNode.getMetaTypeNode(),
|
|
144
140
|
metaType = MetaType.fromMetaTypeNode(metaTypeNode, fileContext);
|
|
145
141
|
|
|
146
142
|
return metaType;
|
|
@@ -4,6 +4,7 @@ import dom from "../../dom";
|
|
|
4
4
|
|
|
5
5
|
import { domAssigned } from "../../dom";
|
|
6
6
|
import { superTypesStringFromSuperTypes } from "../../utilities/type";
|
|
7
|
+
import { stringFromTypeNameNameAndSuperTypes } from "../../utilities/type";
|
|
7
8
|
|
|
8
9
|
export default domAssigned(class TypeDeclaration {
|
|
9
10
|
constructor(fileContext, string, type) {
|
|
@@ -139,8 +140,9 @@ export default domAssigned(class TypeDeclaration {
|
|
|
139
140
|
static fromTypeDeclarationNode(typeDeclarationNode, fileContext) {
|
|
140
141
|
const { Type } = dom,
|
|
141
142
|
type = Type.fromTypeDeclarationNode(typeDeclarationNode, fileContext),
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
typeName = type.getName(),
|
|
144
|
+
superTypes = type.getSuperTypes(),
|
|
145
|
+
string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes),
|
|
144
146
|
typeDeclaration = new TypeDeclaration(fileContext, string, type);
|
|
145
147
|
|
|
146
148
|
return typeDeclaration;
|
package/src/dom/declaration.js
CHANGED
|
@@ -3,12 +3,9 @@
|
|
|
3
3
|
import dom from "../dom";
|
|
4
4
|
import Substitutions from "../substitutions";
|
|
5
5
|
|
|
6
|
-
import { nodeQuery } from "../utilities/query";
|
|
7
6
|
import { domAssigned } from "../dom";
|
|
8
7
|
import { unifyStatementIntrinsically } from "../utilities/unification";
|
|
9
8
|
|
|
10
|
-
const judgementDeclarationNodeQuery = nodeQuery("/judgement/declaration");
|
|
11
|
-
|
|
12
9
|
export default domAssigned(class Declaration {
|
|
13
10
|
constructor(string, reference, statement) {
|
|
14
11
|
this.string = string;
|
|
@@ -255,8 +252,7 @@ export default domAssigned(class Declaration {
|
|
|
255
252
|
static name = "Declaration";
|
|
256
253
|
|
|
257
254
|
static fromJudgementNode(judgementNode, context) {
|
|
258
|
-
const
|
|
259
|
-
declarationNode = judgementDeclarationNode, ///
|
|
255
|
+
const declarationNode = judgementNode.getDeclarationNode(),
|
|
260
256
|
declaration = declarationFromDeclarationNode(declarationNode, context);
|
|
261
257
|
|
|
262
258
|
return declaration;
|
package/src/dom/derivation.js
CHANGED
|
@@ -4,14 +4,11 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import dom from "../dom";
|
|
6
6
|
|
|
7
|
-
import { nodesQuery } from "../utilities/query";
|
|
8
7
|
import { domAssigned } from "../dom";
|
|
9
8
|
import { assignAssignments } from "../utilities/assignments";
|
|
10
9
|
|
|
11
10
|
const { last } = arrayUtilities;
|
|
12
11
|
|
|
13
|
-
const stepOrSubproofNodesQuery = nodesQuery("/derivation/step|subproof");
|
|
14
|
-
|
|
15
12
|
export default domAssigned(class Derivation {
|
|
16
13
|
constructor(stepsOrSubproofs) {
|
|
17
14
|
this.stepsOrSubproofs = stepsOrSubproofs;
|
|
@@ -65,7 +62,7 @@ export default domAssigned(class Derivation {
|
|
|
65
62
|
|
|
66
63
|
function stepsOrSubproofsFromDerivationNode(derivationNode, fileContext) {
|
|
67
64
|
const { Step, Subproof } = dom,
|
|
68
|
-
stepOrSubproofNodes =
|
|
65
|
+
stepOrSubproofNodes = derivationNode.getStepOrSubproofNodes(),
|
|
69
66
|
stepsOrSubproofs = stepOrSubproofNodes.map((stepOrSubproofNode) => {
|
|
70
67
|
let stepOrSubproof;
|
|
71
68
|
|
package/src/dom/equality.js
CHANGED
|
@@ -4,15 +4,9 @@ import dom from "../dom";
|
|
|
4
4
|
import EqualityAssignment from "../assignment/equality";
|
|
5
5
|
import VariableAssignment from "../assignment/variable";
|
|
6
6
|
|
|
7
|
-
import { nodeQuery } from "../utilities/query";
|
|
8
7
|
import { domAssigned } from "../dom";
|
|
9
8
|
import { unifyEquality } from "../utilities/unification";
|
|
10
9
|
|
|
11
|
-
const equalityNodeQuery = nodeQuery("/statement/equality"),
|
|
12
|
-
variableNodeQuery = nodeQuery("/term/variable!"),
|
|
13
|
-
leftTermNodeQuery = nodeQuery("/equality/term[0]"),
|
|
14
|
-
rightTermNodeQuery = nodeQuery("/equality/term[1]");
|
|
15
|
-
|
|
16
10
|
export default domAssigned(class Equality {
|
|
17
11
|
constructor(string, leftTerm, rightTerm) {
|
|
18
12
|
this.string = string;
|
|
@@ -179,23 +173,25 @@ export default domAssigned(class Equality {
|
|
|
179
173
|
type = this.getType(),
|
|
180
174
|
leftTermNode = this.leftTerm.getNode(),
|
|
181
175
|
rightTermNode = this.rightTerm.getNode(),
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
176
|
+
leftTermNodeSingularVariableNode = leftTermNode.getSingularVariableNode(),
|
|
177
|
+
rightTermNodeSingularVariableNode = rightTermNode.getSingularVariableNode(),
|
|
178
|
+
leftVariableNode = leftTermNodeSingularVariableNode, ///
|
|
179
|
+
rightVariableNode = rightTermNodeSingularVariableNode; ///
|
|
186
180
|
|
|
187
181
|
let assignment;
|
|
188
182
|
|
|
189
|
-
if (
|
|
190
|
-
const
|
|
183
|
+
if (leftVariableNode !== null) {
|
|
184
|
+
const leftVariable = Variable.fromVariableNodeAndType(leftVariableNode, type, context),
|
|
185
|
+
leftVariableAssignment = VariableAssignment.fromVariable(leftVariable);
|
|
191
186
|
|
|
192
187
|
assignment = leftVariableAssignment; ///
|
|
193
188
|
|
|
194
189
|
assignments.push(assignment);
|
|
195
190
|
}
|
|
196
191
|
|
|
197
|
-
if (
|
|
198
|
-
const
|
|
192
|
+
if (rightVariableNode !== null) {
|
|
193
|
+
const rightVariable = Variable.fromVariableNodeAndType(rightVariableNode, type, context),
|
|
194
|
+
rightVariableAssignment = VariableAssignment.fromVariable(rightVariable);
|
|
199
195
|
|
|
200
196
|
assignment = rightVariableAssignment; ///
|
|
201
197
|
|
|
@@ -215,7 +211,7 @@ export default domAssigned(class Equality {
|
|
|
215
211
|
static fromStatementNode(statementNode, context) {
|
|
216
212
|
let equality = null;
|
|
217
213
|
|
|
218
|
-
const equalityNode =
|
|
214
|
+
const equalityNode = statementNode.getEqualityNode();
|
|
219
215
|
|
|
220
216
|
if (equalityNode !== null) {
|
|
221
217
|
const node = equalityNode, ///
|
|
@@ -232,7 +228,7 @@ export default domAssigned(class Equality {
|
|
|
232
228
|
|
|
233
229
|
function leftTermFromEqualityNode(equalityNode, context) {
|
|
234
230
|
const { Term } = dom,
|
|
235
|
-
leftTermNode =
|
|
231
|
+
leftTermNode = equalityNode.getLeftTermNode(),
|
|
236
232
|
leftTerm = Term.fromTermNode(leftTermNode, context);
|
|
237
233
|
|
|
238
234
|
return leftTerm;
|
|
@@ -240,7 +236,7 @@ function leftTermFromEqualityNode(equalityNode, context) {
|
|
|
240
236
|
|
|
241
237
|
function rightTermFromEqualityNode(equalityNode, context) {
|
|
242
238
|
const { Term } = dom,
|
|
243
|
-
rightTermNode =
|
|
239
|
+
rightTermNode = equalityNode.getRightTermNode(),
|
|
244
240
|
rightTerm = Term.fromTermNode(rightTermNode, context);
|
|
245
241
|
|
|
246
242
|
return rightTerm;
|
package/src/dom/frame.js
CHANGED
|
@@ -7,13 +7,6 @@ import dom from "../dom";
|
|
|
7
7
|
import { S, NOTHING } from "../constants";
|
|
8
8
|
import { domAssigned } from "../dom";
|
|
9
9
|
import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
|
|
10
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
11
|
-
|
|
12
|
-
const declarationNodesQuery = nodesQuery("/frame/declaration"),
|
|
13
|
-
metavariableNodesQuery = nodesQuery("/frame/metavariable"),
|
|
14
|
-
judgementFrameNodeQuery = nodeQuery("/judgement/frame"),
|
|
15
|
-
definedAssertionFrameNodeQuery = nodeQuery("/definedAssertion/frame"),
|
|
16
|
-
containedAssertionFrameNodeQuery = nodeQuery("/containedAssertion/frame");
|
|
17
10
|
|
|
18
11
|
const { first } = arrayUtilities;
|
|
19
12
|
|
|
@@ -308,8 +301,7 @@ export default domAssigned(class Frame {
|
|
|
308
301
|
}
|
|
309
302
|
|
|
310
303
|
static fromJudgementNode(judgementNode, context) {
|
|
311
|
-
const
|
|
312
|
-
frameNode = judgementFrameNode,
|
|
304
|
+
const frameNode = judgementNode.getFrameNode(),
|
|
313
305
|
frame = frameFromFrameNode(frameNode, context);
|
|
314
306
|
|
|
315
307
|
return frame;
|
|
@@ -318,11 +310,9 @@ export default domAssigned(class Frame {
|
|
|
318
310
|
static fromDefinedAssertionNode(definedAssertionNode, context) {
|
|
319
311
|
let frame = null;
|
|
320
312
|
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
if (definedAssertionFrameNode !== null) {
|
|
324
|
-
const frameNode = definedAssertionFrameNode; ///
|
|
313
|
+
const frameNode = definedAssertionNode.getFrameNode();
|
|
325
314
|
|
|
315
|
+
if (frameNode !== null) {
|
|
326
316
|
frame = frameFromFrameNode(frameNode, context);
|
|
327
317
|
}
|
|
328
318
|
|
|
@@ -332,11 +322,9 @@ export default domAssigned(class Frame {
|
|
|
332
322
|
static fromContainedAssertionNode(containedAssertionNode, context) {
|
|
333
323
|
let frame = null;
|
|
334
324
|
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
if (containedAssertionFrameNode !== null) {
|
|
338
|
-
const frameNode = containedAssertionFrameNode; ///
|
|
325
|
+
const frameNode = containedAssertionNode.getFrameNode();
|
|
339
326
|
|
|
327
|
+
if (frameNode !== null) {
|
|
340
328
|
frame = frameFromFrameNode(frameNode, context)
|
|
341
329
|
}
|
|
342
330
|
|
|
@@ -358,7 +346,7 @@ function frameFromFrameNode(frameNode, context) {
|
|
|
358
346
|
|
|
359
347
|
function declarationsFromFrameNode(frameNode, context) {
|
|
360
348
|
const { Declaration } = dom,
|
|
361
|
-
declarationNodes =
|
|
349
|
+
declarationNodes = frameNode.getDeclarationNodes(),
|
|
362
350
|
declarations = declarationNodes.map((declarationNode) => {
|
|
363
351
|
const declaration = Declaration.fromDeclarationNode(declarationNode, context);
|
|
364
352
|
|
|
@@ -370,7 +358,7 @@ function declarationsFromFrameNode(frameNode, context) {
|
|
|
370
358
|
|
|
371
359
|
function metavariablesFromFrameNode(frameNode, context) {
|
|
372
360
|
const { Metavariable } = dom,
|
|
373
|
-
metavariableNodes =
|
|
361
|
+
metavariableNodes = frameNode.getMetavariableNodes(),
|
|
374
362
|
metavariables = metavariableNodes.map((metavariableNode) => {
|
|
375
363
|
const metavariable = Metavariable.fromMetavariableNode(metavariableNode, context);
|
|
376
364
|
|
package/src/dom/judgement.js
CHANGED
|
@@ -3,11 +3,8 @@
|
|
|
3
3
|
import dom from "../dom";
|
|
4
4
|
import JudgementAssignment from "../assignment/judgement";
|
|
5
5
|
|
|
6
|
-
import { nodeQuery } from "../utilities/query";
|
|
7
6
|
import { domAssigned } from "../dom";
|
|
8
7
|
|
|
9
|
-
const judgementNodeQuery = nodeQuery("/statement/judgement");
|
|
10
|
-
|
|
11
8
|
export default domAssigned(class Judgement {
|
|
12
9
|
constructor(string, frame, declaration) {
|
|
13
10
|
this.string = string;
|
|
@@ -158,7 +155,7 @@ export default domAssigned(class Judgement {
|
|
|
158
155
|
static fromStatementNode(statementNode, context) {
|
|
159
156
|
let judgement = null;
|
|
160
157
|
|
|
161
|
-
const judgementNode =
|
|
158
|
+
const judgementNode = statementNode.getJudgementNode();
|
|
162
159
|
|
|
163
160
|
if (judgementNode !== null) {
|
|
164
161
|
const { Frame, Declaration} = dom,
|
package/src/dom/lemma.js
CHANGED
|
@@ -33,5 +33,10 @@ export default domAssigned(class Lemma extends TopLevelAssertion {
|
|
|
33
33
|
|
|
34
34
|
static name = "Lemma";
|
|
35
35
|
|
|
36
|
-
static
|
|
36
|
+
static fromLemmaNode(lemmaNode, fileContext) {
|
|
37
|
+
const node = lemmaNode, ///
|
|
38
|
+
lemma = TopLevelAssertion.fromNode(Lemma, node, fileContext);
|
|
39
|
+
|
|
40
|
+
return lemma;
|
|
41
|
+
}
|
|
37
42
|
});
|
package/src/dom/metaLemma.js
CHANGED
|
@@ -31,5 +31,10 @@ 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 fromMetaLemmaNode(metaLemmaNode, fileContext) {
|
|
35
|
+
const node = metaLemmaNode, ///
|
|
36
|
+
metaLemma = TopLevelMetaAssertion.fromNode(MetaLemma, node, fileContext);
|
|
37
|
+
|
|
38
|
+
return metaLemma;
|
|
39
|
+
}
|
|
35
40
|
});
|
package/src/dom/metaType.js
CHANGED
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import LocalContext from "../context/local";
|
|
4
4
|
|
|
5
|
-
import { nodeQuery } from "../utilities/query";
|
|
6
5
|
import { domAssigned } from "../dom";
|
|
7
6
|
import { FRAME_META_TYPE_NAME, REFERENCE_META_TYPE_NAME, STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
8
7
|
|
|
9
|
-
const metavariableDeclarationMetaTypeNodeQuery = nodeQuery("/metavariableDeclaration/metaType");
|
|
10
|
-
|
|
11
8
|
class MetaType {
|
|
12
9
|
constructor(name) {
|
|
13
10
|
this.name = name;
|
|
@@ -61,8 +58,7 @@ class MetaType {
|
|
|
61
58
|
}
|
|
62
59
|
|
|
63
60
|
static fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
|
|
64
|
-
const
|
|
65
|
-
metaTypeNode = metavariableDeclarationMetaTypeNode, ///
|
|
61
|
+
const metaTypeNode = metavariableDeclarationNode.getMetaTypeNode(),
|
|
66
62
|
localContext = LocalContext.fromFileContext(fileContext),
|
|
67
63
|
context = localContext, ///
|
|
68
64
|
metaType = metaTypeFromMetaTypeNode(metaTypeNode, context);
|
package/src/dom/metatheorem.js
CHANGED
|
@@ -31,5 +31,10 @@ 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 fromMetatheoremNode(metatheoremNode, fileContext) {
|
|
35
|
+
const node = metatheoremNode, ///
|
|
36
|
+
metatheorem = TopLevelMetaAssertion.fromNode(Metatheorem, node, fileContext);
|
|
37
|
+
|
|
38
|
+
return metatheorem;
|
|
39
|
+
}
|
|
35
40
|
});
|