occam-verify-cli 0.0.1032 → 0.0.1035

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.
Files changed (51) hide show
  1. package/lib/argument.js +2 -3
  2. package/lib/assertion/subproof.js +50 -11
  3. package/lib/assertion/type.js +180 -0
  4. package/lib/constructor.js +3 -2
  5. package/lib/context/file.js +32 -13
  6. package/lib/context/local.js +15 -15
  7. package/lib/context/release.js +9 -24
  8. package/lib/equality.js +5 -5
  9. package/lib/mixins/statement/verify.js +3 -3
  10. package/lib/premise.js +21 -12
  11. package/lib/substitution/termForVariable.js +15 -18
  12. package/lib/supposition.js +19 -10
  13. package/lib/term.js +21 -16
  14. package/lib/theorem.js +107 -6
  15. package/lib/unifier/intrinsicLevel.js +9 -4
  16. package/lib/unifier/metaLevel.js +10 -4
  17. package/lib/unifier/statementWithCombinator.js +2 -2
  18. package/lib/utilities/array.js +5 -2
  19. package/lib/utilities/unify.js +2 -14
  20. package/lib/variable.js +65 -13
  21. package/lib/verifier/topLevel.js +3 -3
  22. package/package.json +1 -1
  23. package/src/argument.js +1 -3
  24. package/src/assertion/subproof.js +74 -15
  25. package/src/assertion/type.js +176 -0
  26. package/src/constructor.js +3 -1
  27. package/src/context/file.js +48 -14
  28. package/src/context/local.js +17 -7
  29. package/src/context/release.js +11 -35
  30. package/src/equality.js +4 -4
  31. package/src/mixins/statement/verify.js +3 -2
  32. package/src/premise.js +29 -16
  33. package/src/substitution/termForVariable.js +21 -21
  34. package/src/supposition.js +24 -11
  35. package/src/term.js +22 -17
  36. package/src/theorem.js +87 -1
  37. package/src/unifier/intrinsicLevel.js +16 -3
  38. package/src/unifier/metaLevel.js +18 -3
  39. package/src/unifier/statementWithCombinator.js +1 -1
  40. package/src/utilities/array.js +1 -1
  41. package/src/utilities/unify.js +1 -16
  42. package/src/variable.js +88 -18
  43. package/src/verifier/topLevel.js +3 -2
  44. package/lib/unify/variableWithTerm.js +0 -39
  45. package/lib/verify/assertion/type.js +0 -99
  46. package/lib/verify/lemma.js +0 -48
  47. package/lib/verify/theorem.js +0 -47
  48. package/src/unify/variableWithTerm.js +0 -37
  49. package/src/verify/assertion/type.js +0 -139
  50. package/src/verify/lemma.js +0 -70
  51. package/src/verify/theorem.js +0 -65
@@ -4,10 +4,11 @@ import shim from "../shim";
4
4
  import LocalContext from "../context/local";
5
5
  import metaLevelUnifier from "../unifier/metaLevel";
6
6
 
7
- import { match } from "../utilities/array";
7
+ import { front, last, match } from "../utilities/array";
8
8
  import { nodeQuery, nodesQuery } from "../utilities/query";
9
9
 
10
- const statementNodesQuery = nodesQuery("/subproofAssertion/statement"),
10
+ const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement"),
11
+ statementNodesQuery = nodesQuery("/subproofAssertion/statement"),
11
12
  subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion");
12
13
 
13
14
  export default class SubproofAssertion {
@@ -60,26 +61,84 @@ export default class SubproofAssertion {
60
61
  return subproofUnified;
61
62
  }
62
63
 
63
- static fromStatementNode(statementNode, fileContext) {
64
+ toJSON() {
65
+ const statementStings = this.statements.map((statement) => {
66
+ const statementString = statement.getString();
67
+
68
+ return statementString;
69
+ }),
70
+ statements = statementStings, ///
71
+ json = {
72
+ statements
73
+ };
74
+
75
+ return json;
76
+ }
77
+
78
+ static fromJSON(json, fileContext) {
79
+ let { statements } = json;
80
+
81
+ const statementsJSON = statements; ///
82
+
83
+ statements = statementsJSON.map((statementJSON) => {
84
+ const json = statementJSON,
85
+ statement = Statement.fromJSON(json, fileContext);
86
+
87
+ return statement;
88
+ });
89
+
90
+ const string = stringFromStatements(statements),
91
+ subproofAssertion = new SubproofAssertion(fileContext, string, statements);
92
+
93
+ return subproofAssertion;
94
+ }
95
+
96
+ static fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext) {
64
97
  let subproofAssertion = null;
65
98
 
66
- const subproofAssertionNode = subproofAssertionNodeQuery(statementNode);
99
+ if (unqualifiedStatementNode !== null) {
100
+ const statementNode = statementNodeQuery(unqualifiedStatementNode),
101
+ subproofAssertionNode = subproofAssertionNodeQuery(statementNode);
67
102
 
68
- if (subproofAssertionNode !== null) {
69
- const { Statement } = shim,
70
- node = subproofAssertionNode, ///
71
- string = fileContext.nodeAsString(node),
72
- localContext = LocalContext.fromFileContext(fileContext),
73
- statementNodes = statementNodesQuery(subproofAssertionNode),
74
- statements = statementNodes.map((statementNode) => {
75
- const statement = Statement.fromStatementNode(statementNode, localContext);
103
+ if (subproofAssertionNode !== null) {
104
+ const { Statement } = shim,
105
+ localContext = LocalContext.fromFileContext(fileContext),
106
+ statementNodes = statementNodesQuery(subproofAssertionNode),
107
+ statements = statementNodes.map((statementNode) => {
108
+ const statement = Statement.fromStatementNode(statementNode, localContext);
76
109
 
77
- return statement;
78
- });
110
+ return statement;
111
+ }),
112
+ string = stringFromStatements(statements);
79
113
 
80
- subproofAssertion = new SubproofAssertion(fileContext, string, statements);
114
+ subproofAssertion = new SubproofAssertion(fileContext, string, statements);
115
+ }
81
116
  }
82
117
 
83
118
  return subproofAssertion;
84
119
  }
120
+ }
121
+
122
+ function stringFromStatements(statements) {
123
+ const frontStatements = front(statements),
124
+ lastStatement = last(statements),
125
+ frontStatementsString = statementsStringtatements(frontStatements),
126
+ lastStatementString = lastStatement.getString(),
127
+ string = `[${frontStatementsString}] ... ${lastStatementString}`;
128
+
129
+ return string;
130
+ }
131
+
132
+ function statementsStringtatements(statements) {
133
+ const statementsString = statements.reduce((statementsString, statement) => {
134
+ const statementString = statement.getString();
135
+
136
+ statementsString = (statementsString !== null) ?
137
+ `${statementsString}, ${statementString}` :
138
+ statementString; ///
139
+
140
+ return statementsString;
141
+ }, null);
142
+
143
+ return statementsString
85
144
  }
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+
3
+ import shim from "../shim";
4
+ import Variable from "../variable";
5
+ import VariableAssignment from "../assignment/variable";
6
+
7
+ import { nodeQuery } from "../utilities/query";
8
+ import {objectType} from "../type";
9
+
10
+ const termNodeQuery = nodeQuery("/typeAssertion/term"),
11
+ typeNodeQuery = nodeQuery("/typeAssertion/type"),
12
+ variableNodeQuery = nodeQuery("/term/variable");
13
+
14
+ export default class TypeAssertion {
15
+ constructor(string, term, type, variable) {
16
+ this.string = string;
17
+ this.term = term;
18
+ this.type = type;
19
+ this.variable = variable;
20
+ }
21
+
22
+ getString() {
23
+ return this.string;
24
+ }
25
+
26
+ getTerm() {
27
+ return this.term;
28
+ }
29
+
30
+ getType() {
31
+ return this.type;
32
+ }
33
+
34
+ getVariable() {
35
+ return this.variable;
36
+ }
37
+
38
+ verify(assignments, stated, localContext) {
39
+ let verified;
40
+
41
+ if (stated) {
42
+ const verifiedWhenStated = this.verifyWhenStated(assignments, localContext);
43
+
44
+ verified = verifiedWhenStated; ///
45
+ } else {
46
+ const verifiedWhenDerived = this.verifyWhenDerived(localContext);
47
+
48
+ verified = verifiedWhenDerived; ///
49
+ }
50
+
51
+ return verified;
52
+ }
53
+
54
+ verifyType(localContext) {
55
+ let typeVerified;
56
+
57
+ if (this.type === objectType) {
58
+ typeVerified = true;
59
+ } else {
60
+ const typeName = this.type.getName();
61
+
62
+ localContext.trace(`Verifying the '${typeName}' type...`);
63
+
64
+ const type = localContext.findTypeByTypeName(typeName);
65
+
66
+ if (type === null) {
67
+ localContext.debug(`The '${typeName}' type is missing.`);
68
+ } else {
69
+ this.type = type; ///
70
+
71
+ typeVerified = true;
72
+ }
73
+
74
+ if (typeVerified) {
75
+ localContext.debug(`...verified the '${typeName}' type.`);
76
+ }
77
+ }
78
+
79
+ return typeVerified;
80
+ }
81
+
82
+ verifyWhenStated(assignments, localContext) {
83
+ let verifiedWhenStated = false;
84
+
85
+ const typeAssertionString = this.string; ///
86
+
87
+ localContext.trace(`Verifying the stated '${typeAssertionString}' type assertion...`);
88
+
89
+ const typeVerified = this.verifyType(localContext);
90
+
91
+ if (typeVerified) {
92
+ const termVerified = this.term.verify(localContext, () => {
93
+ let verifiedAhead;
94
+
95
+ const termType = this.term.getType(),
96
+ typeEqualToOrSuperTypeOfTermType = this.type.isEqualToOrSubTypeOf(termType);
97
+
98
+ if (typeEqualToOrSuperTypeOfTermType) {
99
+ if (this.variable !== null) {
100
+ this.variable.setType(this.type);
101
+
102
+ const variableAssignment = VariableAssignment.fromVariable(this.variable),
103
+ assignment = variableAssignment; ///
104
+
105
+ assignments.push(assignment);
106
+ }
107
+
108
+ verifiedAhead = true;
109
+ }
110
+
111
+ return verifiedAhead;
112
+ });
113
+
114
+ verifiedWhenStated = termVerified; ///
115
+ }
116
+
117
+ if (verifiedWhenStated) {
118
+ localContext.debug(`...verified the stated '${typeAssertionString}' type assertion.`);
119
+ }
120
+
121
+ return verifiedWhenStated;
122
+ }
123
+
124
+ verifyWhenDerived(localContext) {
125
+ let verifiedWhenDerived = false;
126
+
127
+ const typeAssertionString = this.string; ///
128
+
129
+ localContext.trace(`Verifying the derived '${typeAssertionString}' type assertion...`);
130
+
131
+ const typeVerified = this.verifyType(localContext);
132
+
133
+ if (typeVerified) {
134
+ const termVerified = this.term.verify(localContext, () => {
135
+ let verifiedAhead;
136
+
137
+ const termType = this.term.getType(),
138
+ typeEqualToOrSuperTypeOfTermType = this.type.isEqualToOrSuperTypeOf(termType);
139
+
140
+ verifiedAhead = typeEqualToOrSuperTypeOfTermType; ///
141
+
142
+ return verifiedAhead;
143
+ });
144
+
145
+ verifiedWhenDerived = termVerified; ///
146
+ }
147
+
148
+ if (verifiedWhenDerived) {
149
+ localContext.debug(`...verified the derived '${typeAssertionString}' type assertion.`);
150
+ }
151
+
152
+ return verifiedWhenDerived;
153
+ }
154
+
155
+ static fromTypeAssertionNode(typeAssertionNode, localContext) {
156
+ const { Term, Type } = shim,
157
+ termNode = termNodeQuery(typeAssertionNode),
158
+ typeNode = typeNodeQuery(typeAssertionNode),
159
+ variableNode = variableNodeQuery(termNode),
160
+ term = Term.fromTermNode(termNode, localContext),
161
+ type = Type.fromTypeNode(typeNode, localContext),
162
+ variable = Variable.fromVariableNode(variableNode, localContext),
163
+ string = stringFromTermAndType(term, type),
164
+ typeAssertion = new TypeAssertion(string, term, type, variable);
165
+
166
+ return typeAssertion;
167
+ }
168
+ }
169
+
170
+ function stringFromTermAndType(term, type) {
171
+ const termString = term.getString(),
172
+ typeName = type.getName(),
173
+ string = `${termString}:${typeName}`;
174
+
175
+ return string;
176
+ }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import shim from "./shim";
4
+ import LocalContext from "./context/local";
4
5
 
5
6
  import { nodeQuery } from "./utilities/query";
6
7
  import { objectType } from "./type";
@@ -79,7 +80,8 @@ export default class Constructor {
79
80
  type = (typeNode === null) ?
80
81
  objectType :
81
82
  Type.fromTypeNode(typeNode),
82
- term = Term.fromTermNodeAndType(termNode, type, fileContext),
83
+ localContext = LocalContext.fromFileContext(fileContext),
84
+ term = Term.fromTermNodeAndType(termNode, type, localContext),
83
85
  string = stringFromTermAndType(term, type),
84
86
  constructor = new Constructor(string, term);
85
87
 
@@ -390,20 +390,6 @@ export default class FileContext {
390
390
  return label;
391
391
  }
392
392
 
393
- findMetavariableByMetavariableName(metavariableName) {
394
- const name = metavariableName, ///
395
- metavariables = this.getMetavariables(),
396
- metavariable = metavariables.find((metavariable) => {
397
- const nameMatches = metavariable.matchName(name);
398
-
399
- if (nameMatches) {
400
- return true;
401
- }
402
- }) || null;
403
-
404
- return metavariable;
405
- }
406
-
407
393
  isTypePresentByTypeName(typeName) {
408
394
  const type = this.findTypeByTypeName(typeName),
409
395
  typePresent = (type !== null);
@@ -544,6 +530,33 @@ export default class FileContext {
544
530
  return variable;
545
531
  }
546
532
 
533
+ findJudgementByMetavariableName(metavariableName) {
534
+ const judgements = this.getJudgements(),
535
+ judgement = judgements.find((judgement) => {
536
+ const judgementMatchesMetavariableName = judgement.matchMetavariableName(metavariableName);
537
+
538
+ if (judgementMatchesMetavariableName) {
539
+ return true;
540
+ }
541
+ }) || null;
542
+
543
+ return judgement;
544
+ }
545
+
546
+ findMetavariableByMetavariableName(metavariableName) {
547
+ const name = metavariableName, ///
548
+ metavariables = this.getMetavariables(),
549
+ metavariable = metavariables.find((metavariable) => {
550
+ const nameMatches = metavariable.matchName(name);
551
+
552
+ if (nameMatches) {
553
+ return true;
554
+ }
555
+ }) || null;
556
+
557
+ return metavariable;
558
+ }
559
+
547
560
  nodeAsString(node) {
548
561
  const string = nodeAsString(node, this.tokens);
549
562
 
@@ -864,6 +877,27 @@ export default class FileContext {
864
877
  });
865
878
  }
866
879
 
880
+ static fromJSONAndReleaseContext(json, releaseContext) {
881
+ const { filePath } = json,
882
+ tokens = null,
883
+ node = null,
884
+ types = [],
885
+ rules = [],
886
+ axioms = [],
887
+ lemmas = [],
888
+ theorems = [],
889
+ variables = [],
890
+ metaLemmas = [],
891
+ conjectures = [],
892
+ combinators = [],
893
+ constructors = [],
894
+ metatheorems = [],
895
+ metavariables = [],
896
+ fileContext = new FileContext(releaseContext, filePath, tokens, node, types, rules, axioms, lemmas, variables, metaLemmas, theorems, conjectures, combinators, constructors, metatheorems, metavariables);
897
+
898
+ return fileContext;
899
+ }
900
+
867
901
  static fromFileAndReleaseContext(file, releaseContext) {
868
902
  const lexer = releaseContext.getLexer(),
869
903
  parser = releaseContext.getParser(),
@@ -332,11 +332,21 @@ class LocalContext {
332
332
 
333
333
  findMetaTypeByMetaTypeName(metaTypeName) { return this.context.findMetaTypeByMetaTypeName(metaTypeName); }
334
334
 
335
- findVariableByVariableName(variableName) { return this.context.findVariableByVariableName(variableName); }
336
-
337
335
  findLabelByMetavariableNode(metavariableNode) { return this.context.findLabelByMetavariableNode(metavariableNode); }
338
336
 
339
- findMetavariableByMetavariableName(metavariableName) { return this.context.findMetavariableByMetavariableName(metavariableName); }
337
+ findVariableByVariableName(variableName) {
338
+ const name = variableName, ///
339
+ variables = this.getVariables(),
340
+ variable = variables.find((variable) => {
341
+ const nameMatches = variable.matchName(name);
342
+
343
+ if (nameMatches) {
344
+ return true;
345
+ }
346
+ }) || null;
347
+
348
+ return variable;
349
+ }
340
350
 
341
351
  findJudgementByMetavariableName(metavariableName) {
342
352
  const judgements = this.getJudgements(),
@@ -351,13 +361,13 @@ class LocalContext {
351
361
  return judgement;
352
362
  }
353
363
 
354
- findMetavariableByMetavariableNode(metavariableNode) {
355
- const localContext = this, ///
364
+ findMetavariableByMetavariableName(metavariableName) {
365
+ const name = metavariableName, ///
356
366
  metavariables = this.getMetavariables(),
357
367
  metavariable = metavariables.find((metavariable) => {
358
- const metavariableNodeMatches = metavariable.matchMetavariableNode(metavariableNode, localContext);
368
+ const nameMatches = metavariable.matchName(name);
359
369
 
360
- if (metavariableNodeMatches) {
370
+ if (nameMatches) {
361
371
  return true;
362
372
  }
363
373
  }) || null;
@@ -438,9 +438,9 @@ export default class ReleaseContext {
438
438
 
439
439
  this.parser = nominalParser; ///
440
440
 
441
- this.fileContexts = released ?
442
- fileContextsFromJSONEntriesAndReleaseContext(this.json, this.entries, releaseContext) :
443
- fileContextsFromEntriesAndReleaseContext(this.entries, releaseContext);
441
+ released ?
442
+ fileContextsFromJSONAndReleaseContext(this.json, this.fileContexts, releaseContext) :
443
+ fileContextsFromEntriesAndReleaseContext(this.entries, this.fileContexts, releaseContext);
444
444
 
445
445
  this.initialised = true;
446
446
  }
@@ -487,31 +487,20 @@ export default class ReleaseContext {
487
487
  }
488
488
  }
489
489
 
490
- function fileContextsFromJSONEntriesAndReleaseContext(json, entries, releaseContext) {
491
- const fileContexts = [];
490
+ function fileContextsFromJSONAndReleaseContext(json, fileContexts, releaseContext) {
491
+ const fileContextsJSON = json; ///
492
492
 
493
- entries.forEachFile((file) => {
494
- const filePath = file.getPath(),
495
- filePathNominalFilePath = isFilePathNominalFilePath(filePath);
496
-
497
- if (filePathNominalFilePath) {
498
- const fileContext = FileContext.fromFileAndReleaseContext(file, releaseContext),
499
- filePath = fileContext.getFilePath();
500
-
501
- fileContexts.push(fileContext);
493
+ fileContextsJSON.forEach((fileContextJSON) => {
494
+ const json = fileContextJSON,
495
+ fileContext = FileContext.fromJSONAndReleaseContext(json, releaseContext);
502
496
 
503
- const fileContextJSON = findFileContextJSON(json, filePath);
497
+ fileContext.initialise(fileContextJSON);
504
498
 
505
- fileContext.initialise(fileContextJSON);
506
- }
499
+ fileContexts.push(fileContext);
507
500
  });
508
-
509
- return fileContexts;
510
501
  }
511
502
 
512
- function fileContextsFromEntriesAndReleaseContext(entries, releaseContext) {
513
- const fileContexts = [];
514
-
503
+ function fileContextsFromEntriesAndReleaseContext(entries, fileContexts, releaseContext) {
515
504
  entries.forEachFile((file) => {
516
505
  const filePath = file.getPath(),
517
506
  filePathNominalFilePath = isFilePathNominalFilePath(filePath);
@@ -526,19 +515,6 @@ function fileContextsFromEntriesAndReleaseContext(entries, releaseContext) {
526
515
  return fileContexts;
527
516
  }
528
517
 
529
- function findFileContextJSON(json, filePath) {
530
- const fileContextsJSON = json, ///
531
- fileContextJSON = fileContextsJSON.find((fileContextJSON) => {
532
- const { filePath: fileContextFilePath } = fileContextJSON;
533
-
534
- if (fileContextFilePath === filePath) {
535
- return true;
536
- }
537
- });
538
-
539
- return fileContextJSON;
540
- }
541
-
542
518
  function verifyFileContexts(fileContexts, verifiedFileContexts) {
543
519
  let fileContextsVerified;
544
520
 
package/src/equality.js CHANGED
@@ -121,14 +121,14 @@ export default class Equality {
121
121
 
122
122
  const equalityString = this.string; ///
123
123
 
124
- localContext.trace(`Verifying the '${equalityString}' equality when stated...`);
124
+ localContext.trace(`Verifying the stated '${equalityString}' equality...`);
125
125
 
126
126
  const termsVerified = this.verifyTerms(localContext);
127
127
 
128
128
  verifiedWhenStated = termsVerified; ///
129
129
 
130
130
  if (verifiedWhenStated) {
131
- localContext.debug(`...verified the '${equalityString}' equality when stated.`);
131
+ localContext.debug(`...verified the stated '${equalityString}' equality.`);
132
132
  }
133
133
 
134
134
  return verifiedWhenStated;
@@ -139,7 +139,7 @@ export default class Equality {
139
139
 
140
140
  const equalityString = this.string; ///
141
141
 
142
- localContext.trace(`Verifying the '${equalityString}' equality when derived...`);
142
+ localContext.trace(`Verifying the derived '${equalityString}' equality...`);
143
143
 
144
144
  const termsVerified = this.verifyTerms(localContext);
145
145
 
@@ -150,7 +150,7 @@ export default class Equality {
150
150
  }
151
151
 
152
152
  if (verifiedWhenDerived) {
153
- localContext.debug(`...verified the '${equalityString}' equality when derived.`);
153
+ localContext.debug(`...verified the derived '${equalityString}' equality.`);
154
154
  }
155
155
 
156
156
  return verifiedWhenDerived;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  import Equality from "../../equality";
4
+ import TypeAssertion from "../../assertion/type";
4
5
 
5
6
  import verifyFrame from "../../verify/frame";
6
7
  import verifyJudgement from "../../verify/judgement";
7
8
  import verifyDeclaration from "../../verify/declaration";
8
- import verifyTypeAssertion from "../../verify/assertion/type";
9
9
  import metavariableUnifier from "../../unifier/metavariable";
10
10
  import verifyDefinedAssertion from "../../verify/assertion/defined";
11
11
  import verifySubproofAssertion from "../../verify/assertion/subproof";
@@ -151,7 +151,8 @@ function verifyAsTypeAssertion(statement, assignments, stated, localContext) {
151
151
 
152
152
  localContext.trace(`Verifying the '${statementString}' statement as a type assertion...`);
153
153
 
154
- const typeAssertionVerified = verifyTypeAssertion(typeAssertionNode, assignments, stated, localContext);
154
+ const typeAssertion = TypeAssertion.fromTypeAssertionNode(typeAssertionNode, localContext),
155
+ typeAssertionVerified = typeAssertion.verify(assignments, stated, localContext);
155
156
 
156
157
  verifiedAsTypeAssertion = typeAssertionVerified; ///
157
158
 
package/src/premise.js CHANGED
@@ -12,8 +12,9 @@ import { assignAssignments } from "./utilities/assignments";
12
12
  const unqualifiedStatementNodeQuery = nodeQuery("/premise/unqualifiedStatement");
13
13
 
14
14
  export default class Premise {
15
- constructor(fileContext, unqualifiedStatement) {
15
+ constructor(fileContext, subproofAssertion, unqualifiedStatement) {
16
16
  this.fileContext = fileContext;
17
+ this.subproofAssertion = subproofAssertion;
17
18
  this.unqualifiedStatement = unqualifiedStatement;
18
19
  }
19
20
 
@@ -21,6 +22,10 @@ export default class Premise {
21
22
  return this.fileContext;
22
23
  }
23
24
 
25
+ getSubproofAssertion() {
26
+ return this.subproofAssertion;
27
+ }
28
+
24
29
  getUnqualifiedStatement() {
25
30
  return this.unqualifiedStatement;
26
31
  }
@@ -90,12 +95,8 @@ export default class Premise {
90
95
 
91
96
  localContext.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement...`);
92
97
 
93
- const statement = this.unqualifiedStatement.getStatement(),
94
- statementNode = statement.getNode(),
95
- subproofAssertion = SubproofAssertion.fromStatementNode(statementNode, this.fileContext);
96
-
97
- if (subproofAssertion !== null) {
98
- subproofUnified = subproofAssertion.unifySubproof(subproof, substitutions, localContext);
98
+ if (this.subproofAssertion !== null) {
99
+ subproofUnified = this.subproofAssertion.unifySubproof(subproof, substitutions, localContext);
99
100
  }
100
101
 
101
102
  if (subproofUnified) {
@@ -142,30 +143,42 @@ export default class Premise {
142
143
 
143
144
  toJSON() {
144
145
  const unqualifiedStatementJSON = this.unqualifiedStatement.toJSON(),
145
- unqualifiedStatement = unqualifiedStatementJSON, ///
146
- json = {
147
- unqualifiedStatement
148
- };
146
+ subproofAssertionJSON = (this.subproofAssertion !== null) ?
147
+ this.subproofAssertion.toJSON() :
148
+ null,
149
+ unqualifiedStatement = unqualifiedStatementJSON, ///
150
+ subproofAssertion = subproofAssertionJSON, ///
151
+ json = {
152
+ unqualifiedStatement,
153
+ subproofAssertion
154
+ };
149
155
 
150
156
  return json;
151
157
  }
152
158
 
153
159
  static fromJSON(json, fileContext) {
154
- let { unqualifiedStatement } = json;
160
+ let { subproofAssertion, unqualifiedStatement } = json;
155
161
 
156
162
  json = unqualifiedStatement; ///
157
163
 
158
164
  unqualifiedStatement = UnqualifiedStatement.fromJSON(json, fileContext);
159
165
 
160
- const premise = new Premise(fileContext, unqualifiedStatement);
166
+ json = subproofAssertion; ///
167
+
168
+ subproofAssertion = (json !== null) ?
169
+ SubproofAssertion.fromJSON(json, fileContext) :
170
+ null;
171
+
172
+ const premise = new Premise(fileContext, subproofAssertion, unqualifiedStatement);
161
173
 
162
174
  return premise;
163
175
  }
164
176
 
165
- static fromPremiseNode(premiseNode, fileContext) {
166
- const unqualifiedStatementNode = unqualifiedStatementNodeQuery(premiseNode),
177
+ static fromSuppositionNode(suppositionNode, fileContext) {
178
+ const unqualifiedStatementNode = unqualifiedStatementNodeQuery(suppositionNode),
167
179
  unqualifiedStatement = UnqualifiedStatement.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext),
168
- premise = new Premise(fileContext, unqualifiedStatement);
180
+ subproofAssertion = SubproofAssertion.fromUnqualifiedStatementNode(unqualifiedStatementNode, fileContext),
181
+ premise = new Premise(fileContext, subproofAssertion, unqualifiedStatement);
169
182
 
170
183
  return premise
171
184
  }