occam-verify-cli 1.0.230 → 1.0.233
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/local.js +1 -14
- package/lib/dom/axiom.js +22 -16
- package/lib/dom/combinator.js +5 -5
- package/lib/dom/conclusion.js +5 -5
- package/lib/dom/conjecture.js +9 -9
- package/lib/dom/constructor.js +5 -5
- package/lib/dom/declaration/combinator.js +14 -14
- package/lib/dom/declaration/complexType.js +35 -35
- package/lib/dom/declaration/constructor.js +19 -19
- package/lib/dom/declaration/metavariable.js +22 -22
- package/lib/dom/declaration/simpleType.js +23 -23
- package/lib/dom/declaration/variable.js +20 -20
- package/lib/dom/declaration.js +4 -2
- package/lib/dom/deduction.js +5 -5
- package/lib/dom/derivation.js +5 -5
- package/lib/dom/error.js +9 -9
- package/lib/dom/hypothesis.js +260 -0
- package/lib/dom/label.js +18 -24
- package/lib/dom/lemma.js +7 -7
- package/lib/dom/metaLemma.js +9 -9
- package/lib/dom/metaType.js +4 -10
- package/lib/dom/metatheorem.js +9 -9
- package/lib/dom/metavariable.js +7 -8
- package/lib/dom/parameter.js +2 -2
- package/lib/dom/premise.js +5 -5
- package/lib/dom/procedureCall.js +11 -10
- package/lib/dom/proof.js +3 -3
- package/lib/dom/property.js +9 -9
- package/lib/dom/reference.js +23 -22
- package/lib/dom/rule.js +25 -25
- package/lib/dom/section.js +146 -0
- package/lib/dom/signature.js +5 -5
- package/lib/dom/statement.js +25 -20
- package/lib/dom/step.js +3 -3
- package/lib/dom/subDerivation.js +5 -5
- package/lib/dom/subproof.js +7 -7
- package/lib/dom/substitution/statement.js +3 -3
- package/lib/dom/supposition.js +5 -5
- package/lib/dom/term.js +5 -6
- package/lib/dom/theorem.js +9 -9
- package/lib/dom/topLevelAssertion.js +22 -22
- package/lib/dom/topLevelMetaAssertion.js +14 -14
- package/lib/dom/type.js +21 -21
- package/lib/dom/variable.js +9 -15
- package/lib/index.js +3 -1
- package/lib/node/hypothesis.js +123 -0
- package/lib/node/section.js +116 -0
- package/lib/nonTerminalNodeMap.js +5 -3
- package/lib/ruleNames.js +9 -1
- package/lib/utilities/json.js +59 -59
- package/lib/utilities/subproof.js +10 -10
- package/lib/verifier/combinator.js +9 -10
- package/lib/verifier/constructor.js +10 -11
- package/lib/verifier/topLevel.js +38 -31
- package/package.json +2 -2
- package/src/context/local.js +0 -14
- package/src/dom/axiom.js +30 -29
- package/src/dom/combinator.js +4 -4
- package/src/dom/conclusion.js +5 -5
- package/src/dom/conjecture.js +8 -8
- package/src/dom/constructor.js +4 -4
- package/src/dom/declaration/combinator.js +14 -14
- package/src/dom/declaration/complexType.js +35 -35
- package/src/dom/declaration/constructor.js +20 -20
- package/src/dom/declaration/metavariable.js +22 -22
- package/src/dom/declaration/simpleType.js +22 -22
- package/src/dom/declaration/variable.js +21 -21
- package/src/dom/declaration.js +5 -3
- package/src/dom/deduction.js +5 -5
- package/src/dom/derivation.js +5 -5
- package/src/dom/error.js +8 -8
- package/src/dom/hypothesis.js +230 -0
- package/src/dom/label.js +17 -19
- package/src/dom/lemma.js +8 -8
- package/src/dom/metaLemma.js +8 -8
- package/src/dom/metaType.js +2 -6
- package/src/dom/metatheorem.js +8 -8
- package/src/dom/metavariable.js +9 -12
- package/src/dom/parameter.js +1 -1
- package/src/dom/premise.js +8 -8
- package/src/dom/procedureCall.js +9 -9
- package/src/dom/proof.js +2 -2
- package/src/dom/property.js +8 -8
- package/src/dom/reference.js +23 -27
- package/src/dom/rule.js +30 -30
- package/src/dom/section.js +70 -0
- package/src/dom/signature.js +4 -4
- package/src/dom/statement.js +24 -32
- package/src/dom/step.js +4 -4
- package/src/dom/subDerivation.js +5 -5
- package/src/dom/subproof.js +8 -8
- package/src/dom/substitution/statement.js +5 -5
- package/src/dom/supposition.js +7 -7
- package/src/dom/term.js +3 -8
- package/src/dom/theorem.js +7 -7
- package/src/dom/topLevelAssertion.js +29 -30
- package/src/dom/topLevelMetaAssertion.js +20 -20
- package/src/dom/type.js +22 -22
- package/src/dom/variable.js +8 -11
- package/src/index.js +2 -0
- package/src/node/hypothesis.js +23 -0
- package/src/node/section.js +16 -0
- package/src/nonTerminalNodeMap.js +7 -1
- package/src/ruleNames.js +2 -0
- package/src/utilities/json.js +58 -58
- package/src/utilities/subproof.js +10 -10
- package/src/verifier/combinator.js +6 -11
- package/src/verifier/constructor.js +9 -12
- package/src/verifier/topLevel.js +42 -30
package/src/utilities/json.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import dom from "../dom";
|
|
4
4
|
|
|
5
|
-
export function termFromJSON(json,
|
|
5
|
+
export function termFromJSON(json, context) {
|
|
6
6
|
let { term } = json;
|
|
7
7
|
|
|
8
8
|
const termJSON = term; ///
|
|
@@ -11,38 +11,38 @@ export function termFromJSON(json, fileContext) {
|
|
|
11
11
|
|
|
12
12
|
const { Term } = dom;
|
|
13
13
|
|
|
14
|
-
term = Term.fromJSON(json,
|
|
14
|
+
term = Term.fromJSON(json, context);
|
|
15
15
|
|
|
16
16
|
return term;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export function typeFromJSON(json,
|
|
19
|
+
export function typeFromJSON(json, context) {
|
|
20
20
|
let { type } = json;
|
|
21
21
|
|
|
22
22
|
if (type !== null) {
|
|
23
23
|
const { name } = type,
|
|
24
24
|
typeName = name; ///
|
|
25
25
|
|
|
26
|
-
type =
|
|
26
|
+
type = context.findTypeByTypeName(typeName);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
return type;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export function metaTypeFromJSON(json,
|
|
32
|
+
export function metaTypeFromJSON(json, context) {
|
|
33
33
|
let { metaType } = json;
|
|
34
34
|
|
|
35
35
|
if (metaType !== null) {
|
|
36
36
|
const { name } = metaType,
|
|
37
37
|
metaTypeName = name; ///
|
|
38
38
|
|
|
39
|
-
metaType =
|
|
39
|
+
metaType = context.findMetaTypeByMetaTypeName(metaTypeName);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
return metaType;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export function statementFromJSON(json,
|
|
45
|
+
export function statementFromJSON(json, context) {
|
|
46
46
|
let { statement = null } = json;
|
|
47
47
|
|
|
48
48
|
if (statement !== null) {
|
|
@@ -51,13 +51,13 @@ export function statementFromJSON(json, fileContext) {
|
|
|
51
51
|
|
|
52
52
|
json = statementJSON; ///
|
|
53
53
|
|
|
54
|
-
statement = Statement.fromJSON(json,
|
|
54
|
+
statement = Statement.fromJSON(json, context);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
return statement;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export function referenceFromJSON(json,
|
|
60
|
+
export function referenceFromJSON(json, context) {
|
|
61
61
|
let { reference } = json;
|
|
62
62
|
|
|
63
63
|
const { Reference } = dom,
|
|
@@ -65,12 +65,12 @@ export function referenceFromJSON(json, fileContext) {
|
|
|
65
65
|
|
|
66
66
|
json = referenceJSON; ///
|
|
67
67
|
|
|
68
|
-
reference = Reference.fromJSON(json,
|
|
68
|
+
reference = Reference.fromJSON(json, context);
|
|
69
69
|
|
|
70
70
|
return reference;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export function deductionFromJSON(json,
|
|
73
|
+
export function deductionFromJSON(json, context) {
|
|
74
74
|
let { deduction } = json;
|
|
75
75
|
|
|
76
76
|
const { Deduction } = dom,
|
|
@@ -78,12 +78,12 @@ export function deductionFromJSON(json, fileContext) {
|
|
|
78
78
|
|
|
79
79
|
json = deductionJSON; ///
|
|
80
80
|
|
|
81
|
-
deduction = Deduction.fromJSON(json,
|
|
81
|
+
deduction = Deduction.fromJSON(json, context);
|
|
82
82
|
|
|
83
83
|
return deduction;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export function signatureFromJSON(json,
|
|
86
|
+
export function signatureFromJSON(json, context) {
|
|
87
87
|
let { signature = null } = json;
|
|
88
88
|
|
|
89
89
|
if (signature !== null) {
|
|
@@ -92,13 +92,13 @@ export function signatureFromJSON(json, fileContext) {
|
|
|
92
92
|
|
|
93
93
|
json = signatureJSON; ///
|
|
94
94
|
|
|
95
|
-
signature = Signature.fromJSON(json,
|
|
95
|
+
signature = Signature.fromJSON(json, context);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
return signature;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
export function conclusionFromJSON(json,
|
|
101
|
+
export function conclusionFromJSON(json, context) {
|
|
102
102
|
let { conclusion } = json;
|
|
103
103
|
|
|
104
104
|
const { Conclusion } = dom,
|
|
@@ -106,12 +106,12 @@ export function conclusionFromJSON(json, fileContext) {
|
|
|
106
106
|
|
|
107
107
|
json = conclusionJSON; ///
|
|
108
108
|
|
|
109
|
-
conclusion = Conclusion.fromJSON(json,
|
|
109
|
+
conclusion = Conclusion.fromJSON(json, context);
|
|
110
110
|
|
|
111
111
|
return conclusion;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
export function metavariableFromJSON(json,
|
|
114
|
+
export function metavariableFromJSON(json, context) {
|
|
115
115
|
let { metavariable } = json;
|
|
116
116
|
|
|
117
117
|
const { Metavariable } = dom,
|
|
@@ -119,12 +119,12 @@ export function metavariableFromJSON(json, fileContext) {
|
|
|
119
119
|
|
|
120
120
|
json = metavariableJSON; ///
|
|
121
121
|
|
|
122
|
-
metavariable = Metavariable.fromJSON(json,
|
|
122
|
+
metavariable = Metavariable.fromJSON(json, context);
|
|
123
123
|
|
|
124
124
|
return metavariable;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
export function procedureCallFromJSON(json,
|
|
127
|
+
export function procedureCallFromJSON(json, context) {
|
|
128
128
|
let { procedureCall = null } = json;
|
|
129
129
|
|
|
130
130
|
if (procedureCall !== null) {
|
|
@@ -133,26 +133,26 @@ export function procedureCallFromJSON(json, fileContext) {
|
|
|
133
133
|
|
|
134
134
|
json = procedureCallJSON; ///
|
|
135
135
|
|
|
136
|
-
procedureCall = ProcedureCall.fromJSON(json,
|
|
136
|
+
procedureCall = ProcedureCall.fromJSON(json, context);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
return procedureCall;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export function typesFromJSON(json, types,
|
|
142
|
+
export function typesFromJSON(json, types, context) {
|
|
143
143
|
const { types: typesJSON } = json;
|
|
144
144
|
|
|
145
145
|
const { Type } = dom;
|
|
146
146
|
|
|
147
147
|
typesJSON.forEach((typeJSON) => {
|
|
148
148
|
const json = typeJSON, ///
|
|
149
|
-
type = Type.fromJSON(json,
|
|
149
|
+
type = Type.fromJSON(json, context);
|
|
150
150
|
|
|
151
151
|
types.push(type);
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
export function termsFromJSON(json,
|
|
155
|
+
export function termsFromJSON(json, context) {
|
|
156
156
|
let { terms } = json;
|
|
157
157
|
|
|
158
158
|
const { Term } = dom,
|
|
@@ -160,7 +160,7 @@ export function termsFromJSON(json, fileContext) {
|
|
|
160
160
|
|
|
161
161
|
terms = termsJSON.map((termJSON) => {
|
|
162
162
|
const json = termJSON, ///
|
|
163
|
-
term = Term.fromJSON(json,
|
|
163
|
+
term = Term.fromJSON(json, context);
|
|
164
164
|
|
|
165
165
|
return term;
|
|
166
166
|
});
|
|
@@ -168,7 +168,7 @@ export function termsFromJSON(json, fileContext) {
|
|
|
168
168
|
return terms;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
export function rulesFromJSON(json,
|
|
171
|
+
export function rulesFromJSON(json, context) {
|
|
172
172
|
let { rules } = json;
|
|
173
173
|
|
|
174
174
|
const { Rule } = dom,
|
|
@@ -176,7 +176,7 @@ export function rulesFromJSON(json, fileContext) {
|
|
|
176
176
|
|
|
177
177
|
rules = rulesJSON.map((ruleJSON) => {
|
|
178
178
|
const json = ruleJSON, ///
|
|
179
|
-
rule = Rule.fromJSON(json,
|
|
179
|
+
rule = Rule.fromJSON(json, context);
|
|
180
180
|
|
|
181
181
|
return rule;
|
|
182
182
|
});
|
|
@@ -184,7 +184,7 @@ export function rulesFromJSON(json, fileContext) {
|
|
|
184
184
|
return rules;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
export function labelFromJSON(json,
|
|
187
|
+
export function labelFromJSON(json, context) {
|
|
188
188
|
let { label } = json;
|
|
189
189
|
|
|
190
190
|
const { Label } = dom,
|
|
@@ -192,12 +192,12 @@ export function labelFromJSON(json, fileContext) {
|
|
|
192
192
|
|
|
193
193
|
json = labelJSON; ///
|
|
194
194
|
|
|
195
|
-
label = Label.fromJSON(json,
|
|
195
|
+
label = Label.fromJSON(json, context);
|
|
196
196
|
|
|
197
197
|
return label;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
export function labelsFromJSON(json,
|
|
200
|
+
export function labelsFromJSON(json, context) {
|
|
201
201
|
let { labels } = json;
|
|
202
202
|
|
|
203
203
|
const { Label } = dom,
|
|
@@ -205,7 +205,7 @@ export function labelsFromJSON(json, fileContext) {
|
|
|
205
205
|
|
|
206
206
|
labels = labelsJSON.map((labelJSON) => {
|
|
207
207
|
const json = labelJSON, ///
|
|
208
|
-
label = Label.fromJSON(json,
|
|
208
|
+
label = Label.fromJSON(json, context);
|
|
209
209
|
|
|
210
210
|
return label;
|
|
211
211
|
});
|
|
@@ -213,7 +213,7 @@ export function labelsFromJSON(json, fileContext) {
|
|
|
213
213
|
return labels;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
export function axiomsFromJSON(json,
|
|
216
|
+
export function axiomsFromJSON(json, context) {
|
|
217
217
|
let { axioms } = json;
|
|
218
218
|
|
|
219
219
|
const { Axiom } = dom,
|
|
@@ -221,7 +221,7 @@ export function axiomsFromJSON(json, fileContext) {
|
|
|
221
221
|
|
|
222
222
|
axioms = axiomsJSON.map((axiomJSON) => {
|
|
223
223
|
const json = axiomJSON, ///
|
|
224
|
-
axiom = Axiom.fromJSON(json,
|
|
224
|
+
axiom = Axiom.fromJSON(json, context);
|
|
225
225
|
|
|
226
226
|
return axiom;
|
|
227
227
|
});
|
|
@@ -229,7 +229,7 @@ export function axiomsFromJSON(json, fileContext) {
|
|
|
229
229
|
return axioms;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
export function premisesFromJSON(json,
|
|
232
|
+
export function premisesFromJSON(json, context) {
|
|
233
233
|
let { premises } = json;
|
|
234
234
|
|
|
235
235
|
const { Premise } = dom,
|
|
@@ -237,7 +237,7 @@ export function premisesFromJSON(json, fileContext) {
|
|
|
237
237
|
|
|
238
238
|
premises = premisesJSON.map((premiseJSON) => {
|
|
239
239
|
const json = premiseJSON, ///
|
|
240
|
-
premise = Premise.fromJSON(json,
|
|
240
|
+
premise = Premise.fromJSON(json, context);
|
|
241
241
|
|
|
242
242
|
return premise;
|
|
243
243
|
});
|
|
@@ -245,7 +245,7 @@ export function premisesFromJSON(json, fileContext) {
|
|
|
245
245
|
return premises;
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
export function theoremsFromJSON(json,
|
|
248
|
+
export function theoremsFromJSON(json, context) {
|
|
249
249
|
let { theorems } = json;
|
|
250
250
|
|
|
251
251
|
const { Theorem } = dom,
|
|
@@ -253,7 +253,7 @@ export function theoremsFromJSON(json, fileContext) {
|
|
|
253
253
|
|
|
254
254
|
theorems = theoremsJSON.map((theoremJSON) => {
|
|
255
255
|
const json = theoremJSON, ///
|
|
256
|
-
theorem = Theorem.fromJSON(json,
|
|
256
|
+
theorem = Theorem.fromJSON(json, context);
|
|
257
257
|
|
|
258
258
|
return theorem;
|
|
259
259
|
});
|
|
@@ -261,7 +261,7 @@ export function theoremsFromJSON(json, fileContext) {
|
|
|
261
261
|
return theorems;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
export function variablesFromJSON(json,
|
|
264
|
+
export function variablesFromJSON(json, context) {
|
|
265
265
|
let { variables } = json;
|
|
266
266
|
|
|
267
267
|
const { Variable } = dom,
|
|
@@ -269,7 +269,7 @@ export function variablesFromJSON(json, fileContext) {
|
|
|
269
269
|
|
|
270
270
|
variables = variablesJSON.map((variableJSON) => {
|
|
271
271
|
const json = variableJSON, ///
|
|
272
|
-
variable = Variable.fromJSON(json,
|
|
272
|
+
variable = Variable.fromJSON(json, context);
|
|
273
273
|
|
|
274
274
|
return variable;
|
|
275
275
|
});
|
|
@@ -277,7 +277,7 @@ export function variablesFromJSON(json, fileContext) {
|
|
|
277
277
|
return variables;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
export function propertiesFromJSON(json,
|
|
280
|
+
export function propertiesFromJSON(json, context) {
|
|
281
281
|
let { properties } = json;
|
|
282
282
|
|
|
283
283
|
const { Property } = dom,
|
|
@@ -285,7 +285,7 @@ export function propertiesFromJSON(json, fileContext) {
|
|
|
285
285
|
|
|
286
286
|
properties = propertiesJSON.map((propertyJSON) => {
|
|
287
287
|
const json = propertyJSON, ///
|
|
288
|
-
property = Property.fromJSON(json,
|
|
288
|
+
property = Property.fromJSON(json, context);
|
|
289
289
|
|
|
290
290
|
return property;
|
|
291
291
|
});
|
|
@@ -293,14 +293,14 @@ export function propertiesFromJSON(json, fileContext) {
|
|
|
293
293
|
return properties;
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
export function superTypesFromJSON(json,
|
|
296
|
+
export function superTypesFromJSON(json, context) {
|
|
297
297
|
const { superTypes: superTypesJSON } = json;
|
|
298
298
|
|
|
299
299
|
const superTypes = superTypesJSON.map((superTypeJSON) => {
|
|
300
300
|
const json = superTypeJSON, ///
|
|
301
301
|
{ name } = json,
|
|
302
302
|
superTypeName = name, ///
|
|
303
|
-
superType =
|
|
303
|
+
superType = context.findTypeByTypeName(superTypeName);
|
|
304
304
|
|
|
305
305
|
return superType;
|
|
306
306
|
});
|
|
@@ -308,7 +308,7 @@ export function superTypesFromJSON(json, fileContext) {
|
|
|
308
308
|
return superTypes;
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
export function parametersFromJSON(json,
|
|
311
|
+
export function parametersFromJSON(json, context) {
|
|
312
312
|
let { parameters } = json;
|
|
313
313
|
|
|
314
314
|
const { Parameter } = dom,
|
|
@@ -316,7 +316,7 @@ export function parametersFromJSON(json, fileContext) {
|
|
|
316
316
|
|
|
317
317
|
parameters = parametersJSON.map((parameterJSON) => {
|
|
318
318
|
const json = parameterJSON, ///
|
|
319
|
-
parameter = Parameter.fromJSON(json,
|
|
319
|
+
parameter = Parameter.fromJSON(json, context);
|
|
320
320
|
|
|
321
321
|
return parameter;
|
|
322
322
|
});
|
|
@@ -324,7 +324,7 @@ export function parametersFromJSON(json, fileContext) {
|
|
|
324
324
|
return parameters;
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
export function conjecturesFromJSON(json,
|
|
327
|
+
export function conjecturesFromJSON(json, context) {
|
|
328
328
|
let { conjectures } = json;
|
|
329
329
|
|
|
330
330
|
const { Conjecture } = dom,
|
|
@@ -332,7 +332,7 @@ export function conjecturesFromJSON(json, fileContext) {
|
|
|
332
332
|
|
|
333
333
|
conjectures = conjecturesJSON.map((conjectureJSON) => {
|
|
334
334
|
const json = conjectureJSON, ///
|
|
335
|
-
conjecture = Conjecture.fromJSON(json,
|
|
335
|
+
conjecture = Conjecture.fromJSON(json, context);
|
|
336
336
|
|
|
337
337
|
return conjecture;
|
|
338
338
|
});
|
|
@@ -340,7 +340,7 @@ export function conjecturesFromJSON(json, fileContext) {
|
|
|
340
340
|
return conjectures;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
export function combinatorsFromJSON(json,
|
|
343
|
+
export function combinatorsFromJSON(json, context) {
|
|
344
344
|
let { combinators } = json;
|
|
345
345
|
|
|
346
346
|
const { Combinator } = dom,
|
|
@@ -348,7 +348,7 @@ export function combinatorsFromJSON(json, fileContext) {
|
|
|
348
348
|
|
|
349
349
|
combinators = combinatorsJSON.map((combinatorJSON) => {
|
|
350
350
|
const json = combinatorJSON, ///
|
|
351
|
-
combinator = Combinator.fromJSON(json,
|
|
351
|
+
combinator = Combinator.fromJSON(json, context);
|
|
352
352
|
|
|
353
353
|
return combinator;
|
|
354
354
|
});
|
|
@@ -356,7 +356,7 @@ export function combinatorsFromJSON(json, fileContext) {
|
|
|
356
356
|
return combinators;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
export function constructorsFromJSON(json,
|
|
359
|
+
export function constructorsFromJSON(json, context) {
|
|
360
360
|
let { constructors } = json;
|
|
361
361
|
|
|
362
362
|
const { Constructor } = dom,
|
|
@@ -364,7 +364,7 @@ export function constructorsFromJSON(json, fileContext) {
|
|
|
364
364
|
|
|
365
365
|
constructors = constructorsJSON.map((constructorJSON) => {
|
|
366
366
|
const json = constructorJSON, ///
|
|
367
|
-
constructor = Constructor.fromJSON(json,
|
|
367
|
+
constructor = Constructor.fromJSON(json, context);
|
|
368
368
|
|
|
369
369
|
return constructor;
|
|
370
370
|
});
|
|
@@ -372,7 +372,7 @@ export function constructorsFromJSON(json, fileContext) {
|
|
|
372
372
|
return constructors;
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
-
export function metatheoremsFromJSON(json,
|
|
375
|
+
export function metatheoremsFromJSON(json, context) {
|
|
376
376
|
let { metatheorems } = json;
|
|
377
377
|
|
|
378
378
|
const { Metatheorem } = dom,
|
|
@@ -380,7 +380,7 @@ export function metatheoremsFromJSON(json, fileContext) {
|
|
|
380
380
|
|
|
381
381
|
metatheorems = metatheoremsJSON.map((metatheoremJSON) => {
|
|
382
382
|
const json = metatheoremJSON, ///
|
|
383
|
-
metatheorem = Metatheorem.fromJSON(json,
|
|
383
|
+
metatheorem = Metatheorem.fromJSON(json, context);
|
|
384
384
|
|
|
385
385
|
return metatheorem;
|
|
386
386
|
});
|
|
@@ -388,7 +388,7 @@ export function metatheoremsFromJSON(json, fileContext) {
|
|
|
388
388
|
return metatheorems;
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
export function suppositionsFromJSON(json,
|
|
391
|
+
export function suppositionsFromJSON(json, context) {
|
|
392
392
|
let { suppositions } = json;
|
|
393
393
|
|
|
394
394
|
const { Supposition } = dom,
|
|
@@ -396,7 +396,7 @@ export function suppositionsFromJSON(json, fileContext) {
|
|
|
396
396
|
|
|
397
397
|
suppositions = suppositionsJSON.map((suppositionJSON) => {
|
|
398
398
|
const json = suppositionJSON, ///
|
|
399
|
-
supposition = Supposition.fromJSON(json,
|
|
399
|
+
supposition = Supposition.fromJSON(json, context);
|
|
400
400
|
|
|
401
401
|
return supposition;
|
|
402
402
|
});
|
|
@@ -404,7 +404,7 @@ export function suppositionsFromJSON(json, fileContext) {
|
|
|
404
404
|
return suppositions;
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
-
export function substitutionsFromJSON(json,
|
|
407
|
+
export function substitutionsFromJSON(json, context) {
|
|
408
408
|
let { substitutions = [] } = json; ///
|
|
409
409
|
|
|
410
410
|
const { StatementSubstitution } = dom,
|
|
@@ -413,7 +413,7 @@ export function substitutionsFromJSON(json, fileContext) {
|
|
|
413
413
|
|
|
414
414
|
substitutions = substitutionsJSON.map((substitutionJSON) => {
|
|
415
415
|
const json = substitutionJSON, ///
|
|
416
|
-
substitution = Substitution.fromJSON(json,
|
|
416
|
+
substitution = Substitution.fromJSON(json, context);
|
|
417
417
|
|
|
418
418
|
return substitution;
|
|
419
419
|
});
|
|
@@ -421,7 +421,7 @@ export function substitutionsFromJSON(json, fileContext) {
|
|
|
421
421
|
return substitutions;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
export function metavariablesFromJSON(json,
|
|
424
|
+
export function metavariablesFromJSON(json, context) {
|
|
425
425
|
let { metavariables } = json;
|
|
426
426
|
|
|
427
427
|
const { Metavariable } = dom,
|
|
@@ -429,7 +429,7 @@ export function metavariablesFromJSON(json, fileContext) {
|
|
|
429
429
|
|
|
430
430
|
metavariables = metavariablesJSON.map((metavariableJSON) => {
|
|
431
431
|
const json = metavariableJSON, ///
|
|
432
|
-
metavariable = Metavariable.fromJSON(json,
|
|
432
|
+
metavariable = Metavariable.fromJSON(json, context);
|
|
433
433
|
|
|
434
434
|
return metavariable;
|
|
435
435
|
});
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export function subproofStringFromSubproofNode(subproofNode,
|
|
4
|
-
const suppositionStatementsOrNonsenseString = suppositionStatementOrNonsenseStringFromSubproofNode(subproofNode,
|
|
5
|
-
lastStatementOrNonsenseString = lastStatementOrNonsenseStringFromSubproofNode(subproofNode,
|
|
3
|
+
export function subproofStringFromSubproofNode(subproofNode, context) {
|
|
4
|
+
const suppositionStatementsOrNonsenseString = suppositionStatementOrNonsenseStringFromSubproofNode(subproofNode, context),
|
|
5
|
+
lastStatementOrNonsenseString = lastStatementOrNonsenseStringFromSubproofNode(subproofNode, context),
|
|
6
6
|
subproofString = `[${suppositionStatementsOrNonsenseString}] ... ${lastStatementOrNonsenseString}`;
|
|
7
7
|
|
|
8
8
|
return subproofString;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function suppositionStatementOrNonsenseStringFromSubproofNode(subproofNode,
|
|
11
|
+
function suppositionStatementOrNonsenseStringFromSubproofNode(subproofNode, context) {
|
|
12
12
|
const suppositionNodes = subproofNode.getSuppositionNodes(),
|
|
13
13
|
suppositionStatementsOrNonsenseString = suppositionNodes.reduce((suppositionStatementsOrNonsenseString, suppositionNode) => {
|
|
14
14
|
const suppositionOrStepNode = suppositionNode, ///
|
|
15
|
-
statementOrNonsenseString = statementOrNonsenseStringFromSuppositionOrStepNode(suppositionOrStepNode,
|
|
15
|
+
statementOrNonsenseString = statementOrNonsenseStringFromSuppositionOrStepNode(suppositionOrStepNode, context),
|
|
16
16
|
suppositionStatementOrNonsenseString = statementOrNonsenseString; ///
|
|
17
17
|
|
|
18
18
|
suppositionStatementsOrNonsenseString = (suppositionStatementsOrNonsenseString !== null) ?
|
|
@@ -25,16 +25,16 @@ function suppositionStatementOrNonsenseStringFromSubproofNode(subproofNode, file
|
|
|
25
25
|
return suppositionStatementsOrNonsenseString;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function lastStatementOrNonsenseStringFromSubproofNode(subproofNode,
|
|
28
|
+
function lastStatementOrNonsenseStringFromSubproofNode(subproofNode, context) {
|
|
29
29
|
const lastStepNode = subproofNode.getLastStepNode(),
|
|
30
30
|
suppositionOrStepNode = lastStepNode, ///
|
|
31
|
-
statementOrNonsenseString = statementOrNonsenseStringFromSuppositionOrStepNode(suppositionOrStepNode,
|
|
31
|
+
statementOrNonsenseString = statementOrNonsenseStringFromSuppositionOrStepNode(suppositionOrStepNode, context),
|
|
32
32
|
lastStatementOrNonsenseString = statementOrNonsenseString; ///
|
|
33
33
|
|
|
34
34
|
return lastStatementOrNonsenseString;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
function statementOrNonsenseStringFromSuppositionOrStepNode(suppositionOrStepNode,
|
|
37
|
+
function statementOrNonsenseStringFromSuppositionOrStepNode(suppositionOrStepNode, context) {
|
|
38
38
|
let statementOrNonsenseString;
|
|
39
39
|
|
|
40
40
|
const nonsenseNode = suppositionOrStepNode.getNonsenseNode(),
|
|
@@ -43,11 +43,11 @@ function statementOrNonsenseStringFromSuppositionOrStepNode(suppositionOrStepNod
|
|
|
43
43
|
if (false) {
|
|
44
44
|
///
|
|
45
45
|
} else if (nonsenseNode !== null) {
|
|
46
|
-
const nonsenseString =
|
|
46
|
+
const nonsenseString = context.nodeAsString(nonsenseNode);
|
|
47
47
|
|
|
48
48
|
statementOrNonsenseString = nonsenseString; ///
|
|
49
49
|
} else if (statementNode !== null) {
|
|
50
|
-
const statementString =
|
|
50
|
+
const statementString = context.nodeAsString(statementNode);
|
|
51
51
|
|
|
52
52
|
statementOrNonsenseString = statementString; ///
|
|
53
53
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import dom from "../dom";
|
|
4
4
|
import Verifier from "../verifier";
|
|
5
|
-
import LocalContext from "../context/local";
|
|
6
5
|
|
|
7
6
|
import { nodeQuery } from "../utilities/query";
|
|
8
7
|
|
|
@@ -11,12 +10,12 @@ const termNodeQuery = nodeQuery("/term"),
|
|
|
11
10
|
statementNodeQuery = nodeQuery("/statement");
|
|
12
11
|
|
|
13
12
|
class CombinatorVerifier extends Verifier {
|
|
14
|
-
verifyStatement(statementNode,
|
|
13
|
+
verifyStatement(statementNode, context) {
|
|
15
14
|
let statementVerifiesAsCombinator;
|
|
16
15
|
|
|
17
16
|
const nonTerminalNode = statementNode, ///
|
|
18
17
|
childNodes = nonTerminalNode.getChildNodes(),
|
|
19
|
-
childNodesVerify = this.verifyChildNodes(childNodes,
|
|
18
|
+
childNodesVerify = this.verifyChildNodes(childNodes, context);
|
|
20
19
|
|
|
21
20
|
statementVerifiesAsCombinator = childNodesVerify; ///
|
|
22
21
|
|
|
@@ -26,10 +25,8 @@ class CombinatorVerifier extends Verifier {
|
|
|
26
25
|
static maps = [
|
|
27
26
|
{
|
|
28
27
|
nodeQuery: statementNodeQuery,
|
|
29
|
-
verify: (statementNode,
|
|
28
|
+
verify: (statementNode, context) => {
|
|
30
29
|
const { Statement } = dom,
|
|
31
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
32
|
-
context = localContext, ///
|
|
33
30
|
statement = Statement.fromStatementNode(statementNode, context),
|
|
34
31
|
assignments = null,
|
|
35
32
|
stated = false,
|
|
@@ -40,10 +37,8 @@ class CombinatorVerifier extends Verifier {
|
|
|
40
37
|
},
|
|
41
38
|
{
|
|
42
39
|
nodeQuery: termNodeQuery,
|
|
43
|
-
verify: (termNode,
|
|
40
|
+
verify: (termNode, context) => {
|
|
44
41
|
const { Term } = dom,
|
|
45
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
46
|
-
context = localContext, ///
|
|
47
42
|
term = Term.fromTermNode(termNode, context),
|
|
48
43
|
termVerifies = term.verify(context, () => {
|
|
49
44
|
const verifiesAhead = true;
|
|
@@ -56,11 +51,11 @@ class CombinatorVerifier extends Verifier {
|
|
|
56
51
|
},
|
|
57
52
|
{
|
|
58
53
|
nodeQuery: typeNodeQuery,
|
|
59
|
-
verify: (typeNode,
|
|
54
|
+
verify: (typeNode, context) => {
|
|
60
55
|
let typeVerifies = false;
|
|
61
56
|
|
|
62
57
|
const typeName = typeNode.getTypeName(),
|
|
63
|
-
typePresent =
|
|
58
|
+
typePresent = context.isTypePresentByTypeName(typeName);
|
|
64
59
|
|
|
65
60
|
if (typePresent) {
|
|
66
61
|
typeVerifies = true;
|
|
@@ -4,7 +4,6 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import dom from "../dom";
|
|
6
6
|
import Verifier from "../verifier";
|
|
7
|
-
import LocalContext from "../context/local";
|
|
8
7
|
|
|
9
8
|
import { nodeQuery } from "../utilities/query";
|
|
10
9
|
import { TYPE_TYPE } from "../constants";
|
|
@@ -15,12 +14,12 @@ const termNodeQuery = nodeQuery("/term"),
|
|
|
15
14
|
typeNodeQuery = nodeQuery("/type");
|
|
16
15
|
|
|
17
16
|
class ConstructorVerifier extends Verifier {
|
|
18
|
-
verifyTerm(termNode,
|
|
17
|
+
verifyTerm(termNode, context) {
|
|
19
18
|
let termVerifiesAsConstructor;
|
|
20
19
|
|
|
21
20
|
const nonTerminalNode = termNode, ///
|
|
22
21
|
childNodes = nonTerminalNode.getChildNodes(),
|
|
23
|
-
childNodesVerify = this.verifyChildNodes(childNodes,
|
|
22
|
+
childNodesVerify = this.verifyChildNodes(childNodes, context, () => {
|
|
24
23
|
const verifiesAhead = true;
|
|
25
24
|
|
|
26
25
|
return verifiesAhead;
|
|
@@ -39,11 +38,11 @@ class ConstructorVerifier extends Verifier {
|
|
|
39
38
|
if (type === TYPE_TYPE) {
|
|
40
39
|
const verifyAhead = remainingArguments.pop(), ///
|
|
41
40
|
lastRemainingArgument = last(remainingArguments),
|
|
42
|
-
|
|
41
|
+
context = lastRemainingArgument, ///
|
|
43
42
|
content = terminalNode.getContent(),
|
|
44
43
|
typeString = content; ///
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
context.debug(`The '${typeString}' type is present in the constructor but has not been declared beforehand.`);
|
|
47
46
|
|
|
48
47
|
terminalNodeVerifies = false;
|
|
49
48
|
|
|
@@ -58,23 +57,21 @@ class ConstructorVerifier extends Verifier {
|
|
|
58
57
|
static maps = [
|
|
59
58
|
{
|
|
60
59
|
nodeQuery: termNodeQuery,
|
|
61
|
-
verify: (termNode,
|
|
60
|
+
verify: (termNode, context, verifyAhead) => {
|
|
62
61
|
const { Term } = dom,
|
|
63
|
-
localContext = LocalContext.fromFileContext(fileContext),
|
|
64
|
-
context = localContext, ///
|
|
65
62
|
term = Term.fromTermNode(termNode, context),
|
|
66
|
-
termVerifies = term.verify(
|
|
63
|
+
termVerifies = term.verify(context, verifyAhead);
|
|
67
64
|
|
|
68
65
|
return termVerifies;
|
|
69
66
|
}
|
|
70
67
|
},
|
|
71
68
|
{
|
|
72
69
|
nodeQuery: typeNodeQuery,
|
|
73
|
-
verify: (typeNode,
|
|
70
|
+
verify: (typeNode, context, verifyAhead) => {
|
|
74
71
|
let typeVerifies;
|
|
75
72
|
|
|
76
73
|
const typeName = typeNode.getTypeName(),
|
|
77
|
-
typePresent =
|
|
74
|
+
typePresent = context.isTypePresentByTypeName(typeName);
|
|
78
75
|
|
|
79
76
|
if (typePresent) {
|
|
80
77
|
const verifiesAhead = verifyAhead();
|
|
@@ -83,7 +80,7 @@ class ConstructorVerifier extends Verifier {
|
|
|
83
80
|
} else {
|
|
84
81
|
const typeString = typeName; ///
|
|
85
82
|
|
|
86
|
-
|
|
83
|
+
context.debug(`The '${typeString}' type is not present.`);
|
|
87
84
|
|
|
88
85
|
typeVerifies = false;
|
|
89
86
|
}
|