occam-verify-cli 1.0.564 → 1.0.570
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/file/nominal.js +1 -13
- package/lib/context/liminal.js +84 -6
- package/lib/element/assertion/satisfies.js +4 -46
- package/lib/element/assumption.js +49 -69
- package/lib/element/conclusion.js +3 -3
- package/lib/element/frame.js +56 -42
- package/lib/element/judgement.js +2 -2
- package/lib/element/metavariable.js +26 -35
- package/lib/element/proofAssertion/premise.js +26 -29
- package/lib/element/proofAssertion/step.js +4 -44
- package/lib/element/proofAssertion/supposition.js +161 -32
- package/lib/element/proofAssertion.js +5 -5
- package/lib/element/reference.js +9 -2
- package/lib/element/rule.js +21 -55
- package/lib/element/statement.js +5 -5
- package/lib/element/subproof.js +2 -2
- package/lib/element/substitution/frame.js +1 -2
- package/lib/element/substitution/reference.js +1 -2
- package/lib/element/substitution/statement.js +3 -46
- package/lib/element/substitution/term.js +1 -2
- package/lib/element/substitution.js +8 -1
- package/lib/element/substitutions.js +1 -53
- package/lib/element/term.js +3 -3
- package/lib/element/topLevelAssertion/axiom.js +25 -15
- package/lib/element/topLevelAssertion/conjecture.js +22 -12
- package/lib/element/topLevelAssertion/lemma.js +27 -12
- package/lib/element/topLevelAssertion/theorem.js +22 -12
- package/lib/element/topLevelAssertion.js +331 -58
- package/lib/element/topLevelMetaAssertion/metaLemma.js +4 -2
- package/lib/element/topLevelMetaAssertion/metatheorem.js +4 -2
- package/lib/element/variable.js +6 -7
- package/lib/node/assumption.js +1 -12
- package/lib/node/frame.js +8 -34
- package/lib/process/assign.js +9 -9
- package/lib/process/instantiate.js +2 -14
- package/lib/process/unify.js +14 -14
- package/lib/process/validate.js +1 -1
- package/lib/utilities/context.js +169 -1
- package/lib/utilities/element.js +18 -7
- package/lib/utilities/unification.js +3 -5
- package/package.json +4 -4
- package/src/context/file/nominal.js +0 -13
- package/src/context/liminal.js +90 -7
- package/src/element/assertion/satisfies.js +2 -5
- package/src/element/assumption.js +62 -86
- package/src/element/conclusion.js +2 -2
- package/src/element/frame.js +72 -45
- package/src/element/judgement.js +2 -1
- package/src/element/metavariable.js +31 -39
- package/src/element/proofAssertion/premise.js +30 -35
- package/src/element/proofAssertion/step.js +4 -4
- package/src/element/proofAssertion/supposition.js +3 -1
- package/src/element/proofAssertion.js +4 -4
- package/src/element/reference.js +13 -3
- package/src/element/rule.js +25 -17
- package/src/element/statement.js +10 -7
- package/src/element/subproof.js +2 -3
- package/src/element/substitution/frame.js +0 -2
- package/src/element/substitution/reference.js +0 -2
- package/src/element/substitution/statement.js +1 -7
- package/src/element/substitution/term.js +0 -2
- package/src/element/substitution.js +11 -0
- package/src/element/substitutions.js +0 -53
- package/src/element/term.js +8 -5
- package/src/element/topLevelAssertion/axiom.js +5 -2
- package/src/element/topLevelAssertion/conjecture.js +5 -2
- package/src/element/topLevelAssertion/lemma.js +6 -3
- package/src/element/topLevelAssertion/theorem.js +5 -2
- package/src/element/topLevelAssertion.js +40 -38
- package/src/element/topLevelMetaAssertion/metaLemma.js +5 -2
- package/src/element/topLevelMetaAssertion/metatheorem.js +5 -2
- package/src/element/variable.js +8 -6
- package/src/node/assumption.js +0 -12
- package/src/node/frame.js +6 -34
- package/src/process/assign.js +16 -16
- package/src/process/instantiate.js +2 -10
- package/src/process/unify.js +14 -14
- package/src/process/validate.js +2 -2
- package/src/utilities/context.js +17 -0
- package/src/utilities/element.js +23 -10
- package/src/utilities/unification.js +3 -7
package/src/element/frame.js
CHANGED
|
@@ -1,53 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
|
-
import { arrayUtilities } from "necessary";
|
|
5
4
|
|
|
6
5
|
import { define } from "../elements";
|
|
7
6
|
import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
|
|
7
|
+
import { findMetaTypeByMetaTypeName } from "../metaTypes";
|
|
8
8
|
import { assumptionsStringFromAssumptions } from "../utilities/string";
|
|
9
9
|
|
|
10
|
-
const { first } = arrayUtilities;
|
|
11
|
-
|
|
12
10
|
export default define(class Frame extends Element {
|
|
13
|
-
constructor(context, string, node, assumptions) {
|
|
11
|
+
constructor(context, string, node, assumptions, metavairable) {
|
|
14
12
|
super(context, string, node);
|
|
15
13
|
|
|
16
14
|
this.assumptions = assumptions;
|
|
15
|
+
this.metavariable = metavairable;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
getAssumptions() {
|
|
20
19
|
return this.assumptions;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
getLength() { return this.assumptions.length; }
|
|
24
|
-
|
|
25
|
-
getAssumption() {
|
|
26
|
-
let assumption = null;
|
|
27
|
-
|
|
28
|
-
const length = this.getLength();
|
|
29
|
-
|
|
30
|
-
if (length === 1) {
|
|
31
|
-
const firstAssumption = first(this.assumptions);
|
|
32
|
-
|
|
33
|
-
assumption = firstAssumption; ///
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return assumption;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
22
|
getMetavariable() {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const singular = this.isSingular();
|
|
43
|
-
|
|
44
|
-
if (singular) {
|
|
45
|
-
const assumption = this.getAssumption();
|
|
46
|
-
|
|
47
|
-
metavariable = assumption.getMetavariable();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return metavariable;
|
|
23
|
+
return this.metavariable;
|
|
51
24
|
}
|
|
52
25
|
|
|
53
26
|
getMetavariableName() {
|
|
@@ -59,7 +32,8 @@ export default define(class Frame extends Element {
|
|
|
59
32
|
|
|
60
33
|
isSingular() {
|
|
61
34
|
const node = this.getNode(),
|
|
62
|
-
|
|
35
|
+
frameNode = node, ///
|
|
36
|
+
singular = frameNode.isSingular();
|
|
63
37
|
|
|
64
38
|
return singular;
|
|
65
39
|
}
|
|
@@ -86,6 +60,17 @@ export default define(class Frame extends Element {
|
|
|
86
60
|
return metavariableEqualToMetavariable;
|
|
87
61
|
}
|
|
88
62
|
|
|
63
|
+
isEqualTo(frame) {
|
|
64
|
+
const frameA = this, ///
|
|
65
|
+
frameB = frame, ///
|
|
66
|
+
frameANode = frameA.getNode(),
|
|
67
|
+
frameBNode = frameB.getNode(),
|
|
68
|
+
frameANodeMatchesFrameBNode = frameANode.match(frameBNode),
|
|
69
|
+
equalTo = frameANodeMatchesFrameBNode; ///
|
|
70
|
+
|
|
71
|
+
return equalTo;
|
|
72
|
+
}
|
|
73
|
+
|
|
89
74
|
compareParameter(parameter) {
|
|
90
75
|
let comparesToParamter = false;
|
|
91
76
|
|
|
@@ -161,9 +146,10 @@ export default define(class Frame extends Element {
|
|
|
161
146
|
|
|
162
147
|
context.trace(`Validating the '${frameString}' frame...`);
|
|
163
148
|
|
|
164
|
-
const assumptionsValidate = this.validateAssumptions(assignments, stated, context)
|
|
149
|
+
const assumptionsValidate = this.validateAssumptions(assignments, stated, context),
|
|
150
|
+
metavariablevalidates = this.validateMetavariable(assignments, stated, context);
|
|
165
151
|
|
|
166
|
-
if (assumptionsValidate) {
|
|
152
|
+
if (assumptionsValidate && metavariablevalidates) {
|
|
167
153
|
let validatesWhenStated = false,
|
|
168
154
|
validatesWhenDerived = false;
|
|
169
155
|
|
|
@@ -230,28 +216,69 @@ export default define(class Frame extends Element {
|
|
|
230
216
|
validateAssumptions(assignments, stated, context) {
|
|
231
217
|
let assumptionsValidate;
|
|
232
218
|
|
|
233
|
-
const
|
|
234
|
-
assumptionsString = assumptionsStringFromAssumptions(this.assumptions);
|
|
219
|
+
const singular = this.isSingular();
|
|
235
220
|
|
|
236
|
-
|
|
221
|
+
if (!singular) {
|
|
222
|
+
const frameString = this.getString(), ///
|
|
223
|
+
assumptionsString = assumptionsStringFromAssumptions(this.assumptions);
|
|
237
224
|
|
|
238
|
-
|
|
225
|
+
context.trace(`Validating the '${assumptionsString}' assumptions of the '${frameString}' frame...`);
|
|
239
226
|
|
|
240
|
-
|
|
227
|
+
stated = true; ///
|
|
241
228
|
|
|
242
|
-
|
|
243
|
-
const assumptionVerifies = assumption.validate(assignments, stated, context);
|
|
229
|
+
assignments = null; ///
|
|
244
230
|
|
|
245
|
-
|
|
246
|
-
|
|
231
|
+
assumptionsValidate = this.assumptions.every((assumption) => {
|
|
232
|
+
const assumptionVerifies = assumption.validate(assignments, stated, context);
|
|
247
233
|
|
|
248
|
-
|
|
249
|
-
|
|
234
|
+
return assumptionVerifies;
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
if (assumptionsValidate) {
|
|
238
|
+
context.debug(`...validated the '${assumptionsString}' assumptions of the '${frameString}' frame.`);
|
|
239
|
+
}
|
|
240
|
+
} else {
|
|
241
|
+
assumptionsValidate = true;
|
|
250
242
|
}
|
|
251
243
|
|
|
252
244
|
return assumptionsValidate;
|
|
253
245
|
}
|
|
254
246
|
|
|
247
|
+
validateMetavariable(assignments, stated, context) {
|
|
248
|
+
let metavariableValidates = false;
|
|
249
|
+
|
|
250
|
+
const singular = this.isSingular();
|
|
251
|
+
|
|
252
|
+
if (singular) {
|
|
253
|
+
const frameString = this.getString(), ///
|
|
254
|
+
metavraibleString = this.metavariable.getString();
|
|
255
|
+
|
|
256
|
+
context.trace(`Validating the '${frameString}' frame's '${metavraibleString}' metavariable...`);
|
|
257
|
+
|
|
258
|
+
const metavariable = context.findMetavariable(this.metavariable);
|
|
259
|
+
|
|
260
|
+
if (metavariable !== null) {
|
|
261
|
+
const metaTypeName = FRAME_META_TYPE_NAME,
|
|
262
|
+
frameMetaType = findMetaTypeByMetaTypeName(metaTypeName),
|
|
263
|
+
metavariableValidateGivenMetaType = metavariable.validateGivenMetaType(frameMetaType, context);
|
|
264
|
+
|
|
265
|
+
if (metavariableValidateGivenMetaType) {
|
|
266
|
+
metavariableValidates = true;
|
|
267
|
+
}
|
|
268
|
+
} else {
|
|
269
|
+
context.debug(`The '${frameString}' frame's '${metavraibleString}' metavariable is not present.`);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (metavariableValidates) {
|
|
273
|
+
context.debug(`...validated the '${frameString}' frame's '${metavraibleString}' metavariable.`);
|
|
274
|
+
}
|
|
275
|
+
} else {
|
|
276
|
+
metavariableValidates = true;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return metavariableValidates;
|
|
280
|
+
}
|
|
281
|
+
|
|
255
282
|
validateGivenMetaType(metaType, assignments, stated, context) {
|
|
256
283
|
let validatesGivenMetaType = false;
|
|
257
284
|
|
package/src/element/judgement.js
CHANGED
|
@@ -6,7 +6,6 @@ import elements from "../elements";
|
|
|
6
6
|
|
|
7
7
|
import { define } from "../elements";
|
|
8
8
|
import { EMPTY_STRING } from "../constants";
|
|
9
|
-
import { synthetically } from "../utilities/context";
|
|
10
9
|
import { typeToTypeJSON } from "../utilities/json";
|
|
11
10
|
import { metaTypeToMetaTypeJSON } from "../utilities/json";
|
|
12
11
|
import { unifyMetavariable, unifyMetavariableIntrinsically } from "../process/unify";
|
|
@@ -103,7 +102,7 @@ export default define(class Metavariable extends Element {
|
|
|
103
102
|
return validatesGivenMetaType;
|
|
104
103
|
}
|
|
105
104
|
|
|
106
|
-
unifyFrame(frame,
|
|
105
|
+
unifyFrame(frame, generalContext, specificContext) {
|
|
107
106
|
let frameUnifies = false;
|
|
108
107
|
|
|
109
108
|
const context = specificContext, ///
|
|
@@ -112,30 +111,27 @@ export default define(class Metavariable extends Element {
|
|
|
112
111
|
|
|
113
112
|
context.trace(`Unifying the '${frameString}' frame with the '${metavariableString}' metavariable...`);
|
|
114
113
|
|
|
115
|
-
const
|
|
114
|
+
const metavariable = this, ///
|
|
115
|
+
frameMetavariableUnifies = this.unifyFrameMetavariable(frame, generalContext, specificContext);
|
|
116
116
|
|
|
117
117
|
if (frameMetavariableUnifies) {
|
|
118
118
|
frameUnifies = true;
|
|
119
119
|
} else {
|
|
120
|
-
const
|
|
121
|
-
simpleSubstitutionPresent = substitutions.isSimpleSubstitutionPresentByMetavariable(metavariable);
|
|
120
|
+
const simpleSubstitution = context.findSimpleSubstitutionByMetavariable(metavariable);
|
|
122
121
|
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
125
|
-
substitution = simpleSubstitution, ///
|
|
122
|
+
if (simpleSubstitution !== null) {
|
|
123
|
+
const substitution = simpleSubstitution, ///
|
|
126
124
|
substitutionFrameEqualToFrame = substitution.isFrameEqualToFrame(frame);
|
|
127
125
|
|
|
128
126
|
if (substitutionFrameEqualToFrame) {
|
|
129
127
|
frameUnifies = true;
|
|
130
128
|
}
|
|
131
129
|
} else {
|
|
132
|
-
const
|
|
130
|
+
const { FrameSubstitution } = elements,
|
|
131
|
+
frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context),
|
|
132
|
+
substitution = frameSubstitution; ///
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
const { FrameSubstitution } = elements;
|
|
136
|
-
|
|
137
|
-
FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context);
|
|
138
|
-
}, generalContext, specificContext);
|
|
134
|
+
context.addSubstitution(substitution);
|
|
139
135
|
|
|
140
136
|
frameUnifies = true;
|
|
141
137
|
}
|
|
@@ -148,7 +144,7 @@ export default define(class Metavariable extends Element {
|
|
|
148
144
|
return frameUnifies;
|
|
149
145
|
}
|
|
150
146
|
|
|
151
|
-
unifyStatement(statement, substitution,
|
|
147
|
+
unifyStatement(statement, substitution, generalContext, specificContext) {
|
|
152
148
|
let statementUnifies = false;
|
|
153
149
|
|
|
154
150
|
const context = specificContext, ///
|
|
@@ -160,17 +156,17 @@ export default define(class Metavariable extends Element {
|
|
|
160
156
|
|
|
161
157
|
context.trace(`Unifying the '${statementString}' statement with the '${metavariableString}${substitutionString}' metavariable...`);
|
|
162
158
|
|
|
163
|
-
const
|
|
159
|
+
const metavariable = this, ///
|
|
160
|
+
statementMetavariableUnifies = this.unifyStatementMetavariable(statement, generalContext, specificContext);
|
|
164
161
|
|
|
165
162
|
if (statementMetavariableUnifies) {
|
|
166
163
|
statementUnifies = true;
|
|
167
164
|
} else {
|
|
168
165
|
const context = specificContext, ///
|
|
169
|
-
|
|
170
|
-
substitutionPresent = substitutions.isSubstitutionPresentByMetavariableAndSubstitution(metavariable, substitution);
|
|
166
|
+
substitutionPresent = context.isSubstitutionPresentByMetavariableAndSubstitution(metavariable, substitution);
|
|
171
167
|
|
|
172
168
|
if (substitutionPresent) {
|
|
173
|
-
substitution =
|
|
169
|
+
substitution = context.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution); ///
|
|
174
170
|
|
|
175
171
|
const substitutionComparesToStatement = substitution.compareStatement(statement, context);
|
|
176
172
|
|
|
@@ -178,16 +174,14 @@ export default define(class Metavariable extends Element {
|
|
|
178
174
|
statementUnifies = true;
|
|
179
175
|
}
|
|
180
176
|
} else {
|
|
181
|
-
const
|
|
177
|
+
const { StatementSubstitution } = elements,
|
|
178
|
+
statementSubstitution = (substitution !== null) ?
|
|
179
|
+
StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) :
|
|
180
|
+
StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
|
|
182
181
|
|
|
183
|
-
|
|
184
|
-
const { StatementSubstitution } = elements;
|
|
182
|
+
substitution = statementSubstitution; ///
|
|
185
183
|
|
|
186
|
-
|
|
187
|
-
StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) :
|
|
188
|
-
StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
|
|
189
|
-
|
|
190
|
-
}, generalContext, specificContext);
|
|
184
|
+
context.addSubstitution(substitution);
|
|
191
185
|
|
|
192
186
|
statementUnifies = true;
|
|
193
187
|
}
|
|
@@ -209,13 +203,13 @@ export default define(class Metavariable extends Element {
|
|
|
209
203
|
|
|
210
204
|
context.trace(`Unifying the '${referenceString}' reference with the '${metavariableString}' metavariable...`);
|
|
211
205
|
|
|
212
|
-
const
|
|
206
|
+
const metavariable = this, ///
|
|
207
|
+
referenceMetavariableUnifies = this.unifyReferenceMetavariable(reference, substitutions, generalContext, specificContext);
|
|
213
208
|
|
|
214
209
|
if (referenceMetavariableUnifies) {
|
|
215
210
|
referenceUnifies = true;
|
|
216
211
|
} else {
|
|
217
|
-
const
|
|
218
|
-
simpleSubstitutionPresent = substitutions.isSimpleSubstitutionPresentByMetavariable(metavariable);
|
|
212
|
+
const simpleSubstitutionPresent = substitutions.isSimpleSubstitutionPresentByMetavariable(metavariable);
|
|
219
213
|
|
|
220
214
|
if (simpleSubstitutionPresent) {
|
|
221
215
|
const simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariable(metavariable), ///
|
|
@@ -226,13 +220,11 @@ export default define(class Metavariable extends Element {
|
|
|
226
220
|
referenceUnifies = true;
|
|
227
221
|
}
|
|
228
222
|
} else {
|
|
229
|
-
const
|
|
223
|
+
const { ReferenceSubstitution } = elements,
|
|
224
|
+
referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context),
|
|
225
|
+
substitution = referenceSubstitution; ///
|
|
230
226
|
|
|
231
|
-
|
|
232
|
-
const { ReferenceSubstitution } = elements;
|
|
233
|
-
|
|
234
|
-
ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context);
|
|
235
|
-
}, generalContext, specificContext);
|
|
227
|
+
context.addSubstitution(substitution);
|
|
236
228
|
|
|
237
229
|
referenceUnifies = true;
|
|
238
230
|
}
|
|
@@ -272,7 +264,7 @@ export default define(class Metavariable extends Element {
|
|
|
272
264
|
return metavariableUnifies;
|
|
273
265
|
}
|
|
274
266
|
|
|
275
|
-
unifyFrameMetavariable(frame,
|
|
267
|
+
unifyFrameMetavariable(frame, generalContext, specificContext) {
|
|
276
268
|
let frameMetavariableUnifies = false;
|
|
277
269
|
|
|
278
270
|
const context = specificContext, ///
|
|
@@ -312,7 +304,7 @@ export default define(class Metavariable extends Element {
|
|
|
312
304
|
return frameMetavariableUnifies;
|
|
313
305
|
}
|
|
314
306
|
|
|
315
|
-
unifyStatementMetavariable(statement,
|
|
307
|
+
unifyStatementMetavariable(statement, generalContext, specificContext) {
|
|
316
308
|
let statementMetavariableUnifies = false;
|
|
317
309
|
|
|
318
310
|
const context = specificContext, ///
|
|
@@ -338,7 +330,7 @@ export default define(class Metavariable extends Element {
|
|
|
338
330
|
|
|
339
331
|
const generalMetavariable = this, ///
|
|
340
332
|
specificMetavariable = statementMetavariable, ///
|
|
341
|
-
metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable,
|
|
333
|
+
metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
|
|
342
334
|
|
|
343
335
|
statementMetavariableUnifies = metavariableUnifiesIntrinsically; ///
|
|
344
336
|
|
|
@@ -4,7 +4,7 @@ import ProofAssertion from "../proofAssertion";
|
|
|
4
4
|
import assignAssignments from "../../process/assign";
|
|
5
5
|
|
|
6
6
|
import { define } from "../../elements";
|
|
7
|
-
import { attempt,
|
|
7
|
+
import { attempt, liminally } from "../../utilities/context";
|
|
8
8
|
import { statementFromJSON, procedureCallFromJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../../utilities/json";
|
|
9
9
|
|
|
10
10
|
export default define(class Premise extends ProofAssertion {
|
|
@@ -118,8 +118,13 @@ export default define(class Premise extends ProofAssertion {
|
|
|
118
118
|
return unifiesIndependently;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
unifySubproofOrProofAssertion(subproofOrProofAssertion,
|
|
122
|
-
let subproofOrProofAssertionUnifies
|
|
121
|
+
unifySubproofOrProofAssertion(subproofOrProofAssertion, context) {
|
|
122
|
+
let subproofOrProofAssertionUnifies;
|
|
123
|
+
|
|
124
|
+
const premiseString = this.getString(), ///
|
|
125
|
+
subproofOrProofAssertionString = subproofOrProofAssertion.getString();
|
|
126
|
+
|
|
127
|
+
context.trace(`Unifying the '${subproofOrProofAssertionString}' subproof or proof assertion with the '${premiseString}' premise...`);
|
|
123
128
|
|
|
124
129
|
const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
|
|
125
130
|
proofAssertion = subproofOrProofAssertionProofAssertion ?
|
|
@@ -129,62 +134,52 @@ export default define(class Premise extends ProofAssertion {
|
|
|
129
134
|
null :
|
|
130
135
|
subproofOrProofAssertion;
|
|
131
136
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (subproof !== null) {
|
|
135
|
-
const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
|
|
137
|
+
if (proofAssertion !== null) {
|
|
138
|
+
const proofAssertionUnifies = this.unifyProofAssertion(proofAssertion, context);
|
|
136
139
|
|
|
137
|
-
if (
|
|
140
|
+
if (proofAssertionUnifies) {
|
|
138
141
|
subproofOrProofAssertionUnifies = true;
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
|
|
142
|
-
if (
|
|
143
|
-
const
|
|
145
|
+
if (subproof !== null) {
|
|
146
|
+
const subproofUnifies = this.unifySubproof(subproof, context);
|
|
144
147
|
|
|
145
|
-
if (
|
|
148
|
+
if (subproofUnifies) {
|
|
146
149
|
subproofOrProofAssertionUnifies = true;
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
if (subproofOrProofAssertionUnifies) {
|
|
151
|
-
|
|
154
|
+
context.debug(`...unified the '${subproofOrProofAssertionString}' subproof or proof assertion with the '${premiseString}' premise.`);
|
|
152
155
|
}
|
|
153
156
|
|
|
154
|
-
subproofOrProofAssertionUnifies ?
|
|
155
|
-
substitutions.continue(context) :
|
|
156
|
-
substitutions.rollback(context);
|
|
157
|
-
|
|
158
157
|
return subproofOrProofAssertionUnifies;
|
|
159
158
|
}
|
|
160
159
|
|
|
161
|
-
unifyProofAssertion(proofAssertion,
|
|
162
|
-
let proofAssertionUnifies
|
|
160
|
+
unifyProofAssertion(proofAssertion, context) {
|
|
161
|
+
let proofAssertionUnifies;
|
|
163
162
|
|
|
164
163
|
const premiseString = this.getString(), ///
|
|
165
164
|
proofAssertionString = proofAssertion.getString();
|
|
166
165
|
|
|
167
166
|
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise...`);
|
|
168
167
|
|
|
169
|
-
const specificContext = context; ///
|
|
170
|
-
|
|
171
|
-
context = this.getContext();
|
|
172
|
-
|
|
173
|
-
const generalContext = context; ///
|
|
174
|
-
|
|
175
|
-
context = specificContext; ///
|
|
176
|
-
|
|
177
168
|
const proofAssertionContext = proofAssertion.getContext(),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
169
|
+
premiseContext = this.getContext(),
|
|
170
|
+
generalContext = premiseContext, ///
|
|
171
|
+
specificContext = proofAssertionContext; ///
|
|
181
172
|
|
|
182
|
-
|
|
183
|
-
|
|
173
|
+
proofAssertionUnifies = liminally((specificContext) => {
|
|
174
|
+
const statement = proofAssertion.getStatement(),
|
|
175
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
184
176
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
177
|
+
if (statementUnifies) {
|
|
178
|
+
specificContext.commit(context);
|
|
179
|
+
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
}, specificContext);
|
|
188
183
|
|
|
189
184
|
if (proofAssertionUnifies) {
|
|
190
185
|
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`);
|
|
@@ -193,7 +188,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
193
188
|
return proofAssertionUnifies;
|
|
194
189
|
}
|
|
195
190
|
|
|
196
|
-
unifySubproof(subproof,
|
|
191
|
+
unifySubproof(subproof, context) {
|
|
197
192
|
let subproofUnifies = false;
|
|
198
193
|
|
|
199
194
|
const premiseString = this.getString(),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import elements from "../../elements";
|
|
4
3
|
import ProofAssertion from "../proofAssertion";
|
|
5
4
|
|
|
6
5
|
import { define } from "../../elements";
|
|
@@ -59,6 +58,8 @@ export default define(class Step extends ProofAssertion {
|
|
|
59
58
|
verify(assignments, context) {
|
|
60
59
|
let verifies = false;
|
|
61
60
|
|
|
61
|
+
this.break(context);
|
|
62
|
+
|
|
62
63
|
const stepString = this.getString(); ///
|
|
63
64
|
|
|
64
65
|
context.trace(`Verifying the '${stepString}' step...`);
|
|
@@ -165,9 +166,8 @@ export default define(class Step extends ProofAssertion {
|
|
|
165
166
|
axiom = context.findAxiomByReference(reference);
|
|
166
167
|
|
|
167
168
|
if (axiom !== null) {
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
substitutions = Substitutions.fromNothing(context),
|
|
169
|
+
const step = this, ///
|
|
170
|
+
substitutions = [],
|
|
171
171
|
stepUnifies = axiom.unifyStep(step, substitutions, context);
|
|
172
172
|
|
|
173
173
|
if (stepUnifies) {
|
|
@@ -24,9 +24,11 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
24
24
|
return stated;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
verify(context) {
|
|
27
|
+
async verify(context) {
|
|
28
28
|
let verifies = false;
|
|
29
29
|
|
|
30
|
+
this.break(context);
|
|
31
|
+
|
|
30
32
|
const suppositionString = this.getString(); ///
|
|
31
33
|
|
|
32
34
|
context.trace(`Verifying the '${suppositionString}' supposition...`);
|
|
@@ -59,7 +59,7 @@ export default class ProofAssertion extends Element {
|
|
|
59
59
|
statementValidates = this.statement.validate(assignments, stated, context);
|
|
60
60
|
|
|
61
61
|
if (statementValidates) {
|
|
62
|
-
context.debug(`...validated the '${proofAssertionString}' proof assertion's '${statementString}'
|
|
62
|
+
context.debug(`...validated the '${proofAssertionString}' proof assertion's '${statementString}' statement. `);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return statementValidates;
|
|
@@ -71,14 +71,14 @@ export default class ProofAssertion extends Element {
|
|
|
71
71
|
if (this.statement !== null) {
|
|
72
72
|
const context = specificContext, ///
|
|
73
73
|
statementString = statement.getString(),
|
|
74
|
-
|
|
74
|
+
proofAssertionString = this.getString(); ///
|
|
75
75
|
|
|
76
|
-
context.trace(`Unifying the '${statementString}' statement with the '${
|
|
76
|
+
context.trace(`Unifying the '${statementString}' statement with the '${proofAssertionString}' proof assertion...`);
|
|
77
77
|
|
|
78
78
|
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
79
79
|
|
|
80
80
|
if (statementUnifies) {
|
|
81
|
-
context.debug(`...unified the '${statementString}' statement with the '${
|
|
81
|
+
context.debug(`...unified the '${statementString}' statement with the '${proofAssertionString}' proof assertion.`);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
package/src/element/reference.js
CHANGED
|
@@ -36,6 +36,17 @@ export default define(class Reference extends Element {
|
|
|
36
36
|
|
|
37
37
|
isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
|
|
38
38
|
|
|
39
|
+
isEqualTo(reference) {
|
|
40
|
+
const referenceA = this, ///
|
|
41
|
+
referenceB = reference, ///
|
|
42
|
+
referenceANode = referenceA.getNode(),
|
|
43
|
+
referenceBNode = referenceB.getNode(),
|
|
44
|
+
referenceANodeMatchesReferenceBNode = referenceANode.match(referenceBNode),
|
|
45
|
+
equalTo = referenceANodeMatchesReferenceBNode; ///
|
|
46
|
+
|
|
47
|
+
return equalTo;
|
|
48
|
+
}
|
|
49
|
+
|
|
39
50
|
compareParameter(parameter) {
|
|
40
51
|
let comparesToParamter = false;
|
|
41
52
|
|
|
@@ -214,9 +225,8 @@ export default define(class Reference extends Element {
|
|
|
214
225
|
|
|
215
226
|
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference...`);
|
|
216
227
|
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
substitutions = Substitutions.fromNothing(context),
|
|
228
|
+
const label = topLevelMetaAssertion.getLabel(),
|
|
229
|
+
substitutions = [],
|
|
220
230
|
labelUnifies = this.unifyLabel(label, substitutions, context);
|
|
221
231
|
|
|
222
232
|
topLevelMetaAssertionUnifies = labelUnifies; ///
|