occam-verify-cli 1.0.587 → 1.0.603

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 (105) hide show
  1. package/lib/context/ephemeral.js +74 -2
  2. package/lib/context/file/nominal.js +11 -9
  3. package/lib/context/liminal.js +161 -24
  4. package/lib/context/literal.js +8 -2
  5. package/lib/context/scoped.js +4 -28
  6. package/lib/context/synthetic.js +146 -0
  7. package/lib/context.js +170 -1
  8. package/lib/element/assertion/contained.js +21 -15
  9. package/lib/element/assertion/defined.js +45 -65
  10. package/lib/element/assertion/property.js +25 -19
  11. package/lib/element/assertion/satisfies.js +14 -8
  12. package/lib/element/assertion/subproof.js +12 -6
  13. package/lib/element/assertion.js +47 -1
  14. package/lib/element/assumption.js +12 -12
  15. package/lib/element/conclusion.js +2 -2
  16. package/lib/element/deduction.js +2 -2
  17. package/lib/element/frame.js +61 -29
  18. package/lib/element/judgement.js +7 -1
  19. package/lib/element/label.js +8 -8
  20. package/lib/element/metavariable.js +71 -59
  21. package/lib/element/procedureCall.js +24 -8
  22. package/lib/element/proof.js +43 -35
  23. package/lib/element/proofAssertion/premise.js +122 -97
  24. package/lib/element/proofAssertion/step.js +161 -115
  25. package/lib/element/proofAssertion/supposition.js +157 -118
  26. package/lib/element/proofAssertion.js +3 -3
  27. package/lib/element/reference.js +40 -7
  28. package/lib/element/rule.js +227 -95
  29. package/lib/element/signature.js +2 -1
  30. package/lib/element/statement.js +67 -34
  31. package/lib/element/substitution/frame.js +36 -16
  32. package/lib/element/substitution/reference.js +36 -16
  33. package/lib/element/substitution/statement.js +94 -55
  34. package/lib/element/substitution/term.js +36 -16
  35. package/lib/element/substitution.js +54 -17
  36. package/lib/element/substitutions.js +4 -276
  37. package/lib/element/term.js +60 -31
  38. package/lib/element/topLevelAssertion/axiom.js +13 -4
  39. package/lib/element/topLevelAssertion/conjecture.js +7 -2
  40. package/lib/element/topLevelAssertion/theorem.js +7 -2
  41. package/lib/element/topLevelAssertion.js +201 -134
  42. package/lib/element/topLevelMetaAssertion.js +310 -51
  43. package/lib/element/variable.js +15 -6
  44. package/lib/node/substitution/statement.js +33 -1
  45. package/lib/process/unify.js +6 -6
  46. package/lib/utilities/context.js +10 -25
  47. package/lib/utilities/element.js +34 -9
  48. package/lib/utilities/statement.js +1 -8
  49. package/lib/utilities/string.js +12 -1
  50. package/lib/utilities/substitutions.js +42 -16
  51. package/lib/utilities/unification.js +3 -1
  52. package/lib/utilities/validation.js +2 -2
  53. package/package.json +4 -4
  54. package/src/context/ephemeral.js +73 -1
  55. package/src/context/file/nominal.js +14 -11
  56. package/src/context/liminal.js +180 -25
  57. package/src/context/literal.js +3 -1
  58. package/src/context/scoped.js +3 -35
  59. package/src/context/synthetic.js +49 -0
  60. package/src/context.js +163 -1
  61. package/src/element/assertion/contained.js +28 -20
  62. package/src/element/assertion/defined.js +62 -34
  63. package/src/element/assertion/property.js +27 -19
  64. package/src/element/assertion/satisfies.js +15 -7
  65. package/src/element/assertion/subproof.js +13 -5
  66. package/src/element/assertion.js +35 -0
  67. package/src/element/assumption.js +5 -5
  68. package/src/element/conclusion.js +2 -4
  69. package/src/element/deduction.js +2 -4
  70. package/src/element/frame.js +71 -39
  71. package/src/element/judgement.js +2 -0
  72. package/src/element/label.js +4 -4
  73. package/src/element/metavariable.js +94 -75
  74. package/src/element/procedureCall.js +6 -6
  75. package/src/element/proof.js +6 -6
  76. package/src/element/proofAssertion/premise.js +101 -69
  77. package/src/element/proofAssertion/step.js +78 -39
  78. package/src/element/proofAssertion/supposition.js +141 -115
  79. package/src/element/proofAssertion.js +3 -2
  80. package/src/element/reference.js +52 -10
  81. package/src/element/rule.js +138 -76
  82. package/src/element/signature.js +2 -0
  83. package/src/element/statement.js +76 -45
  84. package/src/element/substitution/frame.js +44 -15
  85. package/src/element/substitution/reference.js +44 -15
  86. package/src/element/substitution/statement.js +124 -72
  87. package/src/element/substitution/term.js +43 -15
  88. package/src/element/substitution.js +55 -18
  89. package/src/element/substitutions.js +1 -258
  90. package/src/element/term.js +65 -34
  91. package/src/element/topLevelAssertion/axiom.js +1 -1
  92. package/src/element/topLevelAssertion/conjecture.js +1 -1
  93. package/src/element/topLevelAssertion/theorem.js +1 -1
  94. package/src/element/topLevelAssertion.js +128 -48
  95. package/src/element/topLevelMetaAssertion.js +86 -32
  96. package/src/element/variable.js +15 -5
  97. package/src/node/substitution/statement.js +33 -0
  98. package/src/process/unify.js +6 -8
  99. package/src/utilities/context.js +9 -8
  100. package/src/utilities/element.js +37 -10
  101. package/src/utilities/statement.js +0 -7
  102. package/src/utilities/string.js +14 -0
  103. package/src/utilities/substitutions.js +59 -17
  104. package/src/utilities/unification.js +4 -0
  105. package/src/utilities/validation.js +3 -1
@@ -186,15 +186,10 @@ class ScopedContext extends Context {
186
186
  findJudgementByMetavariable(metavariable) {
187
187
  const judgements = this.getJudgements(),
188
188
  judgement = judgements.find((judgement) => {
189
- const judgementSingular = judgement.isSingular();
189
+ const judgementMetavariableComparesToMetavariable = judgement.compareMetavariable(metavariable);
190
190
 
191
- if (judgementSingular) {
192
- const judgementMetavariable = judgement.getMetavariable(),
193
- judgementMetavariableEqualToMetavariable = judgementMetavariable.isEqualTo(metavariable);
194
-
195
- if (judgementMetavariableEqualToMetavariable) {
196
- return true;
197
- }
191
+ if (judgementMetavariableComparesToMetavariable) {
192
+ return true;
198
193
  }
199
194
  }) || null;
200
195
 
@@ -235,33 +230,6 @@ class ScopedContext extends Context {
235
230
  return termGrounded;
236
231
  }
237
232
 
238
- isVariableDefined(variable) {
239
- const context = this, ///
240
- equivalences = this.getEquivalences(),
241
- groundedTerms = [],
242
- definedVariables = [];
243
-
244
- equivalences.separateGroundedTermsAndDefinedVariables(groundedTerms, definedVariables, context);
245
-
246
- const variableMatchesDefinedVariable = definedVariables.some((definedVariable) => {
247
- const definedVariableEqualToVariable = definedVariable.isEqualTo(variable);
248
-
249
- if (definedVariableEqualToVariable === variable) {
250
- return true;
251
- }
252
- }),
253
- variableDefined = variableMatchesDefinedVariable; ///
254
-
255
- return variableDefined;
256
- }
257
-
258
- isMetavariableDefined(metavariable) {
259
- const judgementPresent = this.isJudgementPresentByMetavariable(metavariable),
260
- metavariableDefined = judgementPresent; ///
261
-
262
- return metavariableDefined
263
- }
264
-
265
233
  isJudgementPresentByMetavariable(metavariable) {
266
234
  const judgement = this.findJudgementByMetavariable(metavariable),
267
235
  judgementPresent = (judgement !== null);
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ import Context from "../context";
4
+
5
+ export default class SyntheticContext extends Context {
6
+ constructor(context, contexts) {
7
+ super(context);
8
+
9
+ this.contexts = contexts;
10
+ }
11
+
12
+ getContexts() {
13
+ return this.contexts;
14
+ }
15
+
16
+ findTermByTermNode(termNode) {
17
+ let term = null;
18
+
19
+ this.contexts.some((context) => {
20
+ term = context.findTermByTermNode(termNode);
21
+
22
+ if (term !== null) {
23
+ return true;
24
+ }
25
+ });
26
+
27
+ return term;
28
+ }
29
+
30
+ findFrameByFrameNode(frameNode) {
31
+ let frame = null;
32
+
33
+ this.contexts.some((context) => {
34
+ frame = context.findFrameByFrameNode(frameNode);
35
+
36
+ if (frame !== null) {
37
+ return true;
38
+ }
39
+ });
40
+
41
+ return frame;
42
+ }
43
+
44
+ static fromContexts(contexts, context) {
45
+ const syntheticContext = new SyntheticContext(context, contexts);
46
+
47
+ return syntheticContext;
48
+ }
49
+ }
package/src/context.js CHANGED
@@ -24,9 +24,30 @@ export default class Context extends ContextBase {
24
24
  return filePath;
25
25
  }
26
26
 
27
+ getTerms() {
28
+ const context = this.getContext(),
29
+ terms = context.getTerms();
30
+
31
+ return terms;
32
+ }
33
+
34
+ getFrames() {
35
+ const context = this.getContext(),
36
+ frames = context.getFrames();
37
+
38
+ return frames;
39
+ }
40
+
41
+ getSubstitutions() {
42
+ const context = this.getContext(),
43
+ substitutions = context.getSubstitutions();
44
+
45
+ return substitutions;
46
+ }
47
+
27
48
  getVariables(includeRelease) {
28
49
  const context = this.getContext(),
29
- variables = context.getVariables(includeRelease);
50
+ variables = context.getVariables(includeRelease);
30
51
 
31
52
  return variables;
32
53
  }
@@ -38,6 +59,13 @@ export default class Context extends ContextBase {
38
59
  return combinators;
39
60
  }
40
61
 
62
+ getMetavariables(includeRelease) {
63
+ const context = this.getContext(),
64
+ metavariables = context.getMetavariables(includeRelease);
65
+
66
+ return metavariables;
67
+ }
68
+
41
69
  getSubproofOrProofAssertions() {
42
70
  const context = this.getContext(),
43
71
  subproofOrProofAssertions = context.getSubproofOrProofAssertions();
@@ -81,6 +109,34 @@ export default class Context extends ContextBase {
81
109
  return statement;
82
110
  }
83
111
 
112
+ findReferenceByMetavariableNode(metavariableNode) {
113
+ const context = this.getContext(),
114
+ reference = context.findReferenceByMetavariableNode(metavariableNode);
115
+
116
+ return reference;
117
+ }
118
+
119
+ findTopLevelAssertionByReference(reference) {
120
+ const context = this.getContext(),
121
+ topLevelAssertion = context.findTopLevelAssertionByReference(reference);
122
+
123
+ return topLevelAssertion;
124
+ }
125
+
126
+ findSubstitutionByVariable(variable, generalContext, specificContext) {
127
+ const context = this.getContext(),
128
+ substitution = context.findSubstitutionByVariable(variable, generalContext, specificContext);
129
+
130
+ return substitution;
131
+ }
132
+
133
+ findSubstitutionByMetavariable(metavariable, generalContet, specificContext) {
134
+ const context = this.getContext(),
135
+ substitution = context.findSubstitutionByMetavariable(metavariable, generalContet, specificContext);
136
+
137
+ return substitution;
138
+ }
139
+
84
140
  findVariableByVariableIdentifier(variableIdentifier) {
85
141
  const context = this.getContext(),
86
142
  variable = context.findVariableByVariableIdentifier(variableIdentifier);
@@ -95,6 +151,70 @@ export default class Context extends ContextBase {
95
151
  return metavariable;
96
152
  }
97
153
 
154
+ findSimpleSubstitutionByMetavariable(metavariable) {
155
+ const context = this.getContext(),
156
+ simpleSubstitution = context.findSimpleSubstitutionByMetavariable(metavariable);
157
+
158
+ return simpleSubstitution;
159
+ }
160
+
161
+ findSubstitutionByMetavariableAndSubstitution(metavariable, substitution, generalContet, specificContext) {
162
+ const context = this.getContext();
163
+
164
+ substitution = context.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution, generalContet, specificContext); ///
165
+
166
+ return substitution;
167
+ }
168
+
169
+ isTermPresentByTermNode(termNode) {
170
+ const context = this.getContext(),
171
+ termPresent = context.isTermPresentByTermNode(termNode);
172
+
173
+ return termPresent;
174
+ }
175
+
176
+ isFramePresentByFrameNode(frameNode) {
177
+ const context = this.getContext(),
178
+ framePresent = context.isFramePresentByFrameNode(frameNode);
179
+
180
+ return framePresent;
181
+ }
182
+
183
+ isJudgementPresentByMetavariable(metavariable) {
184
+ const context = this.getContext(),
185
+ judgementPresent = context.isJudgementPresentByMetavariable(metavariable);
186
+
187
+ return judgementPresent;
188
+ }
189
+
190
+ isStatementPresentByStatementNode(statementNode) {
191
+ const context = this.getContext(),
192
+ statementPresent = context.isStatementPresentByStatementNode(statementNode);
193
+
194
+ return statementPresent;
195
+ }
196
+
197
+ isAssertionPresentByAssertionNode(assertionNode) {
198
+ const context = this.getContext(),
199
+ assertionPresent = context.isAssertionPresentByAssertionNode(assertionNode);
200
+
201
+ return assertionPresent;
202
+ }
203
+
204
+ isReferencePresentByReferenceNode(referenceNode) {
205
+ const context = this.getContext(),
206
+ referencePresent = context.isReferencePresentByReferenceNode(referenceNode);
207
+
208
+ return referencePresent;
209
+ }
210
+
211
+ isSubstitutionPresentBySubstitutionNode(substitutionNode) {
212
+ const context = this.getContext(),
213
+ substitutionPresent = context.isSubstitutionPresentBySubstitutionNode(substitutionNode);
214
+
215
+ return substitutionPresent;
216
+ }
217
+
98
218
  isProcedurePresentByName(name) {
99
219
  const context = this.getContext(),
100
220
  procedurePresent = context.isProcedurePresentByName(name);
@@ -116,6 +236,36 @@ export default class Context extends ContextBase {
116
236
  return metavariablePresent;
117
237
  }
118
238
 
239
+ addRule(rule) {
240
+ const context = this.getContext();
241
+
242
+ context.addRule(rule);
243
+ }
244
+
245
+ adTerm(term) {
246
+ const context = this.getContext();
247
+
248
+ context.adTerm(term);
249
+ }
250
+
251
+ addFrame(frame) {
252
+ const context = this.getContext();
253
+
254
+ context.addFrame(frame);
255
+ }
256
+
257
+ addStatement(statement) {
258
+ const context = this.getContext();
259
+
260
+ context.addStatement(statement);
261
+ }
262
+
263
+ addReference(reference) {
264
+ const context = this.getContext();
265
+
266
+ context.addReference(reference);
267
+ }
268
+
119
269
  addJudgement(judgement) {
120
270
  const context = this.getContext(),
121
271
  judgementAdded = context.addJudgement(judgement);
@@ -123,6 +273,18 @@ export default class Context extends ContextBase {
123
273
  return judgementAdded;
124
274
  }
125
275
 
276
+ addSubstitution(substitution) {
277
+ const context = this.getContext();
278
+
279
+ context.addSubstitution(substitution);
280
+ }
281
+
282
+ removeSubstitution(substitution) {
283
+ const context = this.getContext();
284
+
285
+ context.removeSubstitution(substitution);
286
+ }
287
+
126
288
  addSubproofOrProofAssertion(subproofOrProofAssertion) {
127
289
  const context = this.getContext();
128
290
 
@@ -38,27 +38,35 @@ export default define(class ContainedAssertion extends Assertion {
38
38
 
39
39
  context.trace(`Validating the '${containedAssertionString}' contained assertion...`);
40
40
 
41
- const termValidates = this.validateTerm(assignments, stated, context),
42
- frameVerifies = this.validateFrame(assignments, stated, context),
43
- statementValidates = this.validateStatement(assignments, stated, context)
41
+ const valid = this.isValid(context);
44
42
 
45
- if (termValidates || frameVerifies || statementValidates) {
46
- let validatesWhenStated = false,
47
- validatesWhenDerived = false;
43
+ if (!valid) {
44
+ validates = true;
48
45
 
49
- if (stated) {
50
- validatesWhenStated = this.validateWhenStated(assignments, context);
51
- } else {
52
- validatesWhenDerived = this.validateWhenDerived(context);
53
- }
46
+ context.debug(`...the '${containedAssertionString}' contained assertion is already valid.`);
47
+ } else {
48
+ const termValidates = this.validateTerm(assignments, stated, context),
49
+ frameVerifies = this.validateFrame(assignments, stated, context),
50
+ statementValidates = this.validateStatement(assignments, stated, context)
51
+
52
+ if (termValidates || frameVerifies || statementValidates) {
53
+ let validatesWhenStated = false,
54
+ validatesWhenDerived = false;
55
+
56
+ if (stated) {
57
+ validatesWhenStated = this.validateWhenStated(assignments, context);
58
+ } else {
59
+ validatesWhenDerived = this.validateWhenDerived(context);
60
+ }
54
61
 
55
- if (validatesWhenStated || validatesWhenDerived) {
56
- validates = true;
62
+ if (validatesWhenStated || validatesWhenDerived) {
63
+ validates = true;
64
+ }
57
65
  }
58
- }
59
66
 
60
- if (validates) {
61
- context.debug(`...validated the '${containedAssertionString}' contained assertion.`);
67
+ if (validates) {
68
+ context.debug(`...validated the '${containedAssertionString}' contained assertion.`);
69
+ }
62
70
  }
63
71
 
64
72
  return validates;
@@ -179,7 +187,7 @@ export default define(class ContainedAssertion extends Assertion {
179
187
  return validatesWhenDerived;
180
188
  }
181
189
 
182
- unifyIndependently(substitutions, generalContext, specificContext) {
190
+ unifyIndependently(generalContext, specificContext) {
183
191
  let unifiesIndependently;
184
192
 
185
193
  const context = specificContext, ///
@@ -187,9 +195,9 @@ export default define(class ContainedAssertion extends Assertion {
187
195
 
188
196
  context.trace(`Unifying the '${containedAssertionString}' contained assertion independently...`);
189
197
 
190
- const term = termFromTermAndSubstitutions(this.term, substitutions, generalContext, specificContext),
191
- frame = frameFromFrameAndSubstitutions(this.frame, substitutions, generalContext, specificContext),
192
- statement = statementFromStatementAndSubstitutions(this.statement, substitutions, generalContext, specificContext),
198
+ const term = termFromTermAndSubstitutions(this.term, generalContext, specificContext),
199
+ frame = frameFromFrameAndSubstitutions(this.frame, generalContext, specificContext),
200
+ statement = statementFromStatementAndSubstitutions(this.statement, generalContext, specificContext),
193
201
  validatesWhenDerived = validateWhenDerived(term, frame, statement, this.negated, generalContext, specificContext);
194
202
 
195
203
  unifiesIndependently = validatesWhenDerived; ///
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- import elements from "../../elements";
4
3
  import Assertion from "../assertion";
5
4
 
6
5
  import { define } from "../../elements";
@@ -28,35 +27,43 @@ export default define(class DefinedAssertion extends Assertion {
28
27
  }
29
28
 
30
29
  validate(assignments, stated, context) {
31
- let validated = false;
30
+ let validates = false;
32
31
 
33
32
  const definedAssertionString = this.getString(); ///
34
33
 
35
34
  context.trace(`Validating the '${definedAssertionString}' defined assertion...`);
36
35
 
37
- const termValidates = this.validateTerm(assignments, stated, context),
38
- frameVerifies = this.validateFrame(assignments, stated, context);
36
+ const valid = this.isValid(context);
39
37
 
40
- if (termValidates || frameVerifies) {
41
- let verifiesWhenStated = false,
42
- verifiesWhenDerived = false;
38
+ if (valid) {
39
+ validates = true;
43
40
 
44
- if (stated) {
45
- verifiesWhenStated = this.validateWhenStated(assignments, context);
46
- } else {
47
- verifiesWhenDerived = this.validateWhenDerived(context);
48
- }
41
+ context.debug(`...the '${definedAssertionString}' defined assertion is already valid.`);
42
+ } else {
43
+ const termValidates = this.validateTerm(assignments, stated, context),
44
+ frameVerifies = this.validateFrame(assignments, stated, context);
45
+
46
+ if (termValidates || frameVerifies) {
47
+ let verifiesWhenStated = false,
48
+ verifiesWhenDerived = false;
49
+
50
+ if (stated) {
51
+ verifiesWhenStated = this.validateWhenStated(assignments, context);
52
+ } else {
53
+ verifiesWhenDerived = this.validateWhenDerived(context);
54
+ }
49
55
 
50
- if (verifiesWhenStated || verifiesWhenDerived) {
51
- validated = true;
56
+ if (verifiesWhenStated || verifiesWhenDerived) {
57
+ validates = true;
58
+ }
52
59
  }
53
- }
54
60
 
55
- if (validated) {
56
- context.debug(`...validated the '${definedAssertionString}' defined assertion.`);
61
+ if (validates) {
62
+ context.debug(`...validates the '${definedAssertionString}' defined assertion.`);
63
+ }
57
64
  }
58
65
 
59
- return validated;
66
+ return validates;
60
67
  }
61
68
 
62
69
  validateTerm(assignments, stated, context) {
@@ -80,7 +87,7 @@ export default define(class DefinedAssertion extends Assertion {
80
87
  });
81
88
 
82
89
  if (termValidates) {
83
- context.debug(`...validated the'${definedAssertionString}' defined assertino's '${termString}' term.`);
90
+ context.debug(`...validates the'${definedAssertionString}' defined assertino's '${termString}' term.`);
84
91
  }
85
92
  }
86
93
  }
@@ -109,7 +116,7 @@ export default define(class DefinedAssertion extends Assertion {
109
116
  frameVerifies = this.frame.validate(assignments, stated, context);
110
117
 
111
118
  if (frameVerifies) {
112
- context.debug(`...validated the'${definedAssertionString}' defined assertino's '${frameString}' frame.`);
119
+ context.debug(`...validates the'${definedAssertionString}' defined assertino's '${frameString}' frame.`);
113
120
  }
114
121
  }
115
122
  }
@@ -127,7 +134,7 @@ export default define(class DefinedAssertion extends Assertion {
127
134
  verifiesWhenStated = true;
128
135
 
129
136
  if (verifiesWhenStated) {
130
- context.debug(`...validated the '${definedAssertionString}' stated defined assertion.`);
137
+ context.debug(`...validates the '${definedAssertionString}' stated defined assertion.`);
131
138
  }
132
139
 
133
140
  return verifiesWhenStated;
@@ -146,13 +153,13 @@ export default define(class DefinedAssertion extends Assertion {
146
153
  verifiesWhenDerived = validateWhenDerived(this.term, this.frame, this.negated, generalContext, specificContext);
147
154
 
148
155
  if (verifiesWhenDerived) {
149
- context.debug(`...validated the '${definedAssertionString}' derived defined assertion.`);
156
+ context.debug(`...validates the '${definedAssertionString}' derived defined assertion.`);
150
157
  }
151
158
 
152
159
  return verifiesWhenDerived;
153
160
  }
154
161
 
155
- unifyIndependently(substitutions, generalContext, specificContext) {
162
+ unifyIndependently(generalContext, specificContext) {
156
163
  let unifiesIndependently;
157
164
 
158
165
  const context = specificContext, ///
@@ -160,8 +167,8 @@ export default define(class DefinedAssertion extends Assertion {
160
167
 
161
168
  context.trace(`Unifying the '${definedAssertionString}' defined assertion independently...`);
162
169
 
163
- const term = termFromTermAndSubstitutions(this.term, substitutions, generalContext, specificContext),
164
- frame = frameFromFrameAndSubstitutions(this.frame, substitutions, generalContext, specificContext),
170
+ const term = termFromTermAndSubstitutions(this.term, generalContext, specificContext),
171
+ frame = frameFromFrameAndSubstitutions(this.frame, generalContext, specificContext),
165
172
  verifiesWhenDerived = validateWhenDerived(term, frame, this.negated, generalContext, specificContext);
166
173
 
167
174
  unifiesIndependently = verifiesWhenDerived; ///
@@ -182,11 +189,8 @@ function validateWhenDerived(term, frame, negated, generalContext, specificConte
182
189
  const context = specificContext; ///
183
190
 
184
191
  if (term !== null) {
185
- const { Variable } = elements,
186
- termNode = term.getNode(),
187
- variable = Variable.fromTermNode(termNode, context),
188
- generalContext = context, ///
189
- variableDefined = generalContext.isVariableDefined(variable);
192
+ const variable = term.getVariable(generalContext, specificContext),
193
+ variableDefined = isVariableDefined(variable, context);
190
194
 
191
195
  if (!negated && variableDefined) {
192
196
  verifiesWhenDerived = true;
@@ -198,10 +202,8 @@ function validateWhenDerived(term, frame, negated, generalContext, specificConte
198
202
  }
199
203
 
200
204
  if (frame!== null) {
201
- const { Metavariable } = elements,
202
- frameNode = frame.getNode(),
203
- metavariable = Metavariable.fromFrameNode(frameNode, context),
204
- metavariableDefined = context.isMetavariableDefined(metavariable);
205
+ const metavariable = frame.getMetavariable(generalContext, specificContext),
206
+ metavariableDefined = isMetavariableDefined(metavariable, context);
205
207
 
206
208
  if (!negated && metavariableDefined) {
207
209
  verifiesWhenDerived = true;
@@ -214,3 +216,29 @@ function validateWhenDerived(term, frame, negated, generalContext, specificConte
214
216
 
215
217
  return verifiesWhenDerived;
216
218
  }
219
+
220
+ function isVariableDefined(variable, context) {
221
+ const equivalences = context.getEquivalences(),
222
+ groundedTerms = [],
223
+ definedVariables = [];
224
+
225
+ equivalences.separateGroundedTermsAndDefinedVariables(groundedTerms, definedVariables, context);
226
+
227
+ const variableMatchesDefinedVariable = definedVariables.some((definedVariable) => {
228
+ const definedVariableEqualToVariable = definedVariable.compare(variable);
229
+
230
+ if (definedVariableEqualToVariable === variable) {
231
+ return true;
232
+ }
233
+ }),
234
+ variableDefined = variableMatchesDefinedVariable; ///
235
+
236
+ return variableDefined;
237
+ }
238
+
239
+ function isMetavariableDefined(metavariable, context) {
240
+ const judgementPresent = context.isJudgementPresentByMetavariable(metavariable),
241
+ metavariableDefined = judgementPresent; ///
242
+
243
+ return metavariableDefined
244
+ }
@@ -55,35 +55,43 @@ export default define(class PropertyAssertion extends Assertion {
55
55
 
56
56
  context.trace(`Validating the '${propertyAssertionString}' property assertion...`);
57
57
 
58
- const termValidates = this.validateTerm(assignments, stated, context);
58
+ const valid = this.isValid(context);
59
59
 
60
- if (termValidates) {
61
- const propertyRelationVerifies = this.validatePropertyRelation(assignments, stated, context);
60
+ if (valid) {
61
+ validates = true;
62
+
63
+ context.debug(`...the '${propertyAssertionString}' property assertion is already valid.`);
64
+ } else {
65
+ const termValidates = this.validateTerm(assignments, stated, context);
66
+
67
+ if (termValidates) {
68
+ const propertyRelationVerifies = this.validatePropertyRelation(assignments, stated, context);
62
69
 
63
- if (propertyRelationVerifies) {
64
- let validatesWhenStated = false,
70
+ if (propertyRelationVerifies) {
71
+ let validatesWhenStated = false,
65
72
  validatesWhenDerived = false;
66
73
 
67
- if (stated) {
68
- validatesWhenStated = this.validateWhenStated(assignments, context);
69
- } else {
70
- validatesWhenDerived = this.validateWhenDerived(context);
71
- }
74
+ if (stated) {
75
+ validatesWhenStated = this.validateWhenStated(assignments, context);
76
+ } else {
77
+ validatesWhenDerived = this.validateWhenDerived(context);
78
+ }
72
79
 
73
- if (validatesWhenStated || validatesWhenDerived) {
74
- validates = true;
80
+ if (validatesWhenStated || validatesWhenDerived) {
81
+ validates = true;
82
+ }
75
83
  }
76
84
  }
77
- }
78
85
 
79
- if (validates) {
80
- if (stated) {
81
- this.assign(assignments, context);
86
+ if (validates) {
87
+ if (stated) {
88
+ this.assign(assignments, context);
89
+ }
82
90
  }
83
- }
84
91
 
85
- if (validates) {
86
- context.debug(`...validated the '${propertyAssertionString}' property assertion.`);
92
+ if (validates) {
93
+ context.debug(`...validated the '${propertyAssertionString}' property assertion.`);
94
+ }
87
95
  }
88
96
 
89
97
  return validates;
@@ -31,16 +31,24 @@ export default define(class SatisfiesAssertion extends Assertion {
31
31
 
32
32
  context.trace(`Validating the '${satisfiesAssertionString}' satisfies assertion...`);
33
33
 
34
- const signatureVerifies = this.validateSignature(assignments, stated, context);
34
+ const valid = this.isValid(context);
35
35
 
36
- if (signatureVerifies) {
37
- const referenceVerifies = this.validateReference(assignments, stated, context);
36
+ if (valid) {
37
+ validates = true;
38
38
 
39
- validates = referenceVerifies; ///
40
- }
39
+ context.debug(`...the '${satisfiesAssertionString}' satisfies assertion is already valid.`);
40
+ } else {
41
+ const signatureVerifies = this.validateSignature(assignments, stated, context);
42
+
43
+ if (signatureVerifies) {
44
+ const referenceVerifies = this.validateReference(assignments, stated, context);
41
45
 
42
- if (validates) {
43
- context.debug(`...validated the '${satisfiesAssertionString}' satisfies assertion.`);
46
+ validates = referenceVerifies; ///
47
+ }
48
+
49
+ if (validates) {
50
+ context.debug(`...validated the '${satisfiesAssertionString}' satisfies assertion.`);
51
+ }
44
52
  }
45
53
 
46
54
  return validates;
@@ -27,14 +27,22 @@ export default define(class SubproofAssertion extends Assertion {
27
27
 
28
28
  context.trace(`Validating the '${subproofAssertionString}' subproof assertion...`);
29
29
 
30
- const statementsValidate = this.validateStatements(assignments, stated, context);
30
+ const valid = this.isValid(context);
31
31
 
32
- if (statementsValidate) {
32
+ if (valid) {
33
33
  validates = true;
34
- }
35
34
 
36
- if (validates) {
37
- context.debug(`...validated the '${subproofAssertionString}' subproof assertion.`);
35
+ context.debug(`...the '${subproofAssertionString}' subproof assertion is already valid.`);
36
+ } else {
37
+ const statementsValidate = this.validateStatements(assignments, stated, context);
38
+
39
+ if (statementsValidate) {
40
+ validates = true;
41
+ }
42
+
43
+ if (validates) {
44
+ context.debug(`...validated the '${subproofAssertionString}' subproof assertion.`);
45
+ }
38
46
  }
39
47
 
40
48
  return validates;