occam-verify-cli 1.0.651 → 1.0.655
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/ephemeral.js +42 -1
- package/lib/context/file/nominal.js +23 -4
- package/lib/element/assertion/contained.js +24 -1
- package/lib/element/assertion/defined.js +24 -1
- package/lib/element/assertion/property.js +24 -1
- package/lib/element/assertion/satisfies.js +24 -1
- package/lib/element/assertion/subproof.js +37 -1
- package/lib/element/assertion/type.js +27 -1
- package/lib/element/assumption.js +2 -7
- package/lib/element/combinator.js +16 -3
- package/lib/element/conclusion.js +18 -3
- package/lib/element/constructor.js +8 -2
- package/lib/element/declaration/complexType.js +52 -52
- package/lib/element/declaration/constructor.js +38 -38
- package/lib/element/declaration/metavariable.js +35 -35
- package/lib/element/declaration/simpleType.js +42 -42
- package/lib/element/declaration/typePrefix.js +32 -32
- package/lib/element/declaration/variable.js +39 -39
- package/lib/element/deduction.js +2 -4
- package/lib/element/equivalences.js +3 -3
- package/lib/element/frame.js +2 -9
- package/lib/element/hypothesis.js +18 -24
- package/lib/element/label.js +14 -3
- package/lib/element/metavariable.js +10 -3
- package/lib/element/parameter.js +2 -3
- package/lib/element/procedureCall.js +2 -3
- package/lib/element/procedureReference.js +2 -3
- package/lib/element/proofAssertion/premise.js +54 -49
- package/lib/element/proofAssertion/step.js +86 -86
- package/lib/element/proofAssertion/supposition.js +39 -49
- package/lib/element/property.js +2 -3
- package/lib/element/reference.js +2 -3
- package/lib/element/rule.js +2 -4
- package/lib/element/section.js +14 -14
- package/lib/element/signature.js +2 -3
- package/lib/element/statement.js +8 -2
- package/lib/element/subproof.js +8 -8
- package/lib/element/substitution/statement.js +2 -2
- package/lib/element/term.js +15 -29
- package/lib/element/topLevelAssertion/axiom.js +63 -63
- package/lib/element/topLevelMetaAssertion.js +15 -15
- package/lib/element/type.js +2 -3
- package/lib/element/typePrefix.js +2 -3
- package/lib/element/variable.js +2 -2
- package/lib/process/instantiate.js +38 -2
- package/lib/utilities/equivalence.js +27 -0
- package/lib/utilities/json.js +197 -30
- package/package.json +1 -1
- package/src/context/ephemeral.js +84 -0
- package/src/context/file/nominal.js +38 -18
- package/src/element/assertion/contained.js +25 -0
- package/src/element/assertion/defined.js +25 -0
- package/src/element/assertion/property.js +25 -0
- package/src/element/assertion/satisfies.js +25 -0
- package/src/element/assertion/subproof.js +46 -0
- package/src/element/assertion/type.js +32 -0
- package/src/element/assumption.js +1 -12
- package/src/element/combinator.js +33 -3
- package/src/element/conclusion.js +33 -3
- package/src/element/constructor.js +17 -4
- package/src/element/declaration/complexType.js +49 -49
- package/src/element/declaration/constructor.js +32 -32
- package/src/element/declaration/metavariable.js +26 -26
- package/src/element/declaration/simpleType.js +34 -34
- package/src/element/declaration/typePrefix.js +35 -35
- package/src/element/declaration/variable.js +30 -30
- package/src/element/deduction.js +1 -6
- package/src/element/equivalences.js +1 -1
- package/src/element/frame.js +1 -15
- package/src/element/hypothesis.js +23 -34
- package/src/element/label.js +22 -5
- package/src/element/metavariable.js +20 -2
- package/src/element/parameter.js +1 -6
- package/src/element/procedureCall.js +1 -7
- package/src/element/procedureReference.js +1 -6
- package/src/element/proofAssertion/premise.js +54 -39
- package/src/element/proofAssertion/step.js +62 -62
- package/src/element/proofAssertion/supposition.js +27 -44
- package/src/element/property.js +1 -6
- package/src/element/reference.js +1 -6
- package/src/element/rule.js +3 -11
- package/src/element/section.js +12 -12
- package/src/element/signature.js +1 -7
- package/src/element/statement.js +13 -1
- package/src/element/subproof.js +6 -6
- package/src/element/substitution/statement.js +1 -1
- package/src/element/term.js +16 -24
- package/src/element/topLevelAssertion/axiom.js +45 -45
- package/src/element/topLevelMetaAssertion.js +19 -19
- package/src/element/type.js +1 -10
- package/src/element/typePrefix.js +1 -6
- package/src/element/variable.js +1 -1
- package/src/process/instantiate.js +26 -2
- package/src/utilities/equivalence.js +26 -0
- package/src/utilities/json.js +233 -37
|
@@ -5,10 +5,12 @@ import { Element } from "occam-languages";
|
|
|
5
5
|
import elements from "../elements";
|
|
6
6
|
|
|
7
7
|
import { define } from "../elements";
|
|
8
|
+
import { literally } from "../utilities/context";
|
|
8
9
|
import { EMPTY_STRING } from "../constants";
|
|
9
|
-
import { typeToTypeJSON } from "../utilities/json";
|
|
10
10
|
import { metaTypeToMetaTypeJSON } from "../utilities/json";
|
|
11
|
+
import { instantiateMetavariable } from "../process/instantiate";
|
|
11
12
|
import { unifyMetavariable, unifyMetavariableIntrinsically } from "../process/unify";
|
|
13
|
+
import { nameFromJSON, typeFromJSON, nameToNameJSON, metaTypeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
12
14
|
|
|
13
15
|
export default define(class Metavariable extends Element {
|
|
14
16
|
constructor(context, string, node, name, type, metaType) {
|
|
@@ -438,11 +440,14 @@ export default define(class Metavariable extends Element {
|
|
|
438
440
|
toJSON() {
|
|
439
441
|
const metaTypeJSON = metaTypeToMetaTypeJSON(this.metaType),
|
|
440
442
|
typeJSON = typeToTypeJSON(this.type),
|
|
443
|
+
nameJSON = nameToNameJSON(this.name),
|
|
441
444
|
type = typeJSON, ///
|
|
442
445
|
metaType = metaTypeJSON, ///
|
|
443
446
|
string = this.getString(), ///
|
|
447
|
+
name = this.name,
|
|
444
448
|
json = {
|
|
445
449
|
string,
|
|
450
|
+
name,
|
|
446
451
|
type,
|
|
447
452
|
metaType
|
|
448
453
|
};
|
|
@@ -453,6 +458,19 @@ export default define(class Metavariable extends Element {
|
|
|
453
458
|
static name = "Metavariable";
|
|
454
459
|
|
|
455
460
|
static fromJSON(json, context) {
|
|
456
|
-
|
|
461
|
+
const metavariable = literally((context) => {
|
|
462
|
+
const { string } = json,
|
|
463
|
+
metavariableNode = instantiateMetavariable(string, context),
|
|
464
|
+
node = metavariableNode, ///
|
|
465
|
+
name = nameFromJSON(json, context),
|
|
466
|
+
type = typeFromJSON(json, context),
|
|
467
|
+
metaType = metaTypeFromJSON(json, context),
|
|
468
|
+
metavariable = new Metavariable(context, string, node, name, type, metaType);
|
|
469
|
+
|
|
470
|
+
return metavariable;
|
|
471
|
+
|
|
472
|
+
}, context);
|
|
473
|
+
|
|
474
|
+
return metavariable;
|
|
457
475
|
}
|
|
458
476
|
});
|
package/src/element/parameter.js
CHANGED
|
@@ -58,11 +58,6 @@ export default define(class Parameter extends Element {
|
|
|
58
58
|
static name = "Parameter";
|
|
59
59
|
|
|
60
60
|
static fromJSON(json, context) {
|
|
61
|
-
|
|
62
|
-
string = null,
|
|
63
|
-
node = null,
|
|
64
|
-
parameter = new Parameter(context, string, node, name, identifier);
|
|
65
|
-
|
|
66
|
-
return parameter;
|
|
61
|
+
debugger
|
|
67
62
|
}
|
|
68
63
|
});
|
|
@@ -126,12 +126,6 @@ export default define(class ProcedureCall extends Element {
|
|
|
126
126
|
static name = "ProcedureCall";
|
|
127
127
|
|
|
128
128
|
static fromJSON(json, context) {
|
|
129
|
-
|
|
130
|
-
parameters = parametersFromJSON(json, context),
|
|
131
|
-
procedureReference = procedureReferenceFromJSON(json, context),
|
|
132
|
-
string = stringFromProcedureReferenceAndParameters(procedureReference, parameters),
|
|
133
|
-
procedureCall = new ProcedureCall(context, string, node, parameters, procedureReference);
|
|
134
|
-
|
|
135
|
-
return procedureCall;
|
|
129
|
+
debugger
|
|
136
130
|
}
|
|
137
131
|
});
|
|
@@ -39,11 +39,6 @@ export default define(class ProcedureReference extends Element {
|
|
|
39
39
|
static name = "ProcedureReference";
|
|
40
40
|
|
|
41
41
|
static fromJSON(json, context) {
|
|
42
|
-
|
|
43
|
-
string = name, ///
|
|
44
|
-
node = null,
|
|
45
|
-
procedureReference = new ProcedureReference(context, string, node, name);
|
|
46
|
-
|
|
47
|
-
return procedureReference;
|
|
42
|
+
debugger
|
|
48
43
|
}
|
|
49
44
|
});
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import ProofAssertion from "../proofAssertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { instantiatePremise } from "../../process/instantiate";
|
|
7
|
+
import { attempt, liminally, literally } from "../../utilities/context";
|
|
8
|
+
import { statementFromJSON, procedureCallFromJSON, statementToStatementJSON, ephemeralContextFromJSON, procedureCallToProcedureCallJSON } from "../../utilities/json";
|
|
8
9
|
|
|
9
10
|
export default define(class Premise extends ProofAssertion {
|
|
10
11
|
constructor(context, string, node, statement, procedureCall) {
|
|
@@ -30,6 +31,32 @@ export default define(class Premise extends ProofAssertion {
|
|
|
30
31
|
return stated;
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
async verify(context) {
|
|
35
|
+
let verifies = false;
|
|
36
|
+
|
|
37
|
+
await this.break(context);
|
|
38
|
+
|
|
39
|
+
const premiseString = this.getString();
|
|
40
|
+
|
|
41
|
+
context.trace(`Verifying the '${premiseString}' premise...`);
|
|
42
|
+
|
|
43
|
+
attempt((context) => {
|
|
44
|
+
const validates = this.validate(context);
|
|
45
|
+
|
|
46
|
+
if (validates) {
|
|
47
|
+
this.setContext(context);
|
|
48
|
+
|
|
49
|
+
verifies = true;
|
|
50
|
+
}
|
|
51
|
+
}, context);
|
|
52
|
+
|
|
53
|
+
if (verifies) {
|
|
54
|
+
context.debug(`...verified the '${premiseString}' premise.`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return verifies;
|
|
58
|
+
}
|
|
59
|
+
|
|
33
60
|
validate(context) {
|
|
34
61
|
let validates = false;
|
|
35
62
|
|
|
@@ -194,32 +221,6 @@ export default define(class Premise extends ProofAssertion {
|
|
|
194
221
|
return subproofUnifies;
|
|
195
222
|
}
|
|
196
223
|
|
|
197
|
-
async verify(context) {
|
|
198
|
-
let verifies = false;
|
|
199
|
-
|
|
200
|
-
await this.break(context);
|
|
201
|
-
|
|
202
|
-
const premiseString = this.getString();
|
|
203
|
-
|
|
204
|
-
context.trace(`Verifying the '${premiseString}' premise...`);
|
|
205
|
-
|
|
206
|
-
attempt((context) => {
|
|
207
|
-
const validates = this.validate(context);
|
|
208
|
-
|
|
209
|
-
if (validates) {
|
|
210
|
-
this.setContext(context);
|
|
211
|
-
|
|
212
|
-
verifies = true;
|
|
213
|
-
}
|
|
214
|
-
}, context);
|
|
215
|
-
|
|
216
|
-
if (verifies) {
|
|
217
|
-
context.debug(`...verified the '${premiseString}' premise.`);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return verifies;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
224
|
async unifyIndependently(context) {
|
|
224
225
|
let unifiesIndependently = false;
|
|
225
226
|
|
|
@@ -262,11 +263,22 @@ export default define(class Premise extends ProofAssertion {
|
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
toJSON() {
|
|
266
|
+
let context;
|
|
267
|
+
|
|
268
|
+
context = this.getContext();
|
|
269
|
+
|
|
270
|
+
const contextJSON = context.toJSON();
|
|
271
|
+
|
|
272
|
+
context = contextJSON; ///
|
|
273
|
+
|
|
265
274
|
const procedureCallJSON = procedureCallToProcedureCallJSON(this.procedureCall),
|
|
266
275
|
statementJSON = statementToStatementJSON(this.statement),
|
|
267
276
|
procedureCall = procedureCallJSON, ///
|
|
268
277
|
statement = statementJSON, ///
|
|
278
|
+
string = this.getString(),
|
|
269
279
|
json = {
|
|
280
|
+
context,
|
|
281
|
+
string,
|
|
270
282
|
statement,
|
|
271
283
|
procedureCall
|
|
272
284
|
};
|
|
@@ -277,22 +289,25 @@ export default define(class Premise extends ProofAssertion {
|
|
|
277
289
|
static name = "Premise";
|
|
278
290
|
|
|
279
291
|
static fromJSON(json, context) {
|
|
280
|
-
const
|
|
281
|
-
|
|
292
|
+
const premise = literally((context) => {
|
|
293
|
+
let { string } = json;
|
|
282
294
|
|
|
283
|
-
|
|
295
|
+
string = `${string}
|
|
296
|
+
`; ///
|
|
284
297
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
298
|
+
const prmiseNode = instantiatePremise(string, context),
|
|
299
|
+
node = prmiseNode, ///
|
|
300
|
+
statement = statementFromJSON(json, context),
|
|
301
|
+
procedureCall = procedureCallFromJSON(json, context),
|
|
302
|
+
ephemeralContext = ephemeralContextFromJSON(json, context);
|
|
288
303
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
304
|
+
context = ephemeralContext; ///
|
|
305
|
+
|
|
306
|
+
const premise = new Premise(context, string, node, statement, procedureCall);
|
|
292
307
|
|
|
293
|
-
|
|
308
|
+
return premise;
|
|
294
309
|
|
|
295
|
-
|
|
310
|
+
}, context);
|
|
296
311
|
|
|
297
312
|
return premise;
|
|
298
313
|
}
|
|
@@ -66,6 +66,36 @@ export default define(class Step extends ProofAssertion {
|
|
|
66
66
|
return comparesToTermAndPropertyRelation;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
async verify(context) {
|
|
70
|
+
let verifies = false;
|
|
71
|
+
|
|
72
|
+
await this.break(context);
|
|
73
|
+
|
|
74
|
+
const stepString = this.getString(); ///
|
|
75
|
+
|
|
76
|
+
context.trace(`Verifying the '${stepString}' step...`);
|
|
77
|
+
|
|
78
|
+
await asyncAttempt(async (context) => {
|
|
79
|
+
const validates = this.validate(context);
|
|
80
|
+
|
|
81
|
+
if (validates) {
|
|
82
|
+
const unifies = await this.unify(context);
|
|
83
|
+
|
|
84
|
+
if (unifies) {
|
|
85
|
+
this.setContext(context);
|
|
86
|
+
|
|
87
|
+
verifies = true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}, context);
|
|
91
|
+
|
|
92
|
+
if (verifies) {
|
|
93
|
+
context.debug(`...verified the '${stepString}' step.`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return verifies;
|
|
97
|
+
}
|
|
98
|
+
|
|
69
99
|
validate(context) {
|
|
70
100
|
let validates = false;
|
|
71
101
|
|
|
@@ -147,68 +177,6 @@ export default define(class Step extends ProofAssertion {
|
|
|
147
177
|
return satisfiesAssertionValidates;
|
|
148
178
|
}
|
|
149
179
|
|
|
150
|
-
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
151
|
-
let unifiesWithSatisfiesAssertion = false;
|
|
152
|
-
|
|
153
|
-
const stepString = this.getString(), ///
|
|
154
|
-
satisfiesAssertionString = satisfiesAssertion.getString();
|
|
155
|
-
|
|
156
|
-
context.trace(`Unifying the '${stepString}' step with the '${satisfiesAssertionString}' satisfies assertion...`);
|
|
157
|
-
|
|
158
|
-
const reference = satisfiesAssertion.getReference(),
|
|
159
|
-
axiom = context.findAxiomByReference(reference);
|
|
160
|
-
|
|
161
|
-
if (axiom !== null) {
|
|
162
|
-
const step = this, ///
|
|
163
|
-
substitutions = [],
|
|
164
|
-
stepUnifies = axiom.unifyStep(step, substitutions, context);
|
|
165
|
-
|
|
166
|
-
if (stepUnifies) {
|
|
167
|
-
const substitutionsCompare = satisfiesAssertion.compareSubstitutions(substitutions, context);
|
|
168
|
-
|
|
169
|
-
if (substitutionsCompare) {
|
|
170
|
-
unifiesWithSatisfiesAssertion = true;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
if (unifiesWithSatisfiesAssertion) {
|
|
176
|
-
context.debug(`...unified the '${stepString}' step with the '${satisfiesAssertionString}' satisfies assertion.`);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return unifiesWithSatisfiesAssertion;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
async verify(context) {
|
|
183
|
-
let verifies = false;
|
|
184
|
-
|
|
185
|
-
await this.break(context);
|
|
186
|
-
|
|
187
|
-
const stepString = this.getString(); ///
|
|
188
|
-
|
|
189
|
-
context.trace(`Verifying the '${stepString}' step...`);
|
|
190
|
-
|
|
191
|
-
await asyncAttempt(async (context) => {
|
|
192
|
-
const validates = this.validate(context);
|
|
193
|
-
|
|
194
|
-
if (validates) {
|
|
195
|
-
const unifies = await this.unify(context);
|
|
196
|
-
|
|
197
|
-
if (unifies) {
|
|
198
|
-
this.setContext(context);
|
|
199
|
-
|
|
200
|
-
verifies = true;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}, context);
|
|
204
|
-
|
|
205
|
-
if (verifies) {
|
|
206
|
-
context.debug(`...verified the '${stepString}' step.`);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return verifies;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
180
|
async unify(context) {
|
|
213
181
|
let unifies = false;
|
|
214
182
|
|
|
@@ -242,5 +210,37 @@ export default define(class Step extends ProofAssertion {
|
|
|
242
210
|
return unifies;
|
|
243
211
|
}
|
|
244
212
|
|
|
213
|
+
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
214
|
+
let unifiesWithSatisfiesAssertion = false;
|
|
215
|
+
|
|
216
|
+
const stepString = this.getString(), ///
|
|
217
|
+
satisfiesAssertionString = satisfiesAssertion.getString();
|
|
218
|
+
|
|
219
|
+
context.trace(`Unifying the '${stepString}' step with the '${satisfiesAssertionString}' satisfies assertion...`);
|
|
220
|
+
|
|
221
|
+
const reference = satisfiesAssertion.getReference(),
|
|
222
|
+
axiom = context.findAxiomByReference(reference);
|
|
223
|
+
|
|
224
|
+
if (axiom !== null) {
|
|
225
|
+
const step = this, ///
|
|
226
|
+
substitutions = [],
|
|
227
|
+
stepUnifies = axiom.unifyStep(step, substitutions, context);
|
|
228
|
+
|
|
229
|
+
if (stepUnifies) {
|
|
230
|
+
const substitutionsCompare = satisfiesAssertion.compareSubstitutions(substitutions, context);
|
|
231
|
+
|
|
232
|
+
if (substitutionsCompare) {
|
|
233
|
+
unifiesWithSatisfiesAssertion = true;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (unifiesWithSatisfiesAssertion) {
|
|
239
|
+
context.debug(`...unified the '${stepString}' step with the '${satisfiesAssertionString}' satisfies assertion.`);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return unifiesWithSatisfiesAssertion;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
245
|
static name = "Step";
|
|
246
246
|
});
|
|
@@ -30,6 +30,32 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
30
30
|
return stated;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
async verify(context) {
|
|
34
|
+
let verifies = false;
|
|
35
|
+
|
|
36
|
+
await this.break(context);
|
|
37
|
+
|
|
38
|
+
const suppositionString = this.getString(); ///
|
|
39
|
+
|
|
40
|
+
context.trace(`Verifying the '${suppositionString}' supposition...`);
|
|
41
|
+
|
|
42
|
+
attempt((context) => {
|
|
43
|
+
const validates = this.validate(context);
|
|
44
|
+
|
|
45
|
+
if (validates) {
|
|
46
|
+
this.setContext(context);
|
|
47
|
+
|
|
48
|
+
verifies = true;
|
|
49
|
+
}
|
|
50
|
+
}, context);
|
|
51
|
+
|
|
52
|
+
if (verifies) {
|
|
53
|
+
context.debug(`...verified the '${suppositionString}' supposition.`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return verifies;
|
|
57
|
+
}
|
|
58
|
+
|
|
33
59
|
validate(context) {
|
|
34
60
|
let validates = false;
|
|
35
61
|
|
|
@@ -216,32 +242,6 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
216
242
|
return subproofUnifies;
|
|
217
243
|
}
|
|
218
244
|
|
|
219
|
-
async verify(context) {
|
|
220
|
-
let verifies = false;
|
|
221
|
-
|
|
222
|
-
await this.break(context);
|
|
223
|
-
|
|
224
|
-
const suppositionString = this.getString(); ///
|
|
225
|
-
|
|
226
|
-
context.trace(`Verifying the '${suppositionString}' supposition...`);
|
|
227
|
-
|
|
228
|
-
attempt((context) => {
|
|
229
|
-
const validates = this.validate(context);
|
|
230
|
-
|
|
231
|
-
if (validates) {
|
|
232
|
-
this.setContext(context);
|
|
233
|
-
|
|
234
|
-
verifies = true;
|
|
235
|
-
}
|
|
236
|
-
}, context);
|
|
237
|
-
|
|
238
|
-
if (verifies) {
|
|
239
|
-
context.debug(`...verified the '${suppositionString}' supposition.`);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return verifies;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
245
|
async unifyIndependently(context) {
|
|
246
246
|
let unifiesIndependently = false;
|
|
247
247
|
|
|
@@ -299,24 +299,7 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
299
299
|
static name = "Supposition";
|
|
300
300
|
|
|
301
301
|
static fromJSON(json, context) {
|
|
302
|
-
|
|
303
|
-
procedureCall = procedureCallFromJSON(json, context);
|
|
304
|
-
|
|
305
|
-
let string;
|
|
306
|
-
|
|
307
|
-
if (statement !== null) {
|
|
308
|
-
string = statement.getString();
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
if (procedureCall !== null) {
|
|
312
|
-
string = procedureCall.getString();
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const node = null;
|
|
316
|
-
|
|
317
|
-
const supposition = new Supposition(context, string, node, statement, procedureCall);
|
|
318
|
-
|
|
319
|
-
return supposition;
|
|
302
|
+
debugger
|
|
320
303
|
}
|
|
321
304
|
});
|
|
322
305
|
|
package/src/element/property.js
CHANGED
|
@@ -53,11 +53,6 @@ export default define(class Property extends Element {
|
|
|
53
53
|
static name = "Property";
|
|
54
54
|
|
|
55
55
|
static fromJSON(json, context) {
|
|
56
|
-
|
|
57
|
-
string = name, ///
|
|
58
|
-
node = null,
|
|
59
|
-
property = new Property(context, string, node, name, nominalTypeName);
|
|
60
|
-
|
|
61
|
-
return property;
|
|
56
|
+
debugger
|
|
62
57
|
}
|
|
63
58
|
});
|
package/src/element/reference.js
CHANGED
|
@@ -304,11 +304,6 @@ export default define(class Reference extends Element {
|
|
|
304
304
|
static name = "Reference";
|
|
305
305
|
|
|
306
306
|
static fromJSON(json, context) {
|
|
307
|
-
|
|
308
|
-
string = metavariable.getString(),
|
|
309
|
-
node = metavariable.getNode(),
|
|
310
|
-
reference = new Reference(context, string, node, metavariable);
|
|
311
|
-
|
|
312
|
-
return reference;
|
|
307
|
+
debugger
|
|
313
308
|
}
|
|
314
309
|
});
|
package/src/element/rule.js
CHANGED
|
@@ -5,12 +5,7 @@ import { Element, asynchronousUtilities } from "occam-languages";
|
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
7
|
import { asyncScope } from "../utilities/context";
|
|
8
|
-
import { labelsFromJSON,
|
|
9
|
-
premisesFromJSON,
|
|
10
|
-
conclusionFromJSON,
|
|
11
|
-
labelsToLabelsJSON,
|
|
12
|
-
premisesToPremisesJSON,
|
|
13
|
-
conclusionToConclusionJSON } from "../utilities/json";
|
|
8
|
+
import { labelsFromJSON, premisesFromJSON, conclusionFromJSON, labelsToLabelsJSON, premisesToPremisesJSON, conclusionToConclusionJSON } from "../utilities/json";
|
|
14
9
|
|
|
15
10
|
const { reverse, extract } = arrayUtilities,
|
|
16
11
|
{ asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
|
|
@@ -307,16 +302,13 @@ export default define(class Rule extends Element {
|
|
|
307
302
|
static name = "Rule";
|
|
308
303
|
|
|
309
304
|
static fromJSON(json, context) {
|
|
310
|
-
let rule;
|
|
311
|
-
|
|
312
305
|
const node = null,
|
|
313
306
|
proof = null,
|
|
307
|
+
string = null,
|
|
314
308
|
labels = labelsFromJSON(json, context),
|
|
315
309
|
premises = premisesFromJSON(json, context),
|
|
316
310
|
conclusion = conclusionFromJSON(json, context),
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
rule = new Rule(context, string, node, labels, premises, conclusion, proof);
|
|
311
|
+
rule = new Rule(context, string, node, proof, labels, premises, conclusion);
|
|
320
312
|
|
|
321
313
|
return rule;
|
|
322
314
|
}
|
package/src/element/section.js
CHANGED
|
@@ -42,18 +42,6 @@ export default define(class Section extends Element {
|
|
|
42
42
|
return sectionNode;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
verifyHypotheses() {
|
|
46
|
-
const hypothesesVerify = this.hypotheses.every((hypothesis) => {
|
|
47
|
-
const hypothesisVerifies = hypothesis.verify(this.context);
|
|
48
|
-
|
|
49
|
-
if (hypothesisVerifies) {
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
return hypothesesVerify;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
45
|
async verify() {
|
|
58
46
|
let verifies = false;
|
|
59
47
|
|
|
@@ -82,5 +70,17 @@ export default define(class Section extends Element {
|
|
|
82
70
|
return verifies;
|
|
83
71
|
}
|
|
84
72
|
|
|
73
|
+
verifyHypotheses() {
|
|
74
|
+
const hypothesesVerify = this.hypotheses.every((hypothesis) => {
|
|
75
|
+
const hypothesisVerifies = hypothesis.verify(this.context);
|
|
76
|
+
|
|
77
|
+
if (hypothesisVerifies) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
return hypothesesVerify;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
85
|
static name = "Section";
|
|
86
86
|
});
|
package/src/element/signature.js
CHANGED
|
@@ -170,12 +170,6 @@ export default define(class Signature extends Element {
|
|
|
170
170
|
static name = "Signature";
|
|
171
171
|
|
|
172
172
|
static fromJSON(json, context) {
|
|
173
|
-
|
|
174
|
-
signatureString = signatureStringFromTerms(terms),
|
|
175
|
-
string = signatureString, ///
|
|
176
|
-
node = null,
|
|
177
|
-
signature = new Signature(context, string, node, terms);
|
|
178
|
-
|
|
179
|
-
return signature;
|
|
173
|
+
debugger
|
|
180
174
|
}
|
|
181
175
|
});
|
package/src/element/statement.js
CHANGED
|
@@ -4,8 +4,10 @@ import { Element } from "occam-languages";
|
|
|
4
4
|
import { arrayUtilities } from "necessary";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
+
import { literally } from "../utilities/context";
|
|
7
8
|
import { unifyStatement } from "../process/unify";
|
|
8
9
|
import { validateStatements } from "../utilities/validation";
|
|
10
|
+
import { instantiateStatement } from "../process/instantiate";
|
|
9
11
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
10
12
|
|
|
11
13
|
const { match, backwardsSome } = arrayUtilities;
|
|
@@ -345,6 +347,16 @@ export default define(class Statement extends Element {
|
|
|
345
347
|
static name = "Statement";
|
|
346
348
|
|
|
347
349
|
static fromJSON(json, context) {
|
|
348
|
-
|
|
350
|
+
const statement = literally((context) => {
|
|
351
|
+
const { string } = json,
|
|
352
|
+
statementNode = instantiateStatement(string, context),
|
|
353
|
+
node = statementNode, ///
|
|
354
|
+
statement = new Statement(context, string, node);
|
|
355
|
+
|
|
356
|
+
return statement;
|
|
357
|
+
|
|
358
|
+
}, context);
|
|
359
|
+
|
|
360
|
+
return statement;
|
|
349
361
|
}
|
|
350
362
|
});
|
package/src/element/subproof.js
CHANGED
|
@@ -54,6 +54,12 @@ export default define(class Subproof extends Element {
|
|
|
54
54
|
return proofAssertion;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
compareStatement(statement, context) {
|
|
58
|
+
const statementUnifies = false;
|
|
59
|
+
|
|
60
|
+
return statementUnifies;
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
async verify(context) {
|
|
58
64
|
let verifies = false;
|
|
59
65
|
|
|
@@ -84,12 +90,6 @@ export default define(class Subproof extends Element {
|
|
|
84
90
|
return verifies;
|
|
85
91
|
}
|
|
86
92
|
|
|
87
|
-
compareStatement(statement, context) {
|
|
88
|
-
const statementUnifies = false;
|
|
89
|
-
|
|
90
|
-
return statementUnifies;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
93
|
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
94
94
|
let unifiesWithSatisfiesAssertion = false;
|
|
95
95
|
|
|
@@ -338,7 +338,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
338
338
|
static name = "StatementSubstitution";
|
|
339
339
|
|
|
340
340
|
static fromJSON(json, context) {
|
|
341
|
-
|
|
341
|
+
debugger
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
static fromStatementAndMetavariable(statement, metavariable, context) {
|