occam-verify-cli 1.0.816 → 1.0.817
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/context/file/nominal.js +10 -13
- package/lib/element/rule.js +3 -2
- package/lib/utilities/json.js +13 -102
- package/package.json +1 -1
- package/src/context/file/nominal.js +12 -30
- package/src/element/rule.js +2 -0
- package/src/utilities/json.js +12 -117
|
@@ -11,22 +11,14 @@ import { verifyFile } from "../../process/verify";
|
|
|
11
11
|
import { baseTypeFromNothing } from "../../utilities/type";
|
|
12
12
|
import { findMetaTypeByMetaTypeName } from "../../metaTypes";
|
|
13
13
|
import { typesFromJSON,
|
|
14
|
-
|
|
15
|
-
axiomsFromJSON,
|
|
14
|
+
lemmasFromJSON,
|
|
16
15
|
typesToTypesJSON,
|
|
17
|
-
|
|
18
|
-
theoremsFromJSON,
|
|
19
|
-
lemmasFromNothing,
|
|
20
|
-
axiomsToAxiomsJSON,
|
|
21
|
-
conjecturesFromJSON,
|
|
16
|
+
metaLemmasFromJSON,
|
|
22
17
|
combinatorsFromJSON,
|
|
23
18
|
typePrefixesFromJSON,
|
|
24
19
|
constructorsFromJSON,
|
|
25
20
|
metatheoremsFromJSON,
|
|
26
|
-
metaLemmasFromNothing,
|
|
27
|
-
theoremsToTheoremsJSON,
|
|
28
21
|
declaredVariablesFromJSON,
|
|
29
|
-
conjecturesToConjecturesJSON,
|
|
30
22
|
combinatorsToCombinatorsJSON,
|
|
31
23
|
declaredMetavariablesFromJSON,
|
|
32
24
|
typePrefixesToTypePrefixesJSON,
|
|
@@ -811,40 +803,33 @@ export default class NominalFileContext extends FileContext {
|
|
|
811
803
|
|
|
812
804
|
typesFromJSON(json, this.types, fileContext);
|
|
813
805
|
|
|
814
|
-
this.lemmas =
|
|
815
|
-
this.metaLemmas =
|
|
806
|
+
this.lemmas = lemmasFromJSON(json, fileContext);
|
|
807
|
+
this.metaLemmas = metaLemmasFromJSON(json, fileContext);
|
|
816
808
|
|
|
817
809
|
this.declaredMetavariables = declaredMetavariablesFromJSON(json, fileContext);
|
|
818
810
|
this.declaredVariables = declaredVariablesFromJSON(json, fileContext);
|
|
819
|
-
|
|
820
|
-
this.rules = rulesFromJSON(json, fileContext);
|
|
821
|
-
this.axioms = axiomsFromJSON(json, fileContext);
|
|
822
|
-
this.theorems = theoremsFromJSON(json, fileContext);
|
|
823
|
-
this.conjectures = conjecturesFromJSON(json, fileContext);
|
|
824
|
-
this.combinators = combinatorsFromJSON(json, fileContext);
|
|
825
811
|
this.typePrefixes = typePrefixesFromJSON(json, fileContext);
|
|
812
|
+
this.combinators = combinatorsFromJSON(json, fileContext);
|
|
826
813
|
this.constructors = constructorsFromJSON(json, fileContext);
|
|
827
814
|
this.metatheorems = metatheoremsFromJSON(json, fileContext);
|
|
815
|
+
|
|
816
|
+
// this.rules = rulesFromJSON(json, fileContext);
|
|
817
|
+
// this.axioms = axiomsFromJSON(json, fileContext);
|
|
818
|
+
// this.theorems = theoremsFromJSON(json, fileContext);
|
|
819
|
+
// this.conjectures = conjecturesFromJSON(json, fileContext);
|
|
828
820
|
}
|
|
829
821
|
|
|
830
822
|
toJSON() {
|
|
831
823
|
const typesJSON = typesToTypesJSON(this.types),
|
|
832
|
-
rulesJSON = rulesToRulesJSON(this.rules),
|
|
833
|
-
axiomsJSON = axiomsToAxiomsJSON(this.axioms),
|
|
834
|
-
theoremsJSON = theoremsToTheoremsJSON(this.theorems),
|
|
835
|
-
conjecturesJSON = conjecturesToConjecturesJSON(this.conjectures),
|
|
836
824
|
combinatorsJSON = combinatorsToCombinatorsJSON(this.combinators),
|
|
837
825
|
typePrefixesJSON = typePrefixesToTypePrefixesJSON(this.typePrefixes),
|
|
838
826
|
constructorsJSON = constructorsToConstructorsJSON(this.constructors),
|
|
839
827
|
metatheoremsJSON = metatheoremsToMetatheoremsJSON(this.metatheorems),
|
|
840
828
|
declaredVariablesJSON = declaredVariablesToDeclaredVariablesJSON(this.declaredVariables),
|
|
841
829
|
declaredMetavariablesJSON = declaredMetavariablesToDeclaredMetavariablesJSON(this.declaredMetavariables),
|
|
830
|
+
fileContent = this.fileContent,
|
|
842
831
|
filePath = this.filePath,
|
|
843
832
|
types = typesJSON, ///
|
|
844
|
-
rules = rulesJSON, ///
|
|
845
|
-
axioms = axiomsJSON, ///
|
|
846
|
-
theorems = theoremsJSON, ///
|
|
847
|
-
conjectures = conjecturesJSON, ///
|
|
848
833
|
combinators = combinatorsJSON, ///
|
|
849
834
|
typePrefixes = typePrefixesJSON, ///
|
|
850
835
|
constructors = constructorsJSON, ///
|
|
@@ -852,12 +837,9 @@ export default class NominalFileContext extends FileContext {
|
|
|
852
837
|
declaredVariables = declaredVariablesJSON, ///
|
|
853
838
|
declaredMetavariables = declaredMetavariablesJSON, ///
|
|
854
839
|
json = {
|
|
840
|
+
fileContent,
|
|
855
841
|
filePath,
|
|
856
842
|
types,
|
|
857
|
-
rules,
|
|
858
|
-
axioms,
|
|
859
|
-
theorems,
|
|
860
|
-
conjectures,
|
|
861
843
|
combinators,
|
|
862
844
|
typePrefixes,
|
|
863
845
|
constructors,
|
package/src/element/rule.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Element, asynchronousUtilities } from "occam-languages";
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
7
|
import { enclose } from "../utilities/context";
|
|
8
8
|
import { labelsFromJSON, premisesFromJSON, conclusionFromJSON, labelsToLabelsJSON, premisesToPremisesJSON, conclusionToConclusionJSON } from "../utilities/json";
|
|
9
|
+
import {rulsStringFromLabelsPremisesAndConclusion} from "../utilities/string";
|
|
9
10
|
|
|
10
11
|
const { reverse } = arrayUtilities,
|
|
11
12
|
{ asyncExtract, asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
|
|
@@ -343,6 +344,7 @@ export default define(class Rule extends Element {
|
|
|
343
344
|
labels = labelsFromJSON(json, context),
|
|
344
345
|
premises = premisesFromJSON(json, context),
|
|
345
346
|
conclusion = conclusionFromJSON(json, context),
|
|
347
|
+
ruleString = rulsStringFromLabelsPremisesAndConclusion(labels, premises, conclusion),
|
|
346
348
|
rule = new Rule(context, string, node, proof, labels, premises, conclusion);
|
|
347
349
|
|
|
348
350
|
return rule;
|
package/src/utilities/json.js
CHANGED
|
@@ -2,19 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import elements from "../elements";
|
|
4
4
|
import EphemeralContext from "../context/ephemeral";
|
|
5
|
-
import Substitution from "../element/substitution";
|
|
6
|
-
|
|
7
|
-
export function lemmasFromNothing() {
|
|
8
|
-
const lemmas = [];
|
|
9
|
-
|
|
10
|
-
return lemmas;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function metaLemmasFromNothing() {
|
|
14
|
-
const metaLemmas = [];
|
|
15
|
-
|
|
16
|
-
return metaLemmas;
|
|
17
|
-
}
|
|
18
5
|
|
|
19
6
|
export function nameFromJSON(json, context) {
|
|
20
7
|
let { name } = json;
|
|
@@ -86,6 +73,12 @@ export function frameFromJSON(json, context) {
|
|
|
86
73
|
return frame;
|
|
87
74
|
}
|
|
88
75
|
|
|
76
|
+
export function lemmasFromJSON(json, context) {
|
|
77
|
+
const lemmas = [];
|
|
78
|
+
|
|
79
|
+
return lemmas;
|
|
80
|
+
}
|
|
81
|
+
|
|
89
82
|
export function negatedFromJSON(json, context) {
|
|
90
83
|
const { negated } = json;
|
|
91
84
|
|
|
@@ -186,6 +179,12 @@ export function conclusionFromJSON(json, context) {
|
|
|
186
179
|
return conclusion;
|
|
187
180
|
}
|
|
188
181
|
|
|
182
|
+
export function metaLemmasFromJSON(json, context) {
|
|
183
|
+
const metaLemmas = [];
|
|
184
|
+
|
|
185
|
+
return metaLemmas;
|
|
186
|
+
}
|
|
187
|
+
|
|
189
188
|
export function provisionalFromJSON(json, context) {
|
|
190
189
|
const { provisional } = json;
|
|
191
190
|
|
|
@@ -268,22 +267,6 @@ export function termsFromJSON(json, context) {
|
|
|
268
267
|
return terms;
|
|
269
268
|
}
|
|
270
269
|
|
|
271
|
-
export function rulesFromJSON(json, context) {
|
|
272
|
-
let { rules } = json;
|
|
273
|
-
|
|
274
|
-
const { Rule } = elements,
|
|
275
|
-
rulesJSON = rules; ///
|
|
276
|
-
|
|
277
|
-
rules = rulesJSON.map((ruleJSON) => {
|
|
278
|
-
const json = ruleJSON, ///
|
|
279
|
-
rule = Rule.fromJSON(json, context);
|
|
280
|
-
|
|
281
|
-
return rule;
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
return rules;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
270
|
export function framesFromJSON(json, context) {
|
|
288
271
|
let { frames } = json;
|
|
289
272
|
|
|
@@ -316,22 +299,6 @@ export function labelsFromJSON(json, context) {
|
|
|
316
299
|
return labels;
|
|
317
300
|
}
|
|
318
301
|
|
|
319
|
-
export function axiomsFromJSON(json, context) {
|
|
320
|
-
let { axioms } = json;
|
|
321
|
-
|
|
322
|
-
const { Axiom } = elements,
|
|
323
|
-
axiomsJSON = axioms; ///
|
|
324
|
-
|
|
325
|
-
axioms = axiomsJSON.map((axiomJSON) => {
|
|
326
|
-
const json = axiomJSON, ///
|
|
327
|
-
axiom = Axiom.fromJSON(json, context);
|
|
328
|
-
|
|
329
|
-
return axiom;
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
return axioms;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
302
|
export function premisesFromJSON(json, context) {
|
|
336
303
|
let { premises } = json;
|
|
337
304
|
|
|
@@ -348,22 +315,6 @@ export function premisesFromJSON(json, context) {
|
|
|
348
315
|
return premises;
|
|
349
316
|
}
|
|
350
317
|
|
|
351
|
-
export function theoremsFromJSON(json, context) {
|
|
352
|
-
let { theorems } = json;
|
|
353
|
-
|
|
354
|
-
const { Theorem } = elements,
|
|
355
|
-
theoremsJSON = theorems; ///
|
|
356
|
-
|
|
357
|
-
theorems = theoremsJSON.map((theoremJSON) => {
|
|
358
|
-
const json = theoremJSON, ///
|
|
359
|
-
theorem = Theorem.fromJSON(json, context);
|
|
360
|
-
|
|
361
|
-
return theorem;
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
return theorems;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
318
|
export function variablesFromJSON(json, context) {
|
|
368
319
|
let { variables } = json;
|
|
369
320
|
|
|
@@ -529,22 +480,6 @@ export function referencesFromJSON(json, context) {
|
|
|
529
480
|
return references;
|
|
530
481
|
}
|
|
531
482
|
|
|
532
|
-
export function conjecturesFromJSON(json, context) {
|
|
533
|
-
let { conjectures } = json;
|
|
534
|
-
|
|
535
|
-
const { Conjecture } = elements,
|
|
536
|
-
conjecturesJSON = conjectures; ///
|
|
537
|
-
|
|
538
|
-
conjectures = conjecturesJSON.map((conjectureJSON) => {
|
|
539
|
-
const json = conjectureJSON, ///
|
|
540
|
-
conjecture = Conjecture.fromJSON(json, context);
|
|
541
|
-
|
|
542
|
-
return conjecture;
|
|
543
|
-
});
|
|
544
|
-
|
|
545
|
-
return conjectures;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
483
|
export function combinatorsFromJSON(json, context) {
|
|
549
484
|
let { combinators } = json;
|
|
550
485
|
|
|
@@ -922,16 +857,6 @@ export function typesToTypesJSON(types) {
|
|
|
922
857
|
return typesJSON;
|
|
923
858
|
}
|
|
924
859
|
|
|
925
|
-
export function rulesToRulesJSON(rules) {
|
|
926
|
-
const rulesJSON = rules.map((rule) => {
|
|
927
|
-
const ruleJSON = rule.toJSON();
|
|
928
|
-
|
|
929
|
-
return ruleJSON;
|
|
930
|
-
});
|
|
931
|
-
|
|
932
|
-
return rulesJSON;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
860
|
export function labelsToLabelsJSON(labels) {
|
|
936
861
|
const labelsJSON = labels.map((label) => {
|
|
937
862
|
const labelJSON = label.toJSON();
|
|
@@ -952,16 +877,6 @@ export function framesToFramesJSON(frames) {
|
|
|
952
877
|
return framesJSON;
|
|
953
878
|
}
|
|
954
879
|
|
|
955
|
-
export function axiomsToAxiomsJSON(axioms) {
|
|
956
|
-
const axiomsJSON = axioms.map((axiom) => {
|
|
957
|
-
const axiomJSON = axiom.toJSON();
|
|
958
|
-
|
|
959
|
-
return axiomJSON;
|
|
960
|
-
});
|
|
961
|
-
|
|
962
|
-
return axiomsJSON;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
880
|
export function premisesToPremisesJSON(premises) {
|
|
966
881
|
const premisesJSON = premises.map((premise) => {
|
|
967
882
|
const premiseJSON = premise.toJSON();
|
|
@@ -972,16 +887,6 @@ export function premisesToPremisesJSON(premises) {
|
|
|
972
887
|
return premisesJSON;
|
|
973
888
|
}
|
|
974
889
|
|
|
975
|
-
export function theoremsToTheoremsJSON(theorems) {
|
|
976
|
-
const theoremsJSON = theorems.map((theorem) => {
|
|
977
|
-
const theoremJSON = theorem.toJSON();
|
|
978
|
-
|
|
979
|
-
return theoremJSON;
|
|
980
|
-
});
|
|
981
|
-
|
|
982
|
-
return theoremsJSON;
|
|
983
|
-
}
|
|
984
|
-
|
|
985
890
|
export function variablesToVariablesJSON(variables) {
|
|
986
891
|
const variablesJSON = variables.map((variable) => {
|
|
987
892
|
const variableJSON = variable.toJSON();
|
|
@@ -1082,16 +987,6 @@ export function referencesToReferencesJSON(references) {
|
|
|
1082
987
|
return referencesJSON;
|
|
1083
988
|
}
|
|
1084
989
|
|
|
1085
|
-
export function conjecturesToConjecturesJSON(conjectures) {
|
|
1086
|
-
const conjecturesJSON = conjectures.map((conjecture) => {
|
|
1087
|
-
const conjectureJSON = conjecture.toJSON();
|
|
1088
|
-
|
|
1089
|
-
return conjectureJSON;
|
|
1090
|
-
});
|
|
1091
|
-
|
|
1092
|
-
return conjecturesJSON;
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
990
|
export function combinatorsToCombinatorsJSON(combinators) {
|
|
1096
991
|
const combinatorsJSON = combinators.map((combinator) => {
|
|
1097
992
|
const combinatorJSON = combinator.toJSON();
|