occam-verify-cli 1.0.686 → 1.0.688

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.
@@ -3,16 +3,18 @@
3
3
  import { Element } from "occam-languages";
4
4
 
5
5
  import { define } from "../elements";
6
+ import { literally } from "../utilities/context";
7
+ import { instantiateFrame } from "../process/instantiate";
6
8
  import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
7
9
  import { assumptionsStringFromAssumptions } from "../utilities/string";
8
- import { assumptionsToAssumptionsJSON, metavariableToMetavariableJSON } from "../utilities/json";
10
+ import { assumptionsFromJSON, metavariableFromJSON, assumptionsToAssumptionsJSON, metavariableToMetavariableJSON } from "../utilities/json";
9
11
 
10
12
  export default define(class Frame extends Element {
11
- constructor(context, string, node, assumptions, metavairable) {
13
+ constructor(context, string, node, assumptions, metavariable) {
12
14
  super(context, string, node);
13
15
 
14
16
  this.assumptions = assumptions;
15
- this.metavariable = metavairable;
17
+ this.metavariable = metavariable;
16
18
  }
17
19
 
18
20
  getAssumptions() {
@@ -363,6 +365,17 @@ export default define(class Frame extends Element {
363
365
  static name = "Frame";
364
366
 
365
367
  static fromJSON(json, context) {
366
- debugger
368
+ const frame = literally((context) => {
369
+ const { string } = json,
370
+ frameNode = instantiateFrame(string, context),
371
+ node = frameNode, ///
372
+ assumptions = assumptionsFromJSON(json, context),
373
+ metavariable = metavariableFromJSON(json, context),
374
+ frame = new Frame(context, string, node, assumptions, metavariable);
375
+
376
+ return frame;
377
+ }, context);
378
+
379
+ return frame;
367
380
  }
368
381
  });
@@ -3,7 +3,9 @@
3
3
  import { Element } from "occam-languages";
4
4
 
5
5
  import { define } from "../elements";
6
- import { nameToNameJSON, identifierToIdentifierJSON } from "../utilities/json";
6
+ import { literally } from "../utilities/context";
7
+ import { instantiateParameter } from "../process/instantiate";
8
+ import { nameFromJSON, nameToNameJSON, identifierFromJSON, identifierToIdentifierJSON } from "../utilities/json";
7
9
 
8
10
  export default define(class Parameter extends Element {
9
11
  constructor(context, string, node, name, identifier) {
@@ -65,6 +67,17 @@ export default define(class Parameter extends Element {
65
67
  static name = "Parameter";
66
68
 
67
69
  static fromJSON(json, context) {
68
- debugger
70
+ const parameter = literally((context) => {
71
+ const { string } = json,
72
+ parameterNode = instantiateParameter(string, context),
73
+ node = parameterNode, ///
74
+ name = nameFromJSON(json, context),
75
+ identifier = identifierFromJSON(json, context),
76
+ parameter = new Parameter(context, string, node, name, identifier);
77
+
78
+ return parameter;
79
+ }, context);
80
+
81
+ return parameter;
69
82
  }
70
83
  });
@@ -4,7 +4,9 @@ import { Element } from "occam-languages";
4
4
  import { termsUtilities } from "occam-furtle";
5
5
 
6
6
  import { define } from "../elements";
7
- import { parametersToParametersJSON, procedureReferenceToProcedureReferenceJSON } from "../utilities/json";
7
+ import { literally } from "../utilities/context";
8
+ import { instantiateProcedureCall } from "../process/instantiate";
9
+ import { parametersFromJSON, parametersToParametersJSON, procedureReferenceFromJSON, procedureReferenceToProcedureReferenceJSON } from "../utilities/json";
8
10
 
9
11
  const { termsFromPrimitives } = termsUtilities;
10
12
 
@@ -129,6 +131,17 @@ export default define(class ProcedureCall extends Element {
129
131
  static name = "ProcedureCall";
130
132
 
131
133
  static fromJSON(json, context) {
132
- debugger
134
+ const procedureCall = literally((context) => {
135
+ const { string } = json,
136
+ procedureCallNode = instantiateProcedureCall(string, context),
137
+ node = procedureCallNode, ///
138
+ parameters = parametersFromJSON(json, context),
139
+ procedureReference = procedureReferenceFromJSON(json, context),
140
+ procedureCall = new ProcedureCall(context, string, node, parameters, procedureReference);
141
+
142
+ return procedureCall;
143
+ }, context);
144
+
145
+ return procedureCall;
133
146
  }
134
147
  });
@@ -3,11 +3,14 @@
3
3
  import { Element } from "occam-languages";
4
4
 
5
5
  import { define } from "../elements";
6
- import {nameToNameJSON} from "../utilities/json";
6
+ import { literally } from "../utilities/context";
7
+ import { nameFromJSON, nameToNameJSON } from "../utilities/json";
8
+ import { instantiateProcedureReference } from "../process/instantiate";
7
9
 
8
10
  export default define(class ProcedureReference extends Element {
9
11
  constructor(context, string, node, name) {
10
12
  super(context, string, node);
13
+
11
14
  this.name = name;
12
15
  }
13
16
 
@@ -43,6 +46,16 @@ export default define(class ProcedureReference extends Element {
43
46
  static name = "ProcedureReference";
44
47
 
45
48
  static fromJSON(json, context) {
46
- debugger
49
+ const procedureReference = literally((context) => {
50
+ const { string } = json,
51
+ procedureReferenceNode = instantiateProcedureReference(string, context),
52
+ node = procedureReferenceNode, ///
53
+ name = nameFromJSON(json, context),
54
+ procedureReference = new ProcedureReference(context, string, node, name);
55
+
56
+ return procedureReference;
57
+ }, context);
58
+
59
+ return procedureReference;
47
60
  }
48
61
  });
@@ -311,7 +311,7 @@ export default define(class Supposition extends ProofAssertion {
311
311
  static name = "Supposition";
312
312
 
313
313
  static fromJSON(json, context) {
314
- const premise = literally((context) => {
314
+ const supposition = literally((context) => {
315
315
  const { string } = json,
316
316
  suppositionNode = instantiateSupposition(string, context),
317
317
  node = suppositionNode, ///
@@ -321,13 +321,13 @@ export default define(class Supposition extends ProofAssertion {
321
321
 
322
322
  context = ephemeralContext; ///
323
323
 
324
- const premise = new Supposition(context, string, node, statement, procedureCall);
324
+ const supposition = new Supposition(context, string, node, statement, procedureCall);
325
325
 
326
- return premise;
326
+ return supposition;
327
327
 
328
328
  }, context);
329
329
 
330
- return premise;
330
+ return supposition;
331
331
  }
332
332
  });
333
333
 
@@ -245,7 +245,6 @@ export default define(class Term extends Element {
245
245
  term = new Term(context, string, node, type);
246
246
 
247
247
  return term;
248
-
249
248
  }, context);
250
249
 
251
250
  return term;
@@ -5,7 +5,14 @@ import { Element } from "occam-languages";
5
5
  import elements from "../elements";
6
6
 
7
7
  import { define } from "../elements";
8
- import { typeToTypeJSON, identifierToIdentifierJSON, propertyRelationsToPropertyRelationsJSON } from "../utilities/json";
8
+ import { literally } from "../utilities/context";
9
+ import { instantiateVariable } from "../process/instantiate";
10
+ import { typeFromJSON,
11
+ typeToTypeJSON,
12
+ identifierFromJSON,
13
+ propertyRelationsFromJSON,
14
+ identifierToIdentifierJSON,
15
+ propertyRelationsToPropertyRelationsJSON } from "../utilities/json";
9
16
 
10
17
  export default define(class Variable extends Element {
11
18
  constructor(context, string, node, type, identifier, propertyRelations) {
@@ -208,6 +215,18 @@ export default define(class Variable extends Element {
208
215
  static name = "Variable";
209
216
 
210
217
  static fromJSON(json, context) {
211
- debugger
218
+ const variable = literally((context) => {
219
+ const { string } = json,
220
+ variableNode = instantiateVariable(string, context),
221
+ node = variableNode, ///
222
+ type = typeFromJSON(json, context),
223
+ identifier = identifierFromJSON(json, context),
224
+ propertyRelations = propertyRelationsFromJSON(json, context),
225
+ variable = new Variable(context, string, node, type, identifier, propertyRelations);
226
+
227
+ return variable;
228
+ }, context);
229
+
230
+ return variable;
212
231
  }
213
232
  });
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  import { ruleFromRuleName } from "../utilities/bnf";
4
- import { LABEL_RULE_NAME,
4
+ import { TERM_RULE_NAME,
5
+ FRAME_RULE_NAME,
6
+ LABEL_RULE_NAME,
5
7
  PREMISE_RULE_NAME,
8
+ VARIABLE_RULE_NAME,
9
+ PARAMETER_RULE_NAME,
6
10
  STATEMENT_RULE_NAME,
7
11
  REFERENCE_RULE_NAME,
8
12
  COMBINATOR_RULE_NAME,
@@ -10,14 +14,22 @@ import { LABEL_RULE_NAME,
10
14
  CONSTRUCTOR_RULE_NAME,
11
15
  EQUIVALENCE_RULE_NAME,
12
16
  METAVARIABLE_RULE_NAME,
17
+ PROCEDURE_CALL_RULE_NAME,
18
+ DEFINED_ASSERTION_RULE_NAME,
13
19
  TERM_SUBSTITUTION_RULE_NAME,
14
- FRAME_SUBSTITUTION_RULE_NAME,
15
20
  SUBPROOF_ASSERTION_RULE_NAME,
21
+ FRAME_SUBSTITUTION_RULE_NAME,
22
+ PROCEDURE_REFERENCE_RULE_NAME,
23
+ CONTAINED_ASSERTION_RULE_NAME,
16
24
  STATEMENT_SUBSTITUTION_RULE_NAME,
17
25
  REFERENCE_SUBSTITUTION_RULE_NAME } from "../ruleNames";
18
26
 
19
- const labelPlaceholderRule = ruleFromRuleName(LABEL_RULE_NAME),
27
+ const termPlaceholderRule = ruleFromRuleName(TERM_RULE_NAME),
28
+ framePlaceholderRule = ruleFromRuleName(FRAME_RULE_NAME),
29
+ labelPlaceholderRule = ruleFromRuleName(LABEL_RULE_NAME),
20
30
  premisePlaceholderRule = ruleFromRuleName(PREMISE_RULE_NAME),
31
+ variablePlaceholderRule = ruleFromRuleName(VARIABLE_RULE_NAME),
32
+ parameterPlaceholderRule = ruleFromRuleName(PARAMETER_RULE_NAME),
21
33
  statementPlaceholderRule = ruleFromRuleName(STATEMENT_RULE_NAME),
22
34
  referencePlaceholderRule = ruleFromRuleName(REFERENCE_RULE_NAME),
23
35
  combinatorPlaceholderRule = ruleFromRuleName(COMBINATOR_RULE_NAME),
@@ -25,12 +37,20 @@ const labelPlaceholderRule = ruleFromRuleName(LABEL_RULE_NAME),
25
37
  constructorPlaceholderRule = ruleFromRuleName(CONSTRUCTOR_RULE_NAME),
26
38
  equivalencePlaceholderRule = ruleFromRuleName(EQUIVALENCE_RULE_NAME),
27
39
  metavariablePlaceholderRule = ruleFromRuleName(METAVARIABLE_RULE_NAME),
28
- subproofAssertionlaceholderRule = ruleFromRuleName(SUBPROOF_ASSERTION_RULE_NAME),
40
+ procedureCalllaceholderRule = ruleFromRuleName(PROCEDURE_CALL_RULE_NAME),
41
+ definedAssertionPlaceholderRule = ruleFromRuleName(DEFINED_ASSERTION_RULE_NAME),
29
42
  termSubstitutionPlaceholderRule = ruleFromRuleName(TERM_SUBSTITUTION_RULE_NAME),
43
+ subproofAssertionlaceholderRule = ruleFromRuleName(SUBPROOF_ASSERTION_RULE_NAME),
30
44
  frameSubstitutionPlaceholderRule = ruleFromRuleName(FRAME_SUBSTITUTION_RULE_NAME),
45
+ procedureReferencelaceholderRule = ruleFromRuleName(PROCEDURE_REFERENCE_RULE_NAME),
46
+ containedAssertionPlaceholderRule = ruleFromRuleName(CONTAINED_ASSERTION_RULE_NAME),
31
47
  statementSubstitutionPlaceholderRule = ruleFromRuleName(STATEMENT_SUBSTITUTION_RULE_NAME),
32
48
  referenceSubstitutionPlaceholderRule = ruleFromRuleName(REFERENCE_SUBSTITUTION_RULE_NAME);
33
49
 
50
+ export function instantiateTerm(string, context) { return instantiate(termPlaceholderRule, string, context); }
51
+
52
+ export function instantiateFrame(string, context) { return instantiate(framePlaceholderRule, string, context); }
53
+
34
54
  export function instantiateLabel(string, context) { return instantiate(labelPlaceholderRule, string, context); }
35
55
 
36
56
  export function instantiatePremise(string, context) {
@@ -40,6 +60,10 @@ export function instantiatePremise(string, context) {
40
60
  return instantiate(premisePlaceholderRule, string, context);
41
61
  }
42
62
 
63
+ export function instantiateVariable(string, context) { return instantiate(variablePlaceholderRule, string, context); }
64
+
65
+ export function instantiateParameter(string, context) { return instantiate(parameterPlaceholderRule, string, context); }
66
+
43
67
  export function instantiateStatement(string, context) { return instantiate(statementPlaceholderRule, string, context); }
44
68
 
45
69
  export function instantiateReference(string, context) { return instantiate(referencePlaceholderRule, string, context); }
@@ -59,12 +83,20 @@ export function instantiateEquivalence(string, context) { return instantiate(equ
59
83
 
60
84
  export function instantiateMetavariable(string, context) { return instantiate(metavariablePlaceholderRule, string, context); }
61
85
 
86
+ export function instantiateProcedureCall(string, context) { return instantiate(procedureCalllaceholderRule, string, context); }
87
+
88
+ export function instantiateDefinedAssertion(string, context) { return instantiate(definedAssertionPlaceholderRule, string, context); }
89
+
62
90
  export function instantiateTermSubstitution(string, context) { return instantiate(termSubstitutionPlaceholderRule, string, context); }
63
91
 
64
92
  export function instantiateSubproofAssertion(string, context) { return instantiate(subproofAssertionlaceholderRule, string, context); }
65
93
 
66
94
  export function instantiateFrameSubstitution(string, context) { return instantiate(frameSubstitutionPlaceholderRule, string, context); }
67
95
 
96
+ export function instantiateProcedureReference(string, context) { return instantiate(procedureReferencelaceholderRule, string, context); }
97
+
98
+ export function instantiateContainedAssertion(string, context) { return instantiate(containedAssertionPlaceholderRule, string, context); }
99
+
68
100
  export function instantiateStatementSubstitution(string, context) { return instantiate(statementSubstitutionPlaceholderRule, string, context); }
69
101
 
70
102
  export function instantiateReferenceSubstitution(string, context) { return instantiate(referenceSubstitutionPlaceholderRule, string, context); }
@@ -28,13 +28,15 @@ export function nameFromJSON(json, context) {
28
28
  export function termFromJSON(json, context) {
29
29
  let { term } = json;
30
30
 
31
- const termJSON = term; ///
31
+ if (term !== null) {
32
+ const termJSON = term; ///
32
33
 
33
- json = termJSON; ///
34
+ json = termJSON; ///
34
35
 
35
- const { Term } = elements;
36
+ const { Term } = elements;
36
37
 
37
- term = Term.fromJSON(json, context);
38
+ term = Term.fromJSON(json, context);
39
+ }
38
40
 
39
41
  return term;
40
42
  }
@@ -56,6 +58,28 @@ export function typeFromJSON(json, context) {
56
58
  return type;
57
59
  }
58
60
 
61
+ export function frameFromJSON(json, context) {
62
+ let { frame } = json;
63
+
64
+ if (frame !== null) {
65
+ const frameJSON = frame; ///
66
+
67
+ json = frameJSON; ///
68
+
69
+ const { Frame } = elements;
70
+
71
+ frame = Frame.fromJSON(json, context);
72
+ }
73
+
74
+ return frame;
75
+ }
76
+
77
+ export function negatedFromJSON(json, context) {
78
+ const { negated } = json;
79
+
80
+ return negated;
81
+ }
82
+
59
83
  export function metaTypeFromJSON(json, context) {
60
84
  let { metaType } = json;
61
85
 
@@ -127,6 +151,16 @@ export function referenceFromJSON(json, context) {
127
151
  return reference;
128
152
  }
129
153
 
154
+ export function identifierFromJSON(json, context) {
155
+ let { identifier } = json;
156
+
157
+ const identifierJSON = identifier; ///
158
+
159
+ identifier = identifierJSON; ///
160
+
161
+ return identifier;
162
+ }
163
+
130
164
  export function conclusionFromJSON(json, context) {
131
165
  let { conclusion } = json;
132
166
 
@@ -243,11 +277,11 @@ export function framesFromJSON(json, context) {
243
277
  let { frames } = json;
244
278
 
245
279
  const { Frame } = elements,
246
- framesJSON = frames; ///
280
+ framesJSON = frames; ///
247
281
 
248
282
  frames = framesJSON.map((frameJSON) => {
249
283
  const json = frameJSON, ///
250
- frame = Frame.fromJSON(json, context);
284
+ frame = Frame.fromJSON(json, context);
251
285
 
252
286
  return frame;
253
287
  });
@@ -644,6 +678,22 @@ export function ephemeralContextFromJSON(json, context) {
644
678
  return emphemeralContext;
645
679
  }
646
680
 
681
+ export function propertyRelationsFromJSON(json, context) {
682
+ let { propertyRelations } = json;
683
+
684
+ const { PropertyRelation } = elements,
685
+ propertyRelationsJSON = propertyRelations; ///
686
+
687
+ propertyRelations = propertyRelationsJSON.map((propertyRelationJSON) => {
688
+ const json = propertyRelationJSON, ///
689
+ propertyRelation = PropertyRelation.fromJSON(json, context);
690
+
691
+ return propertyRelation;
692
+ });
693
+
694
+ return propertyRelations;
695
+ }
696
+
647
697
  export function nameToNameJSON(name) {
648
698
  const nameJSON = name; ///
649
699
 
@@ -203,7 +203,7 @@ export function typeStringFromTypeNameTypePrefixNameAndSuperTypes(typeName, type
203
203
  export function procedureCallStringFromProcedureReferenceAndParameters(procedureReference, parameters) {
204
204
  const procedureReferenceName = procedureReference.getName(),
205
205
  parametersString = parametersStringFromParameters(parameters),
206
- procedureCallString = `${procedureReferenceName}(${parametersString})`;
206
+ procedureCallString = `@${procedureReferenceName}(${parametersString})`;
207
207
 
208
208
  return procedureCallString;
209
209
  }