occam-verify-cli 1.0.387 → 1.0.396

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 (119) hide show
  1. package/lib/action/verify.js +3 -3
  2. package/lib/context/file.js +8 -7
  3. package/lib/context/local.js +23 -57
  4. package/lib/context/temporary.js +705 -0
  5. package/lib/mixins/statement/verify.js +38 -16
  6. package/lib/mixins/step/unify.js +3 -3
  7. package/lib/node/substitution/frame.js +23 -1
  8. package/lib/node/substitution/term.js +23 -1
  9. package/lib/ontology/assertion/contained.js +77 -35
  10. package/lib/ontology/assertion/defined.js +76 -34
  11. package/lib/ontology/assertion/property.js +71 -29
  12. package/lib/ontology/assertion/satisfies.js +70 -22
  13. package/lib/ontology/assertion/subproof.js +95 -41
  14. package/lib/ontology/assertion/type.js +74 -18
  15. package/lib/ontology/assertion.js +66 -0
  16. package/lib/ontology/axiom.js +8 -11
  17. package/lib/ontology/combinator/bracketed.js +17 -3
  18. package/lib/ontology/combinator.js +17 -3
  19. package/lib/ontology/conclusion.js +38 -9
  20. package/lib/ontology/constructor/bracketed.js +17 -3
  21. package/lib/ontology/constructor.js +17 -3
  22. package/lib/ontology/declaration.js +27 -2
  23. package/lib/ontology/deduction.js +38 -9
  24. package/lib/ontology/frame.js +50 -13
  25. package/lib/ontology/hypothesis.js +11 -11
  26. package/lib/ontology/judgement.js +1 -1
  27. package/lib/ontology/label.js +5 -6
  28. package/lib/ontology/metavariable.js +11 -12
  29. package/lib/ontology/premise.js +47 -17
  30. package/lib/ontology/procedureCall.js +15 -15
  31. package/lib/ontology/procedureReference.js +1 -1
  32. package/lib/ontology/proof.js +2 -2
  33. package/lib/ontology/reference.js +4 -5
  34. package/lib/ontology/rule.js +68 -69
  35. package/lib/ontology/section.js +2 -2
  36. package/lib/ontology/signature.js +2 -2
  37. package/lib/ontology/statement.js +9 -1
  38. package/lib/ontology/step.js +37 -24
  39. package/lib/ontology/subproof.js +11 -11
  40. package/lib/ontology/substitution/frame.js +69 -21
  41. package/lib/ontology/substitution/reference.js +24 -9
  42. package/lib/ontology/substitution/statement.js +99 -79
  43. package/lib/ontology/substitution/term.js +89 -29
  44. package/lib/ontology/substitution.js +37 -30
  45. package/lib/ontology/supposition.js +56 -25
  46. package/lib/ontology/term.js +4 -3
  47. package/lib/ontology/topLevelAssertion.js +15 -15
  48. package/lib/ontology/topLevelMetaAssertion.js +2 -2
  49. package/lib/ontology/variable.js +42 -14
  50. package/lib/substitutions.js +25 -25
  51. package/lib/unifier/intrinsicLevel.js +14 -7
  52. package/lib/unifier/metaLevel.js +25 -17
  53. package/lib/utilities/brackets.js +4 -21
  54. package/lib/utilities/context.js +6 -6
  55. package/lib/utilities/json.js +24 -1
  56. package/lib/utilities/metavariable.js +18 -0
  57. package/lib/utilities/substitutions.js +3 -3
  58. package/lib/utilities/unification.js +10 -16
  59. package/lib/utilities/variable.js +30 -0
  60. package/package.json +2 -2
  61. package/src/action/verify.js +2 -2
  62. package/src/context/file.js +8 -7
  63. package/src/context/local.js +13 -61
  64. package/src/context/temporary.js +394 -0
  65. package/src/mixins/statement/verify.js +60 -23
  66. package/src/mixins/step/unify.js +2 -2
  67. package/src/node/substitution/frame.js +26 -0
  68. package/src/node/substitution/term.js +26 -0
  69. package/src/ontology/assertion/contained.js +12 -23
  70. package/src/ontology/assertion/defined.js +12 -23
  71. package/src/ontology/assertion/property.js +7 -20
  72. package/src/ontology/assertion/satisfies.js +7 -16
  73. package/src/ontology/assertion/subproof.js +36 -42
  74. package/src/ontology/assertion/type.js +10 -11
  75. package/src/ontology/assertion.js +23 -0
  76. package/src/ontology/axiom.js +7 -16
  77. package/src/ontology/combinator/bracketed.js +2 -0
  78. package/src/ontology/combinator.js +2 -0
  79. package/src/ontology/conclusion.js +51 -10
  80. package/src/ontology/constructor/bracketed.js +2 -0
  81. package/src/ontology/constructor.js +2 -0
  82. package/src/ontology/declaration.js +34 -1
  83. package/src/ontology/deduction.js +51 -10
  84. package/src/ontology/frame.js +58 -21
  85. package/src/ontology/hypothesis.js +8 -8
  86. package/src/ontology/judgement.js +1 -1
  87. package/src/ontology/label.js +2 -7
  88. package/src/ontology/metavariable.js +12 -15
  89. package/src/ontology/premise.js +64 -21
  90. package/src/ontology/procedureCall.js +14 -14
  91. package/src/ontology/procedureReference.js +2 -2
  92. package/src/ontology/proof.js +1 -1
  93. package/src/ontology/reference.js +1 -6
  94. package/src/ontology/rule.js +76 -80
  95. package/src/ontology/section.js +1 -1
  96. package/src/ontology/signature.js +1 -1
  97. package/src/ontology/statement.js +6 -0
  98. package/src/ontology/step.js +43 -26
  99. package/src/ontology/subproof.js +8 -8
  100. package/src/ontology/substitution/frame.js +72 -26
  101. package/src/ontology/substitution/reference.js +8 -6
  102. package/src/ontology/substitution/statement.js +93 -77
  103. package/src/ontology/substitution/term.js +108 -42
  104. package/src/ontology/substitution.js +27 -22
  105. package/src/ontology/supposition.js +70 -24
  106. package/src/ontology/term.js +5 -5
  107. package/src/ontology/topLevelAssertion.js +14 -16
  108. package/src/ontology/topLevelMetaAssertion.js +1 -1
  109. package/src/ontology/variable.js +64 -17
  110. package/src/substitutions.js +25 -25
  111. package/src/unifier/intrinsicLevel.js +18 -8
  112. package/src/unifier/metaLevel.js +35 -21
  113. package/src/utilities/brackets.js +3 -29
  114. package/src/utilities/context.js +5 -5
  115. package/src/utilities/json.js +28 -0
  116. package/src/utilities/metavariable.js +13 -0
  117. package/src/utilities/substitutions.js +2 -4
  118. package/src/utilities/unification.js +8 -24
  119. package/src/utilities/variable.js +22 -0
@@ -1,16 +1,18 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../../ontology";
4
3
  import Substitution from "../substitution";
5
4
  import TermSubstitutionPartialContext from "../../context/partial/substitution/term";
6
5
 
7
- import { define } from "../../ontology";
6
+ import ontology, { define } from "../../ontology";
7
+ import { nodeQuery } from "../../utilities/query";
8
8
  import { stripBracketsFromTerm } from "../../utilities/brackets";
9
- import { stripBracketsFromTermNode } from "../../utilities/brackets";
9
+ import { variableIdentifierFromVariableNode } from "../../utilities/variable";
10
+
11
+ const termVariableNodeQuery = nodeQuery("/term/variable!");
10
12
 
11
13
  export default define(class TermSubstitution extends Substitution {
12
- constructor(string, node, tokens, term, variable) {
13
- super(string, node, tokens);
14
+ constructor(context, string, node, tokens, term, variable) {
15
+ super(context, string, node, tokens);
14
16
 
15
17
  this.term = term;
16
18
  this.variable = variable;
@@ -24,6 +26,13 @@ export default define(class TermSubstitution extends Substitution {
24
26
  return this.variable;
25
27
  }
26
28
 
29
+ getReplacementNode() {
30
+ const termNode = this.term.getNode(),
31
+ replacementNode = termNode; ///
32
+
33
+ return replacementNode;
34
+ }
35
+
27
36
  isTrivial() {
28
37
  const termString = this.term.getString(),
29
38
  variableString = this.variable.getString(),
@@ -32,68 +41,125 @@ export default define(class TermSubstitution extends Substitution {
32
41
  return trivial;
33
42
  }
34
43
 
35
- isTermEqualTo(term, context) {
44
+ isTermEqualToTerm(term, context) {
36
45
  term = stripBracketsFromTerm(term, context); ///
37
46
 
38
- const termEqualTo = this.term.isEqualTo(term);
47
+ const termEqualToTerm = this.term.isEqualTo(term);
39
48
 
40
- return termEqualTo;
49
+ return termEqualToTerm;
41
50
  }
42
51
 
43
- isVariableEqualTo(variable) { return this.variable.isEqualTo(variable); }
52
+ isTermVariableEqualToTerm(termVariable, context) {
53
+ let termVariableEqualToTerm = false;
54
+
55
+ const termNode = this.term.getNode();
56
+
57
+ let termVariableNode;
58
+
59
+ termVariableNode = termVariableNodeQuery(termNode);
60
+
61
+ if (termVariableNode !== null) {
62
+ const termVariableNodeA = termVariableNode; ///
63
+
64
+ termVariableNode = termVariable.getNode();
65
+
66
+ const termVariableNodeB = termVariableNode, ///
67
+ termVariableNodeAMatchesTermVariableNodeB = termVariableNodeA.match(termVariableNodeB);
68
+
69
+ if (termVariableNodeAMatchesTermVariableNodeB) {
70
+ termVariableEqualToTerm = true;
71
+ }
72
+ }
73
+
74
+ return termVariableEqualToTerm;
75
+ }
44
76
 
45
77
  matchParameter(parameter) { return this.variable.matchParameter(parameter); }
46
78
 
47
- getReplacementNode() {
48
- const termNode = this.term.getNode(),
49
- replacementNode = termNode; ///
79
+ verify(context) {
80
+ let verifies = false;
50
81
 
51
- return replacementNode;
82
+ const termSubstitutionString = this.string; ///
83
+
84
+ context.trace(`Verifiying the '${termSubstitutionString}' term substitutin...`);
85
+
86
+ const termSimple = this.term.isSimple();
87
+
88
+ if (termSimple) {
89
+ if (this.variable === null) {
90
+ context.debug(`The specific term is not simple.`);
91
+ } else {
92
+ const variableIdentigier = this.variable.getIdentifier(),
93
+ variablePresent = context.isVariablePresentByVariableIdentifier(variableIdentigier);
94
+
95
+ if (variablePresent) {
96
+ const variable = this.term.getVariable(),
97
+ variableIdentigier = variable.getIdentifier(),
98
+ variablePresent = context.isVariablePresentByVariableIdentifier(variableIdentigier);
99
+
100
+ if (variablePresent) {
101
+ verifies = true;
102
+ } else {
103
+ const variableString = variable.getString();
104
+
105
+ context.debug(`The '${variableString}' variable is not present.`);
106
+ }
107
+ } else {
108
+ const variableString = this.variable.getString();
109
+
110
+ context.debug(`The '${variableString}' variable is not present.`);
111
+ }
112
+ }
113
+ } else {
114
+ context.debug(`The general term is not simple.`);
115
+ }
116
+
117
+ if (verifies) {
118
+ const substititoin = this; ///
119
+
120
+ context.addSubstitution(substititoin);
121
+
122
+ context.debug(`...verified the '${termSubstitutionString}' term substitutin.`);
123
+ }
124
+
125
+ return verifies;
52
126
  }
53
127
 
54
- static fromStatementNode(statementNode, context) {
128
+ static name = "TermSubstitution";
129
+
130
+ static fromStatement(statement, context) {
55
131
  let termSubstitution = null;
56
132
 
57
- const termSubstitutionNode = statementNode.getTermSubstitutionNode();
133
+ const statementNode = statement.getNode(),
134
+ termSubstitutionNode = statementNode.getTermSubstitutionNode();
58
135
 
59
136
  if (termSubstitutionNode !== null) {
60
- const lastTermNode = termSubstitutionNode.getLastTermNode(),
137
+ const { Term, Variable } = ontology,
61
138
  firstTermNode = termSubstitutionNode.getFirstTermNode(),
62
- singularVariableNode = lastTermNode.getSingularVariableNode(lastTermNode);
63
-
64
- if (singularVariableNode !== null) {
65
- const { Term, Variable } = ontology,
66
- termNode = firstTermNode, ///
67
- variableNode = singularVariableNode, ///
68
- term = Term.fromTermNode(termNode, context),
69
- variable = Variable.fromVariableNode(variableNode, context),
70
- node = termSubstitutionNode, ///
71
- tokens = context.nodeAsTokens(node),
72
- string = stringFromTermAndVariable(term, variable);
73
-
74
- termSubstitution = new TermSubstitution(string, node, tokens, term, variable);
75
- }
139
+ lastVariableNode = termSubstitutionNode.getLastVariableNode(),
140
+ termNode = firstTermNode, ///
141
+ variableNode = lastVariableNode, ///
142
+ term = Term.fromTermNode(termNode, context),
143
+ variable = Variable.fromVariableNode(variableNode, context),
144
+ node = termSubstitutionNode, ///
145
+ tokens = context.nodeAsTokens(node),
146
+ string = stringFromTermAndVariable(term, variable);
147
+
148
+ termSubstitution = new TermSubstitution(context, string, node, tokens, term, variable);
76
149
  }
77
150
 
78
151
  return termSubstitution;
79
152
  }
80
153
 
81
154
  static fromTernAndVariable(term, variable, context) {
82
- let termNode = term.getNode();
83
-
84
- termNode = stripBracketsFromTermNode(termNode); ///
85
-
86
- const { Term } = ontology;
87
-
88
- term = Term.fromTermNode(termNode, context);
89
-
90
- const string = stringFromTermAndVariable(term, variable),
91
- lexer = context.getLexer(),
155
+ const lexer = context.getLexer(),
92
156
  parser = context.getParser(),
157
+ string = stringFromTermAndVariable(term, variable),
93
158
  termSubstitutionPartialContext = TermSubstitutionPartialContext.fromStringLexerAndParser(string, lexer, parser),
94
159
  node = termSubstitutionPartialContext.getNode(),
95
- tokens = termSubstitutionPartialContext.getTokens(),
96
- termSubstitution = new TermSubstitution(string, node, tokens, term, variable);
160
+ tokens = termSubstitutionPartialContext.getTokens();
161
+
162
+ const termSubstitution = new TermSubstitution(context, string, node, tokens, term, variable);
97
163
 
98
164
  return termSubstitution;
99
165
  }
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  export default class Substitution {
4
- constructor(string, node, tokens) {
4
+ constructor(context, string, node, tokens) {
5
+ this.context = context;
5
6
  this.string = string;
6
7
  this.node = node;
7
8
  this.tokens = tokens;
8
9
  }
9
10
 
11
+ getContext() {
12
+ return this.context;
13
+ }
14
+
10
15
  getString() {
11
16
  return this.string;
12
17
  }
@@ -87,46 +92,46 @@ export default class Substitution {
87
92
  return equalTo;
88
93
  }
89
94
 
90
- isTermEqualTo(term) {
91
- const termEqualTo = false;
95
+ isTermEqualToTerm(term, context) {
96
+ const termEqualToTerm = false;
92
97
 
93
- return termEqualTo;
98
+ return termEqualToTerm;
94
99
  }
95
100
 
96
- isFrameEqualTo(frame) {
97
- const frameEqualTo = false;
101
+ isFrameEqualToFrame(frame) {
102
+ const frameEqualToFrame = false;
98
103
 
99
- return frameEqualTo;
104
+ return frameEqualToFrame;
100
105
  }
101
106
 
102
- isVariableEqualTo(variable) {
103
- const variableEqualTo = false;
107
+ isTermVariableEqualToTerm(termVariable, context) {
108
+ const termVariableEqualToTerm = false;
104
109
 
105
- return variableEqualTo;
110
+ return termVariableEqualToTerm;
106
111
  }
107
112
 
108
- isReferenceEqualTo(reference) {
109
- const referenceEqualTo = false;
113
+ isReferenceEqualToReference(reference, context) {
114
+ const referenceEqualToReference = false;
110
115
 
111
- return referenceEqualTo;
116
+ return referenceEqualToReference;
112
117
  }
113
118
 
114
- isStatementEqualTo(statement) {
115
- const statementEqualTo = false;
119
+ isStatementEqualToStatement(statement, context) {
120
+ const statementEqualToStatement = false;
116
121
 
117
- return statementEqualTo;
122
+ return statementEqualToStatement;
118
123
  }
119
124
 
120
- isMetavariableEqualTo(metavariable) {
121
- const metavariableEqualTo = false;
125
+ isMetavariableEqualToMetavariable(metavariable) {
126
+ const metavariableEqualToMetavariable = false;
122
127
 
123
- return metavariableEqualTo;
128
+ return metavariableEqualToMetavariable;
124
129
  }
125
130
 
126
- isSubstitutionEqualTo(substitution) {
127
- const substitutionEqualTo = (substitution === null);
131
+ isSubstitutionEqualToSubstitution(substitution) {
132
+ const substitutionEqualToSubstitution = (substitution === null);
128
133
 
129
- return substitutionEqualTo;
134
+ return substitutionEqualToSubstitution;
130
135
  }
131
136
 
132
137
  resolve(substitutions, context) {
@@ -1,20 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  import ontology from "../ontology";
4
+ import TemporaryContext from "../context/temporary";
4
5
 
5
6
  import { define } from "../ontology";
6
7
  import { assignAssignments } from "../utilities/assignments";
7
8
  import { subproofAssertionFromStatement } from "../utilities/context";
8
- import { statementFromJSON, procedureCallFromJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../utilities/json";
9
+ import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../utilities/json";
9
10
 
10
11
  export default define(class Supposition {
11
- constructor(node, string, statement, procedureCall) {
12
+ constructor(context, node, string, statement, procedureCall) {
13
+ this.context = context;
12
14
  this.node = node;
13
15
  this.string = string;
14
16
  this.statement = statement;
15
17
  this.procedureCall = procedureCall;
16
18
  }
17
19
 
20
+ getContext() {
21
+ return this.context;
22
+ }
23
+
18
24
  getNode() {
19
25
  return this.node;
20
26
  }
@@ -34,6 +40,10 @@ export default define(class Supposition {
34
40
  verify(context) {
35
41
  let verifies = false;
36
42
 
43
+ const temporaryContext = TemporaryContext.fromNothing(context);
44
+
45
+ context = temporaryContext; ///
46
+
37
47
  const suppositionString = this.string; ///
38
48
 
39
49
  context.trace(`Verifying the '${suppositionString}' supposition...`, this.node);
@@ -71,6 +81,8 @@ export default define(class Supposition {
71
81
  }
72
82
 
73
83
  if (verifies) {
84
+ this.context = context;
85
+
74
86
  context.debug(`...verified the '${suppositionString}' supposition.`, this.node);
75
87
  }
76
88
 
@@ -117,7 +129,7 @@ export default define(class Supposition {
117
129
  return unifiesIndependently;
118
130
  }
119
131
 
120
- unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext) {
132
+ unifyStepOrSubproof(stepOrSubproof, substitutions, context) {
121
133
  let stepOrSubproofUnifies = false;
122
134
 
123
135
  const stepOrSubProofStep = stepOrSubproof.isStep(),
@@ -131,40 +143,42 @@ export default define(class Supposition {
131
143
  substitutions.snapshot();
132
144
 
133
145
  if (subproof !== null) {
134
- const subproofUnifies = this.unifySubproof(subproof, substitutions, generalContext, specificContext);
146
+ const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
135
147
 
136
148
  stepOrSubproofUnifies = subproofUnifies; ///
137
149
  }
138
150
 
139
151
  if (step !== null) {
140
- const statementUnifies = this.unifyStep(step, substitutions, generalContext, specificContext);
152
+ const statementUnifies = this.unifyStep(step, substitutions, context);
141
153
 
142
154
  stepOrSubproofUnifies = statementUnifies; ///
143
155
  }
144
156
 
145
157
  if (stepOrSubproofUnifies) {
146
- substitutions.resolve(generalContext, specificContext);
158
+ substitutions.resolve(context);
147
159
  }
148
160
 
149
161
  stepOrSubproofUnifies ?
150
162
  substitutions.continue() :
151
- substitutions.rollback(specificContext);
163
+ substitutions.rollback(context);
152
164
 
153
165
  return stepOrSubproofUnifies;
154
166
  }
155
167
 
156
- unifyStep(step, substitutions, generalContext, specificContext) {
168
+ unifyStep(step, substitutions, context) {
157
169
  let stepUnifies;
158
170
 
171
+ context = step.getContext();
172
+
159
173
  const statement = step.getStatement(),
160
- statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
174
+ statementUnifies = this.unifyStatement(statement, substitutions, context);
161
175
 
162
176
  stepUnifies = statementUnifies; ///
163
177
 
164
178
  return stepUnifies;
165
179
  }
166
180
 
167
- unifySubproof(subproof, substitutions, generalContext, specificContext) {
181
+ unifySubproof(subproof, substitutions, context) {
168
182
  let subproofUnifies = false;
169
183
 
170
184
  const supposition = this, ///
@@ -172,52 +186,74 @@ export default define(class Supposition {
172
186
  suppositionStatement = supposition.getStatement(),
173
187
  suppositionStatementString = suppositionStatement.getString();
174
188
 
175
- specificContext.trace(`Unifying the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement...`);
189
+ context.trace(`Unifying the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement...`);
176
190
 
177
191
  if (this.statement !== null) {
178
192
  const context = generalContext, ///
179
193
  subproofAssertion = subproofAssertionFromStatement(this.statement, context);
180
194
 
181
195
  if (subproofAssertion !== null) {
196
+ const generalContext = this.context, ///
197
+ specificContext = context; ///
198
+
182
199
  subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
183
200
  }
184
201
  }
185
202
 
186
203
  if (subproofUnifies) {
187
- specificContext.debug(`...unified the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement.`);
204
+ context.debug(`...unified the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement.`);
188
205
  }
189
206
 
190
207
  return subproofUnifies;
191
208
  }
192
209
 
193
- unifyStatement(statement, substitutions, generalContext, specificContext) {
210
+ unifyStatement(statement, substitutions, context) {
194
211
  let statementUnifies;
195
212
 
196
213
  const supposition = this, ///
197
214
  statementString = statement.getString(),
198
215
  suppositionString = supposition.getString();
199
216
 
200
- specificContext.trace(`Unifying the '${statementString}' statement with the '${suppositionString}' supposition...`);
217
+ context.trace(`Unifying the '${statementString}' statement with the '${suppositionString}' supposition...`);
201
218
 
202
219
  if (this.statement !== null) {
220
+ const generalContext = this.context, ///
221
+ specificContext = context; ///
222
+
203
223
  statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
204
224
  }
205
225
 
206
226
  if (statementUnifies) {
207
- specificContext.debug(`...unified the '${statementString}' statement with the '${suppositionString}' supposition.`);
227
+ context.debug(`...unified the '${statementString}' statement with the '${suppositionString}' supposition.`);
208
228
  }
209
229
 
210
230
  return statementUnifies;
211
231
  }
212
232
 
213
233
  toJSON() {
214
- const statementJSON = statementToStatementJSON(this.statement),
215
- procedureCallJSON = procedureCallToProcedureCallJSON(this.procedureCall),
234
+ let frames,
235
+ terms;
236
+
237
+ frames = this.context.getFrames();
238
+
239
+ terms = this.context.getTerms();
240
+
241
+ const procedureCallJSON = procedureCallToProcedureCallJSON(this.procedureCall),
242
+ statementJSON = statementToStatementJSON(this.statement),
243
+ framesJSON = framesToFramesJSON(frames),
244
+ termsJSON = termsToTermsJSON(terms);
245
+
246
+ frames = framesJSON; ///
247
+
248
+ terms = termsJSON; ///
249
+
250
+ const procedureCall = procedureCallJSON, ///
216
251
  statement = statementJSON, ///
217
- procedureCall = procedureCallJSON, ///
218
252
  json = {
253
+ procedureCall,
219
254
  statement,
220
- procedureCall
255
+ frames,
256
+ terms
221
257
  };
222
258
 
223
259
  return json;
@@ -226,8 +262,11 @@ export default define(class Supposition {
226
262
  static name = "Supposition";
227
263
 
228
264
  static fromJSON(json, context) {
229
- const statement = statementFromJSON(json, context),
230
- procedureCall = procedureCallFromJSON(json, context);
265
+ const terms = termsFromJSON(json, context),
266
+ frames = framesFromJSON(json, context),
267
+ statement = statementFromJSON(json, context),
268
+ procedureCall = procedureCallFromJSON(json, context),
269
+ temporaryContext = TemporaryContext.fromTermsAndFrames(terms, frames, context);
231
270
 
232
271
  let string;
233
272
 
@@ -239,8 +278,11 @@ export default define(class Supposition {
239
278
  string = procedureCall.getString();
240
279
  }
241
280
 
242
- const node = null,
243
- supposition = new Supposition(node, string, statement, procedureCall);
281
+ const node = null;
282
+
283
+ context = temporaryContext; ///
284
+
285
+ const supposition = new Supposition(context, node, string, statement, procedureCall);
244
286
 
245
287
  return supposition;
246
288
  }
@@ -251,7 +293,11 @@ export default define(class Supposition {
251
293
  string = context.nodeAsString(node),
252
294
  statement = Statement.fromSuppositionNode(suppositionNode, context),
253
295
  procedureCall = ProcedureCall.fromSuppositionNode(suppositionNode, context),
254
- supposition = new Supposition(node, string, statement, procedureCall);
296
+ temporaryContext = null;
297
+
298
+ context = temporaryContext; ///
299
+
300
+ const supposition = new Supposition(context, node, string, statement, procedureCall);
255
301
 
256
302
  return supposition
257
303
  }
@@ -64,11 +64,7 @@ export default define(class Term {
64
64
  return variables;
65
65
  }
66
66
 
67
- matchTermNode(termNode) {
68
- const termNodeMatches = this.node.match(termNode);
69
-
70
- return termNodeMatches;
71
- }
67
+ matchTermNode(termNode) { return this.node.match(termNode); }
72
68
 
73
69
  isProvisional() { return this.type.isProvisional(); }
74
70
 
@@ -137,6 +133,10 @@ export default define(class Term {
137
133
  });
138
134
 
139
135
  if (verifies) {
136
+ const term = this; ///
137
+
138
+ context.addTerm(term);
139
+
140
140
  context.debug(`...verified the '${termString}' term.`);
141
141
  }
142
142
 
@@ -112,7 +112,7 @@ export default class TopLevelAssertion {
112
112
  const labelsVerify = this.verifyLabels();
113
113
 
114
114
  if (labelsVerify) {
115
- const localContext = LocalContext.fromContext(this.context),
115
+ const localContext = LocalContext.fromNothing(this.context),
116
116
  context = localContext, ///
117
117
  suppositionsVerify = this.verifySuppositions(context);
118
118
 
@@ -212,10 +212,10 @@ export default class TopLevelAssertion {
212
212
  return hypothesesCorrelate;
213
213
  }
214
214
 
215
- unifyStatementWithDeduction(statement, substitutions, generalContext, specificContext) {
215
+ unifyStatementWithDeduction(statement, substitutions, context) {
216
216
  let statementUnifiesWithDeduction = false;
217
217
 
218
- const statementUnifies = this.deduction.unifyStatement(statement, substitutions, generalContext, specificContext); ///
218
+ const statementUnifies = this.deduction.unifyStatement(statement, substitutions, context); ///
219
219
 
220
220
  if (statementUnifies) {
221
221
  statementUnifiesWithDeduction = true;
@@ -225,39 +225,37 @@ export default class TopLevelAssertion {
225
225
  }
226
226
 
227
227
  unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, substitutions, context) {
228
- let statementAndStepsOrSubproofsUnify = false;
228
+ let statementAndStepsOrSubproofsUnifies = false;
229
229
 
230
230
  const hypothesesCorrelate = this.correlateHypotheses(context);
231
231
 
232
232
  if (hypothesesCorrelate) {
233
- const generalContext = this.context, ///
234
- specificContext = context, ///
235
- statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, generalContext, specificContext);
233
+ const statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, context);
236
234
 
237
235
  if (statementUnifiesWithDeduction) {
238
- const stepsOrSubproofsUnifyWithSuppositions = this.unifyStepsOrSubproofsWithSuppositions(stepsOrSubproofs, substitutions, generalContext, specificContext);
236
+ const stepsOrSubproofsUnifyWithSuppositions = this.unifyStepsOrSubproofsWithSuppositions(stepsOrSubproofs, substitutions, context);
239
237
 
240
238
  if (stepsOrSubproofsUnifyWithSuppositions) {
241
239
  const substitutionsResolved = substitutions.areResolved();
242
240
 
243
241
  if (substitutionsResolved) {
244
- statementAndStepsOrSubproofsUnify = true;
242
+ statementAndStepsOrSubproofsUnifies = true;
245
243
  }
246
244
  }
247
245
  }
248
246
  }
249
247
 
250
- return statementAndStepsOrSubproofsUnify;
248
+ return statementAndStepsOrSubproofsUnifies;
251
249
  }
252
250
 
253
251
  unifyStepsOrSubproofsWithSupposition(stepsOrSubproofs, supposition, substitutions, generalContext, specificContext) {
254
- let stepsOrSubproofsUnifyWithSupposition = false;
252
+ let stepsOrSubproofsUnifiesWithSupposition = false;
255
253
 
256
254
  const context = specificContext, ///
257
255
  suppositionUnifiesIndependently = supposition.unifyIndependently(substitutions, context);
258
256
 
259
257
  if (suppositionUnifiesIndependently) {
260
- stepsOrSubproofsUnifyWithSupposition = true;
258
+ stepsOrSubproofsUnifiesWithSupposition = true;
261
259
  } else {
262
260
  const stepOrSubproof = extract(stepsOrSubproofs, (stepOrSubproof) => {
263
261
  const stepOrSubproofUnifies = supposition.unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext);
@@ -268,20 +266,20 @@ export default class TopLevelAssertion {
268
266
  }) || null;
269
267
 
270
268
  if (stepOrSubproof !== null) {
271
- stepsOrSubproofsUnifyWithSupposition = true;
269
+ stepsOrSubproofsUnifiesWithSupposition = true;
272
270
  }
273
271
  }
274
272
 
275
- return stepsOrSubproofsUnifyWithSupposition;
273
+ return stepsOrSubproofsUnifiesWithSupposition;
276
274
  }
277
275
 
278
276
  unifyStepsOrSubproofsWithSuppositions(stepsOrSubproofs, substitutions, generalContext, specificContext) {
279
277
  stepsOrSubproofs = reverse(stepsOrSubproofs); ///
280
278
 
281
279
  const stepsOrSubproofsUnifyWithSuppositions = backwardsEvery(this.suppositions, (supposition) => {
282
- const stepsOrSubproofsUnifyWithSupposition = this.unifyStepsOrSubproofsWithSupposition(stepsOrSubproofs, supposition, substitutions, generalContext, specificContext);
280
+ const stepsOrSubproofsUnifiesWithSupposition = this.unifyStepsOrSubproofsWithSupposition(stepsOrSubproofs, supposition, substitutions, generalContext, specificContext);
283
281
 
284
- if (stepsOrSubproofsUnifyWithSupposition) {
282
+ if (stepsOrSubproofsUnifiesWithSupposition) {
285
283
  return true;
286
284
  }
287
285
  });
@@ -73,7 +73,7 @@ export default class TopLevelMetaAssertion {
73
73
  const labelVerifies = this.verifyLabel();
74
74
 
75
75
  if (labelVerifies) {
76
- const localContext = LocalContext.fromContext(this.context),
76
+ const localContext = LocalContext.fromNothing(this.context),
77
77
  context = localContext, ///
78
78
  suppositionsVerify = this.verifySuppositions(context);
79
79