occam-verify-cli 0.0.374 → 0.0.375

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/src/rule.js CHANGED
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
2
 
3
+ import Label from "./label";
4
+ import Premise from "./premise";
5
+ import Conclusion from "./conclusion";
6
+
3
7
  import { prune } from "./utilities/array";
4
8
  import { RULE_KIND } from "./kinds";
5
9
  import { someSubArray } from "./utilities/array";
@@ -62,29 +66,57 @@ export default class Rule {
62
66
  }
63
67
 
64
68
  toJSON() {
65
- const premisesJSON = this.premises.map((premise) => {
69
+ const labelsJSON = this.labels.map((label) => {
70
+ const labelJSON = label.toJSON();
71
+
72
+ return labelJSON;
73
+ }),
74
+ premisesJSON = this.premises.map((premise) => {
66
75
  const premiseJSON = premise.toJSON();
67
76
 
68
77
  return premiseJSON;
69
78
  }),
70
79
  conclusionJSON = this.conclusion.toJSON(),
71
80
  kind = RULE_KIND,
81
+ labels = labelsJSON, ///
72
82
  premises = premisesJSON, ///
73
83
  conclusion = conclusionJSON, ///
74
- json = this.labels.map((label) => {
75
- const labelString = label.asString();
84
+ json = {
85
+ kind,
86
+ labels,
87
+ premises,
88
+ conclusion
89
+ };
90
+
91
+ return json;
92
+ }
76
93
 
77
- label = labelString; ///
94
+ static fromJSON(json, callback) {
95
+ let { labels, premises, conclusion } = json;
78
96
 
79
- return ({
80
- kind,
81
- label,
82
- premises,
83
- conclusion
84
- });
85
- });
97
+ labels = labels.map((label) => {
98
+ const json = label; ///
86
99
 
87
- return json;
100
+ label = Label.fromJSON(json, callback);
101
+
102
+ return label;
103
+ });
104
+
105
+ premises = premises.map((premise) => {
106
+ const json = premise; ///
107
+
108
+ premise = Premise.fromJSON(json, callback);
109
+
110
+ return premise;
111
+ });
112
+
113
+ json = conclusion; ///
114
+
115
+ conclusion = Conclusion.fromJSON(json, callback);
116
+
117
+ const rule = new Rule(labels, premises, conclusion);
118
+
119
+ return rule;
88
120
  }
89
121
 
90
122
  static fromLabelsPremisesAndConclusion(labels, premises, conclusion) {
package/src/ruleNames.js CHANGED
@@ -3,6 +3,7 @@
3
3
  export const TERM_RULE_NAME = "term";
4
4
  export const TYPE_RULE_NAME = "type";
5
5
  export const ARGUMENT_RULE_NAME = "argument";
6
+ export const STATEMENT_RULE_NAME = "statement";
6
7
  export const METAVARIABLE_RULE_NAME = "metavariable";
7
8
  export const METASTATEMENT_RULE_NAME = "metastatement";
8
9
  export const META_SUBPROOF_RULE_NAME = "metaSubproof";
package/src/type.js CHANGED
@@ -110,15 +110,32 @@ export default class Type {
110
110
  kind = TYPE_KIND,
111
111
  name = this.name,
112
112
  superType = superTypeJSON, ///
113
- json = [{
113
+ json = {
114
114
  kind,
115
115
  name,
116
116
  superType
117
- }];
117
+ };
118
118
 
119
119
  return json;
120
120
  }
121
121
 
122
+ static fromJSON(json) {
123
+ const { name } = json;
124
+
125
+ let { superType } = json;
126
+
127
+ if (superType !== null) {
128
+ json = superType; ///
129
+
130
+ superType = Type.fromJSON(json);
131
+ }
132
+
133
+ const type = new Type(name, superType);
134
+
135
+ return type;
136
+ }
137
+
138
+
122
139
  static fromTypeName(typeName) {
123
140
  const name = typeName, ///
124
141
  superType = null,