occam-verify-cli 0.0.543 → 0.0.544

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.
@@ -16,16 +16,6 @@ import Metavariable from "../metavariable";
16
16
  import { push, filter } from "../utilities/array";
17
17
  import { statementMetaType } from "../metaType";
18
18
  import { nodeAsString, nodesAsString } from "../utilities/string";
19
- import { TYPE_KIND,
20
- RULE_KIND,
21
- AXIOM_KIND,
22
- LEMMA_KIND,
23
- THEOREM_KIND,
24
- VARIABLE_KIND,
25
- CONJECTURE_KIND,
26
- COMBINATOR_KIND,
27
- CONSTRUCTOR_KIND,
28
- METAVARIABLE_KIND } from "../kinds";
29
19
 
30
20
  const metaTypes = [
31
21
  statementMetaType
@@ -502,159 +492,185 @@ export default class FileContext {
502
492
  fatal(message, node) { this.releaseContext.fatal(message, node, this.tokens, this.filePath); }
503
493
 
504
494
  toJSON() {
505
- const json = [];
495
+ const filePath = this.filePath,
496
+ types = this.types.map((type) => {
497
+ const typeJSON = type.toJSON(this.tokens);
506
498
 
507
- this.types.forEach((type) => {
508
- const typeJSON = type.toJSON(this.tokens);
499
+ type = typeJSON; ///
509
500
 
510
- json.push(typeJSON);
511
- });
501
+ return type;
502
+ }),
503
+ rules = this.rules.map((rule) => {
504
+ const ruleJSON = rule.toJSON(this.tokens);
512
505
 
513
- this.rules.forEach((rule) => {
514
- const ruleJSON = rule.toJSON(this.tokens);
506
+ rule = ruleJSON; ///
515
507
 
516
- json.push(ruleJSON);
517
- });
508
+ return rule;
509
+ }),
510
+ axioms = this.axioms.map((axiom) => {
511
+ const axiomJSON = axiom.toJSON(this.tokens);
518
512
 
519
- this.axioms.forEach((axiom) => {
520
- const axiomJSON = axiom.toJSON(this.tokens);
513
+ axiom = axiomJSON; ///
521
514
 
522
- json.push(axiomJSON);
523
- });
515
+ return axiom;
516
+ }),
517
+ lemmas = this.lemmas.map((lemma) => {
518
+ const lemmaJSON = lemma.toJSON(this.tokens);
524
519
 
525
- this.lemmas.forEach((lemma) => {
526
- const lemmaJSON = lemma.toJSON(this.tokens);
520
+ lemma = lemmaJSON; ///
527
521
 
528
- json.push(lemmaJSON);
529
- });
522
+ return lemma;
523
+ }),
524
+ theorems = this.theorems.map((theorem) => {
525
+ const theoremJSON = theorem.toJSON(this.tokens);
530
526
 
531
- this.theorems.forEach((theorem) => {
532
- const theoremJSON = theorem.toJSON(this.tokens);
527
+ theorem = theoremJSON; ///
533
528
 
534
- json.push(theoremJSON);
535
- });
529
+ return theorem;
530
+ }),
531
+ variables = this.variables.map((variable) => {
532
+ const variableJSON = variable.toJSON(this.tokens);
536
533
 
537
- this.variables.forEach((variable) => {
538
- const variableJSON = variable.toJSON(this.tokens);
534
+ variable = variableJSON; ///
539
535
 
540
- json.push(variableJSON)
541
- });
536
+ return variable;
537
+ }),
538
+ conjectures = this.conjectures.map((conjecture) => {
539
+ const conjectureJSON = conjecture.toJSON(this.tokens);
542
540
 
543
- this.conjectures.forEach((conjecture) => {
544
- const conjectureJSON = conjecture.toJSON(this.tokens);
541
+ conjecture = conjectureJSON; ///
545
542
 
546
- json.push(conjectureJSON);
547
- });
543
+ return conjecture;
544
+ }),
545
+ combinators = this.combinators.map((combinator) => {
546
+ const combinatorJSON = combinator.toJSON(this.tokens);
548
547
 
549
- this.combinators.forEach((combinator) => {
550
- const combinatorJSON = combinator.toJSON(this.tokens);
548
+ combinator = combinatorJSON; ///
551
549
 
552
- json.push(combinatorJSON);
553
- });
550
+ return combinator;
551
+ }),
552
+ constructors = this.constructors.map((constructor) => {
553
+ const constructorJSON = constructor.toJSON(this.tokens);
554
554
 
555
- this.constructors.forEach((constructor) => {
556
- const constructorJSON = constructor.toJSON(this.tokens);
555
+ constructor = constructorJSON; ///
557
556
 
558
- json.push(constructorJSON)
559
- });
557
+ return constructor;
558
+ }),
559
+ metavariables = this.metavariables.map((metavariable) => {
560
+ const metavariableJSON = metavariable.toJSON(this.tokens);
560
561
 
561
- this.metavariables.forEach((metavariable) => {
562
- const metavariableJSON = metavariable.toJSON(this.tokens);
562
+ metavariable = metavariableJSON; ///
563
563
 
564
- json.push(metavariableJSON)
565
- });
564
+ return metavariable;
565
+ }),
566
+ json = {
567
+ filePath,
568
+ types,
569
+ rules,
570
+ axioms,
571
+ lemmas,
572
+ theorems,
573
+ variables,
574
+ conjectures,
575
+ combinators,
576
+ constructors,
577
+ metavariables
578
+ };
566
579
 
567
580
  return json;
568
581
  }
569
582
 
570
583
  initialise(json) {
571
- const jsonArray = json, ///
572
- fileContext = this; ///
573
-
574
- jsonArray.forEach((json) => {
575
- const { kind } = json;
576
-
577
- switch (kind) {
578
- case TYPE_KIND: {
579
- const type = Type.fromJSONAndFileContext(json, fileContext);
580
-
581
- this.types.push(type);
582
-
583
- break;
584
- }
585
-
586
- case RULE_KIND: {
587
- const rule = Rule.fromJSONAndFileContext(json, fileContext);
588
-
589
- this.rules.push(rule);
590
-
591
- break;
592
- }
593
-
594
- case AXIOM_KIND: {
595
- const axiom = Axiom.fromJSONAndFileContext(json, fileContext);
596
-
597
- this.axioms.push(axiom);
598
-
599
- break;
600
- }
601
-
602
- case LEMMA_KIND: {
603
- const lemma = Lemma.fromJSONAndFileContext(json, fileContext);
604
-
605
- this.lemmas.push(lemma);
606
-
607
- break;
608
- }
584
+ const fileContext = this, ///
585
+ { types,
586
+ rules,
587
+ axioms,
588
+ lemmas,
589
+ theorems,
590
+ variables,
591
+ conjectures,
592
+ combinators,
593
+ constructors,
594
+ metavariables } = json,
595
+ typesJSON = types,
596
+ rulesJSON = rules,
597
+ axiomsJSON = axioms,
598
+ lemmasJSON = lemmas,
599
+ theoremsJSON = theorems,
600
+ variablesJSON = variables,
601
+ conjecturesJSON = conjectures,
602
+ combinatorsJSON = combinators,
603
+ constructorsJSON = constructors,
604
+ metavariablesJSON = metavariables;
605
+
606
+ typesJSON.forEach((typeJSON) => {
607
+ const json = typeJSON, ///
608
+ type = Type.fromJSONAndFileContext(json, fileContext);
609
+
610
+ this.types.push(type);
611
+ });
609
612
 
610
- case THEOREM_KIND: {
611
- const theorem = Theorem.fromJSONAndFileContext(json, fileContext);
613
+ rulesJSON.forEach((ruleJSON) => {
614
+ const json = ruleJSON, ///
615
+ rule = Rule.fromJSONAndFileContext(json, fileContext);
612
616
 
613
- this.theorems.push(theorem);
617
+ this.rules.push(rule);
618
+ });
614
619
 
615
- break;
616
- }
620
+ axiomsJSON.forEach((axiomJSON) => {
621
+ const json = axiomJSON, ///
622
+ axiom = Axiom.fromJSONAndFileContext(json, fileContext);
617
623
 
618
- case VARIABLE_KIND: {
619
- const variable = Variable.fromJSONAndFileContext(json, fileContext);
624
+ this.axioms.push(axiom);
625
+ });
620
626
 
621
- this.variables.push(variable);
627
+ lemmasJSON.forEach((lemmaJSON) => {
628
+ const json = lemmaJSON, ///
629
+ lemma = Lemma.fromJSONAndFileContext(json, fileContext);
622
630
 
623
- break;
624
- }
631
+ this.lemmas.push(lemma);
632
+ });
625
633
 
626
- case CONJECTURE_KIND: {
627
- const conjecture = Conjecture.fromJSONAndFileContext(json, fileContext);
634
+ theoremsJSON.forEach((theoremJSON) => {
635
+ const json = theoremJSON, ///
636
+ theorem = Theorem.fromJSONAndFileContext(json, fileContext);
628
637
 
629
- this.conjectures.push(conjecture);
638
+ this.theorems.push(theorem);
639
+ });
630
640
 
631
- break;
632
- }
641
+ variablesJSON.forEach((variableJSON) => {
642
+ const json = variableJSON, ///
643
+ variable = Variable.fromJSONAndFileContext(json, fileContext);
633
644
 
634
- case COMBINATOR_KIND: {
635
- const combinator = Combinator.fromJSONAndFileContext(json, fileContext);
645
+ this.variables.push(variable);
646
+ });
636
647
 
637
- this.combinators.push(combinator);
648
+ conjecturesJSON.forEach((conjectureJSON) => {
649
+ const json = conjectureJSON, ///
650
+ conjecture = Conjecture.fromJSONAndFileContext(json, fileContext);
638
651
 
639
- break;
640
- }
652
+ this.conjectures.push(conjecture);
653
+ });
641
654
 
642
- case CONSTRUCTOR_KIND: {
643
- const constructor = Constructor.fromJSONAndFileContext(json, fileContext);
655
+ combinatorsJSON.forEach((combinatorJSON) => {
656
+ const json = combinatorJSON, ///
657
+ combinator = Combinator.fromJSONAndFileContext(json, fileContext);
644
658
 
645
- this.constructors.push(constructor);
659
+ this.combinators.push(combinator);
660
+ });
646
661
 
647
- break;
648
- }
662
+ constructorsJSON.forEach((constructorJSON) => {
663
+ const json = constructorJSON, ///
664
+ constructor = Constructor.fromJSONAndFileContext(json, fileContext);
649
665
 
650
- case METAVARIABLE_KIND: {
651
- const metavariable = Metavariable.fromJSONAndFileContext(json, fileContext);
666
+ this.constructors.push(constructor);
667
+ });
652
668
 
653
- this.metavariables.push(metavariable);
669
+ metavariablesJSON.forEach((metavariableJSON) => {
670
+ const json = metavariableJSON, ///
671
+ metavariable = Metavariable.fromJSONAndFileContext(json, fileContext);
654
672
 
655
- break;
656
- }
657
- }
673
+ this.metavariables.push(metavariable);
658
674
  });
659
675
  }
660
676
 
package/src/lemma.js CHANGED
@@ -2,11 +2,7 @@
2
2
 
3
3
  import AxiomLemmaTheoremConjecture from "./axiomLemmaTheoremConjecture";
4
4
 
5
- import { LEMMA_KIND } from "./kinds";
6
-
7
5
  export default class Lemma extends AxiomLemmaTheoremConjecture {
8
- static kind = LEMMA_KIND;
9
-
10
6
  static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Lemma,json, fileContext); }
11
7
 
12
8
  static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions, consequence, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequenceAndProofContext(Lemma, labels, suppositions, consequence, proofContext); }
package/src/metaType.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- import { META_TYPE_KIND } from "./kinds";
4
3
  import { STATEMENT_META_TYPE_NAME } from "./metaTypeNames";
5
4
 
6
5
  export default class MetaType {
@@ -44,10 +43,8 @@ export default class MetaType {
44
43
  }
45
44
 
46
45
  toJSON(tokens) {
47
- const kind = META_TYPE_KIND,
48
- name = this.name,
46
+ const name = this.name,
49
47
  json = {
50
- kind,
51
48
  name
52
49
  };
53
50
 
@@ -2,8 +2,6 @@
2
2
 
3
3
  import MetaType from "./metaType";
4
4
 
5
- import { METAVARIABLE_KIND } from "./kinds";
6
-
7
5
  export default class Metavariable {
8
6
  constructor(name, metaType) {
9
7
  this.name = name;
@@ -26,11 +24,9 @@ export default class Metavariable {
26
24
 
27
25
  toJSON(tokens) {
28
26
  const metaTypeJSON = this.metaType.toJSON(tokens),
29
- kind = METAVARIABLE_KIND,
30
27
  name = this.name, ///
31
28
  metaType = metaTypeJSON, ///
32
29
  json = {
33
- kind,
34
30
  name,
35
31
  metaType
36
32
  };
package/src/rule.js CHANGED
@@ -5,7 +5,6 @@ import Premise from "./premise";
5
5
  import Conclusion from "./conclusion";
6
6
 
7
7
  import { prune } from "./utilities/array";
8
- import { RULE_KIND } from "./kinds";
9
8
  import { someSubArray } from "./utilities/array";
10
9
 
11
10
  export default class Rule {
@@ -125,12 +124,10 @@ export default class Rule {
125
124
  return premiseJSON;
126
125
  }),
127
126
  conclusionJSON = this.conclusion.toJSON(tokens),
128
- kind = RULE_KIND,
129
127
  labels = labelsJSON, ///
130
128
  premises = premisesJSON, ///
131
129
  conclusion = conclusionJSON, ///
132
130
  json = {
133
- kind,
134
131
  labels,
135
132
  premises,
136
133
  conclusion
package/src/theorem.js CHANGED
@@ -2,11 +2,7 @@
2
2
 
3
3
  import AxiomLemmaTheoremConjecture from "./axiomLemmaTheoremConjecture";
4
4
 
5
- import { THEOREM_KIND } from "./kinds";
6
-
7
5
  export default class Theorem extends AxiomLemmaTheoremConjecture {
8
- static kind = THEOREM_KIND;
9
-
10
6
  static fromJSONAndFileContext(json, fileContext) { return AxiomLemmaTheoremConjecture.fromJSONAndFileContext(Theorem, json, fileContext); }
11
7
 
12
8
  static fromLabelsSuppositionsConsequenceAndProofContext(labels, suppositions, consequence, proofContext) { return AxiomLemmaTheoremConjecture.fromLabelsSuppositionsConsequenceAndProofContext(Theorem, labels, suppositions, consequence, proofContext); }
package/src/type.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- import { TYPE_KIND } from "./kinds";
4
3
  import { OBJECT_TYPE_NAME } from "./typeNames";
5
4
 
6
5
  export default class Type {
@@ -121,11 +120,9 @@ export default class Type {
121
120
 
122
121
  toJSON(tokens) {
123
122
  const superTypeJSON = this.superType.toJSON(tokens),
124
- kind = TYPE_KIND,
125
123
  name = this.name,
126
124
  superType = superTypeJSON, ///
127
125
  json = {
128
- kind,
129
126
  name,
130
127
  superType
131
128
  };
@@ -167,11 +164,9 @@ export default class Type {
167
164
 
168
165
  class ObjectType extends Type {
169
166
  toJSON(tokens) {
170
- const kind = TYPE_KIND,
171
- name = this.name,
167
+ const name = this.name,
172
168
  superType = null, ///
173
169
  json = {
174
- kind,
175
170
  name,
176
171
  superType
177
172
  };
package/src/variable.js CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  import Type from "./type";
4
4
 
5
- import { VARIABLE_KIND } from "./kinds";
6
-
7
5
  export default class Variable {
8
6
  constructor(name, type) {
9
7
  this.name = name;
@@ -33,11 +31,9 @@ export default class Variable {
33
31
 
34
32
  toJSON(tokens) {
35
33
  const typeJSON = this.type.toJSON(tokens),
36
- kind = VARIABLE_KIND,
37
34
  name = this.name, ///
38
35
  type = typeJSON, ///
39
36
  json = {
40
- kind,
41
37
  name,
42
38
  type
43
39
  };
package/lib/kinds.js DELETED
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- TYPE_KIND: function() {
13
- return TYPE_KIND;
14
- },
15
- RULE_KIND: function() {
16
- return RULE_KIND;
17
- },
18
- AXIOM_KIND: function() {
19
- return AXIOM_KIND;
20
- },
21
- LEMMA_KIND: function() {
22
- return LEMMA_KIND;
23
- },
24
- THEOREM_KIND: function() {
25
- return THEOREM_KIND;
26
- },
27
- VARIABLE_KIND: function() {
28
- return VARIABLE_KIND;
29
- },
30
- META_TYPE_KIND: function() {
31
- return META_TYPE_KIND;
32
- },
33
- CONJECTURE_KIND: function() {
34
- return CONJECTURE_KIND;
35
- },
36
- COMBINATOR_KIND: function() {
37
- return COMBINATOR_KIND;
38
- },
39
- CONSTRUCTOR_KIND: function() {
40
- return CONSTRUCTOR_KIND;
41
- },
42
- METAVARIABLE_KIND: function() {
43
- return METAVARIABLE_KIND;
44
- }
45
- });
46
- var TYPE_KIND = "type";
47
- var RULE_KIND = "rule";
48
- var AXIOM_KIND = "axiom";
49
- var LEMMA_KIND = "lemma";
50
- var THEOREM_KIND = "theorem";
51
- var VARIABLE_KIND = "variable";
52
- var META_TYPE_KIND = "meta-type";
53
- var CONJECTURE_KIND = "conjecture";
54
- var COMBINATOR_KIND = "combinator";
55
- var CONSTRUCTOR_KIND = "constructor";
56
- var METAVARIABLE_KIND = "metavariable";
57
-
58
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9raW5kcy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuZXhwb3J0IGNvbnN0IFRZUEVfS0lORCA9IFwidHlwZVwiO1xuZXhwb3J0IGNvbnN0IFJVTEVfS0lORCA9IFwicnVsZVwiO1xuZXhwb3J0IGNvbnN0IEFYSU9NX0tJTkQgPSBcImF4aW9tXCI7XG5leHBvcnQgY29uc3QgTEVNTUFfS0lORCA9IFwibGVtbWFcIjtcbmV4cG9ydCBjb25zdCBUSEVPUkVNX0tJTkQgPSBcInRoZW9yZW1cIjtcbmV4cG9ydCBjb25zdCBWQVJJQUJMRV9LSU5EID0gXCJ2YXJpYWJsZVwiO1xuZXhwb3J0IGNvbnN0IE1FVEFfVFlQRV9LSU5EID0gXCJtZX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jtBQUN4QixJQUFNQyxrQkFBa0I7QUFDeEIsSUFBTUMsbUJBQW1CO0FBQ3pCLElBQU1DLG9CQUFvQiJ9
package/src/kinds.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- export const TYPE_KIND = "type";
4
- export const RULE_KIND = "rule";
5
- export const AXIOM_KIND = "axiom";
6
- export const LEMMA_KIND = "lemma";
7
- export const THEOREM_KIND = "theorem";
8
- export const VARIABLE_KIND = "variable";
9
- export const META_TYPE_KIND = "meta-type";
10
- export const CONJECTURE_KIND = "conjecture";
11
- export const COMBINATOR_KIND = "combinator";
12
- export const CONSTRUCTOR_KIND = "constructor";
13
- export const METAVARIABLE_KIND = "metavariable";