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
@@ -12,6 +12,41 @@ import { equalityFromStatement,
12
12
  containedAssertionFromStatement,
13
13
  satisfiesAssertionFromStatement } from "../../utilities/context";
14
14
 
15
+ function verifyAsMetavariableAndSubstitution(statement, assignments, stated, context) {
16
+ let verifiesAsMetavariableAndSubstitution = false;
17
+
18
+ const metavariable = metavariableFromStatement(statement, context);
19
+
20
+ if (metavariable !== null) {
21
+ const statementString = statement.getString();
22
+
23
+ context.trace(`Verifying the '${statementString}' statement as a metavariable and substitution...`);
24
+
25
+ const metavariableVerifies = metavariable.verify(context);
26
+
27
+ if (metavariableVerifies) {
28
+ const { TermSubstitution, FrameSubstitution } = ontology,
29
+ substitution = TermSubstitution.fromStatement(statement, context) || FrameSubstitution.fromStatement(statement, context);
30
+
31
+ if (substitution !== null) {
32
+ const substitutionVerifies = substitution.verify(context);
33
+
34
+ if (substitutionVerifies) {
35
+ verifiesAsMetavariableAndSubstitution = true;
36
+ }
37
+ } else {
38
+ verifiesAsMetavariableAndSubstitution = true;
39
+ }
40
+ }
41
+
42
+ if (verifiesAsMetavariableAndSubstitution) {
43
+ context.debug(`...verified the '${statementString}' statement as a metavariable and substitution.`);
44
+ }
45
+ }
46
+
47
+ return verifiesAsMetavariableAndSubstitution;
48
+ }
49
+
15
50
  function unifyWithBracketedCombinator(statement, assignments, stated, context) {
16
51
  stated = true; ///
17
52
 
@@ -41,28 +76,6 @@ function unifyWithCombinators(statement, assignments, stated, context) {
41
76
  return unifiesWithCombinators;
42
77
  }
43
78
 
44
- function verifyAsMetavariable(statement, assignments, stated, context) {
45
- let verifiesAsMetavariable = false;
46
-
47
- const metavariable = metavariableFromStatement(statement, context);
48
-
49
- if (metavariable !== null) {
50
- const statementString = statement.getString();
51
-
52
- context.trace(`Verifying the '${statementString}' statement as a metavariable...`);
53
-
54
- const metavariableVerifies = metavariable.verify(context);
55
-
56
- verifiesAsMetavariable = metavariableVerifies; ///
57
-
58
- if (verifiesAsMetavariable) {
59
- context.debug(`...verified the '${statementString}' statement as a metavariable.`);
60
- }
61
- }
62
-
63
- return verifiesAsMetavariable;
64
- }
65
-
66
79
  function verifyAsEquality(statement, assignments, stated, context) {
67
80
  let verifiesAsEquality = false;
68
81
 
@@ -122,6 +135,10 @@ function verifyAsTypeAssertion(statement, assignments, stated, context) {
122
135
  verifiesAsTypeAssertion = typeAssertionVerifies; ///
123
136
 
124
137
  if (verifiesAsTypeAssertion) {
138
+ const assertion = typeAssertion; ///
139
+
140
+ context.addAssertion(assertion);
141
+
125
142
  context.debug(`...verified the '${statementString}' statement as a type assertion.`);
126
143
  }
127
144
  }
@@ -144,6 +161,10 @@ function verifyAsDefinedAssertion(statement, assignments, stated, context) {
144
161
  verifiesAsDefinedAssertion = definedAssertionVerifies; ///
145
162
 
146
163
  if (verifiesAsDefinedAssertion) {
164
+ const assertion = definedAssertion; ///
165
+
166
+ context.addAssertion(assertion);
167
+
147
168
  context.debug(`...verified the '${statementString}' statement as a defined assertion.`);
148
169
  }
149
170
  }
@@ -166,6 +187,10 @@ function verifyAsPropertyAssertion(statement, assignments, stated, context) {
166
187
  verifiesAsPropertyAssertion = propertyAssertionVerifies; ///
167
188
 
168
189
  if (verifiesAsPropertyAssertion) {
190
+ const assertion = propertyAssertion; ///
191
+
192
+ context.addAssertion(assertion);
193
+
169
194
  context.debug(`...verified the '${statementString}' statement as a property assertion.`);
170
195
  }
171
196
  }
@@ -188,6 +213,10 @@ function verifyAsSubproofAssertion(statement, assignments, stated, context) {
188
213
  verifiesAsSubproofAssertion = subproofAssertionVerifies; ///
189
214
 
190
215
  if (verifiesAsSubproofAssertion) {
216
+ const assertion = subproofAssertion; ///
217
+
218
+ context.addAssertion(assertion);
219
+
191
220
  context.debug(`...verified the '${statementString}' statement as a subproof assertion.`);
192
221
  }
193
222
  }
@@ -210,6 +239,10 @@ function verifyAsContainedAssertion(statement, assignments, stated, context) {
210
239
  verifiesAsContainedAssertion = containedAssertionVerifies; ///
211
240
 
212
241
  if (verifiesAsContainedAssertion) {
242
+ const assertion = containedAssertion; ///
243
+
244
+ context.addAssertion(assertion);
245
+
213
246
  context.debug(`...verified the '${statementString}' statement as a contained assertion.`);
214
247
  }
215
248
  }
@@ -232,6 +265,10 @@ function verifyAsSatisfiesAssertion(statement, assignments, stated, context) {
232
265
  verifiesAsSatisfiesAssertion = satisfiesAssertionVerifies; ///
233
266
 
234
267
  if (verifiesAsSatisfiesAssertion) {
268
+ const assertion = satisfiesAssertion; ///
269
+
270
+ context.addAssertion(assertion);
271
+
235
272
  context.debug(`...verified the '${statementString}' statement as a satisfies assertion.`);
236
273
  }
237
274
  }
@@ -240,9 +277,9 @@ function verifyAsSatisfiesAssertion(statement, assignments, stated, context) {
240
277
  }
241
278
 
242
279
  const verifyMixins = [
280
+ verifyAsMetavariableAndSubstitution,
243
281
  unifyWithBracketedCombinator,
244
282
  unifyWithCombinators,
245
- verifyAsMetavariable,
246
283
  verifyAsEquality,
247
284
  verifyAsJudgement,
248
285
  verifyAsTypeAssertion,
@@ -59,7 +59,7 @@ function unifyWithReference(statement, reference, satisfiesAssertion, substituti
59
59
  statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
60
60
  substitution = statementSubstitution; ///
61
61
 
62
- substitutions.addSubstitution(substitution, specificContext);
62
+ substitutions.addSubstitution(substitution, context);
63
63
 
64
64
  unifiesWithReference = true;
65
65
 
@@ -164,7 +164,7 @@ function unifyWithAxiomLemmaTheoremOrConjecture(statement, reference, satisfiesA
164
164
 
165
165
  substitutions = generalSubstitutions; ///
166
166
 
167
- substitutions.addSubstitution(substitution, specificContext);
167
+ substitutions.addSubstitution(substitution, context);
168
168
 
169
169
  unifiesWithAxiomLemmaTheoremOrConjecture = true;
170
170
  }
@@ -19,5 +19,31 @@ export default class FrameSubstitutionNode extends NonTerminalNode {
19
19
  return firstFrameNode;
20
20
  }
21
21
 
22
+ getLastMetavariableNode() {
23
+ let lastMetavariableNode = null;
24
+
25
+ const lastFrameNode = this.getLastFrameNode(),
26
+ singularMetavariableNode = lastFrameNode.getSingularMetavariableNode();
27
+
28
+ if (singularMetavariableNode !== null) {
29
+ lastMetavariableNode = singularMetavariableNode; ///
30
+ }
31
+
32
+ return lastMetavariableNode;
33
+ }
34
+
35
+ getFirstMetavariableNode() {
36
+ let firstMetavariableNode = null;
37
+
38
+ const firstFrameNode = this.getFirstFrameNode(),
39
+ singularMetavariableNode = firstFrameNode.getSingularMetavariableNode();
40
+
41
+ if (singularMetavariableNode !== null) {
42
+ firstMetavariableNode = singularMetavariableNode; ///
43
+ }
44
+
45
+ return firstMetavariableNode;
46
+ }
47
+
22
48
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(FrameSubstitutionNode, ruleName, childNodes, opacity, precedence); }
23
49
  }
@@ -19,5 +19,31 @@ export default class TermSubstitutionNode extends NonTerminalNode {
19
19
  return firstTermNode;
20
20
  }
21
21
 
22
+ getLastVariableNode() {
23
+ let lastVariableNode = null;
24
+
25
+ const lastTermNode = this.getLastTermNode(),
26
+ singularVariableNode = lastTermNode.getSingularVariableNode();
27
+
28
+ if (singularVariableNode !== null) {
29
+ lastVariableNode = singularVariableNode; ///
30
+ }
31
+
32
+ return lastVariableNode;
33
+ }
34
+
35
+ getFirstVariableNode() {
36
+ let firstVariableNode = null;
37
+
38
+ const firstTermNode = this.getFirstTermNode(),
39
+ singularVariableNode = firstTermNode.getSingularVariableNode();
40
+
41
+ if (singularVariableNode !== null) {
42
+ firstVariableNode = singularVariableNode; ///
43
+ }
44
+
45
+ return firstVariableNode;
46
+ }
47
+
22
48
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(TermSubstitutionNode, ruleName, childNodes, opacity, precedence); }
23
49
  }
@@ -1,34 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  import ontology from "../../ontology";
4
- import LocalContext from "../../context/local";
4
+ import Assertion from "../assertion";
5
+ import TemporaryContext from "../../context/temporary";
5
6
 
6
7
  import { define } from "../../ontology";
7
8
  import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions, statementFromStatementAndSubstitutions } from "../../utilities/substitutions";
8
9
 
9
- export default define(class ContainedAssertion {
10
+ export default define(class ContainedAssertion extends Assertion {
10
11
  constructor(string, node, tokens, term, frame, negated, statement) {
11
- this.string = string;
12
- this.node = node;
13
- this.tokens = tokens;
12
+ super(string, node, tokens);
13
+
14
14
  this.term = term;
15
15
  this.frame = frame;
16
16
  this.negated = negated;
17
17
  this.statement = statement;
18
18
  }
19
19
 
20
- getString() {
21
- return this.string;
22
- }
23
-
24
- getNode() {
25
- return this.node;
26
- }
27
-
28
- getTokens() {
29
- return this.tokens;
30
- }
31
-
32
20
  getTerm() {
33
21
  return this.term;
34
22
  }
@@ -48,7 +36,7 @@ export default define(class ContainedAssertion {
48
36
  verify(assignments, stated, context) {
49
37
  let verifies = false;
50
38
 
51
- const containedAssertionString = this.string; ///
39
+ const containedAssertionString = this.getString(); ///
52
40
 
53
41
  context.trace(`Verifying the '${containedAssertionString}' contained assertion...`);
54
42
 
@@ -159,7 +147,7 @@ export default define(class ContainedAssertion {
159
147
  verifyWhenStated(assignments, context) {
160
148
  let verifiesWhenStated;
161
149
 
162
- const containedAssertionString = this.string; ///
150
+ const containedAssertionString = this.getString(); ///
163
151
 
164
152
  context.trace(`Verifying the '${containedAssertionString}' stated contained assertion...`);
165
153
 
@@ -175,7 +163,7 @@ export default define(class ContainedAssertion {
175
163
  verifyWhenDerived(context) {
176
164
  let verifiesWhenDerived;
177
165
 
178
- const containedAssertionString = this.string; ///
166
+ const containedAssertionString = this.getString(); ///
179
167
 
180
168
  context.trace(`Verifying the '${containedAssertionString}' derived contained assertion...`);
181
169
 
@@ -191,13 +179,14 @@ export default define(class ContainedAssertion {
191
179
  unifyIndependently(substitutions, context) {
192
180
  let unifiesIndependently;
193
181
 
194
- const containedAssertionString = this.string; ///
182
+ const containedAssertionString = this.getString(); ///
195
183
 
196
184
  context.trace(`Unifying the '${containedAssertionString}' contained assertion independently...`);
197
185
 
198
- const localContext = LocalContext.fromContextAndTokens(context, this.tokens);
186
+ const tokens = this.getTokens(),
187
+ temporaryContext = TemporaryContext.fromContextAndTokens(context, tokens);
199
188
 
200
- context = localContext; ///
189
+ context = temporaryContext; ///
201
190
 
202
191
  const term = termFromTermAndSubstitutions(this.term, substitutions, context),
203
192
  frame = frameFromFrameAndSubstitutions(this.frame, substitutions, context),
@@ -1,33 +1,21 @@
1
1
  "use strict";
2
2
 
3
3
  import ontology from "../../ontology";
4
- import LocalContext from "../../context/local";
4
+ import Assertion from "../assertion";
5
+ import TemporaryContext from "../../context/temporary";
5
6
 
6
7
  import { define } from "../../ontology";
7
8
  import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions } from "../../utilities/substitutions";
8
9
 
9
- export default define(class DefinedAssertion {
10
+ export default define(class DefinedAssertion extends Assertion {
10
11
  constructor(string, node, tokens, term, frame, negated) {
11
- this.string = string;
12
- this.node = node;
13
- this.tokens = tokens;
12
+ super(string, node, tokens);
13
+
14
14
  this.term = term;
15
15
  this.frame= frame;
16
16
  this.negated = negated;
17
17
  }
18
18
 
19
- getString() {
20
- return this.string;
21
- }
22
-
23
- getNode() {
24
- return this.node;
25
- }
26
-
27
- getTokens() {
28
- return this.tokens;
29
- }
30
-
31
19
  getTerm() {
32
20
  return this.term;
33
21
  }
@@ -43,7 +31,7 @@ export default define(class DefinedAssertion {
43
31
  verify(assignments, stated, context) {
44
32
  let verifies = false;
45
33
 
46
- const definedAssertionString = this.string; ///
34
+ const definedAssertionString = this.getString(); ///
47
35
 
48
36
  context.trace(`Verifying the '${definedAssertionString}' defined assertion...`);
49
37
 
@@ -131,7 +119,7 @@ export default define(class DefinedAssertion {
131
119
  verifyWhenStated(assignments, context) {
132
120
  let verifiesWhenStated;
133
121
 
134
- const definedAssertionString = this.string; ///
122
+ const definedAssertionString = this.getString(); ///
135
123
 
136
124
  context.trace(`Verifying the '${definedAssertionString}' stated defined assertion...`);
137
125
 
@@ -147,7 +135,7 @@ export default define(class DefinedAssertion {
147
135
  verifyWhenDerived(context) {
148
136
  let verifiesWhenDerived;
149
137
 
150
- const definedAssertionString = this.string; ///
138
+ const definedAssertionString = this.getString(); ///
151
139
 
152
140
  context.trace(`Verifying the '${definedAssertionString}' derived defined assertion...`);
153
141
 
@@ -163,13 +151,14 @@ export default define(class DefinedAssertion {
163
151
  unifyIndependently(substitutions, context) {
164
152
  let unifiesIndependently;
165
153
 
166
- const definedAssertionString = this.string; ///
154
+ const definedAssertionString = this.getString(); ///
167
155
 
168
156
  context.trace(`Unifying the '${definedAssertionString}' defined assertion independently...`);
169
157
 
170
- const localContext = LocalContext.fromContextAndTokens(context, this.tokens);
158
+ const tokens = this.getTokens(),
159
+ temporaryContext = TemporaryContext.fromContextAndTokens(context, tokens);
171
160
 
172
- context = localContext; ///
161
+ context = temporaryContext; ///
173
162
 
174
163
  const term = termFromTermAndSubstitutions(this.term, substitutions, context),
175
164
  frame = frameFromFrameAndSubstitutions(this.frame, substitutions, context),
@@ -1,32 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  import ontology from "../../ontology";
4
-
4
+ import Assertion from "../assertion";
5
5
  import VariableAssignment from "../../assignment/variable";
6
6
 
7
7
  import { define } from "../../ontology";
8
8
 
9
- export default define(class PropertyAssertion {
9
+ export default define(class PropertyAssertion extends Assertion {
10
10
  constructor(string, node, tokens, term, propertyRelation) {
11
- this.string = string;
12
- this.node = node;
13
- this.tokens = tokens;
11
+ super(string, node, tokens);
12
+
14
13
  this.term = term;
15
14
  this.propertyRelation = propertyRelation;
16
15
  }
17
16
 
18
- getString() {
19
- return this.string;
20
- }
21
-
22
- getNode() {
23
- return this.node;
24
- }
25
-
26
- getTokens() {
27
- return this.tokens;
28
- }
29
-
30
17
  getTerm() {
31
18
  return this.term;
32
19
  }
@@ -64,7 +51,7 @@ export default define(class PropertyAssertion {
64
51
  verify(assignments, stated, context) {
65
52
  let verifies = false;
66
53
 
67
- const propertyAssertionString = this.string; ///
54
+ const propertyAssertionString = this.getString(); ///
68
55
 
69
56
  context.trace(`Verifying the '${propertyAssertionString}' property assertion...`);
70
57
 
@@ -141,7 +128,7 @@ export default define(class PropertyAssertion {
141
128
  verifyWhenStated(assignments, context) {
142
129
  let verifiesWhenStated = false;
143
130
 
144
- const propertyAssertionString = this.string; ///
131
+ const propertyAssertionString = this.getString(); ///
145
132
 
146
133
  context.trace(`Verifying the '${propertyAssertionString}' stated property assertion...`);
147
134
 
@@ -157,7 +144,7 @@ export default define(class PropertyAssertion {
157
144
  verifyWhenDerived(context) {
158
145
  let verifiesWhenDerived;
159
146
 
160
- const propertyAssertionString = this.string; ///
147
+ const propertyAssertionString = this.getString(); ///
161
148
 
162
149
  context.trace(`Verifying the '${propertyAssertionString}' derived property assertion...`);
163
150
 
@@ -1,28 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  import ontology from "../../ontology";
4
+ import Assertion from "../assertion";
5
+ import Substitutions from "../../substitutions";
4
6
 
5
7
  import { define } from "../../ontology";
6
8
 
7
- import Substitutions from "../../substitutions";
8
-
9
- export default define(class SatisfiesAssertion {
9
+ export default define(class SatisfiesAssertion extends Assertion {
10
10
  constructor(string, node, tokens, signature, reference) {
11
- this.string = string;
12
- this.node = node;
13
- this.tokens = tokens;
11
+ super(string, node, tokens);
12
+
14
13
  this.signature = signature;
15
14
  this.reference = reference;
16
15
  }
17
16
 
18
- getString() {
19
- return this.string;
20
- }
21
-
22
- getNode() {
23
- return this.node;
24
- }
25
-
26
17
  getTokens() {
27
18
  return this.tokens;
28
19
  }
@@ -42,7 +33,7 @@ export default define(class SatisfiesAssertion {
42
33
  verify(assignments, stated, context) {
43
34
  let verifies = false;
44
35
 
45
- const satisfiesAssertionString = this.string; ///
36
+ const satisfiesAssertionString = this.getString(); ///
46
37
 
47
38
  context.trace(`Verifying the '${satisfiesAssertionString}' satisfies assertion...`);
48
39
 
@@ -95,7 +86,7 @@ export default define(class SatisfiesAssertion {
95
86
  let statementUnifies = false;
96
87
 
97
88
  const statementString = statement.getString(),
98
- satisfiesAssertionString = this.string; ///
89
+ satisfiesAssertionString = this.getString(); ///
99
90
 
100
91
  context.trace(`Unifying the '${statementString}' statement with the '${satisfiesAssertionString}' satisfies assertion...`);
101
92
 
@@ -3,63 +3,28 @@
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
5
  import ontology from "../../ontology";
6
+ import Assertion from "../assertion";
6
7
 
7
8
  import { define } from "../../ontology";
8
9
  import { unifyStatement } from "../../utilities/unification";
9
10
 
10
11
  const { match } = arrayUtilities;
11
12
 
12
- export default define(class SubproofAssertion {
13
- constructor(string, node, statements) {
14
- this.string = string;
15
- this.node = node;
16
- this.statements = statements;
17
- }
18
-
19
- getString() {
20
- return this.string;
21
- }
13
+ export default define(class SubproofAssertion extends Assertion {
14
+ constructor(string, node, tokens, statements) {
15
+ super(string, node, tokens);
22
16
 
23
- getNode() {
24
- return this.node;
17
+ this.statements = statements;
25
18
  }
26
19
 
27
20
  getStatements() {
28
21
  return this.statements;
29
22
  }
30
23
 
31
- unifySubproof(subproof, substitutions, generalContext, specificContext) {
32
- let subproofUnifies;
33
-
34
- const subproofString = subproof.getString(),
35
- subproofAssertionString = this.string; ///
36
-
37
- specificContext.trace(`Unifying the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion...`);
38
-
39
- const subproofStatements = subproof.getStatements(),
40
- subproofAssertionStatements = this.statements; ///
41
-
42
- subproofUnifies = match(subproofAssertionStatements, subproofStatements, (subproofAssertionStatement, subproofStatement) => {
43
- const generalStatement = subproofAssertionStatement, ///
44
- specificStatement = subproofStatement, ///
45
- statementUnifies = unifyStatement(generalStatement, specificStatement, substitutions, generalContext, specificContext);
46
-
47
- if (statementUnifies) {
48
- return true;
49
- }
50
- });
51
-
52
- if (subproofUnifies) {
53
- specificContext.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
54
- }
55
-
56
- return subproofUnifies;
57
- }
58
-
59
24
  verify(assignments, stated, context) {
60
25
  let verifies;
61
26
 
62
- const subproofAssertionString = this.string; ///
27
+ const subproofAssertionString = this.getString(); ///
63
28
 
64
29
  context.trace(`Verifying the '${subproofAssertionString}' subproof assertion...`);
65
30
 
@@ -90,6 +55,34 @@ export default define(class SubproofAssertion {
90
55
  return statementsVerify;
91
56
  }
92
57
 
58
+ unifySubproof(subproof, substitutions, generalContext, specificContext) {
59
+ let subproofUnifies;
60
+
61
+ const subproofString = subproof.getString(),
62
+ subproofAssertionString = this.getString(); ///
63
+
64
+ specificContext.trace(`Unifying the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion...`);
65
+
66
+ const subproofStatements = subproof.getStatements(),
67
+ subproofAssertionStatements = this.statements; ///
68
+
69
+ subproofUnifies = match(subproofAssertionStatements, subproofStatements, (subproofAssertionStatement, subproofStatement) => {
70
+ const generalStatement = subproofAssertionStatement, ///
71
+ specificStatement = subproofStatement, ///
72
+ statementUnifies = unifyStatement(generalStatement, specificStatement, substitutions, generalContext, specificContext);
73
+
74
+ if (statementUnifies) {
75
+ return true;
76
+ }
77
+ });
78
+
79
+ if (subproofUnifies) {
80
+ specificContext.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
81
+ }
82
+
83
+ return subproofUnifies;
84
+ }
85
+
93
86
  static name = "SubproofAssertion";
94
87
 
95
88
  static fromStatementNode(statementNode, context) {
@@ -99,10 +92,11 @@ export default define(class SubproofAssertion {
99
92
 
100
93
  if (subproofAssertionNode !== null) {
101
94
  const node = subproofAssertionNode, ///
95
+ tokens = null,
102
96
  string = context.nodeAsString(node),
103
97
  statements = statementsFromSubproofAssertionNode(subproofAssertionNode, context);
104
98
 
105
- subproofAssertion = new SubproofAssertion(string, node, statements);
99
+ subproofAssertion = new SubproofAssertion(string, node, tokens, statements);
106
100
  }
107
101
 
108
102
  return subproofAssertion;