occam-verify-cli 0.0.1075 → 0.0.1077
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/assertion/contained.js +6 -4
- package/lib/assertion/defined.js +2 -2
- package/lib/assertion/subproof.js +46 -30
- package/lib/declaration.js +5 -8
- package/lib/metavariable.js +6 -5
- package/lib/mixins/statement/unify.js +2 -2
- package/lib/mixins/statement/verify.js +16 -46
- package/lib/premise.js +23 -19
- package/lib/proofStep.js +61 -23
- package/lib/rule.js +8 -10
- package/lib/statement/qualified.js +3 -3
- package/lib/substitution/statementForMetavariable.js +23 -13
- package/lib/substitutions.js +23 -3
- package/lib/supposition.js +29 -21
- package/lib/topLevelAssertion.js +11 -5
- package/lib/variable.js +2 -2
- package/lib/verifier/statementAsCombinator.js +4 -11
- package/lib/verifier/termAsConstructor.js +3 -3
- package/package.json +1 -1
- package/src/assertion/contained.js +7 -5
- package/src/assertion/defined.js +2 -2
- package/src/assertion/subproof.js +61 -42
- package/src/declaration.js +5 -8
- package/src/metavariable.js +5 -8
- package/src/mixins/statement/unify.js +2 -2
- package/src/mixins/statement/verify.js +23 -77
- package/src/premise.js +39 -31
- package/src/proofStep.js +89 -28
- package/src/rule.js +8 -13
- package/src/statement/qualified.js +2 -4
- package/src/substitution/statementForMetavariable.js +33 -18
- package/src/substitutions.js +34 -12
- package/src/supposition.js +48 -33
- package/src/topLevelAssertion.js +14 -6
- package/src/variable.js +1 -1
- package/src/verifier/statementAsCombinator.js +3 -17
- package/src/verifier/termAsConstructor.js +2 -2
- package/lib/verifier/metaLevel.js +0 -147
- package/src/verifier/metaLevel.js +0 -54
|
@@ -71,7 +71,7 @@ class QualifiedStatement {
|
|
|
71
71
|
return statementUnified;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
verify(substitutions, localContext) {
|
|
74
|
+
verify(substitutions, assignments, stated, localContext) {
|
|
75
75
|
let verified;
|
|
76
76
|
|
|
77
77
|
const qualifiedStatementString = this.string; ///
|
|
@@ -79,9 +79,7 @@ class QualifiedStatement {
|
|
|
79
79
|
if (this.statement !== null) {
|
|
80
80
|
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement...`);
|
|
81
81
|
|
|
82
|
-
const
|
|
83
|
-
assignments = [],
|
|
84
|
-
statementVerified = this.statement.verify(assignments, stated, localContext);
|
|
82
|
+
const statementVerified = this.statement.verify(assignments, stated, localContext);
|
|
85
83
|
|
|
86
84
|
if (statementVerified) {
|
|
87
85
|
const unified = this.unify(substitutions, localContext);
|
|
@@ -9,14 +9,19 @@ import { stripBracketsFromStatementNode } from "../utilities/brackets";
|
|
|
9
9
|
import { statementFromJSON, statementToStatementJSON, metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
10
10
|
|
|
11
11
|
export default class StatementForMetavariableSubstitution extends Substitution {
|
|
12
|
-
constructor(string, statement, metavariable, substitution) {
|
|
12
|
+
constructor(string, resolved, statement, metavariable, substitution) {
|
|
13
13
|
super(string);
|
|
14
14
|
|
|
15
|
+
this.resolved = resolved;
|
|
15
16
|
this.statement = statement;
|
|
16
17
|
this.metavariable = metavariable;
|
|
17
18
|
this.substitution = substitution;
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
isResolved() {
|
|
22
|
+
return this.resolved;
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
getStatement() {
|
|
21
26
|
return this.statement;
|
|
22
27
|
}
|
|
@@ -42,27 +47,23 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
resolve(substitutions, localContextA, localContextB) {
|
|
45
|
-
let resolved = false;
|
|
46
|
-
|
|
47
50
|
const substitutionString = this.string;
|
|
48
51
|
|
|
49
|
-
localContextB.trace(`Resolving the ${substitutionString} substitution...`);
|
|
50
|
-
|
|
51
52
|
const metavariableNode = this.getMetavariableNode(),
|
|
52
53
|
simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariableNode(metavariableNode);
|
|
53
54
|
|
|
54
55
|
if (simpleSubstitution !== null) {
|
|
56
|
+
localContextB.trace(`Resolving the ${substitutionString} substitution...`);
|
|
57
|
+
|
|
55
58
|
const substitution = simpleSubstitution, ///
|
|
56
59
|
substitutionResolved = substitution.resolveSubstitution(this.substitution, this.statement, substitutions, localContextA, localContextB);
|
|
57
60
|
|
|
58
|
-
resolved = substitutionResolved; ///
|
|
59
|
-
}
|
|
61
|
+
this.resolved = substitutionResolved; ///
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
if (this.resolved) {
|
|
64
|
+
localContextB.debug(`...resolved the ${substitutionString} substitution.`);
|
|
65
|
+
}
|
|
63
66
|
}
|
|
64
|
-
|
|
65
|
-
return resolved;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
resolveSubstitution(substitution, statement, substitutions, localContextA, localContextB) {
|
|
@@ -82,10 +83,21 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
82
83
|
|
|
83
84
|
substitutions.snapshot();
|
|
84
85
|
|
|
85
|
-
const
|
|
86
|
-
|
|
86
|
+
const substitutionNodeA = substitutionA.getSubstitutionNode(), ///
|
|
87
|
+
substitutionNodeB = substitutionB.getSubstitutionNode(), ///
|
|
88
|
+
substitutionStringA = localContextA.nodeAsString(substitutionNodeA),
|
|
89
|
+
substitutionStringB = localContextB.nodeAsString(substitutionNodeB);
|
|
90
|
+
|
|
91
|
+
localContextB.trace(`Unifying the '${substitutionStringB}' substitution with the '${substitutionStringA}' substitution...`);
|
|
92
|
+
|
|
93
|
+
const nodeA = substitutionNodeA, ///
|
|
94
|
+
nodeB = substitutionNodeB, ///
|
|
87
95
|
unifiedAtMetaLevel = metaLevelUnifier.unify(nodeA, nodeB, substitutions, localContextA, localContextB);
|
|
88
96
|
|
|
97
|
+
if (unifiedAtMetaLevel) {
|
|
98
|
+
localContextB.trace(`...unified the '${substitutionStringB}' substitution with the '${substitutionStringA}' substitution.`);
|
|
99
|
+
}
|
|
100
|
+
|
|
89
101
|
unifiedAtMetaLevel ?
|
|
90
102
|
substitutions.continue() :
|
|
91
103
|
substitutions.rollback(localContextB);
|
|
@@ -171,10 +183,11 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
171
183
|
|
|
172
184
|
static fromJSON(json, fileContext) {
|
|
173
185
|
const { string } = json,
|
|
186
|
+
resolved = true,
|
|
174
187
|
statement = statementFromJSON(json, fileContext),
|
|
175
188
|
metavariable = metavariableFromJSON(json, fileContext),
|
|
176
189
|
substitution = null, ///
|
|
177
|
-
statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(string, statement, metavariable, substitution);
|
|
190
|
+
statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(string, resolved, statement, metavariable, substitution);
|
|
178
191
|
|
|
179
192
|
return statementForMetavariableSubstitution;
|
|
180
193
|
}
|
|
@@ -188,9 +201,10 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
188
201
|
|
|
189
202
|
statement = Statement.fromStatementNode(statementNode, localContext);
|
|
190
203
|
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
204
|
+
const string = stringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution, localContext),
|
|
205
|
+
resolved = true,
|
|
206
|
+
substitution = null,
|
|
207
|
+
statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(string, resolved, statement, metavariable, substitution);
|
|
194
208
|
|
|
195
209
|
return statementForMetavariableSubstitution;
|
|
196
210
|
}
|
|
@@ -205,7 +219,8 @@ export default class StatementForMetavariableSubstitution extends Substitution {
|
|
|
205
219
|
statement = Statement.fromStatementNode(statementNode, localContext);
|
|
206
220
|
|
|
207
221
|
const string = stringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution, localContext),
|
|
208
|
-
|
|
222
|
+
resolved = false,
|
|
223
|
+
statementForMetavariableSubstitution = new StatementForMetavariableSubstitution(string, resolved, statement, metavariable, substitution);
|
|
209
224
|
|
|
210
225
|
return statementForMetavariableSubstitution;
|
|
211
226
|
}
|
package/src/substitutions.js
CHANGED
|
@@ -224,24 +224,46 @@ class Substitutions {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
resolve(localContextA, localContextB) {
|
|
227
|
+
const metavariableNodes = this.getMetavariableNodes();
|
|
228
|
+
|
|
229
|
+
metavariableNodes.forEach((metavariableNode) => {
|
|
230
|
+
const complexSubstitutions = this.findComplexSubstitutionsByMetavariableNode(metavariableNode),
|
|
231
|
+
complexSubstitutionsResolved = complexSubstitutions.everySubstitution((complexSubstitution) => {
|
|
232
|
+
let resolved;
|
|
233
|
+
|
|
234
|
+
const substitutions = this,
|
|
235
|
+
substitution = complexSubstitution; ///
|
|
236
|
+
|
|
237
|
+
resolved = substitution.isResolved();
|
|
238
|
+
|
|
239
|
+
if (!resolved) {
|
|
240
|
+
substitution.resolve(substitutions, localContextA, localContextB);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
if (complexSubstitutionsResolved) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
areResolved() {
|
|
227
251
|
const metavariableNodes = this.getMetavariableNodes(),
|
|
228
252
|
resolved = metavariableNodes.every((metavariableNode) => {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (substitutionResolved) {
|
|
236
|
-
return true;
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
if (complexSubstitutionsResolved) {
|
|
253
|
+
const complexSubstitutions = this.findComplexSubstitutionsByMetavariableNode(metavariableNode),
|
|
254
|
+
complexSubstitutionsResolved = complexSubstitutions.everySubstitution((complexSubstitution) => {
|
|
255
|
+
const complexSubstitutionResolved = complexSubstitution.isResolved();
|
|
256
|
+
|
|
257
|
+
if (complexSubstitutionResolved) {
|
|
241
258
|
return true;
|
|
242
259
|
}
|
|
243
260
|
});
|
|
244
261
|
|
|
262
|
+
if (complexSubstitutionsResolved) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
|
|
245
267
|
return resolved;
|
|
246
268
|
}
|
|
247
269
|
|
package/src/supposition.js
CHANGED
|
@@ -59,37 +59,6 @@ class Supposition {
|
|
|
59
59
|
return verified;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
unifySubproof(subproof, substitutions, localContext) {
|
|
63
|
-
let subproofUnified = false;
|
|
64
|
-
|
|
65
|
-
const supposition = this, ///
|
|
66
|
-
subproofString = subproof.getString(),
|
|
67
|
-
suppositionStatement = supposition.getStatement(),
|
|
68
|
-
suppositionStatementString = suppositionStatement.getString();
|
|
69
|
-
|
|
70
|
-
localContext.trace(`Unifying the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement...`);
|
|
71
|
-
|
|
72
|
-
const statement = this.unqualifiedStatement.getStatement(),
|
|
73
|
-
statementNode = statement.getNode(),
|
|
74
|
-
statementTokens = statement.getTokens(),
|
|
75
|
-
context = this.fileContext, ///
|
|
76
|
-
tokens = statementTokens; ///
|
|
77
|
-
|
|
78
|
-
localContext = LocalContext.fromContextAndTokens(context, tokens); ///
|
|
79
|
-
|
|
80
|
-
const subproofAssertion = SubproofAssertion.fromStatementNode(statementNode, localContext);
|
|
81
|
-
|
|
82
|
-
if (subproofAssertion !== null) {
|
|
83
|
-
subproofUnified = subproofAssertion.unifySubproof(subproof, substitutions, this.fileContext, localContext);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (subproofUnified) {
|
|
87
|
-
localContext.debug(`...unified the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement.`);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return subproofUnified;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
62
|
unifyProofStep(proofStep, substitutions, localContext) {
|
|
94
63
|
let proofStepUnified = false;
|
|
95
64
|
|
|
@@ -98,12 +67,27 @@ class Supposition {
|
|
|
98
67
|
|
|
99
68
|
substitutions.snapshot();
|
|
100
69
|
|
|
70
|
+
let subproofUnified = false,
|
|
71
|
+
statementUnified = false;
|
|
72
|
+
|
|
101
73
|
if (false) {
|
|
102
74
|
///
|
|
103
75
|
} else if (subproof !== null) {
|
|
104
|
-
|
|
76
|
+
subproofUnified = this.unifySubproof(subproof, substitutions, localContext);
|
|
105
77
|
} else if (statement !== null) {
|
|
106
|
-
|
|
78
|
+
statementUnified = this.unifyStatement(statement, substitutions, localContext);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (subproofUnified || statementUnified) {
|
|
82
|
+
const localContextB = localContext; ///
|
|
83
|
+
|
|
84
|
+
localContext = LocalContext.fromFileContext(this.fileContext);
|
|
85
|
+
|
|
86
|
+
const localContextA = localContext; ///
|
|
87
|
+
|
|
88
|
+
substitutions.resolve(localContextA, localContextB);
|
|
89
|
+
|
|
90
|
+
proofStepUnified = true;
|
|
107
91
|
}
|
|
108
92
|
|
|
109
93
|
proofStepUnified ?
|
|
@@ -136,6 +120,37 @@ class Supposition {
|
|
|
136
120
|
return statementUnified;
|
|
137
121
|
}
|
|
138
122
|
|
|
123
|
+
unifySubproof(subproof, substitutions, localContext) {
|
|
124
|
+
let subproofUnified = false;
|
|
125
|
+
|
|
126
|
+
const supposition = this, ///
|
|
127
|
+
subproofString = subproof.getString(),
|
|
128
|
+
suppositionStatement = supposition.getStatement(),
|
|
129
|
+
suppositionStatementString = suppositionStatement.getString();
|
|
130
|
+
|
|
131
|
+
localContext.trace(`Unifying the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement...`);
|
|
132
|
+
|
|
133
|
+
const statement = this.unqualifiedStatement.getStatement(),
|
|
134
|
+
statementNode = statement.getNode(),
|
|
135
|
+
statementTokens = statement.getTokens(),
|
|
136
|
+
context = this.fileContext, ///
|
|
137
|
+
tokens = statementTokens; ///
|
|
138
|
+
|
|
139
|
+
localContext = LocalContext.fromContextAndTokens(context, tokens); ///
|
|
140
|
+
|
|
141
|
+
const subproofAssertion = SubproofAssertion.fromStatementNode(statementNode, localContext);
|
|
142
|
+
|
|
143
|
+
if (subproofAssertion !== null) {
|
|
144
|
+
subproofUnified = subproofAssertion.unifySubproof(subproof, substitutions, this.fileContext, localContext);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (subproofUnified) {
|
|
148
|
+
localContext.debug(`...unified the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement.`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return subproofUnified;
|
|
152
|
+
}
|
|
153
|
+
|
|
139
154
|
toJSON() {
|
|
140
155
|
const unqualifiedStatementJSON = unqualifiedStatementToUnqualifiedStatementJSON(this.unqualifiedStatement),
|
|
141
156
|
unqualifiedStatement = unqualifiedStatementJSON, ///
|
package/src/topLevelAssertion.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
import shim from "./shim";
|
|
6
|
+
import LocalContext from "./context/local";
|
|
6
7
|
|
|
7
8
|
import { EMPTY_STRING } from "./constants";
|
|
8
9
|
import { labelsFromJSON,
|
|
@@ -61,15 +62,22 @@ export default class TopLevelAssertion {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
unifyStatement(statement, localContext) {
|
|
64
|
-
let statementUnified
|
|
65
|
+
let statementUnified;
|
|
65
66
|
|
|
66
67
|
const { Substitutions } = shim,
|
|
67
|
-
|
|
68
|
-
substitutions = Substitutions.fromNothing(),
|
|
69
|
-
proofStepsUnified = this.unifyProofSteps(proofSteps, substitutions, localContext);
|
|
68
|
+
substitutions = Substitutions.fromNothing();
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
statementUnified = this.consequent.unifyStatement(statement, substitutions, localContext);
|
|
71
|
+
|
|
72
|
+
if (statementUnified) {
|
|
73
|
+
const proofSteps = localContext.getProofSteps(),
|
|
74
|
+
proofStepsUnified = this.unifyProofSteps(proofSteps, substitutions, localContext);
|
|
75
|
+
|
|
76
|
+
if (proofStepsUnified) {
|
|
77
|
+
const substitutionsResolved = substitutions.areResolved();
|
|
78
|
+
|
|
79
|
+
statementUnified = substitutionsResolved; ///
|
|
80
|
+
}
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
return statementUnified;
|
package/src/variable.js
CHANGED
|
@@ -164,7 +164,7 @@ class Variable {
|
|
|
164
164
|
variable = variableFromVariableNode(variableNode, localContext),
|
|
165
165
|
termVariable = termVariableFromTermNode(termNode, localContext);
|
|
166
166
|
|
|
167
|
-
if (variable === termVariable) {
|
|
167
|
+
if ((variable !== null) && (variable === termVariable)) {
|
|
168
168
|
termUnified = true;
|
|
169
169
|
} else {
|
|
170
170
|
const variable = this, ///
|
|
@@ -8,8 +8,7 @@ import { nodeQuery } from "../utilities/query";
|
|
|
8
8
|
import { typeNameFromTypeNode } from "../utilities/name";
|
|
9
9
|
|
|
10
10
|
const termNodeQuery = nodeQuery("/term"),
|
|
11
|
-
typeNodeQuery = nodeQuery("/type")
|
|
12
|
-
statementNodeQuery = nodeQuery("/statement");
|
|
11
|
+
typeNodeQuery = nodeQuery("/type");
|
|
13
12
|
|
|
14
13
|
class StatementAsCombinatorVerifier extends Verifier {
|
|
15
14
|
verifyStatement(statementNode, fileContext) {
|
|
@@ -25,19 +24,6 @@ class StatementAsCombinatorVerifier extends Verifier {
|
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
static maps = [
|
|
28
|
-
{
|
|
29
|
-
nodeQuery: statementNodeQuery,
|
|
30
|
-
verify: (statementNode, fileContext) => {
|
|
31
|
-
const { Statement } = shim,
|
|
32
|
-
statement = Statement.fromStatementNode(statementNode, fileContext),
|
|
33
|
-
stated = false,
|
|
34
|
-
assignments = null,
|
|
35
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
36
|
-
statementVerified = statement.verify(statementNode, assignments, stated, localContext);
|
|
37
|
-
|
|
38
|
-
return statementVerified;
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
27
|
{
|
|
42
28
|
nodeQuery: termNodeQuery,
|
|
43
29
|
verify: (termNode, fileContext) => {
|
|
@@ -59,9 +45,9 @@ class StatementAsCombinatorVerifier extends Verifier {
|
|
|
59
45
|
let typeVerified = false;
|
|
60
46
|
|
|
61
47
|
const typeName = typeNameFromTypeNode(typeNode),
|
|
62
|
-
|
|
48
|
+
typePresent = fileContext.isTypePresentByTypeName(typeName);
|
|
63
49
|
|
|
64
|
-
if (
|
|
50
|
+
if (typePresent) {
|
|
65
51
|
typeVerified = true;
|
|
66
52
|
}
|
|
67
53
|
|
|
@@ -45,9 +45,9 @@ class TermAsConstructorVerifier extends Verifier {
|
|
|
45
45
|
let typeVerified = false;
|
|
46
46
|
|
|
47
47
|
const typeName = typeNameFromTypeNode(typeNode),
|
|
48
|
-
|
|
48
|
+
typePresent = fileContext.isTypePresentByTypeName(typeName);
|
|
49
49
|
|
|
50
|
-
if (
|
|
50
|
+
if (typePresent) {
|
|
51
51
|
const verifiedAhead = verifyAhead();
|
|
52
52
|
|
|
53
53
|
if (verifiedAhead) {
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _shim = /*#__PURE__*/ _interop_require_default(require("../shim"));
|
|
12
|
-
var _verifier = /*#__PURE__*/ _interop_require_default(require("../verifier"));
|
|
13
|
-
var _query = require("../utilities/query");
|
|
14
|
-
function _assert_this_initialized(self) {
|
|
15
|
-
if (self === void 0) {
|
|
16
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
17
|
-
}
|
|
18
|
-
return self;
|
|
19
|
-
}
|
|
20
|
-
function _call_super(_this, derived, args) {
|
|
21
|
-
derived = _get_prototype_of(derived);
|
|
22
|
-
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
23
|
-
}
|
|
24
|
-
function _class_call_check(instance, Constructor) {
|
|
25
|
-
if (!(instance instanceof Constructor)) {
|
|
26
|
-
throw new TypeError("Cannot call a class as a function");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
function _defineProperties(target, props) {
|
|
30
|
-
for(var i = 0; i < props.length; i++){
|
|
31
|
-
var descriptor = props[i];
|
|
32
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
33
|
-
descriptor.configurable = true;
|
|
34
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
35
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
39
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
40
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
41
|
-
return Constructor;
|
|
42
|
-
}
|
|
43
|
-
function _define_property(obj, key, value) {
|
|
44
|
-
if (key in obj) {
|
|
45
|
-
Object.defineProperty(obj, key, {
|
|
46
|
-
value: value,
|
|
47
|
-
enumerable: true,
|
|
48
|
-
configurable: true,
|
|
49
|
-
writable: true
|
|
50
|
-
});
|
|
51
|
-
} else {
|
|
52
|
-
obj[key] = value;
|
|
53
|
-
}
|
|
54
|
-
return obj;
|
|
55
|
-
}
|
|
56
|
-
function _get_prototype_of(o) {
|
|
57
|
-
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
58
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
59
|
-
};
|
|
60
|
-
return _get_prototype_of(o);
|
|
61
|
-
}
|
|
62
|
-
function _inherits(subClass, superClass) {
|
|
63
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
64
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
65
|
-
}
|
|
66
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
67
|
-
constructor: {
|
|
68
|
-
value: subClass,
|
|
69
|
-
writable: true,
|
|
70
|
-
configurable: true
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
74
|
-
}
|
|
75
|
-
function _interop_require_default(obj) {
|
|
76
|
-
return obj && obj.__esModule ? obj : {
|
|
77
|
-
default: obj
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function _possible_constructor_return(self, call) {
|
|
81
|
-
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
82
|
-
return call;
|
|
83
|
-
}
|
|
84
|
-
return _assert_this_initialized(self);
|
|
85
|
-
}
|
|
86
|
-
function _set_prototype_of(o, p) {
|
|
87
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
88
|
-
o.__proto__ = p;
|
|
89
|
-
return o;
|
|
90
|
-
};
|
|
91
|
-
return _set_prototype_of(o, p);
|
|
92
|
-
}
|
|
93
|
-
function _type_of(obj) {
|
|
94
|
-
"@swc/helpers - typeof";
|
|
95
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
96
|
-
}
|
|
97
|
-
function _is_native_reflect_construct() {
|
|
98
|
-
try {
|
|
99
|
-
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
100
|
-
} catch (_) {}
|
|
101
|
-
return (_is_native_reflect_construct = function() {
|
|
102
|
-
return !!result;
|
|
103
|
-
})();
|
|
104
|
-
}
|
|
105
|
-
var termNodeQuery = (0, _query.nodeQuery)("/term"), statementNodeQuery = (0, _query.nodeQuery)("/statement");
|
|
106
|
-
var MetaLevelVerifier = /*#__PURE__*/ function(Verifier) {
|
|
107
|
-
_inherits(MetaLevelVerifier, Verifier);
|
|
108
|
-
function MetaLevelVerifier() {
|
|
109
|
-
_class_call_check(this, MetaLevelVerifier);
|
|
110
|
-
return _call_super(this, MetaLevelVerifier, arguments);
|
|
111
|
-
}
|
|
112
|
-
_create_class(MetaLevelVerifier, [
|
|
113
|
-
{
|
|
114
|
-
key: "verify",
|
|
115
|
-
value: function verify(node, assignments, stated, localContext) {
|
|
116
|
-
var verifiedAtMetaLevel;
|
|
117
|
-
var nonTerminalNode = node, childNodes = nonTerminalNode.getChildNodes(), nonTerminalNodeVerified = this.verifyChildNodes(childNodes, assignments, stated, localContext);
|
|
118
|
-
verifiedAtMetaLevel = nonTerminalNodeVerified; ///
|
|
119
|
-
return verifiedAtMetaLevel;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
]);
|
|
123
|
-
return MetaLevelVerifier;
|
|
124
|
-
}(_verifier.default);
|
|
125
|
-
_define_property(MetaLevelVerifier, "maps", [
|
|
126
|
-
{
|
|
127
|
-
nodeQuery: statementNodeQuery,
|
|
128
|
-
verify: function(statementNode, assignments, stated, localContext) {
|
|
129
|
-
var Statement = _shim.default.Statement, statement = Statement.fromStatementNode(statementNode, localContext), statementVerified = statement.verify(assignments, stated, localContext);
|
|
130
|
-
return statementVerified;
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
nodeQuery: termNodeQuery,
|
|
135
|
-
verify: function(termNode, assignments, stated, localContext) {
|
|
136
|
-
var Term = _shim.default.Term, term = Term.fromTermNode(termNode, localContext), termVerified = term.verify(localContext, function() {
|
|
137
|
-
var verifiedAhead = true;
|
|
138
|
-
return verifiedAhead;
|
|
139
|
-
});
|
|
140
|
-
return termVerified;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
]);
|
|
144
|
-
var metaLevelVerifier = new MetaLevelVerifier();
|
|
145
|
-
var _default = metaLevelVerifier;
|
|
146
|
-
|
|
147
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLC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|
-
import Verifier from "../verifier";
|
|
5
|
-
|
|
6
|
-
import { nodeQuery } from "../utilities/query";
|
|
7
|
-
|
|
8
|
-
const termNodeQuery = nodeQuery("/term"),
|
|
9
|
-
statementNodeQuery = nodeQuery("/statement");
|
|
10
|
-
|
|
11
|
-
class MetaLevelVerifier extends Verifier {
|
|
12
|
-
verify(node, assignments, stated, localContext) {
|
|
13
|
-
let verifiedAtMetaLevel;
|
|
14
|
-
|
|
15
|
-
const nonTerminalNode = node, ///
|
|
16
|
-
childNodes = nonTerminalNode.getChildNodes(),
|
|
17
|
-
nonTerminalNodeVerified = this.verifyChildNodes(childNodes, assignments, stated, localContext);
|
|
18
|
-
|
|
19
|
-
verifiedAtMetaLevel = nonTerminalNodeVerified; ///
|
|
20
|
-
|
|
21
|
-
return verifiedAtMetaLevel;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
static maps = [
|
|
25
|
-
{
|
|
26
|
-
nodeQuery: statementNodeQuery,
|
|
27
|
-
verify: (statementNode, assignments, stated, localContext) => {
|
|
28
|
-
const { Statement } = shim,
|
|
29
|
-
statement = Statement.fromStatementNode(statementNode, localContext),
|
|
30
|
-
statementVerified = statement.verify(assignments, stated, localContext);
|
|
31
|
-
|
|
32
|
-
return statementVerified;
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
nodeQuery: termNodeQuery,
|
|
37
|
-
verify: (termNode, assignments, stated, localContext) => {
|
|
38
|
-
const { Term } = shim,
|
|
39
|
-
term = Term.fromTermNode(termNode, localContext),
|
|
40
|
-
termVerified = term.verify(localContext, () => {
|
|
41
|
-
const verifiedAhead = true;
|
|
42
|
-
|
|
43
|
-
return verifiedAhead;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return termVerified;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const metaLevelVerifier = new MetaLevelVerifier();
|
|
53
|
-
|
|
54
|
-
export default metaLevelVerifier;
|