occam-verify-cli 1.0.444 → 1.0.448
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.js +5 -5
- package/lib/context/local.js +27 -27
- package/lib/context/release.js +3 -7
- package/lib/context/temporary.js +13 -13
- package/lib/element/axiom.js +19 -19
- package/lib/element/axiomLemmaTheoremConjecture.js +25 -32
- package/lib/element/derivation.js +14 -14
- package/lib/element/hypothesis.js +14 -55
- package/lib/element/metaLemmaMetatheorem.js +2 -35
- package/lib/element/metavariable.js +9 -5
- package/lib/element/premise.js +67 -140
- package/lib/element/proof.js +7 -7
- package/lib/element/proofAssertion.js +203 -0
- package/lib/element/reference.js +5 -3
- package/lib/element/rule.js +26 -26
- package/lib/element/statement.js +8 -8
- package/lib/element/step.js +14 -93
- package/lib/element/subDerivation.js +14 -14
- package/lib/element/subproof.js +11 -11
- package/lib/element/supposition.js +62 -152
- package/lib/metaTypes.js +19 -8
- package/lib/node/subDerivation.js +1 -8
- package/lib/node/subproof.js +1 -8
- package/lib/utilities/brackets.js +6 -11
- package/lib/utilities/instance.js +24 -11
- package/lib/utilities/string.js +6 -6
- package/lib/utilities/unification.js +21 -21
- package/package.json +6 -6
- package/src/context/file.js +3 -3
- package/src/context/local.js +28 -28
- package/src/context/release.js +2 -9
- package/src/context/temporary.js +4 -4
- package/src/element/axiom.js +26 -26
- package/src/element/axiomLemmaTheoremConjecture.js +25 -44
- package/src/element/derivation.js +12 -12
- package/src/element/hypothesis.js +14 -16
- package/src/element/metaLemmaMetatheorem.js +1 -66
- package/src/element/metavariable.js +9 -4
- package/src/element/premise.js +94 -62
- package/src/element/proof.js +6 -6
- package/src/element/proofAssertion.js +76 -0
- package/src/element/reference.js +4 -2
- package/src/element/rule.js +22 -22
- package/src/element/statement.js +6 -6
- package/src/element/step.js +12 -50
- package/src/element/subDerivation.js +12 -12
- package/src/element/subproof.js +7 -7
- package/src/element/supposition.js +74 -73
- package/src/metaTypes.js +23 -10
- package/src/node/subDerivation.js +0 -7
- package/src/node/subproof.js +0 -7
- package/src/utilities/brackets.js +5 -8
- package/src/utilities/instance.js +24 -6
- package/src/utilities/string.js +7 -7
- package/src/utilities/unification.js +24 -24
package/src/element/premise.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import elements from "../elements";
|
|
3
|
+
import ProofAssertion from "./proofAssertion";
|
|
5
4
|
import TemporaryContext from "../context/temporary";
|
|
6
5
|
import assignAssignments from "../process/assign";
|
|
7
6
|
|
|
8
7
|
import { define } from "../elements";
|
|
9
|
-
import { termsFromJSON,
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import { termsFromJSON,
|
|
9
|
+
framesFromJSON,
|
|
10
|
+
termsToTermsJSON,
|
|
11
|
+
statementFromJSON,
|
|
12
|
+
framesToFramesJSON,
|
|
13
|
+
procedureCallFromJSON,
|
|
14
|
+
statementToStatementJSON,
|
|
15
|
+
procedureCallToProcedureCallJSON } from "../utilities/json";
|
|
16
|
+
|
|
17
|
+
export default define(class Premise extends ProofAssertion {
|
|
12
18
|
constructor(context, string, node, statement, procedureCall) {
|
|
13
|
-
super(context, string, node);
|
|
19
|
+
super(context, string, node, statement);
|
|
14
20
|
|
|
15
|
-
this.statement = statement;
|
|
16
21
|
this.procedureCall = procedureCall;
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
getStatement() {
|
|
20
|
-
return this.statement;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
24
|
getProcedureCall() {
|
|
24
25
|
return this.procedureCall;
|
|
25
26
|
}
|
|
@@ -36,23 +37,23 @@ export default define(class Premise extends Element {
|
|
|
36
37
|
|
|
37
38
|
context.trace(`Verifying the '${premiseString}' premise...`, node);
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
const statement = this.getStatement();
|
|
41
|
+
|
|
42
|
+
if ((statement === null) && (this.procedureCall === null)) {
|
|
40
43
|
context.debug(`Unable to verify the '${premiseString}' premise because it is nonsense.`, node);
|
|
41
44
|
} else {
|
|
42
|
-
if (
|
|
45
|
+
if (statement !== null) {
|
|
43
46
|
const stated = true,
|
|
44
47
|
assignments = [],
|
|
45
|
-
statementValidates =
|
|
48
|
+
statementValidates = statement.validate(assignments, stated, context);
|
|
46
49
|
|
|
47
50
|
if (statementValidates) {
|
|
48
51
|
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
49
52
|
|
|
50
53
|
if (assignmentsAssigned) {
|
|
51
|
-
const
|
|
52
|
-
step = Step.fromStatement(this.statement, context),
|
|
53
|
-
stepOrSubproof = step; ///
|
|
54
|
+
const subproofOrProofAssertion = this; ///
|
|
54
55
|
|
|
55
|
-
context.
|
|
56
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
56
57
|
|
|
57
58
|
verifies = true;
|
|
58
59
|
}
|
|
@@ -83,14 +84,22 @@ export default define(class Premise extends Element {
|
|
|
83
84
|
let unifiesIndependently = false;
|
|
84
85
|
|
|
85
86
|
const node = this.getNode(),
|
|
86
|
-
premiseString = this.getString()
|
|
87
|
-
generalContext = this.context, ///
|
|
88
|
-
specificContext = context; ///
|
|
87
|
+
premiseString = this.getString(); ///
|
|
89
88
|
|
|
90
89
|
context.trace(`Unifying the '${premiseString}' premise independently...`, node);
|
|
91
90
|
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
const generalContext = context; ///
|
|
92
|
+
|
|
93
|
+
context = this.getContext();
|
|
94
|
+
|
|
95
|
+
const specificContext = context; ///
|
|
96
|
+
|
|
97
|
+
context = specificContext; ///
|
|
98
|
+
|
|
99
|
+
const statement = this.getStatement();
|
|
100
|
+
|
|
101
|
+
if (statement !== null) {
|
|
102
|
+
const statementUnifiesIndependently = statement.unifyIndependently(substitutions, generalContext, specificContext);
|
|
94
103
|
|
|
95
104
|
if (statementUnifiesIndependently) {
|
|
96
105
|
unifiesIndependently = true;
|
|
@@ -112,51 +121,54 @@ export default define(class Premise extends Element {
|
|
|
112
121
|
return unifiesIndependently;
|
|
113
122
|
}
|
|
114
123
|
|
|
115
|
-
|
|
116
|
-
let
|
|
124
|
+
unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, context) {
|
|
125
|
+
let subproofOrProofAssertionUnifies = false;
|
|
117
126
|
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
127
|
+
const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
|
|
128
|
+
proofAssertion = subproofOrProofAssertionProofAssertion ?
|
|
129
|
+
subproofOrProofAssertion :
|
|
130
|
+
null,
|
|
131
|
+
subproof = subproofOrProofAssertionProofAssertion ?
|
|
132
|
+
null :
|
|
133
|
+
subproofOrProofAssertion;
|
|
125
134
|
|
|
126
135
|
substitutions.snapshot();
|
|
127
136
|
|
|
128
137
|
if (subproof !== null) {
|
|
129
138
|
const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
|
|
130
139
|
|
|
131
|
-
|
|
140
|
+
if (subproofUnifies) {
|
|
141
|
+
subproofOrProofAssertionUnifies = true;
|
|
142
|
+
}
|
|
132
143
|
}
|
|
133
144
|
|
|
134
|
-
if (
|
|
135
|
-
const
|
|
145
|
+
if (proofAssertion !== null) {
|
|
146
|
+
const proofAssertionUnifies = this.unifyProofAssertion(proofAssertion, substitutions, context);
|
|
136
147
|
|
|
137
|
-
|
|
148
|
+
if (proofAssertionUnifies) {
|
|
149
|
+
subproofOrProofAssertionUnifies = true;
|
|
150
|
+
}
|
|
138
151
|
}
|
|
139
152
|
|
|
140
|
-
if (
|
|
153
|
+
if (subproofOrProofAssertionUnifies) {
|
|
141
154
|
substitutions.resolve(context);
|
|
142
155
|
}
|
|
143
156
|
|
|
144
|
-
|
|
157
|
+
subproofOrProofAssertionUnifies ?
|
|
145
158
|
substitutions.continue() :
|
|
146
159
|
substitutions.rollback(context);
|
|
147
160
|
|
|
148
|
-
return
|
|
161
|
+
return subproofOrProofAssertionUnifies;
|
|
149
162
|
}
|
|
150
163
|
|
|
151
|
-
|
|
152
|
-
let
|
|
164
|
+
unifyProofAssertion(proofAssertion, substitutions, context) {
|
|
165
|
+
let proofAssertionUnifies = false;
|
|
153
166
|
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
premiseStatementString = premiseStatement.getString();
|
|
167
|
+
const node = this.getNode(),
|
|
168
|
+
premiseString = this.getString(),
|
|
169
|
+
proofAssertionString = proofAssertion.getString();
|
|
158
170
|
|
|
159
|
-
context.trace(`Unifying the '${
|
|
171
|
+
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise...`, node);
|
|
160
172
|
|
|
161
173
|
const specificContext = context; ///
|
|
162
174
|
|
|
@@ -166,24 +178,28 @@ export default define(class Premise extends Element {
|
|
|
166
178
|
|
|
167
179
|
context = specificContext; ///
|
|
168
180
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
subproofAssertion = subproofAssertionFromStatement(this.statement, context);
|
|
181
|
+
const statement = proofAssertion.getStatement(),
|
|
182
|
+
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
172
183
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
184
|
+
if (statementUnifies) {
|
|
185
|
+
proofAssertionUnifies = true;
|
|
176
186
|
}
|
|
177
187
|
|
|
178
|
-
if (
|
|
179
|
-
context.debug(`...unified the '${
|
|
188
|
+
if (proofAssertionUnifies) {
|
|
189
|
+
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`, node);
|
|
180
190
|
}
|
|
181
191
|
|
|
182
|
-
return
|
|
192
|
+
return proofAssertionUnifies;
|
|
183
193
|
}
|
|
184
194
|
|
|
185
|
-
|
|
186
|
-
let
|
|
195
|
+
unifySubproof(subproof, substitutions, context) {
|
|
196
|
+
let subproofUnifies = false;
|
|
197
|
+
|
|
198
|
+
const node = this.getNode(),
|
|
199
|
+
premiseString = this.getString(),
|
|
200
|
+
subproofString = subproof.getString();
|
|
201
|
+
|
|
202
|
+
context.trace(`Unifying the '${subproofString}' subproof with the '${premiseString}' premise...`, node);
|
|
187
203
|
|
|
188
204
|
const specificContext = context; ///
|
|
189
205
|
|
|
@@ -193,14 +209,30 @@ export default define(class Premise extends Element {
|
|
|
193
209
|
|
|
194
210
|
context = specificContext; ///
|
|
195
211
|
|
|
196
|
-
const statement =
|
|
197
|
-
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
212
|
+
const statement = this.getStatement();
|
|
198
213
|
|
|
199
|
-
if (
|
|
200
|
-
|
|
214
|
+
if (statement !== null) {
|
|
215
|
+
const statementNode = statement.getNode(),
|
|
216
|
+
subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
217
|
+
|
|
218
|
+
if (subproofAssertionNode !== null) {
|
|
219
|
+
const context = generalContext, ///
|
|
220
|
+
assertionNode = subproofAssertionNode, ///
|
|
221
|
+
assertion = context.findAssertionByAssertionNode(assertionNode)
|
|
222
|
+
|
|
223
|
+
if (assertion !== null) {
|
|
224
|
+
const subproofAssertion = assertion; ///
|
|
225
|
+
|
|
226
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
201
229
|
}
|
|
202
230
|
|
|
203
|
-
|
|
231
|
+
if (subproofUnifies) {
|
|
232
|
+
context.debug(`...unified the '${subproofString}' subproof with the '${premiseString}' premise.`, node);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return subproofUnifies;
|
|
204
236
|
}
|
|
205
237
|
|
|
206
238
|
toJSON() {
|
package/src/element/proof.js
CHANGED
|
@@ -16,12 +16,12 @@ export default define(class Proof extends Element {
|
|
|
16
16
|
return this.derivation;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
getLastProofAssertion() { return this.derivation.getLastProofAssertion(); }
|
|
20
20
|
|
|
21
21
|
getStatement() {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
statement =
|
|
22
|
+
const lastProofAssertion = this.getLastProofAssertion(),
|
|
23
|
+
lastProofAssertionStatement = lastProofAssertion.getStatement(),
|
|
24
|
+
statement = lastProofAssertionStatement; ///
|
|
25
25
|
|
|
26
26
|
return statement;
|
|
27
27
|
}
|
|
@@ -36,9 +36,9 @@ export default define(class Proof extends Element {
|
|
|
36
36
|
const derivationVerifies = this.derivation.verify(substitutions, context);
|
|
37
37
|
|
|
38
38
|
if (derivationVerifies) {
|
|
39
|
-
const
|
|
39
|
+
const lastProofAssertion = context.getLastProofAssertion();
|
|
40
40
|
|
|
41
|
-
if (
|
|
41
|
+
if (lastProofAssertion !== null) {
|
|
42
42
|
const statement = this.getStatement(),
|
|
43
43
|
conclusionStatement = conclusion.getStatement(),
|
|
44
44
|
conclusionStatementEqualToStatement = conclusionStatement.isEqualTo(statement);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Element from "../element";
|
|
4
|
+
|
|
5
|
+
import { equateStatements } from "../process/equate";
|
|
6
|
+
|
|
7
|
+
export default class ProofAssertion extends Element {
|
|
8
|
+
constructor(context, string, node, statement) {
|
|
9
|
+
super(context, string, node);
|
|
10
|
+
|
|
11
|
+
this.statement = statement;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
getStatement() {
|
|
15
|
+
return this.statement;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
isProofAssertion() {
|
|
19
|
+
const proofAssertion = true;
|
|
20
|
+
|
|
21
|
+
return proofAssertion;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
compareStatement(statement, context) {
|
|
25
|
+
let comparesToStatement = false;
|
|
26
|
+
|
|
27
|
+
const statementString = statement.getString(),
|
|
28
|
+
proofAssertionString = this.getString();
|
|
29
|
+
|
|
30
|
+
context.trace(`Comparing the '${statementString}' statement to the '${proofAssertionString}' proof assertion...`);
|
|
31
|
+
|
|
32
|
+
const leftStatement = statement, ///
|
|
33
|
+
rightStatement = this.statement, ///
|
|
34
|
+
leftStatementNode = leftStatement.getNode(),
|
|
35
|
+
rightStatementNode = rightStatement.getNode(),
|
|
36
|
+
statementsEquate = equateStatements(leftStatementNode, rightStatementNode, context);
|
|
37
|
+
|
|
38
|
+
if (statementsEquate) {
|
|
39
|
+
comparesToStatement = true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (comparesToStatement) {
|
|
43
|
+
context.debug(`...compared the '${statementString}' statement to the '${proofAssertionString}' proof assertion.`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return comparesToStatement;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
unifyStatement(statement, substitutions, context) {
|
|
50
|
+
let statementUnifies = false;
|
|
51
|
+
|
|
52
|
+
if (this.statement !== null) {
|
|
53
|
+
const node = this.getNode(),
|
|
54
|
+
premiseString = this.getString(), ///
|
|
55
|
+
statementString = statement.getString();
|
|
56
|
+
|
|
57
|
+
context.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise...`, node);
|
|
58
|
+
|
|
59
|
+
const specificContext = context; ///
|
|
60
|
+
|
|
61
|
+
context = this.getContext(); ///
|
|
62
|
+
|
|
63
|
+
const generalContext = context; ///
|
|
64
|
+
|
|
65
|
+
context = specificContext; ///
|
|
66
|
+
|
|
67
|
+
statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
68
|
+
|
|
69
|
+
if (statementUnifies) {
|
|
70
|
+
context.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`, node);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return statementUnifies;
|
|
75
|
+
}
|
|
76
|
+
}
|
package/src/element/reference.js
CHANGED
|
@@ -71,13 +71,15 @@ export default define(class Reference extends Element {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
validateMetavariable(context) {
|
|
74
|
-
let metavariableValidates;
|
|
74
|
+
let metavariableValidates = false;
|
|
75
75
|
|
|
76
76
|
const referenceMetaType = referenceMetaTypeFromNothing(),
|
|
77
77
|
metaType = referenceMetaType, ///
|
|
78
78
|
metavariableValidatesGivenMetaType = this.metavariable.validateGivenMetaType(metaType, context);
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
if (metavariableValidatesGivenMetaType) {
|
|
81
|
+
metavariableValidates = true;
|
|
82
|
+
}
|
|
81
83
|
|
|
82
84
|
return metavariableValidates;
|
|
83
85
|
}
|
package/src/element/rule.js
CHANGED
|
@@ -165,68 +165,68 @@ export default define(class Rule extends Element {
|
|
|
165
165
|
return statementUnifiesWithConclusion;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
let
|
|
168
|
+
unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context) {
|
|
169
|
+
let statementAndSubproofOrProofAssertionsUnify = false;
|
|
170
170
|
|
|
171
171
|
const { Substitutions } = elements,
|
|
172
172
|
substitutions = Substitutions.fromNothing(),
|
|
173
173
|
statementUnifiesWithConclusion = this.unifyStatementWithConclusion(statement, substitutions, context);
|
|
174
174
|
|
|
175
175
|
if (statementUnifiesWithConclusion) {
|
|
176
|
-
const
|
|
176
|
+
const subproofOrProofAssertionsUnifiesWithPremises = this.unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, substitutions, context);
|
|
177
177
|
|
|
178
|
-
if (
|
|
178
|
+
if (subproofOrProofAssertionsUnifiesWithPremises) {
|
|
179
179
|
const substitutionsResolved = substitutions.areResolved();
|
|
180
180
|
|
|
181
181
|
if (substitutionsResolved) {
|
|
182
|
-
|
|
182
|
+
statementAndSubproofOrProofAssertionsUnify = true;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
return
|
|
187
|
+
return statementAndSubproofOrProofAssertionsUnify;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
let
|
|
190
|
+
unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, substitutions, context) {
|
|
191
|
+
let subproofOrProofAssertionsUnifiesWithPremise = false;
|
|
192
192
|
|
|
193
|
-
if (!
|
|
193
|
+
if (!subproofOrProofAssertionsUnifiesWithPremise) {
|
|
194
194
|
const premiseUnifiesIndependently = premise.unifyIndependently(substitutions, context);
|
|
195
195
|
|
|
196
196
|
if (premiseUnifiesIndependently) {
|
|
197
|
-
|
|
197
|
+
subproofOrProofAssertionsUnifiesWithPremise = true;
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
if (!
|
|
202
|
-
const
|
|
203
|
-
const
|
|
201
|
+
if (!subproofOrProofAssertionsUnifiesWithPremise) {
|
|
202
|
+
const subproofOrProofAssertion = extract(subproofOrProofAssertions, (subproofOrProofAssertion) => {
|
|
203
|
+
const subproofOrProofAssertionUnifies = premise.unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, context);
|
|
204
204
|
|
|
205
|
-
if (
|
|
205
|
+
if (subproofOrProofAssertionUnifies) {
|
|
206
206
|
return true;
|
|
207
207
|
}
|
|
208
208
|
}) || null;
|
|
209
209
|
|
|
210
|
-
if (
|
|
211
|
-
|
|
210
|
+
if (subproofOrProofAssertion !== null) {
|
|
211
|
+
subproofOrProofAssertionsUnifiesWithPremise = true;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
return
|
|
215
|
+
return subproofOrProofAssertionsUnifiesWithPremise;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, substitutions, context) {
|
|
219
|
+
subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
|
|
220
220
|
|
|
221
|
-
const
|
|
222
|
-
const stepUnifiesWithPremise = this.
|
|
221
|
+
const subproofOrProofAssertionsUnifiesWithPremises = backwardsEvery(this.premises, (premise) => {
|
|
222
|
+
const stepUnifiesWithPremise = this.unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, substitutions, context);
|
|
223
223
|
|
|
224
224
|
if (stepUnifiesWithPremise) {
|
|
225
225
|
return true;
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
228
|
|
|
229
|
-
return
|
|
229
|
+
return subproofOrProofAssertionsUnifiesWithPremises;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
toJSON() {
|
package/src/element/statement.js
CHANGED
|
@@ -254,19 +254,19 @@ export default define(class Statement extends Element {
|
|
|
254
254
|
return unifiesIndependently;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
|
|
258
|
-
let
|
|
257
|
+
compareSubproofOrProofAssertions(subproofOrProofAssertions, context) {
|
|
258
|
+
let comparesToSubproofOrProofAssertions;
|
|
259
259
|
|
|
260
|
-
|
|
260
|
+
comparesToSubproofOrProofAssertions = backwardsSome(subproofOrProofAssertions, (subproofOrProofAssertion) => {
|
|
261
261
|
const statement = this, ///
|
|
262
|
-
|
|
262
|
+
subproofOrProofAssertionComparesToStatement = subproofOrProofAssertion.compareStatement(statement, context);
|
|
263
263
|
|
|
264
|
-
if (
|
|
264
|
+
if (subproofOrProofAssertionComparesToStatement) {
|
|
265
265
|
return true;
|
|
266
266
|
}
|
|
267
267
|
});
|
|
268
268
|
|
|
269
|
-
return
|
|
269
|
+
return comparesToSubproofOrProofAssertions;
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
toJSON() {
|
package/src/element/step.js
CHANGED
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import Element from "../element";
|
|
4
3
|
import elements from "../elements";
|
|
4
|
+
import ProofAssertion from "./proofAssertion";
|
|
5
5
|
import TemporaryContext from "../context/temporary";
|
|
6
6
|
|
|
7
7
|
import { define } from "../elements";
|
|
8
|
-
import { instantiateStep } from "../process/instantiate";
|
|
9
8
|
import { unifyStatements } from "../utilities/unification";
|
|
10
|
-
import { equateStatements } from "../process/equate";
|
|
11
|
-
import { stepFromStepNode } from "../utilities/element";
|
|
12
9
|
import { propertyAssertionFromStatement } from "../utilities/statement";
|
|
13
10
|
|
|
14
|
-
export default define(class Step extends
|
|
11
|
+
export default define(class Step extends ProofAssertion {
|
|
15
12
|
constructor(context, string, node, statement, reference, satisfiesAssertion) {
|
|
16
|
-
super(context, string, node);
|
|
13
|
+
super(context, string, node, statement);
|
|
17
14
|
|
|
18
|
-
this.statement = statement;
|
|
19
15
|
this.reference = reference;
|
|
20
16
|
this.satisfiesAssertion = satisfiesAssertion;
|
|
21
17
|
}
|
|
22
18
|
|
|
23
|
-
getStatement() {
|
|
24
|
-
return this.statement;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
19
|
getReference() {
|
|
28
20
|
return this.reference;
|
|
29
21
|
}
|
|
@@ -51,16 +43,11 @@ export default define(class Step extends Element {
|
|
|
51
43
|
return stated;
|
|
52
44
|
}
|
|
53
45
|
|
|
54
|
-
isStep() {
|
|
55
|
-
const step = true;
|
|
56
|
-
|
|
57
|
-
return step;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
46
|
compareTermAndPropertyRelation(term, propertyRelation, context) {
|
|
61
47
|
let comparesToTermAndPropertyRelation = false;
|
|
62
48
|
|
|
63
|
-
const
|
|
49
|
+
const statement = this.getStatement(),
|
|
50
|
+
propertyAssertion = propertyAssertionFromStatement(statement, context);
|
|
64
51
|
|
|
65
52
|
if (propertyAssertion !== null) {
|
|
66
53
|
comparesToTermAndPropertyRelation = propertyAssertion.compareTermAndPropertyRelation(term, propertyRelation, context);
|
|
@@ -81,7 +68,9 @@ export default define(class Step extends Element {
|
|
|
81
68
|
|
|
82
69
|
context.trace(`Verifying the '${stepString}' step...`, node);
|
|
83
70
|
|
|
84
|
-
|
|
71
|
+
const statement = this.getStatement();
|
|
72
|
+
|
|
73
|
+
if (statement === null) {
|
|
85
74
|
context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`, node);
|
|
86
75
|
} else {
|
|
87
76
|
const referenceVerifies = this.verifyReference(context);
|
|
@@ -91,11 +80,11 @@ export default define(class Step extends Element {
|
|
|
91
80
|
|
|
92
81
|
if (satisfiesAssertioVeriries) {
|
|
93
82
|
const stated = this.isStated(),
|
|
94
|
-
statementValidates =
|
|
83
|
+
statementValidates = statement.validate(assignments, stated, context);
|
|
95
84
|
|
|
96
85
|
if (statementValidates) {
|
|
97
86
|
const statementUnifies = unifyStatements.some((unifyStatement) => {
|
|
98
|
-
const statementUnifies = unifyStatement(
|
|
87
|
+
const statementUnifies = unifyStatement(statement, this.reference, this.satisfiesAssertion, substitutions, context);
|
|
99
88
|
|
|
100
89
|
if (statementUnifies) {
|
|
101
90
|
return true;
|
|
@@ -103,11 +92,9 @@ export default define(class Step extends Element {
|
|
|
103
92
|
});
|
|
104
93
|
|
|
105
94
|
if (statementUnifies) {
|
|
106
|
-
const
|
|
107
|
-
step = Step.fromStatement(this.statement, context),
|
|
108
|
-
stepOrSubproof = step; ///
|
|
95
|
+
const subproofOrProofAssertion = this; ///
|
|
109
96
|
|
|
110
|
-
context.
|
|
97
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
111
98
|
|
|
112
99
|
this.setContext(context);
|
|
113
100
|
|
|
@@ -170,20 +157,6 @@ export default define(class Step extends Element {
|
|
|
170
157
|
return satisfiesAssertionVerifies;
|
|
171
158
|
}
|
|
172
159
|
|
|
173
|
-
compareStatment(statement, context) {
|
|
174
|
-
let comparesToStatement;
|
|
175
|
-
|
|
176
|
-
const leftStatement = statement, ///
|
|
177
|
-
rightStatement = this.statement, ///
|
|
178
|
-
leftStatementNode = leftStatement.getNode(),
|
|
179
|
-
rightStatementNode = rightStatement.getNode(),
|
|
180
|
-
statementsEquate = equateStatements(leftStatementNode, rightStatementNode, context);
|
|
181
|
-
|
|
182
|
-
comparesToStatement = statementsEquate; ///
|
|
183
|
-
|
|
184
|
-
return comparesToStatement;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
160
|
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
188
161
|
let unifiesWithSatisfiesAssertion = false;
|
|
189
162
|
|
|
@@ -218,15 +191,4 @@ export default define(class Step extends Element {
|
|
|
218
191
|
}
|
|
219
192
|
|
|
220
193
|
static name = "Step";
|
|
221
|
-
|
|
222
|
-
static fromStatement(statement, context) {
|
|
223
|
-
const statementString = statement.getString(),
|
|
224
|
-
stepString = statementString, ///
|
|
225
|
-
string = `${stepString}
|
|
226
|
-
`,
|
|
227
|
-
stepNode = instantiateStep(string, context),
|
|
228
|
-
step = stepFromStepNode(stepNode, context);
|
|
229
|
-
|
|
230
|
-
return step;;
|
|
231
|
-
}
|
|
232
194
|
});
|
|
@@ -10,35 +10,35 @@ import { define } from "../elements";
|
|
|
10
10
|
const { last } = arrayUtilities;
|
|
11
11
|
|
|
12
12
|
export default define(class SubDerivation extends Element {
|
|
13
|
-
constructor(context, string, node,
|
|
13
|
+
constructor(context, string, node, subproofOrProofAssertions) {
|
|
14
14
|
super(context, string, node);
|
|
15
15
|
|
|
16
|
-
this.
|
|
16
|
+
this.subproofOrProofAssertions = subproofOrProofAssertions;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
return this.
|
|
19
|
+
getSubproofOrProofAssertions() {
|
|
20
|
+
return this.subproofOrProofAssertions;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
23
|
+
getLastProofAssertion() {
|
|
24
|
+
const lastSubproofOrProofAssertion = last(this.subproofOrProofAssertions),
|
|
25
|
+
lastProofAssertion = lastSubproofOrProofAssertion; ///
|
|
26
26
|
|
|
27
|
-
return
|
|
27
|
+
return lastProofAssertion;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
verify(substitutions, context) {
|
|
31
31
|
let verifies;
|
|
32
32
|
|
|
33
|
-
verifies = this.
|
|
33
|
+
verifies = this.subproofOrProofAssertions.every((subproofOrProofAssertion) => { ///
|
|
34
34
|
const assignments = [],
|
|
35
|
-
|
|
35
|
+
subproofOrProofAssertionVarifies = subproofOrProofAssertion.verify(substitutions, assignments, context);
|
|
36
36
|
|
|
37
|
-
if (
|
|
37
|
+
if (subproofOrProofAssertionVarifies) {
|
|
38
38
|
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
39
39
|
|
|
40
40
|
if (assignmentsAssigned) {
|
|
41
|
-
context.
|
|
41
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
42
42
|
|
|
43
43
|
return true;
|
|
44
44
|
}
|