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.
- package/lib/context/ephemeral.js +74 -2
- package/lib/context/file/nominal.js +11 -9
- package/lib/context/liminal.js +161 -24
- package/lib/context/literal.js +8 -2
- package/lib/context/scoped.js +4 -28
- package/lib/context/synthetic.js +146 -0
- package/lib/context.js +170 -1
- package/lib/element/assertion/contained.js +21 -15
- package/lib/element/assertion/defined.js +45 -65
- package/lib/element/assertion/property.js +25 -19
- package/lib/element/assertion/satisfies.js +14 -8
- package/lib/element/assertion/subproof.js +12 -6
- package/lib/element/assertion.js +47 -1
- package/lib/element/assumption.js +12 -12
- package/lib/element/conclusion.js +2 -2
- package/lib/element/deduction.js +2 -2
- package/lib/element/frame.js +61 -29
- package/lib/element/judgement.js +7 -1
- package/lib/element/label.js +8 -8
- package/lib/element/metavariable.js +71 -59
- package/lib/element/procedureCall.js +24 -8
- package/lib/element/proof.js +43 -35
- package/lib/element/proofAssertion/premise.js +122 -97
- package/lib/element/proofAssertion/step.js +161 -115
- package/lib/element/proofAssertion/supposition.js +157 -118
- package/lib/element/proofAssertion.js +3 -3
- package/lib/element/reference.js +40 -7
- package/lib/element/rule.js +227 -95
- package/lib/element/signature.js +2 -1
- package/lib/element/statement.js +67 -34
- package/lib/element/substitution/frame.js +36 -16
- package/lib/element/substitution/reference.js +36 -16
- package/lib/element/substitution/statement.js +94 -55
- package/lib/element/substitution/term.js +36 -16
- package/lib/element/substitution.js +54 -17
- package/lib/element/substitutions.js +4 -276
- package/lib/element/term.js +60 -31
- package/lib/element/topLevelAssertion/axiom.js +13 -4
- package/lib/element/topLevelAssertion/conjecture.js +7 -2
- package/lib/element/topLevelAssertion/theorem.js +7 -2
- package/lib/element/topLevelAssertion.js +201 -134
- package/lib/element/topLevelMetaAssertion.js +310 -51
- package/lib/element/variable.js +15 -6
- package/lib/node/substitution/statement.js +33 -1
- package/lib/process/unify.js +6 -6
- package/lib/utilities/context.js +10 -25
- package/lib/utilities/element.js +34 -9
- package/lib/utilities/statement.js +1 -8
- package/lib/utilities/string.js +12 -1
- package/lib/utilities/substitutions.js +42 -16
- package/lib/utilities/unification.js +3 -1
- package/lib/utilities/validation.js +2 -2
- package/package.json +4 -4
- package/src/context/ephemeral.js +73 -1
- package/src/context/file/nominal.js +14 -11
- package/src/context/liminal.js +180 -25
- package/src/context/literal.js +3 -1
- package/src/context/scoped.js +3 -35
- package/src/context/synthetic.js +49 -0
- package/src/context.js +163 -1
- package/src/element/assertion/contained.js +28 -20
- package/src/element/assertion/defined.js +62 -34
- package/src/element/assertion/property.js +27 -19
- package/src/element/assertion/satisfies.js +15 -7
- package/src/element/assertion/subproof.js +13 -5
- package/src/element/assertion.js +35 -0
- package/src/element/assumption.js +5 -5
- package/src/element/conclusion.js +2 -4
- package/src/element/deduction.js +2 -4
- package/src/element/frame.js +71 -39
- package/src/element/judgement.js +2 -0
- package/src/element/label.js +4 -4
- package/src/element/metavariable.js +94 -75
- package/src/element/procedureCall.js +6 -6
- package/src/element/proof.js +6 -6
- package/src/element/proofAssertion/premise.js +101 -69
- package/src/element/proofAssertion/step.js +78 -39
- package/src/element/proofAssertion/supposition.js +141 -115
- package/src/element/proofAssertion.js +3 -2
- package/src/element/reference.js +52 -10
- package/src/element/rule.js +138 -76
- package/src/element/signature.js +2 -0
- package/src/element/statement.js +76 -45
- package/src/element/substitution/frame.js +44 -15
- package/src/element/substitution/reference.js +44 -15
- package/src/element/substitution/statement.js +124 -72
- package/src/element/substitution/term.js +43 -15
- package/src/element/substitution.js +55 -18
- package/src/element/substitutions.js +1 -258
- package/src/element/term.js +65 -34
- package/src/element/topLevelAssertion/axiom.js +1 -1
- package/src/element/topLevelAssertion/conjecture.js +1 -1
- package/src/element/topLevelAssertion/theorem.js +1 -1
- package/src/element/topLevelAssertion.js +128 -48
- package/src/element/topLevelMetaAssertion.js +86 -32
- package/src/element/variable.js +15 -5
- package/src/node/substitution/statement.js +33 -0
- package/src/process/unify.js +6 -8
- package/src/utilities/context.js +9 -8
- package/src/utilities/element.js +37 -10
- package/src/utilities/statement.js +0 -7
- package/src/utilities/string.js +14 -0
- package/src/utilities/substitutions.js +59 -17
- package/src/utilities/unification.js +4 -0
- package/src/utilities/validation.js +3 -1
package/src/context/scoped.js
CHANGED
|
@@ -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
|
|
189
|
+
const judgementMetavariableComparesToMetavariable = judgement.compareMetavariable(metavariable);
|
|
190
190
|
|
|
191
|
-
if (
|
|
192
|
-
|
|
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
|
-
|
|
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
|
|
42
|
-
frameVerifies = this.validateFrame(assignments, stated, context),
|
|
43
|
-
statementValidates = this.validateStatement(assignments, stated, context)
|
|
41
|
+
const valid = this.isValid(context);
|
|
44
42
|
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
validatesWhenDerived = false;
|
|
43
|
+
if (!valid) {
|
|
44
|
+
validates = true;
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
56
|
-
|
|
62
|
+
if (validatesWhenStated || validatesWhenDerived) {
|
|
63
|
+
validates = true;
|
|
64
|
+
}
|
|
57
65
|
}
|
|
58
|
-
}
|
|
59
66
|
|
|
60
|
-
|
|
61
|
-
|
|
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(
|
|
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,
|
|
191
|
-
frame = frameFromFrameAndSubstitutions(this.frame,
|
|
192
|
-
statement = statementFromStatementAndSubstitutions(this.statement,
|
|
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
|
|
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
|
|
38
|
-
frameVerifies = this.validateFrame(assignments, stated, context);
|
|
36
|
+
const valid = this.isValid(context);
|
|
39
37
|
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
verifiesWhenDerived = false;
|
|
38
|
+
if (valid) {
|
|
39
|
+
validates = true;
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
51
|
-
|
|
56
|
+
if (verifiesWhenStated || verifiesWhenDerived) {
|
|
57
|
+
validates = true;
|
|
58
|
+
}
|
|
52
59
|
}
|
|
53
|
-
}
|
|
54
60
|
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
if (validates) {
|
|
62
|
+
context.debug(`...validates the '${definedAssertionString}' defined assertion.`);
|
|
63
|
+
}
|
|
57
64
|
}
|
|
58
65
|
|
|
59
|
-
return
|
|
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(`...
|
|
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(`...
|
|
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(`...
|
|
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(`...
|
|
156
|
+
context.debug(`...validates the '${definedAssertionString}' derived defined assertion.`);
|
|
150
157
|
}
|
|
151
158
|
|
|
152
159
|
return verifiesWhenDerived;
|
|
153
160
|
}
|
|
154
161
|
|
|
155
|
-
unifyIndependently(
|
|
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,
|
|
164
|
-
frame = frameFromFrameAndSubstitutions(this.frame,
|
|
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
|
|
186
|
-
|
|
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
|
|
202
|
-
|
|
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
|
|
58
|
+
const valid = this.isValid(context);
|
|
59
59
|
|
|
60
|
-
if (
|
|
61
|
-
|
|
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
|
-
|
|
64
|
-
|
|
70
|
+
if (propertyRelationVerifies) {
|
|
71
|
+
let validatesWhenStated = false,
|
|
65
72
|
validatesWhenDerived = false;
|
|
66
73
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
if (stated) {
|
|
75
|
+
validatesWhenStated = this.validateWhenStated(assignments, context);
|
|
76
|
+
} else {
|
|
77
|
+
validatesWhenDerived = this.validateWhenDerived(context);
|
|
78
|
+
}
|
|
72
79
|
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
if (validatesWhenStated || validatesWhenDerived) {
|
|
81
|
+
validates = true;
|
|
82
|
+
}
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
|
-
}
|
|
78
85
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
if (validates) {
|
|
87
|
+
if (stated) {
|
|
88
|
+
this.assign(assignments, context);
|
|
89
|
+
}
|
|
82
90
|
}
|
|
83
|
-
}
|
|
84
91
|
|
|
85
|
-
|
|
86
|
-
|
|
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
|
|
34
|
+
const valid = this.isValid(context);
|
|
35
35
|
|
|
36
|
-
if (
|
|
37
|
-
|
|
36
|
+
if (valid) {
|
|
37
|
+
validates = true;
|
|
38
38
|
|
|
39
|
-
|
|
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
|
-
|
|
43
|
-
|
|
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
|
|
30
|
+
const valid = this.isValid(context);
|
|
31
31
|
|
|
32
|
-
if (
|
|
32
|
+
if (valid) {
|
|
33
33
|
validates = true;
|
|
34
|
-
}
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
|
|
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;
|