occam-verify-cli 1.0.753 → 1.0.758
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 +5 -5
- package/lib/context/scoped.js +6 -5
- package/lib/context/synthetic.js +5 -1
- package/lib/element/assertion/contained.js +1 -1
- package/lib/element/assertion/subproof.js +110 -13
- package/lib/element/assumption.js +20 -32
- package/lib/element/conclusion.js +1 -5
- package/lib/element/deduction.js +16 -19
- package/lib/element/derivation.js +4 -4
- package/lib/element/metavariable.js +7 -1
- package/lib/element/proof.js +6 -6
- package/lib/element/proofAssertion/premise.js +9 -15
- package/lib/element/proofAssertion/supposition.js +10 -16
- package/lib/element/reference.js +10 -8
- package/lib/element/statement.js +99 -58
- package/lib/element/subDerivation.js +4 -4
- package/lib/element/subproof.js +6 -6
- package/lib/element/substitution/statement.js +63 -46
- package/lib/element/topLevelAssertion/axiom.js +15 -13
- package/lib/element/topLevelAssertion.js +1 -4
- package/lib/element/topLevelMetaAssertion.js +26 -2
- package/lib/element/variable.js +3 -1
- package/lib/process/unify.js +41 -3
- package/lib/utilities/releaseContext.js +3 -3
- package/lib/utilities/string.js +2 -2
- package/package.json +3 -3
- package/src/context/file/nominal.js +4 -4
- package/src/context/scoped.js +6 -4
- package/src/context/synthetic.js +6 -0
- package/src/element/assertion/contained.js +1 -1
- package/src/element/assertion/subproof.js +189 -16
- package/src/element/assumption.js +20 -51
- package/src/element/conclusion.js +0 -7
- package/src/element/deduction.js +15 -21
- package/src/element/derivation.js +4 -3
- package/src/element/metavariable.js +15 -2
- package/src/element/proof.js +6 -6
- package/src/element/proofAssertion/premise.js +18 -28
- package/src/element/proofAssertion/supposition.js +23 -32
- package/src/element/reference.js +9 -7
- package/src/element/statement.js +153 -87
- package/src/element/subDerivation.js +4 -3
- package/src/element/subproof.js +4 -4
- package/src/element/substitution/statement.js +94 -64
- package/src/element/topLevelAssertion/axiom.js +20 -16
- package/src/element/topLevelAssertion.js +0 -2
- package/src/element/topLevelMetaAssertion.js +40 -1
- package/src/element/variable.js +5 -0
- package/src/process/unify.js +63 -1
- package/src/utilities/releaseContext.js +1 -1
- package/src/utilities/string.js +3 -3
|
@@ -167,21 +167,18 @@ export default define(class Premise extends ProofAssertion {
|
|
|
167
167
|
const proofAssertionContext = proofAssertion.getContext(),
|
|
168
168
|
premiseContext = this.getContext(), ///
|
|
169
169
|
generalContext = premiseContext, ///
|
|
170
|
-
specificContext = proofAssertionContext
|
|
171
|
-
statementUnifies = reconcile((specificContext) => {
|
|
172
|
-
const statement = proofAssertion.getStatement(),
|
|
173
|
-
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
170
|
+
specificContext = proofAssertionContext; ///
|
|
174
171
|
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
reconcile((specificContext) => {
|
|
173
|
+
const statement = proofAssertion.getStatement(),
|
|
174
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
177
175
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}, specificContext);
|
|
176
|
+
if (statementUnifies) {
|
|
177
|
+
specificContext.commit(context);
|
|
181
178
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
179
|
+
proofAssertionUnifies = true;
|
|
180
|
+
}
|
|
181
|
+
}, specificContext);
|
|
185
182
|
|
|
186
183
|
if (proofAssertionUnifies) {
|
|
187
184
|
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`);
|
|
@@ -193,19 +190,11 @@ export default define(class Premise extends ProofAssertion {
|
|
|
193
190
|
unifySubproof(subproof, context) {
|
|
194
191
|
let subproofUnifies = false;
|
|
195
192
|
|
|
196
|
-
const premiseString = this.getString(),
|
|
193
|
+
const premiseString = this.getString(), ///
|
|
197
194
|
subproofString = subproof.getString();
|
|
198
195
|
|
|
199
196
|
context.trace(`Unifying the '${subproofString}' subproof with the '${premiseString}' premise...`);
|
|
200
197
|
|
|
201
|
-
const specificContext = context; ///
|
|
202
|
-
|
|
203
|
-
context = this.getContext();
|
|
204
|
-
|
|
205
|
-
const generalContext = context; ///
|
|
206
|
-
|
|
207
|
-
context = specificContext; ///
|
|
208
|
-
|
|
209
198
|
const statement = this.getStatement();
|
|
210
199
|
|
|
211
200
|
if (statement !== null) {
|
|
@@ -213,15 +202,16 @@ export default define(class Premise extends ProofAssertion {
|
|
|
213
202
|
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
214
203
|
|
|
215
204
|
if (subproofAssertionNode !== null) {
|
|
216
|
-
const
|
|
217
|
-
assertionNode = subproofAssertionNode, ///
|
|
218
|
-
assertion = context.findAssertionByAssertionNode(assertionNode)
|
|
205
|
+
const specificContext = context; ///
|
|
219
206
|
|
|
220
|
-
|
|
221
|
-
const subproofAssertion = assertion; ///
|
|
207
|
+
context = this.getContext();
|
|
222
208
|
|
|
223
|
-
|
|
224
|
-
|
|
209
|
+
const generalContext = context, ///
|
|
210
|
+
subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
211
|
+
|
|
212
|
+
context = specificContext; ///
|
|
213
|
+
|
|
214
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, generalContext, specificContext);
|
|
225
215
|
}
|
|
226
216
|
}
|
|
227
217
|
|
|
@@ -121,14 +121,14 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
121
121
|
let suppositionUnifies;
|
|
122
122
|
|
|
123
123
|
const context = specificContext, ///
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
specificSupposition = supposition, ///
|
|
125
|
+
generalSuppositionString = this.getString(), ///
|
|
126
|
+
specificSuppositionString = specificSupposition.getString();
|
|
127
127
|
|
|
128
128
|
context.trace(`Unifying the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition...`);
|
|
129
129
|
|
|
130
130
|
const statement = specificSupposition.getStatement(),
|
|
131
|
-
|
|
131
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
132
132
|
|
|
133
133
|
suppositionUnifies = statementUnifies; ///
|
|
134
134
|
|
|
@@ -189,20 +189,18 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
189
189
|
const proofAssertionContext = proofAssertion.getContext(),
|
|
190
190
|
suppositionContext = this.getContext(),
|
|
191
191
|
generalContext = suppositionContext, ///
|
|
192
|
-
specificContext = proofAssertionContext
|
|
193
|
-
statementUnifies = reconcile((specificContext) => {
|
|
194
|
-
const statement = proofAssertion.getStatement(),
|
|
195
|
-
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
192
|
+
specificContext = proofAssertionContext;
|
|
196
193
|
|
|
197
|
-
|
|
194
|
+
reconcile((specificContext) => {
|
|
195
|
+
const statement = proofAssertion.getStatement(),
|
|
196
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
198
197
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}, specificContext);
|
|
198
|
+
if (statementUnifies) {
|
|
199
|
+
specificContext.commit(context);
|
|
202
200
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
201
|
+
proofAssertionUnifies = true;
|
|
202
|
+
}
|
|
203
|
+
}, specificContext);
|
|
206
204
|
|
|
207
205
|
if (proofAssertionUnifies) {
|
|
208
206
|
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`);
|
|
@@ -214,19 +212,11 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
214
212
|
unifySubproof(subproof, context) {
|
|
215
213
|
let subproofUnifies = false;
|
|
216
214
|
|
|
217
|
-
const
|
|
218
|
-
|
|
215
|
+
const subproofString = subproof.getString(),
|
|
216
|
+
suppositionString = this.getString();
|
|
219
217
|
|
|
220
218
|
context.trace(`Unifying the '${subproofString}' subproof with the '${suppositionString}' supposition...`);
|
|
221
219
|
|
|
222
|
-
const specificContext = context; ///
|
|
223
|
-
|
|
224
|
-
context = this.getContext();
|
|
225
|
-
|
|
226
|
-
const generalContext = context; ///
|
|
227
|
-
|
|
228
|
-
context = specificContext; ///
|
|
229
|
-
|
|
230
220
|
const statement = this.getStatement();
|
|
231
221
|
|
|
232
222
|
if (statement !== null) {
|
|
@@ -234,15 +224,16 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
234
224
|
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
235
225
|
|
|
236
226
|
if (subproofAssertionNode !== null) {
|
|
237
|
-
const
|
|
238
|
-
assertionNode = subproofAssertionNode, ///
|
|
239
|
-
assertion = context.findAssertionByAssertionNode(assertionNode)
|
|
227
|
+
const specificContext = context; ///
|
|
240
228
|
|
|
241
|
-
|
|
242
|
-
const subproofAssertion = assertion; ///
|
|
229
|
+
context = this.getContext();
|
|
243
230
|
|
|
244
|
-
|
|
245
|
-
|
|
231
|
+
const generalContext = context, ///
|
|
232
|
+
subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
233
|
+
|
|
234
|
+
context = specificContext; ///
|
|
235
|
+
|
|
236
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, generalContext, specificContext);
|
|
246
237
|
}
|
|
247
238
|
}
|
|
248
239
|
|
package/src/element/reference.js
CHANGED
|
@@ -249,25 +249,27 @@ export default define(class Reference extends Element {
|
|
|
249
249
|
return metavariableUnifies;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
|
|
253
|
-
let
|
|
252
|
+
compareTopLevelMetaAssertion(topLevelMetaAssertion, context) {
|
|
253
|
+
let topLevelMetaAssertionCompares = false;
|
|
254
254
|
|
|
255
255
|
const reference = this, ///
|
|
256
256
|
referenceString = reference.getString(),
|
|
257
257
|
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
258
258
|
|
|
259
|
-
context.trace(`
|
|
259
|
+
context.trace(`Comparing the '${topLevelMetaAssertionString}' top level meta-assertion to the '${referenceString}' reference...`);
|
|
260
260
|
|
|
261
261
|
const label = topLevelMetaAssertion.getLabel(),
|
|
262
262
|
labelUnifies = this.unifyLabel(label, context);
|
|
263
263
|
|
|
264
|
-
|
|
264
|
+
if (labelUnifies) {
|
|
265
|
+
topLevelMetaAssertionCompares = true;
|
|
266
|
+
}
|
|
265
267
|
|
|
266
|
-
if (
|
|
267
|
-
context.trace(`...
|
|
268
|
+
if (topLevelMetaAssertionCompares) {
|
|
269
|
+
context.trace(`...compared the '${topLevelMetaAssertionString}' top level meta-assertion to the '${referenceString}' reference.`);
|
|
268
270
|
}
|
|
269
271
|
|
|
270
|
-
return
|
|
272
|
+
return topLevelMetaAssertionCompares;
|
|
271
273
|
}
|
|
272
274
|
|
|
273
275
|
toJSON() {
|
package/src/element/statement.js
CHANGED
|
@@ -4,12 +4,12 @@ import { Element } from "occam-languages";
|
|
|
4
4
|
import { arrayUtilities } from "necessary";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import { instantiate } from "../utilities/context";
|
|
8
7
|
import { unifyStatement } from "../process/unify";
|
|
9
8
|
import { validateStatements } from "../utilities/validation";
|
|
10
9
|
import { instantiateStatement } from "../process/instantiate";
|
|
10
|
+
import { reconcile, instantiate } from "../utilities/context";
|
|
11
11
|
|
|
12
|
-
const {
|
|
12
|
+
const { backwardsSome } = arrayUtilities;
|
|
13
13
|
|
|
14
14
|
export default define(class Statement extends Element {
|
|
15
15
|
getStatementNode() {
|
|
@@ -33,6 +33,14 @@ export default define(class Statement extends Element {
|
|
|
33
33
|
return singular;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
isEqualTo(statement) {
|
|
37
|
+
const statementNode = statement.getNode(),
|
|
38
|
+
statementNodeMatches = this.matchStatementNode(statementNode),
|
|
39
|
+
equalTo = statementNodeMatches; ///
|
|
40
|
+
|
|
41
|
+
return equalTo;
|
|
42
|
+
}
|
|
43
|
+
|
|
36
44
|
matchStatementNode(statementNode) {
|
|
37
45
|
const node = statementNode, ///
|
|
38
46
|
nodeMatches = this.matchNode(node),
|
|
@@ -41,6 +49,48 @@ export default define(class Statement extends Element {
|
|
|
41
49
|
return statementNodeMatches;
|
|
42
50
|
}
|
|
43
51
|
|
|
52
|
+
compareParameter(parameter) {
|
|
53
|
+
let comparesToParamter = false;
|
|
54
|
+
|
|
55
|
+
const singular = this.isSingular();
|
|
56
|
+
|
|
57
|
+
if (singular) {
|
|
58
|
+
const parameterName = parameter.getName();
|
|
59
|
+
|
|
60
|
+
if (parameterName !== null) {
|
|
61
|
+
const metavariableName = this.getMetavariableName();
|
|
62
|
+
|
|
63
|
+
if (parameterName === metavariableName) {
|
|
64
|
+
comparesToParamter = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return comparesToParamter;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
compareMetavariable(metavariable) {
|
|
73
|
+
let comparesToMetavariableName;
|
|
74
|
+
|
|
75
|
+
const singular = this.isSingular();
|
|
76
|
+
|
|
77
|
+
if (singular) {
|
|
78
|
+
let metavariableName;
|
|
79
|
+
|
|
80
|
+
metavariableName = metavariable.getName();
|
|
81
|
+
|
|
82
|
+
const metavariableNameA = metavariableName; ///
|
|
83
|
+
|
|
84
|
+
metavariableName = this.getMetavariableName();
|
|
85
|
+
|
|
86
|
+
const metavariableNameB = metavariableName; ///
|
|
87
|
+
|
|
88
|
+
comparesToMetavariableName = (metavariableNameA === metavariableNameB);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return comparesToMetavariableName;
|
|
92
|
+
}
|
|
93
|
+
|
|
44
94
|
compareMetavariableName(metavariableName) {
|
|
45
95
|
let comparesToMetavariableName = false;
|
|
46
96
|
|
|
@@ -59,6 +109,21 @@ export default define(class Statement extends Element {
|
|
|
59
109
|
return comparesToMetavariableName;
|
|
60
110
|
}
|
|
61
111
|
|
|
112
|
+
compareSubproofOrProofAssertions(subproofOrProofAssertions, context) {
|
|
113
|
+
let comparesToSubproofOrProofAssertions;
|
|
114
|
+
|
|
115
|
+
comparesToSubproofOrProofAssertions = backwardsSome(subproofOrProofAssertions, (subproofOrProofAssertion) => {
|
|
116
|
+
const statement = this, ///
|
|
117
|
+
subproofOrProofAssertionComparesToStatement = subproofOrProofAssertion.compareStatement(statement, context);
|
|
118
|
+
|
|
119
|
+
if (subproofOrProofAssertionComparesToStatement) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
return comparesToSubproofOrProofAssertions;
|
|
125
|
+
}
|
|
126
|
+
|
|
62
127
|
findValidStatment(context) {
|
|
63
128
|
const statementNode = this.getStatementNode(),
|
|
64
129
|
statement = context.findStatementByStatementNode(statementNode),
|
|
@@ -67,14 +132,6 @@ export default define(class Statement extends Element {
|
|
|
67
132
|
return validStatement;
|
|
68
133
|
}
|
|
69
134
|
|
|
70
|
-
isEqualTo(statement) {
|
|
71
|
-
const statementNode = statement.getNode(),
|
|
72
|
-
statementNodeMatches = this.matchStatementNode(statementNode),
|
|
73
|
-
equalTo = statementNodeMatches; ///
|
|
74
|
-
|
|
75
|
-
return equalTo;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
135
|
isTermContained(term, context) {
|
|
79
136
|
let termContained;
|
|
80
137
|
|
|
@@ -127,48 +184,6 @@ export default define(class Statement extends Element {
|
|
|
127
184
|
return frameContained;
|
|
128
185
|
}
|
|
129
186
|
|
|
130
|
-
compareParameter(parameter) {
|
|
131
|
-
let comparesToParamter = false;
|
|
132
|
-
|
|
133
|
-
const singular = this.isSingular();
|
|
134
|
-
|
|
135
|
-
if (singular) {
|
|
136
|
-
const parameterName = parameter.getName();
|
|
137
|
-
|
|
138
|
-
if (parameterName !== null) {
|
|
139
|
-
const metavariableName = this.getMetavariableName();
|
|
140
|
-
|
|
141
|
-
if (parameterName === metavariableName) {
|
|
142
|
-
comparesToParamter = true;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return comparesToParamter;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
compareMetavariable(metavariable) {
|
|
151
|
-
let comparesToMetavariableName;
|
|
152
|
-
|
|
153
|
-
const singular = this.isSingular();
|
|
154
|
-
|
|
155
|
-
if (singular) {
|
|
156
|
-
let metavariableName;
|
|
157
|
-
|
|
158
|
-
metavariableName = metavariable.getName();
|
|
159
|
-
|
|
160
|
-
const metavariableNameA = metavariableName; ///
|
|
161
|
-
|
|
162
|
-
metavariableName = this.getMetavariableName();
|
|
163
|
-
|
|
164
|
-
const metavariableNameB = metavariableName; ///
|
|
165
|
-
|
|
166
|
-
comparesToMetavariableName = (metavariableNameA === metavariableNameB);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return comparesToMetavariableName;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
187
|
validate(stated, context) {
|
|
173
188
|
let statement = null;
|
|
174
189
|
|
|
@@ -208,40 +223,60 @@ export default define(class Statement extends Element {
|
|
|
208
223
|
let subproofUnifies = false;
|
|
209
224
|
|
|
210
225
|
const statementNode = this.getStatementNode(),
|
|
211
|
-
subproofAssertionNode = statementNode.getSubproofAssertionNode()
|
|
212
|
-
assertionNode = subproofAssertionNode; ///
|
|
226
|
+
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
213
227
|
|
|
214
|
-
if (
|
|
228
|
+
if (subproofAssertionNode !== null) {
|
|
215
229
|
const context = generalContext, ///
|
|
216
|
-
|
|
217
|
-
|
|
230
|
+
subproofString = subproof.getString(),
|
|
231
|
+
statementString = this.getString();
|
|
218
232
|
|
|
219
|
-
|
|
220
|
-
subproofAssertionString = subproofAssertion.getString();
|
|
233
|
+
context.trace(`Unifying the '${subproofString}' subproof with the '${statementString}' statement...`);
|
|
221
234
|
|
|
222
|
-
context.
|
|
235
|
+
const subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
223
236
|
|
|
224
|
-
|
|
225
|
-
subproofAssertionStatements = subproofAssertion.getStatements();
|
|
226
|
-
|
|
227
|
-
subproofUnifies = match(subproofAssertionStatements, subproofStatements, (subproofAssertionStatement, subproofStatement) => {
|
|
228
|
-
const generalStatement = subproofAssertionStatement, ///
|
|
229
|
-
specificStatement = subproofStatement, ///
|
|
230
|
-
statementUnifies = unifyStatement(generalStatement, specificStatement, generalContext, specificContext);
|
|
231
|
-
|
|
232
|
-
if (statementUnifies) {
|
|
233
|
-
return true;
|
|
234
|
-
}
|
|
235
|
-
});
|
|
237
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, generalContext, specificContext);
|
|
236
238
|
|
|
237
239
|
if (subproofUnifies) {
|
|
238
|
-
context.debug(`...unified the '${subproofString}' subproof with the '${
|
|
240
|
+
context.debug(`...unified the '${subproofString}' subproof with the '${statementString}' statement.`);
|
|
239
241
|
}
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
return subproofUnifies;
|
|
243
245
|
}
|
|
244
246
|
|
|
247
|
+
unifyDeduction(deduction, generalContext, specificContext) {
|
|
248
|
+
let deductionUnifies = false;
|
|
249
|
+
|
|
250
|
+
const statementString = this.getString(), ///
|
|
251
|
+
deductionString = deduction.getString(),
|
|
252
|
+
deductionStatement = deduction.getStatement(),
|
|
253
|
+
deductionStatementString = deductionStatement.getString();
|
|
254
|
+
|
|
255
|
+
let context;
|
|
256
|
+
|
|
257
|
+
context = specificContext; ///
|
|
258
|
+
|
|
259
|
+
context.trace(`Unifying the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${statementString}' statement...`);
|
|
260
|
+
|
|
261
|
+
context = deduction.getContext();
|
|
262
|
+
|
|
263
|
+
specificContext = context; ///
|
|
264
|
+
|
|
265
|
+
reconcile((specificContext) => {
|
|
266
|
+
const deductionStatementUnfies = this.unifyStatement(deductionStatement, generalContext, specificContext);
|
|
267
|
+
|
|
268
|
+
if (deductionStatementUnfies) {
|
|
269
|
+
deductionUnifies = true;
|
|
270
|
+
}
|
|
271
|
+
}, specificContext);
|
|
272
|
+
|
|
273
|
+
if (deductionUnifies) {
|
|
274
|
+
context.debug(`...unified the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${statementString}' statement.`);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return deductionUnifies;
|
|
278
|
+
}
|
|
279
|
+
|
|
245
280
|
unifyStatement(statement, generalContext, specificContext) {
|
|
246
281
|
let statementUnifies;
|
|
247
282
|
|
|
@@ -274,13 +309,22 @@ export default define(class Statement extends Element {
|
|
|
274
309
|
definedAssertionNode = statementNode.getDefinedAssertionNode(),
|
|
275
310
|
containedAssertionNode = statementNode.getContainedAssertionNode();
|
|
276
311
|
|
|
277
|
-
if (
|
|
312
|
+
if (definedAssertionNode !== null) {
|
|
313
|
+
const context = generalContext, ///
|
|
314
|
+
definedAssertion = context.findAssertionByAssertionNode(definedAssertionNode),
|
|
315
|
+
definedAssertionUnifiesIndependently = definedAssertion.unifyIndependently(generalContext, specificContext);
|
|
316
|
+
|
|
317
|
+
if (definedAssertionUnifiesIndependently) {
|
|
318
|
+
unifiesIndependently = true;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (containedAssertionNode !== null) {
|
|
278
323
|
const context = generalContext, ///
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
assertionUnifiesIndependently = assertion.unifyIndependently(generalContext, specificContext);
|
|
324
|
+
containedAssertion = context.findAssertionByAssertionNode(containedAssertionNode),
|
|
325
|
+
containedAssertionUnifiesIndependently = containedAssertion.unifyIndependently(generalContext, specificContext);
|
|
282
326
|
|
|
283
|
-
if (
|
|
327
|
+
if (containedAssertionUnifiesIndependently) {
|
|
284
328
|
unifiesIndependently = true;
|
|
285
329
|
}
|
|
286
330
|
}
|
|
@@ -292,19 +336,41 @@ export default define(class Statement extends Element {
|
|
|
292
336
|
return unifiesIndependently;
|
|
293
337
|
}
|
|
294
338
|
|
|
295
|
-
|
|
296
|
-
let
|
|
339
|
+
unifyTopLevelMetaAssertion(topLevelMetaAssertion, generalContext, specificContext) {
|
|
340
|
+
let topLevelMetaAssertionUnifies = false;
|
|
297
341
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
342
|
+
const context = specificContext, ///
|
|
343
|
+
statementString = this.getString(), ///
|
|
344
|
+
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
301
345
|
|
|
302
|
-
|
|
303
|
-
|
|
346
|
+
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${statementString}' statement...`);
|
|
347
|
+
|
|
348
|
+
const topLevelMetaAssertionUnconditional = topLevelMetaAssertion.isUnconditional();
|
|
349
|
+
|
|
350
|
+
if (topLevelMetaAssertionUnconditional) {
|
|
351
|
+
const deduction = topLevelMetaAssertion.getDeduction(),
|
|
352
|
+
deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
|
|
353
|
+
|
|
354
|
+
if (deductionUnifies) {
|
|
355
|
+
topLevelMetaAssertionUnifies = true;
|
|
304
356
|
}
|
|
305
|
-
}
|
|
357
|
+
} else {
|
|
358
|
+
const statementNode = this.getStatementNode(),
|
|
359
|
+
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
306
360
|
|
|
307
|
-
|
|
361
|
+
if (subproofAssertionNode !== null) {
|
|
362
|
+
const context = generalContext, ///
|
|
363
|
+
subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
364
|
+
|
|
365
|
+
topLevelMetaAssertionUnifies = subproofAssertion.unifyTopLevelMetaAssertion(topLevelMetaAssertion, generalContext, specificContext);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (topLevelMetaAssertionUnifies) {
|
|
370
|
+
context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${statementString}' statement.`);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return topLevelMetaAssertionUnifies;
|
|
308
374
|
}
|
|
309
375
|
|
|
310
376
|
toJSON() {
|
|
@@ -26,11 +26,12 @@ export default define(class SubDerivation extends Element {
|
|
|
26
26
|
return subDerivationNode;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
getLastStep() {
|
|
30
30
|
const lastSubproofOrProofAssertion = last(this.subproofOrProofAssertions),
|
|
31
|
-
lastProofAssertion = lastSubproofOrProofAssertion
|
|
31
|
+
lastProofAssertion = lastSubproofOrProofAssertion, ///
|
|
32
|
+
lastStep = lastProofAssertion; ///
|
|
32
33
|
|
|
33
|
-
return
|
|
34
|
+
return lastStep;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
async verify(context) {
|
package/src/element/subproof.js
CHANGED
|
@@ -30,19 +30,19 @@ export default define(class Subproof extends Element {
|
|
|
30
30
|
return subproofNode;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
getLastStep() { return this.subDerivation.getLastStep(); }
|
|
34
34
|
|
|
35
35
|
getStatements() {
|
|
36
|
-
const
|
|
36
|
+
const lastStep = this.getLastStep(),
|
|
37
37
|
suppositionStatements = this.suppositions.map((supposition) => {
|
|
38
38
|
const suppositionStatement = supposition.getStatement();
|
|
39
39
|
|
|
40
40
|
return suppositionStatement;
|
|
41
41
|
}),
|
|
42
|
-
|
|
42
|
+
lastStepStatement = lastStep.getStatement(),
|
|
43
43
|
statements = [
|
|
44
44
|
...suppositionStatements,
|
|
45
|
-
|
|
45
|
+
lastStepStatement
|
|
46
46
|
];
|
|
47
47
|
|
|
48
48
|
return statements;
|