occam-verify-cli 1.0.220 → 1.0.224
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 +19 -19
- package/lib/context/local.js +5 -43
- package/lib/context/release.js +11 -11
- package/lib/dom/assertion/contained.js +44 -44
- package/lib/dom/assertion/defined.js +40 -40
- package/lib/dom/assertion/property.js +37 -35
- package/lib/dom/assertion/satisfies.js +26 -25
- package/lib/dom/assertion/subproof.js +16 -16
- package/lib/dom/assertion/type.js +34 -32
- package/lib/dom/axiom.js +52 -52
- package/lib/dom/combinator/bracketed.js +5 -5
- package/lib/dom/combinator.js +6 -6
- package/lib/dom/conclusion.js +10 -10
- package/lib/dom/conjecture.js +5 -5
- package/lib/dom/constructor/bracketed.js +12 -12
- package/lib/dom/constructor.js +9 -9
- package/lib/dom/declaration/combinator.js +11 -11
- package/lib/dom/declaration/complexType.js +133 -63
- package/lib/dom/declaration/constructor.js +17 -17
- package/lib/dom/declaration/metavariable.js +17 -17
- package/lib/dom/declaration/simpleType.js +229 -0
- package/lib/dom/declaration/variable.js +17 -17
- package/lib/dom/declaration.js +54 -52
- package/lib/dom/deduction.js +15 -15
- package/lib/dom/derivation.js +8 -8
- package/lib/dom/equality.js +49 -34
- package/lib/dom/error.js +3 -3
- package/lib/dom/frame.js +38 -38
- package/lib/dom/judgement.js +31 -29
- package/lib/dom/label.js +5 -5
- package/lib/dom/lemma.js +5 -5
- package/lib/dom/metaLemma.js +5 -5
- package/lib/dom/metatheorem.js +5 -5
- package/lib/dom/metavariable.js +55 -55
- package/lib/dom/premise.js +36 -34
- package/lib/dom/procedureCall.js +9 -9
- package/lib/dom/proof.js +6 -6
- package/lib/dom/propertyRelation.js +18 -18
- package/lib/dom/reference.js +28 -28
- package/lib/dom/rule.js +63 -48
- package/lib/dom/signature.js +17 -17
- package/lib/dom/statement.js +36 -36
- package/lib/dom/step.js +32 -35
- package/lib/dom/subDerivation.js +8 -8
- package/lib/dom/subproof.js +27 -30
- package/lib/dom/substitution/statement.js +7 -7
- package/lib/dom/substitution/term.js +2 -16
- package/lib/dom/substitution.js +1 -15
- package/lib/dom/supposition.js +39 -39
- package/lib/dom/term.js +15 -15
- package/lib/dom/theorem.js +5 -5
- package/lib/dom/topLevelAssertion.js +60 -71
- package/lib/dom/topLevelMetaAssertion.js +28 -20
- package/lib/dom/type.js +18 -24
- package/lib/dom/variable.js +16 -16
- package/lib/equivalence.js +54 -33
- package/lib/equivalences.js +57 -101
- package/lib/index.js +2 -2
- package/lib/mixins/statement/verify.js +52 -52
- package/lib/mixins/step/unify.js +79 -61
- package/lib/mixins/term/verify.js +17 -17
- package/lib/substitutions.js +7 -7
- package/lib/unifier/equantional.js +170 -0
- package/lib/unifier/intrinsicLevel.js +8 -8
- package/lib/unifier/metaLevel.js +21 -21
- package/lib/unifier/metavariable.js +9 -9
- package/lib/unifier/statementWithCombinator.js +18 -18
- package/lib/unifier/termWithConstructor.js +10 -10
- package/lib/unifier.js +41 -41
- package/lib/utilities/brackets.js +2 -2
- package/lib/utilities/release.js +18 -17
- package/lib/utilities/subproof.js +2 -2
- package/lib/utilities/type.js +2 -2
- package/lib/utilities/unification.js +28 -34
- package/lib/verifier/combinator.js +14 -14
- package/lib/verifier/constructor.js +18 -18
- package/lib/verifier/topLevel.js +38 -38
- package/lib/verifier.js +30 -30
- package/package.json +1 -1
- package/src/context/file.js +18 -18
- package/src/context/local.js +5 -48
- package/src/context/release.js +11 -11
- package/src/dom/assertion/contained.js +46 -46
- package/src/dom/assertion/defined.js +41 -41
- package/src/dom/assertion/property.js +37 -35
- package/src/dom/assertion/satisfies.js +26 -25
- package/src/dom/assertion/subproof.js +15 -15
- package/src/dom/assertion/type.js +34 -32
- package/src/dom/axiom.js +56 -54
- package/src/dom/combinator/bracketed.js +4 -4
- package/src/dom/combinator.js +5 -5
- package/src/dom/conclusion.js +9 -9
- package/src/dom/conjecture.js +4 -4
- package/src/dom/constructor/bracketed.js +11 -11
- package/src/dom/constructor.js +8 -8
- package/src/dom/declaration/combinator.js +10 -10
- package/src/dom/declaration/complexType.js +129 -64
- package/src/dom/declaration/constructor.js +16 -16
- package/src/dom/declaration/metavariable.js +16 -16
- package/src/dom/declaration/simpleType.js +179 -0
- package/src/dom/declaration/variable.js +16 -16
- package/src/dom/declaration.js +54 -52
- package/src/dom/deduction.js +14 -14
- package/src/dom/derivation.js +7 -7
- package/src/dom/equality.js +55 -38
- package/src/dom/error.js +2 -2
- package/src/dom/frame.js +38 -38
- package/src/dom/judgement.js +31 -29
- package/src/dom/label.js +4 -4
- package/src/dom/lemma.js +4 -4
- package/src/dom/metaLemma.js +4 -4
- package/src/dom/metatheorem.js +4 -4
- package/src/dom/metavariable.js +54 -54
- package/src/dom/premise.js +35 -33
- package/src/dom/procedureCall.js +8 -8
- package/src/dom/proof.js +5 -5
- package/src/dom/propertyRelation.js +17 -17
- package/src/dom/reference.js +27 -27
- package/src/dom/rule.js +72 -49
- package/src/dom/signature.js +15 -15
- package/src/dom/statement.js +34 -34
- package/src/dom/step.js +42 -48
- package/src/dom/subDerivation.js +7 -7
- package/src/dom/subproof.js +30 -40
- package/src/dom/substitution/statement.js +6 -6
- package/src/dom/substitution/term.js +1 -19
- package/src/dom/substitution.js +0 -13
- package/src/dom/supposition.js +38 -38
- package/src/dom/term.js +14 -14
- package/src/dom/theorem.js +4 -4
- package/src/dom/topLevelAssertion.js +62 -81
- package/src/dom/topLevelMetaAssertion.js +35 -20
- package/src/dom/type.js +23 -33
- package/src/dom/variable.js +16 -15
- package/src/equivalence.js +69 -46
- package/src/equivalences.js +53 -115
- package/src/index.js +1 -1
- package/src/mixins/statement/verify.js +51 -51
- package/src/mixins/step/unify.js +88 -67
- package/src/mixins/term/verify.js +16 -16
- package/src/substitutions.js +5 -6
- package/src/unifier/equantional.js +90 -0
- package/src/unifier/intrinsicLevel.js +7 -7
- package/src/unifier/metaLevel.js +20 -21
- package/src/unifier/metavariable.js +8 -8
- package/src/unifier/statementWithCombinator.js +17 -17
- package/src/unifier/termWithConstructor.js +9 -9
- package/src/unifier.js +40 -40
- package/src/utilities/brackets.js +1 -1
- package/src/utilities/release.js +18 -18
- package/src/utilities/subproof.js +1 -1
- package/src/utilities/type.js +1 -1
- package/src/utilities/unification.js +27 -37
- package/src/verifier/combinator.js +13 -13
- package/src/verifier/constructor.js +17 -17
- package/src/verifier/topLevel.js +41 -41
- package/src/verifier.js +29 -29
- package/lib/dom/declaration/type.js +0 -209
- package/lib/unifier/equality.js +0 -155
- package/src/dom/declaration/type.js +0 -150
- package/src/unifier/equality.js +0 -70
package/src/dom/theorem.js
CHANGED
|
@@ -6,16 +6,16 @@ import { domAssigned } from "../dom";
|
|
|
6
6
|
|
|
7
7
|
export default domAssigned(class Theorem extends TopLevelAssertion {
|
|
8
8
|
verify() {
|
|
9
|
-
let
|
|
9
|
+
let verifies;
|
|
10
10
|
|
|
11
11
|
const fileContext = this.getFileContext(),
|
|
12
12
|
theoremString = this.string; ///
|
|
13
13
|
|
|
14
14
|
fileContext.trace(`Verifying the '${theoremString}' theorem...`);
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
verifies = super.verify();
|
|
17
17
|
|
|
18
|
-
if (
|
|
18
|
+
if (verifies) {
|
|
19
19
|
const theorem = this; ///
|
|
20
20
|
|
|
21
21
|
fileContext.addTheorem(theorem);
|
|
@@ -23,7 +23,7 @@ export default domAssigned(class Theorem extends TopLevelAssertion {
|
|
|
23
23
|
fileContext.debug(`...verified the '${theoremString}' theorem.`);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
return
|
|
26
|
+
return verifies;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
static name = "Theorem";
|
|
@@ -64,13 +64,6 @@ export default class TopLevelAssertion {
|
|
|
64
64
|
return supposition;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
isUnconditional() {
|
|
68
|
-
const suppositionsLength = this.suppositions.length,
|
|
69
|
-
unconditional = (suppositionsLength === 0);
|
|
70
|
-
|
|
71
|
-
return unconditional;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
67
|
matchMetavariableName(metavariableName) {
|
|
75
68
|
const metavariableNameMatches = this.labels.some((label) => {
|
|
76
69
|
const metavariableNameMatches = label.matchMetavariableName(metavariableName);
|
|
@@ -84,150 +77,123 @@ export default class TopLevelAssertion {
|
|
|
84
77
|
}
|
|
85
78
|
|
|
86
79
|
verify() {
|
|
87
|
-
let
|
|
80
|
+
let verifies = false;
|
|
88
81
|
|
|
89
|
-
const
|
|
82
|
+
const labelsVerify = this.verifyLabels();
|
|
90
83
|
|
|
91
|
-
if (
|
|
84
|
+
if (labelsVerify) {
|
|
92
85
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
93
86
|
context = localContext, ///
|
|
94
|
-
|
|
95
|
-
const
|
|
87
|
+
suppositionsVerify = this.suppositions.every((supposition) => {
|
|
88
|
+
const suppositionVerifies = supposition.verify(context);
|
|
96
89
|
|
|
97
|
-
if (
|
|
90
|
+
if (suppositionVerifies) {
|
|
98
91
|
return true;
|
|
99
92
|
}
|
|
100
93
|
});
|
|
101
94
|
|
|
102
|
-
if (
|
|
103
|
-
const
|
|
95
|
+
if (suppositionsVerify) {
|
|
96
|
+
const deductionVerifies = this.deduction.verify(context);
|
|
104
97
|
|
|
105
|
-
if (
|
|
98
|
+
if (deductionVerifies) {
|
|
106
99
|
if (this.proof === null) {
|
|
107
|
-
|
|
100
|
+
verifies = true;
|
|
108
101
|
} else {
|
|
109
102
|
const substitutions = Substitutions.fromNothing(),
|
|
110
|
-
|
|
103
|
+
proofVerifies = this.proof.verify(substitutions, this.deduction, context);
|
|
111
104
|
|
|
112
|
-
|
|
105
|
+
verifies = proofVerifies; ///
|
|
113
106
|
}
|
|
114
107
|
}
|
|
115
108
|
}
|
|
116
109
|
}
|
|
117
110
|
|
|
118
|
-
return
|
|
111
|
+
return verifies;
|
|
119
112
|
}
|
|
120
113
|
|
|
121
114
|
verifyLabels() {
|
|
122
|
-
const
|
|
115
|
+
const labelsVerify = this.labels.every((label) => {
|
|
123
116
|
const nameOnly = true,
|
|
124
|
-
|
|
117
|
+
labelVerifies = label.verify(nameOnly);
|
|
125
118
|
|
|
126
|
-
if (
|
|
119
|
+
if (labelVerifies) {
|
|
127
120
|
return true;
|
|
128
121
|
}
|
|
129
122
|
});
|
|
130
123
|
|
|
131
|
-
return
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
unifyStatement(statement, context) {
|
|
135
|
-
let statementUnified;
|
|
136
|
-
|
|
137
|
-
const statementString = statement.getString(),
|
|
138
|
-
axiomLemmaTheoremConjecture = this, ///
|
|
139
|
-
axiomLemmaTheoremConjectureString = axiomLemmaTheoremConjecture.getString();
|
|
140
|
-
|
|
141
|
-
context.trace(`Unifying the '${statementString}' statement with the '${axiomLemmaTheoremConjectureString}' axiom, lemma, theorem or conjecture...`);
|
|
142
|
-
|
|
143
|
-
const suppositions = this.getSuppositions(),
|
|
144
|
-
suppositionsLength = suppositions.length;
|
|
145
|
-
|
|
146
|
-
if (suppositionsLength === 0) {
|
|
147
|
-
const substitutions = Substitutions.fromNothing(),
|
|
148
|
-
localContext = LocalContext.fromFileContext(this.fileContext),
|
|
149
|
-
generalContext = localContext, ///
|
|
150
|
-
specificContext = context, ///
|
|
151
|
-
statementUnifiedWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, generalContext, specificContext);
|
|
152
|
-
|
|
153
|
-
statementUnified = statementUnifiedWithDeduction; ///
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (statementUnified) {
|
|
157
|
-
context.debug(`...unified the '${statementString}' statement with the '${axiomLemmaTheoremConjectureString}' axiom, lemma, theorem or conjecture.`);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return statementUnified;
|
|
124
|
+
return labelsVerify;
|
|
161
125
|
}
|
|
162
126
|
|
|
163
127
|
unifyStatementWithDeduction(statement, substitutions, generalContext, specificContext) {
|
|
164
|
-
let
|
|
128
|
+
let deductionUnifies;
|
|
165
129
|
|
|
166
|
-
const
|
|
130
|
+
const statementUnifies = this.deduction.unifyStatement(statement, substitutions, generalContext, specificContext); ///
|
|
167
131
|
|
|
168
|
-
|
|
132
|
+
deductionUnifies = statementUnifies; ///
|
|
169
133
|
|
|
170
|
-
return
|
|
134
|
+
return deductionUnifies;
|
|
171
135
|
}
|
|
172
136
|
|
|
173
137
|
unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, substitutions, context) {
|
|
174
|
-
let
|
|
138
|
+
let statementAndStepsOrSubproofsUnify = false;
|
|
175
139
|
|
|
176
140
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
177
141
|
generalContext = localContext, ///
|
|
178
142
|
specificContext = context, ///
|
|
179
|
-
|
|
143
|
+
statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, generalContext, specificContext);
|
|
180
144
|
|
|
181
|
-
if (
|
|
182
|
-
const
|
|
145
|
+
if (statementUnifiesWithDeduction) {
|
|
146
|
+
const stepsOrSubproofsUnifyWithSuppositions = this.unifyStepsOrSubproofsWithSuppositions(stepsOrSubproofs, substitutions, generalContext, specificContext);
|
|
183
147
|
|
|
184
|
-
if (
|
|
148
|
+
if (stepsOrSubproofsUnifyWithSuppositions) {
|
|
185
149
|
const substitutionsResolved = substitutions.areResolved();
|
|
186
150
|
|
|
187
|
-
|
|
151
|
+
if (substitutionsResolved) {
|
|
152
|
+
statementAndStepsOrSubproofsUnify = true;
|
|
153
|
+
}
|
|
188
154
|
}
|
|
189
155
|
}
|
|
190
156
|
|
|
191
|
-
return
|
|
157
|
+
return statementAndStepsOrSubproofsUnify;
|
|
192
158
|
}
|
|
193
159
|
|
|
194
160
|
unifyStepsOrSubproofsWithSupposition(stepsOrSubproofs, supposition, substitutions, generalContext, specificContext) {
|
|
195
|
-
let
|
|
161
|
+
let stepsOrSubproofsUnifyWithSupposition = false;
|
|
196
162
|
|
|
197
163
|
const context = specificContext, ///
|
|
198
|
-
|
|
164
|
+
suppositionUnifiesIndependently = supposition.unifyIndependently(substitutions, context);
|
|
199
165
|
|
|
200
|
-
if (
|
|
201
|
-
|
|
166
|
+
if (suppositionUnifiesIndependently) {
|
|
167
|
+
stepsOrSubproofsUnifyWithSupposition = true;
|
|
202
168
|
} else {
|
|
203
169
|
const stepOrSubproof = extract(stepsOrSubproofs, (stepOrSubproof) => {
|
|
204
|
-
const
|
|
170
|
+
const stepOrSubproofUnifies = supposition.unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext);
|
|
205
171
|
|
|
206
|
-
if (
|
|
172
|
+
if (stepOrSubproofUnifies) {
|
|
207
173
|
return true;
|
|
208
174
|
}
|
|
209
175
|
}) || null;
|
|
210
176
|
|
|
211
177
|
if (stepOrSubproof !== null) {
|
|
212
|
-
|
|
178
|
+
stepsOrSubproofsUnifyWithSupposition = true;
|
|
213
179
|
}
|
|
214
180
|
}
|
|
215
181
|
|
|
216
|
-
return
|
|
182
|
+
return stepsOrSubproofsUnifyWithSupposition;
|
|
217
183
|
}
|
|
218
184
|
|
|
219
185
|
unifyStepsOrSubproofsWithSuppositions(stepsOrSubproofs, substitutions, generalContext, specificContext) {
|
|
220
186
|
stepsOrSubproofs = reverse(stepsOrSubproofs); ///
|
|
221
187
|
|
|
222
|
-
const
|
|
223
|
-
const
|
|
188
|
+
const stepsOrSubproofsUnifyWithSuppositions = backwardsEvery(this.suppositions, (supposition) => {
|
|
189
|
+
const stepsOrSubproofsUnifyWithSupposition = this.unifyStepsOrSubproofsWithSupposition(stepsOrSubproofs, supposition, substitutions, generalContext, specificContext);
|
|
224
190
|
|
|
225
|
-
if (
|
|
191
|
+
if (stepsOrSubproofsUnifyWithSupposition) {
|
|
226
192
|
return true;
|
|
227
193
|
}
|
|
228
194
|
});
|
|
229
195
|
|
|
230
|
-
return
|
|
196
|
+
return stepsOrSubproofsUnifyWithSuppositions;
|
|
231
197
|
}
|
|
232
198
|
|
|
233
199
|
toJSON() {
|
|
@@ -255,7 +221,7 @@ export default class TopLevelAssertion {
|
|
|
255
221
|
suppositions = suppositionsFromJSON(json, fileContext),
|
|
256
222
|
signature = signatureFromJSON(json, fileContext),
|
|
257
223
|
proof = null,
|
|
258
|
-
string =
|
|
224
|
+
string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
259
225
|
topLevelAssertion = new Class(fileContext, string, labels, suppositions, deduction, proof, signature);
|
|
260
226
|
|
|
261
227
|
return topLevelAssertion;
|
|
@@ -273,7 +239,7 @@ export default class TopLevelAssertion {
|
|
|
273
239
|
deduction = deductionFromDeductionNode(deductionNode, fileContext),
|
|
274
240
|
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, fileContext),
|
|
275
241
|
signature = signatureFromSignatureNode(signatureNode, fileContext),
|
|
276
|
-
string =
|
|
242
|
+
string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
277
243
|
topLevelAssertion = new Class(fileContext, string, labels, suppositions, deduction, proof, signature);
|
|
278
244
|
|
|
279
245
|
return topLevelAssertion;
|
|
@@ -342,12 +308,27 @@ export function labelsStringFromLabels(labels) {
|
|
|
342
308
|
return labelsString;
|
|
343
309
|
}
|
|
344
310
|
|
|
345
|
-
export function
|
|
346
|
-
const
|
|
311
|
+
export function suppositionsStringFromSuppositions(suppositions) {
|
|
312
|
+
const suppositionsString = suppositions.reduce((suppositionsString, supposition) => {
|
|
313
|
+
const suppositionString = supposition.getString();
|
|
314
|
+
|
|
315
|
+
suppositionsString = (suppositionsString !== null) ?
|
|
316
|
+
`${suppositionsString}, ${suppositionString}` :
|
|
317
|
+
suppositionString; ///
|
|
318
|
+
|
|
319
|
+
return suppositionsString;
|
|
320
|
+
}, null);
|
|
321
|
+
|
|
322
|
+
return suppositionsString;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export function stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction) {
|
|
326
|
+
const suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
327
|
+
deductionString = deduction.getString(),
|
|
347
328
|
labelsString = labelsStringFromLabels(labels),
|
|
348
329
|
string = (labelsString === null) ?
|
|
349
330
|
deductionString : ///
|
|
350
|
-
`${labelsString} :: ${deductionString}`;
|
|
331
|
+
`${labelsString} :: [${suppositionsString}] ... ${deductionString}`;
|
|
351
332
|
|
|
352
333
|
return string;
|
|
353
334
|
}
|
|
@@ -63,44 +63,44 @@ export default class TopLevelMetaAssertion {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
verify() {
|
|
66
|
-
let
|
|
66
|
+
let verifies = false;
|
|
67
67
|
|
|
68
|
-
const
|
|
68
|
+
const labelVerifies = this.verifyLabel();
|
|
69
69
|
|
|
70
|
-
if (
|
|
70
|
+
if (labelVerifies) {
|
|
71
71
|
const localContext = LocalContext.fromFileContext(this.fileContext),
|
|
72
72
|
context = localContext, ///
|
|
73
|
-
|
|
74
|
-
const
|
|
73
|
+
suppositionsVerify = this.suppositions.every((supposition) => {
|
|
74
|
+
const suppositionVerifies = supposition.verify(context);
|
|
75
75
|
|
|
76
|
-
if (
|
|
76
|
+
if (suppositionVerifies) {
|
|
77
77
|
return true;
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
81
|
+
if (suppositionsVerify) {
|
|
82
|
+
const deductionVerifies = this.deduction.verify(context);
|
|
83
83
|
|
|
84
|
-
if (
|
|
84
|
+
if (deductionVerifies) {
|
|
85
85
|
if (this.proof === null) {
|
|
86
|
-
|
|
86
|
+
verifies = true;
|
|
87
87
|
} else {
|
|
88
|
-
const
|
|
88
|
+
const proofVerifies = this.proof.verify(this.substitutions, this.deduction, context);
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
verifies = proofVerifies; ///
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
return
|
|
96
|
+
return verifies;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
verifyLabel() {
|
|
100
100
|
const nameOnly = false,
|
|
101
|
-
|
|
101
|
+
labelVerifies = this.label.verify(nameOnly);
|
|
102
102
|
|
|
103
|
-
return
|
|
103
|
+
return labelVerifies;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
toJSON() {
|
|
@@ -128,7 +128,7 @@ export default class TopLevelMetaAssertion {
|
|
|
128
128
|
suppositions = suppositionsFromJSON(json, fileContext),
|
|
129
129
|
substitutions = substitutionsFromJSON(json, fileContext),
|
|
130
130
|
proof = null,
|
|
131
|
-
string =
|
|
131
|
+
string = stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
|
|
132
132
|
topLevelMetaAssertion = new Class(fileContext, string, label, suppositions, deduction, proof, substitutions);
|
|
133
133
|
|
|
134
134
|
return topLevelMetaAssertion;
|
|
@@ -145,7 +145,7 @@ export default class TopLevelMetaAssertion {
|
|
|
145
145
|
deduction = deductionFromDeductionNode(deductionNode, fileContext),
|
|
146
146
|
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, fileContext),
|
|
147
147
|
substitutions = Substitutions.fromNothing(),
|
|
148
|
-
string =
|
|
148
|
+
string = stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
|
|
149
149
|
topLevelMetaAssertion = new Class(fileContext, string, label, suppositions, deduction, proof, substitutions);
|
|
150
150
|
|
|
151
151
|
return topLevelMetaAssertion;
|
|
@@ -172,12 +172,27 @@ function labelStringFromLabel(label) {
|
|
|
172
172
|
return labelsString;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
function
|
|
176
|
-
const
|
|
175
|
+
function suppositionsStringFromSuppositions(suppositions) {
|
|
176
|
+
const suppositionsString = suppositions.reduce((suppositionsString, supposition) => {
|
|
177
|
+
const suppositionString = supposition.getString();
|
|
178
|
+
|
|
179
|
+
suppositionsString = (suppositionsString !== null) ?
|
|
180
|
+
`${suppositionsString}, ${suppositionString}` :
|
|
181
|
+
suppositionString; ///
|
|
182
|
+
|
|
183
|
+
return suppositionsString;
|
|
184
|
+
}, null);
|
|
185
|
+
|
|
186
|
+
return suppositionsString;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction) {
|
|
190
|
+
const suppositionsString = suppositionsStringFromSuppositions(suppositions),
|
|
191
|
+
deductionString = deduction.getString(),
|
|
177
192
|
labelString = labelStringFromLabel(label),
|
|
178
193
|
string = (labelString === null) ?
|
|
179
194
|
deductionString : ///
|
|
180
|
-
`${labelString} :: ${deductionString}`;
|
|
195
|
+
`${labelString} :: [${suppositionsString}] ... ${deductionString}`;
|
|
181
196
|
|
|
182
197
|
return string;
|
|
183
198
|
}
|
package/src/dom/type.js
CHANGED
|
@@ -248,21 +248,33 @@ class Type {
|
|
|
248
248
|
return type;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
static
|
|
251
|
+
static fromPropertyDeclarationNode(propertyDeclarationNode, fileContext) {
|
|
252
|
+
const typeNode = propertyDeclarationNode.getTypeNode(),
|
|
253
|
+
type = typeFromTypeNode(typeNode, fileContext);
|
|
254
|
+
|
|
255
|
+
return type;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
static fromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, fileContext) {
|
|
252
259
|
const properties = [],
|
|
253
|
-
provisional =
|
|
254
|
-
typeName =
|
|
260
|
+
provisional = simpleTypeDeclarationNode.isProvisional(),
|
|
261
|
+
typeName = simpleTypeDeclarationNode.getTypeName(),
|
|
255
262
|
name = typeName, ///
|
|
256
|
-
superTypes =
|
|
263
|
+
superTypes = superTypesFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, fileContext),
|
|
257
264
|
string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes),
|
|
258
265
|
type = new Type(string, name, superTypes, properties, provisional);
|
|
259
266
|
|
|
260
267
|
return type;
|
|
261
268
|
}
|
|
262
269
|
|
|
263
|
-
static
|
|
264
|
-
const
|
|
265
|
-
|
|
270
|
+
static fromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext) {
|
|
271
|
+
const provisional = complexTypeDeclarationNode.isProvisional(),
|
|
272
|
+
typeName = complexTypeDeclarationNode.getTypeName(),
|
|
273
|
+
name = typeName,
|
|
274
|
+
superTypes = superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext),
|
|
275
|
+
properties = propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext),
|
|
276
|
+
string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes),
|
|
277
|
+
type = new Type(string, name, superTypes, properties, provisional);
|
|
266
278
|
|
|
267
279
|
return type;
|
|
268
280
|
}
|
|
@@ -284,34 +296,17 @@ class Type {
|
|
|
284
296
|
|
|
285
297
|
return type;
|
|
286
298
|
}
|
|
287
|
-
|
|
288
|
-
static fromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext) {
|
|
289
|
-
const provisional = complexTypeDeclarationNode.isProvisional(),
|
|
290
|
-
typeName = complexTypeDeclarationNode.getTypeName(),
|
|
291
|
-
name = typeName,
|
|
292
|
-
superTypes = superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext),
|
|
293
|
-
properties = propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext),
|
|
294
|
-
string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes),
|
|
295
|
-
type = new Type(string, name, superTypes, properties, provisional);
|
|
296
|
-
|
|
297
|
-
return type;
|
|
298
|
-
}
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
export default domAssigned(Type);
|
|
302
302
|
|
|
303
|
-
function
|
|
304
|
-
const superTypeNodes =
|
|
303
|
+
function superTypesFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, fileContext) {
|
|
304
|
+
const superTypeNodes = simpleTypeDeclarationNode.getSuperTypeNodes(),
|
|
305
305
|
superTypes = superTypeNodes.map((superTypeNode) => {
|
|
306
306
|
const superType = Type.fromTypeNode(superTypeNode, fileContext);
|
|
307
307
|
|
|
308
308
|
return superType;
|
|
309
|
-
})
|
|
310
|
-
superTypesLength = superTypes.length;
|
|
311
|
-
|
|
312
|
-
if (superTypesLength === 0) {
|
|
313
|
-
superTypes.push(objectType);
|
|
314
|
-
}
|
|
309
|
+
});
|
|
315
310
|
|
|
316
311
|
return superTypes;
|
|
317
312
|
}
|
|
@@ -322,12 +317,7 @@ function superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, fi
|
|
|
322
317
|
const superType = Type.fromTypeNode(superTypeNode, fileContext);
|
|
323
318
|
|
|
324
319
|
return superType;
|
|
325
|
-
})
|
|
326
|
-
superTypesLength = superTypes.length;
|
|
327
|
-
|
|
328
|
-
if (superTypesLength === 0) {
|
|
329
|
-
superTypes.push(objectType);
|
|
330
|
-
}
|
|
320
|
+
});
|
|
331
321
|
|
|
332
322
|
return superTypes;
|
|
333
323
|
}
|
package/src/dom/variable.js
CHANGED
|
@@ -62,7 +62,7 @@ export default domAssigned(class Variable {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
verify(context) {
|
|
65
|
-
let
|
|
65
|
+
let verifies;
|
|
66
66
|
|
|
67
67
|
const variableString = this.string; ///
|
|
68
68
|
|
|
@@ -76,20 +76,20 @@ export default domAssigned(class Variable {
|
|
|
76
76
|
|
|
77
77
|
this.type = type;
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
verifies = true;
|
|
80
80
|
} else {
|
|
81
81
|
context.debug(`The '${variableString}' variable is not present.`);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
if (
|
|
84
|
+
if (verifies) {
|
|
85
85
|
context.debug(`...verified the '${variableString}' variable.`);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
return
|
|
88
|
+
return verifies;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
verifyType(fileContext) {
|
|
92
|
-
let
|
|
92
|
+
let typeVerifies = false;
|
|
93
93
|
|
|
94
94
|
const typeString = this.type.getString();
|
|
95
95
|
|
|
@@ -102,18 +102,18 @@ export default domAssigned(class Variable {
|
|
|
102
102
|
} else {
|
|
103
103
|
this.type = type; ///
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
typeVerifies = true;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
if (
|
|
108
|
+
if (typeVerifies) {
|
|
109
109
|
fileContext.debug(`...verified the '${typeString}' type.`);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
return
|
|
112
|
+
return typeVerifies;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
unifyTerm(term, substitutions, generalContext, specificContext) {
|
|
116
|
-
let
|
|
116
|
+
let termUnifies = false;
|
|
117
117
|
|
|
118
118
|
const termString = term.getString(),
|
|
119
119
|
variableString = this.string; ///
|
|
@@ -124,11 +124,12 @@ export default domAssigned(class Variable {
|
|
|
124
124
|
substitutionPresent = substitutions.isSubstitutionPresentByVariable(variable);
|
|
125
125
|
|
|
126
126
|
if (substitutionPresent) {
|
|
127
|
-
const
|
|
128
|
-
|
|
127
|
+
const context = specificContext, ///
|
|
128
|
+
substitution = substitutions.findSubstitutionByVariable(variable),
|
|
129
|
+
substitutionTermEqualToTerm = substitution.isTermEqualTo(term, context);
|
|
129
130
|
|
|
130
131
|
if (substitutionTermEqualToTerm) {
|
|
131
|
-
|
|
132
|
+
termUnifies = true;
|
|
132
133
|
}
|
|
133
134
|
} else {
|
|
134
135
|
const { TermSubstitution } = dom,
|
|
@@ -139,14 +140,14 @@ export default domAssigned(class Variable {
|
|
|
139
140
|
|
|
140
141
|
substitutions.addSubstitution(substitution, specificContext);
|
|
141
142
|
|
|
142
|
-
|
|
143
|
+
termUnifies = true;
|
|
143
144
|
}
|
|
144
145
|
|
|
145
|
-
if (
|
|
146
|
+
if (termUnifies) {
|
|
146
147
|
specificContext.debug(`...unified the '${termString}' term with the '${variableString}' variable.`);
|
|
147
148
|
}
|
|
148
149
|
|
|
149
|
-
return
|
|
150
|
+
return termUnifies;
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
toJSON() {
|