occam-verify-cli 0.0.1068 → 0.0.1069
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/bin/action/verify.js +3 -2
- package/lib/assertion/subproof.js +3 -3
- package/lib/axiom.js +11 -6
- package/lib/combinator.js +9 -9
- package/lib/conclusion.js +10 -7
- package/lib/conjecture.js +11 -6
- package/lib/consequent.js +10 -7
- package/lib/constructor.js +9 -9
- package/lib/context/file.js +34 -126
- package/lib/context/local.js +16 -5
- package/lib/context/release.js +2 -3
- package/lib/declaration.js +50 -43
- package/lib/equivalence.js +2 -2
- package/lib/frame.js +100 -80
- package/lib/index.js +22 -6
- package/lib/judgement.js +3 -3
- package/lib/label.js +12 -8
- package/lib/lemma.js +12 -12
- package/lib/metaLemma.js +120 -8
- package/lib/metatheorem.js +145 -9
- package/lib/metavariable.js +39 -22
- package/lib/mixins/statement/qualified/unify.js +6 -10
- package/lib/mixins/statement/unify.js +3 -3
- package/lib/mixins/term/unify.js +2 -2
- package/lib/premise.js +12 -8
- package/lib/reference.js +7 -9
- package/lib/rule.js +24 -39
- package/lib/ruleNames.js +1 -5
- package/lib/statement/unqualified.js +9 -8
- package/lib/statement.js +4 -4
- package/lib/substitution/frameForMetavariable.js +30 -26
- package/lib/substitution/statementForMetavariable.js +44 -26
- package/lib/substitution/termForVariable.js +33 -37
- package/lib/substitution.js +24 -21
- package/lib/substitutions.js +7 -1
- package/lib/supposition.js +12 -8
- package/lib/term.js +6 -11
- package/lib/theorem.js +11 -6
- package/lib/topLevelAssertion.js +24 -42
- package/lib/type.js +5 -12
- package/lib/unifier/metaLevel.js +3 -3
- package/lib/unifier/metavariable.js +6 -6
- package/lib/unifier/statementWithCombinator.js +16 -16
- package/lib/unifier/termWithConstructor.js +7 -7
- package/lib/utilities/brackets.js +10 -10
- package/lib/utilities/json.js +493 -0
- package/lib/utilities/node.js +15 -22
- package/lib/utilities/release.js +53 -0
- package/lib/utilities/releaseContext.js +4 -15
- package/lib/utilities/tokens.js +7 -7
- package/lib/variable.js +6 -11
- package/lib/verifier/topLevel.js +5 -5
- package/package.json +1 -1
- package/src/assertion/subproof.js +2 -3
- package/src/axiom.js +14 -6
- package/src/combinator.js +12 -13
- package/src/conclusion.js +12 -9
- package/src/conjecture.js +14 -6
- package/src/consequent.js +12 -9
- package/src/constructor.js +11 -13
- package/src/context/file.js +94 -202
- package/src/context/local.js +8 -6
- package/src/context/release.js +2 -3
- package/src/declaration.js +72 -44
- package/src/equivalence.js +2 -2
- package/src/frame.js +111 -86
- package/src/index.js +17 -1
- package/src/judgement.js +2 -2
- package/src/label.js +15 -10
- package/src/lemma.js +17 -10
- package/src/metaLemma.js +102 -1
- package/src/metatheorem.js +143 -2
- package/src/metavariable.js +50 -30
- package/src/mixins/statement/qualified/unify.js +7 -19
- package/src/mixins/statement/unify.js +2 -2
- package/src/mixins/term/unify.js +1 -1
- package/src/premise.js +18 -10
- package/src/reference.js +7 -11
- package/src/rule.js +33 -57
- package/src/ruleNames.js +0 -1
- package/src/statement/unqualified.js +10 -10
- package/src/statement.js +3 -2
- package/src/substitution/frameForMetavariable.js +39 -33
- package/src/substitution/statementForMetavariable.js +64 -31
- package/src/substitution/termForVariable.js +47 -37
- package/src/substitution.js +18 -16
- package/src/substitutions.js +2 -0
- package/src/supposition.js +18 -10
- package/src/term.js +5 -15
- package/src/theorem.js +14 -6
- package/src/topLevelAssertion.js +38 -64
- package/src/type.js +5 -20
- package/src/unifier/metaLevel.js +2 -2
- package/src/unifier/metavariable.js +5 -5
- package/src/unifier/statementWithCombinator.js +18 -18
- package/src/unifier/termWithConstructor.js +7 -7
- package/src/utilities/brackets.js +5 -5
- package/src/utilities/json.js +551 -0
- package/src/utilities/node.js +15 -26
- package/src/{verify → utilities}/release.js +5 -1
- package/src/utilities/releaseContext.js +2 -2
- package/src/utilities/tokens.js +10 -7
- package/src/variable.js +4 -14
- package/src/verifier/topLevel.js +6 -4
- package/lib/argument.js +0 -106
- package/lib/metaTypes.js +0 -19
- package/lib/unify/statementWithSttaemetnGivenEquivalences.js +0 -45
- package/lib/verify/metaLemma.js +0 -49
- package/lib/verify/metatheorem.js +0 -48
- package/lib/verify/release.js +0 -50
- package/src/argument.js +0 -79
- package/src/metaTypes.js +0 -11
- package/src/unify/statementWithSttaemetnGivenEquivalences.js +0 -51
- package/src/verify/metaLemma.js +0 -72
- package/src/verify/metatheorem.js +0 -67
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import shim from "../shim";
|
|
4
|
+
|
|
5
|
+
export function termFromJSON(json, fileContext) {
|
|
6
|
+
let { term } = json;
|
|
7
|
+
|
|
8
|
+
const termJSON = term; ///
|
|
9
|
+
|
|
10
|
+
json = termJSON; ///
|
|
11
|
+
|
|
12
|
+
const { Term } = shim;
|
|
13
|
+
|
|
14
|
+
term = Term.fromJSON(json, fileContext);
|
|
15
|
+
|
|
16
|
+
return term;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function typeFromJSON(json, fileContext) {
|
|
20
|
+
let { type } = json;
|
|
21
|
+
|
|
22
|
+
const { name } = type,
|
|
23
|
+
typeName = name; ///
|
|
24
|
+
|
|
25
|
+
type = fileContext.findTypeByTypeName(typeName);
|
|
26
|
+
|
|
27
|
+
return type;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function metaTypeFromJSON(json, fileContext) {
|
|
31
|
+
let { metaType } = json;
|
|
32
|
+
|
|
33
|
+
if (metaType !== null) {
|
|
34
|
+
const { name } = metaType,
|
|
35
|
+
metaTypeName = name; ///
|
|
36
|
+
|
|
37
|
+
metaType = fileContext.findMetaTypeByMetaTypeName(metaTypeName);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return metaType;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function superTypeFromJSON(json, fileContext) {
|
|
44
|
+
let { superType } = json;
|
|
45
|
+
|
|
46
|
+
const superTypeJSON = superType; ///
|
|
47
|
+
|
|
48
|
+
json = superTypeJSON; ///
|
|
49
|
+
|
|
50
|
+
const { name } = json,
|
|
51
|
+
typeName = name, ///
|
|
52
|
+
type = fileContext.findTypeByTypeName(typeName);
|
|
53
|
+
|
|
54
|
+
superType = type; ///
|
|
55
|
+
|
|
56
|
+
return superType;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function statementFromJSON(json, fileContext) {
|
|
60
|
+
let { statement } = json;
|
|
61
|
+
|
|
62
|
+
const { Statement } = shim,
|
|
63
|
+
statementJSON = statement; ///
|
|
64
|
+
|
|
65
|
+
json = statementJSON; ///
|
|
66
|
+
|
|
67
|
+
statement = Statement.fromJSON(json, fileContext);
|
|
68
|
+
|
|
69
|
+
return statement;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function conclusionFromJSON(json, fileContext) {
|
|
73
|
+
let { conclusion } = json;
|
|
74
|
+
|
|
75
|
+
const { Conclusion } = shim,
|
|
76
|
+
conclusionJSON = conclusion; ///
|
|
77
|
+
|
|
78
|
+
json = conclusionJSON; ///
|
|
79
|
+
|
|
80
|
+
conclusion = Conclusion.fromJSON(json, fileContext);
|
|
81
|
+
|
|
82
|
+
return conclusion;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function consequentFromJSON(json, fileContext) {
|
|
86
|
+
let { consequent } = json;
|
|
87
|
+
|
|
88
|
+
const { Consequent } = shim,
|
|
89
|
+
consequentJSON = consequent; ///
|
|
90
|
+
|
|
91
|
+
json = consequentJSON; ///
|
|
92
|
+
|
|
93
|
+
consequent = Consequent.fromJSON(json, fileContext);
|
|
94
|
+
|
|
95
|
+
return consequent;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function metavariableFromJSON(json, fileContext) {
|
|
99
|
+
let { metavariable } = json;
|
|
100
|
+
|
|
101
|
+
const { Metavariable } = shim,
|
|
102
|
+
metavariableJSON = metavariable; ///
|
|
103
|
+
|
|
104
|
+
json = metavariableJSON; ///
|
|
105
|
+
|
|
106
|
+
metavariable = Metavariable.fromJSON(json, fileContext);
|
|
107
|
+
|
|
108
|
+
return metavariable;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function unqualifiedStatementFromJSON(json, fileContext) {
|
|
112
|
+
let { unqualifiedStatement } = json;
|
|
113
|
+
|
|
114
|
+
const { UnqualifiedStatement } = shim,
|
|
115
|
+
unqualifiedStatementJSON = unqualifiedStatement; ///
|
|
116
|
+
|
|
117
|
+
json = unqualifiedStatementJSON; ///
|
|
118
|
+
|
|
119
|
+
unqualifiedStatement = UnqualifiedStatement.fromJSON(json, fileContext);
|
|
120
|
+
|
|
121
|
+
return unqualifiedStatement;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function typesFromJSON(json, fileContext) {
|
|
125
|
+
let { types } = json;
|
|
126
|
+
|
|
127
|
+
const typesJSON = types; ///
|
|
128
|
+
types = typesJSON.map((typeJSON) => {
|
|
129
|
+
const { Type } = shim,
|
|
130
|
+
json = typeJSON, ///
|
|
131
|
+
type = Type.fromJSON(json, fileContext);
|
|
132
|
+
|
|
133
|
+
return (type);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return types;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function rulesFromJSON(json, fileContext) {
|
|
140
|
+
let { rules } = json;
|
|
141
|
+
|
|
142
|
+
const rulesJSON = rules; ///
|
|
143
|
+
rules = rulesJSON.map((ruleJSON) => {
|
|
144
|
+
const { Rule } = shim,
|
|
145
|
+
json = ruleJSON, ///
|
|
146
|
+
rule = Rule.fromJSON(json, fileContext);
|
|
147
|
+
|
|
148
|
+
return (rule);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
return rules;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function labelsFromJSON(json, fileContext) {
|
|
155
|
+
let { labels } = json;
|
|
156
|
+
|
|
157
|
+
const { Label } = shim,
|
|
158
|
+
labelsJSON = labels; ///
|
|
159
|
+
|
|
160
|
+
labels = labelsJSON.map((labelJSON) => {
|
|
161
|
+
const json = labelJSON, ///
|
|
162
|
+
label = Label.fromJSON(json, fileContext);
|
|
163
|
+
|
|
164
|
+
return label;
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
return labels;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export function axiomsFromJSON(json, fileContext) {
|
|
171
|
+
let { axioms } = json;
|
|
172
|
+
|
|
173
|
+
const axiomsJSON = axioms; ///
|
|
174
|
+
axioms = axiomsJSON.map((axiomJSON) => {
|
|
175
|
+
const { Axiom } = shim,
|
|
176
|
+
json = axiomJSON, ///
|
|
177
|
+
axiom = Axiom.fromJSON(json, fileContext);
|
|
178
|
+
|
|
179
|
+
return (axiom);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
return axioms;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function premisesFromJSON(json, fileContext) {
|
|
186
|
+
let { premises } = json;
|
|
187
|
+
|
|
188
|
+
const { Premise } = shim,
|
|
189
|
+
premisesJSON = premises; ///
|
|
190
|
+
|
|
191
|
+
premises = premisesJSON.map((premiseJSON) => {
|
|
192
|
+
const json = premiseJSON, ///
|
|
193
|
+
premise = Premise.fromJSON(json, fileContext);
|
|
194
|
+
|
|
195
|
+
return premise;
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
return premises;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export function theoremsFromJSON(json, fileContext) {
|
|
202
|
+
let { theorems } = json;
|
|
203
|
+
|
|
204
|
+
const theoremsJSON = theorems; ///
|
|
205
|
+
theorems = theoremsJSON.map((theoremJSON) => {
|
|
206
|
+
const { Theorem } = shim,
|
|
207
|
+
json = theoremJSON, ///
|
|
208
|
+
theorem = Theorem.fromJSON(json, fileContext);
|
|
209
|
+
|
|
210
|
+
return (theorem);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
return theorems;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export function variablesFromJSON(json, fileContext) {
|
|
217
|
+
let { variables } = json;
|
|
218
|
+
|
|
219
|
+
const variablesJSON = variables; ///
|
|
220
|
+
variables = variablesJSON.map((variableJSON) => {
|
|
221
|
+
const { Variable } = shim,
|
|
222
|
+
json = variableJSON, ///
|
|
223
|
+
variable = Variable.fromJSON(json, fileContext);
|
|
224
|
+
|
|
225
|
+
return (variable);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
return variables;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export function conjecturesFromJSON(json, fileContext) {
|
|
232
|
+
let { conjectures } = json;
|
|
233
|
+
|
|
234
|
+
const conjecturesJSON = conjectures; ///
|
|
235
|
+
conjectures = conjecturesJSON.map((conjectureJSON) => {
|
|
236
|
+
const { Conjecture } = shim,
|
|
237
|
+
json = conjectureJSON, ///
|
|
238
|
+
conjecture = Conjecture.fromJSON(json, fileContext);
|
|
239
|
+
|
|
240
|
+
return (conjecture);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
return conjectures;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export function combinatorsFromJSON(json, fileContext) {
|
|
247
|
+
let { combinators } = json;
|
|
248
|
+
|
|
249
|
+
const combinatorsJSON = combinators; ///
|
|
250
|
+
combinators = combinatorsJSON.map((combinatorJSON) => {
|
|
251
|
+
const { Combinator } = shim,
|
|
252
|
+
json = combinatorJSON, ///
|
|
253
|
+
combinator = Combinator.fromJSON(json, fileContext);
|
|
254
|
+
|
|
255
|
+
return (combinator);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
return combinators;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export function constructorsFromJSON(json, fileContext) {
|
|
262
|
+
let { constructors } = json;
|
|
263
|
+
|
|
264
|
+
const constructorsJSON = constructors; ///
|
|
265
|
+
constructors = constructorsJSON.map((constructorJSON) => {
|
|
266
|
+
const { Constructor } = shim,
|
|
267
|
+
json = constructorJSON, ///
|
|
268
|
+
constructor = Constructor.fromJSON(json, fileContext);
|
|
269
|
+
|
|
270
|
+
return (constructor);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
return constructors;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export function metatheoremsFromJSON(json, fileContext) {
|
|
277
|
+
let { metatheorems } = json;
|
|
278
|
+
|
|
279
|
+
const metatheoremsJSON = metatheorems; ///
|
|
280
|
+
metatheorems = metatheoremsJSON.map((metatheoremJSON) => {
|
|
281
|
+
const { Metatheorem } = shim,
|
|
282
|
+
json = metatheoremJSON, ///
|
|
283
|
+
metatheorem = Metatheorem.fromJSON(json, fileContext);
|
|
284
|
+
|
|
285
|
+
return (metatheorem);
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
return metatheorems;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export function suppositionsFromJSON(json, fileContext) {
|
|
292
|
+
let { suppositions } = json;
|
|
293
|
+
|
|
294
|
+
const { Supposition } = shim,
|
|
295
|
+
suppositionsJSON = suppositions; ///
|
|
296
|
+
|
|
297
|
+
suppositions = suppositionsJSON.map((suppositionJSON) => {
|
|
298
|
+
const json = suppositionJSON, ///
|
|
299
|
+
supposition = Supposition.fromJSON(json, fileContext);
|
|
300
|
+
|
|
301
|
+
return supposition;
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
return suppositions;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export function substitutionsFromJSON(json, fileContext) {
|
|
308
|
+
let { substitutions } = json;
|
|
309
|
+
|
|
310
|
+
const { Substitution } = shim,
|
|
311
|
+
substitutionsJSON = substitutions; ///
|
|
312
|
+
|
|
313
|
+
substitutions = substitutionsJSON.map((substitutionJSON) => {
|
|
314
|
+
const json = substitutionJSON, ///
|
|
315
|
+
substitution = Substitution.fromJSON(json, fileContext);
|
|
316
|
+
|
|
317
|
+
return substitution;
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
return substitutions;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export function metavariablesFromJSON(json, fileContext) {
|
|
324
|
+
let { metavariables } = json;
|
|
325
|
+
|
|
326
|
+
const metavariablesJSON = metavariables; ///
|
|
327
|
+
metavariables = metavariablesJSON.map((metavariableJSON) => {
|
|
328
|
+
const { Metavariable } = shim,
|
|
329
|
+
json = metavariableJSON, ///
|
|
330
|
+
metavariable = Metavariable.fromJSON(json, fileContext);
|
|
331
|
+
|
|
332
|
+
return (metavariable);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
return metavariables;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export function termToTermJSON(term) {
|
|
339
|
+
const termJSON = term.toJSON();
|
|
340
|
+
|
|
341
|
+
return termJSON;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export function typeToTypeJSON(type) {
|
|
345
|
+
const typeJSON = type.toJSON();
|
|
346
|
+
|
|
347
|
+
return typeJSON;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export function metaTypeToMetaTypeJSON(metaType) {
|
|
351
|
+
const metaTypeJSON = (metaType !== null) ?
|
|
352
|
+
metaType.toJSON() :
|
|
353
|
+
null;
|
|
354
|
+
return metaTypeJSON;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export function superTypeToSuperTypeJSON(superType) {
|
|
358
|
+
const superTypeJSON = superType.toJSON();
|
|
359
|
+
|
|
360
|
+
return superTypeJSON;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export function statementToStatementJSON(statement) {
|
|
364
|
+
const statementJSON = statement.toJSNO();
|
|
365
|
+
|
|
366
|
+
return statementJSON;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export function conclusionToConclusionJSON(conclusion) {
|
|
370
|
+
const conclusionJSON = conclusion.toJSON();
|
|
371
|
+
|
|
372
|
+
return conclusionJSON;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export function consequentToConsequentJSON(consequent) {
|
|
376
|
+
const consequentJSON = consequent.toJSON();
|
|
377
|
+
|
|
378
|
+
return consequentJSON;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export function metavariableToMetavariableJSON(metavariable) {
|
|
382
|
+
const metavariableJSON = metavariable.toJSNO();
|
|
383
|
+
|
|
384
|
+
return metavariableJSON;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export function unqualifiedStatementToUnqualifiedStatementJSON(unqualifiedStatement) {
|
|
388
|
+
const unqualifiedStatementJSON = unqualifiedStatement.toJSNO();
|
|
389
|
+
|
|
390
|
+
return unqualifiedStatementJSON;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export function typesToTypesJSON(types) {
|
|
394
|
+
const typesJSON = types.map((type) => {
|
|
395
|
+
const typeJSON = type.toJSON();
|
|
396
|
+
|
|
397
|
+
type = typeJSON; ///
|
|
398
|
+
|
|
399
|
+
return type;
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
return typesJSON;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export function rulesToRulesJSON(rules) {
|
|
406
|
+
const rulesJSON = rules.map((rule) => {
|
|
407
|
+
const ruleJSON = rule.toJSON();
|
|
408
|
+
|
|
409
|
+
rule = ruleJSON; ///
|
|
410
|
+
|
|
411
|
+
return rule;
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
return rulesJSON;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export function labelsToLabelsJSON(labels) {
|
|
418
|
+
const labelsJSON = labels.map((label) => {
|
|
419
|
+
const labelJSON = label.toJSON();
|
|
420
|
+
|
|
421
|
+
return labelJSON;
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
return labelsJSON;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export function axiomsToAxiomsJSON(axioms) {
|
|
428
|
+
const axiomsJSON = axioms.map((axiom) => {
|
|
429
|
+
const axiomJSON = axiom.toJSON();
|
|
430
|
+
|
|
431
|
+
axiom = axiomJSON; ///
|
|
432
|
+
|
|
433
|
+
return axiom;
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
return axiomsJSON;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export function premisesToPremisesJSON(premises) {
|
|
440
|
+
const premisesJSON = premises.map((premise) => {
|
|
441
|
+
const premiseJSON = premise.toJSON();
|
|
442
|
+
|
|
443
|
+
return premiseJSON;
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
return premisesJSON;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export function theoremsToTheoremsJSON(theorems) {
|
|
450
|
+
const theoremsJSON = theorems.map((theorem) => {
|
|
451
|
+
const theoremJSON = theorem.toJSON();
|
|
452
|
+
|
|
453
|
+
theorem = theoremJSON; ///
|
|
454
|
+
|
|
455
|
+
return theorem;
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
return theoremsJSON;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export function variablesToVariablesJSON(variables) {
|
|
462
|
+
const variablesJSON = variables.map((variable) => {
|
|
463
|
+
const variableJSON = variable.toJSON();
|
|
464
|
+
|
|
465
|
+
variable = variableJSON; ///
|
|
466
|
+
|
|
467
|
+
return variable;
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
return variablesJSON;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export function conjecturesToConjecturesJSON(conjectures) {
|
|
474
|
+
const conjecturesJSON = conjectures.map((conjecture) => {
|
|
475
|
+
const conjectureJSON = conjecture.toJSON();
|
|
476
|
+
|
|
477
|
+
conjecture = conjectureJSON; ///
|
|
478
|
+
|
|
479
|
+
return conjecture;
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
return conjecturesJSON;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export function combinatorsToCombinatorsJSON(combinators) {
|
|
486
|
+
const combinatorsJSON = combinators.map((combinator) => {
|
|
487
|
+
const combinatorJSON = combinator.toJSON();
|
|
488
|
+
|
|
489
|
+
combinator = combinatorJSON; ///
|
|
490
|
+
|
|
491
|
+
return combinator;
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
return combinatorsJSON;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export function suppositionsToSuppositionsJSON(suppositions) {
|
|
498
|
+
const suppositionsJSON = suppositions.map((supposition) => {
|
|
499
|
+
const suppositionJSON = supposition.toJSON();
|
|
500
|
+
|
|
501
|
+
return suppositionJSON;
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
return suppositionsJSON;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export function constructorsToConstructorsJSON(constructors) {
|
|
508
|
+
const constructorsJSON = constructors.map((constructor) => {
|
|
509
|
+
const constructorJSON = constructor.toJSON();
|
|
510
|
+
|
|
511
|
+
constructor = constructorJSON; ///
|
|
512
|
+
|
|
513
|
+
return constructor;
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
return constructorsJSON;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export function metatheoremsToMetatheoremsJSON(metatheorems) {
|
|
520
|
+
const metatheoremsJSON = metatheorems.map((metatheorem) => {
|
|
521
|
+
const metatheoremJSON = metatheorem.toJSON();
|
|
522
|
+
|
|
523
|
+
metatheorem = metatheoremJSON; ///
|
|
524
|
+
|
|
525
|
+
return metatheorem;
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
return metatheoremsJSON;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export function substitutionsToSubstitutionsJSON(substitutions) {
|
|
532
|
+
const substitutionsJSON = substitutions.mapSubstitution((substitution) => {
|
|
533
|
+
const substitutionJSON = substitution.toJSON();
|
|
534
|
+
|
|
535
|
+
return substitutionJSON;
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
return substitutionsJSON;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export function metavariablesToMetavariablesJSON(metavariables) {
|
|
542
|
+
const metavariablesJSON = metavariables.map((metavariable) => {
|
|
543
|
+
const metavariableJSON = metavariable.toJSON();
|
|
544
|
+
|
|
545
|
+
metavariable = metavariableJSON; ///
|
|
546
|
+
|
|
547
|
+
return metavariable;
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
return metavariablesJSON;
|
|
551
|
+
}
|
package/src/utilities/node.js
CHANGED
|
@@ -6,12 +6,10 @@ import { nodeQuery } from "../utilities/query";
|
|
|
6
6
|
import { combinedCustomGrammarFromNothing } from "./customGrammar";
|
|
7
7
|
import { VARIABLE_RULE_NAME,
|
|
8
8
|
METAVARIABLE_RULE_NAME,
|
|
9
|
-
SUBSTITUTION_RULE_NAME,
|
|
10
9
|
UNQUALIFIED_STATEMENT_RULE_NAME,
|
|
11
10
|
CONSTRUCTOR_DECLARATION_RULE_NAME } from "../ruleNames";
|
|
12
11
|
import { variableTokensFromVariableString,
|
|
13
12
|
metavariableTokensFromMetavariableString,
|
|
14
|
-
substitutionTokensFromSubstitutionString,
|
|
15
13
|
unqualifiedStatementTokensFromUnqualifiedStatementString,
|
|
16
14
|
constructorDeclarationTokensFromConstructorDeclarationString } from "../utilities/tokens";
|
|
17
15
|
|
|
@@ -21,7 +19,8 @@ const combinedCustomGrammar = combinedCustomGrammarFromNothing(),
|
|
|
21
19
|
nominalParser = nominalParserFromCombinedCustomGrammar(combinedCustomGrammar);
|
|
22
20
|
|
|
23
21
|
const termNodeQuery = nodeQuery("/constructorDeclaration/term"),
|
|
24
|
-
statementNodeQuery = nodeQuery("/unqualifiedStatement/statement")
|
|
22
|
+
statementNodeQuery = nodeQuery("/unqualifiedStatement/statement"),
|
|
23
|
+
substitutionNodeQuery = nodeQuery("/unqualifiedStatement/statement/substitution");
|
|
25
24
|
|
|
26
25
|
export function termNodeFromTermString(termString, lexer, parser) {
|
|
27
26
|
const constructorDeclarationString = constructorDeclarationStringFromTermString(termString),
|
|
@@ -39,15 +38,6 @@ export function variableNodeFromVariableString(variableString, lexer, parser) {
|
|
|
39
38
|
return variableNode;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
export function statementNodeFromStatementString(statementString, lexer, parser) {
|
|
43
|
-
const unqualifiedStatementString =unqualifiedStatementStringFromStatementString(statementString),
|
|
44
|
-
unqualifiedStatementTokens = unqualifiedStatementTokensFromUnqualifiedStatementString(unqualifiedStatementString, lexer),
|
|
45
|
-
unqualifiedStatementNode = unqualifiedStatementNodeFromUnqualifiedStatementTokens(unqualifiedStatementTokens, parser),
|
|
46
|
-
statementNode = statementNodeFromUnqualifiedStatementNode(unqualifiedStatementNode);
|
|
47
|
-
|
|
48
|
-
return statementNode;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
41
|
export function metavariableNodeFromMetavariableString(metavariableString, lexer, parser) {
|
|
52
42
|
const metavariableTokens = metavariableTokensFromMetavariableString(metavariableString, lexer),
|
|
53
43
|
metavariableNode = metavariableNodeFromMetavariableTokens(metavariableTokens, parser);
|
|
@@ -55,13 +45,6 @@ export function metavariableNodeFromMetavariableString(metavariableString, lexer
|
|
|
55
45
|
return metavariableNode;
|
|
56
46
|
}
|
|
57
47
|
|
|
58
|
-
export function substitutionNodeFromSubstitutionString(substitutionString, lexer, parser) {
|
|
59
|
-
const substitutionTokens = substitutionTokensFromSubstitutionString(substitutionString, lexer),
|
|
60
|
-
substitutionNode = substitutionNodeFromSubstitutionTokens(substitutionTokens, parser);
|
|
61
|
-
|
|
62
|
-
return substitutionNode;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
48
|
export function constructorDeclarationStringFromTermString(termString) {
|
|
66
49
|
const constructorDeclarationString = `Constructor ${termString}
|
|
67
50
|
`;
|
|
@@ -76,6 +59,13 @@ export function unqualifiedStatementStringFromStatementString(statementString) {
|
|
|
76
59
|
return unqualifiedStatementString;
|
|
77
60
|
}
|
|
78
61
|
|
|
62
|
+
export function unqualifiedStatementStringFromSubstitutionString(substitutionString) {
|
|
63
|
+
const unqualifiedStatementString = `a ${substitutionString}
|
|
64
|
+
`; ///
|
|
65
|
+
|
|
66
|
+
return unqualifiedStatementString;
|
|
67
|
+
}
|
|
68
|
+
|
|
79
69
|
export function termNodeFromConstructorDeclarationNode(constructorDeclarationNode) {
|
|
80
70
|
const termNode = termNodeQuery(constructorDeclarationNode, constructorDeclarationNode);
|
|
81
71
|
|
|
@@ -88,6 +78,12 @@ export function statementNodeFromUnqualifiedStatementNode(unqualifiedStatementNo
|
|
|
88
78
|
return statementNode;
|
|
89
79
|
}
|
|
90
80
|
|
|
81
|
+
export function substitutionNodeFromUnqualifiedStatementNode(unqualifiedStatementNode) {
|
|
82
|
+
const substitutionNode = substitutionNodeQuery(unqualifiedStatementNode);
|
|
83
|
+
|
|
84
|
+
return substitutionNode;
|
|
85
|
+
}
|
|
86
|
+
|
|
91
87
|
export function variableNodeFromVariableTokens(variableTokens, parser) {
|
|
92
88
|
const ruleName = VARIABLE_RULE_NAME,
|
|
93
89
|
variableNode = nodeFromTokensRuleNameAndParser(variableTokens, ruleName, parser);
|
|
@@ -102,13 +98,6 @@ export function metavariableNodeFromMetavariableTokens(metavariableTokens, parse
|
|
|
102
98
|
return metavariableNode;
|
|
103
99
|
}
|
|
104
100
|
|
|
105
|
-
export function substitutionNodeFromSubstitutionTokens(substitutionTokens, parser) {
|
|
106
|
-
const ruleName = SUBSTITUTION_RULE_NAME,
|
|
107
|
-
substitutionNode = nodeFromTokensRuleNameAndParser(substitutionTokens, ruleName, parser);
|
|
108
|
-
|
|
109
|
-
return substitutionNode;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
101
|
export function unqualifiedStatementNodeFromUnqualifiedStatementTokens(unqualifiedStatementTokens, parser) {
|
|
113
102
|
const tokens = unqualifiedStatementTokens, ///
|
|
114
103
|
ruleName = UNQUALIFIED_STATEMENT_RULE_NAME,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function verifyRelease(releaseName, dependentName, dependentReleased, releaseContextMap) {
|
|
4
4
|
let releaseVerified = false;
|
|
5
5
|
|
|
6
6
|
const releaseContext = releaseContextMap[releaseName];
|
|
@@ -42,6 +42,10 @@ export default function verifyRelease(releaseName, dependentName, dependentRelea
|
|
|
42
42
|
return releaseVerified;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export default {
|
|
46
|
+
verifyRelease
|
|
47
|
+
};
|
|
48
|
+
|
|
45
49
|
function verifyDependencyReleases(releaseContext, dependentName, dependentReleased, releaseContextMap) {
|
|
46
50
|
const dependencies = releaseContext.getDependencies(),
|
|
47
51
|
dependencyReleasesVVerified = dependencies.everyDependency((dependency) => {
|
|
@@ -4,7 +4,7 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
const { last } = arrayUtilities;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function createReleaseContext(dependency, dependentNames, context, callback) {
|
|
8
8
|
const { log, releaseContextMap } = context,
|
|
9
9
|
dependencyName = dependency.getName(),
|
|
10
10
|
releaseName = dependencyName, ///
|
|
@@ -87,7 +87,7 @@ export function createReleaseContext(dependency, dependentNames, context, callba
|
|
|
87
87
|
}, context);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
function initialiseReleaseContext(dependency, context) {
|
|
91
91
|
const { releaseContextMap } = context,
|
|
92
92
|
dependencyName = dependency.getName(),
|
|
93
93
|
releaseName = dependencyName, ///
|
package/src/utilities/tokens.js
CHANGED
|
@@ -25,13 +25,6 @@ export function metavariableTokensFromMetavariableString(metavariableString, lex
|
|
|
25
25
|
return metavariableTokens;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export function substitutionTokensFromSubstitutionString(substitutionString, lexer) {
|
|
29
|
-
const substitutionContent = `${substitutionString}`,
|
|
30
|
-
substitutionTokens = tokensFromContentAndLexer(substitutionContent, lexer);
|
|
31
|
-
|
|
32
|
-
return substitutionTokens;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
28
|
export function unqualifiedStatementTokensFromUnqualifiedStatementString(unqualifiedStatementString, lexer) {
|
|
36
29
|
const content = unqualifiedStatementString, ///
|
|
37
30
|
unqualifiedStatementTokens = tokensFromContentAndLexer(content, lexer);
|
|
@@ -60,6 +53,16 @@ export function statementTokensFromUnqualifiedStatementTokens(unqualifiedStateme
|
|
|
60
53
|
return statementTokens;
|
|
61
54
|
}
|
|
62
55
|
|
|
56
|
+
export function substitutionTokensFromUnqualifiedStatementTokensAndSubstitutionNode(unqualifiedStatementTokens, substitutionNode) {
|
|
57
|
+
const lastSignificantTokenIndex = substitutionNode.getLastSignificantTokenIndex(unqualifiedStatementTokens),
|
|
58
|
+
firstSignificantTokenIndex = substitutionNode.getFirstSignificantTokenIndex(unqualifiedStatementTokens),
|
|
59
|
+
start = firstSignificantTokenIndex, ///
|
|
60
|
+
end = lastSignificantTokenIndex + 1,
|
|
61
|
+
substitutionTokens = unqualifiedStatementTokens.slice(start, end);
|
|
62
|
+
|
|
63
|
+
return substitutionTokens;
|
|
64
|
+
}
|
|
65
|
+
|
|
63
66
|
function tokensFromContentAndLexer(content, lexer = nominalLexer) {
|
|
64
67
|
const tokens = lexer.tokenise(content);
|
|
65
68
|
|